@brightspace-ui/core 1.191.1 → 1.193.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.
@@ -19,10 +19,12 @@ Used to surface pertinent information, cards make it easy for users to browse in
19
19
  <d2l-card-content-meta>Science • Grade 11</d2l-card-content-meta>
20
20
  </div>
21
21
  <div slot="footer">
22
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
23
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
24
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
25
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
22
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
23
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
24
+ </d2l-card-footer-link>
25
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
26
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
27
+ </d2l-card-footer-link>
26
28
  </div>
27
29
  </d2l-card>
28
30
  ```
@@ -90,10 +92,12 @@ Cards are composed of 3 sections. Each card will have a content section but is n
90
92
  <d2l-card-content-meta>Science • Grade 11</d2l-card-content-meta>
91
93
  </div>
92
94
  <div slot="footer">
93
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
94
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
95
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
96
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
95
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
96
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
97
+ </d2l-card-footer-link>
98
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
99
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
100
+ </d2l-card-footer-link>
97
101
  </div>
98
102
  </d2l-card>
99
103
  </div>
@@ -122,10 +126,12 @@ The `d2l-card` element is a container that provides specific layout using severa
122
126
  <d2l-card-content-meta>Science • Grade 11</d2l-card-content-meta>
123
127
  </div>
124
128
  <div slot="footer">
125
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
126
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
127
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
128
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
129
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
130
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
131
+ </d2l-card-footer-link>
132
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
133
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
134
+ </d2l-card-footer-link>
129
135
  </div>
130
136
  </d2l-card>
131
137
  ```
@@ -175,10 +181,12 @@ The `d2l-card-content-title` element is a helper for providing layout/style for
175
181
  <d2l-card-content-title>Biology</d2l-card-content-title>
176
182
  </div>
177
183
  <div slot="footer">
178
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
179
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
180
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
181
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
184
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
185
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
186
+ </d2l-card-footer-link>
187
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
188
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
189
+ </d2l-card-footer-link>
182
190
  </div>
183
191
  </d2l-card>
184
192
  ```
@@ -202,10 +210,12 @@ The `d2l-card-content-meta` element is a helper for providing layout/style for a
202
210
  <d2l-card-content-meta>Science • Grade 11</d2l-card-content-meta>
203
211
  </div>
204
212
  <div slot="footer">
205
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
206
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
207
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
208
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
213
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
214
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
215
+ </d2l-card-footer-link>
216
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
217
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
218
+ </d2l-card-footer-link>
209
219
  </div>
210
220
  </d2l-card>
211
221
  ```
@@ -229,15 +239,23 @@ The `d2l-card-footer-link` element is an icon link that can be placed in the `fo
229
239
  <d2l-card-content-meta>Science • Grade 11</d2l-card-content-meta>
230
240
  </div>
231
241
  <div slot="footer">
232
- <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2"></d2l-card-footer-link>
233
- <d2l-tooltip for="discussionsLink1">Discussions</d2l-tooltip>
234
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1"></d2l-card-footer-link>
235
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
242
+ <d2l-card-footer-link id="discussionsLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="2">
243
+ <d2l-tooltip slot="tooltip" for="discussionsLink1">Discussions</d2l-tooltip>
244
+ </d2l-card-footer-link>
245
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="1">
246
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 1 assignments due tomorrow.</d2l-tooltip>
247
+ </d2l-card-footer-link>
236
248
  </div>
237
249
  </d2l-card>
238
250
  ```
239
251
 
240
252
  <!-- docs: start hidden content -->
253
+ ### Slots
254
+
255
+ | Slot | Type | Description |
256
+ |--|--|--|
257
+ | `tooltip` | required | The tooltip for the footer link. |
258
+
241
259
  ### Properties:
242
260
 
243
261
  | Property | Type | Description |
