@brightspace-ui/labs 1.1.1 → 1.2.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.
- package/README.md +22 -72
- package/package.json +12 -17
- package/src/components/localize-labs-element.js +11 -0
- package/src/components/opt-in-flyout/README.md +59 -0
- package/src/components/opt-in-flyout/flyout-impl.js +501 -0
- package/src/components/opt-in-flyout/opt-in-flyout.js +59 -0
- package/src/components/opt-in-flyout/opt-out-dialog.js +204 -0
- package/src/components/opt-in-flyout/opt-out-flyout.js +82 -0
- package/src/components/opt-in-flyout/opt-out-reason-selector.js +149 -0
- package/src/components/opt-in-flyout/opt-out-reason.js +22 -0
- package/src/lang/ar.js +20 -2
- package/src/lang/cy.js +21 -2
- package/src/lang/da.js +21 -2
- package/src/lang/de.js +21 -2
- package/src/lang/en.js +21 -2
- package/src/lang/es-es.js +21 -2
- package/src/lang/es.js +21 -2
- package/src/lang/fr-fr.js +21 -2
- package/src/lang/fr.js +21 -2
- package/src/lang/hi.js +23 -0
- package/src/lang/ja.js +21 -2
- package/src/lang/ko.js +21 -2
- package/src/lang/nl.js +21 -2
- package/src/lang/pt.js +21 -2
- package/src/lang/sv.js +21 -2
- package/src/lang/tr.js +21 -2
- package/src/lang/zh-cn.js +21 -2
- package/src/lang/zh-tw.js +21 -2
package/README.md
CHANGED
|
@@ -12,59 +12,42 @@ Install from NPM:
|
|
|
12
12
|
npm install @brightspace-ui/labs
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Developing, Testing and Contributing
|
|
15
|
+
## Developing and Contributing
|
|
19
16
|
|
|
20
17
|
After cloning the repo, run `npm install` to install dependencies.
|
|
21
18
|
|
|
22
|
-
### Linting
|
|
23
|
-
|
|
24
|
-
```shell
|
|
25
|
-
# eslint and lit-analyzer
|
|
26
|
-
npm run lint
|
|
27
|
-
|
|
28
|
-
# eslint only
|
|
29
|
-
npm run lint:eslint
|
|
30
|
-
```
|
|
31
|
-
|
|
32
19
|
### Testing
|
|
33
20
|
|
|
21
|
+
To run the full suite of tests:
|
|
22
|
+
|
|
34
23
|
```shell
|
|
35
|
-
# lint & run headless unit tests
|
|
36
24
|
npm test
|
|
37
|
-
|
|
38
|
-
# unit tests only
|
|
39
|
-
npm run test:headless
|
|
40
|
-
|
|
41
|
-
# debug or run a subset of local unit tests
|
|
42
|
-
npm run test:headless:watch
|
|
43
25
|
```
|
|
44
26
|
|
|
45
|
-
|
|
27
|
+
Alternatively, tests can be selectively run:
|
|
46
28
|
|
|
47
|
-
|
|
29
|
+
```shell
|
|
30
|
+
# eslint
|
|
31
|
+
npm run lint:eslint
|
|
48
32
|
|
|
49
|
-
|
|
33
|
+
# stylelint
|
|
34
|
+
npm run lint:style
|
|
50
35
|
|
|
51
|
-
|
|
36
|
+
# translations
|
|
37
|
+
npm run test:translations
|
|
52
38
|
|
|
53
|
-
|
|
54
|
-
npm
|
|
39
|
+
# unit tests
|
|
40
|
+
npm run test:unit
|
|
55
41
|
```
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Then run the tests:
|
|
43
|
+
This repo uses [@brightspace-ui/testing](https://github.com/BrightspaceUI/testing)'s vdiff command to perform visual regression testing:
|
|
60
44
|
|
|
61
45
|
```shell
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
npx mocha './test/**/*.visual-diff.js' -t 10000 --golden
|
|
46
|
+
# vdiff
|
|
47
|
+
npm run test:vdiff
|
|
48
|
+
|
|
49
|
+
# re-generate goldens
|
|
50
|
+
npm run test:vdiff golden
|
|
68
51
|
```
|
|
69
52
|
|
|
70
53
|
### Running the demos
|
|
@@ -75,41 +58,8 @@ To start a [@web/dev-server](https://modern-web.dev/docs/dev-server/overview/) t
|
|
|
75
58
|
npm start
|
|
76
59
|
```
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
> TL;DR: Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`. Read on for more details...
|
|
81
|
-
|
|
82
|
-
The [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) is called from the `release.yml` GitHub Action workflow to handle version changes and releasing.
|
|
83
|
-
|
|
84
|
-
### Version Changes
|
|
85
|
-
|
|
86
|
-
All version changes should obey [semantic versioning](https://semver.org/) rules:
|
|
87
|
-
1. **MAJOR** version when you make incompatible API changes,
|
|
88
|
-
2. **MINOR** version when you add functionality in a backwards compatible manner, and
|
|
89
|
-
3. **PATCH** version when you make backwards compatible bug fixes.
|
|
90
|
-
|
|
91
|
-
The next version number will be determined from the commit messages since the previous release. Our semantic-release configuration uses the [Angular convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) when analyzing commits:
|
|
92
|
-
* Commits which are prefixed with `fix:` or `perf:` will trigger a `patch` release. Example: `fix: validate input before using`
|
|
93
|
-
* Commits which are prefixed with `feat:` will trigger a `minor` release. Example: `feat: add toggle() method`
|
|
94
|
-
* To trigger a MAJOR release, include `BREAKING CHANGE:` with a space or two newlines in the footer of the commit message
|
|
95
|
-
* Other suggested prefixes which will **NOT** trigger a release: `build:`, `ci:`, `docs:`, `style:`, `refactor:` and `test:`. Example: `docs: adding README for new component`
|
|
96
|
-
|
|
97
|
-
To revert a change, add the `revert:` prefix to the original commit message. This will cause the reverted change to be omitted from the release notes. Example: `revert: fix: validate input before using`.
|
|
98
|
-
|
|
99
|
-
### Releases
|
|
100
|
-
|
|
101
|
-
When a release is triggered, it will:
|
|
102
|
-
* Update the version in `package.json`
|
|
103
|
-
* Tag the commit
|
|
104
|
-
* Create a GitHub release (including release notes)
|
|
105
|
-
* Deploy a new package to NPM
|
|
106
|
-
|
|
107
|
-
### Releasing from Maintenance Branches
|
|
108
|
-
|
|
109
|
-
Occasionally you'll want to backport a feature or bug fix to an older release. `semantic-release` refers to these as [maintenance branches](https://semantic-release.gitbook.io/semantic-release/usage/workflow-configuration#maintenance-branches).
|
|
61
|
+
### Versioning and Releasing
|
|
110
62
|
|
|
111
|
-
|
|
63
|
+
This repo is configured to use `semantic-release`. Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`.
|
|
112
64
|
|
|
113
|
-
|
|
114
|
-
* `1.15.x` for patch releases on top of the `1.15` release (after version `1.16` exists)
|
|
115
|
-
* `2.x` for feature releases on top of the `2` release (after version `3` exists)
|
|
65
|
+
To learn how to create major releases and release from maintenance branches, refer to the [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) documentation.
|
package/package.json
CHANGED
|
@@ -4,35 +4,30 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "https://github.com/BrightspaceUI/labs.git",
|
|
6
6
|
"exports": {
|
|
7
|
+
"./components/opt-in-flyout.js": "./src/components/opt-in-flyout/opt-in-flyout.js",
|
|
8
|
+
"./components/opt-out-flyout.js": "./src/components/opt-in-flyout/opt-out-flyout.js",
|
|
9
|
+
"./components/opt-out-reason.js": "./src/components/opt-in-flyout/opt-out-reason.js",
|
|
7
10
|
"./controllers/computed-value.js": "./src/controllers/computed-values/computed-value.js",
|
|
8
11
|
"./controllers/computed-values.js": "./src/controllers/computed-values/computed-values.js"
|
|
9
12
|
},
|
|
10
13
|
"scripts": {
|
|
11
|
-
"lint": "npm run lint:eslint && npm run lint:
|
|
14
|
+
"lint": "npm run lint:eslint && npm run lint:style",
|
|
12
15
|
"lint:eslint": "eslint . --ext .js,.html",
|
|
13
|
-
"lint:lit": "lit-analyzer \"src/**/*.js\" --strict",
|
|
14
16
|
"lint:style": "stylelint \"**/*.{js,html}\"",
|
|
15
17
|
"start": "web-dev-server --node-resolve --open --watch",
|
|
16
|
-
"test": "npm run lint && npm run test:
|
|
17
|
-
"test:
|
|
18
|
-
"test:
|
|
18
|
+
"test": "npm run lint && npm run test:translations && npm run test:unit",
|
|
19
|
+
"test:translations": "mfv -e -s en -p ./lang/ -i untranslated",
|
|
20
|
+
"test:unit": "d2l-test-runner"
|
|
19
21
|
},
|
|
20
22
|
"author": "D2L Corporation",
|
|
21
23
|
"license": "Apache-2.0",
|
|
22
24
|
"devDependencies": {
|
|
23
|
-
"@babel/core": "^7",
|
|
24
|
-
"@babel/eslint-parser": "^7",
|
|
25
25
|
"@brightspace-ui/stylelint-config": "^0.8",
|
|
26
|
-
"@
|
|
27
|
-
"@web/dev-server": "^0.
|
|
28
|
-
"@web/test-runner": "^0.16",
|
|
26
|
+
"@brightspace-ui/testing": "^0.28",
|
|
27
|
+
"@web/dev-server": "^0.3",
|
|
29
28
|
"eslint": "^8",
|
|
30
|
-
"eslint-config-brightspace": "^0.
|
|
31
|
-
"
|
|
32
|
-
"eslint-plugin-import": "^2",
|
|
33
|
-
"eslint-plugin-lit": "^1",
|
|
34
|
-
"eslint-plugin-sort-class-members": "^1",
|
|
35
|
-
"lit-analyzer": "^1",
|
|
29
|
+
"eslint-config-brightspace": "^0.25",
|
|
30
|
+
"messageformat-validator": "^2",
|
|
36
31
|
"stylelint": "^15"
|
|
37
32
|
},
|
|
38
33
|
"files": [
|
|
@@ -46,5 +41,5 @@
|
|
|
46
41
|
"@brightspace-ui/core": "^2",
|
|
47
42
|
"lit": "^2"
|
|
48
43
|
},
|
|
49
|
-
"version": "1.
|
|
44
|
+
"version": "1.2.1"
|
|
50
45
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LocalizeDynamicMixin } from '@brightspace-ui/core/mixins/localize-dynamic-mixin.js';
|
|
2
|
+
|
|
3
|
+
export const LocalizeLabsElement = (superclass) => class extends LocalizeDynamicMixin(superclass) {
|
|
4
|
+
|
|
5
|
+
static get localizeConfig() {
|
|
6
|
+
return {
|
|
7
|
+
importFunc: async lang => (await import(`../lang/${lang}.js`)).default
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Opt-in/Opt-out Flyouts
|
|
2
|
+
|
|
3
|
+
The `<d2l-labs-opt-in-flyout>` and `<d2l-labs-opt-out-flyout>` can be used in applications to enable users to opt-in or out of new experiences.
|
|
4
|
+
|
|
5
|
+
<!-- docs: start hidden content -->
|
|
6
|
+
### Properties
|
|
7
|
+
|
|
8
|
+
| Property | Type | Description |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `opened` | Boolean, default: `false` | Indicates the opened or closed state of the flyout |
|
|
11
|
+
| `flyout-title` | String, required | Title to display at the top of the flyout |
|
|
12
|
+
| `short-description` | String |Descriptive text shown beneath the `flyout-title` |
|
|
13
|
+
| `long-description` | String | Additional text shown beneath `short-description` |
|
|
14
|
+
| `tab-position` | String, default: `'right'` | Position to display the expand/collapse tab. Can either be an integer percentage (including the `%` character) or the string `left`, `right`, or `center`/`centre`. |
|
|
15
|
+
| `tutorial-link` | String | A URL for a tutorial of the new experience or feature |
|
|
16
|
+
| `help-docs-link` | String | A URL for help documentation on the new experience or feature |
|
|
17
|
+
|
|
18
|
+
Additional properties for `<d2l-labs-opt-out-flyout>`:
|
|
19
|
+
|
|
20
|
+
| Property | Type | Description |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `hide-reason` | Boolean, default: `false` | Hides the reason field from the opt-out dialog |
|
|
23
|
+
| `hide-feedback` | Boolean, default: `false` | Hides the feedback textarea field from the opt-out dialog |
|
|
24
|
+
|
|
25
|
+
If both `hide-reason` _and_ `hide-feedback` are specified, the opt-out dialog will not display.
|
|
26
|
+
|
|
27
|
+
### Events
|
|
28
|
+
* `flyout-opened`: flyout was expanded
|
|
29
|
+
* `flyout-closed`: flyout was collapsed
|
|
30
|
+
* `opt-in`: *Turn it on* / *Leave it on* button was clicked
|
|
31
|
+
* `opt-out`: *Leave it off* / *Turn it off* button was clicked
|
|
32
|
+
<!-- docs: end hidden content -->
|
|
33
|
+
|
|
34
|
+
## Opt-out Reasons
|
|
35
|
+
|
|
36
|
+
By default, `<d2l-labs-opt-out-flyout>` will make the following opt-out reasons available to the user, in addition to "other":
|
|
37
|
+
|
|
38
|
+
| key | English text |
|
|
39
|
+
| ----------------------- | ----------------------------------------------- |
|
|
40
|
+
| `NotReadyForSomethingNew` | It's not a good time for me to try this version |
|
|
41
|
+
| `MissingFeature` | It's missing a feature that I use |
|
|
42
|
+
| `JustCheckingSomething` | Just switching back to check something |
|
|
43
|
+
| `PreferOldExperience` | I think the old version is a better experience |
|
|
44
|
+
|
|
45
|
+
To provide custom reasons, place `<d2l-labs-opt-out-reason>` elements as children of `<d2l-labs-opt-out-flyout>`.
|
|
46
|
+
|
|
47
|
+
<!-- docs: start hidden content -->
|
|
48
|
+
### Properties
|
|
49
|
+
|
|
50
|
+
| Property | Type | Description |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `key` | String, required | Uniquely identifies the opt-out reason |
|
|
53
|
+
| `text` | String, required | Text that will be displayed to the user |
|
|
54
|
+
<!-- docs: end hidden content -->
|
|
55
|
+
|
|
56
|
+
When the `opt-out` event is fired from `<d2l-labs-opt-out-flyout>`, its `detail` will contain:
|
|
57
|
+
|
|
58
|
+
* `reason`: unique identifier for the opt-out reason
|
|
59
|
+
* `feedback`: optional feedback provided by the user
|