@moodlehq/design-system 0.1.0 → 2.0.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 +102 -52
- package/dist/components/index.d.ts +2 -0
- package/dist/index.css +488 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -14
- package/tokens/css/borders.css +18 -0
- package/tokens/css/colors.css +68 -0
- package/tokens/css/index.css +11 -0
- package/tokens/css/primitives.css +162 -0
- package/tokens/css/shadows.css +15 -0
- package/tokens/css/sizes.css +13 -0
- package/tokens/css/spacing.css +14 -0
- package/tokens/css/typography.css +47 -0
- package/tokens/scss/_borders.scss +15 -0
- package/tokens/scss/_colors.scss +65 -0
- package/tokens/scss/_index.legacy.scss +11 -0
- package/tokens/scss/_index.scss +10 -0
- package/tokens/scss/_primitives.scss +159 -0
- package/tokens/scss/_shadows.scss +12 -0
- package/tokens/scss/_sizes.scss +10 -0
- package/tokens/scss/_spacing.scss +11 -0
- package/tokens/scss/_typography.scss +44 -0
- package/dist/index.cjs.js +0 -15
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -628
- package/dist/index.es.js.map +0 -1
- package/dist/src/index.d.ts +0 -1
- /package/dist/{src → components}/button/Button.d.ts +0 -0
- /package/dist/{src → components}/button/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# [Moodle Design System](https://github.com/moodlehq/design-system)
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
4
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
6
5
|
|
|
7
6
|
[](https://github.com/moodlehq/design-system/actions/workflows/testing.yml)
|
|
8
7
|
[](https://www.bestpractices.dev/projects/11543)
|
|
9
8
|
[](https://scorecard.dev/viewer/?uri=github.com/moodlehq/design-system)
|
|
10
9
|
|
|
11
|
-
Welcome! Whether you
|
|
10
|
+
Welcome! Whether you're a designer or a developer, this guide will help you get started and connect you to the essential resources you need.
|
|
12
11
|
|
|
13
12
|
The Moodle Design System (MDS) is a comprehensive collection of design and development resources aimed at creating a consistent and efficient user experience across all Moodle products starting with the Core LMS.
|
|
14
13
|
It includes design assets, guidelines, UI components, and code standards to help teams build cohesive and accessible interfaces.
|
|
@@ -21,14 +20,14 @@ The MDS is a collaborative effort between designers and developers at Moodle HQ
|
|
|
21
20
|
- [Design Tools](#design-tools)
|
|
22
21
|
- [Design Assets & Guidelines](#design-assets--guidelines)
|
|
23
22
|
- [Development Resources](#development-resources)
|
|
24
|
-
- [Prerequisites](#prerequisites)
|
|
25
|
-
- [Coding Standards](#coding-standards)
|
|
26
23
|
- [Development Tools](#development-tools)
|
|
24
|
+
- [Coding Standards](#coding-standards)
|
|
27
25
|
- [Installation & Usage](#installation--usage)
|
|
26
|
+
- [Prerequisites](#prerequisites)
|
|
28
27
|
- [Quick Start](#quick-start)
|
|
29
|
-
- [Convert Tokens From ZeroHeight
|
|
30
|
-
- [Testing
|
|
31
|
-
- [Build
|
|
28
|
+
- [Convert Tokens From ZeroHeight to CSS Variables](#convert-tokens-from-zeroheight-to-css-variables)
|
|
29
|
+
- [Testing the Design System](#testing-the-design-system)
|
|
30
|
+
- [Build the Design System](#build-the-design-system)
|
|
32
31
|
- [CHANGELOG](#changelog)
|
|
33
32
|
- [Contributing & Support](#contributing--support)
|
|
34
33
|
- [FAQ](#faq)
|
|
@@ -40,7 +39,7 @@ The MDS is a collaborative effort between designers and developers at Moodle HQ
|
|
|
40
39
|
|
|
41
40
|
To create and manage our design assets, we use the following tools:
|
|
42
41
|
|
|
43
|
-
- **[Figma](https://www.figma.com/)**: A collaborative design and prototyping tool. It
|
|
42
|
+
- **[Figma](https://www.figma.com/)**: A collaborative design and prototyping tool. It's the heart of the design process, allowing designers to work together seamlessly.
|
|
44
43
|
- **[ZeroHeight](https://zeroheight.com/)**: A platform for creating and maintaining design systems. It helps document design guidelines and components for easy access by the team.
|
|
45
44
|
|
|
46
45
|
### Design Assets & Guidelines
|
|
@@ -51,50 +50,34 @@ All design assets and guidelines are centralized in the following resource:
|
|
|
51
50
|
|
|
52
51
|
## Development Resources
|
|
53
52
|
|
|
54
|
-
###
|
|
53
|
+
### Development Tools
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
55
|
+
Key tools for contributing to the design system:
|
|
56
|
+
|
|
57
|
+
- **Code Editor**: Any modern editor supporting JavaScript/TypeScript. [VSCode](https://code.visualstudio.com/) is recommended with pre-configured settings in `.vscode/` directory. [EditorConfig](https://editorconfig.org/) ensures consistent styles across all editors.
|
|
58
|
+
- **[Storybook](https://storybook.js.org/)**: Interactive component development and documentation environment.
|
|
59
|
+
- **[Chromatic](https://www.chromatic.com/)**: Visual regression testing and UI review platform.
|
|
60
|
+
- **[Style Dictionary](https://styledictionary.com/)**: Design token management and transformation.
|
|
61
|
+
- **[GitHub Actions](https://github.com/features/actions)**: CI/CD pipeline for automated testing and deployment.
|
|
59
62
|
|
|
60
63
|
### Coding Standards
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
This repository follows these standards:
|
|
63
66
|
|
|
64
|
-
- ESLint and Prettier
|
|
65
|
-
- OpenSSF Best Practices
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
- Pre-commit and pre-push hooks are set up to run tests and linters automatically.
|
|
71
|
-
- Testing is done using Vitest and Storybook\'s built-in testing capabilities.
|
|
72
|
-
- Storybook is configured to run components against accessibility standards using the [axe](https://www.npmjs.com/package/@storybook/addon-a11y) addon with WCAG 2.2 AA standards.
|
|
67
|
+
- **Code Quality**: [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) for consistent code style.
|
|
68
|
+
- **Security**: [OpenSSF Best Practices](https://www.bestpractices.dev/) and [OpenSSF Scorecard](https://scorecard.dev/) compliance.
|
|
69
|
+
- **Commits**: [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification.
|
|
70
|
+
- **Git Hooks**: [Husky](https://typicode.github.io/husky/) with [lint-staged](https://github.com/lint-staged/lint-staged), pre-commit, and pre-push hooks.
|
|
71
|
+
- **Testing**: [Vitest](https://vitest.dev/) for unit tests, [Storybook](https://storybook.js.org/) for component development and interaction testing.
|
|
72
|
+
- **Accessibility**: [WCAG 2.2 AA](https://www.w3.org/WAI/WCAG22/quickref/) compliance via [axe accessibility addon](https://www.npmjs.com/package/@storybook/addon-a11y).
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## Installation & Usage
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- **Code Editor**:
|
|
79
|
-
We recommend using VSCode or any other modern code editor that supports JavaScript/TypeScript development.
|
|
80
|
-
- `.editorconfig` is included to ensure consistent coding styles across different editors and IDEs.
|
|
81
|
-
- Editor configurations for VSCode are provided in the `.vscode/` directory.
|
|
82
|
-
- **[Node.js](https://nodejs.org/)**:
|
|
83
|
-
Ensure you have version `22.13.0` or higher installed.
|
|
84
|
-
- **[NPM](https://www.npmjs.com/)**:
|
|
85
|
-
Used to manage project dependencies.
|
|
86
|
-
- **[Storybook](https://storybook.js.org/)**:
|
|
87
|
-
A tool for developing and showcasing UI components in isolation.
|
|
88
|
-
- **[Chromatic](https://www.chromatic.com/)**:
|
|
89
|
-
Used for visual testing and review of UI components.
|
|
90
|
-
- **[Style Dictionary](https://styledictionary.com/)**:
|
|
91
|
-
Used to manage and convert design tokens.
|
|
92
|
-
- **Git**:
|
|
93
|
-
Make sure you have Git installed and are familiar with its basics.
|
|
94
|
-
- **Continuous Integration (CI)**:
|
|
95
|
-
Configured with GitHub Actions to automate testing and deployment.
|
|
76
|
+
### Prerequisites
|
|
96
77
|
|
|
97
|
-
|
|
78
|
+
- Node.js v22.13.0 or higher
|
|
79
|
+
- npm
|
|
80
|
+
- Git
|
|
98
81
|
|
|
99
82
|
### Quick Start
|
|
100
83
|
|
|
@@ -105,9 +88,11 @@ npm install
|
|
|
105
88
|
npm run storybook
|
|
106
89
|
```
|
|
107
90
|
|
|
108
|
-
Storybook will provide detailed documentation and interactive examples of all components in the design system
|
|
91
|
+
Storybook will provide detailed documentation and interactive examples of all components in the design system. However, a quick example is shown below:
|
|
109
92
|
|
|
110
93
|
```js
|
|
94
|
+
import '@moodlehq/design-system/css';
|
|
95
|
+
|
|
111
96
|
import { Button } from '@moodlehq/design-system';
|
|
112
97
|
|
|
113
98
|
export default function App() {
|
|
@@ -115,7 +100,69 @@ export default function App() {
|
|
|
115
100
|
}
|
|
116
101
|
```
|
|
117
102
|
|
|
118
|
-
|
|
103
|
+
> **Note:** Subpath imports such as `@moodlehq/design-system/button` are not currently supported. Please import components from `@moodlehq/design-system`.
|
|
104
|
+
|
|
105
|
+
### Fonts
|
|
106
|
+
|
|
107
|
+
The recommended typeface for Moodle Design System is **[Roboto](https://fonts.google.com/specimen/Roboto)**. The package does not bundle font files. Provide Roboto in your application:
|
|
108
|
+
|
|
109
|
+
**Option 1: Google Fonts CDN**
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<link
|
|
113
|
+
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
|
|
114
|
+
rel="stylesheet"
|
|
115
|
+
/>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Option 2: Self-hosted**
|
|
119
|
+
Place font files in your project and add `@font-face` declarations:
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
@font-face {
|
|
123
|
+
font-family: 'Roboto';
|
|
124
|
+
src: url('./fonts/Roboto-VariableFont_wdth,wght.woff2') format('woff2');
|
|
125
|
+
font-weight: 100 900;
|
|
126
|
+
font-style: normal;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@font-face {
|
|
130
|
+
font-family: 'Roboto';
|
|
131
|
+
src: url('./fonts/Roboto-Italic-VariableFont_wdth,wght.woff2') format('woff2');
|
|
132
|
+
font-weight: 100 900;
|
|
133
|
+
font-style: italic;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Consuming Tokens Only
|
|
138
|
+
|
|
139
|
+
The design system supports standalone token integration without components. Tokens are available in both CSS and SCSS formats:
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
// CSS tokens
|
|
143
|
+
import '@moodlehq/design-system/tokens/css';
|
|
144
|
+
|
|
145
|
+
// SCSS tokens
|
|
146
|
+
import '@moodlehq/design-system/tokens/scss';
|
|
147
|
+
|
|
148
|
+
// SCSS tokens (legacy Sass @import syntax)
|
|
149
|
+
import '@moodlehq/design-system/tokens/scss/legacy';
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Legacy SCSS compatibility for Moodle Core LMS
|
|
153
|
+
|
|
154
|
+
Tag: `MDS_LEGACY_SCSSPHP_COMPAT`
|
|
155
|
+
|
|
156
|
+
MDS now ships an optional legacy SCSS entrypoint (`@moodlehq/design-system/tokens/scss/legacy`) that uses Sass `@import` syntax.
|
|
157
|
+
|
|
158
|
+
- Use `@moodlehq/design-system/tokens/scss` (default) for modern Sass module syntax (`@use` / `@forward`).
|
|
159
|
+
- Use `@moodlehq/design-system/tokens/scss/legacy` when integrating with Moodle Core LMS environments that still rely on older `scssphp` behavior.
|
|
160
|
+
|
|
161
|
+
This legacy entrypoint is intended as a compatibility bridge until Core LMS completes a major `scssphp` library upgrade.
|
|
162
|
+
|
|
163
|
+
> **Note:** SCSS tokens use flat values rather than variable references. This is an intentional design decision due to limitations in Style Dictionary's built-in `scssVariables` formatter, which does not support `@use` imports for cross-file variable references. While a custom formatter could address this, it would also need to handle proper variable hoisting and sorting, requiring significant ongoing maintenance.
|
|
164
|
+
|
|
165
|
+
### Convert Tokens From ZeroHeight to CSS Variables
|
|
119
166
|
|
|
120
167
|
We make use of [Style Dictionary](https://styledictionary.com/) to convert design tokens exported from ZeroHeight into CSS variables that can be used throughout the design system and its consumers.
|
|
121
168
|
|
|
@@ -138,7 +185,7 @@ npx playwright install
|
|
|
138
185
|
npm run test-unit
|
|
139
186
|
# Run unit tests with coverage report.
|
|
140
187
|
npm run test-unit-coverage
|
|
141
|
-
# Run Storybook interaction & accessibility tests
|
|
188
|
+
# Run Storybook interaction & accessibility tests.
|
|
142
189
|
npm run test-storybook
|
|
143
190
|
```
|
|
144
191
|
|
|
@@ -165,22 +212,25 @@ See [CHANGELOG](CHANGELOG.md) for release history and updates.
|
|
|
165
212
|
|
|
166
213
|
For any contributions, issues, or support, please reach out to the Moodle HQ Design System team through the following channels:
|
|
167
214
|
|
|
168
|
-
- Submit a
|
|
215
|
+
- Submit a [GitHub Issue](https://github.com/moodlehq/design-system/issues)
|
|
169
216
|
- Join our [Matrix channel](https://matrix.to/#/!BmKCxoEFOvaJrscitV:moodle.com?via=moodle.com&via=matrix.org&via=lern.link)
|
|
170
217
|
- Join the [Moodle Design System PAG course](https://moodle.org/course/view.php?id=17258)
|
|
171
218
|
|
|
172
|
-
Pull requests are our suggested method for contributing to the design system. Please ensure that your contributions adhere to our contribution guidelines
|
|
219
|
+
Pull requests are our suggested method for contributing to the design system. Please ensure that your contributions adhere to our contribution guidelines. See [CONTRIBUTING](CONTRIBUTING) for more information.
|
|
173
220
|
|
|
174
221
|
## FAQ
|
|
175
222
|
|
|
176
223
|
**Q:** Does this work with Moodle LMS 5.x?<br>
|
|
177
|
-
**A:**
|
|
224
|
+
**A:** We are aiming for integration with Moodle LMS 5.2.
|
|
178
225
|
|
|
179
226
|
**Q:** How do I report a bug or request a feature?<br>
|
|
180
|
-
**A:** Please use
|
|
227
|
+
**A:** Please use [GitHub Issues](https://github.com/moodlehq/design-system/issues) to report bugs or request features.
|
|
181
228
|
|
|
182
229
|
**Q:** Will my Moodle instance automatically use the latest Design System release?<br>
|
|
183
|
-
**A:**
|
|
230
|
+
**A:** This will depend on the upcoming integration we are looking into. You will likely need to update your Moodle instance once we integrate into LMS.
|
|
231
|
+
|
|
232
|
+
**Q:** Can I import components via subpaths like `@moodlehq/design-system/button`?<br>
|
|
233
|
+
**A:** Not currently. Please import components from `@moodlehq/design-system`.
|
|
184
234
|
|
|
185
235
|
## License
|
|
186
236
|
|