@@ -247,8 +265,9 @@ The `d2l-card-footer-link` element is an icon link that can be placed in the `fo
247
265
  | `download` | Boolean | Download a URL instead of navigating to it |
248
266
  | `href` | String | Location for the primary action/navigation |
249
267
  | `rel` | String | Relationship of the target object to the link object |
250
- | `secondary-text` | String | Text to display as a superscript on the icon |
251
- | `secondary-text-type` | String | Controls the style of the secondary text bubble; options are `notification` and `count` |
268
+ | `secondary-count` | Number | Count to display as a superscript on the icon |
269
+ | `secondary-count-type` | String | Controls the style of the secondary count bubble; options are `notification` and `count` |
270
+ | `secondary-count-max-digits` | Number | Overrides the default maximum digits of the secondary count bubble (2 for `notification` and no limit for `count` type) |
252
271
  | `target` | String | Where to display the linked URL |
253
272
 
254
273
  See the [anchor element docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) for more information on standard link attributes and their values.
@@ -1,4 +1,5 @@
1
1
  import '../colors/colors.js';
2
+ import '../count-badge/count-badge-icon.js';
2
3
  import '../icons/icon.js';
3
4
  import { css, html, LitElement } from 'lit-element/lit-element.js';
4
5
  import { ifDefined } from 'lit-html/directives/if-defined.js';
@@ -7,6 +8,7 @@ import { RtlMixin } from '../../mixins/rtl-mixin.js';
7
8
 
8
9
  /**
9
10
  * An icon link that can be placed in the `footer` slot.
11
+ * @slot tooltip - slot for the link tooltip
10
12
  */
11
13
  class CardFooterLink extends RtlMixin(LitElement) {
12
14
 
@@ -25,7 +27,7 @@ class CardFooterLink extends RtlMixin(LitElement) {
25
27
  */
26
28
  hreflang: { type: String, reflect: true },
27
29
  /**
28
- * REQUIRED: Preset icon key (e.g. "tier1:gear")
30
+ * REQUIRED: Preset icon key (e.g. "tier1:gear"). Must be a tier 1 icon.
29
31
  */
30
32
  icon: { type: String, reflect: true },
31
33
  /**
@@ -33,13 +35,18 @@ class CardFooterLink extends RtlMixin(LitElement) {
33
35
  */
34
36
  rel: { type: String, reflect: true },
35
37
  /**
36
- * Secondary text to display as a superscript on the icon
38
+ * Secondary count to display as a count bubble on the icon
37
39
  */
38
- secondaryText: { type: String, attribute: 'secondary-text', reflect: true },
40
+ secondaryCount: { type: Number, attribute: 'secondary-count', reflect: true },
39
41
  /**
40
- * Controls the style of the secondary text bubble; options are 'notification' and 'count'
42
+ * Maximum digits to display in the secondary count. Defaults to no limit
41
43
  */
42
- secondaryTextType: { type: String, attribute: 'secondary-text-type', reflect: true },
44
+ secondaryCountMaxDigits: { type: String, attribute: 'secondary-count-max-digits' },
45
+ /**
46
+ * Controls the style of the secondary count bubble
47
+ * @type {'count'|'notification'}
48
+ */
49
+ secondaryCountType: { type: String, attribute: 'secondary-count-type', reflect: true },
43
50
  /**
44
51
  * Where to display the linked URL
45
52
  */
@@ -51,8 +58,7 @@ class CardFooterLink extends RtlMixin(LitElement) {
51
58
  /**
52
59
  * Specifies the media type in the form of a MIME type for the linked URL; purely advisory, with no built-in functionality
53
60
  */
54
- type: { type: String, reflect: true },
55
- _secondaryTextHidden: { type: Boolean }
61
+ type: { type: String, reflect: true }
56
62
  };
57
63
  }
58
64
 
@@ -73,64 +79,22 @@ class CardFooterLink extends RtlMixin(LitElement) {
73
79
  margin-right: 0;
74
80
  right: 0.15rem;
75
81
  }
76
- .d2l-card-footer-link-content {
77
- display: inline-block;
78
- line-height: 0;
79
- padding: 0.6rem;
80
- position: relative;
81
- text-align: center;
82
- }
83
82
  a {
84
83
  box-sizing: border-box;
85
84
  display: inline-block;
86
85
  height: 100%;
87
86
  outline: none;
88
- position: absolute;
89
87
  width: 100%;
90
- z-index: 1;
91
- }
92
- a[href]:focus + .d2l-card-footer-link-content > d2l-icon,
93
- a[href]:hover + .d2l-card-footer-link-content > d2l-icon {
94
- color: var(--d2l-color-celestine);
95
88
  }
96
- d2l-icon {
97
- height: 0.9rem;
98
- width: 0.9rem;
89
+ d2l-count-badge-icon {
90
+ text-align: initial;
99
91
  }
100
- .d2l-card-footer-link-secondary-text {
101
- border-radius: 0.75rem;
102
- box-shadow: 0 0 0 1px white;
103
- box-sizing: content-box;
104
- display: inline-block;
105
- font-size: 0.55rem;
106
- font-weight: 400;
107
- line-height: 100%;
108
- min-width: 0.5rem;
109
- padding: 2px;
110
- position: relative;
92
+ ::slotted(d2l-tooltip) {
93
+ left: calc(-50% + 11px) !important;
111
94
  }
112
- .d2l-card-footer-link-secondary-text-container {
113
- position: absolute;
114
- right: 1rem;
115
- top: 0;
116
- width: 1px;
117
- }
118
- :host([dir="rtl"]) .d2l-card-footer-link-secondary-text-container {
119
- left: 1rem;
120
- right: auto;
121
- }
122
- :host([secondary-text-type="notification"]) .d2l-card-footer-link-secondary-text {
123
- background-color: var(--d2l-color-carnelian-minus-1);
124
- border: 2px solid var(--d2l-color-carnelian-minus-1);
125
- color: white;
126
- }
127
- :host([secondary-text-type="count"]) .d2l-card-footer-link-secondary-text {
128
- background-color: var(--d2l-color-gypsum);
129
- border: 2px solid var(--d2l-color-gypsum);
130
- color: var(--d2l-color-ferrite);
131
- }
132
- [hidden].d2l-card-footer-link-secondary-text {
133
- display: none;
95
+ :host([dir="rtl"]) ::slotted(d2l-tooltip) {
96
+ left: 0;
97
+ right: calc(-50% + 11px) !important;
134
98
  }
135
99
  `];
136
100
  }
