@brightspace-ui/core 3.89.0 → 3.90.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.
@@ -35,7 +35,7 @@ Tabs are used to present related information in mutually exclusive panels, allow
35
35
  <!-- docs: end donts -->
36
36
  <!-- docs: end best practices -->
37
37
 
38
- ## Tab [d2l-tabs]
38
+ ## Tabs [d2l-tabs]
39
39
 
40
40
  The `d2l-tabs` element is a web component for tabbed content. It provides the `d2l-tab-panel` component for the content, renders tabs responsively, and provides virtual scrolling for large tab lists.
41
41
 
@@ -66,6 +66,10 @@ The `d2l-tabs` element is a web component for tabbed content. It provides the `d
66
66
 
67
67
  <!-- docs: end hidden content -->
68
68
 
69
+ ## Tab [d2l-tab]
70
+
71
+ Coming soon! This is currently in development and not quite ready for usage.
72
+
69
73
  ## Tab Panels [d2l-tab-panel]
70
74
  Selecting a tab in the tab bar causes the relevant tab panel to be displayed. Tab panels can contain text, form controls, rich media, or just about anything else. There is an optional “slot” available for related controls such as a Settings button.
71
75
 
@@ -34,6 +34,40 @@
34
34
  </template>
35
35
  </d2l-demo-snippet>
36
36
 
37
+ <h2>Tabs (paired d2l-tab with d2l-panel)</h2>
38
+
39
+ <d2l-demo-snippet>
40
+ <div>This format is not yet functional. Please do not use yet.</div>
41
+ <template>
42
+ <d2l-tabs>
43
+ <d2l-tab id="all" text="All" slot="tabs"></d2l-tab>
44
+ <d2l-tab id="biology" text="Biology" slot="tabs"></d2l-tab>
45
+ <d2l-tab id="chemistry" text="Chemistry" slot="tabs"></d2l-tab>
46
+ <d2l-tab id="earth" text="Earth &amp; Planetary Sciences" slot="tabs"></d2l-tab>
47
+ <d2l-tab id="physics" text="Physics" slot="tabs"></d2l-tab>
48
+ <d2l-tab id="math" text="Math" slot="tabs"></d2l-tab>
49
+ <d2l-tab-panel labelled-by="all" slot="panels">Tab content for All</d2l-tab-panel>
50
+ <d2l-tab-panel labelled-by="biology" slot="panels">Tab content for Biology</d2l-tab-panel>
51
+ <d2l-tab-panel labelled-by="chemistry" slot="panels">Tab content for Chemistry</d2l-tab-panel>
52
+ <d2l-tab-panel labelled-by="earth" slot="panels">Tab content for Earth &amp; Planetary Sciences</d2l-tab-panel>
53
+ <d2l-tab-panel labelled-by="physics" slot="panels">Tab content for physics</d2l-tab-panel>
54
+ <d2l-tab-panel labelled-by="math" slot="panels">Tab content for math</d2l-tab-panel>
55
+ <d2l-dropdown-button-subtle slot="ext" text="Explore Topics">
56
+ <d2l-dropdown-menu>
57
+ <d2l-menu label="Astronomy">
58
+ <d2l-menu-item text="Introduction"></d2l-menu-item>
59
+ <d2l-menu-item text="Searching for the Heavens "></d2l-menu-item>
60
+ <d2l-menu-item text="The Solar System"></d2l-menu-item>
61
+ <d2l-menu-item text="Stars &amp; Galaxies"></d2l-menu-item>
62
+ <d2l-menu-item text="The Night Sky"></d2l-menu-item>
63
+ <d2l-menu-item text="The Universe"></d2l-menu-item>
64
+ </d2l-menu>
65
+ </d2l-dropdown-menu>
66
+ </d2l-dropdown-button-subtle>
67
+ </d2l-tabs>
68
+ </template>
69
+ </d2l-demo-snippet>
70
+
37
71
  <h3>Tabs (with slot)</h3>
38
72
 
39
73
  <div style="margin-bottom: 30px;">
@@ -92,25 +92,22 @@ export const TabMixin = superclass => class extends SkeletonMixin(superclass) {
92
92
 
93
93
  render() {
94
94
  return html`
95
- <div class="d2l-skeletize">
96
- ${this.renderContent()}
97
- </div>
95
+ ${this.renderContent()}
98
96
  <div class="d2l-tab-selected-indicator d2l-skeletize-container"></div>
