@spark-ui/components
Version:
Spark (Leboncoin design system) components.
1 lines • 4.77 kB
Source Map (JSON)
{"version":3,"sources":["../../src/collapsible/Content.tsx","../../src/collapsible/useRenderSlot.tsx","../../src/collapsible/Root.tsx","../../src/collapsible/Trigger.tsx","../../src/collapsible/index.ts"],"sourcesContent":["import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ContentProps extends ComponentProps<typeof Collapsible.Panel> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Content = ({\n asChild = false,\n className,\n children,\n hiddenUntilFound = true,\n ...props\n}: ContentProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Panel\n data-spark-component=\"collapsible-content\"\n className={cx(\n 'overflow-hidden',\n 'h-[var(--collapsible-panel-height)]',\n 'transition-all duration-200',\n 'motion-reduce:transition-none',\n 'data-[starting-style]:h-0',\n 'data-[ending-style]:h-0',\n className\n )}\n render={renderSlot}\n hiddenUntilFound={hiddenUntilFound}\n {...props}\n >\n {children}\n </Collapsible.Panel>\n )\n}\n\nContent.displayName = 'Collapsible.Content'\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface RootProps extends ComponentProps<typeof Collapsible.Root> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Root = ({ asChild = false, children, ...props }: RootProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Root data-spark-component=\"collapsible\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Root>\n )\n}\n\nRoot.displayName = 'Collapsible'\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TriggerProps extends ComponentProps<'button'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Trigger = ({ asChild = false, children, ...props }: TriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return (\n <Collapsible.Trigger data-spark-component=\"collapsible-trigger\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Trigger>\n )\n}\n\nTrigger.displayName = 'Collapsible.Trigger'\n","import { Content } from './Content'\nimport { Root } from './Root'\nimport { Trigger } from './Trigger'\n\nexport const Collapsible: typeof Root & {\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n Trigger,\n Content,\n})\n\nCollapsible.displayName = 'Collapsible'\nTrigger.displayName = 'Collapsible.Trigger'\nContent.displayName = 'Collapsible.Content'\n"],"mappings":";;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,UAAU;;;ACIkB;AAH9B,SAAS,cAAc,SAAkB,YAAoB;AAClE,QAAM,YAAY,UAAU,OAAO;AAEnC,SAAO,UAAU,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,aAAW,GAAG,OAAO,IAAK;AAChE;;;ADiBI,gBAAAA,YAAA;AAVG,IAAM,UAAU,CAAC;AAAA,EACtB,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,GAAG;AACL,MAAoB;AAClB,QAAM,aAAa,cAAc,SAAS,KAAK;AAE/C,SACE,gBAAAA;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACC,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