@spark-web/stack 1.0.9 → 1.1.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/CHANGELOG.md +219 -0
- package/README.md +1 -5
- package/dist/declarations/src/alignment.d.ts +5 -5
- package/dist/declarations/src/index.d.ts +2 -2
- package/dist/declarations/src/stack.d.ts +21 -0
- package/dist/spark-web-stack.cjs.dev.js +10 -12
- package/dist/spark-web-stack.cjs.prod.js +10 -12
- package/dist/spark-web-stack.esm.js +10 -12
- package/package.json +17 -10
- package/dist/declarations/src/Stack.d.ts +0 -21
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# @spark-web/stack
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#382](https://github.com/brighte-labs/spark-web/pull/382)
|
|
8
|
+
[`955bf5d`](https://github.com/brighte-labs/spark-web/commit/955bf5d7698bfdf45e7f317aa3e726c81d3444c0)
|
|
9
|
+
Thanks [@dilipt-brighte](https://github.com/dilipt-brighte)! - Updates React
|
|
10
|
+
version to latest (18.2.0)
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
[[`955bf5d`](https://github.com/brighte-labs/spark-web/commit/955bf5d7698bfdf45e7f317aa3e726c81d3444c0)]:
|
|
16
|
+
- @spark-web/box@1.2.0
|
|
17
|
+
- @spark-web/divider@1.1.0
|
|
18
|
+
- @spark-web/theme@3.2.0
|
|
19
|
+
- @spark-web/utils@1.3.0
|
|
20
|
+
|
|
21
|
+
## 1.0.10
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#218](https://github.com/brighte-labs/spark-web/pull/218)
|
|
26
|
+
[`6fc8d1b`](https://github.com/brighte-labs/spark-web/commit/6fc8d1bc37e25d0cd622bc37f68a1d92eb5961b5)
|
|
27
|
+
Thanks [@nderkim](https://github.com/nderkim)! - Rename files to kebab case
|
|
28
|
+
|
|
29
|
+
- [#222](https://github.com/brighte-labs/spark-web/pull/222)
|
|
30
|
+
[`7f93c45`](https://github.com/brighte-labs/spark-web/commit/7f93c45bbae8c765e10df9d0dd7615473797749b)
|
|
31
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update
|
|
32
|
+
dependencies
|
|
33
|
+
|
|
34
|
+
- [#242](https://github.com/brighte-labs/spark-web/pull/242)
|
|
35
|
+
[`6df05f7`](https://github.com/brighte-labs/spark-web/commit/6df05f764e4181c140d6547d6b897d0210468f6a)
|
|
36
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - - Add homepage
|
|
37
|
+
and repository keys to package.json
|
|
38
|
+
- Add CHANGELOG and README to files key in package.json
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
[[`adc5e9e`](https://github.com/brighte-labs/spark-web/commit/adc5e9e6c99acd117f3261edcefdb5573132441b),
|
|
41
|
+
[`de99b9c`](https://github.com/brighte-labs/spark-web/commit/de99b9c7f72373bd1902cf67f5cfec9a1e1db01c),
|
|
42
|
+
[`6fc8d1b`](https://github.com/brighte-labs/spark-web/commit/6fc8d1bc37e25d0cd622bc37f68a1d92eb5961b5),
|
|
43
|
+
[`7f93c45`](https://github.com/brighte-labs/spark-web/commit/7f93c45bbae8c765e10df9d0dd7615473797749b),
|
|
44
|
+
[`62f7de8`](https://github.com/brighte-labs/spark-web/commit/62f7de8a2e1df5ae088c093d3acdaa868d3f61fe),
|
|
45
|
+
[`6df05f7`](https://github.com/brighte-labs/spark-web/commit/6df05f764e4181c140d6547d6b897d0210468f6a)]:
|
|
46
|
+
- @spark-web/box@1.1.0
|
|
47
|
+
- @spark-web/divider@1.0.10
|
|
48
|
+
- @spark-web/theme@3.1.0
|
|
49
|
+
- @spark-web/utils@1.2.3
|
|
50
|
+
|
|
51
|
+
## 1.0.9
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [#208](https://github.com/brighte-labs/spark-web/pull/208)
|
|
56
|
+
[`1ea26ef`](https://github.com/brighte-labs/spark-web/commit/1ea26ef04a3b45875ed0dd2326eeab1fbe1e4bc5)
|
|
57
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Lower required
|
|
58
|
+
node version
|
|
59
|
+
|
|
60
|
+
- Updated dependencies
|
|
61
|
+
[[`1ea26ef`](https://github.com/brighte-labs/spark-web/commit/1ea26ef04a3b45875ed0dd2326eeab1fbe1e4bc5)]:
|
|
62
|
+
- @spark-web/box@1.0.9
|
|
63
|
+
- @spark-web/divider@1.0.9
|
|
64
|
+
- @spark-web/theme@3.0.6
|
|
65
|
+
- @spark-web/utils@1.2.2
|
|
66
|
+
|
|
67
|
+
## 1.0.8
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- [#197](https://github.com/brighte-labs/spark-web/pull/197)
|
|
72
|
+
[`94016d8`](https://github.com/brighte-labs/spark-web/commit/94016d84e26bbe55833bbcbab847a2cce6041538)
|
|
73
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update packages
|
|
74
|
+
|
|
75
|
+
- Updated dependencies
|
|
76
|
+
[[`94016d8`](https://github.com/brighte-labs/spark-web/commit/94016d84e26bbe55833bbcbab847a2cce6041538)]:
|
|
77
|
+
- @spark-web/box@1.0.8
|
|
78
|
+
- @spark-web/divider@1.0.8
|
|
79
|
+
- @spark-web/theme@3.0.5
|
|
80
|
+
- @spark-web/utils@1.2.1
|
|
81
|
+
|
|
82
|
+
## 1.0.7
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- [#173](https://github.com/brighte-labs/spark-web/pull/173)
|
|
87
|
+
[`90b7e9c`](https://github.com/brighte-labs/spark-web/commit/90b7e9cf4eb7e864d765c74b22c3dedf3d262e25)
|
|
88
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update babel
|
|
89
|
+
dependency
|
|
90
|
+
|
|
91
|
+
- Updated dependencies
|
|
92
|
+
[[`90b7e9c`](https://github.com/brighte-labs/spark-web/commit/90b7e9cf4eb7e864d765c74b22c3dedf3d262e25),
|
|
93
|
+
[`c3867af`](https://github.com/brighte-labs/spark-web/commit/c3867af7b77dfae3580ab63a5d5c9e8452f2da62)]:
|
|
94
|
+
- @spark-web/box@1.0.7
|
|
95
|
+
- @spark-web/divider@1.0.7
|
|
96
|
+
- @spark-web/theme@3.0.3
|
|
97
|
+
- @spark-web/utils@1.2.0
|
|
98
|
+
|
|
99
|
+
## 1.0.6
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- [#167](https://github.com/brighte-labs/spark-web/pull/167)
|
|
104
|
+
[`4f79350`](https://github.com/brighte-labs/spark-web/commit/4f793508fdb43ddd452f0d59a3126101f9fa5459)
|
|
105
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update Babel
|
|
106
|
+
|
|
107
|
+
- Updated dependencies
|
|
108
|
+
[[`4f79350`](https://github.com/brighte-labs/spark-web/commit/4f793508fdb43ddd452f0d59a3126101f9fa5459),
|
|
109
|
+
[`60f7281`](https://github.com/brighte-labs/spark-web/commit/60f7281c4a194d934a2ce561cad47e737b0fb48e)]:
|
|
110
|
+
- @spark-web/box@1.0.6
|
|
111
|
+
- @spark-web/divider@1.0.6
|
|
112
|
+
- @spark-web/theme@3.0.2
|
|
113
|
+
- @spark-web/utils@1.1.5
|
|
114
|
+
|
|
115
|
+
## 1.0.5
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- [#113](https://github.com/brighte-labs/spark-web/pull/113)
|
|
120
|
+
[`156236d`](https://github.com/brighte-labs/spark-web/commit/156236d2474aee66a0b8e2030635f9c08a5b78ba)
|
|
121
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update
|
|
122
|
+
dependencies
|
|
123
|
+
|
|
124
|
+
- Updated dependencies
|
|
125
|
+
[[`156236d`](https://github.com/brighte-labs/spark-web/commit/156236d2474aee66a0b8e2030635f9c08a5b78ba)]:
|
|
126
|
+
- @spark-web/box@1.0.5
|
|
127
|
+
- @spark-web/divider@1.0.5
|
|
128
|
+
- @spark-web/theme@3.0.1
|
|
129
|
+
- @spark-web/utils@1.1.3
|
|
130
|
+
|
|
131
|
+
## 1.0.4
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- [#87](https://github.com/brighte-labs/spark-web/pull/87)
|
|
136
|
+
[`5744b68`](https://github.com/brighte-labs/spark-web/commit/5744b6820f626b93a14e11e1fbd96bcbe1b12b27)
|
|
137
|
+
Thanks [@ChristopherMitchell242](https://github.com/ChristopherMitchell242)! -
|
|
138
|
+
Data attribute added to component props to allow consumers to attach
|
|
139
|
+
customattributes to components
|
|
140
|
+
|
|
141
|
+
* [#52](https://github.com/brighte-labs/spark-web/pull/52)
|
|
142
|
+
[`82ab744`](https://github.com/brighte-labs/spark-web/commit/82ab744f198466810f3386bc459b8ab4d57c820e)
|
|
143
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Add files array
|
|
144
|
+
to package.json files
|
|
145
|
+
|
|
146
|
+
* Updated dependencies
|
|
147
|
+
[[`182a53a`](https://github.com/brighte-labs/spark-web/commit/182a53a484892df48754e89dd714459a7f69fcff),
|
|
148
|
+
[`82ab744`](https://github.com/brighte-labs/spark-web/commit/82ab744f198466810f3386bc459b8ab4d57c820e),
|
|
149
|
+
[`df618d9`](https://github.com/brighte-labs/spark-web/commit/df618d92d534e06f06ecedc95ea6bdd51cdc906b)]:
|
|
150
|
+
- @spark-web/theme@3.0.0
|
|
151
|
+
- @spark-web/box@1.0.4
|
|
152
|
+
- @spark-web/divider@1.0.4
|
|
153
|
+
- @spark-web/utils@1.1.2
|
|
154
|
+
|
|
155
|
+
## 1.0.3
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- [#42](https://github.com/brighte-labs/spark-web/pull/42)
|
|
160
|
+
[`435779a`](https://github.com/brighte-labs/spark-web/commit/435779aa42bd635bbf43e1fd41724c666402caa2)
|
|
161
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Prevent multiple
|
|
162
|
+
versions of React
|
|
163
|
+
|
|
164
|
+
- Updated dependencies
|
|
165
|
+
[[`435779a`](https://github.com/brighte-labs/spark-web/commit/435779aa42bd635bbf43e1fd41724c666402caa2)]:
|
|
166
|
+
- @spark-web/box@1.0.3
|
|
167
|
+
- @spark-web/divider@1.0.3
|
|
168
|
+
- @spark-web/theme@2.0.2
|
|
169
|
+
- @spark-web/utils@1.1.1
|
|
170
|
+
|
|
171
|
+
## 1.0.2
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- [#40](https://github.com/brighte-labs/spark-web/pull/40)
|
|
176
|
+
[`062c8ab`](https://github.com/brighte-labs/spark-web/commit/062c8ab8c7b4120f8d14c269b5f7801288c678ca)
|
|
177
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Add
|
|
178
|
+
@babel/transform-runtime
|
|
179
|
+
|
|
180
|
+
- Updated dependencies
|
|
181
|
+
[[`062c8ab`](https://github.com/brighte-labs/spark-web/commit/062c8ab8c7b4120f8d14c269b5f7801288c678ca)]:
|
|
182
|
+
- @spark-web/box@1.0.2
|
|
183
|
+
- @spark-web/divider@1.0.2
|
|
184
|
+
- @spark-web/theme@2.0.1
|
|
185
|
+
- @spark-web/utils@1.0.2
|
|
186
|
+
|
|
187
|
+
## 1.0.1
|
|
188
|
+
|
|
189
|
+
### Patch Changes
|
|
190
|
+
|
|
191
|
+
- [#36](https://github.com/brighte-labs/spark-web/pull/36)
|
|
192
|
+
[`8546f8f`](https://github.com/brighte-labs/spark-web/commit/8546f8f05daaa79ea3ff954c6c4928a7a2d0622d)
|
|
193
|
+
Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update Babel
|
|
194
|
+
config
|
|
195
|
+
|
|
196
|
+
- Updated dependencies
|
|
197
|
+
[[`aebff30`](https://github.com/brighte-labs/spark-web/commit/aebff30c86cb0a9db22b545c46159ce0d1c14afb),
|
|
198
|
+
[`8546f8f`](https://github.com/brighte-labs/spark-web/commit/8546f8f05daaa79ea3ff954c6c4928a7a2d0622d)]:
|
|
199
|
+
- @spark-web/theme@2.0.0
|
|
200
|
+
- @spark-web/box@1.0.1
|
|
201
|
+
- @spark-web/divider@1.0.1
|
|
202
|
+
- @spark-web/utils@1.0.1
|
|
203
|
+
|
|
204
|
+
## 1.0.0
|
|
205
|
+
|
|
206
|
+
### Major Changes
|
|
207
|
+
|
|
208
|
+
- [#27](https://github.com/brighte-labs/spark-web/pull/27)
|
|
209
|
+
[`4c8e398`](https://github.com/brighte-labs/spark-web/commit/4c8e3988f8a59d3dab60a6b67b1128b6ff2a5f2c)
|
|
210
|
+
Thanks [@JedWatson](https://github.com/JedWatson)! - Initial Version
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- Updated dependencies
|
|
215
|
+
[[`4c8e398`](https://github.com/brighte-labs/spark-web/commit/4c8e3988f8a59d3dab60a6b67b1128b6ff2a5f2c)]:
|
|
216
|
+
- @spark-web/box@1.0.0
|
|
217
|
+
- @spark-web/divider@1.0.0
|
|
218
|
+
- @spark-web/theme@1.0.0
|
|
219
|
+
- @spark-web/utils@1.0.0
|
package/README.md
CHANGED
|
@@ -104,11 +104,7 @@ Nest Stack components to create more complex white space rules.
|
|
|
104
104
|
|
|
105
105
|
## Props
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
| --------- | -------------------------------------- | --------- | ----------------------------------------------------- |
|
|
109
|
-
| align? | [ResponsiveProp\<Align>][align] | 'stretch' | Horizontally align items within the container. |
|
|
110
|
-
| dividers? | boolean | | Sets whether to place a divider between each element. |
|
|
111
|
-
| data? | [DataAttributeMap][data-attribute-map] | | Sets data attributes on the component. |
|
|
107
|
+
<PropsTable displayName="Stack" />
|
|
112
108
|
|
|
113
109
|
`Stack` props also include [`Box`](/package/box) props and are not listed here
|
|
114
110
|
(excludes `display`, `className`, `alignItems`, `flexDirection`,
|
|
@@ -5,10 +5,10 @@ declare const alignLookup: {
|
|
|
5
5
|
readonly stretch: "stretch";
|
|
6
6
|
};
|
|
7
7
|
export declare type Align = keyof typeof alignLookup;
|
|
8
|
-
export declare const alignToAlignItems: (prop?: import("@spark-web/theme").ResponsiveProp<"left" | "right" | "center" | "stretch"> | undefined) => "
|
|
9
|
-
mobile: "
|
|
10
|
-
tablet: "
|
|
11
|
-
desktop: "
|
|
12
|
-
wide: "
|
|
8
|
+
export declare const alignToAlignItems: (prop?: import("@spark-web/theme").ResponsiveProp<"left" | "right" | "center" | "stretch"> | undefined) => "center" | "stretch" | "start" | "end" | {
|
|
9
|
+
mobile: "center" | "stretch" | "start" | "end" | undefined;
|
|
10
|
+
tablet: "center" | "stretch" | "start" | "end" | undefined;
|
|
11
|
+
desktop: "center" | "stretch" | "start" | "end" | undefined;
|
|
12
|
+
wide: "center" | "stretch" | "start" | "end" | undefined;
|
|
13
13
|
} | undefined;
|
|
14
14
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Stack } from './
|
|
2
|
-
export type { StackProps } from './
|
|
1
|
+
export { Stack } from './stack';
|
|
2
|
+
export type { StackProps } from './stack';
|
|
@@ -0,0 +1,21 @@
|
|
|
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';
|
|
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> = "div">(props: {
|
|
13
|
+
as?: Comp | undefined;
|
|
14
|
+
ref?: import("react").Ref<Comp extends "symbol" | "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" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap | "set" ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "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" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "set">)[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 {};
|
|
@@ -22,31 +22,29 @@ var alignToAlignItems = theme.createResponsiveMapFn(alignLookup);
|
|
|
22
22
|
var _excluded = ["align", "children", "data", "dividers"];
|
|
23
23
|
var Stack = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
24
24
|
var _ref$align = _ref.align,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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);
|
|
31
30
|
var alignItems = alignToAlignItems(align);
|
|
32
|
-
|
|
33
31
|
var rootProps = _objectSpread({
|
|
34
32
|
ref: forwardedRef,
|
|
35
33
|
alignItems: alignItems,
|
|
36
34
|
data: data,
|
|
37
35
|
display: 'flex',
|
|
38
36
|
flexDirection: 'column'
|
|
39
|
-
}, props);
|
|
40
|
-
|
|
37
|
+
}, props);
|
|
41
38
|
|
|
39
|
+
// bail early w/o dividers to avoid unnecessary map
|
|
42
40
|
if (!dividers) {
|
|
43
41
|
return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
44
42
|
children: children
|
|
45
43
|
}));
|
|
46
|
-
}
|
|
47
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
48
|
-
|
|
44
|
+
}
|
|
49
45
|
|
|
46
|
+
// map over children to insert dividers
|
|
47
|
+
// remove falsy values before mapping, keeps the index in sync
|
|
50
48
|
var childArray = react.Children.toArray(children);
|
|
51
49
|
return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
52
50
|
children: childArray.map(function (child, idx) {
|
|
@@ -22,31 +22,29 @@ var alignToAlignItems = theme.createResponsiveMapFn(alignLookup);
|
|
|
22
22
|
var _excluded = ["align", "children", "data", "dividers"];
|
|
23
23
|
var Stack = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
24
24
|
var _ref$align = _ref.align,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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);
|
|
31
30
|
var alignItems = alignToAlignItems(align);
|
|
32
|
-
|
|
33
31
|
var rootProps = _objectSpread({
|
|
34
32
|
ref: forwardedRef,
|
|
35
33
|
alignItems: alignItems,
|
|
36
34
|
data: data,
|
|
37
35
|
display: 'flex',
|
|
38
36
|
flexDirection: 'column'
|
|
39
|
-
}, props);
|
|
40
|
-
|
|
37
|
+
}, props);
|
|
41
38
|
|
|
39
|
+
// bail early w/o dividers to avoid unnecessary map
|
|
42
40
|
if (!dividers) {
|
|
43
41
|
return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
44
42
|
children: children
|
|
45
43
|
}));
|
|
46
|
-
}
|
|
47
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
48
|
-
|
|
44
|
+
}
|
|
49
45
|
|
|
46
|
+
// map over children to insert dividers
|
|
47
|
+
// remove falsy values before mapping, keeps the index in sync
|
|
50
48
|
var childArray = react.Children.toArray(children);
|
|
51
49
|
return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
52
50
|
children: childArray.map(function (child, idx) {
|
|
@@ -18,31 +18,29 @@ var alignToAlignItems = createResponsiveMapFn(alignLookup);
|
|
|
18
18
|
var _excluded = ["align", "children", "data", "dividers"];
|
|
19
19
|
var Stack = forwardRefWithAs(function (_ref, forwardedRef) {
|
|
20
20
|
var _ref$align = _ref.align,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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);
|
|
27
26
|
var alignItems = alignToAlignItems(align);
|
|
28
|
-
|
|
29
27
|
var rootProps = _objectSpread({
|
|
30
28
|
ref: forwardedRef,
|
|
31
29
|
alignItems: alignItems,
|
|
32
30
|
data: data,
|
|
33
31
|
display: 'flex',
|
|
34
32
|
flexDirection: 'column'
|
|
35
|
-
}, props);
|
|
36
|
-
|
|
33
|
+
}, props);
|
|
37
34
|
|
|
35
|
+
// bail early w/o dividers to avoid unnecessary map
|
|
38
36
|
if (!dividers) {
|
|
39
37
|
return /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
40
38
|
children: children
|
|
41
39
|
}));
|
|
42
|
-
}
|
|
43
|
-
// remove falsy values before mapping, keeps the index in sync
|
|
44
|
-
|
|
40
|
+
}
|
|
45
41
|
|
|
42
|
+
// map over children to insert dividers
|
|
43
|
+
// remove falsy values before mapping, keeps the index in sync
|
|
46
44
|
var childArray = Children.toArray(children);
|
|
47
45
|
return /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
48
46
|
children: childArray.map(function (child, idx) {
|
package/package.json
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/stack",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/brighte-labs/spark-web.git",
|
|
8
|
+
"directory": "packages/stack"
|
|
9
|
+
},
|
|
5
10
|
"main": "dist/spark-web-stack.cjs.js",
|
|
6
11
|
"module": "dist/spark-web-stack.esm.js",
|
|
7
12
|
"files": [
|
|
8
|
-
"
|
|
13
|
+
"CHANGELOG.md",
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
9
16
|
],
|
|
10
17
|
"dependencies": {
|
|
11
|
-
"@babel/runtime": "^7.
|
|
18
|
+
"@babel/runtime": "^7.19.0",
|
|
12
19
|
"@emotion/css": "^11.9.0",
|
|
13
|
-
"@spark-web/box": "^1.0
|
|
14
|
-
"@spark-web/divider": "^1.0
|
|
15
|
-
"@spark-web/theme": "^3.0
|
|
16
|
-
"@spark-web/utils": "^1.
|
|
20
|
+
"@spark-web/box": "^1.2.0",
|
|
21
|
+
"@spark-web/divider": "^1.1.0",
|
|
22
|
+
"@spark-web/theme": "^3.2.0",
|
|
23
|
+
"@spark-web/utils": "^1.3.0"
|
|
17
24
|
},
|
|
18
25
|
"devDependencies": {
|
|
19
|
-
"@types/react": "^
|
|
20
|
-
"react": "^
|
|
26
|
+
"@types/react": "^18.2.0",
|
|
27
|
+
"react": "^18.2.0"
|
|
21
28
|
},
|
|
22
29
|
"peerDependencies": {
|
|
23
30
|
"react": ">=17.0.2"
|
|
@@ -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';
|
|
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> = "div">(props: {
|
|
13
|
-
as?: Comp | undefined;
|
|
14
|
-
ref?: import("react").Ref<Comp extends "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "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" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "set" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "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" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "set">)[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 {};
|