@razorpay/blade 11.6.3 → 11.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/build/lib/native/components/Accordion/Accordion.js +2 -2
  2. package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
  3. package/build/lib/native/components/Accordion/AccordionButton.native.js +2 -2
  4. package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
  5. package/build/lib/native/components/Accordion/AccordionContext.js +2 -2
  6. package/build/lib/native/components/Accordion/AccordionContext.js.map +1 -1
  7. package/build/lib/native/components/Accordion/AccordionItem.js +11 -14
  8. package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
  9. package/build/lib/native/components/Accordion/AccordionItemBody.js +24 -0
  10. package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -0
  11. package/build/lib/native/components/Accordion/AccordionItemHeader.js +24 -0
  12. package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -0
  13. package/build/lib/native/components/Accordion/commonStyles.js +1 -1
  14. package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
  15. package/build/lib/native/components/Accordion/componentIds.js +4 -0
  16. package/build/lib/native/components/Accordion/componentIds.js.map +1 -0
  17. package/build/lib/native/components/ActionList/ActionListBox.native.js +1 -4
  18. package/build/lib/native/components/ActionList/ActionListBox.native.js.map +1 -1
  19. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
  20. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  21. package/build/lib/native/components/Button/BaseButton/AnimatedButtonContent.native.js +16 -0
  22. package/build/lib/native/components/Button/BaseButton/AnimatedButtonContent.native.js.map +1 -0
  23. package/build/lib/native/components/Button/BaseButton/BaseButton.js +7 -5
  24. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  25. package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js +1 -1
  26. package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js.map +1 -1
  27. package/build/lib/native/components/ButtonGroup/ButtonGroup.native.js +7 -0
  28. package/build/lib/native/components/ButtonGroup/ButtonGroup.native.js.map +1 -0
  29. package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js +6 -0
  30. package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
  31. package/build/lib/native/components/Collapsible/CollapsibleBodyContent.native.js.map +1 -1
  32. package/build/lib/native/components/index.js +3 -0
  33. package/build/lib/native/components/index.js.map +1 -1
  34. package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
  35. package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
  36. package/build/lib/web/development/components/Accordion/Accordion.js +57 -6
  37. package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
  38. package/build/lib/web/development/components/Accordion/AccordionButton.web.js +21 -25
  39. package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
  40. package/build/lib/web/development/components/Accordion/AccordionContext.js +16 -1
  41. package/build/lib/web/development/components/Accordion/AccordionContext.js.map +1 -1
  42. package/build/lib/web/development/components/Accordion/AccordionItem.js +66 -66
  43. package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
  44. package/build/lib/web/development/components/Accordion/AccordionItemBody.js +84 -0
  45. package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -0
  46. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +71 -0
  47. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -0
  48. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js +3 -2
  49. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  50. package/build/lib/web/development/components/Accordion/commonStyles.js +8 -6
  51. package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
  52. package/build/lib/web/development/components/Accordion/componentIds.js +8 -0
  53. package/build/lib/web/development/components/Accordion/componentIds.js.map +1 -0
  54. package/build/lib/web/development/components/Accordion/index.js +2 -0
  55. package/build/lib/web/development/components/Accordion/index.js.map +1 -1
  56. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +131 -68
  57. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  58. package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
  59. package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
  60. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +116 -66
  61. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  62. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +158 -0
  63. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
  64. package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js +11 -0
  65. package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
  66. package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js +47 -0
  67. package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
  68. package/build/lib/web/development/components/ButtonGroup/index.js +2 -0
  69. package/build/lib/web/development/components/ButtonGroup/index.js.map +1 -0
  70. package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
  71. package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
  72. package/build/lib/web/development/components/index.js +4 -0
  73. package/build/lib/web/development/components/index.js.map +1 -1
  74. package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -0
  75. package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
  76. package/build/lib/web/production/components/Accordion/Accordion.js +57 -6
  77. package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
  78. package/build/lib/web/production/components/Accordion/AccordionButton.web.js +21 -25
  79. package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
  80. package/build/lib/web/production/components/Accordion/AccordionContext.js +16 -1
  81. package/build/lib/web/production/components/Accordion/AccordionContext.js.map +1 -1
  82. package/build/lib/web/production/components/Accordion/AccordionItem.js +66 -66
  83. package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
  84. package/build/lib/web/production/components/Accordion/AccordionItemBody.js +84 -0
  85. package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -0
  86. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +71 -0
  87. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -0
  88. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +3 -2
  89. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  90. package/build/lib/web/production/components/Accordion/commonStyles.js +8 -6
  91. package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
  92. package/build/lib/web/production/components/Accordion/componentIds.js +8 -0
  93. package/build/lib/web/production/components/Accordion/componentIds.js.map +1 -0
  94. package/build/lib/web/production/components/Accordion/index.js +2 -0
  95. package/build/lib/web/production/components/Accordion/index.js.map +1 -1
  96. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +131 -68
  97. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  98. package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
  99. package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
  100. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +116 -66
  101. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  102. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +158 -0
  103. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
  104. package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js +11 -0
  105. package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
  106. package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js +47 -0
  107. package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
  108. package/build/lib/web/production/components/ButtonGroup/index.js +2 -0
  109. package/build/lib/web/production/components/ButtonGroup/index.js.map +1 -0
  110. package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
  111. package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
  112. package/build/lib/web/production/components/index.js +4 -0
  113. package/build/lib/web/production/components/index.js.map +1 -1
  114. package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -0
  115. package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
  116. package/build/types/components/index.d.ts +1120 -965
  117. package/build/types/components/index.native.d.ts +1091 -962
  118. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { useState, useCallback, useMemo, Children, cloneElement } from 'react';
3
+ import { useState, Children, useCallback, useMemo, cloneElement } from 'react';
4
4
  import { AccordionContext } from './AccordionContext.js';
5
5
  import { MAX_WIDTH } from './styles.native.js';
6
6
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
@@ -15,7 +15,7 @@ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js
15
15
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
16
16
  import { jsx } from 'react/jsx-runtime';
17
17
 
18
- var _excluded=["defaultExpandedIndex","expandedIndex","onExpandChange","showNumberPrefix","children","testID"];var MIN_WIDTH={s:makeSize(size[200]),m:makeSize(size[360]),l:makeSize(size[360])};var Accordion=function Accordion(_ref){var defaultExpandedIndex=_ref.defaultExpandedIndex,expandedIndex=_ref.expandedIndex,onExpandChange=_ref.onExpandChange,_ref$showNumberPrefix=_ref.showNumberPrefix,showNumberPrefix=_ref$showNumberPrefix===void 0?false:_ref$showNumberPrefix,children=_ref.children,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useState=useState(defaultExpandedIndex),_useState2=_slicedToArray(_useState,2),expandedAccordionItemIndex=_useState2[0],setExpandedAccordionItemIndex=_useState2[1];var handleExpandChange=useCallback(function(nextExpandedIndex){if(typeof expandedIndex!=='undefined'){onExpandChange==null?void 0:onExpandChange({expandedIndex:nextExpandedIndex});}else {setExpandedAccordionItemIndex(nextExpandedIndex);onExpandChange==null?void 0:onExpandChange({expandedIndex:nextExpandedIndex});}},[onExpandChange,expandedIndex]);var accordionContext=useMemo(function(){return {expandedIndex:expandedIndex!=null?expandedIndex:expandedAccordionItemIndex,defaultExpandedIndex:defaultExpandedIndex,onExpandChange:handleExpandChange,showNumberPrefix:showNumberPrefix};},[expandedAccordionItemIndex,handleExpandChange,expandedIndex,showNumberPrefix,defaultExpandedIndex]);return jsx(AccordionContext.Provider,{value:accordionContext,children:jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Accordion,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{minWidth:MIN_WIDTH,maxWidth:MAX_WIDTH,width:"100%",children:Children.map(children,function(child,index){return cloneElement(child,{_index:index,key:index});})})}))});};
18
+ var _excluded=["defaultExpandedIndex","expandedIndex","onExpandChange","showNumberPrefix","children","variant","size","testID"];var MIN_WIDTH={s:makeSize(size[200]),m:makeSize(size[360]),l:makeSize(size[360])};var getVariantStyles=function getVariantStyles(variant){if(variant==='transparent'){return {};}return {backgroundColor:'surface.background.gray.intense',borderRadius:'medium',borderWidth:'thinner',borderColor:'surface.border.gray.subtle'};};var Accordion=function Accordion(_ref){var defaultExpandedIndex=_ref.defaultExpandedIndex,expandedIndex=_ref.expandedIndex,onExpandChange=_ref.onExpandChange,_ref$showNumberPrefix=_ref.showNumberPrefix,showNumberPrefix=_ref$showNumberPrefix===void 0?false:_ref$showNumberPrefix,children=_ref.children,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'transparent':_ref$variant,_ref$size=_ref.size,size=_ref$size===void 0?'large':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useState=useState(defaultExpandedIndex),_useState2=_slicedToArray(_useState,2),expandedAccordionItemIndex=_useState2[0],setExpandedAccordionItemIndex=_useState2[1];var numberOfItems=Children.count(children);var handleExpandChange=useCallback(function(nextExpandedIndex){if(typeof expandedIndex!=='undefined'){onExpandChange==null?void 0:onExpandChange({expandedIndex:nextExpandedIndex});}else {setExpandedAccordionItemIndex(nextExpandedIndex);onExpandChange==null?void 0:onExpandChange({expandedIndex:nextExpandedIndex});}},[onExpandChange,expandedIndex]);var accordionContext=useMemo(function(){return {expandedIndex:expandedIndex!=null?expandedIndex:expandedAccordionItemIndex,defaultExpandedIndex:defaultExpandedIndex,onExpandChange:handleExpandChange,showNumberPrefix:showNumberPrefix,variant:variant,numberOfItems:numberOfItems,size:size};},[expandedAccordionItemIndex,handleExpandChange,expandedIndex,showNumberPrefix,defaultExpandedIndex,variant,numberOfItems,size]);return jsx(AccordionContext.Provider,{value:accordionContext,children:jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Accordion,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,Object.assign({},getVariantStyles(variant),{minWidth:MIN_WIDTH,maxWidth:MAX_WIDTH,width:"100%",children:Children.map(children,function(child,index){return cloneElement(child,{_index:index,key:index});})}))}))});};
19
19
 
20
20
  export { Accordion };
