@bedrock-layout/center
Advanced tools
Comparing version 3.1.7 to 3.1.8
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@bedrock-layout/spacing-constants"),d=require("@bedrock-layout/type-utils"),C=require("react"),n=d.forwardRefWithAs(({as:r,centerChildren:o,centerText:s,maxWidth:e,style:c,...i},l)=>{const a=t.useTheme(),u=[s&&"center-text",o&&"center-children"].filter(f=>f).join(" "),p=c??{},y=r??"div";return C.createElement(y,{"data-bedrock-center":u,ref:l,style:{"--maxWidth":typeof e=="number"&&e>0?`${e}px`:t.getSizeValue(a,e)??e,...p},...i})});n.displayName="Center";exports.Center=n; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@bedrock-layout/spacing-constants"),C=require("@bedrock-layout/type-utils"),d=require("react"),n=C.forwardRefWithAs(function({as:r,centerChildren:o,centerText:c,maxWidth:e,style:s,...i},l){const u=t.useTheme(),a=[c&&"center-text",o&&"center-children"].filter(y=>y).join(" "),p=s??{},f=r??"div";return d.createElement(f,{"data-bedrock-center":a,ref:l,style:{"--maxWidth":typeof e=="number"&&e>0?`${e}px`:t.getSizeValue(u,e)??e,...p},...i})});n.displayName="Center";exports.Center=n; |
import { CSSLength, SizesOptions } from "@bedrock-layout/spacing-constants"; | ||
type MaxWidth = number | CSSLength | SizesOptions; | ||
/** | ||
* The `maxWidth` prop can accept any positive integer, `CSSLength`, `SizeOption`. | ||
*/ | ||
export type MaxWidth = number | CSSLength | SizesOptions; | ||
/** | ||
* Props for the Center component. | ||
*/ | ||
export interface CenterProps { | ||
/** | ||
* Sets the max-inline size of the component. | ||
* The `maxWidth` prop can accept any positive integer, `CSSLength`, `SizeOption`. | ||
*/ | ||
maxWidth?: MaxWidth; | ||
/** | ||
* Sets the text alignment of the component to center. | ||
*/ | ||
centerText?: boolean; | ||
/** | ||
* Sets the alignment of the component's children to be centered. | ||
*/ | ||
centerChildren?: boolean; | ||
} | ||
/** | ||
* The `Center` component is designed to center and clamp its width at a predefined value. | ||
* By default, this value is set to the `medium` breakpoint. | ||
* You can also center the children and text alignment as well. | ||
*/ | ||
export declare const Center: import("@bedrock-layout/type-utils").PolymorphicForwardedRefComponent<"div", CenterProps>; | ||
export {}; |
import { useTheme as a, getSizeValue as u } from "@bedrock-layout/spacing-constants"; | ||
import { forwardRefWithAs as y } from "@bedrock-layout/type-utils"; | ||
import d from "react"; | ||
const C = y( | ||
({ as: t, centerChildren: r, centerText: o, maxWidth: e, style: n, ...c }, s) => { | ||
const m = a(), p = [ | ||
o && "center-text", | ||
r && "center-children" | ||
].filter((l) => l).join(" "), f = n ?? {}, i = t ?? "div"; | ||
return /* @__PURE__ */ d.createElement( | ||
i, | ||
{ | ||
"data-bedrock-center": p, | ||
ref: s, | ||
style: { | ||
"--maxWidth": typeof e == "number" && e > 0 ? `${e}px` : u(m, e) ?? e, | ||
...f | ||
}, | ||
...c | ||
} | ||
); | ||
} | ||
); | ||
C.displayName = "Center"; | ||
import C from "react"; | ||
const d = y(function({ as: t, centerChildren: r, centerText: n, maxWidth: e, style: o, ...c }, s) { | ||
const f = a(), m = [ | ||
n && "center-text", | ||
r && "center-children" | ||
].filter((l) => l).join(" "), p = o ?? {}, i = t ?? "div"; | ||
return /* @__PURE__ */ C.createElement( | ||
i, | ||
{ | ||
"data-bedrock-center": m, | ||
ref: s, | ||
style: { | ||
"--maxWidth": typeof e == "number" && e > 0 ? `${e}px` : u(f, e) ?? e, | ||
...p | ||
}, | ||
...c | ||
} | ||
); | ||
}); | ||
d.displayName = "Center"; | ||
export { | ||
C as Center | ||
d as Center | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@bedrock-layout/spacing-constants"),require("@bedrock-layout/type-utils"),require("react")):typeof define=="function"&&define.amd?define(["exports","@bedrock-layout/spacing-constants","@bedrock-layout/type-utils","react"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.center={},e.spacingConstants,e.typeUtils,e.React))})(this,function(e,t,o,c){"use strict";const r=o.forwardRefWithAs(({as:s,centerChildren:i,centerText:u,maxWidth:n,style:d,...f},p)=>{const y=t.useTheme(),a=[u&&"center-text",i&&"center-children"].filter(m=>m).join(" "),l=d??{},b=s??"div";return c.createElement(b,{"data-bedrock-center":a,ref:p,style:{"--maxWidth":typeof n=="number"&&n>0?`${n}px`:t.getSizeValue(y,n)??n,...l},...f})});r.displayName="Center",e.Center=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); | ||
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@bedrock-layout/spacing-constants"),require("@bedrock-layout/type-utils"),require("react")):typeof define=="function"&&define.amd?define(["exports","@bedrock-layout/spacing-constants","@bedrock-layout/type-utils","react"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.center={},e.spacingConstants,e.typeUtils,e.React))})(this,function(e,t,o,c){"use strict";const r=o.forwardRefWithAs(function({as:s,centerChildren:i,centerText:u,maxWidth:n,style:d,...f},p){const y=t.useTheme(),a=[u&&"center-text",i&&"center-children"].filter(m=>m).join(" "),l=d??{},b=s??"div";return c.createElement(b,{"data-bedrock-center":a,ref:p,style:{"--maxWidth":typeof n=="number"&&n>0?`${n}px`:t.getSizeValue(y,n)??n,...l},...f})});r.displayName="Center",e.Center=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "@bedrock-layout/center", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"description": "bedrock-layout center", | ||
@@ -62,3 +62,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "c44ae37688f22756d6451f5d1fbfa128ab4bd42d" | ||
"gitHead": "90187d6a9c3356e91fa67c638e9093cd26b145cd" | ||
} |
7117
61