cetec-design-system 0.0.4 → 0.0.6

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.
@@ -0,0 +1,185 @@
1
+ import { defineRecipe } from '@pandacss/dev';
2
+ import {
3
+ fontSizes as fontSizeTokens,
4
+ fontWeights as fontWeightTokens,
5
+ } from '~/styles/tokens';
6
+
7
+ const textBase = {
8
+ margin: '0',
9
+ lineHeight: 'default',
10
+ fontWeight: 'normal',
11
+ fontSize: '16',
12
+ color: { base: 'slate.60', _dark: 'slate.30' },
13
+ };
14
+
15
+ type FontSizeKey = keyof typeof fontSizeTokens;
16
+ const fontSizes = (Object.keys(fontSizeTokens) as FontSizeKey[]).reduce(
17
+ (accumulator, currentKey) => {
18
+ accumulator[currentKey] = { fontSize: fontSizeTokens[currentKey].value };
19
+ return accumulator;
20
+ },
21
+ {} as Record<FontSizeKey, Record<'fontSize', string>>,
22
+ );
23
+
24
+ type FontWeightKey = keyof typeof fontWeightTokens;
25
+ const fontWeights = (Object.keys(fontWeightTokens) as FontWeightKey[]).reduce(
26
+ (accumulator, currentKey) => {
27
+ accumulator[currentKey] = {
28
+ fontWeight: fontWeightTokens[currentKey].value,
29
+ };
30
+ return accumulator;
31
+ },
32
+ {} as Record<FontWeightKey, Record<'fontWeight', number>>,
33
+ );
34
+
35
+ const textVariants = {
36
+ textStyle: {
37
+ 'display-lg': { textStyle: 'display.lg' },
38
+ 'display-md': { textStyle: 'display.md' },
39
+ 'display-sm': { textStyle: 'display.sm' },
40
+ 'display-xs': { textStyle: 'display.xs' },
41
+ 'heading-lg': { textStyle: 'heading.lg' },
42
+ 'heading-md': { textStyle: 'heading.md' },
43
+ 'heading-sm': { textStyle: 'heading.sm' },
44
+ 'heading-xs': { textStyle: 'heading.xs' },
45
+ 'body-lg': { textStyle: 'body.lg' },
46
+ 'body-md': { textStyle: 'body.md' },
47
+ 'body-sm': { textStyle: 'body.sm' },
48
+ 'body-xs': { textStyle: 'body.xs' },
49
+ 'mono-lg': { textStyle: 'mono.lg' },
50
+ 'mono-md': { textStyle: 'mono.md' },
51
+ 'mono-sm': { textStyle: 'mono.sm' },
52
+ 'mono-xs': { textStyle: 'mono.xs' },
53
+ },
54
+ family: {
55
+ heading: { fontFamily: 'heading' },
56
+ body: { fontFamily: 'body' },
57
+ mono: {
58
+ fontFamily: 'mono',
59
+ fontVariationSettings: '"CRSV" 0, "CASL" 0, "MONO" 1',
60
+ },
61
+ },
62
+ bold: {
63
+ true: {
64
+ fontWeight: 'bold',
65
+ },
66
+ },
67
+ italic: {
68
+ true: {
69
+ fontStyle: 'italic',
70
+ fontVariationSettings: '"CRSV" 0, "CASL" 0, "slnt" -15',
71
+ },
72
+ },
73
+ underline: {
74
+ true: {
75
+ textDecoration: 'underline',
76
+ },
77
+ },
78
+ size: fontSizes,
79
+ weight: fontWeights,
80
+ };
81
+
82
+ const headingBase = {
83
+ fontFamily: 'heading',
84
+ fontWeight: 'black',
85
+ color: { base: 'slate.90', _dark: 'slate.5' },
86
+ lineHeight: 'default',
87
+ };
88
+
89
+ const headingVariants = {
90
+ level: {
91
+ h1: { textStyle: 'heading.lg' },
92
+ h2: { textStyle: 'heading.md' },
93
+ h3: { textStyle: 'heading.sm' },
94
+ h4: { textStyle: 'heading.xs' },
95
+ },
96
+ };
97
+
98
+ const linkBase = {
99
+ display: 'inline-flex',
100
+ alignItems: 'center',
101
+ fontWeight: 'medium',
102
+ gap: '1',
103
+ color: { base: 'blue.50', _dark: 'blue.40' },
104
+ textDecoration: 'none',
105
+ backgroundImage: 'linear-gradient(90deg, transparent 0% 100%)',
106
+ backgroundSize: '100% 1px',
107
+ backgroundRepeat: 'no-repeat',
108
+ backgroundPositionY: '100%',
109
+ width: 'fit-content',
110
+ cursor: 'pointer',
111
+ _hover: {
112
+ color: { base: 'blue.40', _dark: 'blue.30' },
113
+ backgroundImage: 'linear-gradient(90deg, currentColor 0% 100%)',
114
+ },
115
+ };
116
+
117
+ const linkVariants = {
118
+ ...textVariants,
119
+ _disabled: {
120
+ true: {
121
+ cursor: 'not-allowed',
122
+ opacity: 0.7,
123
+ pointerEvents: 'none',
124
+ },
125
+ },
126
+ };
127
+
128
+ const labelBase = {
129
+ fontSize: '14',
130
+ fontWeight: 'normal',
131
+ lineHeight: 'normal',
132
+ cursor: 'default',
133
+ };
134
+
135
+ //Copied linkvarients, don't have styles defined for this yet
136
+ const labelVariants = {
137
+ ...textVariants,
138
+ _disabled: {
139
+ true: {
140
+ cursor: 'not-allowed',
141
+ opacity: 0.7,
142
+ pointerEvents: 'none',
143
+ },
144
+ },
145
+ };
146
+
147
+ export const textRecipe = defineRecipe({
148
+ className: 'text',
149
+ jsx: ['Text'],
150
+ base: textBase,
151
+ variants: textVariants,
152
+ defaultVariants: {
153
+ textStyle: 'body-md',
154
+ },
155
+ });
156
+
157
+ export const headingRecipe = defineRecipe({
158
+ className: 'heading',
159
+ jsx: ['Heading'],
160
+ base: headingBase,
161
+ variants: headingVariants,
162
+ defaultVariants: {
163
+ level: 'h2',
164
+ },
165
+ });
166
+
167
+ export const linkRecipe = defineRecipe({
168
+ className: 'link',
169
+ jsx: ['Link'],
170
+ base: linkBase,
171
+ variants: linkVariants,
172
+ defaultVariants: {
173
+ family: 'body',
174
+ },
175
+ });
176
+
177
+ export const labelRecipe = defineRecipe({
178
+ className: 'label',
179
+ jsx: ['Label'],
180
+ base: labelBase,
181
+ variants: labelVariants,
182
+ defaultVariants: {
183
+ family: 'body',
184
+ },
185
+ });
@@ -0,0 +1,77 @@
1
+ import { defineRecipe } from '@pandacss/dev';
2
+
3
+ const textareaBase = {
4
+ position: 'relative',
5
+ display: 'inline-grid',
6
+ verticalAlign: 'top',
7
+ alignItems: 'center',
8
+ padding: '0',
9
+ fontFamily: 'body',
10
+ fontSize: '16',
11
+ fontWeight: 'normal',
12
+ lineHeight: 'normal',
13
+ color: { base: 'slate.90', _osDark: 'slate.5' },
14
+ borderRadius: '8',
15
+ width: 'full',
16
+ '&::after, & textarea': {
17
+ width: 'auto',
18
+ minWidth: '16',
19
+ maxWidth: 'full',
20
+ font: 'inherit',
21
+ py: '4',
22
+ px: '8',
23
+ m: '0',
24
+ resize: 'none',
25
+ appearance: 'none',
26
+ borderWidth: '1',
27
+ borderStyle: 'solid',
28
+ borderRadius: '4',
29
+ borderColor: 'transparent',
30
+ background: { base: 'slate.0', _osDark: 'slate.90' },
31
+ _hover: {
32
+ borderColor: { base: 'slate.20', _osDark: 'slate.30' },
33
+ },
34
+ _focus: {
35
+ borderColor: { base: 'slate.90', _osDark: 'slate.5' },
36
+ },
37
+ },
38
+ _after: {
39
+ content: 'attr(data-value) " "',
40
+ outline: '1px solid olive',
41
+ whiteSpace: 'pre-wrap',
42
+ transform: 'translate(4px, 4px)',
43
+ opacity: '0.3',
44
+ },
45
+ '& textarea': {},
46
+ gridTemplateColumns: 'auto 1fr',
47
+ };
48
+
49
+ const textareaVariants = {
50
+ variant: {
51
+ autoGrow: {
52
+ width: 'fit-content',
53
+ },
54
+ stacked: {
55
+ gridTemplateRows: 'auto 1fr',
56
+ alignItems: 'stretch',
57
+ '&::after, & textarea': {
58
+ gridArea: '2 / 1',
59
+ },
60
+ '& textarea': {
61
+ background: { base: 'slate.0', _osDark: 'slate.90' },
62
+ borderColor: { base: 'slate.40', _osDark: 'slate.50' },
63
+ },
64
+ },
65
+ internalLabel: {},
66
+ },
67
+ };
68
+
69
+ export const textareaRecipe = defineRecipe({
70
+ className: 'textarea',
71
+ jsx: ['Textarea'],
72
+ base: textareaBase,
73
+ variants: textareaVariants,
74
+ defaultVariants: {
75
+ variant: 'autoGrow',
76
+ },
77
+ });
@@ -0,0 +1,108 @@
1
+ export const conditions = {
2
+ hover: '&:is(:hover, [data-hover])',
3
+ focus: '&:is(:focus, [data-focus])',
4
+ focusWithin: '&:focus-within',
5
+ focusVisible: '&:is(:focus-visible, [data-focus-visible])',
6
+ disabled: '&:is(:disabled, [disabled], [data-disabled])',
7
+ error: '&:is([data-error], [error])',
8
+ active: '&:is(:active, [data-active])',
9
+ visited: '&:visited',
10
+ target: '&:target',
11
+ readOnly: '&:is(:read-only, [data-read-only])',
12
+ readWrite: '&:read-write',
13
+ empty: '&:is(:empty, [data-empty])',
14
+ checked: '&:is(:checked, [data-checked], [aria-checked=true], [data-state="checked"])',
15
+ // checked: '&:has(+ input[type=checkbox]:checked)',
16
+ enabled: '&:enabled',
17
+ expanded: '&:is([aria-expanded=true], [data-expanded], [data-state="expanded"])',
18
+ highlighted: '&[data-highlighted]',
19
+
20
+ before: '&::before',
21
+ after: '&::after',
22
+ firstLetter: '&::first-letter',
23
+ firstLine: '&::first-line',
24
+ marker: '&::marker',
25
+ selection: '&::selection',
26
+ file: '&::file-selector-button',
27
+ backdrop: '&::backdrop',
28
+
29
+ first: '&:first-child',
30
+ last: '&:last-child',
31
+ only: '&:only-child',
32
+ even: '&:nth-child(even)',
33
+ odd: '&:nth-child(odd)',
34
+
35
+ firstOfType: '&:first-of-type',
36
+ lastOfType: '&:last-of-type',
37
+ onlyOfType: '&:only-of-type',
38
+
39
+ peerFocus: '.peer:is(:focus, [data-focus]) ~ &',
40
+ peerHover: '.peer:is(:hover, [data-hover]) ~ &',
41
+ peerActive: '.peer:is(:active, [data-active]) ~ &',
42
+ peerFocusWithin: '.peer:focus-within ~ &',
43
+ peerFocusVisible: '.peer:is(:focus-visible, [data-focus-visible]) ~ &',
44
+ peerDisabled: '.peer:is(:disabled, [disabled], [data-disabled]) ~ &',
45
+ peerChecked: '.peer:is(:checked, [data-checked], [aria-checked=true], [data-state="checked"]) ~ &',
46
+ peerInvalid: '.peer:is(:invalid, [data-invalid], [aria-invalid=true]) ~ &',
47
+ peerExpanded: '.peer:is([aria-expanded=true], [data-expanded], [data-state="expanded"]) ~ &',
48
+ peerPlaceholderShown: '.peer:placeholder-shown ~ &',
49
+
50
+ groupFocus: '.group:is(:focus, [data-focus]) &',
51
+ groupHover: '.group:is(:hover, [data-hover]) &',
52
+ groupActive: '.group:is(:active, [data-active]) &',
53
+ groupFocusWithin: '.group:focus-within &',
54
+ groupFocusVisible: '.group:is(:focus-visible, [data-focus-visible]) &',
55
+ groupDisabled: '.group:is(:disabled, [disabled], [data-disabled]) &',
56
+ groupChecked: '.group:is(:checked, [data-checked], [aria-checked=true], [data-state="checked"]) &',
57
+ groupExpanded: '.group:is([aria-expanded=true], [data-expanded], [data-state="expanded"]) &',
58
+ groupInvalid: '.group:invalid &',
59
+
60
+ indeterminate: '&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed], [data-state="indeterminate"])',
61
+ required: '&:is(:required, [data-required], [aria-required=true])',
62
+ valid: '&:is(:valid, [data-valid])',
63
+ invalid: '&:is(:invalid, [data-invalid])',
64
+ autofill: '&:autofill',
65
+ inRange: '&:in-range',
66
+ outOfRange: '&:out-of-range',
67
+ placeholder: '&::placeholder, &[data-placeholder]',
68
+ placeholderShown: '&:is(:placeholder-shown, [data-placeholder-shown])',
69
+ pressed: '&:is([aria-pressed=true], [data-pressed])',
70
+ selected: '&:is([aria-selected=true], [data-selected])',
71
+
72
+ default: '&:default',
73
+ optional: '&:optional',
74
+ open: '&:is([open], [data-open], [data-state="open"])',
75
+ closed: '&:is([closed], [data-closed], [data-state="closed"])',
76
+ fullscreen: '&:fullscreen',
77
+ loading: '&:is([data-loading], [aria-busy=true])',
78
+
79
+ currentPage: '&[aria-current=page]',
80
+ currentStep: '&[aria-current=step]',
81
+
82
+ motionReduce: '@media (prefers-reduced-motion: reduce)',
83
+ motionSafe: '@media (prefers-reduced-motion: no-preference)',
84
+ print: '@media print',
85
+ landscape: '@media (orientation: landscape)',
86
+ portrait: '@media (orientation: portrait)',
87
+
88
+ dark: '.dark &, [data-color-mode=dark] &',
89
+ light: '.light &, [data-color-mode=light] &',
90
+ osDark: '@media (prefers-color-scheme: dark)',
91
+ osLight: '@media (prefers-color-scheme: light)',
92
+
93
+ highContrast: '@media (forced-colors: active)',
94
+ lessContrast: '@media (prefers-contrast: less)',
95
+ moreContrast: '@media (prefers-contrast: more)',
96
+
97
+ ltr: '[dir=ltr] &',
98
+ rtl: '[dir=rtl] &',
99
+
100
+ scrollbar: '&::-webkit-scrollbar',
101
+ scrollbarThumb: '&::-webkit-scrollbar-thumb',
102
+ scrollbarTrack: '&::-webkit-scrollbar-track',
103
+
104
+ horizontal: '&[data-orientation=horizontal]',
105
+ vertical: '&[data-orientation=vertical]',
106
+
107
+ starting: '@starting-style',
108
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ --------------------
3
+ Font imports
4
+ --------------------
5
+ */
6
+
7
+ @layer base {
8
+ /* ruda-latin-wght-normal */
9
+ @font-face {
10
+ font-family: 'Ruda Variable';
11
+ font-style: normal;
12
+ font-display: swap;
13
+ font-weight: 400 900;
14
+ src: url(@fontsource-variable/ruda/files/ruda-latin-wght-normal.woff2)
15
+ format('woff2-variations');
16
+ unicode-range:
17
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
18
+ U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
19
+ U+2212, U+2215, U+FEFF, U+FFFD;
20
+ }
21
+ /* recursive-latin-wght-normal */
22
+ /* https://www.recursive.design/ */
23
+ @font-face {
24
+ font-family: 'Recursive Variable';
25
+ font-style: oblique 0deg 15deg;
26
+ font-display: swap;
27
+ font-weight: 300 1000;
28
+ src: url(@fontsource-variable/recursive/files/recursive-latin-full-normal.woff2)
29
+ format('woff2-variations');
30
+ unicode-range:
31
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
32
+ U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
33
+ U+2212, U+2215, U+FEFF, U+FFFD;
34
+ }
35
+ }
@@ -0,0 +1,85 @@
1
+ import { defineGlobalStyles } from '@pandacss/dev';
2
+
3
+ // includes some normalize styles from:
4
+ // https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css
5
+
6
+ export const globalCss = defineGlobalStyles({
7
+ '*, *::before, *::after': {
8
+ boxSizing: 'border-box',
9
+ margin: 0,
10
+ padding: 0,
11
+ _focusVisible: {
12
+ outlineColor: { base: 'slate.80', _dark: 'slate.5' },
13
+ },
14
+ },
15
+ html: {
16
+ fontSize: '16',
17
+ lineHeight: 'calc(1em + 0.5rem)',
18
+ '-webkit-text-size-adjust': '100%',
19
+ tabSize: '4',
20
+ },
21
+ body: {
22
+ fontFamily: 'body',
23
+ fontVariationSettings: '"CRSV" 0, "CASL" 0',
24
+ bg: { base: 'slate.0', _dark: 'slate.90' },
25
+ color: { base: 'slate.60', _dark: 'slate.20' },
26
+ fontWeight: 'normal',
27
+ },
28
+ 'h1, h2, h3, h4, h5, h6': {
29
+ color: { base: 'slate.90', _dark: 'slate.5' },
30
+ fontWeight: 'black',
31
+ lineHeight: 'calc(1em + 0.5rem)',
32
+ },
33
+ p: {
34
+ marginBottom: '0.5rem',
35
+ },
36
+ 'b, strong': {
37
+ fontWeight: 'bold',
38
+ },
39
+ 'i, em': {
40
+ fontStyle: 'italic',
41
+ fontVariationSettings: '"CRSV" 0, "CASL" 0, "slnt" -15',
42
+ },
43
+ u: {
44
+ textDecoration: 'underline',
45
+ },
46
+ 'code, kbd, samp, pre': {
47
+ fontFamily: 'mono',
48
+ fontSize: '1em',
49
+ },
50
+ table: {
51
+ borderColor: 'currentcolor',
52
+ },
53
+ 'button, input, optgroup, select, textarea': {
54
+ fontFamily: 'inherit',
55
+ fontSize: '100%',
56
+ lineHeight: '1.15',
57
+ margin: '0',
58
+ },
59
+ 'button, [type="button"], [type="reset"], [type="submit"]': {
60
+ '-webkit-appearance': 'button',
61
+ },
62
+ legend: {
63
+ padding: '0',
64
+ },
65
+ progress: {
66
+ verticalAlign: 'baseline',
67
+ },
68
+ '::-webkit-inner-spin-button, ::-webkit-outer-spin-button': {
69
+ height: 'auto',
70
+ },
71
+ '[type="search"]': {
72
+ '-webkit-appearance': 'textfield',
73
+ outlineOffset: '-2px',
74
+ },
75
+ '::-webkit-search-decoration': {
76
+ '-webkit-appearance': 'none',
77
+ },
78
+ '::-webkit-file-upload-button': {
79
+ '-webkit-appearance': 'button',
80
+ font: 'inherit',
81
+ },
82
+ summary: {
83
+ display: 'list-item',
84
+ },
85
+ });
@@ -0,0 +1,3 @@
1
+ @layer reset, base, tokens, recipes, utilities;
2
+
3
+ @import 'font-imports.css';
@@ -0,0 +1,110 @@
1
+ export const colors = {
2
+ brand: {
3
+ slate: { value: '{colors.slate.90}' },
4
+ gold: { value: '{colors.gold.20}' },
5
+ },
6
+ success: {
7
+ lighter: {
8
+ value: {
9
+ base: '{colors.green.2}',
10
+ _dark: '{colors.green.5}',
11
+ },
12
+ },
13
+ light: {
14
+ value: {
15
+ base: '{colors.green.10}',
16
+ _dark: '{colors.green.20}',
17
+ },
18
+ },
19
+ default: {
20
+ value: {
21
+ base: '{colors.green.40}',
22
+ _dark: '{colors.green.30}',
23
+ },
24
+ },
25
+ dark: {
26
+ value: {
27
+ base: '{colors.green.60}',
28
+ _dark: '{colors.green.60}',
29
+ },
30
+ },
31
+ darker: {
32
+ value: {
33
+ base: '{colors.green.70}',
34
+ _dark: '{colors.green.70}',
35
+ },
36
+ },
37
+ },
38
+ warning: {
39
+ lighter: {
40
+ value: {
41
+ base: '{colors.yellow.2}',
42
+ _dark: '{colors.yellow.2}',
43
+ },
44
+ },
45
+ light: {
46
+ value: {
47
+ base: '{colors.yellow.10}',
48
+ _dark: '{colors.yellow.10}',
49
+ },
50
+ },
51
+ default: {
52
+ value: {
53
+ base: '{colors.yellow.30}',
54
+ _dark: '{colors.yellow.20}',
55
+ },
56
+ },
57
+ dark: {
58
+ value: {
59
+ base: '{colors.yellow.60}',
60
+ _dark: '{colors.yellow.60}',
61
+ },
62
+ },
63
+ darker: {
64
+ value: {
65
+ base: '{colors.yellow.70}',
66
+ _dark: '{colors.yellow.70}',
67
+ },
68
+ },
69
+ },
70
+ error: {
71
+ lighter: {
72
+ value: {
73
+ base: '{colors.red.2}',
74
+ _dark: '{colors.red.5}',
75
+ },
76
+ },
77
+ light: {
78
+ value: {
79
+ base: '{colors.red.10}',
80
+ _dark: '{colors.red.20}',
81
+ },
82
+ },
83
+ default: {
84
+ value: {
85
+ base: '{colors.red.50}',
86
+ _dark: '{colors.red.40}',
87
+ },
88
+ },
89
+ dark: {
90
+ value: {
91
+ base: '{colors.red.60}',
92
+ _dark: '{colors.red.60}',
93
+ },
94
+ },
95
+ darker: {
96
+ value: {
97
+ base: '{colors.red.70}',
98
+ _dark: '{colors.red.70}',
99
+ },
100
+ },
101
+ },
102
+ utility: {
103
+ shadowColor: {
104
+ value: {
105
+ base: '{colors.slate.90/20}',
106
+ _dark: '{colors.slate.100/40}',
107
+ },
108
+ },
109
+ },
110
+ };