@brightspace-ui/core 3.227.4 → 3.227.5
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.
- package/components/button/button.js +8 -8
- package/components/demo/test/demo-page-settings.test.js +25 -0
- package/components/demo/test/demo-page.test.js +17 -0
- package/package.json +1 -1
- package/components/alert/demo/alert-toast.html +0 -106
- package/components/alert/demo/alert.html +0 -82
- package/components/backdrop/demo/backdrop-loading.html +0 -166
- package/components/backdrop/demo/backdrop.html +0 -57
- package/components/breadcrumbs/demo/breadcrumbs.html +0 -53
- package/components/button/demo/button-add.html +0 -55
- package/components/button/demo/button-copy.html +0 -122
- package/components/button/demo/button-icon.html +0 -174
- package/components/button/demo/button-move.html +0 -38
- package/components/button/demo/button-split.html +0 -76
- package/components/button/demo/button-subtle.html +0 -132
- package/components/button/demo/button-toggle.html +0 -80
- package/components/button/demo/button.html +0 -67
- package/components/button/demo/floating-buttons-in-frame.html +0 -44
- package/components/button/demo/floating-buttons-in-tabs.html +0 -244
- package/components/button/demo/floating-buttons-page.html +0 -100
- package/components/button/demo/floating-buttons.html +0 -101
- package/components/calendar/demo/calendar.html +0 -76
- package/components/card/demo/card.html +0 -304
- package/components/collapsible-panel/demo/collapsible-panel.html +0 -218
- package/components/colors/demo/color-swatch.js +0 -240
- package/components/colors/demo/colors.html +0 -139
- package/components/count-badge/demo/count-badge-icon.html +0 -48
- package/components/count-badge/demo/count-badge.html +0 -73
- package/components/demo/demo/demo-snippet.html +0 -71
- package/components/description-list/demo/description-list-test.js +0 -142
- package/components/description-list/demo/description-list.html +0 -48
- package/components/dialog/demo/dialog-async-content-until.js +0 -89
- package/components/dialog/demo/dialog-async-content.js +0 -72
- package/components/dialog/demo/dialog-confirm.html +0 -102
- package/components/dialog/demo/dialog-container.js +0 -40
- package/components/dialog/demo/dialog-fullscreen.html +0 -273
- package/components/dialog/demo/dialog-nested.html +0 -94
- package/components/dialog/demo/dialog.html +0 -398
- package/components/dropdown/demo/dropdown-button.html +0 -102
- package/components/dropdown/demo/dropdown-context-menu.html +0 -129
- package/components/dropdown/demo/dropdown-flicker-inner.html +0 -70
- package/components/dropdown/demo/dropdown-flicker.html +0 -142
- package/components/dropdown/demo/dropdown-menu-demo-view.js +0 -37
- package/components/dropdown/demo/dropdown-menu.html +0 -227
- package/components/dropdown/demo/dropdown-more.html +0 -160
- package/components/dropdown/demo/dropdown-positioning.html +0 -127
- package/components/dropdown/demo/dropdown-tabs.html +0 -87
- package/components/dropdown/demo/dropdown.html +0 -217
- package/components/empty-state/demo/empty-state.html +0 -94
- package/components/expand-collapse/demo/expand-collapse-content.html +0 -58
- package/components/filter/demo/filter-load-more-demo.js +0 -182
- package/components/filter/demo/filter-overflow-group.html +0 -246
- package/components/filter/demo/filter-search-demo.js +0 -135
- package/components/filter/demo/filter-tags.html +0 -115
- package/components/filter/demo/filter.html +0 -230
- package/components/focus-trap/demo/focus-trap.html +0 -75
- package/components/form/demo/form-demo.js +0 -105
- package/components/form/demo/form-dialog-demo.js +0 -94
- package/components/form/demo/form-panel-demo.js +0 -89
- package/components/form/demo/form.html +0 -37
- package/components/hierarchical-view/demo/hierarchical-view.html +0 -221
- package/components/html-block/demo/html-block-code.html +0 -55
- package/components/html-block/demo/html-block.html +0 -696
- package/components/icons/demo/icon-color-override.js +0 -23
- package/components/icons/demo/icon-custom.html +0 -112
- package/components/icons/demo/icon-size-override.js +0 -24
- package/components/icons/demo/icon.html +0 -52
- package/components/inputs/demo/input-checkbox.html +0 -118
- package/components/inputs/demo/input-color-palette.js +0 -67
- package/components/inputs/demo/input-color.html +0 -110
- package/components/inputs/demo/input-date-range.html +0 -114
- package/components/inputs/demo/input-date-time-range.html +0 -128
- package/components/inputs/demo/input-date-time.html +0 -100
- package/components/inputs/demo/input-date.html +0 -81
- package/components/inputs/demo/input-group.html +0 -56
- package/components/inputs/demo/input-number.html +0 -136
- package/components/inputs/demo/input-percent.html +0 -99
- package/components/inputs/demo/input-radio-label-test.js +0 -45
- package/components/inputs/demo/input-radio-solo-test.js +0 -47
- package/components/inputs/demo/input-radio.html +0 -119
- package/components/inputs/demo/input-search.html +0 -75
- package/components/inputs/demo/input-select-test.js +0 -60
- package/components/inputs/demo/input-select.html +0 -45
- package/components/inputs/demo/input-text.html +0 -163
- package/components/inputs/demo/input-textarea.html +0 -124
- package/components/inputs/demo/input-time-range.html +0 -121
- package/components/inputs/demo/input-time.html +0 -95
- package/components/link/demo/link.html +0 -111
- package/components/list/demo/demo-list-nav.js +0 -170
- package/components/list/demo/demo-list-nested-iterations-helper.js +0 -168
- package/components/list/demo/demo-list-nested-lazy-load.js +0 -133
- package/components/list/demo/demo-list-nested.js +0 -291
- package/components/list/demo/demo-list.js +0 -241
- package/components/list/demo/list-color.html +0 -423
- package/components/list/demo/list-demo-scenarios.js +0 -380
- package/components/list/demo/list-drag-and-drop-position.js +0 -102
- package/components/list/demo/list-drag-and-drop.html +0 -82
- package/components/list/demo/list-expand-collapse.html +0 -136
- package/components/list/demo/list-item-actions.html +0 -371
- package/components/list/demo/list-item-custom.js +0 -204
- package/components/list/demo/list-item-layouts.html +0 -331
- package/components/list/demo/list-item-scroll.html +0 -122
- package/components/list/demo/list-layout.html +0 -575
- package/components/list/demo/list-nav.html +0 -110
- package/components/list/demo/list-nested.html +0 -270
- package/components/list/demo/list-selection.html +0 -301
- package/components/list/demo/list.html +0 -319
- package/components/loading-spinner/demo/loading-spinner-override.js +0 -34
- package/components/loading-spinner/demo/loading-spinner.html +0 -63
- package/components/menu/demo/checkbox-menu.html +0 -52
- package/components/menu/demo/custom-menu-item.js +0 -37
- package/components/menu/demo/custom-view.js +0 -63
- package/components/menu/demo/menu.html +0 -211
- package/components/menu/demo/radio-menu.html +0 -52
- package/components/meter/demo/meter.html +0 -115
- package/components/more-less/demo/more-less-test.js +0 -67
- package/components/more-less/demo/more-less.html +0 -71
- package/components/object-property-list/demo/object-property-list.html +0 -99
- package/components/offscreen/demo/offscreen-demo.js +0 -16
- package/components/offscreen/demo/offscreen.html +0 -44
- package/components/overflow-group/demo/demo-overflow-group.js +0 -29
- package/components/overflow-group/demo/overflow-group.html +0 -110
- package/components/paging/demo/pager-load-more.html +0 -120
- package/components/popover/demo/popover.html +0 -309
- package/components/progress/demo/progress.html +0 -104
- package/components/scroll-wrapper/demo/scroll-wrapper-test.js +0 -108
- package/components/scroll-wrapper/demo/scroll-wrapper.html +0 -52
- package/components/selection/demo/demo-selection.js +0 -35
- package/components/selection/demo/selection.html +0 -198
- package/components/skeleton/demo/skeleton-group-nested-test.js +0 -71
- package/components/skeleton/demo/skeleton-group-test-wrapper.js +0 -18
- package/components/skeleton/demo/skeleton-group-test.js +0 -91
- package/components/skeleton/demo/skeleton-mixin.html +0 -78
- package/components/skeleton/demo/skeleton-test-box.js +0 -34
- package/components/skeleton/demo/skeleton-test-container.js +0 -45
- package/components/skeleton/demo/skeleton-test-heading.js +0 -44
- package/components/skeleton/demo/skeleton-test-link.js +0 -47
- package/components/skeleton/demo/skeleton-test-paragraph.js +0 -54
- package/components/skeleton/demo/skeleton-test-stack.js +0 -38
- package/components/skeleton/demo/skeleton-test-width.js +0 -20
- package/components/sorting/demo/sort.html +0 -37
- package/components/status-indicator/demo/status-indicator.html +0 -99
- package/components/switch/demo/switch.html +0 -95
- package/components/table/demo/table-test.js +0 -271
- package/components/table/demo/table.html +0 -107
- package/components/tabs/demo/tab-custom.js +0 -39
- package/components/tabs/demo/tabs-array.js +0 -43
- package/components/tabs/demo/tabs.html +0 -558
- package/components/tag-list/demo/tag-list.html +0 -117
- package/components/tooltip/demo/tooltip.html +0 -275
- package/components/typography/demo/typography.html +0 -93
- package/components/view-switcher/demo/demo-table-view.js +0 -41
- package/components/view-switcher/demo/view-switcher.html +0 -71
- package/directives/animate/demo/animate-test.js +0 -98
- package/directives/animate/demo/index.html +0 -23
- package/helpers/demo/announce-test.js +0 -37
- package/helpers/demo/announce.html +0 -19
- package/helpers/demo/dismissible-test.js +0 -66
- package/helpers/demo/dismissible.html +0 -38
- package/helpers/demo/gestures.html +0 -58
- package/helpers/demo/prism.html +0 -694
- package/helpers/demo/template-tags.html +0 -118
- package/mixins/arrow-keys/demo/arrow-keys-mixin.html +0 -29
- package/mixins/arrow-keys/demo/arrow-keys-test.js +0 -38
- package/mixins/async-container/demo/async-container.html +0 -109
- package/mixins/async-container/demo/async-container.js +0 -27
- package/mixins/async-container/demo/async-item.js +0 -80
- package/mixins/labelled/demo/labelled-mixin.html +0 -90
- package/mixins/localize/demo/localize-mixin-greeting.js +0 -39
- package/mixins/localize/demo/localize-mixin-mission.js +0 -25
- package/mixins/localize/demo/localize-mixin.html +0 -28
- package/templates/primary-secondary/demo/form.html +0 -55
- package/templates/primary-secondary/demo/index.html +0 -27
- package/templates/primary-secondary/demo/integration.html +0 -457
- package/templates/primary-secondary/demo/overflow-hidden.html +0 -22
- package/templates/primary-secondary/demo/width-type-normal.html +0 -26
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="../../components/demo/styles.css" type="text/css">
|
|
7
|
-
<script type="module">
|
|
8
|
-
import '../../components/demo/demo-page.js';
|
|
9
|
-
import '../../components/inputs/input-textarea.js';
|
|
10
|
-
</script>
|
|
11
|
-
</head>
|
|
12
|
-
<body unresolved>
|
|
13
|
-
<d2l-demo-page page-title="template-tags">
|
|
14
|
-
|
|
15
|
-
<h2>Basic Template - No Tag</h2>
|
|
16
|
-
|
|
17
|
-
<d2l-demo-snippet>
|
|
18
|
-
<template>
|
|
19
|
-
<d2l-input-textarea id="no-tag"></d2l-input-textarea>
|
|
20
|
-
<script type="module">
|
|
21
|
-
document.querySelector('#no-tag').value = `
|
|
22
|
-
A multiline template literal,
|
|
23
|
-
with in-code indentation
|
|
24
|
-
`;
|
|
25
|
-
</script>
|
|
26
|
-
</template>
|
|
27
|
-
</d2l-demo-snippet>
|
|
28
|
-
|
|
29
|
-
<h2>Basic Template - Tag</h2>
|
|
30
|
-
|
|
31
|
-
<d2l-demo-snippet>
|
|
32
|
-
<template>
|
|
33
|
-
<d2l-input-textarea id="normal-tag"></d2l-input-textarea>
|
|
34
|
-
<script type="module">
|
|
35
|
-
import { set } from '../../helpers/template-tags.js';
|
|
36
|
-
document.querySelector('#normal-tag').value =
|
|
37
|
-
set`A multiline template literal,
|
|
38
|
-
with in-code indentation`;
|
|
39
|
-
</script>
|
|
40
|
-
</template>
|
|
41
|
-
</d2l-demo-snippet>
|
|
42
|
-
|
|
43
|
-
<h2>Basic Template - Tag (whitespace)</h2>
|
|
44
|
-
|
|
45
|
-
<d2l-demo-snippet>
|
|
46
|
-
<template>
|
|
47
|
-
<d2l-input-textarea id="marked-tag"></d2l-input-textarea>
|
|
48
|
-
<script type="module">
|
|
49
|
-
import { set } from '../../helpers/template-tags.js';
|
|
50
|
-
document.querySelector('#marked-tag').value = set`
|
|
51
|
-
A multiline template literal,
|
|
52
|
-
with in-code indentation
|
|
53
|
-
`;
|
|
54
|
-
</script>
|
|
55
|
-
</template>
|
|
56
|
-
</d2l-demo-snippet>
|
|
57
|
-
|
|
58
|
-
<h2>Complex Template - No Tag</h2>
|
|
59
|
-
|
|
60
|
-
<d2l-demo-snippet>
|
|
61
|
-
<template>
|
|
62
|
-
<d2l-input-textarea id="complex-no-tag"></d2l-input-textarea>
|
|
63
|
-
<d2l-input-textarea id="complex-no-tag2"></d2l-input-textarea>
|
|
64
|
-
<script type="module">
|
|
65
|
-
document.querySelector('#complex-no-tag').value =
|
|
66
|
-
`{peopleCount, plural,
|
|
67
|
-
one {There is # person}
|
|
68
|
-
other {There are # people}
|
|
69
|
-
}`;
|
|
70
|
-
/* eslint-disable @stylistic/indent */
|
|
71
|
-
document.querySelector('#complex-no-tag2').value =
|
|
72
|
-
`{peopleCount, plural,
|
|
73
|
-
one {There is # person}
|
|
74
|
-
other {There are # people}
|
|
75
|
-
}`;
|
|
76
|
-
/* eslint-enable @stylistic/indent */
|
|
77
|
-
</script>
|
|
78
|
-
</template>
|
|
79
|
-
</d2l-demo-snippet>
|
|
80
|
-
|
|
81
|
-
<h2>Complex Template - Tag</h2>
|
|
82
|
-
|
|
83
|
-
<d2l-demo-snippet>
|
|
84
|
-
<template>
|
|
85
|
-
<d2l-input-textarea id="complex-normal-tag"></d2l-input-textarea>
|
|
86
|
-
<script type="module">
|
|
87
|
-
import { set } from '../../helpers/template-tags.js';
|
|
88
|
-
document.querySelector('#complex-normal-tag').value =
|
|
89
|
-
set`{peopleCount, plural,
|
|
90
|
-
one {There is # person}
|
|
91
|
-
other {There are # people}
|
|
92
|
-
}`;
|
|
93
|
-
</script>
|
|
94
|
-
</template>
|
|
95
|
-
</d2l-demo-snippet>
|
|
96
|
-
|
|
97
|
-
<h2>Complex Template - Tag (whitespace)</h2>
|
|
98
|
-
|
|
99
|
-
<d2l-demo-snippet>
|
|
100
|
-
<template>
|
|
101
|
-
<d2l-input-textarea id="complex-marked-tag"></d2l-input-textarea>
|
|
102
|
-
<script type="module">
|
|
103
|
-
import { set } from '../../helpers/template-tags.js';
|
|
104
|
-
const test = 'are';
|
|
105
|
-
document.querySelector('#complex-marked-tag').value = set`
|
|
106
|
-
{peopleCount, plural,
|
|
107
|
-
one {There is # person}
|
|
108
|
-
other {There ${test} # people}
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
</script>
|
|
112
|
-
</template>
|
|
113
|
-
</d2l-demo-snippet>
|
|
114
|
-
|
|
115
|
-
</d2l-demo-page>
|
|
116
|
-
|
|
117
|
-
</body>
|
|
118
|
-
</html>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
7
|
-
<script type="module">
|
|
8
|
-
import '../../../components/demo/demo-page.js';
|
|
9
|
-
import './arrow-keys-test.js';
|
|
10
|
-
</script>
|
|
11
|
-
</head>
|
|
12
|
-
<body unresolved>
|
|
13
|
-
<d2l-demo-page page-title="arrow-keys-mixin">
|
|
14
|
-
|
|
15
|
-
<h2>Focus Wrap (default)</h2>
|
|
16
|
-
|
|
17
|
-
<d2l-demo-snippet>
|
|
18
|
-
<d2l-test-arrow-keys></d2l-test-arrow-keys>
|
|
19
|
-
</d2l-demo-snippet>
|
|
20
|
-
|
|
21
|
-
<h2>Focus No Wrap</h2>
|
|
22
|
-
|
|
23
|
-
<d2l-demo-snippet>
|
|
24
|
-
<d2l-test-arrow-keys arrow-keys-no-wrap></d2l-test-arrow-keys>
|
|
25
|
-
</d2l-demo-snippet>
|
|
26
|
-
|
|
27
|
-
</d2l-demo-page>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import '../../../components/colors/colors.js';
|
|
2
|
-
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { ArrowKeysMixin } from '../arrow-keys-mixin.js';
|
|
4
|
-
|
|
5
|
-
export class ArrowKeysTest extends ArrowKeysMixin(LitElement) {
|
|
6
|
-
|
|
7
|
-
static get styles() {
|
|
8
|
-
return css`
|
|
9
|
-
:host {
|
|
10
|
-
display: inline-block;
|
|
11
|
-
}
|
|
12
|
-
.d2l-arrowkeys-focusable {
|
|
13
|
-
border: 2px solid var(--d2l-color-ferrite);
|
|
14
|
-
border-radius: 4px;
|
|
15
|
-
display: inline-block;
|
|
16
|
-
padding: 1rem;
|
|
17
|
-
}
|
|
18
|
-
.d2l-arrowkeys-focusable:focus {
|
|
19
|
-
border: 2px solid var(--d2l-color-celestine);
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
render() {
|
|
25
|
-
const inner = html`
|
|
26
|
-
<div class="d2l-arrowkeys-focusable" tabindex="0"></div>
|
|
27
|
-
<div class="d2l-arrowkeys-focusable" tabindex="-1"></div>
|
|
28
|
-
<div class="d2l-arrowkeys-focusable" tabindex="-1"></div>
|
|
29
|
-
<div class="d2l-arrowkeys-focusable" tabindex="-1"></div>
|
|
30
|
-
<div class="d2l-arrowkeys-focusable" tabindex="-1"></div>`;
|
|
31
|
-
|
|
32
|
-
return html`<div id="d2l-arrowkeys-mixin-test">
|
|
33
|
-
${this.arrowKeysContainer(inner)}
|
|
34
|
-
</div>`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
customElements.define('d2l-test-arrow-keys', ArrowKeysTest);
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
7
|
-
<script type="module">
|
|
8
|
-
import '../../../components/demo/demo-page.js';
|
|
9
|
-
import '../../../components/button/button.js';
|
|
10
|
-
import '../../../components/loading-spinner/loading-spinner.js';
|
|
11
|
-
import './async-container.js';
|
|
12
|
-
import './async-item.js';
|
|
13
|
-
</script>
|
|
14
|
-
<style>
|
|
15
|
-
#asyncNoContainer div,
|
|
16
|
-
#asyncContainer div {
|
|
17
|
-
margin-bottom: 0.6rem;
|
|
18
|
-
margin-top: 0.6rem;
|
|
19
|
-
}
|
|
20
|
-
d2l-async-demo-container {
|
|
21
|
-
display: block;
|
|
22
|
-
margin-top: 0.6rem;
|
|
23
|
-
}
|
|
24
|
-
d2l-async-demo-item {
|
|
25
|
-
margin-right: 0.6rem;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
28
|
-
</head>
|
|
29
|
-
<body unresolved>
|
|
30
|
-
|
|
31
|
-
<d2l-demo-page page-title="d2l-async-container">
|
|
32
|
-
|
|
33
|
-
<h2>Async Items (no container)</h2>
|
|
34
|
-
|
|
35
|
-
<d2l-demo-snippet id="asyncNoContainer">
|
|
36
|
-
<template>
|
|
37
|
-
<d2l-button>Do Async Tasks</d2l-button>
|
|
38
|
-
<div>
|
|
39
|
-
<d2l-async-demo-item delay="1000"></d2l-async-demo-item>
|
|
40
|
-
<d2l-async-demo-item delay="2000" throw-error></d2l-async-demo-item>
|
|
41
|
-
<d2l-async-demo-item delay="6000"></d2l-async-demo-item>
|
|
42
|
-
<d2l-async-demo-item delay="2000"></d2l-async-demo-item>
|
|
43
|
-
</div>
|
|
44
|
-
<script>
|
|
45
|
-
document.querySelector('#asyncNoContainer d2l-button').addEventListener('click', () => {
|
|
46
|
-
const items = document.querySelectorAll('#asyncNoContainer d2l-async-demo-item');
|
|
47
|
-
for (let i = 0; i < items.length; i++) {
|
|
48
|
-
items[i].key = `key-${i}`;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
</script>
|
|
52
|
-
</template>
|
|
53
|
-
</d2l-demo-snippet>
|
|
54
|
-
|
|
55
|
-
<h2>Async Container (init -> pending -> complete)</h2>
|
|
56
|
-
|
|
57
|
-
<d2l-demo-snippet id="asyncContainer">
|
|
58
|
-
<template>
|
|
59
|
-
<d2l-button>Do Async Tasks</d2l-button>
|
|
60
|
-
<d2l-async-demo-container async-pending-delay="1000">
|
|
61
|
-
<div slot="initial">Click above!</div>
|
|
62
|
-
<div slot="pending"><d2l-loading-spinner></d2l-loading-spinner></div>
|
|
63
|
-
<div>
|
|
64
|
-
<d2l-async-demo-item delay="1000"></d2l-async-demo-item>
|
|
65
|
-
<d2l-async-demo-item delay="2000" throw-error></d2l-async-demo-item>
|
|
66
|
-
<d2l-async-demo-item delay="4000"></d2l-async-demo-item>
|
|
67
|
-
<d2l-async-demo-item delay="2000"></d2l-async-demo-item>
|
|
68
|
-
</div>
|
|
69
|
-
</d2l-async-demo-container>
|
|
70
|
-
<script>
|
|
71
|
-
document.querySelector('#asyncContainer d2l-button').addEventListener('click', () => {
|
|
72
|
-
const items = document.querySelectorAll('#asyncContainer d2l-async-demo-item');
|
|
73
|
-
for (let i = 0; i < items.length; i++) {
|
|
74
|
-
items[i].key = `key-${i}`;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
</script>
|
|
78
|
-
</template>
|
|
79
|
-
</d2l-demo-snippet>
|
|
80
|
-
|
|
81
|
-
<h2>Async Container (init -> complete)</h2>
|
|
82
|
-
|
|
83
|
-
<d2l-demo-snippet id="asyncContainerNoPending">
|
|
84
|
-
<template>
|
|
85
|
-
<d2l-button>Do Async Tasks</d2l-button>
|
|
86
|
-
<d2l-async-demo-container async-pending-delay="5000">
|
|
87
|
-
<div slot="initial">Click above!</div>
|
|
88
|
-
<div slot="pending"><d2l-loading-spinner></d2l-loading-spinner></div>
|
|
89
|
-
<div>
|
|
90
|
-
<d2l-async-demo-item delay="1000"></d2l-async-demo-item>
|
|
91
|
-
<d2l-async-demo-item delay="2000" throw-error></d2l-async-demo-item>
|
|
92
|
-
<d2l-async-demo-item delay="4000"></d2l-async-demo-item>
|
|
93
|
-
<d2l-async-demo-item delay="2000"></d2l-async-demo-item>
|
|
94
|
-
</div>
|
|
95
|
-
</d2l-async-demo-container>
|
|
96
|
-
<script>
|
|
97
|
-
document.querySelector('#asyncContainerNoPending d2l-button').addEventListener('click', () => {
|
|
98
|
-
const items = document.querySelectorAll('#asyncContainerNoPending d2l-async-demo-item');
|
|
99
|
-
for (let i = 0; i < items.length; i++) {
|
|
100
|
-
items[i].key = `key-${i}`;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
</script>
|
|
104
|
-
</template>
|
|
105
|
-
</d2l-demo-snippet>
|
|
106
|
-
|
|
107
|
-
</d2l-demo-page>
|
|
108
|
-
</body>
|
|
109
|
-
</html>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AsyncContainerMixin, asyncStates } from '../async-container-mixin.js';
|
|
2
|
-
import { html, LitElement } from 'lit';
|
|
3
|
-
|
|
4
|
-
class AsyncContainer extends AsyncContainerMixin(LitElement) {
|
|
5
|
-
|
|
6
|
-
render() {
|
|
7
|
-
if (this.asyncState === asyncStates.complete) {
|
|
8
|
-
return html`<slot></slot>`;
|
|
9
|
-
} else if (this.asyncState === asyncStates.pending) {
|
|
10
|
-
return html`<slot name="pending"></slot>`;
|
|
11
|
-
} else {
|
|
12
|
-
return html`<slot name="initial"></slot>`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
updated(changedProperties) {
|
|
17
|
-
if (!changedProperties.has('asyncState')) return;
|
|
18
|
-
this.dispatchEvent(new CustomEvent('d2l-async-demo-container-changed', {
|
|
19
|
-
composed: true,
|
|
20
|
-
bubbles: true,
|
|
21
|
-
detail: { state: this.asyncState }
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
customElements.define('d2l-async-demo-container', AsyncContainer);
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import '../../../components/colors/colors.js';
|
|
2
|
-
import { css, html, LitElement } from 'lit';
|
|
3
|
-
import { InitialStateError, runAsync } from '../../../directives/run-async/run-async.js';
|
|
4
|
-
|
|
5
|
-
class AsyncItem extends LitElement {
|
|
6
|
-
|
|
7
|
-
static get properties() {
|
|
8
|
-
return {
|
|
9
|
-
delay: { type: Number },
|
|
10
|
-
key: { type: String },
|
|
11
|
-
manual: { type: Boolean },
|
|
12
|
-
throwError: { type: Boolean, attribute: 'throw-error' }
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static get styles() {
|
|
17
|
-
return css`
|
|
18
|
-
:host {
|
|
19
|
-
display: inline-block;
|
|
20
|
-
}
|
|
21
|
-
div {
|
|
22
|
-
background-color: var(--d2l-color-celestine);
|
|
23
|
-
border: 1px solid var(--d2l-color-galena);
|
|
24
|
-
border-radius: 0.4rem;
|
|
25
|
-
color: white;
|
|
26
|
-
height: 100px;
|
|
27
|
-
padding: 0.3rem;
|
|
28
|
-
text-align: center;
|
|
29
|
-
width: 100px;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
constructor() {
|
|
35
|
-
super();
|
|
36
|
-
this.delay = 4000;
|
|
37
|
-
this.key = null;
|
|
38
|
-
this.manual = false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
render() {
|
|
42
|
-
return html`${runAsync(this.key, (key) => this._getContent(key), {
|
|
43
|
-
initial: () => html`<div>init</div>`,
|
|
44
|
-
pending: () => html`<div>pending</div>`,
|
|
45
|
-
success: (content) => content,
|
|
46
|
-
failure: (message) => html`<div title="${message}">failure</div>`
|
|
47
|
-
})}`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
reject() {
|
|
51
|
-
setTimeout(() => this._reject('error'), 0);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
resolve() {
|
|
55
|
-
setTimeout(() => this._resolve(html`<div>${this.key}</div>`), 0);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
_getContent(key) {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
if (!key) {
|
|
61
|
-
throw new InitialStateError();
|
|
62
|
-
} else {
|
|
63
|
-
this._resolve = resolve;
|
|
64
|
-
this._reject = reject;
|
|
65
|
-
if (!this.manual) {
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
if (this.throwError) {
|
|
68
|
-
this.reject();
|
|
69
|
-
} else {
|
|
70
|
-
this.resolve();
|
|
71
|
-
}
|
|
72
|
-
}, this.delay);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
customElements.define('d2l-async-demo-item', AsyncItem);
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
5
|
-
<script type="module">
|
|
6
|
-
import '../../../components/demo/demo-page.js';
|
|
7
|
-
import '../../../components/inputs/input-checkbox.js';
|
|
8
|
-
import { css, html, LitElement } from 'lit';
|
|
9
|
-
import { LabelledMixin, LabelMixin } from '../labelled-mixin.js';
|
|
10
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
-
|
|
12
|
-
class DemoInput extends LabelledMixin(LitElement) {
|
|
13
|
-
static get styles() {
|
|
14
|
-
return css`
|
|
15
|
-
:host {
|
|
16
|
-
disply: inline-block;
|
|
17
|
-
}
|
|
18
|
-
d2l-input-checkbox {
|
|
19
|
-
margin-bottom: 0;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return html`
|
|
25
|
-
<d2l-input-checkbox label="${ifDefined(this.label)}" label-hidden></d2l-input-checkbox>
|
|
26
|
-
`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
customElements.define('d2l-demo-input', DemoInput);
|
|
30
|
-
|
|
31
|
-
class DemoText extends LabelMixin(LitElement) {
|
|
32
|
-
static get properties() {
|
|
33
|
-
return {
|
|
34
|
-
text: { type: String }
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
static get styles() {
|
|
38
|
-
return css`
|
|
39
|
-
:host {
|
|
40
|
-
disply: inline-block;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
constructor() {
|
|
45
|
-
super();
|
|
46
|
-
this.text = '';
|
|
47
|
-
}
|
|
48
|
-
render() {
|
|
49
|
-
return html`
|
|
50
|
-
<span>${this.text}</span>
|
|
51
|
-
`;
|
|
52
|
-
}
|
|
53
|
-
updated(changedProperties) {
|
|
54
|
-
super.updated(changedProperties);
|
|
55
|
-
this.updateLabel(this.text);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
customElements.define('d2l-demo-text', DemoText);
|
|
59
|
-
|
|
60
|
-
</script>
|
|
61
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
62
|
-
<meta charset="UTF-8">
|
|
63
|
-
</head>
|
|
64
|
-
<body unresolved>
|
|
65
|
-
<d2l-demo-page page-title="LabelMixin & LabelledMixin">
|
|
66
|
-
|
|
67
|
-
<h2>Default</h2>
|
|
68
|
-
|
|
69
|
-
<d2l-demo-snippet>
|
|
70
|
-
<template>
|
|
71
|
-
<table>
|
|
72
|
-
<tr>
|
|
73
|
-
<td><d2l-demo-input labelled-by="topping-1"></d2l-demo-input></td>
|
|
74
|
-
<td><span id="topping-1" class="d2l-label-text">Caramel</span></td>
|
|
75
|
-
</tr>
|
|
76
|
-
<tr>
|
|
77
|
-
<td><d2l-demo-input label="Sprinkles"></d2l-demo-input></td>
|
|
78
|
-
<td><span class="d2l-label-text">Sprinkles</span></td>
|
|
79
|
-
</tr>
|
|
80
|
-
<tr>
|
|
81
|
-
<td><d2l-demo-input labelled-by="topping-3"></d2l-demo-input></td>
|
|
82
|
-
<td><d2l-demo-text id="topping-3" class="d2l-label-text" text="Hard Chocolate Coating"></d2l-demo-text></td>
|
|
83
|
-
</tr>
|
|
84
|
-
</table>
|
|
85
|
-
</template>
|
|
86
|
-
</d2l-demo-snippet>
|
|
87
|
-
|
|
88
|
-
</d2l-demo-page>
|
|
89
|
-
</body>
|
|
90
|
-
</html>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { html, LitElement } from 'lit';
|
|
2
|
-
import { LocalizeMixin } from '../localize-mixin.js';
|
|
3
|
-
|
|
4
|
-
class Greeting extends LocalizeMixin(LitElement) {
|
|
5
|
-
|
|
6
|
-
static get properties() {
|
|
7
|
-
return {
|
|
8
|
-
name: { type: String }
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static get localizeConfig() {
|
|
13
|
-
const langResources = {
|
|
14
|
-
'ar': { 'hello': 'مرحبا {name}' },
|
|
15
|
-
'de': { 'hello': 'Hallo {name}' },
|
|
16
|
-
'en': { 'hello': 'Hello, {name}' },
|
|
17
|
-
'en-gb': { 'hello': '\'Ello, {name}' },
|
|
18
|
-
'es': { 'hello': 'Hola {name}' },
|
|
19
|
-
'fr': { 'hello': 'Bonjour, {name}' },
|
|
20
|
-
'ja': { 'hello': 'こんにちは {name}' },
|
|
21
|
-
'ko': { 'hello': '안녕하세요 {name}' },
|
|
22
|
-
'pt-br': { 'hello': 'Olá {name}' },
|
|
23
|
-
'tr': { 'hello': 'Merhaba {name}' },
|
|
24
|
-
'zh-cn': { 'hello': '你好 {name}' },
|
|
25
|
-
'zh-tw': { 'hello': '你好 {name}' }
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
importFunc: async lang => langResources[lang]
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
return html`
|
|
34
|
-
<p>${this.localize('hello', { name: this.name })}</p>
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
customElements.define('d2l-greeting', Greeting);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { generateLink, LocalizeMixin } from '../localize-mixin.js';
|
|
2
|
-
import { LitElement } from 'lit';
|
|
3
|
-
|
|
4
|
-
class Mission extends LocalizeMixin(LitElement) {
|
|
5
|
-
|
|
6
|
-
static get localizeConfig() {
|
|
7
|
-
const langResources = {
|
|
8
|
-
'en': { mission: '<b>Transforming</b> the way <linkEarth>the world</linkEarth> learns' },
|
|
9
|
-
'fr': { mission: '<b>Transformer</b> la façon dont <linkEarth>le monde</linkEarth> apprend' }
|
|
10
|
-
};
|
|
11
|
-
return {
|
|
12
|
-
importFunc: async lang => langResources[lang]
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
render() {
|
|
17
|
-
const replacements = {
|
|
18
|
-
linkEarth: generateLink({ href: 'https://wikipedia.org/wiki/Earth', target: '_blank' }),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return this.localizeHTML('mission', replacements);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
customElements.define('d2l-mission', Mission);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
7
|
-
<script type="module">
|
|
8
|
-
import '../../../components/demo/demo-page.js';
|
|
9
|
-
import './localize-mixin-greeting.js';
|
|
10
|
-
import './localize-mixin-mission.js';
|
|
11
|
-
</script>
|
|
12
|
-
</head>
|
|
13
|
-
<body unresolved>
|
|
14
|
-
<d2l-demo-page page-title="localize-mixin">
|
|
15
|
-
|
|
16
|
-
<h2>localize()</h2>
|
|
17
|
-
<d2l-demo-snippet>
|
|
18
|
-
<d2l-greeting name="Bill"></d2l-greeting>
|
|
19
|
-
</d2l-demo-snippet>
|
|
20
|
-
|
|
21
|
-
<h2>localizeHTML()</h2>
|
|
22
|
-
<d2l-demo-snippet>
|
|
23
|
-
<d2l-mission></d2l-mission>
|
|
24
|
-
</d2l-demo-snippet>
|
|
25
|
-
|
|
26
|
-
</d2l-demo-page>
|
|
27
|
-
</body>
|
|
28
|
-
</html>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<link rel="stylesheet" href="../../../components/demo/styles.css" type="text/css">
|
|
7
|
-
<script type="module">
|
|
8
|
-
import '../../../components/button/button.js';
|
|
9
|
-
import '../../../components/demo/demo-page.js';
|
|
10
|
-
import '../../../components/inputs/input-group.js';
|
|
11
|
-
import '../../../components/inputs/input-radio-group.js';
|
|
12
|
-
import '../../../components/inputs/input-radio.js';
|
|
13
|
-
import '../../../components/inputs/input-text.js';
|
|
14
|
-
import '../../../components/inputs/input-textarea.js';
|
|
15
|
-
import '../primary-secondary.js';
|
|
16
|
-
</script>
|
|
17
|
-
<style>
|
|
18
|
-
div[slot="primary"] {
|
|
19
|
-
padding: 0 20px;
|
|
20
|
-
}
|
|
21
|
-
div[slot="secondary"] {
|
|
22
|
-
padding: 10px;
|
|
23
|
-
}
|
|
24
|
-
</style>
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<d2l-template-primary-secondary has-form background-shading="secondary" width-type="normal">
|
|
28
|
-
<div slot="primary">
|
|
29
|
-
<h1>Title</h1>
|
|
30
|
-
<d2l-input-group>
|
|
31
|
-
<d2l-input-text name="name" label="Name" required></d2l-input-text>
|
|
32
|
-
<d2l-input-textarea name="description" label="Description"></d2l-input-textarea>
|
|
33
|
-
</d2l-input-group>
|
|
34
|
-
</div>
|
|
35
|
-
<div slot="secondary">
|
|
36
|
-
<d2l-input-radio-group name="band" label="Band" required>
|
|
37
|
-
<d2l-input-radio label="FM" value="fm"></d2l-input-radio>
|
|
38
|
-
<d2l-input-radio label="AM" value="am"></d2l-input-radio>
|
|
39
|
-
</d2l-input-radio-group>
|
|
40
|
-
</div>
|
|
41
|
-
<div slot="footer">
|
|
42
|
-
<d2l-button primary>Save</d2l-button>
|
|
43
|
-
</div>
|
|
44
|
-
</d2l-template-primary-secondary>
|
|
45
|
-
<script>
|
|
46
|
-
const form = document.querySelector('d2l-template-primary-secondary');
|
|
47
|
-
document
|
|
48
|
-
.querySelector('d2l-button')
|
|
49
|
-
.addEventListener('click', () => form.submitForm());
|
|
50
|
-
form.addEventListener('d2l-template-primary-secondary-form-submit', (e) => {
|
|
51
|
-
console.log('Form submitted!', e.detail.formData);
|
|
52
|
-
});
|
|
53
|
-
</script>
|
|
54
|
-
</body>
|
|
55
|
-
</html>
|