@codezee/sixtify-brahma 0.2.43 → 0.2.45

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 (31) hide show
  1. package/package.json +1 -1
  2. package/packages/shared-components/dist/Actions/DownloadIconAction.d.ts.map +1 -1
  3. package/packages/shared-components/dist/Actions/DownloadIconAction.js +3 -1
  4. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  5. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.js +3 -2
  6. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.d.ts +10 -0
  7. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.d.ts.map +1 -0
  8. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.js +49 -0
  9. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.d.ts +2 -0
  10. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.d.ts.map +1 -0
  11. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.js +17 -0
  12. package/packages/shared-components/dist/FormFields/FileUpload/FileNames.d.ts.map +1 -1
  13. package/packages/shared-components/dist/FormFields/FileUpload/FileNames.js +1 -1
  14. package/packages/shared-components/dist/FormFields/index.d.ts +1 -0
  15. package/packages/shared-components/dist/FormFields/index.d.ts.map +1 -1
  16. package/packages/shared-components/dist/FormFields/index.js +1 -0
  17. package/packages/shared-components/dist/TabBar/Tab.d.ts +21 -0
  18. package/packages/shared-components/dist/TabBar/Tab.d.ts.map +1 -0
  19. package/packages/shared-components/dist/TabBar/Tab.js +56 -0
  20. package/packages/shared-components/dist/TabBar/TabBar.d.ts +12 -0
  21. package/packages/shared-components/dist/TabBar/TabBar.d.ts.map +1 -0
  22. package/packages/shared-components/dist/TabBar/TabBar.js +41 -0
  23. package/packages/shared-components/dist/TabBar/TabsMenus.d.ts +15 -0
  24. package/packages/shared-components/dist/TabBar/TabsMenus.d.ts.map +1 -0
  25. package/packages/shared-components/dist/TabBar/TabsMenus.js +15 -0
  26. package/packages/shared-components/dist/TabBar/index.d.ts +7 -0
  27. package/packages/shared-components/dist/TabBar/index.d.ts.map +1 -0
  28. package/packages/shared-components/dist/TabBar/index.js +9 -0
  29. package/packages/shared-components/dist/index.d.ts +1 -0
  30. package/packages/shared-components/dist/index.d.ts.map +1 -1
  31. package/packages/shared-components/dist/index.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadIconAction.d.ts","sourceRoot":"","sources":["../../src/Actions/DownloadIconAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAQhE,CAAC"}
1
+ {"version":3,"file":"DownloadIconAction.d.ts","sourceRoot":"","sources":["../../src/Actions/DownloadIconAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAShE,CAAC"}
@@ -6,6 +6,8 @@ const material_1 = require("@mui/material");
6
6
  const Svgs_1 = require("../Svgs");
7
7
  const Tooltip_1 = require("../Tooltip");
8
8
  const DownloadIconAction = (props) => {
9
- return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Download", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...props, children: (0, jsx_runtime_1.jsx)(Svgs_1.SvgDownload, {}) }) }));
9
+ return (
10
+ // TODO: Need to add margin top to set the UI in sync with the design
11
+ (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...props, children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Download", children: (0, jsx_runtime_1.jsx)(Svgs_1.SvgDownload, {}) }) }));
10
12
  };
11
13
  exports.DownloadIconAction = DownloadIconAction;
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
1
+ {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DateRangePicker = DateRangePicker;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
+ const luxon_1 = require("luxon");
6
7
  const react_1 = require("react");
7
8
  const react_date_range_1 = require("react-date-range");
8
9
  const react_hook_form_1 = require("react-hook-form");
@@ -31,8 +32,8 @@ function DateRangePicker({ control, defaultValue, disabled = false, label, name,
31
32
  key: selectedRange.key,
32
33
  },
33
34
  ]);
34
- const startDate = new Date(selectedRange.startDate.toUTCString()).toISOString();
35
- const endDate = new Date(selectedRange.endDate.toUTCString()).toISOString();
35
+ const startDate = luxon_1.DateTime.fromJSDate(selectedRange.startDate).toISODate();
36
+ const endDate = luxon_1.DateTime.fromJSDate(selectedRange.endDate).toISODate();
36
37
  onChange([startDate, endDate]);
37
38
  }
38
39
  }, months: 1, direction: "horizontal", calendarFocus: "backwards", staticRanges: [], inputRanges: [], moveRangeOnFirstSelection: false, preventSnapRefocus: true }), error && (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "red", children: helperText })] }));
