Skip to content

Commit daa7907

Browse files
committed
Merge branch '4.0.0-dev' into v4-dynamic-illustreations
2 parents e272729 + 0cebf3e commit daa7907

71 files changed

Lines changed: 1379 additions & 454 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/core/scss/components/_star-rating.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
.tutor-star-rating-container {
55
@include tutor-flex(row, center, space-between);
6+
7+
button.tutor-star-rating-icon-btn {
8+
@include tutor-button-reset();
9+
min-height: unset;
10+
}
11+
612
&.is-emoji-view {
713
@include tutor-flex-column;
814
gap: $tutor-spacing-7;

assets/core/scss/components/_tooltip.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
text-align: center;
2525
pointer-events: none;
2626

27+
&-medium {
28+
max-width: 226px;
29+
padding: $tutor-spacing-5;
30+
}
31+
2732
&-large {
2833
max-width: 320px;
2934
padding: $tutor-spacing-5;

assets/core/scss/mixins/_buttons.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141

4242
&:disabled,
4343
&.disabled {
44-
color: $tutor-text-disabled;
44+
color: $tutor-text-subdued;
4545
cursor: not-allowed;
4646
pointer-events: none;
4747

4848
svg:not([class]) {
49-
color: $tutor-icon-disabled;
49+
color: $tutor-icon-subdued;
5050
}
5151
}
5252
}
@@ -103,7 +103,6 @@
103103
&:disabled,
104104
&.disabled {
105105
background-color: $tutor-button-disabled;
106-
color: $tutor-text-brand;
107106
--tutor-button-border-shadow: #{$tutor-button-primary-soft-border-shadow-disabled};
108107
}
109108
} @else if $variant == destructive {
@@ -130,7 +129,6 @@
130129
&:disabled,
131130
&.disabled {
132131
background-color: $tutor-button-disabled;
133-
color: $tutor-text-primary-inverse;
134132
--tutor-button-border-shadow: #{$tutor-button-destructive-border-shadow-disabled};
135133
}
136134
} @else if $variant == destructive-soft {

assets/core/scss/themes/_dark.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
@use '../tokens' as *;
55

6-
[data-tutor-theme='dark'] {
6+
// Mixin containing all dark theme tokens
7+
@mixin dark-theme-tokens {
78
// =============================================================================
89
// SURFACE COLORS
910
// =============================================================================
@@ -224,3 +225,16 @@
224225
--tutor-shadow-2xl: #{$tutor-shadow-2xl};
225226
--tutor-shadow-3xl: #{$tutor-shadow-3xl};
226227
}
228+
229+
// Apply dark theme when explicitly set
230+
[data-tutor-theme='dark'] {
231+
@include dark-theme-tokens;
232+
}
233+
234+
// Apply dark theme when system preference is dark
235+
// This prevents flash of light theme before JS loads
236+
@media (prefers-color-scheme: dark) {
237+
[data-tutor-theme='system'] {
238+
@include dark-theme-tokens;
239+
}
240+
}

assets/core/scss/themes/_deuteranomaly.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
// LIGHT — overrides specific to the light base theme
5959
// =============================================================================
6060

61-
[data-tutor-theme='light'][data-tutor-vision='deuteranomaly'] {
61+
@mixin deuteranomaly-light-tokens {
6262
// SURFACE COLORS
6363
--tutor-surface-warning: #{$tutor-warning-50};
6464
--tutor-surface-warning-hover: #{$tutor-warning-100};
@@ -97,7 +97,7 @@
9797
// DARK — overrides specific to the dark base theme
9898
// =============================================================================
9999

100-
[data-tutor-theme='dark'][data-tutor-vision='deuteranomaly'] {
100+
@mixin deuteranomaly-dark-tokens {
101101
// SURFACE COLORS
102102
--tutor-surface-warning: #{$tutor-gray-750};
103103
--tutor-surface-warning-hover: #{$tutor-warning-900};
@@ -133,3 +133,18 @@
133133
--tutor-visual-critical-1: #{$tutor-error-600};
134134
--tutor-visual-critical-2: #{$tutor-orange-900};
135135
}
136+
137+
[data-tutor-theme='light'][data-tutor-vision='deuteranomaly'],
138+
[data-tutor-theme='system'][data-tutor-vision='deuteranomaly'] {
139+
@include deuteranomaly-light-tokens;
140+
}
141+
142+
[data-tutor-theme='dark'][data-tutor-vision='deuteranomaly'] {
143+
@include deuteranomaly-dark-tokens;
144+
}
145+
146+
@media (prefers-color-scheme: dark) {
147+
[data-tutor-theme='system'][data-tutor-vision='deuteranomaly'] {
148+
@include deuteranomaly-dark-tokens;
149+
}
150+
}

assets/core/scss/themes/_deuteranopia.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
// LIGHT — overrides specific to the light base theme
5959
// =============================================================================
6060

61-
[data-tutor-theme='light'][data-tutor-vision='deuteranopia'] {
61+
@mixin deuteranopia-light-tokens {
6262
// SURFACE COLORS
6363
--tutor-surface-warning: #{$tutor-warning-50};
6464
--tutor-surface-warning-hover: #{$tutor-warning-100};
@@ -93,7 +93,7 @@
9393
// DARK — overrides specific to the dark base theme
9494
// =============================================================================
9595

96-
[data-tutor-theme='dark'][data-tutor-vision='deuteranopia'] {
96+
@mixin deuteranopia-dark-tokens {
9797
// SURFACE COLORS
9898
--tutor-surface-warning: #{$tutor-gray-750};
9999
--tutor-surface-warning-hover: #{$tutor-warning-900};
@@ -127,3 +127,18 @@
127127
--tutor-visual-critical-1: #{$tutor-orange-600};
128128
--tutor-visual-critical-2: #{$tutor-orange-900};
129129
}
130+
131+
[data-tutor-theme='light'][data-tutor-vision='deuteranopia'],
132+
[data-tutor-theme='system'][data-tutor-vision='deuteranopia'] {
133+
@include deuteranopia-light-tokens;
134+
}
135+
136+
[data-tutor-theme='dark'][data-tutor-vision='deuteranopia'] {
137+
@include deuteranopia-dark-tokens;
138+
}
139+
140+
@media (prefers-color-scheme: dark) {
141+
[data-tutor-theme='system'][data-tutor-vision='deuteranopia'] {
142+
@include deuteranopia-dark-tokens;
143+
}
144+
}

assets/core/scss/themes/_high-contrast.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// LIGHT — overrides specific to the light base theme
1010
// =============================================================================
1111

12-
[data-tutor-theme='light'][data-tutor-contrast='high'] {
12+
@mixin high-contrast-light-tokens {
1313
// TEXT COLORS
1414
--tutor-text-primary: #{$tutor-gray-950};
1515
--tutor-text-secondary: #{$tutor-gray-950};
@@ -43,7 +43,7 @@
4343
// DARK — overrides specific to the dark base theme
4444
// =============================================================================
4545

46-
[data-tutor-theme='dark'][data-tutor-contrast='high'] {
46+
@mixin high-contrast-dark-tokens {
4747
// TEXT COLORS
4848
--tutor-text-primary: #{$tutor-gray-100};
4949
--tutor-text-secondary: #{$tutor-gray-50};
@@ -72,3 +72,18 @@
7272
--tutor-visual-critical-2: #{$tutor-error-900};
7373
--tutor-visual-exception-1: #{$tutor-exception-3};
7474
}
75+
76+
[data-tutor-theme='light'][data-tutor-contrast='high'],
77+
[data-tutor-theme='system'][data-tutor-contrast='high'] {
78+
@include high-contrast-light-tokens;
79+
}
80+
81+
[data-tutor-theme='dark'][data-tutor-contrast='high'] {
82+
@include high-contrast-dark-tokens;
83+
}
84+
85+
@media (prefers-color-scheme: dark) {
86+
[data-tutor-theme='system'][data-tutor-contrast='high'] {
87+
@include high-contrast-dark-tokens;
88+
}
89+
}

assets/core/scss/themes/_protanopia.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
// LIGHT — overrides specific to the light base theme
6767
// =============================================================================
6868

69-
[data-tutor-theme='light'][data-tutor-vision='protanopia'] {
69+
@mixin protanopia-light-tokens {
7070
// SURFACE COLORS
7171
--tutor-surface-success: #{$tutor-cyan-50};
7272
--tutor-surface-critical: #{$tutor-orange-100};
@@ -89,7 +89,7 @@
8989
// DARK — overrides specific to the dark base theme
9090
// =============================================================================
9191

92-
[data-tutor-theme='dark'][data-tutor-vision='protanopia'] {
92+
@mixin protanopia-dark-tokens {
9393
// SURFACE COLORS
9494
--tutor-surface-success: #{$tutor-cyan-900};
9595
--tutor-surface-critical: #{$tutor-orange-900};
@@ -105,3 +105,18 @@
105105
--tutor-visual-critical-1: #{$tutor-orange-600};
106106
--tutor-visual-critical-2: #{$tutor-orange-900};
107107
}
108+
109+
[data-tutor-theme='light'][data-tutor-vision='protanopia'],
110+
[data-tutor-theme='system'][data-tutor-vision='protanopia'] {
111+
@include protanopia-light-tokens;
112+
}
113+
114+
[data-tutor-theme='dark'][data-tutor-vision='protanopia'] {
115+
@include protanopia-dark-tokens;
116+
}
117+
118+
@media (prefers-color-scheme: dark) {
119+
[data-tutor-theme='system'][data-tutor-vision='protanopia'] {
120+
@include protanopia-dark-tokens;
121+
}
122+
}

assets/core/ts/components/file-uploader.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,35 @@ export const fileUploader = (props: FileUploaderProps = defaultProps) => ({
234234

235235
if (this.multiple) {
236236
const mergedFiles = this.mergeFileLists(this.selectedFiles, validFiles);
237+
const totalFileSize = mergedFiles.reduce((total, current) => {
238+
if (typeof current === 'string') {
239+
return 0;
240+
}
241+
return total + Math.round(Number(current?.size) || 0);
242+
}, 0);
237243

238244
if (this.maxFiles && mergedFiles.length > this.maxFiles) {
239245
this.showError(
240246
sprintf(
241-
// translators: %d is the maximum number of files allowed
247+
// translators: %d is the maximum number of files allowed.
242248
__('Cannot select more than %d files', 'tutor'),
243249
this.maxFiles,
244250
),
245251
);
246252
return;
247253
}
248254

255+
if (totalFileSize > this.maxSize) {
256+
this.showError(
257+
sprintf(
258+
// translators: %1$s is the maximum allowed size.
259+
__('Maximum allowed size is %1$s.', 'tutor'),
260+
formatBytes(this.maxSize),
261+
),
262+
);
263+
return;
264+
}
265+
249266
this.selectedFiles = mergedFiles;
250267
} else {
251268
this.selectedFiles = [validFiles[0]];

0 commit comments

Comments
 (0)