@vinyasa/layout 1.0.19
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 +164 -0
- package/dist/cjs/aspect-ratio.cjs +271 -0
- package/dist/cjs/box.cjs +268 -0
- package/dist/cjs/center.cjs +457 -0
- package/dist/cjs/center.css +80 -0
- package/dist/cjs/container.cjs +275 -0
- package/dist/cjs/container.css +31 -0
- package/dist/cjs/divider.cjs +389 -0
- package/dist/cjs/divider.css +16 -0
- package/dist/cjs/flex.cjs +425 -0
- package/dist/cjs/flex.css +80 -0
- package/dist/cjs/grid.cjs +419 -0
- package/dist/cjs/grid.css +84 -0
- package/dist/cjs/index.cjs +1806 -0
- package/dist/cjs/index.css +302 -0
- package/dist/cjs/inline.cjs +456 -0
- package/dist/cjs/inline.css +80 -0
- package/dist/cjs/portal.cjs +67 -0
- package/dist/cjs/scroll-area.cjs +303 -0
- package/dist/cjs/scroll-area.css +59 -0
- package/dist/cjs/spacer.cjs +137 -0
- package/dist/cjs/spacer.css +4 -0
- package/dist/cjs/stack.cjs +456 -0
- package/dist/cjs/stack.css +80 -0
- package/dist/cjs/surface.cjs +390 -0
- package/dist/cjs/surface.css +28 -0
- package/dist/esm/207.css +80 -0
- package/dist/esm/207.js +88 -0
- package/dist/esm/474.js +76 -0
- package/dist/esm/953.js +87 -0
- package/dist/esm/aspect-ratio.js +36 -0
- package/dist/esm/box.js +35 -0
- package/dist/esm/center.js +14 -0
- package/dist/esm/components/aspect-ratio/AspectRatio.d.ts +11 -0
- package/dist/esm/components/aspect-ratio/index.d.ts +3 -0
- package/dist/esm/components/box/Box.d.ts +5 -0
- package/dist/esm/components/box/index.d.ts +3 -0
- package/dist/esm/components/center/Center.d.ts +4 -0
- package/dist/esm/components/center/index.d.ts +3 -0
- package/dist/esm/components/container/Container.css.d.ts +1 -0
- package/dist/esm/components/container/Container.d.ts +11 -0
- package/dist/esm/components/container/index.d.ts +3 -0
- package/dist/esm/components/divider/Divider.css.d.ts +12 -0
- package/dist/esm/components/divider/Divider.d.ts +16 -0
- package/dist/esm/components/divider/index.d.ts +3 -0
- package/dist/esm/components/flex/Flex.css.d.ts +69 -0
- package/dist/esm/components/flex/Flex.d.ts +14 -0
- package/dist/esm/components/flex/index.d.ts +3 -0
- package/dist/esm/components/grid/Grid.css.d.ts +70 -0
- package/dist/esm/components/grid/Grid.d.ts +23 -0
- package/dist/esm/components/grid/index.d.ts +3 -0
- package/dist/esm/components/inline/Inline.d.ts +4 -0
- package/dist/esm/components/inline/index.d.ts +3 -0
- package/dist/esm/components/portal/Portal.d.ts +11 -0
- package/dist/esm/components/portal/index.d.ts +3 -0
- package/dist/esm/components/scroll-area/ScrollArea.css.d.ts +5 -0
- package/dist/esm/components/scroll-area/ScrollArea.d.ts +29 -0
- package/dist/esm/components/scroll-area/index.d.ts +3 -0
- package/dist/esm/components/spacer/Spacer.css.d.ts +1 -0
- package/dist/esm/components/spacer/Spacer.d.ts +4 -0
- package/dist/esm/components/spacer/index.d.ts +3 -0
- package/dist/esm/components/stack/Stack.d.ts +4 -0
- package/dist/esm/components/stack/index.d.ts +3 -0
- package/dist/esm/components/surface/Surface.css.d.ts +24 -0
- package/dist/esm/components/surface/Surface.d.ts +11 -0
- package/dist/esm/components/surface/index.d.ts +3 -0
- package/dist/esm/container.css +30 -0
- package/dist/esm/container.js +40 -0
- package/dist/esm/divider.css +16 -0
- package/dist/esm/divider.js +67 -0
- package/dist/esm/flex.js +4 -0
- package/dist/esm/grid.css +84 -0
- package/dist/esm/grid.js +88 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/inline.js +13 -0
- package/dist/esm/polymorphic.d.ts +5 -0
- package/dist/esm/portal.js +14 -0
- package/dist/esm/scroll-area.css +58 -0
- package/dist/esm/scroll-area.js +68 -0
- package/dist/esm/spacer.css +4 -0
- package/dist/esm/spacer.js +18 -0
- package/dist/esm/spacing.d.ts +19 -0
- package/dist/esm/stack.js +13 -0
- package/dist/esm/surface.css +28 -0
- package/dist/esm/surface.js +64 -0
- package/package.json +153 -0
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# @vinyasa/layout
|
|
2
|
+
|
|
3
|
+
13 structural layout primitives: Box, Flex, Stack, Inline, Grid, Container, Surface, Divider, ScrollArea, Portal, AspectRatio, Center, Spacer.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @vinyasa/layout @vinyasa/tokens react react-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`@vinyasa/tokens` is a peer dependency: most of these primitives reference the shared design-token contract, and rendering them requires a `VinyasaProvider` (from `@vinyasa/tokens`) somewhere above them in the tree. See [`@vinyasa/tokens`'s README](../tokens/README.md).
|
|
12
|
+
|
|
13
|
+
## Spacing
|
|
14
|
+
|
|
15
|
+
Every component in this package except `Portal` (which renders no wrapper element of its own) and `Spacer` (which has no properties left to space) accepts the same set of margin/padding shorthand props, resolved against `@vinyasa/tokens`'s `space1`–`space6` scale — the same scale `Flex`/`Grid`'s `gap` already use:
|
|
16
|
+
|
|
17
|
+
| Prop | CSS applied | Prop | CSS applied |
|
|
18
|
+
| ---- | --------------- | ---- | ---------------- |
|
|
19
|
+
| `m` | `margin` | `p` | `padding` |
|
|
20
|
+
| `mx` | `margin-inline` | `px` | `padding-inline` |
|
|
21
|
+
| `my` | `margin-block` | `py` | `padding-block` |
|
|
22
|
+
| `mt` | `margin-top` | `pt` | `padding-top` |
|
|
23
|
+
| `mr` | `margin-right` | `pr` | `padding-right` |
|
|
24
|
+
| `mb` | `margin-bottom` | `pb` | `padding-bottom` |
|
|
25
|
+
| `ml` | `margin-left` | `pl` | `padding-left` |
|
|
26
|
+
|
|
27
|
+
Each accepts `1`–`6`, mapping directly to a token:
|
|
28
|
+
|
|
29
|
+
| Scale | Token | Value |
|
|
30
|
+
| ----- | -------- | ----------------- |
|
|
31
|
+
| `1` | `space1` | `0.25rem` (4px) |
|
|
32
|
+
| `2` | `space2` | `0.5rem` (8px) |
|
|
33
|
+
| `3` | `space3` | `0.625rem` (10px) |
|
|
34
|
+
| `4` | `space4` | `1rem` (16px) |
|
|
35
|
+
| `5` | `space5` | `1.25rem` (20px) |
|
|
36
|
+
| `6` | `space6` | `1.5rem` (24px) |
|
|
37
|
+
|
|
38
|
+
Values are scale-only — there's no raw-string escape hatch for margin/padding, so spacing always traces back to a token. General → axis → specific-side precedence applies, same as CSS shorthand: `mx`/`my` override `m`; `mt`/`mr`/`mb`/`ml` override both. A consumer-supplied `style` prop always wins over any spacing prop.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Surface p={4} m={2}>...</Surface>
|
|
42
|
+
<Box px={4} py={2}>...</Box>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
### Box
|
|
48
|
+
|
|
49
|
+
A minimal polymorphic wrapper — an `as` prop, native props, and the spacing props above. Every other primitive below builds its own small set of curated, token-aware props on top of this same `as` pattern.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<Box as="section" p={4} mb={6}>
|
|
53
|
+
content
|
|
54
|
+
</Box>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Flex, Stack, Inline, Center
|
|
58
|
+
|
|
59
|
+
`Flex` is the one real recipe (`direction`, `align`, `justify`, `wrap`, `gap`); `Stack`, `Inline`, and `Center` are thin, fixed-prop wrappers over it — not duplicated CSS.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Flex direction="row" align="center" justify="between" gap={4} px={4} py={2}>...</Flex>
|
|
63
|
+
<Stack gap={3} p={4}>...</Stack> {/* Flex direction="column" */}
|
|
64
|
+
<Inline gap={2} mx={4}>...</Inline> {/* Flex direction="row" */}
|
|
65
|
+
<Center p={6}>...</Center> {/* Flex align/justify="center" */}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Grid
|
|
69
|
+
|
|
70
|
+
`columns`/`rows` each take a number (`repeat(N, 1fr)`) or a raw `grid-template-*` string for advanced layouts; `flow` maps to `grid-auto-flow`; `align`/`justify` use the same value sets as `Flex`.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Grid columns={3} rows={2} gap={4} align="center" justify="between" flow="row-dense" p={4}>
|
|
74
|
+
...
|
|
75
|
+
</Grid>
|
|
76
|
+
<Grid columns="1fr 2fr" gap={4}>...</Grid>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Container
|
|
80
|
+
|
|
81
|
+
Centers content and snaps its max-width at each breakpoint (640/768/1024/1280px) as the viewport grows — the same mechanism Tailwind's own `.container` utility uses. `maxWidth` is an escape hatch for a narrower container regardless of viewport (e.g. a login form).
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<Container my={6}>...</Container>
|
|
85
|
+
<Container maxWidth="20rem">...</Container>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Surface
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Surface p={4} radius="md" elevation="raised" m={2}>
|
|
92
|
+
...
|
|
93
|
+
</Surface>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`radius` is the same `sm`/`md`/`full` scale `@vinyasa/button`'s `radius` prop uses; `elevation` is `raised`/`overlay`/`modal`.
|
|
97
|
+
|
|
98
|
+
### Divider
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<Divider /> {/* <hr>, horizontal */}
|
|
102
|
+
<Divider orientation="vertical" /> {/* role="separator" div */}
|
|
103
|
+
<Divider orientation="vertical" decorative /> {/* aria-hidden, purely visual */}
|
|
104
|
+
<Divider my={4} /> {/* spacing props apply here too */}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### ScrollArea
|
|
108
|
+
|
|
109
|
+
A fully custom, cross-browser-consistent scrollbar (thumb/track/drag), built by styling [`@radix-ui/react-scroll-area`](https://www.radix-ui.com/primitives/docs/components/scroll-area) with our own tokens rather than hand-rolling pointer-drag math and accessibility. `maxHeight`/`maxWidth` are applied as real `height`/`width` (not `max-height`/`max-width`) since Radix's internal viewport needs an explicit bound to resolve its own `100%` sizing against.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<ScrollArea maxHeight="20rem">{longContent}</ScrollArea>
|
|
113
|
+
<ScrollArea maxHeight="20rem" maxWidth="24rem">{content}</ScrollArea>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Portal
|
|
117
|
+
|
|
118
|
+
An SSR-safe wrapper around `createPortal` (mounts only on the client, no hydration mismatch). No spacing props — it renders no wrapper element of its own.
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<Portal>{children}</Portal> {/* defaults to document.body */}
|
|
122
|
+
<Portal container={someElement}>{children}</Portal>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### AspectRatio
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<AspectRatio ratio={16 / 9} m={4}>
|
|
129
|
+
{video}
|
|
130
|
+
</AspectRatio>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`ratio` is an arbitrary runtime number, not a themed/discrete design value — this is why it's a plain inline `aspect-ratio` style rather than a `recipe()` variant, unlike everything else in this package.
|
|
134
|
+
|
|
135
|
+
### Spacer
|
|
136
|
+
|
|
137
|
+
A flexible filler (`flex: 1 0 0%`) for pushing content apart inside `Flex`/`Stack`/`Inline`. No props beyond native ones — a spacer being "spaceable" itself doesn't add anything.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<Inline>
|
|
141
|
+
<span>Left</span>
|
|
142
|
+
<Spacer />
|
|
143
|
+
<span>Right</span>
|
|
144
|
+
</Inline>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Subpath imports
|
|
148
|
+
|
|
149
|
+
Every component can be imported directly instead of through the package root, e.g.:
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import Surface from '@vinyasa/layout/surface';
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
From the repository root:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pnpm --filter @vinyasa/layout build
|
|
161
|
+
pnpm --filter @vinyasa/layout test
|
|
162
|
+
pnpm --filter @vinyasa/layout lint
|
|
163
|
+
pnpm storybook # Layout/*
|
|
164
|
+
```
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
153 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
+
v: ()=>resolveSpacingStyle
|
|
6
|
+
});
|
|
7
|
+
const tokens_namespaceObject = require("@vinyasa/tokens");
|
|
8
|
+
const space = {
|
|
9
|
+
1: tokens_namespaceObject.themeContract.space1,
|
|
10
|
+
2: tokens_namespaceObject.themeContract.space2,
|
|
11
|
+
3: tokens_namespaceObject.themeContract.space3,
|
|
12
|
+
4: tokens_namespaceObject.themeContract.space4,
|
|
13
|
+
5: tokens_namespaceObject.themeContract.space5,
|
|
14
|
+
6: tokens_namespaceObject.themeContract.space6
|
|
15
|
+
};
|
|
16
|
+
const spacingPropertyMap = [
|
|
17
|
+
[
|
|
18
|
+
'm',
|
|
19
|
+
'margin'
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
'mx',
|
|
23
|
+
'marginInline'
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
'my',
|
|
27
|
+
'marginBlock'
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
'mt',
|
|
31
|
+
'marginTop'
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
'mr',
|
|
35
|
+
'marginRight'
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
'mb',
|
|
39
|
+
'marginBottom'
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
'ml',
|
|
43
|
+
'marginLeft'
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'p',
|
|
47
|
+
'padding'
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
'px',
|
|
51
|
+
'paddingInline'
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
'py',
|
|
55
|
+
'paddingBlock'
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
'pt',
|
|
59
|
+
'paddingTop'
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
'pr',
|
|
63
|
+
'paddingRight'
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
'pb',
|
|
67
|
+
'paddingBottom'
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
'pl',
|
|
71
|
+
'paddingLeft'
|
|
72
|
+
]
|
|
73
|
+
];
|
|
74
|
+
const resolveSpacingStyle = (props)=>{
|
|
75
|
+
const style = {};
|
|
76
|
+
for (const [propKey, cssProperty] of spacingPropertyMap){
|
|
77
|
+
const value = props[propKey];
|
|
78
|
+
if (void 0 !== value) style[cssProperty] = space[value];
|
|
79
|
+
}
|
|
80
|
+
return style;
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
15 (module) {
|
|
84
|
+
module.exports = require("react");
|
|
85
|
+
},
|
|
86
|
+
732 (module) {
|
|
87
|
+
module.exports = require("react/jsx-runtime");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var __webpack_module_cache__ = {};
|
|
91
|
+
function __webpack_require__(moduleId) {
|
|
92
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
93
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
94
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
95
|
+
exports: {}
|
|
96
|
+
};
|
|
97
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
98
|
+
return module.exports;
|
|
99
|
+
}
|
|
100
|
+
(()=>{
|
|
101
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
102
|
+
var define = (defs, kind)=>{
|
|
103
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
[kind]: defs[key]
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
define(getters, "get");
|
|
109
|
+
define(values, "value");
|
|
110
|
+
};
|
|
111
|
+
})();
|
|
112
|
+
(()=>{
|
|
113
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
114
|
+
})();
|
|
115
|
+
(()=>{
|
|
116
|
+
__webpack_require__.r = (exports1)=>{
|
|
117
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
118
|
+
value: 'Module'
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
121
|
+
value: true
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
})();
|
|
125
|
+
var __webpack_exports__ = {};
|
|
126
|
+
(()=>{
|
|
127
|
+
__webpack_require__.r(__webpack_exports__);
|
|
128
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
129
|
+
default: ()=>aspect_ratio
|
|
130
|
+
});
|
|
131
|
+
var jsx_runtime_ = __webpack_require__(732);
|
|
132
|
+
var external_react_ = __webpack_require__(15);
|
|
133
|
+
var spacing = __webpack_require__(153);
|
|
134
|
+
function _define_property(obj, key, value) {
|
|
135
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
136
|
+
value: value,
|
|
137
|
+
enumerable: true,
|
|
138
|
+
configurable: true,
|
|
139
|
+
writable: true
|
|
140
|
+
});
|
|
141
|
+
else obj[key] = value;
|
|
142
|
+
return obj;
|
|
143
|
+
}
|
|
144
|
+
function _object_spread(target) {
|
|
145
|
+
for(var i = 1; i < arguments.length; i++){
|
|
146
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
147
|
+
var ownKeys = Object.keys(source);
|
|
148
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
149
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
150
|
+
}));
|
|
151
|
+
ownKeys.forEach(function(key) {
|
|
152
|
+
_define_property(target, key, source[key]);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return target;
|
|
156
|
+
}
|
|
157
|
+
function AspectRatio_ownKeys(object, enumerableOnly) {
|
|
158
|
+
var keys = Object.keys(object);
|
|
159
|
+
if (Object.getOwnPropertySymbols) {
|
|
160
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
161
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
162
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
163
|
+
});
|
|
164
|
+
keys.push.apply(keys, symbols);
|
|
165
|
+
}
|
|
166
|
+
return keys;
|
|
167
|
+
}
|
|
168
|
+
function _object_spread_props(target, source) {
|
|
169
|
+
source = null != source ? source : {};
|
|
170
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
171
|
+
else AspectRatio_ownKeys(Object(source)).forEach(function(key) {
|
|
172
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
173
|
+
});
|
|
174
|
+
return target;
|
|
175
|
+
}
|
|
176
|
+
function _object_without_properties(source, excluded) {
|
|
177
|
+
if (null == source) return {};
|
|
178
|
+
var target = {}, sourceKeys, key, i;
|
|
179
|
+
if ("u" > typeof Reflect && Reflect.ownKeys) {
|
|
180
|
+
sourceKeys = Reflect.ownKeys(Object(source));
|
|
181
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
182
|
+
key = sourceKeys[i];
|
|
183
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
184
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return target;
|
|
188
|
+
}
|
|
189
|
+
target = _object_without_properties_loose(source, excluded);
|
|
190
|
+
if (Object.getOwnPropertySymbols) {
|
|
191
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
192
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
193
|
+
key = sourceKeys[i];
|
|
194
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
195
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return target;
|
|
200
|
+
}
|
|
201
|
+
function _object_without_properties_loose(source, excluded) {
|
|
202
|
+
if (null == source) return {};
|
|
203
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
204
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
205
|
+
key = sourceKeys[i];
|
|
206
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
207
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return target;
|
|
211
|
+
}
|
|
212
|
+
const AspectRatio = /*#__PURE__*/ (0, external_react_.forwardRef)((_0, _1)=>{
|
|
213
|
+
let _ref = [
|
|
214
|
+
_0,
|
|
215
|
+
_1
|
|
216
|
+
], [_ref1, ..._rest] = _ref, { as: Component = 'div', ratio = 1, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, style, children } = _ref1, rest = _object_without_properties(_ref1, [
|
|
217
|
+
"as",
|
|
218
|
+
"ratio",
|
|
219
|
+
"m",
|
|
220
|
+
"mt",
|
|
221
|
+
"mr",
|
|
222
|
+
"mb",
|
|
223
|
+
"ml",
|
|
224
|
+
"mx",
|
|
225
|
+
"my",
|
|
226
|
+
"p",
|
|
227
|
+
"pt",
|
|
228
|
+
"pr",
|
|
229
|
+
"pb",
|
|
230
|
+
"pl",
|
|
231
|
+
"px",
|
|
232
|
+
"py",
|
|
233
|
+
"style",
|
|
234
|
+
"children"
|
|
235
|
+
]), [ref] = _rest;
|
|
236
|
+
const computedStyle = _object_spread(_object_spread_props(_object_spread({}, (0, spacing.v)({
|
|
237
|
+
m,
|
|
238
|
+
mt,
|
|
239
|
+
mr,
|
|
240
|
+
mb,
|
|
241
|
+
ml,
|
|
242
|
+
mx,
|
|
243
|
+
my,
|
|
244
|
+
p,
|
|
245
|
+
pt,
|
|
246
|
+
pr,
|
|
247
|
+
pb,
|
|
248
|
+
pl,
|
|
249
|
+
px,
|
|
250
|
+
py
|
|
251
|
+
})), {
|
|
252
|
+
aspectRatio: String(ratio)
|
|
253
|
+
}), style);
|
|
254
|
+
return /*#__PURE__*/ (0, jsx_runtime_.jsx)(Component, _object_spread_props(_object_spread({
|
|
255
|
+
ref: ref,
|
|
256
|
+
style: computedStyle
|
|
257
|
+
}, rest), {
|
|
258
|
+
children: children
|
|
259
|
+
}));
|
|
260
|
+
});
|
|
261
|
+
AspectRatio.displayName = 'AspectRatio';
|
|
262
|
+
const aspect_ratio_AspectRatio = AspectRatio;
|
|
263
|
+
const aspect_ratio = aspect_ratio_AspectRatio;
|
|
264
|
+
})();
|
|
265
|
+
exports["default"] = __webpack_exports__["default"];
|
|
266
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
267
|
+
"default"
|
|
268
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
269
|
+
Object.defineProperty(exports, '__esModule', {
|
|
270
|
+
value: true
|
|
271
|
+
});
|
package/dist/cjs/box.cjs
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
153 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
+
v: ()=>resolveSpacingStyle
|
|
6
|
+
});
|
|
7
|
+
const tokens_namespaceObject = require("@vinyasa/tokens");
|
|
8
|
+
const space = {
|
|
9
|
+
1: tokens_namespaceObject.themeContract.space1,
|
|
10
|
+
2: tokens_namespaceObject.themeContract.space2,
|
|
11
|
+
3: tokens_namespaceObject.themeContract.space3,
|
|
12
|
+
4: tokens_namespaceObject.themeContract.space4,
|
|
13
|
+
5: tokens_namespaceObject.themeContract.space5,
|
|
14
|
+
6: tokens_namespaceObject.themeContract.space6
|
|
15
|
+
};
|
|
16
|
+
const spacingPropertyMap = [
|
|
17
|
+
[
|
|
18
|
+
'm',
|
|
19
|
+
'margin'
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
'mx',
|
|
23
|
+
'marginInline'
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
'my',
|
|
27
|
+
'marginBlock'
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
'mt',
|
|
31
|
+
'marginTop'
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
'mr',
|
|
35
|
+
'marginRight'
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
'mb',
|
|
39
|
+
'marginBottom'
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
'ml',
|
|
43
|
+
'marginLeft'
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'p',
|
|
47
|
+
'padding'
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
'px',
|
|
51
|
+
'paddingInline'
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
'py',
|
|
55
|
+
'paddingBlock'
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
'pt',
|
|
59
|
+
'paddingTop'
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
'pr',
|
|
63
|
+
'paddingRight'
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
'pb',
|
|
67
|
+
'paddingBottom'
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
'pl',
|
|
71
|
+
'paddingLeft'
|
|
72
|
+
]
|
|
73
|
+
];
|
|
74
|
+
const resolveSpacingStyle = (props)=>{
|
|
75
|
+
const style = {};
|
|
76
|
+
for (const [propKey, cssProperty] of spacingPropertyMap){
|
|
77
|
+
const value = props[propKey];
|
|
78
|
+
if (void 0 !== value) style[cssProperty] = space[value];
|
|
79
|
+
}
|
|
80
|
+
return style;
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
15 (module) {
|
|
84
|
+
module.exports = require("react");
|
|
85
|
+
},
|
|
86
|
+
732 (module) {
|
|
87
|
+
module.exports = require("react/jsx-runtime");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var __webpack_module_cache__ = {};
|
|
91
|
+
function __webpack_require__(moduleId) {
|
|
92
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
93
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
94
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
95
|
+
exports: {}
|
|
96
|
+
};
|
|
97
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
98
|
+
return module.exports;
|
|
99
|
+
}
|
|
100
|
+
(()=>{
|
|
101
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
102
|
+
var define = (defs, kind)=>{
|
|
103
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
[kind]: defs[key]
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
define(getters, "get");
|
|
109
|
+
define(values, "value");
|
|
110
|
+
};
|
|
111
|
+
})();
|
|
112
|
+
(()=>{
|
|
113
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
114
|
+
})();
|
|
115
|
+
(()=>{
|
|
116
|
+
__webpack_require__.r = (exports1)=>{
|
|
117
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
118
|
+
value: 'Module'
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
121
|
+
value: true
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
})();
|
|
125
|
+
var __webpack_exports__ = {};
|
|
126
|
+
(()=>{
|
|
127
|
+
__webpack_require__.r(__webpack_exports__);
|
|
128
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
129
|
+
default: ()=>box
|
|
130
|
+
});
|
|
131
|
+
var jsx_runtime_ = __webpack_require__(732);
|
|
132
|
+
var external_react_ = __webpack_require__(15);
|
|
133
|
+
var spacing = __webpack_require__(153);
|
|
134
|
+
function _define_property(obj, key, value) {
|
|
135
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
136
|
+
value: value,
|
|
137
|
+
enumerable: true,
|
|
138
|
+
configurable: true,
|
|
139
|
+
writable: true
|
|
140
|
+
});
|
|
141
|
+
else obj[key] = value;
|
|
142
|
+
return obj;
|
|
143
|
+
}
|
|
144
|
+
function _object_spread(target) {
|
|
145
|
+
for(var i = 1; i < arguments.length; i++){
|
|
146
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
147
|
+
var ownKeys = Object.keys(source);
|
|
148
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
149
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
150
|
+
}));
|
|
151
|
+
ownKeys.forEach(function(key) {
|
|
152
|
+
_define_property(target, key, source[key]);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return target;
|
|
156
|
+
}
|
|
157
|
+
function Box_ownKeys(object, enumerableOnly) {
|
|
158
|
+
var keys = Object.keys(object);
|
|
159
|
+
if (Object.getOwnPropertySymbols) {
|
|
160
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
161
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
162
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
163
|
+
});
|
|
164
|
+
keys.push.apply(keys, symbols);
|
|
165
|
+
}
|
|
166
|
+
return keys;
|
|
167
|
+
}
|
|
168
|
+
function _object_spread_props(target, source) {
|
|
169
|
+
source = null != source ? source : {};
|
|
170
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
171
|
+
else Box_ownKeys(Object(source)).forEach(function(key) {
|
|
172
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
173
|
+
});
|
|
174
|
+
return target;
|
|
175
|
+
}
|
|
176
|
+
function _object_without_properties(source, excluded) {
|
|
177
|
+
if (null == source) return {};
|
|
178
|
+
var target = {}, sourceKeys, key, i;
|
|
179
|
+
if ("u" > typeof Reflect && Reflect.ownKeys) {
|
|
180
|
+
sourceKeys = Reflect.ownKeys(Object(source));
|
|
181
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
182
|
+
key = sourceKeys[i];
|
|
183
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
184
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return target;
|
|
188
|
+
}
|
|
189
|
+
target = _object_without_properties_loose(source, excluded);
|
|
190
|
+
if (Object.getOwnPropertySymbols) {
|
|
191
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
192
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
193
|
+
key = sourceKeys[i];
|
|
194
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
195
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return target;
|
|
200
|
+
}
|
|
201
|
+
function _object_without_properties_loose(source, excluded) {
|
|
202
|
+
if (null == source) return {};
|
|
203
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
204
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
205
|
+
key = sourceKeys[i];
|
|
206
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
207
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return target;
|
|
211
|
+
}
|
|
212
|
+
const Box = /*#__PURE__*/ (0, external_react_.forwardRef)((_0, _1)=>{
|
|
213
|
+
let _ref = [
|
|
214
|
+
_0,
|
|
215
|
+
_1
|
|
216
|
+
], [_ref1, ..._rest] = _ref, { as: Component = 'div', m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, style, children } = _ref1, rest = _object_without_properties(_ref1, [
|
|
217
|
+
"as",
|
|
218
|
+
"m",
|
|
219
|
+
"mt",
|
|
220
|
+
"mr",
|
|
221
|
+
"mb",
|
|
222
|
+
"ml",
|
|
223
|
+
"mx",
|
|
224
|
+
"my",
|
|
225
|
+
"p",
|
|
226
|
+
"pt",
|
|
227
|
+
"pr",
|
|
228
|
+
"pb",
|
|
229
|
+
"pl",
|
|
230
|
+
"px",
|
|
231
|
+
"py",
|
|
232
|
+
"style",
|
|
233
|
+
"children"
|
|
234
|
+
]), [ref] = _rest;
|
|
235
|
+
const computedStyle = _object_spread({}, (0, spacing.v)({
|
|
236
|
+
m,
|
|
237
|
+
mt,
|
|
238
|
+
mr,
|
|
239
|
+
mb,
|
|
240
|
+
ml,
|
|
241
|
+
mx,
|
|
242
|
+
my,
|
|
243
|
+
p,
|
|
244
|
+
pt,
|
|
245
|
+
pr,
|
|
246
|
+
pb,
|
|
247
|
+
pl,
|
|
248
|
+
px,
|
|
249
|
+
py
|
|
250
|
+
}), style);
|
|
251
|
+
return /*#__PURE__*/ (0, jsx_runtime_.jsx)(Component, _object_spread_props(_object_spread({
|
|
252
|
+
ref: ref,
|
|
253
|
+
style: computedStyle
|
|
254
|
+
}, rest), {
|
|
255
|
+
children: children
|
|
256
|
+
}));
|
|
257
|
+
});
|
|
258
|
+
Box.displayName = 'Box';
|
|
259
|
+
const box_Box = Box;
|
|
260
|
+
const box = box_Box;
|
|
261
|
+
})();
|
|
262
|
+
exports["default"] = __webpack_exports__["default"];
|
|
263
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
264
|
+
"default"
|
|
265
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
266
|
+
Object.defineProperty(exports, '__esModule', {
|
|
267
|
+
value: true
|
|
268
|
+
});
|