@razorpay/blade 12.20.0 → 12.21.0
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/build/lib/native/components/ActionList/ActionListItem.js +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheet.native.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheet.native.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/native/components/Collapsible/Collapsible.js +3 -1
- package/build/lib/native/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleBody.js +2 -1
- package/build/lib/native/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleButton.js +2 -3
- package/build/lib/native/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleLink.js +2 -3
- package/build/lib/native/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/native/components/Collapsible/componentIds.js +4 -0
- package/build/lib/native/components/Collapsible/componentIds.js.map +1 -0
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js +1 -1
- package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/AutoComplete.js +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js +3 -3
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +4 -4
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +9 -2
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +3 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/Collapsible.js +7 -2
- package/build/lib/web/development/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleBody.js +2 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleButton.js +2 -3
- package/build/lib/web/development/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleLink.js +2 -3
- package/build/lib/web/development/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/componentIds.js +9 -0
- package/build/lib/web/development/components/Collapsible/componentIds.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +6 -3
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/useDatesState.js +12 -1
- package/build/lib/web/development/components/DatePicker/useDatesState.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/usePopup.js +5 -1
- package/build/lib/web/development/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js +6 -3
- package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +8 -6
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js +18 -8
- package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js +16 -6
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +7 -3
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/AutoComplete.js +11 -8
- package/build/lib/web/development/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +24 -12
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNav.web.js +13 -2
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +1 -0
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavLevel.web.js +4 -0
- package/build/lib/web/development/components/SideNav/SideNavLevel.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/StepGroup.web.js +26 -4
- package/build/lib/web/development/components/StepGroup/StepGroup.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/StepItem.web.js +2 -1
- package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js +3 -3
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +4 -4
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +9 -2
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +3 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/Collapsible.js +7 -2
- package/build/lib/web/production/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleBody.js +2 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleButton.js +2 -3
- package/build/lib/web/production/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleLink.js +2 -3
- package/build/lib/web/production/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/componentIds.js +9 -0
- package/build/lib/web/production/components/Collapsible/componentIds.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +6 -3
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/useDatesState.js +12 -1
- package/build/lib/web/production/components/DatePicker/useDatesState.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/usePopup.js +5 -1
- package/build/lib/web/production/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js +6 -3
- package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +8 -6
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js +18 -8
- package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js +16 -6
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +7 -3
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/AutoComplete.js +11 -8
- package/build/lib/web/production/components/Input/DropdownInputTriggers/AutoComplete.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +24 -12
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNav.web.js +13 -2
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +1 -0
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavLevel.web.js +4 -0
- package/build/lib/web/production/components/SideNav/SideNavLevel.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/StepGroup.web.js +26 -4
- package/build/lib/web/production/components/StepGroup/StepGroup.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/StepItem.web.js +2 -1
- package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/types/components/index.d.ts +20 -9
- package/build/types/components/index.native.d.ts +19 -8
- package/package.json +1 -1
|
@@ -109,10 +109,10 @@ var useFilteredItems = function useFilteredItems(children) {
|
|
|
109
109
|
|
|
110
110
|
var _useDropdown = useDropdown(),
|
|
111
111
|
filteredValues = _useDropdown.filteredValues,
|
|
112
|
-
|
|
112
|
+
hasAutoCompleteInHeader = _useDropdown.hasAutoCompleteInHeader,
|
|
113
113
|
dropdownTriggerer = _useDropdown.dropdownTriggerer;
|
|
114
114
|
var items = React__default.useMemo(function () {
|
|
115
|
-
var hasAutoComplete =
|
|
115
|
+
var hasAutoComplete = hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
116
116
|
if (!hasAutoComplete) {
|
|
117
117
|
return childrenArray;
|
|
118
118
|
}
|
|
@@ -145,7 +145,7 @@ var useFilteredItems = function useFilteredItems(children) {
|
|
|
145
145
|
return acc;
|
|
146
146
|
}, []);
|
|
147
147
|
return filteredItems;
|
|
148
|
-
}, [filteredValues,
|
|
148
|
+
}, [filteredValues, hasAutoCompleteInHeader, dropdownTriggerer, childrenArray]);
|
|
149
149
|
return {
|
|
150
150
|
itemData: items,
|
|
151
151
|
itemCount: items.length
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React, { useCallback } from 'react';\nimport type { VariableSizeList } from 'react-window';\nimport { VariableSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { componentIds } from './componentIds';\nimport { ActionListSectionTitle } from './ActionListItem';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport {\n actionListSectionTitleHeight,\n actionListDividerHeight,\n getActionListItemHeight,\n} from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { Divider } from '~components/Divider';\nimport type { ActionListItemProps } from '~components/ActionList';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * get the height of the item based on the componentId\n */\nconst getItemHeight = ({\n index,\n itemData,\n actionListItemHeight,\n}: {\n index: number;\n itemData: React.ReactNode[];\n actionListItemHeight: number;\n}): number => {\n if (getComponentId(itemData[index]) === componentIds.ActionListItem) {\n return actionListItemHeight;\n }\n\n if (getComponentId(itemData[index]) === componentIds.ActionListSectionTitle) {\n return actionListSectionTitleHeight;\n }\n // @ts-expect-error: key does exist\n if (itemData[index]?.key.includes('divider')) {\n return actionListDividerHeight;\n }\n return 0;\n};\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n itemCount,\n itemData,\n}: {\n theme: Theme;\n isMobile: boolean;\n itemCount: number;\n itemData: React.ReactNode[];\n}): {\n actionListItemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getActionListItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListItemHeight = isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop;\n const shouldCalculateMinimumHeight = itemCount <= 10;\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n const actionListBoxMinHeight = shouldCalculateMinimumHeight\n ? itemData.reduce<number>((acc, _, index) => {\n const itemHeight = getItemHeight({ index, itemData, actionListItemHeight });\n return acc + itemHeight;\n }, 0)\n : actionListBoxHeight;\n const finalActionListBoxHeight = Math.min(actionListBoxHeight, actionListBoxMinHeight);\n\n return {\n actionListItemHeight,\n actionListBoxHeight: finalActionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n const filteredItems = childrenArray.reduce<React.ReactNode[]>((acc, item, index) => {\n if (getComponentId(item) === componentIds.ActionListSection) {\n const sectionTitle = (\n <ActionListSectionTitle\n key={index}\n // @ts-expect-error: props does exist\n title={item?.props.title}\n isInsideVirtualizedList\n />\n );\n // @ts-expect-error: props does exist\n const sectionChildren = item?.props.children;\n\n const divider =\n index !== childrenArray.length - 1 ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" key={`divider-${index}`} />\n ) : null;\n const filteredSectionChildren = sectionChildren.filter(\n (item: { props: { value: string } }) => filteredValues.includes(item.props.value),\n );\n if (filteredSectionChildren.length !== 0) {\n acc.push(sectionTitle, ...filteredSectionChildren, divider);\n }\n } else {\n // @ts-expect-error: props does exist\n const value = item?.props.value;\n if (filteredValues.includes(value)) {\n acc.push(item);\n }\n }\n return acc;\n }, []);\n\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = React.memo(\n ({\n index,\n style,\n data,\n onVirtualizedFocus,\n }: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n onVirtualizedFocus: (index: number) => void;\n }): React.ReactElement | null => {\n const currentItem = data[index];\n\n if (\n React.isValidElement(currentItem) &&\n getComponentId(currentItem) === componentIds.ActionListItem\n ) {\n // Clone the element passed via `data` and add the `_virtualizedIndex` prop\n const elementWithIndex = React.cloneElement(\n currentItem as React.ReactElement<ActionListItemProps>,\n {\n _virtualizedIndex: index,\n _onVirtualizedFocus: onVirtualizedFocus,\n },\n );\n\n return <div style={style}>{elementWithIndex}</div>;\n }\n\n return <div style={style}>{data[index]}</div>;\n },\n (prevProps, nextProps) => {\n // Custom comparison function to determine if component should update\n return (\n prevProps.index === nextProps.index &&\n prevProps.style === nextProps.style &&\n prevProps.data[prevProps.index] === nextProps.data[nextProps.index]\n );\n },\n);\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const virtualizedListRef = React.useRef<VariableSizeList>(null);\n const [visibleStartIndex, setVisibleStartIndex] = React.useState(0);\n const [visibleStopIndex, setVisibleStopIndex] = React.useState(0);\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { actionListItemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile, itemCount, itemData }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile, itemCount, itemData],\n );\n React.useEffect(() => {\n virtualizedListRef?.current?.resetAfterIndex(0);\n virtualizedListRef?.current?.scrollToItem(0);\n }, [itemCount]);\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n // in case of virtualized list, we only render visible items. so css will hide divider for every last item visible. instead of hiding the last divider of the list.\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n <VirtualizedList<React.ReactNode[]>\n ref={virtualizedListRef}\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={(index) => getItemHeight({ index, itemData, actionListItemHeight })}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={(index) =>\n // @ts-expect-error: props does exist\n itemData[index]?.props.value ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.title ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.key\n }\n onItemsRendered={({ visibleStartIndex, visibleStopIndex }) => {\n setVisibleStartIndex(visibleStartIndex);\n setVisibleStopIndex(visibleStopIndex);\n }}\n >\n {useCallback(\n ({ index, style, data }) => {\n return (\n <VirtualListItem\n index={index}\n style={style}\n data={data}\n onVirtualizedFocus={(index) => {\n // We need scroll Direction to determine the index to focus\n const scrollDirection =\n Math.round((visibleStartIndex + visibleStopIndex) / 2) > index\n ? 'top'\n : 'bottom';\n virtualizedListRef?.current?.resetAfterIndex(0);\n /**\n * we are scrolling to the item which is 3 items away from the current item.\n * since we can have 2 item sectoin header and divider which are not focusable.\n */\n virtualizedListRef?.current?.scrollToItem(\n index + (scrollDirection === 'top' ? -3 : 3),\n 'smart',\n );\n }}\n />\n );\n },\n [visibleStartIndex, visibleStopIndex],\n )}\n </VirtualizedList>\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getItemHeight","_ref2","_itemData$index","index","itemData","actionListItemHeight","getComponentId","componentIds","ActionListItem","ActionListSectionTitle","actionListSectionTitleHeight","key","includes","actionListDividerHeight","getVirtualItemParams","_ref3","theme","isMobile","itemCount","itemHeightResponsive","getActionListItemHeight","actionListPadding","getActionListPadding","itemHeightMobile","itemHeightDesktop","shouldCalculateMinimumHeight","actionListBoxHeight","actionListMaxHeight","actionListBoxMinHeight","reduce","acc","_","itemHeight","finalActionListBoxHeight","Math","min","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","item","ActionListSection","sectionTitle","title","props","isInsideVirtualizedList","sectionChildren","divider","length","Divider","marginX","marginY","concat","filteredSectionChildren","filter","value","push","apply","_toConsumableArray","VirtualListItem","_ref4","style","data","onVirtualizedFocus","currentItem","isValidElement","elementWithIndex","cloneElement","_virtualizedIndex","_onVirtualizedFocus","prevProps","nextProps","_ActionListVirtualizedBox","_ref5","_excluded2","virtualizedListRef","useRef","_React$useState","useState","_React$useState2","_slicedToArray","visibleStartIndex","setVisibleStartIndex","_React$useState3","_React$useState4","visibleStopIndex","setVisibleStopIndex","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","useEffect","_virtualizedListRef$c","_virtualizedListRef$c2","current","resetAfterIndex","scrollToItem","VirtualizedList","height","width","itemSize","itemKey","_ref6","_itemData$index$props","_itemData$index2","_itemData$index3","_itemData$index4","onItemsRendered","_ref7","useCallback","_ref8","_virtualizedListRef$c3","_virtualizedListRef$c4","scrollDirection","round","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AACtE,EAAA,IAAAC,qBAAA,GAA4BC,qBAAqB,EAAE;IAA3CC,eAAe,GAAAF,qBAAA,CAAfE,eAAe,CAAA;EAEvB,oBACEC,GAAA,CAACC,oBAAoB,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACnBH,IAAAA,eAAe,EAAEA,eAAgB;AACjCT,IAAAA,GAAG,EAAEA,GAAAA;AAAI,GAAA,EACLa,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEZ,yBAAyB;AAC/Ba,IAAAA,eAAe,EAAEb,yBAAyB,KAAK,SAAS,GAAGC,iBAAiB,GAAGa,SAAAA;AACjF,GAAC,CAAC,CAAA,EACEC,sBAAsB,CAACb,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAA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pB;AACA;AACA;AACoBvB,YAAAA,kBAAkB,KAAlBA,IAAAA,IAAAA,kBAAkB,KAAAwC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,sBAAA,GAAlBxC,kBAAkB,CAAEsB,OAAO,MAAAkB,IAAAA,IAAAA,sBAAA,KAA3BA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAA,CAA6BhB,YAAY,CACvC5G,KAAK,IAAI6H,eAAe,KAAK,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAC5C,OACF,CAAC,CAAA;AACH,WAAA;AAAE,SACH,CAAC,CAAA;AAEN,OAAC,EACD,CAACnC,iBAAiB,EAAEI,gBAAgB,CACtC,CAAA;KACe,CAAA;AAAC,GAAA,CACE,CAAC,CAAA;AAE3B,CACF,CAAC,CAAA;AAEKiC,IAAAA,wBAAwB,gBAAGrI,wBAAwB,eAACvB,cAAK,CAACwB,IAAI,CAACsF,yBAAyB,CAAC,EAAE;AAC/FrF,EAAAA,WAAW,EAAE,0BAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React, { useCallback } from 'react';\nimport type { VariableSizeList } from 'react-window';\nimport { VariableSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { componentIds } from './componentIds';\nimport { ActionListSectionTitle } from './ActionListItem';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport {\n actionListSectionTitleHeight,\n actionListDividerHeight,\n getActionListItemHeight,\n} from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { Divider } from '~components/Divider';\nimport type { ActionListItemProps } from '~components/ActionList';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * get the height of the item based on the componentId\n */\nconst getItemHeight = ({\n index,\n itemData,\n actionListItemHeight,\n}: {\n index: number;\n itemData: React.ReactNode[];\n actionListItemHeight: number;\n}): number => {\n if (getComponentId(itemData[index]) === componentIds.ActionListItem) {\n return actionListItemHeight;\n }\n\n if (getComponentId(itemData[index]) === componentIds.ActionListSectionTitle) {\n return actionListSectionTitleHeight;\n }\n // @ts-expect-error: key does exist\n if (itemData[index]?.key.includes('divider')) {\n return actionListDividerHeight;\n }\n return 0;\n};\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n itemCount,\n itemData,\n}: {\n theme: Theme;\n isMobile: boolean;\n itemCount: number;\n itemData: React.ReactNode[];\n}): {\n actionListItemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getActionListItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListItemHeight = isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop;\n const shouldCalculateMinimumHeight = itemCount <= 10;\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n const actionListBoxMinHeight = shouldCalculateMinimumHeight\n ? itemData.reduce<number>((acc, _, index) => {\n const itemHeight = getItemHeight({ index, itemData, actionListItemHeight });\n return acc + itemHeight;\n }, 0)\n : actionListBoxHeight;\n const finalActionListBoxHeight = Math.min(actionListBoxHeight, actionListBoxMinHeight);\n\n return {\n actionListItemHeight,\n actionListBoxHeight: finalActionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n const filteredItems = childrenArray.reduce<React.ReactNode[]>((acc, item, index) => {\n if (getComponentId(item) === componentIds.ActionListSection) {\n const sectionTitle = (\n <ActionListSectionTitle\n key={index}\n // @ts-expect-error: props does exist\n title={item?.props.title}\n isInsideVirtualizedList\n />\n );\n // @ts-expect-error: props does exist\n const sectionChildren = item?.props.children;\n\n const divider =\n index !== childrenArray.length - 1 ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" key={`divider-${index}`} />\n ) : null;\n const filteredSectionChildren = sectionChildren.filter(\n (item: { props: { value: string } }) => filteredValues.includes(item.props.value),\n );\n if (filteredSectionChildren.length !== 0) {\n acc.push(sectionTitle, ...filteredSectionChildren, divider);\n }\n } else {\n // @ts-expect-error: props does exist\n const value = item?.props.value;\n if (filteredValues.includes(value)) {\n acc.push(item);\n }\n }\n return acc;\n }, []);\n\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = React.memo(\n ({\n index,\n style,\n data,\n onVirtualizedFocus,\n }: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n onVirtualizedFocus: (index: number) => void;\n }): React.ReactElement | null => {\n const currentItem = data[index];\n\n if (\n React.isValidElement(currentItem) &&\n getComponentId(currentItem) === componentIds.ActionListItem\n ) {\n // Clone the element passed via `data` and add the `_virtualizedIndex` prop\n const elementWithIndex = React.cloneElement(\n currentItem as React.ReactElement<ActionListItemProps>,\n {\n _virtualizedIndex: index,\n _onVirtualizedFocus: onVirtualizedFocus,\n },\n );\n\n return <div style={style}>{elementWithIndex}</div>;\n }\n\n return <div style={style}>{data[index]}</div>;\n },\n (prevProps, nextProps) => {\n // Custom comparison function to determine if component should update\n return (\n prevProps.index === nextProps.index &&\n prevProps.style === nextProps.style &&\n prevProps.data[prevProps.index] === nextProps.data[nextProps.index]\n );\n },\n);\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const virtualizedListRef = React.useRef<VariableSizeList>(null);\n const [visibleStartIndex, setVisibleStartIndex] = React.useState(0);\n const [visibleStopIndex, setVisibleStopIndex] = React.useState(0);\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { actionListItemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile, itemCount, itemData }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile, itemCount, itemData],\n );\n React.useEffect(() => {\n virtualizedListRef?.current?.resetAfterIndex(0);\n virtualizedListRef?.current?.scrollToItem(0);\n }, [itemCount]);\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n // in case of virtualized list, we only render visible items. so css will hide divider for every last item visible. instead of hiding the last divider of the list.\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n <VirtualizedList<React.ReactNode[]>\n ref={virtualizedListRef}\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={(index) => getItemHeight({ index, itemData, actionListItemHeight })}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={(index) =>\n // @ts-expect-error: props does exist\n itemData[index]?.props.value ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.title ??\n // @ts-expect-error: props does exist\n itemData[index]?.props.key\n }\n onItemsRendered={({ visibleStartIndex, visibleStopIndex }) => {\n setVisibleStartIndex(visibleStartIndex);\n setVisibleStopIndex(visibleStopIndex);\n }}\n >\n {useCallback(\n ({ index, style, data }) => {\n return (\n <VirtualListItem\n index={index}\n style={style}\n data={data}\n onVirtualizedFocus={(index) => {\n // We need scroll Direction to determine the index to focus\n const scrollDirection =\n Math.round((visibleStartIndex + visibleStopIndex) / 2) > index\n ? 'top'\n : 'bottom';\n virtualizedListRef?.current?.resetAfterIndex(0);\n /**\n * we are scrolling to the item which is 3 items away from the current item.\n * since we can have 2 item sectoin header and divider which are not focusable.\n */\n virtualizedListRef?.current?.scrollToItem(\n index + (scrollDirection === 'top' ? -3 : 3),\n 'smart',\n );\n }}\n />\n );\n },\n [visibleStartIndex, visibleStopIndex],\n )}\n </VirtualizedList>\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getItemHeight","_ref2","_itemData$index","index","itemData","actionListItemHeight","getComponentId","componentIds","ActionListItem","ActionListSectionTitle","actionListSectionTitleHeight","key","includes","actionListDividerHeight","getVirtualItemParams","_ref3","theme","isMobile","itemCount","itemHeightResponsive","getActionListItemHeight","actionListPadding","getActionListPadding","itemHeightMobile","itemHeightDesktop","shouldCalculateMinimumHeight","actionListBoxHeight","actionListMaxHeight","actionListBoxMinHeight","reduce","acc","_","itemHeight","finalActionListBoxHeight","Math","min","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","item","ActionListSection","sectionTitle","title","props","isInsideVirtualizedList","sectionChildren","divider","length","Divider","marginX","marginY","concat","filteredSectionChildren","filter","value","push","apply","_toConsumableArray","VirtualListItem","_ref4","style","data","onVirtualizedFocus","currentItem","isValidElement","elementWithIndex","cloneElement","_virtualizedIndex","_onVirtualizedFocus","prevProps","nextProps","_ActionListVirtualizedBox","_ref5","_excluded2","virtualizedListRef","useRef","_React$useState","useState","_React$useState2","_slicedToArray","visibleStartIndex","setVisibleStartIndex","_React$useState3","_React$useState4","visibleStopIndex","setVisibleStopIndex","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","useEffect","_virtualizedListRef$c","_virtualizedListRef$c2","current","resetAfterIndex","scrollToItem","VirtualizedList","height","width","itemSize","itemKey","_ref6","_itemData$index$props","_itemData$index2","_itemData$index3","_itemData$index4","onItemsRendered","_ref7","useCallback","_ref8","_virtualizedListRef$c3","_virtualizedListRef$c4","scrollDirection","round","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AACtE,EAAA,IAAAC,qBAAA,GAA4BC,qBAAqB,EAAE;IAA3CC,eAAe,GAAAF,qBAAA,CAAfE,eAAe,CAAA;EAEvB,oBACEC,GAAA,CAACC,oBAAoB,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACnBH,IAAAA,eAAe,EAAEA,eAAgB;AACjCT,IAAAA,GAAG,EAAEA,GAAAA;AAAI,GAAA,EACLa,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEZ,yBAAyB;AAC/Ba,IAAAA,eAAe,EAAEb,yBAAyB,KAAK,SAAS,GAAGC,iBAAiB,GAAGa,SAAAA;AACjF,GAAC,CAAC,CAAA,EACEC,sBAAsB,CAACb,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAAA,EAE/BjB,cAAAA;AAAc,GAAA,CACK,CAAC,CAAA;AAE3B,CACF,CAAC,CAAA;AAEKkB,IAAAA,aAAa,gBAAGC,wBAAwB,eAACvB,cAAK,CAACwB,IAAI,C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lBxC,kBAAkB,CAAEsB,OAAO,MAAAkB,IAAAA,IAAAA,sBAAA,KAA3BA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAA,CAA6BhB,YAAY,CACvC5G,KAAK,IAAI6H,eAAe,KAAK,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAC5C,OACF,CAAC,CAAA;AACH,WAAA;AAAE,SACH,CAAC,CAAA;AAEN,OAAC,EACD,CAACnC,iBAAiB,EAAEI,gBAAgB,CACtC,CAAA;KACe,CAAA;AAAC,GAAA,CACE,CAAC,CAAA;AAE3B,CACF,CAAC,CAAA;AAEKiC,IAAAA,wBAAwB,gBAAGrI,wBAAwB,eAACvB,cAAK,CAACwB,IAAI,CAACsF,yBAAyB,CAAC,EAAE;AAC/FrF,EAAAA,WAAW,EAAE,0BAAA;AACf,CAAC;;;;"}
|
|
@@ -81,10 +81,10 @@ var _ActionListSection = function _ActionListSection(_ref2) {
|
|
|
81
81
|
_sectionChildValues = _ref2._sectionChildValues,
|
|
82
82
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
83
83
|
var _useDropdown = useDropdown(),
|
|
84
|
-
|
|
84
|
+
hasAutoCompleteInHeader = _useDropdown.hasAutoCompleteInHeader,
|
|
85
85
|
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
86
86
|
filteredValues = _useDropdown.filteredValues;
|
|
87
|
-
var hasAutoComplete =
|
|
87
|
+
var hasAutoComplete = hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
88
88
|
var isSectionVisible = React__default.useMemo(function () {
|
|
89
89
|
if (hasAutoComplete) {
|
|
90
90
|
var visibleActionListItemInSection = _sectionChildValues === null || _sectionChildValues === void 0 ? void 0 : _sectionChildValues.find(function (actionItemValue) {
|
|
@@ -243,7 +243,7 @@ var _ActionListItem = function _ActionListItem(props) {
|
|
|
243
243
|
dropdownTriggerer = _useDropdown2.dropdownTriggerer,
|
|
244
244
|
isKeydownPressed = _useDropdown2.isKeydownPressed,
|
|
245
245
|
filteredValues = _useDropdown2.filteredValues,
|
|
246
|
-
|
|
246
|
+
hasAutoCompleteInHeader = _useDropdown2.hasAutoCompleteInHeader,
|
|
247
247
|
hasUnControlledFilterChipSelectInput = _useDropdown2.hasUnControlledFilterChipSelectInput;
|
|
248
248
|
React__default.useEffect(function () {
|
|
249
249
|
if (activeIndex === props._index && props._virtualizedIndex !== undefined) {
|
|
@@ -252,7 +252,7 @@ var _ActionListItem = function _ActionListItem(props) {
|
|
|
252
252
|
}
|
|
253
253
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
254
254
|
}, [activeIndex]);
|
|
255
|
-
var hasAutoComplete =
|
|
255
|
+
var hasAutoComplete = hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
256
256
|
var renderOnWebAs = props.href ? 'a' : 'button';
|
|
257
257
|
/**
|
|
258
258
|
* In SelectInput, returns the isSelected according to selected indexes in the state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListItem.js","sources":["../../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { componentIds } from './componentIds';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { BaseMenuItem, useBaseMenuItem } from '~components/BaseMenu';\nimport { Checkbox } from '~components/Checkbox';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n /**\n * Internally used to pass index for virtualized lists\n *\n * @private\n */\n _virtualizedIndex?: number;\n /**\n * Internally used to focus on virtualized list\n *\n * @private\n */\n _onVirtualizedFocus?: (_virtuazedIndex: number) => void;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionListSectionTitle = ({\n title,\n isInsideVirtualizedList = false,\n}: {\n title: string;\n isInsideVirtualizedList?: boolean;\n}): React.ReactElement => {\n return (\n <StyledActionListSectionTitle\n {...makeAccessible({\n hidden: !isInsideVirtualizedList,\n role: isInsideVirtualizedList ? 'heading' : undefined,\n })}\n >\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n );\n};\n\nconst ActionListSectionTitle = assignWithoutSideEffects(_ActionListSectionTitle, {\n componentId: componentIds.ActionListSectionTitle,\n});\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? <ActionListSectionTitle title={title} /> : null}\n\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(React.memo(_ActionListSection), {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { color, isDisabled } = useBaseMenuItem();\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n color === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = useBaseMenuItem();\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\nconst BaseMenuLeadingItem = ({\n isSelected,\n leading,\n selectionType,\n isDisabled,\n}: {\n isSelected?: boolean;\n leading?: React.ReactNode;\n selectionType: string | undefined;\n isDisabled?: boolean;\n}): React.ReactElement | null => {\n if (selectionType === 'multiple') {\n return (\n <BaseBox\n pointerEvents=\"none\"\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/*\n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n );\n }\n return React.isValidElement(leading) ? leading : null;\n};\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: (e: React.TouchEvent<TouchableOpacity>) => void; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInBottomSheetHeader,\n hasUnControlledFilterChipSelectInput,\n } = useDropdown();\n\n React.useEffect(() => {\n if (activeIndex === props._index && props._virtualizedIndex !== undefined) {\n props._onVirtualizedFocus?.(props._virtualizedIndex as number);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput ||\n hasAutoComplete ||\n hasUnControlledFilterChipSelectInput\n ) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n const isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;\n\n return (\n <BaseMenuItem\n isVisible={isVisible}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n tabIndex={-1}\n title={props.title}\n description={props.description}\n leading={\n <BaseMenuLeadingItem\n key={`${dropdownBaseId}-${props._index}-leading-${isSelected}`}\n isSelected={isSelected}\n leading={props.leading}\n selectionType={selectionType}\n isDisabled={props.isDisabled}\n />\n }\n trailing={props.trailing}\n titleSuffix={props.titleSuffix}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n role={getActionListItemRole(dropdownTriggerer, props.href)}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...makeAnalyticsAttribute({ ...props })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n selectionType={selectionType}\n color={props.intent}\n isKeydownPressed={isKeydownPressed}\n />\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemAvatar,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n ActionListSectionTitle,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSectionTitle","_ref","title","_ref$isInsideVirtuali","isInsideVirtualizedList","_jsx","_objectSpread","makeAccessible","hidden","role","undefined","children","Text","color","size","weight","ActionListSectionTitle","assignWithoutSideEffects","componentIds","_ActionListSection","_ref2","testID","_hideDivider","_sectionChildValues","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","makeAnalyticsAttribute","Divider","marginX","marginY","memo","_ActionListItemIcon","_ref3","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref4","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref5","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","BaseMenuLeadingItem","_ref6","isSelected","leading","selectionType","pointerEvents","Checkbox","isChecked","tabIndex","isValidElement","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","isKeydownPressed","hasUnControlledFilterChipSelectInput","useEffect","_index","_virtualizedIndex","_props$_onVirtualized","_onVirtualizedFocus","call","renderOnWebAs","href","getIsSelected","SelectInput","validateActionListItemProps","trailing","titleSuffix","intent","throwBladeError","message","moduleName","isVisible","value","BaseMenuItem","as","id","description","target","className","getActionListItemRole","e","_props$onClick","event","castWebType","ActionListItem","onMouseDown","onMouseUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,IAAMA,4BAA4B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAAC,UAACC,KAAK,EAAA;EAAA,OAAM;AAC/D;IACAC,OAAO,EAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAA;GACzC,CAAA;AAAA,CAAC,CAAC,CAAA;AAsBH,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAMH;AAAA,EAAA,IALxBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,qBAAA,GAAAF,IAAA,CACLG,uBAAuB;AAAvBA,IAAAA,uBAAuB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA,CAAA;EAK/B,oBACEE,GAAA,CAAChB,4BAA4B,EAAAiB,aAAA,CAAAA,aAAA,CACvBC,EAAAA,EAAAA,cAAc,CAAC;IACjBC,MAAM,EAAE,CAACJ,uBAAuB;AAChCK,IAAAA,IAAI,EAAEL,uBAAuB,GAAG,SAAS,GAAGM,SAAAA;AAC9C,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;IAAAC,QAAA,eAEFN,GAAA,CAACO,IAAI,EAAA;AAACC,MAAAA,KAAK,EAAC,yBAAyB;AAACC,MAAAA,IAAI,EAAC,OAAO;AAACC,MAAAA,MAAM,EAAC,UAAU;AAAAJ,MAAAA,QAAA,EACjET,KAAAA;KACG,CAAA;AAAC,GAAA,CACqB,CAAC,CAAA;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K,CAAC,CAAA;KACnC;IACF,YAAYrH,EAAAA,KAAK,CAAC0I,KAAM;IACxB,YAAY1I,EAAAA,KAAK,CAACyH,MAAO;AACzBpB,IAAAA,aAAa,EAAEA,aAAc;IAC7BnF,KAAK,EAAElB,KAAK,CAACqI,MAAO;AACpBf,IAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,GAAA,CACpC,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKgC,IAAAA,cAAc,gBAAGhI,wBAAwB,eAACoB,cAAK,CAACsB,IAAI,CAAC+C,eAAe,CAAC,EAAE;EAC3EhH,WAAW,EAAEwB,YAAY,CAAC+H,cAAc;EACxCxJ,WAAW,EAAEyB,YAAY,CAAC+H,cAAAA;AAC5B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionListItem.js","sources":["../../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { componentIds } from './componentIds';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { BaseMenuItem, useBaseMenuItem } from '~components/BaseMenu';\nimport { Checkbox } from '~components/Checkbox';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n /**\n * Internally used to pass index for virtualized lists\n *\n * @private\n */\n _virtualizedIndex?: number;\n /**\n * Internally used to focus on virtualized list\n *\n * @private\n */\n _onVirtualizedFocus?: (_virtuazedIndex: number) => void;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionListSectionTitle = ({\n title,\n isInsideVirtualizedList = false,\n}: {\n title: string;\n isInsideVirtualizedList?: boolean;\n}): React.ReactElement => {\n return (\n <StyledActionListSectionTitle\n {...makeAccessible({\n hidden: !isInsideVirtualizedList,\n role: isInsideVirtualizedList ? 'heading' : undefined,\n })}\n >\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n );\n};\n\nconst ActionListSectionTitle = assignWithoutSideEffects(_ActionListSectionTitle, {\n componentId: componentIds.ActionListSectionTitle,\n});\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? <ActionListSectionTitle title={title} /> : null}\n\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(React.memo(_ActionListSection), {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { color, isDisabled } = useBaseMenuItem();\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n color === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = useBaseMenuItem();\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\nconst BaseMenuLeadingItem = ({\n isSelected,\n leading,\n selectionType,\n isDisabled,\n}: {\n isSelected?: boolean;\n leading?: React.ReactNode;\n selectionType: string | undefined;\n isDisabled?: boolean;\n}): React.ReactElement | null => {\n if (selectionType === 'multiple') {\n return (\n <BaseBox\n pointerEvents=\"none\"\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/*\n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n );\n }\n return React.isValidElement(leading) ? leading : null;\n};\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: (e: React.TouchEvent<TouchableOpacity>) => void; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInHeader,\n hasUnControlledFilterChipSelectInput,\n } = useDropdown();\n\n React.useEffect(() => {\n if (activeIndex === props._index && props._virtualizedIndex !== undefined) {\n props._onVirtualizedFocus?.(props._virtualizedIndex as number);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n\n const hasAutoComplete =\n hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput ||\n hasAutoComplete ||\n hasUnControlledFilterChipSelectInput\n ) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n const isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;\n\n return (\n <BaseMenuItem\n isVisible={isVisible}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n tabIndex={-1}\n title={props.title}\n description={props.description}\n leading={\n <BaseMenuLeadingItem\n key={`${dropdownBaseId}-${props._index}-leading-${isSelected}`}\n isSelected={isSelected}\n leading={props.leading}\n selectionType={selectionType}\n isDisabled={props.isDisabled}\n />\n }\n trailing={props.trailing}\n titleSuffix={props.titleSuffix}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n role={getActionListItemRole(dropdownTriggerer, props.href)}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...makeAnalyticsAttribute({ ...props })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n selectionType={selectionType}\n color={props.intent}\n isKeydownPressed={isKeydownPressed}\n />\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemAvatar,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n ActionListSectionTitle,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSectionTitle","_ref","title","_ref$isInsideVirtuali","isInsideVirtualizedList","_jsx","_objectSpread","makeAccessible","hidden","role","undefined","children","Text","color","size","weight","ActionListSectionTitle","assignWithoutSideEffects","componentIds","_ActionListSection","_ref2","testID","_hideDivider","_sectionChildValues","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","hasAutoCompleteInHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","makeAnalyticsAttribute","Divider","marginX","marginY","memo","_ActionListItemIcon","_ref3","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref4","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref5","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","BaseMenuLeadingItem","_ref6","isSelected","leading","selectionType","pointerEvents","Checkbox","isChecked","tabIndex","isValidElement","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","isKeydownPressed","hasUnControlledFilterChipSelectInput","useEffect","_index","_virtualizedIndex","_props$_onVirtualized","_onVirtualizedFocus","call","renderOnWebAs","href","getIsSelected","SelectInput","validateActionListItemProps","trailing","titleSuffix","intent","throwBladeError","message","moduleName","isVisible","value","BaseMenuItem","as","id","description","target","className","getActionListItemRole","e","_props$onClick","event","castWebType","ActionListItem","onMouseDown","onMouseUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AAiB,GAAA,CACpC,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKgC,IAAAA,cAAc,gBAAGhI,wBAAwB,eAACoB,cAAK,CAACsB,IAAI,CAAC+C,eAAe,CAAC,EAAE;EAC3EhH,WAAW,EAAEwB,YAAY,CAAC+H,cAAc;EACxCxJ,WAAW,EAAEyB,YAAY,CAAC+H,cAAAA;AAC5B,CAAC;;;;"}
|
|
@@ -52,6 +52,11 @@ var centerBoxProps = {
|
|
|
52
52
|
height: '20px'
|
|
53
53
|
})
|
|
54
54
|
};
|
|
55
|
+
var absolutePositionedButton = {
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
top: 'spacing.0',
|
|
58
|
+
right: 'spacing.0'
|
|
59
|
+
};
|
|
55
60
|
var sizeTokensMapping = {
|
|
56
61
|
large: {
|
|
57
62
|
title: 'large'
|
|
@@ -184,6 +189,7 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
184
189
|
size: size$1
|
|
185
190
|
});
|
|
186
191
|
var shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;
|
|
192
|
+
var hasOnlyChildren = children && !(title || subtitle || titleSuffix || leading);
|
|
187
193
|
var webOnlyEventHandlers = isReactNative() ? {} : {
|
|
188
194
|
onClickCapture: onClickCapture,
|
|
189
195
|
onKeyDown: onKeyDown,
|
|
@@ -212,6 +218,7 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
212
218
|
touchAction: "none"
|
|
213
219
|
}, webOnlyEventHandlers), {}, {
|
|
214
220
|
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
221
|
+
position: "relative",
|
|
215
222
|
display: "flex",
|
|
216
223
|
flexDirection: "row",
|
|
217
224
|
userSelect: "none",
|
|
@@ -229,7 +236,7 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
229
236
|
accessibilityLabel: "Back"
|
|
230
237
|
})
|
|
231
238
|
}))
|
|
232
|
-
}) : null, /*#__PURE__*/jsxs(BaseBox, {
|
|
239
|
+
}) : null, hasOnlyChildren ? null : /*#__PURE__*/jsxs(BaseBox, {
|
|
233
240
|
paddingRight: "spacing.5",
|
|
234
241
|
marginRight: "auto",
|
|
235
242
|
flex: "auto",
|
|
@@ -277,7 +284,7 @@ var _BaseHeader = function _BaseHeader(_ref2) {
|
|
|
277
284
|
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
278
285
|
children: validatedTrailingComponent
|
|
279
286
|
}))
|
|
280
|
-
}) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
287
|
+
}) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, hasOnlyChildren ? absolutePositionedButton : centerBoxProps[size$1]), {}, {
|
|
281
288
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
282
289
|
ref: closeButtonRef,
|
|
283
290
|
size: "large",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n marginTop?: BoxProps['marginTop'];\n marginBottom?: BoxProps['marginBottom'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID &\n DataAnalyticsAttribute;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n marginBottom,\n marginTop,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n ...rest\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n marginTop={marginTop}\n marginBottom={marginBottom}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n wordBreak=\"break-word\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box width=\"100%\">{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","_objectSpread","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","marginBottom","marginTop","_ref2$size","isDisabled","children","trailingInteractionElement","rest","_objectWithoutProperties","_excluded","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","makeAnalyticsAttribute","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","makeSize","sizeToken","weight","color","wordBreak","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,IAAMA,oBAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,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ACT1B,WAAW,gBAAG2C,GAAA,CAACwB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAAC3E,WAAW,EAAE;AACvD4E,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n marginTop?: BoxProps['marginTop'];\n marginBottom?: BoxProps['marginBottom'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID &\n DataAnalyticsAttribute;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst absolutePositionedButton = {\n position: 'absolute',\n top: 'spacing.0',\n right: 'spacing.0',\n} as const;\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n marginBottom,\n marginTop,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n ...rest\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n const hasOnlyChildren = children && !(title || subtitle || titleSuffix || leading);\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n marginTop={marginTop}\n marginBottom={marginBottom}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox position=\"relative\" display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n {hasOnlyChildren ? null : (\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n wordBreak=\"break-word\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n )}\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...(hasOnlyChildren ? absolutePositionedButton : centerBoxProps[size])}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box width=\"100%\">{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","_objectSpread","height","medium","absolutePositionedButton","position","top","right","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","marginBottom","marginTop","_ref2$size","isDisabled","children","trailingInteractionElement","rest","_objectWithoutProperties","_excluded","shouldWrapTitle","hasOnlyChildren","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","makeAnalyticsAttribute","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","makeSize","sizeToken","weight","color","wordBreak","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,IAAMA,oBAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,cAAc,EAAE,QAAA;AAClB,CAAC,CAAA;AAED,IAAMC,cAAqD,GAAG;AAC5DC,EAAAA,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACAN,oBAAoB,CAAA,EAAA,EAAA,EAAA;A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a,MAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAuE,UAAAA,QAAA,EACjDC,0BAAAA;SACE,CAAA,CAAC,GACJ,IAAI,CAAA;AAAA,OACD,CAAC,CAAA;KACH,CAAA,CAAC,EACT1B,WAAW,gBAAG4C,GAAA,CAACwB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAAC5E,WAAW,EAAE;AACvD6E,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -147,7 +147,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
147
147
|
var setPositionY = React__default.useCallback(function (value) {
|
|
148
148
|
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
149
149
|
// In AutoComplete, we want BottomSheet to be docked to top snappoint so we remove the limits
|
|
150
|
-
var shouldLimitPositionY = limit && !(bottomSheetAndDropdownGlue !== null && bottomSheetAndDropdownGlue !== void 0 && bottomSheetAndDropdownGlue.
|
|
150
|
+
var shouldLimitPositionY = limit && !(bottomSheetAndDropdownGlue !== null && bottomSheetAndDropdownGlue !== void 0 && bottomSheetAndDropdownGlue.hasAutoCompleteInHeader);
|
|
151
151
|
var maxValue = computeMaxContent({
|
|
152
152
|
contentHeight: contentHeight,
|
|
153
153
|
footerHeight: footerHeight,
|
|
@@ -155,7 +155,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
155
155
|
maxHeight: value
|
|
156
156
|
});
|
|
157
157
|
_setPositionY(shouldLimitPositionY ? maxValue : value);
|
|
158
|
-
}, [bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.
|
|
158
|
+
}, [bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 ? void 0 : bottomSheetAndDropdownGlue.hasAutoCompleteInHeader, contentHeight, footerHeight, grabHandleHeight, headerHeight]);
|
|
159
159
|
|
|
160
160
|
// locks the body scroll to prevent accidental scrolling of content when we drag the sheet
|
|
161
161
|
// We are ready when we calculated the height of the content
|
|
@@ -184,7 +184,7 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
184
184
|
|
|
185
185
|
// if bottomSheet height is >35% & <50% then set initial snapPoint to 35%
|
|
186
186
|
useIsomorphicLayoutEffect(function () {
|
|
187
|
-
if (bottomSheetAndDropdownGlue !== null && bottomSheetAndDropdownGlue !== void 0 && bottomSheetAndDropdownGlue.
|
|
187
|
+
if (bottomSheetAndDropdownGlue !== null && bottomSheetAndDropdownGlue !== void 0 && bottomSheetAndDropdownGlue.hasAutoCompleteInHeader) {
|
|
188
188
|
initialSnapPoint.current = AUTOCOMPLETE_DEFAULT_SNAPPOINT;
|
|
189
189
|
} else {
|
|
190
190
|
var middleSnapPoint = snapPoints[1] * dimensions.height;
|