pixelize-design-library 1.1.25 → 1.1.27

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.
@@ -20,7 +20,7 @@ export type ButtonGroupIconProps = {
20
20
  label: string;
21
21
  id: string | number;
22
22
  }[];
23
- onDropdownOptionClick?: (option: {
23
+ onDropdownOptionClick?: (event: React.MouseEvent, option: {
24
24
  label: string;
25
25
  id: string | number;
26
26
  }) => void;
@@ -38,12 +38,13 @@ function ButtonGroupIcon(_a) {
38
38
  onRightIconClick();
39
39
  }
40
40
  };
41
- var handleMenuClick = function (option) { return function () {
41
+ var handleMenuClick = function (event, option) {
42
42
  setIsDropdownOpen(false);
43
+ // console.log("Option clicked:", option,event)
43
44
  if (onDropdownOptionClick) {
44
- onDropdownOptionClick(option);
45
+ onDropdownOptionClick(event, option);
45
46
  }
46
- }; };
47
+ };
47
48
  return (react_1.default.createElement(react_2.ButtonGroup, { size: size, isAttached: true, variant: variant, onClick: onButtongroupClick, colorScheme: color, style: buttonGroupStyle },
48
49
  leftIcon && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Left icon button", icon: leftIcon, onClick: onLeftIconClick, onBlur: onBlurLeftIcon, style: buttonGroupLeftIconStyle, sx: {
49
50
  backgroundColor: theme.colors.primary[500],
@@ -65,7 +66,7 @@ function ButtonGroupIcon(_a) {
65
66
  },
66
67
  } }),
67
68
  react_1.default.createElement(react_2.Portal, null,
68
- react_1.default.createElement(react_2.MenuList, { style: menulistStyle }, dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map(function (option, index) { return (react_1.default.createElement(react_2.MenuItem, { key: index, onClick: handleMenuClick(option), style: menuItemStyle }, option.label)); }))))) : rightIcon && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Right icon button", icon: rightIcon, onClick: onRightIconClick, onBlur: onBlurRightIcon, style: buttonGroupRightIconStyle, sx: {
69
+ react_1.default.createElement(react_2.MenuList, { style: menulistStyle }, dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map(function (option, index) { return (react_1.default.createElement(react_2.MenuItem, { key: index, onClick: function (event) { return handleMenuClick(event, option); }, style: menuItemStyle }, option.label)); }))))) : rightIcon && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Right icon button", icon: rightIcon, onClick: onRightIconClick, onBlur: onBlurRightIcon, style: buttonGroupRightIconStyle, sx: {
69
70
  backgroundColor: theme.colors.primary[500],
