@brightspace-ui/core 3.200.0 → 3.202.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.
@@ -467,6 +467,62 @@
467
467
  </template>
468
468
  </d2l-demo-snippet>
469
469
 
470
+ <h2>Color Indicator</h2>
471
+
472
+ <d2l-demo-snippet>
473
+ <template>
474
+ <d2l-button-toggle pressed>
475
+ <d2l-button-subtle slot="not-pressed" icon="tier1:tile-view" text="Tiles"></d2l-button-subtle>
476
+ <d2l-button-subtle slot="pressed" icon="tier1:list-view" text="List"></d2l-button-subtle>
477
+ </d2l-button-toggle>
478
+ <d2l-list layout="tiles">
479
+ <d2l-list-item label="item 1" key="1" color="#29a6ff" selectable tile-header>
480
+ <img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg"></img>
481
+ <d2l-list-item-content>
482
+ <div>Identify categories of physical activities</div>
483
+ <div slot="secondary">Secondary Information</div>
484
+ <div slot="supporting-info">Specific Expectation A1.2</div>
485
+ </d2l-list-item-content>
486
+ <div slot="actions">
487
+ <d2l-button-icon text="More" icon="tier1:more"></d2l-button-icon>
488
+ </div>
489
+ </d2l-list-item>
490
+ <d2l-list-item label="item 2" key="2" color="#29a6ff">
491
+ <img slot="illustration" src="https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg"></img>
492
+ <d2l-list-item-content>
493
+ <div>Apply a decision-making process to assess risks and make safe decisions in a variety of situations</div>
494
+ <div slot="secondary">Secondary Information</div>
495
+ <div slot="supporting-info">Specific Expectation B2.1</div>
496
+ </d2l-list-item-content>
497
+ <div slot="actions">
498
+ <d2l-button-icon text="More" icon="tier1:more" translucent></d2l-button-icon>
499
+ </div>
500
+ </d2l-list-item>
501
+ <d2l-list-item label="item 3" key="3" tile-header selectable color="#29a6ff">
502
+ <d2l-list-item-content>
503
+ <div>Retain objects of various shapes and sizes in different ways, while moving around others and equipment</div>
504
+ <div slot="secondary">Secondary Information</div>
505
+ <div slot="supporting-info">Specific Expectation B2.2</div>
506
+ </d2l-list-item-content>
507
+ <div slot="actions">
508
+ <d2l-button-icon text="Pin" icon="tier1:pin-filled"></d2l-button-icon>
509
+ <d2l-button-icon text="More" icon="tier1:more"></d2l-button-icon>
510
+ </div>
511
+ </d2l-list-item>
512
+ <d2l-list-item label="item 4" key="4" color="#29a6ff">
513
+ <d2l-list-item-content>
514
+ <div>Retain objects of various shapes and sizes in different ways, while moving around others and equipment</div>
515
+ <div slot="secondary">Secondary Information</div>
516
+ <div slot="supporting-info">Specific Expectation B2.2</div>
517
+ </d2l-list-item-content>
518
+ </d2l-list-item>
519
+ </d2l-list>
520
+ <script data-demo-hide>
521
+ (demo => window.wireupListTileToggle(demo))(document.currentScript.parentNode);
522
+ </script>
523
+ </template>
524
+ </d2l-demo-snippet>
525
+
470
526
  </d2l-demo-page>
471
527
  </body>
472
528
  </html>
@@ -256,13 +256,17 @@ class ListItemGenericLayout extends LitElement {
256
256
  grid-row: start / start;
257
257
  }
258
258
 
259
+ :host([layout="tile"]) ::slotted([slot="color-indicator"]) {
260
+ grid-column: start;
261
+ grid-row: content-start / content-end;
262
+ }
263
+
259
264
  :host(:not([layout="tile"])) slot[name="header"],
260
265
  :host([layout="tile"]) slot[name="add-top"],
261
266
  :host([layout="tile"]) slot[name="control-container"],
262
267
  :host([layout="tile"]) slot[name="before-content"],
263
268
  :host([layout="tile"]) slot[name="outside-control"],
264
269
  :host([layout="tile"]) slot[name="outside-control-action"],
