@razorpay/blade 11.28.1 → 11.29.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 +3 -2
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/actionListUtils.js +1 -1
- package/build/lib/native/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/native/components/ActionList/componentIds.js +1 -1
- package/build/lib/native/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/native/components/Form/FormHint.js +2 -1
- package/build/lib/native/components/Form/FormHint.js.map +1 -1
- package/build/lib/native/components/index.js +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +11 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/ActionList/actionListUtils.js +2 -2
- package/build/lib/web/development/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/web/development/components/ActionList/componentIds.js +1 -0
- package/build/lib/web/development/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/web/development/components/ActionList/index.js +1 -1
- package/build/lib/web/development/components/Form/FormHint.js +19 -15
- package/build/lib/web/development/components/Form/FormHint.js.map +1 -1
- package/build/lib/web/development/components/Form/FormHintWrapper.web.js +2 -4
- package/build/lib/web/development/components/Form/FormHintWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/StepItem.web.js +11 -6
- package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/TooltipInteractiveWrapper.web.js +9 -13
- package/build/lib/web/development/components/Tooltip/TooltipInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +11 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/ActionList/actionListUtils.js +2 -2
- package/build/lib/web/production/components/ActionList/actionListUtils.js.map +1 -1
- package/build/lib/web/production/components/ActionList/componentIds.js +1 -0
- package/build/lib/web/production/components/ActionList/componentIds.js.map +1 -1
- package/build/lib/web/production/components/ActionList/index.js +1 -1
- package/build/lib/web/production/components/Form/FormHint.js +19 -15
- package/build/lib/web/production/components/Form/FormHint.js.map +1 -1
- package/build/lib/web/production/components/Form/FormHintWrapper.web.js +2 -4
- package/build/lib/web/production/components/Form/FormHintWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/StepItem.web.js +11 -6
- package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/TooltipInteractiveWrapper.web.js +9 -13
- package/build/lib/web/production/components/Tooltip/TooltipInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +1 -1
- package/build/types/components/index.d.ts +445 -1131
- package/build/types/components/index.native.d.ts +254 -249
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionListUtils.js","sources":["../../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$onClick","_child$props","_child$props$isSelect","anchorLink","href","onClick","call","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","_objectSpread","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","throwBladeError","message","concat","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,EAItB;AACH;AACA,EAAA,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,UAACC,KAAK,EAAA;IAAA,OACvEC,cAAc,CAACD,KAAK,CAAC,CAAA;AAAA,GACvB,CAAC,CAAA;;AAED;EACA,IAAME,0BAA0B,GAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAAA;;AAED;AACA,EAAA,IAAMC,mCAAmC,GAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAAA;EAExC,OAAO;AACLH,IAAAA,mCAAmC,EAAnCA,mCAAmC;AACnCJ,IAAAA,0BAA0B,EAA1BA,0BAAAA;GACD,CAAA;AACH,CAAC,CAAA;AAED,IAAMQ,yBAAyB,GAAG,CAACN,YAAY,CAACK,cAAc,EAAEL,YAAY,CAACC,iBAAiB,CAAC,CAAA;AAQ/F;AACA;AACA;AACA,IAAMM,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3BjB,QAAyB,EAKtB;EACH,IAAMkB,WAAwB,GAAG,EAAE,CAAA;EACnC,IAAIC,cAA6B,GAAG,IAAI,CAAA;EACxC,IAAMC,iBAA8B,GAAG,EAAE,CAAA;EAEzC,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3Bf,KAAsB,EACtBgB,WAAoB,EACA;AACpB,IAAA,kBAAIpB,cAAK,CAACqB,cAAc,CAACjB,KAAK,CAAC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AAAA,CAAAA,CAAAA,MAAA,CAASzD,YAAY,CAACkE,kBAAkB,EAA8B,8BAAA,CAAA;AAC3JP,UAAAA,UAAU,EAAE,gBAAA;AACd,SAAC,CAAC,CAAA;AACJ,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AACF,EAAC;AAED,IAAMW,kBAAkB,GAAG,SAArBA,kBAAkBA,CACtBvD,UAA+B,EAK5B;AAAA,EAAA,IAAAwD,KAAA,GAAAC,SAAA,CAAApC,MAAA,GAAA,CAAA,IAAAoC,SAAA,CAAA,CAAA,CAAA,KAAAnB,SAAA,GAAAmB,SAAA,CAAA,CAAA,CAAA,GAJkC,EAAE;IAArCC,OAAO,GAAAF,KAAA,CAAPE,OAAO,CAAA;AAKT,EAAA,IAAI1D,UAAU,EAAE;AACd,IAAA,OAAO,gCAAgC,CAAA;AACzC,GAAA;AAEA,EAAA,IAAI0D,OAAO,EAAE;AACX,IAAA,OAAO,6BAA6B,CAAA;AACtC,GAAA;AAEA,EAAA,OAAO,8BAA8B,CAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"actionListUtils.js","sources":["../../../../../../src/components/ActionList/actionListUtils.ts"],"sourcesContent":["import React from 'react';\nimport { componentIds } from './componentIds';\nimport type { ActionListItemProps } from './ActionListItem';\nimport type { OptionsType } from '~components/Dropdown/useDropdown';\nimport { isReactNative } from '~utils';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\n/**\n * Returns if there is ActionListItem after ActionListSection\n * and an index of last ActionListSection\n *\n * It is used to decide if ActionListSection add divider at the end\n */\nconst getActionListSectionPosition = (\n children: React.ReactNode,\n): {\n isActionListItemPresentAfterSection: boolean;\n lastActionListSectionIndex: number;\n} => {\n // Creating an array of componentIds\n const childComponentIdArray = React.Children.toArray(children).map((child) =>\n getComponentId(child),\n );\n\n // Reading the last `ActionListSection` component's index\n const lastActionListSectionIndex = childComponentIdArray.lastIndexOf(\n componentIds.ActionListSection,\n );\n\n // Checking if there is any `ActionListItem` present after `ActionListSection`\n const isActionListItemPresentAfterSection = childComponentIdArray\n .slice(lastActionListSectionIndex)\n .includes(componentIds.ActionListItem);\n\n return {\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n };\n};\n\nconst actionListAllowedChildren = [componentIds.ActionListItem, componentIds.ActionListSection];\n\nexport type SectionData = {\n title: string;\n hideDivider: boolean;\n data: ActionListItemProps[];\n}[];\n\n/**\n * Loops over action list items and returns different properties from children like option values, header and footer child, etc\n */\nconst getActionListProperties = (\n children: React.ReactNode,\n): {\n sectionData: SectionData;\n childrenWithId?: React.ReactNode[] | null;\n actionListOptions: OptionsType;\n} => {\n const sectionData: SectionData = [];\n let currentSection: string | null = null;\n const actionListOptions: OptionsType = [];\n\n const getActionListItemWithId = (\n child: React.ReactNode,\n hideDivider: boolean,\n ): React.ReactNode => {\n if (React.isValidElement(child) && !child.props.isDisabled) {\n actionListOptions.push({\n title: child.props.title,\n value: child.props.value,\n onClickTrigger: (value) => {\n const anchorLink = child.props.href;\n child.props.onClick?.({\n name: child.props.value,\n value: child.props.isSelected ?? value,\n });\n\n if (anchorLink && !isReactNative()) {\n const target = child.props.target ?? '_self';\n window.open(anchorLink, target);\n if (window.top) {\n window.top.open(anchorLink, target);\n }\n }\n },\n });\n const currentIndex = actionListOptions.length - 1;\n\n const foundSection = sectionData.find((v) => v.title === currentSection);\n // push the item in the appropriate bucket\n if (foundSection) {\n foundSection?.data.push({\n ...child.props,\n _index: currentIndex,\n });\n } else {\n // create a new bucket\n sectionData.push({\n title: currentSection!,\n hideDivider,\n data: [\n {\n ...child.props,\n _index: currentIndex,\n },\n ],\n });\n }\n\n const clonedChild = React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n _index: currentIndex,\n });\n return clonedChild;\n }\n\n return child;\n };\n\n let isActionListItemPresentAfterSection: boolean;\n // eslint-disable-next-line one-var\n let lastActionListSectionIndex: number;\n\n if (isReactNative()) {\n // We're reading this so that we can decide whether to show the divider or not.\n // If ActionListSection is final item and no ActionListItem is present after that, we hide the divider\n\n // On web, we do it using descendant styling\n ({\n isActionListItemPresentAfterSection,\n lastActionListSectionIndex,\n } = getActionListSectionPosition(children));\n }\n\n // Looping through ActionListItems to add index to them and get an options array for moving focus between items\n const childrenWithId = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (isValidAllowedChildren(child, componentIds.ActionListSection)) {\n const shouldHideDivider =\n index === lastActionListSectionIndex && !isActionListItemPresentAfterSection;\n const sectionChildValues: string[] = [];\n return React.cloneElement(child, {\n // @ts-expect-error: TS doesn't understand the child's props\n children: React.Children.map(child.props.children, (childInSection) => {\n currentSection = child.props.title;\n sectionChildValues.push(childInSection.props.value);\n if (isValidAllowedChildren(childInSection, componentIds.ActionListItem)) {\n return getActionListItemWithId(childInSection, shouldHideDivider);\n }\n\n return childInSection;\n }),\n // On web, we handle it with descendant styling in css so no need of JS there\n _hideDivider: isReactNative() ? shouldHideDivider : undefined,\n _sectionChildValues: sectionChildValues,\n });\n }\n\n if (isValidAllowedChildren(child, componentIds.ActionListItem)) {\n return getActionListItemWithId(child, true);\n }\n\n if (__DEV__) {\n throwBladeError({\n message: `Only ${actionListAllowedChildren.join(', ')} supported inside ActionList`,\n moduleName: 'ActionList',\n });\n }\n }\n return child;\n });\n\n return {\n sectionData,\n childrenWithId,\n actionListOptions,\n };\n};\n\nconst validateActionListItemProps = ({\n leading,\n trailing,\n titleSuffix,\n}: {\n leading: ActionListItemProps['leading'];\n trailing: ActionListItemProps['trailing'];\n titleSuffix: ActionListItemProps['titleSuffix'];\n}): void => {\n if (__DEV__) {\n React.Children.map(trailing, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon} and ${componentIds.ActionListItemText} are allowed in trailing prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(titleSuffix, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemBadge) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemBadgeGroup)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemBadge} and ${componentIds.ActionListItemBadgeGroup} are allowed in titleSuffix prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n\n React.Children.map(leading, (child) => {\n if (\n !isValidAllowedChildren(child, componentIds.ActionListItemIcon) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemText) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAsset) &&\n !isValidAllowedChildren(child, componentIds.ActionListItemAvatar)\n ) {\n throwBladeError({\n message: `Only ${componentIds.ActionListItemIcon}, ${componentIds.ActionListItemAvatar}, ${componentIds.ActionListItemAsset}, and ${componentIds.ActionListItemText} are allowed in leading prop`,\n moduleName: 'ActionListItem',\n });\n }\n });\n }\n};\n\nconst getNormalTextColor = (\n isDisabled: boolean | undefined,\n { isMuted }: { isMuted?: boolean } = {},\n): Extract<\n BaseTextProps['color'],\n 'interactive.text.gray.disabled' | 'interactive.text.gray.muted' | 'interactive.text.gray.normal'\n> => {\n if (isDisabled) {\n return 'interactive.text.gray.disabled';\n }\n\n if (isMuted) {\n return 'interactive.text.gray.muted';\n }\n\n return 'interactive.text.gray.normal';\n};\n\nexport { getActionListProperties, validateActionListItemProps, getNormalTextColor };\n"],"names":["getActionListSectionPosition","children","childComponentIdArray","React","Children","toArray","map","child","getComponentId","lastActionListSectionIndex","lastIndexOf","componentIds","ActionListSection","isActionListItemPresentAfterSection","slice","includes","ActionListItem","actionListAllowedChildren","getActionListProperties","sectionData","currentSection","actionListOptions","getActionListItemWithId","hideDivider","isValidElement","props","isDisabled","push","title","value","onClickTrigger","_child$props$onClick","_child$props","_child$props$isSelect","anchorLink","href","onClick","call","name","isSelected","isReactNative","_child$props$target","target","window","open","top","currentIndex","length","foundSection","find","v","data","_objectSpread","_index","clonedChild","cloneElement","_getActionListSection","childrenWithId","index","isValidAllowedChildren","shouldHideDivider","sectionChildValues","childInSection","_hideDivider","undefined","_sectionChildValues","throwBladeError","message","concat","join","moduleName","validateActionListItemProps","_ref","leading","trailing","titleSuffix","ActionListItemIcon","ActionListItemText","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemAvatar","getNormalTextColor","_ref2","arguments","isMuted"],"mappings":";;;;;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAChCC,QAAyB,EAItB;AACH;AACA,EAAA,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,GAAG,CAAC,UAACC,KAAK,EAAA;IAAA,OACvEC,cAAc,CAACD,KAAK,CAAC,CAAA;AAAA,GACvB,CAAC,CAAA;;AAED;EACA,IAAME,0BAA0B,GAAGP,qBAAqB,CAACQ,WAAW,CAClEC,YAAY,CAACC,iBACf,CAAC,CAAA;;AAED;AACA,EAAA,IAAMC,mCAAmC,GAAGX,qBAAqB,CAC9DY,KAAK,CAACL,0BAA0B,CAAC,CACjCM,QAAQ,CAACJ,YAAY,CAACK,cAAc,CAAC,CAAA;EAExC,OAAO;AACLH,IAAAA,mCAAmC,EAAnCA,mCAAmC;AACnCJ,IAAAA,0BAA0B,EAA1BA,0BAAAA;GACD,CAAA;AACH,CAAC,CAAA;AAED,IAAMQ,yBAAyB,GAAG,CAACN,YAAY,CAACK,cAAc,EAAEL,YAAY,CAACC,iBAAiB,CAAC,CAAA;AAQ/F;AACA;AACA;AACA,IAAMM,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAC3BjB,QAAyB,EAKtB;EACH,IAAMkB,WAAwB,GAAG,EAAE,CAAA;EACnC,IAAIC,cAA6B,GAAG,IAAI,CAAA;EACxC,IAAMC,iBAA8B,GAAG,EAAE,C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,IAChE,CAACrB,sBAAsB,CAACpD,KAAK,EAAEI,YAAY,CAACsE,oBAAoB,CAAC,EACjE;AACAf,QAAAA,eAAe,CAAC;UACdC,OAAO,EAAA,OAAA,CAAAC,MAAA,CAAUzD,YAAY,CAACiE,kBAAkB,EAAAR,IAAAA,CAAAA,CAAAA,MAAA,CAAKzD,YAAY,CAACsE,oBAAoB,QAAAb,MAAA,CAAKzD,YAAY,CAACqE,mBAAmB,EAAA,QAAA,CAAA,CAAAZ,MAAA,CAASzD,YAAY,CAACkE,kBAAkB,EAA8B,8BAAA,CAAA;AACjMP,UAAAA,UAAU,EAAE,gBAAA;AACd,SAAC,CAAC,CAAA;AACJ,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AACF,EAAC;AAED,IAAMY,kBAAkB,GAAG,SAArBA,kBAAkBA,CACtBxD,UAA+B,EAK5B;AAAA,EAAA,IAAAyD,KAAA,GAAAC,SAAA,CAAArC,MAAA,GAAA,CAAA,IAAAqC,SAAA,CAAA,CAAA,CAAA,KAAApB,SAAA,GAAAoB,SAAA,CAAA,CAAA,CAAA,GAJkC,EAAE;IAArCC,OAAO,GAAAF,KAAA,CAAPE,OAAO,CAAA;AAKT,EAAA,IAAI3D,UAAU,EAAE;AACd,IAAA,OAAO,gCAAgC,CAAA;AACzC,GAAA;AAEA,EAAA,IAAI2D,OAAO,EAAE;AACX,IAAA,OAAO,6BAA6B,CAAA;AACtC,GAAA;AAEA,EAAA,OAAO,8BAA8B,CAAA;AACvC;;;;"}
|
|
@@ -5,6 +5,7 @@ var componentIds = {
|
|
|
5
5
|
ActionListItemBadgeGroup: 'ActionListItemBadgeGroup',
|
|
6
6
|
ActionListItemAsset: 'ActionListItemAsset',
|
|
7
7
|
ActionListItemIcon: 'ActionListItemIcon',
|
|
8
|
+
ActionListItemAvatar: 'ActionListItemAvatar',
|
|
8
9
|
ActionListItemText: 'ActionListItemText',
|
|
9
10
|
ActionListSection: 'ActionListSection'
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentIds.js","sources":["../../../../../../src/components/ActionList/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ActionList: 'ActionList',\n ActionListItem: 'ActionListItem',\n ActionListItemBadge: 'ActionListItemBadge',\n ActionListItemBadgeGroup: 'ActionListItemBadgeGroup',\n ActionListItemAsset: 'ActionListItemAsset',\n ActionListItemIcon: 'ActionListItemIcon',\n ActionListItemText: 'ActionListItemText',\n ActionListSection: 'ActionListSection',\n};\n"],"names":["componentIds","ActionList","ActionListItem","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemIcon","ActionListItemText","ActionListSection"],"mappings":"AAAO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,wBAAwB,EAAE,0BAA0B;AACpDC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAA;AACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"componentIds.js","sources":["../../../../../../src/components/ActionList/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ActionList: 'ActionList',\n ActionListItem: 'ActionListItem',\n ActionListItemBadge: 'ActionListItemBadge',\n ActionListItemBadgeGroup: 'ActionListItemBadgeGroup',\n ActionListItemAsset: 'ActionListItemAsset',\n ActionListItemIcon: 'ActionListItemIcon',\n ActionListItemAvatar: 'ActionListItemAvatar',\n ActionListItemText: 'ActionListItemText',\n ActionListSection: 'ActionListSection',\n};\n"],"names":["componentIds","ActionList","ActionListItem","ActionListItemBadge","ActionListItemBadgeGroup","ActionListItemAsset","ActionListItemIcon","ActionListItemAvatar","ActionListItemText","ActionListSection"],"mappings":"AAAO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,wBAAwB,EAAE,0BAA0B;AACpDC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,oBAAoB,EAAE,sBAAsB;AAC5CC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAA;AACrB;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ActionList } from './ActionList.js';
|
|
2
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionListItem.js';
|
|
2
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionListItem.js';
|
|
3
3
|
export { ActionListItemAsset } from './ActionListItemAsset.web.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,9 +5,11 @@ import '../Typography/Text/index.js';
|
|
|
5
5
|
import '../Box/BaseBox/index.js';
|
|
6
6
|
import '../Icons/index.js';
|
|
7
7
|
import '../../utils/getPlatformType/index.js';
|
|
8
|
+
import '../Box/index.js';
|
|
8
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
10
|
import { getPlatformType } from '../../utils/getPlatformType/getPlatformType.js';
|
|
10
11
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
12
|
+
import { Box } from '../Box/Box.js';
|
|
11
13
|
import { Text } from '../Typography/Text/Text.js';
|
|
12
14
|
import InfoIcon from '../Icons/InfoIcon/InfoIcon.js';
|
|
13
15
|
import CheckIcon from '../Icons/CheckIcon/CheckIcon.js';
|
|
@@ -25,11 +27,19 @@ var HintText = function HintText(_ref) {
|
|
|
25
27
|
marginTop: hintMarginTop[size],
|
|
26
28
|
id: id,
|
|
27
29
|
children: /*#__PURE__*/jsxs(FormHintWrapper, {
|
|
28
|
-
children: [Icon ?
|
|
30
|
+
children: [Icon ?
|
|
31
|
+
/*#__PURE__*/
|
|
32
|
+
// offset block element 2px down to align with text
|
|
33
|
+
jsx(Box, {
|
|
34
|
+
flexShrink: 0,
|
|
35
|
+
marginTop: "spacing.1",
|
|
36
|
+
children: /*#__PURE__*/jsx(Icon, {})
|
|
37
|
+
}) : null, /*#__PURE__*/jsx(Text, {
|
|
29
38
|
as: isReactNative ? undefined : 'span',
|
|
30
39
|
color: color,
|
|
31
40
|
size: hintTextSize[size],
|
|
32
41
|
variant: "caption",
|
|
42
|
+
wordBreak: "break-word",
|
|
33
43
|
children: children
|
|
34
44
|
})]
|
|
35
45
|
})
|
|
@@ -38,24 +48,18 @@ var HintText = function HintText(_ref) {
|
|
|
38
48
|
var Icons = {
|
|
39
49
|
error: function error(_ref2) {
|
|
40
50
|
var size = _ref2.size;
|
|
41
|
-
return /*#__PURE__*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}), /*#__PURE__*/jsx(BaseBox, {
|
|
46
|
-
marginRight: "spacing.2"
|
|
47
|
-
})]
|
|
51
|
+
return /*#__PURE__*/jsx(InfoIcon, {
|
|
52
|
+
display: 'block',
|
|
53
|
+
color: "feedback.icon.negative.intense",
|
|
54
|
+
size: hintIconSize[size]
|
|
48
55
|
});
|
|
49
56
|
},
|
|
50
57
|
success: function success(_ref3) {
|
|
51
58
|
var size = _ref3.size;
|
|
52
|
-
return /*#__PURE__*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}), /*#__PURE__*/jsx(BaseBox, {
|
|
57
|
-
marginRight: "spacing.2"
|
|
58
|
-
})]
|
|
59
|
+
return /*#__PURE__*/jsx(CheckIcon, {
|
|
60
|
+
display: 'block',
|
|
61
|
+
color: "feedback.icon.positive.intense",
|
|
62
|
+
size: hintIconSize[size]
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHint.js","sources":["../../../../../../src/components/Form/FormHint.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { FormHintWrapper } from './FormHintWrapper';\nimport { hintIconSize, hintMarginTop, hintTextSize } from './formTokens';\nimport type { TextProps } from '~components/Typography/Text';\nimport { Text } from '~components/Typography/Text';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CheckIcon, InfoIcon } from '~components/Icons';\nimport { getPlatformType } from '~utils/getPlatformType';\n\ntype HintTextProps = {\n icon?:
|
|
1
|
+
{"version":3,"file":"FormHint.js","sources":["../../../../../../src/components/Form/FormHint.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport { FormHintWrapper } from './FormHintWrapper';\nimport { hintIconSize, hintMarginTop, hintTextSize } from './formTokens';\nimport type { TextProps } from '~components/Typography/Text';\nimport { Text } from '~components/Typography/Text';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { CheckIcon, InfoIcon } from '~components/Icons';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { Box } from '~components/Box';\n\ntype HintTextProps = {\n icon?: IconComponent;\n children: string;\n id?: string;\n color: TextProps<{ variant: 'caption' }>['color'];\n size: 'small' | 'medium' | 'large';\n};\n\nconst HintText = ({ icon: Icon, children, id, color, size }: HintTextProps): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox marginTop={hintMarginTop[size]} id={id}>\n <FormHintWrapper>\n {Icon ? (\n // offset block element 2px down to align with text\n <Box flexShrink={0} marginTop=\"spacing.1\">\n <Icon />\n </Box>\n ) : null}\n <Text\n as={isReactNative ? undefined : 'span'}\n color={color}\n size={hintTextSize[size]}\n variant=\"caption\"\n wordBreak=\"break-word\"\n >\n {children}\n </Text>\n </FormHintWrapper>\n </BaseBox>\n );\n};\n\nexport type FormHintProps = {\n type: 'help' | 'error' | 'success';\n /**\n * Help text for the group\n */\n helpText?: string;\n /**\n * Error text for the group\n *\n * Renders when `state` is set to 'error'\n */\n errorText?: string;\n /**\n * Success text for the group\n *\n * Renders when `state` is set to 'success'\n */\n successText?: string;\n /**\n * Sets the id on errorText.\n * Needed for accessibility reasons.\n */\n errorTextId?: string;\n /**\n * Sets the id on helpText.\n * Needed for accessibility reasons.\n */\n helpTextId?: string;\n /**\n * Sets the id on successText.\n * Needed for accessibility reasons.\n */\n successTextId?: string;\n /**\n * Sets the size of the hint\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n};\n\nconst Icons = {\n error: ({ size }: { size: 'small' | 'medium' | 'large' }): ReactElement => (\n <InfoIcon\n display={'block' as never}\n color=\"feedback.icon.negative.intense\"\n size={hintIconSize[size]}\n />\n ),\n success: ({ size }: { size: 'small' | 'medium' | 'large' }): ReactElement => (\n <CheckIcon\n display={'block' as never}\n color=\"feedback.icon.positive.intense\"\n size={hintIconSize[size]}\n />\n ),\n};\n\nconst FormHint = ({\n type,\n helpText,\n errorText,\n successText,\n helpTextId,\n errorTextId,\n successTextId,\n size = 'medium',\n}: FormHintProps): React.ReactElement => {\n const colors: Record<string, TextProps<{ variant: 'caption' }>['color']> = {\n help: 'surface.text.gray.muted',\n error: 'feedback.text.negative.intense',\n success: 'feedback.text.positive.intense',\n };\n\n const showError = type === 'error' && errorText;\n const showSuccess = type === 'success' && successText;\n const showHelp = !showError && !showSuccess && helpText;\n\n return (\n <>\n {showHelp && (\n <HintText size={size} id={helpTextId} color={colors.help}>\n {helpText}\n </HintText>\n )}\n\n {showError && (\n <HintText\n size={size}\n id={errorTextId}\n icon={() => Icons.error({ size })}\n color={colors.error}\n >\n {errorText}\n </HintText>\n )}\n\n {showSuccess && (\n <HintText\n size={size}\n id={successTextId}\n icon={() => Icons.success({ size })}\n color={colors.success}\n >\n {successText}\n </HintText>\n )}\n </>\n );\n};\n\nexport { FormHint };\n"],"names":["HintText","_ref","Icon","icon","children","id","color","size","isReactNative","getPlatformType","_jsx","BaseBox","marginTop","hintMarginTop","_jsxs","FormHintWrapper","Box","flexShrink","Text","as","undefined","hintTextSize","variant","wordBreak","Icons","error","_ref2","InfoIcon","display","hintIconSize","success","_ref3","CheckIcon","FormHint","_ref4","type","helpText","errorText","successText","helpTextId","errorTextId","successTextId","_ref4$size","colors","help","showError","showSuccess","showHelp","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AAAA;;AAqBA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAA+E;AAAA,EAAA,IAAnEC,IAAI,GAAAD,IAAA,CAAVE,IAAI;IAAQC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAEC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IAAEC,KAAK,GAAAL,IAAA,CAALK,KAAK;IAAEC,IAAI,GAAAN,IAAA,CAAJM,IAAI,CAAA;AACvD,EAAA,IAAMC,aAAa,GAAGC,eAAe,EAAE,KAAK,cAAc,CAAA;EAE1D,oBACEC,GAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,SAAS,EAAEC,aAAa,CAACN,IAAI,CAAE;AAACF,IAAAA,EAAE,EAAEA,EAAG;IAAAD,QAAA,eAC9CU,IAAA,CAACC,eAAe,EAAA;AAAAX,MAAAA,QAAA,GACbF,IAAI;AAAA;AACH;AACAQ,MAAAA,GAAA,CAACM,GAAG,EAAA;AAACC,QAAAA,UAAU,EAAE,CAAE;AAACL,QAAAA,SAAS,EAAC,WAAW;AAAAR,QAAAA,QAAA,eACvCM,GAAA,CAACR,IAAI,EAAE,EAAA,CAAA;AAAC,OACL,CAAC,GACJ,IAAI,eACRQ,GAAA,CAACQ,IAAI,EAAA;AACHC,QAAAA,EAAE,EAAEX,aAAa,GAAGY,SAAS,GAAG,MAAO;AACvCd,QAAAA,KAAK,EAAEA,KAAM;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BtC,IAAI,EAAE,SAAAA,IAAA,GAAA;QAAA,OAAMqB,KAAK,CAACM,OAAO,CAAC;AAAEvB,UAAAA,IAAI,EAAJA,IAAAA;AAAK,SAAC,CAAC,CAAA;OAAC;MACpCD,KAAK,EAAEqC,MAAM,CAACb,OAAQ;AAAA1B,MAAAA,QAAA,EAErBkC,WAAAA;AAAW,KACJ,CACX,CAAA;AAAA,GACD,CAAC,CAAA;AAEP;;;;"}
|
|
@@ -9,10 +9,8 @@ var FormHintWrapper = function FormHintWrapper(_ref) {
|
|
|
9
9
|
as: "span",
|
|
10
10
|
display: "flex",
|
|
11
11
|
flexDirection: "row",
|
|
12
|
-
alignItems: "
|
|
13
|
-
|
|
14
|
-
wordBreak: 'break-all'
|
|
15
|
-
},
|
|
12
|
+
alignItems: "flex-start",
|
|
13
|
+
gap: "spacing.2",
|
|
16
14
|
children: children
|
|
17
15
|
});
|
|
18
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHintWrapper.web.js","sources":["../../../../../../src/components/Form/FormHintWrapper.web.tsx"],"sourcesContent":["import React from 'react';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst FormHintWrapper = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox
|
|
1
|
+
{"version":3,"file":"FormHintWrapper.web.js","sources":["../../../../../../src/components/Form/FormHintWrapper.web.tsx"],"sourcesContent":["import React from 'react';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst FormHintWrapper = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox as=\"span\" display=\"flex\" flexDirection=\"row\" alignItems=\"flex-start\" gap=\"spacing.2\">\n {children}\n </BaseBox>\n );\n};\n\nexport { FormHintWrapper };\n"],"names":["FormHintWrapper","_ref","children","_jsx","BaseBox","as","display","flexDirection","alignItems","gap"],"mappings":";;;;;AAGA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAwE;AAAA,EAAA,IAAlEC,QAAQ,GAAAD,IAAA,CAARC,QAAQ,CAAA;EACjC,oBACEC,GAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,EAAE,EAAC,MAAM;AAACC,IAAAA,OAAO,EAAC,MAAM;AAACC,IAAAA,aAAa,EAAC,KAAK;AAACC,IAAAA,UAAU,EAAC,YAAY;AAACC,IAAAA,GAAG,EAAC,WAAW;AAAAP,IAAAA,QAAA,EAC1FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -45,12 +45,15 @@ var InteractiveItemHeaderBox = /*#__PURE__*/styled.button.withConfig({
|
|
|
45
45
|
borderRadius: props.theme.border.radius.medium,
|
|
46
46
|
width: '100%',
|
|
47
47
|
transition: "background-color ".concat(props.theme.motion.duration.xquick, " ").concat(props.theme.motion.easing.standard.effective),
|
|
48
|
-
':hover': {
|
|
48
|
+
':not([disabled]):hover': {
|
|
49
49
|
backgroundColor: props.isSelected ? props.theme.colors.interactive.background.primary.fadedHighlighted : props.theme.colors.interactive.background.gray.fadedHighlighted
|
|
50
50
|
},
|
|
51
|
-
':focus-visible': _objectSpread({}, getFocusRingStyles({
|
|
51
|
+
':not([disabled]):focus-visible': _objectSpread({}, getFocusRingStyles({
|
|
52
52
|
theme: props.theme
|
|
53
|
-
}))
|
|
53
|
+
})),
|
|
54
|
+
'&[disabled]': {
|
|
55
|
+
cursor: 'not-allowed'
|
|
56
|
+
}
|
|
54
57
|
};
|
|
55
58
|
});
|
|
56
59
|
var getStepTypeFromIndex = function getStepTypeFromIndex(_ref) {
|
|
@@ -80,6 +83,7 @@ var _StepItem = function _StepItem(_ref2) {
|
|
|
80
83
|
marker = _ref2.marker,
|
|
81
84
|
trailing = _ref2.trailing,
|
|
82
85
|
isSelected = _ref2.isSelected,
|
|
86
|
+
isDisabled = _ref2.isDisabled,
|
|
83
87
|
href = _ref2.href,
|
|
84
88
|
target = _ref2.target,
|
|
85
89
|
onClick = _ref2.onClick,
|
|
@@ -129,18 +133,18 @@ var _StepItem = function _StepItem(_ref2) {
|
|
|
129
133
|
children: [/*#__PURE__*/jsxs(Box, {
|
|
130
134
|
children: [/*#__PURE__*/jsx(Text, {
|
|
131
135
|
size: stepItemHeaderTokens[size$1].title,
|
|
132
|
-
color:
|
|
136
|
+
color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle',
|
|
133
137
|
weight: "semibold",
|
|
134
138
|
children: title
|
|
135
139
|
}), /*#__PURE__*/jsx(Text, {
|
|
136
140
|
size: stepItemHeaderTokens[size$1].timestamp,
|
|
137
141
|
marginY: "spacing.2",
|
|
138
|
-
color:
|
|
142
|
+
color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted',
|
|
139
143
|
variant: "caption",
|
|
140
144
|
children: timestamp
|
|
141
145
|
}), /*#__PURE__*/jsx(Text, {
|
|
142
146
|
size: stepItemHeaderTokens[size$1].description,
|
|
143
|
-
color:
|
|
147
|
+
color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted',
|
|
144
148
|
children: description
|
|
145
149
|
})]
|
|
146
150
|
}), /*#__PURE__*/jsx(Box, {
|
|
@@ -181,6 +185,7 @@ var _StepItem = function _StepItem(_ref2) {
|
|
|
181
185
|
target: target,
|
|
182
186
|
isSelected: isSelected,
|
|
183
187
|
onClick: onClick,
|
|
188
|
+
disabled: isDisabled,
|
|
184
189
|
children: stepItemHeaderJSX
|
|
185
190
|
})) : /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, stepItemHeaderPaddings), {}, {
|
|
186
191
|
children: stepItemHeaderJSX
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepItem.web.js","sources":["../../../../../../src/components/StepGroup/StepItem.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { StepLine } from './StepLine';\nimport type { StepLineProps } from './StepLine';\nimport { useStepGroup } from './StepGroupContext';\nimport type {\n InteractiveItemHeaderProps,\n StepGroupContextType,\n StepGroupProps,\n StepItemProps,\n} from './types';\nimport { componentIds } from './componentIds';\nimport { itemLineGap, stepItemHeaderTokens } from './tokens';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeSize, makeSpace } from '~utils';\nimport { size as sizeTokens } from '~tokens/global';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport getIn from '~utils/lodashButBetter/get';\nimport { throwBladeError } from '~utils/logger';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\ntype GetStepTypeFromIndexProps = {\n _index: StepItemProps['_index'];\n _nestingLevel: StepGroupProps['_nestingLevel'];\n itemsCount: StepGroupContextType['itemsInGroupCount'];\n};\n\nconst InteractiveItemHeaderBox = styled.button<InteractiveItemHeaderProps>((props) => {\n return {\n padding: `${makeSpace(getIn(props.theme, props.paddingY))} ${makeSpace(\n getIn(props.theme, props.paddingX),\n )}`,\n cursor: 'pointer',\n display: 'inline-block',\n textDecoration: 'none',\n border: 'none',\n textAlign: 'inherit',\n backgroundColor: props.isSelected\n ? props.theme.colors.interactive.background.primary.faded\n : props.theme.colors.transparent,\n borderRadius: props.theme.border.radius.medium,\n width: '100%',\n transition: `background-color ${props.theme.motion.duration.xquick} ${props.theme.motion.easing.standard.effective}`,\n ':hover': {\n backgroundColor: props.isSelected\n ? props.theme.colors.interactive.background.primary.fadedHighlighted\n : props.theme.colors.interactive.background.gray.fadedHighlighted,\n },\n ':focus-visible': {\n ...getFocusRingStyles({ theme: props.theme }),\n },\n };\n});\n\nconst getStepTypeFromIndex = ({\n _index,\n _nestingLevel,\n itemsCount,\n}: GetStepTypeFromIndexProps): StepLineProps['stepType'] => {\n if (_nestingLevel === 0) {\n return 'default';\n }\n\n if (itemsCount === 1) {\n return 'single-item';\n }\n\n if (_index === 0) {\n return 'start';\n }\n\n if (_index === itemsCount - 1) {\n return 'end';\n }\n\n return 'middle';\n};\n\nconst _StepItem = ({\n title,\n timestamp,\n description,\n stepProgress = 'none',\n marker,\n trailing,\n isSelected,\n href,\n target,\n onClick,\n children,\n _index = 0,\n _totalIndex = 0,\n _nestingLevel = 0,\n}: StepItemProps): React.ReactElement => {\n const {\n itemsInGroupCount: itemsCount,\n totalItemsInParentGroupCount,\n orientation,\n size,\n } = useStepGroup();\n const stepType = React.useMemo(\n () => getStepTypeFromIndex({ _index, _nestingLevel, itemsCount }),\n [_index, _nestingLevel, itemsCount],\n );\n\n const itemRef = React.useRef<HTMLDivElement>(null);\n\n const isFirstItem = _totalIndex === 0;\n const isLastItem = _totalIndex === totalItemsInParentGroupCount - 1;\n const isInteractive = Boolean(href) || Boolean(onClick);\n const isVertical = orientation === 'vertical';\n\n if (__DEV__) {\n if (trailing && orientation === 'horizontal') {\n throwBladeError({\n message: 'trailing is not allowed in horizontal StepGroup',\n moduleName: 'StepItem',\n });\n }\n\n if (_nestingLevel >= 1 && orientation === 'horizontal') {\n throwBladeError({\n message: 'Nested StepGroup components are not allowed in horizontal orientation',\n moduleName: 'StepItem',\n });\n }\n }\n\n const stepItemHeaderJSX = (\n <Box display=\"flex\" flexDirection=\"row\" justifyContent=\"space-between\" gap=\"spacing.4\">\n <Box>\n <Text\n size={stepItemHeaderTokens[size].title}\n color=\"surface.text.gray.subtle\"\n weight=\"semibold\"\n >\n {title}\n </Text>\n <Text\n size={stepItemHeaderTokens[size].timestamp}\n marginY=\"spacing.2\"\n color=\"surface.text.gray.muted\"\n variant=\"caption\"\n >\n {timestamp}\n </Text>\n <Text size={stepItemHeaderTokens[size].description} color=\"surface.text.gray.muted\">\n {description}\n </Text>\n </Box>\n <Box>{trailing}</Box>\n </Box>\n );\n\n const stepItemHeaderPaddings: Omit<InteractiveItemHeaderProps, 'isSelected'> = {\n paddingY: 'spacing.3',\n paddingX: 'spacing.4',\n } as const;\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection={isVertical ? 'row' : 'column'}\n gap={itemLineGap[size]}\n className={`step-item step-index-${_index} step-nesting-level-${_nestingLevel}`}\n textAlign={isVertical ? 'left' : 'center'}\n alignItems={isVertical ? undefined : 'center'}\n minWidth={isVertical ? undefined : `min(${makeSize(sizeTokens['120'])}, 100%)`}\n width={isVertical ? '100%' : undefined}\n flex={isVertical ? undefined : '1'}\n {...metaAttribute({ name: MetaConstants.StepItem })}\n ref={itemRef}\n >\n <StepLine\n shouldShowStartBranch={!isFirstItem}\n shouldShowEndBranch={!isLastItem}\n stepType={stepType}\n marker={marker}\n stepProgress={stepProgress}\n />\n <Box marginTop=\"spacing.3\" flex=\"1\" marginRight={isVertical ? undefined : undefined}>\n {isInteractive ? (\n <InteractiveItemHeaderBox\n {...stepItemHeaderPaddings}\n as={href ? 'a' : 'button'}\n href={href}\n target={target}\n isSelected={isSelected}\n onClick={onClick}\n >\n {stepItemHeaderJSX}\n </InteractiveItemHeaderBox>\n ) : (\n <Box {...stepItemHeaderPaddings}>{stepItemHeaderJSX}</Box>\n )}\n {children ? (\n <Box paddingX=\"spacing.4\" paddingY=\"spacing.3\">\n {children}\n </Box>\n ) : null}\n </Box>\n </BaseBox>\n );\n};\n\n/**\n * ## StepItem\n *\n * Component meant to be used inside the StepGroup parent component\n *\n * ### Usage\n *\n * ```jsx\n * <StepGroup orientation=\"vertical\" size=\"medium\">\n * <StepItem\n * title=\"Personal Details\"\n * timestamp=\"Thu 15th Oct'23 | 12:00pm\"\n * description=\"Fill your personal details here\"\n * marker={<StepItemIndicator color=\"negative\" />}\n * />\n * </StepGroup>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-stepgroup--docs StepGroup Documentation}\n */\nconst StepItem = assignWithoutSideEffects(_StepItem, {\n componentId: componentIds.StepItem,\n displayName: componentIds.StepItem,\n});\n\nexport { StepLine, StepItem };\n"],"names":["InteractiveItemHeaderBox","styled","button","withConfig","displayName","componentId","props","padding","concat","makeSpace","getIn","theme","paddingY","paddingX","cursor","display","textDecoration","border","textAlign","backgroundColor","isSelected","colors","interactive","background","primary","faded","transparent","borderRadius","radius","medium","width","transition","motion","duration","xquick","easing","standard","effective","fadedHighlighted","gray","_objectSpread","getFocusRingStyles","getStepTypeFromIndex","_ref","_index","_nestingLevel","itemsCount","_StepItem","_ref2","title","timestamp","description","_ref2$stepProgress","stepProgress","marker","trailing","href","target","onClick","children","_ref2$_index","_ref2$_totalIndex","_totalIndex","_ref2$_nestingLevel","_useStepGroup","useStepGroup","itemsInGroupCount","totalItemsInParentGroupCount","orientation","size","stepType","React","useMemo","itemRef","useRef","isFirstItem","isLastItem","isInteractive","Boolean","isVertical","throwBladeError","message","moduleName","stepItemHeaderJSX","_jsxs","Box","flexDirection","justifyContent","gap","_jsx","Text","stepItemHeaderTokens","color","weight","marginY","variant","stepItemHeaderPaddings","BaseBox","itemLineGap","className","alignItems","undefined","minWidth","makeSize","sizeTokens","flex","metaAttribute","name","MetaConstants","StepItem","ref","StepLine","shouldShowStartBranch","shouldShowEndBranch","marginTop","marginRight","as","assignWithoutSideEffects","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,wBAAwB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,uCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;EACpF,OAAO;AACLC,IAAAA,OAAO,EAAAC,EAAAA,CAAAA,MAAA,CAAKC,SAAS,CAACC,KAAK,CAACJ,KAAK,CAACK,KAAK,EAAEL,KAAK,CAACM,QAAQ,CAAC,CAAC,EAAAJ,GAAAA,CAAAA,CAAAA,MAAA,CAAIC,SAAS,CACpEC,KAAK,CAACJ,KAAK,CAACK,KAAK,EAAEL,KAAK,CAACO,QAAQ,CACnC,CAAC,CAAE;AACHC,IAAAA,MAAM,EAAE,SAAS;AACjBC,IAAAA,OAAO,EAAE,cAAc;AACvBC,IAAAA,cAAc,EAAE,MAAM;AACtB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["../../../../../../src/components/StepGroup/StepItem.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { StepLine } from './StepLine';\nimport type { StepLineProps } from './StepLine';\nimport { useStepGroup } from './StepGroupContext';\nimport type {\n InteractiveItemHeaderProps,\n StepGroupContextType,\n StepGroupProps,\n StepItemProps,\n} from './types';\nimport { componentIds } from './componentIds';\nimport { itemLineGap, stepItemHeaderTokens } from './tokens';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeSize, makeSpace } from '~utils';\nimport { size as sizeTokens } from '~tokens/global';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport getIn from '~utils/lodashButBetter/get';\nimport { throwBladeError } from '~utils/logger';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\ntype GetStepTypeFromIndexProps = {\n _index: StepItemProps['_index'];\n _nestingLevel: StepGroupProps['_nestingLevel'];\n itemsCount: StepGroupContextType['itemsInGroupCount'];\n};\n\nconst InteractiveItemHeaderBox = styled.button<InteractiveItemHeaderProps>((props) => {\n return {\n padding: `${makeSpace(getIn(props.theme, props.paddingY))} ${makeSpace(\n getIn(props.theme, props.paddingX),\n )}`,\n cursor: 'pointer',\n display: 'inline-block',\n textDecoration: 'none',\n border: 'none',\n textAlign: 'inherit',\n backgroundColor: props.isSelected\n ? props.theme.colors.interactive.background.primary.faded\n : props.theme.colors.transparent,\n borderRadius: props.theme.border.radius.medium,\n width: '100%',\n transition: `background-color ${props.theme.motion.duration.xquick} ${props.theme.motion.easing.standard.effective}`,\n ':not([disabled]):hover': {\n backgroundColor: props.isSelected\n ? props.theme.colors.interactive.background.primary.fadedHighlighted\n : props.theme.colors.interactive.background.gray.fadedHighlighted,\n },\n ':not([disabled]):focus-visible': {\n ...getFocusRingStyles({ theme: props.theme }),\n },\n '&[disabled]': {\n cursor: 'not-allowed',\n },\n };\n});\n\nconst getStepTypeFromIndex = ({\n _index,\n _nestingLevel,\n itemsCount,\n}: GetStepTypeFromIndexProps): StepLineProps['stepType'] => {\n if (_nestingLevel === 0) {\n return 'default';\n }\n\n if (itemsCount === 1) {\n return 'single-item';\n }\n\n if (_index === 0) {\n return 'start';\n }\n\n if (_index === itemsCount - 1) {\n return 'end';\n }\n\n return 'middle';\n};\n\nconst _StepItem = ({\n title,\n timestamp,\n description,\n stepProgress = 'none',\n marker,\n trailing,\n isSelected,\n isDisabled,\n href,\n target,\n onClick,\n children,\n _index = 0,\n _totalIndex = 0,\n _nestingLevel = 0,\n}: StepItemProps): React.ReactElement => {\n const {\n itemsInGroupCount: itemsCount,\n totalItemsInParentGroupCount,\n orientation,\n size,\n } = useStepGroup();\n const stepType = React.useMemo(\n () => getStepTypeFromIndex({ _index, _nestingLevel, itemsCount }),\n [_index, _nestingLevel, itemsCount],\n );\n\n const itemRef = React.useRef<HTMLDivElement>(null);\n\n const isFirstItem = _totalIndex === 0;\n const isLastItem = _totalIndex === totalItemsInParentGroupCount - 1;\n const isInteractive = Boolean(href) || Boolean(onClick);\n const isVertical = orientation === 'vertical';\n\n if (__DEV__) {\n if (trailing && orientation === 'horizontal') {\n throwBladeError({\n message: 'trailing is not allowed in horizontal StepGroup',\n moduleName: 'StepItem',\n });\n }\n\n if (_nestingLevel >= 1 && orientation === 'horizontal') {\n throwBladeError({\n message: 'Nested StepGroup components are not allowed in horizontal orientation',\n moduleName: 'StepItem',\n });\n }\n }\n\n const stepItemHeaderJSX = (\n <Box display=\"flex\" flexDirection=\"row\" justifyContent=\"space-between\" gap=\"spacing.4\">\n <Box>\n <Text\n size={stepItemHeaderTokens[size].title}\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n weight=\"semibold\"\n >\n {title}\n </Text>\n <Text\n size={stepItemHeaderTokens[size].timestamp}\n marginY=\"spacing.2\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n variant=\"caption\"\n >\n {timestamp}\n </Text>\n <Text\n size={stepItemHeaderTokens[size].description}\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {description}\n </Text>\n </Box>\n <Box>{trailing}</Box>\n </Box>\n );\n\n const stepItemHeaderPaddings: Omit<InteractiveItemHeaderProps, 'isSelected'> = {\n paddingY: 'spacing.3',\n paddingX: 'spacing.4',\n } as const;\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection={isVertical ? 'row' : 'column'}\n gap={itemLineGap[size]}\n className={`step-item step-index-${_index} step-nesting-level-${_nestingLevel}`}\n textAlign={isVertical ? 'left' : 'center'}\n alignItems={isVertical ? undefined : 'center'}\n minWidth={isVertical ? undefined : `min(${makeSize(sizeTokens['120'])}, 100%)`}\n width={isVertical ? '100%' : undefined}\n flex={isVertical ? undefined : '1'}\n {...metaAttribute({ name: MetaConstants.StepItem })}\n ref={itemRef}\n >\n <StepLine\n shouldShowStartBranch={!isFirstItem}\n shouldShowEndBranch={!isLastItem}\n stepType={stepType}\n marker={marker}\n stepProgress={stepProgress}\n />\n <Box marginTop=\"spacing.3\" flex=\"1\" marginRight={isVertical ? undefined : undefined}>\n {isInteractive ? (\n <InteractiveItemHeaderBox\n {...stepItemHeaderPaddings}\n as={href ? 'a' : 'button'}\n href={href}\n target={target}\n isSelected={isSelected}\n onClick={onClick}\n disabled={isDisabled}\n >\n {stepItemHeaderJSX}\n </InteractiveItemHeaderBox>\n ) : (\n <Box {...stepItemHeaderPaddings}>{stepItemHeaderJSX}</Box>\n )}\n {children ? (\n <Box paddingX=\"spacing.4\" paddingY=\"spacing.3\">\n {children}\n </Box>\n ) : null}\n </Box>\n </BaseBox>\n );\n};\n\n/**\n * ## StepItem\n *\n * Component meant to be used inside the StepGroup parent component\n *\n * ### Usage\n *\n * ```jsx\n * <StepGroup orientation=\"vertical\" size=\"medium\">\n * <StepItem\n * title=\"Personal Details\"\n * timestamp=\"Thu 15th Oct'23 | 12:00pm\"\n * description=\"Fill your personal details here\"\n * marker={<StepItemIndicator color=\"negative\" />}\n * />\n * </StepGroup>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-stepgroup--docs StepGroup Documentation}\n */\nconst StepItem = assignWithoutSideEffects(_StepItem, {\n componentId: componentIds.StepItem,\n displayName: componentIds.StepItem,\n});\n\nexport { StepLine, StepItem };\n"],"names":["InteractiveItemHeaderBox","styled","button","withConfig","displayName","componentId","props","padding","concat","makeSpace","getIn","theme","paddingY","paddingX","cursor","display","textDecoration","border","textAlign","backgroundColor","isSelected","colors","interactive","background","primary","faded","transparent","borderRadius","radius","medium","width","transition","motion","duration","xquick","easing","standard","effective","fadedHighlighted","gray","_objectSpread","getFocusRingStyles","getStepTypeFromIndex","_ref","_index","_nestingLevel","itemsCount","_StepItem","_ref2","title","timestamp","description","_ref2$stepProgress","stepProgress","marker","trailing","isDisabled","href","target","onClick","children","_ref2$_index","_ref2$_totalIndex","_totalIndex","_ref2$_nestingLevel","_useStepGroup","useStepGroup","itemsInGroupCount","totalItemsInParentGroupCount","orientation","size","stepType","React","useMemo","itemRef","useRef","isFirstItem","isLastItem","isInteractive","Boolean","isVertical","throwBladeError","message","moduleName","stepItemHeaderJSX","_jsxs","Box","flexDirection","justifyContent","gap","_jsx","Text","stepItemHeaderTokens","color","weight","marginY","variant","stepItemHeaderPaddings","BaseBox","itemLineGap","className","alignItems","undefined","minWidth","makeSize","sizeTokens","flex","metaAttribute","name","MetaConstants","StepItem","ref","StepLine","shouldShowStartBranch","shouldShowEndBranch","marginTop","marginRight","as","disabled","assignWithoutSideEffects","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,wBAAwB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,uCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;EACpF,OAAO;A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AAGwB,iBAAAA;AAAiB,OAAA,CAAM,CAC1D,EACAxB,QAAQ,gBACP8B,GAAA,CAACJ,GAAG,EAAA;AAACzE,QAAAA,QAAQ,EAAC,WAAW;AAACD,QAAAA,QAAQ,EAAC,WAAW;AAAAgD,QAAAA,QAAA,EAC3CA,QAAAA;OACE,CAAC,GACJ,IAAI,CAAA;AAAA,KACL,CAAC,CAAA;AAAA,GAAA,CACC,CAAC,CAAA;AAEd,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMkD,QAAQ,gBAAGS,wBAAwB,CAACxE,SAAS,EAAE;EACnD1C,WAAW,EAAEmH,YAAY,CAACV,QAAQ;EAClC1G,WAAW,EAAEoH,YAAY,CAACV,QAAAA;AAC5B,CAAC;;;;"}
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { useTooltipContext } from './TooltipContext.js';
|
|
4
4
|
import '../Box/BaseBox/index.js';
|
|
5
5
|
import '../../utils/metaAttribute/index.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
7
8
|
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
8
9
|
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
9
10
|
|
|
10
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
var TooltipInteractiveWrapper = /*#__PURE__*/
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var TooltipInteractiveWrapper = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
14
|
+
useTooltipContext();
|
|
15
|
+
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
16
|
+
ref: ref,
|
|
17
|
+
tabIndex: -1,
|
|
18
|
+
display: "inline-block"
|
|
15
19
|
}, metaAttribute({
|
|
16
20
|
testID: 'tooltip-interactive-wrapper',
|
|
17
21
|
name: MetaConstants.TooltipInteractiveWrapper
|
|
18
|
-
}));
|
|
19
|
-
}).withConfig({
|
|
20
|
-
displayName: "TooltipInteractiveWrapperweb__TooltipInteractiveWrapper",
|
|
21
|
-
componentId: "y7list-0"
|
|
22
|
-
})(function () {
|
|
23
|
-
useTooltipContext();
|
|
24
|
-
return {
|
|
25
|
-
display: 'inline-block'
|
|
26
|
-
};
|
|
22
|
+
})), props));
|
|
27
23
|
});
|
|
28
24
|
|
|
29
25
|
export { TooltipInteractiveWrapper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipInteractiveWrapper.web.js","sources":["../../../../../../src/components/Tooltip/TooltipInteractiveWrapper.web.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"TooltipInteractiveWrapper.web.js","sources":["../../../../../../src/components/Tooltip/TooltipInteractiveWrapper.web.tsx"],"sourcesContent":["import React from 'react';\nimport { useTooltipContext } from './TooltipContext';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst TooltipInteractiveWrapper = React.forwardRef<HTMLDivElement, Omit<BaseBoxProps, 'as'>>(\n (props, ref) => {\n useTooltipContext();\n\n return (\n <BaseBox\n ref={ref}\n tabIndex={-1}\n display=\"inline-block\"\n {...metaAttribute({\n testID: 'tooltip-interactive-wrapper',\n name: MetaConstants.TooltipInteractiveWrapper,\n })}\n {...props}\n />\n );\n },\n);\n\nexport { TooltipInteractiveWrapper };\n"],"names":["TooltipInteractiveWrapper","React","forwardRef","props","ref","useTooltipContext","_jsx","BaseBox","_objectSpread","tabIndex","display","metaAttribute","testID","name","MetaConstants"],"mappings":";;;;;;;;;;;;AAMMA,IAAAA,yBAAyB,gBAAGC,cAAK,CAACC,UAAU,CAChD,UAACC,KAAK,EAAEC,GAAG,EAAK;AACdC,EAAAA,iBAAiB,EAAE,CAAA;AAEnB,EAAA,oBACEC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAA;AACNJ,IAAAA,GAAG,EAAEA,GAAI;IACTK,QAAQ,EAAE,CAAC,CAAE;AACbC,IAAAA,OAAO,EAAC,cAAA;AAAc,GAAA,EAClBC,aAAa,CAAC;AAChBC,IAAAA,MAAM,EAAE,6BAA6B;IACrCC,IAAI,EAAEC,aAAa,CAACd,yBAAAA;AACtB,GAAC,CAAC,CAAA,EACEG,KAAK,CACV,CAAC,CAAA;AAEN,CACF;;;;"}
|
|
@@ -60,7 +60,7 @@ export { AccordionItemHeader } from './Accordion/AccordionItemHeader.js';
|
|
|
60
60
|
export { AccordionItemBody } from './Accordion/AccordionItemBody.js';
|
|
61
61
|
export { AccordionItem } from './Accordion/AccordionItem.js';
|
|
62
62
|
export { ActionList } from './ActionList/ActionList.js';
|
|
63
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionList/ActionListItem.js';
|
|
63
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection } from './ActionList/ActionListItem.js';
|
|
64
64
|
export { ActionListItemAsset } from './ActionList/ActionListItemAsset.web.js';
|
|
65
65
|
export { Alert } from './Alert/Alert.js';
|
|
66
66
|
export { Amount } from './Amount/Amount.js';
|
|
@@ -19,6 +19,7 @@ import '../Box/index.js';
|
|
|
19
19
|
import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
|
|
20
20
|
import '../BaseMenu/index.js';
|
|
21
21
|
import '../Checkbox/index.js';
|
|
22
|
+
import '../Avatar/index.js';
|
|
22
23
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
23
24
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
24
25
|
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
@@ -31,6 +32,7 @@ import { Divider } from '../Divider/Divider.js';
|
|
|
31
32
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
32
33
|
import { useBaseMenuItem } from '../BaseMenu/BaseMenuContext.js';
|
|
33
34
|
import { Box } from '../Box/Box.js';
|
|
35
|
+
import { Avatar } from '../Avatar/Avatar.web.js';
|
|
34
36
|
import { Badge } from '../Badge/Badge.js';
|
|
35
37
|
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
36
38
|
import { BaseMenuItem } from '../BaseMenu/BaseMenuItem/BaseMenuItem.js';
|
|
@@ -128,6 +130,14 @@ var _ActionListItemBadgeGroup = function _ActionListItemBadgeGroup(_ref3) {
|
|
|
128
130
|
var ActionListItemBadgeGroup = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemBadgeGroup, {
|
|
129
131
|
componentId: componentIds.ActionListItemBadgeGroup
|
|
130
132
|
});
|
|
133
|
+
var _ActionListItemAvatar = function _ActionListItemAvatar(avatarProps) {
|
|
134
|
+
return /*#__PURE__*/jsx(Avatar, _objectSpread({
|
|
135
|
+
size: "xsmall"
|
|
136
|
+
}, avatarProps));
|
|
137
|
+
};
|
|
138
|
+
var ActionListItemAvatar = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemAvatar, {
|
|
139
|
+
componentId: componentIds.ActionListItemAvatar
|
|
140
|
+
});
|
|
131
141
|
var _ActionListItemBadge = function _ActionListItemBadge(props) {
|
|
132
142
|
return /*#__PURE__*/jsx(Badge, _objectSpread({
|
|
133
143
|
size: "medium",
|
|
@@ -298,5 +308,5 @@ var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__
|
|
|
298
308
|
displayName: componentIds.ActionListItem
|
|
299
309
|
});
|
|
300
310
|
|
|
301
|
-
export { ActionListItem, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
311
|
+
export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection };
|
|
302
312
|
//# sourceMappingURL=ActionListItem.js.map
|