99
97
  `;
100
98
  }
101
99
 
102
100
  update(changedProperties) {
103
101
  super.update(changedProperties);
104
- changedProperties.forEach((oldVal, prop) => {
105
- if (prop === 'selected') {
106
- this.ariaSelected = this.selected;
107
- if (this.selected === 'true') {
108
- this.dispatchEvent(new CustomEvent(
109
- 'd2l-tab-selected', { bubbles: true, composed: true }
110
- ));
111
- }
102
+
103
+ if (changedProperties.has('selected')) {
104
+ this.ariaSelected = this.selected;
105
+ if (this.selected) {
106
+ this.dispatchEvent(new CustomEvent(
107
+ 'd2l-tab-selected', { bubbles: true, composed: true }
108
+ ));
112
109
  }
113
- });
110
+ }
114
111
  }
115
112
 
116
113
  renderContent() {
@@ -9,7 +9,7 @@ export const TabPanelMixin = superclass => class extends superclass {
9
9
  * Id of the tab that labels this panel
10
10
  * @type {string}
11
11
  */
12
- labelledBy: { type: String },
12
+ labelledBy: { type: String, attribute: 'labelled-by' },
13
13
  /**
14
14
  * Opt out of default padding/whitespace around the panel
15
15
  * @type {boolean}
@@ -21,12 +21,12 @@ export const TabPanelMixin = superclass => class extends superclass {
21
21
  // eslint-disable-next-line lit/no-native-attributes
22
22
  role: { type: String, reflect: true },
23
23
  /**
24
- * Use to select the tab
24
+ * Use to select the tab. Do not set if using the d2l-tab/d2l-tab-panel implementation.
25
25
  * @type {boolean}
26
26
  */
27
27
  selected: { type: Boolean, reflect: true },
28
28
  /**
29
- * ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel
29
+ * ACCESSIBILITY: The text used for the tab, as well as labelling the panel. Required if not using d2l-tab/d2l-tab-panel implementation.
30
30
  * @type {string}
31
31
  */
32
32
  text: { type: String }
@@ -5,6 +5,16 @@ import { TabMixin } from './tab-mixin.js';
5
5
 
6
6
  class Tab extends TabMixin(LitElement) {
7
7
 
8
+ static get properties() {
9
+ return {
10
+ /**
11
+ * ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel.
12
+ * @type {string}
13
+ */
14
+ text: { type: String }
15
+ };
16
+ }
17
+
8
18
  static get styles() {
9
19
  const styles = [ css`
10
20
  .d2l-tab-text {
@@ -30,16 +40,15 @@ class Tab extends TabMixin(LitElement) {
30
40
 
31
41
  renderContent() {
32
42
  const contentClasses = {
33
- 'd2l-tab-handler': true,
34
43
  'd2l-tab-text': true,
35
44
  };
36
45
 
37
46
  return html`
38
47
  <div class="${classMap(contentClasses)}">
39
- <slot></slot>
48
+ ${this.text}
40
49
  </div>
41
50
  `;
42
51
  }
43
52
  }
44
53
 
45
- customElements.define('d2l-tab-wip', Tab);
54
+ customElements.define('d2l-tab', Tab);
@@ -87,7 +87,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
87
87
  padding-inline: 4px 0;
88
88
  }
89
89
  .d2l-tabs-container-list {
90
- display: block;
90
+ display: flex;
91
91
  -webkit-transition: transform 200ms ease-out;
92
92
  transition: transform 200ms ease-out;
93
93
  white-space: nowrap;
@@ -12762,13 +12762,13 @@
12762
12762
  "description": "A component for tab panel content.",
12763
12763
  "attributes": [
12764
12764
  {
12765
- "name": "labelledBy",
12765
+ "name": "labelled-by",
12766
12766
  "description": "Id of the tab that labels this panel",
12767
12767
  "type": "string"
12768
12768
  },
12769
12769
  {
12770
12770
  "name": "text",
12771
- "description": "ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel",
12771
+ "description": "ACCESSIBILITY: The text used for the tab, as well as labelling the panel. Required if not using d2l-tab/d2l-tab-panel implementation.",
12772
12772
  "type": "string"
12773
12773
  },
12774
12774
  {
@@ -12779,7 +12779,7 @@
12779
12779
  },
12780
12780
  {
12781
12781
  "name": "selected",
12782
- "description": "Use to select the tab",
12782
+ "description": "Use to select the tab. Do not set if using the d2l-tab/d2l-tab-panel implementation.",
12783
12783
  "type": "boolean",
12784
12784
  "default": "false"
12785
12785
  }
@@ -12787,14 +12787,14 @@
12787
12787
  "properties": [
12788
12788
  {
12789
12789
  "name": "labelledBy",
12790
- "attribute": "labelledBy",
12790
+ "attribute": "labelled-by",
12791
12791
  "description": "Id of the tab that labels this panel",
12792
12792
  "type": "string"
12793
12793
  },
12794
12794
  {
12795
12795
  "name": "text",
12796
12796
  "attribute": "text",
12797
- "description": "ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel",
12797
+ "description": "ACCESSIBILITY: The text used for the tab, as well as labelling the panel. Required if not using d2l-tab/d2l-tab-panel implementation.",
12798
12798
  "type": "string"
12799
12799
  },
12800
12800
  {
@@ -12807,7 +12807,7 @@
12807
12807
  {
12808
12808
  "name": "selected",
12809
12809
  "attribute": "selected",
12810
- "description": "Use to select the tab",
12810
+ "description": "Use to select the tab. Do not set if using the d2l-tab/d2l-tab-panel implementation.",
12811
12811
  "type": "boolean",
12812
12812
  "default": "false"
12813
12813
  }
@@ -12830,9 +12830,14 @@
12830
12830
  ]
12831
12831
  },
12832
12832
  {
12833
- "name": "d2l-tab-wip",
12833
+ "name": "d2l-tab",
12834
12834
  "path": "./components/tabs/tab.js",
12835
12835
  "attributes": [
12836
+ {
12837
+ "name": "text",
12838
+ "description": "ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel.",
12839
+ "type": "string"
12840
+ },
12836
12841
  {
12837
12842
  "name": "selected",
12838
12843
  "type": "boolean",
@@ -12845,6 +12850,12 @@
12845
12850
  }
12846
12851
  ],
12847
12852
  "properties": [
12853
+ {
12854
+ "name": "text",
12855
+ "attribute": "text",
12856
+ "description": "ACCESSIBILITY: REQUIRED: The text used for the tab, as well as labelling the panel.",
12857
+ "type": "string"
12858
+ },
12848
12859
  {
12849
12860
  "name": "ariaSelected",
12850
12861
  "type": "boolean",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.89.0",
3
+ "version": "3.90.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",