21
21
  //# sourceMappingURL=Accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { useCallback, useMemo, useState, cloneElement, Children } from 'react';\nimport type { AccordionContextState } from './AccordionContext';\nimport { AccordionContext } from './AccordionContext';\nimport { MAX_WIDTH } from './styles';\nimport { BaseBox } from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { BoxProps } from '~components/Box';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\ntype AccordionProps = {\n /**\n * Makes the passed item index expanded by default (uncontrolled)\n */\n defaultExpandedIndex?: number;\n\n /**\n * Expands the passed index (controlled), `-1` implies no expanded items\n */\n expandedIndex?: number;\n\n /**\n * Callback for change in any item's expanded state,\n * `-1` implies no expanded items\n */\n onExpandChange?: ({ expandedIndex }: { expandedIndex: number }) => void;\n\n /**\n * Adds numeric index at the beginning of items\n *\n * @default false\n */\n showNumberPrefix?: boolean;\n\n /**\n * Accepts `AccordionItem` child nodes\n */\n children: ReactElement | ReactElement[];\n} & TestID &\n StyledPropsBlade;\n\nconst MIN_WIDTH: BoxProps['minWidth'] = {\n s: makeSize(size[200]),\n m: makeSize(size[360]),\n l: makeSize(size[360]),\n};\n\nconst Accordion = ({\n defaultExpandedIndex,\n expandedIndex,\n onExpandChange,\n showNumberPrefix = false,\n children,\n testID,\n ...styledProps\n}: AccordionProps): ReactElement => {\n const [expandedAccordionItemIndex, setExpandedAccordionItemIndex] = useState<number | undefined>(\n defaultExpandedIndex,\n );\n\n const handleExpandChange = useCallback(\n (nextExpandedIndex: number) => {\n if (typeof expandedIndex !== 'undefined') {\n // controlled\n onExpandChange?.({ expandedIndex: nextExpandedIndex });\n } else {\n // uncontrolled\n setExpandedAccordionItemIndex(nextExpandedIndex);\n onExpandChange?.({ expandedIndex: nextExpandedIndex });\n }\n },\n [onExpandChange, expandedIndex],\n );\n\n const accordionContext = useMemo<AccordionContextState>(\n () => ({\n expandedIndex: expandedIndex ?? expandedAccordionItemIndex,\n defaultExpandedIndex,\n onExpandChange: handleExpandChange,\n showNumberPrefix,\n }),\n [\n expandedAccordionItemIndex,\n handleExpandChange,\n expandedIndex,\n showNumberPrefix,\n defaultExpandedIndex,\n ],\n );\n\n return (\n <AccordionContext.Provider value={accordionContext}>\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Accordion, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox minWidth={MIN_WIDTH} maxWidth={MAX_WIDTH} width=\"100%\">\n {Children.map(children, (child, index) =>\n cloneElement(child, { _index: index, key: index }),\n )}\n </BaseBox>\n </BaseBox>\n </AccordionContext.Provider>\n );\n};\n\nexport type { AccordionProps };\nexport { Accordion };\n"],"names":["MIN_WIDTH","s","makeSize","size","m","l","Accordion","_ref","defaultExpandedIndex","expandedIndex","onExpandChange","_ref$showNumberPrefix","showNumberPrefix","children","testID","styledProps","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","expandedAccordionItemIndex","setExpandedAccordionItemIndex","handleExpandChange","useCallback","nextExpandedIndex","accordionContext","useMemo","_jsx","AccordionContext","Provider","value","BaseBox","Object","assign","metaAttribute","name","MetaConstants","getStyledProps","minWidth","maxWidth","MAX_WIDTH","width","Children","map","child","index","cloneElement","_index","key"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,gBAAA,CAAA,kBAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CA4CA,IAAMA,SAA+B,CAAG,CACtCC,CAAC,CAAEC,QAAQ,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,CACtBC,CAAC,CAAEF,QAAQ,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,CACtBE,CAAC,CAAEH,QAAQ,CAACC,IAAI,CAAC,GAAG,CAAC,CACvB,CAAC,CAEK,IAAAG,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAQqB,KAPlCC,oBAAoB,CAAAD,IAAA,CAApBC,oBAAoB,CACpBC,aAAa,CAAAF,IAAA,CAAbE,aAAa,CACbC,cAAc,CAAAH,IAAA,CAAdG,cAAc,CAAAC,qBAAA,CAAAJ,IAAA,CACdK,gBAAgB,CAAhBA,gBAAgB,CAAAD,qBAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,qBAAA,CACxBE,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CAC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EC,IAAI,CAAEC,aAAa,CAAChC,SAAS,CAAEQ,MAAM,CAANA,MAAO,CAAC,CAAC,CACxDyB,cAAc,CAACxB,WAAW,CAAC,EAAAF,QAAA,CAE/BgB,GAAA,CAACI,OAAO,EAACO,QAAQ,CAAExC,SAAU,CAACyC,QAAQ,CAAEC,SAAU,CAACC,KAAK,CAAC,MAAM,CAAA9B,QAAA,CAC5D+B,QAAQ,CAACC,GAAG,CAAChC,QAAQ,CAAE,SAACiC,KAAK,CAAEC,KAAK,CAAA,CAAA,OACnCC,YAAY,CAACF,KAAK,CAAE,CAAEG,MAAM,CAAEF,KAAK,CAAEG,GAAG,CAAEH,KAAM,CAAC,CAAC,CACpD,CAAA,CAAC,CACM,CAAC,CAAA,CACH,CAAC,CACe,CAAC,CAEhC;;;;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { useCallback, useMemo, useState, cloneElement, Children } from 'react';\nimport type { AccordionContextState } from './AccordionContext';\nimport { AccordionContext } from './AccordionContext';\nimport { MAX_WIDTH } from './styles';\nimport type { AccordionProps } from './types';\nimport { BaseBox } from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { BoxProps } from '~components/Box';\nimport { size as sizeTokens } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst MIN_WIDTH: BoxProps['minWidth'] = {\n s: makeSize(sizeTokens[200]),\n m: makeSize(sizeTokens[360]),\n l: makeSize(sizeTokens[360]),\n};\n\nconst getVariantStyles = (variant: AccordionProps['variant']): BoxProps => {\n if (variant === 'transparent') {\n return {};\n }\n\n return {\n backgroundColor: 'surface.background.gray.intense',\n borderRadius: 'medium',\n borderWidth: 'thinner',\n borderColor: 'surface.border.gray.subtle',\n };\n};\n\n/**\n * # Accordion\n *\n * An accordion is used to allow users to toggle between different content sections in a compact vertical stack.\n *\n * ## Usage\n *\n * ```jsx\n * <Accordion>\n * <AccordionItem>\n * <AccordionItemHeader title=\"Title\" />\n * <AccordionItemBody>\n * <Text color=\"surface.text.gray.subtle\">\n * Hello this is accordion body content\n * </Text>\n * </AccordionItemBody>\n * </AccordionItem>\n * <AccordionItem>\n * <AccordionItemHeader title=\"Title\" />\n * <AccordionItemBody>\n * <Text color=\"surface.text.gray.subtle\">\n * Hello this is accordion body content\n * </Text>\n * </AccordionItemBody>\n * </AccordionItem>\n * </Accordion>\n * ```\n *\n * Checkout https://blade.razorpay.com/?path=/docs/components-accordion--docs\n *\n */\nconst Accordion = ({\n defaultExpandedIndex,\n expandedIndex,\n onExpandChange,\n showNumberPrefix = false,\n children,\n variant = 'transparent',\n size = 'large',\n testID,\n ...styledProps\n}: AccordionProps): ReactElement => {\n const [expandedAccordionItemIndex, setExpandedAccordionItemIndex] = useState<number | undefined>(\n defaultExpandedIndex,\n );\n\n const numberOfItems = Children.count(children);\n\n const handleExpandChange = useCallback(\n (nextExpandedIndex: number) => {\n if (typeof expandedIndex !== 'undefined') {\n // controlled\n onExpandChange?.({ expandedIndex: nextExpandedIndex });\n } else {\n // uncontrolled\n setExpandedAccordionItemIndex(nextExpandedIndex);\n onExpandChange?.({ expandedIndex: nextExpandedIndex });\n }\n },\n [onExpandChange, expandedIndex],\n );\n\n const accordionContext = useMemo<AccordionContextState>(\n () => ({\n expandedIndex: expandedIndex ?? expandedAccordionItemIndex,\n defaultExpandedIndex,\n onExpandChange: handleExpandChange,\n showNumberPrefix,\n variant,\n numberOfItems,\n size,\n }),\n [\n expandedAccordionItemIndex,\n handleExpandChange,\n expandedIndex,\n showNumberPrefix,\n defaultExpandedIndex,\n variant,\n numberOfItems,\n size,\n ],\n );\n\n return (\n <AccordionContext.Provider value={accordionContext}>\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Accordion, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n {...getVariantStyles(variant)}\n minWidth={MIN_WIDTH}\n maxWidth={MAX_WIDTH}\n width=\"100%\"\n >\n {Children.map(children, (child, index) =>\n cloneElement(child, { _index: index, key: index }),\n )}\n </BaseBox>\n </BaseBox>\n </AccordionContext.Provider>\n );\n};\n\nexport { Accordion };\n"],"names":["MIN_WIDTH","s","makeSize","sizeTokens","m","l","getVariantStyles","variant","backgroundColor","borderRadius","borderWidth","borderColor","Accordion","_ref","defaultExpandedIndex","expandedIndex","onExpandChange","_ref$showNumberPrefix","showNumberPrefix","children","_ref$variant","_ref$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","expandedAccordionItemIndex","setExpandedAccordionItemIndex","numberOfItems","Children","count","handleExpandChange","useCallback","nextExpandedIndex","accordionContext","useMemo","_jsx","AccordionContext","Provider","value","BaseBox","Object","assign","metaAttribute","name","MetaConstants","getStyledProps","minWidth","maxWidth","MAX_WIDTH","width","map","child","index","cloneElement","_index","key"],"mappings":";;;;;;;;;;;;;;;;;gIAaA,IAAMA,SAA+B,CAAG,CACtCC,CAAC,CAAEC,QAAQ,CAACC,IAAU,CAAC,GAAG,CAAC,CAAC,CAC5BC,CAAC,CAAEF,QAAQ,CAACC,IAAU,CAAC,GAAG,CAAC,CAAC,CAC5BE,CAAC,CAAEH,QAAQ,CAACC,IAAU,CAAC,GAAG,CAAC,CAC7B,CAAC,CAED,IAAMG,gBAAgB,CAAG,SAAnBA,gBAAgBA,CAAIC,OAAkC,CAAe,CACzE,GAAIA,OAAO,GAAK,aAAa,CAAE,CAC7B,OAAO,EAAE,CACX,CAEA,OAAO,CACLC,eAAe,CAAE,iCAAiC,CAClDC,YAAY,CAAE,QAAQ,CACtBC,WAAW,CAAE,SAAS,CACtBC,WAAW,CAAE,4BACf,CAAC,CACH,CAAC,CAiCK,IAAAC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAUqB,KATlCC,oBAAoB,CAAAD,IAAA,CAApBC,oBAAoB,CACpBC,aAAa,CAAAF,IAAA,CAAbE,aAAa,C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iming } from 'react-native-reani
3
3
  import { StyledAccordionButton } from './StyledAccordionButton.native.js';
4
4
  import { useAccordion } from './AccordionContext.js';
5
5
  import { getTransitionDuration, getTransitionEasing, getBackgroundColor } from './commonStyles.js';
6
+ import { AccordionItemHeader } from './AccordionItemHeader.js';
6
7
  import '@babel/runtime/helpers/objectWithoutProperties';
7
8
  import '../Typography/BaseText/BaseText.native.js';
8
9
  import { throwBladeError } from '../../utils/logger/logger.js';
@@ -19,7 +20,6 @@ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/a
19
20
  import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
20
21
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
21
22
  import { useCollapsible } from '../Collapsible/CollapsibleContext.js';
22
- import { CollapsibleChevronIcon } from '../Collapsible/CollapsibleChevronIcon.native.js';
23
23
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
24
24
  import 'styled-components/native';
25
25
  import '@gorhom/portal';
@@ -27,7 +27,7 @@ import 'react-native-gesture-handler';
27
27
  import '../BottomSheet/BottomSheetStack.js';
28
28
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
29
29
 
30
- var _AccordionButton=function _AccordionButton(_ref){var index=_ref.index,Icon=_ref.icon,children=_ref.children;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var _useAccordion=useAccordion(),showNumberPrefix=_useAccordion.showNumberPrefix,expandedIndex=_useAccordion.expandedIndex;var _useTheme=useTheme(),theme=_useTheme.theme;var toggleCollapse=function toggleCollapse(){return onExpandChange(!isExpanded);};var isItemExpanded=expandedIndex===index;var isPressed=useSharedValue(false);var duration=castNativeType(getTransitionDuration(theme));var easing=castNativeType(getTransitionEasing(theme));var activeBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true}));var inActiveBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false}));useEffect(function(){activeBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true});inActiveBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false});},[isExpanded,activeBackgroundColor,inActiveBackgroundColor,theme]);var animatedStyles=useAnimatedStyle(function(){return {backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};});var _showNumberPrefix=typeof index==='number'&&showNumberPrefix;var _index=_showNumberPrefix?jsxs(Text,{size:"large",weight:"semibold",marginRight:"spacing.2",children:[index+1,"."]}):null;var a11yLabel=_showNumberPrefix?`${index+1}. ${children}`:children;var renderChildren=function renderChildren(_ref2){var pressed=_ref2.pressed;isPressed.value=pressed;var iconColor=pressed||isExpanded?'interactive.icon.gray.subtle':'interactive.icon.gray.muted';var _icon=Icon&&jsx(Icon,{size:"medium",color:"surface.icon.gray.muted",marginRight:"spacing.3",marginY:"spacing.2"});if(__DEV__){if(_index&&_icon){throwBladeError({message:"showNumberPrefix and icon shouldn't be used together",moduleName:'Accordion'});}}return jsxs(BaseBox,{display:"flex",flexDirection:"row",flex:1,justifyContent:"space-between",alignItems:"center",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"flex-start",marginRight:"spacing.5",flexShrink:1,children:[_index,_icon,jsx(Text,{size:"large",weight:"semibold",children:children})]}),jsx(BaseBox,{children:jsx(CollapsibleChevronIcon,{color:iconColor,size:"large"})})]});};return jsx(StyledAccordionButton,Object.assign({isExpanded:isExpanded,onPress:toggleCollapse,style:animatedStyles},makeAccessible({role:'button',expanded:isItemExpanded,controls:collapsibleBodyId,label:a11yLabel}),metaAttribute({name:MetaConstants.AccordionButton}),{children:renderChildren}));};var AccordionButton=assignWithoutSideEffects(_AccordionButton,{componentId:MetaConstants.AccordionButton});
30
+ var _AccordionButton=function _AccordionButton(_ref){var index=_ref.index,Icon=_ref.icon,title=_ref.title,isDeprecatedAPI=_ref.isDeprecatedAPI,isDisabled=_ref.isDisabled,header=_ref.header;var _useCollapsible=useCollapsible(),onExpandChange=_useCollapsible.onExpandChange,isExpanded=_useCollapsible.isExpanded,collapsibleBodyId=_useCollapsible.collapsibleBodyId;var _useAccordion=useAccordion(),showNumberPrefix=_useAccordion.showNumberPrefix,expandedIndex=_useAccordion.expandedIndex;var _useTheme=useTheme(),theme=_useTheme.theme;var toggleCollapse=function toggleCollapse(){return onExpandChange(!isExpanded);};var isItemExpanded=expandedIndex===index;var isPressed=useSharedValue(false);var duration=castNativeType(getTransitionDuration(theme));var easing=castNativeType(getTransitionEasing(theme));var activeBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true}));var inActiveBackgroundColor=useSharedValue(getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false}));useEffect(function(){activeBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:true});inActiveBackgroundColor.value=getBackgroundColor({theme:theme,isExpanded:isExpanded,isActive:false});},[isExpanded,activeBackgroundColor,inActiveBackgroundColor,theme]);var animatedStyles=useAnimatedStyle(function(){return {backgroundColor:withTiming(isPressed.value?activeBackgroundColor.value:inActiveBackgroundColor.value,{duration:duration,easing:easing})};});var _showNumberPrefix=typeof index==='number'&&showNumberPrefix;var _index=_showNumberPrefix?jsxs(Text,{size:"large",weight:"semibold",marginRight:"spacing.2",children:[index+1,"."]}):null;var a11yLabel=_showNumberPrefix?`${index+1}. ${title}`:title;var renderChildren=function renderChildren(_ref2){var pressed=_ref2.pressed;isPressed.value=pressed;var _icon=Icon&&jsx(Icon,{size:"medium",color:"surface.icon.gray.normal",marginRight:"spacing.3",marginY:"spacing.2"});if(__DEV__){if(_index&&_icon){throwBladeError({message:"showNumberPrefix and icon shouldn't be used together",moduleName:'Accordion'});}}return jsx(BaseBox,{display:"flex",flexDirection:"row",flex:1,justifyContent:"space-between",alignItems:"center",children:isDeprecatedAPI?jsx(AccordionItemHeader,{title:title,leading:_icon!=null?_icon:_index}):header});};return jsx(StyledAccordionButton,Object.assign({isExpanded:isExpanded,onPress:toggleCollapse,style:animatedStyles,disabled:isDisabled},makeAccessible({role:'button',expanded:isItemExpanded,controls:collapsibleBodyId,label:a11yLabel}),metaAttribute({name:MetaConstants.AccordionButton}),{children:renderChildren}));};var AccordionButton=assignWithoutSideEffects(_AccordionButton,{componentId:MetaConstants.AccordionButton});
31
31
 
32
32
  export { AccordionButton };
