thread-ui 0.7.14 → 0.8.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 +11 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/styled-system/css/conditions..js +36 -0
- package/dist/styled-system/css/conditions.js +36 -0
- package/dist/styled-system/css/css..js +45 -0
- package/dist/styled-system/css/css.js +45 -0
- package/dist/styled-system/css/cva..js +87 -0
- package/dist/styled-system/css/cva.js +87 -0
- package/dist/styled-system/css/cx..js +15 -0
- package/dist/styled-system/css/cx.js +15 -0
- package/dist/styled-system/css/index..js +4 -0
- package/dist/styled-system/css/index.js +4 -0
- package/dist/styled-system/css/sva..js +46 -0
- package/dist/styled-system/css/sva.js +46 -0
- package/dist/styled-system/helpers..js +316 -0
- package/dist/styled-system/helpers.js +316 -0
- package/dist/styled-system/patterns/aspect-ratio..js +38 -0
- package/dist/styled-system/patterns/aspect-ratio.js +38 -0
- package/dist/styled-system/patterns/bleed..js +24 -0
- package/dist/styled-system/patterns/bleed.js +24 -0
- package/dist/styled-system/patterns/box..js +15 -0
- package/dist/styled-system/patterns/box.js +15 -0
- package/dist/styled-system/patterns/center..js +21 -0
- package/dist/styled-system/patterns/center.js +21 -0
- package/dist/styled-system/patterns/circle..js +25 -0
- package/dist/styled-system/patterns/circle.js +25 -0
- package/dist/styled-system/patterns/container..js +22 -0
- package/dist/styled-system/patterns/container.js +22 -0
- package/dist/styled-system/patterns/cq..js +21 -0
- package/dist/styled-system/patterns/cq.js +21 -0
- package/dist/styled-system/patterns/divider..js +25 -0
- package/dist/styled-system/patterns/divider.js +25 -0
- package/dist/styled-system/patterns/flex..js +26 -0
- package/dist/styled-system/patterns/flex.js +26 -0
- package/dist/styled-system/patterns/float..js +52 -0
- package/dist/styled-system/patterns/float.js +52 -0
- package/dist/styled-system/patterns/grid-item..js +25 -0
- package/dist/styled-system/patterns/grid-item.js +25 -0
- package/dist/styled-system/patterns/grid..js +27 -0
- package/dist/styled-system/patterns/grid.js +27 -0
- package/dist/styled-system/patterns/hstack..js +24 -0
- package/dist/styled-system/patterns/hstack.js +24 -0
- package/dist/styled-system/patterns/index..js +20 -0
- package/dist/styled-system/patterns/index.js +20 -0
- package/dist/styled-system/patterns/link-overlay..js +24 -0
- package/dist/styled-system/patterns/link-overlay.js +24 -0
- package/dist/styled-system/patterns/spacer..js +21 -0
- package/dist/styled-system/patterns/spacer.js +21 -0
- package/dist/styled-system/patterns/square..js +24 -0
- package/dist/styled-system/patterns/square.js +24 -0
- package/dist/styled-system/patterns/stack..js +24 -0
- package/dist/styled-system/patterns/stack.js +24 -0
- package/dist/styled-system/patterns/visually-hidden..js +18 -0
- package/dist/styled-system/patterns/visually-hidden.js +18 -0
- package/dist/styled-system/patterns/vstack..js +24 -0
- package/dist/styled-system/patterns/vstack.js +24 -0
- package/dist/styled-system/patterns/wrap..js +25 -0
- package/dist/styled-system/patterns/wrap.js +25 -0
- package/dist/styled-system/recipes/button..js +445 -0
- package/dist/styled-system/recipes/button.js +445 -0
- package/dist/styled-system/recipes/create-recipe..js +82 -0
- package/dist/styled-system/recipes/create-recipe.js +82 -0
- package/dist/styled-system/recipes/index..js +1 -0
- package/dist/styled-system/recipes/index.js +1 -0
- package/dist/styled-system/styles.css +1 -1
- package/dist/styled-system/tokens/index..js +2104 -0
- package/dist/styled-system/tokens/index.js +2104 -0
- package/dist/styles/theme.css +115 -0
- package/dist/styles/thread.css +3 -115
- package/package.json +3 -4
- /package/dist/styles/{styles.css → tailwind.css} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const bleedConfig = {
|
|
5
|
+
transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { inline, block, ...rest } = props;
|
|
7
|
+
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
8
|
+
return {
|
|
9
|
+
"--bleed-x": map(inline, valueFn),
|
|
10
|
+
"--bleed-y": map(block, valueFn),
|
|
11
|
+
marginInline: "calc(var(--bleed-x, 0) * -1)",
|
|
12
|
+
marginBlock: "calc(var(--bleed-y, 0) * -1)",
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{inline:'0',block:'0'}}
|
|
17
|
+
|
|
18
|
+
export const getBleedStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(bleedConfig, styles)
|
|
20
|
+
return bleedConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const bleed = (styles) => css(getBleedStyle(styles))
|
|
24
|
+
bleed.raw = getBleedStyle
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const bleedConfig = {
|
|
5
|
+
transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { inline, block, ...rest } = props;
|
|
7
|
+
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
8
|
+
return {
|
|
9
|
+
"--bleed-x": map(inline, valueFn),
|
|
10
|
+
"--bleed-y": map(block, valueFn),
|
|
11
|
+
marginInline: "calc(var(--bleed-x, 0) * -1)",
|
|
12
|
+
marginBlock: "calc(var(--bleed-y, 0) * -1)",
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{inline:'0',block:'0'}}
|
|
17
|
+
|
|
18
|
+
export const getBleedStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(bleedConfig, styles)
|
|
20
|
+
return bleedConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const bleed = (styles) => css(getBleedStyle(styles))
|
|
24
|
+
bleed.raw = getBleedStyle
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const boxConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
return props;
|
|
7
|
+
}}
|
|
8
|
+
|
|
9
|
+
export const getBoxStyle = (styles = {}) => {
|
|
10
|
+
const _styles = getPatternStyles(boxConfig, styles)
|
|
11
|
+
return boxConfig.transform(_styles, patternFns)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const box = (styles) => css(getBoxStyle(styles))
|
|
15
|
+
box.raw = getBoxStyle
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const boxConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
return props;
|
|
7
|
+
}}
|
|
8
|
+
|
|
9
|
+
export const getBoxStyle = (styles = {}) => {
|
|
10
|
+
const _styles = getPatternStyles(boxConfig, styles)
|
|
11
|
+
return boxConfig.transform(_styles, patternFns)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const box = (styles) => css(getBoxStyle(styles))
|
|
15
|
+
box.raw = getBoxStyle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const centerConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { inline, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: inline ? "inline-flex" : "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
...rest
|
|
12
|
+
};
|
|
13
|
+
}}
|
|
14
|
+
|
|
15
|
+
export const getCenterStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(centerConfig, styles)
|
|
17
|
+
return centerConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const center = (styles) => css(getCenterStyle(styles))
|
|
21
|
+
center.raw = getCenterStyle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const centerConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { inline, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: inline ? "inline-flex" : "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
...rest
|
|
12
|
+
};
|
|
13
|
+
}}
|
|
14
|
+
|
|
15
|
+
export const getCenterStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(centerConfig, styles)
|
|
17
|
+
return centerConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const center = (styles) => css(getCenterStyle(styles))
|
|
21
|
+
center.raw = getCenterStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const circleConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { size, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
flex: "0 0 auto",
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
borderRadius: "9999px",
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
}}
|
|
18
|
+
|
|
19
|
+
export const getCircleStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(circleConfig, styles)
|
|
21
|
+
return circleConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const circle = (styles) => css(getCircleStyle(styles))
|
|
25
|
+
circle.raw = getCircleStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const circleConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { size, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
flex: "0 0 auto",
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
borderRadius: "9999px",
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
}}
|
|
18
|
+
|
|
19
|
+
export const getCircleStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(circleConfig, styles)
|
|
21
|
+
return circleConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const circle = (styles) => css(getCircleStyle(styles))
|
|
25
|
+
circle.raw = getCircleStyle
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const containerConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
return {
|
|
7
|
+
width: "100%",
|
|
8
|
+
marginRight: "auto",
|
|
9
|
+
marginLeft: "auto",
|
|
10
|
+
maxWidth: "1400px",
|
|
11
|
+
paddingRight: "2rem",
|
|
12
|
+
paddingLeft: "2rem"
|
|
13
|
+
};
|
|
14
|
+
}}
|
|
15
|
+
|
|
16
|
+
export const getContainerStyle = (styles = {}) => {
|
|
17
|
+
const _styles = getPatternStyles(containerConfig, styles)
|
|
18
|
+
return containerConfig.transform(_styles, patternFns)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const container = (styles) => css(getContainerStyle(styles))
|
|
22
|
+
container.raw = getContainerStyle
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const containerConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
return {
|
|
7
|
+
width: "100%",
|
|
8
|
+
marginRight: "auto",
|
|
9
|
+
marginLeft: "auto",
|
|
10
|
+
maxWidth: "1400px",
|
|
11
|
+
paddingRight: "2rem",
|
|
12
|
+
paddingLeft: "2rem"
|
|
13
|
+
};
|
|
14
|
+
}}
|
|
15
|
+
|
|
16
|
+
export const getContainerStyle = (styles = {}) => {
|
|
17
|
+
const _styles = getPatternStyles(containerConfig, styles)
|
|
18
|
+
return containerConfig.transform(_styles, patternFns)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const container = (styles) => css(getContainerStyle(styles))
|
|
22
|
+
container.raw = getContainerStyle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const cqConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { name, type, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
containerType: type,
|
|
9
|
+
containerName: name,
|
|
10
|
+
...rest
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
defaultValues:{type:'inline-size'}}
|
|
14
|
+
|
|
15
|
+
export const getCqStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(cqConfig, styles)
|
|
17
|
+
return cqConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const cq = (styles) => css(getCqStyle(styles))
|
|
21
|
+
cq.raw = getCqStyle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const cqConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { name, type, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
containerType: type,
|
|
9
|
+
containerName: name,
|
|
10
|
+
...rest
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
defaultValues:{type:'inline-size'}}
|
|
14
|
+
|
|
15
|
+
export const getCqStyle = (styles = {}) => {
|
|
16
|
+
const _styles = getPatternStyles(cqConfig, styles)
|
|
17
|
+
return cqConfig.transform(_styles, patternFns)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const cq = (styles) => css(getCqStyle(styles))
|
|
21
|
+
cq.raw = getCqStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const dividerConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { orientation, thickness, color, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
"--thickness": thickness,
|
|
9
|
+
width: map(orientation, (v) => v === "vertical" ? void 0 : "100%"),
|
|
10
|
+
height: map(orientation, (v) => v === "horizontal" ? void 0 : "100%"),
|
|
11
|
+
borderBlockEndWidth: map(orientation, (v) => v === "horizontal" ? "var(--thickness)" : void 0),
|
|
12
|
+
borderInlineEndWidth: map(orientation, (v) => v === "vertical" ? "var(--thickness)" : void 0),
|
|
13
|
+
borderColor: color,
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues:{orientation:'horizontal',thickness:'1px'}}
|
|
18
|
+
|
|
19
|
+
export const getDividerStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(dividerConfig, styles)
|
|
21
|
+
return dividerConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const divider = (styles) => css(getDividerStyle(styles))
|
|
25
|
+
divider.raw = getDividerStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const dividerConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { orientation, thickness, color, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
"--thickness": thickness,
|
|
9
|
+
width: map(orientation, (v) => v === "vertical" ? void 0 : "100%"),
|
|
10
|
+
height: map(orientation, (v) => v === "horizontal" ? void 0 : "100%"),
|
|
11
|
+
borderBlockEndWidth: map(orientation, (v) => v === "horizontal" ? "var(--thickness)" : void 0),
|
|
12
|
+
borderInlineEndWidth: map(orientation, (v) => v === "vertical" ? "var(--thickness)" : void 0),
|
|
13
|
+
borderColor: color,
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues:{orientation:'horizontal',thickness:'1px'}}
|
|
18
|
+
|
|
19
|
+
export const getDividerStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(dividerConfig, styles)
|
|
21
|
+
return dividerConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const divider = (styles) => css(getDividerStyle(styles))
|
|
25
|
+
divider.raw = getDividerStyle
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const flexConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { direction, align, justify, wrap: wrap2, basis, grow, shrink, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: direction,
|
|
10
|
+
alignItems: align,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
flexWrap: wrap2,
|
|
13
|
+
flexBasis: basis,
|
|
14
|
+
flexGrow: grow,
|
|
15
|
+
flexShrink: shrink,
|
|
16
|
+
...rest
|
|
17
|
+
};
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
export const getFlexStyle = (styles = {}) => {
|
|
21
|
+
const _styles = getPatternStyles(flexConfig, styles)
|
|
22
|
+
return flexConfig.transform(_styles, patternFns)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const flex = (styles) => css(getFlexStyle(styles))
|
|
26
|
+
flex.raw = getFlexStyle
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const flexConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { direction, align, justify, wrap: wrap2, basis, grow, shrink, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: direction,
|
|
10
|
+
alignItems: align,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
flexWrap: wrap2,
|
|
13
|
+
flexBasis: basis,
|
|
14
|
+
flexGrow: grow,
|
|
15
|
+
flexShrink: shrink,
|
|
16
|
+
...rest
|
|
17
|
+
};
|
|
18
|
+
}}
|
|
19
|
+
|
|
20
|
+
export const getFlexStyle = (styles = {}) => {
|
|
21
|
+
const _styles = getPatternStyles(flexConfig, styles)
|
|
22
|
+
return flexConfig.transform(_styles, patternFns)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const flex = (styles) => css(getFlexStyle(styles))
|
|
26
|
+
flex.raw = getFlexStyle
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const floatConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "inline-flex",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
position: "absolute",
|
|
12
|
+
insetBlockStart: map(placement, (v) => {
|
|
13
|
+
const [side] = v.split("-");
|
|
14
|
+
const map2 = { top: offsetY, middle: "50%", bottom: "auto" };
|
|
15
|
+
return map2[side];
|
|
16
|
+
}),
|
|
17
|
+
insetBlockEnd: map(placement, (v) => {
|
|
18
|
+
const [side] = v.split("-");
|
|
19
|
+
const map2 = { top: "auto", middle: "50%", bottom: offsetY };
|
|
20
|
+
return map2[side];
|
|
21
|
+
}),
|
|
22
|
+
insetInlineStart: map(placement, (v) => {
|
|
23
|
+
const [, align] = v.split("-");
|
|
24
|
+
const map2 = { start: offsetX, center: "50%", end: "auto" };
|
|
25
|
+
return map2[align];
|
|
26
|
+
}),
|
|
27
|
+
insetInlineEnd: map(placement, (v) => {
|
|
28
|
+
const [, align] = v.split("-");
|
|
29
|
+
const map2 = { start: "auto", center: "50%", end: offsetX };
|
|
30
|
+
return map2[align];
|
|
31
|
+
}),
|
|
32
|
+
translate: map(placement, (v) => {
|
|
33
|
+
const [side, align] = v.split("-");
|
|
34
|
+
const mapX = { start: "-50%", center: "-50%", end: "50%" };
|
|
35
|
+
const mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
|
|
36
|
+
return `${mapX[align]} ${mapY[side]}`;
|
|
37
|
+
}),
|
|
38
|
+
...rest
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
defaultValues(props) {
|
|
42
|
+
const offset = props.offset || "0";
|
|
43
|
+
return { offset, offsetX: offset, offsetY: offset, placement: "top-end" };
|
|
44
|
+
}}
|
|
45
|
+
|
|
46
|
+
export const getFloatStyle = (styles = {}) => {
|
|
47
|
+
const _styles = getPatternStyles(floatConfig, styles)
|
|
48
|
+
return floatConfig.transform(_styles, patternFns)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const float = (styles) => css(getFloatStyle(styles))
|
|
52
|
+
float.raw = getFloatStyle
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const floatConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "inline-flex",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
position: "absolute",
|
|
12
|
+
insetBlockStart: map(placement, (v) => {
|
|
13
|
+
const [side] = v.split("-");
|
|
14
|
+
const map2 = { top: offsetY, middle: "50%", bottom: "auto" };
|
|
15
|
+
return map2[side];
|
|
16
|
+
}),
|
|
17
|
+
insetBlockEnd: map(placement, (v) => {
|
|
18
|
+
const [side] = v.split("-");
|
|
19
|
+
const map2 = { top: "auto", middle: "50%", bottom: offsetY };
|
|
20
|
+
return map2[side];
|
|
21
|
+
}),
|
|
22
|
+
insetInlineStart: map(placement, (v) => {
|
|
23
|
+
const [, align] = v.split("-");
|
|
24
|
+
const map2 = { start: offsetX, center: "50%", end: "auto" };
|
|
25
|
+
return map2[align];
|
|
26
|
+
}),
|
|
27
|
+
insetInlineEnd: map(placement, (v) => {
|
|
28
|
+
const [, align] = v.split("-");
|
|
29
|
+
const map2 = { start: "auto", center: "50%", end: offsetX };
|
|
30
|
+
return map2[align];
|
|
31
|
+
}),
|
|
32
|
+
translate: map(placement, (v) => {
|
|
33
|
+
const [side, align] = v.split("-");
|
|
34
|
+
const mapX = { start: "-50%", center: "-50%", end: "50%" };
|
|
35
|
+
const mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
|
|
36
|
+
return `${mapX[align]} ${mapY[side]}`;
|
|
37
|
+
}),
|
|
38
|
+
...rest
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
defaultValues(props) {
|
|
42
|
+
const offset = props.offset || "0";
|
|
43
|
+
return { offset, offsetX: offset, offsetY: offset, placement: "top-end" };
|
|
44
|
+
}}
|
|
45
|
+
|
|
46
|
+
export const getFloatStyle = (styles = {}) => {
|
|
47
|
+
const _styles = getPatternStyles(floatConfig, styles)
|
|
48
|
+
return floatConfig.transform(_styles, patternFns)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const float = (styles) => css(getFloatStyle(styles))
|
|
52
|
+
float.raw = getFloatStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const gridItemConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props;
|
|
7
|
+
const spanFn = (v) => v === "auto" ? v : `span ${v}`;
|
|
8
|
+
return {
|
|
9
|
+
gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
|
|
10
|
+
gridRow: rowSpan != null ? map(rowSpan, spanFn) : void 0,
|
|
11
|
+
gridColumnStart: colStart,
|
|
12
|
+
gridColumnEnd: colEnd,
|
|
13
|
+
gridRowStart: rowStart,
|
|
14
|
+
gridRowEnd: rowEnd,
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
}}
|
|
18
|
+
|
|
19
|
+
export const getGridItemStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(gridItemConfig, styles)
|
|
21
|
+
return gridItemConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const gridItem = (styles) => css(getGridItemStyle(styles))
|
|
25
|
+
gridItem.raw = getGridItemStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const gridItemConfig = {
|
|
5
|
+
transform(props, { map }) {
|
|
6
|
+
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props;
|
|
7
|
+
const spanFn = (v) => v === "auto" ? v : `span ${v}`;
|
|
8
|
+
return {
|
|
9
|
+
gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
|
|
10
|
+
gridRow: rowSpan != null ? map(rowSpan, spanFn) : void 0,
|
|
11
|
+
gridColumnStart: colStart,
|
|
12
|
+
gridColumnEnd: colEnd,
|
|
13
|
+
gridRowStart: rowStart,
|
|
14
|
+
gridRowEnd: rowEnd,
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
}}
|
|
18
|
+
|
|
19
|
+
export const getGridItemStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(gridItemConfig, styles)
|
|
21
|
+
return gridItemConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const gridItem = (styles) => css(getGridItemStyle(styles))
|
|
25
|
+
gridItem.raw = getGridItemStyle
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const gridConfig = {
|
|
5
|
+
transform(props, { map, isCssUnit }) {
|
|
6
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
|
|
7
|
+
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
8
|
+
return {
|
|
9
|
+
display: "grid",
|
|
10
|
+
gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
|
|
11
|
+
gap,
|
|
12
|
+
columnGap,
|
|
13
|
+
rowGap,
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues(props) {
|
|
18
|
+
return { gap: props.columnGap || props.rowGap ? void 0 : "8px" };
|
|
19
|
+
}}
|
|
20
|
+
|
|
21
|
+
export const getGridStyle = (styles = {}) => {
|
|
22
|
+
const _styles = getPatternStyles(gridConfig, styles)
|
|
23
|
+
return gridConfig.transform(_styles, patternFns)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const grid = (styles) => css(getGridStyle(styles))
|
|
27
|
+
grid.raw = getGridStyle
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const gridConfig = {
|
|
5
|
+
transform(props, { map, isCssUnit }) {
|
|
6
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
|
|
7
|
+
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
8
|
+
return {
|
|
9
|
+
display: "grid",
|
|
10
|
+
gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
|
|
11
|
+
gap,
|
|
12
|
+
columnGap,
|
|
13
|
+
rowGap,
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues(props) {
|
|
18
|
+
return { gap: props.columnGap || props.rowGap ? void 0 : "8px" };
|
|
19
|
+
}}
|
|
20
|
+
|
|
21
|
+
export const getGridStyle = (styles = {}) => {
|
|
22
|
+
const _styles = getPatternStyles(gridConfig, styles)
|
|
23
|
+
return gridConfig.transform(_styles, patternFns)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const grid = (styles) => css(getGridStyle(styles))
|
|
27
|
+
grid.raw = getGridStyle
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers..js';
|
|
2
|
+
import { css } from '../css/index..js';
|
|
3
|
+
|
|
4
|
+
const hstackConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { justify, gap, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: justify,
|
|
11
|
+
gap,
|
|
12
|
+
flexDirection: "row",
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{gap:'8px'}}
|
|
17
|
+
|
|
18
|
+
export const getHstackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(hstackConfig, styles)
|
|
20
|
+
return hstackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const hstack = (styles) => css(getHstackStyle(styles))
|
|
24
|
+
hstack.raw = getHstackStyle
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.js';
|
|
2
|
+
import { css } from '../css/index.js';
|
|
3
|
+
|
|
4
|
+
const hstackConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { justify, gap, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: justify,
|
|
11
|
+
gap,
|
|
12
|
+
flexDirection: "row",
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{gap:'8px'}}
|
|
17
|
+
|
|
18
|
+
export const getHstackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(hstackConfig, styles)
|
|
20
|
+
return hstackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const hstack = (styles) => css(getHstackStyle(styles))
|
|
24
|
+
hstack.raw = getHstackStyle
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './container..js';
|
|
2
|
+
export * from './box..js';
|
|
3
|
+
export * from './flex..js';
|
|
4
|
+
export * from './stack..js';
|
|
5
|
+
export * from './vstack..js';
|
|
6
|
+
export * from './hstack..js';
|
|
7
|
+
export * from './spacer..js';
|
|
8
|
+
export * from './square..js';
|
|
9
|
+
export * from './circle..js';
|
|
10
|
+
export * from './center..js';
|
|
11
|
+
export * from './link-overlay..js';
|
|
12
|
+
export * from './aspect-ratio..js';
|
|
13
|
+
export * from './grid..js';
|
|
14
|
+
export * from './grid-item..js';
|
|
15
|
+
export * from './wrap..js';
|
|
16
|
+
export * from './divider..js';
|
|
17
|
+
export * from './float..js';
|
|
18
|
+
export * from './bleed..js';
|
|
19
|
+
export * from './visually-hidden..js';
|
|
20
|
+
export * from './cq..js';
|