@a4banana/react-layout-primitives 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ "use strict";const M=require("react"),z={Start:"start",End:"end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},W={Top:"top",Bottom:"bottom",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},U={Start:"start",Center:"center",End:"end",Stretch:"stretch"},q={Top:"top",Center:"center",Bottom:"bottom",Stretch:"stretch"},F={start:"flex-start",end:"flex-end",top:"flex-start",bottom:"flex-end",center:"center",stretch:"stretch","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"};var S={exports:{}},_={};var D;function ce(){if(D)return _;D=1;var l=Symbol.for("react.transitional.element"),d=Symbol.for("react.fragment");function i(f,o,s){var c=null;if(s!==void 0&&(c=""+s),o.key!==void 0&&(c=""+o.key),"key"in o){s={};for(var u in o)u!=="key"&&(s[u]=o[u])}else s=o;return o=s.ref,{$$typeof:l,type:f,key:c,ref:o!==void 0?o:null,props:s}}return _.Fragment=d,_.jsx=i,_.jsxs=i,_}var b={};var L;function ue(){return L||(L=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case Z:return"Profiler";case X:return"StrictMode";case re:return"Suspense";case te:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case H:return"Portal";case K:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ne:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case g:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function d(e){return""+e}function i(e){try{d(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),d(e)}}function f(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===g)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=x.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function c(e){if(j.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function u(e,r){function t(){C||(C=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function y(){var e=l(this.type);return N[e]||(N[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function k(e,r,t,n,A,h){var a=t.ref;return e={$$typeof:T,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:y}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:h}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function E(e,r,t,n,A,h){var a=r.children;if(a!==void 0)if(n)if(se(a)){for(n=0;n<a.length;n++)v(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(a);if(j.call(r,"key")){a=l(e);var p=Object.keys(r).filter(function(le){return le!=="key"});n=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",I[a+n]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,n,a,p,a),I[a+n]=!0)}if(a=null,t!==void 0&&(i(t),a=""+t),c(r)&&(i(r.key),a=""+r.key),"key"in r){t={};for(var P in r)P!=="key"&&(t[P]=r[P])}else t=r;return a&&u(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),k(e,a,t,o(),A,h)}function v(e){R(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===g&&(e._payload.status==="fulfilled"?R(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function R(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var m=M,T=Symbol.for("react.transitional.element"),H=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),K=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),x=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,se=Array.isArray,O=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var C,N={},Y=m.react_stack_bottom_frame.bind(m,s)(),$=O(f(s)),I={};b.Fragment=w,b.jsx=function(e,r,t){var n=1e4>x.recentlyCreatedOwnerStacks++;return E(e,r,t,!1,n?Error("react-stack-top-frame"):Y,n?O(f(e)):$)},b.jsxs=function(e,r,t){var n=1e4>x.recentlyCreatedOwnerStacks++;return E(e,r,t,!0,n?Error("react-stack-top-frame"):Y,n?O(f(e)):$)}})()),b}var V;function ie(){return V||(V=1,process.env.NODE_ENV==="production"?S.exports=ce():S.exports=ue()),S.exports}var fe=ie();function J(l){const{direction:d,defaultArrangement:i,defaultAlignment:f}=l;return({children:s=null,arrangement:c=i,alignment:u=f,style:y={},className:k="",gap:E=0,as:v="div",ref:R,...m})=>{const T=M.useMemo(()=>({display:"flex",flexDirection:d,gap:`${E}px`,justifyContent:F[c]??c,alignItems:F[u]??u}),[E,c,u]);return fe.jsx(v,{ref:R,style:{...T,...y},className:k,...m,children:s})}}const B=J({direction:"row",defaultArrangement:z.Start,defaultAlignment:q.Stretch});B.displayName="Row";const G=J({direction:"column",defaultArrangement:W.Top,defaultAlignment:U.Stretch});G.displayName="Column";exports.Column=G;exports.HorizontalAlignment=U;exports.HorizontalArrangement=z;exports.Row=B;exports.VerticalAlignment=q;exports.VerticalArrangement=W;
@@ -0,0 +1,348 @@
1
+ import re, { useMemo as te } from "react";
2
+ const ne = {
3
+ Start: "start",
4
+ End: "end",
5
+ Center: "center",
6
+ SpaceBetween: "space-between",
7
+ SpaceAround: "space-around",
8
+ SpaceEvenly: "space-evenly"
9
+ }, ae = {
10
+ Top: "top",
11
+ Bottom: "bottom",
12
+ Center: "center",
13
+ SpaceBetween: "space-between",
14
+ SpaceAround: "space-around",
15
+ SpaceEvenly: "space-evenly"
16
+ }, oe = {
17
+ Start: "start",
18
+ Center: "center",
19
+ End: "end",
20
+ Stretch: "stretch"
21
+ }, se = {
22
+ Top: "top",
23
+ Center: "center",
24
+ Bottom: "bottom",
25
+ Stretch: "stretch"
26
+ }, F = {
27
+ start: "flex-start",
28
+ end: "flex-end",
29
+ top: "flex-start",
30
+ bottom: "flex-end",
31
+ center: "center",
32
+ stretch: "stretch",
33
+ "space-between": "space-between",
34
+ "space-around": "space-around",
35
+ "space-evenly": "space-evenly"
36
+ };
37
+ var A = { exports: {} }, _ = {};
38
+ var D;
39
+ function le() {
40
+ if (D) return _;
41
+ D = 1;
42
+ var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
43
+ function i(f, o, s) {
44
+ var c = null;
45
+ if (s !== void 0 && (c = "" + s), o.key !== void 0 && (c = "" + o.key), "key" in o) {
46
+ s = {};
47
+ for (var u in o)
48
+ u !== "key" && (s[u] = o[u]);
49
+ } else s = o;
50
+ return o = s.ref, {
51
+ $$typeof: l,
52
+ type: f,
53
+ key: c,
54
+ ref: o !== void 0 ? o : null,
55
+ props: s
56
+ };
57
+ }
58
+ return _.Fragment = d, _.jsx = i, _.jsxs = i, _;
59
+ }
60
+ var b = {};
61
+ var L;
62
+ function ce() {
63
+ return L || (L = 1, process.env.NODE_ENV !== "production" && (function() {
64
+ function l(e) {
65
+ if (e == null) return null;
66
+ if (typeof e == "function")
67
+ return e.$$typeof === Q ? null : e.displayName || e.name || null;
68
+ if (typeof e == "string") return e;
69
+ switch (e) {
70
+ case w:
71
+ return "Fragment";
72
+ case z:
73
+ return "Profiler";
74
+ case U:
75
+ return "StrictMode";
76
+ case G:
77
+ return "Suspense";
78
+ case H:
79
+ return "SuspenseList";
80
+ case Z:
81
+ return "Activity";
82
+ }
83
+ if (typeof e == "object")
84
+ switch (typeof e.tag == "number" && console.error(
85
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
86
+ ), e.$$typeof) {
87
+ case W:
88
+ return "Portal";
89
+ case J:
90
+ return e.displayName || "Context";
91
+ case q:
92
+ return (e._context.displayName || "Context") + ".Consumer";
93
+ case B:
94
+ var r = e.render;
95
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
96
+ case X:
97
+ return r = e.displayName || null, r !== null ? r : l(e.type) || "Memo";
98
+ case x:
99
+ r = e._payload, e = e._init;
100
+ try {
101
+ return l(e(r));
102
+ } catch {
103
+ }
104
+ }
105
+ return null;
106
+ }
107
+ function d(e) {
108
+ return "" + e;
109
+ }
110
+ function i(e) {
111
+ try {
112
+ d(e);
113
+ var r = !1;
114
+ } catch {
115
+ r = !0;
116
+ }
117
+ if (r) {
118
+ r = console;
119
+ var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
120
+ return t.call(
121
+ r,
122
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
123
+ n
124
+ ), d(e);
125
+ }
126
+ }
127
+ function f(e) {
128
+ if (e === w) return "<>";
129
+ if (typeof e == "object" && e !== null && e.$$typeof === x)
130
+ return "<...>";
131
+ try {
132
+ var r = l(e);
133
+ return r ? "<" + r + ">" : "<...>";
134
+ } catch {
135
+ return "<...>";
136
+ }
137
+ }
138
+ function o() {
139
+ var e = O.A;
140
+ return e === null ? null : e.getOwner();
141
+ }
142
+ function s() {
143
+ return Error("react-stack-top-frame");
144
+ }
145
+ function c(e) {
146
+ if (j.call(e, "key")) {
147
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
148
+ if (r && r.isReactWarning) return !1;
149
+ }
150
+ return e.key !== void 0;
151
+ }
152
+ function u(e, r) {
153
+ function t() {
154
+ C || (C = !0, console.error(
155
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
156
+ r
157
+ ));
158
+ }
159
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
160
+ get: t,
161
+ configurable: !0
162
+ });
163
+ }
164
+ function y() {
165
+ var e = l(this.type);
166
+ return N[e] || (N[e] = !0, console.error(
167
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
168
+ )), e = this.props.ref, e !== void 0 ? e : null;
169
+ }
170
+ function k(e, r, t, n, S, h) {
171
+ var a = t.ref;
172
+ return e = {
173
+ $$typeof: T,
174
+ type: e,
175
+ key: r,
176
+ props: t,
177
+ _owner: n
178
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
179
+ enumerable: !1,
180
+ get: y
181
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
182
+ configurable: !1,
183
+ enumerable: !1,
184
+ writable: !0,
185
+ value: 0
186
+ }), Object.defineProperty(e, "_debugInfo", {
187
+ configurable: !1,
188
+ enumerable: !1,
189
+ writable: !0,
190
+ value: null
191
+ }), Object.defineProperty(e, "_debugStack", {
192
+ configurable: !1,
193
+ enumerable: !1,
194
+ writable: !0,
195
+ value: S
196
+ }), Object.defineProperty(e, "_debugTask", {
197
+ configurable: !1,
198
+ enumerable: !1,
199
+ writable: !0,
200
+ value: h
201
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
202
+ }
203
+ function E(e, r, t, n, S, h) {
204
+ var a = r.children;
205
+ if (a !== void 0)
206
+ if (n)
207
+ if (K(a)) {
208
+ for (n = 0; n < a.length; n++)
209
+ v(a[n]);
210
+ Object.freeze && Object.freeze(a);
211
+ } else
212
+ console.error(
213
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
214
+ );
215
+ else v(a);
216
+ if (j.call(r, "key")) {
217
+ a = l(e);
218
+ var p = Object.keys(r).filter(function(ee) {
219
+ return ee !== "key";
220
+ });
221
+ n = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", I[a + n] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
222
+ `A props object containing a "key" prop is being spread into JSX:
223
+ let props = %s;
224
+ <%s {...props} />
225
+ React keys must be passed directly to JSX without using spread:
226
+ let props = %s;
227
+ <%s key={someKey} {...props} />`,
228
+ n,
229
+ a,
230
+ p,
231
+ a
232
+ ), I[a + n] = !0);
233
+ }
234
+ if (a = null, t !== void 0 && (i(t), a = "" + t), c(r) && (i(r.key), a = "" + r.key), "key" in r) {
235
+ t = {};
236
+ for (var P in r)
237
+ P !== "key" && (t[P] = r[P]);
238
+ } else t = r;
239
+ return a && u(
240
+ t,
241
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
242
+ ), k(
243
+ e,
244
+ a,
245
+ t,
246
+ o(),
247
+ S,
248
+ h
249
+ );
250
+ }
251
+ function v(e) {
252
+ R(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === x && (e._payload.status === "fulfilled" ? R(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
253
+ }
254
+ function R(e) {
255
+ return typeof e == "object" && e !== null && e.$$typeof === T;
256
+ }
257
+ var m = re, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), U = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), q = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), B = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), H = /* @__PURE__ */ Symbol.for("react.suspense_list"), X = /* @__PURE__ */ Symbol.for("react.memo"), x = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), O = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, K = Array.isArray, g = console.createTask ? console.createTask : function() {
258
+ return null;
259
+ };
260
+ m = {
261
+ react_stack_bottom_frame: function(e) {
262
+ return e();
263
+ }
264
+ };
265
+ var C, N = {}, Y = m.react_stack_bottom_frame.bind(
266
+ m,
267
+ s
268
+ )(), $ = g(f(s)), I = {};
269
+ b.Fragment = w, b.jsx = function(e, r, t) {
270
+ var n = 1e4 > O.recentlyCreatedOwnerStacks++;
271
+ return E(
272
+ e,
273
+ r,
274
+ t,
275
+ !1,
276
+ n ? Error("react-stack-top-frame") : Y,
277
+ n ? g(f(e)) : $
278
+ );
279
+ }, b.jsxs = function(e, r, t) {
280
+ var n = 1e4 > O.recentlyCreatedOwnerStacks++;
281
+ return E(
282
+ e,
283
+ r,
284
+ t,
285
+ !0,
286
+ n ? Error("react-stack-top-frame") : Y,
287
+ n ? g(f(e)) : $
288
+ );
289
+ };
290
+ })()), b;
291
+ }
292
+ var M;
293
+ function ue() {
294
+ return M || (M = 1, process.env.NODE_ENV === "production" ? A.exports = le() : A.exports = ce()), A.exports;
295
+ }
296
+ var ie = ue();
297
+ function V(l) {
298
+ const { direction: d, defaultArrangement: i, defaultAlignment: f } = l;
299
+ return ({
300
+ children: s = null,
301
+ arrangement: c = i,
302
+ alignment: u = f,
303
+ style: y = {},
304
+ className: k = "",
305
+ gap: E = 0,
306
+ as: v = "div",
307
+ ref: R,
308
+ ...m
309
+ }) => {
310
+ const T = te(() => ({
311
+ display: "flex",
312
+ flexDirection: d,
313
+ gap: `${E}px`,
314
+ justifyContent: F[c] ?? c,
315
+ alignItems: F[u] ?? u
316
+ }), [E, c, u]);
317
+ return /* @__PURE__ */ ie.jsx(
318
+ v,
319
+ {
320
+ ref: R,
321
+ style: { ...T, ...y },
322
+ className: k,
323
+ ...m,
324
+ children: s
325
+ }
326
+ );
327
+ };
328
+ }
329
+ const fe = V({
330
+ direction: "row",
331
+ defaultArrangement: ne.Start,
332
+ defaultAlignment: se.Stretch
333
+ });
334
+ fe.displayName = "Row";
335
+ const de = V({
336
+ direction: "column",
337
+ defaultArrangement: ae.Top,
338
+ defaultAlignment: oe.Stretch
339
+ });
340
+ de.displayName = "Column";
341
+ export {
342
+ de as C,
343
+ oe as H,
344
+ fe as R,
345
+ se as V,
346
+ ne as a,
347
+ ae as b
348
+ };
package/dist/index.cjs CHANGED
@@ -1,31 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),s={EQUAL_WEIGHT:"Equal Weight",SPACE_BETWEEN:"Space Between",SPACE_AROUND:"Space Around",SPACE_EVENLY:"Space Evenly",CENTER:"Center",START:"Start",END:"End",TOP:"Top",BOTTOM:"Bottom"},be={[s.EQUAL_WEIGHT]:"stretch",[s.SPACE_BETWEEN]:"space-between",[s.SPACE_AROUND]:"space-around",[s.SPACE_EVENLY]:"space-evenly",[s.CENTER]:"center",[s.START]:"flex-start",[s.END]:"flex-end",[s.TOP]:"flex-start",[s.BOTTOM]:"flex-end"};var P={exports:{}},O={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ge;function je(){if(ge)return O;ge=1;var f=Symbol.for("react.transitional.element"),A=Symbol.for("react.fragment");function g(R,i,c){var E=null;if(c!==void 0&&(E=""+c),i.key!==void 0&&(E=""+i.key),"key"in i){c={};for(var d in i)d!=="key"&&(c[d]=i[d])}else c=i;return i=c.ref,{$$typeof:f,type:R,key:E,ref:i!==void 0?i:null,props:c}}return O.Fragment=A,O.jsx=g,O.jsxs=g,O}var N={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Te;function he(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&function(){function f(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===we?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case xe:return"Portal";case D:return"Profiler";case K:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case re:return(e.displayName||"Context")+".Provider";case ee:return(e._context.displayName||"Context")+".Consumer";case B:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J:return r=e.displayName||null,r!==null?r:f(e.type)||"Memo";case L:r=e._payload,e=e._init;try{return f(e(r))}catch{}}return null}function A(e){return""+e}function g(e){try{A(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),A(e)}}function R(){}function i(){if(p===0){oe=console.log,ae=console.info,ue=console.warn,le=console.error,se=console.group,fe=console.groupCollapsed,ie=console.groupEnd;var e={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}p++}function c(){if(p--,p===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:_({},e,{value:oe}),info:_({},e,{value:ae}),warn:_({},e,{value:ue}),error:_({},e,{value:le}),group:_({},e,{value:se}),groupCollapsed:_({},e,{value:fe}),groupEnd:_({},e,{value:ie})})}0>p&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function E(e){if(H===void 0)try{throw Error()}catch(t){var r=t.stack.trim().match(/\n( *(at )?)/);H=r&&r[1]||"",ce=-1<t.stack.indexOf(`
18
- at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
19
- `+H+e+ce}function d(e,r){if(!e||X)return"";var t=F.get(e);if(t!==void 0)return t;X=!0,t=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var o=null;o=T.H,T.H=null,i();try{var u={DetermineComponentFrameRoot:function(){try{if(r){var b=function(){throw Error()};if(Object.defineProperty(b.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(m){var k=m}Reflect.construct(e,[],b)}else{try{b.call()}catch(m){k=m}e.call(b.prototype)}}else{try{throw Error()}catch(m){k=m}(b=e())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(m){if(m&&k&&typeof m.stack=="string")return[m.stack,k.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var n=u.DetermineComponentFrameRoot(),v=n[0],C=n[1];if(v&&C){var l=v.split(`
20
- `),y=C.split(`
21
- `);for(n=a=0;a<l.length&&!l[a].includes("DetermineComponentFrameRoot");)a++;for(;n<y.length&&!y[n].includes("DetermineComponentFrameRoot");)n++;if(a===l.length||n===y.length)for(a=l.length-1,n=y.length-1;1<=a&&0<=n&&l[a]!==y[n];)n--;for(;1<=a&&0<=n;a--,n--)if(l[a]!==y[n]){if(a!==1||n!==1)do if(a--,n--,0>n||l[a]!==y[n]){var w=`
22
- `+l[a].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&F.set(e,w),w}while(1<=a&&0<=n);break}}}finally{X=!1,T.H=o,c(),Error.prepareStackTrace=t}return l=(l=e?e.displayName||e.name:"")?E(l):"",typeof e=="function"&&F.set(e,l),l}function S(e){if(e==null)return"";if(typeof e=="function"){var r=e.prototype;return d(e,!(!r||!r.isReactComponent))}if(typeof e=="string")return E(e);switch(e){case V:return E("Suspense");case G:return E("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case B:return e=d(e.render,!1),e;case J:return S(e.type);case L:r=e._payload,e=e._init;try{return S(e(r))}catch{}}return""}function x(){var e=T.A;return e===null?null:e.getOwner()}function j(e){if(ne.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Y(e,r){function t(){Ee||(Ee=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function M(){var e=f(this.type);return de[e]||(de[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function W(e,r,t,o,u,a){return t=a.ref,e={$$typeof:U,type:e,key:r,props:a,_owner:u},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:M}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function h(e,r,t,o,u,a){if(typeof e=="string"||typeof e=="function"||e===q||e===D||e===K||e===V||e===G||e===pe||typeof e=="object"&&e!==null&&(e.$$typeof===L||e.$$typeof===J||e.$$typeof===re||e.$$typeof===ee||e.$$typeof===B||e.$$typeof===Oe||e.getModuleId!==void 0)){var n=r.children;if(n!==void 0)if(o)if(z(n)){for(o=0;o<n.length;o++)Q(n[o],e);Object.freeze&&Object.freeze(n)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Q(n,e)}else n="",(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(n+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),e===null?o="null":z(e)?o="array":e!==void 0&&e.$$typeof===U?(o="<"+(f(e.type)||"Unknown")+" />",n=" Did you accidentally export a JSX literal instead of a component?"):o=typeof e,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",o,n);if(ne.call(r,"key")){n=f(e);var v=Object.keys(r).filter(function(l){return l!=="key"});o=0<v.length?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}",ve[n+o]||(v=0<v.length?"{"+v.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
23
- let props = %s;
24
- <%s {...props} />
25
- React keys must be passed directly to JSX without using spread:
26
- let props = %s;
27
- <%s key={someKey} {...props} />`,o,n,v,n),ve[n+o]=!0)}if(n=null,t!==void 0&&(g(t),n=""+t),j(r)&&(g(r.key),n=""+r.key),"key"in r){t={};for(var C in r)C!=="key"&&(t[C]=r[C])}else t=r;return n&&Y(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),W(e,n,a,u,x(),t)}function Q(e,r){if(typeof e=="object"&&e&&e.$$typeof!==Ne){if(z(e))for(var t=0;t<e.length;t++){var o=e[t];$(o)&&Z(o,r)}else if($(e))e._store&&(e._store.validated=1);else if(e===null||typeof e!="object"?t=null:(t=te&&e[te]||e["@@iterator"],t=typeof t=="function"?t:null),typeof t=="function"&&t!==e.entries&&(t=t.call(e),t!==e))for(;!(e=t.next()).done;)$(e.value)&&Z(e.value,r)}}function $(e){return typeof e=="object"&&e!==null&&e.$$typeof===U}function Z(e,r){if(e._store&&!e._store.validated&&e.key==null&&(e._store.validated=1,r=Ce(r),!me[r])){me[r]=!0;var t="";e&&e._owner!=null&&e._owner!==x()&&(t=null,typeof e._owner.tag=="number"?t=f(e._owner.type):typeof e._owner.name=="string"&&(t=e._owner.name),t=" It was passed a child from "+t+".");var o=T.getCurrentStack;T.getCurrentStack=function(){var u=S(e.type);return o&&(u+=o()||""),u},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',r,t),T.getCurrentStack=o}}function Ce(e){var r="",t=x();return t&&(t=f(t.type))&&(r=`
28
-
29
- Check the render method of \``+t+"`."),r||(e=f(e))&&(r=`
30
-
31
- Check the top-level render call using <`+e+">."),r}var Se=I,U=Symbol.for("react.transitional.element"),xe=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),re=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),te=Symbol.iterator,we=Symbol.for("react.client.reference"),T=Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=Object.prototype.hasOwnProperty,_=Object.assign,Oe=Symbol.for("react.client.reference"),z=Array.isArray,p=0,oe,ae,ue,le,se,fe,ie;R.__reactDisabledLog=!0;var H,ce,X=!1,F=new(typeof WeakMap=="function"?WeakMap:Map),Ne=Symbol.for("react.client.reference"),Ee,de={},ve={},me={};N.Fragment=q,N.jsx=function(e,r,t,o,u){return h(e,r,t,!1,o,u)},N.jsxs=function(e,r,t,o,u){return h(e,r,t,!0,o,u)}}()),N}var _e;function ke(){return _e||(_e=1,process.env.NODE_ENV==="production"?P.exports=je():P.exports=he()),P.exports}var Pe=ke();function ye(f){const{direction:A,defaultArrangement:g,defaultAlignment:R}=f;return I.forwardRef(({children:c=null,arrangement:E=g,alignment:d=R,style:S={},className:x="",gap:j=0,as:Y="div",...M},W)=>{const h=I.useMemo(()=>({display:"flex",flexDirection:A,gap:`${j}px`,justifyContent:be[E],alignItems:be[d]}),[j,E,d]);return Pe.jsx(Y,{ref:W,style:{...h,...S},className:x,...M,children:c})})}const Ae=ye({direction:"row",defaultArrangement:s.START,defaultAlignment:s.TOP});Ae.displayName="Row";const Re=ye({direction:"column",defaultArrangement:s.TOP,defaultAlignment:s.START});Re.displayName="Column";exports.Column=Re;exports.Row=Ae;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Column-BQyZsRY7.cjs");exports.Column=n.Column;exports.HorizontalAlignment=n.HorizontalAlignment;exports.HorizontalArrangement=n.HorizontalArrangement;exports.Row=n.Row;exports.VerticalAlignment=n.VerticalAlignment;exports.VerticalArrangement=n.VerticalArrangement;
package/dist/index.d.ts CHANGED
@@ -1,88 +1,123 @@
1
1
  import { ComponentPropsWithRef } from 'react';
2
2
  import { CSSProperties } from 'react';
3
3
  import { ElementType } from 'react';
4
- import { ForwardRefExoticComponent } from 'react';
5
4
  import { ReactNode } from 'react';
5
+ import { Ref } from 'react';
6
6
 
7
- /** Configuration options for element alignment in both horizontal and vertical directions */
8
- declare type Alignment = Readonly<{
9
- /** Alignment configuration for horizontal positioning */
10
- Horizontal: HorizontalAlignment;
11
- /** Alignment configuration for vertical positioning */
12
- Vertical: VerticalAlignment;
13
- }>;
7
+ export declare const Column: {
8
+ (props: ColumnProps): React.JSX.Element;
9
+ displayName?: string;
10
+ };
14
11
 
15
- /** Configuration options for element arrangement in both horizontal and vertical directions */
16
- declare type Arrangement = Readonly<{
17
- /** Arrangement configuration for horizontal layouts */
18
- Horizontal: HorizontalArrangement;
19
- /** Arrangement configuration for vertical layouts */
20
- Vertical: VerticalArrangement;
21
- }>;
12
+ /**
13
+ * Props for the Column component.
14
+ * @example
15
+ * ```tsx
16
+ * <Column arrangement={VerticalArrangement.SpaceBetween} alignment={HorizontalAlignment.Center}>
17
+ * <div>Item 1</div>
18
+ * <div>Item 2</div>
19
+ * </Column>
20
+ * ```
21
+ */
22
+ export declare interface ColumnProps extends LayoutPrimitivesProps {
23
+ /** Controls vertical distribution of children (main axis) */
24
+ readonly arrangement?: VerticalArrangement;
25
+ /** Controls horizontal alignment of children (cross axis) */
26
+ readonly alignment?: HorizontalAlignment;
27
+ }
22
28
 
23
29
  /**
24
- * Common arrangement values used across the layout primitives.
25
- * These values are used to define the alignment and distribution of child elements.
30
+ * Namespace for horizontal alignment options.
31
+ * Used for Column's cross axis alignment.
26
32
  */
27
- declare const ArrangementValues: {
28
- readonly EQUAL_WEIGHT: "Equal Weight";
29
- readonly SPACE_BETWEEN: "Space Between";
30
- readonly SPACE_AROUND: "Space Around";
31
- readonly SPACE_EVENLY: "Space Evenly";
32
- readonly CENTER: "Center";
33
- readonly START: "Start";
34
- readonly END: "End";
35
- readonly TOP: "Top";
36
- readonly BOTTOM: "Bottom";
33
+ export declare const HorizontalAlignment: {
34
+ readonly Start: "start";
35
+ readonly Center: "center";
36
+ readonly End: "end";
37
+ readonly Stretch: "stretch";
37
38
  };
38
39
 
39
- export declare const Column: ForwardRefExoticComponent<ColumnProps>;
40
+ export declare type HorizontalAlignment = typeof HorizontalAlignment[keyof typeof HorizontalAlignment];
40
41
 
41
42
  /**
42
- * Props interface for the Column component
43
- * Extends LayoutPrimitivesProps with column-specific arrangement options
43
+ * Namespace for horizontal arrangement options.
44
+ * Used for Row's main axis distribution.
44
45
  */
45
- export declare interface ColumnProps extends LayoutPrimitivesProps {
46
- readonly arrangement?: Arrangement['Vertical'];
47
- readonly alignment?: Alignment['Horizontal'];
48
- }
49
-
50
- /** Common arrangement options that can be applied to both horizontal and vertical layouts */
51
- declare type CommonArrangement = typeof ArrangementValues.EQUAL_WEIGHT | typeof ArrangementValues.SPACE_BETWEEN | typeof ArrangementValues.SPACE_AROUND | typeof ArrangementValues.SPACE_EVENLY | typeof ArrangementValues.CENTER;
52
-
53
- /** Alignment options for horizontal positioning */
54
- declare type HorizontalAlignment = typeof ArrangementValues.START | typeof ArrangementValues.CENTER | typeof ArrangementValues.END;
46
+ export declare const HorizontalArrangement: {
47
+ readonly Start: "start";
48
+ readonly End: "end";
49
+ readonly Center: "center";
50
+ readonly SpaceBetween: "space-between";
51
+ readonly SpaceAround: "space-around";
52
+ readonly SpaceEvenly: "space-evenly";
53
+ };
55
54
 
56
- /** Arrangement options specific to horizontal layouts */
57
- declare type HorizontalArrangement = typeof ArrangementValues.START | typeof ArrangementValues.END | CommonArrangement;
55
+ export declare type HorizontalArrangement = typeof HorizontalArrangement[keyof typeof HorizontalArrangement];
58
56
 
59
57
  /**
60
- * Base interface for all layout primitive components
61
- * Extends React's div props while adding custom layout properties
58
+ * Base props for all layout primitive components.
59
+ * Extends React's div props while adding custom layout properties.
62
60
  */
63
- declare interface LayoutPrimitivesProps extends Omit<ComponentPropsWithRef<'div'>, 'as'> {
61
+ export declare interface LayoutPrimitivesProps extends Omit<ComponentPropsWithRef<'div'>, 'as' | 'ref'> {
64
62
  readonly children?: ReactNode;
65
63
  readonly style?: CSSProperties;
66
64
  readonly className?: string;
65
+ /** Gap between child elements in pixels */
67
66
  readonly gap?: number;
67
+ /** The element type to render as */
68
68
  readonly as?: ElementType;
69
+ /** Ref to the underlying DOM element (React 19+ ref-as-prop) */
70
+ readonly ref?: Ref<HTMLElement>;
69
71
  }
70
72
 
71
- export declare const Row: ForwardRefExoticComponent<RowProps>;
73
+ export declare const Row: {
74
+ (props: RowProps): React.JSX.Element;
75
+ displayName?: string;
76
+ };
72
77
 
73
78
  /**
74
- * Props interface for the Row component
75
- * Extends LayoutPrimitivesProps with row-specific arrangement options
79
+ * Props for the Row component.
80
+ * @example
81
+ * ```tsx
82
+ * <Row arrangement={HorizontalArrangement.SpaceBetween} alignment={VerticalAlignment.Center}>
83
+ * <div>Item 1</div>
84
+ * <div>Item 2</div>
85
+ * </Row>
86
+ * ```
76
87
  */
77
88
  export declare interface RowProps extends LayoutPrimitivesProps {
78
- readonly arrangement?: Arrangement['Horizontal'];
79
- readonly alignment?: Alignment['Vertical'];
89
+ /** Controls horizontal distribution of children (main axis) */
90
+ readonly arrangement?: HorizontalArrangement;
91
+ /** Controls vertical alignment of children (cross axis) */
92
+ readonly alignment?: VerticalAlignment;
80
93
  }
81
94
 
82
- /** Alignment options for vertical positioning */
83
- declare type VerticalAlignment = typeof ArrangementValues.TOP | typeof ArrangementValues.CENTER | typeof ArrangementValues.BOTTOM;
95
+ /**
96
+ * Namespace for vertical alignment options.
97
+ * Used for Row's cross axis alignment.
98
+ */
99
+ export declare const VerticalAlignment: {
100
+ readonly Top: "top";
101
+ readonly Center: "center";
102
+ readonly Bottom: "bottom";
103
+ readonly Stretch: "stretch";
104
+ };
105
+
106
+ export declare type VerticalAlignment = typeof VerticalAlignment[keyof typeof VerticalAlignment];
107
+
108
+ /**
109
+ * Namespace for vertical arrangement options.
110
+ * Used for Column's main axis distribution.
111
+ */
112
+ export declare const VerticalArrangement: {
113
+ readonly Top: "top";
114
+ readonly Bottom: "bottom";
115
+ readonly Center: "center";
116
+ readonly SpaceBetween: "space-between";
117
+ readonly SpaceAround: "space-around";
118
+ readonly SpaceEvenly: "space-evenly";
119
+ };
84
120
 
85
- /** Arrangement options specific to vertical layouts */
86
- declare type VerticalArrangement = typeof ArrangementValues.TOP | typeof ArrangementValues.BOTTOM | CommonArrangement;
121
+ export declare type VerticalArrangement = typeof VerticalArrangement[keyof typeof VerticalArrangement];
87
122
 
88
123
  export { }