@skalfa/skalfa-component 1.0.8 → 1.0.10
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/accordion/Accordion.component.js +2 -3
- package/dist/breadcrumb/Breadcrumb.component.js +2 -3
- package/dist/button/Button.component.d.ts +2 -1
- package/dist/button/Button.component.js +2 -2
- package/dist/carousel/Carousel.component.js +2 -3
- package/dist/chip/Chip.component.js +2 -3
- package/dist/contexts-mock.d.ts +2 -0
- package/dist/contexts-mock.js +10 -0
- package/dist/input/Checkbox.component.js +2 -3
- package/dist/input/Input.component.d.ts +3 -2
- package/dist/input/Input.component.js +3 -3
- package/dist/input/InputCheckbox.component.js +1 -1
- package/dist/input/InputCurrency.component.d.ts +3 -2
- package/dist/input/InputCurrency.component.js +3 -3
- package/dist/input/InputDate.component.js +4 -5
- package/dist/input/InputDatetime.component.d.ts +3 -2
- package/dist/input/InputDatetime.component.js +3 -3
- package/dist/input/InputDocument.component.js +7 -8
- package/dist/input/InputImage.component.js +3 -4
- package/dist/input/InputNumber.component.js +3 -4
- package/dist/input/InputPassword.component.js +3 -3
- package/dist/input/InputRadio.component.js +1 -1
- package/dist/input/InputTime.component.js +3 -3
- package/dist/input/InputValues.component.js +3 -4
- package/dist/input/Select.component.js +6 -7
- package/dist/modal/FloatingPage.component.d.ts +3 -1
- package/dist/modal/FloatingPage.component.js +7 -3
- package/dist/modal/Modal.component.js +1 -2
- package/dist/modal/ModalConfirm.component.d.ts +2 -2
- package/dist/modal/ModalConfirm.component.js +14 -12
- package/dist/modal/Toast.component.js +1 -2
- package/dist/nav/Bottombar.component.d.ts +2 -2
- package/dist/nav/Bottombar.component.js +7 -8
- package/dist/nav/Footer.component.d.ts +2 -2
- package/dist/nav/Footer.component.js +6 -7
- package/dist/nav/Headbar.component.js +2 -3
- package/dist/nav/Navbar.component.d.ts +2 -2
- package/dist/nav/Navbar.component.js +3 -4
- package/dist/nav/Sidebar.component.d.ts +3 -7
- package/dist/nav/Sidebar.component.js +14 -17
- package/dist/supervision/FormSupervision.component.d.ts +4 -29
- package/dist/supervision/FormSupervision.component.js +84 -136
- package/dist/supervision/TableSupervision.component.d.ts +17 -26
- package/dist/supervision/TableSupervision.component.js +207 -193
- package/dist/table/ControlBar.component.js +15 -16
- package/dist/table/FilterComponent.js +4 -6
- package/dist/table/Pagination.component.js +2 -3
- package/dist/table/Table.component.js +3 -4
- package/dist/wrap/Swipe.component.js +2 -2
- package/package.json +18 -10
- package/src/accordion/Accordion.component.tsx +3 -3
- package/src/breadcrumb/Breadcrumb.component.tsx +4 -4
- package/src/button/Button.component.tsx +3 -3
- package/src/carousel/Carousel.component.tsx +4 -4
- package/src/chip/Chip.component.tsx +3 -4
- package/src/contexts-mock.ts +6 -0
- package/src/input/Checkbox.component.tsx +3 -3
- package/src/input/Input.component.tsx +6 -6
- package/src/input/InputCheckbox.component.tsx +1 -1
- package/src/input/InputCurrency.component.tsx +6 -6
- package/src/input/InputDate.component.tsx +6 -7
- package/src/input/InputDatetime.component.tsx +6 -6
- package/src/input/InputDocument.component.tsx +9 -9
- package/src/input/InputImage.component.tsx +4 -5
- package/src/input/InputNumber.component.tsx +7 -8
- package/src/input/InputPassword.component.tsx +4 -4
- package/src/input/InputRadio.component.tsx +1 -1
- package/src/input/InputTime.component.tsx +4 -4
- package/src/input/InputValues.component.tsx +5 -6
- package/src/input/Select.component.tsx +10 -10
- package/src/modal/FloatingPage.component.tsx +33 -3
- package/src/modal/Modal.component.tsx +1 -2
- package/src/modal/ModalConfirm.component.tsx +34 -49
- package/src/modal/Toast.component.tsx +1 -2
- package/src/nav/Bottombar.component.tsx +9 -10
- package/src/nav/Footer.component.tsx +8 -9
- package/src/nav/Headbar.component.tsx +3 -3
- package/src/nav/Navbar.component.tsx +9 -10
- package/src/nav/Sidebar.component.tsx +55 -46
- package/src/supervision/FormSupervision.component.tsx +203 -224
- package/src/supervision/TableSupervision.component.tsx +420 -455
- package/src/table/ControlBar.component.tsx +16 -16
- package/src/table/FilterComponent.tsx +9 -11
- package/src/table/Pagination.component.tsx +6 -6
- package/src/table/Table.component.tsx +5 -5
- package/src/wrap/Swipe.component.tsx +3 -3
- package/src/types.d.ts +0 -7
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ControlBarComponent = ControlBarComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
6
7
|
const react_1 = require("react");
|
|
7
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
8
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
10
9
|
const _contexts_1 = require("@contexts");
|
|
11
10
|
const InputCheckbox_component_1 = require("../input/InputCheckbox.component");
|
|
@@ -70,7 +69,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
70
69
|
}
|
|
71
70
|
};
|
|
72
71
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("control-bar", className), children: (isSm ? [
|
|
73
|
-
...(options?.filter((op
|
|
72
|
+
...(options?.filter((op) => op == "SEARCH" || op == "REFRESH") || []),
|
|
74
73
|
...(options && options?.length > 1 ? ['MOBILE_OPTION'] : [])
|
|
75
74
|
] : options)?.map((option, key) => {
|
|
76
75
|
{
|
|
@@ -79,7 +78,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
79
78
|
// =========================>
|
|
80
79
|
}
|
|
81
80
|
if (option == "CREATE") {
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-create-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-create-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/plus", label: "Tambah Data", size: "sm", onClick: () => setToggle(`MODAL_FORM_${_utils_1.conversion.strSnake(id).toUpperCase()}`) }) }, "button-add"));
|
|
83
82
|
}
|
|
84
83
|
{
|
|
85
84
|
// =========================>
|
|
@@ -88,7 +87,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
88
87
|
}
|
|
89
88
|
if (option == "SEARCH") {
|
|
90
89
|
const searchable = !!options?.find((option) => option == "SEARCHABLE");
|
|
91
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("control-bar-search-wrapper", searchable ? "control-bar-search-wrapper-searchable" : "control-bar-search-wrapper-standalone"), children: (0, jsx_runtime_1.jsx)(Input_component_1.InputComponent, { ref: searchRef, name: "search", placeholder: "Cari disini...", rightIcon:
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("control-bar-search-wrapper", searchable ? "control-bar-search-wrapper-searchable" : "control-bar-search-wrapper-standalone"), children: (0, jsx_runtime_1.jsx)(Input_component_1.InputComponent, { ref: searchRef, name: "search", placeholder: "Cari disini...", rightIcon: "solid/magnifying-glass", value: search, onChange: (e) => onSearch?.(e), className: (0, _utils_1.cn)("control-bar-search-input", searchable && "control-bar-search-input-searchable") }) }, key));
|
|
92
91
|
}
|
|
93
92
|
{
|
|
94
93
|
// =========================>
|
|
@@ -96,7 +95,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
96
95
|
// =========================>
|
|
97
96
|
}
|
|
98
97
|
if (option == "SEARCHABLE") {
|
|
99
|
-
return searchableOptions?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-searchable-wrapper", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: "searchableColumn", leftIcon:
|
|
98
|
+
return searchableOptions?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-searchable-wrapper", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: "searchableColumn", leftIcon: "solid/search", options: searchableOptions?.map((column) => {
|
|
100
99
|
return {
|
|
101
100
|
label: column.label,
|
|
102
101
|
value: column.selector,
|
|
@@ -109,7 +108,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
109
108
|
// =========================>
|
|
110
109
|
}
|
|
111
110
|
if (option == "SELECTABLE") {
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "control-bar-button-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "control-bar-button-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/eye-low-vision", variant: "outline", className: "control-bar-icon-button", onClick: () => setToggle("SELECTABLE"), size: "sm" }), (0, jsx_runtime_1.jsx)(OutsideClick_component_1.OutsideClickComponent, { onOutsideClick: () => setToggle("SELECTABLE", false), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("control-bar-dropdown", !toggle.SELECTABLE && "control-bar-dropdown-hidden"), children: [(0, jsx_runtime_1.jsx)("p", { className: 'control-bar-dropdown-title', children: "Kolom Ditampilkan" }), (0, jsx_runtime_1.jsx)(InputCheckbox_component_1.InputCheckboxComponent, { vertical: true, name: "show_column", options: selectableOptions?.map((option) => {
|
|
113
112
|
return {
|
|
114
113
|
label: option.label,
|
|
115
114
|
value: option.selector,
|
|
@@ -122,9 +121,9 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
122
121
|
// =========================>
|
|
123
122
|
}
|
|
124
123
|
if (option == "SORT") {
|
|
125
|
-
return sortableOptions?.length ? ((0, jsx_runtime_1.jsxs)("div", { className: "control-bar-button-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
124
|
+
return sortableOptions?.length ? ((0, jsx_runtime_1.jsxs)("div", { className: "control-bar-button-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/sort", variant: "outline", className: "control-bar-icon-button", onClick: () => setToggle("SORT"), size: "sm" }), (0, jsx_runtime_1.jsx)(OutsideClick_component_1.OutsideClickComponent, { onOutsideClick: () => setToggle("SORT", false), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("control-bar-dropdown", !toggle.SORT && "control-bar-dropdown-hidden"), children: [(0, jsx_runtime_1.jsx)("p", { className: 'control-bar-dropdown-title', children: "Urut Berdasarkan" }), (0, jsx_runtime_1.jsx)("div", { className: 'control-bar-sort-list', children: sortableOptions?.map((option, key) => {
|
|
126
125
|
const sortBy = sort?.find((s) => s.split(" ")?.at(0) == option?.selector)?.split(" ")?.at(1) || "";
|
|
127
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)('control-bar-sort-item', !!sortBy && "control-bar-sort-item-active"), onClick: () => onChangeSort(option.selector), children: [(0, jsx_runtime_1.jsx)("p", { children: option.label }), sortBy && ((0, jsx_runtime_1.jsxs)("div", { className: 'control-bar-sort-active-icon', children: [(0, jsx_runtime_1.jsx)(
|
|
126
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)('control-bar-sort-item', !!sortBy && "control-bar-sort-item-active"), onClick: () => onChangeSort(option.selector), children: [(0, jsx_runtime_1.jsx)("p", { children: option.label }), sortBy && ((0, jsx_runtime_1.jsxs)("div", { className: 'control-bar-sort-active-icon', children: [(0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: sortBy == "desc" ? "solid/arrow-down-z-a" : "solid/arrow-up-a-z", className: 'control-bar-sort-icon' }), sort?.length && sort?.length > 1 && (0, jsx_runtime_1.jsx)("span", { className: 'control-bar-sort-badge', children: sort.findIndex((s) => s.split(" ")?.at(0) == option?.selector) + 1 })] }))] }, key));
|
|
128
127
|
}) })] }) })] }, key)) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
129
128
|
}
|
|
130
129
|
{
|
|
@@ -133,7 +132,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
133
132
|
// =========================>
|
|
134
133
|
}
|
|
135
134
|
if (option == "REFRESH") {
|
|
136
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper-refresh", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper-refresh", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/refresh", variant: "outline", className: "control-bar-icon-button", onClick: () => onRefresh?.(), size: "sm" }) }, key));
|
|
137
136
|
}
|
|
138
137
|
{
|
|
139
138
|
// =========================>
|
|
@@ -141,7 +140,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
141
140
|
// =========================>
|
|
142
141
|
}
|
|
143
142
|
if (option == "FILTER") {
|
|
144
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
143
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/sliders", label: "Filter", variant: "outline", className: "control-bar-filter-button", onClick: () => setToggle("FILTER"), size: "sm" }) }, key));
|
|
145
144
|
}
|
|
146
145
|
{
|
|
147
146
|
// =========================>
|
|
@@ -149,17 +148,17 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
149
148
|
// =========================>
|
|
150
149
|
}
|
|
151
150
|
if (option == "MOBILE_OPTION") {
|
|
152
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
151
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "control-bar-button-wrapper", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/ellipsis-v", variant: "outline", className: "control-bar-icon-button", onClick: () => setToggle("MOBILE_OPTION"), size: "sm" }) }, key));
|
|
153
152
|
}
|
|
154
153
|
return option;
|
|
155
|
-
}) }), !!filterableColumns && !!filterableColumns?.length && ((0, jsx_runtime_1.jsx)(FilterComponent_1.FilterComponent, { className: (0, _utils_1.cn)(!toggle.FILTER ? "control-bar-filter-panel-hidden" : "control-bar-filter-panel"), columns: filterableColumns, onChange: onFilter, value: filter, onMinimize: () => setToggle("FILTER") })), isSm && ((0, jsx_runtime_1.jsx)(BottomSheet_component_1.BottomSheetComponent, { show: !!toggle["MOBILE_OPTION"], onClose: () => setToggle("MOBILE_OPTION", false), maxSize: "98vh", children: (0, jsx_runtime_1.jsx)("div", { className: 'control-bar-mobile-container', children: options?.filter((op, iop) => (iop != 0 && op != "CREATE" && op != "REFRESH"))?.map((option, key) => {
|
|
154
|
+
}) }), !!filterableColumns && !!filterableColumns?.length && ((0, jsx_runtime_1.jsx)(FilterComponent_1.FilterComponent, { className: (0, _utils_1.cn)(!toggle.FILTER ? "control-bar-filter-panel-hidden" : "control-bar-filter-panel"), columns: filterableColumns, onChange: onFilter, value: filter, onMinimize: () => setToggle("FILTER") })), isSm && ((0, jsx_runtime_1.jsx)(BottomSheet_component_1.BottomSheetComponent, { show: !!toggle["MOBILE_OPTION"], onClose: () => setToggle("MOBILE_OPTION", false), maxSize: "98vh", children: (0, jsx_runtime_1.jsx)("div", { className: 'control-bar-mobile-container', children: options?.filter((op, iop) => (iop != 0 && op != "CREATE" && op != "SEARCH" && op != "REFRESH"))?.map((option, key) => {
|
|
156
155
|
{
|
|
157
156
|
// =========================>
|
|
158
157
|
// ## Search Field
|
|
159
158
|
// =========================>
|
|
160
159
|
}
|
|
161
160
|
if (option == "SEARCH") {
|
|
162
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Input_component_1.InputComponent, { name: "search", placeholder: "Cari disini...", rightIcon:
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Input_component_1.InputComponent, { name: "search", placeholder: "Cari disini...", rightIcon: "solid/magnifying-glass", value: search, onChange: (e) => onSearch?.(e) }) }, key));
|
|
163
162
|
}
|
|
164
163
|
{
|
|
165
164
|
// =========================>
|
|
@@ -167,7 +166,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
167
166
|
// =========================>
|
|
168
167
|
}
|
|
169
168
|
if (option == "SEARCHABLE") {
|
|
170
|
-
return searchableOptions?.length ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: "searchableColumn", leftIcon:
|
|
169
|
+
return searchableOptions?.length ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: "searchableColumn", leftIcon: "solid/search", options: searchableOptions?.map((column) => {
|
|
171
170
|
return {
|
|
172
171
|
label: column.label,
|
|
173
172
|
value: column.selector,
|
|
@@ -195,7 +194,7 @@ function ControlBarComponent({ id = "", options, className, search, onSearch, se
|
|
|
195
194
|
if (option == "SORT") {
|
|
196
195
|
return sortableOptions?.length ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: 'control-bar-mobile-title', children: "Urut Berdasarkan" }), (0, jsx_runtime_1.jsx)("div", { className: 'flex flex-col', children: sortableOptions?.map((option, key) => {
|
|
197
196
|
const sortBy = sort?.find((s) => s.split(" ")?.at(0) == option?.selector)?.split(" ")?.at(1) || "";
|
|
198
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)('control-bar-mobile-sort-item', !!sortBy && "control-bar-mobile-sort-item-active"), onClick: () => onChangeSort(option.selector), children: [(0, jsx_runtime_1.jsx)("p", { children: option.label }), sortBy && ((0, jsx_runtime_1.jsxs)("div", { className: 'text-primary', children: [(0, jsx_runtime_1.jsx)(
|
|
197
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)('control-bar-mobile-sort-item', !!sortBy && "control-bar-mobile-sort-item-active"), onClick: () => onChangeSort(option.selector), children: [(0, jsx_runtime_1.jsx)("p", { children: option.label }), sortBy && ((0, jsx_runtime_1.jsxs)("div", { className: 'text-primary', children: [(0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: sortBy == "desc" ? "solid/arrow-down-z-a" : "solid/arrow-up-a-z", className: 'text-xs' }), sort?.length && sort?.length > 1 && (0, jsx_runtime_1.jsx)("span", { className: 'text-[9px] ml-1', children: sort.findIndex((s) => s.split(" ")?.at(0) == option?.selector) + 1 })] }))] }, key));
|
|
199
198
|
}) })] }, key)) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
200
199
|
}
|
|
201
200
|
{
|
|
@@ -5,7 +5,6 @@ exports.FilterComponent = FilterComponent;
|
|
|
5
5
|
exports.InputFilterValueComponent = InputFilterValueComponent;
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
10
9
|
const Button_component_1 = require("../button/Button.component");
|
|
11
10
|
const Chip_component_1 = require("../chip/Chip.component");
|
|
@@ -16,7 +15,6 @@ const InputNumber_component_1 = require("../input/InputNumber.component");
|
|
|
16
15
|
const Modal_component_1 = require("../modal/Modal.component");
|
|
17
16
|
const Select_component_1 = require("../input/Select.component");
|
|
18
17
|
const _contexts_1 = require("@contexts");
|
|
19
|
-
const free_regular_svg_icons_1 = require("@fortawesome/free-regular-svg-icons");
|
|
20
18
|
const FILTER_OPERATORS = [
|
|
21
19
|
{ label: "Cari", value: "li" },
|
|
22
20
|
{ label: "Sama", value: "eq" },
|
|
@@ -65,16 +63,16 @@ function FilterComponent({ columns, onChange, value, onMinimize, className = "",
|
|
|
65
63
|
(0, react_1.useEffect)(() => {
|
|
66
64
|
localStorage.setItem(BOOKMARK_KEY, JSON.stringify(bookmarks));
|
|
67
65
|
}, [bookmarks]);
|
|
68
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("filter-panel", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-header", children: [(0, jsx_runtime_1.jsx)("p", { className: (0, _utils_1.cn)((0, _utils_1.pcn)(className, "title")), children: "Filter" }), (0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-controls", children: [(0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-bookmarks-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("filter-panel", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-header", children: [(0, jsx_runtime_1.jsx)("p", { className: (0, _utils_1.cn)((0, _utils_1.pcn)(className, "title")), children: "Filter" }), (0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-controls", children: [(0, jsx_runtime_1.jsxs)("div", { className: "filter-panel-bookmarks-wrapper", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/bookmark", variant: "outline", paint: "primary", className: "filter-panel-bookmark-btn icon::text-slate-400", size: "xs", onClick: () => setToggle("MODAL_BOOKMARK", { bookmark_id: "new" }) }), !!bookmarks?.length && ((0, jsx_runtime_1.jsx)(Chip_component_1.ChipComponent, { items: bookmarks.slice(0, 5).map((b) => b.name), onClick: (_, index) => setFilters(bookmarks[index]?.filters), onDelete: (_, index) => setBookmarks(bookmarks.filter((_, bi) => bi != index)) })), bookmarks?.length > 5 && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/ellipsis-h", variant: "outline", paint: "primary", className: "filter-panel-bookmark-btn icon::text-slate-400", size: "xs", onClick: () => setToggle("MODAL_BOOKMARK_LIST") }))] }), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/rotate", label: "Bersihkan", variant: "outline", paint: "primary", className: "filter-panel-bookmark-btn icon::text-slate-400", size: "xs", onClick: () => setFilters([]) }), onMinimize && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/chevron-up", variant: "outline", paint: "primary", className: "filter-panel-bookmark-btn icon::text-slate-400", size: "xs", onClick: onMinimize }))] })] }), filters.map((f, i) => {
|
|
69
67
|
const column = columns.find((c) => c.selector === f.column);
|
|
70
68
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "filter-row", children: [i > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "filter-col-logic", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: `filter_logic_${i}`, options: LOGIC_OPTIONS, placeholder: "Dan/Atau", value: f.logic, onChange: (e) => handleChange(i, "logic", e), className: "filter-input-field" }) })), (0, jsx_runtime_1.jsx)("div", { className: i > 0 ? "filter-col-column-with-logic" : "filter-col-column", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: `filter_column_${i}`, options: columns.map((c) => ({
|
|
71
69
|
label: c.label,
|
|
72
70
|
value: c.selector,
|
|
73
|
-
})), placeholder: "Kolom", value: f.column, onChange: (e) => handleChange(i, "column", e), className: "filter-input-field" }) }), (0, jsx_runtime_1.jsx)("div", { className: "filter-col-operator", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: `filter_operator_${i}`, options: FILTER_OPERATORS, placeholder: "Operator", value: f.type, onChange: (e) => handleChange(i, "type", e), className: "filter-input-field" }) }), isSm && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
74
|
-
}), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { label: "Tambahkan", icon:
|
|
71
|
+
})), placeholder: "Kolom", value: f.column, onChange: (e) => handleChange(i, "column", e), className: "filter-input-field" }) }), (0, jsx_runtime_1.jsx)("div", { className: "filter-col-operator", children: (0, jsx_runtime_1.jsx)(Select_component_1.SelectComponent, { name: `filter_operator_${i}`, options: FILTER_OPERATORS, placeholder: "Operator", value: f.type, onChange: (e) => handleChange(i, "type", e), className: "filter-input-field" }) }), isSm && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/times", paint: "danger", variant: "outline", onClick: () => removeFilter(i), size: "xs" })), column && ((0, jsx_runtime_1.jsx)("div", { className: "filter-col-value", children: (0, jsx_runtime_1.jsx)(InputFilterValueComponent, { type: column.type, name: `filter_value_${i}`, placeholder: "...", value: f.value || "", onChange: (e) => handleChange(i, "value", e), options: column.type === "select" && column.options ? column.options : [], className: "filter-input-field", between: f.type === "bw", multiple: ["in", "ni"].includes(f.type || "") }) })), !isSm && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/times", paint: "danger", variant: "outline", onClick: () => removeFilter(i), size: "xs" }))] }, i));
|
|
72
|
+
}), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { label: "Tambahkan", icon: "solid/plus", variant: "outline", paint: "primary", size: isSm ? "xs" : "sm", onClick: addFilter, className: "filter-add-btn" })] }), (0, jsx_runtime_1.jsx)(Modal_component_1.ModalComponent, { show: !!toggle["MODAL_BOOKMARK_LIST"], onClose: () => setToggle("MODAL_BOOKMARK_LIST", false), title: "Bookmark Filter", children: (0, jsx_runtime_1.jsx)("div", { className: "filter-bookmark-list-container", children: bookmarks?.length ? bookmarks?.map((b, key) => ((0, jsx_runtime_1.jsxs)("div", { className: "filter-bookmark-row", children: [(0, jsx_runtime_1.jsx)("p", { className: "filter-bookmark-name", children: b.name }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/plus", variant: "outline", paint: "primary", className: "", size: "xs", onClick: () => {
|
|
75
73
|
setFilters(b.filters);
|
|
76
74
|
setToggle("MODAL_BOOKMARK_LIST", false);
|
|
77
|
-
} }), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon:
|
|
75
|
+
} }), (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/times", variant: "outline", paint: "danger", className: "", size: "xs", onClick: () => setBookmarks(bookmarks.filter((_, bi) => bi != key)) })] })] }, key))) : ((0, jsx_runtime_1.jsx)("div", { className: "filter-bookmark-empty-text", children: " -- Tidak ada Bookmark --" })) }) }), (0, jsx_runtime_1.jsx)(Modal_component_1.ModalComponent, { show: !!toggle["MODAL_BOOKMARK"], onClose: () => setToggle("MODAL_BOOKMARK", false), title: "Bookmark Filter", footer: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-end", children: (0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { label: "Terapkan", onClick: () => {
|
|
78
76
|
let updated = [];
|
|
79
77
|
if (toggle["MODAL_BOOKMARK"]?.bookmark_id == "new") {
|
|
80
78
|
const newBookmark = {
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.PaginationComponent = PaginationComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
6
7
|
const react_1 = require("react");
|
|
7
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
10
9
|
const Button_component_1 = require("../button/Button.component");
|
|
11
10
|
const InputRadio_component_1 = require("../input/InputRadio.component");
|
|
@@ -29,5 +28,5 @@ function PaginationComponent({ paginate = 10, page = 1, totalRow = 0, onChange,
|
|
|
29
28
|
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("pagination-container", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsxs)("div", { className: "pagination-desktop-wrapper", children: [(0, jsx_runtime_1.jsx)(InputRadio_component_1.InputRadioComponent, { name: "paginate", options: [10, 20, 50].map((val) => ({
|
|
30
29
|
value: val,
|
|
31
30
|
label: String(val),
|
|
32
|
-
})), value: paginate, onChange: (e) => onChange?.(totalRow, Number(e), 1), className: "pagination-paginate-select" }), totalRow > paginate && ((0, jsx_runtime_1.jsxs)("div", { className: "pagination-desktop-pages", children: [page > 1 && ((0, jsx_runtime_1.jsx)("button", { className: "pagination-overflow", onClick: () => onChange?.(totalRow, paginate, page - 1), children: (0, jsx_runtime_1.jsx)(
|
|
31
|
+
})), value: paginate, onChange: (e) => onChange?.(totalRow, Number(e), 1), className: "pagination-paginate-select" }), totalRow > paginate && ((0, jsx_runtime_1.jsxs)("div", { className: "pagination-desktop-pages", children: [page > 1 && ((0, jsx_runtime_1.jsx)("button", { className: "pagination-overflow", onClick: () => onChange?.(totalRow, paginate, page - 1), children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-left" }) })), page > 2 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { className: (0, _utils_1.cn)("pagination-item", (0, _utils_1.pcn)(className, "item")), onClick: () => onChange?.(totalRow, paginate, 1), children: "1" }), page > 3 && (0, jsx_runtime_1.jsx)("span", { className: "pagination-overflow", children: "..." })] })), pages.map((p) => ((0, jsx_runtime_1.jsx)("button", { className: (0, _utils_1.cn)("pagination-item", (0, _utils_1.pcn)(className, "item"), p === page && (0, _utils_1.cn)("pagination-item-active", (0, _utils_1.pcn)(className, "active"))), onClick: () => onChange?.(totalRow, paginate, p), children: p }, p))), page < lastPage - 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [page < lastPage - 2 && ((0, jsx_runtime_1.jsx)("span", { className: "pagination-overflow", children: "..." })), (0, jsx_runtime_1.jsx)("button", { className: (0, _utils_1.cn)("pagination-item", (0, _utils_1.pcn)(className, "item")), onClick: () => onChange?.(totalRow, paginate, lastPage), children: lastPage })] })), page < lastPage && ((0, jsx_runtime_1.jsx)("button", { className: "pagination-overflow", onClick: () => onChange?.(totalRow, paginate, page + 1), children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: "solid/chevron-right" }) }))] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "pagination-desktop-info", children: [Math.min(totalRow, paginate * (page - 1) + 1), " - ", Math.min(totalRow, paginate * page), " / ", totalRow] }), (0, jsx_runtime_1.jsxs)("div", { className: "pagination-mobile-wrapper", children: [(0, jsx_runtime_1.jsxs)("div", { className: "pagination-mobile-info", children: [Math.min(totalRow, paginate * (page - 1) + 1), " - ", Math.min(totalRow, paginate * page), " / ", totalRow] }), totalRow > paginate && ((0, jsx_runtime_1.jsxs)("div", { className: "pagination-mobile-controls", children: [page > 1 && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/chevron-left", onClick: () => onChange?.(totalRow, paginate, page - 1), size: "sm" })), page < lastPage && ((0, jsx_runtime_1.jsx)(Button_component_1.ButtonComponent, { icon: "solid/chevron-right", onClick: () => onChange?.(totalRow, paginate, page + 1), size: "sm" }))] }))] })] }));
|
|
33
32
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.TableComponent = TableComponent;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
6
7
|
const react_1 = require("react");
|
|
7
|
-
const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
8
|
-
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
9
8
|
const _utils_1 = require("@utils");
|
|
10
9
|
const ControlBar_component_1 = require("./ControlBar.component");
|
|
11
10
|
const Pagination_component_1 = require("./Pagination.component");
|
|
@@ -41,7 +40,7 @@ function TableComponent({ id, controlBar, columns, data, pagination, loading, so
|
|
|
41
40
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: columnMapping?.map((column, key) => {
|
|
42
41
|
const sortColumn = sortBy?.find((e) => e.split(" ")?.at(0) == column.selector)?.split(" ")?.at(0) || "";
|
|
43
42
|
const sortDirection = sortBy?.find((e) => e.split(" ")?.at(0) == column.selector)?.split(" ")?.at(1) || "";
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("table-head-column", column.sortable && "cursor-pointer", (0, _utils_1.pcn)(className, "head-column")), style: { width: column.width ? column.width : 200 }, onClick: () => column.sortable && onChangeSortBy?.([`${column.selector} ${sortDirection == "desc" ? "asc" : "desc"}`]), children: [column.label, !!sortColumn && ((0, jsx_runtime_1.jsx)(
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("table-head-column", column.sortable && "cursor-pointer", (0, _utils_1.pcn)(className, "head-column")), style: { width: column.width ? column.width : 200 }, onClick: () => column.sortable && onChangeSortBy?.([`${column.selector} ${sortDirection == "desc" ? "asc" : "desc"}`]), children: [column.label, !!sortColumn && ((0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: sortDirection == "desc" ? "solid/arrow-down-z-a" : "solid/arrow-up-a-z", className: "text-light-foreground/70" }))] }, key));
|
|
45
44
|
}) }));
|
|
46
45
|
}
|
|
47
46
|
function renderItem(item, itemKey) {
|
|
@@ -101,7 +100,7 @@ function TableComponent({ id, controlBar, columns, data, pagination, loading, so
|
|
|
101
100
|
setShowFloatingAction(e.scrollLeft + e.clientWidth <= e.scrollWidth - actionColumnRef.current?.clientWidth);
|
|
102
101
|
}, footer: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: block && pagination && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "py-6" }), (0, jsx_runtime_1.jsx)("div", { className: "my-2 absolute bottom-0 w-full", children: (0, jsx_runtime_1.jsx)(Pagination_component_1.PaginationComponent, { ...pagination }) })] })) }), children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "w-max min-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "table-loading-container", children: (0, jsx_runtime_1.jsx)("h1", { className: "table-loading-text", children: "Memuat data..." }) }) })) : !data || !data.length ? ((0, jsx_runtime_1.jsx)("div", { className: "table-empty-container", children: (0, jsx_runtime_1.jsx)("h1", { className: "table-empty-text", children: "Belum Ada Data" }) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !isSm || !responsiveControl?.mobile ? ((0, jsx_runtime_1.jsxs)("div", { className: "w-max min-w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("table-head-row", (0, _utils_1.pcn)(className, "row")), children: [!!actionBulking && ((0, jsx_runtime_1.jsx)("div", { className: "table-head-column w-max", children: (0, jsx_runtime_1.jsx)(Checkbox_component_1.CheckboxComponent, { name: "selected_table", className: "w-5 h-5", checked: data.length > 0 && checks?.length === data.length, onChange: () => data.length > 0 && checks?.length === data.length ? onChangeChecks?.([]) : onChangeChecks?.(data.map((d) => d.id)) }) })), !noIndex && (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("table-head-column w-8", (0, _utils_1.pcn)(className, "head-column")), children: "#" }), renderHead()] }), (0, jsx_runtime_1.jsx)("div", { className: "table-body", children: data.map((item, key) => {
|
|
103
102
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { animationDelay: `${(key + 1) * 0.05}s` }, className: (0, _utils_1.cn)("table-body-row", key % 2 ? "bg-light-primary/10" : "bg-white", focus == key && "bg-light-primary/30", (0, _utils_1.pcn)(className, "row")), children: [!!actionBulking && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("table-body-column w-max", (0, _utils_1.pcn)(className, "column")), children: (0, jsx_runtime_1.jsx)(Checkbox_component_1.CheckboxComponent, { name: "selected_table", className: "w-5 h-5", checked: checks?.includes(item?.id), onChange: () => checks?.includes(item?.id) ? onChangeChecks?.(checks.filter((i) => i !== item?.id)) : onChangeChecks?.([...(checks || []), item?.id]) }) })), !noIndex && (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("table-body-column w-8", (0, _utils_1.pcn)(className, "column")), children: numberOfRow(key) }), renderItem(item, key), (0, jsx_runtime_1.jsx)("div", { ref: actionColumnRef, className: "table-action-column", children: item["action"] }), item["action"] && showFloatingAction && ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("table-floating-action", (0, _utils_1.pcn)(className, "floating-action")), onClick: () => floatingActionActive !== false &&
|
|
104
|
-
floatingActionActive == key ? setFloatingActionActive(false) : setFloatingActionActive(key), children: [(0, jsx_runtime_1.jsx)("div", { className: "table-floating-action-icon-wrapper", children: (0, jsx_runtime_1.jsx)(
|
|
103
|
+
floatingActionActive == key ? setFloatingActionActive(false) : setFloatingActionActive(key), children: [(0, jsx_runtime_1.jsx)("div", { className: "table-floating-action-icon-wrapper", children: (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: floatingActionActive === false || floatingActionActive != key ? "solid/chevron-left" : "solid/chevron-right" }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("table-floating-action-content", floatingActionActive === key && "table-floating-action-content-active"), children: item["action"] })] }))] }, key));
|
|
105
104
|
}) })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "table-mobile-list", children: data.map((item, key) => {
|
|
106
105
|
return ((0, jsx_runtime_1.jsx)("div", { style: { animationDelay: `${(key + 1) * 0.05}s` }, children: renderItem(item, key) }, key));
|
|
107
106
|
}) })) })) }) }), !!actionBulking && !!checks?.length && ((0, jsx_runtime_1.jsxs)("div", { className: "table-bulk-actions-bar", children: [(0, jsx_runtime_1.jsxs)("div", { className: "table-bulk-actions-title", children: [checks?.length, " Data Terpilih"] }), (0, jsx_runtime_1.jsx)("div", { className: "table-bulk-actions-buttons", children: actionBulking?.(checks) })] })), !block && pagination && ((0, jsx_runtime_1.jsx)("div", { className: "table-pagination-desktop", children: (0, jsx_runtime_1.jsx)(Pagination_component_1.PaginationComponent, { ...pagination }) })), pagination && ((0, jsx_runtime_1.jsx)("div", { className: "table-pagination-mobile", children: (0, jsx_runtime_1.jsx)(Pagination_component_1.PaginationComponent, { ...pagination }) }))] }));
|
|
@@ -5,7 +5,7 @@ exports.SwipeComponent = SwipeComponent;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const _utils_1 = require("@utils");
|
|
8
|
-
const
|
|
8
|
+
const skalfa_icon_1 = require("@skalfa/skalfa-icon");
|
|
9
9
|
function SwipeComponent({ leftActionControl, rightActionControl, children, className, }) {
|
|
10
10
|
const startX = (0, react_1.useRef)(0);
|
|
11
11
|
const [offset, setOffset] = (0, react_1.useState)(0);
|
|
@@ -49,7 +49,7 @@ function SwipeComponent({ leftActionControl, rightActionControl, children, class
|
|
|
49
49
|
control?.onAction?.();
|
|
50
50
|
setOffset(0);
|
|
51
51
|
}
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("swipe-container", className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: () => handleAction('left'), className: (0, _utils_1.cn)("swipe-left-action", leftActionControl?.className, offset > 0 ? "opacity-100" : "opacity-0"), children: [leftActionControl?.icon && (0, jsx_runtime_1.jsx)(
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("swipe-container", className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: () => handleAction('left'), className: (0, _utils_1.cn)("swipe-left-action", leftActionControl?.className, offset > 0 ? "opacity-100" : "opacity-0"), children: [leftActionControl?.icon && (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: leftActionControl?.icon }), " ", leftActionControl?.label] }), (0, jsx_runtime_1.jsxs)("div", { onClick: () => handleAction('right'), className: (0, _utils_1.cn)("swipe-right-action", rightActionControl?.className, offset < 0 ? "opacity-100" : "opacity-0"), children: [rightActionControl?.icon && (0, jsx_runtime_1.jsx)(skalfa_icon_1.Icon, { icon: rightActionControl?.icon }), " ", rightActionControl?.label] }), (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("swipe-content", className), style: {
|
|
53
53
|
transform: `translateX(${offset}px)`,
|
|
54
54
|
transition: dragging ? "none" : "transform 0.2s ease",
|
|
55
55
|
}, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onTouchEnd, onClickCapture: (e) => {
|
package/package.json
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skalfa/skalfa-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Reusable UI components for Skalfa App.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"keywords": [
|
|
6
|
+
"keywords": [
|
|
7
|
+
"skalfa",
|
|
8
|
+
"skalfa-app",
|
|
9
|
+
"skalfa-component",
|
|
10
|
+
"next-framework",
|
|
11
|
+
"next-template"
|
|
12
|
+
],
|
|
7
13
|
"main": "dist/index.js",
|
|
8
14
|
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
10
19
|
"scripts": {
|
|
11
20
|
"build": "tsc -p tsconfig.json",
|
|
12
21
|
"postbuild": "bun fix-exports.js"
|
|
13
22
|
},
|
|
14
23
|
"peerDependencies": {
|
|
15
24
|
"@skalfa/skalfa-app-core": "*",
|
|
16
|
-
"@
|
|
25
|
+
"@skalfa/skalfa-lang": "*",
|
|
26
|
+
"@skalfa/skalfa-icon": "*",
|
|
17
27
|
"next": "^15.0.0 || ^16.0.0",
|
|
18
28
|
"react": "^19.0.0",
|
|
19
29
|
"react-dom": "^19.0.0"
|
|
20
30
|
},
|
|
21
31
|
"devDependencies": {
|
|
22
32
|
"@skalfa/skalfa-app-core": "*",
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
27
|
-
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
33
|
+
"@skalfa/skalfa-lang": "*",
|
|
34
|
+
"@skalfa/skalfa-icon": "*",
|
|
35
|
+
"moment": "^2.30.1",
|
|
28
36
|
"@react-google-maps/api": "^2.20.7",
|
|
29
37
|
"@types/google.maps": "^3.58.1",
|
|
30
38
|
"@types/node": "^20.0.0",
|
|
@@ -35,4 +43,4 @@
|
|
|
35
43
|
"react-dom": "^19.2.1",
|
|
36
44
|
"typescript": "^6.0.3"
|
|
37
45
|
}
|
|
38
|
-
}
|
|
46
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
import { ReactNode, useEffect, useState } from "react";
|
|
4
|
-
import { faChevronDown, faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
6
|
import { cn, pcn } from "@utils";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -63,7 +63,7 @@ export function AccordionComponent({
|
|
|
63
63
|
isActive !== key && "rotate-180",
|
|
64
64
|
)}
|
|
65
65
|
>
|
|
66
|
-
<
|
|
66
|
+
<Icon icon={horizontal ? "solid/chevron-left" : "solid/chevron-down"} />
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
<div
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
import { Fragment, ReactNode } from "react";
|
|
4
6
|
import Link from "next/link";
|
|
5
|
-
import { faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
7
7
|
import { cn, pcn } from "@utils";
|
|
8
8
|
|
|
9
9
|
|
|
@@ -64,8 +64,8 @@ export function BreadcrumbComponent({
|
|
|
64
64
|
{!isActive && (
|
|
65
65
|
<li className="breadcrumb-separator">
|
|
66
66
|
{separatorContent || (
|
|
67
|
-
<
|
|
68
|
-
icon=
|
|
67
|
+
<Icon
|
|
68
|
+
icon="solid/chevron-right"
|
|
69
69
|
/>
|
|
70
70
|
)}
|
|
71
71
|
</li>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import Link from "next/link";
|
|
5
|
-
import {
|
|
5
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
6
6
|
import { cn, pcn } from "@utils";
|
|
7
7
|
|
|
8
8
|
type CT = "icon" | "loading" | "base";
|
|
@@ -18,7 +18,7 @@ export interface ButtonProps {
|
|
|
18
18
|
size ?: "xs" | "sm" | "md" | "lg";
|
|
19
19
|
onClick ?: any;
|
|
20
20
|
href ?: string;
|
|
21
|
-
icon ?:
|
|
21
|
+
icon ?: IconName;
|
|
22
22
|
loading ?: boolean;
|
|
23
23
|
hover ?: boolean;
|
|
24
24
|
tips ?: string; // Tooltip / title attribute
|
|
@@ -67,7 +67,7 @@ export function ButtonComponent({
|
|
|
67
67
|
<div className={cn("button-loading", pcn<CT>(className, "loading"))}></div>
|
|
68
68
|
) : (
|
|
69
69
|
icon && (
|
|
70
|
-
<
|
|
70
|
+
<Icon
|
|
71
71
|
icon={icon}
|
|
72
72
|
className={cn("button-icon", pcn<CT>(className, "icon"))}
|
|
73
73
|
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
import { useState, useRef, useEffect } from "react";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
6
6
|
import { cn, pcn } from "@utils";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -96,13 +96,13 @@ export function CarouselComponent({
|
|
|
96
96
|
className={cn("carousel-btn carousel-prev-btn", pcn<CT>(className, "prev-button"))}
|
|
97
97
|
onClick={handlePrev}
|
|
98
98
|
>
|
|
99
|
-
<
|
|
99
|
+
<Icon icon="solid/chevron-left" />
|
|
100
100
|
</button>
|
|
101
101
|
<button
|
|
102
102
|
className={cn("carousel-btn carousel-next-btn", pcn<CT>(className, "next-button"))}
|
|
103
103
|
onClick={handleNext}
|
|
104
104
|
>
|
|
105
|
-
<
|
|
105
|
+
<Icon icon="solid/chevron-right" />
|
|
106
106
|
</button>
|
|
107
107
|
</>
|
|
108
108
|
)}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
1
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
3
2
|
import { cn } from "@utils";
|
|
4
3
|
|
|
5
4
|
export function ChipComponent({
|
|
@@ -25,8 +24,8 @@ export function ChipComponent({
|
|
|
25
24
|
<span>{item}</span>
|
|
26
25
|
|
|
27
26
|
{onDelete && (
|
|
28
|
-
<
|
|
29
|
-
icon=
|
|
27
|
+
<Icon
|
|
28
|
+
icon="solid/times"
|
|
30
29
|
className="chip-delete"
|
|
31
30
|
onClick={() => onDelete?.(item, key)}
|
|
32
31
|
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
import { ReactNode, useEffect, useState } from "react";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { faCheck } from "@fortawesome/free-solid-svg-icons";
|
|
6
6
|
import { cn, pcn, useInputRandomId } from "@utils";
|
|
7
7
|
|
|
8
8
|
type CT = "label" | "checked" | "error" | "base";
|
|
@@ -78,7 +78,7 @@ export function CheckboxComponent({
|
|
|
78
78
|
pcn<CT>(className, "base"),
|
|
79
79
|
)}
|
|
80
80
|
>
|
|
81
|
-
{checked && <
|
|
81
|
+
{checked && <Icon icon="solid/check" className="text-sm" />}
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
<span
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { InputHTMLAttributes, ReactNode, Ref, useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
5
5
|
import { cn, pcn, useInputHandler, useInputRandomId, useValidation, validation, ValidationRules } from "@utils";
|
|
6
6
|
import { InputValues } from "./InputValues.component";
|
|
7
7
|
|
|
@@ -12,8 +12,8 @@ type CT = "label" | "tip" | "error" | "base" | "icon" | "suggest" | "suggest-ite
|
|
|
12
12
|
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
13
13
|
label ?: string;
|
|
14
14
|
tip ?: string | ReactNode;
|
|
15
|
-
leftIcon ?:
|
|
16
|
-
rightIcon ?:
|
|
15
|
+
leftIcon ?: IconName;
|
|
16
|
+
rightIcon ?: IconName;
|
|
17
17
|
|
|
18
18
|
value ?: any;
|
|
19
19
|
invalid ?: string;
|
|
@@ -72,7 +72,7 @@ export function InputComponent({
|
|
|
72
72
|
// =========================>
|
|
73
73
|
// ## Initial
|
|
74
74
|
// =========================>
|
|
75
|
-
const inputHandler = useInputHandler(props.name, value, validations, register,
|
|
75
|
+
const inputHandler = useInputHandler(props.name, value, validations, register, props.type == "file")
|
|
76
76
|
const randomId = useInputRandomId()
|
|
77
77
|
|
|
78
78
|
|
|
@@ -256,7 +256,7 @@ export function InputComponent({
|
|
|
256
256
|
)}
|
|
257
257
|
|
|
258
258
|
{leftIcon && (
|
|
259
|
-
<
|
|
259
|
+
<Icon
|
|
260
260
|
className={cn(
|
|
261
261
|
"input-icon",
|
|
262
262
|
"input-icon-left",
|
|
@@ -271,7 +271,7 @@ export function InputComponent({
|
|
|
271
271
|
)}
|
|
272
272
|
|
|
273
273
|
{rightIcon && (
|
|
274
|
-
<
|
|
274
|
+
<Icon
|
|
275
275
|
className={cn(
|
|
276
276
|
"input-icon",
|
|
277
277
|
"input-icon-right",
|
|
@@ -70,7 +70,7 @@ export function InputCheckboxComponent({
|
|
|
70
70
|
// =========================>
|
|
71
71
|
// ## initial
|
|
72
72
|
// =========================>
|
|
73
|
-
const inputHandler = useInputHandler(name, value, validations, register,
|
|
73
|
+
const inputHandler = useInputHandler(name, value, validations, register, false)
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
// =========================>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { InputHTMLAttributes, ReactNode } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Icon, type IconName } from "@skalfa/skalfa-icon";
|
|
5
5
|
import { cn, conversion, pcn, useInputHandler, useInputRandomId, useValidation, validation, ValidationRules } from "@utils";
|
|
6
6
|
|
|
7
7
|
|
|
@@ -11,8 +11,8 @@ type CT = "label" | "tip" | "error" | "input" | "icon";
|
|
|
11
11
|
export interface InputCurrencyProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
12
12
|
label ?: string;
|
|
13
13
|
tip ?: string | ReactNode;
|
|
14
|
-
leftIcon ?:
|
|
15
|
-
rightIcon ?:
|
|
14
|
+
leftIcon ?: IconName;
|
|
15
|
+
rightIcon ?: IconName;
|
|
16
16
|
|
|
17
17
|
value ?: number;
|
|
18
18
|
invalid ?: string;
|
|
@@ -55,7 +55,7 @@ export function InputCurrencyComponent({
|
|
|
55
55
|
// =========================>
|
|
56
56
|
// ## Initial
|
|
57
57
|
// =========================>
|
|
58
|
-
const inputHandler = useInputHandler(props.name, value, validations, register,
|
|
58
|
+
const inputHandler = useInputHandler(props.name, value, validations, register, false)
|
|
59
59
|
const randomId = useInputRandomId()
|
|
60
60
|
|
|
61
61
|
|
|
@@ -128,7 +128,7 @@ export function InputCurrencyComponent({
|
|
|
128
128
|
/>
|
|
129
129
|
|
|
130
130
|
{leftIcon && (
|
|
131
|
-
<
|
|
131
|
+
<Icon
|
|
132
132
|
className={cn(
|
|
133
133
|
"input-icon",
|
|
134
134
|
"input-icon-left",
|
|
@@ -142,7 +142,7 @@ export function InputCurrencyComponent({
|
|
|
142
142
|
/>
|
|
143
143
|
)}
|
|
144
144
|
{rightIcon && (
|
|
145
|
-
<
|
|
145
|
+
<Icon
|
|
146
146
|
className={cn(
|
|
147
147
|
"input-icon",
|
|
148
148
|
"input-icon-right",
|