@discourser/design-system 0.9.3 → 0.9.4
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/AbsoluteCenter.d.ts +4 -0
- package/dist/components/AbsoluteCenter.d.ts.map +1 -0
- package/dist/components/Accordion.d.ts +12 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Avatar.d.ts +17 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Badge.d.ts +13 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Button.d.ts +39 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Card.d.ts +17 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Checkbox.d.ts +507 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/CloseButton.d.ts +4 -0
- package/dist/components/CloseButton.d.ts.map +1 -0
- package/dist/components/Dialog.d.ts +16 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Drawer.d.ts +17 -0
- package/dist/components/Drawer.d.ts.map +1 -0
- package/dist/components/Group.d.ts +4 -0
- package/dist/components/Group.d.ts.map +1 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Icon.d.ts +4 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/IconButton.d.ts +5 -0
- package/dist/components/IconButton.d.ts.map +1 -0
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/InputAddon.d.ts +4 -0
- package/dist/components/InputAddon.d.ts.map +1 -0
- package/dist/components/InputGroup.d.ts +14 -0
- package/dist/components/InputGroup.d.ts.map +1 -0
- package/dist/components/Loader.d.ts +25 -0
- package/dist/components/Loader.d.ts.map +1 -0
- package/dist/components/Popover.d.ts +20 -0
- package/dist/components/Popover.d.ts.map +1 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/RadioGroup.d.ts +14 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/Select.d.ts +26 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Skeleton.d.ts +16 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Slider.d.ts +34 -0
- package/dist/components/Slider.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +4 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Switch.d.ts +10 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Tabs.d.ts +11 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Textarea.d.ts +5 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Toast.d.ts +4 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/contracts/design-language.contract.d.ts +175 -0
- package/dist/contracts/design-language.contract.d.ts.map +1 -0
- package/dist/index.d.ts +7 -21506
- package/dist/index.d.ts.map +1 -0
- package/dist/languages/index.d.ts +4 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/material3.language.d.ts +9 -0
- package/dist/languages/material3.language.d.ts.map +1 -0
- package/dist/languages/transform.d.ts +98 -0
- package/dist/languages/transform.d.ts.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/preset/colors/index.d.ts +1485 -0
- package/dist/preset/colors/index.d.ts.map +1 -0
- package/dist/preset/colors/m3-error.d.ts +295 -0
- package/dist/preset/colors/m3-error.d.ts.map +1 -0
- package/dist/preset/colors/m3-neutral.d.ts +301 -0
- package/dist/preset/colors/m3-neutral.d.ts.map +1 -0
- package/dist/preset/colors/m3-primary.d.ts +312 -0
- package/dist/preset/colors/m3-primary.d.ts.map +1 -0
- package/dist/preset/index.d.ts +3 -0
- package/dist/preset/index.d.ts.map +1 -0
- package/dist/preset/layer-styles.d.ts +6 -0
- package/dist/preset/layer-styles.d.ts.map +1 -0
- package/dist/preset/recipes/absolute-center.d.ts +2 -0
- package/dist/preset/recipes/absolute-center.d.ts.map +1 -0
- package/dist/preset/recipes/accordion.d.ts +2 -0
- package/dist/preset/recipes/accordion.d.ts.map +1 -0
- package/dist/preset/recipes/avatar.d.ts +2 -0
- package/dist/preset/recipes/avatar.d.ts.map +1 -0
- package/dist/preset/recipes/badge.d.ts +2 -0
- package/dist/preset/recipes/badge.d.ts.map +1 -0
- package/dist/preset/recipes/button.d.ts +2 -0
- package/dist/preset/recipes/button.d.ts.map +1 -0
- package/dist/preset/recipes/card.d.ts +2 -0
- package/dist/preset/recipes/card.d.ts.map +1 -0
- package/dist/preset/recipes/checkbox.d.ts +2 -0
- package/dist/preset/recipes/checkbox.d.ts.map +1 -0
- package/dist/preset/recipes/dialog.d.ts +2 -0
- package/dist/preset/recipes/dialog.d.ts.map +1 -0
- package/dist/preset/recipes/drawer.d.ts +2 -0
- package/dist/preset/recipes/drawer.d.ts.map +1 -0
- package/dist/preset/recipes/field.d.ts +2 -0
- package/dist/preset/recipes/field.d.ts.map +1 -0
- package/dist/preset/recipes/group.d.ts +2 -0
- package/dist/preset/recipes/group.d.ts.map +1 -0
- package/dist/preset/recipes/heading.d.ts +2 -0
- package/dist/preset/recipes/heading.d.ts.map +1 -0
- package/dist/preset/recipes/index.d.ts +28 -0
- package/dist/preset/recipes/index.d.ts.map +1 -0
- package/dist/preset/recipes/input-addon.d.ts +2 -0
- package/dist/preset/recipes/input-addon.d.ts.map +1 -0
- package/dist/preset/recipes/input-group.d.ts +2 -0
- package/dist/preset/recipes/input-group.d.ts.map +1 -0
- package/dist/preset/recipes/input.d.ts +114 -0
- package/dist/preset/recipes/input.d.ts.map +1 -0
- package/dist/preset/recipes/popover.d.ts +2 -0
- package/dist/preset/recipes/popover.d.ts.map +1 -0
- package/dist/preset/recipes/progress.d.ts +2 -0
- package/dist/preset/recipes/progress.d.ts.map +1 -0
- package/dist/preset/recipes/radio-group.d.ts +2 -0
- package/dist/preset/recipes/radio-group.d.ts.map +1 -0
- package/dist/preset/recipes/select.d.ts +2 -0
- package/dist/preset/recipes/select.d.ts.map +1 -0
- package/dist/preset/recipes/skeleton.d.ts +2 -0
- package/dist/preset/recipes/skeleton.d.ts.map +1 -0
- package/dist/preset/recipes/slider.d.ts +2 -0
- package/dist/preset/recipes/slider.d.ts.map +1 -0
- package/dist/preset/recipes/spinner.d.ts +2 -0
- package/dist/preset/recipes/spinner.d.ts.map +1 -0
- package/dist/preset/recipes/switch.d.ts +2 -0
- package/dist/preset/recipes/switch.d.ts.map +1 -0
- package/dist/preset/recipes/tabs.d.ts +2 -0
- package/dist/preset/recipes/tabs.d.ts.map +1 -0
- package/dist/preset/recipes/textarea.d.ts +2 -0
- package/dist/preset/recipes/textarea.d.ts.map +1 -0
- package/dist/preset/recipes/toast.d.ts +2 -0
- package/dist/preset/recipes/toast.d.ts.map +1 -0
- package/dist/preset/recipes/tooltip.d.ts +2 -0
- package/dist/preset/recipes/tooltip.d.ts.map +1 -0
- package/dist/preset/semantic-tokens.d.ts +197 -0
- package/dist/preset/semantic-tokens.d.ts.map +1 -0
- package/dist/preset/shadows.d.ts +49 -0
- package/dist/preset/shadows.d.ts.map +1 -0
- package/dist/preset/text-styles.d.ts +6 -0
- package/dist/preset/text-styles.d.ts.map +1 -0
- package/dist/recipes/button.recipe.d.ts +2 -0
- package/dist/recipes/button.recipe.d.ts.map +1 -0
- package/dist/recipes/card.recipe.d.ts +2 -0
- package/dist/recipes/card.recipe.d.ts.map +1 -0
- package/dist/recipes/dialog.recipe.d.ts +2 -0
- package/dist/recipes/dialog.recipe.d.ts.map +1 -0
- package/dist/recipes/icon-button.recipe.d.ts +2 -0
- package/dist/recipes/icon-button.recipe.d.ts.map +1 -0
- package/dist/recipes/index.d.ts +7 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/input.recipe.d.ts +2 -0
- package/dist/recipes/input.recipe.d.ts.map +1 -0
- package/dist/recipes/switch.recipe.d.ts +2 -0
- package/dist/recipes/switch.recipe.d.ts.map +1 -0
- package/dist/stories/foundations/components/ColorSwatch.d.ts +21 -0
- package/dist/stories/foundations/components/ColorSwatch.d.ts.map +1 -0
- package/dist/stories/foundations/components/ElevationCard.d.ts +11 -0
- package/dist/stories/foundations/components/ElevationCard.d.ts.map +1 -0
- package/dist/stories/foundations/components/SpacingBox.d.ts +11 -0
- package/dist/stories/foundations/components/SpacingBox.d.ts.map +1 -0
- package/dist/stories/foundations/components/TypeSpecimen.d.ts +12 -0
- package/dist/stories/foundations/components/TypeSpecimen.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/components/AbsoluteCenter.tsx +7 -0
- package/src/components/Accordion.tsx +27 -0
- package/src/components/Avatar.tsx +55 -0
- package/src/components/Badge.tsx +29 -0
- package/src/components/Button.tsx +116 -0
- package/src/components/Card.tsx +24 -0
- package/src/components/Checkbox.tsx +48 -0
- package/src/components/CloseButton.tsx +21 -0
- package/src/components/Dialog.tsx +25 -0
- package/src/components/Drawer.tsx +29 -0
- package/src/components/Group.tsx +7 -0
- package/src/components/Heading.tsx +9 -0
- package/src/components/Icon.tsx +6 -0
- package/src/components/IconButton.tsx +10 -0
- package/src/components/Input.tsx +7 -0
- package/src/components/InputAddon.tsx +7 -0
- package/src/components/InputGroup.tsx +44 -0
- package/src/components/Loader.tsx +71 -0
- package/src/components/Popover.tsx +34 -0
- package/src/components/Progress.tsx +19 -0
- package/src/components/RadioGroup.tsx +21 -0
- package/src/components/Select.tsx +70 -0
- package/src/components/Skeleton.tsx +37 -0
- package/src/components/Slider.tsx +156 -0
- package/src/components/Spinner.tsx +7 -0
- package/src/components/Switch.tsx +19 -0
- package/src/components/Tabs.tsx +17 -0
- package/src/components/Textarea.tsx +7 -0
- package/src/components/Toast.tsx +96 -0
- package/src/components/Tooltip.tsx +65 -0
- package/src/components/index.ts +48 -0
- package/src/contracts/design-language.contract.ts +198 -0
- package/src/global.css +4 -0
- package/src/index.ts +18 -0
- package/src/languages/index.ts +9 -0
- package/src/languages/material3.language.ts +379 -0
- package/src/languages/transform.ts +131 -0
- package/src/main.ts +33 -0
- package/src/preset/colors/index.ts +14 -0
- package/src/preset/colors/m3-error.ts +76 -0
- package/src/preset/colors/m3-neutral.ts +89 -0
- package/src/preset/colors/m3-primary.ts +107 -0
- package/src/preset/index.ts +189 -0
- package/src/preset/layer-styles.ts +14 -0
- package/src/preset/recipes/absolute-center.ts +37 -0
- package/src/preset/recipes/accordion.ts +92 -0
- package/src/preset/recipes/avatar.ts +152 -0
- package/src/preset/recipes/badge.ts +49 -0
- package/src/preset/recipes/button.ts +110 -0
- package/src/preset/recipes/card.ts +69 -0
- package/src/preset/recipes/checkbox.ts +109 -0
- package/src/preset/recipes/dialog.ts +157 -0
- package/src/preset/recipes/drawer.ts +203 -0
- package/src/preset/recipes/field.ts +40 -0
- package/src/preset/recipes/group.ts +77 -0
- package/src/preset/recipes/heading.ts +26 -0
- package/src/preset/recipes/index.ts +40 -0
- package/src/preset/recipes/input-addon.ts +42 -0
- package/src/preset/recipes/input-group.ts +66 -0
- package/src/preset/recipes/input.ts +87 -0
- package/src/preset/recipes/popover.ts +77 -0
- package/src/preset/recipes/progress.ts +120 -0
- package/src/preset/recipes/radio-group.ts +99 -0
- package/src/preset/recipes/select.ts +175 -0
- package/src/preset/recipes/skeleton.ts +64 -0
- package/src/preset/recipes/slider.ts +174 -0
- package/src/preset/recipes/spinner.ts +33 -0
- package/src/preset/recipes/switch.ts +136 -0
- package/src/preset/recipes/tabs.ts +177 -0
- package/src/preset/recipes/textarea.ts +82 -0
- package/src/preset/recipes/toast.ts +51 -0
- package/src/preset/recipes/tooltip.ts +38 -0
- package/src/preset/semantic-tokens.ts +75 -0
- package/src/preset/shadows.ts +50 -0
- package/src/preset/text-styles.ts +21 -0
- package/src/recipes/button.recipe.ts +120 -0
- package/src/recipes/card.recipe.ts +50 -0
- package/src/recipes/dialog.recipe.ts +130 -0
- package/src/recipes/icon-button.recipe.ts +96 -0
- package/src/recipes/index.ts +6 -0
- package/src/recipes/input.recipe.ts +93 -0
- package/src/recipes/switch.recipe.ts +117 -0
- package/src/stories/foundations/Colors.mdx +380 -0
- package/src/stories/foundations/Elevation.mdx +292 -0
- package/src/stories/foundations/Spacing.mdx +223 -0
- package/src/stories/foundations/Typography.mdx +264 -0
- package/src/stories/foundations/components/ColorSwatch.tsx +166 -0
- package/src/stories/foundations/components/ElevationCard.tsx +81 -0
- package/src/stories/foundations/components/SpacingBox.tsx +94 -0
- package/src/stories/foundations/components/TypeSpecimen.tsx +117 -0
- package/src/test/setup.ts +12 -0
- package/src/test/vitest.d.ts +29 -0
- package/src/utils/cn.ts +8 -0
- package/src/vite-env.d.ts +1 -0
- package/dist/index.d.cts +0 -21506
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ElevationCardProps {
|
|
4
|
+
level: string;
|
|
5
|
+
shadow: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ElevationCard = ({ level, shadow }: ElevationCardProps) => {
|
|
9
|
+
const containerStyle: CSSProperties = {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
marginBottom: '32px',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const cardStyle: CSSProperties = {
|
|
17
|
+
width: '200px',
|
|
18
|
+
height: '120px',
|
|
19
|
+
backgroundColor: '#fff',
|
|
20
|
+
borderRadius: '12px',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
marginBottom: '16px',
|
|
25
|
+
boxShadow: shadow === 'none' ? 'none' : shadow,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const labelStyle: CSSProperties = {
|
|
29
|
+
fontSize: '16px',
|
|
30
|
+
fontWeight: '600',
|
|
31
|
+
fontFamily: 'Inter, sans-serif',
|
|
32
|
+
marginBottom: '8px',
|
|
33
|
+
color: '#333',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const shadowValueStyle: CSSProperties = {
|
|
37
|
+
fontSize: '11px',
|
|
38
|
+
fontFamily: 'monospace',
|
|
39
|
+
color: '#666',
|
|
40
|
+
maxWidth: '300px',
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
wordBreak: 'break-word',
|
|
43
|
+
lineHeight: '1.5',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div style={containerStyle}>
|
|
48
|
+
<div style={labelStyle}>{level}</div>
|
|
49
|
+
<div style={cardStyle}>
|
|
50
|
+
<span style={{ color: '#999', fontSize: '14px' }}>
|
|
51
|
+
{level === 'level0' ? 'No shadow' : 'Elevation'}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
<div style={shadowValueStyle}>{shadow === 'none' ? 'none' : shadow}</div>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
interface ElevationGridProps {
|
|
60
|
+
elevations: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const ElevationGrid = ({ elevations }: ElevationGridProps) => {
|
|
64
|
+
const gridStyle: CSSProperties = {
|
|
65
|
+
display: 'grid',
|
|
66
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',
|
|
67
|
+
gap: '48px',
|
|
68
|
+
marginTop: '32px',
|
|
69
|
+
padding: '32px',
|
|
70
|
+
backgroundColor: '#f5f5f5',
|
|
71
|
+
borderRadius: '8px',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div style={gridStyle}>
|
|
76
|
+
{Object.entries(elevations).map(([level, shadow]) => (
|
|
77
|
+
<ElevationCard key={level} level={level} shadow={shadow} />
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SpacingBoxProps {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const SpacingBox = ({ name, value }: SpacingBoxProps) => {
|
|
9
|
+
const containerStyle: CSSProperties = {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
marginBottom: '24px',
|
|
13
|
+
gap: '16px',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const labelContainerStyle: CSSProperties = {
|
|
17
|
+
minWidth: '120px',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const nameStyle: CSSProperties = {
|
|
23
|
+
fontSize: '14px',
|
|
24
|
+
fontWeight: '500',
|
|
25
|
+
fontFamily: 'Inter, sans-serif',
|
|
26
|
+
marginBottom: '4px',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const valueStyle: CSSProperties = {
|
|
30
|
+
fontSize: '12px',
|
|
31
|
+
fontFamily: 'monospace',
|
|
32
|
+
color: '#666',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const boxContainerStyle: CSSProperties = {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
flex: 1,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const boxStyle: CSSProperties = {
|
|
42
|
+
width: value,
|
|
43
|
+
height: '40px',
|
|
44
|
+
backgroundColor: '#4C662B',
|
|
45
|
+
borderRadius: '4px',
|
|
46
|
+
position: 'relative',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const dimensionStyle: CSSProperties = {
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
top: '-20px',
|
|
52
|
+
left: '0',
|
|
53
|
+
right: '0',
|
|
54
|
+
fontSize: '10px',
|
|
55
|
+
fontFamily: 'monospace',
|
|
56
|
+
color: '#999',
|
|
57
|
+
textAlign: 'center',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div style={containerStyle}>
|
|
62
|
+
<div style={labelContainerStyle}>
|
|
63
|
+
<div style={nameStyle}>{name}</div>
|
|
64
|
+
<div style={valueStyle}>{value}</div>
|
|
65
|
+
</div>
|
|
66
|
+
<div style={boxContainerStyle}>
|
|
67
|
+
<div style={boxStyle}>
|
|
68
|
+
<div style={dimensionStyle}>{value}</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
interface SpacingGridProps {
|
|
76
|
+
spacings: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const SpacingGrid = ({ spacings }: SpacingGridProps) => {
|
|
80
|
+
const gridStyle: CSSProperties = {
|
|
81
|
+
display: 'grid',
|
|
82
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))',
|
|
83
|
+
gap: '32px',
|
|
84
|
+
marginTop: '24px',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div style={gridStyle}>
|
|
89
|
+
{Object.entries(spacings).map(([name, value]) => (
|
|
90
|
+
<SpacingBox key={name} name={name} value={value} />
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface TypeSpecimenProps {
|
|
4
|
+
name: string;
|
|
5
|
+
fontSize: string;
|
|
6
|
+
lineHeight: string;
|
|
7
|
+
fontWeight: string;
|
|
8
|
+
letterSpacing: string;
|
|
9
|
+
fontFamily: string;
|
|
10
|
+
sampleText?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const TypeSpecimen = ({
|
|
14
|
+
name,
|
|
15
|
+
fontSize,
|
|
16
|
+
lineHeight,
|
|
17
|
+
fontWeight,
|
|
18
|
+
letterSpacing,
|
|
19
|
+
fontFamily,
|
|
20
|
+
sampleText = 'The quick brown fox jumps over the lazy dog',
|
|
21
|
+
}: TypeSpecimenProps) => {
|
|
22
|
+
const containerStyle: CSSProperties = {
|
|
23
|
+
marginBottom: '32px',
|
|
24
|
+
paddingBottom: '24px',
|
|
25
|
+
borderBottom: '1px solid #e0e0e0',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const headerStyle: CSSProperties = {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
alignItems: 'baseline',
|
|
32
|
+
marginBottom: '12px',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const nameStyle: CSSProperties = {
|
|
36
|
+
fontSize: '16px',
|
|
37
|
+
fontWeight: '600',
|
|
38
|
+
fontFamily: 'Inter, sans-serif',
|
|
39
|
+
color: '#333',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const specimenStyle: CSSProperties = {
|
|
43
|
+
fontSize,
|
|
44
|
+
lineHeight,
|
|
45
|
+
fontWeight,
|
|
46
|
+
letterSpacing,
|
|
47
|
+
fontFamily: getFontFamilyString(fontFamily),
|
|
48
|
+
marginBottom: '16px',
|
|
49
|
+
color: '#000',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const propertiesStyle: CSSProperties = {
|
|
53
|
+
display: 'grid',
|
|
54
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
|
|
55
|
+
gap: '12px',
|
|
56
|
+
fontSize: '12px',
|
|
57
|
+
fontFamily: 'monospace',
|
|
58
|
+
color: '#666',
|
|
59
|
+
backgroundColor: '#f5f5f5',
|
|
60
|
+
padding: '12px',
|
|
61
|
+
borderRadius: '4px',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const propertyStyle: CSSProperties = {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const propertyLabelStyle: CSSProperties = {
|
|
70
|
+
fontSize: '10px',
|
|
71
|
+
textTransform: 'uppercase',
|
|
72
|
+
color: '#999',
|
|
73
|
+
marginBottom: '4px',
|
|
74
|
+
fontWeight: '600',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div style={containerStyle}>
|
|
79
|
+
<div style={headerStyle}>
|
|
80
|
+
<div style={nameStyle}>{name}</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div style={specimenStyle}>{sampleText}</div>
|
|
83
|
+
<div style={propertiesStyle}>
|
|
84
|
+
<div style={propertyStyle}>
|
|
85
|
+
<div style={propertyLabelStyle}>Font Size</div>
|
|
86
|
+
<div>{fontSize}</div>
|
|
87
|
+
</div>
|
|
88
|
+
<div style={propertyStyle}>
|
|
89
|
+
<div style={propertyLabelStyle}>Line Height</div>
|
|
90
|
+
<div>{lineHeight}</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div style={propertyStyle}>
|
|
93
|
+
<div style={propertyLabelStyle}>Font Weight</div>
|
|
94
|
+
<div>{fontWeight}</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div style={propertyStyle}>
|
|
97
|
+
<div style={propertyLabelStyle}>Letter Spacing</div>
|
|
98
|
+
<div>{letterSpacing}</div>
|
|
99
|
+
</div>
|
|
100
|
+
<div style={propertyStyle}>
|
|
101
|
+
<div style={propertyLabelStyle}>Font Family</div>
|
|
102
|
+
<div>{fontFamily}</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
function getFontFamilyString(family: string): string {
|
|
110
|
+
const fontFamilies = {
|
|
111
|
+
display: '"Fraunces", Georgia, "Times New Roman", serif',
|
|
112
|
+
body: '"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
113
|
+
mono: '"JetBrains Mono", "Fira Code", Consolas, monospace',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return fontFamilies[family as keyof typeof fontFamilies] || family;
|
|
117
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { expect, afterEach } from 'vitest';
|
|
3
|
+
import { cleanup } from '@testing-library/react';
|
|
4
|
+
import { toHaveNoViolations } from 'jest-axe';
|
|
5
|
+
|
|
6
|
+
// Extend Vitest's expect with jest-axe matchers
|
|
7
|
+
expect.extend(toHaveNoViolations);
|
|
8
|
+
|
|
9
|
+
// Cleanup after each test
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
cleanup();
|
|
12
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="vitest/globals" />
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
|
|
4
|
+
// jest-axe types for Vitest
|
|
5
|
+
interface AxeMatchers<R = void> {
|
|
6
|
+
toHaveNoViolations(): R;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'vitest' {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
interface Assertion<T = any> extends AxeMatchers<T> {}
|
|
12
|
+
interface AsymmetricMatchersContaining extends AxeMatchers {}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Declare jest-axe module since it doesn't have proper TS types for Vitest
|
|
16
|
+
declare module 'jest-axe' {
|
|
17
|
+
import type { AxeResults, RunOptions, Spec } from 'axe-core';
|
|
18
|
+
|
|
19
|
+
export function axe(
|
|
20
|
+
html: Element | string,
|
|
21
|
+
options?: RunOptions & { globalOptions?: Spec }
|
|
22
|
+
): Promise<AxeResults>;
|
|
23
|
+
|
|
24
|
+
export const toHaveNoViolations: {
|
|
25
|
+
toHaveNoViolations(results: AxeResults): { pass: boolean; message(): string };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function configureAxe(options?: RunOptions & { globalOptions?: Spec }): typeof axe;
|
|
29
|
+
}
|
package/src/utils/cn.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|