@mediafly/js-ui 47.2.1-beta.0 → 47.3.1-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.
Files changed (54) hide show
  1. package/CHANGELOG.md +2 -14
  2. package/lib/auto-complete/auto-complete-match-renderer.component.d.ts +0 -2
  3. package/lib/auto-complete/auto-complete-match-renderer.component.js +4 -18
  4. package/lib/auto-complete/auto-complete-match-renderer.component.js.map +1 -1
  5. package/lib/auto-complete/auto-complete.component.html +2 -1
  6. package/lib/font-selector/font-selector.d.ts +39 -8
  7. package/lib/font-selector/font-selector.html +62 -13
  8. package/lib/font-selector/font-selector.js +190 -18
  9. package/lib/font-selector/font-selector.js.map +1 -1
  10. package/lib/font-selector/google-webfonts-api.service.d.ts +1 -1
  11. package/lib/font-selector/google-webfonts-api.service.js +10 -2
  12. package/lib/font-selector/google-webfonts-api.service.js.map +1 -1
  13. package/lib/font-selector/webfont-loader.service.d.ts +1 -2
  14. package/lib/font-selector/webfont-loader.service.js +2 -2
  15. package/lib/font-selector/webfont-loader.service.js.map +1 -1
  16. package/lib/jsui.module.css +13 -2
  17. package/lib/localization/index.strings.json +1 -1
  18. package/lib/rich-text/index.d.ts +0 -1
  19. package/lib/rich-text/index.js +0 -1
  20. package/lib/rich-text/index.js.map +1 -1
  21. package/lib/rich-text/rich-text.component.d.ts +2 -2
  22. package/lib/rich-text/rich-text.component.html +6 -14
  23. package/lib/rich-text/rich-text.component.js +6 -5
  24. package/lib/rich-text/rich-text.component.js.map +1 -1
  25. package/lib/styles.css +25 -16
  26. package/lib/tsconfig.deploy.tsbuildinfo +21 -33
  27. package/package.json +2 -2
  28. package/src/components/auto-complete/auto-complete-match-renderer.component.ts +5 -23
  29. package/src/components/auto-complete/auto-complete.component.html +2 -1
  30. package/src/components/auto-complete/auto-complete.component.less +2 -1
  31. package/src/components/font-selector/font-selector.html +62 -13
  32. package/src/components/font-selector/font-selector.less +116 -0
  33. package/src/components/font-selector/font-selector.ts +210 -17
  34. package/src/components/font-selector/google-webfonts-api.backend.ts +1 -1
  35. package/src/components/font-selector/google-webfonts-api.service.ts +10 -2
  36. package/src/components/font-selector/webfont-loader.service.ts +2 -2
  37. package/src/components/index.less +1 -1
  38. package/src/components/less/objects/buttons.less +8 -0
  39. package/src/components/less/objects/buttons.module.css +11 -0
  40. package/src/components/less/variables/colors.less +2 -2
  41. package/src/components/less/variables.module.css +2 -2
  42. package/src/components/localization/index.strings.json +1 -1
  43. package/src/components/rich-text/index.ts +0 -1
  44. package/src/components/rich-text/rich-text.component.html +6 -14
  45. package/src/components/rich-text/rich-text.component.less +5 -1
  46. package/src/components/rich-text/rich-text.component.ts +7 -5
  47. package/tsconfig.tsbuildinfo +48 -65
  48. package/lib/rich-text/rich-text-toolbar-container.component.d.ts +0 -16
  49. package/lib/rich-text/rich-text-toolbar-container.component.html +0 -12
  50. package/lib/rich-text/rich-text-toolbar-container.component.js +0 -75
  51. package/lib/rich-text/rich-text-toolbar-container.component.js.map +0 -1
  52. package/src/components/rich-text/rich-text-toolbar-container.component.html +0 -12
  53. package/src/components/rich-text/rich-text-toolbar-container.component.ts +0 -66
  54. package/src/components/rich-text/rich-text-toolbar-container.less +0 -21
package/CHANGELOG.md CHANGED
@@ -1,17 +1,5 @@
1
1
  ## @mediafly/js-ui changelog
2
2
 
3
- **47.2.0**
4
-
5
- * Buttons: Added small sizing to primary buttons
6
-
7
- **47.1.0**
8
-
9
- * Colors: Tweaked color-danger and color-danger-light values
10
-
11
- **47.0.0**
12
-
13
- * **Breaking:** Update AngularJS to 1.8
14
-
15
3
  **46.3.0**
16
4
 
17
5
  * CSS Modules: Added button module styles
@@ -69,11 +57,11 @@
69
57
 
70
58
  **45.0.1**
71
59
 
72
- * **Breaking:** Add an `o-hero` header typography class and update the font-size for `o-h1` class
60
+ * Add a `o-hero` header typography class and update the font-size for `o-h1` class
73
61
 