33
33
  //# sourceMappingURL=AccordionButton.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionButton.native.js","sources":["../../../../../src/components/Accordion/AccordionButton.native.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { useEffect } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { StyledAccordionButton } from './StyledAccordionButton.native';\nimport type { AccordionButtonProps } from './types';\nimport { useAccordion } from './AccordionContext';\nimport { getBackgroundColor, getTransitionDuration, getTransitionEasing } from './commonStyles';\nimport { Text } from '~components/Typography';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { castNativeType } from '~utils';\nimport { useCollapsible } from '~components/Collapsible/CollapsibleContext';\nimport { CollapsibleChevronIcon } from '~components/Collapsible/CollapsibleChevronIcon';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport type { IconProps } from '~components/Icons';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\nconst _AccordionButton = ({ index, icon: Icon, children }: AccordionButtonProps): ReactElement => {\n const { onExpandChange, isExpanded, collapsibleBodyId } = useCollapsible();\n const { showNumberPrefix, expandedIndex } = useAccordion();\n const { theme } = useTheme();\n\n const toggleCollapse = (): void => onExpandChange(!isExpanded);\n const isItemExpanded = expandedIndex === index;\n\n const isPressed = useSharedValue(false);\n\n const duration = castNativeType(getTransitionDuration(theme));\n const easing = castNativeType(getTransitionEasing(theme));\n\n const activeBackgroundColor = useSharedValue(\n getBackgroundColor({ theme, isExpanded, isActive: true }),\n );\n const inActiveBackgroundColor = useSharedValue(\n getBackgroundColor({ theme, isExpanded, isActive: false }),\n );\n\n /**\n * `backgroundColor` is derived from `isExpanded` and pressed state.\n *\n * Since we can't directly access return values from JS functions (`getBackgroundColor`) on UI thread,\n * this effect updates the shared values for active / inactive states which are used by `animatedStyles`.\n */\n useEffect(() => {\n activeBackgroundColor.value = getBackgroundColor({ theme, isExpanded, isActive: true });\n inActiveBackgroundColor.value = getBackgroundColor({ theme, isExpanded, isActive: false });\n }, [isExpanded, activeBackgroundColor, inActiveBackgroundColor, theme]);\n\n const animatedStyles = useAnimatedStyle(() => ({\n backgroundColor: withTiming(\n isPressed.value ? activeBackgroundColor.value : inActiveBackgroundColor.value,\n {\n duration,\n easing,\n },\n ),\n }));\n\n const _showNumberPrefix = typeof index === 'number' && showNumberPrefix;\n\n const _index = _showNumberPrefix ? (\n <Text size=\"large\" weight=\"semibold\" marginRight=\"spacing.2\">\n {index + 1}.\n </Text>\n ) : null;\n\n const a11yLabel = _showNumberPrefix ? `${index + 1}. ${children}` : children;\n\n const renderChildren: PressableProps['children'] = ({ pressed }) => {\n isPressed.value = pressed;\n\n const iconColor: IconProps['color'] =\n pressed || isExpanded ? 'interactive.icon.gray.subtle' : 'interactive.icon.gray.muted';\n\n const _icon = Icon && (\n <Icon\n size=\"medium\"\n color=\"surface.icon.gray.muted\"\n marginRight=\"spacing.3\"\n marginY=\"spacing.2\"\n />\n );\n\n if (__DEV__) {\n if (_index && _icon) {\n throwBladeError({\n message: \"showNumberPrefix and icon shouldn't be used together\",\n moduleName: 'Accordion',\n });\n }\n }\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n flex={1}\n justifyContent=\"space-between\"\n alignItems=\"center\"\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n /**\n * The `marginRight` is slightly larger here than web and the design spec (`spacing.4`),\n * because otherwise lengthy text sometimes comes too close to the rotating chevron icon\n * which doesn't look perfect\n */\n marginRight=\"spacing.5\"\n flexShrink={1}\n >\n {_index}\n {_icon}\n <Text size=\"large\" weight=\"semibold\">\n {children}\n </Text>\n </BaseBox>\n <BaseBox>\n <CollapsibleChevronIcon color={iconColor} size=\"large\" />\n </BaseBox>\n </BaseBox>\n );\n };\n\n return (\n <StyledAccordionButton\n isExpanded={isExpanded}\n onPress={toggleCollapse}\n style={animatedStyles}\n {...makeAccessible({\n role: 'button',\n expanded: isItemExpanded,\n controls: collapsibleBodyId,\n label: a11yLabel,\n })}\n {...metaAttribute({ name: MetaConstants.AccordionButton })}\n >\n {renderChildren}\n </StyledAccordionButton>\n );\n};\n\nconst AccordionButton = assignWithoutSideEffects(_AccordionButton, {\n componentId: MetaConstants.AccordionButton,\n});\n\nexport { AccordionButton };\n"],"names":["_AccordionButton","_ref","index","Icon","icon","children","_useCollapsible","useCollapsible","onExpandChange","isExpanded","collapsibleBodyId","_useAccordion","useAccordion","showNumberPrefix","expandedIndex","_useTheme","useTheme","theme","toggleCollapse","isItemExpanded","isPressed","useSharedValue","duration","castNativeType","getTransitionDuration","easing","getTransitionEasing","activeBackgroundColor","getBackgroundColor","isActive","inActiveBackgroundColor","useEffect","value","animatedStyles","useAnimatedStyle","backgroundColor","withTiming","_showNumberPrefix","_index","_jsxs","Text","size","weight","marginRight","a11yLabel","renderChildren","_ref2","pressed","iconColor","_icon","_jsx","color","marginY","__DEV__","throwBladeError","message","moduleName","BaseBox","display","flexDirection","flex","justifyContent","alignItems","flexShrink","CollapsibleChevronIcon","StyledAccordionButton","Object","assign","onPress","style","makeAccessible","role","expanded","controls","label","metaAttribute","name","MetaConstants","AccordionButton","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMA,gBAAgB,CAA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Ac,CAAC,CACjBC,IAAI,CAAE,QAAQ,CACdC,QAAQ,CAAErD,cAAc,CACxBsD,QAAQ,CAAE/D,iBAAiB,CAC3BgE,KAAK,CAAE9B,SACT,CAAC,CAAC,CACE+B,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,eAAgB,CAAC,CAAC,CAAA,CAAAzE,QAAA,CAEzDwC,cAAc,EACM,CAAC,CAE5B,CAAC,CAEK,IAAAiC,eAAe,CAAGC,wBAAwB,CAAC/E,gBAAgB,CAAE,CACjEgF,WAAW,CAAEH,aAAa,CAACC,eAC7B,CAAC;;;;"}
