{"ast":null,"code":"import * as React from 'react';\nexport const ListAccordionGroupContext = React.createContext(null);\nconst ListAccordionGroup = ({\n  expandedId: expandedIdProp,\n  onAccordionPress,\n  children\n}) => {\n  const [expandedId, setExpandedId] = React.useState(undefined);\n  const onAccordionPressDefault = newExpandedId => {\n    setExpandedId(currentExpandedId => currentExpandedId === newExpandedId ? undefined : newExpandedId);\n  };\n  return React.createElement(ListAccordionGroupContext.Provider, {\n    value: {\n      expandedId: expandedIdProp || expandedId,\n      onAccordionPress: onAccordionPress || onAccordionPressDefault\n    }\n  }, children);\n};\nListAccordionGroup.displayName = 'List.AccordionGroup';\nexport default ListAccordionGroup;","map":{"version":3,"names":["React","ListAccordionGroupContext","createContext","ListAccordionGroup","expandedId","expandedIdProp","onAccordionPress","children","setExpandedId","useState","undefined","onAccordionPressDefault","newExpandedId","currentExpandedId","createElement","Provider","value","displayName"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/List/ListAccordionGroup.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type Props = {\n  /**\n   * Function to execute on selection change.\n   */\n  onAccordionPress?: (expandedId: string | number) => void;\n  /**\n   * Id of the currently expanded list accordion\n   */\n  expandedId?: string | number;\n  /**\n   * React elements containing list accordions\n   */\n  children: React.ReactNode;\n};\n\nexport type ListAccordionGroupContextType = {\n  expandedId: string | number | undefined;\n  onAccordionPress: (expandedId: string | number) => void;\n} | null;\n\nexport const ListAccordionGroupContext =\n  React.createContext<ListAccordionGroupContextType>(null);\n\n/**\n * List.AccordionGroup allows to control a group of List Accordions. `id` prop for List.Accordion is required in order for group to work.\n * List.AccordionGroup can be a controlled or uncontrolled component. The example shows the uncontrolled version.\n * At most one Accordion can be expanded at a given time.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { View, Text } from 'react-native';\n * import { List } from 'react-native-paper';\n *\n * const MyComponent = () => (\n *   <List.AccordionGroup>\n *     <List.Accordion title=\"Accordion 1\" id=\"1\">\n *       <List.Item title=\"Item 1\" />\n *     </List.Accordion>\n *     <List.Accordion title=\"Accordion 2\" id=\"2\">\n *       <List.Item title=\"Item 2\" />\n *     </List.Accordion>\n *     <View>\n *       <Text>\n *         List.Accordion can be wrapped because implementation uses React.Context.\n *       </Text>\n *       <List.Accordion title=\"Accordion 3\" id=\"3\">\n *         <List.Item title=\"Item 3\" />\n *       </List.Accordion>\n *     </View>\n *   </List.AccordionGroup>\n * );\n *\n * export default MyComponent;\n *```\n */\nconst ListAccordionGroup = ({\n  expandedId: expandedIdProp,\n  onAccordionPress,\n  children,\n}: Props) => {\n  const [expandedId, setExpandedId] = React.useState<\n    string | number | undefined\n  >(undefined);\n\n  const onAccordionPressDefault = (newExpandedId: string | number) => {\n    setExpandedId((currentExpandedId) =>\n      currentExpandedId === newExpandedId ? undefined : newExpandedId\n    );\n  };\n\n  return (\n    <ListAccordionGroupContext.Provider\n      value={{\n        expandedId: expandedIdProp || expandedId, // component can be controlled or uncontrolled\n        onAccordionPress: onAccordionPress || onAccordionPressDefault,\n      }}\n    >\n      {children}\n    </ListAccordionGroupContext.Provider>\n  );\n};\n\nListAccordionGroup.displayName = 'List.AccordionGroup';\n\nexport default ListAccordionGroup;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAsB9B,OAAO,MAAMC,yBAAyB,GACpCD,KAAK,CAACE,aAAa,CAAgC,IAAI,CAAC;AAmC1D,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,UAAU,EAAEC,cAAc;EAC1BC,gBAAgB;EAChBC;AACK,CAAC,KAAK;EACX,MAAM,CAACH,UAAU,EAAEI,aAAa,CAAC,GAAGR,KAAK,CAACS,QAAQ,CAEhDC,SAAS,CAAC;EAEZ,MAAMC,uBAAuB,GAAIC,aAA8B,IAAK;IAClEJ,aAAa,CAAEK,iBAAiB,IAC9BA,iBAAiB,KAAKD,aAAa,GAAGF,SAAS,GAAGE,aACpD,CAAC;EACH,CAAC;EAED,OACEZ,KAAA,CAAAc,aAAA,CAACb,yBAAyB,CAACc,QAAQ;IACjCC,KAAK,EAAE;MACLZ,UAAU,EAAEC,cAAc,IAAID,UAAU;MACxCE,gBAAgB,EAAEA,gBAAgB,IAAIK;IACxC;EAAE,GAEDJ,QACiC,CAAC;AAEzC,CAAC;AAEDJ,kBAAkB,CAACc,WAAW,GAAG,qBAAqB;AAEtD,eAAed,kBAAkB","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}