74
62
  **44.0.0**
75
63
 
76
- * **Breaking:** Errors: Start handling 400 api errors.
64
+ * Errors: Start handling 400 api errors.
77
65
 
78
66
  **43.4.2**
79
67
 
@@ -44,8 +44,6 @@ export default class AutoCompleteMatchRendererComponentController implements ng.
44
44
  protected keyEventElement: HTMLInputElement | null;
45
45
  protected matches: AutoCompleteMatch[];
46
46
  private debouncedFetchAndSetMatches;
47
- private fetchRequestCount;
48
- private inputArray;
49
47
  private observer;
50
48
  constructor($document: ng.IDocumentService, $element: ng.IAugmentedJQuery, $q: ng.IQService, $scope: ng.IScope, $timeout: ng.ITimeoutService);
51
49
  $onDestroy(): void;
@@ -21,8 +21,6 @@ export default class AutoCompleteMatchRendererComponentController {
21
21
  this.keyEventElement = null;
22
22
  this.matches = [];
23
23
  this.debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay);
24
- this.fetchRequestCount = 0;
25
- this.inputArray = [];
26
24
  this.onClickElsewhere = ($event) => {
27
25
  this.$timeout(() => {
28
26
  this.matches = [];
@@ -131,29 +129,17 @@ export default class AutoCompleteMatchRendererComponentController {
131
129
  });
132
130
  return;
133
131
  }
134
- // each keystroke above the minLength will fire a new fetch request and we'll want to end with the 'last' input so put each 'input' in an array
135
- this.inputArray.push(input);
136
132
  if (this.onStartedFetching) {
137
- this.fetchRequestCount = this.fetchRequestCount + 1;
138
133
  this.onStartedFetching();
139
134
  }
140
135
  // Wrap the entire fetch in a timeout so that fetching callbacks will
141
136
  // be called correctly while the async part happens.
142
137
  this.$timeout(() => {
143
- const inputArrayIndex = this.fetchRequestCount - 1;
144
- this.$q.when(this.getMatches({ input: this.inputArray[inputArrayIndex], origin: this.keyEventElementId }))
145
- .then((matches) => {
146
- if (this.fetchRequestCount === 0) {
147
- return;
148
- }
149
- // each set of matches could be shown when received but this can give a weird "flickering" effect depending on the async order of responses
150
- // instead, when the last thing in the current array of inputs is returned, use it & ignore the rest of the responses
151
- if ((inputArrayIndex === this.inputArray.length - 1) && this.onDoneFetching) {
152
- this.matches = matches;
138
+ this.$q.when(this.getMatches({ input, origin: this.keyEventElementId }))
139
+ .then(matches => {
140
+ this.matches = matches;
141
+ if (this.onDoneFetching) {
153
142
  this.onDoneFetching();
154
- // reset the count and array
155
- this.fetchRequestCount = 0;
156
- this.inputArray = [];
157
143
  }
158
144
  });
159
145
  });
@@ -1 +1 @@
1
- {"version":3,"file":"auto-complete-match-renderer.component.js","sourceRoot":"","sources":["../../src/components/auto-complete/auto-complete-match-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,CAAC,MAAM,QAAQ,CAAA;AAetB,MAAM,UAAU,yBAAyB,CAAC,CAAoB;IAC7D,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,4CAA4C;IAyBhE,YACW,SAA8B,EAC9B,QAA6B,EAC7B,EAAgB,EAChB,MAAiB,EACjB,QAA4B;QAJ5B,cAAS,GAAT,SAAS,CAAqB;QAC9B,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,OAAE,GAAF,EAAE,CAAc;QAChB,WAAM,GAAN,MAAM,CAAW;QACjB,aAAQ,GAAR,QAAQ,CAAoB;QAf7B,oBAAe,GAAyB,OAAO,CAAA;QAC/C,oBAAe,GAAG,CAAC,CAAC,CAAA;QACpB,oBAAe,GAA4B,IAAI,CAAA;QAC/C,YAAO,GAAwB,EAAE,CAAA;QAEnC,gCAA2B,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QACrF,sBAAiB,GAAW,CAAC,CAAA;QAC7B,eAAU,GAAa,EAAE,CAAA;QAsHzB,qBAAgB,GAAG,CAAC,MAAkB,EAAE,EAAE;YAEjD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;gBAClB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;YAClB,CAAC,CAAC,CAAA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,EAAE;QACT,KAAK,EAAE,GAAG;QACV,UAAU,EAAE,GAAG;QACf,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,GAAG;QACd,cAAc,EAAE,GAAG;QACnB,QAAQ,EAAE,GAAG;QACb,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,GAAG;KACd;IACD,UAAU,EAAE,4CAA4C;IACxD,QAAQ,EAAE,OAAO,CAAC,+CAA+C,CAAC;CAClE,CAAC,CAAA"}
1
+ {"version":3,"file":"auto-complete-match-renderer.component.js","sourceRoot":"","sources":["../../src/components/auto-complete/auto-complete-match-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,CAAC,MAAM,QAAQ,CAAA;AAetB,MAAM,UAAU,yBAAyB,CAAC,CAAoB;IAC7D,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,4CAA4C;IAuBhE,YACW,SAA8B,EAC9B,QAA6B,EAC7B,EAAgB,EAChB,MAAiB,EACjB,QAA4B;QAJ5B,cAAS,GAAT,SAAS,CAAqB;QAC9B,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,OAAE,GAAF,EAAE,CAAc;QAChB,WAAM,GAAN,MAAM,CAAW;QACjB,aAAQ,GAAR,QAAQ,CAAoB;QAb7B,oBAAe,GAAyB,OAAO,CAAA;QAC/C,oBAAe,GAAG,CAAC,CAAC,CAAA;QACpB,oBAAe,GAA4B,IAAI,CAAA;QAC/C,YAAO,GAAwB,EAAE,CAAA;QAEnC,gCAA2B,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QAsGrF,qBAAgB,GAAG,CAAC,MAAkB,EAAE,EAAE;YAEjD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;gB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IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,QAAQ,CAAC;YACb,YAAY,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK;YAC3E,MAAM,EAAE,IAAI,CAAC,iBAAiB;YAC9B,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;SAC7D,CAAC,CAAA;IACH,CAAC;IAwDO,aAAa,CAAC,KAAa;QAElC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,KAAK,CAAmB,CAAA;QACtF,IAAI,GAAG,EAAE;YACR,GAAG,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;SAC5D;IACF,CAAC;CACD;AAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,2BAA2B,EAAE;IAC5D,QAAQ,EAAE;QACT,KAAK,EAAE,GAAG;QACV,UAAU,EAAE,GAAG;QACf,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,GAAG;QACd,cAAc,EAAE,GAAG;QACnB,QAAQ,EAAE,GAAG;QACb,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,GAAG;KACd;IACD,UAAU,EAAE,4CAA4C;IACxD,QAAQ,EAAE,OAAO,CAAC,+CAA+C,CAAC;CAClE,CAAC,CAAA"}
@@ -27,7 +27,8 @@
27
27
  test-value="$ctrl.inputValue">
28
28
  </auto-complete-match-renderer>
29
29
 
30
- <span ng-class="{ 'is-visible': $ctrl.isFetching }" class="c-auto-complete__spinner fal fa-spin fa-spinner"></span>
30
+ <span ng-class="{ 'is-visible': $ctrl.isFetching }"
31
+ class="far fa-spin fa-spinner c-auto-complete__spinner"></span>
31
32
 
32
33
  <span ng-if="$ctrl.displayClose"
33
34
  ng-click="$ctrl.clear()"
@@ -1,25 +1,56 @@
1
- /// <reference types="google.fonts" />
2
1
  /// <reference types="angular" />
2
+ /// <reference types="angular-mocks" />
3
3
  import GoogleWebfontsApiService from './google-webfonts-api.service';
4
- import { AutoCompleteMatchObject } from '../auto-complete/auto-complete-match-renderer.component';
5
4
  import WebfontLoaderService from './webfont-loader.service';
6
5
  import { TranslateFactory } from '../translate/translate-factory';
7
6
  export interface FontFamilyStyle {
8
7
  'font-family': string;
9
8
  }
10
9
  export default class FontSelectorController implements ng.IComponentController {
10
+ private $document;
11
+ private $element;
12
+ private $timeout;
13
+ private $q;
11
14
  private googleWebfontsApiService;
12
15
  private translateFactory;
13
16
  private webfontLoaderService;
17
+ inputId: string;
14
18
  isDisabled?: boolean;
15
19
  isRequired?: boolean;
16
- onFontSelect: (param: {
17
- font: google.fonts.WebfontFamily;
20
+ fontFamily?: string;
21
+ onFontSelect?: (param: {
22
+ fontFamily: string;
18
23
  }) => void;
24
+ protected delay: number;
25
+ protected googleFonts: string[];
26
+ protected inputValue?: string;
27
+ protected interactionMode: 'mouse' | 'keyboard';
28
+ protected isDropdownVisible: boolean;
29
+ protected isFetching: boolean;
30
+ protected kbSelectedIndex: number;
31
+ protected keyEventElement: HTMLInputElement | null;
32
+ protected loadingFonts: boolean;
19
33
  protected placeholderText: string;
20
- constructor(googleWebfontsApiService: GoogleWebfontsApiService, translateFactory: TranslateFactory, webfontLoaderService: WebfontLoaderService);
21
- protected googleFonts: google.fonts.WebfontFamily[];
34
+ protected popularFonts: string[];
35
+ protected matches: string[];
36
+ protected minLength: number;
37
+ protected requiredText: string;
38
+ protected showPopular: boolean;
39
+ private debouncedFetchAndSetMatches;
40
+ private inputElement;
41
+ private observer;
42
+ constructor($document: ng.IDocumentService, $element: ng.IAugmentedJQuery, $timeout: ng.ITimeoutService, $q: ng.IQService, googleWebfontsApiService: GoogleWebfontsApiService, translateFactory: TranslateFactory, webfontLoaderService: WebfontLoaderService);
43
+ $onDestroy(): void;
22
44
  $onInit(): void;
23
- protected onFontLookup(value: string): AutoCompleteMatchObject<google.fonts.WebfontFamily>[];
24
- protected onSelect(font: google.fonts.WebfontFamily): void;
45
+ protected clearInput($event: any): void;
46
+ protected clickSelect($event: any): void;
47
+ dropdownWasMousedOver(): void;
48
+ protected inputClick($event: any): void;
49
+ protected inputValueWasChanged(): void;
50
+ protected matchWasSelected(match: string): void;
51
+ protected onFontLookup(value: string): ng.IPromise<string[]>;
52
+ private fetchAndSetMatches;
53
+ private onClickElsewhere;
54
+ private onKeyDown;
55
+ private scrollToMatch;
25
56
  }
@@ -1,13 +1,62 @@
1
- <auto-complete
2
- class="c-font-selector__input"
3
- clear-after-selection="true"
4
- delay="500"
5
- display-close="true"
6
- get-matches="$ctrl.onFontLookup(input)"
7
- input-id="fontLookup"
8
- is-disabled="$ctrl.isDisabled"
9
- is-required="$ctrl.isRequired"
10
- placeholder-text="{{ $ctrl.placeholderText }}"
11
- min-length="2"
12
- on-select="$ctrl.onSelect(value)">
13
- </auto-complete>
1
+ <ng-form class="o-form c-font-selector" novalidate>
2
+
3
+ <div ng-click="$ctrl.clickSelect($event)"
4
+ ng-class="{'is-disabled': $ctrl.isDisabled}"
5
+ class="c-font-selector__select">
6
+
7
+ <div>{{ $ctrl.fontFamily }}</div>
8
+
9
+ <div class="fas fa-sort c-font-selector__select__icon"></div>
10
+ </div>
11
+
12
+ <div
13
+ ng-if="!$ctrl.fontFamily && $ctrl.isRequired"
14
+ class="c-font-selector__warning">{{ $ctrl.requiredText }}
15
+ </div>
16
+
17
+ <div ng-class="{'is-visible': $ctrl.isDropdownVisible,
18
+ 'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
19
+ class="c-font-selector__dropdown">
20
+
21
+ <input
22
+ ng-click="$ctrl.inputClick($event)"
23
+ ng-model="$ctrl.inputValue"
24
+ autocapitalize="off"
25
+ autocomplete="off"
26
+ autocorrect="off"
27
+ class="o-form-control c-font-selector__input"
28
+ id="{{ $ctrl.inputId }}"
29
+ name="autocomplete"
30
+ placeholder="{{ $ctrl.placeholderText }}"
31
+ type="text">
32
+
33
+ <span ng-class="{ 'is-visible': $ctrl.isFetching && $ctrl.inputValue.length >= $ctrl.minLength }"
34
+ class="far fa-spin fa-spinner c-font-selector__dropdown__spinner">
35
+ </span>
36
+
37
+ <span ng-if="!$ctrl.isFetching && $ctrl.inputValue.length >= $ctrl.minLength"
38
+ ng-click="$ctrl.clearInput($event)"
39
+ class="c-font-selector__dropdown__close fal fa-times-circle">
40
+ </span>
41
+
42
+ <div ng-if="$ctrl.showPopular && !$ctrl.inputValue"
43
+ class="c-font-selector__dropdown__label">or select from popular <a class="o-link" href="https://fonts.google.com/" target="_blank">Google Fonts</a></div>
44
+
45
+ <div ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
46
+ class="c-font-selector__dropdown__matches">
47
+ <div
48
+ class="c-font-selector__match-row"
49
+ data-test="auto-complete-match"
50
+ ng-class="[
51
+ ($ctrl.interactionMode === 'mouse') ? 'with-mouse' : 'with-keyboard',
52
+ { 'is-selected': ($ctrl.kbSelectedIndex === $index) },
53
+ ]"
54
+ ng-style="{'font-family': match}"
55
+ ng-click="$ctrl.matchWasSelected(match)"
56
+ ng-repeat="match in $ctrl.matches">
57
+ <span>{{ match }}</span>
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
+ </ng-form>
@@ -13,45 +13,213 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  import { Component, Inject, Input, Output } from '../decorators';
14
14
  import GoogleWebfontsApiService from './google-webfonts-api.service';
15
15
  import WebfontLoaderService from './webfont-loader.service';
16
+ import _ from 'lodash';
16
17
  let FontSelectorController = class FontSelectorController {
17
- constructor(googleWebfontsApiService, translateFactory, webfontLoaderService) {
18
+ constructor($document, $element, $timeout, $q, googleWebfontsApiService, translateFactory, webfontLoaderService) {
19
+ this.$document = $document;
20
+ this.$element = $element;
21
+ this.$timeout = $timeout;
22
+ this.$q = $q;
18
23
  this.googleWebfontsApiService = googleWebfontsApiService;
19
24
  this.translateFactory = translateFactory;
20
25
  this.webfontLoaderService = webfontLoaderService;
26
+ this.delay = 500;
27
+ this.interactionMode = 'mouse';
28
+ this.kbSelectedIndex = -1;
29
+ this.keyEventElement = null;
30
+ this.loadingFonts = true;
31
+ this.matches = [];
32
+ this.minLength = 2;
33
+ this.showPopular = true;
34
+ this.debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay);
35
+ this.onClickElsewhere = ($event) => {
36
+ this.$timeout(() => {
37
+ this.isDropdownVisible = false;
38
+ });
39
+ };
40
+ this.onKeyDown = ($event) => this.$timeout(() => {
41
+ this.interactionMode = 'keyboard';
42
+ // Enter with no selection: let the $event through
43
+ if ($event.key === 'Enter' && this.kbSelectedIndex === -1) {
44
+ return;
45
+ }
46
+ // If the dropdown is closed, all we can do is arrow down to open the thing
47
+ if (this.matches.length === 0 && $event.key !== 'ArrowDown') {
48
+ return;
49
+ }
50
+ // Escape: close the dropdown
51
+ if ($event.key === 'Escape') {
52
+ this.matches = this.popularFonts;
53
+ this.showPopular = true;
54
+ }
55
+ // Arrow down with dropdown closed: fetch matches
56
+ if ($event.key === 'ArrowDown' && this.matches.length === 0) {
57
+ this.fetchAndSetMatches();
58
+ }
59
+ // Arrow keys with dropdown open: move the selection highlight
60
+ if ($event.key === 'ArrowDown' && this.matches.length > 0) {
61
+ const idx = Math.min(this.kbSelectedIndex + 1, this.matches.length - 1);
62
+ this.kbSelectedIndex = idx;
63
+ this.scrollToMatch(idx);
64
+ }
65
+ if ($event.key === 'ArrowUp') {
66
+ const idx = Math.max(this.kbSelectedIndex - 1, 0);
67
+ this.kbSelectedIndex = idx;
68
+ this.scrollToMatch(idx);
69
+ }
70
+ // Enter with a selection: set the selection to the currently highlighted match
71
+ if ($event.key === 'Enter' && this.kbSelectedIndex > -1) {
72
+ const match = this.matches[this.kbSelectedIndex];
73
+ this.matchWasSelected(match);
74
+ $event.preventDefault();
75
+ }
76
+ $event.stopPropagation();
77
+ });
78
+ }
79
+ $onDestroy() {
80
+ if (this.keyEventElement) {
81
+ this.keyEventElement.removeEventListener('input', this.debouncedFetchAndSetMatches);
82
+ this.keyEventElement.removeEventListener('keydown', this.onKeyDown);
83
+ }
84
+ const body = this.$document[0].body;
85
+ body.removeEventListener('click', this.onClickElsewhere);
86
+ this.observer.disconnect();
21
87
  }
22
88
  $onInit() {
89
+ if (!this.inputId) {
90
+ throw new Error(`You must provide a string to key-event-element-id on the AutoCompleteMatchRenderer.`);
91
+ }
23
92
  // set label text
24
- this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_FONTS');
93
+ this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_ALL_FONTS');
94
+ this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
95
+ // init list of popylar fonts
96
+ this.googleWebfontsApiService.getFontList('popularity')
97
+ .then(popularList => {
98
+ this.popularFonts = popularList.map(f => f.family);
99
+ this.popularFonts = this.popularFonts.slice(0, 50);
100
+ this.webfontLoaderService.loadFonts(this.popularFonts);
101
+ this.matches = this.popularFonts;
102
+ });
25
103
  // init list of google fonts
26
104
  this.googleWebfontsApiService.getFontList()
27
- .then(fontList => { this.googleFonts = fontList; });
105
+ .then(fontList => {
106
+ this.googleFonts = fontList.map(f => f.family);
107
+ this.loadingFonts = false;
108
+ });
109
+ const body = this.$document[0].body;
110
+ body.addEventListener('click', this.onClickElsewhere);
111
+ // Set up an observer that will find the input element and attach events when it is present.
112
+ this.observer = new MutationObserver(() => {
113
+ // expect the tag-input component to be defined in a div with the id autocomplete-tag-lookup
114
+ // this allows us to more reliably find the input to listen to when there are multiple instances of this combination
115
+ this.inputElement = this.$element.parent().find(`#${this.inputId}`)[0];
116
+ if (this.inputElement) {
117
+ this.keyEventElement = this.inputElement;
118
+ this.keyEventElement.addEventListener('input', this.debouncedFetchAndSetMatches);
119
+ this.keyEventElement.addEventListener('keydown', this.onKeyDown);
120
+ this.observer.disconnect();
121
+ }
122
+ });
123
+ this.observer.observe(body, { attributes: true, childList: true, characterData: false, subtree: true });
124
+ }
125
+ clearInput($event) {
126
+ this.inputValue = '';
127
+ this.matches = this.popularFonts;
128
+ this.showPopular = true;
129
+ $event.stopPropagation();
130
+ }
131
+ clickSelect($event) {
132
+ if (this.isDisabled) {
133
+ return;
134
+ }
135
+ this.isDropdownVisible = !this.isDropdownVisible;
136
+ if (this.isDropdownVisible) {
137
+ this.$timeout(() => {
138
+ this.inputElement.focus();
139
+ }, 250);
140
+ }
141
+ $event.stopPropagation();
142
+ }
143
+ // When the user mouses over the dropdown, we should remove any keyboard
144
+ // highlighting, since the mouse hover provides it too.
145
+ dropdownWasMousedOver() {
146
+ this.interactionMode = 'mouse';
147
+ this.kbSelectedIndex = -1;
148
+ }
149
+ inputClick($event) {
150
+ $event.stopPropagation();
151
+ }
152
+ inputValueWasChanged() {
153
+ this.debouncedFetchAndSetMatches();
154
+ }
155
+ matchWasSelected(match) {
156
+ this.matches = this.popularFonts;
157
+ this.showPopular = true;
158
+ this.kbSelectedIndex = -1;
159
+ this.inputValue = '';
160
+ this.fontFamily = match;
161
+ this.isDropdownVisible = false;
162
+ if (this.onFontSelect) {
163
+ this.onFontSelect({ fontFamily: this.fontFamily });
164
+ }
28
165
  }
29
166
  onFontLookup(value) {
167
+ value = value.toLocaleLowerCase();
168
+ // const fonts: google.fonts.WebfontFamily[] = []
30
169
  const fonts = this.googleFonts.filter(font => {
31
- return font.family.toLowerCase().includes(value.toLowerCase());
170
+ return font.toLowerCase().includes(value);
32
171
  });
33
172
  // load this set with the api service
34
173
  this.webfontLoaderService.loadFonts(fonts);
35
- return fonts.map(font => ({
36
- cssStyle: { 'font-family': font.family },
37
- displayValue: font.family,
38
- value: font
39
- }));
174
+ return this.$q.resolve(fonts);
40
175
  }
41
- onSelect(font) {
42
- this.onFontSelect({ font });
176
+ fetchAndSetMatches() {
177
+ this.isFetching = true;
178
+ const input = this.inputValue || (this.keyEventElement ? this.keyEventElement.value : '');
179
+ if (input.length < this.minLength) {
180
+ this.$timeout(() => {
181
+ this.matches = this.popularFonts;
182
+ this.showPopular = true;
183
+ });
184
+ return;
185
+ }
186
+ this.isFetching = true;
187
+ // Wrap the entire fetch in a timeout so that fetching callbacks will
188
+ // be called correctly while the async part happens.
189
+ this.$timeout(() => {
190
+ this.$q.when(this.onFontLookup(input))
191
+ .then(matches => {
192
+ this.matches = matches;
193
+ this.showPopular = false;
194
+ this.isFetching = false;
195
+ });
196
+ });
197
+ }
198
+ scrollToMatch(index) {
199
+ const row = this.$element.find('.c-font-selector__match-row')[index];
200
+ if (row) {
201
+ row.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
202
+ }
43
203
  }
44
204
  };
45
205
  __decorate([
46
- Input(),
206
+ Input('<'),
207
+ __metadata("design:type", String)
208
+ ], FontSelectorController.prototype, "inputId", void 0);
209
+ __decorate([
210
+ Input('<'),
47
211
  __metadata("design:type", Boolean)
48
212
  ], FontSelectorController.prototype, "isDisabled", void 0);
49
213
  __decorate([
50
- Input(),
214
+ Input('<'),
51
215
  __metadata("design:type", Boolean)
52
216
  ], FontSelectorController.prototype, "isRequired", void 0);
53
217
  __decorate([
54
- Output(),
218
+ Input('=?'),
219
+ __metadata("design:type", String)
220
+ ], FontSelectorController.prototype, "fontFamily", void 0);
221
+ __decorate([
222
+ Output('&?'),
55
223
  __metadata("design:type", Function)
56
224
  ], FontSelectorController.prototype, "onFontSelect", void 0);
57
225
  FontSelectorController = __decorate([
@@ -59,10 +227,14 @@ FontSelectorController = __decorate([
59
227
  selector: 'mflyFontSelector',
60
228
  template: require('./font-selector.html')
61
229
  }),
62
- __param(0, Inject('googleWebfontsApiService')),
63
- __param(1, Inject('translateFactory')),
64
- __param(2, Inject('webfontLoaderService')),
65
- __metadata("design:paramtypes", [GoogleWebfontsApiService, Object, WebfontLoaderService])
230
+ __param(0, Inject('$document')),
231
+ __param(1, Inject('$element')),
232
+ __param(2, Inject('$timeout')),
233
+ __param(3, Inject('$q')),
234
+ __param(4, Inject('googleWebfontsApiService')),
235
+ __param(5, Inject('translateFactory')),
236
+ __param(6, Inject('webfontLoaderService')),
237
+ __metadata("design:paramtypes", [Object, Object, Function, Function, GoogleWebfontsApiService, Object, WebfontLoaderService])
66
238
  ], FontSelectorController);
67
239
  export default FontSelectorController;
68
240
  //# sourceMappingURL=font-selector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,wBAAwB,MAAM,+BAA+B,CAAA;AAEpE,OAAO,oBAAoB,MAAM,0BAA0B,CAAA;AAa3D,IAAqB,sBAAsB,GAA3C,MAAqB,sBAAsB;IAQ1C,YAC6C,wBAAkD,EAC1D,gBAAkC,EAC9B,oBAA0C;QAFtC,6BAAwB,GAAxB,wBAAwB,CAA0B;QAC1D,qBAAgB,GAAhB,gBAAgB,CAAkB;QAC9B,yBAAoB,GAApB,oBAAoB,CAAsB;IAChF,CAAC;IAIJ,OAAO;QACN,iBAAiB;QACjB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAEzE,4BAA4B;QAC5B,IAAI,CAAC,wBAAwB,CAAC,WAAW,EAAE;aACzC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAA,CAAC,CAAC,CAAC,CAAA;IACpD,CAAC;IAES,YAAY,CAAC,KAAa;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,E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AEhC,oBAAoB;GApC/D,sBAAsB,CAgP1C;eAhPoB,sBAAsB"}
@@ -5,5 +5,5 @@ export default class GoogleWebfontsApiService {
5
5
  private $http;
6
6
  private apiSuccessHandler;
7
7
  constructor($http: ng.IHttpService, apiSuccessHandler: ApiSuccessHandler);
8
- getFontList(): ng.IPromise<google.fonts.WebfontFamily[]>;
8
+ getFontList(sort?: string): ng.IPromise<google.fonts.WebfontFamily[]>;
9
9
  }
@@ -17,8 +17,16 @@ let GoogleWebfontsApiService = class GoogleWebfontsApiService {
17
17
  this.$http = $http;
18
18
  this.apiSuccessHandler = apiSuccessHandler;
19
19
  }
20
- getFontList() {
21
- return this.$http.get('https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyB-3EKXiPv1rjJ0Ab3u4s9iUaTqHXMLVOI')
20
+ getFontList(sort) {
21
+ const call = 'https://www.googleapis.com/webfonts/v1/webfonts';
22
+ if (!sort) {
23
+ sort = 'alpha';
24
+ }
25
+ const params = {
26
+ key: 'AIzaSyB-3EKXiPv1rjJ0Ab3u4s9iUaTqHXMLVOI',
27
+ sort,
28
+ };
29
+ return this.$http.get(call, { params })
22
30
  .then((response) => {
23
31
  return this.apiSuccessHandler.response(response).items;
24
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,iBAAiB,MAAM,2CAA2C,CAAA;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACV,iBAAoC;QADhD,UAAK,GAAL,KAAK,CAAiB;QACV,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,6FAA6F,CAAC;aAC5I,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC;CAED,CAAA;AAfoB,wBAAwB;IAD5C,UAAU,CAAC,0BAA0B,CAAC;IAIpC,WAAA,MAAM,CAAC,OAAO,CAAC,CAAA;IACf,WAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;+CAA4B,iBAAiB;GAJtD,wBAAwB,CAe5C;eAfoB,wBAAwB"}
1
+ {"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,iBAAiB,MAAM,2CAA2C,CAAA;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACV,iBAAoC;QADhD,UAAK,GAAL,KAAK,CAAiB;QACV,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW,CAAC,IAAa;QACxB,MAAM,IAAI,GAAG,iDAAiD,CAAA;QAE9D,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,GAAG,OAAO,CAAA;SAAE;QAE7B,MAAM,MAAM,GAAG;YACd,GAAG,EAAE,yCAAyC;YAC9C,IAAI;SACJ,CAAA;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC;aAC/D,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC;CAED,CAAA;AAvBoB,wBAAwB;IAD5C,UAAU,CAAC,0BAA0B,CAAC;IAIpC,WAAA,MAAM,CAAC,OAAO,CAAC,CAAA;IACf,WAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;+CAA4B,iBAAiB;GAJtD,wBAAwB,CAuB5C;eAvBoB,wBAAwB"}
@@ -1,4 +1,3 @@
1
- /// <reference types="google.fonts" />
2
1
  export default class WebfontLoaderService {
3
- loadFonts(fontList: google.fonts.WebfontFamily[]): void;
2
+ loadFonts(families: string[]): void;
4
3
  }
@@ -7,8 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Injectable } from '../decorators';
8
8
  import WebFont from 'webfontloader';
9
9
  let WebfontLoaderService = class WebfontLoaderService {
10
- loadFonts(fontList) {
11
- const families = fontList.map(f => f.family);
10
+ loadFonts(families) {
11
+ // const families = fontList.map(f => f.family)
12
12
  let hasFonts = true;
13
13
  try {
14
14
  WebFont.load({
@@ -1 +1 @@
1
- {"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,OAAO,MAAM,eAAe,CAAA;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,QAAsC;QAE/C,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,QAAQ,GAAG,IAAI,CAAA;QAEnB,IAAI;YACH,OAAO,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE;oBACP,QAAQ;iBACR;gBACD,OAAO,EAAE,IAAI;aACb,CAAC,CAAA;SACF;QACD,OAAO,GAAG,EAAE;YACX,QAAQ,GAAG,KAAK,CAAA;SAChB;gBACO;YACP,IAAI,QAAQ,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE;wBACP,QAAQ;qBACR;oBACD,OAAO,EAAE,IAAI;iBACb,CAAC,CAAA;aACF;SACD;IACF,CAAC;CACD,CAAA;AA9BoB,oBAAoB;IADxC,UAAU,CAAC,sBAAsB,CAAC;GACd,oBAAoB,CA8BxC;eA9BoB,oBAAoB"}
1
+ {"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,OAAO,MAAM,eAAe,CAAA;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,QAAkB;QAE3B,+CAA+C;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAA;QAEnB,IAAI;YACH,OAAO,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE;oBACP,QAAQ;iBACR;gBACD,OAAO,EAAE,IAAI;aACb,CAAC,CAAA;SACF;QACD,OAAO,GAAG,EAAE;YACX,QAAQ,GAAG,KAAK,CAAA;SAChB;gBACO;YACP,IAAI,QAAQ,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE;wBACP,QAAQ;qBACR;oBACD,OAAO,EAAE,IAAI;iBACb,CAAC,CAAA;aACF;SACD;IACF,CAAC;CACD,CAAA;AA9BoB,oBAAoB;IADxC,UAAU,CAAC,sBAAsB,CAAC;GACd,oBAAoB,CA8BxC;eA9BoB,oBAAoB"}
@@ -32,8 +32,8 @@
32
32
  /* UI colors */
33
33
  --color-success-light: #d8f2e6;
34
34
  --color-success: #008c48;
35
- --color-danger-light: #f7dfe4;
36
- --color-danger: #d90d36;
35
+ --color-danger-light: #f9ebee;
36
+ --color-danger: #89142e;
37
37
  --color-warning-light: #f9e4de;
38
38
  --color-warning: #de6a44;
39
39
  --color-info-light: #d8edf5;
@@ -222,12 +222,23 @@
222
222
  }
223
223
 
224
224
  .button.isSmall {
225
+ background: #fff;
226
+ border: 1px solid var(--color-gray-x-light);
225
227
  border-radius: 16px;
226
228
  font-size: 13px;
227
229
  font-weight: var(--font-weight-regular);
228
230
  height: auto; /* Match the non-module large button height instead of using fixed height of flex button */
229
231
  line-height: 1;
230
232
  padding: 6px 12px;
233
+
234
+ /* We set an explicit background on this button so we need more specificity on the hover style: */
235
+ @media (hover: hover) {
236
+ &:hover {
237
+ background-color: var(--color-button-default-hover-background);
238
+ border-color: var(--color-button-default-hover-border);
239
+ color: var(--color-button-default-text);
240
+ }
241
+ }
231
242
  }
232
243
 
233
244
  .button.isRoundRect {