@a4banana/react-layout-primitives 1.3.2 → 2.0.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.
- package/README.md +18 -15
- package/dist/index.cjs +6 -1
- package/dist/index.js +337 -7
- package/package.json +2 -16
- package/dist/Column-CIsJNLGH.js +0 -339
- package/dist/Column-CS66eSYd.cjs +0 -6
- package/dist/motion.cjs +0 -1
- package/dist/motion.d.ts +0 -675
- package/dist/motion.js +0 -9
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Flexible and type-safe React layout components inspired by Jetpack Compose's Row
|
|
|
6
6
|
|
|
7
7
|
- **Type-safe** - Full TypeScript support with exported constants for arrangement and alignment
|
|
8
8
|
- **React 19+** - Uses modern ref-as-prop pattern
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
9
|
+
- **Lightweight** - Zero dependencies, minimal bundle size
|
|
10
|
+
- **Motion compatible** - Works seamlessly with [Motion](https://motion.dev) for animations
|
|
11
11
|
|
|
12
12
|
## Requirements
|
|
13
13
|
|
|
@@ -21,12 +21,6 @@ Flexible and type-safe React layout components inspired by Jetpack Compose's Row
|
|
|
21
21
|
npm install @a4banana/react-layout-primitives
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
For animation support:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install @a4banana/react-layout-primitives motion
|
|
28
|
-
```
|
|
29
|
-
|
|
30
24
|
## Usage
|
|
31
25
|
|
|
32
26
|
### Basic Usage
|
|
@@ -64,29 +58,38 @@ function App() {
|
|
|
64
58
|
|
|
65
59
|
### With Motion
|
|
66
60
|
|
|
61
|
+
You can easily add animations using [Motion](https://motion.dev):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install motion
|
|
65
|
+
```
|
|
66
|
+
|
|
67
67
|
```tsx
|
|
68
|
-
import { motion } from '
|
|
69
|
-
import {
|
|
68
|
+
import { motion } from 'motion/react';
|
|
69
|
+
import { Row, Column, HorizontalArrangement } from '@a4banana/react-layout-primitives';
|
|
70
|
+
|
|
71
|
+
// Create motion-enabled components
|
|
72
|
+
const MotionRow = motion.create(Row);
|
|
73
|
+
const MotionColumn = motion.create(Column);
|
|
70
74
|
|
|
71
75
|
function AnimatedLayout() {
|
|
72
76
|
return (
|
|
73
|
-
<
|
|
77
|
+
<MotionRow
|
|
74
78
|
initial={{ opacity: 0, y: 20 }}
|
|
75
79
|
animate={{ opacity: 1, y: 0 }}
|
|
76
80
|
transition={{ duration: 0.3 }}
|
|
77
81
|
gap={16}
|
|
78
82
|
arrangement={HorizontalArrangement.SpaceBetween}
|
|
79
|
-
alignment={VerticalAlignment.Center}
|
|
80
83
|
>
|
|
81
|
-
<
|
|
84
|
+
<MotionColumn
|
|
82
85
|
initial={{ scale: 0.9 }}
|
|
83
86
|
animate={{ scale: 1 }}
|
|
84
87
|
gap={8}
|
|
85
88
|
>
|
|
86
89
|
<span>Item 1</span>
|
|
87
90
|
<span>Item 2</span>
|
|
88
|
-
</
|
|
89
|
-
</
|
|
91
|
+
</MotionColumn>
|
|
92
|
+
</MotionRow>
|
|
90
93
|
);
|
|
91
94
|
}
|
|
92
95
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=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={top:"flex-start",bottom:"flex-end"};var S={exports:{}},E={};var D;function ce(){if(D)return E;D=1;var s=Symbol.for("react.transitional.element"),m=Symbol.for("react.fragment");function i(f,a,l){var c=null;if(l!==void 0&&(c=""+l),a.key!==void 0&&(c=""+a.key),"key"in a){l={};for(var u in a)u!=="key"&&(l[u]=a[u])}else l=a;return a=l.ref,{$$typeof:s,type:f,key:c,ref:a!==void 0?a:null,props:l}}return E.Fragment=m,E.jsx=i,E.jsxs=i,E}var _={};var L;function ue(){return L||(L=1,process.env.NODE_ENV!=="production"&&(function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case Z:return"Profiler";case X:return"StrictMode";case re:return"Suspense";case te:return"SuspenseList";case oe: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:s(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return s(e(r))}catch{}}return null}function m(e){return""+e}function i(e){try{m(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),m(e)}}function f(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=s(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=w.A;return e===null?null:e.getOwner()}function l(){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=s(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 b(e,r,t,n,A,x){var o=t.ref;return e={$$typeof:h,type:e,key:r,props:t,_owner:n},(o!==void 0?o: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:x}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function v(e,r,t,n,A,x){var o=r.children;if(o!==void 0)if(n)if(le(o)){for(n=0;n<o.length;n++)R(o[n]);Object.freeze&&Object.freeze(o)}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 R(o);if(j.call(r,"key")){o=s(e);var p=Object.keys(r).filter(function(se){return se!=="key"});n=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",I[o+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,o,p,o),I[o+n]=!0)}if(o=null,t!==void 0&&(i(t),o=""+t),c(r)&&(i(r.key),o=""+r.key),"key"in r){t={};for(var P in r)P!=="key"&&(t[P]=r[P])}else t=r;return o&&u(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,o,t,a(),A,x)}function R(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===k&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}var d=V,h=Symbol.for("react.transitional.element"),H=Symbol.for("react.portal"),g=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"),k=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),w=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,le=Array.isArray,O=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(e){return e()}};var C,N={},Y=d.react_stack_bottom_frame.bind(d,l)(),$=O(f(l)),I={};_.Fragment=g,_.jsx=function(e,r,t){var n=1e4>w.recentlyCreatedOwnerStacks++;return v(e,r,t,!1,n?Error("react-stack-top-frame"):Y,n?O(f(e)):$)},_.jsxs=function(e,r,t){var n=1e4>w.recentlyCreatedOwnerStacks++;return v(e,r,t,!0,n?Error("react-stack-top-frame"):Y,n?O(f(e)):$)}})()),_}var M;function ie(){return M||(M=1,process.env.NODE_ENV==="production"?S.exports=ce():S.exports=ue()),S.exports}var fe=ie();function J(s){const{direction:m,defaultArrangement:i,defaultAlignment:f}=s;return({children:l,arrangement:c=i,alignment:u=f,style:y,gap:b=0,as:v="div",ref:R,...T})=>{const d=V.useMemo(()=>({display:"flex",flexDirection:m,gap:`${b}px`,justifyContent:F[c]??c,alignItems:F[u]??u}),[b,c,u]);return fe.jsx(v,{ref:R,style:{...d,...y},...T,children:l})}}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;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,339 @@
|
|
|
1
|
-
import
|
|
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
|
+
}, oe = {
|
|
10
|
+
Top: "top",
|
|
11
|
+
Bottom: "bottom",
|
|
12
|
+
Center: "center",
|
|
13
|
+
SpaceBetween: "space-between",
|
|
14
|
+
SpaceAround: "space-around",
|
|
15
|
+
SpaceEvenly: "space-evenly"
|
|
16
|
+
}, ae = {
|
|
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
|
+
top: "flex-start",
|
|
28
|
+
bottom: "flex-end"
|
|
29
|
+
};
|
|
30
|
+
var A = { exports: {} }, E = {};
|
|
31
|
+
var D;
|
|
32
|
+
function le() {
|
|
33
|
+
if (D) return E;
|
|
34
|
+
D = 1;
|
|
35
|
+
var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
36
|
+
function i(f, a, s) {
|
|
37
|
+
var c = null;
|
|
38
|
+
if (s !== void 0 && (c = "" + s), a.key !== void 0 && (c = "" + a.key), "key" in a) {
|
|
39
|
+
s = {};
|
|
40
|
+
for (var u in a)
|
|
41
|
+
u !== "key" && (s[u] = a[u]);
|
|
42
|
+
} else s = a;
|
|
43
|
+
return a = s.ref, {
|
|
44
|
+
$$typeof: l,
|
|
45
|
+
type: f,
|
|
46
|
+
key: c,
|
|
47
|
+
ref: a !== void 0 ? a : null,
|
|
48
|
+
props: s
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return E.Fragment = d, E.jsx = i, E.jsxs = i, E;
|
|
52
|
+
}
|
|
53
|
+
var _ = {};
|
|
54
|
+
var L;
|
|
55
|
+
function ce() {
|
|
56
|
+
return L || (L = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
57
|
+
function l(e) {
|
|
58
|
+
if (e == null) return null;
|
|
59
|
+
if (typeof e == "function")
|
|
60
|
+
return e.$$typeof === Q ? null : e.displayName || e.name || null;
|
|
61
|
+
if (typeof e == "string") return e;
|
|
62
|
+
switch (e) {
|
|
63
|
+
case k:
|
|
64
|
+
return "Fragment";
|
|
65
|
+
case z:
|
|
66
|
+
return "Profiler";
|
|
67
|
+
case U:
|
|
68
|
+
return "StrictMode";
|
|
69
|
+
case G:
|
|
70
|
+
return "Suspense";
|
|
71
|
+
case X:
|
|
72
|
+
return "SuspenseList";
|
|
73
|
+
case Z:
|
|
74
|
+
return "Activity";
|
|
75
|
+
}
|
|
76
|
+
if (typeof e == "object")
|
|
77
|
+
switch (typeof e.tag == "number" && console.error(
|
|
78
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
79
|
+
), e.$$typeof) {
|
|
80
|
+
case W:
|
|
81
|
+
return "Portal";
|
|
82
|
+
case J:
|
|
83
|
+
return e.displayName || "Context";
|
|
84
|
+
case q:
|
|
85
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
86
|
+
case B:
|
|
87
|
+
var r = e.render;
|
|
88
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
89
|
+
case H:
|
|
90
|
+
return r = e.displayName || null, r !== null ? r : l(e.type) || "Memo";
|
|
91
|
+
case w:
|
|
92
|
+
r = e._payload, e = e._init;
|
|
93
|
+
try {
|
|
94
|
+
return l(e(r));
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
function d(e) {
|
|
101
|
+
return "" + e;
|
|
102
|
+
}
|
|
103
|
+
function i(e) {
|
|
104
|
+
try {
|
|
105
|
+
d(e);
|
|
106
|
+
var r = !1;
|
|
107
|
+
} catch {
|
|
108
|
+
r = !0;
|
|
109
|
+
}
|
|
110
|
+
if (r) {
|
|
111
|
+
r = console;
|
|
112
|
+
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
113
|
+
return t.call(
|
|
114
|
+
r,
|
|
115
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
116
|
+
n
|
|
117
|
+
), d(e);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function f(e) {
|
|
121
|
+
if (e === k) return "<>";
|
|
122
|
+
if (typeof e == "object" && e !== null && e.$$typeof === w)
|
|
123
|
+
return "<...>";
|
|
124
|
+
try {
|
|
125
|
+
var r = l(e);
|
|
126
|
+
return r ? "<" + r + ">" : "<...>";
|
|
127
|
+
} catch {
|
|
128
|
+
return "<...>";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function a() {
|
|
132
|
+
var e = x.A;
|
|
133
|
+
return e === null ? null : e.getOwner();
|
|
134
|
+
}
|
|
135
|
+
function s() {
|
|
136
|
+
return Error("react-stack-top-frame");
|
|
137
|
+
}
|
|
138
|
+
function c(e) {
|
|
139
|
+
if (j.call(e, "key")) {
|
|
140
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
141
|
+
if (r && r.isReactWarning) return !1;
|
|
142
|
+
}
|
|
143
|
+
return e.key !== void 0;
|
|
144
|
+
}
|
|
145
|
+
function u(e, r) {
|
|
146
|
+
function t() {
|
|
147
|
+
C || (C = !0, console.error(
|
|
148
|
+
"%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)",
|
|
149
|
+
r
|
|
150
|
+
));
|
|
151
|
+
}
|
|
152
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
153
|
+
get: t,
|
|
154
|
+
configurable: !0
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function y() {
|
|
158
|
+
var e = l(this.type);
|
|
159
|
+
return N[e] || (N[e] = !0, console.error(
|
|
160
|
+
"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."
|
|
161
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
162
|
+
}
|
|
163
|
+
function b(e, r, t, n, S, g) {
|
|
164
|
+
var o = t.ref;
|
|
165
|
+
return e = {
|
|
166
|
+
$$typeof: h,
|
|
167
|
+
type: e,
|
|
168
|
+
key: r,
|
|
169
|
+
props: t,
|
|
170
|
+
_owner: n
|
|
171
|
+
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
172
|
+
enumerable: !1,
|
|
173
|
+
get: y
|
|
174
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
175
|
+
configurable: !1,
|
|
176
|
+
enumerable: !1,
|
|
177
|
+
writable: !0,
|
|
178
|
+
value: 0
|
|
179
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: null
|
|
184
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
185
|
+
configurable: !1,
|
|
186
|
+
enumerable: !1,
|
|
187
|
+
writable: !0,
|
|
188
|
+
value: S
|
|
189
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
190
|
+
configurable: !1,
|
|
191
|
+
enumerable: !1,
|
|
192
|
+
writable: !0,
|
|
193
|
+
value: g
|
|
194
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
195
|
+
}
|
|
196
|
+
function v(e, r, t, n, S, g) {
|
|
197
|
+
var o = r.children;
|
|
198
|
+
if (o !== void 0)
|
|
199
|
+
if (n)
|
|
200
|
+
if (K(o)) {
|
|
201
|
+
for (n = 0; n < o.length; n++)
|
|
202
|
+
R(o[n]);
|
|
203
|
+
Object.freeze && Object.freeze(o);
|
|
204
|
+
} else
|
|
205
|
+
console.error(
|
|
206
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
207
|
+
);
|
|
208
|
+
else R(o);
|
|
209
|
+
if (j.call(r, "key")) {
|
|
210
|
+
o = l(e);
|
|
211
|
+
var p = Object.keys(r).filter(function(ee) {
|
|
212
|
+
return ee !== "key";
|
|
213
|
+
});
|
|
214
|
+
n = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", I[o + n] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
215
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
216
|
+
let props = %s;
|
|
217
|
+
<%s {...props} />
|
|
218
|
+
React keys must be passed directly to JSX without using spread:
|
|
219
|
+
let props = %s;
|
|
220
|
+
<%s key={someKey} {...props} />`,
|
|
221
|
+
n,
|
|
222
|
+
o,
|
|
223
|
+
p,
|
|
224
|
+
o
|
|
225
|
+
), I[o + n] = !0);
|
|
226
|
+
}
|
|
227
|
+
if (o = null, t !== void 0 && (i(t), o = "" + t), c(r) && (i(r.key), o = "" + r.key), "key" in r) {
|
|
228
|
+
t = {};
|
|
229
|
+
for (var P in r)
|
|
230
|
+
P !== "key" && (t[P] = r[P]);
|
|
231
|
+
} else t = r;
|
|
232
|
+
return o && u(
|
|
233
|
+
t,
|
|
234
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
235
|
+
), b(
|
|
236
|
+
e,
|
|
237
|
+
o,
|
|
238
|
+
t,
|
|
239
|
+
a(),
|
|
240
|
+
S,
|
|
241
|
+
g
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
function R(e) {
|
|
245
|
+
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === w && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
246
|
+
}
|
|
247
|
+
function T(e) {
|
|
248
|
+
return typeof e == "object" && e !== null && e.$$typeof === h;
|
|
249
|
+
}
|
|
250
|
+
var m = re, h = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__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"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), w = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), x = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, K = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
251
|
+
return null;
|
|
252
|
+
};
|
|
253
|
+
m = {
|
|
254
|
+
react_stack_bottom_frame: function(e) {
|
|
255
|
+
return e();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var C, N = {}, Y = m.react_stack_bottom_frame.bind(
|
|
259
|
+
m,
|
|
260
|
+
s
|
|
261
|
+
)(), $ = O(f(s)), I = {};
|
|
262
|
+
_.Fragment = k, _.jsx = function(e, r, t) {
|
|
263
|
+
var n = 1e4 > x.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return v(
|
|
265
|
+
e,
|
|
266
|
+
r,
|
|
267
|
+
t,
|
|
268
|
+
!1,
|
|
269
|
+
n ? Error("react-stack-top-frame") : Y,
|
|
270
|
+
n ? O(f(e)) : $
|
|
271
|
+
);
|
|
272
|
+
}, _.jsxs = function(e, r, t) {
|
|
273
|
+
var n = 1e4 > x.recentlyCreatedOwnerStacks++;
|
|
274
|
+
return v(
|
|
275
|
+
e,
|
|
276
|
+
r,
|
|
277
|
+
t,
|
|
278
|
+
!0,
|
|
279
|
+
n ? Error("react-stack-top-frame") : Y,
|
|
280
|
+
n ? O(f(e)) : $
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
})()), _;
|
|
284
|
+
}
|
|
285
|
+
var M;
|
|
286
|
+
function ue() {
|
|
287
|
+
return M || (M = 1, process.env.NODE_ENV === "production" ? A.exports = le() : A.exports = ce()), A.exports;
|
|
288
|
+
}
|
|
289
|
+
var ie = ue();
|
|
290
|
+
function V(l) {
|
|
291
|
+
const { direction: d, defaultArrangement: i, defaultAlignment: f } = l;
|
|
292
|
+
return ({
|
|
293
|
+
children: s,
|
|
294
|
+
arrangement: c = i,
|
|
295
|
+
alignment: u = f,
|
|
296
|
+
style: y,
|
|
297
|
+
gap: b = 0,
|
|
298
|
+
as: v = "div",
|
|
299
|
+
ref: R,
|
|
300
|
+
...T
|
|
301
|
+
}) => {
|
|
302
|
+
const m = te(() => ({
|
|
303
|
+
display: "flex",
|
|
304
|
+
flexDirection: d,
|
|
305
|
+
gap: `${b}px`,
|
|
306
|
+
justifyContent: F[c] ?? c,
|
|
307
|
+
alignItems: F[u] ?? u
|
|
308
|
+
}), [b, c, u]);
|
|
309
|
+
return /* @__PURE__ */ ie.jsx(
|
|
310
|
+
v,
|
|
311
|
+
{
|
|
312
|
+
ref: R,
|
|
313
|
+
style: { ...m, ...y },
|
|
314
|
+
...T,
|
|
315
|
+
children: s
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
const fe = V({
|
|
321
|
+
direction: "row",
|
|
322
|
+
defaultArrangement: ne.Start,
|
|
323
|
+
defaultAlignment: se.Stretch
|
|
324
|
+
});
|
|
325
|
+
fe.displayName = "Row";
|
|
326
|
+
const de = V({
|
|
327
|
+
direction: "column",
|
|
328
|
+
defaultArrangement: oe.Top,
|
|
329
|
+
defaultAlignment: ae.Stretch
|
|
330
|
+
});
|
|
331
|
+
de.displayName = "Column";
|
|
2
332
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
333
|
+
de as Column,
|
|
334
|
+
ae as HorizontalAlignment,
|
|
335
|
+
ne as HorizontalArrangement,
|
|
336
|
+
fe as Row,
|
|
337
|
+
se as VerticalAlignment,
|
|
338
|
+
oe as VerticalArrangement
|
|
9
339
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a4banana/react-layout-primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Flexible and type-safe React layout components inspired by Jetpack Compose",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,11 +16,6 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js",
|
|
18
18
|
"require": "./dist/index.cjs"
|
|
19
|
-
},
|
|
20
|
-
"./motion": {
|
|
21
|
-
"types": "./dist/motion.d.ts",
|
|
22
|
-
"import": "./dist/motion.js",
|
|
23
|
-
"require": "./dist/motion.cjs"
|
|
24
19
|
}
|
|
25
20
|
},
|
|
26
21
|
"scripts": {
|
|
@@ -33,22 +28,15 @@
|
|
|
33
28
|
"@types/node": "^25.2.1",
|
|
34
29
|
"@types/react": "^19.2.13",
|
|
35
30
|
"@vitejs/plugin-react-swc": "^4.2.3",
|
|
36
|
-
"motion": "^12.33.0",
|
|
37
31
|
"react": "^19.2.4",
|
|
38
32
|
"typescript": "^5.9.3",
|
|
39
33
|
"vite": "^7.3.1",
|
|
40
34
|
"vite-plugin-dts": "^4.5.4"
|
|
41
35
|
},
|
|
42
36
|
"peerDependencies": {
|
|
43
|
-
"motion": "^12.0.0",
|
|
44
37
|
"react": "^19.0.0",
|
|
45
38
|
"react-dom": "^19.0.0"
|
|
46
39
|
},
|
|
47
|
-
"peerDependenciesMeta": {
|
|
48
|
-
"motion": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
40
|
"engines": {
|
|
53
41
|
"node": ">=22.0.0"
|
|
54
42
|
},
|
|
@@ -63,9 +51,7 @@
|
|
|
63
51
|
"column",
|
|
64
52
|
"components",
|
|
65
53
|
"ui",
|
|
66
|
-
"typescript"
|
|
67
|
-
"motion",
|
|
68
|
-
"animation"
|
|
54
|
+
"typescript"
|
|
69
55
|
],
|
|
70
56
|
"author": "a4banana",
|
|
71
57
|
"license": "MIT"
|