1
+ {"version":3,"file":"AccordionButton.native.js","sources":["../../../../../src/components/Accordion/AccordionButton.native.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { useEffect } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { StyledAccordionButton } from './StyledAccordionButton.native';\nimport type { AccordionButtonProps } from './types';\nimport { useAccordion } from './AccordionContext';\nimport { getBackgroundColor, getTransitionDuration, getTransitionEasing } from './commonStyles';\nimport { AccordionItemHeader } from './AccordionItemHeader';\nimport { Text } from '~components/Typography';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { castNativeType } from '~utils';\nimport { useCollapsible } from '~components/Collapsible/CollapsibleContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\nconst _AccordionButton = ({\n index,\n icon: Icon,\n title,\n isDeprecatedAPI,\n isDisabled,\n header,\n}: AccordionButtonProps): ReactElement => {\n const { onExpandChange, isExpanded, collapsibleBodyId } = useCollapsible();\n const { showNumberPrefix, expandedIndex } = useAccordion();\n const { theme } = useTheme();\n\n const toggleCollapse = (): void => onExpandChange(!isExpanded);\n const isItemExpanded = expandedIndex === index;\n\n const isPressed = useSharedValue(false);\n\n const duration = castNativeType(getTransitionDuration(theme));\n const easing = castNativeType(getTransitionEasing(theme));\n\n const activeBackgroundColor = useSharedValue(\n getBackgroundColor({ theme, isExpanded, isActive: true }),\n );\n const inActiveBackgroundColor = useSharedValue(\n getBackgroundColor({ theme, isExpanded, isActive: false }),\n );\n\n /**\n * `backgroundColor` is derived from `isExpanded` and pressed state.\n *\n * Since we can't directly access return values from JS functions (`getBackgroundColor`) on UI thread,\n * this effect updates the shared values for active / inactive states which are used by `animatedStyles`.\n */\n useEffect(() => {\n activeBackgroundColor.value = getBackgroundColor({ theme, isExpanded, isActive: true });\n inActiveBackgroundColor.value = getBackgroundColor({ theme, isExpanded, isActive: false });\n }, [isExpanded, activeBackgroundColor, inActiveBackgroundColor, theme]);\n\n const animatedStyles = useAnimatedStyle(() => ({\n backgroundColor: withTiming(\n isPressed.value ? activeBackgroundColor.value : inActiveBackgroundColor.value,\n {\n duration,\n easing,\n },\n ),\n }));\n\n const _showNumberPrefix = typeof index === 'number' && showNumberPrefix;\n\n const _index = _showNumberPrefix ? (\n <Text size=\"large\" weight=\"semibold\" marginRight=\"spacing.2\">\n {index + 1}.\n </Text>\n ) : null;\n\n const a11yLabel = _showNumberPrefix ? `${index + 1}. ${title}` : title;\n\n const renderChildren: PressableProps['children'] = ({ pressed }) => {\n isPressed.value = pressed;\n\n const _icon = Icon && (\n <Icon\n size=\"medium\"\n color=\"surface.icon.gray.normal\"\n marginRight=\"spacing.3\"\n marginY=\"spacing.2\"\n />\n );\n\n if (__DEV__) {\n if (_index && _icon) {\n throwBladeError({\n message: \"showNumberPrefix and icon shouldn't be used together\",\n moduleName: 'Accordion',\n });\n }\n }\n\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n flex={1}\n justifyContent=\"space-between\"\n alignItems=\"center\"\n >\n {isDeprecatedAPI ? <AccordionItemHeader title={title} leading={_icon ?? _index} /> : header}\n </BaseBox>\n );\n };\n\n return (\n <StyledAccordionButton\n isExpanded={isExpanded}\n onPress={toggleCollapse}\n style={animatedStyles}\n disabled={isDisabled}\n {...makeAccessible({\n role: 'button',\n expanded: isItemExpanded,\n controls: collapsibleBodyId,\n label: a11yLabel,\n })}\n {...metaAttribute({ name: MetaConstants.AccordionButton })}\n >\n {renderChildren}\n </StyledAccordionButton>\n );\n};\n\nconst AccordionButton = assignWithoutSideEffects(_AccordionButton, {\n componentId: MetaConstants.AccordionButton,\n});\n\nexport { AccordionButton };\n"],"names":["_AccordionButton","_ref","index","Icon","icon","title","isDeprecatedAPI","isDisabled","header","_useCollapsible","useCollapsible","onExpandChange","isExpanded","collapsibleBodyId","_useAccordion","useAccordion","showNumberPrefix","expandedIndex","_useTheme","useTheme","theme","toggleCollapse","isItemExpanded","isPressed","useSharedValue","duration","castNativeType","getTransitionDuration","easing","getTransitionEasing","activeBackgroundColor","getBackgroundColor","isActive","inActiveBackgroundColor","useEffect","value","animatedStyles","useAnimatedStyle","backgroundColor","withTiming","_showNumberPrefix","_index","_jsxs","Text","size","weight","marginRight","children","a11yLabel","renderChildren","_ref2","pressed","_icon","_jsx","color","marginY","__DEV__","throwBladeError","message","moduleName","BaseBox","display","flexDirection","flex","justifyContent","alignItems","AccordionItemHeader","leading","StyledAccordionButton","Object","assign","onPress","style","disabled","makeAccessible","role","expanded","controls","label","metaAttribute","name","MetaConstants","AccordionButton","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAMA,gBAAgB,CAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,CAOoB,CANxC,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACCC,IAAI,CAAAF,IAAA,CAAVG,IAAI,CACJC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CACLC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CACfC,UAAU,CAAAN,IAAA,CAAVM,UAAU,CACVC,MAAM,CAAAP,IAAA,CAANO,MAAM,CAE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If,MAAM,EAAIW,KAAK,CAAE,CACnBK,eAAe,CAAC,CACdC,OAAO,CAAE,sDAAsD,CAC/DC,UAAU,CAAE,WACd,CAAC,CAAC,CACJ,CACF,CAEA,OACEN,GAAA,CAACO,OAAO,CAAA,CACNC,OAAO,CAAC,MAAM,CACdC,aAAa,CAAC,KAAK,CACnBC,IAAI,CAAE,CAAE,CACRC,cAAc,CAAC,eAAe,CAC9BC,UAAU,CAAC,QAAQ,CAAAlB,QAAA,CAElBzC,eAAe,CAAG+C,GAAA,CAACa,mBAAmB,CAAA,CAAC7D,KAAK,CAAEA,KAAM,CAAC8D,OAAO,CAAEf,KAAK,EAAA,IAAA,CAALA,KAAK,CAAIX,MAAO,CAAE,CAAC,CAAGjC,MAAM,CACpF,CAAC,CAEd,CAAC,CAED,OACE6C,GAAA,CAACe,qBAAqB,CAAAC,MAAA,CAAAC,MAAA,CACpB1D,CAAAA,UAAU,CAAEA,UAAW,CACvB2D,OAAO,CAAElD,cAAe,CACxBmD,KAAK,CAAEpC,cAAe,CACtBqC,QAAQ,CAAElE,UAAW,CAAA,CACjBmE,cAAc,CAAC,CACjBC,IAAI,CAAE,QAAQ,CACdC,QAAQ,CAAEtD,cAAc,CACxBuD,QAAQ,CAAEhE,iBAAiB,CAC3BiE,KAAK,CAAE9B,SACT,CAAC,CAAC,CACE+B,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,eAAgB,CAAC,CAAC,EAAAnC,QAAA,CAEzDE,cAAc,CAAA,CACM,CAAC,CAE5B,CAAC,CAEK,IAAAiC,eAAe,CAAGC,wBAAwB,CAACnF,gBAAgB,CAAE,CACjEoF,WAAW,CAAEH,aAAa,CAACC,eAC7B,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { createContext, useContext } from 'react';
2
2
  import { throwBladeError } from '../../utils/logger/logger.js';
3
3
 
4
- var AccordionContext=createContext(null);var useAccordion=function useAccordion(){var accordionContext=useContext(AccordionContext);if(__DEV__){if(!accordionContext){throwBladeError({message:'useAccordion should be only used within AccordionContext',moduleName:'AccordionContext'});}}return accordionContext;};
4
+ var AccordionContext=createContext(null);var AccordionItemContext=createContext({index:undefined});var useAccordion=function useAccordion(){var accordionContext=useContext(AccordionContext);if(__DEV__){if(!accordionContext){throwBladeError({message:'useAccordion should be only used within AccordionContext',moduleName:'AccordionContext'});}}return accordionContext;};var useAccordionItemIndex=function useAccordionItemIndex(){var accordionItemContext=useContext(AccordionItemContext);if(__DEV__){if(!accordionItemContext){throwBladeError({message:'AccordionItem* components should be only used within AccordionItem',moduleName:'AccordionContext'});}}return accordionItemContext;};
5
5
 
6
- export { AccordionContext, useAccordion };
6
+ export { AccordionContext, AccordionItemContext, useAccordion, useAccordionItemIndex };
7
7
  //# sourceMappingURL=AccordionContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionContext.js","sources":["../../../../../src/components/Accordion/AccordionContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { throwBladeError } from '~utils/logger';\n\ntype AccordionContextState = {\n expandedIndex?: number;\n defaultExpandedIndex?: number;\n onExpandChange: (expandedIndex: number) => void;\n showNumberPrefix: boolean;\n};\n\nconst AccordionContext = createContext<AccordionContextState | null>(null);\n\nconst useAccordion = (): AccordionContextState => {\n const accordionContext = useContext(AccordionContext);\n if (__DEV__) {\n if (!accordionContext) {\n throwBladeError({\n message: 'useAccordion should be only used within AccordionContext',\n moduleName: 'AccordionContext',\n });\n }\n }\n return accordionContext!;\n};\n\nexport type { AccordionContextState };\nexport { AccordionContext, useAccordion };\n"],"names":["AccordionContext","createContext","useAccordion","accordionContext","useContext","__DEV__","throwBladeError","message","moduleName"],"mappings":";;;AAUM,IAAAA,gBAAgB,CAAGC,aAAa,CAA+B,IAAI,EAEnE,IAAAC,YAAY,CAAG,SAAfA,YAAYA,EAAgC,CAChD,IAAMC,gBAAgB,CAAGC,UAAU,CAACJ,gBAAgB,CAAC,CACrD,GAAIK,OAAO,CAAE,CACX,GAAI,CAACF,gBAAgB,CAAE,CACrBG,eAAe,CAAC,CACdC,OAAO,CAAE,0DAA0D,CACnEC,UAAU,CAAE,kBACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOL,gBAAgB,CACzB;;;;"}
1
+ {"version":3,"file":"AccordionContext.js","sources":["../../../../../src/components/Accordion/AccordionContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { AccordionProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\ntype AccordionContextState = {\n expandedIndex?: number;\n defaultExpandedIndex?: number;\n onExpandChange: (expandedIndex: number) => void;\n showNumberPrefix: boolean;\n variant: AccordionProps['variant'];\n numberOfItems: number;\n size: NonNullable<AccordionProps['size']>;\n};\n\ntype AccordionItemContextState = {\n index?: number;\n isDisabled?: boolean;\n};\n\nconst AccordionContext = createContext<AccordionContextState | null>(null);\nconst AccordionItemContext = createContext<AccordionItemContextState>({\n index: undefined,\n});\n\nconst useAccordion = (): AccordionContextState => {\n const accordionContext = useContext(AccordionContext);\n if (__DEV__) {\n if (!accordionContext) {\n throwBladeError({\n message: 'useAccordion should be only used within AccordionContext',\n moduleName: 'AccordionContext',\n });\n }\n }\n return accordionContext!;\n};\n\nconst useAccordionItemIndex = (): AccordionItemContextState => {\n const accordionItemContext = useContext(AccordionItemContext);\n if (__DEV__) {\n if (!accordionItemContext) {\n throwBladeError({\n message: 'AccordionItem* components should be only used within AccordionItem',\n moduleName: 'AccordionContext',\n });\n }\n }\n return accordionItemContext;\n};\n\nexport type { AccordionContextState };\nexport { AccordionContext, useAccordion, AccordionItemContext, useAccordionItemIndex };\n"],"names":["AccordionContext","createContext","AccordionItemContext","index","undefined","useAccordion","accordionContext","useContext","__DEV__","throwBladeError","message","moduleName","useAccordionItemIndex","accordionItemContext"],"mappings":";;;AAmBM,IAAAA,gBAAgB,CAAGC,aAAa,CAA+B,IAAI,EACnE,IAAAC,oBAAoB,CAAGD,aAAa,CAA4B,CACpEE,KAAK,CAAEC,SACT,CAAC,EAEK,IAAAC,YAAY,CAAG,SAAfA,YAAYA,EAAgC,CAChD,IAAMC,gBAAgB,CAAGC,UAAU,CAACP,gBAAgB,CAAC,CACrD,GAAIQ,OAAO,CAAE,CACX,GAAI,CAACF,gBAAgB,CAAE,CACrBG,eAAe,CAAC,CACdC,OAAO,CAAE,0DAA0D,CACnEC,UAAU,CAAE,kBACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOL,gBAAgB,CACzB,EAEM,IAAAM,qBAAqB,CAAG,SAAxBA,qBAAqBA,EAAoC,CAC7D,IAAMC,oBAAoB,CAAGN,UAAU,CAACL,oBAAoB,CAAC,CAC7D,GAAIM,OAAO,CAAE,CACX,GAAI,CAACK,oBAAoB,CAAE,CACzBJ,eAAe,CAAC,CACdC,OAAO,CAAE,oEAAoE,CAC7EC,UAAU,CAAE,kBACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOE,oBAAoB,CAC7B;;;;"}
@@ -1,28 +1,25 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import React__default from 'react';
1
3
  import { AccordionButton } from './AccordionButton.native.js';
2
- import { useAccordion } from './AccordionContext.js';
4
+ import { useAccordion, AccordionItemContext } from './AccordionContext.js';
5
+ import { AccordionItemBody } from './AccordionItemBody.js';
6
+ import { componentIds } from './componentIds.js';
3
7
  import { Divider } from '../Divider/Divider.js';
4
8
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
5
- import '@babel/runtime/helpers/objectWithoutProperties';
6
- import '../Typography/BaseText/BaseText.native.js';
7
- import 'react';
8
- import '@babel/runtime/helpers/slicedToArray';
9
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
10
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
9
11
  import 'react-native';
10
- import '../../tokens/global/typography.js';
11
- import '../../tokens/global/motion.js';
12
+ import { throwBladeError } from '../../utils/logger/logger.js';
12
13
  import { isReactNative } from '../../utils/platform/isReactNative.js';
13
14
  import '../BladeProvider/useTheme.js';
14
- import { jsx, jsxs } from 'react/jsx-runtime';
15
- import { Text } from '../Typography/Text/Text.js';
16
- import '../Typography/Code/Code.js';
17
- import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
18
- import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
19
15
  import { Collapsible } from '../Collapsible/Collapsible.js';
20
16
  import '../Collapsible/CollapsibleLink.js';
21
17
  import '../Collapsible/CollapsibleButton.js';
22
18
  import { CollapsibleBody } from '../Collapsible/CollapsibleBody.js';
23
- import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
19
+ import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
20
+ import { jsx, jsxs } from 'react/jsx-runtime';
24
21
 
25
- var BLANK_SPACE=' ';var reactNativeMultilineTextOverflowFix=jsx(BaseBox,Object.assign({},makeAccessible({hidden:true}),{children:jsx(Text,{children:BLANK_SPACE})}));var AccordionItem=function AccordionItem(_ref){var title=_ref.title,description=_ref.description,icon=_ref.icon,children=_ref.children,_index=_ref._index,testID=_ref.testID;var _useAccordion=useAccordion(),expandedIndex=_useAccordion.expandedIndex,onExpandChange=_useAccordion.onExpandChange,defaultExpandedIndex=_useAccordion.defaultExpandedIndex;var isExpanded=expandedIndex===_index;var isDefaultExpanded=defaultExpandedIndex===_index;var _description=description&&jsx(Text,{color:"interactive.text.gray.subtle",children:description});var handleExpandChange=function handleExpandChange(_ref2){var isExpanded=_ref2.isExpanded;if(isExpanded&&typeof _index!=='undefined'){onExpandChange(_index);}else {onExpandChange(-1);}};var collapsibleBodyContent=isReactNative()?jsxs(BaseBox,{marginX:"spacing.5",children:[_description,jsx(BaseBox,{marginTop:description&&children?'spacing.5':'spacing.0',children:children}),reactNativeMultilineTextOverflowFix]}):jsxs(BaseBox,{display:"flex",flexDirection:"column",gap:"spacing.5",marginBottom:"spacing.5",marginX:"spacing.5",children:[_description,children]});return jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.AccordionItem,testID:testID}),{children:[jsxs(Collapsible,{isExpanded:isExpanded,defaultIsExpanded:isDefaultExpanded,onExpandChange:handleExpandChange,_shouldApplyWidthRestrictions:false,children:[jsx(AccordionButton,{index:_index,icon:icon,children:title}),jsx(CollapsibleBody,{width:isReactNative()?'100%':undefined,children:collapsibleBodyContent})]}),jsx(Divider,{})]}));};
22
+ var AccordionItem=function AccordionItem(_ref){var title=_ref.title,description=_ref.description,icon=_ref.icon,children=_ref.children,isDisabled=_ref.isDisabled,_index=_ref._index,testID=_ref.testID;var _useAccordion=useAccordion(),expandedIndex=_useAccordion.expandedIndex,onExpandChange=_useAccordion.onExpandChange,defaultExpandedIndex=_useAccordion.defaultExpandedIndex,variant=_useAccordion.variant,numberOfItems=_useAccordion.numberOfItems;var isExpanded=expandedIndex===_index;var isDefaultExpanded=defaultExpandedIndex===_index;var isDeprecatedAPI=Boolean(title)||Boolean(description)||Boolean(icon);var _React$Children$toArr=React__default.Children.toArray(children),_React$Children$toArr2=_slicedToArray(_React$Children$toArr,2),header=_React$Children$toArr2[0],body=_React$Children$toArr2[1];if(!isDeprecatedAPI){var headerComponentId=getComponentId(header);var bodyComponentId=getComponentId(body);if(headerComponentId!==componentIds.AccordionItemHeader&&bodyComponentId!==componentIds.AccordionItemBody){throwBladeError({message:'AccordionItem only allows AccordionItemHeader as first component and AccordionItemBody as second. Check Accordion documentation',moduleName:'AccordionItem'});}}var isLastItem=_index!==undefined&&_index<numberOfItems-1;var handleExpandChange=function handleExpandChange(_ref2){var isExpanded=_ref2.isExpanded;if(isExpanded&&typeof _index!=='undefined'){onExpandChange(_index);}else {onExpandChange(-1);}};return jsx(AccordionItemContext.Provider,{value:{index:_index,isDisabled:isDisabled},children:jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.AccordionItem,testID:testID}),{children:[jsxs(Collapsible,{isExpanded:isExpanded,defaultIsExpanded:isDefaultExpanded,onExpandChange:handleExpandChange,_shouldApplyWidthRestrictions:false,children:[jsx(AccordionButton,{index:_index,icon:icon,title:title,header:header,isDisabled:isDisabled,isDeprecatedAPI:isDeprecatedAPI}),jsx(CollapsibleBody,{width:isReactNative()||!isDeprecatedAPI?'100%':undefined,children:isDeprecatedAPI?jsx(AccordionItemBody,{_description:description,children:children}):body})]}),isLastItem||variant==='transparent'?jsx(Divider,{}):null]}))});};
26
23
 
27
24
  export { AccordionItem };
28
25
  //# sourceMappingURL=AccordionItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.js","sources":["../../../../../src/components/Accordion/AccordionItem.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport { AccordionButton } from './AccordionButton';\nimport { useAccordion } from './AccordionContext';\nimport { Divider } from '~components/Divider';\nimport { BaseBox } from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { isReactNative } from '~utils';\nimport { Collapsible } from '~components/Collapsible/Collapsible';\nimport { CollapsibleBody } from '~components/Collapsible';\nimport type { TestID } from '~utils/types';\nimport { makeAccessible } from '~utils/makeAccessible';\n\ntype AccordionItemProps = {\n /**\n * Title text content\n */\n title: string;\n\n /**\n * Body text content\n */\n description?: string;\n\n /**\n * Renders a Blade icon as title prefix (requires `showNumberPrefix={false}`)\n */\n icon?: IconComponent;\n\n /**\n * Slot, renders any custom content\n */\n children?: ReactNode;\n\n /**\n * **Internal:** used for determining numbering, you don't need to pass this,\n * instead pass `showNumberPrefix` to root `Accordion`\n */\n _index?: number;\n} & TestID;\n\nconst BLANK_SPACE = ' ';\n\n/**\n * On React Native if the `AccordionItem` has a lengthy description which renders a `Text` spanning multiple lines,\n * it sometimes messes up the layout calculation (it thinks of multiline as a single line before flowing in the UI).\n * And during the expanding / collapsing animation, text reflows causing words to jump around across lines.\n *\n * Rendering a blank `Text` at the end seems to fix all this 🤯\n */\nconst reactNativeMultilineTextOverflowFix = (\n // make this hidden from screen readers\n <BaseBox {...makeAccessible({ hidden: true })}>\n <Text>{BLANK_SPACE}</Text>\n </BaseBox>\n);\n\nconst AccordionItem = ({\n title,\n description,\n icon,\n children,\n _index,\n testID,\n}: AccordionItemProps): ReactElement => {\n const { expandedIndex, onExpandChange, defaultExpandedIndex } = useAccordion();\n const isExpanded = expandedIndex === _index;\n const isDefaultExpanded = defaultExpandedIndex === _index;\n\n const _description = description && (\n <Text color=\"interactive.text.gray.subtle\">{description}</Text>\n );\n const handleExpandChange = ({ isExpanded }: { isExpanded: boolean }): void => {\n if (isExpanded && typeof _index !== 'undefined') {\n onExpandChange(_index);\n } else {\n onExpandChange(-1);\n }\n };\n\n const collapsibleBodyContent = isReactNative() ? (\n <BaseBox marginX=\"spacing.5\">\n {_description}\n <BaseBox marginTop={description && children ? 'spacing.5' : 'spacing.0'}>{children}</BaseBox>\n {reactNativeMultilineTextOverflowFix}\n </BaseBox>\n ) : (\n <BaseBox\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"spacing.5\"\n marginBottom=\"spacing.5\"\n marginX=\"spacing.5\"\n >\n {_description}\n {children}\n </BaseBox>\n );\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItem, testID })}>\n <Collapsible\n isExpanded={isExpanded}\n defaultIsExpanded={isDefaultExpanded}\n onExpandChange={handleExpandChange}\n // Accordion has its own width restrictions\n _shouldApplyWidthRestrictions={false}\n >\n <AccordionButton index={_index} icon={icon}>\n {title}\n </AccordionButton>\n <CollapsibleBody\n // Just React Native things, need this 100% so collapsed content flows correctly inside Accordion\n width={isReactNative() ? '100%' : undefined}\n >\n {collapsibleBodyContent}\n </CollapsibleBody>\n </Collapsible>\n <Divider />\n </BaseBox>\n );\n};\n\nexport type { AccordionItemProps };\nexport { AccordionItem };\n"],"names":["BLANK_SPACE","reactNativeMultilineTextOverflowFix","_jsx","BaseBox","Object","assign","makeAccessible","hidden","children","Text","AccordionItem","_ref","title","description","icon","_index","testID","_useAccordion","useAccordion","expandedIndex","onExpandChange","defaultExpandedIndex","isExpanded","isDefaultExpanded","_description","color","handleExpandChange","_ref2","collapsibleBodyContent","isReactNative","_jsxs","marginX","marginTop","display","flexDirection","gap","marginBottom","metaAttribute","name","MetaConstants","Collapsible","defaultIsExpanded","_shouldApplyWidthRestrictions","AccordionButton","index","CollapsibleBody","width","undefined","Divider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAMA,WAAW,CAAG,GAAG,CASvB,IAAMC,mCAAmC,CAEvCC,GAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CAAKC,cAAc,CAAC,CAAEC,MAAM,CAAE,IAAK,CAAC,CAAC,CAAAC,CAAAA,QAAA,CAC3CN,GAAA,CAACO,IAAI,CAAA,CAAAD,QAAA,CAAER,WAAW,CAAO,CAAC,EACnB,CACV,CAEK,IAAAU,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAOqB,KANtCC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CACXC,IAAI,CAAAH,IAAA,CAAJG,IAAI,CACJN,QAAQ,CAAAG,IAAA,CAARH,QAAQ,CACRO,MAAM,CAAAJ,IAAA,CAANI,MAAM,CACNC,MAAM,CAAAL,IAAA,CAANK,MAAM,CAEN,IAAAC,aAAA,CAAgEC,YAAY,EAAE,CAAtEC,aAAa,CAAAF,aAAA,CAAbE,aAAa,CAAEC,cAAc,CAAAH,aAAA,CAAdG,cAAc,CAAEC,oBAAoB,CAAAJ,aAAA,CAApBI,oBAAoB,CAC3D,IAAMC,UAAU,CAAGH,aAAa,GAAKJ,MAAM,CAC3C,IAAMQ,iBAAiB,CAAGF,oBAAoB,GAAKN,MAAM,CAEzD,IAAMS,YAAY,CAAGX,WAAW,EAC9BX,GAAA,CAACO,IAAI,EAACgB,KAAK,CAAC,8BAA8B,CAAAjB,QAAA,CAAEK,WAAW,CAAO,CAC/D,CACD,IAAMa,kBAAkB,CAAG,SAAr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I,KAAK,CACS,CAAC,CAClBV,GAAA,CAAC2C,eAAe,CAEdC,CAAAA,KAAK,CAAEjB,aAAa,EAAE,CAAG,MAAM,CAAGkB,SAAU,CAAAvC,QAAA,CAE3CoB,sBAAsB,CACR,CAAC,CAAA,CACP,CAAC,CACd1B,GAAA,CAAC8C,OAAO,GAAE,CAAC,CAAA,CAAA,CACJ,CAAC,CAEd;;;;"}
