wjec-one 4.0.21 → 4.1.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/README.md +71 -99
- package/auth/index.d.ts +183 -183
- package/auth/index.js +1 -3
- package/config/babel.config.js +3 -11
- package/config/eslint-config.js +3 -3
- package/config/utils.js +19 -7
- package/config/webpack.config.js +19 -3
- package/index.d.ts +1690 -1665
- package/index.js +44 -1
- package/layout/index.d.ts +55 -55
- package/layout/index.js +1 -1
- package/localization/index.d.ts +35 -37
- package/localization/index.js +1 -1
- package/package.json +25 -28
- package/portal/index.d.ts +264 -248
- package/portal/index.js +9 -3
- package/scripts/test.js +0 -1
- package/services/index.d.ts +102 -102
- package/services/index.js +1 -3
- package/store/index.d.ts +61 -61
- package/store/index.js +1 -1
- package/store/utils/index.d.ts +1 -1
- package/store/utils/index.js +1 -1
- package/test/setupTests.ts +1 -1
- package/test/setupTestsAfterEnv.ts +15 -0
- package/theme/index.d.ts +427 -79
- package/theme/index.js +1 -1
- package/umd/auth/index.js +1 -3
- package/umd/index.js +44 -1
- package/umd/layout/index.js +1 -1
- package/umd/localization/index.js +1 -1
- package/umd/portal/index.js +9 -3
- package/umd/services/index.js +1 -3
- package/umd/store/index.js +1 -1
- package/umd/store/utils/index.js +1 -1
- package/umd/theme/index.js +1 -1
- package/umd/utils/index.js +1 -3
- package/utils/index.d.ts +150 -140
- package/utils/index.js +1 -3
- package/wjec-one-project.d.ts +1 -0
package/theme/index.d.ts
CHANGED
|
@@ -1,87 +1,435 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Record } from 'immutable';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Dispatch, FC, PropsWithChildren } from 'react';
|
|
3
|
+
import { Implements, DeepPartial, ObjectLeaves, ColorPalette as ColorPalette$1, ColorPaletteEduqas } from 'wjec-one';
|
|
4
|
+
import * as _emotion_core from '@emotion/core';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
6
|
+
declare const wjec: Readonly<{
|
|
7
|
+
readonly basicBlack: "#000000";
|
|
8
|
+
readonly basicBlack50: "#000000";
|
|
9
|
+
readonly basicNearlyWhite: "#fafcfc";
|
|
10
|
+
readonly basicWhite: "#ffffff";
|
|
11
|
+
readonly basicWhite50: "#ffffff";
|
|
12
|
+
readonly error: "#d22d2d";
|
|
13
|
+
readonly errorDark: "#931f1f";
|
|
14
|
+
readonly errorDarker: "#691616";
|
|
15
|
+
readonly errorDarkest: "#3f0d0d";
|
|
16
|
+
readonly errorLight: "#db5757";
|
|
17
|
+
readonly errorLighter: "#f2bfbf";
|
|
18
|
+
readonly errorLightest: "#fbebeb";
|
|
19
|
+
readonly highlight: "#e57300";
|
|
20
|
+
readonly highlightDark: "#b25900";
|
|
21
|
+
readonly highlightDarker: "#663300";
|
|
22
|
+
readonly highlightDarkest: "#331a00";
|
|
23
|
+
readonly highlightLight: "#f8a653";
|
|
24
|
+
readonly highlightLighter: "#fcd9b5";
|
|
25
|
+
readonly highlightLightest: "#fef2e6";
|
|
26
|
+
readonly neutral: "#819198";
|
|
27
|
+
readonly neutralDark: "#68787f";
|
|
28
|
+
readonly neutralDarker: "#4b585d";
|
|
29
|
+
readonly neutralDarker2: "#22282a";
|
|
30
|
+
readonly neutralDarkest: "#171b1c";
|
|
31
|
+
readonly neutralLight: "#9daaaf";
|
|
32
|
+
readonly neutralLighter: "#b9c2c6";
|
|
33
|
+
readonly neutralLighter2: "#d5dbdd";
|
|
34
|
+
readonly neutralLighter3: "#f1f3f4";
|
|
35
|
+
readonly neutralLightest: "#fafcfc";
|
|
36
|
+
readonly primary: "#007db2";
|
|
37
|
+
readonly primaryDark: "#005980";
|
|
38
|
+
readonly primaryDarker: "#004766";
|
|
39
|
+
readonly primaryDarkest: "#00354d";
|
|
40
|
+
readonly primaryLight: "#80d9ff";
|
|
41
|
+
readonly primaryLighter: "#b2e8ff";
|
|
42
|
+
readonly primaryLightest: "#e5f7ff";
|
|
43
|
+
readonly qualificationMurkyGreenLight: "#acc081";
|
|
44
|
+
readonly qualificationMurkyGreenMid: "#81994d";
|
|
45
|
+
readonly qualificationOrangeLight: "#f8a653";
|
|
46
|
+
readonly qualificationPinkLight: "#ffc0cb";
|
|
47
|
+
readonly qualificationPinkMid: "#ff8fa2";
|
|
48
|
+
readonly qualificationPlum: "#b858f4";
|
|
49
|
+
readonly qualificationTeal: "#4d9995";
|
|
50
|
+
readonly qualificationTealishBlueLight: "#aeb6dc";
|
|
51
|
+
readonly qualificationTealishBlueMid: "#5f6fba";
|
|
52
|
+
readonly qualificationYellowLight: "#f9e186";
|
|
53
|
+
readonly secondary: "#247d8f";
|
|
54
|
+
readonly secondaryDark: "#1a5966";
|
|
55
|
+
readonly secondaryDarker: "#135e6d";
|
|
56
|
+
readonly secondaryDarkest: "#0f363d";
|
|
57
|
+
readonly secondaryLight: "#70c9db";
|
|
58
|
+
readonly secondaryLighter: "#c2e8f0";
|
|
59
|
+
readonly secondaryLightest: "#ebf7fa";
|
|
60
|
+
readonly secondaryLightest2: "#f7fcfd";
|
|
61
|
+
readonly success: "#357e38";
|
|
62
|
+
readonly successDark: "#265a26";
|
|
63
|
+
readonly successDarker: "#1e481e";
|
|
64
|
+
readonly successLight: "#5dbb5d";
|
|
65
|
+
readonly successLighter: "#aad4aa";
|
|
66
|
+
readonly successLightest: "#ecf7ec";
|
|
67
|
+
readonly tertiary: "#f4c924";
|
|
68
|
+
readonly tertiaryDark: "#aa8909";
|
|
69
|
+
readonly tertiaryDarker: "#796206";
|
|
70
|
+
readonly tertiaryDarkest: "#493b04";
|
|
71
|
+
readonly tertiaryLight: "#f6d555";
|
|
72
|
+
readonly tertiaryLighter: "#f9e186";
|
|
73
|
+
readonly tertiaryLightest: "#fef9e7";
|
|
74
|
+
readonly warning: "#e57300";
|
|
75
|
+
readonly warningDark: "#b25900";
|
|
76
|
+
readonly warningDarker: "#663300";
|
|
77
|
+
readonly warningDarkest: "#331a00";
|
|
78
|
+
readonly warningLight: "#ff8c1a";
|
|
79
|
+
readonly warningLighter: "#fcd9b5";
|
|
80
|
+
readonly warningLightest: "#fef2e6";
|
|
81
|
+
}>;
|
|
82
|
+
declare const eduqas: Readonly<{
|
|
83
|
+
readonly primary: "#F1511B";
|
|
84
|
+
readonly primaryDark: "#BF3608";
|
|
85
|
+
readonly primaryLight: "#FDB8A1";
|
|
86
|
+
readonly basicBlack: "#000000";
|
|
87
|
+
readonly basicBlack50: "#000000";
|
|
88
|
+
readonly basicNearlyWhite: "#fafcfc";
|
|
89
|
+
readonly basicWhite: "#ffffff";
|
|
90
|
+
readonly basicWhite50: "#ffffff";
|
|
91
|
+
readonly error: "#d22d2d";
|
|
92
|
+
readonly errorDark: "#931f1f";
|
|
93
|
+
readonly errorDarker: "#691616";
|
|
94
|
+
readonly errorDarkest: "#3f0d0d";
|
|
95
|
+
readonly errorLight: "#db5757";
|
|
96
|
+
readonly errorLighter: "#f2bfbf";
|
|
97
|
+
readonly errorLightest: "#fbebeb";
|
|
98
|
+
readonly highlight: "#e57300";
|
|
99
|
+
readonly highlightDark: "#b25900";
|
|
100
|
+
readonly highlightDarker: "#663300";
|
|
101
|
+
readonly highlightDarkest: "#331a00";
|
|
102
|
+
readonly highlightLight: "#f8a653";
|
|
103
|
+
readonly highlightLighter: "#fcd9b5";
|
|
104
|
+
readonly highlightLightest: "#fef2e6";
|
|
105
|
+
readonly neutral: "#819198";
|
|
106
|
+
readonly neutralDark: "#68787f";
|
|
107
|
+
readonly neutralDarker: "#4b585d";
|
|
108
|
+
readonly neutralDarker2: "#22282a";
|
|
109
|
+
readonly neutralDarkest: "#171b1c";
|
|
110
|
+
readonly neutralLight: "#9daaaf";
|
|
111
|
+
readonly neutralLighter: "#b9c2c6";
|
|
112
|
+
readonly neutralLighter2: "#d5dbdd";
|
|
113
|
+
readonly neutralLighter3: "#f1f3f4";
|
|
114
|
+
readonly neutralLightest: "#fafcfc";
|
|
115
|
+
readonly primaryDarker: "#004766";
|
|
116
|
+
readonly primaryDarkest: "#00354d";
|
|
117
|
+
readonly primaryLighter: "#b2e8ff";
|
|
118
|
+
readonly primaryLightest: "#e5f7ff";
|
|
119
|
+
readonly qualificationMurkyGreenLight: "#acc081";
|
|
120
|
+
readonly qualificationMurkyGreenMid: "#81994d";
|
|
121
|
+
readonly qualificationOrangeLight: "#f8a653";
|
|
122
|
+
readonly qualificationPinkLight: "#ffc0cb";
|
|
123
|
+
readonly qualificationPinkMid: "#ff8fa2";
|
|
124
|
+
readonly qualificationPlum: "#b858f4";
|
|
125
|
+
readonly qualificationTeal: "#4d9995";
|
|
126
|
+
readonly qualificationTealishBlueLight: "#aeb6dc";
|
|
127
|
+
readonly qualificationTealishBlueMid: "#5f6fba";
|
|
128
|
+
readonly qualificationYellowLight: "#f9e186";
|
|
129
|
+
readonly secondary: "#247d8f";
|
|
130
|
+
readonly secondaryDark: "#1a5966";
|
|
131
|
+
readonly secondaryDarker: "#135e6d";
|
|
132
|
+
readonly secondaryDarkest: "#0f363d";
|
|
133
|
+
readonly secondaryLight: "#70c9db";
|
|
134
|
+
readonly secondaryLighter: "#c2e8f0";
|
|
135
|
+
readonly secondaryLightest: "#ebf7fa";
|
|
136
|
+
readonly secondaryLightest2: "#f7fcfd";
|
|
137
|
+
readonly success: "#357e38";
|
|
138
|
+
readonly successDark: "#265a26";
|
|
139
|
+
readonly successDarker: "#1e481e";
|
|
140
|
+
readonly successLight: "#5dbb5d";
|
|
141
|
+
readonly successLighter: "#aad4aa";
|
|
142
|
+
readonly successLightest: "#ecf7ec";
|
|
143
|
+
readonly tertiary: "#f4c924";
|
|
144
|
+
readonly tertiaryDark: "#aa8909";
|
|
145
|
+
readonly tertiaryDarker: "#796206";
|
|
146
|
+
readonly tertiaryDarkest: "#493b04";
|
|
147
|
+
readonly tertiaryLight: "#f6d555";
|
|
148
|
+
readonly tertiaryLighter: "#f9e186";
|
|
149
|
+
readonly tertiaryLightest: "#fef9e7";
|
|
150
|
+
readonly warning: "#e57300";
|
|
151
|
+
readonly warningDark: "#b25900";
|
|
152
|
+
readonly warningDarker: "#663300";
|
|
153
|
+
readonly warningDarkest: "#331a00";
|
|
154
|
+
readonly warningLight: "#ff8c1a";
|
|
155
|
+
readonly warningLighter: "#fcd9b5";
|
|
156
|
+
readonly warningLightest: "#fef2e6";
|
|
157
|
+
}>;
|
|
51
158
|
|
|
52
|
-
declare const
|
|
159
|
+
declare const colors_d_eduqas: typeof eduqas;
|
|
160
|
+
declare const colors_d_wjec: typeof wjec;
|
|
161
|
+
declare namespace colors_d {
|
|
162
|
+
export {
|
|
163
|
+
colors_d_eduqas as eduqas,
|
|
164
|
+
colors_d_wjec as wjec,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
53
167
|
|
|
54
|
-
type
|
|
55
|
-
|
|
56
|
-
|
|
168
|
+
type ColorPalette = {
|
|
169
|
+
basicBlack: string;
|
|
170
|
+
basicBlack50: string;
|
|
171
|
+
basicNearlyWhite: string;
|
|
172
|
+
basicWhite: string;
|
|
173
|
+
basicWhite50: string;
|
|
174
|
+
errorDark: string;
|
|
175
|
+
errorDarker: string;
|
|
176
|
+
errorDarkest: string;
|
|
177
|
+
error: string;
|
|
178
|
+
errorLight: string;
|
|
179
|
+
errorLighter: string;
|
|
180
|
+
errorLightest: string;
|
|
181
|
+
highlightDark: string;
|
|
182
|
+
highlightDarker: string;
|
|
183
|
+
highlightDarkest: string;
|
|
184
|
+
highlight: string;
|
|
185
|
+
highlightLight: string;
|
|
186
|
+
highlightLighter: string;
|
|
187
|
+
highlightLightest: string;
|
|
188
|
+
neutralDark: string;
|
|
189
|
+
neutralDarker: string;
|
|
190
|
+
neutralDarker2: string;
|
|
191
|
+
neutralDarkest: string;
|
|
192
|
+
neutral: string;
|
|
193
|
+
neutralLight: string;
|
|
194
|
+
neutralLighter: string;
|
|
195
|
+
neutralLighter2: string;
|
|
196
|
+
neutralLighter3: string;
|
|
197
|
+
neutralLightest: string;
|
|
198
|
+
primaryDark: string;
|
|
199
|
+
primaryDarker: string;
|
|
200
|
+
primaryDarkest: string;
|
|
201
|
+
primary: string;
|
|
202
|
+
primaryLight: string;
|
|
203
|
+
primaryLighter: string;
|
|
204
|
+
primaryLightest: string;
|
|
205
|
+
qualificationMurkyGreenLight: string;
|
|
206
|
+
qualificationMurkyGreenMid: string;
|
|
207
|
+
qualificationOrangeLight: string;
|
|
208
|
+
qualificationPinkLight: string;
|
|
209
|
+
qualificationPinkMid: string;
|
|
210
|
+
qualificationPlum: string;
|
|
211
|
+
qualificationTeal: string;
|
|
212
|
+
qualificationTealishBlueLight: string;
|
|
213
|
+
qualificationTealishBlueMid: string;
|
|
214
|
+
qualificationYellowLight: string;
|
|
215
|
+
secondaryDark: string;
|
|
216
|
+
secondaryDarker: string;
|
|
217
|
+
secondaryDarkest: string;
|
|
218
|
+
secondary: string;
|
|
219
|
+
secondaryLight: string;
|
|
220
|
+
secondaryLighter: string;
|
|
221
|
+
secondaryLightest: string;
|
|
222
|
+
secondaryLightest2: string;
|
|
223
|
+
successDark: string;
|
|
224
|
+
successDarker: string;
|
|
225
|
+
success: string;
|
|
226
|
+
successLight: string;
|
|
227
|
+
successLighter: string;
|
|
228
|
+
successLightest: string;
|
|
229
|
+
tertiaryDark: string;
|
|
230
|
+
tertiaryDarker: string;
|
|
231
|
+
tertiaryDarkest: string;
|
|
232
|
+
tertiary: string;
|
|
233
|
+
tertiaryLight: string;
|
|
234
|
+
tertiaryLighter: string;
|
|
235
|
+
tertiaryLightest: string;
|
|
236
|
+
warningDark: string;
|
|
237
|
+
warningDarker: string;
|
|
238
|
+
warningDarkest: string;
|
|
239
|
+
warning: string;
|
|
240
|
+
warningLight: string;
|
|
241
|
+
warningLighter: string;
|
|
242
|
+
warningLightest: string;
|
|
57
243
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
244
|
+
type ThemeCategory = {
|
|
245
|
+
[category: string]: keyof ColorPalette | ThemeCategory;
|
|
246
|
+
};
|
|
247
|
+
type ThemeColorMapping = Implements<ThemeCategory, {
|
|
248
|
+
controls: {
|
|
249
|
+
borders: {
|
|
250
|
+
default: keyof ColorPalette;
|
|
251
|
+
defaultDarker: keyof ColorPalette;
|
|
252
|
+
defaultHover: keyof ColorPalette;
|
|
253
|
+
defaultLight: keyof ColorPalette;
|
|
254
|
+
disabled: keyof ColorPalette;
|
|
255
|
+
error: keyof ColorPalette;
|
|
256
|
+
primary: keyof ColorPalette;
|
|
257
|
+
primaryHover: keyof ColorPalette;
|
|
258
|
+
secondary: keyof ColorPalette;
|
|
259
|
+
secondaryHover: keyof ColorPalette;
|
|
260
|
+
success: keyof ColorPalette;
|
|
261
|
+
warning: keyof ColorPalette;
|
|
262
|
+
white: keyof ColorPalette;
|
|
263
|
+
};
|
|
264
|
+
container: {
|
|
265
|
+
background: keyof ColorPalette;
|
|
266
|
+
backgroundLightgrey: keyof ColorPalette;
|
|
267
|
+
boldGreen: keyof ColorPalette;
|
|
268
|
+
boldRed: keyof ColorPalette;
|
|
269
|
+
boldYellow: keyof ColorPalette;
|
|
270
|
+
border: keyof ColorPalette;
|
|
271
|
+
error: keyof ColorPalette;
|
|
272
|
+
primary: keyof ColorPalette;
|
|
273
|
+
success: keyof ColorPalette;
|
|
274
|
+
warning: keyof ColorPalette;
|
|
275
|
+
};
|
|
276
|
+
interaction: {
|
|
277
|
+
default: keyof ColorPalette;
|
|
278
|
+
defaultActive: keyof ColorPalette;
|
|
279
|
+
defaultHover: keyof ColorPalette;
|
|
280
|
+
disabled: keyof ColorPalette;
|
|
281
|
+
error: keyof ColorPalette;
|
|
282
|
+
errorActive: keyof ColorPalette;
|
|
283
|
+
errorHover: keyof ColorPalette;
|
|
284
|
+
errorSecondary: keyof ColorPalette;
|
|
285
|
+
errorSecondaryActive: keyof ColorPalette;
|
|
286
|
+
errorSecondaryHover: keyof ColorPalette;
|
|
287
|
+
primary: keyof ColorPalette;
|
|
288
|
+
primaryActive: keyof ColorPalette;
|
|
289
|
+
primaryHover: keyof ColorPalette;
|
|
290
|
+
primaryLightBackground: keyof ColorPalette;
|
|
291
|
+
secondary: keyof ColorPalette;
|
|
292
|
+
secondaryActive: keyof ColorPalette;
|
|
293
|
+
secondaryHover: keyof ColorPalette;
|
|
294
|
+
success: keyof ColorPalette;
|
|
295
|
+
successActive: keyof ColorPalette;
|
|
296
|
+
successHover: keyof ColorPalette;
|
|
297
|
+
successLightBackground: keyof ColorPalette;
|
|
298
|
+
tertiary: keyof ColorPalette;
|
|
299
|
+
tertiaryActive: keyof ColorPalette;
|
|
300
|
+
tertiaryHover: keyof ColorPalette;
|
|
301
|
+
textDark: keyof ColorPalette;
|
|
302
|
+
textDisabled: keyof ColorPalette;
|
|
303
|
+
textLight: keyof ColorPalette;
|
|
304
|
+
textSecondaryDark: keyof ColorPalette;
|
|
305
|
+
textSecondaryLight: keyof ColorPalette;
|
|
306
|
+
warning: keyof ColorPalette;
|
|
307
|
+
warningActive: keyof ColorPalette;
|
|
308
|
+
warningHover: keyof ColorPalette;
|
|
309
|
+
};
|
|
310
|
+
userInput: {
|
|
311
|
+
background: {
|
|
312
|
+
default: keyof ColorPalette;
|
|
313
|
+
defaultHover: keyof ColorPalette;
|
|
314
|
+
defaultShadow: keyof ColorPalette;
|
|
315
|
+
error: keyof ColorPalette;
|
|
316
|
+
primary: keyof ColorPalette;
|
|
317
|
+
primaryHover: keyof ColorPalette;
|
|
318
|
+
secondary: keyof ColorPalette;
|
|
319
|
+
secondaryHover: keyof ColorPalette;
|
|
320
|
+
success: keyof ColorPalette;
|
|
321
|
+
warning: keyof ColorPalette;
|
|
322
|
+
};
|
|
323
|
+
icon: {
|
|
324
|
+
default: keyof ColorPalette;
|
|
325
|
+
defaultLight: keyof ColorPalette;
|
|
326
|
+
disabled: keyof ColorPalette;
|
|
327
|
+
error: keyof ColorPalette;
|
|
328
|
+
primary: keyof ColorPalette;
|
|
329
|
+
primaryDark: keyof ColorPalette;
|
|
330
|
+
primaryLight: keyof ColorPalette;
|
|
331
|
+
secondary: keyof ColorPalette;
|
|
332
|
+
secondaryDark: keyof ColorPalette;
|
|
333
|
+
secondaryLight: keyof ColorPalette;
|
|
334
|
+
success: keyof ColorPalette;
|
|
335
|
+
warning: keyof ColorPalette;
|
|
336
|
+
};
|
|
337
|
+
message: {
|
|
338
|
+
default: keyof ColorPalette;
|
|
339
|
+
error: keyof ColorPalette;
|
|
340
|
+
success: keyof ColorPalette;
|
|
341
|
+
warning: keyof ColorPalette;
|
|
342
|
+
};
|
|
343
|
+
text: {
|
|
344
|
+
default: keyof ColorPalette;
|
|
345
|
+
defaultLighter: keyof ColorPalette;
|
|
346
|
+
disabled: keyof ColorPalette;
|
|
347
|
+
label: keyof ColorPalette;
|
|
348
|
+
placeholder: keyof ColorPalette;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
foundational: {
|
|
353
|
+
background: keyof ColorPalette;
|
|
354
|
+
border: keyof ColorPalette;
|
|
355
|
+
eduqas: keyof ColorPalette;
|
|
356
|
+
neutral: keyof ColorPalette;
|
|
357
|
+
primary: keyof ColorPalette;
|
|
358
|
+
secondary: keyof ColorPalette;
|
|
359
|
+
tertiary: keyof ColorPalette;
|
|
360
|
+
white: keyof ColorPalette;
|
|
361
|
+
wjec: keyof ColorPalette;
|
|
362
|
+
};
|
|
363
|
+
qualifications: {
|
|
364
|
+
entrylevel: keyof ColorPalette;
|
|
365
|
+
gcealevel: keyof ColorPalette;
|
|
366
|
+
gceaslevel: keyof ColorPalette;
|
|
367
|
+
gcse: keyof ColorPalette;
|
|
368
|
+
otherquals: keyof ColorPalette;
|
|
369
|
+
vqaward: keyof ColorPalette;
|
|
370
|
+
wbqadvanced: keyof ColorPalette;
|
|
371
|
+
wbqfoundation: keyof ColorPalette;
|
|
372
|
+
wbqkeystage4: keyof ColorPalette;
|
|
373
|
+
wbqnational: keyof ColorPalette;
|
|
374
|
+
};
|
|
375
|
+
text: {
|
|
376
|
+
body: {
|
|
377
|
+
accent: keyof ColorPalette;
|
|
378
|
+
default: keyof ColorPalette;
|
|
379
|
+
disabled: keyof ColorPalette;
|
|
380
|
+
highlight: keyof ColorPalette;
|
|
381
|
+
link: keyof ColorPalette;
|
|
382
|
+
linkHoverBackground: keyof ColorPalette;
|
|
383
|
+
};
|
|
384
|
+
heading: {
|
|
385
|
+
large: keyof ColorPalette;
|
|
386
|
+
medium: keyof ColorPalette;
|
|
387
|
+
primary: keyof ColorPalette;
|
|
388
|
+
secondary: keyof ColorPalette;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
}>;
|
|
392
|
+
type ThemeConfig = {
|
|
393
|
+
colorMapping?: DeepPartial<ThemeColorMapping>;
|
|
394
|
+
colorPalette: ColorPalette;
|
|
395
|
+
name: string;
|
|
75
396
|
};
|
|
397
|
+
interface ThemeRegister {
|
|
398
|
+
legacyEduqas: ThemeConfig;
|
|
399
|
+
eduqas: ThemeConfig;
|
|
400
|
+
legacyWjec: ThemeConfig;
|
|
401
|
+
wjec: ThemeConfig;
|
|
402
|
+
}
|
|
403
|
+
type Theme = {
|
|
404
|
+
colorPalette: ColorPalette;
|
|
405
|
+
name: string;
|
|
406
|
+
themeColors: ThemeColorMapping;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
declare const cssVar: (path: keyof ColorPalette | ObjectLeaves<ThemeColorMapping>) => `var(--${string})`;
|
|
410
|
+
declare const getCssColorVariableName: (path: keyof ColorPalette | ObjectLeaves<ThemeColorMapping>) => `--${string}`;
|
|
411
|
+
declare const registerThemes: (newThemeConfigs: {
|
|
412
|
+
[theme: string]: ThemeConfig;
|
|
413
|
+
}) => void;
|
|
76
414
|
|
|
77
|
-
type ThemeState =
|
|
415
|
+
type ThemeState = {
|
|
416
|
+
brand: 'eduqas' | 'wjec';
|
|
417
|
+
colorPalette: typeof ColorPalette$1 | typeof ColorPaletteEduqas;
|
|
418
|
+
};
|
|
419
|
+
type ThemeStylesType = (_emotion_core.SerializedStyles extends undefined ? 0 : 1) extends 1 ? _emotion_core.SerializedStyles : react.CSSProperties;
|
|
420
|
+
declare const selectBrand: (brand: "eduqas" | "wjec") => void;
|
|
421
|
+
declare const useWjecOneTheme: () => [ThemeState, Dispatch<any>];
|
|
422
|
+
declare const useWjecOneThemeStyles: <S extends {
|
|
423
|
+
[key: string]: ThemeStylesType;
|
|
424
|
+
}>(styles: S | ((theme: ThemeState) => S)) => S;
|
|
78
425
|
|
|
79
|
-
declare const
|
|
80
|
-
declare const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
426
|
+
declare const getTheme: (theme?: keyof ThemeRegister) => Readonly<Theme>;
|
|
427
|
+
declare const setTheme: (themeOrSetter: keyof ThemeRegister | ((currentTheme: keyof ThemeRegister) => keyof ThemeRegister)) => void;
|
|
428
|
+
type ThemeProviderProps = PropsWithChildren<{
|
|
429
|
+
defaultTheme?: keyof ThemeRegister;
|
|
430
|
+
}>;
|
|
431
|
+
declare const ThemeProvider: FC<ThemeProviderProps>;
|
|
432
|
+
declare const useTheme: (theme?: keyof ThemeRegister) => Readonly<Theme>;
|
|
433
|
+
declare const useThemeColor: <T extends string>(color: T | keyof ColorPalette) => string;
|
|
86
434
|
|
|
87
|
-
export { ThemeState,
|
|
435
|
+
export { ColorPalette, Theme, ThemeColorMapping, ThemeConfig, ThemeProvider, ThemeRegister, ThemeState, colors_d as colors, cssVar, getCssColorVariableName, getTheme, registerThemes, selectBrand, setTheme, useTheme, useThemeColor, useWjecOneTheme, useWjecOneThemeStyles };
|
package/theme/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useMemo as e,createContext as r,useState as a,createElement as t,useContext as i}from"react";import{ColorPaletteEduqas as n,ColorPalette as c,useIsMounted as s}from"wjec-one";import{deepFreeze as o,deepMerge as l,noop as d}from"wjec-one/utils";const h={selectedTheme:"wjec",themes:{legacyEduqas:void 0,eduqas:void 0,legacyWjec:void 0,wjec:void 0}},u=e=>h[e],g=e=>{Object.entries(e).forEach(([e,r])=>{h[e]=r})},f=Object.freeze({basicBlack:"#000000",basicBlack50:"#000000",basicNearlyWhite:"#fafcfc",basicWhite:"#ffffff",basicWhite50:"#ffffff",error:"#d22d2d",errorDark:"#931f1f",errorDarker:"#691616",errorDarkest:"#3f0d0d",errorLight:"#db5757",errorLighter:"#f2bfbf",errorLightest:"#fbebeb",highlight:"#e57300",highlightDark:"#b25900",highlightDarker:"#663300",highlightDarkest:"#331a00",highlightLight:"#f8a653",highlightLighter:"#fcd9b5",highlightLightest:"#fef2e6",neutral:"#819198",neutralDark:"#68787f",neutralDarker:"#4b585d",neutralDarker2:"#22282a",neutralDarkest:"#171b1c",neutralLight:"#9daaaf",neutralLighter:"#b9c2c6",neutralLighter2:"#d5dbdd",neutralLighter3:"#f1f3f4",neutralLightest:"#fafcfc",primary:"#007db2",primaryDark:"#005980",primaryDarker:"#004766",primaryDarkest:"#00354d",primaryLight:"#80d9ff",primaryLighter:"#b2e8ff",primaryLightest:"#e5f7ff",qualificationMurkyGreenLight:"#acc081",qualificationMurkyGreenMid:"#81994d",qualificationOrangeLight:"#f8a653",qualificationPinkLight:"#ffc0cb",qualificationPinkMid:"#ff8fa2",qualificationPlum:"#b858f4",qualificationTeal:"#4d9995",qualificationTealishBlueLight:"#aeb6dc",qualificationTealishBlueMid:"#5f6fba",qualificationYellowLight:"#f9e186",secondary:"#247d8f",secondaryDark:"#1a5966",secondaryDarker:"#135e6d",secondaryDarkest:"#0f363d",secondaryLight:"#70c9db",secondaryLighter:"#c2e8f0",secondaryLightest:"#ebf7fa",secondaryLightest2:"#f7fcfd",success:"#357e38",successDark:"#265a26",successDarker:"#1e481e",successLight:"#5dbb5d",successLighter:"#aad4aa",successLightest:"#ecf7ec",tertiary:"#f4c924",tertiaryDark:"#aa8909",tertiaryDarker:"#796206",tertiaryDarkest:"#493b04",tertiaryLight:"#f6d555",tertiaryLighter:"#f9e186",tertiaryLightest:"#fef9e7",warning:"#e57300",warningDark:"#b25900",warningDarker:"#663300",warningDarkest:"#331a00",warningLight:"#ff8c1a",warningLighter:"#fcd9b5",warningLightest:"#fef2e6"}),y=Object.freeze({...f,primary:"#F1511B",primaryDark:"#BF3608",primaryLight:"#FDB8A1"});var L=Object.freeze({__proto__:null,eduqas:y,wjec:f});const m=Object.freeze({controls:{borders:{default:"neutralLight",defaultDarker:"neutralDark",defaultHover:"neutral",defaultLight:"neutralLighter2",disabled:"neutralLight",error:"error",primary:"primary",primaryHover:"primaryDark",secondary:"secondary",secondaryHover:"secondaryDark",success:"success",warning:"warning",white:"basicWhite"},container:{background:"basicWhite",backgroundLightgrey:"neutralLighter3",boldGreen:"successLighter",boldRed:"errorLighter",boldYellow:"tertiaryLighter",border:"neutralLighter2",error:"errorLightest",primary:"primaryLightest",success:"successLightest",warning:"warningLightest"},interaction:{default:"neutralLighter2",defaultActive:"neutralDark",defaultHover:"neutralLight",disabled:"neutralLighter3",error:"error",errorActive:"errorDarker",errorHover:"errorDark",errorSecondary:"errorLightest",errorSecondaryActive:"errorLight",errorSecondaryHover:"errorLighter",primary:"primary",primaryActive:"primaryDarker",primaryHover:"primaryDark",primaryLightBackground:"primaryLightest",secondary:"secondaryLightest",secondaryActive:"secondaryLight",secondaryHover:"secondaryLighter",success:"success",successActive:"successDarker",successHover:"successDark",successLightBackground:"successLightest",tertiary:"tertiary",tertiaryActive:"tertiaryDarker",tertiaryHover:"tertiaryDark",textDark:"neutralDarker2",textDisabled:"neutralLighter",textLight:"neutralLightest",textSecondaryDark:"secondaryDarker",textSecondaryLight:"secondaryLightest",warning:"warning",warningActive:"warningDarker",warningHover:"warningDark"},userInput:{background:{default:"basicWhite",defaultHover:"neutralLighter3",defaultShadow:"neutralLighter2",error:"errorLightest",primary:"primaryLightest",primaryHover:"primaryLighter",secondary:"secondaryLightest",secondaryHover:"secondaryLighter",success:"successLightest",warning:"warningLightest"},icon:{default:"neutralDark",defaultLight:"neutralLighter3",disabled:"neutralLighter",error:"error",primary:"primary",primaryDark:"primaryDark",primaryLight:"primaryLighter",secondary:"secondary",secondaryDark:"secondaryDark",secondaryLight:"secondaryLighter",success:"success",warning:"warning"},message:{default:"neutralDarker",error:"errorDark",success:"successDark",warning:"warningDark"},text:{default:"neutralDarker2",defaultLighter:"neutralLightest",disabled:"neutral",label:"neutralDarker",placeholder:"neutral"}}},foundational:{background:"neutralLighter3",border:"neutralLighter",eduqas:"warning",neutral:"neutral",primary:"primary",secondary:"secondary",tertiary:"tertiary",white:"basicWhite",wjec:"primary"},qualifications:{entrylevel:"qualificationMurkyGreenLight",gcealevel:"qualificationTealishBlueMid",gceaslevel:"qualificationTeal",gcse:"qualificationMurkyGreenMid",otherquals:"qualificationPlum",vqaward:"qualificationPinkMid",wbqadvanced:"qualificationTealishBlueLight",wbqfoundation:"qualificationOrangeLight",wbqkeystage4:"qualificationPinkLight",wbqnational:"qualificationYellowLight"},text:{body:{accent:"warningDark",default:"neutralDarker2",disabled:"neutral",highlight:"primaryDark",link:"primary",linkHoverBackground:"primaryLighter"},heading:{large:"primaryDarkest",medium:"neutralDarker2",primary:"primary",secondary:"secondary"}}}),k=({colorMapping:e={},...r})=>o({...r,themeColors:l(m,e)}),b=e=>`var(${p(e)})`,p=e=>`--${e.replaceAll(".","_").replaceAll(/[A-Z]/g,e=>`-${e.toLocaleLowerCase()}`)}`,D=e=>{const r=u("themes"),a=Object.fromEntries(Object.entries(e).map(([e,r])=>[e,k(r)]));g({themes:{...r,...a}})};let w,q;const v=()=>{const e=u("selectedTheme"),r=u("themes"),a=r[e].colorPalette,t=Object.keys(a).map(e=>`${p(e)}: ${a[e]};`),i=(e,r)=>{const a=[];return Object.entries(e).forEach(([e,t])=>{const n=`${r}.${e}`;if("string"==typeof t){const e=p(n);a.push(`${e}: ${b(t)};`)}else"object"==typeof t&&a.push(...i(t,n).flat())}),a},n=Object.entries(r[e].themeColors).map(([e,r])=>i(r,e)).flat();w.setAttribute("data-wjec-one-color-palette",e),q.setAttribute("data-wjec-one-theme-colors",e),w.innerHTML=`\n :root {\n ${t.join("\n")}\n }\n `,q.innerHTML=`\n :root {\n ${n.join("\n")}\n }\n `},j=e=>M(e),T=()=>{E();const e=u("selectedTheme").toLocaleLowerCase().includes("eduqas")?"eduqas":"wjec";return[{brand:e,colorPalette:"eduqas"===e?n:c},(...e)=>d()]},H=r=>{const[a]=T();return e(()=>"function"==typeof r?r(a):r,[a])};((e={})=>{D(e),w=document.createElement("style"),q=document.createElement("style"),document.head.appendChild(w),document.head.appendChild(q),v()})({legacyEduqas:{colorPalette:n,name:"Eduqas 4.0"},eduqas:{colorPalette:y,name:"Eduqas 5.0"},legacyWjec:{colorPalette:c,name:"WJEC 4.0"},wjec:{colorPalette:f,name:"WJEC 5.0"}});const A=(e=u("selectedTheme"))=>u("themes")[e],O=r(u("themes")[u("selectedTheme")]);let P;const M=e=>{const r="function"==typeof e?e(u("selectedTheme")):e;g({selectedTheme:r}),v(),P?.(r)},B=({children:e,defaultTheme:r="wjec"})=>{const i=s(),[n,c]=a(r);return i.current||r===u("selectedTheme")||M(r),P=c,t(O.Provider,{value:A(n)},e)},E=(e=u("selectedTheme"))=>{const r=i(O);return e!==u("selectedTheme")?u("themes")[e]:r},W=e=>{const{colorPalette:r}=E();return Object.hasOwn(r,e)?r[e]:e};export{B as ThemeProvider,L as colors,b as cssVar,p as getCssColorVariableName,A as getTheme,D as registerThemes,j as selectBrand,M as setTheme,E as useTheme,W as useThemeColor,T as useWjecOneTheme,H as useWjecOneThemeStyles};
|