@brightspace-ui/core 1.213.2 → 1.214.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.
@@ -80,6 +80,37 @@
80
80
  </template>
81
81
  </d2l-demo-snippet>
82
82
 
83
+ <h2>HTML Block (compact)</h2>
84
+
85
+ <d2l-demo-snippet>
86
+ <template>
87
+ <d2l-html-block compact>
88
+ <template>
89
+ <h1>heading 1</h1>
90
+ <h2>heading 2</h2>
91
+ <h3>heading 3</h3>
92
+ <h4>heading 4</h4>
93
+ <h5>heading 5</h5>
94
+ <h6>heading 6</h6>
95
+ <div><strong>strong</strong></div>
96
+ <div><b>bold</b></div>
97
+ <div>text</div>
98
+ <pre>preformatted</pre>
99
+ <p>paragraph</p>
100
+ <ul>
101
+ <li>unordered item 1</li>
102
+ <li>unordered item 2</li>
103
+ </ul>
104
+ <ol>
105
+ <li>ordered item 1</li>
106
+ <li>ordered item 2</li>
107
+ </ol>
108
+ <div><a href="https://d2l.com">anchor</a></div>
109
+ </template>
110
+ </d2l-html-block>
111
+ </template>
112
+ </d2l-demo-snippet>
113
+
83
114
  <h2>HTML Block (math)</h2>
84
115
 
85
116
  <d2l-demo-snippet>
@@ -5,6 +5,11 @@ import { HtmlBlockMathRenderer } from '../../helpers/mathjax.js';
5
5
  import { requestInstance } from '../../mixins/provider-mixin.js';
6
6
 
7
7
  export const htmlBlockContentStyles = css`
8
+ .d2l-html-block-compact {
9
+ font-size: 0.8rem;
10
+ font-weight: 400;
11
+ line-height: 1.2rem;
12
+ }
8
13
  h1, h2, h3, h4, h5, h6, b, strong, b *, strong * {
9
14
  font-weight: bold;
10
15
  }
@@ -49,7 +54,11 @@ export const htmlBlockContentStyles = css`
49
54
  ul, ol {
50
55
  list-style-position: outside;
51
56
  margin: 1em 0;
52
- padding-left: 3em;
57
+ padding-inline-start: 3em;
58
+ }
59
+ .d2l-html-block-compact ul,
60
+ .d2l-html-block-compact ol {
61
+ padding-inline-start: 1.5em;
53
62
  }
54
63
  ul, ul[type="disc"] {
55
64
  list-style-type: disc;
@@ -95,11 +104,6 @@ export const htmlBlockContentStyles = css`
95
104
  :host([dir="rtl"]) {
96
105
  text-align: right;
97
106
  }
98
- :host([dir="rtl"]) ul,
99
- :host([dir="rtl"]) ol {
100
- padding-left: 0;
101
- padding-right: 3em;
102
- }
103
107
  `;
104
108
 
105
109
  let renderers;
@@ -120,6 +124,11 @@ class HtmlBlock extends LitElement {
120
124
 
121
125
  static get properties() {
122
126
  return {
127
+ /**
128
+ * Whether compact styles should be applied
129
+ * @type {Boolean}
130
+ */
131
+ compact: { type: Boolean },
123
132
  /**
124
133
  * Whether to disable deferred rendering of the user-authored HTML. Do *not* set this
125
134
  * unless your HTML relies on script executions that may break upon stamping.
@@ -153,6 +162,7 @@ class HtmlBlock extends LitElement {
153
162
 
154
163
  constructor() {
155
164
  super();
165
+ this.compact = false;
156
166
  this.noDeferredRendering = false;
157
167
 
158
168
  const rendererContextAttributes = getRenderers().reduce((attrs, currentRenderer) => {
@@ -185,7 +195,7 @@ class HtmlBlock extends LitElement {
185
195
 
186
196
  if (this._renderContainer) return;
187
197
 
188
- this.shadowRoot.innerHTML += '<div class="d2l-html-block-rendered"></div><slot></slot>';
198
+ this.shadowRoot.innerHTML += `<div class="d2l-html-block-rendered${this.compact ? ' d2l-html-block-compact' : ''}"></div><slot></slot>`;
189
199
 
190
200
  this.shadowRoot.querySelector('slot').addEventListener('slotchange', async e => await this._render(e.target));
191
201
  this._renderContainer = this.shadowRoot.querySelector('.d2l-html-block-rendered');
@@ -3378,6 +3378,12 @@
3378
3378
  "path": "./components/html-block/html-block.js",
3379
3379
  "description": "A component for displaying user-authored HTML.",
3380
3380
  "attributes": [
3381
+ {
3382
+ "name": "compact",
3383
+ "description": "Whether compact styles should be applied",
3384
+ "type": "Boolean",
3385
+ "default": "false"
3386
+ },
3381
3387
  {
3382
3388
  "name": "no-deferred-rendering",
3383
3389
  "description": "Whether to disable deferred rendering of the user-authored HTML. Do *not* set this\nunless your HTML relies on script executions that may break upon stamping.",
@@ -3386,6 +3392,13 @@
3386
3392
  }
3387
3393
  ],
3388
3394
  "properties": [
3395
+ {
3396
+ "name": "compact",
3397
+ "attribute": "compact",
3398
+ "description": "Whether compact styles should be applied",
3399
+ "type": "Boolean",
3400
+ "default": "false"
3401
+ },
3389
3402
  {
3390
3403
  "name": "noDeferredRendering",
3391
3404
  "attribute": "no-deferred-rendering",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.213.2",
3
+ "version": "1.214.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",