@openedx/paragon 23.8.0 → 23.10.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/bin/paragon-scripts.js +5 -0
- package/dist/Button/_mixins.scss +25 -3
- package/dist/Button/index.scss +38 -630
- package/dist/core.css +8 -17
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/lib/__tests__/build-scss.test.js +14 -0
- package/lib/build-scss.js +10 -6
- package/lib/build-tokens.js +8 -0
- package/package.json +1 -1
- package/src/Button/_mixins.scss +25 -3
- package/src/Button/index.scss +38 -630
- package/tokens/src/themes/light/components/Alert.json +14 -0
- package/tokens/style-dictionary.js +64 -1
- package/tokens/utils.js +63 -16
|
@@ -143,4 +143,18 @@ describe('buildScssCommand', () => {
|
|
|
143
143
|
expect.any(Object),
|
|
144
144
|
);
|
|
145
145
|
});
|
|
146
|
+
|
|
147
|
+
it('should exclude core properly', () => {
|
|
148
|
+
buildScssCommand(['--excludeCore']);
|
|
149
|
+
|
|
150
|
+
expect(sass.compile).not.toHaveBeenCalledWith(
|
|
151
|
+
expect.stringContaining('core.scss'),
|
|
152
|
+
expect.any(Object),
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
expect(fs.readdirSync).toHaveBeenCalledWith(
|
|
156
|
+
expect.stringContaining('themes'),
|
|
157
|
+
expect.objectContaining({ withFileTypes: true }),
|
|
158
|
+
);
|
|
159
|
+
});
|
|
146
160
|
});
|
package/lib/build-scss.js
CHANGED
|
@@ -154,6 +154,7 @@ const compileAndWriteStyleSheets = ({
|
|
|
154
154
|
function buildScssCommand(commandArgs) {
|
|
155
155
|
const defaultArgs = {
|
|
156
156
|
corePath: path.resolve(process.cwd(), 'styles/scss/core/core.scss'),
|
|
157
|
+
excludeCore: false,
|
|
157
158
|
themesPath: path.resolve(process.cwd(), 'styles/css/themes'),
|
|
158
159
|
outDir: './dist',
|
|
159
160
|
defaultThemeVariants: 'light',
|
|
@@ -161,17 +162,20 @@ function buildScssCommand(commandArgs) {
|
|
|
161
162
|
|
|
162
163
|
const {
|
|
163
164
|
corePath,
|
|
165
|
+
excludeCore,
|
|
164
166
|
themesPath,
|
|
165
167
|
outDir,
|
|
166
168
|
defaultThemeVariants,
|
|
167
|
-
} = minimist(commandArgs, { default: defaultArgs });
|
|
169
|
+
} = minimist(commandArgs, { default: defaultArgs, boolean: ['excludeCore'] });
|
|
168
170
|
|
|
169
171
|
// Core CSS
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
if (!excludeCore) {
|
|
173
|
+
compileAndWriteStyleSheets({
|
|
174
|
+
name: 'core',
|
|
175
|
+
stylesPath: corePath,
|
|
176
|
+
outDir,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
175
179
|
|
|
176
180
|
// Theme Variants CSS
|
|
177
181
|
fs.readdirSync(themesPath, { withFileTypes: true })
|
package/lib/build-tokens.js
CHANGED
|
@@ -141,6 +141,14 @@ async function buildTokensCommand(commandArgs) {
|
|
|
141
141
|
outputReferences,
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
|
+
{
|
|
145
|
+
format: 'css/component-button-variant-overrides',
|
|
146
|
+
destination: `themes/${themeVariant}/overrides/component-button-variants.css`,
|
|
147
|
+
filter: transformSourceTokensOnly ? 'isSource' : undefined,
|
|
148
|
+
options: {
|
|
149
|
+
outputReferences,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
144
152
|
],
|
|
145
153
|
},
|
|
146
154
|
},
|
package/package.json
CHANGED
package/src/Button/_mixins.scss
CHANGED
|
@@ -16,7 +16,29 @@
|
|
|
16
16
|
@include border-radius($button-border-radius, 0);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/// Sets the CSS custom properties for a button variant
|
|
20
|
+
/// @param {String} $variant - The variant name (e.g., 'primary', 'outline-primary')
|
|
21
|
+
@mixin button-variant($variant) {
|
|
22
|
+
--pgn-btn-color: var(--pgn-color-btn-text-#{$variant});
|
|
23
|
+
--pgn-btn-bg: var(--pgn-color-btn-bg-#{$variant});
|
|
24
|
+
--pgn-btn-border-color: var(--pgn-color-btn-border-#{$variant});
|
|
25
|
+
--pgn-btn-hover-color: var(--pgn-color-btn-hover-text-#{$variant});
|
|
26
|
+
--pgn-btn-hover-bg: var(--pgn-color-btn-hover-bg-#{$variant});
|
|
27
|
+
--pgn-btn-hover-border-color: var(--pgn-color-btn-hover-border-#{$variant});
|
|
28
|
+
--pgn-btn-disabled-color: var(--pgn-color-btn-disabled-text-#{$variant});
|
|
29
|
+
--pgn-btn-disabled-bg: var(--pgn-color-btn-disabled-bg-#{$variant});
|
|
30
|
+
--pgn-btn-disabled-border-color: var(--pgn-color-btn-disabled-border-#{$variant});
|
|
31
|
+
--pgn-btn-active-color: var(--pgn-color-btn-active-text-#{$variant});
|
|
32
|
+
--pgn-btn-active-bg: var(--pgn-color-btn-active-bg-#{$variant});
|
|
33
|
+
--pgn-btn-active-border-color: var(--pgn-color-btn-active-border-#{$variant});
|
|
34
|
+
--pgn-btn-focus-outline-color: var(--pgn-color-btn-focus-outline-#{$variant});
|
|
35
|
+
--pgn-btn-focus-color: var(--pgn-color-btn-focus-text-#{$variant});
|
|
36
|
+
--pgn-btn-focus-border-color: var(--pgn-color-btn-focus-border-#{$variant});
|
|
37
|
+
--pgn-btn-focus-bg: var(--pgn-color-btn-focus-bg-#{$variant});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// Mixin for button states that affect border radius
|
|
41
|
+
/// @param {String} $side - The side of the button to affect ('left' or 'right')
|
|
20
42
|
@mixin button-border-radius-0($side) {
|
|
21
43
|
@if $side == 'right' {
|
|
22
44
|
@include border-right-radius(0);
|
|
@@ -26,7 +48,7 @@
|
|
|
26
48
|
@include border-left-radius(0);
|
|
27
49
|
}
|
|
28
50
|
|
|
29
|
-
|
|
51
|
+
/// Handle pseudo-classes
|
|
30
52
|
&.btn:not(:disabled, .disabled):focus,
|
|
31
53
|
&.btn:not(:disabled, .disabled):focus::before {
|
|
32
54
|
@if $side == 'left' {
|
|
@@ -49,7 +71,7 @@
|
|
|
49
71
|
}
|
|
50
72
|
}
|
|
51
73
|
|
|
52
|
-
|
|
74
|
+
/// Handle .active class
|
|
53
75
|
&.btn:not(:disabled, .disabled).active,
|
|
54
76
|
&.btn:not(:disabled, .disabled).active::before {
|
|
55
77
|
@if $side == 'right' {
|