@@ -0,0 +1,10 @@
1
+ import type { Control, FieldValues, Path, UseFormSetValue, UseFormWatch } from "react-hook-form";
2
+ type DateRangeSelectorProps<T extends FieldValues> = {
3
+ name: Path<T>;
4
+ watch: UseFormWatch<T>;
5
+ control: Control<T>;
6
+ setValue: UseFormSetValue<T>;
7
+ };
8
+ export declare function DateRangeSelector<T extends FieldValues>({ name, watch, control, setValue, }: Readonly<DateRangeSelectorProps<T>>): import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=DateRangeSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateRangeSelector.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangeSelector/DateRangeSelector.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,IAAI,EAEJ,eAAe,EACf,YAAY,EACb,MAAM,iBAAiB,CAAC;AAUzB,KAAK,sBAAsB,CAAC,CAAC,SAAS,WAAW,IAAI;IACnD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,EACvD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,GACT,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,2CAkFrC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DateRangeSelector = DateRangeSelector;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
9
+ const material_1 = require("@mui/material");
10
+ const luxon_1 = require("luxon");
11
+ const react_1 = require("react");
12
+ const PadBox_1 = require("../../PadBox");
13
+ const utils_1 = require("../../utils");
14
+ const DateRangePicker_1 = require("../DateRangePicker");
15
+ function DateRangeSelector({ name, watch, control, setValue, }) {
16
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
17
+ const [showCustom, setShowCustom] = (0, react_1.useState)(false);
18
+ const dateField = watch(name);
19
+ const castDateRangeToPathValue = (dateField) => {
20
+ return dateField;
21
+ };
22
+ const setRange = (days) => {
23
+ if (!showCustom) {
24
+ const fromDate = luxon_1.DateTime.now().minus({ days }).toISODate();
25
+ const toDate = luxon_1.DateTime.now().toISODate();
26
+ setValue(name, castDateRangeToPathValue([fromDate, toDate]));
27
+ setAnchorEl(null);
28
+ }
29
+ };
30
+ const defaultRanges = [
31
+ { title: "Last 7 days", onClick: () => setRange(7) },
32
+ { title: "Last 14 days", onClick: () => setRange(14) },
33
+ { title: "Last 30 days", onClick: () => setRange(30) },
34
+ { title: "Custom", onClick: () => setShowCustom(true) },
35
+ ];
36
+ (0, react_1.useMemo)(() => {
37
+ if (showCustom && Array.isArray(dateField)) {
38
+ setValue(name, castDateRangeToPathValue(dateField));
39
+ }
40
+ }, [showCustom, name]);
41
+ const handleClick = (event) => {
42
+ setAnchorEl(event.currentTarget);
43
+ };
44
+ const handleClose = () => {
45
+ setAnchorEl(null);
46
+ setShowCustom(false);
47
+ };
48
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", children: [(0, utils_1.formatDate)(dateField[0] ?? "", "dd MMM yyyy"), " -", (0, utils_1.formatDate)(dateField[1] ?? "", "dd MMM yyyy")] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { component: "div", onClick: handleClick, children: (0, jsx_runtime_1.jsx)(MoreVert_1.default, { fontSize: "small" }) }), !!anchorEl && ((0, jsx_runtime_1.jsx)(material_1.Popover, { open: true, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: showCustom ? ((0, jsx_runtime_1.jsx)(DateRangePicker_1.DateRangePicker, { name: name, control: control })) : (defaultRanges.map((item) => ((0, jsx_runtime_1.jsx)(material_1.ListItemButton, { sx: { width: "100%", textAlign: "center" }, onClick: item.onClick, children: item.title }, item.title)))) }) }))] }));
49
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./DateRangeSelector";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangeSelector/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./DateRangeSelector"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"FileNames.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileNames.tsx"],"names":[],"mappings":"AAYA,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,0CAIvB,cAAc,4CA8EhB,CAAC"}
1
+ {"version":3,"file":"FileNames.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileNames.tsx"],"names":[],"mappings":"AAYA,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,0CAIvB,cAAc,4CA+EhB,CAAC"}
@@ -35,6 +35,6 @@ const FileNames = ({ fileNames, previewEnabled = false, onDelete, }) => {
35
35
  const dialogRenderer = {
36
36
  viewAttachment: selectedFile && ((0, jsx_runtime_1.jsx)(ViewFilePreviewDialog_1.ViewFilePreviewDialog, { open: openedDialog === "viewAttachment", onClose: onDialogClose, fileName: selectedFile })),
37
37
  };
38
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [names.map((name, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "5x", alignItems: "center", maxWidth: "80%", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: "100%", textOverflow: "clip", children: name })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [previewEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => fileNames[index] && handlePreviewClick(fileNames[index]), children: (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => onDelete(index), children: (0, jsx_runtime_1.jsx)(DeleteOutlineOutlined_1.default, {}) })] })] }, (0, uuid_1.v4)()))), openedDialog && dialogRenderer[openedDialog]] }));
38
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "5px", maxHeight: "120px", overflow: "auto", children: [names.map((name, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "5x", alignItems: "center", maxWidth: "80%", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: "100%", textOverflow: "clip", children: name })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [previewEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => fileNames[index] && handlePreviewClick(fileNames[index]), children: (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => onDelete(index), children: (0, jsx_runtime_1.jsx)(DeleteOutlineOutlined_1.default, {}) })] })] }, (0, uuid_1.v4)()))), openedDialog && dialogRenderer[openedDialog]] }));
39
39
  };
