kempo-ui 0.0.6 → 0.0.8
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/dist/src/components/Icon.js +1 -1
- package/dist/src/components/ShadowComponent.js +1 -1
- package/dist/src/components/Tree.js +37 -0
- package/docs/components/accordion.html +3 -9
- package/docs/components/card.html +3 -9
- package/docs/components/collapsible.html +3 -9
- package/docs/components/content-slider.html +3 -9
- package/docs/components/dialog.html +4 -151
- package/docs/components/focus-capture.html +3 -7
- package/docs/components/hybrid-component.html +3 -7
- package/docs/components/icon.html +1 -6
- package/docs/components/import.html +1 -6
- package/docs/components/init.js +7 -0
- package/docs/components/light-component.html +3 -7
- package/docs/components/persistant-collapsible.html +1 -8
- package/docs/components/photo-viewer.html +1 -8
- package/docs/components/resize.html +3 -9
- package/docs/components/shadow-component.html +3 -7
- package/docs/components/show-more.html +3 -9
- package/docs/components/side-menu.html +1 -6
- package/docs/components/sortable.html +3 -7
- package/docs/components/split.html +3 -7
- package/docs/components/table.html +3 -7
- package/docs/components/tableControls.html +3 -7
- package/docs/components/tableCustomFields.html +3 -7
- package/docs/components/tableFetchRecords.html +3 -7
- package/docs/components/tableFieldSortHide.html +3 -7
- package/docs/components/tablePagination.html +3 -7
- package/docs/components/tableRecordEditing.html +3 -7
- package/docs/components/tableRecordFiltering.html +3 -7
- package/docs/components/tableRecordHiding.html +3 -7
- package/docs/components/tableRecordSearching.html +3 -7
- package/docs/components/tableRecordSelection.html +3 -7
- package/docs/components/tableRowControls.html +3 -7
- package/docs/components/tableSorting.html +3 -7
- package/docs/components/tabs.html +3 -9
- package/docs/components/tags.html +3 -9
- package/docs/components/theme-switcher.html +3 -9
- package/docs/components/timestamp.html +3 -9
- package/docs/components/toast.html +4 -272
- package/docs/components/toggle.html +3 -9
- package/docs/components/tree.html +176 -0
- package/docs/index.html +10 -6
- package/docs/init.js +7 -0
- package/docs/nav.inc.html +1 -0
- package/docs/src/components/Icon.js +1 -1
- package/docs/src/components/ShadowComponent.js +1 -1
- package/docs/src/components/Tree.js +37 -0
- package/docs/utils/debounce.html +1 -6
- package/docs/utils/drag.html +1 -6
- package/docs/utils/formatTimestamp.html +1 -6
- package/docs/utils/init.js +7 -0
- package/docs/utils/propConverters.html +1 -6
- package/docs/utils/toTitleCase.html +1 -6
- package/docs/utils/watchWindowSize.html +1 -6
- package/package.json +1 -1
- package/scripts/build.js +12 -2
- package/scripts/fix-docs-paths.js +62 -0
- package/src/components/Tree.js +239 -0
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Custom Fields - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Table - Fetch Records - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Field Sort and Hide - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Pagination - Table - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Record Editing - Table - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Record Filtering - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Row Controls - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Record Searching - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Record Selection - Table - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Row Controls - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
<title>Sorting - Table - Kempo Docs</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" />
|
|
8
8
|
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
10
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="../src/components/Table.js"></script>
|
|
11
|
-
<script type="module">
|
|
12
|
-
import Import from '../src/components/Import.js';
|
|
13
|
-
import Icon from '../src/components/Icon.js';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
12
|
+
<script type="module" src="./init.js"></script>
|
|
17
13
|
<script>
|
|
18
14
|
window.contacts = [];
|
|
19
15
|
function generateContact(){
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Tabs - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
import Import from '../src/components/Import.js';
|
|
12
|
-
import Icon from '../src/components/Icon.js';
|
|
13
|
-
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module" src="./init.js"></script>
|
|
17
11
|
</head>
|
|
18
12
|
<body>
|
|
19
13
|
<k-import src="../nav.inc.html"></k-import>
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Tags - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
import Import from '../src/components/Import.js';
|
|
12
|
-
import Icon from '../src/components/Icon.js';
|
|
13
|
-
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module" src="./init.js"></script>
|
|
17
11
|
</head>
|
|
18
12
|
<body>
|
|
19
13
|
<k-import src="../nav.inc.html"></k-import>
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>ThemeSwitcher - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
import Import from '../src/components/Import.js';
|
|
12
|
-
import Icon from '../src/components/Icon.js';
|
|
13
|
-
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module" src="./init.js"></script>
|
|
17
11
|
</head>
|
|
18
12
|
<body>
|
|
19
13
|
<k-import src="../nav.inc.html"></k-import>
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Timestamp - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
import Import from '../src/components/Import.js';
|
|
12
|
-
import Icon from '../src/components/Icon.js';
|
|
13
|
-
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
14
|
-
Import.replacements.root = '../';
|
|
15
|
-
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
</script>
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module" src="./init.js"></script>
|
|
17
11
|
</head>
|
|
18
12
|
<body>
|
|
19
13
|
<k-import src="../nav.inc.html"></k-import>
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Toast - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
-
<link rel="stylesheet" href="../src/kempo-hljs.css"
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
import Icon from '../src/components/Icon.js';
|
|
12
|
-
import ShadowComponent from '../src/components/ShadowComponent.js';
|
|
13
|
-
Import.replacements.root = '../';
|
|
14
|
-
Icon.pathToIcons = ['../icons'];
|
|
15
|
-
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
16
|
-
</script>
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module" src="./init.js"></script>
|
|
17
11
|
</head>
|
|
18
12
|
<body>
|
|
19
13
|
<k-import src="../nav.inc.html"></k-import>
|
|
@@ -51,269 +45,7 @@
|
|
|
51
45
|
</div>
|
|
52
46
|
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
53
47
|
<button id="example1" class="mb">Open Toast</button>
|
|
54
|
-
<script type="module">
|
|
55
|
-
import Toast from '/src/components/Toast.js';
|
|
56
|
-
document.getElementById('example1').addEventListener('click', () => {
|
|
57
|
-
Toast.create("Hello World");
|
|
58
|
-
});
|
|
59
|
-
</script>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<h3 id="positions"><a href="#positions" class="no-link">Different Positions</a></h3>
|
|
65
|
-
<p>Toasts can be positioned in different corners of the screen using the <code>position</code> property.</p>
|
|
66
|
-
<div class="row -mx">
|
|
67
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
68
|
-
|
|
69
|
-
</div>
|
|
70
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
71
|
-
<button id="example2-topleft" class="mb">Top Left</button>
|
|
72
|
-
<button id="example2-topcenter" class="mb">Top Center</button>
|
|
73
|
-
<button id="example2-topright" class="mb">Top Right</button><br />
|
|
74
|
-
<button id="example2-bottomleft" class="mb">Bottom Left</button>
|
|
75
|
-
<button id="example2-bottomcenter" class="mb">Bottom Center</button>
|
|
76
|
-
<button id="example2-bottomright" class="mb">Bottom Right</button>
|
|
77
|
-
<script type="module">
|
|
78
|
-
import Toast from '/src/components/Toast.js';
|
|
79
|
-
document.getElementById('example2-topleft').addEventListener('click', () => {
|
|
80
|
-
Toast.create("Hello Top Left", {
|
|
81
|
-
position: "top left"
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
document.getElementById('example2-topcenter').addEventListener('click', () => {
|
|
85
|
-
Toast.create("Hello Top Center", {
|
|
86
|
-
position: "top center"
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
document.getElementById('example2-topright').addEventListener('click', () => {
|
|
90
|
-
Toast.create("Hello Top Right", {
|
|
91
|
-
position: "top right"
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
document.getElementById('example2-bottomleft').addEventListener('click', () => {
|
|
95
|
-
Toast.create("Hello Bottom Left", {
|
|
96
|
-
position: "bottom left"
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
document.getElementById('example2-bottomcenter').addEventListener('click', () => {
|
|
100
|
-
Toast.create("Hello Bottom Center", {
|
|
101
|
-
position: "bottom center"
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
document.getElementById('example2-bottomright').addEventListener('click', () => {
|
|
105
|
-
Toast.create("Hello Bottom Right", {
|
|
106
|
-
position: "bottom right"
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
</script>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<h3 id="timeouts"><a href="#timeouts" class="no-link">Timeouts</a></h3>
|
|
114
|
-
<p>Toasts can automatically close after a specified timeout (in milliseconds). The default timeout when using <code>Toast.create</code> is <code>5000</code> (ms), or 5 seconds.</p>
|
|
115
|
-
<div class="row -mx">
|
|
116
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
117
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-1"</span>></span>Open 1 Second Timeout Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-3"</span>></span>Open 3 Second Timeout Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-10"</span>></span>Open 10 Second Timeout Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>></span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"I will timeout in 1 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">1000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-3'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"I will timeout in 3 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">3000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-10'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"I will timeout in 10 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">10000</span><br /> });<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
118
|
-
</div>
|
|
119
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
120
|
-
<button id="example3-1" class="mb">Open 1 Second Timeout Toast</button>
|
|
121
|
-
<button id="example3-3" class="mb">Open 3 Second Timeout Toast</button>
|
|
122
|
-
<button id="example3-10" class="mb">Open 10 Second Timeout Toast</button>
|
|
123
|
-
<script type="module">
|
|
124
|
-
import Toast from '/src/components/Toast.js';
|
|
125
|
-
document.getElementById('example3-1').addEventListener('click', () => {
|
|
126
|
-
Toast.create("I will timeout in 1 second", {
|
|
127
|
-
timeout: 1000
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
document.getElementById('example3-3').addEventListener('click', () => {
|
|
131
|
-
Toast.create("I will timeout in 3 second", {
|
|
132
|
-
timeout: 3000
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
document.getElementById('example3-10').addEventListener('click', () => {
|
|
136
|
-
Toast.create("I will timeout in 10 second", {
|
|
137
|
-
timeout: 10000
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
</script>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<h3 id="actionAndClose"><a href="#actionAndClose" class="no-link">Action and Close Buttons</a></h3>
|
|
146
|
-
<p>Toasts can have action and close buttons that trigger callbacks when clicked.</p>
|
|
147
|
-
<div class="row -mx">
|
|
148
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
149
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action"</span>></span>Open Toast with Action<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-close"</span>></span>Open Toast with Close Button<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action-close"</span>></span>Open Toast with Action and Close Button<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>></span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =></span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'<k-icon name="close"></div>'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =></span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =></span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; <span class="hljs-comment">// return false to prevent closing</span><br /> },<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'<k-icon name="close"></div>'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =></span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
150
|
-
</div>
|
|
151
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
152
|
-
<button id="example4-action" class="mb">Open Toast with Action</button>
|
|
153
|
-
<button id="example4-close" class="mb">Open Toast with Close Button</button>
|
|
154
|
-
<button id="example4-action-close" class="mb">Open Toast with Action and Close Button</button>
|
|
155
|
-
<script type="module">
|
|
156
|
-
import Toast from '/src/components/Toast.js';
|
|
157
|
-
document.getElementById('example4-action').addEventListener('click', () => {
|
|
158
|
-
Toast.create("Hello World", {
|
|
159
|
-
timeout: 0,
|
|
160
|
-
action: 'Click Me',
|
|
161
|
-
actionCallback: () => {
|
|
162
|
-
Toast.create("You clicked the action");
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
document.getElementById('example4-close').addEventListener('click', () => {
|
|
167
|
-
Toast.create("Hello World", {
|
|
168
|
-
timeout: 0,
|
|
169
|
-
close: '<k-icon name="close"></div>',
|
|
170
|
-
closeCallback: () => {
|
|
171
|
-
Toast.create("You closed the toast");
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
document.getElementById('example4-action-close').addEventListener('click', () => {
|
|
176
|
-
Toast.create("Hello World", {
|
|
177
|
-
timeout: 0,
|
|
178
|
-
action: 'Click Me',
|
|
179
|
-
actionCallback: () => {
|
|
180
|
-
Toast.create("You clicked the action");
|
|
181
|
-
return false; // return false to prevent closing
|
|
182
|
-
},
|
|
183
|
-
close: '<k-icon name="close"></div>',
|
|
184
|
-
closeCallback: () => {
|
|
185
|
-
Toast.create("You closed the toast");
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
</script>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<h3 id="successWarningError"><a href="#successWarningError" class="no-link">Success, Warning and Error</a></h3>
|
|
194
|
-
<p>Toasts can be created as a success, warning or error message.</p>
|
|
195
|
-
<div class="row -mx">
|
|
196
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
197
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-success"</span>></span>Success Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-warning"</span>></span>Warning Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-error"</span>></span>Error Toast<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>></span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-success'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.success(<span class="hljs-string">"It Worked!"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-warning'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.warning(<span class="hljs-string">"Be Careful"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-error'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.error(<span class="hljs-string">"That's a very bad idea"</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
198
|
-
</div>
|
|
199
|
-
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
200
|
-
<button id="example5-success" class="mb">Success Toast</button>
|
|
201
|
-
<button id="example5-warning" class="mb">Warning Toast</button>
|
|
202
|
-
<button id="example5-error" class="mb">Error Toast</button>
|
|
203
|
-
<script type="module">
|
|
204
|
-
import Toast from '/src/components/Toast.js';
|
|
205
|
-
document.getElementById('example5-success').addEventListener('click', () => {
|
|
206
|
-
Toast.success("It Worked!");
|
|
207
|
-
});
|
|
208
|
-
document.getElementById('example5-warning').addEventListener('click', () => {
|
|
209
|
-
Toast.warning("Be Careful");
|
|
210
|
-
});
|
|
211
|
-
document.getElementById('example5-error').addEventListener('click', () => {
|
|
212
|
-
Toast.error("That's a very bad idea");
|
|
213
|
-
});
|
|
214
|
-
</script>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<h2 id="jsRef">JavaScript Reference</h2>
|
|
220
|
-
|
|
221
|
-
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
222
|
-
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
223
|
-
<h5>
|
|
224
|
-
<code>new Toast()</code><br />
|
|
225
|
-
<code>new Toast(<i>object</i> options)</code>
|
|
226
|
-
</h5>
|
|
227
|
-
|
|
228
|
-
<h4>Parameters</h4>
|
|
229
|
-
<h5><code>options<i>: object</i></code></h5>
|
|
230
|
-
<p>An object with the following optional properties:</p>
|
|
231
|
-
<ul>
|
|
232
|
-
<li><code>actionCallback<i>: function</i></code> - Function to call when the action button is clicked. If this function returns <code>false</code>, the toast will not close.</li>
|
|
233
|
-
<li><code>actionHtml<i>: string</i></code> - HTML content for the action button.</li>
|
|
234
|
-
<li><code>closeCallback<i>: function</i></code> - Function to call when the toast is closed.</li>
|
|
235
|
-
<li><code>closeHtml<i>: string</i></code> - HTML content for the close button.</li>
|
|
236
|
-
<li><code>timeout<i>: number</i></code> - Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close).</li>
|
|
237
|
-
</ul>
|
|
238
|
-
|
|
239
|
-
<h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
|
|
240
|
-
<h5><code>Toast.create(message, options)<i>: Toast</i></code></h5>
|
|
241
|
-
<p>Creates and displays a new toast with the specified message and options. Returns the created Toast instance.</p>
|
|
242
|
-
<p>Options include:</p>
|
|
243
|
-
<ul>
|
|
244
|
-
<li><code>position<i>: string</i></code> - Position of the toast on the screen. Default is 'auto', which uses 'bottom center' on mobile and 'top right' on desktop. Valid positions are: 'top left', 'top center', 'top right', 'bottom left', 'bottom center', 'bottom right'.</li>
|
|
245
|
-
<li><code>removeOnClose<i>: boolean</i></code> - If true, the toast element will be removed from the DOM when closed. Default is true.</li>
|
|
246
|
-
<li><code>timeout<i>: number</i></code> - Time in milliseconds before the toast automatically closes. Default is 5000ms (5 seconds).</li>
|
|
247
|
-
<li><code>action<i>: string | HTMLElement</i></code> - Text or HTML element to use for the action button.</li>
|
|
248
|
-
<li><code>actionCallback<i>: function</i></code> - Function to call when the action button is clicked. If this function returns <code>false</code>, the toast will not close.</li>
|
|
249
|
-
<li><code>close<i>: string | HTMLElement</i></code> - Text or HTML element to use for the close button.</li>
|
|
250
|
-
<li><code>closeCallback<i>: function</i></code> - Function to call when the toast is closed.</li>
|
|
251
|
-
<li><code>icon<i>: string | HTMLElement</i></code> - Text or HTML element to use as an icon in the toast.</li>
|
|
252
|
-
</ul>
|
|
253
|
-
|
|
254
|
-
<h5><code>Toast.success(message, options)<i>: Toast</i></code></h5>
|
|
255
|
-
<p>Creates and displays a success toast with a check icon and applies a success background style. Accepts the same options as <code>Toast.create()</code>.</p>
|
|
256
|
-
|
|
257
|
-
<h5><code>Toast.warning(message, options)<i>: Toast</i></code></h5>
|
|
258
|
-
<p>Creates and displays a warning toast with a warning icon and applies a warning background style. Accepts the same options as <code>Toast.create()</code>.</p>
|
|
259
|
-
|
|
260
|
-
<h5><code>Toast.error(message, options)<i>: Toast</i></code></h5>
|
|
261
|
-
<p>Creates and displays an error toast with an error icon and applies a danger background style. Accepts the same options as <code>Toast.create()</code>.</p>
|
|
262
|
-
|
|
263
|
-
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
264
|
-
<ul>
|
|
265
|
-
<li>ShadowComponent (configure <code>ShadowComponent.stylesheetPath</code> as needed for your server)</li>
|
|
266
|
-
<li><a href="./icon.html">Icon</a></li>
|
|
267
|
-
</ul>
|
|
268
|
-
|
|
269
|
-
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
270
|
-
<h5><code>actionHtml<i>: string</i></code></h5>
|
|
271
|
-
<p>HTML content for the action button. Syncs to <code>action-html</code> attribute.</p>
|
|
272
|
-
|
|
273
|
-
<h5><code>closeHtml<i>: string</i></code></h5>
|
|
274
|
-
<p>HTML content for the close button. Syncs to <code>close-html</code> attribute.</p>
|
|
275
|
-
|
|
276
|
-
<h5><code>timeout<i>: number</i></code></h5>
|
|
277
|
-
<p>Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close). Syncs to <code>timeout</code> attribute.</p>
|
|
278
|
-
|
|
279
|
-
<h5><code>opened<i>: boolean</i></code></h5>
|
|
280
|
-
<p>Whether the toast is currently open. Default is false. Syncs to <code>opened</code> attribute.</p>
|
|
281
|
-
|
|
282
|
-
<h5><code>actionCallback<i>: function</i></code></h5>
|
|
283
|
-
<p>Function to call when the action button is clicked.</p>
|
|
284
|
-
|
|
285
|
-
<h5><code>closeCallback<i>: function</i></code></h5>
|
|
286
|
-
<p>Function to call when the toast is closed.</p>
|
|
287
|
-
|
|
288
|
-
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
289
|
-
<h5><code>open()<i>: void</i></code></h5>
|
|
290
|
-
<p>Opens the toast. If a timeout is specified, this starts the timer for automatic closing.</p>
|
|
291
|
-
|
|
292
|
-
<h5><code>close()<i>: void</i></code></h5>
|
|
293
|
-
<p>Closes the toast and calls the <code>closeCallback</code> if provided.</p>
|
|
294
|
-
|
|
295
|
-
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
296
|
-
<h5><code>open</code></h5>
|
|
297
|
-
<p>Fired when the toast is opened.</p>
|
|
298
|
-
|
|
299
|
-
<h5><code>close</code></h5>
|
|
300
|
-
<p>Fired when the toast is closed.</p>
|
|
301
|
-
|
|
302
|
-
<h5><code>openchange</code></h5>
|
|
303
|
-
<p>Fired when the toast open state changes (both when opening and closing).</p>
|
|
304
|
-
|
|
305
|
-
<h3 id="toastContainer"><a href="#toastContainer" class="no-link">ToastContainer</a></h3>
|
|
306
|
-
<p>The <code>ToastContainer</code> is an internal component used to position and display toasts. It is automatically created when <code>Toast.create()</code> is called, but can also be used directly.</p>
|
|
307
|
-
|
|
308
|
-
<h5><code>new ToastContainer(position)</code></h5>
|
|
309
|
-
<p>Creates a new toast container at the specified position.</p>
|
|
310
|
-
|
|
311
|
-
<h5><code>position<i>: string</i></code></h5>
|
|
312
|
-
<p>The position of the container on the screen. Valid values are: 'top left', 'top center', 'top right', 'bottom left', 'bottom center', 'bottom right'.</p>
|
|
313
|
-
|
|
314
|
-
</main>
|
|
315
|
-
<div style="height:33vh"></div>
|
|
316
|
-
<script type="module" src="../src/components/Import.js"></script>
|
|
48
|
+
<script type="module" src="./init.js"></script>
|
|
317
49
|
<script type="module" src="../src/components/Toast.js"></script>
|
|
318
50
|
</body>
|
|
319
51
|
</html>
|