@discourser/design-system 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/README.md +213 -0
- package/dist/index.cjs +1250 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +456 -0
- package/dist/index.d.ts +456 -0
- package/dist/index.js +1234 -0
- package/dist/index.js.map +1 -0
- package/package.json +123 -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 +41 -0
- package/styled-system/helpers.mjs +336 -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/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 +80 -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 +24 -0
- package/styled-system/jsx/index.mjs +22 -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 +21 -0
- package/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/styled-system/patterns/bleed.d.ts +22 -0
- package/styled-system/patterns/bleed.mjs +24 -0
- package/styled-system/patterns/box.d.ts +21 -0
- package/styled-system/patterns/box.mjs +15 -0
- package/styled-system/patterns/center.d.ts +21 -0
- package/styled-system/patterns/center.mjs +21 -0
- package/styled-system/patterns/circle.d.ts +21 -0
- package/styled-system/patterns/circle.mjs +25 -0
- package/styled-system/patterns/container.d.ts +21 -0
- package/styled-system/patterns/container.mjs +21 -0
- package/styled-system/patterns/cq.d.ts +22 -0
- package/styled-system/patterns/cq.mjs +21 -0
- package/styled-system/patterns/divider.d.ts +23 -0
- package/styled-system/patterns/divider.mjs +25 -0
- package/styled-system/patterns/flex.d.ts +27 -0
- package/styled-system/patterns/flex.mjs +26 -0
- package/styled-system/patterns/float.d.ts +24 -0
- package/styled-system/patterns/float.mjs +52 -0
- package/styled-system/patterns/grid-item.d.ts +26 -0
- package/styled-system/patterns/grid-item.mjs +25 -0
- package/styled-system/patterns/grid.d.ts +25 -0
- package/styled-system/patterns/grid.mjs +27 -0
- package/styled-system/patterns/hstack.d.ts +22 -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 +21 -0
- package/styled-system/patterns/link-overlay.mjs +24 -0
- package/styled-system/patterns/spacer.d.ts +21 -0
- package/styled-system/patterns/spacer.mjs +21 -0
- package/styled-system/patterns/square.d.ts +21 -0
- package/styled-system/patterns/square.mjs +24 -0
- package/styled-system/patterns/stack.d.ts +24 -0
- package/styled-system/patterns/stack.mjs +24 -0
- package/styled-system/patterns/visually-hidden.d.ts +21 -0
- package/styled-system/patterns/visually-hidden.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +22 -0
- package/styled-system/patterns/vstack.mjs +24 -0
- package/styled-system/patterns/wrap.d.ts +25 -0
- package/styled-system/patterns/wrap.mjs +25 -0
- package/styled-system/recipes/button.d.ts +39 -0
- package/styled-system/recipes/button.mjs +40 -0
- package/styled-system/recipes/card.d.ts +39 -0
- package/styled-system/recipes/card.mjs +36 -0
- package/styled-system/recipes/create-recipe.mjs +82 -0
- package/styled-system/recipes/dialog.d.ts +35 -0
- package/styled-system/recipes/dialog.mjs +63 -0
- package/styled-system/recipes/icon-button.d.ts +39 -0
- package/styled-system/recipes/icon-button.mjs +39 -0
- package/styled-system/recipes/index.d.ts +7 -0
- package/styled-system/recipes/index.mjs +6 -0
- package/styled-system/recipes/input.d.ts +40 -0
- package/styled-system/recipes/input.mjs +40 -0
- package/styled-system/recipes/switch-control.d.ts +35 -0
- package/styled-system/recipes/switch-control.mjs +53 -0
- package/styled-system/recipes/switch.d.ts +35 -0
- package/styled-system/recipes/switch.mjs +53 -0
- package/styled-system/tokens/index.d.ts +9 -0
- package/styled-system/tokens/index.mjs +924 -0
- package/styled-system/tokens/tokens.d.ts +48 -0
- package/styled-system/types/composition.d.ts +164 -0
- package/styled-system/types/conditions.d.ts +306 -0
- package/styled-system/types/csstype.d.ts +21298 -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 +52 -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 +224 -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 +7468 -0
- package/styled-system/types/system-types.d.ts +109 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
|
+
import { css } from '../css/index.mjs';
|
|
3
|
+
|
|
4
|
+
const stackConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { align, justify, direction, gap, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: direction,
|
|
10
|
+
alignItems: align,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
gap,
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{direction:'column',gap:'10px'}}
|
|
17
|
+
|
|
18
|
+
export const getStackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(stackConfig, styles)
|
|
20
|
+
return stackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const stack = (styles) => css(getStackStyle(styles))
|
|
24
|
+
stack.raw = getStackStyle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
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';
|
|
7
|
+
|
|
8
|
+
export interface VisuallyHiddenProperties {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
interface VisuallyHiddenStyles extends VisuallyHiddenProperties, DistributiveOmit<SystemStyleObject, keyof VisuallyHiddenProperties > {}
|
|
14
|
+
|
|
15
|
+
interface VisuallyHiddenPatternFn {
|
|
16
|
+
(styles?: VisuallyHiddenStyles): string
|
|
17
|
+
raw: (styles?: VisuallyHiddenStyles) => SystemStyleObject
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export declare const visuallyHidden: VisuallyHiddenPatternFn;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
|
+
import { css } from '../css/index.mjs';
|
|
3
|
+
|
|
4
|
+
const visuallyHiddenConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
return {
|
|
7
|
+
srOnly: true,
|
|
8
|
+
...props
|
|
9
|
+
};
|
|
10
|
+
}}
|
|
11
|
+
|
|
12
|
+
export const getVisuallyHiddenStyle = (styles = {}) => {
|
|
13
|
+
const _styles = getPatternStyles(visuallyHiddenConfig, styles)
|
|
14
|
+
return visuallyHiddenConfig.transform(_styles, patternFns)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const visuallyHidden = (styles) => css(getVisuallyHiddenStyle(styles))
|
|
18
|
+
visuallyHidden.raw = getVisuallyHiddenStyle
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
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';
|
|
7
|
+
|
|
8
|
+
export interface VstackProperties {
|
|
9
|
+
justify?: SystemProperties["justifyContent"]
|
|
10
|
+
gap?: SystemProperties["gap"]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
interface VstackStyles extends VstackProperties, DistributiveOmit<SystemStyleObject, keyof VstackProperties > {}
|
|
15
|
+
|
|
16
|
+
interface VstackPatternFn {
|
|
17
|
+
(styles?: VstackStyles): string
|
|
18
|
+
raw: (styles?: VstackStyles) => SystemStyleObject
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export declare const vstack: VstackPatternFn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
|
+
import { css } from '../css/index.mjs';
|
|
3
|
+
|
|
4
|
+
const vstackConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { justify, gap, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: justify,
|
|
11
|
+
gap,
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{gap:'10px'}}
|
|
17
|
+
|
|
18
|
+
export const getVstackStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(vstackConfig, styles)
|
|
20
|
+
return vstackConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const vstack = (styles) => css(getVstackStyle(styles))
|
|
24
|
+
vstack.raw = getVstackStyle
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
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';
|
|
7
|
+
|
|
8
|
+
export interface WrapProperties {
|
|
9
|
+
gap?: SystemProperties["gap"]
|
|
10
|
+
rowGap?: SystemProperties["gap"]
|
|
11
|
+
columnGap?: SystemProperties["gap"]
|
|
12
|
+
align?: SystemProperties["alignItems"]
|
|
13
|
+
justify?: SystemProperties["justifyContent"]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
interface WrapStyles extends WrapProperties, DistributiveOmit<SystemStyleObject, keyof WrapProperties > {}
|
|
18
|
+
|
|
19
|
+
interface WrapPatternFn {
|
|
20
|
+
(styles?: WrapStyles): string
|
|
21
|
+
raw: (styles?: WrapStyles) => SystemStyleObject
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export declare const wrap: WrapPatternFn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
|
+
import { css } from '../css/index.mjs';
|
|
3
|
+
|
|
4
|
+
const wrapConfig = {
|
|
5
|
+
transform(props) {
|
|
6
|
+
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "10px", align, justify, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexWrap: "wrap",
|
|
10
|
+
alignItems: align,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
gap,
|
|
13
|
+
columnGap,
|
|
14
|
+
rowGap,
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
}}
|
|
18
|
+
|
|
19
|
+
export const getWrapStyle = (styles = {}) => {
|
|
20
|
+
const _styles = getPatternStyles(wrapConfig, styles)
|
|
21
|
+
return wrapConfig.transform(_styles, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const wrap = (styles) => css(getWrapStyle(styles))
|
|
25
|
+
wrap.raw = getWrapStyle
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface ButtonVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "filled"
|
|
8
|
+
*/
|
|
9
|
+
variant: "filled" | "outlined" | "text" | "elevated" | "tonal"
|
|
10
|
+
/**
|
|
11
|
+
* @default "md"
|
|
12
|
+
*/
|
|
13
|
+
size: "sm" | "md" | "lg"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ButtonVariantMap = {
|
|
17
|
+
[key in keyof ButtonVariant]: Array<ButtonVariant[key]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ButtonVariantProps = {
|
|
21
|
+
[key in keyof ButtonVariant]?: ConditionalValue<ButtonVariant[key]> | undefined
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ButtonRecipe {
|
|
25
|
+
__type: ButtonVariantProps
|
|
26
|
+
(props?: ButtonVariantProps): string
|
|
27
|
+
raw: (props?: ButtonVariantProps) => ButtonVariantProps
|
|
28
|
+
variantMap: ButtonVariantMap
|
|
29
|
+
variantKeys: Array<keyof ButtonVariant>
|
|
30
|
+
splitVariantProps<Props extends ButtonVariantProps>(props: Props): [ButtonVariantProps, Pretty<DistributiveOmit<Props, keyof ButtonVariantProps>>]
|
|
31
|
+
getVariantProps: (props?: ButtonVariantProps) => ButtonVariantProps
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Material Design 3 button component
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
*/
|
|
39
|
+
export declare const button: ButtonRecipe
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const buttonFn = /* @__PURE__ */ createRecipe('button', {
|
|
5
|
+
"variant": "filled",
|
|
6
|
+
"size": "md"
|
|
7
|
+
}, [])
|
|
8
|
+
|
|
9
|
+
const buttonVariantMap = {
|
|
10
|
+
"variant": [
|
|
11
|
+
"filled",
|
|
12
|
+
"outlined",
|
|
13
|
+
"text",
|
|
14
|
+
"elevated",
|
|
15
|
+
"tonal"
|
|
16
|
+
],
|
|
17
|
+
"size": [
|
|
18
|
+
"sm",
|
|
19
|
+
"md",
|
|
20
|
+
"lg"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const buttonVariantKeys = Object.keys(buttonVariantMap)
|
|
25
|
+
|
|
26
|
+
export const button = /* @__PURE__ */ Object.assign(memo(buttonFn.recipeFn), {
|
|
27
|
+
__recipe__: true,
|
|
28
|
+
__name__: 'button',
|
|
29
|
+
__getCompoundVariantCss__: buttonFn.__getCompoundVariantCss__,
|
|
30
|
+
raw: (props) => props,
|
|
31
|
+
variantKeys: buttonVariantKeys,
|
|
32
|
+
variantMap: buttonVariantMap,
|
|
33
|
+
merge(recipe) {
|
|
34
|
+
return mergeRecipes(this, recipe)
|
|
35
|
+
},
|
|
36
|
+
splitVariantProps(props) {
|
|
37
|
+
return splitProps(props, buttonVariantKeys)
|
|
38
|
+
},
|
|
39
|
+
getVariantProps: buttonFn.getVariantProps,
|
|
40
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
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 "elevated"
|
|
8
|
+
*/
|
|
9
|
+
variant: "elevated" | "filled" | "outlined"
|
|
10
|
+
/**
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
interactive: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type CardVariantMap = {
|
|
17
|
+
[key in keyof CardVariant]: Array<CardVariant[key]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type CardVariantProps = {
|
|
21
|
+
[key in keyof CardVariant]?: ConditionalValue<CardVariant[key]> | undefined
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CardRecipe {
|
|
25
|
+
__type: CardVariantProps
|
|
26
|
+
(props?: CardVariantProps): string
|
|
27
|
+
raw: (props?: CardVariantProps) => CardVariantProps
|
|
28
|
+
variantMap: CardVariantMap
|
|
29
|
+
variantKeys: Array<keyof CardVariant>
|
|
30
|
+
splitVariantProps<Props extends CardVariantProps>(props: Props): [CardVariantProps, Pretty<DistributiveOmit<Props, keyof CardVariantProps>>]
|
|
31
|
+
getVariantProps: (props?: CardVariantProps) => CardVariantProps
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Material Design 3 card component
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
*/
|
|
39
|
+
export declare const card: CardRecipe
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const cardFn = /* @__PURE__ */ createRecipe('card', {
|
|
5
|
+
"variant": "elevated",
|
|
6
|
+
"interactive": false
|
|
7
|
+
}, [])
|
|
8
|
+
|
|
9
|
+
const cardVariantMap = {
|
|
10
|
+
"variant": [
|
|
11
|
+
"elevated",
|
|
12
|
+
"filled",
|
|
13
|
+
"outlined"
|
|
14
|
+
],
|
|
15
|
+
"interactive": [
|
|
16
|
+
"true"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const cardVariantKeys = Object.keys(cardVariantMap)
|
|
21
|
+
|
|
22
|
+
export const card = /* @__PURE__ */ Object.assign(memo(cardFn.recipeFn), {
|
|
23
|
+
__recipe__: true,
|
|
24
|
+
__name__: 'card',
|
|
25
|
+
__getCompoundVariantCss__: cardFn.__getCompoundVariantCss__,
|
|
26
|
+
raw: (props) => props,
|
|
27
|
+
variantKeys: cardVariantKeys,
|
|
28
|
+
variantMap: cardVariantMap,
|
|
29
|
+
merge(recipe) {
|
|
30
|
+
return mergeRecipes(this, recipe)
|
|
31
|
+
},
|
|
32
|
+
splitVariantProps(props) {
|
|
33
|
+
return splitProps(props, cardVariantKeys)
|
|
34
|
+
},
|
|
35
|
+
getVariantProps: cardFn.getVariantProps,
|
|
36
|
+
})
|
|
@@ -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
|
+
|
|
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,35 @@
|
|
|
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
|
+
* @default "md"
|
|
8
|
+
*/
|
|
9
|
+
size: "sm" | "md" | "lg" | "fullscreen"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type DialogVariantMap = {
|
|
13
|
+
[key in keyof DialogVariant]: Array<DialogVariant[key]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type DialogVariantProps = {
|
|
17
|
+
[key in keyof DialogVariant]?: ConditionalValue<DialogVariant[key]> | undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DialogRecipe {
|
|
21
|
+
__type: DialogVariantProps
|
|
22
|
+
(props?: DialogVariantProps): Pretty<Record<"backdrop" | "positioner" | "content" | "title" | "description" | "closeTrigger", 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
|
+
* Material Design 3 dialog component
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
*/
|
|
35
|
+
export declare const dialog: DialogRecipe
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const dialogDefaultVariants = {
|
|
5
|
+
"size": "md"
|
|
6
|
+
}
|
|
7
|
+
const dialogCompoundVariants = []
|
|
8
|
+
|
|
9
|
+
const dialogSlotNames = [
|
|
10
|
+
[
|
|
11
|
+
"backdrop",
|
|
12
|
+
"dialog__backdrop"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"positioner",
|
|
16
|
+
"dialog__positioner"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"content",
|
|
20
|
+
"dialog__content"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"title",
|
|
24
|
+
"dialog__title"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"description",
|
|
28
|
+
"dialog__description"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"closeTrigger",
|
|
32
|
+
"dialog__closeTrigger"
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
const dialogSlotFns = /* @__PURE__ */ dialogSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, dialogDefaultVariants, getSlotCompoundVariant(dialogCompoundVariants, slotName))])
|
|
36
|
+
|
|
37
|
+
const dialogFn = memo((props = {}) => {
|
|
38
|
+
return Object.fromEntries(dialogSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const dialogVariantKeys = [
|
|
42
|
+
"size"
|
|
43
|
+
]
|
|
44
|
+
const getVariantProps = (variants) => ({ ...dialogDefaultVariants, ...compact(variants) })
|
|
45
|
+
|
|
46
|
+
export const dialog = /* @__PURE__ */ Object.assign(dialogFn, {
|
|
47
|
+
__recipe__: false,
|
|
48
|
+
__name__: 'dialog',
|
|
49
|
+
raw: (props) => props,
|
|
50
|
+
variantKeys: dialogVariantKeys,
|
|
51
|
+
variantMap: {
|
|
52
|
+
"size": [
|
|
53
|
+
"sm",
|
|
54
|
+
"md",
|
|
55
|
+
"lg",
|
|
56
|
+
"fullscreen"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
splitVariantProps(props) {
|
|
60
|
+
return splitProps(props, dialogVariantKeys)
|
|
61
|
+
},
|
|
62
|
+
getVariantProps
|
|
63
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue } from '../types/index';
|
|
3
|
+
import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
4
|
+
|
|
5
|
+
interface IconButtonVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "standard"
|
|
8
|
+
*/
|
|
9
|
+
variant: "standard" | "filled" | "tonal" | "outlined"
|
|
10
|
+
/**
|
|
11
|
+
* @default "md"
|
|
12
|
+
*/
|
|
13
|
+
size: "sm" | "md" | "lg"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type IconButtonVariantMap = {
|
|
17
|
+
[key in keyof IconButtonVariant]: Array<IconButtonVariant[key]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type IconButtonVariantProps = {
|
|
21
|
+
[key in keyof IconButtonVariant]?: ConditionalValue<IconButtonVariant[key]> | undefined
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IconButtonRecipe {
|
|
25
|
+
__type: IconButtonVariantProps
|
|
26
|
+
(props?: IconButtonVariantProps): string
|
|
27
|
+
raw: (props?: IconButtonVariantProps) => IconButtonVariantProps
|
|
28
|
+
variantMap: IconButtonVariantMap
|
|
29
|
+
variantKeys: Array<keyof IconButtonVariant>
|
|
30
|
+
splitVariantProps<Props extends IconButtonVariantProps>(props: Props): [IconButtonVariantProps, Pretty<DistributiveOmit<Props, keyof IconButtonVariantProps>>]
|
|
31
|
+
getVariantProps: (props?: IconButtonVariantProps) => IconButtonVariantProps
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Material Design 3 icon button component
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
*/
|
|
39
|
+
export declare const iconButton: IconButtonRecipe
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const iconButtonFn = /* @__PURE__ */ createRecipe('icon-button', {
|
|
5
|
+
"variant": "standard",
|
|
6
|
+
"size": "md"
|
|
7
|
+
}, [])
|
|
8
|
+
|
|
9
|
+
const iconButtonVariantMap = {
|
|
10
|
+
"variant": [
|
|
11
|
+
"standard",
|
|
12
|
+
"filled",
|
|
13
|
+
"tonal",
|
|
14
|
+
"outlined"
|
|
15
|
+
],
|
|
16
|
+
"size": [
|
|
17
|
+
"sm",
|
|
18
|
+
"md",
|
|
19
|
+
"lg"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const iconButtonVariantKeys = Object.keys(iconButtonVariantMap)
|
|
24
|
+
|
|
25
|
+
export const iconButton = /* @__PURE__ */ Object.assign(memo(iconButtonFn.recipeFn), {
|
|
26
|
+
__recipe__: true,
|
|
27
|
+
__name__: 'iconButton',
|
|
28
|
+
__getCompoundVariantCss__: iconButtonFn.__getCompoundVariantCss__,
|
|
29
|
+
raw: (props) => props,
|
|
30
|
+
variantKeys: iconButtonVariantKeys,
|
|
31
|
+
variantMap: iconButtonVariantMap,
|
|
32
|
+
merge(recipe) {
|
|
33
|
+
return mergeRecipes(this, recipe)
|
|
34
|
+
},
|
|
35
|
+
splitVariantProps(props) {
|
|
36
|
+
return splitProps(props, iconButtonVariantKeys)
|
|
37
|
+
},
|
|
38
|
+
getVariantProps: iconButtonFn.getVariantProps,
|
|
39
|
+
})
|
|
@@ -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 InputVariant {
|
|
6
|
+
/**
|
|
7
|
+
* @default "outlined"
|
|
8
|
+
*/
|
|
9
|
+
variant: "filled" | "outlined"
|
|
10
|
+
/**
|
|
11
|
+
* @default "md"
|
|
12
|
+
*/
|
|
13
|
+
size: "sm" | "md"
|
|
14
|
+
state: "error" | "disabled"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type InputVariantMap = {
|
|
18
|
+
[key in keyof InputVariant]: Array<InputVariant[key]>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type InputVariantProps = {
|
|
22
|
+
[key in keyof InputVariant]?: ConditionalValue<InputVariant[key]> | undefined
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface InputRecipe {
|
|
26
|
+
__type: InputVariantProps
|
|
27
|
+
(props?: InputVariantProps): string
|
|
28
|
+
raw: (props?: InputVariantProps) => InputVariantProps
|
|
29
|
+
variantMap: InputVariantMap
|
|
30
|
+
variantKeys: Array<keyof InputVariant>
|
|
31
|
+
splitVariantProps<Props extends InputVariantProps>(props: Props): [InputVariantProps, Pretty<DistributiveOmit<Props, keyof InputVariantProps>>]
|
|
32
|
+
getVariantProps: (props?: InputVariantProps) => InputVariantProps
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Material Design 3 text field component
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
*/
|
|
40
|
+
export declare const input: InputRecipe
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { memo, splitProps } from '../helpers.mjs';
|
|
2
|
+
import { createRecipe, mergeRecipes } from './create-recipe.mjs';
|
|
3
|
+
|
|
4
|
+
const inputFn = /* @__PURE__ */ createRecipe('input', {
|
|
5
|
+
"variant": "outlined",
|
|
6
|
+
"size": "md"
|
|
7
|
+
}, [])
|
|
8
|
+
|
|
9
|
+
const inputVariantMap = {
|
|
10
|
+
"variant": [
|
|
11
|
+
"filled",
|
|
12
|
+
"outlined"
|
|
13
|
+
],
|
|
14
|
+
"size": [
|
|
15
|
+
"sm",
|
|
16
|
+
"md"
|
|
17
|
+
],
|
|
18
|
+
"state": [
|
|
19
|
+
"error",
|
|
20
|
+
"disabled"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const inputVariantKeys = Object.keys(inputVariantMap)
|
|
25
|
+
|
|
26
|
+
export const input = /* @__PURE__ */ Object.assign(memo(inputFn.recipeFn), {
|
|
27
|
+
__recipe__: true,
|
|
28
|
+
__name__: 'input',
|
|
29
|
+
__getCompoundVariantCss__: inputFn.__getCompoundVariantCss__,
|
|
30
|
+
raw: (props) => props,
|
|
31
|
+
variantKeys: inputVariantKeys,
|
|
32
|
+
variantMap: inputVariantMap,
|
|
33
|
+
merge(recipe) {
|
|
34
|
+
return mergeRecipes(this, recipe)
|
|
35
|
+
},
|
|
36
|
+
splitVariantProps(props) {
|
|
37
|
+
return splitProps(props, inputVariantKeys)
|
|
38
|
+
},
|
|
39
|
+
getVariantProps: inputFn.getVariantProps,
|
|
40
|
+
})
|