@coopdigital/styles 1.22.0 → 1.23.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.
@@ -1,259 +0,0 @@
1
- /* oxlint-disable */
2
- import { definePreset } from "unocss"
3
-
4
- function generateTertiaryColors() {
5
- const hues = ["blue", "green", "lilac", "orange", "pink", "purple", "red", "yellow"]
6
- const variants = ["light", "tint", "dark"]
7
- const out = {}
8
- for (const h of hues) {
9
- for (const v of variants) {
10
- const key = `${v}-${h}` // e.g. "light-blue"
11
- const cssVar = `var(--color-${key})`
12
- out[key] = cssVar
13
- }
14
- }
15
- return out
16
- }
17
-
18
- function generateBreakpoints(theme) {
19
- const values = {
20
- "2xs": "320px",
21
- xs: "414px",
22
- sm: "600px",
23
- md: "768px",
24
- lg: "1024px",
25
- xl: "1312px",
26
- "2xl": "1536px",
27
- }
28
-
29
- if (theme.breakpoint) {
30
- return {
31
- breakpoint: {
32
- ...values,
33
- },
34
- }
35
- } else if (theme.breakpoints) {
36
- return {
37
- breakpoints: {
38
- ...values,
39
- },
40
- }
41
- }
42
- }
43
-
44
- const presetCoop = definePreset(() => {
45
- return {
46
- name: "coop-preset",
47
-
48
- extendTheme: (theme) => {
49
- return {
50
- ...theme,
51
- ...generateBreakpoints(theme),
52
-
53
- colors: {
54
- "brand-blue": "var(--color-brand-blue)",
55
- offer: "var(--color-red-500)",
56
- error: "var(--color-red-500)",
57
- "error-light": "var(--color-red-100)",
58
-
59
- alert: "var(--color-yellow-500)",
60
- "alert-light": "var(--color-yellow-100)",
61
-
62
- value: "var(--color-yellow-500)",
63
-
64
- success: "var(--color-green-500)",
65
- "success-light": "var(--color-green-100)",
66
-
67
- blue: {
68
- 100: "var(--color-blue-100)",
69
- 500: "var(--color-blue-500)",
70
- 700: "var(--color-blue-700)",
71
- 800: "var(--color-blue-800)",
72
- 900: "var(--color-blue-900)",
73
- DEFAULT: "var(--color-blue)",
74
- },
75
- red: {
76
- 100: "var(--color-red-100)",
77
- 500: "var(--color-red-500)",
78
- DEFAULT: "var(--color-red)",
79
- },
80
- purple: {
81
- 500: "var(--color-purple-500)",
82
- DEFAULT: "var(--color-purple)",
83
- },
84
- yellow: {
85
- 100: "var(--color-yellow-100)",
86
- 500: "var(--color-yellow-500)",
87
- 900: "var(--color-yellow-900)",
88
- DEFAULT: "var(--color-yellow)",
89
- },
90
- green: {
91
- 100: "var(--color-green-100)",
92
- 500: "var(--color-green-500)",
93
- DEFAULT: "var(--color-green)",
94
- },
95
- teal: {
96
- 500: "var(--color-teal-500)",
97
- DEFAULT: "var(--color-teal)",
98
- },
99
- white: "var(--color-white)",
100
- black: "var(--color-black)",
101
- "grey-warm": {
102
- 100: "var(--color-grey-warm-100)",
103
- 500: "var(--color-grey-warm-500)",
104
- 900: "var(--color-grey-warm-900)",
105
- DEFAULT: "var(--color-grey-warm)",
106
- },
107
- "grey-cool": {
108
- 100: "var(--color-grey-cool-100)",
109
- 500: "var(--color-grey-cool-500)",
110
- 900: "var(--color-grey-cool-900)",
111
- DEFAULT: "var(--color-grey-cool)",
112
- },
113
- grey: {
114
- 100: "var(--color-grey-100)",
115
- 200: "var(--color-grey-200)",
116
- 300: "var(--color-grey-300)",
117
- 400: "var(--color-grey-400)",
118
- 500: "var(--color-grey-500)",
119
- 600: "var(--color-grey-600)",
120
- 700: "var(--color-grey-700)",
121
- 800: "var(--color-grey-800)",
122
- 900: "var(--color-grey-900)",
123
- DEFAULT: "var(--color-grey)",
124
- },
125
- // TERTIARY colours: tints, lights and darks
126
- ...generateTertiaryColors(),
127
- "tint-brown": "var(--color-grey-warm-100)",
128
- "tint-grey": "var(--color-grey-200)",
129
- },
130
- }
131
- },
132
- rules: [
133
- [
134
- "font-avenir",
135
- {
136
- "font-family":
137
- "'Avenir Next', 'Avenir-Next', 'Helvetica Neue', Helvetica, Arial, sans-serif;",
138
- },
139
- ],
140
- [
141
- "font-coopsans",
142
- { "font-family": "'Co-opSans', 'Helvetica Neue', Helvetica, Arial, sans-serif;" },
143
- ],
144
- ["font-headline", { "font-family": "'Co-opHeadline', 'Impact Fallback', sans-serif" }],
145
-
146
- [
147
- /^(bg|border)-(.*)$/,
148
- function* ([, rule, color], { theme }) {
149
- const root = color.split("-")[0]
150
-
151
- if (root in theme.colors || color in theme.colors) {
152
- const cssVar = `var(--color-${color})`
153
- //const cssVar = extractColorVarName(value)
154
- switch (rule) {
155
- case "bg":
156
- yield { "background-color": cssVar, "--bg-color": cssVar }
157
- break
158
- case "border":
159
- yield { "border-color": cssVar, "--border-color": cssVar }
160
- break
161
- }
162
- }
163
- },
164
- ],
165
-
166
- [
167
- /^ch-(\d+)$/,
168
- ([, n]) => ({
169
- width: `calc((${n} * 2ch) + 1rem)`,
170
- }),
171
- { autocomplete: "ch-<num>" },
172
- ],
173
-
174
- /*
175
- To support presetWind3 and presetWind4 and probably future presets
176
- we decided to use rules instead of editing font-size inside theme
177
- */
178
-
179
- ["text-xs", { "font-size": "0.75rem" }],
180
- ["text-sm", { "font-size": "0.875rem" }],
181
- ["text-base", { "font-size": "1rem" }],
182
- ["text-md", { "font-size": "1rem" }],
183
- ["text-lg", { "font-size": "1.125rem" }],
184
- ["text-xl", { "font-size": "1.25rem" }],
185
- ["text-2xl", { "font-size": "1.5rem" }],
186
- ["text-3xl", { "font-size": "1.875rem" }],
187
- ["text-4xl", { "font-size": "2.25rem" }],
188
- ["text-5xl", { "font-size": "3rem" }],
189
- ["text-6xl", { "font-size": "4rem" }],
190
- ["text-7xl", { "font-size": "4.5rem" }],
191
- ["text-mega", { "font-size": "5.125rem" }],
192
- ["text-8xl", { "font-size": "6rem" }],
193
-
194
- ["gap-sm", { gap: "1rem" }],
195
- ["gap-md", { gap: "2rem" }],
196
- ["gap-lg", { gap: "3rem" }],
197
- ],
198
- shortcuts: [
199
- {
200
- "flex-center": "flex justify-center items-center",
201
- "flex-center-around": "flex justify-around items-center",
202
- "flex-center-between": "flex justify-between items-center",
203
- "flex-responsive": "flex flex-col md:flex-row",
204
- "flex-stack-vertical": "flex flex-col gap-4",
205
-
206
- // SEMANTIC COLORS
207
-
208
- // Blues
209
- "text-link": "text-blue-500",
210
- // "icon-brand-blue": "fill-brand-blue",
211
-
212
- // Reds
213
- // "text-offer": "text-red-500",
214
- // "text-error": "text-red-500",
215
- // "bg-offer": "bg-red-500",
216
- // "bg-error": "bg-red-500",
217
- // "bg-error-light": "bg-red-100",
218
- // "border-offer": "border-red-500",
219
- // "border-error": "border-red-500",
220
-
221
- // Purples
222
- "border-focus-ring": "border-purple-500",
223
-
224
- // Whites
225
- "text-inverse": "text-white",
226
- "icon-inverse": "fill-white",
227
-
228
- // Greys
229
- "text-primary": "text-grey-900",
230
- "text-secondary": "text-grey-800",
231
- "bg-primary": "bg-white",
232
- "bg-secondary": "bg-grey-200",
233
- "bg-footer": "bg-grey-900",
234
- "bg-footer-light": "bg-grey-cool-100",
235
- "border-divider": "border-grey-600",
236
-
237
- // Yellows
238
- // "border-alert": "border-yellow-500",
239
- // "bg-alert-light": "bg-yellow-100",
240
-
241
- // Greens
242
- // "text-success": "text-green-500",
243
- // "border-success": "border-green-500",
244
- // "bg-success-light": "bg-green-100",
245
-
246
- // Tertiaries
247
- "text-brand-red": "text-dark-red",
248
- "text-brand-orange": "text-dark-orange",
249
- "text-brand-yellow": "text-dark-yellow",
250
- "text-brand-green": "text-dark-green",
251
- "text-brand-lilac": "text-dark-purple",
252
- "text-brand-purple": "text-dark-lilac",
253
- "text-brand-pink": "text-dark-pink",
254
- },
255
- ],
256
- }
257
- })
258
-
259
- export { presetCoop as default }