UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

1 lines 3.23 kB
{"version":3,"file":"bleed.cjs","names":["createComponent","bleedStyle","varAttr"],"sources":["../../../../src/components/bleed/bleed.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProps, HTMLStyledProps } from \"../../core\"\nimport type { BleedStyle } from \"./bleed.style\"\nimport { createComponent, varAttr } from \"../../core\"\nimport { calc } from \"../../utils\"\nimport { bleedStyle } from \"./bleed.style\"\n\nexport interface BleedProps extends HTMLStyledProps {\n /**\n * The CSS `margin-block` property.\n */\n block?: CSSProps[\"marginBlock\"]\n /**\n * The CSS `margin-block-end` property.\n */\n blockEnd?: CSSProps[\"marginBlockEnd\"]\n /**\n * The CSS `margin-block-start` property.\n */\n blockStart?: CSSProps[\"marginBlockStart\"]\n /**\n * The CSS `margin-inline` property.\n */\n inline?: \"full\" | CSSProps[\"marginInline\"]\n /**\n * The CSS `margin-inline-end` property.\n */\n inlineEnd?: \"full\" | CSSProps[\"marginInlineEnd\"]\n /**\n * The CSS `margin-inline-start` property.\n */\n inlineStart?: \"full\" | CSSProps[\"marginInlineStart\"]\n}\n\nconst {\n PropsContext: BleedPropsContext,\n usePropsContext: useBleedPropsContext,\n withContext,\n} = createComponent<BleedProps, BleedStyle>(\"bleed\", bleedStyle)\n\nexport { BleedPropsContext, useBleedPropsContext }\n\n/**\n * `Bleed` is a component used to break an element from the boundaries of its container.\n *\n * @see https://yamada-ui.com/docs/components/bleed\n */\nexport const Bleed = withContext(\"div\")(\n undefined,\n ({\n block,\n blockEnd,\n blockStart,\n inline,\n inlineEnd,\n inlineStart,\n ...rest\n }) => {\n blockStart ??= block\n blockEnd ??= block\n inlineStart ??= inline\n inlineEnd ??= inline\n\n const inlineStartFull = inlineStart === \"full\"\n const inlineEndFull = inlineEnd === \"full\"\n\n const marginBlockStart = calc.negate(\"{block-start}\")\n const marginBlockEnd = calc.negate(\"{block-end}\")\n const marginInlineStart = inlineStartFull\n ? \"calc(50% - 50vw)\"\n : calc.negate(\"{inline-start}\")\n const marginInlineEnd = inlineEndFull\n ? \"calc(50% - 50vw)\"\n : calc.negate(\"{inline-end}\")\n\n return {\n ...rest,\n \"--block-end\": varAttr(blockEnd, \"spaces\"),\n \"--block-start\": varAttr(blockStart, \"spaces\"),\n \"--inline-end\": varAttr(inlineEnd, \"spaces\"),\n \"--inline-start\": varAttr(inlineStart, \"spaces\"),\n marginBlockEnd,\n marginBlockStart,\n marginInlineEnd,\n marginInlineStart,\n }\n },\n)\n"],"mappings":";;;;;;;;;AAmCA,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,gBACEA,yCAAwC,SAASC,+BAAW;;;;;;AAShE,MAAa,QAAQ,YAAY,MAAM,CACrC,SACC,EACC,OACA,UACA,YACA,QACA,WACA,YACA,GAAG,WACC;AACJ,gBAAe;AACf,cAAa;AACb,iBAAgB;AAChB,eAAc;CAEd,MAAM,kBAAkB,gBAAgB;CACxC,MAAM,gBAAgB,cAAc;CAEpC,MAAM,qDAAmB,KAAK,OAAO,gBAAgB;CACrD,MAAM,mDAAiB,KAAK,OAAO,cAAc;CACjD,MAAM,oBAAoB,kBACtB,uDACA,KAAK,OAAO,iBAAiB;CACjC,MAAM,kBAAkB,gBACpB,uDACA,KAAK,OAAO,eAAe;AAE/B,QAAO;EACL,GAAG;EACH,eAAeC,oBAAQ,UAAU,SAAS;EAC1C,iBAAiBA,oBAAQ,YAAY,SAAS;EAC9C,gBAAgBA,oBAAQ,WAAW,SAAS;EAC5C,kBAAkBA,oBAAQ,aAAa,SAAS;EAChD;EACA;EACA;EACA;EACD;EAEJ"}