1
+ {"version":3,"file":"AccordionItem.js","sources":["../../../../../src/components/Accordion/AccordionItem.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport React from 'react';\nimport { AccordionButton } from './AccordionButton';\nimport { AccordionItemContext, useAccordion } from './AccordionContext';\nimport { AccordionItemBody } from './AccordionItemBody';\nimport { componentIds } from './componentIds';\nimport { Divider } from '~components/Divider';\nimport { BaseBox } from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { isReactNative } from '~utils';\nimport { Collapsible } from '~components/Collapsible/Collapsible';\nimport { CollapsibleBody } from '~components/Collapsible';\nimport type { TestID } from '~utils/types';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\n\ntype AccordionItemProps = {\n /**\n * Title text content\n *\n * @deprecated Use AccordionItemHeader and AccordionItemBody\n *\n * Checkout https://blade.razorpay.com/?path=/docs/components-accordion--docs for new API\n */\n title?: string;\n\n /**\n * Body text content\n *\n * @deprecated Use AccordionItemHeader and AccordionItemBody\n *\n * Checkout https://blade.razorpay.com/?path=/docs/components-accordion--docs for new API\n */\n description?: string;\n\n /**\n * Renders a Blade icon as title prefix (requires `showNumberPrefix={false}`)\n *\n * @deprecated Use `leading={<StarIcon size=\"large\" />}` on AccordionItemHeader instead\n *\n * Checkout https://blade.razorpay.com/?path=/docs/components-accordion--docs for new API\n */\n icon?: IconComponent;\n\n /**\n * Slot, renders any custom content\n */\n children?: ReactNode | ReactNode[];\n\n /**\n * Disabled state of the item\n *\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * **Internal:** used for determining numbering, you don't need to pass this,\n * instead pass `showNumberPrefix` to root `Accordion`\n */\n _index?: number;\n} & TestID;\n\nconst AccordionItem = ({\n title,\n description,\n icon,\n children,\n isDisabled,\n _index,\n testID,\n}: AccordionItemProps): ReactElement => {\n const {\n expandedIndex,\n onExpandChange,\n defaultExpandedIndex,\n variant,\n numberOfItems,\n } = useAccordion();\n const isExpanded = expandedIndex === _index;\n const isDefaultExpanded = defaultExpandedIndex === _index;\n const isDeprecatedAPI = Boolean(title) || Boolean(description) || Boolean(icon);\n const [header, body] = React.Children.toArray(children);\n\n if (!isDeprecatedAPI) {\n // Only doing validation in new API. Deprecated API allows everything as AccordionItem children\n const headerComponentId = getComponentId(header);\n const bodyComponentId = getComponentId(body);\n\n if (\n headerComponentId !== componentIds.AccordionItemHeader &&\n bodyComponentId !== componentIds.AccordionItemBody\n ) {\n throwBladeError({\n message:\n 'AccordionItem only allows AccordionItemHeader as first component and AccordionItemBody as second. Check Accordion documentation',\n moduleName: 'AccordionItem',\n });\n }\n }\n\n const isLastItem = _index !== undefined && _index < numberOfItems - 1;\n\n const handleExpandChange = ({ isExpanded }: { isExpanded: boolean }): void => {\n if (isExpanded && typeof _index !== 'undefined') {\n onExpandChange(_index);\n } else {\n onExpandChange(-1);\n }\n };\n\n return (\n <AccordionItemContext.Provider\n value={{\n index: _index,\n isDisabled,\n }}\n >\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItem, testID })}>\n <Collapsible\n isExpanded={isExpanded}\n defaultIsExpanded={isDefaultExpanded}\n onExpandChange={handleExpandChange}\n // Accordion has its own width restrictions\n _shouldApplyWidthRestrictions={false}\n >\n <AccordionButton\n index={_index}\n icon={icon}\n title={title}\n header={header}\n isDisabled={isDisabled}\n isDeprecatedAPI={isDeprecatedAPI}\n />\n <CollapsibleBody\n // Just React Native things, need this 100% so collapsed content flows correctly inside Accordion\n // In new API, AccordionItemBody takes 100% width to avoid issues like this - https://github.com/razorpay/blade/pull/1814\n width={isReactNative() || !isDeprecatedAPI ? '100%' : undefined}\n >\n {isDeprecatedAPI ? (\n <AccordionItemBody _description={description}>{children}</AccordionItemBody>\n ) : (\n body\n )}\n </CollapsibleBody>\n </Collapsible>\n {isLastItem || variant === 'transparent' ? <Divider /> : null}\n </BaseBox>\n </AccordionItemContext.Provider>\n );\n};\n\nexport type { AccordionItemProps };\nexport { AccordionItem };\n"],"names":["AccordionItem","_ref","title","description","icon","children","isDisabled","_index","testID","_useAccordion","useAccordion","expandedIndex","onExpandChange","defaultExpandedIndex","variant","numberOfItems","isExpanded","isDefaultExpanded","isDeprecatedAPI","Boolean","_React$Children$toArr","React","Children","toArray","_React$Children$toArr2","_slicedToArray","header","body","headerComponentId","getComponentId","bodyComponentId","componentIds","AccordionItemHeader","AccordionItemBody","throwBladeError","message","moduleName","isLastItem","undefined","handleExpandChange","_ref2","_jsx","AccordionItemContext","Provider","value","index","_jsxs","BaseBox","Object","assign","metaAttribute","name","MetaConstants","Collapsible","defaultIsExpanded","_shouldApplyWidthRestrictions","AccordionButton","CollapsibleBody","width","isReactNative","_description","Divider"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgEM,IAAAA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAQqB,CAAA,IAPtCC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CACXC,IAAI,CAAAH,IAAA,CAAJG,IAAI,CACJC,QAAQ,CAAAJ,IAAA,CAARI,QAAQ,CACRC,UAAU,CAAAL,IAAA,CAAVK,UAAU,CACVC,MAAM,CAAAN,IAAA,CAANM,MAAM,CACNC,MAAM,CAAAP,IAAA,CAANO,MAAM,CAEN,IAAAC,aAAA,CAMIC,YAAY,EAAE,CALhBC,aAAa,CAAAF,aAAA,CAAbE,aAAa,CACbC,cAAc,CAAAH,aAAA,CAAdG,cAAc,CACdC,oBAAoB,CAAAJ,aAA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,CAAC,CAED,OACE6B,GAAA,CAACC,oBAAoB,CAACC,QAAQ,CAAA,CAC5BC,KAAK,CAAE,CACLC,KAAK,CAAEtC,MAAM,CACbD,UAAU,CAAVA,UACF,CAAE,CAAAD,QAAA,CAEFyC,IAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CAAKC,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACpD,aAAa,CAAEQ,MAAM,CAANA,MAAO,CAAC,CAAC,CAAA,CAAAH,QAAA,CAAA,CACvEyC,IAAA,CAACO,WAAW,CAAA,CACVrC,UAAU,CAAEA,UAAW,CACvBsC,iBAAiB,CAAErC,iBAAkB,CACrCL,cAAc,CAAE2B,kBAAmB,CAEnCgB,6BAA6B,CAAE,KAAM,CAAAlD,QAAA,CAErCoC,CAAAA,GAAA,CAACe,eAAe,EACdX,KAAK,CAAEtC,MAAO,CACdH,IAAI,CAAEA,IAAK,CACXF,KAAK,CAAEA,KAAM,CACbwB,MAAM,CAAEA,MAAO,CACfpB,UAAU,CAAEA,UAAW,CACvBY,eAAe,CAAEA,eAAgB,CAClC,CAAC,CACFuB,GAAA,CAACgB,eAAe,EAGdC,KAAK,CAAEC,aAAa,EAAE,EAAI,CAACzC,eAAe,CAAG,MAAM,CAAGoB,SAAU,CAAAjC,QAAA,CAE/Da,eAAe,CACduB,GAAA,CAACR,iBAAiB,CAAA,CAAC2B,YAAY,CAAEzD,WAAY,CAAAE,QAAA,CAAEA,QAAQ,CAAoB,CAAC,CAE5EsB,IACD,CACc,CAAC,CACP,CAAA,CAAC,CACbU,UAAU,EAAIvB,OAAO,GAAK,aAAa,CAAG2B,GAAA,CAACoB,OAAO,CAAE,EAAA,CAAC,CAAG,IAAI,CACtD,CAAA,CAAA,CAAC,CACmB,CAAC,CAEpC;;;;"}
@@ -0,0 +1,24 @@
1
+ import { useAccordion } from './AccordionContext.js';
2
+ import { componentIds } from './componentIds.js';
3
+ import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
4
+ import '@babel/runtime/helpers/objectWithoutProperties';
5
+ import '../Typography/BaseText/BaseText.native.js';
6
+ import 'react';
7
+ import '@babel/runtime/helpers/slicedToArray';
8
+ import 'react-native';
9
+ import '../../tokens/global/typography.js';
10
+ import '../../tokens/global/motion.js';
11
+ import { isReactNative } from '../../utils/platform/isReactNative.js';
12
+ import '../BladeProvider/useTheme.js';
13
+ import { jsx, jsxs } from 'react/jsx-runtime';
14
+ import { Text } from '../Typography/Text/Text.js';
15
+ import '../Typography/Code/Code.js';
16
+ import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
17
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
18
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
19
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
20
+
21
+ var BLANK_SPACE=' ';var reactNativeMultilineTextOverflowFix=jsx(BaseBox,Object.assign({},makeAccessible({hidden:true}),{children:jsx(Text,{children:BLANK_SPACE})}));var descriptionSizeToken={large:'medium',medium:'small'};var _AccordionItemBody=function _AccordionItemBody(_ref){var children=_ref.children,_description=_ref._description;var _useAccordion=useAccordion(),size=_useAccordion.size;var childrenElement=typeof children==='string'||typeof children==='number'?jsx(Text,{size:descriptionSizeToken[size],color:"surface.text.gray.subtle",children:children}):children;var descriptionElement=_description&&jsx(Text,{size:descriptionSizeToken[size],color:"surface.text.gray.subtle",children:_description});var collapsibleBodyContent=isReactNative()?jsxs(BaseBox,{marginX:"spacing.5",children:[descriptionElement,jsx(BaseBox,{marginTop:_description&&children?'spacing.5':'spacing.0',children:childrenElement}),reactNativeMultilineTextOverflowFix]}):jsxs(BaseBox,{display:"flex",flexDirection:"column",gap:"spacing.5",marginBottom:"spacing.5",marginX:"spacing.5",children:[descriptionElement,childrenElement]});return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.AccordionItemBody}),{children:collapsibleBodyContent}));};var AccordionItemBody=assignWithoutSideEffects(_AccordionItemBody,{componentId:componentIds.AccordionItemBody});
22
+
23
+ export { AccordionItemBody };
24
+ //# sourceMappingURL=AccordionItemBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionItemBody.js","sources":["../../../../../src/components/Accordion/AccordionItemBody.tsx"],"sourcesContent":["import { useAccordion } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { isReactNative } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { StringChildrenType } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\n\nconst BLANK_SPACE = ' ';\n\n/**\n * On React Native if the `AccordionItem` has a lengthy description which renders a `Text` spanning multiple lines,\n * it sometimes messes up the layout calculation (it thinks of multiline as a single line before flowing in the UI).\n * And during the expanding / collapsing animation, text reflows causing words to jump around across lines.\n *\n * Rendering a blank `Text` at the end seems to fix all this 🤯\n */\nconst reactNativeMultilineTextOverflowFix = (\n // make this hidden from screen readers\n <BaseBox {...makeAccessible({ hidden: true })}>\n <Text>{BLANK_SPACE}</Text>\n </BaseBox>\n);\n\nconst descriptionSizeToken = {\n large: 'medium',\n medium: 'small',\n} as const;\n\nconst _AccordionItemBody = ({\n children,\n _description,\n}: {\n children?: React.ReactNode | StringChildrenType;\n _description?: string;\n}): React.ReactElement => {\n const { size } = useAccordion();\n\n const childrenElement =\n typeof children === 'string' || typeof children === 'number' ? (\n <Text size={descriptionSizeToken[size]} color=\"surface.text.gray.subtle\">\n {children}\n </Text>\n ) : (\n children\n );\n\n const descriptionElement = _description && (\n <Text size={descriptionSizeToken[size]} color=\"surface.text.gray.subtle\">\n {_description}\n </Text>\n );\n\n const collapsibleBodyContent = isReactNative() ? (\n <BaseBox marginX=\"spacing.5\">\n {descriptionElement}\n <BaseBox marginTop={_description && children ? 'spacing.5' : 'spacing.0'}>\n {childrenElement}\n </BaseBox>\n {reactNativeMultilineTextOverflowFix}\n </BaseBox>\n ) : (\n <BaseBox\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"spacing.5\"\n marginBottom=\"spacing.5\"\n marginX=\"spacing.5\"\n >\n {descriptionElement}\n {childrenElement}\n </BaseBox>\n );\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemBody })}>\n {collapsibleBodyContent}\n </BaseBox>\n );\n};\n\nconst AccordionItemBody = assignWithoutSideEffects(_AccordionItemBody, {\n componentId: componentIds.AccordionItemBody,\n});\n\nexport { AccordionItemBody };\n"],"names":["BLANK_SPACE","reactNativeMultilineTextOverflowFix","_jsx","BaseBox","Object","assign","makeAccessible","hidden","children","Text","descriptionSizeToken","large","medium","_AccordionItemBody","_ref","_description","_useAccordion","useAccordion","size","childrenElement","color","descriptionElement","collapsibleBodyContent","isReactNative","_jsxs","marginX","marginTop","display","flexDirection","gap","marginBottom","metaAttribute","name","MetaConstants","AccordionItemBody","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,IAAMA,WAAW,CAAG,GAAG,CASvB,IAAMC,mCAAmC,CAEvCC,GAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CAAKC,cAAc,CAAC,CAAEC,MAAM,CAAE,IAAK,CAAC,CAAC,CAAAC,CAAAA,QAAA,CAC3CN,GAAA,CAACO,IAAI,CAAA,CAAAD,QAAA,CAAER,WAAW,CAAO,CAAC,CACnB,CAAA,CACV,CAED,IAAMU,oBAAoB,CAAG,CAC3BC,KAAK,CAAE,QAAQ,CACfC,MAAM,CAAE,OACV,CAAU,CAEV,IAAMC,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAME,KALxBN,QAAQ,CAAAM,IAAA,CAARN,QAAQ,CACRO,YAAY,CAAAD,IAAA,CAAZC,YAAY,CAKZ,IAAAC,aAAA,CAAiBC,YAAY,E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,kBAAkB,CAAE,CACrEuB,WAAW,CAAEC,YAAY,CAACH,iBAC5B,CAAC;;;;"}
@@ -0,0 +1,24 @@
1
+ import { useAccordion, useAccordionItemIndex } from './AccordionContext.js';
2
+ import { componentIds } from './componentIds.js';
3
+ import { BaseHeader } from '../BaseHeaderFooter/BaseHeader.js';
4
+ import '@babel/runtime/helpers/objectWithoutProperties';
5
+ import '../Typography/BaseText/BaseText.native.js';
6
+ import 'react';
7
+ import '@babel/runtime/helpers/slicedToArray';
8
+ import 'react-native';
9
+ import '../../tokens/global/typography.js';
10
+ import '../../tokens/global/motion.js';
11
+ import '../BladeProvider/useTheme.js';
12
+ import { jsx, jsxs } from 'react/jsx-runtime';
13
+ import { Text } from '../Typography/Text/Text.js';
14
+ import '../Typography/Code/Code.js';
15
+ import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
16
+ import { CollapsibleChevronIcon } from '../Collapsible/CollapsibleChevronIcon.native.js';
17
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
18
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
19
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
20
+
21
+ var _AccordionItemHeader=function _AccordionItemHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,children=_ref.children,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix;var _useAccordion=useAccordion(),size=_useAccordion.size,showNumberPrefix=_useAccordion.showNumberPrefix;var _useAccordionItemInde=useAccordionItemIndex(),index=_useAccordionItemInde.index,isDisabled=_useAccordionItemInde.isDisabled;return jsx(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.AccordionItemHeader}),{flex:"1",children:jsx(BaseHeader,{leading:showNumberPrefix&&typeof index==='number'?jsxs(Text,{size:size,weight:"semibold",marginTop:"-2px",as:"span",children:[index+1,"."]}):leading,title:title,subtitle:subtitle,trailing:trailing,titleSuffix:titleSuffix,isDisabled:isDisabled,showBackButton:false,showCloseButton:false,showDivider:false,paddingX:"spacing.5",marginY:"spacing.5",size:size,trailingInteractionElement:jsx(CollapsibleChevronIcon,{color:isDisabled?'interactive.icon.gray.disabled':'interactive.icon.gray.muted',size:"large"}),children:children})}));};var AccordionItemHeader=assignWithoutSideEffects(_AccordionItemHeader,{componentId:componentIds.AccordionItemHeader});
22
+
23
+ export { AccordionItemHeader };
24
+ //# sourceMappingURL=AccordionItemHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionItemHeader.js","sources":["../../../../../src/components/Accordion/AccordionItemHeader.tsx"],"sourcesContent":["import { useAccordion, useAccordionItemIndex } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { Text } from '~components/Typography';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CollapsibleChevronIcon } from '~components/Collapsible/CollapsibleChevronIcon';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst _AccordionItemHeader = ({\n title,\n subtitle,\n leading,\n children,\n trailing,\n titleSuffix,\n}: Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'children' | 'trailing' | 'titleSuffix'\n>): React.ReactElement => {\n const { size, showNumberPrefix } = useAccordion();\n const { index, isDisabled } = useAccordionItemIndex();\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemHeader })} flex=\"1\">\n <BaseHeader\n leading={\n showNumberPrefix && typeof index === 'number' ? (\n // we have to add -2px margin to align the number with title of BaseHeader\n <Text size={size} weight=\"semibold\" marginTop=\"-2px\" as=\"span\">\n {index + 1}.\n </Text>\n ) : (\n leading\n )\n }\n title={title}\n subtitle={subtitle}\n trailing={trailing}\n titleSuffix={titleSuffix}\n isDisabled={isDisabled}\n showBackButton={false}\n showCloseButton={false}\n showDivider={false}\n paddingX=\"spacing.5\"\n marginY=\"spacing.5\"\n size={size}\n trailingInteractionElement={\n <CollapsibleChevronIcon\n color={isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted'}\n size=\"large\"\n />\n }\n >\n {children}\n </BaseHeader>\n </BaseBox>\n );\n};\n\nconst AccordionItemHeader = assignWithoutSideEffects(_AccordionItemHeader, {\n componentId: componentIds.AccordionItemHeader,\n});\n\nexport { AccordionItemHeader };\n"],"names":["_AccordionItemHeader","_ref","title","subtitle","leading","children","trailing","titleSuffix","_useAccordion","useAccordion","size","showNumberPrefix","_useAccordionItemInde","useAccordionItemIndex","index","isDisabled","_jsx","BaseBox","Object","assign","metaAttribute","name","MetaConstants","AccordionItemHeader","flex","BaseHeader","_jsxs","Text","weight","marginTop","as","showBackButton","showCloseButton","showDivider","paddingX","marginY","trailingInteractionElement","CollapsibleChevronIcon","color","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,IAAMA,oBAAoB,CAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,CAUA,CATxB,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACRC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CACPC,QAAQ,CAAAJ,IAAA,CAARI,QAAQ,CACRC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CACRC,WAAW,CAAAN,IAAA,CAAXM,WAAW,CAKX,IAAAC,aAAA,CAAmCC,YAAY,EAAE,CAAzCC,IAAI,CAAAF,aAAA,CAAJE,IAAI,CAAEC,gBAAgB,CAAAH,aAAA,CAAhBG,gBAAgB,CAC9B,IAAAC,qBAAA,CAA8BC,qBAAqB,EAAE,CAA7CC,KAAK,CAAAF,qBAAA,CAALE,KAAK,CAAEC,UAAU,CAAAH,qBAAA,CAAVG,UAAU,CAEzB,OACEC,GAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAAKC,EAAAA,CAAAA,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,mBAAoB,CAAC,CAAC,CAAA,CAAEC,IAAI,CAAC,GAAG,CAAAnB,QAAA,CAC/EW,GAAA,CAACS,UAAU,CACTrB,CAAAA,OAAO,CACLO,gBAAgB,EAAI,OAAOG,KAAK,GAAK,QAAQ,CAE3CY,IAAA,CAACC,IAAI,CAAA,CAACjB,IAAI,CAAEA,IAAK,CAACkB,MAAM,CAAC,UAAU,CAACC,SAAS,CAAC,MAAM,CAACC,EAAE,CAAC,MAAM,CAAAzB,QAAA,CAAA,CAC3DS,KAAK,CAAG,CAAC,CAAC,GACb,CAAM,CAAA,CAAC,CAEPV,OAEH,CACDF,KAAK,CAAEA,KAAM,CACbC,QAAQ,CAAEA,QAAS,CACnBG,QAAQ,CAAEA,QAAS,CACnBC,WAAW,CAAEA,WAAY,CACzBQ,UAAU,CAAEA,UAAW,CACvBgB,cAAc,CAAE,KAAM,CACtBC,eAAe,CAAE,KAAM,CACvBC,WAAW,CAAE,KAAM,CACnBC,QAAQ,CAAC,WAAW,CACpBC,OAAO,CAAC,WAAW,CACnBzB,IAAI,CAAEA,IAAK,CACX0B,0BAA0B,CACxBpB,GAAA,CAACqB,sBAAsB,CAAA,CACrBC,KAAK,CAAEvB,UAAU,CAAG,gCAAgC,CAAG,6BAA8B,CACrFL,IAAI,CAAC,OAAO,CACb,CACF,CAAAL,QAAA,CAEAA,QAAQ,CACC,CAAC,CAAA,CACN,CAAC,CAEd,CAAC,CAEK,IAAAkB,mBAAmB,CAAGgB,wBAAwB,CAACvC,oBAAoB,CAAE,CACzEwC,WAAW,CAAEC,YAAY,CAAClB,mBAC5B,CAAC;;;;"}
@@ -4,7 +4,7 @@ import 'react';
4
4
  import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.native.js';
