{"version":3,"file":"CartLineQuantity.mjs","sources":["../../src/CartLineQuantity.tsx"],"sourcesContent":["import type {ComponentPropsWithoutRef, ElementType} from 'react';\nimport {useCartLine} from './CartLineProvider.js';\n\ninterface CartLineQuantityBaseProps<\n  ComponentGeneric extends ElementType = 'span',\n> {\n  /** An HTML tag or React Component to be rendered as the base element wrapper. The default is `span`. */\n  as?: ComponentGeneric;\n}\n\nexport type CartLineQuantityProps<ComponentGeneric extends ElementType> =\n  CartLineQuantityBaseProps<ComponentGeneric> &\n    Omit<\n      ComponentPropsWithoutRef<ComponentGeneric>,\n      keyof CartLineQuantityBaseProps<ComponentGeneric>\n    >;\n\n/**\n * The `<CartLineQuantity/>` component renders a `span` (or another element / component that can be customized by the `as` prop) with the cart line's quantity.\n *\n * It must be a descendent of a `<CartLineProvider/>` component, and uses the `useCartLine()` hook internally.\n */\nexport function CartLineQuantity<ComponentGeneric extends ElementType = 'span'>(\n  props: CartLineQuantityProps<ComponentGeneric>,\n): JSX.Element {\n  const cartLine = useCartLine();\n  const {as, ...passthroughProps} = props;\n\n  const Wrapper = as ? as : 'span';\n\n  return <Wrapper {...passthroughProps}>{cartLine.quantity}</Wrapper>;\n}\n"],"names":[],"mappings":";;AAsBO,SAAS,iBACd,OACa;AACb,QAAM,WAAW,YAAA;AACjB,QAAM,EAAC,IAAI,GAAG,iBAAA,IAAoB;AAElC,QAAM,UAAU,KAAK,KAAK;AAE1B,SAAO,oBAAC,SAAA,EAAS,GAAG,kBAAmB,mBAAS,UAAS;AAC3D;"}