265
- :host([layout="tile"]) slot[name="color-indicator"],
266
270
  :host([layout="tile"]) slot[name="expand-collapse"],
267
271
  :host([layout="tile"]) slot[name="drop-target"],
268
272
  :host([layout="tile"]) slot[name="nested"],
@@ -619,6 +619,24 @@ export const ListItemMixin = superclass => class extends composeMixins(
619
619
  margin-inline: 0;
620
620
  }
621
621
 
622
+ :host([layout="tile"]) .d2l-list-item-color-outer {
623
+ padding: 1px;
624
+ }
625
+ :host([layout="tile"]) .d2l-list-item-color-inner {
626
+ border-end-end-radius: 0;
627
+ border-end-start-radius: 6px;
628
+ border-start-end-radius: 0;
629
+ border-start-start-radius: 6px;
630
+ width: 5px;
631
+ }
632
+ :host([layout="tile"][tile-header]) .d2l-list-item-color-outer {
633
+ padding-block-start: 0;
634
+ }
635
+ :host([layout="tile"][tile-header]) .d2l-list-item-color-inner {
636
+ border-start-end-radius: 0;
637
+ border-start-start-radius: 0;
638
+ }
639
+
622
640
  `];
623
641
 
624
642
  super.styles && styles.unshift(super.styles);
@@ -45,6 +45,8 @@
45
45
  <d2l-meter-linear value="3" max="6" text="Visited: {x/y}" percent text-hidden></d2l-meter-linear>
46
46
  <d2l-meter-linear value="3" max="6" text="Visited: {%}"></d2l-meter-linear>
47
47
  <d2l-meter-linear value="3" max="6" text="You're doing great!" percent></d2l-meter-linear>
48
+ <d2l-meter-linear value="1" max="3" text="Round up({x/y} => {%})" percent percent-rounding-mode="ceil"></d2l-meter-linear>
49
+ <d2l-meter-linear value="2" max="3" text="Round down({x/y} => {%})" percent percent-rounding-mode="floor"></d2l-meter-linear>
48
50
  </div>
49
51
  <div class="dark-background">
50
52
  <d2l-meter-linear value="2" max="15" foreground-light text-inline></d2l-meter-linear>
@@ -56,6 +58,8 @@
56
58
  <d2l-meter-linear value="3" max="6" foreground-light text="Visited: {x/y}" percent></d2l-meter-linear>
57
59
  <d2l-meter-linear value="3" max="6" foreground-light text="Visited: {%}"></d2l-meter-linear>
58
60
  <d2l-meter-linear value="3" max="6" foreground-light text="You're doing great!" percent></d2l-meter-linear>
61
+ <d2l-meter-linear value="1" max="3" foreground-light text="Round up({x/y} => {%})" percent percent-rounding-mode="ceil"></d2l-meter-linear>
62
+ <d2l-meter-linear value="2" max="3" foreground-light text="Round down({x/y} => {%})" percent percent-rounding-mode="floor"></d2l-meter-linear>
59
63
  </div>
60
64
  </template>
61
65
  </d2l-demo-snippet>
@@ -16,6 +16,11 @@ export const MeterMixin = superclass => class extends LocalizeCoreElement(superc
16
16
  * @type {boolean}
17
17
  */
18
18
  percent: { type: Boolean },
19
+ /**
20
+ * Rounding mode for percentage text values
21
+ * @type {"round" | "ceil" | "floor"}
22
+ */
23
+ percentRoundingMode: { type: String, attribute: 'percent-rounding-mode' },
19
24
  /**
20
25
  * Context information for the meter. If the text contains {%} or {x/y}, they will be replaced with a percentage or fraction respectively.
21
26
  * @type {string}
@@ -41,6 +46,7 @@ export const MeterMixin = superclass => class extends LocalizeCoreElement(superc
41
46
  this.percent = false;
42
47
  this.textHidden = false;
43
48
  this.value = 0;
49
+ this.percentRoundingMode = 'round';
44
50
 
45
51
  this._namespace = 'components.meter-mixin';
46
52
  }
@@ -52,8 +58,17 @@ export const MeterMixin = superclass => class extends LocalizeCoreElement(superc
52
58
  return secondary ? this.localize(`${this._namespace}.commaSeperatedAria`, { term1: secondary, term2: mainLabel }) : mainLabel;
53
59
  }
54
60
 
61
+ _getPecentage() {
62
+ const value = this.max > 0 ? this.value / this.max : 0;
63
+ switch (this.percentRoundingMode) {
64
+ case 'ceil': return Math.ceil(value * 100) / 100;
65
+ case 'floor': return Math.floor(value * 100) / 100;
66
+ default: return Math.round(value * 100) / 100;
67
+ }
68
+ }
69
+
55
70
  _primary(value, max, aria = false) {
56
- const percentage = max > 0 ? value / max : 0;
71
+ const percentage = this._getPecentage();
57
72
  const key = aria ? 'fractionAria' : 'fraction';
58
73
 
59
74
  return this.percent
@@ -68,7 +83,7 @@ export const MeterMixin = superclass => class extends LocalizeCoreElement(superc
68
83
 
69
84
  const key = aria ? 'fractionAria' : 'fraction';
70
85
 
71
- const percentage = this.max > 0 ? value / max : 0;
86
+ const percentage = this._getPecentage();
72
87
  context = context.replace('{%}', formatPercent(percentage, { maximumFractionDigits: 0 }));
73
88
  context = context.replace('{x/y}', this.localize(`${this._namespace}.${key}`, { x: value, y: max }));
74
89
  context = context.replace('{x}', value);
@@ -11320,6 +11320,12 @@
11320
11320
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11321
11321
  "type": "number",
11322
11322
  "default": "0"
11323
+ },
11324
+ {
11325
+ "name": "percent-rounding-mode",
11326
+ "description": "Rounding mode for percentage text values",
11327
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11328
+ "default": "\"round\""
11323
11329
  }
11324
11330
  ],
11325
11331
  "properties": [
@@ -11356,6 +11362,13 @@
11356
11362
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11357
11363
  "type": "number",
11358
11364
  "default": "0"
11365
+ },
11366
+ {
11367
+ "name": "percentRoundingMode",
11368
+ "attribute": "percent-rounding-mode",
11369
+ "description": "Rounding mode for percentage text values",
11370
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11371
+ "default": "\"round\""
11359
11372
  }
11360
11373
  ]
11361
11374
  },
@@ -11398,6 +11411,12 @@
11398
11411
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11399
11412
  "type": "number",
11400
11413
  "default": "0"
11414
+ },
11415
+ {
11416
+ "name": "percent-rounding-mode",
11417
+ "description": "Rounding mode for percentage text values",
11418
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11419
+ "default": "\"round\""
11401
11420
  }
11402
11421
  ],
11403
11422
  "properties": [
@@ -11441,6 +11460,13 @@
11441
11460
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11442
11461
  "type": "number",
11443
11462
  "default": "0"
11463
+ },
11464
+ {
11465
+ "name": "percentRoundingMode",
11466
+ "attribute": "percent-rounding-mode",
11467
+ "description": "Rounding mode for percentage text values",
11468
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11469
+ "default": "\"round\""
11444
11470
  }
11445
11471
  ]
11446
11472
  },
@@ -11477,6 +11503,12 @@
11477
11503
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11478
11504
  "type": "number",
11479
11505
  "default": "0"
11506
+ },
11507
+ {
11508
+ "name": "percent-rounding-mode",
11509
+ "description": "Rounding mode for percentage text values",
11510
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11511
+ "default": "\"round\""
11480
11512
  }
11481
11513
  ],
11482
11514
  "properties": [
@@ -11513,6 +11545,13 @@
11513
11545
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
11514
11546
  "type": "number",
11515
11547
  "default": "0"
11548
+ },
11549
+ {
11550
+ "name": "percentRoundingMode",
11551
+ "attribute": "percent-rounding-mode",
11552
+ "description": "Rounding mode for percentage text values",
11553
+ "type": "\"round\" | \"ceil\" | \"floor\"",
11554
+ "default": "\"round\""
11516
11555
  }
11517
11556
  ]
11518
11557
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.200.0",
3
+ "version": "3.202.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",