@ndla/preset-panda 0.0.1

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,227 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { defineTokens } from "@pandacss/dev";
10
+ export const animations = defineTokens.animations({
11
+ spin: {
12
+ value: "spin 700ms infinite linear"
13
+ },
14
+ "collapse-in": {
15
+ value: "collapse-in 250ms {easings.emphasized-in}"
16
+ },
17
+ "collapse-out": {
18
+ value: "collapse-out 200ms {easings.emphasized-out}"
19
+ },
20
+ "fade-shift-in": {
21
+ value: "fade-shift-in 200ms {easings.emphasized-in}"
22
+ },
23
+ "fade-shift-out": {
24
+ value: "fade-shift-in 200ms {easings.emphasized-in}"
25
+ },
26
+ "backdrop-in": {
27
+ value: "fade-in 250ms {easings.emphasized-in}"
28
+ },
29
+ "backdrop-out": {
30
+ value: "fade-out 200ms {easings.emphasized-out}"
31
+ },
32
+ "dialog-in": {
33
+ value: "fade-in 400ms {easings.emphasized-in}"
34
+ },
35
+ "dialog-out": {
36
+ value: "fade-out 200ms {easings.emphasized-out}"
37
+ },
38
+ "drawer-in-left": {
39
+ value: "slide-in-left 400ms {easings.emphasized-in}"
40
+ },
41
+ "drawer-out-left": {
42
+ value: "slide-out-left 200ms {easings.emphasized-out}"
43
+ },
44
+ "drawer-in-right": {
45
+ value: "slide-in-right 400ms {easings.emphasized-in}"
46
+ },
47
+ "drawer-out-right": {
48
+ value: "slide-out-right 200ms {easings.emphasized-out}"
49
+ },
50
+ "drawer-in-bottom": {
51
+ value: "slide-in-bottom 400ms {easings.emphasized-in}"
52
+ },
53
+ "drawer-out-bottom": {
54
+ value: "slide-out-bottom 200ms {easings.emphasized-out}"
55
+ },
56
+ "drawer-in-top": {
57
+ value: "slide-in-top 400ms {easings.emphasized-in}"
58
+ },
59
+ "drawer-out-top": {
60
+ value: "slide-out-top 200ms {easings.emphasized-out}"
61
+ },
62
+ "skeleton-pulse": {
63
+ value: "skeleton-pulse 2s {easings.pulse} infinite"
64
+ }
65
+ });
66
+ export const easings = defineTokens.easings({
67
+ default: {
68
+ value: "cubic-bezier(0.17, 0.04, 0.03, 0.94)"
69
+ },
70
+ "emphasized-in": {
71
+ value: "cubic-bezier(0.05, 0.7, 0.1, 1.0)"
72
+ },
73
+ "emphasized-out": {
74
+ value: "cubic-bezier(0.3, 0.0, 0.8, 0.15)"
75
+ },
76
+ pulse: {
77
+ value: "cubic-bezier(0.4, 0.0, 0.6, 1.0)"
78
+ }
79
+ });
80
+ export const durations = defineTokens.durations({
81
+ superFast: {
82
+ value: "100ms"
83
+ },
84
+ fast: {
85
+ value: "200ms"
86
+ },
87
+ normal: {
88
+ value: "400ms"
89
+ },
90
+ slow: {
91
+ value: "600ms"
92
+ },
93
+ infinite: {
94
+ value: "infinite"
95
+ }
96
+ });
97
+ export const keyframes = {
98
+ spin: {
99
+ from: {
100
+ transform: "rotate(0deg)"
101
+ },
102
+ to: {
103
+ transform: "rotate(360deg)"
104
+ }
105
+ },
106
+ "fade-shift-in": {
107
+ "0%": {
108
+ opacity: "0",
109
+ transform: "translateY(-4px)"
110
+ },
111
+ "100%": {
112
+ opacity: "1",
113
+ transform: "translateY(0)"
114
+ }
115
+ },
116
+ "fade-shift-out": {
117
+ "0%": {
118
+ opacity: "1",
119
+ transform: "translateY(0)"
120
+ },
121
+ "100%": {
122
+ opacity: "0",
123
+ transform: "translateY(-4px)"
124
+ }
125
+ },
126
+ "collapse-in": {
127
+ "0%": {
128
+ height: "0"
129
+ },
130
+ "100%": {
131
+ height: "var(--height)"
132
+ }
133
+ },
134
+ "collapse-out": {
135
+ "0%": {
136
+ height: "var(--height)"
137
+ },
138
+ "100%": {
139
+ height: "0"
140
+ }
141
+ },
142
+ "fade-in": {
143
+ from: {
144
+ opacity: "0"
145
+ },
146
+ to: {
147
+ opacity: "1"
148
+ }
149
+ },
150
+ "fade-out": {
151
+ from: {
152
+ opacity: "1"
153
+ },
154
+ to: {
155
+ opacity: "0"
156
+ }
157
+ },
158
+ "slide-in-left": {
159
+ "0%": {
160
+ transform: "translateX(-100%)"
161
+ },
162
+ "100%": {
163
+ transform: "translateX(0%)"
164
+ }
165
+ },
166
+ "slide-out-left": {
167
+ "0%": {
168
+ transform: "translateX(0%)"
169
+ },
170
+ "100%": {
171
+ transform: "translateX(-100%)"
172
+ }
173
+ },
174
+ "slide-in-right": {
175
+ "0%": {
176
+ transform: "translateX(100%)"
177
+ },
178
+ "100%": {
179
+ transform: "translateX(0%)"
180
+ }
181
+ },
182
+ "slide-out-right": {
183
+ "0%": {
184
+ transform: "translateX(0%)"
185
+ },
186
+ "100%": {
187
+ transform: "translateX(100%)"
188
+ }
189
+ },
190
+ "slide-in-top": {
191
+ "0%": {
192
+ transform: "translateY(-100%)"
193
+ },
194
+ "100%": {
195
+ transform: "translateY(0%)"
196
+ }
197
+ },
198
+ "slide-out-top": {
199
+ "0%": {
200
+ transform: "translateY(0%)"
201
+ },
202
+ "100%": {
203
+ transform: "translateY(-100%)"
204
+ }
205
+ },
206
+ "slide-in-bottom": {
207
+ "0%": {
208
+ transform: "translateY(100%)"
209
+ },
210
+ "100%": {
211
+ transform: "translateY(0%)"
212
+ }
213
+ },
214
+ "slide-out-bottom": {
215
+ "0%": {
216
+ transform: "translateY(0%)"
217
+ },
218
+ "100%": {
219
+ transform: "translateY(100%)"
220
+ }
221
+ },
222
+ "skeleton-pulse": {
223
+ "50%": {
224
+ opacity: "0.5"
225
+ }
226
+ }
227
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { defineTokens } from "@pandacss/dev";
10
+ export const boxShadows = defineTokens.shadows({
11
+ xxsmall: {
12
+ value: ["0px 1px 3px 0px rgba(0, 0, 0, 0.15)", "0px 0px 0.5px 0px rgba(0, 0, 0, 0.18)"]
13
+ },
14
+ xsmall: {
15
+ value: ["0px 3px 8px 0px rgba(0, 0, 0, 0.10)", "0px 1px 3px 0px rgba(0, 0, 0, 0.10)", "0px 0px 0.5px 0px rgba(0, 0, 0, 0.18)"]
16
+ },
17
+ medium: {
18
+ value: ["0px 5px 12px 0px rgba(0, 0, 0, 0.13)", "0px 1px 3px 0px rgba(0, 0, 0, 0.10)", "0px 0px 0.5px 0px rgba(0, 0, 0, 0.15)"]
19
+ },
20
+ large: {
21
+ value: ["0px 10px 16px 0px rgba(0, 0, 0, 0.12)", "0px 2px 5px 0px rgba(0, 0, 0, 0.15)", "0px 0px 0.5px 0px rgba(0, 0, 0, 0.12)"]
22
+ },
23
+ xlarge: {
24
+ value: ["0px 10px 24px 0px rgba(0, 0, 0, 0.18)", "0px 2px 5px 0px rgba(0, 0, 0, 0.15)", "0px 0px 0.5px 0px rgba(0, 0, 0, 0.08)"]
25
+ }
26
+ });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ export const breakpoints = {
10
+ mobile: "20em",
11
+ mobileWide: "29.75em",
12
+ tablet: "37.5625em",
13
+ tabletWide: "48em",
14
+ desktop: "61.3125em",
15
+ wide: "81.3125em",
16
+ ultraWide: "100.0625em"
17
+ };
package/es/colors.js ADDED
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { defineTokens } from "@pandacss/dev";
10
+ export const colors = defineTokens.colors({
11
+ grey: {
12
+ 50: {
13
+ value: "#FAFAFA"
14
+ },
15
+ 100: {
16
+ value: "#F2F2F3"
17
+ },
18
+ 200: {
19
+ value: "#E4E4E7"
20
+ },
21
+ 300: {
22
+ value: "#C9C9CF"
23
+ },
24
+ 400: {
25
+ value: "#AFAFB6"
26
+ },
27
+ 500: {
28
+ value: "#94949E"
29
+ },
30
+ 600: {
31
+ value: "#797986"
32
+ },
33
+ 700: {
34
+ value: "#61616B"
35
+ },
36
+ 800: {
37
+ value: "#494950"
38
+ },
39
+ 900: {
40
+ value: "#303036"
41
+ },
42
+ 950: {
43
+ value: "#18181B"
44
+ }
45
+ },
46
+ blue: {
47
+ 50: {
48
+ value: "#F1F9FD"
49
+ },
50
+ 100: {
51
+ value: "#D1ECFA"
52
+ },
53
+ 200: {
54
+ value: "#ACDFF6"
55
+ },
56
+ 300: {
57
+ value: "#87D4F2"
58
+ },
59
+ 400: {
60
+ value: "#6CCCEF"
61
+ },
62
+ 500: {
63
+ value: "#40BDEB"
64
+ },
65
+ 600: {
66
+ value: "#1E9CD2"
67
+ },
68
+ 700: {
69
+ value: "#197AB2"
70
+ },
71
+ 800: {
72
+ value: "#155784"
73
+ },
74
+ 900: {
75
+ value: "#113F5F"
76
+ },
77
+ 950: {
78
+ value: "#0B253D"
79
+ }
80
+ },
81
+ purple: {
82
+ 50: {
83
+ value: "#F9F6FE"
84
+ },
85
+ 100: {
86
+ value: "#F2EBFC"
87
+ },
88
+ 200: {
89
+ value: "#E7DAFA"
90
+ },
91
+ 300: {
92
+ value: "#DDC7FA"
93
+ },
94
+ 400: {
95
+ value: "#D2B4F8"
96
+ },
97
+ 500: {
98
+ value: "#C8A4F7"
99
+ },
100
+ 600: {
101
+ value: "#B586F3"
102
+ },
103
+ 700: {
104
+ value: "#8B65DC"
105
+ },
106
+ 800: {
107
+ value: "#823CC8"
108
+ },
109
+ 900: {
110
+ value: "#5E1F9E"
111
+ },
112
+ 950: {
113
+ value: "#40116F"
114
+ }
115
+ },
116
+ yellow: {
117
+ 50: {
118
+ value: "#FFFCF0"
119
+ },
120
+ 100: {
121
+ value: "#FFF9DB"
122
+ },
123
+ 200: {
124
+ value: "#FFF7CC"
125
+ },
126
+ 300: {
127
+ value: "#FFF1A8"
128
+ },
129
+ 400: {
130
+ value: "#FFED8F"
131
+ },
132
+ 500: {
133
+ value: "#FFE767"
134
+ },
135
+ 600: {
136
+ value: "#FFDD33"
137
+ },
138
+ 700: {
139
+ value: "#FFCC00"
140
+ },
141
+ 800: {
142
+ value: "#FFB700"
143
+ },
144
+ 900: {
145
+ value: "#FAA700"
146
+ },
147
+ 950: {
148
+ value: "#F08C00"
149
+ },
150
+ 1000: {
151
+ value: "#CC8302"
152
+ },
153
+ 1100: {
154
+ value: "#A25C06"
155
+ },
156
+ 1200: {
157
+ value: "#86480D"
158
+ },
159
+ 1300: {
160
+ value: "#7A3701"
161
+ },
162
+ 1400: {
163
+ value: "#481A00"
164
+ }
165
+ },
166
+ green: {
167
+ 50: {
168
+ value: "#EDFDF2"
169
+ },
170
+ 100: {
171
+ value: "#DAFBE5"
172
+ },
173
+ 200: {
174
+ value: "#C3F8D5"
175
+ },
176
+ 300: {
177
+ value: "#A7F6C1"
178
+ },
179
+ 400: {
180
+ value: "#81F3A7"
181
+ },
182
+ 500: {
183
+ value: "#63F293"
184
+ },
185
+ 600: {
186
+ value: "#42D774"
187
+ },
188
+ 700: {
189
+ value: "#2CAF58"
190
+ },
191
+ 800: {
192
+ value: "#238042"
193
+ },
194
+ 900: {
195
+ value: "#174F2A"
196
+ },
197
+ 950: {
198
+ value: "#11361E"
199
+ }
200
+ },
201
+ pink: {
202
+ 50: {
203
+ value: "#FEF2F3"
204
+ },
205
+ 100: {
206
+ value: "#FDECEF"
207
+ },
208
+ 200: {
209
+ value: "#FCDEE3"
210
+ },
211
+ 300: {
212
+ value: "#F9C3CE"
213
+ },
214
+ 400: {
215
+ value: "#F79CAE"
216
+ },
217
+ 500: {
218
+ value: "#F67992"
219
+ },
220
+ 600: {
221
+ value: "#EF4D6D"
222
+ },
223
+ 700: {
224
+ value: "#D53457"
225
+ },
226
+ 800: {
227
+ value: "#A82447"
228
+ },
229
+ 900: {
230
+ value: "#761935"
231
+ },
232
+ 950: {
233
+ value: "#4A1124"
234
+ }
235
+ },
236
+ white: {
237
+ value: "#FFFFFF"
238
+ },
239
+ primary: {
240
+ value: "#2D1B62"
241
+ }
242
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ export const conditions = {
10
+ chinese: "&:where([lang='zh'], &[lang='zh-Hans'], &[lang='zh-Hant']):not([data-pinyin])",
11
+ ariaInvalid: "&:has([aria-invalid='true']), &[aria-invalid='true']"
12
+ };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { defineGlobalStyles } from "@pandacss/dev";
10
+ export const globalCss = defineGlobalStyles({
11
+ ":root": {
12
+ // Applied to html in preflight (css reset)
13
+ "--global-font-body": "fonts.sans",
14
+ // Code, kbd, pre, samp
15
+ "--global-font-mono": "fonts.code"
16
+ },
17
+ html: {
18
+ minHeight: "100%"
19
+ },
20
+ body: {
21
+ background: "background.default"
22
+ },
23
+ "a, summary,[tabindex]:not([tabindex='-1'])": {
24
+ outline: "none",
25
+ _focusVisible: {
26
+ outline: "3px",
27
+ borderRadius: "xsmall",
28
+ outlineColor: "stroke.default",
29
+ outlineOffset: "3px",
30
+ outlineStyle: "solid"
31
+ }
32
+ },
33
+ code: {
34
+ background: "background.subtle",
35
+ whiteSpace: "pre-wrap"
36
+ },
37
+ // TODO: Remove these again once they're no longer needed.
38
+ // Some text elements don't have a styling class, and therefor no margin. Handled with generic fallbacks in old global css, and now temporarily handled by these selectors.
39
+ "h1:not([class])": {
40
+ margin: "24px 0 12px 0"
41
+ },
42
+ "h2:not([class])": {
43
+ margin: "48px 0 12px 0"
44
+ },
45
+ "h3:not([class]), h4:not([class]), h5:not([class])": {
46
+ margin: "36px 0 6px 0"
47
+ },
48
+ "p:not([class])": {
49
+ marginBottom: "24px"
50
+ },
51
+ "blockquote:not([class])": {
52
+ margin: "30px 0"
53
+ },
54
+ h1: {
55
+ textStyle: "heading.medium"
56
+ },
57
+ h2: {
58
+ textStyle: "heading.small"
59
+ },
60
+ h3: {
61
+ textStyle: "title.large"
62
+ },
63
+ "h4, h5, h6": {
64
+ textStyle: "title.medium"
65
+ },
66
+ p: {
67
+ textStyle: "body.medium"
68
+ },
69
+ a: {
70
+ color: "text.link",
71
+ textDecoration: "underline",
72
+ _hover: {
73
+ textDecoration: "none"
74
+ }
75
+ }
76
+ });
package/es/index.js ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { definePreset } from "@pandacss/dev";
10
+ import { animations, durations, easings, keyframes } from "./animations";
11
+ import { boxShadows } from "./boxShadows";
12
+ import { breakpoints } from "./breakpoints";
13
+ import { colors } from "./colors";
14
+ import { conditions } from "./conditions";
15
+ import { globalCss } from "./globalCss";
16
+ import { radii } from "./radii";
17
+ import { semanticTokens } from "./semanticTokens";
18
+ import { spacing } from "./spacing";
19
+ import { fontWeights, textStyles, fonts, fontSizes, lineHeights } from "./typography";
20
+ import { zIndex } from "./zIndex";
21
+ const preset = definePreset({
22
+ globalCss: globalCss,
23
+ conditions: conditions,
24
+ theme: {
25
+ breakpoints: breakpoints,
26
+ textStyles: textStyles,
27
+ keyframes: keyframes,
28
+ tokens: {
29
+ colors: colors,
30
+ easings: easings,
31
+ durations: durations,
32
+ radii: radii,
33
+ spacing: spacing,
34
+ sizes: spacing,
35
+ lineHeights: lineHeights,
36
+ fontWeights: fontWeights,
37
+ fontSizes: fontSizes,
38
+ fonts: fonts,
39
+ animations: animations,
40
+ shadows: boxShadows,
41
+ zIndex: zIndex
42
+ },
43
+ semanticTokens: semanticTokens
44
+ }
45
+ });
46
+ export default preset;
package/es/radii.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2024-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { defineTokens } from "@pandacss/dev";
10
+ export const radii = defineTokens.radii({
11
+ sharp: {
12
+ value: "0px"
13
+ },
14
+ xsmall: {
15
+ value: "{spacing.4xsmall}"
16
+ },
17
+ small: {
18
+ value: "{spacing.xxsmall}"
19
+ },
20
+ medium: {
21
+ value: "{spacing.xsmall}"
22
+ },
23
+ large: {
24
+ value: "{spacing.medium}"
25
+ },
26
+ full: {
27
+ value: "100%"
28
+ }
29
+ });