pixelize-design-library 1.0.58 → 1.0.59

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.
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  import { AccordionProps } from "./AccordionProps";
3
- export declare const Accordion: ({}: AccordionProps) => React.JSX.Element;
3
+ export declare const Accordion: ({ allowMultiple, allowToggle, index, onChange, reduceMotion, items, ...rest }: AccordionProps) => React.JSX.Element;
@@ -1,11 +1,41 @@
1
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 __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
26
  };
5
27
  Object.defineProperty(exports, "__esModule", { value: true });
6
28
  exports.Accordion = void 0;
7
29
  var react_1 = __importDefault(require("react"));
30
+ var react_2 = require("@chakra-ui/react");
8
31
  var Accordion = function (_a) {
9
- return (react_1.default.createElement("div", null, "Accordion"));
32
+ var allowMultiple = _a.allowMultiple, allowToggle = _a.allowToggle, index = _a.index, onChange = _a.onChange, reduceMotion = _a.reduceMotion, items = _a.items, rest = __rest(_a, ["allowMultiple", "allowToggle", "index", "onChange", "reduceMotion", "items"]);
33
+ return (react_1.default.createElement(react_2.Accordion, __assign({ allowMultiple: allowMultiple, allowToggle: allowToggle, index: index, onChange: onChange, reduceMotion: reduceMotion }, rest), items.map(function (item, idx) {
34
+ var _a, _b, _c;
35
+ return (react_1.default.createElement(react_2.AccordionItem, __assign({ key: idx }, item.itemProps, { sx: (_a = item.customStyles) === null || _a === void 0 ? void 0 : _a.itemStyle }),
36
+ react_1.default.createElement("h2", null,
37
+ react_1.default.createElement(react_2.AccordionButton, __assign({}, item.buttonProps, { sx: __assign(__assign({}, (_b = item.customStyles) === null || _b === void 0 ? void 0 : _b.buttonStyle), { border: "1px solid #cdc9c9", backgroundColor: "white", borderRadius: "4px" }) }), item.header)),
38
+ react_1.default.createElement(react_2.AccordionPanel, __assign({}, item.panelProps, { sx: (_c = item.customStyles) === null || _c === void 0 ? void 0 : _c.panelStyle }), item.content)));
39
+ })));
10
40
  };
11
41
  exports.Accordion = Accordion;
