pixelize-design-library 2.1.48 → 2.1.50

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.
@@ -52,9 +52,10 @@ var dnd_1 = require("@hello-pangea/dnd");
52
52
  var lucide_react_1 = require("lucide-react");
53
53
  var useCustomTheme_1 = require("../../Theme/useCustomTheme");
54
54
  var AccountCard_1 = __importDefault(require("./AccountCard"));
55
+ var HeaderActions_1 = __importDefault(require("../Header/HeaderActions"));
55
56
  var KanbanBoard = function (_a) {
56
57
  var _b, _c, _d;
57
- var data = _a.data, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e;
58
+ var data = _a.data, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, kanbanSelect = _a.kanbanSelect, kanbanEdit = _a.kanbanEdit, kanbanCreate = _a.kanbanCreate;
58
59
  var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
59
60
  var _f = (0, react_1.useState)(data), columns = _f[0], setColumns = _f[1];
60
61
  var onDragEnd = function (result) {
@@ -93,28 +94,30 @@ var KanbanBoard = function (_a) {
93
94
  var columnIds = ((_b = (_a = columns[colId]) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (item) { return item.id; })) || [];
94
95
  onColumnDelete === null || onColumnDelete === void 0 ? void 0 : onColumnDelete(columnIds);
95
96
  };
96
- return (react_1.default.createElement(dnd_1.DragDropContext, { onDragEnd: onDragEnd },
97
- react_1.default.createElement(react_2.Flex, { gap: 4, p: 4, bg: (_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200], minH: "100vh", overflowX: "auto", maxWidth: "100vw" }, isLoading ? ((_c = Array.from({ length: 5 })) === null || _c === void 0 ? void 0 : _c.map(function (_, idx) {
98
- var _a, _b;
99
- return (react_1.default.createElement(react_2.Box, { key: idx, width: "17.5rem", p: 4, borderRadius: "0.5rem", bg: (_a = colors === null || colors === void 0 ? void 0 : colors.background) === null || _a === void 0 ? void 0 : _a[100], border: "0.125rem solid ".concat((_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200]), flexShrink: 0 },
100
- react_1.default.createElement(react_2.Skeleton, { height: "2.75rem", mb: 4, borderRadius: "0.25rem" }),
101
- react_1.default.createElement(react_2.SkeletonText, { mt: "4", noOfLines: 5, spacing: "4" })));
102
- })) : ((_d = Object.entries(columns)) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
103
- var colId = _a[0], column = _a[1];
104
- return (react_1.default.createElement(dnd_1.Droppable, { droppableId: colId.toString(), key: colId }, function (provided, snapshot) {
105
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
106
- return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.droppableProps, { width: "17.5rem", opacity: 1, borderRadius: "0.5rem", borderWidth: "0.063rem", background: snapshot.isDraggingOver
107
- ? (_a = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _a === void 0 ? void 0 : _a[50]
108
- : (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[100], border: "".concat(snapshot.isDraggingOver
109
- ? "0.5px dashed" + ((_c = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _c === void 0 ? void 0 : _c[500])
110
- : "0.125rem solid" + ((_d = colors.gray) === null || _d === void 0 ? void 0 : _d[200])), display: "flex", flexDirection: "column", flexShrink: 0 }),
111
- react_1.default.createElement(react_2.Flex, { width: "16.5rem", height: "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (_e = column.color) !== null && _e !== void 0 ? _e : (_f = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _f === void 0 ? void 0 : _f[500], background: (_g = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _g === void 0 ? void 0 : _g[100], align: "center", px: 2, mb: 3, flexShrink: 0, m: 2, justifyContent: "space-between" },
112
- react_1.default.createElement(react_2.Text, { fontWeight: "600", fontSize: "1rem", color: (_h = colors === null || colors === void 0 ? void 0 : colors.text) === null || _h === void 0 ? void 0 : _h[700] }, column.title),
113
- react_1.default.createElement(react_2.Box, { as: lucide_react_1.Trash2, size: 16, cursor: "pointer", color: (_j = colors === null || colors === void 0 ? void 0 : colors.text) === null || _j === void 0 ? void 0 : _j[600], _hover: { color: (_k = colors === null || colors === void 0 ? void 0 : colors.red) === null || _k === void 0 ? void 0 : _k[600] }, onClick: function () { return handleColumnDelete(colId); } })),
114
- react_1.default.createElement(react_2.Box, { px: 2, pb: 2, overflowY: "auto", maxHeight: "calc(100vh - 7rem)", overflowX: "hidden" }, (_l = column.items) === null || _l === void 0 ? void 0 :
115
- _l.map(function (account, index) { return (react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen })); }),
116
- provided.placeholder)));
117
- }));
118
- })))));
97
+ return (react_1.default.createElement(react_1.default.Fragment, null,
98
+ react_1.default.createElement(HeaderActions_1.default, { select: kanbanSelect, edit: kanbanEdit, create: kanbanCreate }),
99
+ react_1.default.createElement(dnd_1.DragDropContext, { onDragEnd: onDragEnd },
100
+ react_1.default.createElement(react_2.Flex, { gap: 4, p: 4, bg: (_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200], minH: "100vh", overflowX: "auto", maxWidth: "100vw" }, isLoading ? ((_c = Array.from({ length: 5 })) === null || _c === void 0 ? void 0 : _c.map(function (_, idx) {
101
+ var _a, _b;
102
+ return (react_1.default.createElement(react_2.Box, { key: idx, width: "17.5rem", p: 4, borderRadius: "0.5rem", bg: (_a = colors === null || colors === void 0 ? void 0 : colors.background) === null || _a === void 0 ? void 0 : _a[100], border: "0.125rem solid ".concat((_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200]), flexShrink: 0 },
103
+ react_1.default.createElement(react_2.Skeleton, { height: "2.75rem", mb: 4, borderRadius: "0.25rem" }),
104
+ react_1.default.createElement(react_2.SkeletonText, { mt: "4", noOfLines: 5, spacing: "4" })));
105
+ })) : ((_d = Object.entries(columns)) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
106
+ var colId = _a[0], column = _a[1];
107
+ return (react_1.default.createElement(dnd_1.Droppable, { droppableId: colId.toString(), key: colId }, function (provided, snapshot) {
108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
109
+ return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.droppableProps, { width: "17.5rem", opacity: 1, borderRadius: "0.5rem", borderWidth: "0.063rem", background: snapshot.isDraggingOver
110
+ ? (_a = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _a === void 0 ? void 0 : _a[50]
111
+ : (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[100], border: "".concat(snapshot.isDraggingOver
112
+ ? "0.5px dashed" + ((_c = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _c === void 0 ? void 0 : _c[500])
113
+ : "0.125rem solid" + ((_d = colors.gray) === null || _d === void 0 ? void 0 : _d[200])), display: "flex", flexDirection: "column", flexShrink: 0 }),
114
+ react_1.default.createElement(react_2.Flex, { width: "16.5rem", height: "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (_e = column.color) !== null && _e !== void 0 ? _e : (_f = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _f === void 0 ? void 0 : _f[500], background: (_g = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _g === void 0 ? void 0 : _g[100], align: "center", px: 2, mb: 3, flexShrink: 0, m: 2, justifyContent: "space-between" },
115
+ react_1.default.createElement(react_2.Text, { fontWeight: "600", fontSize: "1rem", color: (_h = colors === null || colors === void 0 ? void 0 : colors.text) === null || _h === void 0 ? void 0 : _h[700] }, column.title),
116
+ react_1.default.createElement(react_2.Box, { as: lucide_react_1.Trash2, size: 16, cursor: "pointer", color: (_j = colors === null || colors === void 0 ? void 0 : colors.text) === null || _j === void 0 ? void 0 : _j[600], _hover: { color: (_k = colors === null || colors === void 0 ? void 0 : colors.red) === null || _k === void 0 ? void 0 : _k[600] }, onClick: function () { return handleColumnDelete(colId); } })),
117
+ react_1.default.createElement(react_2.Box, { px: 2, pb: 2, overflowY: "auto", maxHeight: "calc(100vh - 7rem)", overflowX: "hidden" }, (_l = column.items) === null || _l === void 0 ? void 0 :
118
+ _l.map(function (account, index) { return (react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen })); }),
119
+ provided.placeholder)));
120
+ }));
121
+ }))))));
119
122
  };
