@stokelp/styled-system 2.126.1 → 3.0.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/css/conditions.d.ts +7 -0
- package/css/conditions.js +32 -0
- package/css/css.d.ts +6 -6
- package/css/css.js +63 -0
- package/css/cva.d.ts +3 -4
- package/css/cva.js +51 -0
- package/css/cx.d.ts +5 -4
- package/css/{cx.mjs → cx.js} +5 -4
- package/css/first-that-works.d.ts +22 -0
- package/css/first-that-works.js +1 -0
- package/css/index.d.ts +8 -5
- package/css/index.js +8 -0
- package/css/keyframes.d.ts +5 -0
- package/css/keyframes.js +8 -0
- package/css/position-try.d.ts +5 -0
- package/css/position-try.js +11 -0
- package/css/sva.d.ts +2 -3
- package/css/sva.js +49 -0
- package/css/view-transition.d.ts +7 -0
- package/css/view-transition.js +18 -0
- package/dist/panda/buildinfo.json +20580 -0
- package/dist/panda/lib.json +15 -0
- package/dist/panda/preset.mjs +9505 -0
- package/helpers.d.ts +67 -0
- package/helpers.js +624 -0
- package/jsx/aspect-ratio.d.ts +5 -8
- package/jsx/aspect-ratio.js +11 -0
- package/jsx/bleed.d.ts +6 -9
- package/jsx/bleed.js +11 -0
- package/jsx/box.d.ts +6 -9
- package/jsx/box.js +11 -0
- package/jsx/center.d.ts +6 -9
- package/jsx/center.js +11 -0
- package/jsx/circle.d.ts +6 -9
- package/jsx/circle.js +11 -0
- package/jsx/container.d.ts +6 -9
- package/jsx/container.js +11 -0
- package/jsx/cq.d.ts +6 -9
- package/jsx/cq.js +11 -0
- package/jsx/create-recipe-context.d.ts +31 -0
- package/jsx/create-recipe-context.js +38 -0
- package/jsx/create-slot-recipe-context.d.ts +49 -0
- package/jsx/create-slot-recipe-context.js +124 -0
- package/jsx/divider.d.ts +6 -9
- package/jsx/divider.js +11 -0
- package/jsx/factory.d.ts +3 -3
- package/jsx/factory.js +91 -0
- package/jsx/flex.d.ts +6 -9
- package/jsx/flex.js +11 -0
- package/jsx/float.d.ts +6 -9
- package/jsx/float.js +11 -0
- package/jsx/grid-item.d.ts +6 -9
- package/jsx/grid-item.js +11 -0
- package/jsx/grid.d.ts +6 -9
- package/jsx/grid.js +11 -0
- package/jsx/helper.d.ts +34 -0
- package/jsx/helper.js +92 -0
- package/jsx/hstack.d.ts +6 -9
- package/jsx/hstack.js +11 -0
- package/jsx/index.d.ts +25 -25
- package/jsx/index.js +24 -0
- package/jsx/is-valid-prop.d.ts +5 -10
- package/jsx/is-valid-prop.js +12 -0
- package/jsx/link-overlay.d.ts +6 -9
- package/jsx/link-overlay.js +11 -0
- package/jsx/spacer.d.ts +6 -9
- package/jsx/spacer.js +11 -0
- package/jsx/square.d.ts +6 -9
- package/jsx/square.js +11 -0
- package/jsx/stack.d.ts +6 -9
- package/jsx/stack.js +11 -0
- package/jsx/visually-hidden.d.ts +6 -9
- package/jsx/visually-hidden.js +11 -0
- package/jsx/vstack.d.ts +6 -9
- package/jsx/vstack.js +11 -0
- package/jsx/wrap.d.ts +6 -9
- package/jsx/wrap.js +11 -0
- package/package.json +32 -18
- package/patterns/aspect-ratio.d.ts +8 -9
- package/patterns/aspect-ratio.js +37 -0
- package/patterns/bleed.d.ts +9 -10
- package/patterns/bleed.js +30 -0
- package/patterns/box.d.ts +8 -11
- package/patterns/box.js +16 -0
- package/patterns/center.d.ts +8 -9
- package/patterns/center.js +22 -0
- package/patterns/circle.d.ts +8 -9
- package/patterns/circle.js +26 -0
- package/patterns/container.d.ts +8 -11
- package/patterns/container.js +26 -0
- package/patterns/cq.d.ts +10 -10
- package/patterns/cq.js +24 -0
- package/patterns/divider.d.ts +11 -11
- package/patterns/divider.js +31 -0
- package/patterns/flex.d.ts +14 -15
- package/patterns/flex.js +27 -0
- package/patterns/float.d.ts +12 -12
- package/patterns/float.js +78 -0
- package/patterns/grid-item.d.ts +13 -14
- package/patterns/grid-item.js +26 -0
- package/patterns/grid.d.ts +13 -13
- package/patterns/grid.js +30 -0
- package/patterns/hstack.d.ts +9 -10
- package/patterns/hstack.js +27 -0
- package/patterns/index.d.ts +20 -21
- package/patterns/index.js +20 -0
- package/patterns/link-overlay.d.ts +8 -11
- package/patterns/link-overlay.js +25 -0
- package/patterns/runtime.js +25 -0
- package/patterns/spacer.d.ts +9 -9
- package/patterns/spacer.js +25 -0
- package/patterns/square.d.ts +8 -9
- package/patterns/square.js +25 -0
- package/patterns/stack.d.ts +11 -12
- package/patterns/stack.js +30 -0
- package/patterns/visually-hidden.d.ts +8 -11
- package/patterns/visually-hidden.js +19 -0
- package/patterns/vstack.d.ts +9 -10
- package/patterns/vstack.js +27 -0
- package/patterns/wrap.d.ts +12 -13
- package/patterns/wrap.js +26 -0
- package/recipes/accordion.d.ts +10 -26
- package/recipes/accordion.js +5 -0
- package/recipes/action-card.d.ts +9 -26
- package/recipes/action-card.js +5 -0
- package/recipes/alert.d.ts +10 -28
- package/recipes/alert.js +5 -0
- package/recipes/app-navigation-language-select.d.ts +12 -34
- package/recipes/app-navigation-language-select.js +5 -0
- package/recipes/app-navigation.d.ts +10 -28
- package/recipes/app-navigation.js +5 -0
- package/recipes/avatar-group.d.ts +8 -26
- package/recipes/avatar-group.js +5 -0
- package/recipes/avatar.d.ts +11 -30
- package/recipes/avatar.js +5 -0
- package/recipes/breadcrumb.d.ts +9 -24
- package/recipes/breadcrumb.js +5 -0
- package/recipes/button-filter.d.ts +8 -27
- package/recipes/button-filter.js +5 -0
- package/recipes/button.d.ts +10 -37
- package/recipes/button.js +5 -0
- package/recipes/chat-document-message.d.ts +8 -27
- package/recipes/chat-document-message.js +5 -0
- package/recipes/chat-message.d.ts +10 -33
- package/recipes/chat-message.js +5 -0
- package/recipes/chat-profile-avatar.d.ts +9 -29
- package/recipes/chat-profile-avatar.js +5 -0
- package/recipes/chat-text-input.d.ts +8 -27
- package/recipes/chat-text-input.js +5 -0
- package/recipes/chat.d.ts +9 -26
- package/recipes/chat.js +5 -0
- package/recipes/checkbox-card.d.ts +10 -26
- package/recipes/checkbox-card.js +5 -0
- package/recipes/checkbox-group.d.ts +7 -24
- package/recipes/checkbox-group.js +5 -0
- package/recipes/checkbox.d.ts +10 -26
- package/recipes/checkbox.js +5 -0
- package/recipes/chip.d.ts +11 -32
- package/recipes/chip.js +5 -0
- package/recipes/collapsible.d.ts +9 -24
- package/recipes/collapsible.js +5 -0
- package/recipes/combobox.d.ts +11 -27
- package/recipes/combobox.js +5 -0
- package/recipes/datepicker.d.ts +9 -24
- package/recipes/datepicker.js +5 -0
- package/recipes/dialog.d.ts +9 -24
- package/recipes/dialog.js +5 -0
- package/recipes/drawer.d.ts +10 -26
- package/recipes/drawer.js +5 -0
- package/recipes/flag.d.ts +8 -26
- package/recipes/flag.js +5 -0
- package/recipes/form-control.d.ts +8 -27
- package/recipes/form-control.js +5 -0
- package/recipes/form-helper-text.d.ts +8 -27
- package/recipes/form-helper-text.js +5 -0
- package/recipes/form-label.d.ts +10 -28
- package/recipes/form-label.js +5 -0
- package/recipes/heading.d.ts +10 -28
- package/recipes/heading.js +5 -0
- package/recipes/highlighted-input.d.ts +9 -26
- package/recipes/highlighted-input.js +5 -0
- package/recipes/icon-button.d.ts +10 -37
- package/recipes/icon-button.js +5 -0
- package/recipes/icon.d.ts +8 -26
- package/recipes/icon.js +5 -0
- package/recipes/illustration.d.ts +9 -29
- package/recipes/illustration.js +5 -0
- package/recipes/index.d.ts +62 -63
- package/recipes/index.js +62 -0
- package/recipes/input-addon.d.ts +8 -27
- package/recipes/input-addon.js +5 -0
- package/recipes/input-group.d.ts +8 -27
- package/recipes/input-group.js +5 -0
- package/recipes/input.d.ts +9 -29
- package/recipes/input.js +5 -0
- package/recipes/menu.d.ts +10 -26
- package/recipes/menu.js +5 -0
- package/recipes/mobile-navigation.d.ts +10 -28
- package/recipes/mobile-navigation.js +5 -0
- package/recipes/pagination.d.ts +9 -26
- package/recipes/pagination.js +5 -0
- package/recipes/phone-number-input.d.ts +9 -29
- package/recipes/phone-number-input.js +5 -0
- package/recipes/popover.d.ts +9 -24
- package/recipes/popover.js +5 -0
- package/recipes/price-tag.d.ts +10 -26
- package/recipes/price-tag.js +5 -0
- package/recipes/product-card-catalog.d.ts +9 -26
- package/recipes/product-card-catalog.js +5 -0
- package/recipes/radio-button-group.d.ts +10 -26
- package/recipes/radio-button-group.js +5 -0
- package/recipes/radio-card-group.d.ts +10 -26
- package/recipes/radio-card-group.js +5 -0
- package/recipes/radio-group.d.ts +10 -26
- package/recipes/radio-group.js +5 -0
- package/recipes/runtime.js +133 -0
- package/recipes/select-language.d.ts +10 -26
- package/recipes/select-language.js +5 -0
- package/recipes/select.d.ts +11 -27
- package/recipes/select.js +5 -0
- package/recipes/status-tag-select.d.ts +11 -30
- package/recipes/status-tag-select.js +5 -0
- package/recipes/steps.d.ts +9 -24
- package/recipes/steps.js +5 -0
- package/recipes/switch-card.d.ts +10 -26
- package/recipes/switch-card.js +5 -0
- package/recipes/switch-recipe.d.ts +10 -26
- package/recipes/switch-recipe.js +5 -0
- package/recipes/table-container.d.ts +7 -24
- package/recipes/table-container.js +5 -0
- package/recipes/table-empty-row.d.ts +7 -24
- package/recipes/table-empty-row.js +5 -0
- package/recipes/table-group-title.d.ts +8 -26
- package/recipes/table-group-title.js +5 -0
- package/recipes/table.d.ts +9 -24
- package/recipes/table.js +5 -0
- package/recipes/tabs-chip.d.ts +9 -29
- package/recipes/tabs-chip.js +5 -0
- package/recipes/tabs.d.ts +11 -30
- package/recipes/tabs.js +5 -0
- package/recipes/tag.d.ts +11 -32
- package/recipes/tag.js +5 -0
- package/recipes/text.d.ts +12 -30
- package/recipes/text.js +5 -0
- package/recipes/textarea.d.ts +7 -24
- package/recipes/textarea.js +5 -0
- package/recipes/tooltip.d.ts +9 -24
- package/recipes/tooltip.js +5 -0
- package/tokens/index.d.ts +4 -5
- package/tokens/index.js +18 -0
- package/types/index.d.ts +6 -8
- package/types/jsx.d.ts +37 -28
- package/types/pattern.d.ts +18 -70
- package/types/recipe.d.ts +58 -150
- package/types/register.d.ts +40 -0
- package/types/system.d.ts +1816 -0
- package/types/tokens.d.ts +72 -0
- package/css/conditions.mjs +0 -36
- package/css/css.mjs +0 -45
- package/css/cva.mjs +0 -87
- package/css/index.mjs +0 -4
- package/css/sva.mjs +0 -46
- package/helpers.mjs +0 -328
- package/jsx/aspect-ratio.mjs +0 -14
- package/jsx/bleed.mjs +0 -14
- package/jsx/box.mjs +0 -14
- package/jsx/center.mjs +0 -14
- package/jsx/circle.mjs +0 -14
- package/jsx/container.mjs +0 -14
- package/jsx/cq.mjs +0 -14
- package/jsx/create-style-context.d.ts +0 -54
- package/jsx/create-style-context.mjs +0 -118
- package/jsx/divider.mjs +0 -14
- package/jsx/factory-helper.mjs +0 -22
- package/jsx/factory.mjs +0 -89
- package/jsx/flex.mjs +0 -14
- package/jsx/float.mjs +0 -14
- package/jsx/grid-item.mjs +0 -14
- package/jsx/grid.mjs +0 -14
- package/jsx/hstack.mjs +0 -14
- package/jsx/index.mjs +0 -23
- package/jsx/is-valid-prop.mjs +0 -17
- package/jsx/link-overlay.mjs +0 -14
- package/jsx/spacer.mjs +0 -14
- package/jsx/square.mjs +0 -14
- package/jsx/stack.mjs +0 -14
- package/jsx/visually-hidden.mjs +0 -14
- package/jsx/vstack.mjs +0 -14
- package/jsx/wrap.mjs +0 -14
- package/panda.buildinfo.json +0 -471
- package/patterns/aspect-ratio.mjs +0 -38
- package/patterns/bleed.mjs +0 -24
- package/patterns/box.mjs +0 -15
- package/patterns/center.mjs +0 -21
- package/patterns/circle.mjs +0 -25
- package/patterns/container.mjs +0 -21
- package/patterns/cq.mjs +0 -21
- package/patterns/divider.mjs +0 -25
- package/patterns/flex.mjs +0 -26
- package/patterns/float.mjs +0 -52
- package/patterns/grid-item.mjs +0 -25
- package/patterns/grid.mjs +0 -27
- package/patterns/hstack.mjs +0 -24
- package/patterns/index.mjs +0 -20
- package/patterns/link-overlay.mjs +0 -24
- package/patterns/spacer.mjs +0 -25
- package/patterns/square.mjs +0 -24
- package/patterns/stack.mjs +0 -24
- package/patterns/visually-hidden.mjs +0 -18
- package/patterns/vstack.mjs +0 -24
- package/patterns/wrap.mjs +0 -25
- package/recipes/accordion.mjs +0 -57
- package/recipes/action-card.mjs +0 -45
- package/recipes/alert.mjs +0 -57
- package/recipes/app-navigation-language-select.mjs +0 -109
- package/recipes/app-navigation.mjs +0 -84
- package/recipes/avatar-group.mjs +0 -32
- package/recipes/avatar.mjs +0 -57
- package/recipes/breadcrumb.mjs +0 -45
- package/recipes/button-filter.mjs +0 -24
- package/recipes/button.mjs +0 -212
- package/recipes/chat-document-message.mjs +0 -24
- package/recipes/chat-message.mjs +0 -36
- package/recipes/chat-profile-avatar.mjs +0 -31
- package/recipes/chat-text-input.mjs +0 -24
- package/recipes/chat.mjs +0 -45
- package/recipes/checkbox-card.mjs +0 -73
- package/recipes/checkbox-group.mjs +0 -24
- package/recipes/checkbox.mjs +0 -57
- package/recipes/chip.mjs +0 -76
- package/recipes/collapsible.mjs +0 -45
- package/recipes/combobox.mjs +0 -101
- package/recipes/create-recipe.mjs +0 -82
- package/recipes/datepicker.mjs +0 -133
- package/recipes/dialog.mjs +0 -69
- package/recipes/drawer.mjs +0 -78
- package/recipes/flag.mjs +0 -33
- package/recipes/form-control.mjs +0 -24
- package/recipes/form-helper-text.mjs +0 -24
- package/recipes/form-label.mjs +0 -50
- package/recipes/heading.mjs +0 -41
- package/recipes/highlighted-input.mjs +0 -45
- package/recipes/icon-button.mjs +0 -233
- package/recipes/icon.mjs +0 -34
- package/recipes/illustration.mjs +0 -37
- package/recipes/index.mjs +0 -62
- package/recipes/input-addon.mjs +0 -24
- package/recipes/input-group.mjs +0 -24
- package/recipes/input.mjs +0 -30
- package/recipes/menu.mjs +0 -93
- package/recipes/mobile-navigation.mjs +0 -56
- package/recipes/pagination.mjs +0 -41
- package/recipes/phone-number-input.mjs +0 -30
- package/recipes/popover.mjs +0 -69
- package/recipes/price-tag.mjs +0 -51
- package/recipes/product-card-catalog.mjs +0 -73
- package/recipes/radio-button-group.mjs +0 -62
- package/recipes/radio-card-group.mjs +0 -77
- package/recipes/radio-group.mjs +0 -61
- package/recipes/select-language.mjs +0 -98
- package/recipes/select.mjs +0 -101
- package/recipes/status-tag-select.mjs +0 -108
- package/recipes/steps.mjs +0 -69
- package/recipes/switch-card.mjs +0 -69
- package/recipes/switch-recipe.mjs +0 -53
- package/recipes/table-container.mjs +0 -24
- package/recipes/table-empty-row.mjs +0 -24
- package/recipes/table-group-title.mjs +0 -32
- package/recipes/table.mjs +0 -61
- package/recipes/tabs-chip.mjs +0 -35
- package/recipes/tabs.mjs +0 -63
- package/recipes/tag.mjs +0 -57
- package/recipes/text.mjs +0 -41
- package/recipes/textarea.mjs +0 -24
- package/recipes/tooltip.mjs +0 -49
- package/tokens/index.mjs +0 -1728
- package/tokens/tokens.d.ts +0 -63
- package/types/composition.d.ts +0 -227
- package/types/conditions.d.ts +0 -300
- package/types/csstype.d.ts +0 -22570
- package/types/global.d.ts +0 -20
- package/types/parts.d.ts +0 -8
- package/types/prop-type.d.ts +0 -251
- package/types/selectors.d.ts +0 -59
- package/types/static-css.d.ts +0 -56
- package/types/style-props.d.ts +0 -8089
- package/types/system-types.d.ts +0 -151
package/patterns/float.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { TokenValue } from '../types/tokens.js';
|
|
2
|
+
import type { ConditionalValue, SystemProperties, SystemStyleObject } from '../types/system.js';
|
|
7
3
|
|
|
8
4
|
export interface FloatProperties {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
offset?: ConditionalValue<TokenValue<"spacing"> | SystemProperties["top"]>
|
|
6
|
+
offsetX?: ConditionalValue<TokenValue<"spacing"> | SystemProperties["left"]>
|
|
7
|
+
offsetY?: ConditionalValue<TokenValue<"spacing"> | SystemProperties["top"]>
|
|
8
|
+
placement?: ConditionalValue<"bottom-end" | "bottom-start" | "top-end" | "top-start" | "bottom-center" | "top-center" | "middle-center" | "middle-end" | "middle-start">
|
|
13
9
|
}
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
type FloatRestStyles = Omit<SystemStyleObject, keyof FloatProperties>
|
|
12
|
+
|
|
13
|
+
interface FloatStyles extends FloatProperties, FloatRestStyles {}
|
|
16
14
|
|
|
17
15
|
interface FloatPatternFn {
|
|
18
16
|
(styles?: FloatStyles): string
|
|
19
17
|
raw: (styles?: FloatStyles) => SystemStyleObject
|
|
18
|
+
propKeys: Array<keyof FloatProperties>
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
export declare function floatRaw(styles?: FloatStyles): SystemStyleObject;
|
|
22
22
|
|
|
23
|
-
export declare const float: FloatPatternFn;
|
|
23
|
+
export declare const float: FloatPatternFn;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const floatConfig = {
|
|
6
|
+
transform(props, { map }) {
|
|
7
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props;
|
|
8
|
+
return {
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
position: "absolute",
|
|
13
|
+
insetBlockStart: map(placement, (v) => {
|
|
14
|
+
const [side] = v.split("-");
|
|
15
|
+
return {
|
|
16
|
+
top: offsetY,
|
|
17
|
+
middle: "50%",
|
|
18
|
+
bottom: "auto"
|
|
19
|
+
}[side];
|
|
20
|
+
}),
|
|
21
|
+
insetBlockEnd: map(placement, (v) => {
|
|
22
|
+
const [side] = v.split("-");
|
|
23
|
+
return {
|
|
24
|
+
top: "auto",
|
|
25
|
+
middle: "50%",
|
|
26
|
+
bottom: offsetY
|
|
27
|
+
}[side];
|
|
28
|
+
}),
|
|
29
|
+
insetInlineStart: map(placement, (v) => {
|
|
30
|
+
const [, align] = v.split("-");
|
|
31
|
+
return {
|
|
32
|
+
start: offsetX,
|
|
33
|
+
center: "50%",
|
|
34
|
+
end: "auto"
|
|
35
|
+
}[align];
|
|
36
|
+
}),
|
|
37
|
+
insetInlineEnd: map(placement, (v) => {
|
|
38
|
+
const [, align] = v.split("-");
|
|
39
|
+
return {
|
|
40
|
+
start: "auto",
|
|
41
|
+
center: "50%",
|
|
42
|
+
end: offsetX
|
|
43
|
+
}[align];
|
|
44
|
+
}),
|
|
45
|
+
translate: map(placement, (v) => {
|
|
46
|
+
const [side, align] = v.split("-");
|
|
47
|
+
return `${{
|
|
48
|
+
start: "-50%",
|
|
49
|
+
center: "-50%",
|
|
50
|
+
end: "50%"
|
|
51
|
+
}[align]} ${{
|
|
52
|
+
top: "-50%",
|
|
53
|
+
middle: "-50%",
|
|
54
|
+
bottom: "50%"
|
|
55
|
+
}[side]}`;
|
|
56
|
+
}),
|
|
57
|
+
...rest
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
defaultValues(props) {
|
|
61
|
+
const offset = props.offset || "0";
|
|
62
|
+
return {
|
|
63
|
+
offset,
|
|
64
|
+
offsetX: offset,
|
|
65
|
+
offsetY: offset,
|
|
66
|
+
placement: "top-end"
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function floatRaw(styles) {
|
|
72
|
+
const s = getPatternStyles(floatConfig, styles || {})
|
|
73
|
+
return floatConfig.transform(s, patternFns)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const float = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function float(styles = {}) {
|
|
77
|
+
return css(floatRaw(styles))
|
|
78
|
+
}), { raw: floatRaw, propKeys: ["offset","offsetX","offsetY","placement"] })
|
package/patterns/grid-item.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SystemStyleObject, ConditionalValue } from '../types/index';
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { ConditionalValue, SystemStyleObject } from '../types/system.js';
|
|
7
2
|
|
|
8
3
|
export interface GridItemProperties {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
colEnd?: ConditionalValue<number>
|
|
5
|
+
colSpan?: ConditionalValue<number>
|
|
6
|
+
colStart?: ConditionalValue<number>
|
|
7
|
+
rowEnd?: ConditionalValue<number>
|
|
8
|
+
rowSpan?: ConditionalValue<number>
|
|
9
|
+
rowStart?: ConditionalValue<number>
|
|
15
10
|
}
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
type GridItemRestStyles = Omit<SystemStyleObject, keyof GridItemProperties>
|
|
13
|
+
|
|
14
|
+
interface GridItemStyles extends GridItemProperties, GridItemRestStyles {}
|
|
18
15
|
|
|
19
16
|
interface GridItemPatternFn {
|
|
20
17
|
(styles?: GridItemStyles): string
|
|
21
18
|
raw: (styles?: GridItemStyles) => SystemStyleObject
|
|
19
|
+
propKeys: Array<keyof GridItemProperties>
|
|
22
20
|
}
|
|
23
21
|
|
|
22
|
+
export declare function gridItemRaw(styles?: GridItemStyles): SystemStyleObject;
|
|
24
23
|
|
|
25
|
-
export declare const gridItem: GridItemPatternFn;
|
|
24
|
+
export declare const gridItem: GridItemPatternFn;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const gridItemConfig = { 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 function gridItemRaw(styles) {
|
|
20
|
+
const s = getPatternStyles(gridItemConfig, styles || {})
|
|
21
|
+
return gridItemConfig.transform(s, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const gridItem = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function gridItem(styles = {}) {
|
|
25
|
+
return css(gridItemRaw(styles))
|
|
26
|
+
}), { raw: gridItemRaw, propKeys: ["colEnd","colSpan","colStart","rowEnd","rowSpan","rowStart"] })
|
package/patterns/grid.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { TokenValue } from '../types/tokens.js';
|
|
2
|
+
import type { ConditionalValue, SystemProperties, SystemStyleObject } from '../types/system.js';
|
|
7
3
|
|
|
8
4
|
export interface GridProperties {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
columnGap?: SystemProperties["gap"]
|
|
6
|
+
columns?: ConditionalValue<number>
|
|
7
|
+
gap?: SystemProperties["gap"]
|
|
8
|
+
minChildWidth?: ConditionalValue<TokenValue<"sizes"> | SystemProperties["width"]>
|
|
9
|
+
rowGap?: SystemProperties["gap"]
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
type GridRestStyles = Omit<SystemStyleObject, keyof GridProperties>
|
|
13
|
+
|
|
14
|
+
interface GridStyles extends GridProperties, GridRestStyles {}
|
|
17
15
|
|
|
18
16
|
interface GridPatternFn {
|
|
19
17
|
(styles?: GridStyles): string
|
|
20
18
|
raw: (styles?: GridStyles) => SystemStyleObject
|
|
19
|
+
propKeys: Array<keyof GridProperties>
|
|
21
20
|
}
|
|
22
21
|
|
|
22
|
+
export declare function gridRaw(styles?: GridStyles): SystemStyleObject;
|
|
23
23
|
|
|
24
|
-
export declare const grid: GridPatternFn;
|
|
24
|
+
export declare const grid: GridPatternFn;
|
package/patterns/grid.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const gridConfig = {
|
|
6
|
+
transform(props, { map, isCssUnit }) {
|
|
7
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
|
|
8
|
+
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
9
|
+
return {
|
|
10
|
+
display: "grid",
|
|
11
|
+
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,
|
|
12
|
+
gap,
|
|
13
|
+
columnGap,
|
|
14
|
+
rowGap,
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
defaultValues(props) {
|
|
19
|
+
return { gap: props.columnGap || props.rowGap ? void 0 : "8px" };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function gridRaw(styles) {
|
|
24
|
+
const s = getPatternStyles(gridConfig, styles || {})
|
|
25
|
+
return gridConfig.transform(s, patternFns)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const grid = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function grid(styles = {}) {
|
|
29
|
+
return css(gridRaw(styles))
|
|
30
|
+
}), { raw: gridRaw, propKeys: ["columnGap","columns","gap","minChildWidth","rowGap"] })
|
package/patterns/hstack.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SystemStyleObject, ConditionalValue } from '../types/index';
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { SystemProperties, SystemStyleObject } from '../types/system.js';
|
|
7
2
|
|
|
8
3
|
export interface HstackProperties {
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
gap?: SystemProperties["gap"]
|
|
5
|
+
justify?: SystemProperties["justifyContent"]
|
|
11
6
|
}
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
type HstackRestStyles = Omit<SystemStyleObject, keyof HstackProperties>
|
|
9
|
+
|
|
10
|
+
interface HstackStyles extends HstackProperties, HstackRestStyles {}
|
|
14
11
|
|
|
15
12
|
interface HstackPatternFn {
|
|
16
13
|
(styles?: HstackStyles): string
|
|
17
14
|
raw: (styles?: HstackStyles) => SystemStyleObject
|
|
15
|
+
propKeys: Array<keyof HstackProperties>
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
export declare function hstackRaw(styles?: HstackStyles): SystemStyleObject;
|
|
20
19
|
|
|
21
|
-
export declare const hstack: HstackPatternFn;
|
|
20
|
+
export declare const hstack: HstackPatternFn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const hstackConfig = {
|
|
6
|
+
transform(props) {
|
|
7
|
+
const { justify, gap, ...rest } = props;
|
|
8
|
+
return {
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
gap,
|
|
13
|
+
flexDirection: "row",
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues: { gap: "8px" }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function hstackRaw(styles) {
|
|
21
|
+
const s = getPatternStyles(hstackConfig, styles || {})
|
|
22
|
+
return hstackConfig.transform(s, patternFns)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const hstack = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function hstack(styles = {}) {
|
|
26
|
+
return css(hstackRaw(styles))
|
|
27
|
+
}), { raw: hstackRaw, propKeys: ["gap","justify"] })
|
package/patterns/index.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './cq';
|
|
1
|
+
export * from './aspect-ratio.js';
|
|
2
|
+
export * from './bleed.js';
|
|
3
|
+
export * from './box.js';
|
|
4
|
+
export * from './center.js';
|
|
5
|
+
export * from './circle.js';
|
|
6
|
+
export * from './container.js';
|
|
7
|
+
export * from './cq.js';
|
|
8
|
+
export * from './divider.js';
|
|
9
|
+
export * from './flex.js';
|
|
10
|
+
export * from './float.js';
|
|
11
|
+
export * from './grid.js';
|
|
12
|
+
export * from './grid-item.js';
|
|
13
|
+
export * from './hstack.js';
|
|
14
|
+
export * from './link-overlay.js';
|
|
15
|
+
export * from './spacer.js';
|
|
16
|
+
export * from './square.js';
|
|
17
|
+
export * from './stack.js';
|
|
18
|
+
export * from './visually-hidden.js';
|
|
19
|
+
export * from './vstack.js';
|
|
20
|
+
export * from './wrap.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './aspect-ratio.js';
|
|
2
|
+
export * from './bleed.js';
|
|
3
|
+
export * from './box.js';
|
|
4
|
+
export * from './center.js';
|
|
5
|
+
export * from './circle.js';
|
|
6
|
+
export * from './container.js';
|
|
7
|
+
export * from './cq.js';
|
|
8
|
+
export * from './divider.js';
|
|
9
|
+
export * from './flex.js';
|
|
10
|
+
export * from './float.js';
|
|
11
|
+
export * from './grid.js';
|
|
12
|
+
export * from './grid-item.js';
|
|
13
|
+
export * from './hstack.js';
|
|
14
|
+
export * from './link-overlay.js';
|
|
15
|
+
export * from './spacer.js';
|
|
16
|
+
export * from './square.js';
|
|
17
|
+
export * from './stack.js';
|
|
18
|
+
export * from './visually-hidden.js';
|
|
19
|
+
export * from './vstack.js';
|
|
20
|
+
export * from './wrap.js';
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SystemStyleObject, ConditionalValue } from '../types/index';
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { SystemStyleObject } from '../types/system.js';
|
|
7
2
|
|
|
8
|
-
export interface LinkOverlayProperties {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export interface LinkOverlayProperties {}
|
|
4
|
+
|
|
5
|
+
type LinkOverlayRestStyles = Omit<SystemStyleObject, keyof LinkOverlayProperties>
|
|
11
6
|
|
|
12
|
-
interface LinkOverlayStyles extends LinkOverlayProperties,
|
|
7
|
+
interface LinkOverlayStyles extends LinkOverlayProperties, LinkOverlayRestStyles {}
|
|
13
8
|
|
|
14
9
|
interface LinkOverlayPatternFn {
|
|
15
10
|
(styles?: LinkOverlayStyles): string
|
|
16
11
|
raw: (styles?: LinkOverlayStyles) => SystemStyleObject
|
|
12
|
+
propKeys: Array<keyof LinkOverlayProperties>
|
|
17
13
|
}
|
|
18
14
|
|
|
15
|
+
export declare function linkOverlayRaw(styles?: LinkOverlayStyles): SystemStyleObject;
|
|
19
16
|
|
|
20
|
-
export declare const linkOverlay: LinkOverlayPatternFn;
|
|
17
|
+
export declare const linkOverlay: LinkOverlayPatternFn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const linkOverlayConfig = { transform(props) {
|
|
6
|
+
return {
|
|
7
|
+
_before: {
|
|
8
|
+
content: "\"\"",
|
|
9
|
+
position: "absolute",
|
|
10
|
+
inset: "0",
|
|
11
|
+
zIndex: "0",
|
|
12
|
+
...props["_before"]
|
|
13
|
+
},
|
|
14
|
+
...props
|
|
15
|
+
};
|
|
16
|
+
} }
|
|
17
|
+
|
|
18
|
+
export function linkOverlayRaw(styles) {
|
|
19
|
+
const s = getPatternStyles(linkOverlayConfig, styles || {})
|
|
20
|
+
return linkOverlayConfig.transform(s, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const linkOverlay = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function linkOverlay(styles = {}) {
|
|
24
|
+
return css(linkOverlayRaw(styles))
|
|
25
|
+
}), { raw: linkOverlayRaw, propKeys: [] })
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mapObject, withDefaults } from '../helpers.js';
|
|
2
|
+
|
|
3
|
+
const CSS_FUNCTION_REGEX = /^(min|max|clamp|calc)\(.*\)/
|
|
4
|
+
const CSS_VAR_REGEX = /^var\(--.+\)$/
|
|
5
|
+
const CSS_UNIT_REGEX = /^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?(?:cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cqw|cqh|cqi|cqb|cqmin|cqmax|%)$/
|
|
6
|
+
|
|
7
|
+
export function isCssFunction(v) {
|
|
8
|
+
return typeof v === "string" && CSS_FUNCTION_REGEX.test(v)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isCssVar(v) {
|
|
12
|
+
return typeof v === "string" && CSS_VAR_REGEX.test(v)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function isCssUnit(v) {
|
|
16
|
+
return typeof v === "string" && CSS_UNIT_REGEX.test(v)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const patternFns = { map: mapObject, isCssFunction, isCssVar, isCssUnit }
|
|
20
|
+
|
|
21
|
+
export function getPatternStyles(pattern, styles) {
|
|
22
|
+
if (!pattern?.defaultValues) return styles
|
|
23
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues
|
|
24
|
+
return withDefaults(defaults, styles)
|
|
25
|
+
}
|
package/patterns/spacer.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { TokenValue } from '../types/tokens.js';
|
|
2
|
+
import type { ConditionalValue, SystemStyleObject } from '../types/system.js';
|
|
7
3
|
|
|
8
4
|
export interface SpacerProperties {
|
|
9
|
-
|
|
5
|
+
size?: ConditionalValue<TokenValue<"spacing">>
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
type SpacerRestStyles = Omit<SystemStyleObject, keyof SpacerProperties>
|
|
9
|
+
|
|
10
|
+
interface SpacerStyles extends SpacerProperties, SpacerRestStyles {}
|
|
13
11
|
|
|
14
12
|
interface SpacerPatternFn {
|
|
15
13
|
(styles?: SpacerStyles): string
|
|
16
14
|
raw: (styles?: SpacerStyles) => SystemStyleObject
|
|
15
|
+
propKeys: Array<keyof SpacerProperties>
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
export declare function spacerRaw(styles?: SpacerStyles): SystemStyleObject;
|
|
19
19
|
|
|
20
|
-
export declare const spacer: SpacerPatternFn;
|
|
20
|
+
export declare const spacer: SpacerPatternFn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const spacerConfig = { transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { size, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
alignSelf: "stretch",
|
|
9
|
+
justifySelf: "stretch",
|
|
10
|
+
flex: map(size, (v) => {
|
|
11
|
+
if (v == null) return "1";
|
|
12
|
+
return `0 0 ${isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`}`;
|
|
13
|
+
}),
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
} }
|
|
17
|
+
|
|
18
|
+
export function spacerRaw(styles) {
|
|
19
|
+
const s = getPatternStyles(spacerConfig, styles || {})
|
|
20
|
+
return spacerConfig.transform(s, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const spacer = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function spacer(styles = {}) {
|
|
24
|
+
return css(spacerRaw(styles))
|
|
25
|
+
}), { raw: spacerRaw, propKeys: ["size"] })
|
package/patterns/square.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SystemStyleObject, ConditionalValue } from '../types/index';
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { SystemProperties, SystemStyleObject } from '../types/system.js';
|
|
7
2
|
|
|
8
3
|
export interface SquareProperties {
|
|
9
|
-
|
|
4
|
+
size?: SystemProperties["width"]
|
|
10
5
|
}
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
type SquareRestStyles = Omit<SystemStyleObject, keyof SquareProperties>
|
|
8
|
+
|
|
9
|
+
interface SquareStyles extends SquareProperties, SquareRestStyles {}
|
|
13
10
|
|
|
14
11
|
interface SquarePatternFn {
|
|
15
12
|
(styles?: SquareStyles): string
|
|
16
13
|
raw: (styles?: SquareStyles) => SystemStyleObject
|
|
14
|
+
propKeys: Array<keyof SquareProperties>
|
|
17
15
|
}
|
|
18
16
|
|
|
17
|
+
export declare function squareRaw(styles?: SquareStyles): SystemStyleObject;
|
|
19
18
|
|
|
20
|
-
export declare const square: SquarePatternFn;
|
|
19
|
+
export declare const square: SquarePatternFn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const squareConfig = { 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
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
} }
|
|
17
|
+
|
|
18
|
+
export function squareRaw(styles) {
|
|
19
|
+
const s = getPatternStyles(squareConfig, styles || {})
|
|
20
|
+
return squareConfig.transform(s, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const square = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function square(styles = {}) {
|
|
24
|
+
return css(squareRaw(styles))
|
|
25
|
+
}), { raw: squareRaw, propKeys: ["size"] })
|
package/patterns/stack.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SystemStyleObject, ConditionalValue } from '../types/index';
|
|
3
|
-
import type { Properties } from '../types/csstype';
|
|
4
|
-
import type { SystemProperties } from '../types/style-props';
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types';
|
|
6
|
-
import type { Tokens } from '../tokens/index';
|
|
1
|
+
import type { SystemProperties, SystemStyleObject } from '../types/system.js';
|
|
7
2
|
|
|
8
3
|
export interface StackProperties {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
align?: SystemProperties["alignItems"]
|
|
5
|
+
direction?: SystemProperties["flexDirection"]
|
|
6
|
+
gap?: SystemProperties["gap"]
|
|
7
|
+
justify?: SystemProperties["justifyContent"]
|
|
13
8
|
}
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
type StackRestStyles = Omit<SystemStyleObject, keyof StackProperties>
|
|
11
|
+
|
|
12
|
+
interface StackStyles extends StackProperties, StackRestStyles {}
|
|
16
13
|
|
|
17
14
|
interface StackPatternFn {
|
|
18
15
|
(styles?: StackStyles): string
|
|
19
16
|
raw: (styles?: StackStyles) => SystemStyleObject
|
|
17
|
+
propKeys: Array<keyof StackProperties>
|
|
20
18
|
}
|
|
21
19
|
|
|
20
|
+
export declare function stackRaw(styles?: StackStyles): SystemStyleObject;
|
|
22
21
|
|
|
23
|
-
export declare const stack: StackPatternFn;
|
|
22
|
+
export declare const stack: StackPatternFn;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime.js';
|
|
2
|
+
import { memo } from '../helpers.js';
|
|
3
|
+
import { css } from '../css/index.js';
|
|
4
|
+
|
|
5
|
+
const stackConfig = {
|
|
6
|
+
transform(props) {
|
|
7
|
+
const { align, justify, direction, gap, ...rest } = props;
|
|
8
|
+
return {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: direction,
|
|
11
|
+
alignItems: align,
|
|
12
|
+
justifyContent: justify,
|
|
13
|
+
gap,
|
|
14
|
+
...rest
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
defaultValues: {
|
|
18
|
+
direction: "column",
|
|
19
|
+
gap: "8px"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function stackRaw(styles) {
|
|
24
|
+
const s = getPatternStyles(stackConfig, styles || {})
|
|
25
|
+
return stackConfig.transform(s, patternFns)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const stack = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function stack(styles = {}) {
|
|
29
|
+
return css(stackRaw(styles))
|
|
30
|
+
}), { raw: stackRaw, propKeys: ["align","direction","gap","justify"] })
|