@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 2.08 kB
Source Map (JSON)
{"version":3,"file":"group.cjs","names":["createComponent","groupStyle","Flex","useValue","useGroup"],"sources":["../../../../src/components/group/group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ThemeProps } from \"../../core\"\nimport type { FlexProps } from \"../flex\"\nimport type { GroupStyle } from \"./group.style\"\nimport { createComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { dataAttr } from \"../../utils\"\nimport { Flex } from \"../flex\"\nimport { groupStyle } from \"./group.style\"\nimport { useGroup } from \"./use-group\"\n\nexport interface GroupProps\n extends Omit<FlexProps, \"grow\">,\n ThemeProps<GroupStyle> {}\n\nconst {\n PropsContext: GroupPropsContext,\n usePropsContext: useGroupPropsContext,\n withContext,\n} = createComponent<GroupProps, GroupStyle>(\"group\", groupStyle)\n\nexport { GroupPropsContext, useGroupPropsContext }\n\n/**\n * `Group` is a component that groups and attaches multiple elements together.\n *\n * @see https://yamada-ui.com/docs/components/group\n */\nexport const Group = withContext<\"div\", GroupProps, \"attached\" | \"orientation\">(\n Flex,\n { transferProps: [\"attached\", \"orientation\"] },\n)(\n undefined,\n ({\n attached: attachedProp,\n children,\n orientation: orientationProp,\n ...rest\n }) => {\n const orientation = useValue(orientationProp)\n const attached = useValue(attachedProp)\n const cloneChildren = useGroup(children)\n\n return {\n \"data-attached\": dataAttr(attached),\n \"data-orientation\": orientation,\n children: cloneChildren,\n role: \"group\",\n ...rest,\n }\n },\n)\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,gBACEA,yCAAwC,SAASC,+BAAW;;;;;;AAShE,MAAa,QAAQ,YACnBC,mBACA,EAAE,eAAe,CAAC,YAAY,cAAc,EAAE,CAC/C,CACC,SACC,EACC,UAAU,cACV,UACA,aAAa,gBACb,GAAG,WACC;CACJ,MAAM,cAAcC,uCAAS,gBAAgB;CAC7C,MAAM,WAAWA,uCAAS,aAAa;CACvC,MAAM,gBAAgBC,2BAAS,SAAS;AAExC,QAAO;EACL,iEAA0B,SAAS;EACnC,oBAAoB;EACpB,UAAU;EACV,MAAM;EACN,GAAG;EACJ;EAEJ"}