@spark-web/stack 2.0.0-rc.19 → 2.0.0-rc.20
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/CHANGELOG.md +14 -0
- package/dist/spark-web-stack.cjs.d.ts +2 -2
- package/dist/spark-web-stack.cjs.js +15 -6
- package/package.json +5 -5
- package/dist/declarations/src/alignment.d.ts +0 -14
- package/dist/declarations/src/index.d.ts +0 -2
- package/dist/declarations/src/stack.d.ts +0 -21
- package/dist/spark-web-stack.cjs.dev.js +0 -58
- package/dist/spark-web-stack.cjs.prod.js +0 -58
- package/dist/spark-web-stack.esm.js +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @spark-web/stack
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.20
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Support for component-level theming; button-level theming
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @spark-web/divider@2.0.0-rc.20
|
|
13
|
+
- @spark-web/theme@4.0.0-rc.20
|
|
14
|
+
- @spark-web/utils@2.0.0-rc.20
|
|
15
|
+
- @spark-web/box@2.0.0-rc.20
|
|
16
|
+
|
|
3
17
|
## 2.0.0-rc.19
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1
|
+
export * from "../src/index";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXN0YWNrLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file might look strange and you might be wondering what it's for
|
|
3
|
+
// it's lets you import your source files by importing this entrypoint
|
|
4
|
+
// as you would import it if it was built with preconstruct build
|
|
5
|
+
// this file is slightly different to some others though
|
|
6
|
+
// it has a require hook which compiles your code with Babel
|
|
7
|
+
// this means that you don't have to set up @babel/register or anything like that
|
|
8
|
+
// but you can still require this module and it'll be compiled
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
// this bit of code imports the require hook and registers it
|
|
11
|
+
let unregister = require("../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", "..");
|
|
12
|
+
|
|
13
|
+
// this re-exports the source file
|
|
14
|
+
module.exports = require("../src/index.ts");
|
|
15
|
+
|
|
16
|
+
unregister();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/stack",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.20",
|
|
4
4
|
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.25.0",
|
|
19
19
|
"@emotion/react": "^11.14.0",
|
|
20
|
-
"@spark-web/box": "^2.0.0-rc.
|
|
21
|
-
"@spark-web/divider": "^2.0.0-rc.
|
|
22
|
-
"@spark-web/theme": "^4.0.0-rc.
|
|
23
|
-
"@spark-web/utils": "^2.0.0-rc.
|
|
20
|
+
"@spark-web/box": "^2.0.0-rc.20",
|
|
21
|
+
"@spark-web/divider": "^2.0.0-rc.20",
|
|
22
|
+
"@spark-web/theme": "^4.0.0-rc.20",
|
|
23
|
+
"@spark-web/utils": "^2.0.0-rc.20"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/react": "^18.2.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const alignLookup: {
|
|
2
|
-
readonly left: "start";
|
|
3
|
-
readonly center: "center";
|
|
4
|
-
readonly right: "end";
|
|
5
|
-
readonly stretch: "stretch";
|
|
6
|
-
};
|
|
7
|
-
export declare type Align = keyof typeof alignLookup;
|
|
8
|
-
export declare const alignToAlignItems: (prop?: import("@spark-web/theme").ResponsiveProp<"left" | "right" | "center" | "stretch"> | undefined) => "center" | "start" | "end" | "stretch" | {
|
|
9
|
-
mobile: "center" | "start" | "end" | "stretch" | undefined;
|
|
10
|
-
tablet: "center" | "start" | "end" | "stretch" | undefined;
|
|
11
|
-
desktop: "center" | "start" | "end" | "stretch" | undefined;
|
|
12
|
-
wide: "center" | "start" | "end" | "stretch" | undefined;
|
|
13
|
-
} | undefined;
|
|
14
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { BoxProps } from '@spark-web/box';
|
|
2
|
-
import type { ResponsiveProp } from '@spark-web/theme';
|
|
3
|
-
import type { ReactElement } from 'react';
|
|
4
|
-
import type { Align } from "./alignment.js";
|
|
5
|
-
declare type ValidBoxProps = Omit<BoxProps, 'display' | 'className' | 'alignItems' | 'flexDirection' | 'justifyContent' | 'flexWrap'>;
|
|
6
|
-
export declare type StackProps = {
|
|
7
|
-
/** Horizontally align items within the stack. */
|
|
8
|
-
align?: ResponsiveProp<Align>;
|
|
9
|
-
/** Place a divider between each element. */
|
|
10
|
-
dividers?: boolean;
|
|
11
|
-
} & ValidBoxProps;
|
|
12
|
-
export declare const Stack: <Comp extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "div">(props: {
|
|
13
|
-
as?: Comp | undefined;
|
|
14
|
-
ref?: import("react").Ref<Comp extends "symbol" | "text" | "clipPath" | "filter" | "mask" | "marker" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "text" | "clipPath" | "filter" | "mask" | "marker" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
|
|
15
|
-
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & {
|
|
16
|
-
/** Horizontally align items within the stack. */
|
|
17
|
-
align?: ResponsiveProp<"left" | "right" | "center" | "stretch"> | undefined;
|
|
18
|
-
/** Place a divider between each element. */
|
|
19
|
-
dividers?: boolean | undefined;
|
|
20
|
-
} & ValidBoxProps) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
21
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var box = require('@spark-web/box');
|
|
8
|
-
var divider = require('@spark-web/divider');
|
|
9
|
-
var ts = require('@spark-web/utils/ts');
|
|
10
|
-
var react = require('react');
|
|
11
|
-
var theme = require('@spark-web/theme');
|
|
12
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
13
|
-
|
|
14
|
-
var alignLookup = {
|
|
15
|
-
left: 'start',
|
|
16
|
-
center: 'center',
|
|
17
|
-
right: 'end',
|
|
18
|
-
stretch: 'stretch'
|
|
19
|
-
};
|
|
20
|
-
var alignToAlignItems = theme.createResponsiveMapFn(alignLookup);
|
|
21
|
-
|
|
22
|
-
var _excluded = ["align", "children", "data", "dividers"];
|
|
23
|
-
var Stack = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
24
|
-
var _ref$align = _ref.align,
|
|
25
|
-
align = _ref$align === void 0 ? 'stretch' : _ref$align,
|
|
26
|
-
children = _ref.children,
|
|
27
|
-
data = _ref.data,
|
|
28
|
-
dividers = _ref.dividers,
|
|
29
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
var alignItems = alignToAlignItems(align);
|
|
31
|
-
var rootProps = _objectSpread({
|
|
32
|
-
ref: forwardedRef,
|
|
33
|
-
alignItems: alignItems,
|
|
34
|
-
data: data,
|
|
35
|
-
display: 'flex',
|
|
36
|
-
flexDirection: 'column'
|
|
37
|
-
}, props);
|
|
38
|
-
|
|
39
|
-
// bail early w/o dividers to avoid unnecessary map
|
|
40
|
-
if (!dividers) {
|
|
41
|
-
return jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
42
|
-
children: children
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// map over children to insert dividers
|
|
47
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
48
|
-
var childArray = react.Children.toArray(children);
|
|
49
|
-
return jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
50
|
-
children: childArray.map(function (child, idx) {
|
|
51
|
-
return jsxRuntime.jsxs(react.Fragment, {
|
|
52
|
-
children: [dividers && idx ? jsxRuntime.jsx(divider.Divider, {}) : null, child]
|
|
53
|
-
}, child.key || idx);
|
|
54
|
-
})
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
exports.Stack = Stack;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var box = require('@spark-web/box');
|
|
8
|
-
var divider = require('@spark-web/divider');
|
|
9
|
-
var ts = require('@spark-web/utils/ts');
|
|
10
|
-
var react = require('react');
|
|
11
|
-
var theme = require('@spark-web/theme');
|
|
12
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
13
|
-
|
|
14
|
-
var alignLookup = {
|
|
15
|
-
left: 'start',
|
|
16
|
-
center: 'center',
|
|
17
|
-
right: 'end',
|
|
18
|
-
stretch: 'stretch'
|
|
19
|
-
};
|
|
20
|
-
var alignToAlignItems = theme.createResponsiveMapFn(alignLookup);
|
|
21
|
-
|
|
22
|
-
var _excluded = ["align", "children", "data", "dividers"];
|
|
23
|
-
var Stack = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
24
|
-
var _ref$align = _ref.align,
|
|
25
|
-
align = _ref$align === void 0 ? 'stretch' : _ref$align,
|
|
26
|
-
children = _ref.children,
|
|
27
|
-
data = _ref.data,
|
|
28
|
-
dividers = _ref.dividers,
|
|
29
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
var alignItems = alignToAlignItems(align);
|
|
31
|
-
var rootProps = _objectSpread({
|
|
32
|
-
ref: forwardedRef,
|
|
33
|
-
alignItems: alignItems,
|
|
34
|
-
data: data,
|
|
35
|
-
display: 'flex',
|
|
36
|
-
flexDirection: 'column'
|
|
37
|
-
}, props);
|
|
38
|
-
|
|
39
|
-
// bail early w/o dividers to avoid unnecessary map
|
|
40
|
-
if (!dividers) {
|
|
41
|
-
return jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
42
|
-
children: children
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// map over children to insert dividers
|
|
47
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
48
|
-
var childArray = react.Children.toArray(children);
|
|
49
|
-
return jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
50
|
-
children: childArray.map(function (child, idx) {
|
|
51
|
-
return jsxRuntime.jsxs(react.Fragment, {
|
|
52
|
-
children: [dividers && idx ? jsxRuntime.jsx(divider.Divider, {}) : null, child]
|
|
53
|
-
}, child.key || idx);
|
|
54
|
-
})
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
exports.Stack = Stack;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import { Box } from '@spark-web/box';
|
|
4
|
-
import { Divider } from '@spark-web/divider';
|
|
5
|
-
import { forwardRefWithAs } from '@spark-web/utils/ts';
|
|
6
|
-
import { Children, Fragment } from 'react';
|
|
7
|
-
import { createResponsiveMapFn } from '@spark-web/theme';
|
|
8
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
var alignLookup = {
|
|
11
|
-
left: 'start',
|
|
12
|
-
center: 'center',
|
|
13
|
-
right: 'end',
|
|
14
|
-
stretch: 'stretch'
|
|
15
|
-
};
|
|
16
|
-
var alignToAlignItems = createResponsiveMapFn(alignLookup);
|
|
17
|
-
|
|
18
|
-
var _excluded = ["align", "children", "data", "dividers"];
|
|
19
|
-
var Stack = forwardRefWithAs(function (_ref, forwardedRef) {
|
|
20
|
-
var _ref$align = _ref.align,
|
|
21
|
-
align = _ref$align === void 0 ? 'stretch' : _ref$align,
|
|
22
|
-
children = _ref.children,
|
|
23
|
-
data = _ref.data,
|
|
24
|
-
dividers = _ref.dividers,
|
|
25
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var alignItems = alignToAlignItems(align);
|
|
27
|
-
var rootProps = _objectSpread({
|
|
28
|
-
ref: forwardedRef,
|
|
29
|
-
alignItems: alignItems,
|
|
30
|
-
data: data,
|
|
31
|
-
display: 'flex',
|
|
32
|
-
flexDirection: 'column'
|
|
33
|
-
}, props);
|
|
34
|
-
|
|
35
|
-
// bail early w/o dividers to avoid unnecessary map
|
|
36
|
-
if (!dividers) {
|
|
37
|
-
return jsx(Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
38
|
-
children: children
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// map over children to insert dividers
|
|
43
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
44
|
-
var childArray = Children.toArray(children);
|
|
45
|
-
return jsx(Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
46
|
-
children: childArray.map(function (child, idx) {
|
|
47
|
-
return jsxs(Fragment, {
|
|
48
|
-
children: [dividers && idx ? jsx(Divider, {}) : null, child]
|
|
49
|
-
}, child.key || idx);
|
|
50
|
-
})
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export { Stack };
|