40
40
  exports.FileNames = FileNames;
@@ -1,6 +1,7 @@
1
1
  export * from "./Autocomplete";
2
2
  export * from "./CheckBox";
3
3
  export * from "./DatePicker";
4
+ export * from "./DateRangeSelector";
4
5
  export * from "./DateRangePicker";
5
6
  export * from "./DateTimePicker";
6
7
  export * from "./FileUpload";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Autocomplete"), exports);
18
18
  __exportStar(require("./CheckBox"), exports);
19
19
  __exportStar(require("./DatePicker"), exports);
20
+ __exportStar(require("./DateRangeSelector"), exports);
20
21
  __exportStar(require("./DateRangePicker"), exports);
21
22
  __exportStar(require("./DateTimePicker"), exports);
22
23
  __exportStar(require("./FileUpload"), exports);
@@ -0,0 +1,21 @@
1
+ import type { TabProps as MuiTabProps } from "@mui/material";
2
+ import type { MouseEvent } from "react";
3
+ import type { MenuProps } from "./TabsMenus";
4
+ export type OnArrowClickFunction = (e: MouseEvent<SVGElement>) => void;
5
+ export type TabModel = {
6
+ label: string;
7
+ value: string | number;
8
+ hint?: string;
9
+ showDot?: boolean;
10
+ menu?: MenuProps[];
11
+ trimLabel?: boolean;
12
+ totalData: number;
13
+ };
14
+ export type TabProps = MuiTabProps & TabModel & {
15
+ activeTab: TabModel;
16
+ index: number;
17
+ onArrowClick: OnArrowClickFunction;
18
+ menuAnchor: HTMLElement | null;
19
+ };
20
+ export declare function Tab({ label, value, showDot, menu, trimLabel, activeTab, index, onArrowClick, menuAnchor, totalData, ...rest }: TabProps): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=Tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../src/TabBar/Tab.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAS7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,MAAM,MAAM,QAAQ,GAAG,WAAW,GAChC,QAAQ,GAAG;IACT,SAAS,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,oBAAoB,CAAC;IACnC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC,CAAC;AAGJ,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAgB,EAChB,SAAS,EACT,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,IAAI,EACR,EAAE,QAAQ,2CAsFV"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Tab = Tab;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const ArrowDropDown_1 = __importDefault(require("@mui/icons-material/ArrowDropDown"));
9
+ const material_1 = require("@mui/material");
10
+ const truncate_1 = __importDefault(require("lodash/truncate"));
11
+ const Chips_1 = require("../Chips");
12
+ const TRIM_LABEL_LENGTH = 15;
13
+ // eslint-disable-next-line sonarjs/cognitive-complexity
14
+ function Tab({ label, value, showDot, menu, trimLabel = true, activeTab, index, onArrowClick, menuAnchor, totalData, ...rest }) {
15
+ const theme = (0, material_1.useTheme)();
16
+ const { butterflyBlue } = theme.palette.app.color;
17
+ const isActive = value === activeTab.value;
18
+ const fallbackTag = label.toLowerCase().replaceAll(/[ _]/g, "-");
19
+ const trimmed = (0, truncate_1.default)(label, {
20
+ length: trimLabel ? TRIM_LABEL_LENGTH : label.length,
21
+ omission: trimLabel ? "..." : "",
22
+ });
23
+ const labelText = isActive ? label : trimmed;
24
+ const props = {
25
+ key: label,
26
+ iconPosition: "end",
27
+ "data-cy": fallbackTag,
28
+ "data-ptag": fallbackTag,
29
+ value: value ?? index,
30
+ label: ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "6px", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", children: labelText }), (0, jsx_runtime_1.jsx)(Chips_1.Chip, { label: totalData, sx: { height: "20px" }, size: "small", color: "info" })] })),
31
+ };
32
+ if (label.length > TRIM_LABEL_LENGTH && !isActive) {
33
+ props.title = label;
34
+ }
35
+ if (value === activeTab.value && menu?.length) {
36
+ props.icon = ((0, jsx_runtime_1.jsx)(ArrowDropDown_1.default, { onClick: onArrowClick, id: `tabDropDown-${value}`, "aria-controls": menuAnchor !== null ? `dropDownMenu-${value}` : undefined, "aria-expanded": menuAnchor !== null ? "true" : undefined, "aria-haspopup": "true", "data-cy": `${fallbackTag}-arrowicon`, "data-ptag": `${fallbackTag}-arrowicon` }));
37
+ }
38
+ return showDot ? ((0, jsx_runtime_1.jsx)(material_1.Tab, { sx: {
39
+ borderRadius: "5px",
40
+ borderBottom: "2px solid",
41
+ borderBottomColor: isActive ? butterflyBlue[900] : "white",
42
+ overflow: "visible",
43
+ [`&.${material_1.tabClasses.root}`]: {
44
+ minHeight: "40px",
45
+ height: "40px",
46
+ },
47
+ }, ...props, ...rest })) : ((0, jsx_runtime_1.jsx)(material_1.Tab, { sx: {
48
+ borderRadius: "5px",
49
+ borderBottom: "2px solid",
50
+ borderBottomColor: isActive ? butterflyBlue[900] : "white",
51
+ [`&.${material_1.tabClasses.root}`]: {
52
+ minHeight: "40px",
53
+ height: "40px",
54
+ },
55
+ }, ...props, ...rest }));
56
+ }
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ import type { TabModel } from "./Tab";
3
+ export type TabBarProps = {
4
+ tabs: TabModel[];
5
+ activeIndex?: number;
6
+ ariaLabel?: string;
7
+ addButton?: ReactNode;
8
+ actionButton?: ReactNode;
9
+ onChange?: (value: TabModel) => void;
10
+ };
11
+ export declare function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex, }: Readonly<TabBarProps>): import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=TabBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/TabBar/TabBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAkB,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAe,GAChB,EAAE,QAAQ,CAAC,WAAW,CAAC,2CAsFvB"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TabBar = TabBar;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const react_1 = require("react");
7
+ const Tab_1 = require("./Tab");
8
+ const TabsMenus_1 = require("./TabsMenus");
9
+ function TabBar({ tabs, onChange, addButton, actionButton, ariaLabel, activeIndex = 0, }) {
10
+ const [activeTab, setActiveTab] = (0, react_1.useState)(tabs[activeIndex]);
11
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
12
+ (0, react_1.useEffect)(() => {
13
+ const activeTabIndex = tabs.findIndex((tab) => tab.value === activeTab.value);
14
+ if (activeTabIndex === -1) {
15
+ if (onChange && tabs[0]) {
16
+ onChange(tabs[0]);
17
+ }
18
+ setActiveTab(tabs[0]);
19
+ }
20
+ }, [tabs, activeTab, onChange]);
21
+ (0, react_1.useEffect)(() => {
22
+ setActiveTab(tabs[activeIndex]);
23
+ }, [activeIndex]);
24
+ const tabChangeHandler = (_event, newTabValue) => {
25
+ const newActiveTab = tabs.find((tab) => tab.value === newTabValue);
26
+ if (newActiveTab) {
27
+ setActiveTab(newActiveTab);
28
+ // eslint-disable-next-line sonarjs/no-gratuitous-expressions
29
+ if (onChange && newActiveTab) {
30
+ onChange(newActiveTab);
31
+ }
32
+ }
33
+ };
34
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(TabsMenus_1.TabsMenus, { activeTab: activeTab, tabs: tabs, onClose: () => setAnchorEl(null), onMenuItemClick: () => setAnchorEl(null), menuAnchor: anchorEl }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", overflow: "hidden", children: (0, jsx_runtime_1.jsx)(material_1.Tabs, { value: activeTab.value, onChange: tabChangeHandler, TabIndicatorProps: {
35
+ sx: {
36
+ display: "none",
37
+ },
38
+ }, variant: "scrollable", scrollButtons: "auto", ScrollButtonComponent: material_1.TabScrollButton, "aria-label": ariaLabel ?? "Tabs", children: tabs.map((tab, index) => ((0, jsx_runtime_1.jsx)(Tab_1.Tab, { index: index, activeTab: activeTab, onArrowClick: (event) => {
39
+ setAnchorEl(event.target);
40
+ }, menuAnchor: anchorEl, ...tab }, tab.value))) }) }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", alignItems: "center", children: [addButton, actionButton] })] })] }));
41
+ }
@@ -0,0 +1,15 @@
1
+ import type { TabModel } from "./Tab";
2
+ export type MenuProps = {
3
+ label: string;
4
+ disabled?: boolean;
5
+ onClick: (tab: TabModel) => void;
6
+ };
7
+ export type TabsMenusProps = {
8
+ tabs: TabModel[];
9
+ menuAnchor: HTMLElement | null;
10
+ activeTab: TabModel;
11
+ onClose: () => void;
12
+ onMenuItemClick: () => void;
13
+ };
14
+ export declare function TabsMenus({ tabs, activeTab, menuAnchor, onClose, onMenuItemClick, }: Readonly<TabsMenusProps>): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=TabsMenus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabsMenus.d.ts","sourceRoot":"","sources":["../../src/TabBar/TabsMenus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,eAAe,GAChB,EAAE,QAAQ,CAAC,cAAc,CAAC,2CAgC1B"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TabsMenus = TabsMenus;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ function TabsMenus({ tabs, activeTab, menuAnchor, onClose, onMenuItemClick, }) {
7
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: tabs
8
+ .filter((tab) => !!tab.menu)
9
+ .map((tab) => ((0, jsx_runtime_1.jsx)(material_1.Menu, { anchorEl: menuAnchor, open: tab.value === activeTab.value && !!menuAnchor, onClose: onClose, id: `dropDownMenu-${tab.value}`, MenuListProps: {
10
+ "aria-labelledby": `tabDropDown-${tab.value}`,
11
+ }, children: tab.menu?.map((menuItem) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { onClick: () => {
12
+ onMenuItemClick();
13
+ menuItem.onClick(activeTab);
14
+ }, disabled: menuItem.disabled, children: menuItem.label }, menuItem.label))) }, tab.value))) }));
15
+ }
@@ -0,0 +1,7 @@
1
+ export { TabBar } from "./TabBar";
2
+ export type { TabBarProps } from "./TabBar";
3
+ export { Tab } from "./Tab";
4
+ export type { OnArrowClickFunction, TabModel, TabProps } from "./Tab";
5
+ export { TabsMenus } from "./TabsMenus";
6
+ export type { MenuProps as TabMenuProps, TabsMenusProps } from "./TabsMenus";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TabBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,SAAS,IAAI,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TabsMenus = exports.Tab = exports.TabBar = void 0;
4
+ var TabBar_1 = require("./TabBar");
5
+ Object.defineProperty(exports, "TabBar", { enumerable: true, get: function () { return TabBar_1.TabBar; } });
6
+ var Tab_1 = require("./Tab");
7
+ Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return Tab_1.Tab; } });
8
+ var TabsMenus_1 = require("./TabsMenus");
9
+ Object.defineProperty(exports, "TabsMenus", { enumerable: true, get: function () { return TabsMenus_1.TabsMenus; } });
@@ -20,6 +20,7 @@ export * from "./Pagination";
20
20
  export * from "./Stepper";
21
21
  export * from "./Svgs";
22
22
  export * from "./Tab";
23
+ export * from "./TabBar";
23
24
  export * from "./Timeline";
24
25
  export * from "./Toast";
25
26
  export * from "./Tooltip";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
@@ -36,6 +36,7 @@ __exportStar(require("./Pagination"), exports);
36
36
  __exportStar(require("./Stepper"), exports);
37
37
  __exportStar(require("./Svgs"), exports);
38
38
  __exportStar(require("./Tab"), exports);
39
+ __exportStar(require("./TabBar"), exports);
39
40
  __exportStar(require("./Timeline"), exports);
40
41
  __exportStar(require("./Toast"), exports);
41
42
  __exportStar(require("./Tooltip"), exports);