@brightspace-ui-labs/facet-filter-sort 5.5.1 → 5.6.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 CHANGED
@@ -191,41 +191,8 @@ npm run test:headless
191
191
  npm run test:headless:watch
192
192
  ```
193
193
 
194
- ## Versioning & Releasing
194
+ ### Versioning and Releasing
195
195
 
196
- > TL;DR: Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`. Read on for more details...
196
+ This repo is configured to use `semantic-release`. Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`.
197
197
 
198
- 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.
199
-
200
- ### Version Changes
201
-
202
- All version changes should obey [semantic versioning](https://semver.org/) rules:
203
- 1. **MAJOR** version when you make incompatible API changes,
204
- 2. **MINOR** version when you add functionality in a backwards compatible manner, and
205
- 3. **PATCH** version when you make backwards compatible bug fixes.
206
-
207
- 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:
208
- * Commits which are prefixed with `fix:` or `perf:` will trigger a `patch` release. Example: `fix: validate input before using`
209
- * Commits which are prefixed with `feat:` will trigger a `minor` release. Example: `feat: add toggle() method`
210
- * To trigger a MAJOR release, include `BREAKING CHANGE:` with a space or two newlines in the footer of the commit message
211
- * Other suggested prefixes which will **NOT** trigger a release: `build:`, `ci:`, `docs:`, `style:`, `refactor:` and `test:`. Example: `docs: adding README for new component`
212
-
213
- 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`.
214
-
215
- ### Releases
216
-
217
- When a release is triggered, it will:
218
- * Update the version in `package.json`
219
- * Tag the commit
220
- * Create a GitHub release (including release notes)
221
- * Deploy a new package to NPM
222
-
223
- ### Releasing from Maintenance Branches
224
-
225
- 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).
226
-
227
- Maintenance branch names should be of the form: `+([0-9])?(.{+([0-9]),x}).x`.
228
-
229
- Regular expressions are complicated, but this essentially means branch names should look like:
230
- * `1.15.x` for patch releases on top of the `1.15` release (after version `1.16` exists)
231
- * `2.x` for feature releases on top of the `2` release (after version `3` exists)
198
+ 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.
@@ -114,7 +114,7 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
114
114
  }
115
115
  </style>
116
116
  <d2l-dropdown-button-subtle
117
- text="[[_getOpenerText(totalSelectedOptionCount, disableOpenerTextVariation, openerText, openerTextSingle, openerTextMultiple)]]"
117
+ text="[[_getOpenerText(totalSelectedOptionCount, disableOpenerTextVariation, openerText, openerTextSingle, openerTextMultiple, localize, resources)]]"
118
118
  disabled="[[disabled]]">
119
119
  <d2l-dropdown-tabs
120
120
  min-width="[[minWidth]]"
@@ -123,7 +123,7 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
123
123
  no-padding-footer$="[[noPaddingFooter]]"
124
124
  render-content>
125
125
  <div class="d2l-labs-filter-dropdown-content-header">
126
- <span>[[_localizeOrAlt(headerText, 'filterBy')]]</span>
126
+ <span>[[_localizeOrAlt(headerText, 'filterBy', localize, resources)]]</span>
127
127
  <d2l-button-subtle text="[[localize('clear')]]" hidden$="[[!totalSelectedOptionCount]]" on-click="clearFilters"></d2l-button-subtle>
128
128
  </div>
129
129
  <d2l-tabs>
@@ -170,6 +170,8 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
170
170
  }
171
171
 
172
172
  _getOpenerText(totalSelectedOptionCount, disableOpenerTextVariation, openerText, openerTextSingle, openerTextMultiple) {
173
+ if (!this.localize || !this.resources) return;
174
+
173
175
  if (totalSelectedOptionCount === 0 || disableOpenerTextVariation) {
174
176
  return this._localizeOrAlt(openerText, 'filter');
175
177
  }
@@ -197,6 +199,7 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
197
199
  }
198
200
 
199
201
  _localizeOrAlt(altText, ...args) {
202
+ if (!this.localize || !this.resources) return;
200
203
  return altText ? altText : this.localize(...args);
201
204
  }
202
205
 
@@ -1,49 +1,8 @@
1
1
  import '@brightspace-ui/localize-behavior/d2l-localize-behavior.js';