120
123
  exports.default = KanbanBoard;
@@ -1,3 +1,4 @@
1
+ import { OptionProp } from "../Select/SelectProps";
1
2
  export type Account = {
2
3
  id: string;
3
4
  [key: string]: string | number | null | undefined;
@@ -19,4 +20,22 @@ export type KanbanBoardProps = {
19
20
  item: Account;
20
21
  }) => void;
21
22
  isLoading?: boolean;
23
+ kanbanSelect?: {
24
+ isSelect?: boolean;
25
+ options?: OptionProp[];
26
+ onSelectChange?: (option?: OptionProp) => void;
27
+ selectPlaceholderText?: string;
28
+ width?: string;
29
+ value?: string;
30
+ };
31
+ kanbanEdit?: {
32
+ isEditable?: boolean;
33
+ onEdit?: () => void;
34
+ label?: string;
35
+ };
36
+ kanbanCreate?: {
37
+ isCreatable?: boolean;
38
+ onCreate?: () => void;
39
+ label?: string;
40
+ };
22
41
  };
@@ -69,18 +69,18 @@ var normalizeMultiValue = function (val) {
69
69
  return [];
70
70
  };
71
71
  var SearchSelect = function (_a) {
72
- var _b, _c, _d, _e, _f, _g;
73
- var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch, _h = _a.isOptionLoading, isOptionLoading = _h === void 0 ? false : _h, _j = _a.isLoading, isLoading = _j === void 0 ? false : _j, _k = _a.loadingText, loadingText = _k === void 0 ? 'Loading...' : _k, _l = _a.placeholder, placeholder = _l === void 0 ? 'Select' : _l, value = _a.value, _m = _a.searchQuery, searchQuery = _m === void 0 ? '' : _m, _o = _a.isMultiple, isMultiple = _o === void 0 ? false : _o, _p = _a.isRequired, isRequired = _p === void 0 ? false : _p, _q = _a.error, error = _q === void 0 ? false : _q, errorMessage = _a.errorMessage, helperText = _a.helperText, _r = _a.width, width = _r === void 0 ? '100%' : _r, _s = _a.height, height = _s === void 0 ? "2.75rem" : _s, _t = _a.size, size = _t === void 0 ? 'md' : _t, chip = _a.chip, information = _a.information, rightIcon = _a.rightIcon, addNew = _a.addNew, _u = _a.isSelectAll, isSelectAll = _u === void 0 ? false : _u, pagination = _a.pagination, insideSelect = _a.insideSelect, isRemoveAllIcon = _a.isRemoveAllIcon;
74
- var _v = (0, react_1.useState)(searchQuery), inputValue = _v[0], setInputValue = _v[1];
75
- var _w = (0, react_1.useState)(false), isOpen = _w[0], setIsOpen = _w[1];
76
- var _x = (0, react_1.useState)(true), hasMore = _x[0], setHasMore = _x[1];
72
+ var _b, _c, _d, _e, _f, _g, _h;
73
+ var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch, _j = _a.isOptionLoading, isOptionLoading = _j === void 0 ? false : _j, _k = _a.isLoading, isLoading = _k === void 0 ? false : _k, _l = _a.loadingText, loadingText = _l === void 0 ? 'Loading...' : _l, _m = _a.placeholder, placeholder = _m === void 0 ? 'Select' : _m, value = _a.value, _o = _a.searchQuery, searchQuery = _o === void 0 ? '' : _o, _p = _a.isMultiple, isMultiple = _p === void 0 ? false : _p, _q = _a.isRequired, isRequired = _q === void 0 ? false : _q, _r = _a.error, error = _r === void 0 ? false : _r, errorMessage = _a.errorMessage, helperText = _a.helperText, _s = _a.width, width = _s === void 0 ? '100%' : _s, _t = _a.height, height = _t === void 0 ? "2.75rem" : _t, _u = _a.size, size = _u === void 0 ? 'md' : _u, chip = _a.chip, information = _a.information, rightIcon = _a.rightIcon, addNew = _a.addNew, _v = _a.isSelectAll, isSelectAll = _v === void 0 ? false : _v, pagination = _a.pagination, insideSelect = _a.insideSelect, isRemoveAllIcon = _a.isRemoveAllIcon;
74
+ var _w = (0, react_1.useState)(searchQuery), inputValue = _w[0], setInputValue = _w[1];
75
+ var _x = (0, react_1.useState)(false), isOpen = _x[0], setIsOpen = _x[1];
76
+ var _y = (0, react_1.useState)(true), hasMore = _y[0], setHasMore = _y[1];
77
77
  var inputRef = (0, react_1.useRef)(null);
78
78
  var containerRef = (0, react_1.useRef)(null);
79
79
  var scrollTimeoutRef = (0, react_1.useRef)(null);
80
- var _y = (0, react_1.useState)(false), focused = _y[0], setFocused = _y[1];
81
- var _z = (0, react_1.useState)(false), customSelectOpen = _z[0], setCustomSelectOpen = _z[1];
80
+ var _z = (0, react_1.useState)(false), focused = _z[0], setFocused = _z[1];
81
+ var _0 = (0, react_1.useState)(false), customSelectOpen = _0[0], setCustomSelectOpen = _0[1];
82
82
  var customSelectRef = (0, react_1.useRef)(null);
83
- var _0 = (0, react_1.useState)({ top: 0, left: 0, width: 0 }), customSelectPos = _0[0], setCustomSelectPos = _0[1];
83
+ var _1 = (0, react_1.useState)({ top: 0, left: 0, width: 0 }), customSelectPos = _1[0], setCustomSelectPos = _1[1];
84
84
  var theme = (0, useCustomTheme_1.useCustomTheme)();
85
85
  (0, react_2.useOutsideClick)({
86
86
  ref: containerRef,
@@ -203,13 +203,13 @@ var SearchSelect = function (_a) {
203
203
  return (react_1.default.createElement(react_2.Box, { ref: containerRef, width: width, position: "relative" },
204
204
  label && (react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isRequired: isRequired, isInformation: information === null || information === void 0 ? void 0 : information.isInformation, informationMessage: information === null || information === void 0 ? void 0 : information.informationMessage })),
205
205
  react_1.default.createElement(react_2.InputGroup, { size: size },
206
- react_1.default.createElement(react_2.Box, { as: "div", w: "100%", minH: "2.85rem", px: 3, display: "flex", alignItems: "center", flexWrap: "wrap", gap: "0.375rem", border: "0.063rem solid", borderColor: error ? theme.colors.semantic.error[500] : focused ? theme.colors.primary[500] : (_b = theme.colors.boxborder) === null || _b === void 0 ? void 0 : _b[500], borderRadius: "0.25rem", bg: "white", boxShadow: focused ? error ? "0 0 0 0.125rem ".concat((_c = theme.colors.boxShadow) === null || _c === void 0 ? void 0 : _c.error) : "0 0 0 0.125rem ".concat((_d = theme.colors.boxShadow) === null || _d === void 0 ? void 0 : _d.primary) : 'none', transition: "box-shadow 0.2s, border-color 0.2s" },
206
+ react_1.default.createElement(react_2.Box, { as: "div", w: "100%", minH: "2.85rem", px: 3, display: "flex", alignItems: "center", flexWrap: "wrap", gap: "0.375rem", border: "0.063rem solid", borderColor: error ? theme.colors.semantic.error[500] : focused ? theme.colors.primary[500] : (_b = theme.colors.boxborder) === null || _b === void 0 ? void 0 : _b[500], borderRadius: "0.25rem", bg: (_c = theme.colors.gray) === null || _c === void 0 ? void 0 : _c[50], boxShadow: focused ? error ? "0 0 0 0.125rem ".concat((_d = theme.colors.boxShadow) === null || _d === void 0 ? void 0 : _d.error) : "0 0 0 0.125rem ".concat((_e = theme.colors.boxShadow) === null || _e === void 0 ? void 0 : _e.primary) : 'none', transition: "box-shadow 0.2s, border-color 0.2s" },
207
207
  insideSelect && (react_1.default.createElement(react_2.Box, { position: "relative", ref: customSelectRef, backgroundColor: theme.colors.gray[200], ml: "-0.75rem", h: "-webkit-fill-available", borderRadius: "0.25rem 0 0 0.25rem", onClick: function () { return setCustomSelectOpen(function (prev) { return !prev; }); } },
208
208
  react_1.default.createElement(react_2.Box, { minW: "5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", width: insideSelect.width, height: height, pl: "0.5rem", pr: "0.5rem" },
209
- react_1.default.createElement(SelectTruncatedLabel_1.default, { label: (_f = (_e = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.value) === null || _e === void 0 ? void 0 : _e.label) !== null && _f !== void 0 ? _f : "", maxWidth: (insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.width) || "6rem" }),
209
+ react_1.default.createElement(SelectTruncatedLabel_1.default, { label: (_g = (_f = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.value) === null || _f === void 0 ? void 0 : _f.label) !== null && _g !== void 0 ? _g : "", maxWidth: (insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.width) || "6rem" }),
210
210
  customSelectOpen ? react_1.default.createElement(lucide_react_1.ChevronUp, { size: 16 }) : react_1.default.createElement(lucide_react_1.ChevronDown, { size: 16 })),
211
211
  customSelectOpen && (react_1.default.createElement(react_2.Portal, null,
212
- react_1.default.createElement(react_2.Box, { id: "custom-select-portal", position: "absolute", top: "".concat(customSelectPos.top, "px"), left: "".concat(customSelectPos.left, "px"), zIndex: 1400, bg: theme.colors.white, border: "0.063rem solid", borderColor: theme.colors.gray[300], borderRadius: "md", boxShadow: "md", minW: "10rem", maxW: "38rem" }, (_g = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.option) === null || _g === void 0 ? void 0 : _g.map(function (item) { return (react_1.default.createElement(react_2.Box, { key: item.id, display: "flex", alignItems: "center", height: "2.5rem", px: "0.75rem", fontSize: "sm", _hover: { bg: theme.colors.gray[100] }, cursor: "pointer", onClick: function (e) {
212
+ react_1.default.createElement(react_2.Box, { id: "custom-select-portal", position: "absolute", top: "".concat(customSelectPos.top, "px"), left: "".concat(customSelectPos.left, "px"), zIndex: 1400, bg: theme.colors.white, border: "0.063rem solid", borderColor: theme.colors.gray[300], borderRadius: "md", boxShadow: "md", minW: "10rem", maxW: "38rem" }, (_h = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.option) === null || _h === void 0 ? void 0 : _h.map(function (item) { return (react_1.default.createElement(react_2.Box, { key: item.id, display: "flex", alignItems: "center", height: "2.5rem", px: "0.75rem", fontSize: "sm", _hover: { bg: theme.colors.gray[100] }, cursor: "pointer", onClick: function (e) {
213
213
  e.stopPropagation();
214
214
  handleCustomSelect(item);
215
215
  } }, item.label)); })))))),
@@ -0,0 +1,16 @@
1
+ .table_wrapper {
2
+ width: 100%;
3
+ border-collapse: collapse;
4
+ /* table-layout: fixed; */
5
+ }
6
+
7
+ .table_wrapper th .resize-handle {
8
+ position: absolute;
9
+ top: 0;
10
+ right: 0;
11
+ width: 8px;
12
+ height: 100%;
13
+ cursor: col-resize;
14
+ background-color: transparent;
15
+ z-index: 999;
16
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const KaTableExample: () => React.JSX.Element;
3
+ export default KaTableExample;
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ var react_1 = __importStar(require("react"));
41
+ var KaTable_1 = __importDefault(require("../Components/KaTable/KaTable"));
42
+ var KaTable_2 = require("../Components/KaTable/KaTable");
43
+ var icons_1 = require("@chakra-ui/icons");
44
+ var react_2 = require("@chakra-ui/react");
45
+ var menuItems = [
46
+ { label: "Hide column", action: "hidecolumn" },
47
+ {
48
+ label: "Filter",
49
+ submenu: [
50
+ { label: "Filter by Date", action: "Filter by Date" },
51
+ { label: "Filter by Name", action: "Filter by Name" },
52
+ { label: "Filter by Status", action: "Filter by Status" },
53
+ ],
54
+ },
55
+ ];
56
+ var DataType = KaTable_2.TableEnums.DataType;
57
+ var dataArray = Array(5)
58
+ .fill(undefined)
59
+ .map(function (_, index) { return ({
60
+ column1: index % 2 === 0,
61
+ column2: "column:2 row:".concat(index + 1),
62
+ column3: "column:3 row:".concat(index + 1),
63
+ column4: "column:4 row:".concat(index + 1),
64
+ column5: "column:5 row:".concat(index + 1),
65
+ column6: index + 20,
66
+ column7: index + 25,
67
+ column8: index + 30,
68
+ column9: index + 35,
69
+ column10: index + 40,
70
+ column11: index + 45,
71
+ column12: index + 50,
72
+ column13: index + 55,
73
+ column14: index + 60,
74
+ column15: new Date(2022, 11, index),
75
+ id: index + 1,
76
+ }); });
77
+ var columns = [
78
+ {
79
+ key: "column1",
80
+ title: "Column 1",
81
+ dataType: DataType.Boolean,
82
+ width: 100,
83
+ columnFreeze: true,
84
+ customHeader: false,
85
+ },
86
+ {
87
+ key: "column2",
88
+ title: "Column 2",
89
+ dataType: DataType.String,
90
+ width: 250,
91
+ // visible: false,
92
+ },
93
+ {
94
+ key: "column3",
95
+ title: "Column 3",
96
+ dataType: DataType.Number,
97
+ width: 150,
98
+ filter: true,
99
+ menu: [
100
+ {
101
+ label: "Filter",
102
+ onClick: function () { return console.log("MENU Filter clicks"); },
103
+ submenu: [
104
+ {
105
+ label: "Filter by Date",
106
+ onClick: function () { return console.log("SUBMENU Date clicks"); },
107
+ },
108
+ { label: "Filter by Name" },
109
+ // { label: "Filter by Status", action: "Filter by Status" },
110
+ ],
111
+ },
112
+ ],
113
+ },
114
+ {
115
+ key: "column4",
116
+ title: "Column 4",
117
+ dataType: DataType.Number,
118
+ width: 150,
119
+ sortable: true,
120
+ },
121
+ {
122
+ key: "column5",
123
+ title: "Column 5",
124
+ dataType: DataType.Number,
125
+ width: 150,
126
+ },
127
+ {
128
+ key: "column6",
129
+ title: "Column 6",
130
+ dataType: DataType.Number,
131
+ width: 150,
132
+ },
133
+ {
134
+ key: "column7",
135
+ title: "Column 7",
136
+ dataType: DataType.Number,
137
+ width: 150,
138
+ sortable: true,
139
+ },
140
+ {
141
+ key: "column8",
142
+ title: "Column 8",
143
+ dataType: DataType.Number,
144
+ width: 150,
145
+ },
146
+ {
147
+ key: "column9",
148
+ title: "Column 9",
149
+ dataType: DataType.Number,
150
+ width: 150,
151
+ },
152
+ {
153
+ key: "column10",
154
+ title: "Column 10",
155
+ dataType: DataType.Number,
156
+ width: 150,
157
+ },
158
+ {
159
+ key: "column11",
160
+ title: "Column 11",
161
+ dataType: DataType.Number,
162
+ width: 150,
163
+ },
164
+ {
165
+ key: "column12",
166
+ title: "Column 12",
167
+ dataType: DataType.Number,
168
+ width: 150,
169
+ },
170
+ {
171
+ key: "column13",
172
+ title: "Column 13",
173
+ dataType: DataType.Number,
174
+ width: 150,
175
+ },
176
+ {
177
+ key: "column14",
178
+ title: "Column 14",
179
+ dataType: DataType.Number,
180
+ width: 150,
181
+ },
182
+ {
183
+ key: "column15",
184
+ title: "Column 15",
185
+ dataType: DataType.Date,
186
+ width: 150,
187
+ },
188
+ {
189
+ key: "editColumn",
190
+ width: 80,
191
+ customHeader: false,
192
+ },
193
+ ];
194
+ var KaTableExample = function () {
195
+ var _a = (0, react_1.useState)(false), actionButtons = _a[0], setActionButtons = _a[1];
196
+ var _b = (0, react_1.useState)([]), selectedRows = _b[0], setSelectedRows = _b[1];
197
+ // const kaTableFormat = (props: any) => {
198
+ // if (props.column.dataType === DataType.Date) {
199
+ // return (
200
+ // props.value &&
201
+ // props.value.toLocaleDateString("en", {
202
+ // month: "2-digit",
203
+ // day: "2-digit",
204
+ // year: "numeric",
205
+ // })
206
+ // );
207
+ // }
208
+ // };
209
+ var EditButton = function (_a) {
210
+ var dispatch = _a.dispatch, rowKeyValue = _a.rowKeyValue;
211
+ return (react_1.default.createElement("div", { className: "edit-cell-button" },
212
+ react_1.default.createElement(icons_1.EditIcon, null),
213
+ react_1.default.createElement(icons_1.DeleteIcon, null)));
214
+ };
215
+ // const handleSortChange = (newSortState: any, columnName: any) => {
216
+ // console.log(`Sort state for ${columnName} changed to:`, newSortState);
217
+ // };
218
+ // const handleMenuItemClick = (action: any, columnName: any) => {
219
+ // console.log(`Menu item clicked for ${columnName}:`, action);
220
+ // };
221
+ var handleCheckSelect = (0, react_1.useCallback)(function (selectedRows) {
222
+ console.log("CB", selectedRows);
223
+ if (selectedRows.length !== 0) {
224
+ setActionButtons(true);
225
+ }
226
+ else {
227
+ setActionButtons(false);
228
+ }
229
+ setSelectedRows(selectedRows);
230
+ }, []);
231
+ // console.log(actionButtons, "actionButtons");
232
+ var handleExample = function () {
233
+ setSelectedRows([]);
234
+ };
235
+ // console.log(selectedRows, "selectedRows");
236
+ return (react_1.default.createElement("div", null,
237
+ react_1.default.createElement(react_2.Button, { onClick: handleExample }, "click here"),
238
+ react_1.default.createElement(KaTable_1.default, { data: dataArray, columns: columns, checkSelect: true, onRowClick: function (rowKeyValue) {
239
+ console.log("Row clicked", rowKeyValue);
240
+ }, selected: selectedRows, onSelectionChange: function (selectedRows) {
241
+ handleCheckSelect(selectedRows);
242
+ }, columnVisibility: true,
243
+ // onSortChange={handleSortChange}
244
+ // onMenuItemClick={handleMenuItemClick}
245
+ // format={kaTableFormat}
246
+ childComponents: {
247
+ cellText: {
248
+ content: function (props) {
249
+ if (props.column.key === "editColumn") {
250
+ return react_1.default.createElement(EditButton, __assign({}, props));
251
+ }
252
+ },
253
+ },
254
+ }, loading: {
255
+ enabled: false,
256
+ text: "Loading data",
257
+ } })));
258
+ };
259
+ exports.default = KaTableExample;
@@ -0,0 +1,35 @@
1
+ import "@fontsource/ubuntu-sans";
2
+ declare const fontOptions: {
3
+ fonts: {
4
+ body: string;
5
+ heading: string;
6
+ mono: string;
7
+ };
8
+ fontSizes: {
9
+ xs: string;
10
+ sm: string;
11
+ md: string;
12
+ lg: string;
13
+ xl: string;
14
+ "2xl": string;
15
+ "3xl": string;
16
+ "4xl": string;
17
+ "5xl": string;
18
+ "6xl": string;
19
+ "7xl": string;
20
+ "8xl": string;
21
+ "9xl": string;
22
+ };
23
+ fontWeights: {
24
+ hairline: number;
25
+ thin: number;
26
+ light: number;
27
+ normal: number;
28
+ medium: number;
29
+ semibold: number;
30
+ bold: number;
31
+ extrabold: number;
32
+ black: number;
33
+ };
34
+ };
35
+ export default fontOptions;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@fontsource/ubuntu-sans");
4
+ var fontOptions = {
5
+ fonts: {
6
+ body: "Ubuntu Sans, serif",
7
+ heading: "Ubuntu Sans, serif",
8
+ mono: "Ubuntu Sans, monospace",
9
+ },
10
+ fontSizes: {
11
+ xs: "0.75rem",
12
+ sm: "0.875rem",
13
+ md: "1rem",
14
+ lg: "1.125rem",
15
+ xl: "1.25rem",
16
+ "2xl": "1.5rem",
17
+ "3xl": "1.875rem",
18
+ "4xl": "2.25rem",
19
+ "5xl": "3rem",
20
+ "6xl": "3.75rem",
21
+ "7xl": "4.5rem",
22
+ "8xl": "6rem",
23
+ "9xl": "8rem",
24
+ },
25
+ fontWeights: {
26
+ hairline: 100,
27
+ thin: 200,
28
+ light: 300,
29
+ normal: 400,
30
+ medium: 500,
31
+ semibold: 600,
32
+ bold: 700,
33
+ extrabold: 800,
34
+ black: 900,
35
+ },
36
+ };
37
+ exports.default = fontOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.1.48",
3
+ "version": "2.1.50",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",