@becket-ui/tokens 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/preset.d.ts +7 -0
- package/dist/preset.js +1846 -0
- package/dist/preset.js.map +1 -0
- package/index.css +3033 -0
- package/index.d.ts +10 -0
- package/index.mjs +13 -0
- package/package.json +108 -0
- package/styled-system/css/conditions.mjs +36 -0
- package/styled-system/css/css.d.ts +22 -0
- package/styled-system/css/css.mjs +45 -0
- package/styled-system/css/cva.d.ts +6 -0
- package/styled-system/css/cva.mjs +87 -0
- package/styled-system/css/cx.d.ts +5 -0
- package/styled-system/css/cx.mjs +15 -0
- package/styled-system/css/index.d.ts +5 -0
- package/styled-system/css/index.mjs +4 -0
- package/styled-system/css/sva.d.ts +4 -0
- package/styled-system/css/sva.mjs +46 -0
- package/styled-system/helpers.mjs +328 -0
- package/styled-system/jsx/aspect-ratio.d.ts +10 -0
- package/styled-system/jsx/aspect-ratio.mjs +14 -0
- package/styled-system/jsx/bleed.d.ts +10 -0
- package/styled-system/jsx/bleed.mjs +14 -0
- package/styled-system/jsx/box.d.ts +10 -0
- package/styled-system/jsx/box.mjs +14 -0
- package/styled-system/jsx/center.d.ts +10 -0
- package/styled-system/jsx/center.mjs +14 -0
- package/styled-system/jsx/circle.d.ts +10 -0
- package/styled-system/jsx/circle.mjs +14 -0
- package/styled-system/jsx/container.d.ts +10 -0
- package/styled-system/jsx/container.mjs +14 -0
- package/styled-system/jsx/cq.d.ts +10 -0
- package/styled-system/jsx/cq.mjs +14 -0
- package/styled-system/jsx/create-style-context.d.ts +54 -0
- package/styled-system/jsx/create-style-context.mjs +121 -0
- package/styled-system/jsx/divider.d.ts +10 -0
- package/styled-system/jsx/divider.mjs +14 -0
- package/styled-system/jsx/factory-helper.mjs +22 -0
- package/styled-system/jsx/factory.d.ts +3 -0
- package/styled-system/jsx/factory.mjs +89 -0
- package/styled-system/jsx/flex.d.ts +10 -0
- package/styled-system/jsx/flex.mjs +14 -0
- package/styled-system/jsx/float.d.ts +10 -0
- package/styled-system/jsx/float.mjs +14 -0
- package/styled-system/jsx/grid-item.d.ts +10 -0
- package/styled-system/jsx/grid-item.mjs +14 -0
- package/styled-system/jsx/grid.d.ts +10 -0
- package/styled-system/jsx/grid.mjs +14 -0
- package/styled-system/jsx/hstack.d.ts +10 -0
- package/styled-system/jsx/hstack.mjs +14 -0
- package/styled-system/jsx/index.d.ts +25 -0
- package/styled-system/jsx/index.mjs +23 -0
- package/styled-system/jsx/is-valid-prop.d.ts +11 -0
- package/styled-system/jsx/is-valid-prop.mjs +17 -0
- package/styled-system/jsx/link-overlay.d.ts +10 -0
- package/styled-system/jsx/link-overlay.mjs +14 -0
- package/styled-system/jsx/spacer.d.ts +10 -0
- package/styled-system/jsx/spacer.mjs +14 -0
- package/styled-system/jsx/square.d.ts +10 -0
- package/styled-system/jsx/square.mjs +14 -0
- package/styled-system/jsx/stack.d.ts +10 -0
- package/styled-system/jsx/stack.mjs +14 -0
- package/styled-system/jsx/visually-hidden.d.ts +10 -0
- package/styled-system/jsx/visually-hidden.mjs +14 -0
- package/styled-system/jsx/vstack.d.ts +10 -0
- package/styled-system/jsx/vstack.mjs +14 -0
- package/styled-system/jsx/wrap.d.ts +10 -0
- package/styled-system/jsx/wrap.mjs +14 -0
- package/styled-system/patterns/aspect-ratio.d.ts +20 -0
- package/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/styled-system/patterns/bleed.d.ts +21 -0
- package/styled-system/patterns/bleed.mjs +24 -0
- package/styled-system/patterns/box.d.ts +20 -0
- package/styled-system/patterns/box.mjs +15 -0
- package/styled-system/patterns/center.d.ts +20 -0
- package/styled-system/patterns/center.mjs +21 -0
- package/styled-system/patterns/circle.d.ts +20 -0
- package/styled-system/patterns/circle.mjs +25 -0
- package/styled-system/patterns/container.d.ts +20 -0
- package/styled-system/patterns/container.mjs +21 -0
- package/styled-system/patterns/cq.d.ts +21 -0
- package/styled-system/patterns/cq.mjs +21 -0
- package/styled-system/patterns/divider.d.ts +22 -0
- package/styled-system/patterns/divider.mjs +25 -0
- package/styled-system/patterns/flex.d.ts +26 -0
- package/styled-system/patterns/flex.mjs +26 -0
- package/styled-system/patterns/float.d.ts +23 -0
- package/styled-system/patterns/float.mjs +52 -0
- package/styled-system/patterns/grid-item.d.ts +25 -0
- package/styled-system/patterns/grid-item.mjs +25 -0
- package/styled-system/patterns/grid.d.ts +24 -0
- package/styled-system/patterns/grid.mjs +27 -0
- package/styled-system/patterns/hstack.d.ts +21 -0
- package/styled-system/patterns/hstack.mjs +24 -0
- package/styled-system/patterns/index.d.ts +21 -0
- package/styled-system/patterns/index.mjs +20 -0
- package/styled-system/patterns/link-overlay.d.ts +20 -0
- package/styled-system/patterns/link-overlay.mjs +24 -0
- package/styled-system/patterns/spacer.d.ts +20 -0
- package/styled-system/patterns/spacer.mjs +25 -0
- package/styled-system/patterns/square.d.ts +20 -0
- package/styled-system/patterns/square.mjs +24 -0
- package/styled-system/patterns/stack.d.ts +23 -0
- package/styled-system/patterns/stack.mjs +24 -0
- package/styled-system/patterns/visually-hidden.d.ts +20 -0
- package/styled-system/patterns/visually-hidden.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +21 -0
- package/styled-system/patterns/vstack.mjs +24 -0
- package/styled-system/patterns/wrap.d.ts +24 -0
- package/styled-system/patterns/wrap.mjs +25 -0
- package/styled-system/recipes/badge.d.ts +48 -0
- package/styled-system/recipes/badge.mjs +91 -0
- package/styled-system/recipes/button.d.ts +52 -0
- package/styled-system/recipes/button.mjs +122 -0
- package/styled-system/recipes/card.d.ts +44 -0
- package/styled-system/recipes/card.mjs +76 -0
- package/styled-system/recipes/checkbox.d.ts +36 -0
- package/styled-system/recipes/checkbox.mjs +62 -0
- package/styled-system/recipes/create-recipe.mjs +82 -0
- package/styled-system/recipes/dialog.d.ts +33 -0
- package/styled-system/recipes/dialog.mjs +53 -0
- package/styled-system/recipes/drawer.d.ts +36 -0
- package/styled-system/recipes/drawer.mjs +62 -0
- package/styled-system/recipes/field.d.ts +40 -0
- package/styled-system/recipes/field.mjs +61 -0
- package/styled-system/recipes/heading.d.ts +40 -0
- package/styled-system/recipes/heading.mjs +54 -0
- package/styled-system/recipes/hide.d.ts +38 -0
- package/styled-system/recipes/hide.mjs +246 -0
- package/styled-system/recipes/index.d.ts +23 -0
- package/styled-system/recipes/index.mjs +22 -0
- package/styled-system/recipes/link.d.ts +40 -0
- package/styled-system/recipes/link.mjs +36 -0
- package/styled-system/recipes/menu.d.ts +33 -0
- package/styled-system/recipes/menu.mjs +45 -0
- package/styled-system/recipes/radio.d.ts +36 -0
- package/styled-system/recipes/radio.mjs +70 -0
- package/styled-system/recipes/select-recipe.d.ts +40 -0
- package/styled-system/recipes/select-recipe.mjs +37 -0
- package/styled-system/recipes/separator.d.ts +36 -0
- package/styled-system/recipes/separator.mjs +31 -0
- package/styled-system/recipes/spinner.d.ts +36 -0
- package/styled-system/recipes/spinner.mjs +32 -0
- package/styled-system/recipes/switch-recipe.d.ts +40 -0
- package/styled-system/recipes/switch-recipe.mjs +93 -0
- package/styled-system/recipes/table.d.ts +36 -0
- package/styled-system/recipes/table.mjs +70 -0
- package/styled-system/recipes/tabs.d.ts +33 -0
- package/styled-system/recipes/tabs.mjs +45 -0
- package/styled-system/recipes/tag.d.ts +48 -0
- package/styled-system/recipes/tag.mjs +89 -0
- package/styled-system/recipes/text-field-recipe.d.ts +40 -0
- package/styled-system/recipes/text-field-recipe.mjs +37 -0
- package/styled-system/recipes/textarea-recipe.d.ts +40 -0
- package/styled-system/recipes/textarea-recipe.mjs +37 -0
- package/styled-system/recipes/tooltip.d.ts +36 -0
- package/styled-system/recipes/tooltip.mjs +33 -0
- package/styled-system/styles.css +2986 -0
- package/styled-system/tokens/index.d.ts +9 -0
- package/styled-system/tokens/index.mjs +2128 -0
- package/styled-system/tokens/tokens.d.ts +63 -0
- package/styled-system/types/composition.d.ts +227 -0
- package/styled-system/types/conditions.d.ts +310 -0
- package/styled-system/types/csstype.d.ts +22570 -0
- package/styled-system/types/global.d.ts +20 -0
- package/styled-system/types/index.d.ts +8 -0
- package/styled-system/types/jsx.d.ts +69 -0
- package/styled-system/types/parts.d.ts +8 -0
- package/styled-system/types/pattern.d.ts +78 -0
- package/styled-system/types/prop-type.d.ts +251 -0
- package/styled-system/types/recipe.d.ts +181 -0
- package/styled-system/types/selectors.d.ts +59 -0
- package/styled-system/types/static-css.d.ts +56 -0
- package/styled-system/types/style-props.d.ts +8089 -0
- package/styled-system/types/system-types.d.ts +151 -0
- package/theme/index.d.ts +56 -0
- package/theme/index.mjs +168 -0
- package/theme.example.css +68 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const buttonFn = /* @__PURE__ */ createRecipe('button', {
|
|
5
|
+
"visual": "outline",
|
|
6
|
+
"size": "md",
|
|
7
|
+
"borderRadius": "md",
|
|
8
|
+
"withGradient": false,
|
|
9
|
+
"fullWidth": false
|
|
10
|
+
}, [
|
|
11
|
+
{
|
|
12
|
+
"visual": "primary",
|
|
13
|
+
"withGradient": true,
|
|
14
|
+
"css": {
|
|
15
|
+
"borderWidth": "0px",
|
|
16
|
+
"borderStyle": "solid",
|
|
17
|
+
"borderColor": "transparent",
|
|
18
|
+
"backgroundColor": "transparent",
|
|
19
|
+
"backgroundImage": "{gradients.primary}",
|
|
20
|
+
"backgroundOrigin": "border-box",
|
|
21
|
+
"backgroundClip": "border-box",
|
|
22
|
+
"backgroundRepeat": "no-repeat",
|
|
23
|
+
"backgroundSize": "100% 100%",
|
|
24
|
+
"color": "neutral.50",
|
|
25
|
+
"_hover": {
|
|
26
|
+
"backgroundImage": "{gradients.primaryHover}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"visual": "secondary",
|
|
32
|
+
"withGradient": true,
|
|
33
|
+
"css": {
|
|
34
|
+
"borderWidth": "0px",
|
|
35
|
+
"borderStyle": "solid",
|
|
36
|
+
"borderColor": "transparent",
|
|
37
|
+
"backgroundColor": "transparent",
|
|
38
|
+
"backgroundImage": "{gradients.secondary}",
|
|
39
|
+
"backgroundOrigin": "border-box",
|
|
40
|
+
"backgroundClip": "border-box",
|
|
41
|
+
"backgroundRepeat": "no-repeat",
|
|
42
|
+
"backgroundSize": "100% 100%",
|
|
43
|
+
"color": "neutral.50"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"visual": "neutral",
|
|
48
|
+
"withGradient": true,
|
|
49
|
+
"css": {
|
|
50
|
+
"borderWidth": "0px",
|
|
51
|
+
"borderStyle": "solid",
|
|
52
|
+
"borderColor": "transparent",
|
|
53
|
+
"backgroundColor": "transparent",
|
|
54
|
+
"backgroundImage": "{gradients.neutral}",
|
|
55
|
+
"backgroundOrigin": "border-box",
|
|
56
|
+
"backgroundClip": "border-box",
|
|
57
|
+
"backgroundRepeat": "no-repeat",
|
|
58
|
+
"backgroundSize": "100% 100%",
|
|
59
|
+
"color": "text"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"visual": "outline",
|
|
64
|
+
"withGradient": true,
|
|
65
|
+
"css": {
|
|
66
|
+
"borderWidth": "2px",
|
|
67
|
+
"borderStyle": "solid",
|
|
68
|
+
"borderColor": "transparent",
|
|
69
|
+
"backgroundImage": "linear-gradient({colors.background}, {colors.background}), {gradients.primary}",
|
|
70
|
+
"backgroundOrigin": "border-box",
|
|
71
|
+
"backgroundClip": "padding-box, border-box",
|
|
72
|
+
"color": "secondary"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
const buttonVariantMap = {
|
|
78
|
+
"visual": [
|
|
79
|
+
"primary",
|
|
80
|
+
"secondary",
|
|
81
|
+
"neutral",
|
|
82
|
+
"outline"
|
|
83
|
+
],
|
|
84
|
+
"size": [
|
|
85
|
+
"sm",
|
|
86
|
+
"md"
|
|
87
|
+
],
|
|
88
|
+
"borderRadius": [
|
|
89
|
+
"none",
|
|
90
|
+
"sm",
|
|
91
|
+
"md",
|
|
92
|
+
"lg",
|
|
93
|
+
"xl",
|
|
94
|
+
"full"
|
|
95
|
+
],
|
|
96
|
+
"withGradient": [
|
|
97
|
+
"false",
|
|
98
|
+
"true"
|
|
99
|
+
],
|
|
100
|
+
"fullWidth": [
|
|
101
|
+
"true",
|
|
102
|
+
"false"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const buttonVariantKeys = Object.keys(buttonVariantMap)
|
|
107
|
+
|
|
108
|
+
export const button = /* @__PURE__ */ Object.assign(memo(buttonFn.recipeFn), {
|
|
109
|
+
__recipe__: true,
|
|
110
|
+
__name__: 'button',
|
|
111
|
+
__getCompoundVariantCss__: buttonFn.__getCompoundVariantCss__,
|
|
112
|
+
raw: (props) => props,
|
|
113
|
+
variantKeys: buttonVariantKeys,
|
|
114
|
+
variantMap: buttonVariantMap,
|
|
115
|
+
merge(recipe) {
|
|
116
|
+
return mergeRecipes(this, recipe)
|
|
117
|
+
},
|
|
118
|
+
splitVariantProps(props) {
|
|
119
|
+
return splitProps(props, buttonVariantKeys)
|
|
120
|
+
},
|
|
121
|
+
getVariantProps: buttonFn.getVariantProps,
|
|
122
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface CardVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "md"
|
|
8
|
+
*/
|
|
9
|
+
size: "sm" | "md" | "lg"
|
|
10
|
+
/**
|
|
11
|
+
* @default "subtle"
|
|
12
|
+
*/
|
|
13
|
+
visual: "outline" | "subtle" | "elevated"
|
|
14
|
+
/**
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
fullWidth: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type CardVariantMap = {
|
|
21
|
+
[key in keyof CardVariant]: Array<CardVariant[key]>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type CardSlot = "root" | "header" | "body" | "footer" | "title" | "description"
|
|
25
|
+
|
|
26
|
+
export type CardVariantProps = {
|
|
27
|
+
[key in keyof CardVariant]?: ConditionalValue<CardVariant[key]> | undefined
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CardRecipe {
|
|
31
|
+
__slot: CardSlot
|
|
32
|
+
__type: CardVariantProps
|
|
33
|
+
(props?: CardVariantProps): Pretty<Record<CardSlot, string>>
|
|
34
|
+
raw: (props?: CardVariantProps) => CardVariantProps
|
|
35
|
+
variantMap: CardVariantMap
|
|
36
|
+
variantKeys: Array<keyof CardVariant>
|
|
37
|
+
splitVariantProps<Props extends CardVariantProps>(props: Props): [CardVariantProps, Pretty<DistributiveOmit<Props, keyof CardVariantProps>>]
|
|
38
|
+
getVariantProps: (props?: CardVariantProps) => CardVariantProps
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Card container with header, body, and footer slots
|
|
43
|
+
*/
|
|
44
|
+
export declare const card: CardRecipe
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const cardDefaultVariants = {
|
|
5
|
+
"size": "md",
|
|
6
|
+
"visual": "subtle",
|
|
7
|
+
"fullWidth": false
|
|
8
|
+
}
|
|
9
|
+
const cardCompoundVariants = []
|
|
10
|
+
|
|
11
|
+
const cardSlotNames = [
|
|
12
|
+
[
|
|
13
|
+
"root",
|
|
14
|
+
"card__root"
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
"header",
|
|
18
|
+
"card__header"
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"body",
|
|
22
|
+
"card__body"
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"footer",
|
|
26
|
+
"card__footer"
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
"title",
|
|
30
|
+
"card__title"
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"description",
|
|
34
|
+
"card__description"
|
|
35
|
+
]
|
|
36
|
+
]
|
|
37
|
+
const cardSlotFns = /* @__PURE__ */ cardSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, cardDefaultVariants, getSlotCompoundVariant(cardCompoundVariants, slotName))])
|
|
38
|
+
|
|
39
|
+
const cardFn = memo((props = {}) => {
|
|
40
|
+
return Object.fromEntries(cardSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const cardVariantKeys = [
|
|
44
|
+
"size",
|
|
45
|
+
"visual",
|
|
46
|
+
"fullWidth"
|
|
47
|
+
]
|
|
48
|
+
const getVariantProps = (variants) => ({ ...cardDefaultVariants, ...compact(variants) })
|
|
49
|
+
|
|
50
|
+
export const card = /* @__PURE__ */ Object.assign(cardFn, {
|
|
51
|
+
__recipe__: false,
|
|
52
|
+
__name__: 'card',
|
|
53
|
+
raw: (props) => props,
|
|
54
|
+
classNameMap: {},
|
|
55
|
+
variantKeys: cardVariantKeys,
|
|
56
|
+
variantMap: {
|
|
57
|
+
"size": [
|
|
58
|
+
"sm",
|
|
59
|
+
"md",
|
|
60
|
+
"lg"
|
|
61
|
+
],
|
|
62
|
+
"visual": [
|
|
63
|
+
"outline",
|
|
64
|
+
"subtle",
|
|
65
|
+
"elevated"
|
|
66
|
+
],
|
|
67
|
+
"fullWidth": [
|
|
68
|
+
"true",
|
|
69
|
+
"false"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
splitVariantProps(props) {
|
|
73
|
+
return splitProps(props, cardVariantKeys)
|
|
74
|
+
},
|
|
75
|
+
getVariantProps
|
|
76
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface CheckboxVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "md"
|
|
8
|
+
*/
|
|
9
|
+
size: "sm" | "md"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type CheckboxVariantMap = {
|
|
13
|
+
[key in keyof CheckboxVariant]: Array<CheckboxVariant[key]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type CheckboxSlot = "root" | "control" | "indicator" | "text" | "label" | "description"
|
|
17
|
+
|
|
18
|
+
export type CheckboxVariantProps = {
|
|
19
|
+
[key in keyof CheckboxVariant]?: ConditionalValue<CheckboxVariant[key]> | undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CheckboxRecipe {
|
|
23
|
+
__slot: CheckboxSlot
|
|
24
|
+
__type: CheckboxVariantProps
|
|
25
|
+
(props?: CheckboxVariantProps): Pretty<Record<CheckboxSlot, string>>
|
|
26
|
+
raw: (props?: CheckboxVariantProps) => CheckboxVariantProps
|
|
27
|
+
variantMap: CheckboxVariantMap
|
|
28
|
+
variantKeys: Array<keyof CheckboxVariant>
|
|
29
|
+
splitVariantProps<Props extends CheckboxVariantProps>(props: Props): [CheckboxVariantProps, Pretty<DistributiveOmit<Props, keyof CheckboxVariantProps>>]
|
|
30
|
+
getVariantProps: (props?: CheckboxVariantProps) => CheckboxVariantProps
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Native checkbox with visible control, label, and optional description
|
|
35
|
+
*/
|
|
36
|
+
export declare const checkbox: CheckboxRecipe
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const checkboxDefaultVariants = {
|
|
5
|
+
"size": "md"
|
|
6
|
+
}
|
|
7
|
+
const checkboxCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const checkboxSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"root",
|
|
12
|
+
"checkbox__root"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"control",
|
|
16
|
+
"checkbox__control"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"indicator",
|
|
20
|
+
"checkbox__indicator"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"text",
|
|
24
|
+
"checkbox__text"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"label",
|
|
28
|
+
"checkbox__label"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"description",
|
|
32
|
+
"checkbox__description"
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
const checkboxSlotFns = /* @__PURE__ */ checkboxSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, checkboxDefaultVariants, getSlotCompoundVariant(checkboxCompoundVariants, slotName))])
|
|
36
|
+
|
|
37
|
+
const checkboxFn = memo((props = {}) => {
|
|
38
|
+
return Object.fromEntries(checkboxSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const checkboxVariantKeys = [
|
|
42
|
+
"size"
|
|
43
|
+
]
|
|
44
|
+
const getVariantProps = (variants) => ({ ...checkboxDefaultVariants, ...compact(variants) })
|
|
45
|
+
|
|
46
|
+
export const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
47
|
+
__recipe__: false,
|
|
48
|
+
__name__: 'checkbox',
|
|
49
|
+
raw: (props) => props,
|
|
50
|
+
classNameMap: {},
|
|
51
|
+
variantKeys: checkboxVariantKeys,
|
|
52
|
+
variantMap: {
|
|
53
|
+
"size": [
|
|
54
|
+
"sm",
|
|
55
|
+
"md"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
splitVariantProps(props) {
|
|
59
|
+
return splitProps(props, checkboxVariantKeys)
|
|
60
|
+
},
|
|
61
|
+
getVariantProps
|
|
62
|
+
})
|
|
@@ -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","2xl"] }
|
|
34
|
+
},
|
|
35
|
+
utility: {
|
|
36
|
+
prefix: "beckui-",
|
|
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,33 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface DialogVariant {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type DialogVariantMap = {
|
|
10
|
+
[key in keyof DialogVariant]: Array<DialogVariant[key]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type DialogSlot = "root" | "header" | "body" | "footer" | "title" | "close"
|
|
14
|
+
|
|
15
|
+
export type DialogVariantProps = {
|
|
16
|
+
[key in keyof DialogVariant]?: ConditionalValue<DialogVariant[key]> | undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface DialogRecipe {
|
|
20
|
+
__slot: DialogSlot
|
|
21
|
+
__type: DialogVariantProps
|
|
22
|
+
(props?: DialogVariantProps): Pretty<Record<DialogSlot, string>>
|
|
23
|
+
raw: (props?: DialogVariantProps) => DialogVariantProps
|
|
24
|
+
variantMap: DialogVariantMap
|
|
25
|
+
variantKeys: Array<keyof DialogVariant>
|
|
26
|
+
splitVariantProps<Props extends DialogVariantProps>(props: Props): [DialogVariantProps, Pretty<DistributiveOmit<Props, keyof DialogVariantProps>>]
|
|
27
|
+
getVariantProps: (props?: DialogVariantProps) => DialogVariantProps
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Native dialog overlay with header, body, and footer slots
|
|
32
|
+
*/
|
|
33
|
+
export declare const dialog: DialogRecipe
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const dialogDefaultVariants = {}
|
|
5
|
+
const dialogCompoundVariants = []
|
|
6
|
+
|
|
7
|
+
const dialogSlotNames = [
|
|
8
|
+
[
|
|
9
|
+
"root",
|
|
10
|
+
"dialog__root"
|
|
11
|
+
],
|
|
12
|
+
[
|
|
13
|
+
"header",
|
|
14
|
+
"dialog__header"
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
"body",
|
|
18
|
+
"dialog__body"
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"footer",
|
|
22
|
+
"dialog__footer"
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"title",
|
|
26
|
+
"dialog__title"
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
"close",
|
|
30
|
+
"dialog__close"
|
|
31
|
+
]
|
|
32
|
+
]
|
|
33
|
+
const dialogSlotFns = /* @__PURE__ */ dialogSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, dialogDefaultVariants, getSlotCompoundVariant(dialogCompoundVariants, slotName))])
|
|
34
|
+
|
|
35
|
+
const dialogFn = memo((props = {}) => {
|
|
36
|
+
return Object.fromEntries(dialogSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const dialogVariantKeys = []
|
|
40
|
+
const getVariantProps = (variants) => ({ ...dialogDefaultVariants, ...compact(variants) })
|
|
41
|
+
|
|
42
|
+
export const dialog = /* @__PURE__ */ Object.assign(dialogFn, {
|
|
43
|
+
__recipe__: false,
|
|
44
|
+
__name__: 'dialog',
|
|
45
|
+
raw: (props) => props,
|
|
46
|
+
classNameMap: {},
|
|
47
|
+
variantKeys: dialogVariantKeys,
|
|
48
|
+
variantMap: {},
|
|
49
|
+
splitVariantProps(props) {
|
|
50
|
+
return splitProps(props, dialogVariantKeys)
|
|
51
|
+
},
|
|
52
|
+
getVariantProps
|
|
53
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface DrawerVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "end"
|
|
8
|
+
*/
|
|
9
|
+
placement: "start" | "end"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type DrawerVariantMap = {
|
|
13
|
+
[key in keyof DrawerVariant]: Array<DrawerVariant[key]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type DrawerSlot = "root" | "header" | "body" | "footer" | "title" | "close"
|
|
17
|
+
|
|
18
|
+
export type DrawerVariantProps = {
|
|
19
|
+
[key in keyof DrawerVariant]?: ConditionalValue<DrawerVariant[key]> | undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DrawerRecipe {
|
|
23
|
+
__slot: DrawerSlot
|
|
24
|
+
__type: DrawerVariantProps
|
|
25
|
+
(props?: DrawerVariantProps): Pretty<Record<DrawerSlot, string>>
|
|
26
|
+
raw: (props?: DrawerVariantProps) => DrawerVariantProps
|
|
27
|
+
variantMap: DrawerVariantMap
|
|
28
|
+
variantKeys: Array<keyof DrawerVariant>
|
|
29
|
+
splitVariantProps<Props extends DrawerVariantProps>(props: Props): [DrawerVariantProps, Pretty<DistributiveOmit<Props, keyof DrawerVariantProps>>]
|
|
30
|
+
getVariantProps: (props?: DrawerVariantProps) => DrawerVariantProps
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Side overlay built on native dialog
|
|
35
|
+
*/
|
|
36
|
+
export declare const drawer: DrawerRecipe
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const drawerDefaultVariants = {
|
|
5
|
+
"placement": "end"
|
|
6
|
+
}
|
|
7
|
+
const drawerCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const drawerSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"root",
|
|
12
|
+
"drawer__root"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"header",
|
|
16
|
+
"drawer__header"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"body",
|
|
20
|
+
"drawer__body"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"footer",
|
|
24
|
+
"drawer__footer"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"title",
|
|
28
|
+
"drawer__title"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"close",
|
|
32
|
+
"drawer__close"
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
const drawerSlotFns = /* @__PURE__ */ drawerSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, drawerDefaultVariants, getSlotCompoundVariant(drawerCompoundVariants, slotName))])
|
|
36
|
+
|
|
37
|
+
const drawerFn = memo((props = {}) => {
|
|
38
|
+
return Object.fromEntries(drawerSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const drawerVariantKeys = [
|
|
42
|
+
"placement"
|
|
43
|
+
]
|
|
44
|
+
const getVariantProps = (variants) => ({ ...drawerDefaultVariants, ...compact(variants) })
|
|
45
|
+
|
|
46
|
+
export const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
47
|
+
__recipe__: false,
|
|
48
|
+
__name__: 'drawer',
|
|
49
|
+
raw: (props) => props,
|
|
50
|
+
classNameMap: {},
|
|
51
|
+
variantKeys: drawerVariantKeys,
|
|
52
|
+
variantMap: {
|
|
53
|
+
"placement": [
|
|
54
|
+
"start",
|
|
55
|
+
"end"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
splitVariantProps(props) {
|
|
59
|
+
return splitProps(props, drawerVariantKeys)
|
|
60
|
+
},
|
|
61
|
+
getVariantProps
|
|
62
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface FieldVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "md"
|
|
8
|
+
*/
|
|
9
|
+
size: "sm" | "md" | "lg"
|
|
10
|
+
/**
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
fullWidth: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type FieldVariantMap = {
|
|
17
|
+
[key in keyof FieldVariant]: Array<FieldVariant[key]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type FieldSlot = "root" | "label" | "helper" | "error"
|
|
21
|
+
|
|
22
|
+
export type FieldVariantProps = {
|
|
23
|
+
[key in keyof FieldVariant]?: ConditionalValue<FieldVariant[key]> | undefined
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FieldRecipe {
|
|
27
|
+
__slot: FieldSlot
|
|
28
|
+
__type: FieldVariantProps
|
|
29
|
+
(props?: FieldVariantProps): Pretty<Record<FieldSlot, string>>
|
|
30
|
+
raw: (props?: FieldVariantProps) => FieldVariantProps
|
|
31
|
+
variantMap: FieldVariantMap
|
|
32
|
+
variantKeys: Array<keyof FieldVariant>
|
|
33
|
+
splitVariantProps<Props extends FieldVariantProps>(props: Props): [FieldVariantProps, Pretty<DistributiveOmit<Props, keyof FieldVariantProps>>]
|
|
34
|
+
getVariantProps: (props?: FieldVariantProps) => FieldVariantProps
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Field composition: label, helper, and error around a control
|
|
39
|
+
*/
|
|
40
|
+
export declare const field: FieldRecipe
|