@stokelp/styled-system 1.0.1
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.mjs +34 -0
- package/css/css.d.ts +9 -0
- package/css/css.mjs +45 -0
- package/css/cva.d.ts +6 -0
- package/css/cva.mjs +87 -0
- package/css/cx.d.ts +5 -0
- package/css/cx.mjs +15 -0
- package/css/index.d.ts +5 -0
- package/css/index.mjs +4 -0
- package/css/sva.d.ts +4 -0
- package/css/sva.mjs +41 -0
- package/jsx/aspect-ratio.d.ts +10 -0
- package/jsx/aspect-ratio.mjs +14 -0
- package/jsx/bleed.d.ts +10 -0
- package/jsx/bleed.mjs +14 -0
- package/jsx/box.d.ts +10 -0
- package/jsx/box.mjs +14 -0
- package/jsx/center.d.ts +10 -0
- package/jsx/center.mjs +14 -0
- package/jsx/circle.d.ts +10 -0
- package/jsx/circle.mjs +14 -0
- package/jsx/container.d.ts +10 -0
- package/jsx/container.mjs +14 -0
- package/jsx/cq.d.ts +10 -0
- package/jsx/cq.mjs +14 -0
- package/jsx/divider.d.ts +10 -0
- package/jsx/divider.mjs +14 -0
- package/jsx/factory-helper.mjs +22 -0
- package/jsx/factory.d.ts +3 -0
- package/jsx/factory.mjs +80 -0
- package/jsx/flex.d.ts +10 -0
- package/jsx/flex.mjs +14 -0
- package/jsx/float.d.ts +10 -0
- package/jsx/float.mjs +14 -0
- package/jsx/grid-item.d.ts +10 -0
- package/jsx/grid-item.mjs +14 -0
- package/jsx/grid.d.ts +10 -0
- package/jsx/grid.mjs +14 -0
- package/jsx/hstack.d.ts +10 -0
- package/jsx/hstack.mjs +14 -0
- package/jsx/index.d.ts +25 -0
- package/jsx/index.mjs +23 -0
- package/jsx/is-valid-prop.d.ts +11 -0
- package/jsx/is-valid-prop.mjs +17 -0
- package/jsx/link-box.d.ts +10 -0
- package/jsx/link-box.mjs +14 -0
- package/jsx/link-overlay.d.ts +10 -0
- package/jsx/link-overlay.mjs +14 -0
- package/jsx/spacer.d.ts +10 -0
- package/jsx/spacer.mjs +14 -0
- package/jsx/square.d.ts +10 -0
- package/jsx/square.mjs +14 -0
- package/jsx/stack.d.ts +10 -0
- package/jsx/stack.mjs +14 -0
- package/jsx/visually-hidden.d.ts +10 -0
- package/jsx/visually-hidden.mjs +14 -0
- package/jsx/vstack.d.ts +10 -0
- package/jsx/vstack.mjs +14 -0
- package/jsx/wrap.d.ts +10 -0
- package/jsx/wrap.mjs +14 -0
- package/package.json +56 -0
- package/panda.buildinfo.json +75 -0
- package/patterns/aspect-ratio.d.ts +21 -0
- package/patterns/aspect-ratio.mjs +38 -0
- package/patterns/bleed.d.ts +22 -0
- package/patterns/bleed.mjs +24 -0
- package/patterns/box.d.ts +21 -0
- package/patterns/box.mjs +15 -0
- package/patterns/center.d.ts +21 -0
- package/patterns/center.mjs +21 -0
- package/patterns/circle.d.ts +21 -0
- package/patterns/circle.mjs +25 -0
- package/patterns/container.d.ts +21 -0
- package/patterns/container.mjs +21 -0
- package/patterns/cq.d.ts +22 -0
- package/patterns/cq.mjs +21 -0
- package/patterns/divider.d.ts +23 -0
- package/patterns/divider.mjs +25 -0
- package/patterns/flex.d.ts +27 -0
- package/patterns/flex.mjs +26 -0
- package/patterns/float.d.ts +24 -0
- package/patterns/float.mjs +52 -0
- package/patterns/grid-item.d.ts +26 -0
- package/patterns/grid-item.mjs +25 -0
- package/patterns/grid.d.ts +25 -0
- package/patterns/grid.mjs +27 -0
- package/patterns/hstack.d.ts +22 -0
- package/patterns/hstack.mjs +24 -0
- package/patterns/index.d.ts +22 -0
- package/patterns/index.mjs +21 -0
- package/patterns/link-box.d.ts +21 -0
- package/patterns/link-box.mjs +22 -0
- package/patterns/link-overlay.d.ts +21 -0
- package/patterns/link-overlay.mjs +27 -0
- package/patterns/spacer.d.ts +21 -0
- package/patterns/spacer.mjs +21 -0
- package/patterns/square.d.ts +21 -0
- package/patterns/square.mjs +24 -0
- package/patterns/stack.d.ts +24 -0
- package/patterns/stack.mjs +24 -0
- package/patterns/visually-hidden.d.ts +21 -0
- package/patterns/visually-hidden.mjs +18 -0
- package/patterns/vstack.d.ts +22 -0
- package/patterns/vstack.mjs +24 -0
- package/patterns/wrap.d.ts +25 -0
- package/patterns/wrap.mjs +25 -0
- package/recipes/accordion.d.ts +28 -0
- package/recipes/accordion.mjs +56 -0
- package/recipes/button.d.ts +30 -0
- package/recipes/button.mjs +116 -0
- package/recipes/checkbox.d.ts +28 -0
- package/recipes/checkbox.mjs +52 -0
- package/recipes/create-recipe.mjs +82 -0
- package/recipes/drawer.d.ts +28 -0
- package/recipes/drawer.mjs +77 -0
- package/recipes/form-control.d.ts +28 -0
- package/recipes/form-control.mjs +24 -0
- package/recipes/form-helper-text.d.ts +28 -0
- package/recipes/form-helper-text.mjs +24 -0
- package/recipes/form-label.d.ts +28 -0
- package/recipes/form-label.mjs +36 -0
- package/recipes/heading.d.ts +30 -0
- package/recipes/heading.mjs +41 -0
- package/recipes/index.d.ts +12 -0
- package/recipes/index.mjs +11 -0
- package/recipes/switch-recipe.d.ts +28 -0
- package/recipes/switch-recipe.mjs +52 -0
- package/recipes/text.d.ts +31 -0
- package/recipes/text.mjs +41 -0
- package/recipes/textarea.d.ts +28 -0
- package/recipes/textarea.mjs +24 -0
- package/tokens/index.d.ts +9 -0
- package/tokens/index.mjs +1496 -0
- package/tokens/tokens.d.ts +63 -0
- package/types/composition.d.ts +111 -0
- package/types/conditions.d.ts +270 -0
- package/types/csstype.d.ts +21298 -0
- package/types/global.d.ts +19 -0
- package/types/index.d.ts +8 -0
- package/types/jsx.d.ts +52 -0
- package/types/parts.d.ts +8 -0
- package/types/pattern.d.ts +74 -0
- package/types/prop-type.d.ts +242 -0
- package/types/recipe.d.ts +173 -0
- package/types/selectors.d.ts +59 -0
- package/types/static-css.d.ts +51 -0
- package/types/style-props.d.ts +7468 -0
- package/types/system-types.d.ts +89 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { finalizeConditions, sortConditions } from '../css/conditions.mjs';
|
|
2
|
+
import { css } from '../css/css.mjs';
|
|
3
|
+
import { assertCompoundVariant, getCompoundVariantCss } from '../css/cva.mjs';
|
|
4
|
+
import { cx } from '../css/cx.mjs';
|
|
5
|
+
import { compact, createCss, splitProps, uniq, withoutSpace } from '../helpers.mjs';
|
|
6
|
+
|
|
7
|
+
export const createRecipe = (name, defaultVariants, compoundVariants) => {
|
|
8
|
+
const getVariantProps = (variants) => {
|
|
9
|
+
return {
|
|
10
|
+
[name]: '__ignore__',
|
|
11
|
+
...defaultVariants,
|
|
12
|
+
...compact(variants),
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const recipeFn = (variants, withCompoundVariants = true) => {
|
|
17
|
+
const transform = (prop, value) => {
|
|
18
|
+
assertCompoundVariant(name, compoundVariants, variants, prop)
|
|
19
|
+
|
|
20
|
+
if (value === '__ignore__') {
|
|
21
|
+
return { className: name }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
value = withoutSpace(value)
|
|
25
|
+
return { className: `${name}--${prop}_${value}` }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const recipeCss = createCss({
|
|
29
|
+
|
|
30
|
+
conditions: {
|
|
31
|
+
shift: sortConditions,
|
|
32
|
+
finalize: finalizeConditions,
|
|
33
|
+
breakpoints: { keys: ["base","sm","md","lg","xl"] }
|
|
34
|
+
},
|
|
35
|
+
utility: {
|
|
36
|
+
|
|
37
|
+
toHash: (path, hashFn) => hashFn(path.join(":")),
|
|
38
|
+
transform,
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const recipeStyles = getVariantProps(variants)
|
|
43
|
+
|
|
44
|
+
if (withCompoundVariants) {
|
|
45
|
+
const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
|
|
46
|
+
return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return recipeCss(recipeStyles)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
recipeFn,
|
|
54
|
+
getVariantProps,
|
|
55
|
+
__getCompoundVariantCss__: (variants) => {
|
|
56
|
+
return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const mergeRecipes = (recipeA, recipeB) => {
|
|
62
|
+
if (recipeA && !recipeB) return recipeA
|
|
63
|
+
if (!recipeA && recipeB) return recipeB
|
|
64
|
+
|
|
65
|
+
const recipeFn = (...args) => cx(recipeA(...args), recipeB(...args))
|
|
66
|
+
const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys)
|
|
67
|
+
const variantMap = variantKeys.reduce((acc, key) => {
|
|
68
|
+
acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
|
|
69
|
+
return acc
|
|
70
|
+
}, {})
|
|
71
|
+
|
|
72
|
+
return Object.assign(recipeFn, {
|
|
73
|
+
__recipe__: true,
|
|
74
|
+
__name__: `${recipeA.__name__} ${recipeB.__name__}`,
|
|
75
|
+
raw: (props) => props,
|
|
76
|
+
variantKeys,
|
|
77
|
+
variantMap,
|
|
78
|
+
splitVariantProps(props) {
|
|
79
|
+
return splitProps(props, variantKeys)
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface DrawerVariant {
|
|
6
|
+
variant: "left" | "right"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type DrawerVariantMap = {
|
|
10
|
+
[key in keyof DrawerVariant]: Array<DrawerVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type DrawerVariantProps = {
|
|
14
|
+
[key in keyof DrawerVariant]?: ConditionalValue<DrawerVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DrawerRecipe {
|
|
18
|
+
__type: DrawerVariantProps
|
|
19
|
+
(props?: DrawerVariantProps): Pretty<Record<"trigger" | "backdrop" | "positioner" | "content" | "title" | "description" | "closeTrigger" | "header" | "body" | "footer", string>>
|
|
20
|
+
raw: (props?: DrawerVariantProps) => DrawerVariantProps
|
|
21
|
+
variantMap: DrawerVariantMap
|
|
22
|
+
variantKeys: Array<keyof DrawerVariant>
|
|
23
|
+
splitVariantProps<Props extends DrawerVariantProps>(props: Props): [DrawerVariantProps, Pretty<DistributiveOmit<Props, keyof DrawerVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: DrawerVariantProps) => DrawerVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export declare const drawer: DrawerRecipe
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const drawerDefaultVariants = {
|
|
5
|
+
"variant": "right"
|
|
6
|
+
}
|
|
7
|
+
const drawerCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const drawerSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"trigger",
|
|
12
|
+
"drawer__trigger"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"backdrop",
|
|
16
|
+
"drawer__backdrop"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"positioner",
|
|
20
|
+
"drawer__positioner"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"content",
|
|
24
|
+
"drawer__content"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"title",
|
|
28
|
+
"drawer__title"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"description",
|
|
32
|
+
"drawer__description"
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"closeTrigger",
|
|
36
|
+
"drawer__closeTrigger"
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"header",
|
|
40
|
+
"drawer__header"
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"body",
|
|
44
|
+
"drawer__body"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"footer",
|
|
48
|
+
"drawer__footer"
|
|
49
|
+
]
|
|
50
|
+
]
|
|
51
|
+
const drawerSlotFns = /* @__PURE__ */ drawerSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, drawerDefaultVariants, getSlotCompoundVariant(drawerCompoundVariants, slotName))])
|
|
52
|
+
|
|
53
|
+
const drawerFn = memo((props = {}) => {
|
|
54
|
+
return Object.fromEntries(drawerSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const drawerVariantKeys = [
|
|
58
|
+
"variant"
|
|
59
|
+
]
|
|
60
|
+
const getVariantProps = (variants) => ({ ...drawerDefaultVariants, ...compact(variants) })
|
|
61
|
+
|
|
62
|
+
export const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
63
|
+
__recipe__: false,
|
|
64
|
+
__name__: 'drawer',
|
|
65
|
+
raw: (props) => props,
|
|
66
|
+
variantKeys: drawerVariantKeys,
|
|
67
|
+
variantMap: {
|
|
68
|
+
"variant": [
|
|
69
|
+
"left",
|
|
70
|
+
"right"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
splitVariantProps(props) {
|
|
74
|
+
return splitProps(props, drawerVariantKeys)
|
|
75
|
+
},
|
|
76
|
+
getVariantProps
|
|
77
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface FormControlVariant {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type FormControlVariantMap = {
|
|
10
|
+
[key in keyof FormControlVariant]: Array<FormControlVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type FormControlVariantProps = {
|
|
14
|
+
[key in keyof FormControlVariant]?: ConditionalValue<FormControlVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FormControlRecipe {
|
|
18
|
+
__type: FormControlVariantProps
|
|
19
|
+
(props?: FormControlVariantProps): string
|
|
20
|
+
raw: (props?: FormControlVariantProps) => FormControlVariantProps
|
|
21
|
+
variantMap: FormControlVariantMap
|
|
22
|
+
variantKeys: Array<keyof FormControlVariant>
|
|
23
|
+
splitVariantProps<Props extends FormControlVariantProps>(props: Props): [FormControlVariantProps, Pretty<DistributiveOmit<Props, keyof FormControlVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: FormControlVariantProps) => FormControlVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The styles for the FormControl component */
|
|
28
|
+
export declare const formControl: FormControlRecipe
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const formControlFn = /* @__PURE__ */ createRecipe('form-control', {}, [])
|
|
5
|
+
|
|
6
|
+
const formControlVariantMap = {}
|
|
7
|
+
|
|
8
|
+
const formControlVariantKeys = Object.keys(formControlVariantMap)
|
|
9
|
+
|
|
10
|
+
export const formControl = /* @__PURE__ */ Object.assign(memo(formControlFn.recipeFn), {
|
|
11
|
+
__recipe__: true,
|
|
12
|
+
__name__: 'formControl',
|
|
13
|
+
__getCompoundVariantCss__: formControlFn.__getCompoundVariantCss__,
|
|
14
|
+
raw: (props) => props,
|
|
15
|
+
variantKeys: formControlVariantKeys,
|
|
16
|
+
variantMap: formControlVariantMap,
|
|
17
|
+
merge(recipe) {
|
|
18
|
+
return mergeRecipes(this, recipe)
|
|
19
|
+
},
|
|
20
|
+
splitVariantProps(props) {
|
|
21
|
+
return splitProps(props, formControlVariantKeys)
|
|
22
|
+
},
|
|
23
|
+
getVariantProps: formControlFn.getVariantProps,
|
|
24
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface FormHelperTextVariant {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type FormHelperTextVariantMap = {
|
|
10
|
+
[key in keyof FormHelperTextVariant]: Array<FormHelperTextVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type FormHelperTextVariantProps = {
|
|
14
|
+
[key in keyof FormHelperTextVariant]?: ConditionalValue<FormHelperTextVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FormHelperTextRecipe {
|
|
18
|
+
__type: FormHelperTextVariantProps
|
|
19
|
+
(props?: FormHelperTextVariantProps): string
|
|
20
|
+
raw: (props?: FormHelperTextVariantProps) => FormHelperTextVariantProps
|
|
21
|
+
variantMap: FormHelperTextVariantMap
|
|
22
|
+
variantKeys: Array<keyof FormHelperTextVariant>
|
|
23
|
+
splitVariantProps<Props extends FormHelperTextVariantProps>(props: Props): [FormHelperTextVariantProps, Pretty<DistributiveOmit<Props, keyof FormHelperTextVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: FormHelperTextVariantProps) => FormHelperTextVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The styles for the FormHelperText component */
|
|
28
|
+
export declare const formHelperText: FormHelperTextRecipe
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const formHelperTextFn = /* @__PURE__ */ createRecipe('form-helper-text', {}, [])
|
|
5
|
+
|
|
6
|
+
const formHelperTextVariantMap = {}
|
|
7
|
+
|
|
8
|
+
const formHelperTextVariantKeys = Object.keys(formHelperTextVariantMap)
|
|
9
|
+
|
|
10
|
+
export const formHelperText = /* @__PURE__ */ Object.assign(memo(formHelperTextFn.recipeFn), {
|
|
11
|
+
__recipe__: true,
|
|
12
|
+
__name__: 'formHelperText',
|
|
13
|
+
__getCompoundVariantCss__: formHelperTextFn.__getCompoundVariantCss__,
|
|
14
|
+
raw: (props) => props,
|
|
15
|
+
variantKeys: formHelperTextVariantKeys,
|
|
16
|
+
variantMap: formHelperTextVariantMap,
|
|
17
|
+
merge(recipe) {
|
|
18
|
+
return mergeRecipes(this, recipe)
|
|
19
|
+
},
|
|
20
|
+
splitVariantProps(props) {
|
|
21
|
+
return splitProps(props, formHelperTextVariantKeys)
|
|
22
|
+
},
|
|
23
|
+
getVariantProps: formHelperTextFn.getVariantProps,
|
|
24
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface FormLabelVariant {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type FormLabelVariantMap = {
|
|
10
|
+
[key in keyof FormLabelVariant]: Array<FormLabelVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type FormLabelVariantProps = {
|
|
14
|
+
[key in keyof FormLabelVariant]?: ConditionalValue<FormLabelVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FormLabelRecipe {
|
|
18
|
+
__type: FormLabelVariantProps
|
|
19
|
+
(props?: FormLabelVariantProps): Pretty<Record<"root" | "addon", string>>
|
|
20
|
+
raw: (props?: FormLabelVariantProps) => FormLabelVariantProps
|
|
21
|
+
variantMap: FormLabelVariantMap
|
|
22
|
+
variantKeys: Array<keyof FormLabelVariant>
|
|
23
|
+
splitVariantProps<Props extends FormLabelVariantProps>(props: Props): [FormLabelVariantProps, Pretty<DistributiveOmit<Props, keyof FormLabelVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: FormLabelVariantProps) => FormLabelVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The styles for the FormLabel component */
|
|
28
|
+
export declare const formLabel: FormLabelRecipe
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const formLabelDefaultVariants = {}
|
|
5
|
+
const formLabelCompoundVariants = []
|
|
6
|
+
|
|
7
|
+
const formLabelSlotNames = [
|
|
8
|
+
[
|
|
9
|
+
"root",
|
|
10
|
+
"form-label__root"
|
|
11
|
+
],
|
|
12
|
+
[
|
|
13
|
+
"addon",
|
|
14
|
+
"form-label__addon"
|
|
15
|
+
]
|
|
16
|
+
]
|
|
17
|
+
const formLabelSlotFns = /* @__PURE__ */ formLabelSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, formLabelDefaultVariants, getSlotCompoundVariant(formLabelCompoundVariants, slotName))])
|
|
18
|
+
|
|
19
|
+
const formLabelFn = memo((props = {}) => {
|
|
20
|
+
return Object.fromEntries(formLabelSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const formLabelVariantKeys = []
|
|
24
|
+
const getVariantProps = (variants) => ({ ...formLabelDefaultVariants, ...compact(variants) })
|
|
25
|
+
|
|
26
|
+
export const formLabel = /* @__PURE__ */ Object.assign(formLabelFn, {
|
|
27
|
+
__recipe__: false,
|
|
28
|
+
__name__: 'formLabel',
|
|
29
|
+
raw: (props) => props,
|
|
30
|
+
variantKeys: formLabelVariantKeys,
|
|
31
|
+
variantMap: {},
|
|
32
|
+
splitVariantProps(props) {
|
|
33
|
+
return splitProps(props, formLabelVariantKeys)
|
|
34
|
+
},
|
|
35
|
+
getVariantProps
|
|
36
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface HeadingVariant {
|
|
6
|
+
italic: boolean
|
|
7
|
+
underline: boolean
|
|
8
|
+
size: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type HeadingVariantMap = {
|
|
12
|
+
[key in keyof HeadingVariant]: Array<HeadingVariant[key]>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type HeadingVariantProps = {
|
|
16
|
+
[key in keyof HeadingVariant]?: ConditionalValue<HeadingVariant[key]> | undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface HeadingRecipe {
|
|
20
|
+
__type: HeadingVariantProps
|
|
21
|
+
(props?: HeadingVariantProps): string
|
|
22
|
+
raw: (props?: HeadingVariantProps) => HeadingVariantProps
|
|
23
|
+
variantMap: HeadingVariantMap
|
|
24
|
+
variantKeys: Array<keyof HeadingVariant>
|
|
25
|
+
splitVariantProps<Props extends HeadingVariantProps>(props: Props): [HeadingVariantProps, Pretty<DistributiveOmit<Props, keyof HeadingVariantProps>>]
|
|
26
|
+
getVariantProps: (props?: HeadingVariantProps) => HeadingVariantProps
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export declare const heading: HeadingRecipe
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const headingFn = /* @__PURE__ */ createRecipe('heading', {
|
|
5
|
+
"size": "h2"
|
|
6
|
+
}, [])
|
|
7
|
+
|
|
8
|
+
const headingVariantMap = {
|
|
9
|
+
"italic": [
|
|
10
|
+
"true"
|
|
11
|
+
],
|
|
12
|
+
"underline": [
|
|
13
|
+
"true"
|
|
14
|
+
],
|
|
15
|
+
"size": [
|
|
16
|
+
"h1",
|
|
17
|
+
"h2",
|
|
18
|
+
"h3",
|
|
19
|
+
"h4",
|
|
20
|
+
"h5",
|
|
21
|
+
"h6"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const headingVariantKeys = Object.keys(headingVariantMap)
|
|
26
|
+
|
|
27
|
+
export const heading = /* @__PURE__ */ Object.assign(memo(headingFn.recipeFn), {
|
|
28
|
+
__recipe__: true,
|
|
29
|
+
__name__: 'heading',
|
|
30
|
+
__getCompoundVariantCss__: headingFn.__getCompoundVariantCss__,
|
|
31
|
+
raw: (props) => props,
|
|
32
|
+
variantKeys: headingVariantKeys,
|
|
33
|
+
variantMap: headingVariantMap,
|
|
34
|
+
merge(recipe) {
|
|
35
|
+
return mergeRecipes(this, recipe)
|
|
36
|
+
},
|
|
37
|
+
splitVariantProps(props) {
|
|
38
|
+
return splitProps(props, headingVariantKeys)
|
|
39
|
+
},
|
|
40
|
+
getVariantProps: headingFn.getVariantProps,
|
|
41
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export * from './button';
|
|
3
|
+
export * from './heading';
|
|
4
|
+
export * from './switch-recipe';
|
|
5
|
+
export * from './text';
|
|
6
|
+
export * from './textarea';
|
|
7
|
+
export * from './form-control';
|
|
8
|
+
export * from './form-helper-text';
|
|
9
|
+
export * from './drawer';
|
|
10
|
+
export * from './accordion';
|
|
11
|
+
export * from './form-label';
|
|
12
|
+
export * from './checkbox';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './button.mjs';
|
|
2
|
+
export * from './heading.mjs';
|
|
3
|
+
export * from './switch-recipe.mjs';
|
|
4
|
+
export * from './text.mjs';
|
|
5
|
+
export * from './textarea.mjs';
|
|
6
|
+
export * from './form-control.mjs';
|
|
7
|
+
export * from './form-helper-text.mjs';
|
|
8
|
+
export * from './drawer.mjs';
|
|
9
|
+
export * from './accordion.mjs';
|
|
10
|
+
export * from './form-label.mjs';
|
|
11
|
+
export * from './checkbox.mjs';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface SwitchRecipeVariant {
|
|
6
|
+
size: "md"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type SwitchRecipeVariantMap = {
|
|
10
|
+
[key in keyof SwitchRecipeVariant]: Array<SwitchRecipeVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type SwitchRecipeVariantProps = {
|
|
14
|
+
[key in keyof SwitchRecipeVariant]?: ConditionalValue<SwitchRecipeVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SwitchRecipeRecipe {
|
|
18
|
+
__type: SwitchRecipeVariantProps
|
|
19
|
+
(props?: SwitchRecipeVariantProps): Pretty<Record<"root" | "label" | "control" | "thumb", string>>
|
|
20
|
+
raw: (props?: SwitchRecipeVariantProps) => SwitchRecipeVariantProps
|
|
21
|
+
variantMap: SwitchRecipeVariantMap
|
|
22
|
+
variantKeys: Array<keyof SwitchRecipeVariant>
|
|
23
|
+
splitVariantProps<Props extends SwitchRecipeVariantProps>(props: Props): [SwitchRecipeVariantProps, Pretty<DistributiveOmit<Props, keyof SwitchRecipeVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: SwitchRecipeVariantProps) => SwitchRecipeVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export declare const switchRecipe: SwitchRecipeRecipe
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const switchRecipeDefaultVariants = {
|
|
5
|
+
"size": "md"
|
|
6
|
+
}
|
|
7
|
+
const switchRecipeCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const switchRecipeSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"root",
|
|
12
|
+
"switch__root"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"label",
|
|
16
|
+
"switch__label"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"control",
|
|
20
|
+
"switch__control"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"thumb",
|
|
24
|
+
"switch__thumb"
|
|
25
|
+
]
|
|
26
|
+
]
|
|
27
|
+
const switchRecipeSlotFns = /* @__PURE__ */ switchRecipeSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, switchRecipeDefaultVariants, getSlotCompoundVariant(switchRecipeCompoundVariants, slotName))])
|
|
28
|
+
|
|
29
|
+
const switchRecipeFn = memo((props = {}) => {
|
|
30
|
+
return Object.fromEntries(switchRecipeSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const switchRecipeVariantKeys = [
|
|
34
|
+
"size"
|
|
35
|
+
]
|
|
36
|
+
const getVariantProps = (variants) => ({ ...switchRecipeDefaultVariants, ...compact(variants) })
|
|
37
|
+
|
|
38
|
+
export const switchRecipe = /* @__PURE__ */ Object.assign(switchRecipeFn, {
|
|
39
|
+
__recipe__: false,
|
|
40
|
+
__name__: 'switchRecipe',
|
|
41
|
+
raw: (props) => props,
|
|
42
|
+
variantKeys: switchRecipeVariantKeys,
|
|
43
|
+
variantMap: {
|
|
44
|
+
"size": [
|
|
45
|
+
"md"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
splitVariantProps(props) {
|
|
49
|
+
return splitProps(props, switchRecipeVariantKeys)
|
|
50
|
+
},
|
|
51
|
+
getVariantProps
|
|
52
|
+
})
|
|
@@ -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 TextVariant {
|
|
6
|
+
bold: boolean
|
|
7
|
+
italic: boolean
|
|
8
|
+
underline: boolean
|
|
9
|
+
size: "lg" | "md" | "sm"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type TextVariantMap = {
|
|
13
|
+
[key in keyof TextVariant]: Array<TextVariant[key]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TextVariantProps = {
|
|
17
|
+
[key in keyof TextVariant]?: ConditionalValue<TextVariant[key]> | undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TextRecipe {
|
|
21
|
+
__type: TextVariantProps
|
|
22
|
+
(props?: TextVariantProps): string
|
|
23
|
+
raw: (props?: TextVariantProps) => TextVariantProps
|
|
24
|
+
variantMap: TextVariantMap
|
|
25
|
+
variantKeys: Array<keyof TextVariant>
|
|
26
|
+
splitVariantProps<Props extends TextVariantProps>(props: Props): [TextVariantProps, Pretty<DistributiveOmit<Props, keyof TextVariantProps>>]
|
|
27
|
+
getVariantProps: (props?: TextVariantProps) => TextVariantProps
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export declare const text: TextRecipe
|
package/recipes/text.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const textFn = /* @__PURE__ */ createRecipe('text', {
|
|
5
|
+
"size": "md"
|
|
6
|
+
}, [])
|
|
7
|
+
|
|
8
|
+
const textVariantMap = {
|
|
9
|
+
"bold": [
|
|
10
|
+
"true"
|
|
11
|
+
],
|
|
12
|
+
"italic": [
|
|
13
|
+
"true"
|
|
14
|
+
],
|
|
15
|
+
"underline": [
|
|
16
|
+
"true"
|
|
17
|
+
],
|
|
18
|
+
"size": [
|
|
19
|
+
"lg",
|
|
20
|
+
"md",
|
|
21
|
+
"sm"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const textVariantKeys = Object.keys(textVariantMap)
|
|
26
|
+
|
|
27
|
+
export const text = /* @__PURE__ */ Object.assign(memo(textFn.recipeFn), {
|
|
28
|
+
__recipe__: true,
|
|
29
|
+
__name__: 'text',
|
|
30
|
+
__getCompoundVariantCss__: textFn.__getCompoundVariantCss__,
|
|
31
|
+
raw: (props) => props,
|
|
32
|
+
variantKeys: textVariantKeys,
|
|
33
|
+
variantMap: textVariantMap,
|
|
34
|
+
merge(recipe) {
|
|
35
|
+
return mergeRecipes(this, recipe)
|
|
36
|
+
},
|
|
37
|
+
splitVariantProps(props) {
|
|
38
|
+
return splitProps(props, textVariantKeys)
|
|
39
|
+
},
|
|
40
|
+
getVariantProps: textFn.getVariantProps,
|
|
41
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface TextareaVariant {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type TextareaVariantMap = {
|
|
10
|
+
[key in keyof TextareaVariant]: Array<TextareaVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type TextareaVariantProps = {
|
|
14
|
+
[key in keyof TextareaVariant]?: ConditionalValue<TextareaVariant[key]> | undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface TextareaRecipe {
|
|
18
|
+
__type: TextareaVariantProps
|
|
19
|
+
(props?: TextareaVariantProps): string
|
|
20
|
+
raw: (props?: TextareaVariantProps) => TextareaVariantProps
|
|
21
|
+
variantMap: TextareaVariantMap
|
|
22
|
+
variantKeys: Array<keyof TextareaVariant>
|
|
23
|
+
splitVariantProps<Props extends TextareaVariantProps>(props: Props): [TextareaVariantProps, Pretty<DistributiveOmit<Props, keyof TextareaVariantProps>>]
|
|
24
|
+
getVariantProps: (props?: TextareaVariantProps) => TextareaVariantProps
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export declare const textarea: TextareaRecipe
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const textareaFn = /* @__PURE__ */ createRecipe('textarea', {}, [])
|
|
5
|
+
|
|
6
|
+
const textareaVariantMap = {}
|
|
7
|
+
|
|
8
|
+
const textareaVariantKeys = Object.keys(textareaVariantMap)
|
|
9
|
+
|
|
10
|
+
export const textarea = /* @__PURE__ */ Object.assign(memo(textareaFn.recipeFn), {
|
|
11
|
+
__recipe__: true,
|
|
12
|
+
__name__: 'textarea',
|
|
13
|
+
__getCompoundVariantCss__: textareaFn.__getCompoundVariantCss__,
|
|
14
|
+
raw: (props) => props,
|
|
15
|
+
variantKeys: textareaVariantKeys,
|
|
16
|
+
variantMap: textareaVariantMap,
|
|
17
|
+
merge(recipe) {
|
|
18
|
+
return mergeRecipes(this, recipe)
|
|
19
|
+
},
|
|
20
|
+
splitVariantProps(props) {
|
|
21
|
+
return splitProps(props, textareaVariantKeys)
|
|
22
|
+
},
|
|
23
|
+
getVariantProps: textareaFn.getVariantProps,
|
|
24
|
+
})
|