@@ -138,39 +102,48 @@ class CardFooterLink extends RtlMixin(LitElement) {
138
102
  constructor() {
139
103
  super();
140
104
  this.download = false;
141
- this.secondaryTextType = 'notification';
142
- this._secondaryTextHidden = true;
105
+ this.secondaryCountType = 'notification';
143
106
  }
144
107
 
145
108
  render() {
109
+ const noNumber = this.secondaryCount === undefined;
146
110
  return html`
147
- <a ?download="${this.download}"
111
+ <a @focus="${this._onFocus}"
112
+ @blur="${this._onBlur}"
113
+ ?download="${this.download}"
148
114
  href="${ifDefined(this.href)}"
149
115
  hreflang="${ifDefined(this.hreflang)}"
150
116
  rel="${ifDefined(this.rel)}"
151
117
  target="${ifDefined(this.target)}"
152
118
  type="${ifDefined(this.type)}">
153
119
  <span class="d2l-offscreen">${this.text}</span>
120
+ <d2l-count-badge-icon
121
+ aria-hidden="true"
122
+ icon="${this.icon}"
123
+ max-digits="${ifDefined(this.secondaryCountMaxDigits ? this.secondaryCountMaxDigits : undefined)}"
124
+ number="${noNumber ? 0 : this.secondaryCount}"
125
+ ?hide-zero="${noNumber}"
126
+ text="${this.text}"
127
+ type="${this._getType()}">
128
+ </d2l-count-badge-icon>
154
129
  </a>
155
- <div class="d2l-card-footer-link-content">
156
- <d2l-icon icon="${this.icon}"></d2l-icon>
157
- <div class="d2l-card-footer-link-secondary-text-container">
158
- <div class="d2l-card-footer-link-secondary-text" aria-hidden="true" ?hidden="${this._secondaryTextHidden}">${this.secondaryText}</div>
159
- </div>
160
- </div>
130
+ <slot name="tooltip"></slot>
161
131
  `;
162
132
  }
163
133
 
164
- updated(changedProperties) {
165
- super.updated(changedProperties);
166
- if (!changedProperties.has('secondaryText')) return;
167
- this._secondaryTextHidden = !(this.secondaryText && this.secondaryText.length > 0);
134
+ _getType() {
135
+ if (this.secondaryCountType === 'count') {
136
+ return this.secondaryCountType;
137
+ }
138
+ return 'notification';
139
+ }
140
+
141
+ _onBlur() {
142
+ this.shadowRoot.querySelector('d2l-count-badge-icon').forceFocusRing = false;
168
143
  }
169
144
 
170
- focus() {
171
- const elem = this.shadowRoot.querySelector('a');
172
- if (!elem) return;
173
- elem.focus();
145
+ _onFocus() {
146
+ this.shadowRoot.querySelector('d2l-count-badge-icon').forceFocusRing = true;
174
147
  }
175
148
 
176
149
  }
@@ -104,14 +104,18 @@
104
104
  <d2l-button-icon slot="actions" translucent text="unpin" icon="tier1:pin-filled"></d2l-button-icon>
105
105
  <div slot="content"><div>Hydrology</div><d2l-card-content-meta>This is some extra meta data that will fill the content slot of the card.</d2l-card-content-meta></div>
106
106
  <div slot="footer">
107
- <d2l-card-footer-link id="googleDriveLink1" icon="tier1:google-drive" text="Google Drive" secondary-text="99+" href="https://www.google.ca/drive/"></d2l-card-footer-link>
108
- <d2l-tooltip for="googleDriveLink1">Go to Google Drive</d2l-tooltip>
109
- <d2l-card-footer-link id="rssFeedLink1" icon="tier1:rss" text="RSS Feed" secondary-text="1"></d2l-card-footer-link>
110
- <d2l-tooltip for="rssFeedLink1">RSS Feed</d2l-tooltip>
111
- <d2l-card-footer-link id="outcomesLink1" icon="tier1:outcomes" text="Outcomes" secondary-text="5"></d2l-card-footer-link>
112
- <d2l-tooltip for="outcomesLink1">Outcomes</d2l-tooltip>
113
- <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-text="3"></d2l-card-footer-link>
114
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink1">You have 3 assignments due tomorrow.</d2l-tooltip>
107
+ <d2l-card-footer-link id="googleDriveLink1" icon="tier1:google-drive" text="Google Drive" secondary-count="100" href="https://www.google.ca/drive/">
108
+ <d2l-tooltip slot="tooltip" for="googleDriveLink1">Go to Google Drive</d2l-tooltip>
109
+ </d2l-card-footer-link>
110
+ <d2l-card-footer-link id="rssFeedLink1" icon="tier1:rss" text="RSS Feed" secondary-count="1">
111
+ <d2l-tooltip slot="tooltip" for="rssFeedLink1">RSS Feed</d2l-tooltip>
112
+ </d2l-card-footer-link>
113
+ <d2l-card-footer-link id="outcomesLink1" icon="tier1:outcomes" text="Outcomes" secondary-count="5">
114
+ <d2l-tooltip slot="tooltip" for="outcomesLink1">Outcomes</d2l-tooltip>
115
+ </d2l-card-footer-link>
116
+ <d2l-card-footer-link id="assignmentsLink1" icon="tier1:assignments" text="Assignments" secondary-count="3">
117
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink1">You have 3 assignments due tomorrow.</d2l-tooltip>
118
+ </d2l-card-footer-link>
115
119
  </div>
116
120
  </d2l-card>
117
121
 
@@ -123,12 +127,15 @@
123
127
  <d2l-button-icon slot="actions" translucent text="unpin" icon="tier1:pin-filled"></d2l-button-icon>
124
128
  <div slot="content">Grade 2</div>
125
129
  <div slot="footer">
126
- <d2l-card-footer-link id="googleDriveLink2" icon="tier1:google-drive" text="Google Drive" secondary-text="99+" href="https://www.google.ca/drive/"></d2l-card-footer-link>
127
- <d2l-tooltip for="googleDriveLink2">Go to Google Drive</d2l-tooltip>
128
- <d2l-card-footer-link id="rssFeedLink2" icon="tier1:rss" text="RSS Feed" secondary-text="1"></d2l-card-footer-link>
129
- <d2l-tooltip for="rssFeedLink2">RSS Feed</d2l-tooltip>
130
- <d2l-card-footer-link id="outcomesLink2" icon="tier1:outcomes" text="Outcomes" secondary-text="5"></d2l-card-footer-link>
131
- <d2l-tooltip for="outcomesLink2">Outcomes</d2l-tooltip>
130
+ <d2l-card-footer-link id="googleDriveLink2" icon="tier1:google-drive" text="Google Drive" secondary-count="100" href="https://www.google.ca/drive/">
131
+ <d2l-tooltip slot="tooltip" for="googleDriveLink2">Go to Google Drive</d2l-tooltip>
132
+ </d2l-card-footer-link>
133
+ <d2l-card-footer-link id="rssFeedLink2" icon="tier1:rss" text="RSS Feed" secondary-count="1">
134
+ <d2l-tooltip slot="tooltip" for="rssFeedLink2">RSS Feed</d2l-tooltip>
135
+ </d2l-card-footer-link>
136
+ <d2l-card-footer-link id="outcomesLink2" icon="tier1:outcomes" text="Outcomes" secondary-count="5">
137
+ <d2l-tooltip slot="tooltip" for="outcomesLink2">Outcomes</d2l-tooltip>
138
+ </d2l-card-footer-link>
132
139
  </div>
133
140
  </d2l-card>
134
141
 
@@ -192,14 +199,18 @@
192
199
  <d2l-button-icon slot="actions" translucent text="unpin" icon="tier1:pin-filled"></d2l-button-icon>
193
200
  <div slot="content"><div>Hydrology</div><d2l-card-content-meta>This is some extra meta data that will fill the content slot of the card.</d2l-card-content-meta></div>
194
201
  <div slot="footer">
195
- <d2l-card-footer-link id="googleDriveLink3" icon="tier1:google-drive" text="Google Drive" secondary-text="99+" href="https://www.google.ca/drive/"></d2l-card-footer-link>
196
- <d2l-tooltip for="googleDriveLink3">Go to Google Drive</d2l-tooltip>
197
- <d2l-card-footer-link id="rssFeedLink3" icon="tier1:rss" text="RSS Feed" secondary-text="1"></d2l-card-footer-link>
198
- <d2l-tooltip for="rssFeedLink3">RSS Feed</d2l-tooltip>
199
- <d2l-card-footer-link id="outcomesLink3" icon="tier1:outcomes" text="Outcomes" secondary-text="5"></d2l-card-footer-link>
200
- <d2l-tooltip for="outcomesLink3">Outcomes</d2l-tooltip>
201
- <d2l-card-footer-link id="assignmentsLink3" icon="tier1:assignments" text="Assignments" secondary-text="3"></d2l-card-footer-link>
202
- <d2l-tooltip position="top" style="width: 100%;" for="assignmentsLink3">You have 3 assignments due tomorrow.</d2l-tooltip>
202
+ <d2l-card-footer-link id="googleDriveLink3" icon="tier1:google-drive" text="Google Drive" secondary-count="100" href="https://www.google.ca/drive/">
203
+ <d2l-tooltip slot="tooltip" for="googleDriveLink3">Go to Google Drive</d2l-tooltip>
204
+ </d2l-card-footer-link>
205
+ <d2l-card-footer-link id="rssFeedLink3" icon="tier1:rss" text="RSS Feed" secondary-count="1">
206
+ <d2l-tooltip slot="tooltip" for="rssFeedLink3">RSS Feed</d2l-tooltip>
207
+ </d2l-card-footer-link>
208
+ <d2l-card-footer-link id="outcomesLink3" icon="tier1:outcomes" text="Outcomes" secondary-count="5">
209
+ <d2l-tooltip slot="tooltip" for="outcomesLink3">Outcomes</d2l-tooltip>
210
+ </d2l-card-footer-link>
211
+ <d2l-card-footer-link id="assignmentsLink3" icon="tier1:assignments" text="Assignments" secondary-count="3">
212
+ <d2l-tooltip slot="tooltip" position="top" style="width: 100%;" for="assignmentsLink3">You have 3 assignments due tomorrow.</d2l-tooltip>
213
+ </d2l-card-footer-link>
203
214
  </div>
204
215
  </d2l-card>
205
216
 
@@ -221,12 +232,15 @@
221
232
  <d2l-button-icon slot="actions" translucent text="unpin" icon="tier1:pin-filled"></d2l-button-icon>
222
233
  <div slot="content">Grade 2</div>
223
234
  <div slot="footer">
224
- <d2l-card-footer-link id="googleDriveLink4" icon="tier1:google-drive" text="Google Drive" secondary-text-type="count" secondary-text="99+" href="https://www.google.ca/drive/"></d2l-card-footer-link>
225
- <d2l-tooltip for="googleDriveLink4">Go to Google Drive</d2l-tooltip>
226
- <d2l-card-footer-link id="rssFeedLink4" icon="tier1:rss" text="RSS Feed" secondary-text-type="count" secondary-text="1"></d2l-card-footer-link>
227
- <d2l-tooltip for="rssFeedLink4">RSS Feed</d2l-tooltip>
228
- <d2l-card-footer-link id="outcomesLink4" icon="tier1:outcomes" text="Outcomes" secondary-text-type="count" secondary-text="5"></d2l-card-footer-link>
229
- <d2l-tooltip for="outcomesLink4">Outcomes</d2l-tooltip>
235
+ <d2l-card-footer-link id="googleDriveLink4" icon="tier1:google-drive" text="Google Drive" secondary-count-type="count" secondary-count="100" href="https://www.google.ca/drive/">
236
+ <d2l-tooltip slot="tooltip" for="googleDriveLink4">Go to Google Drive</d2l-tooltip>
237
+ </d2l-card-footer-link>
238
+ <d2l-card-footer-link id="rssFeedLink4" icon="tier1:rss" text="RSS Feed" secondary-count-type="count" secondary-count="1">
239
+ <d2l-tooltip slot="tooltip" for="rssFeedLink4">RSS Feed</d2l-tooltip>
240
+ </d2l-card-footer-link>
241
+ <d2l-card-footer-link id="outcomesLink4" icon="tier1:outcomes" text="Outcomes" secondary-count-type="count" secondary-count="5">
242
+ <d2l-tooltip slot="tooltip" for="outcomesLink4">Outcomes</d2l-tooltip>
243
+ </d2l-card-footer-link>
230
244
  </div>
231
245
  </d2l-card>
232
246
 
@@ -1,5 +1,3 @@
1
- import '@webcomponents/shadycss/entrypoints/custom-style-interface.js';
2
-
3
1
  if (!document.head.querySelector('#d2l-colors')) {
4
2
  const style = document.createElement('style');
5
3
  style.id = 'd2l-colors';
@@ -94,5 +92,4 @@ if (!document.head.querySelector('#d2l-colors')) {
94
92
  }
95
93
  `;
96
94
  document.head.appendChild(style);
97
- window.ShadyCSS.CustomStyleInterface.addCustomStyle(style);
98
95
  }
@@ -1,86 +1,190 @@
1
- # Count Badge
2
-
3
- ## d2l-count-badge
4
-
5
- The `d2l-count-badge` element is a web component to display a number count, either in a `"notification"` or `"count"` style.
6
-
7
-
8
- ![Notification Badge](./screenshots/count-badge-notification-small.png?raw=true)
9
- ![Count Badge](./screenshots/count-badge-count-large.png?raw=true)
10
-
11
- ```html
12
- <script type="module">
13
- import '@brightspace-ui/core/components/count-badge/count-badge.js';
14
- </script>
15
- <d2l-count-badge size="small" type="notification" text="100 new notifications" number="100"></d2l-count-badge>
16
- ```
17
-
18
- **Properties:**
19
-
20
- | Property | Type | Description |
21
- |--|--|--|
22
- | `number` | Number, required | The number to display on the badge. Must be a positive integer. |
23
- | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
24
- | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
25
- | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
26
- | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
27
- | `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
28
- | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
29
- | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
30
- | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
31
-
32
- ### Accessibility Properties
33
-
34
- To make your `d2l-count-badge` accessible, use the following properties when applicable:
35
-
36
- | Attribute | Description |
37
- |--|--|
38
- | `text`, required | Only the text will be read by screen-readers (not the number), so include the number in the text. |
39
- | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
40
- | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
41
- | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
42
-
43
-
44
-
45
- ## d2l-count-badge-icon
46
-
47
- The `d2l-count-badge-icon` element is a web component to display a number count, either in a `"notification"` or `"count"` style with an icon.
48
-
49
- ![Count Badge with icon](./screenshots/count-badge-icon.png?raw=true)
50
-
51
- ```html
52
- <script type="module">
53
- import '@brightspace-ui/core/components/count-badge/count-badge-icon.js';
54
- </script>
55
- <d2l-count-badge-icon size="small" icon="tier1:gear" type="notification" text="100 new settings applied." number="100"></d2l-count-badge>
56
- ```
57
-
58
- **Properties:**
59
-
60
- | Property | Type | Description |
61
- |--|--|--|
62
- | `number` | Number, required | The number to display on the badge. Must be a positive integer. |
63
- | `icon` | String, required | [Preset icon key](../icons#preset-icons) (e.g. `tier1:gear`) |
64
- | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
65
- | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
66
- | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
67
- | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
68
- | `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
69
- | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
70
- | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
71
- | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
72
-
73
- ### Accessibility Properties
74
-
75
- To make your `d2l-count-badge-icon` accessible, use the following properties when applicable:
76
-
77
- | Attribute | Description |
78
- |--|--|
79
- | `text`, required | Only the text will be read by screen-readers (not the number), so include the number in the text. |
80
- | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
81
- | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
82
- | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
83
-
84
- ## Future Enhancements
85
-
86
- Looking for an enhancement not listed here? Create a GitHub issue!
1
+ # Count Badge
2
+ Badges can be used to provide additional contextual information to users in regards to a task or action.
3
+
4
+ <!-- docs: demo autoSize:false size:small -->
5
+ ```html
6
+ <script type="module">
7
+ import '@brightspace-ui/core/components/count-badge/count-badge.js';
8
+ import '@brightspace-ui/core/components/count-badge/count-badge-icon.js';
9
+ </script>
10
+ <d2l-count-badge size="small" type="notification" text="100 new notifications" number="100"></d2l-count-badge>
11
+ <d2l-count-badge size="small" type="count" text="100 new notifications" number="100"></d2l-count-badge>
12
+ <d2l-count-badge-icon size="small" icon="tier1:gear" type="notification" text="100 new settings applied." number="100" tab-stop></d2l-count-badge-icon>
13
+ <d2l-count-badge-icon size="small" icon="tier1:gear" type="count" text="100 new settings applied." number="100" tab-stop></d2l-count-badge-icon>
14
+ ```
15
+
16
+ ## Count Badge: Basic [d2l-count-badge]
17
+
18
+ The `d2l-count-badge` element is a web component to display a number count, depending on your use case different styling options are available.
19
+
20
+ <!-- docs: start hidden content -->
21
+ ![Notification Badge](./screenshots/count-badge-notification-small.png?raw=true) -->
22
+ ![Count Badge](./screenshots/count-badge-count-large.png?raw=true)
23
+ <!-- docs: end hidden content -->
24
+
25
+ <!-- docs: demo live name:d2l-count-badge -->
26
+ ```html
27
+ <script type="module">
28
+ import '@brightspace-ui/core/components/count-badge/count-badge.js';
29
+ </script>
30
+ <d2l-count-badge size="small" type="notification" text="100 new notifications" number="100" has-tooltip tab-stop></d2l-count-badge>
31
+ ```
32
+
33
+ ### Accessibility Properties
34
+ | Attribute | Description |
35
+ |---|---|
36
+ | `text` | REQUIRED: Only the text will be read by screen-readers (not the number), so include the number in the text. |
37
+ | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
38
+ | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
39
+ | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
40
+
41
+ <!-- docs: start hidden content -->
42
+ ### Properties
43
+
44
+ | Property | Type | Description |
45
+ |---|---|---|
46
+ | `number` | Number, required | The number to display on the badge. Must be a positive integer. |
47
+ | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
48
+ | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
49
+ | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
50
+ | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
51
+ | `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
52
+ | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
53
+ | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
54
+ | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
55
+ | `focus-ring`, default: `false` | Boolean | Optionally force a focus ring around the badge. This property can be used to highlight the badge when the parent element is focused. |
56
+ <!-- docs: end hidden content -->
57
+
58
+ ## Count Badge: Icon [d2l-count-badge-icon]
59
+
60
+ The `d2l-count-badge-icon` element is a web component to display a number count, either in a `"notification"` or `"count"` style with an icon.
61
+
62
+ <!-- docs: start hidden content -->
63
+ ![Count Badge with icon](./screenshots/count-badge-icon.png?raw=true)
64
+ <!-- docs: end hidden content -->
65
+
66
+ <!-- docs: demo live name:d2l-count-badge-icon -->
67
+ ```html
68
+ <script type="module">
69
+ import '@brightspace-ui/core/components/count-badge/count-badge-icon.js';
70
+ </script>
71
+ <d2l-count-badge-icon size="small" icon="tier1:gear" type="notification" text="100 new settings applied." number="100" tab-stop has-tooltip></d2l-count-badge-icon>
72
+ ```
73
+
74
+ ### Accessibility Properties
75
+ | Attribute | Description |
76
+ |---|---|
77
+ | `text` | REQUIRED: Only the text will be read by screen-readers (not the number), so include the number in the text. |
78
+ | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
79
+ | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
80
+ | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
81
+
82
+ <!-- docs: start hidden content -->
83
+ ### Properties
84
+
85
+ | Property | Type | Description |
86
+ |--|--|--|
87
+ | `number` | Number | Required: The number to display on the badge. Must be a positive integer. |
88
+ | `icon` | String | Required: [Preset icon key](../icons#preset-icons) (e.g. `tier1:gear`) |
89
+ | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
90
+ | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
91
+ | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
92
+ | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
93
+ | `text` | String | REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
94
+ | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
95
+ | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
96
+ | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
97
+ | `focus-ring`, default: `false` | Boolean | Optionally force a focus ring around the badge. This property can be used to highlight the badge when the parent element is focused. |
98
+ ## Future Enhancements
99
+
100
+ Looking for an enhancement not listed here? Create a GitHub issue!
101
+ <!-- docs: end hidden content -->
102
+ =======
103
+ # Count Badge
104
+
105
+ ## d2l-count-badge
106
+
107
+ The `d2l-count-badge` element is a web component to display a number count, either in a `"notification"` or `"count"` style.
108
+
109
+
110
+ ![Notification Badge](./screenshots/count-badge-notification-small.png?raw=true)
111
+ ![Count Badge](./screenshots/count-badge-count-large.png?raw=true)
112
+
113
+ ```html
114
+ <script type="module">
115
+ import '@brightspace-ui/core/components/count-badge/count-badge.js';
116
+ </script>
117
+ <d2l-count-badge size="small" type="notification" text="100 new notifications" number="100"></d2l-count-badge>
118
+ ```
119
+
120
+ **Properties:**
121
+
122
+ | Property | Type | Description |
123
+ |--|--|--|
124
+ | `number` | Number, required | The number to display on the badge. Must be a positive integer. |
125
+ | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
126
+ | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
127
+ | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
128
+ | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
129
+ | `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
130
+ | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
131
+ | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
132
+ | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
133
+ | `focus-ring`, default: `false` | Boolean | Optionally force a focus ring around the badge. This property can be used to highlight the badge when the parent element is focused. |
134
+
135
+ ### Accessibility Properties
136
+
137
+ To make your `d2l-count-badge` accessible, use the following properties when applicable:
138
+
139
+ | Attribute | Description |
140
+ |--|--|
141
+ | `text`, required | Only the text will be read by screen-readers (not the number), so include the number in the text. |
142
+ | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
143
+ | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
144
+ | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
145
+
146
+
147
+
148
+ ## d2l-count-badge-icon
149
+
150
+ The `d2l-count-badge-icon` element is a web component to display a number count, either in a `"notification"` or `"count"` style with an icon.
151
+
152
+ ![Count Badge with icon](./screenshots/count-badge-icon.png?raw=true)
153
+
154
+ ```html
155
+ <script type="module">
156
+ import '@brightspace-ui/core/components/count-badge/count-badge-icon.js';
157
+ </script>
158
+ <d2l-count-badge-icon size="small" icon="tier1:gear" type="notification" text="100 new settings applied." number="100"></d2l-count-badge>
159
+ ```
160
+
161
+ **Properties:**
162
+
163
+ | Property | Type | Description |
164
+ |--|--|--|
165
+ | `number` | Number, required | The number to display on the badge. Must be a positive integer. |
166
+ | `icon` | String, required | [Preset icon key](../icons#preset-icons) (e.g. `tier1:gear`) |
167
+ | `size`, default: `small` | String | The size of the badge. Valid options are `"small"` and `"large"`. |
168
+ | `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
169
+ | `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
170
+ | `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
171
+ | `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
172
+ | `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
173
+ | `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
174
+ | `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
175
+ | `focus-ring`, default: `false` | Boolean | Optionally force a focus ring around the badge. This property can be used to highlight the badge when the parent element is focused. |
176
+
177
+ ### Accessibility Properties
178
+
179
+ To make your `d2l-count-badge-icon` accessible, use the following properties when applicable:
180
+
181
+ | Attribute | Description |
182
+ |--|--|
183
+ | `text`, required | Only the text will be read by screen-readers (not the number), so include the number in the text. |
184
+ | `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
185
+ | `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
186
+ | `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
187
+
188
+ ## Future Enhancements
189
+
190
+ Looking for an enhancement not listed here? Create a GitHub issue!
@@ -23,6 +23,7 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
23
23
  static get styles() {
24
24
  return [countBadgeStyles, css`
25
25
  :host(.focus-visible) d2l-icon,
26
+ :host([focus-ring]) d2l-icon,
26
27
  d2l-icon.focus-visible {
27
28
  box-shadow: 0 0 0 2px var(--d2l-color-celestine);
28
29
  outline: none;
@@ -47,13 +48,13 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
47
48
  margin-top: -0.55rem;
48
49
  }
49
50
 
50
- :host([icon^="tier1:"]) {
51
+ :host([icon*="tier1:"]) {
51
52
  --d2l-count-badge-icon-height: 18px;
52
53
  }
53
- :host([icon^="tier2:"]) {
54
+ :host([icon*="tier2:"]) {
54
55
  --d2l-count-badge-icon-height: 24px;
55
56
  }
56
- :host([icon^="tier3:"]) {
57
+ :host([icon*="tier3:"]) {
57
58
  --d2l-count-badge-icon-height: 30px;
58
59
  }
59
60
 
@@ -76,6 +77,7 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
76
77
  render() {
77
78
  const numberPadding = this.size === 'small' ? '0.55rem' : '0.7rem';
78
79
  const numberStyles = {
80
+ border: '2px solid white',
79
81
  position: 'relative',
80
82
  left: this.dir === 'rtl' ? 0 : 'var(--d2l-count-badge-icon-padding)',
81
83
  right: this.dir === 'rtl' ? 'var(--d2l-count-badge-icon-padding)' : 0,
@@ -19,7 +19,6 @@ export const countBadgeStyles = [offscreenStyles, css`
19
19
  }
20
20
 
21
21
  .d2l-count-badge-number {
22
- border: 2px solid white;
23
22
  font-weight: bold;
24
23
  }
25
24
 
@@ -62,6 +61,15 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
62
61
  type: Boolean,
63
62
  attribute: 'announce-changes'
64
63
  },
64
+ /**
65
+ * Optionally choose to force the focus ring around the badge. Defaults to false.
66
+ * @type {boolean}
67
+ */
68
+ forceFocusRing: {
69
+ type: Boolean,
70
+ attribute: 'focus-ring',
71
+ reflect: true
72
+ },
65
73
  /**
66
74
  * Optionally add a tooltip on the badge. Defaults to false.
67
75
  * @type {boolean}
@@ -87,7 +95,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
87
95
  attribute: 'max-digits'
88
96
  },
89
97
  /**
90
- * The number to be displayed on the badge. Must be a positive integer.
98
+ * REQUIRED: The number to be displayed on the badge. Must be a positive integer.
91
99
  * @type {number}
92
100
  */
93
101
  number: {
@@ -112,7 +120,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
112
120
  attribute: 'tab-stop'
113
121
  },
114
122
  /**
115
- * * Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.
123
+ * REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.
116
124
  * @type {string}
117
125
  */
118
126
  text: {
@@ -133,6 +141,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
133
141
  constructor() {
134
142
  super();
135
143
  this.announceChanges = false;
144
+ this.forceFocusRing = false;
136
145
  this.hasTooltip = false;
137
146
  this.hideZero = false;
138
147
  this.size = 'small';
@@ -9,10 +9,15 @@ class CountBadge extends CountBadgeMixin(LitElement) {
9
9
  static get styles() {
10
10
  return [countBadgeStyles, css`
11
11
  :host(.focus-visible) .d2l-count-badge-wrapper,
12
+ :host([focus-ring]) .d2l-count-badge-wrapper,
12
13
  .d2l-count-badge-wrapper.focus-visible {
13
14
  box-shadow: 0 0 0 2px var(--d2l-color-celestine);
14
15
  }
15
16
 
17
+ .d2l-count-badge-wrapper {
18
+ border: 2px solid transparent;
19
+ }
20
+
16
21
  :host([size="small"]) .d2l-count-badge-wrapper {
17
22
  border-radius: 0.65rem;
18
23
  outline: none;
@@ -112,6 +112,7 @@ If you're looking to emulate native form element submission, `d2l-form-native` m
112
112
  ### Events
113
113
  - `d2l-form-submit`: Dispatched when the form is submitted. The form data can be obtained from the `detail`'s `formData` property.
114
114
  - `d2l-form-invalid`: Dispatched when the form fails validation. The error map can be obtained from the `detail`'s `errors` property.
115
+ - `d2l-form-dirty`: Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not.
115
116
  <!-- docs: end hidden content -->
116
117
 
117
118
  ### Methods
@@ -234,6 +235,7 @@ If you're looking to submit form data via your own API calls or nest multiple fo
234
235
  ### Events
235
236
  - `submit`: Dispatched when the form is submitted. Cancelling this event will prevent form submission.
236
237
  - `formdata`: Dispatched after the entry list representing the form's data is constructed. This happens when the form is submitted just prior to submission. The form data can be obtained from the `detail`'s `formData` property.
238
+ - `d2l-form-dirty`: Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not.
237
239
  <!-- docs: end hidden content -->
238
240
 
239
241
  ### Methods
@@ -100,13 +100,19 @@ export const FormMixin = superclass => class extends LocalizeCoreElement(supercl
100
100
  e.stopPropagation();
101
101
  this._updateErrors(e.target, e.detail.errors);
102
102
  }
103
+
103
104
  async _onFormElementChange(e) {
104
105
  const ele = e.target;
106
+
107
+ if ((isNativeFormElement(ele) || isCustomFormElement(ele)) && e.type !== 'focusout') {
108
+ this._dirty = true;
109
+ this.dispatchEvent(new CustomEvent('d2l-form-dirty'));
110
+ }
111
+
105
112
  if (!isNativeFormElement(ele)) {
106
113
  return;
107
114
  }
108
115
  e.stopPropagation();
109
- this._dirty = true;
110
116
  const errors = await this._validateFormElement(ele, e.type === 'focusout');
111
117
  this._updateErrors(ele, errors);
112
118
  }
@@ -8,6 +8,7 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
8
8
  * These interactive controls are submitted using a native HTML form submission.
9
9
  * @slot - The native and custom form elements that participate in validation and submission
10
10
  * @fires submit - Dispatched when the form is submitted. Cancelling this event will prevent form submission.
11
+ * @fires d2l-form-dirty - Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not.
11
12
  */
12
13
  class FormNative extends FormMixin(LitElement) {
13
14
 
@@ -6,6 +6,7 @@ import { FormMixin } from './form-mixin.js';
6
6
  * A component that can be used to build sections containing interactive controls that are validated and submitted as a group.
7
7
  * Values of these interactive controls are aggregated but the user is responsible for handling submission via the @d2l-form-submit event.
8
8
  * @slot - The native and custom form elements that participate in validation and submission
9
+ * @fires d2l-form-dirty - Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not.
9
10
  */
10
11
  class Form extends FormMixin(LitElement) {
11
12
 
@@ -70,13 +70,13 @@ export const htmlBlockContentStyles = css`
70
70
  a:visited,
71
71
  a:link,
72
72
  a:active {
73
- color: var(--d2l-color-celestine);
73
+ color: var(--d2l-color-celestine, #006fbf);
74
74
  cursor: pointer;
75
75
  text-decoration: none;
76
76
  }
77
77
  a:hover,
78
78
  a:focus {
79
- color: var(--d2l-color-celestine-minus-1);
79
+ color: var(--d2l-color-celestine-minus-1, #004489);
80
80
  outline-width: 0;
81
81
  text-decoration: underline;
82
82
  }
@@ -85,7 +85,7 @@ export const htmlBlockContentStyles = css`
85
85
  a:visited,
86
86
  a:link,
87
87
  a:active {
88
- color: var(--d2l-color-ferrite);
88
+ color: var(--d2l-color-ferrite, #494c4e);
89
89
  }
90
90
  }
91
91
  mjx-assistive-mml math {
@@ -1,4 +1,3 @@
1
- import '@webcomponents/shadycss/entrypoints/custom-style-interface.js';
2
1
  import '../colors/colors.js';
3
2
 
4
3
  export const importUrl = 'https://s.brightspace.com/lib/fonts/0.5.0/assets/';
@@ -144,5 +143,4 @@ if (!document.head.querySelector('#d2l-typography-font-face')) {
144
143
  }
145
144
  `;
146
145
  document.head.appendChild(style);
147
- window.ShadyCSS.CustomStyleInterface.addCustomStyle(style);
148
146
  }
@@ -717,7 +717,7 @@
717
717
  },
718
718
  {
719
719
  "name": "icon",
720
- "description": "REQUIRED: Preset icon key (e.g. \"tier1:gear\")",
720
+ "description": "REQUIRED: Preset icon key (e.g. \"tier1:gear\"). Must be a tier 1 icon.",
721
721
  "type": "string"
722
722
  },
723
723
  {
@@ -726,8 +726,13 @@
726
726
  "type": "string"
727
727
  },
728
728
  {
729
- "name": "secondary-text",
730
- "description": "Secondary text to display as a superscript on the icon",
729
+ "name": "secondary-count",
730
+ "description": "Secondary count to display as a count bubble on the icon",
731
+ "type": "number"
732
+ },
733
+ {
734
+ "name": "secondary-count-max-digits",
735
+ "description": "Maximum digits to display in the secondary count. Defaults to no limit",
731
736
  "type": "string"
732
737
  },
733
738
  {
@@ -752,9 +757,9 @@
752
757
  "default": "false"
753
758
  },
754
759
  {
755
- "name": "secondary-text-type",
756
- "description": "Controls the style of the secondary text bubble; options are 'notification' and 'count'",
757
- "type": "string",
760
+ "name": "secondary-count-type",
761
+ "description": "Controls the style of the secondary count bubble",
762
+ "type": "'count'|'notification'",
758
763
  "default": "\"notification\""
759
764
  }
760
765
  ],
@@ -774,7 +779,7 @@
774
779
  {
775
780
  "name": "icon",
776
781
  "attribute": "icon",
777
- "description": "REQUIRED: Preset icon key (e.g. \"tier1:gear\")",
782
+ "description": "REQUIRED: Preset icon key (e.g. \"tier1:gear\"). Must be a tier 1 icon.",
778
783
  "type": "string"
779
784
  },
780
785
  {
@@ -784,9 +789,15 @@
784
789
  "type": "string"
785
790
  },
786
791
  {
787
- "name": "secondaryText",
788
- "attribute": "secondary-text",
789
- "description": "Secondary text to display as a superscript on the icon",
792
+ "name": "secondaryCount",
793
+ "attribute": "secondary-count",
794
+ "description": "Secondary count to display as a count bubble on the icon",
795
+ "type": "number"
796
+ },
797
+ {
798
+ "name": "secondaryCountMaxDigits",
799
+ "attribute": "secondary-count-max-digits",
800
+ "description": "Maximum digits to display in the secondary count. Defaults to no limit",
790
801
  "type": "string"
791
802
  },
792
803
  {
@@ -815,12 +826,18 @@
815
826
  "default": "false"
816
827
  },
817
828
  {
818
- "name": "secondaryTextType",
819
- "attribute": "secondary-text-type",
820
- "description": "Controls the style of the secondary text bubble; options are 'notification' and 'count'",
821
- "type": "string",
829
+ "name": "secondaryCountType",
830
+ "attribute": "secondary-count-type",
831
+ "description": "Controls the style of the secondary count bubble",
832
+ "type": "'count'|'notification'",
822
833
  "default": "\"notification\""
823
834
  }
835
+ ],
836
+ "slots": [
837
+ {
838
+ "name": "tooltip",
839
+ "description": "slot for the link tooltip"
840
+ }
824
841
  ]
825
842
  },
826
843
  {
@@ -1020,7 +1037,7 @@
1020
1037
  },
1021
1038
  {
1022
1039
  "name": "number",
1023
- "description": "The number to be displayed on the badge. Must be a positive integer.",
1040
+ "description": "REQUIRED: The number to be displayed on the badge. Must be a positive integer.",
1024
1041
  "type": "number"
1025
1042
  },
1026
1043
  {
@@ -1029,6 +1046,12 @@
1029
1046
  "type": "boolean",
1030
1047
  "default": "false"
1031
1048
  },
1049
+ {
1050
+ "name": "focus-ring",
1051
+ "description": "Optionally choose to force the focus ring around the badge. Defaults to false.",
1052
+ "type": "boolean",
1053
+ "default": "false"
1054
+ },
1032
1055
  {
1033
1056
  "name": "has-tooltip",
1034
1057
  "description": "Optionally add a tooltip on the badge. Defaults to false.",
@@ -1055,7 +1078,7 @@
1055
1078
  },
1056
1079
  {
1057
1080
  "name": "text",
1058
- "description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1081
+ "description": "REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1059
1082
  "type": "string",
1060
1083
  "default": "\"\""
1061
1084
  },
@@ -1082,7 +1105,7 @@
1082
1105
  {
1083
1106
  "name": "number",
1084
1107
  "attribute": "number",
1085
- "description": "The number to be displayed on the badge. Must be a positive integer.",
1108
+ "description": "REQUIRED: The number to be displayed on the badge. Must be a positive integer.",
1086
1109
  "type": "number"
1087
1110
  },
1088
1111
  {
@@ -1092,6 +1115,13 @@
1092
1115
  "type": "boolean",
1093
1116
  "default": "false"
1094
1117
  },
1118
+ {
1119
+ "name": "forceFocusRing",
1120
+ "attribute": "focus-ring",
1121
+ "description": "Optionally choose to force the focus ring around the badge. Defaults to false.",
1122
+ "type": "boolean",
1123
+ "default": "false"
1124
+ },
1095
1125
  {
1096
1126
  "name": "hasTooltip",
1097
1127
  "attribute": "has-tooltip",
@@ -1123,7 +1153,7 @@
1123
1153
  {
1124
1154
  "name": "text",
1125
1155
  "attribute": "text",
1126
- "description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1156
+ "description": "REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1127
1157
  "type": "string",
1128
1158
  "default": "\"\""
1129
1159
  },
@@ -1147,7 +1177,7 @@
1147
1177
  },
1148
1178
  {
1149
1179
  "name": "number",
1150
- "description": "The number to be displayed on the badge. Must be a positive integer.",
1180
+ "description": "REQUIRED: The number to be displayed on the badge. Must be a positive integer.",
1151
1181
  "type": "number"
1152
1182
  },
1153
1183
  {
@@ -1156,6 +1186,12 @@
1156
1186
  "type": "boolean",
1157
1187
  "default": "false"
1158
1188
  },
1189
+ {
1190
+ "name": "focus-ring",
1191
+ "description": "Optionally choose to force the focus ring around the badge. Defaults to false.",
1192
+ "type": "boolean",
1193
+ "default": "false"
1194
+ },
1159
1195
  {
1160
1196
  "name": "has-tooltip",
1161
1197
  "description": "Optionally add a tooltip on the badge. Defaults to false.",
@@ -1182,7 +1218,7 @@
1182
1218
  },
1183
1219
  {
1184
1220
  "name": "text",
1185
- "description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1221
+ "description": "REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1186
1222
  "type": "string",
1187
1223
  "default": "\"\""
1188
1224
  },
@@ -1203,7 +1239,7 @@
1203
1239
  {
1204
1240
  "name": "number",
1205
1241
  "attribute": "number",
1206
- "description": "The number to be displayed on the badge. Must be a positive integer.",
1242
+ "description": "REQUIRED: The number to be displayed on the badge. Must be a positive integer.",
1207
1243
  "type": "number"
1208
1244
  },
1209
1245
  {
@@ -1213,6 +1249,13 @@
1213
1249
  "type": "boolean",
1214
1250
  "default": "false"
1215
1251
  },
1252
+ {
1253
+ "name": "forceFocusRing",
1254
+ "attribute": "focus-ring",
1255
+ "description": "Optionally choose to force the focus ring around the badge. Defaults to false.",
1256
+ "type": "boolean",
1257
+ "default": "false"
1258
+ },
1216
1259
  {
1217
1260
  "name": "hasTooltip",
1218
1261
  "attribute": "has-tooltip",
@@ -1244,7 +1287,7 @@
1244
1287
  {
1245
1288
  "name": "text",
1246
1289
  "attribute": "text",
1247
- "description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1290
+ "description": "REQUIRED: Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
1248
1291
  "type": "string",
1249
1292
  "default": "\"\""
1250
1293
  },
@@ -3092,6 +3135,10 @@
3092
3135
  "name": "submit",
3093
3136
  "description": "Dispatched when the form is submitted. Cancelling this event will prevent form submission."
3094
3137
  },
3138
+ {
3139
+ "name": "d2l-form-dirty",
3140
+ "description": "Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not."
3141
+ },
3095
3142
  {
3096
3143
  "name": "formdata",
3097
3144
  "description": "Dispatched after the entry list representing the form's data is constructed. This happens when the form is submitted just prior to submission. The form data can be obtained from the `detail`'s `formData` property."
@@ -3137,6 +3184,10 @@
3137
3184
  }
3138
3185
  ],
3139
3186
  "events": [
3187
+ {
3188
+ "name": "d2l-form-dirty",
3189
+ "description": "Dispatched whenever any form element fires an `input` or `change` event. Can be used to track whether the form is dirty or not."
3190
+ },
3140
3191
  {
3141
3192
  "name": "d2l-form-invalid",
3142
3193
  "description": "Dispatched when the form fails validation. The error map can be obtained from the `detail`'s `errors` property."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.191.1",
3
+ "version": "1.193.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "repository": "https://github.com/BrightspaceUI/core.git",
6
6
  "publishConfig": {
@@ -63,7 +63,6 @@
63
63
  "@brightspace-ui/intl": "^3",
64
64
  "@formatjs/intl-pluralrules": "^1",
65
65
  "@open-wc/dedupe-mixin": "^1",
66
- "@webcomponents/shadycss": "^1",
67
66
  "focus-visible": "^5",
68
67
  "ifrau": "^0.39",
69
68
  "intl-messageformat": "^7",