2
- import ar from '../lang/ar.js';
3
- import cy from '../lang/cy.js';
4
- import da from '../lang/da.js';
5
- import de from '../lang/de.js';
6
- import en from '../lang/en.js';
7
- import es from '../lang/es.js';
8
- import eses from '../lang/es-es.js';
9
- import fr from '../lang/fr.js';
10
- import frfr from '../lang/fr-fr.js';
11
- import hi from '../lang/hi.js';
12
- import ja from '../lang/ja.js';
13
- import ko from '../lang/ko.js';
14
- import nl from '../lang/nl.js';
15
- import pt from '../lang/pt.js';
16
- import sv from '../lang/sv.js';
17
- import tr from '../lang/tr.js';
18
- import zhcn from '../lang/zh-cn.js';
19
- import zhtw from '../lang/zh-tw.js';
20
2
 
21
3
  const LocalizeBehaviorImpl = {
22
- properties: {
23
- resources: {
24
- value: function() {
25
- return {
26
- 'ar': ar,
27
- 'cy': cy,
28
- 'da': da,
29
- 'de': de,
30
- 'en': en,
31
- 'es': es,
32
- 'es-es': eses,
33
- 'fr': fr,
34
- 'fr-fr': frfr,
35
- 'hi': hi,
36
- 'ja': ja,
37
- 'ko': ko,
38
- 'nl': nl,
39
- 'pt': pt,
40
- 'sv': sv,
41
- 'tr': tr,
42
- 'zh-cn': zhcn,
43
- 'zh-tw': zhtw
44
- };
45
- }
46
- }
4
+ localizeConfig: {
5
+ importFunc: async lang => (await import(`../lang/${lang}.js`)).default
47
6
  }
48
7
  };
49
8
 
@@ -36,18 +36,14 @@ class LabsSortByDropdown extends mixinBehaviors(
36
36
  */
37
37
  _selectedOptionText: {
38
38
  type: String,
39
+ computed: '_computeSelectedOptionText(_text, localize, resources)'
39
40
  },
40
41
  /**
41
42
  * The text of the currently selected option
42
43
  */
43
44
  _text: {
44
45
  type: String,
45
- value: '',
46
- observer: function(selection) {
47
- this._selectedOptionText = this.compact
48
- ? this.localize('sort')
49
- : this.localize('sortWithOption', 'option', selection);
50
- }
46
+ value: ''
51
47
  },
52
48
 
53
49
  /**
@@ -143,6 +139,13 @@ class LabsSortByDropdown extends mixinBehaviors(
143
139
  this._boundListeners._onItemSelect);
144
140
  }
145
141
 
142
+ _computeSelectedOptionText(selection, localize, resources) {
143
+ if (!selection || !localize || !resources) return;
144
+ return this.compact
145
+ ? this.localize('sort')
146
+ : this.localize('sortWithOption', 'option', selection);
147
+ }
148
+
146
149
  _onItemSelect(e) {
147
150
  this._text = e.target.text;
148
151
  this.value = e.detail.value;
package/package.json CHANGED
@@ -22,8 +22,7 @@
22
22
  "lint:style": "stylelint \"**/*.{js,html}\"",
23
23
  "start": "web-dev-server --node-resolve --watch --open --app-index demo/index.html",
24
24
  "test": "npm run lint && npm run test:headless",
25
- "test:headless": "web-test-runner --group default",
26
- "test:headless:watch": "web-test-runner --group default --watch"
25
+ "test:headless": "d2l-test-runner"
27
26
  },
28
27
  "author": "D2L Corporation",
29
28
  "license": "Apache-2.0",
@@ -31,20 +30,19 @@
31
30
  "@babel/core": "^7",
32
31
  "@babel/eslint-parser": "^7",
33
32
  "@brightspace-ui/stylelint-config": "^0.8",
34
- "@open-wc/testing": "^3",
33
+ "@brightspace-ui/testing": "^1",
35
34
  "@web/dev-server": "^0.3",
36
- "@web/test-runner": "^0.15",
37
35
  "eslint": "^8",
38
36
  "eslint-config-brightspace": "^0.25",
39
37
  "lit-analyzer": "^1",
40
38
  "stylelint": "^15"
41
39
  },
42
- "version": "5.5.1",
40
+ "version": "5.6.0",
43
41
  "dependencies": {
42
+ "@brightspace-ui-labs/multi-select": "^6",
44
43
  "@brightspace-ui/core": "^2",
45
44
  "@brightspace-ui/localize-behavior": "^2",
46
- "@brightspace-ui-labs/multi-select": "^6",
47
- "lit": "^2",
48
- "@polymer/polymer": "^3"
45
+ "@polymer/polymer": "^3",
46
+ "lit": "^2"
49
47
  }
50
48
  }