kempo-ui 0.0.8 → 0.0.10
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/Card.js +3 -3
- package/dist/src/components/Dialog.js +11 -11
- package/dist/src/components/Icon.js +1 -1
- package/dist/src/components/Toggle.js +15 -14
- package/dist/src/components/Tree.js +11 -3
- package/docs/components/accordion.html +2 -3
- package/docs/components/card.html +2 -3
- package/docs/components/collapsible.html +2 -3
- package/docs/components/content-slider.html +3 -3
- package/docs/components/dialog.html +237 -5
- package/docs/components/focus-capture.html +2 -3
- package/docs/components/hybrid-component.html +2 -3
- package/docs/components/icon.html +6 -7
- package/docs/components/import.html +2 -3
- package/docs/components/light-component.html +2 -3
- package/docs/components/persistant-collapsible.html +19 -37
- package/docs/components/photo-viewer.html +129 -84
- package/docs/components/resize.html +2 -3
- package/docs/components/shadow-component.html +2 -3
- package/docs/components/show-more.html +2 -4
- package/docs/components/side-menu.html +2 -3
- package/docs/components/sortable.html +3 -3
- package/docs/components/split.html +2 -3
- package/docs/components/table.html +2 -3
- package/docs/components/tableControls.html +2 -3
- package/docs/components/tableCustomFields.html +2 -3
- package/docs/components/tableFetchRecords.html +2 -3
- package/docs/components/tableFieldSortHide.html +2 -3
- package/docs/components/tablePagination.html +2 -3
- package/docs/components/tableRecordEditing.html +2 -3
- package/docs/components/tableRecordFiltering.html +2 -3
- package/docs/components/tableRecordHiding.html +2 -3
- package/docs/components/tableRecordSearching.html +2 -3
- package/docs/components/tableRecordSelection.html +2 -3
- package/docs/components/tableRowControls.html +2 -3
- package/docs/components/tableSorting.html +2 -3
- package/docs/components/tabs.html +89 -70
- package/docs/components/tags.html +45 -16
- package/docs/components/theme-switcher.html +3 -4
- package/docs/components/timestamp.html +40 -10
- package/docs/components/toast.html +311 -4
- package/docs/components/toggle.html +3 -5
- package/docs/components/tree.html +76 -64
- package/docs/src/components/Card.js +3 -3
- package/docs/src/components/Dialog.js +11 -11
- package/docs/src/components/Icon.js +1 -1
- package/docs/src/components/Toggle.js +15 -14
- package/docs/src/components/Tree.js +11 -3
- package/docs/utils/debounce.html +5 -24
- package/docs/utils/drag.html +3 -13
- package/docs/utils/formatTimestamp.html +7 -25
- package/docs/utils/propConverters.html +7 -46
- package/docs/utils/toTitleCase.html +2 -2
- package/docs/utils/watchWindowSize.html +7 -98
- package/package.json +1 -1
- package/src/components/Card.js +3 -3
- package/src/components/Dialog.js +48 -34
- package/src/components/Icon.js +25 -18
- package/src/components/Toggle.js +69 -69
- package/src/components/Tree.js +10 -2
- package/scripts/fix-docs-paths.js +0 -62
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
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
|
-
<link rel="stylesheet" href="../
|
|
8
|
-
<link rel="stylesheet" href="../
|
|
7
|
+
<link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
9
9
|
<link rel="stylesheet" href="../styles.css" />
|
|
10
10
|
<script type="module" src="./init.js"></script>
|
|
11
11
|
</head>
|
|
@@ -35,24 +35,54 @@
|
|
|
35
35
|
|
|
36
36
|
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
37
37
|
<p>Use the <code>Tags</code> component to allow users to add and remove tags. Tags can be added by typing them into the input field and pressing Enter or by pasting a comma-separated list of tags. You can delete a tag by clicking on it.</p>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
<div class="row -mx mb">
|
|
39
|
+
<div class="col d-span-6 m-span-12 px">
|
|
40
|
+
<k-card label="HTML">
|
|
41
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-tags</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">label</span>></span>Tags<span class="hljs-tag"></<span class="hljs-name">label</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-tags</span>></span></code></pre>
|
|
42
|
+
</k-card>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="col d-span-6 m-span-12 px">
|
|
45
|
+
<k-card label="Output">
|
|
46
|
+
<k-tags>
|
|
47
|
+
<label>Tags</label>
|
|
48
|
+
</k-tags>
|
|
49
|
+
</k-card>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
42
52
|
|
|
43
53
|
<h3 id="allowedTags"><a href="#allowedTags" class="no-link">Allowed Tags</a></h3>
|
|
44
54
|
<p>Use the <code>allowedTags</code> attribute to specify a comma-separated list of allowed tags. Only these tags can be added.</p>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
<div class="row -mx mb">
|
|
56
|
+
<div class="col d-span-6 m-span-12 px">
|
|
57
|
+
<k-card label="HTML">
|
|
58
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-tags</span> <span class="hljs-attr">allowed-tags</span>=<span class="hljs-string">"tag1,tag2,tag3"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">label</span>></span>Allowed Tags<span class="hljs-tag"></<span class="hljs-name">label</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-tags</span>></span></code></pre>
|
|
59
|
+
</k-card>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="col d-span-6 m-span-12 px">
|
|
62
|
+
<k-card label="Output">
|
|
63
|
+
<k-tags allowed-tags="tag1,tag2,tag3">
|
|
64
|
+
<label>Allowed Tags</label>
|
|
65
|
+
</k-tags>
|
|
66
|
+
</k-card>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
49
69
|
|
|
50
70
|
<h3 id="disallowedTags"><a href="#disallowedTags" class="no-link">Disallowed Tags</a></h3>
|
|
51
71
|
<p>Use the <code>disallowedTags</code> attribute to specify a comma-separated list of disallowed tags. These tags cannot be added.</p>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
<div class="row -mx mb">
|
|
73
|
+
<div class="col d-span-6 m-span-12 px">
|
|
74
|
+
<k-card label="HTML">
|
|
75
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-tags</span> <span class="hljs-attr">disallowed-tags</span>=<span class="hljs-string">"tag1,tag2,tag3"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">label</span>></span>Disallowed Tags<span class="hljs-tag"></<span class="hljs-name">label</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-tags</span>></span></code></pre>
|
|
76
|
+
</k-card>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="col d-span-6 m-span-12 px">
|
|
79
|
+
<k-card label="Output">
|
|
80
|
+
<k-tags disallowed-tags="tag1,tag2,tag3">
|
|
81
|
+
<label>Disallowed Tags</label>
|
|
82
|
+
</k-tags>
|
|
83
|
+
</k-card>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
56
86
|
|
|
57
87
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
58
88
|
|
|
@@ -96,9 +126,8 @@
|
|
|
96
126
|
<p>Fired when the allowed tags list changes. Detail contains <code>{ oldValue, newValue }</code>.</p>
|
|
97
127
|
<h5><code>disallowedtagschange</code></h5>
|
|
98
128
|
<p>Fired when the disallowed tags list changes. Detail contains <code>{ oldValue, newValue }</code>.</p>
|
|
99
|
-
|
|
100
129
|
</main>
|
|
101
|
-
<
|
|
130
|
+
<div style="height:33vh"></div>
|
|
102
131
|
<script type="module" src="../src/components/Tags.js"></script>
|
|
103
132
|
</body>
|
|
104
133
|
</html>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
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
|
-
<link rel="stylesheet" href="../
|
|
8
|
-
<link rel="stylesheet" href="../
|
|
7
|
+
<link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
9
9
|
<link rel="stylesheet" href="../styles.css" />
|
|
10
10
|
<script type="module" src="./init.js"></script>
|
|
11
11
|
</head>
|
|
@@ -112,9 +112,8 @@
|
|
|
112
112
|
<h3 id="themeDetection"><a href="#themeDetection" class="no-link">Automatic Theme Detection</a></h3>
|
|
113
113
|
<p>When the theme is set to <code>"auto"</code>, the component automatically detects the user's system preference using <code>prefers-color-scheme</code> media query. The detected theme is applied to the document element as an <code>auto-theme</code> attribute.</p>
|
|
114
114
|
<p>The component also synchronizes theme changes across browser tabs using the storage event, ensuring a consistent user experience.</p>
|
|
115
|
-
|
|
116
115
|
</main>
|
|
117
|
-
<
|
|
116
|
+
<div style="height:33vh"></div>
|
|
118
117
|
<script type="module" src="../src/components/ThemeSwitcher.js"></script>
|
|
119
118
|
</body>
|
|
120
119
|
</html>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
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
|
-
<link rel="stylesheet" href="../
|
|
8
|
-
<link rel="stylesheet" href="../
|
|
7
|
+
<link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
9
9
|
<link rel="stylesheet" href="../styles.css" />
|
|
10
10
|
<script type="module" src="./init.js"></script>
|
|
11
11
|
</head>
|
|
@@ -33,18 +33,50 @@
|
|
|
33
33
|
|
|
34
34
|
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
35
35
|
<p>Use the <code>Timestamp</code> component to display a formatted timestamp. The component will automatically format the timestamp using the default format or a custom format with tokens.</p>
|
|
36
|
-
<
|
|
37
|
-
|
|
36
|
+
<div class="row -mx mb">
|
|
37
|
+
<div class="col d-span-6 m-span-12 px">
|
|
38
|
+
<k-card label="HTML">
|
|
39
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-timestamp</span>></span></code></pre>
|
|
40
|
+
</k-card>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="col d-span-6 m-span-12 px">
|
|
43
|
+
<k-card label="Output">
|
|
44
|
+
<k-timestamp timestamp="1633024800000"></k-timestamp>
|
|
45
|
+
</k-card>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
38
48
|
|
|
39
49
|
<h3 id="customFormat"><a href="#customFormat" class="no-link">Custom Format</a></h3>
|
|
40
50
|
<p>Use the <code>format</code> attribute to specify a custom format using tokens like <code>YYYY</code> (4-digit year), <code>MM</code> (2-digit month), <code>DD</code> (2-digit day), <code>hh</code> (2-digit hour), <code>mm</code> (2-digit minute), and <code>ss</code> (2-digit second).</p>
|
|
41
|
-
<
|
|
42
|
-
|
|
51
|
+
<div class="row -mx mb">
|
|
52
|
+
<div class="col d-span-6 m-span-12 px">
|
|
53
|
+
<k-card label="HTML">
|
|
54
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"MM/DD/YYYY"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-timestamp</span>></span></code></pre>
|
|
55
|
+
</k-card>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="col d-span-6 m-span-12 px">
|
|
58
|
+
<k-card label="Output">
|
|
59
|
+
<k-timestamp timestamp="1633024800000" format="MM/DD/YYYY"></k-timestamp>
|
|
60
|
+
</k-card>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
43
63
|
|
|
44
64
|
<h3 id="timeFormat"><a href="#timeFormat" class="no-link">Time Format</a></h3>
|
|
45
65
|
<p>Display time with custom formatting using hour, minute, and second tokens.</p>
|
|
46
|
-
<
|
|
47
|
-
|
|
66
|
+
<div class="row -mx mb">
|
|
67
|
+
<div class="col d-span-6 m-span-12 px">
|
|
68
|
+
<k-card label="HTML">
|
|
69
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"hh:mm:ss"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-timestamp</span>></span></code></pre>
|
|
70
|
+
</k-card>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="col d-span-6 m-span-12 px">
|
|
73
|
+
<k-card label="Output">
|
|
74
|
+
<k-timestamp timestamp="1633024800000" format="hh:mm:ss"></k-timestamp>
|
|
75
|
+
</k-card>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
|
|
48
80
|
|
|
49
81
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
50
82
|
|
|
@@ -67,10 +99,8 @@
|
|
|
67
99
|
|
|
68
100
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
69
101
|
<p>The <code>Timestamp</code> class does not introduce any new methods beyond those provided by the ShadowComponent class.</p>
|
|
70
|
-
|
|
71
102
|
</main>
|
|
72
103
|
<div style="height:33vh"></div>
|
|
73
|
-
<script type="module" src="../src/components/Import.js"></script>
|
|
74
104
|
<script type="module" src="../src/components/Timestamp.js"></script>
|
|
75
105
|
</body>
|
|
76
106
|
</html>
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
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
|
-
<link rel="stylesheet" href="../
|
|
8
|
-
<link rel="stylesheet" href="../
|
|
7
|
+
<link rel="stylesheet" href="../kempo-vars.css" />
|
|
8
|
+
<link rel="stylesheet" href="../kempo.min.css" />
|
|
9
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
9
10
|
<link rel="stylesheet" href="../styles.css" />
|
|
10
11
|
<script type="module" src="./init.js"></script>
|
|
11
12
|
</head>
|
|
@@ -23,11 +24,13 @@
|
|
|
23
24
|
<a href="#positions">Different Positions</a><br />
|
|
24
25
|
<a href="#timeouts">Timeouts</a><br />
|
|
25
26
|
<a href="#actionAndClose">Action and Close Buttons</a><br />
|
|
27
|
+
<a href="#successWarningError">Success, Warning and Error</a><br />
|
|
26
28
|
|
|
27
29
|
<h6 class="mt">JavaScript Reference</h6>
|
|
28
30
|
<a href="#constructor">Constructor</a><br />
|
|
29
31
|
<a href="#staticMethods">Static Methods</a><br />
|
|
30
32
|
<a href="#requirements">Requirements</a><br />
|
|
33
|
+
<a href="#attributes">Attributes</a><br />
|
|
31
34
|
<a href="#properties">Properties</a><br />
|
|
32
35
|
<a href="#methods">Methods</a><br />
|
|
33
36
|
<a href="#events">Events</a><br />
|
|
@@ -41,11 +44,315 @@
|
|
|
41
44
|
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
42
45
|
<div class="row -mx">
|
|
43
46
|
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
44
|
-
<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">"example1"</span>></span>Open 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">'
|
|
47
|
+
<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">"example1"</span>></span>Open 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">'example1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
45
48
|
</div>
|
|
46
49
|
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
47
50
|
<button id="example1" class="mb">Open Toast</button>
|
|
48
|
-
<script type="module"
|
|
51
|
+
<script type="module">
|
|
52
|
+
import Toast from '../src/components/Toast.js';
|
|
53
|
+
document.getElementById('example1').addEventListener('click', () => {
|
|
54
|
+
Toast.create("Hello World");
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<h3 id="positions"><a href="#positions" class="no-link">Different Positions</a></h3>
|
|
62
|
+
<p>Toasts can be positioned in different corners of the screen using the <code>position</code> property.</p>
|
|
63
|
+
<div class="row -mx">
|
|
64
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
65
|
+
<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">"example2-topleft"</span>></span>Top Left<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">"example2-topcenter"</span>></span>Top Center<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">"example2-topright"</span>></span>Top Right<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">"example2-bottomleft"</span>></span>Bottom Left<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">"example2-bottomcenter"</span>></span>Bottom Center<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">"example2-bottomright"</span>></span>Bottom Right<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">'example2-topleft'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from top left!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'top left'</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example2-topcenter'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from top center!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'top center'</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example2-topright'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from top right!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'top right'</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example2-bottomleft'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from bottom left!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'bottom left'</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example2-bottomcenter'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from bottom center!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'bottom center'</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example2-bottomright'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Toast.create(<span class="hljs-string">"Hello from bottom right!"</span>, {<br /> <span class="hljs-attr">position</span>: <span class="hljs-string">'bottom right'</span><br /> });<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
68
|
+
<button id="example2-topleft" class="mb">Top Left</button>
|
|
69
|
+
<button id="example2-topcenter" class="mb">Top Center</button>
|
|
70
|
+
<button id="example2-topright" class="mb">Top Right</button><br />
|
|
71
|
+
<button id="example2-bottomleft" class="mb">Bottom Left</button>
|
|
72
|
+
<button id="example2-bottomcenter" class="mb">Bottom Center</button>
|
|
73
|
+
<button id="example2-bottomright" class="mb">Bottom Right</button>
|
|
74
|
+
<script type="module">
|
|
75
|
+
import Toast from '../src/components/Toast.js';
|
|
76
|
+
document.getElementById('example2-topleft').addEventListener('click', () => {
|
|
77
|
+
Toast.create("Hello from top left!", {
|
|
78
|
+
position: 'top left'
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
document.getElementById('example2-topcenter').addEventListener('click', () => {
|
|
82
|
+
Toast.create("Hello from top center!", {
|
|
83
|
+
position: 'top center'
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
document.getElementById('example2-topright').addEventListener('click', () => {
|
|
87
|
+
Toast.create("Hello from top right!", {
|
|
88
|
+
position: 'top right'
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
document.getElementById('example2-bottomleft').addEventListener('click', () => {
|
|
92
|
+
Toast.create("Hello from bottom left!", {
|
|
93
|
+
position: 'bottom left'
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
document.getElementById('example2-bottomcenter').addEventListener('click', () => {
|
|
97
|
+
Toast.create("Hello from bottom center!", {
|
|
98
|
+
position: 'bottom center'
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
document.getElementById('example2-bottomright').addEventListener('click', () => {
|
|
102
|
+
Toast.create("Hello from bottom right!", {
|
|
103
|
+
position: 'bottom right'
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
</script>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<h3 id="timeouts"><a href="#timeouts" class="no-link">Timeouts</a></h3>
|
|
111
|
+
<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>
|
|
112
|
+
<div class="row -mx">
|
|
113
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
114
|
+
<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>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
117
|
+
<button id="example3-1" class="mb">Open 1 Second Timeout Toast</button>
|
|
118
|
+
<button id="example3-3" class="mb">Open 3 Second Timeout Toast</button>
|
|
119
|
+
<button id="example3-10" class="mb">Open 10 Second Timeout Toast</button>
|
|
120
|
+
<script type="module">
|
|
121
|
+
import Toast from '../src/components/Toast.js';
|
|
122
|
+
document.getElementById('example3-1').addEventListener('click', () => {
|
|
123
|
+
Toast.create("I will timeout in 1 second", {
|
|
124
|
+
timeout: 1000
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
document.getElementById('example3-3').addEventListener('click', () => {
|
|
128
|
+
Toast.create("I will timeout in 3 second", {
|
|
129
|
+
timeout: 3000
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
document.getElementById('example3-10').addEventListener('click', () => {
|
|
133
|
+
Toast.create("I will timeout in 10 second", {
|
|
134
|
+
timeout: 10000
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
</script>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<h3 id="actionAndClose"><a href="#actionAndClose" class="no-link">Action and Close Buttons</a></h3>
|
|
143
|
+
<p>Toasts can have action and close buttons that trigger callbacks when clicked.</p>
|
|
144
|
+
<div class="row -mx">
|
|
145
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
146
|
+
<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>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
149
|
+
<button id="example4-action" class="mb">Open Toast with Action</button>
|
|
150
|
+
<button id="example4-close" class="mb">Open Toast with Close Button</button>
|
|
151
|
+
<button id="example4-action-close" class="mb">Open Toast with Action and Close Button</button>
|
|
152
|
+
<script type="module">
|
|
153
|
+
import Toast from '../src/components/Toast.js';
|
|
154
|
+
document.getElementById('example4-action').addEventListener('click', () => {
|
|
155
|
+
Toast.create("Hello World", {
|
|
156
|
+
timeout: 0,
|
|
157
|
+
action: 'Click Me',
|
|
158
|
+
actionCallback: () => {
|
|
159
|
+
Toast.create("You clicked the action");
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
document.getElementById('example4-close').addEventListener('click', () => {
|
|
164
|
+
Toast.create("Hello World", {
|
|
165
|
+
timeout: 0,
|
|
166
|
+
close: '<k-icon name="close"></div>',
|
|
167
|
+
closeCallback: () => {
|
|
168
|
+
Toast.create("You closed the toast");
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
document.getElementById('example4-action-close').addEventListener('click', () => {
|
|
173
|
+
Toast.create("Hello World", {
|
|
174
|
+
timeout: 0,
|
|
175
|
+
action: 'Click Me',
|
|
176
|
+
actionCallback: () => {
|
|
177
|
+
Toast.create("You clicked the action");
|
|
178
|
+
return false; // return false to prevent closing
|
|
179
|
+
},
|
|
180
|
+
close: '<k-icon name="close"></div>',
|
|
181
|
+
closeCallback: () => {
|
|
182
|
+
Toast.create("You closed the toast");
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
</script>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<h3 id="successWarningError"><a href="#successWarningError" class="no-link">Success, Warning and Error</a></h3>
|
|
191
|
+
<p>Toasts can be created as a success, warning or error message.</p>
|
|
192
|
+
<div class="row -mx">
|
|
193
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
194
|
+
<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>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="col d-span-6 t-span-6 m-span-12 px">
|
|
197
|
+
<button id="example5-success" class="mb">Success Toast</button>
|
|
198
|
+
<button id="example5-warning" class="mb">Warning Toast</button>
|
|
199
|
+
<button id="example5-error" class="mb">Error Toast</button>
|
|
200
|
+
<script type="module">
|
|
201
|
+
import Toast from '../src/components/Toast.js';
|
|
202
|
+
document.getElementById('example5-success').addEventListener('click', () => {
|
|
203
|
+
Toast.success("It Worked!");
|
|
204
|
+
});
|
|
205
|
+
document.getElementById('example5-warning').addEventListener('click', () => {
|
|
206
|
+
Toast.warning("Be Careful");
|
|
207
|
+
});
|
|
208
|
+
document.getElementById('example5-error').addEventListener('click', () => {
|
|
209
|
+
Toast.error("That's a very bad idea");
|
|
210
|
+
});
|
|
211
|
+
</script>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
217
|
+
|
|
218
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
219
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
220
|
+
<h5>
|
|
221
|
+
<code>new Toast()</code><br />
|
|
222
|
+
<code>new Toast(<i>object</i> options)</code>
|
|
223
|
+
</h5>
|
|
224
|
+
|
|
225
|
+
<h4>Parameters</h4>
|
|
226
|
+
<h5><code>options<i>: object</i></code></h5>
|
|
227
|
+
<p>An object with the following optional properties:</p>
|
|
228
|
+
<ul>
|
|
229
|
+
<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>
|
|
230
|
+
<li><code>actionHtml<i>: string</i></code> - HTML content for the action button.</li>
|
|
231
|
+
<li><code>closeCallback<i>: function</i></code> - Function to call when the toast is closed.</li>
|
|
232
|
+
<li><code>closeHtml<i>: string</i></code> - HTML content for the close button.</li>
|
|
233
|
+
<li><code>timeout<i>: number</i></code> - Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close).</li>
|
|
234
|
+
</ul>
|
|
235
|
+
|
|
236
|
+
<h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
|
|
237
|
+
<h5><code>Toast.create(message, options)<i>: Toast</i></code></h5>
|
|
238
|
+
<p>Creates and displays a new toast with the specified message and options. Returns the created Toast instance.</p>
|
|
239
|
+
<p>Options include:</p>
|
|
240
|
+
<ul>
|
|
241
|
+
<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>
|
|
242
|
+
<li><code>removeOnClose<i>: boolean</i></code> - If true, the toast element will be removed from the DOM when closed. Default is true.</li>
|
|
243
|
+
<li><code>timeout<i>: number</i></code> - Time in milliseconds before the toast automatically closes. Default is 5000ms (5 seconds).</li>
|
|
244
|
+
<li><code>action<i>: string | HTMLElement</i></code> - Text or HTML element to use for the action button.</li>
|
|
245
|
+
<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>
|
|
246
|
+
<li><code>close<i>: string | HTMLElement</i></code> - Text or HTML element to use for the close button.</li>
|
|
247
|
+
<li><code>closeCallback<i>: function</i></code> - Function to call when the toast is closed.</li>
|
|
248
|
+
<li><code>icon<i>: string | HTMLElement</i></code> - Text or HTML element to use as an icon in the toast.</li>
|
|
249
|
+
</ul>
|
|
250
|
+
|
|
251
|
+
<h5><code>Toast.success(message, options)<i>: Toast</i></code></h5>
|
|
252
|
+
<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>
|
|
253
|
+
|
|
254
|
+
<h5><code>Toast.warning(message, options)<i>: Toast</i></code></h5>
|
|
255
|
+
<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>
|
|
256
|
+
|
|
257
|
+
<h5><code>Toast.error(message, options)<i>: Toast</i></code></h5>
|
|
258
|
+
<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>
|
|
259
|
+
|
|
260
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
261
|
+
<ul>
|
|
262
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
263
|
+
<li><a href="./icon.html">Icon</a> (for success, warning, and error toasts)</li>
|
|
264
|
+
</ul>
|
|
265
|
+
|
|
266
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
267
|
+
<h5><code>action-html<i>: string</i></code></h5>
|
|
268
|
+
<p>HTML content for the action button.</p>
|
|
269
|
+
|
|
270
|
+
<h5><code>close-html<i>: string</i></code></h5>
|
|
271
|
+
<p>HTML content for the close button.</p>
|
|
272
|
+
|
|
273
|
+
<h5><code>timeout<i>: number</i></code></h5>
|
|
274
|
+
<p>Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close).</p>
|
|
275
|
+
|
|
276
|
+
<h5><code>opened<i>: boolean</i></code></h5>
|
|
277
|
+
<p>Whether the toast is currently open. Default is false.</p>
|
|
278
|
+
|
|
279
|
+
<h5><code>has-action<i>: boolean</i></code></h5>
|
|
280
|
+
<p>Whether the toast has an action button. Automatically set based on slotted content.</p>
|
|
281
|
+
|
|
282
|
+
<h5><code>has-close<i>: boolean</i></code></h5>
|
|
283
|
+
<p>Whether the toast has a close button. Automatically set based on slotted content.</p>
|
|
284
|
+
|
|
285
|
+
<h5><code>has-icon<i>: boolean</i></code></h5>
|
|
286
|
+
<p>Whether the toast has an icon. Automatically set based on slotted content.</p>
|
|
287
|
+
|
|
288
|
+
<h5><code>position<i>: string</i></code></h5>
|
|
289
|
+
<p>Position of the toast on the screen.</p>
|
|
290
|
+
|
|
291
|
+
<h5><code>animating<i>: string</i></code></h5>
|
|
292
|
+
<p>Current animation state ('in', 'out', or empty string).</p>
|
|
293
|
+
|
|
294
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
295
|
+
<h5><code>actionCallback<i>: function</i></code></h5>
|
|
296
|
+
<p>Function to call when the action button is clicked.</p>
|
|
297
|
+
|
|
298
|
+
<h5><code>closeCallback<i>: function</i></code></h5>
|
|
299
|
+
<p>Function to call when the toast is closed.</p>
|
|
300
|
+
|
|
301
|
+
<h5><code>actionHtml<i>: string</i></code></h5>
|
|
302
|
+
<p>HTML content for the action button.</p>
|
|
303
|
+
|
|
304
|
+
<h5><code>closeHtml<i>: string</i></code></h5>
|
|
305
|
+
<p>HTML content for the close button.</p>
|
|
306
|
+
|
|
307
|
+
<h5><code>timeout<i>: number</i></code></h5>
|
|
308
|
+
<p>Time in milliseconds before the toast automatically closes.</p>
|
|
309
|
+
|
|
310
|
+
<h5><code>opened<i>: boolean</i></code></h5>
|
|
311
|
+
<p>Whether the toast is currently open.</p>
|
|
312
|
+
|
|
313
|
+
<h5><code>hasAction<i>: boolean</i></code></h5>
|
|
314
|
+
<p>Whether the toast has an action button.</p>
|
|
315
|
+
|
|
316
|
+
<h5><code>hasClose<i>: boolean</i></code></h5>
|
|
317
|
+
<p>Whether the toast has a close button.</p>
|
|
318
|
+
|
|
319
|
+
<h5><code>hasIcon<i>: boolean</i></code></h5>
|
|
320
|
+
<p>Whether the toast has an icon.</p>
|
|
321
|
+
|
|
322
|
+
<h5><code>position<i>: string</i></code></h5>
|
|
323
|
+
<p>Position of the toast on the screen.</p>
|
|
324
|
+
|
|
325
|
+
<h5><code>animating<i>: string</i></code></h5>
|
|
326
|
+
<p>Current animation state.</p>
|
|
327
|
+
|
|
328
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
329
|
+
<h5><code>open()<i>: void</i></code></h5>
|
|
330
|
+
<p>Opens the toast. If a timeout is specified, this starts the timer for automatic closing.</p>
|
|
331
|
+
|
|
332
|
+
<h5><code>close()<i>: void</i></code></h5>
|
|
333
|
+
<p>Closes the toast and calls the <code>closeCallback</code> if provided.</p>
|
|
334
|
+
|
|
335
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
336
|
+
<h5><code>open</code></h5>
|
|
337
|
+
<p>Fired when the toast is opened.</p>
|
|
338
|
+
|
|
339
|
+
<h5><code>close</code></h5>
|
|
340
|
+
<p>Fired when the toast is closed.</p>
|
|
341
|
+
|
|
342
|
+
<h5><code>openchange</code></h5>
|
|
343
|
+
<p>Fired when the toast open state changes (both when opening and closing).</p>
|
|
344
|
+
|
|
345
|
+
<h3 id="toastContainer"><a href="#toastContainer" class="no-link">ToastContainer</a></h3>
|
|
346
|
+
<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>
|
|
347
|
+
|
|
348
|
+
<h5><code>new ToastContainer(position)</code></h5>
|
|
349
|
+
<p>Creates a new toast container at the specified position.</p>
|
|
350
|
+
|
|
351
|
+
<h5><code>position<i>: string</i></code></h5>
|
|
352
|
+
<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>
|
|
353
|
+
|
|
354
|
+
</main>
|
|
355
|
+
<div style="height:33vh"></div>
|
|
49
356
|
<script type="module" src="../src/components/Toast.js"></script>
|
|
50
357
|
</body>
|
|
51
358
|
</html>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Toggle - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
-
<link rel="stylesheet" href="../
|
|
8
|
-
<link rel="stylesheet" href="../
|
|
7
|
+
<link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
9
9
|
<link rel="stylesheet" href="../styles.css" />
|
|
10
10
|
<script type="module" src="./init.js"></script>
|
|
11
11
|
</head>
|
|
@@ -143,8 +143,6 @@
|
|
|
143
143
|
<p>Negates the <code>value</code>, if it is <code>true</code> it is now set to <code>false</code>, but if it is <code>false</code> it is now set to <code>true</code>. It also dispatches dispatches a <code><i>change</i></code> and an <code><i>on</i></code> or <code><i>off</i></code> event. The switch visual changes to the oposite state.</p>
|
|
144
144
|
|
|
145
145
|
</main>
|
|
146
|
-
<div style="height:33vh"></div>
|
|
147
|
-
<script type="module" src="../src/components/Import.js"></script>
|
|
148
|
-
<script type="module" src="../src/components/Toggle.js"></script>
|
|
146
|
+
<div style="height:33vh"></div><script type="module" src="../src/components/Toggle.js"></script>
|
|
149
147
|
</body>
|
|
150
148
|
</html>
|