5
5
  import '../BladeProvider/useTheme.js';
6
6
 
7
- var getTransitionDuration=function getTransitionDuration(theme){return makeMotionTime(theme.motion.duration['2xquick']);};var getTransitionEasing=function getTransitionEasing(theme){return theme.motion.easing.standard.effective;};var getBackgroundColor=function getBackgroundColor(_ref){var theme=_ref.theme,isExpanded=_ref.isExpanded,isActive=_ref.isActive;var gray=theme.colors.interactive.background.gray;if(isActive){return gray.faded;}if(isExpanded){return gray.default;}var TRANSPARENT='hsla(0, 0%, 100%, 0)';return TRANSPARENT;};var getCommonAccordionButtonStyles=function getCommonAccordionButtonStyles(props){var theme=props.theme;return {padding:theme.spacing[5],display:'flex',flexDirection:'row',alignItems:'center',justifyContent:'space-between'};};
7
+ var getTransitionDuration=function getTransitionDuration(theme){return makeMotionTime(theme.motion.duration['2xquick']);};var getTransitionEasing=function getTransitionEasing(theme){return theme.motion.easing.standard.effective;};var getBackgroundColor=function getBackgroundColor(_ref){var theme=_ref.theme,isExpanded=_ref.isExpanded,isActive=_ref.isActive;var gray=theme.colors.interactive.background.gray;if(isExpanded){if(isActive){return gray.fadedHighlighted;}return gray.faded;}if(isActive){return gray.faded;}return theme.colors.transparent;};var getCommonAccordionButtonStyles=function getCommonAccordionButtonStyles(props){var theme=props.theme;return {padding:theme.spacing[0],display:'flex',flexDirection:'row',alignItems:'center',justifyContent:'space-between'};};
8
8
 
9
9
  export { getBackgroundColor, getCommonAccordionButtonStyles, getTransitionDuration, getTransitionEasing };
10
10
  //# sourceMappingURL=commonStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonStyles.js","sources":["../../../../../src/components/Accordion/commonStyles.ts"],"sourcesContent":["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard.effective;\n\nconst getBackgroundColor = ({\n theme,\n isExpanded,\n isActive,\n}: {\n theme: Theme;\n isExpanded: boolean;\n isActive: boolean;\n}): string => {\n const { gray } = theme.colors.interactive.background;\n\n if (isActive) {\n return gray.faded;\n }\n\n if (isExpanded) {\n return gray.default;\n }\n\n const TRANSPARENT = 'hsla(0, 0%, 100%, 0)';\n return TRANSPARENT;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[5],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","effective","getBackgroundColor","_ref","isExpanded","isActive","gray","colors","interactive","background","faded","default","TRANSPARENT","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;;;;AAMM,IAAAA,qBAAqB,CAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,CAAA,CAAA,OAAKC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAGhG,EAAM,IAAAC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIJ,KAAY,CAAA,CAAA,OAAKA,KAAK,CAACE,MAAM,CAACG,MAAM,CAACC,QAAQ,CAACC,SAAS,CAAA,EAE9E,IAAAC,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAQV,CAPZ,IAAAT,KAAK,CAAAS,IAAA,CAALT,KAAK,CACLU,UAAU,CAAAD,IAAA,CAAVC,UAAU,CACVC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CAMR,IAAQC,IAAI,CAAKZ,KAAK,CAACa,MAAM,CAACC,WAAW,CAACC,UAAU,CAA5CH,IAAI,CAEZ,GAAID,QAAQ,CAAE,CACZ,OAAOC,IAAI,CAACI,KAAK,CACnB,CAEA,GAAIN,UAAU,CAAE,CACd,OAAOE,IAAI,CAACK,OAAO,CACrB,CAEA,IAAMC,WAAW,CAAG,sBAAsB,CAC1C,OAAOA,WAAW,CACpB,EAEM,IAAAC,8BAA8B,CAAG,SAAjCA,8BAA8BA,CAClCC,KAA8C,CAChC,CACd,IAAQpB,KAAK,CAAKoB,KAAK,CAAfpB,KAAK,CAEb,OAAO,CACLqB,OAAO,CAAErB,KAAK,CAACsB,OAAO,CAAC,CAAC,CAAC,CACzBC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE,KAAK,CACpBC,UAAU,CAAE,QAAQ,CACpBC,cAAc,CAAE,eAClB,CAAC,CACH;;;;"}
