From e0454a3b6c14c5aff5a99924813e0cf00c8fd2b6 Mon Sep 17 00:00:00 2001 From: Subhonbek Date: Mon, 22 May 2023 11:45:20 +0300 Subject: [PATCH] add badge comboBox & comboBox-sb fix --- .../components/combobox/combobox.stories.js | 33 +++++++++++++ packages/components/combobox/index.js | 49 ++++++++++++------- packages/components/drop-down-item/index.js | 16 +++++- 3 files changed, 77 insertions(+), 21 deletions(-) diff --git a/packages/components/combobox/combobox.stories.js b/packages/components/combobox/combobox.stories.js index 9f615d5aa6..efdfb8dd50 100644 --- a/packages/components/combobox/combobox.stories.js +++ b/packages/components/combobox/combobox.stories.js @@ -8,6 +8,18 @@ import CatalogEmployeeReactSvgUrl from "PUBLIC_DIR/images/catalog.employee.react import CatalogGuestReactSvgUrl from "PUBLIC_DIR/images/catalog.guest.react.svg?url"; import CopyReactSvgUrl from "PUBLIC_DIR/images/copy.react.svg?url"; +export default { + title: "Components/ComboBox", + component: ComboBox, + parameters: { + docs: { + description: { + component: "ComboBox is used for a action on a page.", + }, + }, + }, +}; + const comboOptions = [ { key: 1, @@ -74,6 +86,21 @@ const Wrapper = (props) => ( const childrenItems = children.length > 0 ? children : null; +const BadgeTypeTemplate = (args) => ( + + + +); const Template = (args) => ( - 0} - optionsLength={optionsLength} - withAdvancedOptions={withAdvancedOptions} - innerContainer={children} - innerContainerClassName="optionalBlock" - isOpen={isOpen} - size={size} - scaled={scaled} - comboIcon={comboIcon} - modernView={modernView} - fillIcon={fillIcon} - tabIndex={tabIndex} - isLoading={isLoading} - /> + {type === "badge" ? ( + + ) : ( + 0} + optionsLength={optionsLength} + withAdvancedOptions={withAdvancedOptions} + innerContainer={children} + innerContainerClassName="optionalBlock" + isOpen={isOpen} + size={size} + scaled={scaled} + comboIcon={comboIcon} + modernView={modernView} + fillIcon={fillIcon} + tabIndex={tabIndex} + isLoading={isLoading} + /> + )} + {displayType !== "toggle" && ( { const { isSeparator, label, + backgroundColor, icon, children, disabled, className, + type, theme, fillIcon, isSubMenu, @@ -46,6 +49,8 @@ const DropDownItem = (props) => { onClickAction(event); }; + console.log("isSubMenu: ", isSubMenu, "withToggle: ", isSubMenu); + return ( { )} - {isSeparator ? "\u00A0" : label ? label : children && children} + {type === "badge" ? ( + + ) : isSeparator ? ( + "\u00A0" + ) : label ? ( + label + ) : ( + children && children + )} {isSubMenu && ( @@ -83,7 +96,6 @@ const DropDownItem = (props) => { /> )} - {withToggle && (