@stokelp/styled-system 2.27.0 → 2.28.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/package.json +1 -1
- package/panda.buildinfo.json +3 -0
- package/patterns/aspect-ratio.mjs +2 -2
- package/patterns/bleed.mjs +2 -2
- package/patterns/box.mjs +2 -2
- package/patterns/center.mjs +2 -2
- package/patterns/circle.mjs +2 -2
- package/patterns/container.mjs +2 -2
- package/patterns/cq.mjs +2 -2
- package/patterns/divider.mjs +2 -2
- package/patterns/flex.mjs +2 -2
- package/patterns/float.mjs +4 -4
- package/patterns/grid-item.mjs +2 -2
- package/patterns/grid.mjs +4 -4
- package/patterns/hstack.mjs +2 -2
- package/patterns/link-overlay.mjs +3 -3
- package/patterns/spacer.mjs +2 -2
- package/patterns/square.mjs +2 -2
- package/patterns/stack.mjs +2 -2
- package/patterns/visually-hidden.mjs +2 -2
- package/patterns/vstack.mjs +2 -2
- package/patterns/wrap.mjs +2 -2
- package/recipes/index.d.ts +2 -1
- package/recipes/index.mjs +2 -1
- package/recipes/menu.d.ts +31 -0
- package/recipes/menu.mjs +92 -0
package/package.json
CHANGED
package/panda.buildinfo.json
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const aspectRatioConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { ratio = 4 / 3, ...rest } =
|
|
5
|
+
transform(props14, { map }) {
|
|
6
|
+
const { ratio = 4 / 3, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
position: "relative",
|
|
9
9
|
_before: {
|
package/patterns/bleed.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const bleedConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { inline, block, ...rest } =
|
|
5
|
+
transform(props14, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { inline, block, ...rest } = props14;
|
|
7
7
|
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
8
8
|
return {
|
|
9
9
|
"--bleed-x": map(inline, valueFn),
|
package/patterns/box.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const boxConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
return
|
|
5
|
+
transform(props14) {
|
|
6
|
+
return props14;
|
|
7
7
|
}}
|
|
8
8
|
|
|
9
9
|
export const getBoxStyle = (styles = {}) => {
|
package/patterns/center.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const centerConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { inline, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { inline, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: inline ? "inline-flex" : "flex",
|
|
9
9
|
alignItems: "center",
|
package/patterns/circle.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const circleConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { size, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { size, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
package/patterns/container.mjs
CHANGED
|
@@ -2,13 +2,13 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const containerConfig = {
|
|
5
|
-
transform(
|
|
5
|
+
transform(props14) {
|
|
6
6
|
return {
|
|
7
7
|
position: "relative",
|
|
8
8
|
maxWidth: "8xl",
|
|
9
9
|
mx: "auto",
|
|
10
10
|
px: { base: "4", md: "6", lg: "8" },
|
|
11
|
-
...
|
|
11
|
+
...props14
|
|
12
12
|
};
|
|
13
13
|
}}
|
|
14
14
|
|
package/patterns/cq.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const cqConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { name, type, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { name, type, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
containerType: type,
|
|
9
9
|
containerName: name,
|
package/patterns/divider.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const dividerConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { orientation, thickness, color, ...rest } =
|
|
5
|
+
transform(props14, { map }) {
|
|
6
|
+
const { orientation, thickness, color, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
"--thickness": thickness,
|
|
9
9
|
width: map(orientation, (v) => v === "vertical" ? void 0 : "100%"),
|
package/patterns/flex.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const flexConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { direction, align, justify, wrap: wrap22, basis, grow, shrink, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { direction, align, justify, wrap: wrap22, basis, grow, shrink, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: direction,
|
package/patterns/float.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const floatConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { offset, offsetX, offsetY, placement, ...rest } =
|
|
5
|
+
transform(props14, { map }) {
|
|
6
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "inline-flex",
|
|
9
9
|
justifyContent: "center",
|
|
@@ -38,8 +38,8 @@ transform(props13, { map }) {
|
|
|
38
38
|
...rest
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
|
-
defaultValues(
|
|
42
|
-
const offset =
|
|
41
|
+
defaultValues(props14) {
|
|
42
|
+
const offset = props14.offset || "0";
|
|
43
43
|
return { offset, offsetX: offset, offsetY: offset, placement: "top-end" };
|
|
44
44
|
}}
|
|
45
45
|
|
package/patterns/grid-item.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const gridItemConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } =
|
|
5
|
+
transform(props14, { map }) {
|
|
6
|
+
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props14;
|
|
7
7
|
const spanFn = (v) => v === "auto" ? v : `span ${v}`;
|
|
8
8
|
return {
|
|
9
9
|
gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
|
package/patterns/grid.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const gridConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } =
|
|
5
|
+
transform(props14, { map, isCssUnit }) {
|
|
6
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props14;
|
|
7
7
|
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
8
8
|
return {
|
|
9
9
|
display: "grid",
|
|
@@ -14,8 +14,8 @@ transform(props13, { map, isCssUnit }) {
|
|
|
14
14
|
...rest
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
|
-
defaultValues(
|
|
18
|
-
return { gap:
|
|
17
|
+
defaultValues(props14) {
|
|
18
|
+
return { gap: props14.columnGap || props14.rowGap ? void 0 : "10px" };
|
|
19
19
|
}}
|
|
20
20
|
|
|
21
21
|
export const getGridStyle = (styles = {}) => {
|
package/patterns/hstack.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const hstackConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { justify, gap, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { justify, gap, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
|
@@ -2,16 +2,16 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const linkOverlayConfig = {
|
|
5
|
-
transform(
|
|
5
|
+
transform(props14) {
|
|
6
6
|
return {
|
|
7
7
|
_before: {
|
|
8
8
|
content: '""',
|
|
9
9
|
position: "absolute",
|
|
10
10
|
inset: "0",
|
|
11
11
|
zIndex: "0",
|
|
12
|
-
...
|
|
12
|
+
...props14["_before"]
|
|
13
13
|
},
|
|
14
|
-
...
|
|
14
|
+
...props14
|
|
15
15
|
};
|
|
16
16
|
}}
|
|
17
17
|
|
package/patterns/spacer.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const spacerConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { size, ...rest } =
|
|
5
|
+
transform(props14, { map }) {
|
|
6
|
+
const { size, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
alignSelf: "stretch",
|
|
9
9
|
justifySelf: "stretch",
|
package/patterns/square.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const squareConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { size, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { size, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
package/patterns/stack.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const stackConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { align, justify, direction, gap, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { align, justify, direction, gap, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: direction,
|
package/patterns/vstack.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const vstackConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { justify, gap, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { justify, gap, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
alignItems: "center",
|
package/patterns/wrap.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const wrapConfig = {
|
|
5
|
-
transform(
|
|
6
|
-
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "10px", align, justify, ...rest } =
|
|
5
|
+
transform(props14) {
|
|
6
|
+
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "10px", align, justify, ...rest } = props14;
|
|
7
7
|
return {
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexWrap: "wrap",
|
package/recipes/index.d.ts
CHANGED
package/recipes/index.mjs
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface MenuVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "md"
|
|
8
|
+
*/
|
|
9
|
+
size: "md"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type MenuVariantMap = {
|
|
13
|
+
[key in keyof MenuVariant]: Array<MenuVariant[key]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type MenuVariantProps = {
|
|
17
|
+
[key in keyof MenuVariant]?: ConditionalValue<MenuVariant[key]> | undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface MenuRecipe {
|
|
21
|
+
__type: MenuVariantProps
|
|
22
|
+
(props?: MenuVariantProps): Pretty<Record<"arrow" | "arrowTip" | "content" | "contextTrigger" | "indicator" | "item" | "itemGroup" | "itemGroupLabel" | "itemIndicator" | "itemText" | "positioner" | "separator" | "trigger" | "triggerItem", string>>
|
|
23
|
+
raw: (props?: MenuVariantProps) => MenuVariantProps
|
|
24
|
+
variantMap: MenuVariantMap
|
|
25
|
+
variantKeys: Array<keyof MenuVariant>
|
|
26
|
+
splitVariantProps<Props extends MenuVariantProps>(props: Props): [MenuVariantProps, Pretty<DistributiveOmit<Props, keyof MenuVariantProps>>]
|
|
27
|
+
getVariantProps: (props?: MenuVariantProps) => MenuVariantProps
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export declare const menu: MenuRecipe
|
package/recipes/menu.mjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const menuDefaultVariants = {
|
|
5
|
+
"size": "md"
|
|
6
|
+
}
|
|
7
|
+
const menuCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const menuSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"arrow",
|
|
12
|
+
"menu__arrow"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"arrowTip",
|
|
16
|
+
"menu__arrowTip"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"content",
|
|
20
|
+
"menu__content"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"contextTrigger",
|
|
24
|
+
"menu__contextTrigger"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"indicator",
|
|
28
|
+
"menu__indicator"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"item",
|
|
32
|
+
"menu__item"
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"itemGroup",
|
|
36
|
+
"menu__itemGroup"
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"itemGroupLabel",
|
|
40
|
+
"menu__itemGroupLabel"
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"itemIndicator",
|
|
44
|
+
"menu__itemIndicator"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"itemText",
|
|
48
|
+
"menu__itemText"
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"positioner",
|
|
52
|
+
"menu__positioner"
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"separator",
|
|
56
|
+
"menu__separator"
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"trigger",
|
|
60
|
+
"menu__trigger"
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"triggerItem",
|
|
64
|
+
"menu__triggerItem"
|
|
65
|
+
]
|
|
66
|
+
]
|
|
67
|
+
const menuSlotFns = /* @__PURE__ */ menuSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, menuDefaultVariants, getSlotCompoundVariant(menuCompoundVariants, slotName))])
|
|
68
|
+
|
|
69
|
+
const menuFn = memo((props = {}) => {
|
|
70
|
+
return Object.fromEntries(menuSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const menuVariantKeys = [
|
|
74
|
+
"size"
|
|
75
|
+
]
|
|
76
|
+
const getVariantProps = (variants) => ({ ...menuDefaultVariants, ...compact(variants) })
|
|
77
|
+
|
|
78
|
+
export const menu = /* @__PURE__ */ Object.assign(menuFn, {
|
|
79
|
+
__recipe__: false,
|
|
80
|
+
__name__: 'menu',
|
|
81
|
+
raw: (props) => props,
|
|
82
|
+
variantKeys: menuVariantKeys,
|
|
83
|
+
variantMap: {
|
|
84
|
+
"size": [
|
|
85
|
+
"md"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
splitVariantProps(props) {
|
|
89
|
+
return splitProps(props, menuVariantKeys)
|
|
90
|
+
},
|
|
91
|
+
getVariantProps
|
|
92
|
+
})
|