{"version":3,"file":"CartLineQuantity.mjs","names":[],"sources":["../../src/CartLineQuantity.tsx"],"sourcesContent":["import type {ComponentPropsWithoutRef, ElementType} from 'react';\nimport {useCartLine} from './CartLineProvider.js';\n\n/** @publicDocs */\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 * @publicDocs\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"],"mappings":";;;;;;;;;AAwBA,SAAgB,iBACd,OACa;CACb,MAAM,WAAW,aAAa;CAC9B,MAAM,EAAC,IAAI,GAAG,qBAAoB;AAIlC,QAAO,oBAFS,KAAK,KAAK,QAEnB;EAAS,GAAI;YAAmB,SAAS;EAAmB,CAAA"}