1
+ {"version":3,"file":"commonStyles.js","sources":["../../../../../src/components/Accordion/commonStyles.ts"],"sourcesContent":["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard.effective;\n\nconst getBackgroundColor = ({\n theme,\n isExpanded,\n isActive,\n}: {\n theme: Theme;\n isExpanded: boolean;\n isActive: boolean;\n}): string => {\n const { gray } = theme.colors.interactive.background;\n\n if (isExpanded) {\n if (isActive) {\n return gray.fadedHighlighted;\n }\n\n return gray.faded;\n }\n\n if (isActive) {\n return gray.faded;\n }\n\n return theme.colors.transparent;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[0],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","effective","getBackgroundColor","_ref","isExpanded","isActive","gray","colors","interactive","background","fadedHighlighted","faded","transparent","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;;;;AAMM,IAAAA,qBAAqB,CAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,CAAK,CAAA,OAAAC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA,EAG1F,IAAAC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIJ,KAAY,SAAKA,KAAK,CAACE,MAAM,CAACG,MAAM,CAACC,QAAQ,CAACC,SAAS,CAAA,EAE9E,IAAAC,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAQV,CAPZ,IAAAT,KAAK,CAAAS,IAAA,CAALT,KAAK,CACLU,UAAU,CAAAD,IAAA,CAAVC,UAAU,CACVC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CAMR,IAAQC,IAAI,CAAKZ,KAAK,CAACa,MAAM,CAACC,WAAW,CAACC,UAAU,CAA5CH,IAAI,CAEZ,GAAIF,UAAU,CAAE,CACd,GAAIC,QAAQ,CAAE,CACZ,OAAOC,IAAI,CAACI,gBAAgB,CAC9B,CAEA,OAAOJ,IAAI,CAACK,KAAK,CACnB,CAEA,GAAIN,QAAQ,CAAE,CACZ,OAAOC,IAAI,CAACK,KAAK,CACnB,CAEA,OAAOjB,KAAK,CAACa,MAAM,CAACK,WAAW,CACjC,EAEM,IAAAC,8BAA8B,CAAG,SAAjCA,8BAA8BA,CAClCC,KAA8C,CAChC,CACd,IAAQpB,KAAK,CAAKoB,KAAK,CAAfpB,KAAK,CAEb,OAAO,CACLqB,OAAO,CAAErB,KAAK,CAACsB,OAAO,CAAC,CAAC,CAAC,CACzBC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE,KAAK,CACpBC,UAAU,CAAE,QAAQ,CACpBC,cAAc,CAAE,eAClB,CAAC,CACH;;;;"}
@@ -0,0 +1,4 @@
1
+ var componentIds={AccordionItemHeader:'AccordionItemHeader',AccordionItemBody:'AccordionItemBody',AccordionItem:'AccordionItem'};
2
+
3
+ export { componentIds };
4
+ //# sourceMappingURL=componentIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentIds.js","sources":["../../../../../src/components/Accordion/componentIds.ts"],"sourcesContent":["export const componentIds = {\n AccordionItemHeader: 'AccordionItemHeader',\n AccordionItemBody: 'AccordionItemBody',\n AccordionItem: 'AccordionItem',\n};\n"],"names":["componentIds","AccordionItemHeader","AccordionItemBody","AccordionItem"],"mappings":"AAAa,IAAAA,YAAY,CAAG,CAC1BC,mBAAmB,CAAE,qBAAqB,CAC1CC,iBAAiB,CAAE,mBAAmB,CACtCC,aAAa,CAAE,eACjB;;;;"}
@@ -7,12 +7,9 @@ import { useBottomSheetContext } from '../BottomSheet/BottomSheetContext.js';
7
7
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
8
8
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
9
9
  import { Divider } from '../Divider/Divider.js';
10
- import '@babel/runtime/helpers/slicedToArray';
11
- import { makeSize } from '../../utils/makeSize/makeSize.js';
12
- import '../BladeProvider/useTheme.js';
13
10
  import { jsx } from 'react/jsx-runtime';
14
11
 
15
- var _ActionListBox=React__default.forwardRef(function(_ref,ref){var sectionData=_ref.sectionData,actionListItemWrapperRole=_ref.actionListItemWrapperRole,isMultiSelectable=_ref.isMultiSelectable,isInBottomSheet=_ref.isInBottomSheet;var _useBottomSheetContex=useBottomSheetContext(),footerHeight=_useBottomSheetContex.footerHeight,setContentHeight=_useBottomSheetContex.setContentHeight;var renderActionListItem=React__default.useCallback(function(_ref2){var item=_ref2.item;return jsx(ActionListItem,Object.assign({},item));},[]);var renderActionListSectionHeader=React__default.useCallback(function(_ref3){var title=_ref3.section.title;if(!title)return null;return jsx(ActionListSection,{title:title,_hideDivider:true,children:undefined});},[]);var renderActionListSectionDivider=React__default.useCallback(function(_ref4){var _ref4$section=_ref4.section,title=_ref4$section.title,hideDivider=_ref4$section.hideDivider;if(!title)return null;if(hideDivider)return null;return jsx(Divider,{});},[]);return jsx(StyledListBoxWrapper,Object.assign({as:isInBottomSheet?BottomSheetSectionList:SectionList,isInBottomSheet:Boolean(isInBottomSheet),marginBottom:makeSize(footerHeight),sections:sectionData,windowSize:5,keyExtractor:function keyExtractor(item){return item.value;},stickySectionHeadersEnabled:false,renderSectionHeader:renderActionListSectionHeader,renderSectionFooter:renderActionListSectionDivider,renderItem:renderActionListItem,ref:ref,onContentSizeChange:function onContentSizeChange(_width,height){setContentHeight(height);}},makeAccessible({role:actionListItemWrapperRole,multiSelectable:actionListItemWrapperRole==='listbox'?isMultiSelectable:undefined})));});var ActionListBox=assignWithoutSideEffects(_ActionListBox,{displayName:'ActionListBox'});
12
+ var _ActionListBox=React__default.forwardRef(function(_ref,ref){var sectionData=_ref.sectionData,actionListItemWrapperRole=_ref.actionListItemWrapperRole,isMultiSelectable=_ref.isMultiSelectable,isInBottomSheet=_ref.isInBottomSheet;var _useBottomSheetContex=useBottomSheetContext(),footerHeight=_useBottomSheetContex.footerHeight,setContentHeight=_useBottomSheetContex.setContentHeight;var renderActionListItem=React__default.useCallback(function(_ref2){var item=_ref2.item;return jsx(ActionListItem,Object.assign({},item));},[]);var renderActionListSectionHeader=React__default.useCallback(function(_ref3){var title=_ref3.section.title;if(!title)return null;return jsx(ActionListSection,{title:title,_hideDivider:true,children:undefined});},[]);var renderActionListSectionDivider=React__default.useCallback(function(_ref4){var _ref4$section=_ref4.section,title=_ref4$section.title,hideDivider=_ref4$section.hideDivider;if(!title)return null;if(hideDivider)return null;return jsx(Divider,{});},[]);return jsx(StyledListBoxWrapper,Object.assign({as:isInBottomSheet?BottomSheetSectionList:SectionList,isInBottomSheet:Boolean(isInBottomSheet),marginBottom:footerHeight,sections:sectionData,windowSize:5,keyExtractor:function keyExtractor(item){return item.value;},stickySectionHeadersEnabled:false,renderSectionHeader:renderActionListSectionHeader,renderSectionFooter:renderActionListSectionDivider,renderItem:renderActionListItem,ref:ref,onContentSizeChange:function onContentSizeChange(_width,height){setContentHeight(height);}},makeAccessible({role:actionListItemWrapperRole,multiSelectable:actionListItemWrapperRole==='listbox'?isMultiSelectable:undefined})));});var ActionListBox=assignWithoutSideEffects(_ActionListBox,{displayName:'ActionListBox'});
16
13
 
17
14
  export { ActionListBox };
18
15
  //# sourceMappingURL=ActionListBox.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListBox.native.js","sources":["../../../../../src/components/ActionList/ActionListBox.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { BottomSheetSectionList as GorhomBottomSheetSectionList } from '@gorhom/bottom-sheet';\nimport { SectionList } from 'react-native';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport { ActionListItem, ActionListSection } from './ActionListItem';\nimport type { SectionData } from './actionListUtils';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Divider } from '~components/Divider';\nimport { makeSize } from '~utils';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n};\n\nconst _ActionListBox = React.forwardRef<SectionList, ActionListBoxProps>(\n ({ sectionData, actionListItemWrapperRole, isMultiSelectable, isInBottomSheet }, ref) => {\n const { footerHeight, setContentHeight } = useBottomSheetContext();\n\n const renderActionListItem = React.useCallback(({ item }) => {\n return <ActionListItem {...item} />;\n }, []);\n\n const renderActionListSectionHeader = React.useCallback(({ section: { title } }) => {\n if (!title) return null;\n return <ActionListSection title={title} _hideDivider={true} children={undefined} />;\n }, []);\n\n const renderActionListSectionDivider = React.useCallback(\n ({ section: { title, hideDivider } }) => {\n if (!title) return null;\n if (hideDivider) return null;\n return <Divider />;\n },\n [],\n );\n\n return (\n <StyledListBoxWrapper\n // Render either the Gorhom or RN Section list depending on where we are\n // We can't simply use RNSectionList because GorhomSectionList handles extra bottomsheet specific logic internally\n as={isInBottomSheet ? GorhomBottomSheetSectionList : SectionList}\n isInBottomSheet={Boolean(isInBottomSheet)}\n // Setting footerHeight as bottom margin for ActionListBox\n // otherwise the footer hides few list items under it, this will offset it\n marginBottom={makeSize(footerHeight)}\n sections={sectionData}\n windowSize={5}\n keyExtractor={(item: any) => {\n return item.value;\n }}\n stickySectionHeadersEnabled={false}\n renderSectionHeader={renderActionListSectionHeader}\n renderSectionFooter={renderActionListSectionDivider}\n renderItem={renderActionListItem}\n ref={ref as any}\n onContentSizeChange={(_width, height) => {\n setContentHeight(height);\n }}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n />\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(_ActionListBox, { displayName: 'ActionListBox' });\n\nexport { ActionListBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","sectionData","actionListItemWrapperRole","isMultiSelectable","isInBottomSheet","_useBottomSheetContex","useBottomSheetContext","footerHeight","setContentHeight","renderActionListItem","useCallback","_ref2","item","_jsx","ActionListItem","Object","assign","renderActionListSectionHeader","_ref3","title","section","ActionListSection","_hideDivider","children","undefined","renderActionListSectionDivider","_ref4","_ref4$section","hideDivider","Divider","StyledListBoxWrapper","as","GorhomBottomSheetSectionList","SectionList","Boolean","marginBottom","makeSize","sections","windowSize","keyExtractor","value","stickySectionHeadersEnabled","renderSectionHeader","renderSectionFooter","renderItem","onContentSizeChange","_width","height","makeAccessible","role","multiSelectable","ActionListBox","assignWithoutSideEffects","displayName"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAMA,cAAc,CAAGC,cAAK,CAACC,UAAU,CACrC,SAAAC,IAAA,CAAiFC,GAAG,CAAK,CAAtF,IAAAC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CAAEC,yBAAyB,CAAAH,IAAA,CAAzBG,yBAAyB,CAAEC,iBAAiB,CAAAJ,IAAA,CAAjBI,iBAAiB,CAAEC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CAC3E,IAAAC,qBAAA,CAA2CC,qBAAqB,EAAE,CAA1DC,YAAY,CAAAF,qBAAA,CAAZE,YAAY,CAAEC,gBAAgB,CAAAH,qBAAA,CAAhBG,gBAAgB,CAEtC,IAAMC,oBAAoB,CAAGZ,cAAK,CAACa,WAAW,CAAC,SAAAC,KAAA,CAAc,KAAXC,IAAI,CAAAD,KAAA,CAAJC,IAAI,CACpD,OAAOC,GAAA,CAACC,cAAc,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CAAKJ,IAAI,CAAG,CAAC,CACrC,CAAC,CAAE,EAAE,CAAC,CAEN,IAAMK,6BAA6B,CAAGpB,cAAK,CAACa,WAAW,CAAC,SAAAQ,KAAA,CAA4B,CAAA,IAAdC,KAAK,CAAAD,KAAA,CAAhBE,OAAO,CAAID,KAAK,CACzE,GAAI,CAACA,KAAK,CAAE,OAAO,IAAI,CACvB,OAAON,GAAA,CAACQ,iBAAiB,EAACF,KAAK,CAAEA,KAAM,CAACG,YAAY,CAAE,IAAK,CAACC,QAAQ,CAAEC,SAAU,CAAE,CAAC,CACrF,CAAC,CAAE,EAAE,CAAC,CAEN,IAAMC,8BAA8B,CAAG5B,cAAK,CAACa,WAAW,CACtD,SAAAgB,KAAA,CAAyC,KAAAC,aAAA,CAAAD,KAAA,CAAtCN,OAAO,CAAID,KAAK,CAAAQ,aAAA,CAALR,KAAK,CAAES,WAAW,CAAAD,aAAA,CAAXC,WAAW,CAC9B,GAAI,CAACT,KAAK,CAAE,WAAW,CACvB,GAAIS,WAAW,CAAE,WAAW,CAC5B,OAAOf,GAAA,CAACgB,OAAO,CAAE,EAAA,CAAC,CACpB,CAAC,CACD,EACF,CAAC,CAED,OACEhB,GAAA,CAACiB,oBAAoB,CAAAf,MAAA,CAAAC,MAAA,EAGnBe,EAAE,CAAE3B,eAAe,CAAG4B,sBAA4B,CAAGC,WAAY,CACjE7B,eAAe,CAAE8B,OAAO,CAAC9B,eAAe,CAAE,CAG1C+B,YAAY,CAAEC,QAAQ,CAAC7B,YAAY,CAAE,CACrC8B,QAAQ,CAAEpC,WAAY,CACtBqC,UAAU,CAAE,CAAE,CACdC,YAAY,CAAE,SAAAA,YAAC3B,CAAAA,IAAS,CAAK,CAC3B,OAAOA,IAAI,CAAC4B,KAAK,CACnB,CAAE,CACFC,2BAA2B,CAAE,KAAM,CACnCC,mBAAmB,CAAEzB,6BAA8B,CACnD0B,mBAAmB,CAAElB,8BAA+B,CACpDmB,UAAU,CAAEnC,oBAAqB,CACjCT,GAAG,CAAEA,GAAW,CAChB6C,mBAAmB,CAAE,SAAAA,oBAACC,MAAM,CAAEC,MAAM,CAAK,CACvCvC,gBAAgB,CAACuC,MAAM,CAAC,CAC1B,CAAE,EACEC,cAAc,CAAC,CACjBC,IAAI,CAAE/C,yBAAyB,CAC/BgD,eAAe,CAAEhD,yBAAyB,GAAK,SAAS,CAAGC,iBAAiB,CAAGqB,SACjF,CAAC,CAAC,CACH,CAAC,CAEN,CACF,CAAC,CAEK,IAAA2B,aAAa,CAAGC,wBAAwB,CAACxD,cAAc,CAAE,CAAEyD,WAAW,CAAE,eAAgB,CAAC;;;;"}
1
+ {"version":3,"file":"ActionListBox.native.js","sources":["../../../../../src/components/ActionList/ActionListBox.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport { BottomSheetSectionList as GorhomBottomSheetSectionList } from '@gorhom/bottom-sheet';\nimport { SectionList } from 'react-native';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport { ActionListItem, ActionListSection } from './ActionListItem';\nimport type { SectionData } from './actionListUtils';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Divider } from '~components/Divider';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n};\n\nconst _ActionListBox = React.forwardRef<SectionList, ActionListBoxProps>(\n ({ sectionData, actionListItemWrapperRole, isMultiSelectable, isInBottomSheet }, ref) => {\n const { footerHeight, setContentHeight } = useBottomSheetContext();\n\n const renderActionListItem = React.useCallback(({ item }) => {\n return <ActionListItem {...item} />;\n }, []);\n\n const renderActionListSectionHeader = React.useCallback(({ section: { title } }) => {\n if (!title) return null;\n return <ActionListSection title={title} _hideDivider={true} children={undefined} />;\n }, []);\n\n const renderActionListSectionDivider = React.useCallback(\n ({ section: { title, hideDivider } }) => {\n if (!title) return null;\n if (hideDivider) return null;\n return <Divider />;\n },\n [],\n );\n\n return (\n <StyledListBoxWrapper\n // Render either the Gorhom or RN Section list depending on where we are\n // We can't simply use RNSectionList because GorhomSectionList handles extra bottomsheet specific logic internally\n as={isInBottomSheet ? GorhomBottomSheetSectionList : SectionList}\n isInBottomSheet={Boolean(isInBottomSheet)}\n // Setting footerHeight as bottom margin for ActionListBox\n // otherwise the footer hides few list items under it, this will offset it\n marginBottom={footerHeight}\n sections={sectionData}\n windowSize={5}\n keyExtractor={(item: any) => {\n return item.value;\n }}\n stickySectionHeadersEnabled={false}\n renderSectionHeader={renderActionListSectionHeader}\n renderSectionFooter={renderActionListSectionDivider}\n renderItem={renderActionListItem}\n ref={ref as any}\n onContentSizeChange={(_width, height) => {\n setContentHeight(height);\n }}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n />\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(_ActionListBox, { displayName: 'ActionListBox' });\n\nexport { ActionListBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","sectionData","actionListItemWrapperRole","isMultiSelectable","isInBottomSheet","_useBottomSheetContex","useBottomSheetContext","footerHeight","setContentHeight","renderActionListItem","useCallback","_ref2","item","_jsx","ActionListItem","Object","assign","renderActionListSectionHeader","_ref3","title","section","ActionListSection","_hideDivider","children","undefined","renderActionListSectionDivider","_ref4","_ref4$section","hideDivider","Divider","StyledListBoxWrapper","as","GorhomBottomSheetSectionList","SectionList","Boolean","marginBottom","sections","windowSize","keyExtractor","value","stickySectionHeadersEnabled","renderSectionHeader","renderSectionFooter","renderItem","onContentSizeChange","_width","height","makeAccessible","role","multiSelectable","ActionListBox","assignWithoutSideEffects","displayName"],"mappings":";;;;;;;;;;;AAqBA,IAAMA,cAAc,CAAGC,cAAK,CAACC,UAAU,CACrC,SAAAC,IAAA,CAAiFC,GAAG,CAAK,CAAA,IAAtFC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CAAEC,yBAAyB,CAAAH,IAAA,CAAzBG,yBAAyB,CAAEC,iBAAiB,CAAAJ,IAAA,CAAjBI,iBAAiB,CAAEC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CAC3E,IAAAC,qBAAA,CAA2CC,qBAAqB,EAAE,CAA1DC,YAAY,CAAAF,qBAAA,CAAZE,YAAY,CAAEC,gBAAgB,CAAAH,qBAAA,CAAhBG,gBAAgB,CAEtC,IAAMC,oBAAoB,CAAGZ,cAAK,CAACa,WAAW,CAAC,SAAAC,KAAA,CAAc,CAAA,IAAXC,IAAI,CAAAD,KAAA,CAAJC,IAAI,CACpD,OAAOC,GAAA,CAACC,cAAc,CAAAC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B,CACpDkB,UAAU,CAAElC,oBAAqB,CACjCT,GAAG,CAAEA,GAAW,CAChB4C,mBAAmB,CAAE,SAAAA,mBAAAA,CAACC,MAAM,CAAEC,MAAM,CAAK,CACvCtC,gBAAgB,CAACsC,MAAM,CAAC,CAC1B,CAAE,CAAA,CACEC,cAAc,CAAC,CACjBC,IAAI,CAAE9C,yBAAyB,CAC/B+C,eAAe,CAAE/C,yBAAyB,GAAK,SAAS,CAAGC,iBAAiB,CAAGqB,SACjF,CAAC,CAAC,CACH,CAAC,CAEN,CACF,CAAC,CAEK,IAAA0B,aAAa,CAAGC,wBAAwB,CAACvD,cAAc,CAAE,CAAEwD,WAAW,CAAE,eAAgB,CAAC;;;;"}
@@ -29,7 +29,7 @@ import { Box } from '../Box/Box.js';
29
29
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
30
30
  import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
31
31
 
32
- var centerBoxProps={display:'flex',alignItems:'center',justifyContent:'center',height:'28px'};var propRestrictionMap={Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{type:'body',size:'medium'}};var useTrailingRestriction=function useTrailingRestriction(trailing){var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap);if(__DEV__){if(!restrictedProps){throwBladeError({message:`Only one of \`${allowedComponents.join(', ')}\` component is accepted as trailing`,moduleName:'Header'});}}var restrictedPropKeys=Object.keys(propRestrictionMap[trailingComponentType]);for(var prop of restrictedPropKeys){var _trailing$props;if(trailing!=null&&(_trailing$props=trailing.props)!=null&&_trailing$props.hasOwnProperty(prop)){logger({message:`Do not pass "${prop}" to "${trailingComponentType}" while inside Header trailing, because we override it.`,moduleName:'Header',type:'warn'});}}setValidatedTrailingComponent(React__default.cloneElement(trailing,restrictedProps));}},[trailing]);return validatedTrailingComponent;};var _BaseHeader=function _BaseHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,_ref$showCloseButton=_ref.showCloseButton,showCloseButton=_ref$showCloseButton===void 0?true:_ref$showCloseButton,onBackButtonClick=_ref.onBackButtonClick,onCloseButtonClick=_ref.onCloseButtonClick,closeButtonRef=_ref.closeButtonRef,backButtonRef=_ref.backButtonRef,testID=_ref.testID,onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp,metaComponentName=_ref.metaComponentName,children=_ref.children;var validatedTrailingComponent=useTrailingRestriction(trailing);var shouldWrapTitle=titleSuffix&&trailing&&showBackButton&&showCloseButton;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};return jsxs(BaseBox,Object.assign({},metaAttribute({name:metaComponentName,testID:testID}),{children:[jsxs(BaseBox,Object.assign({marginY:{base:'spacing.5',m:'spacing.6'},paddingX:{base:'spacing.5',m:'spacing.6'},touchAction:"none"},webOnlyEventHandlers,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",userSelect:"none",children:[showBackButton?jsx(BaseBox,{overflow:"visible",marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{ref:backButtonRef,size:"large",icon:ChevronLeftIcon,onClick:function onClick(){return onBackButtonClick==null?void 0:onBackButtonClick();},accessibilityLabel:"Back"})}))}):null,jsxs(BaseBox,{paddingRight:"spacing.5",marginRight:"auto",flex:"auto",display:"flex",flexDirection:"row",alignItems:"flex-start",children:[leading?jsx(BaseBox,Object.assign({marginRight:"spacing.3"},centerBoxProps,{children:leading})):null,jsxs(BaseBox,{flex:"auto",children:[jsxs(BaseBox,{maxWidth:isReactNative()&&shouldWrapTitle?'100px':undefined,flexShrink:0,display:"flex",flexDirection:"row",children:[title?jsx(Text,{size:"large",marginTop:makeSize(size['1']),weight:"semibold",color:"surface.text.gray.normal",children:title}):null,titleSuffix&&jsx(BaseBox,{marginLeft:"spacing.3",children:jsx(Box,Object.assign({},centerBoxProps,{children:titleSuffix}))})]}),subtitle?jsx(Text,{variant:"body",size:"small",weight:"regular",color:"surface.text.gray.muted",children:subtitle}):null]})]}),validatedTrailingComponent?jsx(BaseBox,{marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:validatedTrailingComponent}))}):null,showCloseButton?jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{ref:closeButtonRef,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return onCloseButtonClick==null?void 0:onCloseButtonClick();}})})):null]}),children]})),showDivider?jsx(Divider,{}):null]}));};var BaseHeader=assignWithoutSideEffects(_BaseHeader,{componentId:'BaseHeader'});
32
+ var commonCenterBoxProps={display:'flex',alignItems:'center',justifyContent:'center'};var centerBoxProps={large:Object.assign({},commonCenterBoxProps,{height:'28px'}),medium:Object.assign({},commonCenterBoxProps,{height:'20px'})};var sizeTokensMapping={large:{title:'large'},medium:{title:'medium'}};var propRestrictionMap={large:{Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{type:'body',size:'medium'}},medium:{Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'small'},Link:{size:'small'},Text:{size:'small',variant:'body'},Amount:{type:'body',size:'small'}}};var useTrailingRestriction=function useTrailingRestriction(_ref){var trailing=_ref.trailing,size=_ref.size;var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[size][trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap[size]);if(__DEV__){if(!restrictedProps){throwBladeError({message:`Only one of \`${allowedComponents.join(', ')}\` component is accepted as trailing`,moduleName:'Header'});}}var restrictedPropKeys=Object.keys(propRestrictionMap[size][trailingComponentType]);for(var prop of restrictedPropKeys){var _trailing$props;if(trailing!=null&&(_trailing$props=trailing.props)!=null&&_trailing$props.hasOwnProperty(prop)){logger({message:`Do not pass "${prop}" to "${trailingComponentType}" while inside Header trailing, because we override it.`,moduleName:'Header',type:'warn'});}}setValidatedTrailingComponent(React__default.cloneElement(trailing,restrictedProps));}},[trailing,size]);return validatedTrailingComponent;};var _BaseHeader=function _BaseHeader(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle,leading=_ref2.leading,titleSuffix=_ref2.titleSuffix,trailing=_ref2.trailing,_ref2$showDivider=_ref2.showDivider,showDivider=_ref2$showDivider===void 0?true:_ref2$showDivider,_ref2$showBackButton=_ref2.showBackButton,showBackButton=_ref2$showBackButton===void 0?false:_ref2$showBackButton,_ref2$showCloseButton=_ref2.showCloseButton,showCloseButton=_ref2$showCloseButton===void 0?true:_ref2$showCloseButton,onBackButtonClick=_ref2.onBackButtonClick,onCloseButtonClick=_ref2.onCloseButtonClick,closeButtonRef=_ref2.closeButtonRef,backButtonRef=_ref2.backButtonRef,testID=_ref2.testID,onClickCapture=_ref2.onClickCapture,onKeyDown=_ref2.onKeyDown,onKeyUp=_ref2.onKeyUp,onLostPointerCapture=_ref2.onLostPointerCapture,onPointerCancel=_ref2.onPointerCancel,onPointerDown=_ref2.onPointerDown,onPointerMove=_ref2.onPointerMove,onPointerUp=_ref2.onPointerUp,metaComponentName=_ref2.metaComponentName,paddingX=_ref2.paddingX,marginY=_ref2.marginY,_ref2$size=_ref2.size,size$1=_ref2$size===void 0?'large':_ref2$size,isDisabled=_ref2.isDisabled,children=_ref2.children,trailingInteractionElement=_ref2.trailingInteractionElement;var validatedTrailingComponent=useTrailingRestriction({trailing:trailing,size:size$1});var shouldWrapTitle=titleSuffix&&trailing&&showBackButton&&showCloseButton;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};return jsxs(BaseBox,Object.assign({},metaAttribute({name:metaComponentName,testID:testID}),{children:[jsxs(BaseBox,Object.assign({marginY:marginY!=null?marginY:{base:'spacing.5',m:'spacing.6'},paddingX:paddingX!=null?paddingX:{base:'spacing.5',m:'spacing.6'},touchAction:"none"},webOnlyEventHandlers,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",userSelect:"none",children:[showBackButton?jsx(BaseBox,{overflow:"visible",marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps[size$1],{children:jsx(IconButton,{ref:backButtonRef,size:"large",icon:ChevronLeftIcon,onClick:function onClick(){return onBackButtonClick==null?void 0:onBackButtonClick();},accessibilityLabel:"Back"})}))}):null,jsxs(BaseBox,{paddingRight:"spacing.5",marginRight:"auto",flex:"auto",display:"flex",flexDirection:"row",alignItems:"flex-start",children:[leading?jsx(BaseBox,Object.assign({marginRight:"spacing.3"},centerBoxProps[size$1],{children:leading})):null,jsxs(BaseBox,{flex:"auto",children:[jsxs(BaseBox,{maxWidth:isReactNative()&&shouldWrapTitle?'100px':undefined,flexShrink:0,display:"flex",flexDirection:"row",children:[title?jsx(Text,{size:sizeTokensMapping[size$1].title,marginTop:makeSize(size['1']),weight:"semibold",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.normal',children:title}):null,titleSuffix&&jsx(BaseBox,{marginLeft:"spacing.3",children:jsx(Box,Object.assign({},centerBoxProps[size$1],{children:titleSuffix}))})]}),subtitle?jsx(Text,{variant:"body",size:"small",weight:"regular",color:isDisabled?'surface.text.gray.disabled':'surface.text.gray.muted',children:subtitle}):null]})]}),validatedTrailingComponent?jsx(BaseBox,{marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps[size$1],{children:validatedTrailingComponent}))}):null,showCloseButton?jsx(Box,Object.assign({},centerBoxProps[size$1],{children:jsx(IconButton,{ref:closeButtonRef,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return onCloseButtonClick==null?void 0:onCloseButtonClick();}})})):null,trailingInteractionElement&&!children?jsx(Box,Object.assign({},centerBoxProps[size$1],{children:trailingInteractionElement})):null]}),jsxs(BaseBox,{display:"flex",width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[jsx(Box,{children:children}),trailingInteractionElement&&children?jsx(Box,Object.assign({alignSelf:"flex-start"},centerBoxProps[size$1],{children:trailingInteractionElement})):null]})]})),showDivider?jsx(Divider,{}):null]}));};var BaseHeader=assignWithoutSideEffects(_BaseHeader,{componentId:'BaseHeader'});
33
33
 
34
34
  export { BaseHeader };
35
35
  //# sourceMappingURL=BaseHeader.js.map