@sanity-labs/ui-poc 0.0.1-alpha.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/dist/components.css +9 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.js +290 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +8044 -0
- package/dist/utilities.css +8032 -0
- package/package.json +89 -0
- package/src/components/box/Box.tsx +30 -0
- package/src/components/box/box.props.ts +15 -0
- package/src/components/flex/Flex.tsx +31 -0
- package/src/components/flex/flex.props.ts +19 -0
- package/src/components/grid/Grid.tsx +31 -0
- package/src/components/grid/grid.props.ts +19 -0
- package/src/components/index.css +0 -0
- package/src/components/text/Text.tsx +43 -0
- package/src/components/text/text.props.ts +15 -0
- package/src/css/global.css +103 -0
- package/src/css/index.css +6 -0
- package/src/css/utilities/dynamic/flex-child.css +5 -0
- package/src/css/utilities/dynamic/grid-child.css +8 -0
- package/src/css/utilities/dynamic/grid-parent.css +6 -0
- package/src/css/utilities/dynamic/height.css +5 -0
- package/src/css/utilities/dynamic/index.css +7 -0
- package/src/css/utilities/dynamic/line-clamp.css +6 -0
- package/src/css/utilities/dynamic/width.css +5 -0
- package/src/css/utilities/dynamic/z-index.css +3 -0
- package/src/css/utilities/generic/border.css +11 -0
- package/src/css/utilities/generic/display.css +13 -0
- package/src/css/utilities/generic/flex.css +24 -0
- package/src/css/utilities/generic/grid.css +7 -0
- package/src/css/utilities/generic/index.css +10 -0
- package/src/css/utilities/generic/overflow.css +19 -0
- package/src/css/utilities/generic/position.css +7 -0
- package/src/css/utilities/generic/text-align.css +5 -0
- package/src/css/utilities/generic/text-muted.css +2 -0
- package/src/css/utilities/generic/text-trim.css +38 -0
- package/src/css/utilities/generic/tone.css +34 -0
- package/src/css/utilities/tokenized/color.css +223 -0
- package/src/css/utilities/tokenized/container.css +8 -0
- package/src/css/utilities/tokenized/fontFamily.css +2 -0
- package/src/css/utilities/tokenized/fontWeight.css +4 -0
- package/src/css/utilities/tokenized/gap.css +34 -0
- package/src/css/utilities/tokenized/index.css +9 -0
- package/src/css/utilities/tokenized/inset.css +56 -0
- package/src/css/utilities/tokenized/margin.css +92 -0
- package/src/css/utilities/tokenized/padding.css +85 -0
- package/src/css/utilities/tokenized/radius.css +8 -0
- package/src/css/utilities/tokenized/shadow.css +6 -0
- package/src/css/utilities/tokenized/typography.css +31 -0
- package/src/index.css +2 -0
- package/src/index.ts +1 -0
- package/src/props/border.ts +51 -0
- package/src/props/flexChild.ts +29 -0
- package/src/props/flexParent.ts +46 -0
- package/src/props/gap.ts +30 -0
- package/src/props/gridChild.ts +50 -0
- package/src/props/gridParent.ts +44 -0
- package/src/props/height.ts +29 -0
- package/src/props/layout.ts +37 -0
- package/src/props/margin.ts +58 -0
- package/src/props/overflow.ts +30 -0
- package/src/props/padding.ts +58 -0
- package/src/props/position.ts +59 -0
- package/src/props/tone.ts +16 -0
- package/src/props/typography.ts +46 -0
- package/src/props/width.ts +29 -0
- package/src/types/Display.ts +8 -0
- package/src/types/Flex.ts +18 -0
- package/src/types/FontWeight.ts +2 -0
- package/src/types/Grid.ts +2 -0
- package/src/types/Overflow.ts +2 -0
- package/src/types/Position.ts +2 -0
- package/src/types/PropDef.ts +25 -0
- package/src/types/Radius.ts +2 -0
- package/src/types/Responsive.ts +10 -0
- package/src/types/Space.ts +5 -0
- package/src/types/Text.ts +2 -0
- package/src/types/TextAlign.ts +2 -0
- package/src/types/Tone.ts +2 -0
- package/src/utils/getProps.test.ts +103 -0
- package/src/utils/getProps.ts +74 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALIGN_ITEMS,
|
|
3
|
+
type AlignItems,
|
|
4
|
+
FLEX_DIRECTION,
|
|
5
|
+
FLEX_WRAP,
|
|
6
|
+
type FlexDirection,
|
|
7
|
+
type FlexWrap,
|
|
8
|
+
JUSTIFY_CONTENT,
|
|
9
|
+
type JustifyContent,
|
|
10
|
+
} from '../types/Flex'
|
|
11
|
+
import {type PropDef} from '../types/PropDef'
|
|
12
|
+
import {type Responsive} from '../types/Responsive'
|
|
13
|
+
|
|
14
|
+
export type FlexParentProps = {
|
|
15
|
+
/** CSS **align-items** property */
|
|
16
|
+
alignItems?: Responsive<AlignItems>
|
|
17
|
+
/** CSS **justify-content** property */
|
|
18
|
+
justifyContent?: Responsive<JustifyContent>
|
|
19
|
+
/** CSS **flex-direction** property */
|
|
20
|
+
flexDirection?: Responsive<FlexDirection>
|
|
21
|
+
/** CSS **flex-wrap** property */
|
|
22
|
+
flexWrap?: Responsive<FlexWrap>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const flexParentProps: Record<string, PropDef> = {
|
|
26
|
+
alignItems: {
|
|
27
|
+
type: 'union',
|
|
28
|
+
className: 'align-items',
|
|
29
|
+
values: ALIGN_ITEMS,
|
|
30
|
+
},
|
|
31
|
+
justifyContent: {
|
|
32
|
+
type: 'union',
|
|
33
|
+
className: 'justify-content',
|
|
34
|
+
values: JUSTIFY_CONTENT,
|
|
35
|
+
},
|
|
36
|
+
flexDirection: {
|
|
37
|
+
type: 'union',
|
|
38
|
+
className: 'flex-direction',
|
|
39
|
+
values: FLEX_DIRECTION,
|
|
40
|
+
},
|
|
41
|
+
flexWrap: {
|
|
42
|
+
type: 'union',
|
|
43
|
+
className: 'flex-wrap',
|
|
44
|
+
values: FLEX_WRAP,
|
|
45
|
+
},
|
|
46
|
+
}
|
package/src/props/gap.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
import {SPACE, type Space} from '../types/Space'
|
|
4
|
+
|
|
5
|
+
export type GapProps = {
|
|
6
|
+
/** CSS **gap** property */
|
|
7
|
+
gap?: Responsive<Space>
|
|
8
|
+
/** CSS **row-gap** property */
|
|
9
|
+
rowGap?: Responsive<Space>
|
|
10
|
+
/** CSS **column-gap** property */
|
|
11
|
+
columnGap?: Responsive<Space>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const gapProps: Record<string, PropDef> = {
|
|
15
|
+
gap: {
|
|
16
|
+
type: 'union',
|
|
17
|
+
className: 'gap',
|
|
18
|
+
values: SPACE,
|
|
19
|
+
},
|
|
20
|
+
rowGap: {
|
|
21
|
+
type: 'union',
|
|
22
|
+
className: 'row-gap',
|
|
23
|
+
values: SPACE,
|
|
24
|
+
},
|
|
25
|
+
columnGap: {
|
|
26
|
+
type: 'union',
|
|
27
|
+
className: 'column-gap',
|
|
28
|
+
values: SPACE,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
|
|
4
|
+
export type GridChildProps = {
|
|
5
|
+
/** CSS **grid-column** property */
|
|
6
|
+
gridColumn?: Responsive<string>
|
|
7
|
+
/** CSS **grid-column-start** property */
|
|
8
|
+
gridColumnStart?: Responsive<string>
|
|
9
|
+
/** CSS **grid-column-end** property */
|
|
10
|
+
gridColumnEnd?: Responsive<string>
|
|
11
|
+
/** CSS **grid-row** property */
|
|
12
|
+
gridRow?: Responsive<string>
|
|
13
|
+
/** CSS **grid-row-start** property */
|
|
14
|
+
gridRowStart?: Responsive<string>
|
|
15
|
+
/** CSS **grid-row-end** property */
|
|
16
|
+
gridRowEnd?: Responsive<string>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const gridChildProps: Record<string, PropDef> = {
|
|
20
|
+
gridColumn: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
className: 'grid-column',
|
|
23
|
+
variable: '--grid-column',
|
|
24
|
+
},
|
|
25
|
+
gridColumnStart: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
className: 'grid-column-start',
|
|
28
|
+
variable: '--grid-column-start',
|
|
29
|
+
},
|
|
30
|
+
gridColumnEnd: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
className: 'grid-column-end',
|
|
33
|
+
variable: '--grid-column-end',
|
|
34
|
+
},
|
|
35
|
+
gridRow: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
className: 'grid-row',
|
|
38
|
+
variable: '--grid-row',
|
|
39
|
+
},
|
|
40
|
+
gridRowStart: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
className: 'grid-row-start',
|
|
43
|
+
variable: '--grid-row-start',
|
|
44
|
+
},
|
|
45
|
+
gridRowEnd: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
className: 'grid-row-end',
|
|
48
|
+
variable: '--grid-row-end',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {GRID_AUTO_FLOW, type GridAutoFlow} from '../types/Grid'
|
|
2
|
+
import {type PropDef} from '../types/PropDef'
|
|
3
|
+
import {type Responsive} from '../types/Responsive'
|
|
4
|
+
|
|
5
|
+
export type GridParentProps = {
|
|
6
|
+
/** CSS **grid-auto-flow** property */
|
|
7
|
+
gridAutoFlow?: Responsive<GridAutoFlow>
|
|
8
|
+
/** CSS **grid-auto-columns** property */
|
|
9
|
+
gridAutoColumns?: Responsive<string>
|
|
10
|
+
/** CSS **grid-auto-row** property */
|
|
11
|
+
gridAutoRows?: Responsive<string>
|
|
12
|
+
/** CSS **grid-template-columns** property */
|
|
13
|
+
gridTemplateColumns?: Responsive<string>
|
|
14
|
+
/** CSS **grid-template-rows** property */
|
|
15
|
+
gridTemplateRows?: Responsive<string>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const gridParentProps: Record<string, PropDef> = {
|
|
19
|
+
gridAutoFlow: {
|
|
20
|
+
type: 'union',
|
|
21
|
+
className: 'grid-auto-flow',
|
|
22
|
+
values: GRID_AUTO_FLOW,
|
|
23
|
+
},
|
|
24
|
+
gridAutoColumns: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
className: 'grid-auto-columns',
|
|
27
|
+
variable: '--grid-auto-columns',
|
|
28
|
+
},
|
|
29
|
+
gridAutoRows: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
className: 'grid-auto-rows',
|
|
32
|
+
variable: '--grid-auto-rows',
|
|
33
|
+
},
|
|
34
|
+
gridTemplateColumns: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
className: 'grid-template-columns',
|
|
37
|
+
variable: '--grid-template-columns',
|
|
38
|
+
},
|
|
39
|
+
gridTemplateRows: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
className: 'grid-template-rows',
|
|
42
|
+
variable: '--grid-template-rows',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
|
|
4
|
+
export type HeightProps = {
|
|
5
|
+
/** CSS **height** property */
|
|
6
|
+
height?: Responsive<string>
|
|
7
|
+
/** CSS **min-height** property */
|
|
8
|
+
minHeight?: Responsive<string>
|
|
9
|
+
/** CSS **max-height** property */
|
|
10
|
+
maxHeight?: Responsive<string>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const heightProps: Record<string, PropDef> = {
|
|
14
|
+
height: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
className: 'height',
|
|
17
|
+
variable: '--height',
|
|
18
|
+
},
|
|
19
|
+
minHeight: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
className: 'min-height',
|
|
22
|
+
variable: '--min-height',
|
|
23
|
+
},
|
|
24
|
+
maxHeight: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
className: 'max-height',
|
|
27
|
+
variable: '--max-height',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type BorderProps, borderProps} from './border'
|
|
3
|
+
import {type FlexChildProps, flexChildProps} from './flexChild'
|
|
4
|
+
import {type GridChildProps, gridChildProps} from './gridChild'
|
|
5
|
+
import {type HeightProps, heightProps} from './height'
|
|
6
|
+
import {type MarginProps, marginProps} from './margin'
|
|
7
|
+
import {type OverflowProps, overflowProps} from './overflow'
|
|
8
|
+
import {type PaddingProps, paddingProps} from './padding'
|
|
9
|
+
import {type PositionProps, positionProps} from './position'
|
|
10
|
+
import {type ToneProps, toneProps} from './tone'
|
|
11
|
+
import {type WidthProps, widthProps} from './width'
|
|
12
|
+
|
|
13
|
+
export interface LayoutProps
|
|
14
|
+
extends
|
|
15
|
+
ToneProps,
|
|
16
|
+
WidthProps,
|
|
17
|
+
HeightProps,
|
|
18
|
+
MarginProps,
|
|
19
|
+
BorderProps,
|
|
20
|
+
PaddingProps,
|
|
21
|
+
PositionProps,
|
|
22
|
+
OverflowProps,
|
|
23
|
+
FlexChildProps,
|
|
24
|
+
GridChildProps {}
|
|
25
|
+
|
|
26
|
+
export const layoutProps: Record<string, PropDef> = {
|
|
27
|
+
...toneProps,
|
|
28
|
+
...widthProps,
|
|
29
|
+
...heightProps,
|
|
30
|
+
...marginProps,
|
|
31
|
+
...borderProps,
|
|
32
|
+
...paddingProps,
|
|
33
|
+
...positionProps,
|
|
34
|
+
...overflowProps,
|
|
35
|
+
...flexChildProps,
|
|
36
|
+
...gridChildProps,
|
|
37
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
import {SPACE_AUTO, type SpaceAuto} from '../types/Space'
|
|
4
|
+
|
|
5
|
+
export type MarginProps = {
|
|
6
|
+
/** CSS **margin** property */
|
|
7
|
+
margin?: Responsive<SpaceAuto>
|
|
8
|
+
/** CSS **margin-left** and **margin-right** properties */
|
|
9
|
+
marginX?: Responsive<SpaceAuto>
|
|
10
|
+
/** CSS **margin-top** and **margin-bottom** properties */
|
|
11
|
+
marginY?: Responsive<SpaceAuto>
|
|
12
|
+
/** CSS **margin-top** property */
|
|
13
|
+
marginTop?: Responsive<SpaceAuto>
|
|
14
|
+
/** CSS **margin-right** property */
|
|
15
|
+
marginRight?: Responsive<SpaceAuto>
|
|
16
|
+
/** CSS **margin-bottom** property */
|
|
17
|
+
marginBottom?: Responsive<SpaceAuto>
|
|
18
|
+
/** CSS **margin-left** property */
|
|
19
|
+
marginLeft?: Responsive<SpaceAuto>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const marginProps: Record<string, PropDef> = {
|
|
23
|
+
margin: {
|
|
24
|
+
type: 'union',
|
|
25
|
+
className: 'm',
|
|
26
|
+
values: SPACE_AUTO,
|
|
27
|
+
},
|
|
28
|
+
marginX: {
|
|
29
|
+
type: 'union',
|
|
30
|
+
className: 'mx',
|
|
31
|
+
values: SPACE_AUTO,
|
|
32
|
+
},
|
|
33
|
+
marginY: {
|
|
34
|
+
type: 'union',
|
|
35
|
+
className: 'my',
|
|
36
|
+
values: SPACE_AUTO,
|
|
37
|
+
},
|
|
38
|
+
marginTop: {
|
|
39
|
+
type: 'union',
|
|
40
|
+
className: 'mt',
|
|
41
|
+
values: SPACE_AUTO,
|
|
42
|
+
},
|
|
43
|
+
marginRight: {
|
|
44
|
+
type: 'union',
|
|
45
|
+
className: 'mr',
|
|
46
|
+
values: SPACE_AUTO,
|
|
47
|
+
},
|
|
48
|
+
marginBottom: {
|
|
49
|
+
type: 'union',
|
|
50
|
+
className: 'mb',
|
|
51
|
+
values: SPACE_AUTO,
|
|
52
|
+
},
|
|
53
|
+
marginLeft: {
|
|
54
|
+
type: 'union',
|
|
55
|
+
className: 'ml',
|
|
56
|
+
values: SPACE_AUTO,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {OVERFLOW, type Overflow} from '../types/Overflow'
|
|
2
|
+
import {type PropDef} from '../types/PropDef'
|
|
3
|
+
import {type Responsive} from '../types/Responsive'
|
|
4
|
+
|
|
5
|
+
export type OverflowProps = {
|
|
6
|
+
/** CSS **overflow** property */
|
|
7
|
+
overflow?: Responsive<Overflow>
|
|
8
|
+
/** CSS **overflow-x** property */
|
|
9
|
+
overflowX?: Responsive<Overflow>
|
|
10
|
+
/** CSS **overflow-y** property */
|
|
11
|
+
overflowY?: Responsive<Overflow>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const overflowProps: Record<string, PropDef> = {
|
|
15
|
+
overflow: {
|
|
16
|
+
type: 'union',
|
|
17
|
+
className: 'overflow',
|
|
18
|
+
values: OVERFLOW,
|
|
19
|
+
},
|
|
20
|
+
overflowX: {
|
|
21
|
+
type: 'union',
|
|
22
|
+
className: 'overflow-x',
|
|
23
|
+
values: OVERFLOW,
|
|
24
|
+
},
|
|
25
|
+
overflowY: {
|
|
26
|
+
type: 'union',
|
|
27
|
+
className: 'overflow-y',
|
|
28
|
+
values: OVERFLOW,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
import {SPACE, type Space} from '../types/Space'
|
|
4
|
+
|
|
5
|
+
export interface PaddingProps {
|
|
6
|
+
/** CSS **padding** property */
|
|
7
|
+
padding?: Responsive<Space>
|
|
8
|
+
/** CSS **padding-left** and **padding-right** properties */
|
|
9
|
+
paddingX?: Responsive<Space>
|
|
10
|
+
/** CSS **padding-top** and **padding-bottom** properties */
|
|
11
|
+
paddingY?: Responsive<Space>
|
|
12
|
+
/** CSS **padding-top** property */
|
|
13
|
+
paddingTop?: Responsive<Space>
|
|
14
|
+
/** CSS **padding-right** property */
|
|
15
|
+
paddingRight?: Responsive<Space>
|
|
16
|
+
/** CSS **padding-bottom** property */
|
|
17
|
+
paddingBottom?: Responsive<Space>
|
|
18
|
+
/** CSS **padding-left** property */
|
|
19
|
+
paddingLeft?: Responsive<Space>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const paddingProps: Record<string, PropDef> = {
|
|
23
|
+
padding: {
|
|
24
|
+
type: 'union',
|
|
25
|
+
className: 'p',
|
|
26
|
+
values: SPACE,
|
|
27
|
+
},
|
|
28
|
+
paddingX: {
|
|
29
|
+
type: 'union',
|
|
30
|
+
className: 'px',
|
|
31
|
+
values: SPACE,
|
|
32
|
+
},
|
|
33
|
+
paddingY: {
|
|
34
|
+
type: 'union',
|
|
35
|
+
className: 'py',
|
|
36
|
+
values: SPACE,
|
|
37
|
+
},
|
|
38
|
+
paddingTop: {
|
|
39
|
+
type: 'union',
|
|
40
|
+
className: 'pt',
|
|
41
|
+
values: SPACE,
|
|
42
|
+
},
|
|
43
|
+
paddingRight: {
|
|
44
|
+
type: 'union',
|
|
45
|
+
className: 'pr',
|
|
46
|
+
values: SPACE,
|
|
47
|
+
},
|
|
48
|
+
paddingBottom: {
|
|
49
|
+
type: 'union',
|
|
50
|
+
className: 'pb',
|
|
51
|
+
values: SPACE,
|
|
52
|
+
},
|
|
53
|
+
paddingLeft: {
|
|
54
|
+
type: 'union',
|
|
55
|
+
className: 'pl',
|
|
56
|
+
values: SPACE,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {POSITION, type Position} from '../types/Position'
|
|
2
|
+
import {type PropDef} from '../types/PropDef'
|
|
3
|
+
import {type Responsive} from '../types/Responsive'
|
|
4
|
+
import {SPACE_AUTO, type SpaceAuto} from '../types/Space'
|
|
5
|
+
|
|
6
|
+
export type PositionProps = {
|
|
7
|
+
/** CSS **position** property */
|
|
8
|
+
position?: Responsive<Position>
|
|
9
|
+
/** CSS **inset** property */
|
|
10
|
+
inset?: Responsive<SpaceAuto>
|
|
11
|
+
/** CSS **top** property */
|
|
12
|
+
top?: Responsive<SpaceAuto>
|
|
13
|
+
/** CSS **right** property */
|
|
14
|
+
right?: Responsive<SpaceAuto>
|
|
15
|
+
/** CSS **bottom** property */
|
|
16
|
+
bottom?: Responsive<SpaceAuto>
|
|
17
|
+
/** CSS **left** property */
|
|
18
|
+
left?: Responsive<SpaceAuto>
|
|
19
|
+
/** CSS **z-index** property */
|
|
20
|
+
zIndex?: Responsive<number>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const positionProps: Record<string, PropDef> = {
|
|
24
|
+
position: {
|
|
25
|
+
type: 'union',
|
|
26
|
+
className: 'position',
|
|
27
|
+
values: POSITION,
|
|
28
|
+
},
|
|
29
|
+
inset: {
|
|
30
|
+
type: 'union',
|
|
31
|
+
className: 'inset',
|
|
32
|
+
values: SPACE_AUTO,
|
|
33
|
+
},
|
|
34
|
+
top: {
|
|
35
|
+
type: 'union',
|
|
36
|
+
className: 'top',
|
|
37
|
+
values: SPACE_AUTO,
|
|
38
|
+
},
|
|
39
|
+
right: {
|
|
40
|
+
type: 'union',
|
|
41
|
+
className: 'right',
|
|
42
|
+
values: SPACE_AUTO,
|
|
43
|
+
},
|
|
44
|
+
bottom: {
|
|
45
|
+
type: 'union',
|
|
46
|
+
className: 'bottom',
|
|
47
|
+
values: SPACE_AUTO,
|
|
48
|
+
},
|
|
49
|
+
left: {
|
|
50
|
+
type: 'union',
|
|
51
|
+
className: 'left',
|
|
52
|
+
values: SPACE_AUTO,
|
|
53
|
+
},
|
|
54
|
+
zIndex: {
|
|
55
|
+
type: 'number',
|
|
56
|
+
className: 'z-index',
|
|
57
|
+
variable: '--z-index',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
import {TONE, type Tone} from '../types/Tone'
|
|
4
|
+
|
|
5
|
+
export type ToneProps = {
|
|
6
|
+
/** CSS **background-color** property */
|
|
7
|
+
tone?: Responsive<Tone>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const toneProps: Record<string, PropDef> = {
|
|
11
|
+
tone: {
|
|
12
|
+
type: 'union',
|
|
13
|
+
className: 'tone',
|
|
14
|
+
values: TONE,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {FONT_WEIGHT, type FontWeight} from '../types/FontWeight'
|
|
2
|
+
import {type PropDef} from '../types/PropDef'
|
|
3
|
+
import {TEXT_ALIGN, type TextAlign} from '../types/TextAlign'
|
|
4
|
+
import {type MarginProps, marginProps} from './margin'
|
|
5
|
+
|
|
6
|
+
export interface TypographyProps extends MarginProps {
|
|
7
|
+
/** CSS **text-align** property */
|
|
8
|
+
align?: TextAlign
|
|
9
|
+
/** CSS **-webkit-line-clamp** property */
|
|
10
|
+
lineClamp?: number
|
|
11
|
+
/** CSS **color** property */
|
|
12
|
+
muted?: boolean
|
|
13
|
+
/** CSS **text-box-trim** property */
|
|
14
|
+
trim?: boolean
|
|
15
|
+
/** CSS **font-weight** property */
|
|
16
|
+
weight?: FontWeight
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const typographyProps: Record<string, PropDef> = {
|
|
20
|
+
align: {
|
|
21
|
+
type: 'union',
|
|
22
|
+
className: 'text',
|
|
23
|
+
values: TEXT_ALIGN,
|
|
24
|
+
},
|
|
25
|
+
lineClamp: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
className: 'line-clamp',
|
|
28
|
+
variable: '--line-clamp',
|
|
29
|
+
},
|
|
30
|
+
muted: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
className: 'text-muted',
|
|
33
|
+
inverse: 'text-default',
|
|
34
|
+
},
|
|
35
|
+
trim: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
className: 'text-trim',
|
|
38
|
+
inverse: 'text-trim-none',
|
|
39
|
+
},
|
|
40
|
+
weight: {
|
|
41
|
+
type: 'union',
|
|
42
|
+
className: 'weight',
|
|
43
|
+
values: FONT_WEIGHT,
|
|
44
|
+
},
|
|
45
|
+
...marginProps,
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {type PropDef} from '../types/PropDef'
|
|
2
|
+
import {type Responsive} from '../types/Responsive'
|
|
3
|
+
|
|
4
|
+
export type WidthProps = {
|
|
5
|
+
/** CSS **width** property */
|
|
6
|
+
width?: Responsive<string>
|
|
7
|
+
/** CSS **min-width** property */
|
|
8
|
+
minWidth?: Responsive<string>
|
|
9
|
+
/** CSS **max-width** property */
|
|
10
|
+
maxWidth?: Responsive<string>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const widthProps: Record<string, PropDef> = {
|
|
14
|
+
width: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
className: 'width',
|
|
17
|
+
variable: '--width',
|
|
18
|
+
},
|
|
19
|
+
minWidth: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
className: 'min-width',
|
|
22
|
+
variable: '--min-width',
|
|
23
|
+
},
|
|
24
|
+
maxWidth: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
className: 'max-width',
|
|
27
|
+
variable: '--max-width',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const DISPLAY_BLOCK = ['block', 'inline-block', 'none'] as const
|
|
2
|
+
export type DisplayBlock = (typeof DISPLAY_BLOCK)[number]
|
|
3
|
+
|
|
4
|
+
export const DISPLAY_FLEX = ['flex', 'inline-flex', 'none'] as const
|
|
5
|
+
export type DisplayFlex = (typeof DISPLAY_FLEX)[number]
|
|
6
|
+
|
|
7
|
+
export const DISPLAY_GRID = ['grid', 'inline-grid', 'none'] as const
|
|
8
|
+
export type DisplayGrid = (typeof DISPLAY_GRID)[number]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const ALIGN_ITEMS = ['baseline', 'center', 'flex-end', 'flex-start', 'stretch'] as const
|
|
2
|
+
export type AlignItems = (typeof ALIGN_ITEMS)[number]
|
|
3
|
+
|
|
4
|
+
export const JUSTIFY_CONTENT = [
|
|
5
|
+
'flex-start',
|
|
6
|
+
'flex-end',
|
|
7
|
+
'center',
|
|
8
|
+
'space-between',
|
|
9
|
+
'space-around',
|
|
10
|
+
'space-evenly',
|
|
11
|
+
] as const
|
|
12
|
+
export type JustifyContent = (typeof JUSTIFY_CONTENT)[number]
|
|
13
|
+
|
|
14
|
+
export const FLEX_DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'] as const
|
|
15
|
+
export type FlexDirection = (typeof FLEX_DIRECTION)[number]
|
|
16
|
+
|
|
17
|
+
export const FLEX_WRAP = ['wrap', 'wrap-reverse', 'nowrap'] as const
|
|
18
|
+
export type FlexWrap = (typeof FLEX_WRAP)[number]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type BooleanPropDef = {
|
|
2
|
+
type: 'boolean'
|
|
3
|
+
className: string
|
|
4
|
+
inverse: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type NumberPropDef = {
|
|
8
|
+
type: 'number'
|
|
9
|
+
className: string
|
|
10
|
+
variable: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type StringPropDef = {
|
|
14
|
+
type: 'string'
|
|
15
|
+
className?: string
|
|
16
|
+
variable?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type UnionPropDef<T> = {
|
|
20
|
+
type: 'union'
|
|
21
|
+
className: string
|
|
22
|
+
values: readonly T[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type PropDef<T = unknown> = BooleanPropDef | NumberPropDef | StringPropDef | UnionPropDef<T>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Responsive<T> =
|
|
2
|
+
| T
|
|
3
|
+
| []
|
|
4
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 1})
|
|
5
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 2})
|
|
6
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 3})
|
|
7
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 4})
|
|
8
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 5})
|
|
9
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 6})
|
|
10
|
+
| ([T | undefined, ...(T | undefined)[]] & {length: 7})
|