70
71
  "&:hover": {
71
72
  backgroundColor: theme.colors.primary[400],
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { SelectSearchProps } from "./SelectSearchProps";
3
- export default function SelectSearch({ options, initialSelectedOption, onOptionSelect, inputOnchange, id, name, label, inputStyle, dropdownStyle, isOptionLoading, loadingText, boxStyle, placeholder, searchQuery, isInformation, informationMessage, rightIcon, rightElementStyle, isMultipleSelect, onOptionMultiSelect, }: Readonly<SelectSearchProps>): React.JSX.Element;
3
+ export default function SelectSearch({ options, initialSelectedOption, onOptionSelect, inputOnchange, id, name, label, inputStyle, dropdownStyle, isOptionLoading, loadingText, boxStyle, placeholder, searchQuery, isInformation, informationMessage, rightIcon, rightElementStyle, isMultipleSelect, isRequired, onOptionMultiSelect, }: Readonly<SelectSearchProps>): React.JSX.Element;
@@ -495,12 +495,12 @@ var react_2 = require("@chakra-ui/react");
495
495
  var FormLabel_1 = require("../Common/FormLabel");
496
496
  var useCustomTheme_1 = require("../../Theme/useCustomTheme");
497
497
  function SelectSearch(_a) {
498
- 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, boxStyle = _a.boxStyle, _d = _a.placeholder, placeholder = _d === void 0 ? "Select Option" : _d, _e = _a.searchQuery, searchQuery = _e === void 0 ? "" : _e, _f = _a.isInformation, isInformation = _f === void 0 ? false : _f, informationMessage = _a.informationMessage, rightIcon = _a.rightIcon, rightElementStyle = _a.rightElementStyle, isMultipleSelect = _a.isMultipleSelect, onOptionMultiSelect = _a.onOptionMultiSelect;
498
+ 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, boxStyle = _a.boxStyle, _d = _a.placeholder, placeholder = _d === void 0 ? "Select Option" : _d, _e = _a.searchQuery, searchQuery = _e === void 0 ? "" : _e, _f = _a.isInformation, isInformation = _f === void 0 ? false : _f, informationMessage = _a.informationMessage, rightIcon = _a.rightIcon, rightElementStyle = _a.rightElementStyle, isMultipleSelect = _a.isMultipleSelect, _g = _a.isRequired, isRequired = _g === void 0 ? false : _g, onOptionMultiSelect = _a.onOptionMultiSelect;
499
499
  var theme = (0, useCustomTheme_1.useCustomTheme)();
500
- var _g = (0, react_1.useState)([]), selectedOptions = _g[0], setSelectedOptions = _g[1];
501
- var _h = (0, react_1.useState)(""), inputValue = _h[0], setInputValue = _h[1];
502
- var _j = (0, react_1.useState)(false), isOpen = _j[0], setIsOpen = _j[1];
503
- var _k = (0, react_1.useState)("below"), position = _k[0], setPosition = _k[1];
500
+ var _h = (0, react_1.useState)([]), selectedOptions = _h[0], setSelectedOptions = _h[1];
501
+ var _j = (0, react_1.useState)(""), inputValue = _j[0], setInputValue = _j[1];
502
+ var _k = (0, react_1.useState)(false), isOpen = _k[0], setIsOpen = _k[1];
503
+ var _l = (0, react_1.useState)("below"), position = _l[0], setPosition = _l[1];
504
504
  var inputRef = (0, react_1.useRef)(null);
505
505
  var dropdownRef = (0, react_1.useRef)(null);
506
506
  var filteredOptions = (0, react_1.useMemo)(function () {
@@ -597,7 +597,7 @@ function SelectSearch(_a) {
597
597
  return (react_1.default.createElement(react_2.Text, { px: 4, py: 2, color: "gray.500" }, "No options found"));
598
598
  }, [filteredOptions, isOptionLoading, loadingText, handleOptionClick]);
599
599
  return (react_1.default.createElement(react_2.Box, { display: "flex", flexDirection: "column", position: "relative", sx: boxStyle },
600
- label && (react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isRequired: false, isInformation: isInformation, informationMessage: informationMessage })),
600
+ label && (react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })),
601
601
  isMultipleSelect && selectedOptions.length > 0 && (react_1.default.createElement(react_2.HStack, { spacing: 2, mb: 2 }, selectedOptions.map(function (option) { return (react_1.default.createElement(react_2.Tag, { size: "md", key: option.id, borderRadius: "full", variant: "solid", sx: { backgroundColor: theme.colors.primary[500] } },
602
602
  react_1.default.createElement(react_2.TagLabel, { width: "50px" }, option.label),
603
603
  react_1.default.createElement(react_2.TagCloseButton, { onClick: function () { return handleRemoveOption(option); } }))); }))),
@@ -21,6 +21,7 @@ export type SelectSearchProps = {
21
21
  rightIcon?: React.ReactNode;
22
22
  rightElementStyle?: {};
23
23
  isMultipleSelect?: boolean;
24
+ isRequired?: boolean;
24
25
  };
25
26
  export type selectOptions = {
26
27
  id: string;
@@ -9,7 +9,14 @@ var fi_1 = require("react-icons/fi");
9
9
  var Button_1 = __importDefault(require("../Components/Button/Button"));
10
10
  var ButtonPage = function () {
11
11
  return (react_1.default.createElement("div", null,
12
- react_1.default.createElement(ButtonGroupIcon_1.default, { buttonText: "hello", rightIcon: react_1.default.createElement(fi_1.FiHome, null), leftIcon: react_1.default.createElement(fi_1.FiHome, null), size: "md", variant: "solid" }),
12
+ react_1.default.createElement(ButtonGroupIcon_1.default, { buttonText: "hello", rightIcon: react_1.default.createElement(fi_1.FiHome, null), leftIcon: react_1.default.createElement(fi_1.FiHome, null), size: "md", variant: "solid",
13
+ // color="red"
14
+ rightIconDropdown: true, dropdownOptions: [
15
+ { label: "123", id: "1" },
16
+ { label: "456", id: "2" }
17
+ ], onDropdownOptionClick: function (e, option) {
18
+ console.log(e, option);
19
+ } }),
13
20
  react_1.default.createElement("br", null),
14
21
  react_1.default.createElement("br", null),
15
22
  react_1.default.createElement("br", null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",