@@ -1 +1,16 @@
1
- export type AccordionProps = {};
1
+ /// <reference types="react" />
2
+ import { AccordionProps as ChakraAccordionProps, AccordionItemProps, AccordionButtonProps, AccordionPanelProps } from "@chakra-ui/react";
3
+ export type AccordionProps = ChakraAccordionProps & {
4
+ items: {
5
+ header: React.ReactNode;
6
+ content: React.ReactNode;
7
+ buttonProps?: AccordionButtonProps;
8
+ panelProps?: AccordionPanelProps;
9
+ itemProps?: AccordionItemProps;
10
+ customStyles?: {
11
+ buttonStyle?: React.CSSProperties;
12
+ panelStyle?: React.CSSProperties;
13
+ itemStyle?: React.CSSProperties;
14
+ };
15
+ }[];
16
+ };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { AlertDialogsProps } from "./AlertDialogProps";
3
+ declare const AlertDialog: ({ isOpen, onClose, leastDestructiveRef, content, title, confirmButtonText, cancelButtonText, isConfirmLoading, onConfirm, headerStyle, bodyStyle, footerStyle, closeButtonStyle, button1Style, button2Style, }: AlertDialogsProps) => React.JSX.Element;
4
+ export default AlertDialog;
@@ -0,0 +1,20 @@
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
+ var react_1 = require("@chakra-ui/react");
7
+ var react_2 = __importDefault(require("react"));
8
+ var AlertDialog = function (_a) {
9
+ var isOpen = _a.isOpen, onClose = _a.onClose, leastDestructiveRef = _a.leastDestructiveRef, content = _a.content, title = _a.title, _b = _a.confirmButtonText, confirmButtonText = _b === void 0 ? "Yes" : _b, _c = _a.cancelButtonText, cancelButtonText = _c === void 0 ? "No" : _c, isConfirmLoading = _a.isConfirmLoading, onConfirm = _a.onConfirm, headerStyle = _a.headerStyle, bodyStyle = _a.bodyStyle, footerStyle = _a.footerStyle, closeButtonStyle = _a.closeButtonStyle, button1Style = _a.button1Style, button2Style = _a.button2Style;
10
+ return (react_2.default.createElement(react_1.AlertDialog, { motionPreset: "slideInBottom", leastDestructiveRef: leastDestructiveRef, onClose: onClose, isOpen: isOpen, isCentered: true },
11
+ react_2.default.createElement(react_1.AlertDialogOverlay, null),
12
+ react_2.default.createElement(react_1.AlertDialogContent, null,
13
+ react_2.default.createElement(react_1.AlertDialogHeader, { sx: headerStyle }, title),
14
+ react_2.default.createElement(react_1.AlertDialogCloseButton, { sx: closeButtonStyle }),
15
+ react_2.default.createElement(react_1.AlertDialogBody, { sx: bodyStyle }, content),
16
+ react_2.default.createElement(react_1.AlertDialogFooter, { sx: footerStyle },
17
+ react_2.default.createElement(react_1.Button, { ref: null, onClick: onClose, sx: button1Style }, cancelButtonText),
18
+ react_2.default.createElement(react_1.Button, { colorScheme: "red", onClick: onConfirm, isLoading: isConfirmLoading, ml: 3, sx: button2Style }, confirmButtonText)))));
19
+ };
20
+ exports.default = AlertDialog;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { AlertDialogProps, AlertProps } from "@chakra-ui/react";
3
+ export type AlertDialogsProps = Pick<AlertDialogProps, "isOpen" | "onClose" | "leastDestructiveRef"> & Pick<AlertProps, "addRole" | "colorScheme" | "size" | "status" | "variant"> & {
4
+ title: string;
5
+ content: string;
6
+ isCentered?: boolean;
7
+ confirmButtonText?: string;
8
+ cancelButtonText?: string;
9
+ isConfirmLoading?: boolean;
10
+ onConfirm: () => void;
11
+ headerStyle?: React.CSSProperties;
12
+ bodyStyle?: React.CSSProperties;
13
+ footerStyle?: React.CSSProperties;
14
+ closeButtonStyle?: React.CSSProperties;
15
+ button1Style?: React.CSSProperties;
16
+ button2Style?: React.CSSProperties;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { DropdownProps } from "./DropdownProps";
3
- declare const Dropdown: ({ ButtonText, options, handleOptionSelect, dropdownType, text, textDropdownIcon, }: DropdownProps) => React.JSX.Element;
3
+ declare const Dropdown: ({ dropDownButtonStyle, ButtonText, options, handleOptionSelect, dropdownType, text, DropdownIcon, isVisibleIconShow, buttonProps, }: DropdownProps) => React.JSX.Element;
4
4
  export default Dropdown;
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
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);
5
12
  };
6
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
14
  if (k2 === undefined) k2 = k;
@@ -26,74 +33,52 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
33
  __setModuleDefault(result, mod);
27
34
  return result;
28
35
  };
29
- var __importDefault = (this && this.__importDefault) || function (mod) {
30
- return (mod && mod.__esModule) ? mod : { "default": mod };
31
- };
32
36
  Object.defineProperty(exports, "__esModule", { value: true });
33
37
  var react_1 = __importStar(require("react"));
34
- var react_2 = require("react");
35
- var styled_1 = __importDefault(require("@emotion/styled"));
38
+ var react_2 = require("@chakra-ui/react");
36
39
  var fi_1 = require("react-icons/fi");
