@bikdotai/bik-component-library 0.0.876-beta.1 → 0.0.876-beta.3
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.
- package/README.md +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.js +2 -2
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.js.map +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +4 -4
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +2 -2
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js.map +1 -1
- package/dist/cjs/components/accordion/Accordion.style.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.js.map +1 -1
- package/dist/cjs/components/action-button/ActionButton.styled.js +1 -1
- package/dist/cjs/components/action-button/ActionButton.styled.js.map +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js.map +1 -1
- package/dist/cjs/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/cjs/components/bik-layout/SidebarStyles.js.map +1 -1
- package/dist/cjs/components/button/Button.styled.js +3 -3
- package/dist/cjs/components/button/Button.styled.js.map +1 -1
- package/dist/cjs/components/buttonGroup/ButtonGroupStyle.js +1 -1
- package/dist/cjs/components/buttonGroup/ButtonGroupStyle.js.map +1 -1
- package/dist/cjs/components/card-selector/CardSelector.styled.js +1 -1
- package/dist/cjs/components/card-selector/CardSelector.styled.js.map +1 -1
- package/dist/cjs/components/carousel-preview/CarouselPreview.style.js +2 -2
- package/dist/cjs/components/carousel-preview/CarouselPreview.style.js.map +1 -1
- package/dist/cjs/components/checkBox/CheckBox.styled.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.styled.js.map +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +27 -10
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/cjs/components/dual-icon-button/DualIconButton.styled.js +2 -2
- package/dist/cjs/components/dual-icon-button/DualIconButton.styled.js.map +1 -1
- package/dist/cjs/components/floating-action-button/FloatingActionButton.styles.js +1 -1
- package/dist/cjs/components/floating-action-button/FloatingActionButton.styles.js.map +1 -1
- package/dist/cjs/components/icon-button/IconButton.styled.js +4 -4
- package/dist/cjs/components/icon-button/IconButton.styled.js.map +1 -1
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.js.map +1 -1
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.styled.js +28 -19
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.styled.js.map +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/cjs/components/product-picker-v2/style.js +2 -2
- package/dist/cjs/components/product-picker-v2/style.js.map +1 -1
- package/dist/cjs/components/switch/Switch.js +2 -2
- package/dist/cjs/components/switch/Switch.js.map +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.js.map +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js.map +1 -1
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.js +2 -2
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.js.map +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +4 -4
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +2 -2
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js.map +1 -1
- package/dist/esm/components/accordion/Accordion.style.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.js.map +1 -1
- package/dist/esm/components/action-button/ActionButton.styled.js +1 -1
- package/dist/esm/components/action-button/ActionButton.styled.js.map +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js.map +1 -1
- package/dist/esm/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/esm/components/bik-layout/SidebarStyles.js.map +1 -1
- package/dist/esm/components/button/Button.styled.js +3 -3
- package/dist/esm/components/button/Button.styled.js.map +1 -1
- package/dist/esm/components/buttonGroup/ButtonGroupStyle.js +1 -1
- package/dist/esm/components/buttonGroup/ButtonGroupStyle.js.map +1 -1
- package/dist/esm/components/card-selector/CardSelector.styled.js +1 -1
- package/dist/esm/components/card-selector/CardSelector.styled.js.map +1 -1
- package/dist/esm/components/carousel-preview/CarouselPreview.style.js +2 -2
- package/dist/esm/components/carousel-preview/CarouselPreview.style.js.map +1 -1
- package/dist/esm/components/checkBox/CheckBox.styled.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.styled.js.map +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +300 -278
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +8 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +170 -126
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +4 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +144 -112
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +32 -31
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +54 -39
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +18 -16
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +73 -27
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +4 -17
- package/dist/esm/components/dropdown/hooks/useDropdown.js +176 -163
- package/dist/esm/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/type.d.ts +22 -0
- package/dist/esm/components/dual-icon-button/DualIconButton.styled.js +2 -2
- package/dist/esm/components/dual-icon-button/DualIconButton.styled.js.map +1 -1
- package/dist/esm/components/floating-action-button/FloatingActionButton.styles.js +1 -1
- package/dist/esm/components/floating-action-button/FloatingActionButton.styles.js.map +1 -1
- package/dist/esm/components/icon-button/IconButton.styled.js +4 -4
- package/dist/esm/components/icon-button/IconButton.styled.js.map +1 -1
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.js +46 -44
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.js.map +1 -1
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.styled.d.ts +3 -0
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.styled.js +25 -15
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.styled.js.map +1 -1
- package/dist/esm/components/multi-level-dropdown/type.d.ts +5 -0
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/esm/components/product-picker-v2/style.js +2 -2
- package/dist/esm/components/product-picker-v2/style.js.map +1 -1
- package/dist/esm/components/switch/Switch.js +2 -2
- package/dist/esm/components/switch/Switch.js.map +1 -1
- package/dist/esm/components/template-preview/RCS/RCSPreview.styled.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSPreview.styled.js.map +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuItem.tsx"],"sourcesContent":["import ChevronRightIcon from '@src/assets/icons/chevronRight.svg';\nimport { forwardRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS, DEFAULT_THEME } from '@src/constants/Theme';\nimport { MultiSelectOption, SingleOption } from '../../../type';\nimport { FreeFormContainer } from './FreeFormMenu.styled';\n\nconst StyledListItem = styled(ListItem)<{\n\tversion?: '1.0' | '2.0' | '3.0';\n\tbrandSelectedRow?: boolean;\n}>`\n\tpadding: ${(props) =>\n\t\tprops.version === '3.0'\n\t\t\t? '8px'\n\t\t\t: props.version === '2.0'\n\t\t\t? '8px 12px'\n\t\t\t: '14px 16px'} !important;\n\tcursor: pointer;\n\tmargin-top: ${(props) =>\n\t\tprops.brandSelectedRow ? '0' : props.version === '2.0' ? '2px' : '0'};\n`;\n\nconst StyledChildDropdownContainer = styled.div<{ version: string }>`\n\tbox-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);\n\tborder-radius: ${({ version }) => (version === '1.0' ? '0' : '8px')};\n\tpadding: ${({ version }) => (version === '1.0' ? '0' : '4px')};\n\tmin-width: 148px;\n\tborder: ${({ version }) =>\n\t\tversion === '1.0'\n\t\t\t? `1px solid ${DEFAULT_THEME.colorsV2.stroke.primary}`\n\t\t\t: 'none'};\n\tmax-height: 248px;\n\toverflow-y: auto;\n`;\n\nconst DragHandleContainer = styled.div`\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, 2.86px);\n\tgrid-template-rows: repeat(3, 2.86px);\n\tcolumn-gap: 3.8px;\n\trow-gap: 4px;\n\tmargin-right: 8px;\n\tcursor: move;\n\tflex-shrink: 0;\n\talign-self: center;\n\theight: fit-content;\n\tmin-height: 18px;\n`;\n\nconst DragDot = styled.div`\n\twidth: 2.86px;\n\theight: 2.86px;\n\tborder-radius: 50%;\n\tbackground-color: ${COLORS.content.inactive};\n\tflex-shrink: 0;\n`;\n\nconst MultiSelectLeadingContainer = styled.div`\n\tdisplay: flex;\n\talign-content: center;\n\tjustify-content: center;\n\tgap: 8px;\n`;\n\nconst LeadingIconWrapper = styled.div`\n\tmargin-right: -4px;\n`;\n\nconst SingleSelectDragContainer = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tflex-direction: column;\n\tflex: 1;\n`;\n\ninterface DragHandleIconProps {\n\tonDragStart?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;\n}\n\nconst DragHandleIcon = ({ onDragStart, onDragEnd }: DragHandleIconProps) => (\n\t<DragHandleContainer\n\t\tdraggable\n\t\tonDragStart={onDragStart}\n\t\tonDragEnd={onDragEnd}\n\t>\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t</DragHandleContainer>\n);\n\ninterface MenuItemProps {\n\toption: SingleOption | MultiSelectOption;\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (option: SingleOption) => void;\n\tonDropdownItemClick?: (option: SingleOption) => void;\n\tlast?: boolean;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tuseDefaultCursor?: boolean;\n\tisFocused?: boolean;\n\tdataIndex?: number;\n\tisDraggable?: boolean;\n\tonDragStart?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragOver?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDrop?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tisDraggedOver?: boolean;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(\n\t(\n\t\t{\n\t\t\toption,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tlast,\n\t\t\tversion,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tisFocused = false,\n\t\t\tdataIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonDragStart,\n\t\t\tonDragOver,\n\t\t\tonDrop,\n\t\t\tonDragEnd,\n\t\t\tisDraggedOver = false,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t},\n\t\tchildRef,\n\t) => {\n\t\tconst [isChildOptionHovered, setIsChildOptionHovered] = useState(\n\t\t\toption.selected,\n\t\t);\n\n\t\tconst handleOptionClick = (option: SingleOption, parent?: SingleOption) => {\n\t\t\tif (!option.children) {\n\t\t\t\tonCheckHandler(!option.selected);\n\t\t\t\tconst updatedOption = parent ? { ...option, parent } : option;\n\t\t\t\tonDropdownItemClick?.(updatedOption);\n\t\t\t}\n\t\t};\n\n\t\tconst onCheckHandler = (checked: boolean) => {\n\t\t\tif (!option.disabled) {\n\t\t\t\tonSelect({ ...option, selected: checked });\n\t\t\t}\n\t\t};\n\n\t\tconst onHoverIn = () => {\n\t\t\tif (option.description) {\n\t\t\t\tshowDescription(option.label, option.description);\n\t\t\t} else {\n\t\t\t\tshowDescription();\n\t\t\t}\n\t\t};\n\n\t\tconst cursorConfig = useDefaultCursor ? { cursor: 'default' } : {};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Tooltip\n\t\t\t\t\tbody={''}\n\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\toption.children ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tbackgroundColor: DEFAULT_THEME.colorsV2.surface.standard,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tref={childRef}\n\t\t\t\t\t\t\t\tonMouseEnter={() => setIsChildOptionHovered(true)}\n\t\t\t\t\t\t\t\tonMouseLeave={() => setIsChildOptionHovered(false)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<StyledChildDropdownContainer version={version ?? '2.0'}>\n\t\t\t\t\t\t\t\t\t{option.children.map((child) => (\n\t\t\t\t\t\t\t\t\t\t<StyledListItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tkey={child.value}\n\t\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\t\tversion !== '1.0' && (option?.children ?? []).length - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t? { borderBottom: 0 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\t\thandleOptionClick(child, option);\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tlistItem={{ value: child.value, label: child.label }}\n\t\t\t\t\t\t\t\t\t\t\tsubText={child.subText}\n\t\t\t\t\t\t\t\t\t\t\tleadingIcon={child.leadingIcon || undefined}\n\t\t\t\t\t\t\t\t\t\t\tcustomComponent={child.customComponent}\n\t\t\t\t\t\t\t\t\t\t\ttrailingIcon={child.trailingIcon || undefined}\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\toption.disabled\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'inactive'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: child.selected\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'default'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</StyledChildDropdownContainer>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<></>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tplacement={'right-start'}\n\t\t\t\t\thideArrow={true}\n\t\t\t\t>\n\t\t\t\t\t<StyledListItem\n\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\tlast\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tborderBottom: 0,\n\t\t\t\t\t\t\t\t\t\t...cursorConfig,\n\t\t\t\t\t\t\t\t\t\t...(isDraggedOver\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderTop: `2px solid ${COLORS.content.brand}`,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t...cursorConfig,\n\t\t\t\t\t\t\t\t\t\t...(isDraggedOver\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderTop: `2px solid ${COLORS.content.brand}`,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\thandleOptionClick(option);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonMouseOver={onHoverIn}\n\t\t\t\t\t\tlistItem={{ value: option.value, label: option.label }}\n\t\t\t\t\t\tsubText={option.subText}\n\t\t\t\t\t\tdata-option-index={dataIndex}\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tid={`dropdown-option-${dataIndex}`}\n\t\t\t\t\t\taria-selected={!!option.selected}\n\t\t\t\t\t\tonDragOver={isDraggable ? onDragOver : undefined}\n\t\t\t\t\t\tonDrop={isDraggable ? onDrop : undefined}\n\t\t\t\t\t\tleadingIcon={\n\t\t\t\t\t\t\tisMultiSelect &&\n\t\t\t\t\t\t\t!(showCheckboxForCustomElement && option.customComponent) ? (\n\t\t\t\t\t\t\t\t<MultiSelectLeadingContainer>\n\t\t\t\t\t\t\t\t\t{isDraggable && (\n\t\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\t\tsize={version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\t\t\t\t\tisDisabled={option.disabled ?? false}\n\t\t\t\t\t\t\t\t\t\tisChecked={!!option.selected}\n\t\t\t\t\t\t\t\t\t\tonValueChange={onCheckHandler}\n\t\t\t\t\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<LeadingIconWrapper>{option.leadingIcon}</LeadingIconWrapper>\n\t\t\t\t\t\t\t\t</MultiSelectLeadingContainer>\n\t\t\t\t\t\t\t) : isDraggable ? (\n\t\t\t\t\t\t\t\t<SingleSelectDragContainer>\n\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{option.leadingIcon && <div>{option.leadingIcon}</div>}\n\t\t\t\t\t\t\t\t</SingleSelectDragContainer>\n\t\t\t\t\t\t\t) : option.leadingIcon ? (\n\t\t\t\t\t\t\t\t<>{option.leadingIcon}</>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcustomComponent={\n\t\t\t\t\t\t\tisMultiSelect &&\n\t\t\t\t\t\t\tshowCheckboxForCustomElement &&\n\t\t\t\t\t\t\toption.customComponent ? (\n\t\t\t\t\t\t\t\t<MultiSelectLeadingContainer>\n\t\t\t\t\t\t\t\t\t{isDraggable && (\n\t\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\t\tsize={version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\t\t\t\t\tisDisabled={option.disabled ?? false}\n\t\t\t\t\t\t\t\t\t\tisChecked={!!option.selected}\n\t\t\t\t\t\t\t\t\t\tonValueChange={onCheckHandler}\n\t\t\t\t\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{option.customComponent}\n\t\t\t\t\t\t\t\t</MultiSelectLeadingContainer>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\toption.customComponent\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrailingIcon={\n\t\t\t\t\t\t\toption.isFreeForm ? (\n\t\t\t\t\t\t\t\t<FreeFormContainer>\n\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: COLORS.content.secondary }}>\n\t\t\t\t\t\t\t\t\t\tFreeform\n\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t</FreeFormContainer>\n\t\t\t\t\t\t\t) : option.children ? (\n\t\t\t\t\t\t\t\t<ChevronRightIcon width={12} height={12} />\n\t\t\t\t\t\t\t) : option.trailingIcon ? (\n\t\t\t\t\t\t\t\t<>{option.trailingIcon}</>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\toption.disabled\n\t\t\t\t\t\t\t\t? 'inactive'\n\t\t\t\t\t\t\t\t: option.selected || (!isMultiSelect && isChildOptionHovered)\n\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t: isFocused\n\t\t\t\t\t\t\t\t? 'focused'\n\t\t\t\t\t\t\t\t: 'default'\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tooltip>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["StyledListItem","styled","ListItem","props","StyledChildDropdownContainer","version","DEFAULT_THEME","DragHandleContainer","DragDot","COLORS","MultiSelectLeadingContainer","LeadingIconWrapper","SingleSelectDragContainer","DragHandleIcon","onDragStart","onDragEnd","jsxs","jsx","MenuItem","forwardRef","option","isMultiSelect","showDescription","onSelect","last","onDropdownItemClick","useDefaultCursor","isFocused","dataIndex","isDraggable","onDragOver","onDrop","isDraggedOver","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","childRef","isChildOptionHovered","setIsChildOptionHovered","useState","handleOptionClick","parent","onCheckHandler","updatedOption","checked","onHoverIn","cursorConfig","Fragment","Tooltip","child","e","CheckBox","FreeFormContainer","BodyCaption","ChevronRightIcon"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAiBC,EAAOC,CAAQ;AAAA,YAI1B,CAACC,MACXA,EAAM,YAAY,QACf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AAAZ;AAAA,gBAACJ;AAAA,gBAAA;AAAA,kBACA,aAAAC;AAAA,kBACA,WAAAC;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGF,gBAAAE;AAAA,gBAACkC;AAAA,gBAAA;AAAA,kBACA,MAAM9C,MAAY,QAAQ,UAAU;AAAA,kBACpC,YAAYe,EAAO,YAAY;AAAA,kBAC/B,WAAW,CAAC,CAACA,EAAO;AAAA,kBACpB,eAAesB;AAAA,kBACf,aAAaR;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEbd,EAAO;AAAA,YAAA,EAAA,CACT,IAEAA,EAAO;AAAA,YAGT,cACCA,EAAO,aACN,gBAAAH,EAACmC,GAAA,EACA,UAAA,gBAAAnC,EAACoC,GAAA,EAAY,OAAO,EAAE,OAAO5C,EAAO,QAAQ,aAAa,UAAA,WAAA,CAEzD,EAAA,CACD,IACGW,EAAO,WACV,gBAAAH,EAACqC,GAAA,EAAiB,OAAO,IAAI,QAAQ,GAAA,CAAI,IACtClC,EAAO,eACV,gBAAAH,EAAA8B,GAAA,EAAG,UAAA3B,EAAO,cAAa,IACpB;AAAA,YAEL,SACCA,EAAO,WACJ,aACAA,EAAO,YAAa,CAACC,KAAiBgB,IACtC,aACAV,IACA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MAEL;AAAA,IAAA,GAEF;AAAA,EAEF;AACD;"}
|
|
1
|
+
{"version":3,"file":"MenuItem.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuItem.tsx"],"sourcesContent":["import ChevronDownIcon from '@src/assets/icons/chevronDownOutline.svg';\nimport ChevronRightIcon from '@src/assets/icons/chevronRight.svg';\nimport ChevronUpIcon from '@src/assets/icons/chevronUpOutline.svg';\nimport { forwardRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS, DEFAULT_THEME } from '@src/constants/Theme';\nimport { MultiSelectOption, SingleOption } from '../../../type';\nimport { FreeFormContainer } from './FreeFormMenu.styled';\n\nconst StyledListItem = styled(ListItem)<{\n\tversion?: '1.0' | '2.0' | '3.0';\n\tbrandSelectedRow?: boolean;\n}>`\n\tpadding: ${(props) =>\n\t\tprops.version === '3.0'\n\t\t\t? '8px'\n\t\t\t: props.version === '2.0'\n\t\t\t? '8px 12px'\n\t\t\t: '14px 16px'} !important;\n\tcursor: pointer;\n\tmargin-top: ${(props) =>\n\t\tprops.brandSelectedRow ? '0' : props.version === '2.0' ? '2px' : '0'};\n`;\n\n// The elbow connector geometry is fixed, so nested rows pin their own metrics\n// instead of varying with `version`.\nconst StyledNestedListItem = styled(StyledListItem)`\n\tpadding: 8px !important;\n\tmargin-top: 0;\n\tborder-radius: 0;\n`;\n\nconst StyledChildDropdownContainer = styled.div<{ version: string }>`\n\tbox-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);\n\tborder-radius: ${({ version }) => (version === '1.0' ? '0' : '8px')};\n\tpadding: ${({ version }) => (version === '1.0' ? '0' : '4px')};\n\tmin-width: 148px;\n\tborder: ${({ version }) =>\n\t\tversion === '1.0'\n\t\t\t? `1px solid ${DEFAULT_THEME.colorsV2.stroke.primary}`\n\t\t\t: 'none'};\n\tmax-height: 248px;\n\toverflow-y: auto;\n`;\n\nconst DragHandleContainer = styled.div`\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, 2.86px);\n\tgrid-template-rows: repeat(3, 2.86px);\n\tcolumn-gap: 3.8px;\n\trow-gap: 4px;\n\tmargin-right: 8px;\n\tcursor: move;\n\tflex-shrink: 0;\n\talign-self: center;\n\theight: fit-content;\n\tmin-height: 18px;\n`;\n\nconst DragDot = styled.div`\n\twidth: 2.86px;\n\theight: 2.86px;\n\tborder-radius: 50%;\n\tbackground-color: ${COLORS.content.inactive};\n\tflex-shrink: 0;\n`;\n\nconst RowLeadingContainer = styled.div`\n\tdisplay: flex;\n\talign-content: center;\n\tjustify-content: center;\n\tgap: 8px;\n`;\n\n/** Elbow joining a nested child row back to its parent. */\nconst Connector = styled.span`\n\talign-self: flex-start;\n\tflex-shrink: 0;\n\twidth: 11px;\n\theight: 9px;\n\tmargin-left: 4px;\n\tborder-left: 1px solid ${COLORS.content.placeholder};\n\tborder-bottom: 1px solid ${COLORS.content.placeholder};\n\tborder-bottom-left-radius: 4px;\n`;\n\n/** Separate hit area so clicking the chevron never toggles selection. */\nconst CollapseToggle = styled.span`\n\tdisplay: flex;\n\talign-items: center;\n\tcursor: pointer;\n`;\n\nconst LeadingIconWrapper = styled.div`\n\tmargin-right: -4px;\n`;\n\nconst SingleSelectDragContainer = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tflex-direction: column;\n\tflex: 1;\n`;\n\ninterface DragHandleIconProps {\n\tonDragStart?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;\n}\n\nconst DragHandleIcon = ({ onDragStart, onDragEnd }: DragHandleIconProps) => (\n\t<DragHandleContainer\n\t\tdraggable\n\t\tonDragStart={onDragStart}\n\t\tonDragEnd={onDragEnd}\n\t>\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t\t<DragDot />\n\t</DragHandleContainer>\n);\n\ninterface MenuItemProps {\n\toption: SingleOption | MultiSelectOption;\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (option: SingleOption) => void;\n\tonDropdownItemClick?: (option: SingleOption) => void;\n\tlast?: boolean;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tuseDefaultCursor?: boolean;\n\tisFocused?: boolean;\n\tdataIndex?: number;\n\tisDraggable?: boolean;\n\tonDragStart?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragOver?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDrop?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tonDragEnd?: (e: React.DragEvent<HTMLDivElement>) => void;\n\tisDraggedOver?: boolean;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n\tchildrenLayout?: 'flyout' | 'nested';\n\t/** Indents the row under its parent and draws the elbow connector. */\n\tisChildRow?: boolean;\n\t/** Renders the parent checkbox in its indeterminate state. */\n\tisPartiallyChecked?: boolean;\n\tisCollapsible?: boolean;\n\tisCollapsed?: boolean;\n\tonToggleCollapse?: () => void;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuItem = forwardRef<HTMLDivElement, MenuItemProps>(\n\t(\n\t\t{\n\t\t\toption,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tlast,\n\t\t\tversion,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tisFocused = false,\n\t\t\tdataIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonDragStart,\n\t\t\tonDragOver,\n\t\t\tonDrop,\n\t\t\tonDragEnd,\n\t\t\tisDraggedOver = false,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t\tchildrenLayout = 'flyout',\n\t\t\tisChildRow = false,\n\t\t\tisPartiallyChecked = false,\n\t\t\tisCollapsible = false,\n\t\t\tisCollapsed = false,\n\t\t\tonToggleCollapse,\n\t\t},\n\t\tchildRef,\n\t) => {\n\t\tconst [isChildOptionHovered, setIsChildOptionHovered] = useState(\n\t\t\toption.selected,\n\t\t);\n\n\t\t// MenuList renders nested children inline, so there is no flyout and the\n\t\t// parent row is itself selectable.\n\t\tconst isNested = childrenLayout === 'nested';\n\t\tconst RowListItem = isNested ? StyledNestedListItem : StyledListItem;\n\n\t\tconst handleOptionClick = (option: SingleOption, parent?: SingleOption) => {\n\t\t\tif (!option.children || isNested) {\n\t\t\t\tonCheckHandler(!option.selected);\n\t\t\t\tconst updatedOption = parent ? { ...option, parent } : option;\n\t\t\t\tonDropdownItemClick?.(updatedOption);\n\t\t\t}\n\t\t};\n\n\t\tconst onCheckHandler = (checked: boolean) => {\n\t\t\tif (!option.disabled) {\n\t\t\t\tonSelect({ ...option, selected: checked });\n\t\t\t}\n\t\t};\n\n\t\tconst onHoverIn = () => {\n\t\t\tif (option.description) {\n\t\t\t\tshowDescription(option.label, option.description);\n\t\t\t} else {\n\t\t\t\tshowDescription();\n\t\t\t}\n\t\t};\n\n\t\tconst cursorConfig = useDefaultCursor ? { cursor: 'default' } : {};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Tooltip\n\t\t\t\t\tbody={''}\n\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\toption.children && !isNested ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tbackgroundColor: DEFAULT_THEME.colorsV2.surface.standard,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tref={childRef}\n\t\t\t\t\t\t\t\tonMouseEnter={() => setIsChildOptionHovered(true)}\n\t\t\t\t\t\t\t\tonMouseLeave={() => setIsChildOptionHovered(false)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<StyledChildDropdownContainer version={version ?? '2.0'}>\n\t\t\t\t\t\t\t\t\t{option.children.map((child) => (\n\t\t\t\t\t\t\t\t\t\t<StyledListItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tkey={child.value}\n\t\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\t\tversion !== '1.0' && (option?.children ?? []).length - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t? { borderBottom: 0 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\t\thandleOptionClick(child, option);\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tlistItem={{ value: child.value, label: child.label }}\n\t\t\t\t\t\t\t\t\t\t\tsubText={child.subText}\n\t\t\t\t\t\t\t\t\t\t\tleadingIcon={child.leadingIcon || undefined}\n\t\t\t\t\t\t\t\t\t\t\tcustomComponent={child.customComponent}\n\t\t\t\t\t\t\t\t\t\t\ttrailingIcon={child.trailingIcon || undefined}\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\toption.disabled\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'inactive'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: child.selected\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'default'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</StyledChildDropdownContainer>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<></>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tplacement={'right-start'}\n\t\t\t\t\thideArrow={true}\n\t\t\t\t>\n\t\t\t\t\t<RowListItem\n\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\tlast\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tborderBottom: 0,\n\t\t\t\t\t\t\t\t\t\t...cursorConfig,\n\t\t\t\t\t\t\t\t\t\t...(isDraggedOver\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderTop: `2px solid ${COLORS.content.brand}`,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t...cursorConfig,\n\t\t\t\t\t\t\t\t\t\t...(isDraggedOver\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderTop: `2px solid ${COLORS.content.brand}`,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\thandleOptionClick(option);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonMouseOver={onHoverIn}\n\t\t\t\t\t\tlistItem={{ value: option.value, label: option.label }}\n\t\t\t\t\t\tsubText={option.subText}\n\t\t\t\t\t\tdata-option-index={dataIndex}\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tid={`dropdown-option-${dataIndex}`}\n\t\t\t\t\t\taria-selected={!!option.selected}\n\t\t\t\t\t\tonDragOver={isDraggable ? onDragOver : undefined}\n\t\t\t\t\t\tonDrop={isDraggable ? onDrop : undefined}\n\t\t\t\t\t\tleadingIcon={\n\t\t\t\t\t\t\tisMultiSelect &&\n\t\t\t\t\t\t\t!(showCheckboxForCustomElement && option.customComponent) ? (\n\t\t\t\t\t\t\t\t<RowLeadingContainer>\n\t\t\t\t\t\t\t\t\t{isChildRow && <Connector />}\n\t\t\t\t\t\t\t\t\t{isDraggable && (\n\t\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\t\tsize={!isNested && version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\t\t\t\t\tisDisabled={option.disabled ?? false}\n\t\t\t\t\t\t\t\t\t\tisChecked={!!option.selected || isPartiallyChecked}\n\t\t\t\t\t\t\t\t\t\tisPartiallyChecked={isPartiallyChecked}\n\t\t\t\t\t\t\t\t\t\t// A partial parent renders checked while unselected, so\n\t\t\t\t\t\t\t\t\t\t// deriving the next value from isChecked would clear the\n\t\t\t\t\t\t\t\t\t\t// group while the row click selects it.\n\t\t\t\t\t\t\t\t\t\tonValueChange={() => onCheckHandler(!option.selected)}\n\t\t\t\t\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<LeadingIconWrapper>{option.leadingIcon}</LeadingIconWrapper>\n\t\t\t\t\t\t\t\t</RowLeadingContainer>\n\t\t\t\t\t\t\t) : isChildRow ? (\n\t\t\t\t\t\t\t\t<RowLeadingContainer>\n\t\t\t\t\t\t\t\t\t<Connector />\n\t\t\t\t\t\t\t\t\t{option.leadingIcon}\n\t\t\t\t\t\t\t\t</RowLeadingContainer>\n\t\t\t\t\t\t\t) : isDraggable ? (\n\t\t\t\t\t\t\t\t<SingleSelectDragContainer>\n\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{option.leadingIcon && <div>{option.leadingIcon}</div>}\n\t\t\t\t\t\t\t\t</SingleSelectDragContainer>\n\t\t\t\t\t\t\t) : option.leadingIcon ? (\n\t\t\t\t\t\t\t\t<>{option.leadingIcon}</>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcustomComponent={\n\t\t\t\t\t\t\tisMultiSelect &&\n\t\t\t\t\t\t\tshowCheckboxForCustomElement &&\n\t\t\t\t\t\t\toption.customComponent ? (\n\t\t\t\t\t\t\t\t<RowLeadingContainer>\n\t\t\t\t\t\t\t\t\t{isDraggable && (\n\t\t\t\t\t\t\t\t\t\t<DragHandleIcon\n\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\t\tsize={version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\t\t\t\t\tisDisabled={option.disabled ?? false}\n\t\t\t\t\t\t\t\t\t\tisChecked={!!option.selected}\n\t\t\t\t\t\t\t\t\t\tonValueChange={onCheckHandler}\n\t\t\t\t\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{option.customComponent}\n\t\t\t\t\t\t\t\t</RowLeadingContainer>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\toption.customComponent\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrailingIcon={\n\t\t\t\t\t\t\toption.isFreeForm ? (\n\t\t\t\t\t\t\t\t<FreeFormContainer>\n\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: COLORS.content.secondary }}>\n\t\t\t\t\t\t\t\t\t\tFreeform\n\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t</FreeFormContainer>\n\t\t\t\t\t\t\t) : isCollapsible ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{option.trailingIcon}\n\t\t\t\t\t\t\t\t\t<CollapseToggle\n\t\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\t\taria-expanded={!isCollapsed}\n\t\t\t\t\t\t\t\t\t\taria-label={`${isCollapsed ? 'Expand' : 'Collapse'} ${\n\t\t\t\t\t\t\t\t\t\t\toption.label\n\t\t\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonToggleCollapse?.();\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{isCollapsed ? (\n\t\t\t\t\t\t\t\t\t\t\t<ChevronDownIcon width={16} height={16} />\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<ChevronUpIcon width={16} height={16} />\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</CollapseToggle>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : option.children && !isNested ? (\n\t\t\t\t\t\t\t\t<ChevronRightIcon width={12} height={12} />\n\t\t\t\t\t\t\t) : option.trailingIcon ? (\n\t\t\t\t\t\t\t\t<>{option.trailingIcon}</>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\toption.disabled\n\t\t\t\t\t\t\t\t? 'inactive'\n\t\t\t\t\t\t\t\t: option.selected || (!isMultiSelect && isChildOptionHovered)\n\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t: isFocused\n\t\t\t\t\t\t\t\t? 'focused'\n\t\t\t\t\t\t\t\t: 'default'\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tooltip>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["StyledListItem","styled","ListItem","props","StyledNestedListItem","StyledChildDropdownContainer","version","DEFAULT_THEME","DragHandleContainer","DragDot","COLORS","RowLeadingContainer","Connector","CollapseToggle","LeadingIconWrapper","SingleSelectDragContainer","DragHandleIcon","onDragStart","onDragEnd","jsxs","jsx","MenuItem","forwardRef","option","isMultiSelect","showDescription","onSelect","last","onDropdownItemClick","useDefaultCursor","isFocused","dataIndex","isDraggable","onDragOver","onDrop","isDraggedOver","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","childrenLayout","isChildRow","isPartiallyChecked","isCollapsible","isCollapsed","onToggleCollapse","childRef","isChildOptionHovered","setIsChildOptionHovered","useState","isNested","RowListItem","handleOptionClick","parent","onCheckHandler","updatedOption","checked","onHoverIn","cursorConfig","Fragment","Tooltip","child","e","CheckBox","FreeFormContainer","BodyCaption","ChevronDownIcon","ChevronUpIcon","ChevronRightIcon"],"mappings":";;;;;;;;;;;;AAaA,MAAMA,IAAiBC,EAAOC,EAAQ;AAAA,YAI1B,CAACC,MACXA,EAAM,YAAY,QACf,QACAA,EAAM,YAAY,QAClB,aACA,WAAW;AAAA;AAAA,eAED,CAACA,MACdA,EAAM,mBAAmB,MAAMA,EAAM,YAAY,QAAQ,QAAQ,GAAG;AAAA,GAKhEC,KAAuBH,EAAOD,CAAc;AAAA;AAAA;AAAA;AAAA,GAM5CK,KAA+BJ,EAAO;AAAA;AAAA,kBAE1B,CAAC,EAAE,SAAAK,EAAA,MAAeA,MAAY,QAAQ,MAAM,KAAM;AAAA,YACxD,CAAC,EAAE,SAAAA,EAAA,MAAeA,MAAY,QAAQ,MAAM,KAAM;AAAA;AAAA,WAEnD,CAAC,EAAE,SAAAA,EAAA,MACZA,MAAY,QACT,aAAaC,EAAc,SAAS,OAAO,OAAO,KAClD,MAAM;AAAA;AAAA;AAAA,GAKLC,KAAsBP,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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EAAiB,OAAO,IAAI,QAAQ,IAAI,IACtC5C,EAAO,eACV,gBAAAH,EAAAsC,GAAA,EAAG,UAAAnC,EAAO,cAAa,IACpB;AAAA,YAEL,SACCA,EAAO,WACJ,aACAA,EAAO,YAAa,CAACC,KAAiBsB,IACtC,aACAhB,IACA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MAEL;AAAA,IAAA,GAEF;AAAA,EAEF;AACD;"}
|
|
@@ -14,6 +14,10 @@ interface MenuListProps {
|
|
|
14
14
|
showCheckboxForCustomElement?: boolean;
|
|
15
15
|
checkboxActiveColor?: string;
|
|
16
16
|
brandSelectedRow?: boolean;
|
|
17
|
+
childrenLayout?: 'flyout' | 'nested';
|
|
18
|
+
collapsibleChildren?: boolean;
|
|
19
|
+
collapsedParents: string[];
|
|
20
|
+
onToggleCollapsed: (value: string) => void;
|
|
17
21
|
}
|
|
18
22
|
export declare const MenuList: import('react').ForwardRefExoticComponent<MenuListProps & import('react').RefAttributes<HTMLDivElement[]>>;
|
|
19
23
|
export {};
|
|
@@ -1,143 +1,175 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsx as a, Fragment as k, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ee, useRef as U, useState as V, useCallback as p, useEffect as ne } from "react";
|
|
3
|
+
import { flattenSelectableOptions as te } from "../../utils/iterationOnOptions.js";
|
|
4
|
+
import { MenuItem as M } from "./MenuItem.js";
|
|
5
|
+
import { StyledGroupedLabel as re, Divider as se } from "./MenuList.styled.js";
|
|
6
|
+
const fe = ee(
|
|
6
7
|
({
|
|
7
|
-
options:
|
|
8
|
-
isMultiSelect:
|
|
9
|
-
showDescription:
|
|
8
|
+
options: c,
|
|
9
|
+
isMultiSelect: h,
|
|
10
|
+
showDescription: O,
|
|
10
11
|
onSelect: y,
|
|
11
|
-
version:
|
|
12
|
-
onInfiniteScroll:
|
|
13
|
-
onDropdownItemClick:
|
|
14
|
-
useDefaultCursor:
|
|
15
|
-
focusedIndex:
|
|
16
|
-
isDraggable:
|
|
17
|
-
onOptionsReorder:
|
|
18
|
-
showCheckboxForCustomElement:
|
|
19
|
-
checkboxActiveColor:
|
|
20
|
-
brandSelectedRow:
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
version: f,
|
|
13
|
+
onInfiniteScroll: N,
|
|
14
|
+
onDropdownItemClick: b,
|
|
15
|
+
useDefaultCursor: F,
|
|
16
|
+
focusedIndex: x = -1,
|
|
17
|
+
isDraggable: d = !1,
|
|
18
|
+
onOptionsReorder: q,
|
|
19
|
+
showCheckboxForCustomElement: D = !1,
|
|
20
|
+
checkboxActiveColor: j,
|
|
21
|
+
brandSelectedRow: T,
|
|
22
|
+
childrenLayout: E = "flyout",
|
|
23
|
+
collapsibleChildren: W = !1,
|
|
24
|
+
collapsedParents: z,
|
|
25
|
+
onToggleCollapsed: X
|
|
26
|
+
}, s) => {
|
|
27
|
+
const u = U(null), v = U(null), [m, R] = V(null), [Y, $] = V(
|
|
23
28
|
null
|
|
24
|
-
),
|
|
25
|
-
u.current && u.current.disconnect(), u.current = new IntersectionObserver((
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
}, [
|
|
29
|
-
|
|
29
|
+
), B = p(() => {
|
|
30
|
+
u.current && u.current.disconnect(), u.current = new IntersectionObserver((t) => {
|
|
31
|
+
t[0].isIntersecting && N?.();
|
|
32
|
+
}), v.current && u.current.observe(v.current);
|
|
33
|
+
}, [N]);
|
|
34
|
+
ne(() => (B(), () => {
|
|
30
35
|
u.current && u.current.disconnect();
|
|
31
|
-
}), [
|
|
32
|
-
const
|
|
33
|
-
(
|
|
34
|
-
|
|
36
|
+
}), [B, c]);
|
|
37
|
+
const Z = p(
|
|
38
|
+
(t) => (e) => {
|
|
39
|
+
d && (R(t), e.dataTransfer.effectAllowed = "move");
|
|
35
40
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
(
|
|
39
|
-
|
|
41
|
+
[d]
|
|
42
|
+
), _ = p(
|
|
43
|
+
(t) => (e) => {
|
|
44
|
+
d && (e.preventDefault(), e.dataTransfer.dropEffect = "move", $(t));
|
|
40
45
|
},
|
|
41
|
-
[
|
|
42
|
-
),
|
|
43
|
-
(
|
|
44
|
-
if (!(!
|
|
45
|
-
if (e.preventDefault(),
|
|
46
|
-
const
|
|
47
|
-
|
|
46
|
+
[d]
|
|
47
|
+
), A = p(
|
|
48
|
+
(t) => (e) => {
|
|
49
|
+
if (!(!d || m === null)) {
|
|
50
|
+
if (e.preventDefault(), m !== t) {
|
|
51
|
+
const l = [...c], [r] = l.splice(m, 1);
|
|
52
|
+
l.splice(t, 0, r), q?.(l);
|
|
48
53
|
}
|
|
49
|
-
|
|
54
|
+
R(null), $(null);
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
|
-
[
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
}, []),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const r = n;
|
|
70
|
-
return /* @__PURE__ */ D("div", { style: { marginTop: i === "2.0" ? 2 : 0 }, children: [
|
|
71
|
-
/* @__PURE__ */ D(Y, { version: i, children: [
|
|
72
|
-
r.leadingIcon ? /* @__PURE__ */ d("span", { style: { marginRight: 8 }, children: r.leadingIcon }) : null,
|
|
73
|
-
r.label
|
|
57
|
+
[d, m, c, q]
|
|
58
|
+
), w = p(() => {
|
|
59
|
+
R(null), $(null);
|
|
60
|
+
}, []), H = E === "nested", G = new Map(
|
|
61
|
+
te(
|
|
62
|
+
c,
|
|
63
|
+
H ? { collapsedParents: z } : void 0
|
|
64
|
+
).map((t, e) => [t, e])
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ a(k, { children: c.map((t, e) => {
|
|
67
|
+
const l = e === c.length - 1;
|
|
68
|
+
if (t.options) {
|
|
69
|
+
const n = t;
|
|
70
|
+
return /* @__PURE__ */ L("div", { style: { marginTop: f === "2.0" ? 2 : 0 }, children: [
|
|
71
|
+
/* @__PURE__ */ L(re, { version: f, children: [
|
|
72
|
+
n.leadingIcon ? /* @__PURE__ */ a("span", { style: { marginRight: 8 }, children: n.leadingIcon }) : null,
|
|
73
|
+
n.label
|
|
74
74
|
] }),
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
|
|
75
|
+
n.options.map((i, o) => {
|
|
76
|
+
const Q = G.get(i), S = Q === x && !i.disabled;
|
|
77
|
+
return /* @__PURE__ */ a(
|
|
78
|
+
M,
|
|
79
79
|
{
|
|
80
|
-
version:
|
|
81
|
-
last:
|
|
80
|
+
version: f,
|
|
81
|
+
last: o === n.options.length - 1,
|
|
82
82
|
onSelect: y,
|
|
83
|
-
showDescription:
|
|
84
|
-
onDropdownItemClick:
|
|
85
|
-
isMultiSelect:
|
|
86
|
-
option:
|
|
87
|
-
useDefaultCursor:
|
|
88
|
-
isFocused:
|
|
89
|
-
dataIndex:
|
|
83
|
+
showDescription: O,
|
|
84
|
+
onDropdownItemClick: b,
|
|
85
|
+
isMultiSelect: h,
|
|
86
|
+
option: i,
|
|
87
|
+
useDefaultCursor: F,
|
|
88
|
+
isFocused: S,
|
|
89
|
+
dataIndex: Q,
|
|
90
90
|
isDraggable: !1,
|
|
91
|
-
showCheckboxForCustomElement:
|
|
92
|
-
checkboxActiveColor:
|
|
93
|
-
brandSelectedRow:
|
|
94
|
-
ref: (
|
|
95
|
-
|
|
91
|
+
showCheckboxForCustomElement: D,
|
|
92
|
+
checkboxActiveColor: j,
|
|
93
|
+
brandSelectedRow: T,
|
|
94
|
+
ref: (g) => {
|
|
95
|
+
s && typeof s == "object" && s.current && g && g && g && g && (s.current[e] = g);
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
`${e}-${
|
|
98
|
+
`${e}-${o}`
|
|
99
99
|
);
|
|
100
100
|
}),
|
|
101
|
-
|
|
101
|
+
l ? /* @__PURE__ */ a("span", { ref: v }) : null
|
|
102
102
|
] }, e);
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
const r = t, J = G.get(r), C = J === x && !r.disabled, I = H ? r.children ?? [] : [], K = z.includes(r.value), P = I.filter(
|
|
105
|
+
(n) => !n.disabled
|
|
106
|
+
);
|
|
107
|
+
return /* @__PURE__ */ L("div", { children: [
|
|
108
|
+
r.hasDivider && /* @__PURE__ */ a(se, {}),
|
|
109
|
+
/* @__PURE__ */ a(
|
|
110
|
+
M,
|
|
109
111
|
{
|
|
110
|
-
version:
|
|
111
|
-
last:
|
|
112
|
+
version: f,
|
|
113
|
+
last: l,
|
|
112
114
|
onSelect: y,
|
|
113
|
-
showDescription:
|
|
114
|
-
onDropdownItemClick:
|
|
115
|
-
isMultiSelect:
|
|
116
|
-
option:
|
|
117
|
-
useDefaultCursor:
|
|
118
|
-
isFocused:
|
|
119
|
-
dataIndex:
|
|
120
|
-
isDraggable:
|
|
121
|
-
onDragStart:
|
|
122
|
-
onDragOver:
|
|
123
|
-
onDrop:
|
|
124
|
-
onDragEnd:
|
|
125
|
-
isDraggedOver:
|
|
126
|
-
showCheckboxForCustomElement:
|
|
127
|
-
checkboxActiveColor:
|
|
128
|
-
brandSelectedRow:
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
showDescription: O,
|
|
116
|
+
onDropdownItemClick: b,
|
|
117
|
+
isMultiSelect: h,
|
|
118
|
+
option: r,
|
|
119
|
+
useDefaultCursor: F,
|
|
120
|
+
isFocused: C,
|
|
121
|
+
dataIndex: J,
|
|
122
|
+
isDraggable: d,
|
|
123
|
+
onDragStart: Z(e),
|
|
124
|
+
onDragOver: _(e),
|
|
125
|
+
onDrop: A(e),
|
|
126
|
+
onDragEnd: w,
|
|
127
|
+
isDraggedOver: Y === e,
|
|
128
|
+
showCheckboxForCustomElement: D,
|
|
129
|
+
checkboxActiveColor: j,
|
|
130
|
+
brandSelectedRow: T,
|
|
131
|
+
childrenLayout: E,
|
|
132
|
+
isPartiallyChecked: P.some((n) => n.selected) && !P.every((n) => n.selected),
|
|
133
|
+
isCollapsible: W && !!I.length,
|
|
134
|
+
isCollapsed: K,
|
|
135
|
+
onToggleCollapse: () => X(r.value),
|
|
136
|
+
ref: (n) => {
|
|
137
|
+
s && typeof s == "object" && s.current && n && (s.current[e] = n);
|
|
131
138
|
}
|
|
132
139
|
},
|
|
133
|
-
|
|
140
|
+
r.value
|
|
134
141
|
),
|
|
135
|
-
|
|
142
|
+
!K && I.map((n, i) => {
|
|
143
|
+
const o = G.get(n);
|
|
144
|
+
return /* @__PURE__ */ a(
|
|
145
|
+
M,
|
|
146
|
+
{
|
|
147
|
+
version: f,
|
|
148
|
+
last: l && i === I.length - 1,
|
|
149
|
+
onSelect: y,
|
|
150
|
+
showDescription: O,
|
|
151
|
+
onDropdownItemClick: b,
|
|
152
|
+
isMultiSelect: h,
|
|
153
|
+
option: n,
|
|
154
|
+
useDefaultCursor: F,
|
|
155
|
+
isFocused: o === x && !n.disabled,
|
|
156
|
+
dataIndex: o,
|
|
157
|
+
isDraggable: !1,
|
|
158
|
+
showCheckboxForCustomElement: D,
|
|
159
|
+
checkboxActiveColor: j,
|
|
160
|
+
brandSelectedRow: T,
|
|
161
|
+
childrenLayout: E,
|
|
162
|
+
isChildRow: !0
|
|
163
|
+
},
|
|
164
|
+
n.value
|
|
165
|
+
);
|
|
166
|
+
}),
|
|
167
|
+
l ? /* @__PURE__ */ a("span", { ref: v }) : null
|
|
136
168
|
] }, e);
|
|
137
169
|
}) });
|
|
138
170
|
}
|
|
139
171
|
);
|
|
140
172
|
export {
|
|
141
|
-
|
|
173
|
+
fe as MenuList
|
|
142
174
|
};
|
|
143
175
|
//# sourceMappingURL=MenuList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuList.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\nimport { MenuItem } from './MenuItem';\nimport { Divider, StyledGroupedLabel } from './MenuList.styled';\n\ninterface MenuListProps {\n\toptions: DropdownOption[];\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (optionSelect: SingleOption) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tonInfiniteScroll?: () => void;\n\tonDropdownItemClick?: (option: DropdownOption) => void;\n\tuseDefaultCursor?: boolean;\n\tfocusedIndex?: number;\n\tisDraggable?: boolean;\n\tonOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuList = forwardRef<HTMLDivElement[], MenuListProps>(\n\t(\n\t\t{\n\t\t\toptions,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tversion,\n\t\t\tonInfiniteScroll,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tfocusedIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonOptionsReorder,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst observer = useRef<IntersectionObserver | null>(null);\n\t\tconst spanRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst [draggedIndex, setDraggedIndex] = useState<number | null>(null);\n\t\tconst [draggedOverIndex, setDraggedOverIndex] = useState<number | null>(\n\t\t\tnull,\n\t\t);\n\n\t\tconst setupObserver = useCallback(() => {\n\t\t\tif (observer.current) {\n\t\t\t\tobserver.current.disconnect();\n\t\t\t}\n\t\t\tobserver.current = new IntersectionObserver((entries) => {\n\t\t\t\tif (entries[0].isIntersecting) {\n\t\t\t\t\tonInfiniteScroll?.();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (spanRef.current) {\n\t\t\t\tobserver.current.observe(spanRef.current);\n\t\t\t}\n\t\t}, [onInfiniteScroll]);\n\n\t\tuseEffect(() => {\n\t\t\tsetupObserver();\n\t\t\treturn () => {\n\t\t\t\tif (observer.current) {\n\t\t\t\t\tobserver.current.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t}, [setupObserver, options]);\n\n\t\tconst handleDragStart = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\tsetDraggedIndex(index);\n\t\t\t\te.dataTransfer.effectAllowed = 'move';\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDragOver = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\te.preventDefault();\n\t\t\t\te.dataTransfer.dropEffect = 'move';\n\t\t\t\tsetDraggedOverIndex(index);\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDrop = useCallback(\n\t\t\t(dropIndex: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable || draggedIndex === null) return;\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif (draggedIndex !== dropIndex) {\n\t\t\t\t\tconst newOptions = [...options];\n\t\t\t\t\tconst [item] = newOptions.splice(draggedIndex, 1);\n\t\t\t\t\tnewOptions.splice(dropIndex, 0, item);\n\t\t\t\t\tonOptionsReorder?.(newOptions);\n\t\t\t\t}\n\n\t\t\t\tsetDraggedIndex(null);\n\t\t\t\tsetDraggedOverIndex(null);\n\t\t\t},\n\t\t\t[isDraggable, draggedIndex, options, onOptionsReorder],\n\t\t);\n\n\t\tconst handleDragEnd = useCallback(() => {\n\t\t\tsetDraggedIndex(null);\n\t\t\tsetDraggedOverIndex(null);\n\t\t}, []);\n\n\t\t// Calculate flat indices for all options\n\t\tconst flatIndices = new Map<SingleOption, number>();\n\t\tlet currentIndex = -1;\n\t\toptions.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((menuOption) => {\n\t\t\t\t\tif (!menuOption.disabled) {\n\t\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\t\tflatIndices.set(menuOption, currentIndex);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\tif (!singleOption.disabled) {\n\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\tflatIndices.set(singleOption, currentIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{options.map((option, i) => {\n\t\t\t\t\tconst last = i === options.length - 1;\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = option as GroupedOption;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div key={i} style={{ marginTop: version === '2.0' ? 2 : 0 }}>\n\t\t\t\t\t\t\t\t<StyledGroupedLabel version={version}>\n\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon ? (\n\t\t\t\t\t\t\t\t\t\t<span style={{ marginRight: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{groupedOption.label}\n\t\t\t\t\t\t\t\t</StyledGroupedLabel>\n\t\t\t\t\t\t\t\t{groupedOption.options.map((menuOption, idx) => {\n\t\t\t\t\t\t\t\t\tconst currentFlatIndex = flatIndices.get(menuOption);\n\t\t\t\t\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !menuOption.disabled;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tlast={idx === groupedOption.options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\t\toption={menuOption}\n\t\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\t\tkey={`${i}-${idx}`}\n\t\t\t\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={\n\t\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) ref.current[i] = el;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tconst currentFlatIndex = flatIndices.get(singleOption);\n\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !singleOption.disabled;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={i}>\n\t\t\t\t\t\t\t{singleOption.hasDivider && <Divider />}\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\tlast={last}\n\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\toption={singleOption}\n\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\tkey={singleOption.value}\n\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\t\tonDragStart={handleDragStart(i)}\n\t\t\t\t\t\t\t\tonDragOver={handleDragOver(i)}\n\t\t\t\t\t\t\t\tonDrop={handleDrop(i)}\n\t\t\t\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\t\t\t\tisDraggedOver={draggedOverIndex === i}\n\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current && el) {\n\t\t\t\t\t\t\t\t\t\tref.current[i] = el;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["MenuList","forwardRef","options","isMultiSelect","showDescription","onSelect","version","onInfiniteScroll","onDropdownItemClick","useDefaultCursor","focusedIndex","isDraggable","onOptionsReorder","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","ref","observer","useRef","spanRef","draggedIndex","setDraggedIndex","useState","draggedOverIndex","setDraggedOverIndex","setupObserver","useCallback","entries","useEffect","handleDragStart","index","handleDragOver","handleDrop","dropIndex","newOptions","item","handleDragEnd","flatIndices","currentIndex","option","menuOption","singleOption","jsx","Fragment","i","last","groupedOption","jsxs","StyledGroupedLabel","idx","currentFlatIndex","isFocused","MenuItem","el","Divider"],"mappings":";;;;AAsBO,MAAMA,KAAWC;AAAA,EACvB,CACC;AAAA,IACC,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,aAAAC,IAAc;AAAA,IACd,kBAAAC;AAAA,IACA,8BAAAC,IAA+B;AAAA,IAC/B,qBAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,GAEDC,MACI;AACJ,UAAMC,IAAWC,EAAoC,IAAI,GACnDC,IAAUD,EAA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;AAAA,YACA,qBAAAC;AAAA,YACA,kBAAAC;AAAA,YACA,KAAK,CAACsC,MAAO;AACZ,cAAIrC,KAAO,OAAOA,KAAQ,YAAYA,EAAI,WAAWqC,MACpDrC,EAAI,QAAQ4B,CAAC,IAAIS;AAAA,YAEnB;AAAA,UAAA;AAAA,UAhBKZ,EAAa;AAAA,QAAA;AAAA,QAkBlBI,IAAO,gBAAAH,EAAC,QAAA,EAAK,KAAKvB,GAAS,IAAK;AAAA,MAAA,EAAA,GA7BxByB,CA8BV;AAAA,IAEF,CAAC,EAAA,CACF;AAAA,EAEF;AACD;"}
|
|
1
|
+
{"version":3,"file":"MenuList.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuList.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\nimport { flattenSelectableOptions } from '../../utils/iterationOnOptions';\nimport { MenuItem } from './MenuItem';\nimport { Divider, StyledGroupedLabel } from './MenuList.styled';\n\ninterface MenuListProps {\n\toptions: DropdownOption[];\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (optionSelect: SingleOption) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tonInfiniteScroll?: () => void;\n\tonDropdownItemClick?: (option: DropdownOption) => void;\n\tuseDefaultCursor?: boolean;\n\tfocusedIndex?: number;\n\tisDraggable?: boolean;\n\tonOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n\tchildrenLayout?: 'flyout' | 'nested';\n\tcollapsibleChildren?: boolean;\n\t// Collapse state lives in OpenedDropdown, which also drives keyboard focus:\n\t// the flat row order both sides use depends on which children are visible.\n\tcollapsedParents: string[];\n\tonToggleCollapsed: (value: string) => void;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuList = forwardRef<HTMLDivElement[], MenuListProps>(\n\t(\n\t\t{\n\t\t\toptions,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tversion,\n\t\t\tonInfiniteScroll,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tfocusedIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonOptionsReorder,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t\tchildrenLayout = 'flyout',\n\t\t\tcollapsibleChildren = false,\n\t\t\tcollapsedParents,\n\t\t\tonToggleCollapsed,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst observer = useRef<IntersectionObserver | null>(null);\n\t\tconst spanRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst [draggedIndex, setDraggedIndex] = useState<number | null>(null);\n\t\tconst [draggedOverIndex, setDraggedOverIndex] = useState<number | null>(\n\t\t\tnull,\n\t\t);\n\n\t\tconst setupObserver = useCallback(() => {\n\t\t\tif (observer.current) {\n\t\t\t\tobserver.current.disconnect();\n\t\t\t}\n\t\t\tobserver.current = new IntersectionObserver((entries) => {\n\t\t\t\tif (entries[0].isIntersecting) {\n\t\t\t\t\tonInfiniteScroll?.();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (spanRef.current) {\n\t\t\t\tobserver.current.observe(spanRef.current);\n\t\t\t}\n\t\t}, [onInfiniteScroll]);\n\n\t\tuseEffect(() => {\n\t\t\tsetupObserver();\n\t\t\treturn () => {\n\t\t\t\tif (observer.current) {\n\t\t\t\t\tobserver.current.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t}, [setupObserver, options]);\n\n\t\tconst handleDragStart = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\tsetDraggedIndex(index);\n\t\t\t\te.dataTransfer.effectAllowed = 'move';\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDragOver = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\te.preventDefault();\n\t\t\t\te.dataTransfer.dropEffect = 'move';\n\t\t\t\tsetDraggedOverIndex(index);\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDrop = useCallback(\n\t\t\t(dropIndex: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable || draggedIndex === null) return;\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif (draggedIndex !== dropIndex) {\n\t\t\t\t\tconst newOptions = [...options];\n\t\t\t\t\tconst [item] = newOptions.splice(draggedIndex, 1);\n\t\t\t\t\tnewOptions.splice(dropIndex, 0, item);\n\t\t\t\t\tonOptionsReorder?.(newOptions);\n\t\t\t\t}\n\n\t\t\t\tsetDraggedIndex(null);\n\t\t\t\tsetDraggedOverIndex(null);\n\t\t\t},\n\t\t\t[isDraggable, draggedIndex, options, onOptionsReorder],\n\t\t);\n\n\t\tconst handleDragEnd = useCallback(() => {\n\t\t\tsetDraggedIndex(null);\n\t\t\tsetDraggedOverIndex(null);\n\t\t}, []);\n\n\t\tconst isNestedLayout = childrenLayout === 'nested';\n\n\t\tconst flatIndices = new Map<SingleOption, number>(\n\t\t\tflattenSelectableOptions(\n\t\t\t\toptions,\n\t\t\t\tisNestedLayout ? { collapsedParents } : undefined,\n\t\t\t).map((option, index) => [option, index]),\n\t\t);\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{options.map((option, i) => {\n\t\t\t\t\tconst last = i === options.length - 1;\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = option as GroupedOption;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div key={i} style={{ marginTop: version === '2.0' ? 2 : 0 }}>\n\t\t\t\t\t\t\t\t<StyledGroupedLabel version={version}>\n\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon ? (\n\t\t\t\t\t\t\t\t\t\t<span style={{ marginRight: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{groupedOption.label}\n\t\t\t\t\t\t\t\t</StyledGroupedLabel>\n\t\t\t\t\t\t\t\t{groupedOption.options.map((menuOption, idx) => {\n\t\t\t\t\t\t\t\t\tconst currentFlatIndex = flatIndices.get(menuOption);\n\t\t\t\t\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !menuOption.disabled;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tlast={idx === groupedOption.options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\t\toption={menuOption}\n\t\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\t\tkey={`${i}-${idx}`}\n\t\t\t\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={\n\t\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) ref.current[i] = el;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tconst currentFlatIndex = flatIndices.get(singleOption);\n\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !singleOption.disabled;\n\t\t\t\t\tconst nestedChildren = isNestedLayout\n\t\t\t\t\t\t? singleOption.children ?? []\n\t\t\t\t\t\t: [];\n\t\t\t\t\tconst collapsed = collapsedParents.includes(singleOption.value);\n\t\t\t\t\t// iterateOnOptions derives the parent from its selectable children,\n\t\t\t\t\t// so the dash has to ignore disabled ones as well.\n\t\t\t\t\tconst selectableChildren = nestedChildren.filter(\n\t\t\t\t\t\t(child) => !child.disabled,\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={i}>\n\t\t\t\t\t\t\t{singleOption.hasDivider && <Divider />}\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\tlast={last}\n\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\toption={singleOption}\n\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\tkey={singleOption.value}\n\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\t\tonDragStart={handleDragStart(i)}\n\t\t\t\t\t\t\t\tonDragOver={handleDragOver(i)}\n\t\t\t\t\t\t\t\tonDrop={handleDrop(i)}\n\t\t\t\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\t\t\t\tisDraggedOver={draggedOverIndex === i}\n\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\tchildrenLayout={childrenLayout}\n\t\t\t\t\t\t\t\tisPartiallyChecked={\n\t\t\t\t\t\t\t\t\tselectableChildren.some((child) => child.selected) &&\n\t\t\t\t\t\t\t\t\t!selectableChildren.every((child) => child.selected)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisCollapsible={collapsibleChildren && !!nestedChildren.length}\n\t\t\t\t\t\t\t\tisCollapsed={collapsed}\n\t\t\t\t\t\t\t\tonToggleCollapse={() => onToggleCollapsed(singleOption.value)}\n\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current && el) {\n\t\t\t\t\t\t\t\t\t\tref.current[i] = el;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{!collapsed &&\n\t\t\t\t\t\t\t\tnestedChildren.map((child, childIdx) => {\n\t\t\t\t\t\t\t\t\tconst childFlatIndex = flatIndices.get(child);\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tlast={last && childIdx === nestedChildren.length - 1}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\t\toption={child}\n\t\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\t\tkey={child.value}\n\t\t\t\t\t\t\t\t\t\t\tisFocused={\n\t\t\t\t\t\t\t\t\t\t\t\tchildFlatIndex === focusedIndex && !child.disabled\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdataIndex={childFlatIndex}\n\t\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={\n\t\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tchildrenLayout={childrenLayout}\n\t\t\t\t\t\t\t\t\t\t\tisChildRow\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["MenuList","forwardRef","options","isMultiSelect","showDescription","onSelect","version","onInfiniteScroll","onDropdownItemClick","useDefaultCursor","focusedIndex","isDraggable","onOptionsReorder","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","childrenLayout","collapsibleChildren","collapsedParents","onToggleCollapsed","ref","observer","useRef","spanRef","draggedIndex","setDraggedIndex","useState","draggedOverIndex","setDraggedOverIndex","setupObserver","useCallback","entries","useEffect","handleDragStart","index","handleDragOver","handleDrop","dropIndex","newOptions","item","handleDragEnd","isNestedLayout","flatIndices","flattenSelectableOptions","option","jsx","Fragment","i","last","groupedOption","jsxs","StyledGroupedLabel","menuOption","idx","currentFlatIndex","isFocused","MenuItem","el","singleOption","nestedChildren","collapsed","selectableChildren","child","Divider","childIdx","childFlatIndex"],"mappings":";;;;;AA6BO,MAAMA,KAAWC;AAAA,EACvB,CACC;AAAA,IACC,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,aAAAC,IAAc;AAAA,IACd,kBAAAC;AAAA,IACA,8BAAAC,IAA+B;AAAA,IAC/B,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC,IAAsB;AAAA,IACtB,kBAAAC;AAAA,IACA,mBAAAC;AAAA,EAAA,GAEDC,MACI;AACJ,UAAMC,IAAWC,EAAoC,IAAI,GACnDC,IAAUD,EAA+B,IAAI,GAC7C,CAACE,GAAcC,CAAe,IAAIC,EAAwB,IAAI,GAC9D,CAACC,GAAkBC,CAAmB,IAAIF;AAAA,MAC/C;AAAA,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
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useEffect as m } from "react";
|
|
3
|
+
import { getSelectionLeaves as p } from "../../utils/iterationOnOptions.js";
|
|
4
|
+
import { ListItem as h } from "../../../../list-item/ListItem.js";
|
|
5
|
+
import { CheckBox as u } from "../../../../checkBox/CheckBox.js";
|
|
6
|
+
const g = ({
|
|
6
7
|
options: o,
|
|
7
|
-
onSelect:
|
|
8
|
-
version:
|
|
9
|
-
checkboxActiveColor:
|
|
10
|
-
brandSelectedRow:
|
|
8
|
+
onSelect: i,
|
|
9
|
+
version: s,
|
|
10
|
+
checkboxActiveColor: d,
|
|
11
|
+
brandSelectedRow: f,
|
|
12
|
+
childrenLayout: r
|
|
11
13
|
}) => {
|
|
12
|
-
const [e,
|
|
13
|
-
function
|
|
14
|
-
e === "partiallySelected" &&
|
|
14
|
+
const [e, a] = S("notSelected");
|
|
15
|
+
function n() {
|
|
16
|
+
e === "partiallySelected" && i("notSelected"), e === "selectAll" && i("notSelected"), e === "notSelected" && i("selectAll");
|
|
15
17
|
}
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
S,
|
|
18
|
+
return m(() => {
|
|
19
|
+
const t = p(
|
|
20
|
+
o.filter((l) => !l.disabled),
|
|
21
|
+
r === "nested"
|
|
22
|
+
).filter((l) => !l.disabled).map((l) => l.selected || !1);
|
|
23
|
+
t.every(Boolean) ? a("selectAll") : t.filter(Boolean).length > 0 ? a("partiallySelected") : a("notSelected");
|
|
24
|
+
}, [o, r]), /* @__PURE__ */ c(
|
|
25
|
+
h,
|
|
25
26
|
{
|
|
26
|
-
version:
|
|
27
|
-
brandSelectedRow:
|
|
28
|
-
onClick: (
|
|
29
|
-
|
|
27
|
+
version: s,
|
|
28
|
+
brandSelectedRow: f,
|
|
29
|
+
onClick: (t) => {
|
|
30
|
+
t.preventDefault(), n();
|
|
30
31
|
},
|
|
31
32
|
listItem: {
|
|
32
33
|
label: "Select All",
|
|
33
34
|
value: "All"
|
|
34
35
|
},
|
|
35
|
-
leadingIcon: /* @__PURE__ */
|
|
36
|
-
|
|
36
|
+
leadingIcon: /* @__PURE__ */ c("div", { style: { width: 18, height: 18 }, children: /* @__PURE__ */ c(
|
|
37
|
+
u,
|
|
37
38
|
{
|
|
38
|
-
size:
|
|
39
|
+
size: s === "2.0" ? "SMALL" : "DEFAULT",
|
|
39
40
|
isChecked: e === "selectAll" || e === "partiallySelected",
|
|
40
41
|
isPartiallyChecked: e === "partiallySelected",
|
|
41
|
-
onValueChange:
|
|
42
|
-
activeColor:
|
|
42
|
+
onValueChange: n,
|
|
43
|
+
activeColor: d
|
|
43
44
|
}
|
|
44
45
|
) }),
|
|
45
46
|
variant: "default"
|
|
@@ -47,6 +48,6 @@ const y = ({
|
|
|
47
48
|
);
|
|
48
49
|
};
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
+
g as SelectAllMenu
|
|
51
52
|
};
|
|
52
53
|
//# sourceMappingURL=SelectAllMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAllMenu.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { DropdownOption,
|
|
1
|
+
{"version":3,"file":"SelectAllMenu.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { DropdownOption, SingleOption } from '../../../type';\nimport { getSelectionLeaves } from '../../utils/iterationOnOptions';\n\nexport type SelectAllCheckboxState =\n\t| 'notSelected'\n\t| 'selectAll'\n\t| 'partiallySelected';\n\nexport const SelectAllMenu: React.FC<{\n\toptions: DropdownOption[];\n\tonSelect: (newState: SelectAllCheckboxState) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n\tchildrenLayout?: 'flyout' | 'nested';\n}> = ({\n\toptions,\n\tonSelect,\n\tversion,\n\tcheckboxActiveColor,\n\tbrandSelectedRow,\n\tchildrenLayout,\n}) => {\n\tconst [checkStatus, setCheckStatus] =\n\t\tuseState<SelectAllCheckboxState>('notSelected');\n\n\tfunction onCheckHandler() {\n\t\tif (checkStatus === 'partiallySelected') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'selectAll') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'notSelected') {\n\t\t\tonSelect('selectAll');\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tconst allOptions = getSelectionLeaves(\n\t\t\toptions.filter((option) => !(option as SingleOption).disabled),\n\t\t\tchildrenLayout === 'nested',\n\t\t)\n\t\t\t.filter((leaf) => !leaf.disabled)\n\t\t\t.map((leaf) => leaf.selected || false);\n\n\t\tif (allOptions.every(Boolean)) {\n\t\t\tsetCheckStatus('selectAll');\n\t\t} else if (allOptions.filter(Boolean).length > 0) {\n\t\t\tsetCheckStatus('partiallySelected');\n\t\t} else {\n\t\t\tsetCheckStatus('notSelected');\n\t\t}\n\t}, [options, childrenLayout]);\n\n\treturn (\n\t\t<ListItem\n\t\t\tversion={version}\n\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\tonClick={(e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tonCheckHandler();\n\t\t\t}}\n\t\t\tlistItem={{\n\t\t\t\tlabel: 'Select All',\n\t\t\t\tvalue: 'All',\n\t\t\t}}\n\t\t\tleadingIcon={\n\t\t\t\t<div style={{ width: 18, height: 18 }}>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tsize={version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\tisChecked={\n\t\t\t\t\t\t\tcheckStatus === 'selectAll' || checkStatus === 'partiallySelected'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisPartiallyChecked={checkStatus === 'partiallySelected'}\n\t\t\t\t\t\tonValueChange={onCheckHandler}\n\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\tvariant={'default'}\n\t\t/>\n\t);\n};\n"],"names":["SelectAllMenu","options","onSelect","version","checkboxActiveColor","brandSelectedRow","childrenLayout","checkStatus","setCheckStatus","useState","onCheckHandler","useEffect","allOptions","getSelectionLeaves","option","leaf","jsx","ListItem","e","CheckBox"],"mappings":";;;;;AAWO,MAAMA,IAOR,CAAC;AAAA,EACL,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAaC,CAAc,IACjCC,EAAiC,aAAa;AAE/C,WAASC,IAAiB;AACzB,IAAIH,MAAgB,uBACnBL,EAAS,aAAa,GAGnBK,MAAgB,eACnBL,EAAS,aAAa,GAGnBK,MAAgB,iBACnBL,EAAS,WAAW;AAAA,EAEtB;AAEA,SAAAS,EAAU,MAAM;AACf,UAAMC,IAAaC;AAAA,MAClBZ,EAAQ,OAAO,CAACa,MAAW,CAAEA,EAAwB,QAAQ;AAAA,MAC7DR,MAAmB;AAAA,IAAA,EAElB,OAAO,CAACS,MAAS,CAACA,EAAK,QAAQ,EAC/B,IAAI,CAACA,MAASA,EAAK,YAAY,EAAK;AAEtC,IAAIH,EAAW,MAAM,OAAO,IAC3BJ,EAAe,WAAW,IAChBI,EAAW,OAAO,OAAO,EAAE,SAAS,IAC9CJ,EAAe,mBAAmB,IAElCA,EAAe,aAAa;AAAA,EAE9B,GAAG,CAACP,GAASK,CAAc,CAAC,GAG3B,gBAAAU;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,SAAAd;AAAA,MACA,kBAAAE;AAAA,MACA,SAAS,CAACa,MAAM;AACf,QAAAA,EAAE,eAAA,GACFR,EAAA;AAAA,MACD;AAAA,MACA,UAAU;AAAA,QACT,OAAO;AAAA,QACP,OAAO;AAAA,MAAA;AAAA,MAER,+BACE,OAAA,EAAI,OAAO,EAAE,OAAO,IAAI,QAAQ,GAAA,GAChC,UAAA,gBAAAM;AAAA,QAACG;AAAA,QAAA;AAAA,UACA,MAAMhB,MAAY,QAAQ,UAAU;AAAA,UACpC,WACCI,MAAgB,eAAeA,MAAgB;AAAA,UAEhD,oBAAoBA,MAAgB;AAAA,UACpC,eAAeG;AAAA,UACf,aAAaN;AAAA,QAAA;AAAA,MAAA,GAEf;AAAA,MAED,SAAS;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -7,6 +7,8 @@ interface MultiSelectDropdownBottomBarProps {
|
|
|
7
7
|
buttonText?: string;
|
|
8
8
|
buttonOptions?: ButtonOptions;
|
|
9
9
|
hideClearButton?: boolean;
|
|
10
|
+
hideSelectedCount?: boolean;
|
|
11
|
+
childrenLayout?: 'flyout' | 'nested';
|
|
10
12
|
}
|
|
11
13
|
declare const MultiSelectDropdownBottomBar: React.FC<MultiSelectDropdownBottomBarProps>;
|
|
12
14
|
export default MultiSelectDropdownBottomBar;
|