@bedrock-layout/center
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@bedrock-layout/spacing-constants"),c=require("react"),C=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},_=C(c),a=c.forwardRef(({as:e,centerChildren:u,centerText:s,maxWidth:t,style:n,...l},i)=>{var r;const f=o.useTheme(),d=[s&&"center-text",u&&"center-children"].filter(g=>g).join(" "),p=n!=null?n:{},b=e!=null?e:"div";return _.default.createElement(b,{"data-bedrock-center":d,ref:i,style:{"--maxWidth":typeof t=="number"&&t>0?`${t}px`:(r=o.getSizeValue(f,t))!=null?r:t,...p},...l})});a.displayName="Center";exports.Center=a; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@bedrock-layout/spacing-constants"),y=require("@bedrock-layout/type-utils"),g=require("react"),C=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},_=C(g),c=y.forwardRefWithAs(({as:e,centerChildren:u,centerText:s,maxWidth:t,style:n,...a},i)=>{var r;const l=o.useTheme(),d=[s&&"center-text",u&&"center-children"].filter(b=>b).join(" "),f=n!=null?n:{},p=e!=null?e:"div";return _.default.createElement(p,{"data-bedrock-center":d,ref:i,style:{"--maxWidth":typeof t=="number"&&t>0?`${t}px`:(r=o.getSizeValue(l,t))!=null?r:t,...f},...a})});c.displayName="Center";exports.Center=c; |
import { CSSLength, SizesOptions } from "@bedrock-layout/spacing-constants"; | ||
import { PolymorphicComponentPropsWithRef } from "@bedrock-layout/type-utils"; | ||
import React, { ElementType } from "react"; | ||
type MaxWidth = number | CSSLength | SizesOptions; | ||
interface CenterPropsBase { | ||
export interface CenterProps { | ||
maxWidth?: MaxWidth; | ||
@@ -10,4 +8,3 @@ centerText?: boolean; | ||
} | ||
export type CenterProps<C extends ElementType = "div"> = PolymorphicComponentPropsWithRef<C, CenterPropsBase>; | ||
export declare const Center: React.ForwardRefExoticComponent<Pick<CenterProps<React.ElementType<any>>, string | number | symbol> & React.RefAttributes<unknown>>; | ||
export declare const Center: import("@bedrock-layout/type-utils").PolymorphicForwardedRefComponent<"div", CenterProps>; | ||
export {}; |
@@ -1,25 +0,19 @@ | ||
import { useTheme as C, getSizeValue as a } from "@bedrock-layout/spacing-constants"; | ||
import b, { forwardRef as s } from "react"; | ||
const R = s( | ||
({ | ||
as: r, | ||
centerChildren: o, | ||
centerText: c, | ||
maxWidth: e, | ||
style: t, | ||
...p | ||
}, f) => { | ||
var n; | ||
const m = C(), i = [ | ||
import { useTheme as s, getSizeValue as C } from "@bedrock-layout/spacing-constants"; | ||
import { forwardRefWithAs as a } from "@bedrock-layout/type-utils"; | ||
import b from "react"; | ||
const R = a( | ||
({ as: r, centerChildren: n, centerText: c, maxWidth: e, style: t, ...m }, p) => { | ||
var o; | ||
const f = s(), i = [ | ||
c && "center-text", | ||
o && "center-children" | ||
n && "center-children" | ||
].filter((l) => l).join(" "), u = t != null ? t : {}, d = r != null ? r : "div"; | ||
return /* @__PURE__ */ b.createElement(d, { | ||
"data-bedrock-center": i, | ||
ref: f, | ||
ref: p, | ||
style: { | ||
"--maxWidth": typeof e == "number" && e > 0 ? `${e}px` : (n = a(m, e)) != null ? n : e, | ||
"--maxWidth": typeof e == "number" && e > 0 ? `${e}px` : (o = C(f, e)) != null ? o : e, | ||
...u | ||
}, | ||
...p | ||
...m | ||
}); | ||
@@ -26,0 +20,0 @@ } |
@@ -1,1 +0,1 @@ | ||
(function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@bedrock-layout/spacing-constants"),require("react")):typeof define=="function"&&define.amd?define(["exports","@bedrock-layout/spacing-constants","react"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.center={},t.spacingConstants,t.React))})(this,function(t,n,c){"use strict";const f=(e=>e&&typeof e=="object"&&"default"in e?e:{default:e})(c),u=c.forwardRef(({as:e,centerChildren:d,centerText:s,maxWidth:o,style:r,...a},p)=>{var i;const l=n.useTheme(),y=[s&&"center-text",d&&"center-children"].filter(_=>_).join(" "),b=r!=null?r:{},m=e!=null?e:"div";return f.default.createElement(m,{"data-bedrock-center":y,ref:p,style:{"--maxWidth":typeof o=="number"&&o>0?`${o}px`:(i=n.getSizeValue(l,o))!=null?i:o,...b},...a})});u.displayName="Center",t.Center=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(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"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.center={},e.spacingConstants,e.typeUtils,e.React))})(this,function(e,n,i,f){"use strict";const s=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(f),c=i.forwardRefWithAs(({as:t,centerChildren:d,centerText:a,maxWidth:o,style:r,...p},l)=>{var u;const y=n.useTheme(),b=[a&&"center-text",d&&"center-children"].filter(k=>k).join(" "),m=r!=null?r:{},_=t!=null?t:"div";return s.default.createElement(_,{"data-bedrock-center":b,ref:l,style:{"--maxWidth":typeof o=="number"&&o>0?`${o}px`:(u=n.getSizeValue(y,o))!=null?u:o,...m},...p})});c.displayName="Center",e.Center=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "@bedrock-layout/center", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "bedrock-layout center", | ||
@@ -39,3 +39,3 @@ "sideEffects": false, | ||
"@bedrock-layout/spacing-constants": "^3.1.0", | ||
"@bedrock-layout/type-utils": "^0.1.0" | ||
"@bedrock-layout/type-utils": "^0.1.1" | ||
}, | ||
@@ -63,3 +63,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5ae7c1b4aee89c16df12da9c2ec3ec02b9cfb258" | ||
"gitHead": "ad16bb299936a637db82ef9d9b28e528f65104ce" | ||
} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
6744
41