37
- var react_3 = require("@emotion/react");
38
- var showAnimation = (0, react_3.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"], ["\n 0% {\n opacity: 0;\n transform: translateY(-10px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
39
- var closeAnimation = (0, react_3.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {\n opacity: 1;\n transform: translateY(0);\n }\n 100% {\n opacity: 0;\n transform: translateY(-10px);\n }\n"], ["\n 0% {\n opacity: 1;\n transform: translateY(0);\n }\n 100% {\n opacity: 0;\n transform: translateY(-10px);\n }\n"])));
40
- var DropdownContainer = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n display: inline-block;\n // font-size: 1rem;\n // font-weight: 300;\n"], ["\n position: relative;\n display: inline-block;\n // font-size: 1rem;\n // font-weight: 300;\n"])));
41
- var DropdownButton = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: #000000;\n padding: 0.3rem 2rem;\n border: none;\n cursor: pointer;\n border: 1px solid #3182ce;\n width: 100%;\n margin-bottom: 2%;\n &:hover {\n // background-color: #c9dff8;\n }\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: #000000;\n padding: 0.3rem 2rem;\n border: none;\n cursor: pointer;\n border: 1px solid #3182ce;\n width: 100%;\n margin-bottom: 2%;\n &:hover {\n // background-color: #c9dff8;\n }\n"])));
42
- var DropdownContent = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: none;\n position: absolute;\n background-color: #f9f9f9;\n border: 1px solid #3182ce;\n width: 100%;\n min-width: 200px;\n width: fit-content;\n box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);\n z-index: 5;\n top: 100%;\n &.show {\n display: block;\n animation: ", " 0.3s forwards;\n }\n &.close {\n animation: ", " 0.3s forwards;\n }\n"], ["\n display: none;\n position: absolute;\n background-color: #f9f9f9;\n border: 1px solid #3182ce;\n width: 100%;\n min-width: 200px;\n width: fit-content;\n box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);\n z-index: 5;\n top: 100%;\n &.show {\n display: block;\n animation: ", " 0.3s forwards;\n }\n &.close {\n animation: ", " 0.3s forwards;\n }\n"])), showAnimation, closeAnimation);
43
- var ListItem = styled_1.default.li(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: black;\n padding: 5px 10px;\n text-decoration: none;\n display: block;\n display: flex;\n cursor: pointer;\n align-items: center;\n &:hover {\n background-color: #f1f1f1;\n color: #3182ce;\n }\n"], ["\n color: black;\n padding: 5px 10px;\n text-decoration: none;\n display: block;\n display: flex;\n cursor: pointer;\n align-items: center;\n &:hover {\n background-color: #f1f1f1;\n color: #3182ce;\n }\n"])));
44
- var LiParent = styled_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
45
- var ImageContainer = styled_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n // margin-left: ", ";\n padding-right: ", ";\n color: #3182ce;\n svg {\n transition: transform 0.3s ease;\n transform: ", ";\n }\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n // margin-left: ", ";\n padding-right: ", ";\n color: #3182ce;\n svg {\n transition: transform 0.3s ease;\n transform: ", ";\n }\n"])), function (_a) {
46
- var Position = _a.Position;
47
- return (Position === "button" ? "0" : "0.5rem");
48
- }, function (_a) {
49
- var Position = _a.Position;
50
- return (Position === "button" ? "0.2rem" : "0");
51
- }, function (_a) {
52
- var isVisible = _a.isVisible;
53
- return isVisible ? "rotate(180deg)" : "rotate(0deg)";
54
- });
55
- var DropdownText = styled_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: pointer;\n margin-bottom: 2%;\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n cursor: pointer;\n margin-bottom: 2%;\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
56
- var TextContent = styled_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n max-width: 12rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: 0.5rem;\n"], ["\n max-width: 12rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: 0.5rem;\n"])));
40
+ var framer_motion_1 = require("framer-motion");
41
+ var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
57
42
  var Dropdown = function (_a) {
58
- var ButtonText = _a.ButtonText, options = _a.options, handleOptionSelect = _a.handleOptionSelect, _b = _a.dropdownType, dropdownType = _b === void 0 ? "button" : _b, text = _a.text, textDropdownIcon = _a.textDropdownIcon;
59
- var _c = (0, react_2.useState)(false), isVisible = _c[0], setIsVisible = _c[1];
60
- var toggleDropdown = function () { return setIsVisible(!isVisible); };
43
+ var dropDownButtonStyle = _a.dropDownButtonStyle, ButtonText = _a.ButtonText, options = _a.options, handleOptionSelect = _a.handleOptionSelect, _b = _a.dropdownType, dropdownType = _b === void 0 ? "button" : _b, text = _a.text, DropdownIcon = _a.DropdownIcon, _c = _a.isVisibleIconShow, isVisibleIconShow = _c === void 0 ? true : _c, buttonProps = _a.buttonProps;
44
+ var _d = (0, react_2.useDisclosure)(), isOpen = _d.isOpen, onToggle = _d.onToggle, onClose = _d.onClose;
61
45
  var dropdownRef = (0, react_1.useRef)(null);
62
46
  var handleListItemClick = function (optionId, optionLabel) {
63
- setIsVisible(false);
47
+ onClose();
64
48
  handleOptionSelect(optionId, optionLabel);
65
49
  };
66
50
  (0, react_1.useEffect)(function () {
67
51
  var handleClickOutside = function (event) {
68
52
  if (dropdownRef.current &&
69
53
  !dropdownRef.current.contains(event.target)) {
70
- setIsVisible(false);
54
+ onClose();
71
55
  }
72
56
  };
73
57
  document.addEventListener("mousedown", handleClickOutside);
74
58
  return function () {
75
59
  document.removeEventListener("mousedown", handleClickOutside);
76
60
  };
77
- }, [dropdownRef]);
78
- var dropDownToogleOption = function () {
79
- var ButtonToogle = (react_1.default.createElement(DropdownButton, { onClick: toggleDropdown },
80
- ButtonText,
81
- "\u00A0",
82
- react_1.default.createElement(ImageContainer, { isVisible: isVisible },
83
- react_1.default.createElement(fi_1.FiChevronDown, null))));
84
- var TextToggle = (react_1.default.createElement(DropdownText, { onClick: toggleDropdown },
85
- react_1.default.createElement(ImageContainer, { isVisible: false, Position: "button" }, textDropdownIcon),
86
- text));
87
- return dropdownType === "button" ? ButtonToogle : TextToggle;
61
+ }, [dropdownRef, onClose]);
62
+ var dropDownToggleOption = function () {
63
+ var ButtonToggle = (react_1.default.createElement(react_2.Button, __assign({ onClick: onToggle, style: dropDownButtonStyle, rightIcon: isVisibleIconShow ? react_1.default.createElement(react_2.Icon, { as: fi_1.FiChevronDown, transform: isOpen ? "rotate(180deg)" : "rotate(0deg)" }) : undefined }, buttonProps),
64
+ DropdownIcon,
65
+ " \u00A0 ",
66
+ ButtonText));
67
+ var TextToggle = (react_1.default.createElement(react_2.Flex, { onClick: onToggle, align: "center", style: dropDownButtonStyle, cursor: "pointer" },
68
+ DropdownIcon,
69
+ " \u00A0 ",
70
+ text,
71
+ " \u00A0",
72
+ isVisibleIconShow && react_1.default.createElement(react_2.Icon, { as: fi_1.FiChevronDown })));
73
+ return dropdownType === "button" ? ButtonToggle : TextToggle;
88
74
  };
89
- var DropdownContentRunder = function () {
90
- return (react_1.default.createElement("ul", null, options.map(function (option) { return (react_1.default.createElement(ListItem, { key: option.id, onClick: function () { return handleListItemClick(option.id, option.label); } }, option.image && (react_1.default.createElement(LiParent, null,
91
- react_1.default.createElement(ImageContainer, { isVisible: false }, option.image),
92
- react_1.default.createElement(TextContent, null, option.label))))); })));
75
+ var DropdownContentRender = function () {
76
+ return (react_1.default.createElement(react_2.List, { bg: "white", border: "1px solid", borderColor: "blue.500", shadow: "md", p: 2, mt: 2, minWidth: "200px" }, options.map(function (option) { return (react_1.default.createElement(react_2.ListItem, { key: option.id, onClick: function () { return handleListItemClick(option.id, option.label); }, p: 2, _hover: { bg: "gray.100", color: "blue.500" }, display: "flex", alignItems: "center", cursor: "pointer" },
77
+ (option === null || option === void 0 ? void 0 : option.image) && (react_1.default.createElement(react_2.Icon, { as: option.image, boxSize: "1.5rem", mr: 2 })),
78
+ react_1.default.createElement(react_2.Box, { as: "span", isTruncated: true }, option.label))); })));
93
79
  };
94
- return (react_1.default.createElement(DropdownContainer, { ref: dropdownRef },
95
- dropDownToogleOption(),
96
- react_1.default.createElement(DropdownContent, { className: isVisible ? "show" : "" }, DropdownContentRunder())));
80
+ return (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "relative", display: "inline-block", width: "100%" },
81
+ dropDownToggleOption(),
82
+ isOpen && (react_1.default.createElement(MotionBox, { position: "absolute", zIndex: 5, initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 } }, DropdownContentRender()))));
97
83
  };
98
84
  exports.default = Dropdown;
99
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
@@ -1,15 +1,19 @@
1
1
  /// <reference types="react" />
2
+ import { ButtonProps } from "@chakra-ui/react";
2
3
  export type DropdownProps = {
3
4
  ButtonText?: string;
4
5
  options: Option[];
5
6
  handleOptionSelect: (id: string | number, label: string) => void;
6
7
  dropdownType?: "button" | "text";
7
8
  text?: string;
8
- textDropdownIcon?: JSX.Element;
9
+ DropdownIcon?: JSX.Element;
10
+ dropDownButtonStyle?: React.CSSProperties;
11
+ isVisibleIconShow?: boolean;
12
+ buttonProps?: ButtonProps;
9
13
  };
10
14
  type Option = {
11
15
  id: string | number;
12
16
  label: string;
13
- image?: JSX.Element;
17
+ image?: React.ElementType;
14
18
  };
15
19
  export {};
@@ -9,14 +9,6 @@ function Modal(_a) {
9
9
  var size = _a.size, _b = _a.isOpen, isOpen = _b === void 0 ? false : _b, onClose = _a.onClose, _c = _a.overlaybg, overlaybg = _c === void 0 ? "blackAlpha.300" : _c, _d = _a.overlaybackdropFilter, overlaybackdropFilter = _d === void 0 ? "blur(10px) hue-rotate(90deg)" : _d, overlaybackdropInvert = _a.overlaybackdropInvert, overlaybackdropBlur = _a.overlaybackdropBlur, isCentered = _a.isCentered, finalFocusRef = _a.finalFocusRef, blockScrollOnMount = _a.blockScrollOnMount, initialFocusRef = _a.initialFocusRef, closeOnOverlayClick = _a.closeOnOverlayClick, motionPreset = _a.motionPreset, scrollBehavior = _a.scrollBehavior, children = _a.children, isLoading = _a.isLoading;
10
10
  if (!isOpen)
11
11
  return react_1.default.createElement(react_1.default.Fragment, null);
12
- // const filterChildren = (type: string) => {
13
- // return React.Children.map(children, (child) => {
14
- // if (child.type === type) return child.props.children;
15
- // }).filter(Boolean)[0]; // Get the first (and should be only) element's children
16
- // };
17
- // const headerContent = filterChildren("header");
18
- // const bodyContent = filterChildren("body");
19
- // const footerContent = filterChildren("footer");
20
12
  var isReactElement = function (child) {
21
13
  return child !== null && typeof child === "object" && "type" in child;
22
14
  };
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
3
  if (k2 === undefined) k2 = k;
8
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -26,26 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
22
  __setModuleDefault(result, mod);
27
23
  return result;
28
24
  };
29
- var __importDefault = (this && this.__importDefault) || function (mod) {
30
- return (mod && mod.__esModule) ? mod : { "default": mod };
31
- };
32
25
  Object.defineProperty(exports, "__esModule", { value: true });
33
26
  var react_1 = __importStar(require("react"));
34
- var styled_1 = __importDefault(require("@emotion/styled"));
35
27
  var react_2 = require("@chakra-ui/react");
36
- var Container = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n position: relative;\n"], ["\n display: flex;\n flex-direction: column;\n position: relative;\n"])));
37
- var Label = styled_1.default.label(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n margin-bottom: 5px;\n font-weight: bold;\n"], ["\n display: block;\n margin-bottom: 5px;\n font-weight: bold;\n"])));
38
- var Input = styled_1.default.input(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n &:hover {\n border-color: #3182ce;\n }\n &:focus-visible,\n &:focus {\n border-color: #3182ce;\n outline: none;\n }\n"], ["\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n &:hover {\n border-color: #3182ce;\n }\n &:focus-visible,\n &:focus {\n border-color: #3182ce;\n outline: none;\n }\n"])));
39
- var Dropdown = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: 0;\n right: 0;\n border: 1px solid #ccc;\n border-radius: 4px;\n background: white;\n max-height: 150px;\n overflow-y: auto;\n z-index: 1000;\n #max-width: 50%;\n"], ["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: 0;\n right: 0;\n border: 1px solid #ccc;\n border-radius: 4px;\n background: white;\n max-height: 150px;\n overflow-y: auto;\n z-index: 1000;\n #max-width: 50%;\n"])), function (props) { return (props.position === "below" ? "100%" : "auto"); }, function (props) { return (props.position === "above" ? "100%" : "auto"); });
40
- var Option = styled_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: 8px;\n cursor: pointer;\n &:hover {\n background: #3182ce24;\n }\n"], ["\n padding: 8px;\n cursor: pointer;\n &:hover {\n background: #3182ce24;\n }\n"])));
41
- var NoOptions = styled_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding: 8px;\n color: #999;\n"], ["\n padding: 8px;\n color: #999;\n"])));
42
- var Loading = styled_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding: 8px;\n text-align: center;\n color: #3182ce;\n align-item: center;\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n padding: 8px;\n text-align: center;\n color: #3182ce;\n align-item: center;\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
43
28
  function SelectSearch(_a) {
44
29
  var options = _a.options, _b = _a.initialSelectedOption, initialSelectedOption = _b === void 0 ? null : _b, onOptionSelect = _a.onOptionSelect, inputOnchange = _a.inputOnchange, id = _a.id, name = _a.name, label = _a.label, inputStyle = _a.inputStyle, dropdownStyle = _a.dropdownStyle, isOptionLoading = _a.isOptionLoading, _c = _a.loadingText, loadingText = _c === void 0 ? "loading" : _c;
45
30
  var _d = (0, react_1.useState)(initialSelectedOption ? initialSelectedOption.label : ""), inputValue = _d[0], setInputValue = _d[1];
46
31
  var _e = (0, react_1.useState)(false), isOpen = _e[0], setIsOpen = _e[1];
47
32
  var _f = (0, react_1.useState)("below"), position = _f[0], setPosition = _f[1];
48
- // const [dropdownTop, setDropdownTop] = useState(0);
49
33
  var inputRef = (0, react_1.useRef)(null);
50
34
  var dropdownRef = (0, react_1.useRef)(null);
51
35
  var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (option) {
@@ -78,15 +62,12 @@ function SelectSearch(_a) {
78
62
  var spaceAbove = inputRect.top + window.scrollY;
79
63
  if (spaceBelow >= dropdownRect.height) {
80
64
  setPosition("below");
81
- console.log("below");
82
65
  }
83
66
  else if (spaceAbove >= dropdownRect.height) {
84
67
  setPosition("above");
85
- console.log("above");
86
68
  }
87
69
  else {
88
70
  setPosition("below");
89
- console.log("below");
90
71
  }
91
72
  }
92
73
  };
@@ -121,14 +102,11 @@ function SelectSearch(_a) {
121
102
  window.removeEventListener("resize", handleResize);
122
103
  };
123
104
  }, [isOpen]);
124
- return (react_1.default.createElement(Container, null,
125
- react_1.default.createElement(Label, null, label),
126
- react_1.default.createElement(Input, { ref: inputRef, value: inputValue, onClick: function () { return setIsOpen(true); }, onChange: handleInputChange, placeholder: "Select option", onKeyDown: handleKeyDown, id: id, type: "text", name: name, style: inputStyle }),
127
- isOpen && (react_1.default.createElement(Dropdown, { ref: dropdownRef, style: dropdownStyle, position: position }, isOptionLoading ? (react_1.default.createElement(Loading, null,
128
- react_1.default.createElement(react_2.Spinner, { thickness: "2px", speed: "0.65s", emptyColor: "gray.200", color: "blue.500", size: "sm" }),
129
- " ",
130
- "\u00A0",
131
- loadingText)) : (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) > 0 ? (filteredOptions.map(function (option) { return (react_1.default.createElement(Option, { key: option.id, onClick: function () { return handleOptionClick(option); } }, option.label)); })) : (react_1.default.createElement(NoOptions, null, "No options found"))))));
105
+ return (react_1.default.createElement(react_2.Box, { display: "flex", flexDirection: "column", position: "relative" },
106
+ react_1.default.createElement(react_2.FormLabel, { htmlFor: id, mb: 2, fontWeight: "bold" }, label),
107
+ react_1.default.createElement(react_2.Input, { ref: inputRef, value: inputValue, onClick: function () { return setIsOpen(true); }, onChange: handleInputChange, placeholder: "Select option", onKeyDown: handleKeyDown, id: id, name: name, cursor: "pointer", borderColor: "gray.300", _hover: { borderColor: "blue.500" }, _focus: { borderColor: "blue.500" } }),
108
+ isOpen && (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: "gray.300", borderRadius: "md", bg: "white", maxHeight: "150px", overflowY: "auto", zIndex: 10 }, isOptionLoading ? (react_1.default.createElement(react_2.VStack, { py: 2 },
109
+ react_1.default.createElement(react_2.Spinner, { size: "sm", color: "blue.500" }),
110
+ react_1.default.createElement(react_2.Text, { color: "blue.500" }, loadingText))) : (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) > 0 ? (filteredOptions.map(function (option) { return (react_1.default.createElement(react_2.Box, { key: option.id, px: 4, py: 2, cursor: "pointer", _hover: { backgroundColor: "blue.50" }, onClick: function () { return handleOptionClick(option); } }, option.label)); })) : (react_1.default.createElement(react_2.Text, { px: 4, py: 2, color: "gray.500" }, "No options found"))))));
132
111
  }
133
112
  exports.default = SelectSearch;
134
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
package/dist/Layout.js CHANGED
@@ -73,6 +73,9 @@ var DatePicker_1 = __importDefault(require("./Components/DatePicker/DatePicker")
73
73
  var Search_1 = __importDefault(require("./Components/Search/Search"));
74
74
  var Timeline_1 = __importDefault(require("./Components/Timeline/Timeline"));
75
75
  var SelectSearch_1 = __importDefault(require("./Components/SelectSearch/SelectSearch"));
76
+ var Accordion_1 = require("./Components/Accordion/Accordion");
77
+ var fa_1 = require("react-icons/fa");
78
+ var AlertDialog_1 = __importDefault(require("./Components/AlertDialog/AlertDialog"));
76
79
  var Layout = function () {
77
80
  var navmenus = [
78
81
  { title: "Account Settings", url: "myaccount" },
@@ -258,11 +261,11 @@ var Layout = function () {
258
261
  var exportOptionss = (0, react_2.useMemo)(function () { return [
259
262
  // { id: "PDF", label: "Export as PDF", image: <FiChevronUp /> },
260
263
  // { id: "XLS", label: "Export as XLS" },
261
- { id: 1, label: "Upload file", image: react_2.default.createElement(fi_1.FiChevronUp, null) },
262
- { id: 2, label: "Documents", image: react_2.default.createElement(fi_1.FiChevronUp, null) },
263
- { id: 3, label: "CRM workDrive", image: react_2.default.createElement(fi_1.FiChevronUp, null) },
264
- { id: 4, label: "Other Cloud Drives", image: react_2.default.createElement(fi_1.FiChevronUp, null) },
265
- { id: 5, label: "Link(URL)", image: react_2.default.createElement(fi_1.FiChevronUp, null) },
264
+ { id: 1, label: "Upload file" },
265
+ { id: 2, label: "Documents", image: fi_1.FiChevronUp },
266
+ { id: 3, label: "CRM workDrive", image: fi_1.FiChevronUp },
267
+ { id: 4, label: "Other Cloud Drives", image: fi_1.FiChevronUp },
268
+ { id: 5, label: "Link(URL)", image: fi_1.FiChevronUp },
266
269
  ]; }, []);
267
270
  var data = (0, react_2.useMemo)(function () { return Array.from({ length: 10 }, function () { return Math.floor(Math.random() * 100); }); }, []);
268
271
  var categories = (0, react_2.useMemo)(function () { return data.map(function (_, index) { return "Category ".concat(index + 1); }); }, [data]);
@@ -388,6 +391,11 @@ var Layout = function () {
388
391
  var handleSelectClick = function (option) {
389
392
  console.log("Selected option:", option);
390
393
  };
394
+ var _q = (0, react_2.useState)(false), alertActive = _q[0], setAlertActive = _q[1];
395
+ var leastDestructiveRef = react_2.default.useRef();
396
+ var handleAlert = function () {
397
+ setAlertActive(!alertActive);
398
+ };
391
399
  return (react_2.default.createElement(react_1.Box, { minH: "100vh", bg: "gray.100", overflow: "hidden" },
392
400
  react_2.default.createElement(Loading_1.default, { text: "PIXELIZE CRM", isLoading: false, onlytext: true }),
393
401
  react_2.default.createElement(react_1.Flex, null,
@@ -541,9 +549,18 @@ var Layout = function () {
541
549
  console.log("isActive", isActive);
542
550
  } }),
543
551
  react_2.default.createElement("br", null),
544
- react_2.default.createElement(DropDown_1.default, { ButtonText: "Visibility", options: exportOptionss, dropdownType: "button", text: "Visibility", textDropdownIcon: react_2.default.createElement(icons_1.ChevronRightIcon, { color: "gray.500" }), handleOptionSelect: function (id, label) {
552
+ react_2.default.createElement(DropDown_1.default, { ButtonText: "Visibility", options: exportOptionss,
553
+ // dropDownButtonStyle={{ color: "red" }}
554
+ dropdownType: "text", text: "Visibility", DropdownIcon: react_2.default.createElement(fi_1.FiMoreHorizontal, { color: "gray.500" }), handleOptionSelect: function (id, label) {
545
555
  console.log("optionid", id, label);
546
556
  } }),
557
+ react_2.default.createElement("br", null),
558
+ react_2.default.createElement("br", null),
559
+ react_2.default.createElement(DropDown_1.default, { ButtonText: "hello", options: exportOptionss,
560
+ // dropDownButtonStyle={{ color: "red" }}
561
+ DropdownIcon: react_2.default.createElement(fi_1.FiMoreHorizontal, { color: "gray.500" }), dropdownType: "button", handleOptionSelect: function (id, label) {
562
+ console.log("optionid", id, label);
563
+ }, buttonProps: { variant: "solid", colorScheme: "red" }, isVisibleIconShow: true }),
547
564
  react_2.default.createElement("div", null,
548
565
  react_2.default.createElement("br", null),
549
566
  react_2.default.createElement("br", null)),
@@ -585,8 +602,6 @@ var Layout = function () {
585
602
  react_2.default.createElement(Timeline_1.default, { timelineEvents: timeline }),
586
603
  react_2.default.createElement("br", null),
587
604
  react_2.default.createElement("br", null),
588
- react_2.default.createElement("br", null),
589
- react_2.default.createElement("br", null),
590
605
  react_2.default.createElement(SelectSearch_1.default, { options: [
591
606
  { id: "1", label: "Option 1" },
592
607
  { id: "2", label: "select 2" },
@@ -596,14 +611,42 @@ var Layout = function () {
596
611
  },
597
612
  ], inputOnchange: function (value) {
598
613
  console.log(value);
599
- }, initialSelectedOption: { id: "1", label: "Option 1" }, onOptionSelect: handleSelectClick, name: "hai", isOptionLoading: true }),
600
- react_2.default.createElement("br", null),
601
- react_2.default.createElement("br", null),
614
+ }, initialSelectedOption: { id: "1", label: "Option 1" }, onOptionSelect: handleSelectClick, name: "hai",
615
+ // isOptionLoading={true}
616
+ label: "SelectSearch" }),
602
617
  react_2.default.createElement("br", null),
603
618
  react_2.default.createElement("br", null),
619
+ react_2.default.createElement(react_1.Text, null, "Accordion"),
620
+ react_2.default.createElement(Accordion_1.Accordion, { allowToggle: true, items: [
621
+ {
622
+ header: (react_2.default.createElement(react_2.default.Fragment, null,
623
+ react_2.default.createElement(react_1.Box, { as: "span", flex: "1", textAlign: "left" }, "Section 1 title"),
624
+ react_2.default.createElement(fa_1.FaChevronDown, { style: { marginRight: "8px" } }))),
625
+ content: (react_2.default.createElement("div", null,
626
+ react_2.default.createElement(react_1.Text, null, "This is text inside Section 1."),
627
+ react_2.default.createElement(react_1.Box, { bg: "gray.200", p: 4, mt: 2 }, "This is a box with more content inside Section 1."),
628
+ react_2.default.createElement(react_1.Flex, { mt: 2 },
629
+ react_2.default.createElement(react_1.Box, { flex: "1", bg: "blue.200", p: 4 }, "Box 1"),
630
+ react_2.default.createElement(react_1.Box, { flex: "1", bg: "green.200", p: 4, ml: 2 }, "Box 2")))),
631
+ },
632
+ {
633
+ header: (react_2.default.createElement(react_2.default.Fragment, null,
634
+ react_2.default.createElement(react_1.Box, { as: "span", flex: "1", textAlign: "left" }, "Section 1 title"),
635
+ react_2.default.createElement(fa_1.FaChevronDown, { style: { marginRight: "8px" } }))),
636
+ content: (react_2.default.createElement("div", null,
637
+ react_2.default.createElement(react_1.Text, null, "This is text inside Section 1."),
638
+ react_2.default.createElement(react_1.Box, { bg: "gray.200", p: 4, mt: 2 }, "This is a box with more content inside Section 1."),
639
+ react_2.default.createElement(react_1.Flex, { mt: 2 },
640
+ react_2.default.createElement(react_1.Box, { flex: "1", bg: "blue.200", p: 4 }, "Box 1"),
641
+ react_2.default.createElement(react_1.Box, { flex: "1", bg: "green.200", p: 4, ml: 2 }, "Box 2")))),
642
+ },
643
+ ] }),
604
644
  react_2.default.createElement("br", null),
605
645
  react_2.default.createElement("br", null),
606
646
  react_2.default.createElement("br", null),
607
- react_2.default.createElement("br", null))))));
647
+ react_2.default.createElement(react_1.Button, { onClick: function () {
648
+ setAlertActive(true);
649
+ } }, "AlertDialog"),
650
+ react_2.default.createElement(AlertDialog_1.default, { isOpen: alertActive, onClose: handleAlert, leastDestructiveRef: leastDestructiveRef, title: "hello", content: "hellobody", onConfirm: function () { return console.log("isenable"); } }))))));
608
651
  };
609
652
  exports.default = Layout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -76,4 +76,4 @@
76
76
  "prettier --write"
77
77
  ]
78
78
  }
79
- }
79
+ }