@razorpay/blade 11.21.6 → 11.21.8
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/List/List.js +1 -1
- package/build/lib/native/components/List/List.js.map +1 -1
- package/build/lib/native/components/List/ListContext.js.map +1 -1
- package/build/lib/native/components/List/ListItem.js +1 -1
- package/build/lib/native/components/List/ListItem.js.map +1 -1
- package/build/lib/native/components/List/ListItemIcons.js +1 -1
- package/build/lib/native/components/List/ListItemIcons.js.map +1 -1
- package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js +1 -1
- package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/lib/web/development/components/List/List.js +4 -2
- package/build/lib/web/development/components/List/List.js.map +1 -1
- package/build/lib/web/development/components/List/ListContext.js.map +1 -1
- package/build/lib/web/development/components/List/ListItem.js +6 -2
- package/build/lib/web/development/components/List/ListItem.js.map +1 -1
- package/build/lib/web/development/components/List/ListItemIcons.js +3 -2
- package/build/lib/web/development/components/List/ListItemIcons.js.map +1 -1
- package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js +1 -1
- package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/lib/web/production/components/List/List.js +4 -2
- package/build/lib/web/production/components/List/List.js.map +1 -1
- package/build/lib/web/production/components/List/ListContext.js.map +1 -1
- package/build/lib/web/production/components/List/ListItem.js +6 -2
- package/build/lib/web/production/components/List/ListItem.js.map +1 -1
- package/build/lib/web/production/components/List/ListItemIcons.js +3 -2
- package/build/lib/web/production/components/List/ListItemIcons.js.map +1 -1
- package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js +1 -1
- package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/types/components/index.d.ts +9 -2
- package/build/types/components/index.native.d.ts +9 -2
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native
|
|
|
21
21
|
import { isValidAllowedChildren } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
22
22
|
import { jsx } from 'react/jsx-runtime';
|
|
23
23
|
|
|
24
|
-
var _excluded=["variant","size","children","icon","testID"];var StyledOrderedList=styled(OrderedList)(function(_ref){var marginTop=_ref.marginTop,theme=_ref.theme;return {marginTop:marginTop?makeSpace(getIn(theme,marginTop)):undefined};});var StyledUnorderedList=styled(UnorderedList)(function(_ref2){var marginTop=_ref2.marginTop,theme=_ref2.theme;return {marginTop:marginTop?makeSpace(getIn(theme,marginTop)):undefined};});var _List=function _List(_ref3){var _ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'unordered':_ref3$variant,size=_ref3.size,children=_ref3.children,icon=_ref3.icon,testID=_ref3.testID,styledProps=_objectWithoutProperties(_ref3,_excluded);var ListElement=variant==='unordered'?StyledUnorderedList:StyledOrderedList;var _useListContext=useListContext(),level=_useListContext.level,listContextSize=_useListContext.size;var listContextValue=useMemo(function(){return {level:level?level+1:1,size:size!=null?size:listContextSize,icon:icon,variant:variant};},[icon,level,listContextSize,size,variant]);var childrenArray=React__default.Children.toArray(children);var childListItems=childrenArray.filter(function(child){if(isValidAllowedChildren(child,MetaConstants.ListItem)){return child;}if(__DEV__){throwBladeError({message:'You can only pass a ListItem as a child to List.',moduleName:'List'});}return null;});return jsx(ListProvider,{value:listContextValue,children:jsx(BaseBox,Object.assign({},getStyledProps(styledProps),{children:jsx(ListElement,Object.assign({},metaAttribute({name:MetaConstants.List,testID:testID}),makeAccessible({role:'list'}),{children:variant==='unordered'?childListItems:childListItems.map(function(child,index){return React__default.cloneElement(child,{_itemNumber:index+1});})}))}))});};var List=assignWithoutSideEffects(_List,{componentId:MetaConstants.List});
|
|
24
|
+
var _excluded=["variant","size","children","icon","testID","iconColor"];var StyledOrderedList=styled(OrderedList)(function(_ref){var marginTop=_ref.marginTop,theme=_ref.theme;return {marginTop:marginTop?makeSpace(getIn(theme,marginTop)):undefined};});var StyledUnorderedList=styled(UnorderedList)(function(_ref2){var marginTop=_ref2.marginTop,theme=_ref2.theme;return {marginTop:marginTop?makeSpace(getIn(theme,marginTop)):undefined};});var _List=function _List(_ref3){var _ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'unordered':_ref3$variant,size=_ref3.size,children=_ref3.children,icon=_ref3.icon,testID=_ref3.testID,iconColor=_ref3.iconColor,styledProps=_objectWithoutProperties(_ref3,_excluded);var ListElement=variant==='unordered'?StyledUnorderedList:StyledOrderedList;var _useListContext=useListContext(),level=_useListContext.level,listContextSize=_useListContext.size;var listContextValue=useMemo(function(){return {level:level?level+1:1,size:size!=null?size:listContextSize,icon:icon,iconColor:iconColor,variant:variant};},[icon,iconColor,level,listContextSize,size,variant]);var childrenArray=React__default.Children.toArray(children);var childListItems=childrenArray.filter(function(child){if(isValidAllowedChildren(child,MetaConstants.ListItem)){return child;}if(__DEV__){throwBladeError({message:'You can only pass a ListItem as a child to List.',moduleName:'List'});}return null;});return jsx(ListProvider,{value:listContextValue,children:jsx(BaseBox,Object.assign({},getStyledProps(styledProps),{children:jsx(ListElement,Object.assign({},metaAttribute({name:MetaConstants.List,testID:testID}),makeAccessible({role:'list'}),{children:variant==='unordered'?childListItems:childListItems.map(function(child,index){return React__default.cloneElement(child,{_itemNumber:index+1});})}))}))});};var List=assignWithoutSideEffects(_List,{componentId:MetaConstants.List});
|
|
25
25
|
|
|
26
26
|
export { List };
|
|
27
27
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n variant,\n }),\n [icon, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","__DEV__","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","Object","assign","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n iconColor?: IconProps['color'];\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n iconColor?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n iconColor,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n iconColor,\n variant,\n }),\n [icon, iconColor, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","iconColor","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","__DEV__","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","Object","assign","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;wEAoDA,IAAMA,iBAAiB,CAAGC,MAAM,CAACC,WAAW,CAAC,CAC3C,SAAAC,IAAA,CAAG,CAAA,IAAAC,SAAS,CAAAD,IAAA,CAATC,SAAS,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAQ,OAAA,CACzBD,SAAS,CAAEA,SAAS,CAAGE,SAAS,CAACC,KAAK,CAACF,KAAK,CAAED,SAAS,CAAC,CAAC,CAAGI,SAC9D,CAAC,CAAA,CACH,CAAC,CAED,IAAMC,mBAAmB,CAAGR,MAAM,CAACS,aAAa,CAAC,CAC/C,SAAAC,KAAA,CAAA,CAAA,IAAGP,SAAS,CAAAO,KAAA,CAATP,SAAS,CAAEC,KAAK,CAAAM,KAAA,CAALN,KAAK,CAAA,OAAQ,CACzBD,SAAS,CAAEA,SAAS,CAAGE,SAAS,CAACC,KAAK,CAACF,KAAK,CAAED,SAAS,CAAC,CAAC,CAAGI,SAC9D,CAAC,CACH,CAAA,CAAC,CAsBD,IAAMI,KAAK,CAAG,SAARA,KAAKA,CAAAC,KAAA,CAQ0B,CAAAC,IAAAA,aAAA,CAAAD,KAAA,CAPnCE,OAAO,CAAPA,OAAO,CAAAD,aAAA,GAAG,KAAA,CAAA,CAAA,WAAW,CAAAA,aAAA,CACrBE,IAAI,CAAAH,KAAA,CAAJG,IAAI,CACJC,QAAQ,CAAAJ,KAAA,CAARI,QAAQ,CACRC,IAAI,CAAAL,KAAA,CAAJK,IAAI,CACJC,MAAM,CAAAN,KAAA,CAANM,M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,CAAC,CAAAJ,CAAAA,QAAA,CACtC4B,GAAA,CAACrB,WAAW,CAAAyB,MAAA,CAAAC,MAAA,CAAA,EAAA,CACNE,aAAa,CAAC,CAAEC,IAAI,CAAEd,aAAa,CAACe,IAAI,CAAEnC,MAAM,CAANA,MAAO,CAAC,CAAC,CACnDoC,cAAc,CAAC,CAAEC,IAAI,CAAE,MAAO,CAAC,CAAC,CAAA,CAAAvC,QAAA,CAEnCF,OAAO,GAAK,WAAW,CACpBoB,cAAc,CACdA,cAAc,CAACsB,GAAG,CAChB,SAACpB,KAAK,CAAEqB,KAAK,CAAA,CAAA,OACX1B,cAAK,CAAC2B,YAAY,CAACtB,KAAK,CAAwB,CAAEuB,WAAW,CAAEF,KAAK,CAAG,CAAE,CAAC,CAAC,EAC/E,CAAC,CAAA,CACM,CAAC,CAAA,CACP,CAAC,CACE,CAAC,CAEnB,CAAC,CAEK,IAAAJ,IAAI,CAAGO,wBAAwB,CAACjD,KAAK,CAAE,CAAEkD,WAAW,CAAEvB,aAAa,CAACe,IAAK,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListContext.js","sources":["../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ListContext.js","sources":["../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n iconColor?: ListProps['iconColor'];\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;AAYA,IAAMA,WAAW,CAAGC,cAAK,CAACC,aAAa,CAAkB,CACvDC,KAAK,CAAEC,SAAS,CAChBC,IAAI,CAAE,QAAQ,CACdC,OAAO,CAAE,WACX,CAAC,CAAC,CACI,IAAAC,YAAY,CAAGP,WAAW,CAACQ,SAE3B,IAAAC,cAAc,CAAG,SAAjBA,cAAcA,EAA0B,CAC5C,IAAMC,OAAO,CAAGT,cAAK,CAACU,UAAU,CAACX,WAAW,CAAC,CAC7C,OAAOU,OAAO,CAChB;;;;"}
|
|
@@ -27,7 +27,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
|
27
27
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
28
28
|
import { getComponentId, isValidAllowedChildren } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
29
29
|
|
|
30
|
-
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?getIn(theme,listItemMarginLeft[`${variant}${variant==='unordered'&&hasIcon?'WithIcon':''}`][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var children=_ref3.children,Icon=_ref3.icon,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;if(__DEV__){if(level&&level>3){throwBladeError({message:'List Nesting is allowed only upto 3 levels.',moduleName:'List'});}}var childrenArray=React__default.Children.toArray(children);var validChildItem=childrenArray.filter(function(child){if(getComponentId(child)===MetaConstants.List)return null;if(typeof child==='string'||isValidAllowedChildren(child,MetaConstants.ListItemLink)||isValidAllowedChildren(child,MetaConstants.ListItemText)||isValidAllowedChildren(child,MetaConstants.ListItemCode)){return child;}else if(__DEV__){throwBladeError({message:`You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,moduleName:'ListItem'});}return null;});var childList=childrenArray.filter(function(child){return getComponentId(child)===MetaConstants.List?child:null;});var hasIcon=Boolean(ItemIcon);return jsxs(StyledListItem,Object.assign({level:level,variant:variant,hasIcon:hasIcon},metaAttribute({name:MetaConstants.ListItem,testID:testID}),{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:listItemMarginBottom,children:[variant==='unordered'?jsx(BaseBox,{marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[`${variant}${hasIcon?'WithIcon':''}`][platform][size],display:"flex",alignSelf:"flex-start",children:ItemIcon?jsx(ItemIcon,{size:size,color:
|
|
30
|
+
var StyledListItem=styled(ListItemElement)(function(_ref){var level=_ref.level,theme=_ref.theme,variant=_ref.variant,hasIcon=_ref.hasIcon;return {marginLeft:level?getIn(theme,listItemMarginLeft[`${variant}${variant==='unordered'&&hasIcon?'WithIcon':''}`][level]):0};});var ListItemContentChildren=function ListItemContentChildren(_ref2){var children=_ref2.children,size=_ref2.size;return getPlatformType()==='react-native'?jsx(BaseBox,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:children.map(function(child,index){if(typeof child==='string'){return jsx(Text,{variant:"body",size:size,children:child},index);}return child;})}):jsx(Text,{variant:"body",size:size,children:children});};var _ListItem=function _ListItem(_ref3){var _ref4;var children=_ref3.children,Icon=_ref3.icon,listItemIconColor=_ref3.iconColor,_itemNumber=_ref3._itemNumber,testID=_ref3.testID;var _useListContext=useListContext(),level=_useListContext.level,size=_useListContext.size,ListContextIcon=_useListContext.icon,variant=_useListContext.variant,iconColor=_useListContext.iconColor;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var ItemIcon=Icon!=null?Icon:ListContextIcon;var iconColorToken=(_ref4=listItemIconColor!=null?listItemIconColor:iconColor)!=null?_ref4:'surface.icon.gray.muted';if(__DEV__){if(level&&level>3){throwBladeError({message:'List Nesting is allowed only upto 3 levels.',moduleName:'List'});}}var childrenArray=React__default.Children.toArray(children);var validChildItem=childrenArray.filter(function(child){if(getComponentId(child)===MetaConstants.List)return null;if(typeof child==='string'||isValidAllowedChildren(child,MetaConstants.ListItemLink)||isValidAllowedChildren(child,MetaConstants.ListItemText)||isValidAllowedChildren(child,MetaConstants.ListItemCode)){return child;}else if(__DEV__){throwBladeError({message:`You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,moduleName:'ListItem'});}return null;});var childList=childrenArray.filter(function(child){return getComponentId(child)===MetaConstants.List?child:null;});var hasIcon=Boolean(ItemIcon);return jsxs(StyledListItem,Object.assign({level:level,variant:variant,hasIcon:hasIcon},metaAttribute({name:MetaConstants.ListItem,testID:testID}),{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:listItemMarginBottom,children:[variant==='unordered'?jsx(BaseBox,{marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[`${variant}${hasIcon?'WithIcon':''}`][platform][size],display:"flex",alignSelf:"flex-start",children:ItemIcon?jsx(ItemIcon,{size:size,color:iconColorToken}):jsx(UnorderedItemIcon,{level:level})}):jsx(BaseBox,{width:listItemOrderedBulletBoxSize[variant][platform][size],height:listItemOrderedBulletBoxSize[variant][platform][size],marginRight:listItemBulletMarginRight[variant],marginTop:listItemBulletMarginTop[variant][platform][size],display:"flex",flexShrink:0,justifyContent:"center",alignSelf:"flex-start",alignItems:"center",borderRadius:variant==='ordered-filled'?'max':undefined,backgroundColor:variant==='ordered-filled'?getIn(theme.colors,'feedback.background.neutral.subtle'):undefined,children:jsx(Text,{variant:"body",color:"surface.text.gray.muted",size:variant==='ordered'?size:'xsmall',children:`${getOrderedListItemBullet({itemNumber:_itemNumber!=null?_itemNumber:1,level:level!=null?level:1})}${variant==='ordered'?'.':''}`})}),jsx(ListItemContentChildren,{size:size,children:validChildItem})]}),childList]}));};var ListItem=assignWithoutSideEffects(_ListItem,{componentId:MetaConstants.ListItem});
|
|
31
31
|
|
|
32
32
|
export { ListItem };
|
|
33
33
|
//# sourceMappingURL=ListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color=\"surface.icon.gray.muted\" />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","Icon","icon","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","__DEV__","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","Object","assign","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAMA,cAAc,CAAGC,MAAM,CAACC,eAAe,CAAC,CAI3C,SAAAC,IAAA,MAAGC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAEC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CAAEC,OAAO,CAAAJ,IAAA,C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,CAAC,CAErB,CAAC,CAEK,IAAAO,QAAQ,CAAGsB,wBAAwB,CAAC3D,SAAS,CAAE,CAAE4D,WAAW,CAAEpC,aAAa,CAACa,QAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","__DEV__","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","Object","assign","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,CAAGC,MAAM,CAACC,eAAe,CAAC,CAI3C,SAAAC,IAAA,CAAA,CAAA,IAAGC,KAAK,CAAAD,IAAA,CAALC,KAAK,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAEC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CAAEC,OAAO,CAAAJ,IAAA,CAAPI,OAAO,CAAQ,OAAA,CAC1CC,UAAU,CAAEJ,KAAK,CACbK,KAAK,CACHJ,KAAK,CACLK,kBAAkB,CACf,CAAA,EAAEJ,OAAQ,CAAEA,EAAAA,OAAO,GAAK,WAAW,EAAIC,OAAO,CAAG,UAAU,CAAG,EAAG,CAAA,CAAC,CAGpE,CAACH,KAAK,CACT,CAAC,CACD,CACN,CAAC,CAAA,CAAC,CAAC,CAEH,IAAMO,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,KAAA,CAMH,CALxB,IAAAC,QAAQ,CAAAD,KAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,KAAA,CAAJE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../../tokens/global/typography.js';
|
|
19
19
|
import '../../tokens/global/motion.js';
|
|
20
20
|
|
|
21
|
-
var UnorderedLevel1Icon=function UnorderedLevel1Icon(_ref){var iconDimensions=_ref.iconDimensions,color=_ref.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Circle,{cx:"3px",cy:"3px",r:"3px",fill:color,fillOpacity:opacity[600]})});};var UnorderedLevel2Icon=function UnorderedLevel2Icon(_ref2){var iconDimensions=_ref2.iconDimensions,color=_ref2.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Circle,{cx:"3px",cy:"3px",r:"2.5px",stroke:color})});};var UnorderedLevel3Icon=function UnorderedLevel3Icon(_ref3){var iconDimensions=_ref3.iconDimensions,color=_ref3.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Rect,{width:iconDimensions,height:iconDimensions,rx:"1px",fill:color,fillOpacity:opacity[600]})});};var UnorderedItemIcon=function UnorderedItemIcon(_ref4){var level=_ref4.level;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var _useListContext=useListContext(),size=_useListContext.size;var iconDimensions=listItemUnorderedBulletSize[platform][size];var backgroundToken=theme.colors.surface.text.gray.muted;switch(level){case 1:return jsx(UnorderedLevel1Icon,{iconDimensions:iconDimensions,color:backgroundToken});case 2:return jsx(UnorderedLevel2Icon,{iconDimensions:iconDimensions,color:backgroundToken});case 3:return jsx(UnorderedLevel3Icon,{iconDimensions:iconDimensions,color:backgroundToken});default:return jsx(UnorderedLevel3Icon,{iconDimensions:iconDimensions,color:backgroundToken});}};
|
|
21
|
+
var UnorderedLevel1Icon=function UnorderedLevel1Icon(_ref){var iconDimensions=_ref.iconDimensions,color=_ref.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Circle,{cx:"3px",cy:"3px",r:"3px",fill:color,fillOpacity:opacity[600]})});};var UnorderedLevel2Icon=function UnorderedLevel2Icon(_ref2){var iconDimensions=_ref2.iconDimensions,color=_ref2.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Circle,{cx:"3px",cy:"3px",r:"2.5px",stroke:color})});};var UnorderedLevel3Icon=function UnorderedLevel3Icon(_ref3){var iconDimensions=_ref3.iconDimensions,color=_ref3.color;return jsx(Svg,{width:iconDimensions,height:iconDimensions,viewBox:"0 0 6 6",fill:"none",children:jsx(Rect,{width:iconDimensions,height:iconDimensions,rx:"1px",fill:color,fillOpacity:opacity[600]})});};var UnorderedItemIcon=function UnorderedItemIcon(_ref4){var level=_ref4.level;var _useTheme=useTheme(),theme=_useTheme.theme,platform=_useTheme.platform;var _useListContext=useListContext(),size=_useListContext.size,iconColor=_useListContext.iconColor;var iconDimensions=listItemUnorderedBulletSize[platform][size];var backgroundToken=iconColor!=null?iconColor:theme.colors.surface.text.gray.muted;switch(level){case 1:return jsx(UnorderedLevel1Icon,{iconDimensions:iconDimensions,color:backgroundToken});case 2:return jsx(UnorderedLevel2Icon,{iconDimensions:iconDimensions,color:backgroundToken});case 3:return jsx(UnorderedLevel3Icon,{iconDimensions:iconDimensions,color:backgroundToken});default:return jsx(UnorderedLevel3Icon,{iconDimensions:iconDimensions,color:backgroundToken});}};
|
|
22
22
|
|
|
23
23
|
export { UnorderedItemIcon };
|
|
24
24
|
//# sourceMappingURL=ListItemIcons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIcons.js","sources":["../../../../../src/components/List/ListItemIcons.tsx"],"sourcesContent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,CAA0E,
|
|
1
|
+
{"version":3,"file":"ListItemIcons.js","sources":["../../../../../src/components/List/ListItemIcons.tsx"],"sourcesContent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size, iconColor } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = iconColor ?? theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","iconColor","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,CAA0E,CAApE,IAAAC,cAAc,CAAAD,IAAA,CAAdC,cAAc,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAClD,OACEC,GAAA,CAACC,GAAG,EAACC,KAAK,CAAEJ,cAAe,CAACK,MAAM,CAAEL,cAAe,CAACM,OAAO,CAAC,SAAS,CAACC,IAAI,CAAC,MAAM,CAAAC,QAAA,CAC/EN,GAAA,CAACO,MAAM,CAACC,CAAAA,EAAE,CAAC,KAAK,CAACC,EAAE,CAAC,KAAK,CAACC,CAAC,CAAC,KAAK,CAACL,IAAI,CAAEN,KAAM,CAACY,WAAW,CAAEC,OAAO,CAAC,GAAG,CAAE,CAAE,CAAC,CACzE,CAAC,CAEV,CAAC,CAED,IAAMC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAAC,KAAA,CAA0E,KAApEhB,cAAc,CAAAgB,KAAA,CAAdhB,cAAc,CAAEC,KAAK,CAAAe,KAAA,CAALf,KAAK,CAClD,OACEC,GAAA,CAACC,GAAG,CAACC,CAAAA,KAAK,CAAEJ,cAAe,CAACK,MAAM,CAA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A,CAATA,SAAS,CAAIL,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,IAAI,CAACC,IAAI,CAACC,KAAK,CAEzE,OAAQf,KAAK,EACX,KAAK,CAAC,CACJ,OAAOtB,GAAA,CAACJ,mBAAmB,CAAA,CAACE,cAAc,CAAEA,cAAe,CAACC,KAAK,CAAEiC,eAAgB,CAAE,CAAC,CACxF,KAAK,CAAC,CACJ,OAAOhC,GAAA,CAACa,mBAAmB,CAAA,CAACf,cAAc,CAAEA,cAAe,CAACC,KAAK,CAAEiC,eAAgB,CAAE,CAAC,CACxF,KAAM,CAAA,CACJ,OAAOhC,GAAA,CAACgB,mBAAmB,CAAClB,CAAAA,cAAc,CAAEA,cAAe,CAACC,KAAK,CAAEiC,eAAgB,CAAE,CAAC,CACxF,QACE,OAAOhC,GAAA,CAACgB,mBAAmB,CAAA,CAAClB,cAAc,CAAEA,cAAe,CAACC,KAAK,CAAEiC,eAAgB,CAAE,CAAC,CAC1F,CACF;;;;"}
|
|
@@ -24,7 +24,7 @@ import { Text } from '../../Typography/Text/Text.js';
|
|
|
24
24
|
import '../../Typography/Code/Code.js';
|
|
25
25
|
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.native.js';
|
|
26
26
|
|
|
27
|
-
var _excluded=["label","labelPosition","accessibilityLabel","color","size","testID"];var getColor=function getColor(_ref){var color=_ref.color,theme=_ref.theme;if(color&&color==='white'){return getIn(theme.colors,'
|
|
27
|
+
var _excluded=["label","labelPosition","accessibilityLabel","color","size","testID"];var getColor=function getColor(_ref){var color=_ref.color,theme=_ref.theme;if(color&&color==='white'){return getIn(theme.colors,'interactive.icon.staticWhite.subtle');}if(color&&color!=='primary'){return getIn(theme.colors,`feedback.background.${color}.intense`);}return getIn(theme.colors,'surface.background.primary.intense');};var BaseSpinner=function BaseSpinner(_ref2){var label=_ref2.label,_ref2$labelPosition=_ref2.labelPosition,labelPosition=_ref2$labelPosition===void 0?'right':_ref2$labelPosition,accessibilityLabel=_ref2.accessibilityLabel,_ref2$color=_ref2.color,color=_ref2$color===void 0?'neutral':_ref2$color,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Spinner,testID:testID}),getStyledProps(styledProps),{children:jsxs(BaseBox,Object.assign({display:"flex",alignItems:"center",flexDirection:labelPosition==='right'?'row':'column'},makeAccessible({label:accessibilityLabel,role:'progressbar'}),{children:[jsx(SpinningBox,{children:jsx(SpinnerIcon,{dimensions:makeSize(dimensions[size]),color:getColor({color:color,theme:theme})})}),label&&label.trim().length>0?jsx(BaseBox,{marginLeft:labelPosition==='right'?'spacing.3':'spacing.0',marginTop:labelPosition==='bottom'?'spacing.3':'spacing.0',children:jsx(Text,{variant:"body",weight:"regular",size:"small",color:"surface.text.gray.muted",children:label})}):null]}))}));};
|
|
28
28
|
|
|
29
29
|
export { BaseSpinner };
|
|
30
30
|
//# sourceMappingURL=BaseSpinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, '
|
|
1
|
+
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, 'interactive.icon.staticWhite.subtle');\n }\n if (color && color !== 'primary') {\n return getIn(theme.colors, `feedback.background.${color}.intense`);\n }\n return getIn(theme.colors, 'surface.background.primary.intense');\n};\n\nconst BaseSpinner = ({\n label,\n labelPosition = 'right',\n accessibilityLabel,\n color = 'neutral',\n size = 'medium',\n testID,\n ...styledProps\n}: BaseSpinnerProps): React.ReactElement => {\n const { theme } = useTheme();\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Spinner, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n flexDirection={labelPosition === 'right' ? 'row' : 'column'}\n {...makeAccessible({\n label: accessibilityLabel,\n role: 'progressbar',\n })}\n >\n <SpinningBox>\n <SpinnerIcon dimensions={makeSize(dimensions[size])} color={getColor({ color, theme })} />\n </SpinningBox>\n {label && label.trim().length > 0 ? (\n <BaseBox\n marginLeft={labelPosition === 'right' ? 'spacing.3' : 'spacing.0'}\n marginTop={labelPosition === 'bottom' ? 'spacing.3' : 'spacing.0'}\n >\n <Text variant=\"body\" weight=\"regular\" size=\"small\" color=\"surface.text.gray.muted\">\n {label}\n </Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { BaseSpinnerProps };\nexport { BaseSpinner };\n"],"names":["getColor","_ref","color","theme","getIn","colors","BaseSpinner","_ref2","label","_ref2$labelPosition","labelPosition","accessibilityLabel","_ref2$color","_ref2$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","_jsx","BaseBox","Object","assign","metaAttribute","name","MetaConstants","Spinner","getStyledProps","children","_jsxs","display","alignItems","flexDirection","makeAccessible","role","SpinningBox","SpinnerIcon","dimensions","makeSize","trim","length","marginLeft","marginT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aAttribute.web.js';
|
|
|
25
25
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
26
26
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
27
27
|
|
|
28
|
-
var _excluded = ["variant", "size", "children", "icon", "testID"];
|
|
28
|
+
var _excluded = ["variant", "size", "children", "icon", "testID", "iconColor"];
|
|
29
29
|
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; }
|
|
30
30
|
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; }
|
|
31
31
|
var StyledOrderedList = /*#__PURE__*/styled(OrderedList).withConfig({
|
|
@@ -76,6 +76,7 @@ var _List = function _List(_ref3) {
|
|
|
76
76
|
children = _ref3.children,
|
|
77
77
|
icon = _ref3.icon,
|
|
78
78
|
testID = _ref3.testID,
|
|
79
|
+
iconColor = _ref3.iconColor,
|
|
79
80
|
styledProps = _objectWithoutProperties(_ref3, _excluded);
|
|
80
81
|
var ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;
|
|
81
82
|
var _useListContext = useListContext(),
|
|
@@ -86,9 +87,10 @@ var _List = function _List(_ref3) {
|
|
|
86
87
|
level: level ? level + 1 : 1,
|
|
87
88
|
size: size !== null && size !== void 0 ? size : listContextSize,
|
|
88
89
|
icon: icon,
|
|
90
|
+
iconColor: iconColor,
|
|
89
91
|
variant: variant
|
|
90
92
|
};
|
|
91
|
-
}, [icon, level, listContextSize, size, variant]);
|
|
93
|
+
}, [icon, iconColor, level, listContextSize, size, variant]);
|
|
92
94
|
var childrenArray = React__default.Children.toArray(children);
|
|
93
95
|
var childListItems = childrenArray.filter(function (child) {
|
|
94
96
|
if (isValidAllowedChildren(child, MetaConstants.ListItem)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n variant,\n }),\n [icon, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","withConfig","displayName","componentId","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n iconColor?: IconProps['color'];\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n iconColor?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n iconColor,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n iconColor,\n variant,\n }),\n [icon, iconColor, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","withConfig","displayName","componentId","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","iconColor","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,IAAMA,iBAAiB,gBAAGC,MAAM,CAACC,WAAW,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,yBAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAC3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAAA,OAAQ;AACzBD,IAAAA,SAAS,EAAEA,SAAS,GAAGE,SAAS,CAACC,KAAK,CAACF,KAAK,EAAED,SAAS,CAAC,CAAC,GAAGI,SAAAA;GAC7D,CAAA;AAAA,CAAC,CACH,CAAA;AAED,IAAMC,mB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,IAAI,EAAEZ,aAAa,CAACa,IAAI;AAAEjC,QAAAA,MAAM,EAANA,MAAAA;OAAQ,CAAC,CACnDkC,EAAAA,cAAc,CAAC;AAAEC,QAAAA,IAAI,EAAE,MAAA;AAAO,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAArC,QAAAA,QAAA,EAEnCF,OAAO,KAAK,WAAW,GACpBoB,cAAc,GACdA,cAAc,CAACoB,GAAG,CAChB,UAAClB,KAAK,EAAEmB,KAAK,EAAA;AAAA,UAAA,oBACXxB,cAAK,CAACyB,YAAY,CAACpB,KAAK,EAAwB;YAAEqB,WAAW,EAAEF,KAAK,GAAG,CAAA;AAAE,WAAC,CAAC,CAAA;SAAE;AACjF,SAAA;OACO,CAAA,CAAA;KACN,CAAA,CAAA;AAAC,GACE,CAAC,CAAA;AAEnB,CAAC,CAAA;AAED,IAAMJ,IAAI,gBAAGO,wBAAwB,CAAC/C,KAAK,EAAE;EAAEV,WAAW,EAAEqC,aAAa,CAACa,IAAAA;AAAK,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListContext.js","sources":["../../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ListContext.js","sources":["../../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n iconColor?: ListProps['iconColor'];\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;AAYA,IAAMA,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAkB;AACvDC,EAAAA,KAAK,EAAEC,SAAS;AAChBC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,OAAO,EAAE,WAAA;AACX,CAAC,CAAC,CAAA;AACF,IAAMC,YAAY,GAAGP,WAAW,CAACQ,SAAQ;AAEzC,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAA0B;AAC5C,EAAA,IAAMC,OAAO,GAAGT,cAAK,CAACU,UAAU,CAACX,WAAW,CAAC,CAAA;AAC7C,EAAA,OAAOU,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -67,19 +67,23 @@ var ListItemContentChildren = function ListItemContentChildren(_ref2) {
|
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
var _ListItem = function _ListItem(_ref3) {
|
|
70
|
+
var _ref4;
|
|
70
71
|
var children = _ref3.children,
|
|
71
72
|
Icon = _ref3.icon,
|
|
73
|
+
listItemIconColor = _ref3.iconColor,
|
|
72
74
|
_itemNumber = _ref3._itemNumber,
|
|
73
75
|
testID = _ref3.testID;
|
|
74
76
|
var _useListContext = useListContext(),
|
|
75
77
|
level = _useListContext.level,
|
|
76
78
|
size = _useListContext.size,
|
|
77
79
|
ListContextIcon = _useListContext.icon,
|
|
78
|
-
variant = _useListContext.variant
|
|
80
|
+
variant = _useListContext.variant,
|
|
81
|
+
iconColor = _useListContext.iconColor;
|
|
79
82
|
var _useTheme = useTheme(),
|
|
80
83
|
theme = _useTheme.theme,
|
|
81
84
|
platform = _useTheme.platform;
|
|
82
85
|
var ItemIcon = Icon !== null && Icon !== void 0 ? Icon : ListContextIcon;
|
|
86
|
+
var iconColorToken = (_ref4 = listItemIconColor !== null && listItemIconColor !== void 0 ? listItemIconColor : iconColor) !== null && _ref4 !== void 0 ? _ref4 : 'surface.icon.gray.muted';
|
|
83
87
|
if (true) {
|
|
84
88
|
if (level && level > 3) {
|
|
85
89
|
throwBladeError({
|
|
@@ -128,7 +132,7 @@ var _ListItem = function _ListItem(_ref3) {
|
|
|
128
132
|
alignSelf: "flex-start",
|
|
129
133
|
children: ItemIcon ? /*#__PURE__*/jsx(ItemIcon, {
|
|
130
134
|
size: size,
|
|
131
|
-
color:
|
|
135
|
+
color: iconColorToken
|
|
132
136
|
}) : /*#__PURE__*/jsx(UnorderedItemIcon, {
|
|
133
137
|
level: level
|
|
134
138
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color=\"surface.icon.gray.muted\" />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","Icon","icon","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,eAAe,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAI3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,G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,gBAAgB,GAAG,KAAK,GAAGwE,SAAU;AAC/DC,QAAAA,eAAe,EACbzE,OAAO,KAAK,gBAAgB,GACxBG,KAAK,CAACJ,KAAK,CAAC2E,MAAM,EAAE,oCAAoC,CAAC,GACzDF,SACL;QAAAhE,QAAA,eAEDG,GAAA,CAACQ,IAAI,EAAA;AACHnB,UAAAA,OAAO,EAAC,MAAM;AACdgE,UAAAA,KAAK,EAAC,yBAAyB;AAC/BvD,UAAAA,IAAI,EAAET,OAAO,KAAK,SAAS,GAAGS,IAAI,GAAG,QAAS;AAAAD,UAAAA,QAAA,EAAAH,EAAAA,CAAAA,MAAA,CAE1CsE,wBAAwB,CAAC;AAC3BC,YAAAA,UAAU,EAAEpD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,WAAW,GAAI,CAAC;AAC5B1B,YAAAA,KAAK,EAAEA,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAI,CAAA;WACjB,CAAC,CAAAO,CAAAA,MAAA,CAAGL,OAAO,KAAK,SAAS,GAAG,GAAG,GAAG,EAAE,CAAA;SACjC,CAAA;AAAC,OACA,CACV,eACDW,GAAA,CAACL,uBAAuB,EAAA;AAACG,QAAAA,IAAI,EAAEA,IAAK;AAAAD,QAAAA,QAAA,EAAEgC,cAAAA;AAAc,OAA0B,CAAC,CAAA;KACxE,CAAC,EACTS,SAAS,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMM,QAAQ,gBAAGsB,wBAAwB,CAACzD,SAAS,EAAE;EAAExB,WAAW,EAAE+C,aAAa,CAACY,QAAAA;AAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,eAAe,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAI3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO,CAAA;EAAA,OAAQ;AAC1CC,IAAAA,UAAU,EAAEJ,KAAK,GACbK,KAAK,CACHJ,KAAK,EACLK,kBAAkB,CAAAC,EAAAA,CAAAA,MAAA,CACbL,OAAO,CAAAK,CAAAA,MAAA,CAAGL,OAAO,KAAK,WAAW,IAAIC,OAAO,GAAG,UAAU,GAAG,EAAE,CAGlE,CAAA,CAACH,KAAK,CACT,CAAC,GACD,CAAA;GACL,CAAA;AAAA,CAAC,CAAC,CAAA;AAEH,IAAMQ,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,KAAA,EAMH;AAAA,EAAA,IALxBC,QAAQ,GAAAD,KAAA,CAARC,QAAQ;IACRC,IAAI,GAAAF,KAAA,CAAJE,IAAI,CAAA;AAKJ;AACF;AACA;EACE,OAAOC,eAAe,EAAE,KAAK,cAAc,gBACzCC,GAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,OAAO,EAAC,MAAM;AAACC,IAA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AG,QAAS;AAAAD,UAAAA,QAAA,EAAAH,EAAAA,CAAAA,MAAA,CAE1C0E,wBAAwB,CAAC;AAC3BC,YAAAA,UAAU,EAAErD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,WAAW,GAAI,CAAC;AAC5B7B,YAAAA,KAAK,EAAEA,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAI,CAAA;WACjB,CAAC,CAAAO,CAAAA,MAAA,CAAGL,OAAO,KAAK,SAAS,GAAG,GAAG,GAAG,EAAE,CAAA;SACjC,CAAA;AAAC,OACA,CACV,eACDW,GAAA,CAACL,uBAAuB,EAAA;AAACG,QAAAA,IAAI,EAAEA,IAAK;AAAAD,QAAAA,QAAA,EAAEoC,cAAAA;AAAc,OAA0B,CAAC,CAAA;KACxE,CAAC,EACTS,SAAS,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMM,QAAQ,gBAAGsB,wBAAwB,CAAC7D,SAAS,EAAE;EAAExB,WAAW,EAAEmD,aAAa,CAACY,QAAAA;AAAS,CAAC;;;;"}
|
|
@@ -67,9 +67,10 @@ var UnorderedItemIcon = function UnorderedItemIcon(_ref4) {
|
|
|
67
67
|
theme = _useTheme.theme,
|
|
68
68
|
platform = _useTheme.platform;
|
|
69
69
|
var _useListContext = useListContext(),
|
|
70
|
-
size = _useListContext.size
|
|
70
|
+
size = _useListContext.size,
|
|
71
|
+
iconColor = _useListContext.iconColor;
|
|
71
72
|
var iconDimensions = listItemUnorderedBulletSize[platform][size];
|
|
72
|
-
var backgroundToken = theme.colors.surface.text.gray.muted;
|
|
73
|
+
var backgroundToken = iconColor !== null && iconColor !== void 0 ? iconColor : theme.colors.surface.text.gray.muted;
|
|
73
74
|
switch (level) {
|
|
74
75
|
case 1:
|
|
75
76
|
return /*#__PURE__*/jsx(UnorderedLevel1Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIcons.js","sources":["../../../../../../src/components/List/ListItemIcons.tsx"],"sourcesContent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"],"mappings":";;;;;;;;;;;;;AAYA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAA0E;AAAA,EAAA,IAApEC,cAAc,GAAAD,IAAA,CAAdC,cAAc;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAClD,oBACEC,GAAA,CAACC,GAAG,EAAA;AAACC,IAAAA,KAAK,EAAEJ,cAAe;AAACK,IAAAA,MAAM,EAAEL,cAAe;AAACM,IAAAA,OAAO,EAAC,SAAS;AAACC,IAAAA,IAAI,EAAC,MAAM;IAAAC,QAAA,eAC/EN,GAAA,CAACO,MAAM,EAAA;AAACC,MAAAA,EAAE,EAAC,KAAK;AAACC,MAAAA,EAAE,EAAC,KAAK;AAACC,MAAAA,CAAC,EAAC,KAAK;AAACL,MAAAA,IAAI,EAAEN,KAAM;MAACY,WAAW,EAAEC,OAAO,CAAC,GAAG,CAAA;KAAI,CAAA;AAAC,GACzE,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,KAAA,EAA0E;AAAA,EAAA,IAApEhB,cAAc,GAAAgB,KAAA,CAAdhB,cAAc;IAAEC,KAAK,GAAAe,KAAA,CAALf,KAAK,CAAA;EAClD,oBACEC,GAAA,CAACC,GAAG,EAAA;AAACC,IAAAA,KAAK,EAAEJ,cAAe;AAACK,IAAAA,MAAM,EAAEL,cAAe;AAACM,IAAAA,OAAO,EAAC,SAAS;A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ent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size, iconColor } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = iconColor ?? theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","iconColor","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"],"mappings":";;;;;;;;;;;;;AAYA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAA0E;AAAA,EAAA,IAApEC,cAAc,GAAAD,IAAA,CAAdC,cAAc;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAClD,oBACEC,GAAA,CAACC,GAAG,EAAA;AAACC,IAAAA,KAAK,EAAEJ,cAAe;AAACK,IAAAA,MAAM,EAAEL,cAAe;AAACM,IAAAA,OAAO,EAAC,SAAS;AAACC,IAAAA,IAAI,EAAC,MAAM;IAAAC,QAAA,eAC/EN,GAAA,CAACO,MAAM,EAAA;AAACC,MAAAA,EAAE,EAAC,KAAK;AAACC,MAAAA,EAAE,EAAC,KAAK;AAACC,MAAAA,CAAC,EAAC,KAAK;AAACL,MAAAA,IAAI,EAAEN,KAAM;MAACY,WAAW,EAAEC,OAAO,CAAC,GAAG,CAAA;KAAI,CAAA;AAAC,GACzE,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,KAAA,EAA0E;AAAA,EAAA,IAApEhB,cAAc,GAAAgB,KAAA,CAAdhB,cAAc;IAAEC,KAAK,GAAAe,KAAA,CAALf,KAAK,CAAA;EAClD,oBACEC,GAAA,CAACC,GAAG,EAAA;AAACC,IAAAA,KAAK,EAAEJ,cAAe;AAACK,IAAAA,MAAM,EAAEL,cAAe;AAACM,IAAAA,OAAO,EAAC,SAAS;AAACC,IAAAA,IAAI,EAAC,MAAM;IAAAC,QAAA,eAC/EN,GA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2BAA2B,CAACL,QAAQ,CAAC,CAACG,IAAI,CAAC,CAAA;AAClE,EAAA,IAAMG,eAAe,GAAGF,SAAS,aAATA,SAAS,KAAA,KAAA,CAAA,GAATA,SAAS,GAAIL,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,IAAI,CAACC,IAAI,CAACC,KAAK,CAAA;AAEzE,EAAA,QAAQf,KAAK;AACX,IAAA,KAAK,CAAC;MACJ,oBAAOtB,GAAA,CAACJ,mBAAmB,EAAA;AAACE,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA,KAAK,CAAC;MACJ,oBAAOhC,GAAA,CAACa,mBAAmB,EAAA;AAACf,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA,KAAK,CAAC;MACJ,oBAAOhC,GAAA,CAACgB,mBAAmB,EAAA;AAAClB,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA;MACE,oBAAOhC,GAAA,CAACgB,mBAAmB,EAAA;AAAClB,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AAC1F,GAAA;AACF;;;;"}
|
|
@@ -29,7 +29,7 @@ var getColor = function getColor(_ref) {
|
|
|
29
29
|
var color = _ref.color,
|
|
30
30
|
theme = _ref.theme;
|
|
31
31
|
if (color && color === 'white') {
|
|
32
|
-
return getIn(theme.colors, '
|
|
32
|
+
return getIn(theme.colors, 'interactive.icon.staticWhite.subtle');
|
|
33
33
|
}
|
|
34
34
|
if (color && color !== 'primary') {
|
|
35
35
|
return getIn(theme.colors, "feedback.background.".concat(color, ".intense"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, '
|
|
1
|
+
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, 'interactive.icon.staticWhite.subtle');\n }\n if (color && color !== 'primary') {\n return getIn(theme.colors, `feedback.background.${color}.intense`);\n }\n return getIn(theme.colors, 'surface.background.primary.intense');\n};\n\nconst BaseSpinner = ({\n label,\n labelPosition = 'right',\n accessibilityLabel,\n color = 'neutral',\n size = 'medium',\n testID,\n ...styledProps\n}: BaseSpinnerProps): React.ReactElement => {\n const { theme } = useTheme();\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Spinner, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n flexDirection={labelPosition === 'right' ? 'row' : 'column'}\n {...makeAccessible({\n label: accessibilityLabel,\n role: 'progressbar',\n })}\n >\n <SpinningBox>\n <SpinnerIcon dimensions={makeSize(dimensions[size])} color={getColor({ color, theme })} />\n </SpinningBox>\n {label && label.trim().length > 0 ? (\n <BaseBox\n marginLeft={labelPosition === 'right' ? 'spacing.3' : 'spacing.0'}\n marginTop={labelPosition === 'bottom' ? 'spacing.3' : 'spacing.0'}\n >\n <Text variant=\"body\" weight=\"regular\" size=\"small\" color=\"surface.text.gray.muted\">\n {label}\n </Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { BaseSpinnerProps };\nexport { BaseSpinner };\n"],"names":["getColor","_ref","color","theme","getIn","colors","concat","BaseSpinner","_ref2","label","_ref2$labelPosition","labelPosition","accessibilityLabel","_ref2$color","_ref2$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","_jsx","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","Spinner","getStyledProps","children","_jsxs","display","alignItems","flexDirection","makeAccessible","role","SpinningBox","SpinnerIcon","dimensions","makeSize","trim","length","marginLeft","marginTop","Text","variant","weight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAqF;AAAA,EAAA,IAA/EC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;AAC9B,EAAA,IAAID,KAAK,IAAIA,KAAK,KAAK,OAAO,EAAE;AAC9B,IAAA,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,EAAE,qCAAqC,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,IAAIH,KAAK,IAAIA,KAAK,KAAK,SAAS,EAAE;IAChC,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,yBAAAC,MAAA,CAAyBJ,KAAK,EAAA,UAAA,CAAU,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,EAAE,oCAAoC,CAAC,CAAA;AAClE,CAAC,CAAA;AAED,IAAME,WAAW,GAAG,SAAdA,WAAWA,CAAAC,KAAA,EAQ2B;AAAA,EAAA,IAP1CC,KAAK,GAAAD,KAAA,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A;MAAAN,QAAA,EAAA,cAEFR,GAAA,CAACe,WAAW,EAAA;QAAAP,QAAA,eACVR,GAAA,CAACgB,WAAW,EAAA;AAACC,UAAAA,UAAU,EAAEC,QAAQ,CAACD,UAAU,CAACxB,IAAI,CAAC,CAAE;UAACb,KAAK,EAAEF,QAAQ,CAAC;AAAEE,YAAAA,KAAK,EAALA,KAAK;AAAEC,YAAAA,KAAK,EAALA,KAAAA;WAAO,CAAA;SAAI,CAAA;AAAC,OAC/E,CAAC,EACbM,KAAK,IAAIA,KAAK,CAACgC,IAAI,EAAE,CAACC,MAAM,GAAG,CAAC,gBAC/BpB,GAAA,CAACC,OAAO,EAAA;AACNoB,QAAAA,UAAU,EAAEhC,aAAa,KAAK,OAAO,GAAG,WAAW,GAAG,WAAY;AAClEiC,QAAAA,SAAS,EAAEjC,aAAa,KAAK,QAAQ,GAAG,WAAW,GAAG,WAAY;QAAAmB,QAAA,eAElER,GAAA,CAACuB,IAAI,EAAA;AAACC,UAAAA,OAAO,EAAC,MAAM;AAACC,UAAAA,MAAM,EAAC,SAAS;AAAChC,UAAAA,IAAI,EAAC,OAAO;AAACb,UAAAA,KAAK,EAAC,yBAAyB;AAAA4B,UAAAA,QAAA,EAC/ErB,KAAAA;SACG,CAAA;OACC,CAAC,GACR,IAAI,CAAA;KACD,CAAA,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -25,7 +25,7 @@ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
|
25
25
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
26
26
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
27
27
|
|
|
28
|
-
var _excluded = ["variant", "size", "children", "icon", "testID"];
|
|
28
|
+
var _excluded = ["variant", "size", "children", "icon", "testID", "iconColor"];
|
|
29
29
|
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; }
|
|
30
30
|
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; }
|
|
31
31
|
var StyledOrderedList = /*#__PURE__*/styled(OrderedList).withConfig({
|
|
@@ -76,6 +76,7 @@ var _List = function _List(_ref3) {
|
|
|
76
76
|
children = _ref3.children,
|
|
77
77
|
icon = _ref3.icon,
|
|
78
78
|
testID = _ref3.testID,
|
|
79
|
+
iconColor = _ref3.iconColor,
|
|
79
80
|
styledProps = _objectWithoutProperties(_ref3, _excluded);
|
|
80
81
|
var ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;
|
|
81
82
|
var _useListContext = useListContext(),
|
|
@@ -86,9 +87,10 @@ var _List = function _List(_ref3) {
|
|
|
86
87
|
level: level ? level + 1 : 1,
|
|
87
88
|
size: size !== null && size !== void 0 ? size : listContextSize,
|
|
88
89
|
icon: icon,
|
|
90
|
+
iconColor: iconColor,
|
|
89
91
|
variant: variant
|
|
90
92
|
};
|
|
91
|
-
}, [icon, level, listContextSize, size, variant]);
|
|
93
|
+
}, [icon, iconColor, level, listContextSize, size, variant]);
|
|
92
94
|
var childrenArray = React__default.Children.toArray(children);
|
|
93
95
|
var childListItems = childrenArray.filter(function (child) {
|
|
94
96
|
if (isValidAllowedChildren(child, MetaConstants.ListItem)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n variant,\n }),\n [icon, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","withConfig","displayName","componentId","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../../../src/components/List/List.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { ListProvider, useListContext } from './ListContext';\nimport { UnorderedList } from './UnorderedList';\nimport { OrderedList } from './OrderedList';\nimport type { ListItemProps } from './ListItem';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { DotNotationSpacingStringToken, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListCommonProps = {\n /**\n * ListItem to be rendered for the List.\n *\n */\n children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];\n /**\n * Sets the variant to be rendered for the List.\n *\n * @default 'unordered'\n */\n variant?: 'unordered' | 'ordered' | 'ordered-filled';\n /**\n * Sets the size for the List.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\ntype ListWithIconProps = ListCommonProps & {\n variant?: 'unordered';\n icon?: IconComponent;\n iconColor?: IconProps['color'];\n};\ntype ListWithoutIconProps = ListCommonProps & {\n variant?: 'ordered' | 'ordered-filled';\n icon?: undefined;\n iconColor?: undefined;\n};\ntype ListProps = ListWithIconProps | ListWithoutIconProps;\n\nconst StyledOrderedList = styled(OrderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\nconst StyledUnorderedList = styled(UnorderedList)<{ marginTop?: DotNotationSpacingStringToken }>(\n ({ marginTop, theme }) => ({\n marginTop: marginTop ? makeSpace(getIn(theme, marginTop)) : undefined,\n }),\n);\n\n/**\n * List Component is used to display a set of related items that are composed of text/links. Each list item begins with a bullet or a number.\n *\n * ## Usage\n *\n * ```tsx\n * <List\n * variant='unordered'\n * size='medium'\n * >\n * <ListItem>\n * Item 1\n * <List>\n * <ListItem>Item 1.1</ListItem>\n * </List>\n * </ListItem>\n * <ListItem>Item 2</ListItem>\n * <List />\n * ```\n */\nconst _List = ({\n variant = 'unordered',\n size,\n children,\n icon,\n testID,\n iconColor,\n ...styledProps\n}: ListProps): React.ReactElement => {\n const ListElement = variant === 'unordered' ? StyledUnorderedList : StyledOrderedList;\n const { level, size: listContextSize } = useListContext();\n const listContextValue = useMemo(\n () => ({\n level: level ? level + 1 : 1,\n size: size ?? listContextSize,\n icon,\n iconColor,\n variant,\n }),\n [icon, iconColor, level, listContextSize, size, variant],\n );\n\n const childrenArray = React.Children.toArray(children);\n const childListItems = childrenArray.filter((child) => {\n if (isValidAllowedChildren(child, MetaConstants.ListItem)) {\n return child;\n }\n if (__DEV__) {\n throwBladeError({\n message: 'You can only pass a ListItem as a child to List.',\n moduleName: 'List',\n });\n }\n return null;\n });\n\n return (\n <ListProvider value={listContextValue}>\n <BaseBox {...getStyledProps(styledProps)}>\n <ListElement\n {...metaAttribute({ name: MetaConstants.List, testID })}\n {...makeAccessible({ role: 'list' })} // Role needed for react-native\n >\n {variant === 'unordered'\n ? childListItems\n : childListItems.map(\n (child, index) =>\n React.cloneElement(child as React.ReactElement, { _itemNumber: index + 1 }), // adds _itemNumber for rendering ordered list bullets\n )}\n </ListElement>\n </BaseBox>\n </ListProvider>\n );\n};\n\nconst List = assignWithoutSideEffects(_List, { componentId: MetaConstants.List });\n\nexport { List };\nexport type { ListProps };\n"],"names":["StyledOrderedList","styled","OrderedList","withConfig","displayName","componentId","_ref","marginTop","theme","makeSpace","getIn","undefined","StyledUnorderedList","UnorderedList","_ref2","_List","_ref3","_ref3$variant","variant","size","children","icon","testID","iconColor","styledProps","_objectWithoutProperties","_excluded","ListElement","_useListContext","useListContext","level","listContextSize","listContextValue","useMemo","childrenArray","React","Children","toArray","childListItems","filter","child","isValidAllowedChildren","MetaConstants","ListItem","throwBladeError","message","moduleName","_jsx","ListProvider","value","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","List","makeAccessible","role","map","index","cloneElement","_itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,IAAMA,iBAAiB,gBAAGC,MAAM,CAACC,WAAW,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,yBAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAC3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAAA,OAAQ;AACzBD,IAAAA,SAAS,EAAEA,SAAS,GAAGE,SAAS,CAACC,KAAK,CAACF,KAAK,EAAED,SAAS,CAAC,CAAC,GAAGI,SAAAA;GAC7D,CAAA;AAAA,CAAC,CACH,CAAA;AAED,IAAMC,mBAAmB,gBAAGX,MAAM,CAACY,aAAa,CAAC,CAAAV,UAAA,CAAA;EAAAC,WAAA,EAAA,2BAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAC/C,UAAAS,KAAA,EAAA;AAAA,EAAA,IAAGP,SAAS,GAAAO,KAAA,CAATP,SAAS;IAAEC,KAAK,GAAAM,KAAA,CAALN,KAAK,CAAA;EAAA,OAAQ;AACzBD,IAAAA,SAAS,EAAEA,SAAS,GAAGE,SAAS,C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AAAA,UAAA,oBACXxB,cAAK,CAACyB,YAAY,CAACpB,KAAK,EAAwB;YAAEqB,WAAW,EAAEF,KAAK,GAAG,CAAA;AAAE,WAAC,CAAC,CAAA;SAAE;AACjF,SAAA;OACO,CAAA,CAAA;KACN,CAAA,CAAA;AAAC,GACE,CAAC,CAAA;AAEnB,CAAC,CAAA;AAED,IAAMJ,IAAI,gBAAGO,wBAAwB,CAAC/C,KAAK,EAAE;EAAEV,WAAW,EAAEqC,aAAa,CAACa,IAAAA;AAAK,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListContext.js","sources":["../../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ListContext.js","sources":["../../../../../../src/components/List/ListContext.ts"],"sourcesContent":["import React from 'react';\nimport type { ListProps } from './List';\nimport type { IconComponent } from '~components/Icons';\n\nexport type ListContextType = {\n level?: number;\n size: NonNullable<ListProps['size']>;\n icon?: IconComponent;\n iconColor?: ListProps['iconColor'];\n variant: NonNullable<ListProps['variant']>;\n};\n\nconst ListContext = React.createContext<ListContextType>({\n level: undefined,\n size: 'medium',\n variant: 'unordered',\n});\nconst ListProvider = ListContext.Provider;\n\nconst useListContext = (): ListContextType => {\n const context = React.useContext(ListContext);\n return context;\n};\n\nexport { useListContext, ListProvider };\n"],"names":["ListContext","React","createContext","level","undefined","size","variant","ListProvider","Provider","useListContext","context","useContext"],"mappings":";;AAYA,IAAMA,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAkB;AACvDC,EAAAA,KAAK,EAAEC,SAAS;AAChBC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,OAAO,EAAE,WAAA;AACX,CAAC,CAAC,CAAA;AACF,IAAMC,YAAY,GAAGP,WAAW,CAACQ,SAAQ;AAEzC,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAA0B;AAC5C,EAAA,IAAMC,OAAO,GAAGT,cAAK,CAACU,UAAU,CAACX,WAAW,CAAC,CAAA;AAC7C,EAAA,OAAOU,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -67,19 +67,23 @@ var ListItemContentChildren = function ListItemContentChildren(_ref2) {
|
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
var _ListItem = function _ListItem(_ref3) {
|
|
70
|
+
var _ref4;
|
|
70
71
|
var children = _ref3.children,
|
|
71
72
|
Icon = _ref3.icon,
|
|
73
|
+
listItemIconColor = _ref3.iconColor,
|
|
72
74
|
_itemNumber = _ref3._itemNumber,
|
|
73
75
|
testID = _ref3.testID;
|
|
74
76
|
var _useListContext = useListContext(),
|
|
75
77
|
level = _useListContext.level,
|
|
76
78
|
size = _useListContext.size,
|
|
77
79
|
ListContextIcon = _useListContext.icon,
|
|
78
|
-
variant = _useListContext.variant
|
|
80
|
+
variant = _useListContext.variant,
|
|
81
|
+
iconColor = _useListContext.iconColor;
|
|
79
82
|
var _useTheme = useTheme(),
|
|
80
83
|
theme = _useTheme.theme,
|
|
81
84
|
platform = _useTheme.platform;
|
|
82
85
|
var ItemIcon = Icon !== null && Icon !== void 0 ? Icon : ListContextIcon;
|
|
86
|
+
var iconColorToken = (_ref4 = listItemIconColor !== null && listItemIconColor !== void 0 ? listItemIconColor : iconColor) !== null && _ref4 !== void 0 ? _ref4 : 'surface.icon.gray.muted';
|
|
83
87
|
if (false) {
|
|
84
88
|
if (level && level > 3) {
|
|
85
89
|
throwBladeError({
|
|
@@ -128,7 +132,7 @@ var _ListItem = function _ListItem(_ref3) {
|
|
|
128
132
|
alignSelf: "flex-start",
|
|
129
133
|
children: ItemIcon ? /*#__PURE__*/jsx(ItemIcon, {
|
|
130
134
|
size: size,
|
|
131
|
-
color:
|
|
135
|
+
color: iconColorToken
|
|
132
136
|
}) : /*#__PURE__*/jsx(UnorderedItemIcon, {
|
|
133
137
|
level: level
|
|
134
138
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color=\"surface.icon.gray.muted\" />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","Icon","icon","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAMA,cAAc,gBAAGC,MAAM,CAACC,eAAe,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAI3C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO,CAAA;EAAA,OAAQ;AAC1CC,IAAAA,UAAU,EAAEJ,KAAK,GACbK,KAAK,CACHJ,KAAK,EACLK,kBAAkB,CAAAC,EAAAA,CAAAA,MAAA,CACbL,OAAO,CAAAK,CAAAA,MAAA,CAAGL,OAAO,KAAK,WAAW,IAAIC,OAAO,GAAG,UAAU,GAAG,EAAE,CAGlE,CAAA,CAACH,KAAK,C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AK,SAAS,GAAGS,IAAI,GAAG,QAAS;AAAAD,UAAAA,QAAA,EAAAH,EAAAA,CAAAA,MAAA,CAE1CsE,wBAAwB,CAAC;AAC3BC,YAAAA,UAAU,EAAEpD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,WAAW,GAAI,CAAC;AAC5B1B,YAAAA,KAAK,EAAEA,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAI,CAAA;WACjB,CAAC,CAAAO,CAAAA,MAAA,CAAGL,OAAO,KAAK,SAAS,GAAG,GAAG,GAAG,EAAE,CAAA;SACjC,CAAA;AAAC,OACA,CACV,eACDW,GAAA,CAACL,uBAAuB,EAAA;AAACG,QAAAA,IAAI,EAAEA,IAAK;AAAAD,QAAAA,QAAA,EAAEgC,cAAAA;AAAc,OAA0B,CAAC,CAAA;KACxE,CAAC,EACTS,SAAS,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMM,QAAQ,gBAAGsB,wBAAwB,CAACzD,SAAS,EAAE;EAAExB,WAAW,EAAE+C,aAAa,CAACY,QAAAA;AAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../../../../../src/components/List/ListItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React from 'react';\nimport { useListContext } from './ListContext';\nimport { UnorderedItemIcon } from './ListItemIcons';\nimport { ListItemElement } from './ListItemElement';\nimport {\n listItemBulletMarginRight,\n listItemBulletMarginTop,\n listItemOrderedBulletBoxSize,\n listItemMarginBottom,\n listItemMarginLeft,\n} from './listTokens';\nimport type { ListProps } from './List';\nimport { getOrderedListItemBullet } from './getOrderedListItemBullet';\nimport getIn from '~utils/lodashButBetter/get';\nimport { Text } from '~components/Typography';\nimport type { IconComponent } from '~components/Icons';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { getPlatformType } from '~utils/getPlatformType';\nimport { throwBladeError } from '~utils/logger';\n\ntype ListItemProps = {\n /**\n * Children to be rendered for ListItem. This can be a text, ListItemLink or another List.\n *\n */\n children: React.ReactNode;\n /**\n * Icon to be rendered for a ListItem's bullet.\n *\n */\n icon?: IconComponent;\n /**\n * Icon color of the ListItem's bullet.\n *\n */\n iconColor?: ListProps['iconColor'];\n /**\n * This is a private prop to be used only for internal logic purposes.\n *\n */\n _itemNumber?: undefined;\n} & TestID;\n\nconst StyledListItem = styled(ListItemElement)<{\n level?: number;\n variant: NonNullable<ListProps['variant']>;\n hasIcon: boolean;\n}>(({ level, theme, variant, hasIcon }) => ({\n marginLeft: level\n ? getIn(\n theme,\n listItemMarginLeft[\n `${variant}${variant === 'unordered' && hasIcon ? 'WithIcon' : ''}` as NonNullable<\n ListProps['variant'] | 'unorderedWithIcon'\n >\n ][level],\n )\n : 0,\n}));\n\nconst ListItemContentChildren = ({\n children,\n size,\n}: {\n children: React.ReactNode[];\n size: NonNullable<ListProps['size']>;\n}): React.ReactElement => {\n /* Having a <View><Text>...</Text><View/> inside <Text /> breaks vertical alignment. Issue: https://github.com/facebook/react-native/issues/31955\n As a workaround, we wrap individual strings in their own <Text /> and handle alignment with a parent <View> (BaseBox).\n */\n return getPlatformType() === 'react-native' ? (\n <BaseBox display=\"flex\" flexDirection=\"row\" flexWrap=\"wrap\">\n {children.map((child, index) => {\n if (typeof child === 'string') {\n return (\n <Text key={index} variant=\"body\" size={size}>\n {child}\n </Text>\n );\n }\n return child;\n })}\n </BaseBox>\n ) : (\n <Text variant=\"body\" size={size}>\n {children}\n </Text>\n );\n};\n\nconst _ListItem = ({\n children,\n icon: Icon,\n iconColor: listItemIconColor,\n _itemNumber,\n testID,\n}: ListItemProps): React.ReactElement => {\n const { level, size, icon: ListContextIcon, variant, iconColor } = useListContext();\n const { theme, platform } = useTheme();\n const ItemIcon = Icon ?? ListContextIcon;\n const iconColorToken = listItemIconColor ?? iconColor ?? 'surface.icon.gray.muted';\n\n if (__DEV__) {\n if (level && level > 3) {\n throwBladeError({\n message: 'List Nesting is allowed only upto 3 levels.',\n moduleName: 'List',\n });\n }\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // Get children that are not a List component and are valid allowed children\n const validChildItem = childrenArray.filter((child) => {\n if (getComponentId(child) === MetaConstants.List) return null;\n\n if (\n typeof child === 'string' ||\n isValidAllowedChildren(child, MetaConstants.ListItemLink) ||\n isValidAllowedChildren(child, MetaConstants.ListItemText) ||\n isValidAllowedChildren(child, MetaConstants.ListItemCode)\n ) {\n return child;\n } else if (__DEV__) {\n throwBladeError({\n message: `You can only pass a List, ListItemLink, ListItemCode, ListItemText or a string as a child to ListItem.`,\n moduleName: 'ListItem',\n });\n }\n return null;\n });\n // Get child that is a List component\n const childList = childrenArray.filter((child) =>\n getComponentId(child) === MetaConstants.List ? child : null,\n );\n const hasIcon = Boolean(ItemIcon);\n\n return (\n <StyledListItem\n level={level}\n variant={variant}\n hasIcon={hasIcon}\n {...metaAttribute({ name: MetaConstants.ListItem, testID })}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginBottom={listItemMarginBottom}\n >\n {variant === 'unordered' ? (\n <BaseBox\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={\n listItemBulletMarginTop[`${variant}${hasIcon ? 'WithIcon' : ''}`][platform][size]\n }\n display=\"flex\"\n alignSelf=\"flex-start\"\n >\n {ItemIcon ? (\n <ItemIcon size={size} color={iconColorToken} />\n ) : (\n <UnorderedItemIcon level={level} />\n )}\n </BaseBox>\n ) : (\n <BaseBox\n width={listItemOrderedBulletBoxSize[variant][platform][size]}\n height={listItemOrderedBulletBoxSize[variant][platform][size]}\n marginRight={listItemBulletMarginRight[variant]}\n marginTop={listItemBulletMarginTop[variant][platform][size]}\n display=\"flex\"\n flexShrink={0}\n justifyContent=\"center\"\n alignSelf=\"flex-start\"\n alignItems=\"center\"\n borderRadius={variant === 'ordered-filled' ? 'max' : undefined}\n backgroundColor={\n variant === 'ordered-filled'\n ? getIn(theme.colors, 'feedback.background.neutral.subtle')\n : undefined\n }\n >\n <Text\n variant=\"body\"\n color=\"surface.text.gray.muted\"\n size={variant === 'ordered' ? size : 'xsmall'}\n >\n {`${getOrderedListItemBullet({\n itemNumber: _itemNumber ?? 1,\n level: level ?? 1,\n })}${variant === 'ordered' ? '.' : ''}`}\n </Text>\n </BaseBox>\n )}\n <ListItemContentChildren size={size}>{validChildItem}</ListItemContentChildren>\n </BaseBox>\n {childList}\n </StyledListItem>\n );\n};\n\nconst ListItem = assignWithoutSideEffects(_ListItem, { componentId: MetaConstants.ListItem });\n\nexport { ListItem };\nexport type { ListItemProps };\n"],"names":["StyledListItem","styled","ListItemElement","withConfig","displayName","componentId","_ref","level","theme","variant","hasIcon","marginLeft","getIn","listItemMarginLeft","concat","ListItemContentChildren","_ref2","children","size","getPlatformType","_jsx","BaseBox","display","flexDirection","flexWrap","map","child","index","Text","_ListItem","_ref3","_ref4","Icon","icon","listItemIconColor","iconColor","_itemNumber","testID","_useListContext","useListContext","ListContextIcon","_useTheme","useTheme","platform","ItemIcon","iconColorToken","throwBladeError","message","moduleName","childrenArray","React","Children","toArray","validChildItem","filter","getComponentId","MetaConstants","List","isValidAllowedChildren","ListItemLink","ListItemText","ListItemCode","childList","Boolean","_jsxs","_objectSpread","metaAttribute","name","ListItem","alignItems","marginBottom","listItemMarginBottom","marginRight","listItemBulletMarginRight","marginTop","listItemBulletMarginTop","alignSelf","color","UnorderedItemIcon","width","listItemOrderedBulletBoxSize","height","flexShrink","justifyContent","borderRadius","undefined","backgroundColor","colors","getOrderedListItemBullet","itemNumber","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA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CAAAA,MAAA,CAAGL,OAAO,KAAK,SAAS,GAAG,GAAG,GAAG,EAAE,CAAA;SACjC,CAAA;AAAC,OACA,CACV,eACDW,GAAA,CAACL,uBAAuB,EAAA;AAACG,QAAAA,IAAI,EAAEA,IAAK;AAAAD,QAAAA,QAAA,EAAEoC,cAAAA;AAAc,OAA0B,CAAC,CAAA;KACxE,CAAC,EACTS,SAAS,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAED,IAAMM,QAAQ,gBAAGsB,wBAAwB,CAAC7D,SAAS,EAAE;EAAExB,WAAW,EAAEmD,aAAa,CAACY,QAAAA;AAAS,CAAC;;;;"}
|
|
@@ -67,9 +67,10 @@ var UnorderedItemIcon = function UnorderedItemIcon(_ref4) {
|
|
|
67
67
|
theme = _useTheme.theme,
|
|
68
68
|
platform = _useTheme.platform;
|
|
69
69
|
var _useListContext = useListContext(),
|
|
70
|
-
size = _useListContext.size
|
|
70
|
+
size = _useListContext.size,
|
|
71
|
+
iconColor = _useListContext.iconColor;
|
|
71
72
|
var iconDimensions = listItemUnorderedBulletSize[platform][size];
|
|
72
|
-
var backgroundToken = theme.colors.surface.text.gray.muted;
|
|
73
|
+
var backgroundToken = iconColor !== null && iconColor !== void 0 ? iconColor : theme.colors.surface.text.gray.muted;
|
|
73
74
|
switch (level) {
|
|
74
75
|
case 1:
|
|
75
76
|
return /*#__PURE__*/jsx(UnorderedLevel1Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIcons.js","sources":["../../../../../../src/components/List/ListItemIcons.tsx"],"sourcesContent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"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C,KAAA,EAA0E;AAAA,EAAA,IAApEnB,cAAc,GAAAmB,KAAA,CAAdnB,cAAc;IAAEC,KAAK,GAAAkB,KAAA,CAALlB,KAAK,CAAA;EAClD,oBACEC,GAAA,CAACC,GAAG,EAAA;AAACC,IAAAA,KAAK,EAAEJ,cAAe;AAACK,IAAAA,MAAM,EAAEL,cAAe;AAACM,IAAAA,OAAO,EAAC,SAAS;AAACC,IAAAA,IAAI,EAAC,MAAM;IAAAC,QAAA,eAC/EN,GAAA,CAACkB,IAAI,EAAA;AACHhB,MAAAA,KAAK,EAAEJ,cAAe;AACtBK,MAAAA,MAAM,EAAEL,cAAe;AACvBqB,MAAAA,EAAE,EAAC,KAAK;AACRd,MAAAA,IAAI,EAAEN,KAAM;MACZY,WAAW,EAAEC,OAAO,CAAC,GAAG,CAAA;KACzB,CAAA;AAAC,GACC,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,IAAMQ,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,KAAA,EAA0D;AAAA,EAAA,IAApDC,KAAK,GAAAD,KAAA,CAALC,KAAK,CAAA;AAChC,EAAA,IAAAC,SAAA,GAA4BC,QAAQ,EAAE;IAA9BC,KAAK,GAAAF,SAAA,CAALE,KAAK;IAAEC,QAAQ,GAAAH,SAAA,CAARG,QAAQ,CAAA;AACvB,EAAA,IAAAC,eAAA,
|
|
1
|
+
{"version":3,"file":"ListItemIcons.js","sources":["../../../../../../src/components/List/ListItemIcons.tsx"],"sourcesContent":["import React from 'react';\nimport { listItemUnorderedBulletSize } from './listTokens';\nimport { useListContext } from './ListContext';\nimport { useTheme } from '~components/BladeProvider';\nimport { Svg, Circle, Rect } from '~components/Icons/_Svg';\nimport { opacity } from '~tokens/global';\n\ntype UnorderedIconProps = {\n iconDimensions: string;\n color: string;\n};\n\nconst UnorderedLevel1Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"3px\" fill={color} fillOpacity={opacity[600]} />\n </Svg>\n );\n};\n\nconst UnorderedLevel2Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Circle cx=\"3px\" cy=\"3px\" r=\"2.5px\" stroke={color} />\n </Svg>\n );\n};\n\nconst UnorderedLevel3Icon = ({ iconDimensions, color }: UnorderedIconProps): React.ReactElement => {\n return (\n <Svg width={iconDimensions} height={iconDimensions} viewBox=\"0 0 6 6\" fill=\"none\">\n <Rect\n width={iconDimensions}\n height={iconDimensions}\n rx=\"1px\"\n fill={color}\n fillOpacity={opacity[600]}\n />\n </Svg>\n );\n};\n\nconst UnorderedItemIcon = ({ level }: { level?: number }): React.ReactElement => {\n const { theme, platform } = useTheme();\n const { size, iconColor } = useListContext();\n const iconDimensions = listItemUnorderedBulletSize[platform][size];\n const backgroundToken = iconColor ?? theme.colors.surface.text.gray.muted;\n\n switch (level) {\n case 1:\n return <UnorderedLevel1Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 2:\n return <UnorderedLevel2Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n case 3:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n default:\n return <UnorderedLevel3Icon iconDimensions={iconDimensions} color={backgroundToken} />;\n }\n};\n\nexport { UnorderedItemIcon };\n"],"names":["UnorderedLevel1Icon","_ref","iconDimensions","color","_jsx","Svg","width","height","viewBox","fill","children","Circle","cx","cy","r","fillOpacity","opacity","UnorderedLevel2Icon","_ref2","stroke","UnorderedLevel3Icon","_ref3","Rect","rx","UnorderedItemIcon","_ref4","level","_useTheme","useTheme","theme","platform","_useListContext","useListContext","size","iconColor","listItemUnorderedBulletSize","backgroundToken","colors","surface","text","gray","muted"],"mappings":";;;;;;;;;;;;;AAYA,IAAMA,mBAAmB,GAAG,SAA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,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA,KAAK,CAAC;MACJ,oBAAOhC,GAAA,CAACa,mBAAmB,EAAA;AAACf,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA,KAAK,CAAC;MACJ,oBAAOhC,GAAA,CAACgB,mBAAmB,EAAA;AAAClB,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AACxF,IAAA;MACE,oBAAOhC,GAAA,CAACgB,mBAAmB,EAAA;AAAClB,QAAAA,cAAc,EAAEA,cAAe;AAACC,QAAAA,KAAK,EAAEiC,eAAAA;AAAgB,OAAE,CAAC,CAAA;AAC1F,GAAA;AACF;;;;"}
|
|
@@ -29,7 +29,7 @@ var getColor = function getColor(_ref) {
|
|
|
29
29
|
var color = _ref.color,
|
|
30
30
|
theme = _ref.theme;
|
|
31
31
|
if (color && color === 'white') {
|
|
32
|
-
return getIn(theme.colors, '
|
|
32
|
+
return getIn(theme.colors, 'interactive.icon.staticWhite.subtle');
|
|
33
33
|
}
|
|
34
34
|
if (color && color !== 'primary') {
|
|
35
35
|
return getIn(theme.colors, "feedback.background.".concat(color, ".intense"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, '
|
|
1
|
+
{"version":3,"file":"BaseSpinner.js","sources":["../../../../../../../src/components/Spinner/BaseSpinner/BaseSpinner.tsx"],"sourcesContent":["import React from 'react';\nimport { dimensions } from './spinnerTokens';\nimport SpinnerIcon from './SpinnerIcon';\nimport { SpinningBox } from './SpinningBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype BaseSpinnerProps = {\n /**\n * Sets the color of the spinner.\n *\n * @default 'default'\n */\n color?: 'primary' | 'white' | FeedbackColors;\n /**\n * Sets the label of the spinner.\n *\n * @default 'right'\n */\n label?: string;\n /**\n * Sets the label of the spinner.\n *\n */\n labelPosition?: 'right' | 'bottom';\n /**\n * Sets the size of the spinner.\n *\n * @default 'medium'\n */\n size?: 'medium' | 'large' | 'xlarge';\n /**\n * Sets the aria-label for web & accessibilityLabel react-native.\n *\n */\n accessibilityLabel: string;\n} & TestID &\n StyledPropsBlade;\n\nconst getColor = ({ color, theme }: { color: BaseSpinnerProps['color']; theme: Theme }): string => {\n if (color && color === 'white') {\n return getIn(theme.colors, 'interactive.icon.staticWhite.subtle');\n }\n if (color && color !== 'primary') {\n return getIn(theme.colors, `feedback.background.${color}.intense`);\n }\n return getIn(theme.colors, 'surface.background.primary.intense');\n};\n\nconst BaseSpinner = ({\n label,\n labelPosition = 'right',\n accessibilityLabel,\n color = 'neutral',\n size = 'medium',\n testID,\n ...styledProps\n}: BaseSpinnerProps): React.ReactElement => {\n const { theme } = useTheme();\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Spinner, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n flexDirection={labelPosition === 'right' ? 'row' : 'column'}\n {...makeAccessible({\n label: accessibilityLabel,\n role: 'progressbar',\n })}\n >\n <SpinningBox>\n <SpinnerIcon dimensions={makeSize(dimensions[size])} color={getColor({ color, theme })} />\n </SpinningBox>\n {label && label.trim().length > 0 ? (\n <BaseBox\n marginLeft={labelPosition === 'right' ? 'spacing.3' : 'spacing.0'}\n marginTop={labelPosition === 'bottom' ? 'spacing.3' : 'spacing.0'}\n >\n <Text variant=\"body\" weight=\"regular\" size=\"small\" color=\"surface.text.gray.muted\">\n {label}\n </Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { BaseSpinnerProps };\nexport { BaseSpinner };\n"],"names":["getColor","_ref","color","theme","getIn","colors","concat","BaseSpinner","_ref2","label","_ref2$labelPosition","labelPosition","accessibilityLabel","_ref2$color","_ref2$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","_jsx","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","Spinner","getStyledProps","children","_jsxs","display","alignItems","flexDirection","makeAccessible","role","SpinningBox","SpinnerIcon","dimensions","makeSize","trim","length","marginLeft","marginTop","Text","variant","weight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAqF;AAAA,EAAA,IAA/EC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;AAC9B,EAAA,IAAID,KAAK,IAAIA,KAAK,KAAK,OAAO,EAAE;AAC9B,IAAA,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,EAAE,qCAAqC,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,IAAIH,KAAK,IAAIA,KAAK,KAAK,SAAS,EAAE;IAChC,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,yBAAAC,MAAA,CAAyBJ,KAAK,EAAA,UAAA,CAAU,CAAC,CAAA;AACpE,GAAA;AACA,EAAA,OAAOE,KAAK,CAACD,KAAK,CAACE,MAAM,EAAE,oCAAoC,CAAC,CAAA;AAClE,CAAC,CAAA;AAED,IAAME,WAAW,GAAG,SAAdA,WAAWA,CAAAC,KAAA,EAQ2B;AAAA,EAAA,IAP1CC,KAAK,GAAAD,KAAA,CAALC,KAAK;IAAAC,mBAAA,GAAAF,KAAA,CACLG,aAAa;AAAbA,IAAAA,aAAa,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,mBAAA;IACvBE,kBAAkB,GAAAJ,KAAA,CAAlBI,kBAAkB;IAAAC,WAAA,GAAAL,KAAA,CAClBN,KAAK;AAALA,IAAAA,KAAK,GAAAW,WAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,WAAA;IAAAC,UAAA,GAA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EACbM,KAAK,IAAIA,KAAK,CAACgC,IAAI,EAAE,CAACC,MAAM,GAAG,CAAC,gBAC/BpB,GAAA,CAACC,OAAO,EAAA;AACNoB,QAAAA,UAAU,EAAEhC,aAAa,KAAK,OAAO,GAAG,WAAW,GAAG,WAAY;AAClEiC,QAAAA,SAAS,EAAEjC,aAAa,KAAK,QAAQ,GAAG,WAAW,GAAG,WAAY;QAAAmB,QAAA,eAElER,GAAA,CAACuB,IAAI,EAAA;AAACC,UAAAA,OAAO,EAAC,MAAM;AAACC,UAAAA,MAAM,EAAC,SAAS;AAAChC,UAAAA,IAAI,EAAC,OAAO;AAACb,UAAAA,KAAK,EAAC,yBAAyB;AAAA4B,UAAAA,QAAA,EAC/ErB,KAAAA;SACG,CAAA;OACC,CAAC,GACR,IAAI,CAAA;KACD,CAAA,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -8816,13 +8816,18 @@ type ListItemProps = {
|
|
|
8816
8816
|
*
|
|
8817
8817
|
*/
|
|
8818
8818
|
icon?: IconComponent;
|
|
8819
|
+
/**
|
|
8820
|
+
* Icon color of the ListItem's bullet.
|
|
8821
|
+
*
|
|
8822
|
+
*/
|
|
8823
|
+
iconColor?: ListProps['iconColor'];
|
|
8819
8824
|
/**
|
|
8820
8825
|
* This is a private prop to be used only for internal logic purposes.
|
|
8821
8826
|
*
|
|
8822
8827
|
*/
|
|
8823
8828
|
_itemNumber?: undefined;
|
|
8824
8829
|
} & TestID;
|
|
8825
|
-
declare const ListItem: ({ children, icon: Icon, _itemNumber, testID, }: ListItemProps) => React__default.ReactElement;
|
|
8830
|
+
declare const ListItem: ({ children, icon: Icon, iconColor: listItemIconColor, _itemNumber, testID, }: ListItemProps) => React__default.ReactElement;
|
|
8826
8831
|
|
|
8827
8832
|
type ListCommonProps = {
|
|
8828
8833
|
/**
|
|
@@ -8846,13 +8851,15 @@ type ListCommonProps = {
|
|
|
8846
8851
|
type ListWithIconProps = ListCommonProps & {
|
|
8847
8852
|
variant?: 'unordered';
|
|
8848
8853
|
icon?: IconComponent;
|
|
8854
|
+
iconColor?: IconProps['color'];
|
|
8849
8855
|
};
|
|
8850
8856
|
type ListWithoutIconProps = ListCommonProps & {
|
|
8851
8857
|
variant?: 'ordered' | 'ordered-filled';
|
|
8852
8858
|
icon?: undefined;
|
|
8859
|
+
iconColor?: undefined;
|
|
8853
8860
|
};
|
|
8854
8861
|
type ListProps = ListWithIconProps | ListWithoutIconProps;
|
|
8855
|
-
declare const List: ({ variant, size, children, icon, testID, ...styledProps }: ListProps) => React__default.ReactElement;
|
|
8862
|
+
declare const List: ({ variant, size, children, icon, testID, iconColor, ...styledProps }: ListProps) => React__default.ReactElement;
|
|
8856
8863
|
|
|
8857
8864
|
type ListItemLinkProps = Exclude<LinkProps, 'size' | 'variant' | 'isDisabled'>;
|
|
8858
8865
|
declare const ListItemLink: ({ accessibilityLabel, children, href, icon, iconPosition, onClick, rel, target, testID, }: ListItemLinkProps) => React.ReactElement;
|
|
@@ -6797,13 +6797,18 @@ type ListItemProps = {
|
|
|
6797
6797
|
*
|
|
6798
6798
|
*/
|
|
6799
6799
|
icon?: IconComponent;
|
|
6800
|
+
/**
|
|
6801
|
+
* Icon color of the ListItem's bullet.
|
|
6802
|
+
*
|
|
6803
|
+
*/
|
|
6804
|
+
iconColor?: ListProps['iconColor'];
|
|
6800
6805
|
/**
|
|
6801
6806
|
* This is a private prop to be used only for internal logic purposes.
|
|
6802
6807
|
*
|
|
6803
6808
|
*/
|
|
6804
6809
|
_itemNumber?: undefined;
|
|
6805
6810
|
} & TestID;
|
|
6806
|
-
declare const ListItem: ({ children, icon: Icon, _itemNumber, testID, }: ListItemProps) => React__default.ReactElement;
|
|
6811
|
+
declare const ListItem: ({ children, icon: Icon, iconColor: listItemIconColor, _itemNumber, testID, }: ListItemProps) => React__default.ReactElement;
|
|
6807
6812
|
|
|
6808
6813
|
type ListCommonProps = {
|
|
6809
6814
|
/**
|
|
@@ -6827,13 +6832,15 @@ type ListCommonProps = {
|
|
|
6827
6832
|
type ListWithIconProps = ListCommonProps & {
|
|
6828
6833
|
variant?: 'unordered';
|
|
6829
6834
|
icon?: IconComponent;
|
|
6835
|
+
iconColor?: IconProps['color'];
|
|
6830
6836
|
};
|
|
6831
6837
|
type ListWithoutIconProps = ListCommonProps & {
|
|
6832
6838
|
variant?: 'ordered' | 'ordered-filled';
|
|
6833
6839
|
icon?: undefined;
|
|
6840
|
+
iconColor?: undefined;
|
|
6834
6841
|
};
|
|
6835
6842
|
type ListProps = ListWithIconProps | ListWithoutIconProps;
|
|
6836
|
-
declare const List: ({ variant, size, children, icon, testID, ...styledProps }: ListProps) => React__default.ReactElement;
|
|
6843
|
+
declare const List: ({ variant, size, children, icon, testID, iconColor, ...styledProps }: ListProps) => React__default.ReactElement;
|
|
6837
6844
|
|
|
6838
6845
|
type ListItemLinkProps = Exclude<LinkProps, 'size' | 'variant' | 'isDisabled'>;
|
|
6839
6846
|
declare const ListItemLink: ({ accessibilityLabel, children, href, icon, iconPosition, onClick, rel, target, testID, }: ListItemLinkProps) => React.ReactElement;
|