kempo-ui 0.0.2 → 0.0.3
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/.github/copilot-instructions.md +149 -149
- package/.github/workflows/publish-npm.yml +44 -44
- package/CONTRIBUTING.md +149 -149
- package/README.md +0 -0
- package/dist/kempo-vars.css +0 -0
- package/dist/src/components/FocusCapture.js +7 -0
- package/dist/src/components/Icon.js +10 -0
- package/dist/src/components/Import.js +1 -0
- package/dist/src/components/ShadowComponent.js +1 -0
- package/dist/src/components/SideMenu.js +97 -0
- package/dist/src/lit-all.min.js +120 -0
- package/docs/components/accordion.html +122 -0
- package/docs/components/card.html +91 -0
- package/docs/components/component.html +90 -0
- package/docs/components/content-slider.html +193 -0
- package/docs/components/dialog.html +245 -0
- package/docs/components/directory-viewer.html +90 -0
- package/docs/components/focus-capture.html +68 -0
- package/docs/components/icon.html +161 -0
- package/docs/components/import.html +78 -0
- package/docs/components/lazy-component.html +84 -0
- package/docs/components/reactive-component.html +69 -0
- package/docs/components/reactive-lazy-component.html +69 -0
- package/docs/components/resize.html +152 -0
- package/docs/components/search.html +102 -0
- package/docs/components/show-more.html +123 -0
- package/docs/components/side-menu.html +168 -0
- package/docs/components/sortable.html +96 -0
- package/docs/components/split.html +126 -0
- package/docs/components/table.html +312 -0
- package/docs/components/tableControls.html +77 -0
- package/docs/components/tableCustomFields.html +113 -0
- package/docs/components/tableFetchRecords.html +114 -0
- package/docs/components/tableFieldSortHide.html +75 -0
- package/docs/components/tablePagination.html +100 -0
- package/docs/components/tableRecordEditing.html +144 -0
- package/docs/components/tableRecordFiltering.html +75 -0
- package/docs/components/tableRecordHiding.html +80 -0
- package/docs/components/tableRecordSearching.html +75 -0
- package/docs/components/tableRecordSelection.html +75 -0
- package/docs/components/tableRowControls.html +78 -0
- package/docs/components/tableSorting.html +73 -0
- package/docs/components/tabs.html +163 -0
- package/docs/components/tags.html +94 -0
- package/docs/components/theme-switcher.html +129 -0
- package/docs/components/timestamp.html +86 -0
- package/docs/components/toast.html +328 -0
- package/docs/components/toggle.html +155 -0
- package/docs/dev.config.json +20 -0
- package/docs/icons/add.svg +1 -0
- package/docs/icons/arrow-back.svg +1 -0
- package/docs/icons/arrow-down-double.svg +1 -0
- package/docs/icons/arrow-down.svg +1 -0
- package/docs/icons/arrow-forward.svg +1 -0
- package/docs/icons/arrow-up-double.svg +1 -0
- package/docs/icons/arrow-up.svg +1 -0
- package/docs/icons/cards.svg +1 -0
- package/docs/icons/check.svg +1 -0
- package/docs/icons/chevron-left.svg +1 -0
- package/docs/icons/chevron-right.svg +1 -0
- package/docs/icons/close.svg +2 -0
- package/docs/icons/compare.svg +1 -0
- package/docs/icons/delete.svg +1 -0
- package/docs/icons/drag-handle.svg +1 -0
- package/docs/icons/drawing2.svg +124 -0
- package/docs/icons/edit.svg +1 -0
- package/docs/icons/error.svg +1 -0
- package/docs/icons/export-file.svg +1 -0
- package/docs/icons/file-text.svg +1 -0
- package/docs/icons/file.svg +1 -0
- package/docs/icons/filter-off.svg +1 -0
- package/docs/icons/filter.svg +1 -0
- package/docs/icons/first.svg +1 -0
- package/docs/icons/folder-clear.svg +1 -0
- package/docs/icons/folder-create.svg +1 -0
- package/docs/icons/folder-open.svg +1 -0
- package/docs/icons/folder.svg +1 -0
- package/docs/icons/hide.svg +1 -0
- package/docs/icons/image.svg +1 -0
- package/docs/icons/label-add.svg +1 -0
- package/docs/icons/label.svg +1 -0
- package/docs/icons/last.svg +1 -0
- package/docs/icons/menu.svg +1 -0
- package/docs/icons/mode-auto.svg +1 -0
- package/docs/icons/mode-dark.svg +1 -0
- package/docs/icons/mode-light.svg +1 -0
- package/docs/icons/open-in-browser.svg +1 -0
- package/docs/icons/pause.svg +1 -0
- package/docs/icons/play.svg +1 -0
- package/docs/icons/refresh.svg +1 -0
- package/docs/icons/remove.svg +1 -0
- package/docs/icons/save.svg +1 -0
- package/docs/icons/search.svg +1 -0
- package/docs/icons/settings.svg +1 -0
- package/docs/icons/show.svg +1 -0
- package/docs/icons/storage.svg +1 -0
- package/docs/icons/table-visibility.svg +1 -0
- package/docs/icons/tag.svg +1 -0
- package/docs/icons/tools.svg +1 -0
- package/docs/icons/trash-x.svg +1 -0
- package/docs/icons/warning.svg +1 -0
- package/docs/index.html +28 -21
- package/docs/nav.inc.html +73 -0
- package/docs/nav.inc.js +4 -0
- package/{config/production.json → docs/prod.config.json} +20 -16
- package/docs/src/components/FocusCapture.js +7 -0
- package/docs/src/components/HybridComponent.js +1 -0
- package/docs/src/components/Icon.js +10 -0
- package/docs/src/components/Import.js +1 -0
- package/docs/src/components/LightComponent.js +1 -0
- package/docs/src/components/ShadowComponent.js +1 -0
- package/docs/src/components/SideMenu.js +97 -0
- package/docs/src/lit-all.min.js +120 -0
- package/docs/src/utils/cli.js +1 -0
- package/docs/src/utils/fs-utils.js +1 -0
- package/docs/styles.css +6 -0
- package/icons/add.svg +1 -0
- package/icons/arrow-back.svg +1 -0
- package/icons/arrow-down-double.svg +1 -0
- package/icons/arrow-down.svg +1 -0
- package/icons/arrow-forward.svg +1 -0
- package/icons/arrow-up-double.svg +1 -0
- package/icons/arrow-up.svg +1 -0
- package/icons/cards.svg +1 -0
- package/icons/check.svg +1 -0
- package/icons/chevron-left.svg +1 -0
- package/icons/chevron-right.svg +1 -0
- package/icons/close.svg +2 -0
- package/icons/compare.svg +1 -0
- package/icons/delete.svg +1 -0
- package/icons/drag-handle.svg +1 -0
- package/icons/drawing2.svg +124 -0
- package/icons/edit.svg +1 -0
- package/icons/error.svg +1 -0
- package/icons/export-file.svg +1 -0
- package/icons/file-text.svg +1 -0
- package/icons/file.svg +1 -0
- package/icons/filter-off.svg +1 -0
- package/icons/filter.svg +1 -0
- package/icons/first.svg +1 -0
- package/icons/folder-clear.svg +1 -0
- package/icons/folder-create.svg +1 -0
- package/icons/folder-open.svg +1 -0
- package/icons/folder.svg +1 -0
- package/icons/hide.svg +1 -0
- package/icons/image.svg +1 -0
- package/icons/label-add.svg +1 -0
- package/icons/label.svg +1 -0
- package/icons/last.svg +1 -0
- package/icons/menu.svg +1 -0
- package/icons/mode-auto.svg +1 -0
- package/icons/mode-dark.svg +1 -0
- package/icons/mode-light.svg +1 -0
- package/icons/open-in-browser.svg +1 -0
- package/icons/pause.svg +1 -0
- package/icons/play.svg +1 -0
- package/icons/refresh.svg +1 -0
- package/icons/remove.svg +1 -0
- package/icons/save.svg +1 -0
- package/icons/search.svg +1 -0
- package/icons/settings.svg +1 -0
- package/icons/show.svg +1 -0
- package/icons/storage.svg +1 -0
- package/icons/table-visibility.svg +1 -0
- package/icons/tag.svg +1 -0
- package/icons/tools.svg +1 -0
- package/icons/trash-x.svg +1 -0
- package/icons/warning.svg +1 -0
- package/package.json +2 -2
- package/scripts/build.js +109 -138
- package/scripts/docs.js +60 -60
- package/src/components/Card.js +66 -0
- package/src/components/FocusCapture.js +23 -0
- package/src/components/HybridComponent.js +40 -40
- package/src/components/Icon.js +155 -0
- package/src/components/Import.js +104 -0
- package/src/components/LightComponent.js +32 -32
- package/src/components/ShadowComponent.js +30 -17
- package/src/components/SideMenu.js +167 -0
- package/src/components/ThemeSwitcher.js +108 -0
- package/src/kempo-hljs.css +146 -0
- package/src/utils/cli.js +43 -43
- package/src/utils/fs-utils.js +41 -41
- package/src/utils/propConverters.js +11 -0
- package/tests/HybridComponent.browser-test.js +214 -214
- package/tests/LightComponent.browser-test.js +169 -169
- package/tests/ShadowComponent.browser-test.js +130 -130
- package/config/development.json +0 -14
- package/docs/components/ShadowComponent.js +0 -1
- /package/{docs → dist/src}/components/HybridComponent.js +0 -0
- /package/{docs → dist/src}/components/LightComponent.js +0 -0
- /package/{docs → dist/src}/utils/cli.js +0 -0
- /package/{docs → dist/src}/utils/fs-utils.js +0 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Dialog - Components - Kempo Docs - A Web Components Solution</title>
|
|
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" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
|
+
<script type="module">
|
|
10
|
+
import Import from '../src/components/Import.js';
|
|
11
|
+
import Icon from '../src/components/Icon.js';
|
|
12
|
+
Import.replacements.root = '../';
|
|
13
|
+
Icon.pathToIcons = ['../icons'];
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<k-import src="../nav.inc.html"></k-import>
|
|
18
|
+
<main>
|
|
19
|
+
<h1 class="ta-center">Dialog</h1>
|
|
20
|
+
|
|
21
|
+
<details class="b r mb">
|
|
22
|
+
<summary class="p">Table of Contents</summary>
|
|
23
|
+
<div class="m mt0 pl">
|
|
24
|
+
<h6>Examples</h6>
|
|
25
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
26
|
+
<a href="#titles">Titles</a><br />
|
|
27
|
+
<a href="#actionButtons">Action Buttons</a><br />
|
|
28
|
+
<a href="#jsUsage">JavaScript Usage</a><br />
|
|
29
|
+
|
|
30
|
+
<h6 class="mt">JavaScript Reference</h6>
|
|
31
|
+
<a href="#constructor">Constructor</a><br />
|
|
32
|
+
<a href="#requirements">Requirements</a><br />
|
|
33
|
+
<a href="#attributes">Attributes</a><br />
|
|
34
|
+
<a href="#properties">Properties</a><br />
|
|
35
|
+
<a href="#methods">Methods</a><br />
|
|
36
|
+
<a href="#staticMethods">Static Methods</a><br />
|
|
37
|
+
</div>
|
|
38
|
+
</details>
|
|
39
|
+
|
|
40
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
41
|
+
<p>Create dialogs using the <code>k-dialog</code> component. Open the dialog by calling the <code>open()</code> method, and close it by calling the <code>close()</code> method. Or it can be closed using the dialog's GUI (clicking the overlay, clicking the close button, or the cancel or confirm action buttons).</p>
|
|
42
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d1"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span>Hello World<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"doument.getElementById('d1').open()"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></span></code></pre>
|
|
43
|
+
<button class="openDialog mb" data-dialog="d1" slot="right">Open Dialog</button>
|
|
44
|
+
<k-dialog id="d1">
|
|
45
|
+
<p class="p">Hello World</p>
|
|
46
|
+
</k-dialog>
|
|
47
|
+
|
|
48
|
+
<h3 id="titles"><a href="#titles" class="no-link">Titles</a></h3>
|
|
49
|
+
<p>Assign an element to the <code>title</code> slot to have it appear as the dialog title.</p>
|
|
50
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d2"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">h6</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"m0 px"</span><br /> <span class="hljs-attr">slot</span>=<span class="hljs-string">"title"</span><br /> ></span>This is a fact<span class="hljs-tag"></<span class="hljs-name">h6</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span>A hotdog is a sandwhich<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span></code></pre>
|
|
51
|
+
<button class="openDialog mb" data-dialog="d2" slot="right">Open Dialog</button>
|
|
52
|
+
<k-dialog
|
|
53
|
+
id="d2"
|
|
54
|
+
>
|
|
55
|
+
<h6
|
|
56
|
+
class="m0 px"
|
|
57
|
+
slot="title"
|
|
58
|
+
>This is a fact</h6>
|
|
59
|
+
<p class="p">A hotdog is a sandwhich</p>
|
|
60
|
+
</k-dialog>
|
|
61
|
+
|
|
62
|
+
<h3 id="actionButtons"><a href="#actionButtons" class="no-link">Action Buttons</a></h3>
|
|
63
|
+
<p>Add a cancel button using the <code>cancel-text</code> attribute.</p>
|
|
64
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span><br /> <span class="hljs-attr">id</span>=<span class="hljs-string">"d4"</span><br /> <span class="hljs-attr">cancel-text</span>=<span class="hljs-string">"Absolutly Not"</span><br />></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span>Mint and Chocolate belong together<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span></code></pre>
|
|
65
|
+
<button class="openDialog mb" data-dialog="d4" slot="right">Open Dialog</button>
|
|
66
|
+
<k-dialog
|
|
67
|
+
id="d4"
|
|
68
|
+
cancel-text="Absolutly Not"
|
|
69
|
+
>
|
|
70
|
+
<p class="p">Mint and Chocolate belong together</p>
|
|
71
|
+
</k-dialog>
|
|
72
|
+
|
|
73
|
+
<p>Add a confirm button using the <code>confirm-text</code> attribute.</p>
|
|
74
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span><br /> <span class="hljs-attr">id</span>=<span class="hljs-string">"d5"</span><br /> <span class="hljs-attr">confirm-text</span>=<span class="hljs-string">"Confirm"</span><br />></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span>Spaghetti is the greatest food<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span></code></pre>
|
|
75
|
+
<button class="openDialog mb" data-dialog="d5" slot="right">Open Dialog</button>
|
|
76
|
+
<k-dialog
|
|
77
|
+
id="d5"
|
|
78
|
+
confirm-text="Confirm"
|
|
79
|
+
>
|
|
80
|
+
<p class="p">Spaghetti is the greatest food</p>
|
|
81
|
+
</k-dialog>
|
|
82
|
+
|
|
83
|
+
<p>Try it with both a cancel and confirm button.</p>
|
|
84
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span><br /> <span class="hljs-attr">id</span>=<span class="hljs-string">"d6"</span><br /> <span class="hljs-attr">cancel-text</span>=<span class="hljs-string">"It should be outlawed"</span><br /> <span class="hljs-attr">confirm-text</span>=<span class="hljs-string">"Of course it is"</span><br />></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span>Ranch is gross<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span></code></pre>
|
|
85
|
+
<button class="openDialog mb" data-dialog="d6" slot="right">Open Dialog</button>
|
|
86
|
+
<k-dialog
|
|
87
|
+
id="d6"
|
|
88
|
+
cancel-text="It should be outlawed"
|
|
89
|
+
confirm-text="Of course it is"
|
|
90
|
+
>
|
|
91
|
+
<p class="p">Ranch is gross</p>
|
|
92
|
+
</k-dialog>
|
|
93
|
+
|
|
94
|
+
<h3 id="jsUsage"><a href="#jsUsage" class="no-link">JavaScript Usage</a></h3>
|
|
95
|
+
<h5>Create Dialog</h5>
|
|
96
|
+
<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">"d7"</span>></span>Open Dialog<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> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d7'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.create(<span class="hljs-string">'<p>Hello World</p>'</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
97
|
+
<button id="d7" class="mb">Open Dialog</button>
|
|
98
|
+
<script type="module">
|
|
99
|
+
import Dialog from '/kempo/components/Dialog.js';
|
|
100
|
+
document.getElementById('d7').addEventListener('click', () => {
|
|
101
|
+
Dialog.create('<p>Hello World</p>');
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<h5>Error Dialog</h5>
|
|
106
|
+
<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">"d8"</span>></span>Open Dialog<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> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d8'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.error(<span class="hljs-string">"<p>Oh no, don't do that!</p>"</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
107
|
+
<button id="d8" class="mb">Open Dialog</button>
|
|
108
|
+
<script type="module">
|
|
109
|
+
import Dialog from '/kempo/components/Dialog.js';
|
|
110
|
+
document.getElementById('d8').addEventListener('click', () => {
|
|
111
|
+
Dialog.error("Oh no, don't do that!");
|
|
112
|
+
});
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<h3 id="confirmDialog"><a href="#confirmDialog" class="no-link">Confirm Dialog</a></h3>
|
|
116
|
+
<p>Use the <code>Dialog.confirm</code> static method to create a confirmation dialog. This method takes a text message, a response callback, and an options object.</p>
|
|
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">"d9"</span>></span>Open Confirm Dialog<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> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d9'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.confirm(<span class="hljs-string">"Are you sure you want to proceed?"</span>, <span class="hljs-function"><span class="hljs-params">response</span> =></span> {<br /> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"User response:"</span>, response);<br /> });<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
118
|
+
<button id="d9" class="mb">Open Confirm Dialog</button>
|
|
119
|
+
<script type="module">
|
|
120
|
+
import Dialog from '/kempo/components/Dialog.js';
|
|
121
|
+
document.getElementById('d9').addEventListener('click', () => {
|
|
122
|
+
Dialog.confirm("Are you sure you want to proceed?", response => {
|
|
123
|
+
console.log("User response:", response);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
129
|
+
|
|
130
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
131
|
+
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
132
|
+
<h5>
|
|
133
|
+
<code>new Dialog(options)</code>
|
|
134
|
+
</h5>
|
|
135
|
+
|
|
136
|
+
<h4>Parameters</h4>
|
|
137
|
+
<h5><code>options<i>: object</i></code></h5>
|
|
138
|
+
<p>An object containing the initial configuration for the dialog. The options object can contain the following properties:</p>
|
|
139
|
+
<ul>
|
|
140
|
+
<li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened.</li>
|
|
141
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
142
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
143
|
+
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
|
|
144
|
+
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
|
|
145
|
+
<li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
|
|
146
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
147
|
+
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
148
|
+
<li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
|
|
149
|
+
<li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
|
|
150
|
+
</ul>
|
|
151
|
+
|
|
152
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
153
|
+
<ul>
|
|
154
|
+
<li><a href="./component.html">Component</a></li>
|
|
155
|
+
</ul>
|
|
156
|
+
|
|
157
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
158
|
+
<h5><code>opened<i>: boolean</i></code></h5>
|
|
159
|
+
<p>Whether the dialog is opened.</p>
|
|
160
|
+
<h5><code>closeBtn<i>: boolean</i></code></h5>
|
|
161
|
+
<p>Whether to show the close button.</p>
|
|
162
|
+
<h5><code>overlayClose<i>: boolean</i></code></h5>
|
|
163
|
+
<p>Whether clicking the overlay closes the dialog.</p>
|
|
164
|
+
<h5><code>confirmText<i>: string</i></code></h5>
|
|
165
|
+
<p>Text for the confirm button.</p>
|
|
166
|
+
<h5><code>confirmClasses<i>: string</i></code></h5>
|
|
167
|
+
<p>Classes for the confirm button.</p>
|
|
168
|
+
<h5><code>cancelText<i>: string</i></code></h5>
|
|
169
|
+
<p>Text for the cancel button.</p>
|
|
170
|
+
<h5><code>cancelClasses<i>: string</i></code></h5>
|
|
171
|
+
<p>Classes for the cancel button.</p>
|
|
172
|
+
|
|
173
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
174
|
+
<h5><code>confirmAction<i>: function</i></code></h5>
|
|
175
|
+
<p>Action to perform on confirm.</p>
|
|
176
|
+
<h5><code>cancelAction<i>: function</i></code></h5>
|
|
177
|
+
<p>Action to perform on cancel.</p>
|
|
178
|
+
<h5><code>closeCallback<i>: function</i></code></h5>
|
|
179
|
+
<p>Callback to execute when the dialog is closed.</p>
|
|
180
|
+
|
|
181
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
182
|
+
<h5><code>open()<i>: void</i></code></h5>
|
|
183
|
+
<p>Opens the dialog.</p>
|
|
184
|
+
<h5><code>close()<i>: void</i></code></h5>
|
|
185
|
+
<p>Closes the dialog.</p>
|
|
186
|
+
<h5><code>toggle()<i>: void</i></code></h5>
|
|
187
|
+
<p>Toggles the dialog open or closed.</p>
|
|
188
|
+
<h5><code>focus()<i>: void</i></code></h5>
|
|
189
|
+
<p>Focuses the first focusable element in the dialog.</p>
|
|
190
|
+
<h5><code>blur()<i>: void</i></code></h5>
|
|
191
|
+
<p>Returns focus to the element that had focus before the dialog was opened.</p>
|
|
192
|
+
|
|
193
|
+
<h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
|
|
194
|
+
<h5><code>create(contents, options)<i>: Dialog</i></code></h5>
|
|
195
|
+
<p>Creates and opens a new dialog with the specified contents and options.</p>
|
|
196
|
+
<h6>Options</h6>
|
|
197
|
+
<ul>
|
|
198
|
+
<li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened.</li>
|
|
199
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
200
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
201
|
+
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
|
|
202
|
+
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
|
|
203
|
+
<li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
|
|
204
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
205
|
+
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
206
|
+
<li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
|
|
207
|
+
<li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
|
|
208
|
+
</ul>
|
|
209
|
+
<h5><code>confirm(text, responseCallback, options)<i>: void</i></code></h5>
|
|
210
|
+
<p>Creates and opens a confirmation dialog with the specified text and options.</p>
|
|
211
|
+
<h6>Options</h6>
|
|
212
|
+
<ul>
|
|
213
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog.</li>
|
|
214
|
+
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
|
|
215
|
+
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
|
|
216
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
217
|
+
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
218
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
219
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
220
|
+
</ul>
|
|
221
|
+
<h5><code>error(text, responseCallback, options)<i>: void</i></code></h5>
|
|
222
|
+
<p>Creates and opens an error dialog with the specified text and options.</p>
|
|
223
|
+
<h6>Options</h6>
|
|
224
|
+
<ul>
|
|
225
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog.</li>
|
|
226
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
227
|
+
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
228
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
229
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
230
|
+
</ul>
|
|
231
|
+
|
|
232
|
+
</main>
|
|
233
|
+
<div style="height:33vh"></div>
|
|
234
|
+
<script type="module" src="../src/components/Import.js"></script>
|
|
235
|
+
<script type="module" src="../src/components/Dialog.js"></script>
|
|
236
|
+
<script>
|
|
237
|
+
document.querySelectorAll('.openDialog').forEach( $btn => {
|
|
238
|
+
$btn.addEventListener('click', () => {
|
|
239
|
+
const $dialog = document.getElementById($btn.dataset.dialog);
|
|
240
|
+
if($dialog) $dialog.open();
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
</script>
|
|
244
|
+
</body>
|
|
245
|
+
</html>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Directory Viewer - Components - Kempo Docs - A Web Components Solution</title>
|
|
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" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
|
+
<script type="module">
|
|
10
|
+
import Import from '../src/components/Import.js';
|
|
11
|
+
import Icon from '../src/components/Icon.js';
|
|
12
|
+
Import.replacements.root = '../';
|
|
13
|
+
Icon.pathToIcons = ['../icons'];
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<k-import src="../nav.inc.html"></k-import>
|
|
18
|
+
<h1 class="ta-center">Directory Viewer</h1>
|
|
19
|
+
<main>
|
|
20
|
+
<details class="b r mb">
|
|
21
|
+
<summary class="p">Table of Contents</summary>
|
|
22
|
+
<div class="m mt0 pl">
|
|
23
|
+
<h6>Examples</h6>
|
|
24
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
25
|
+
|
|
26
|
+
<h6 class="mt">JavaScript Reference</h6>
|
|
27
|
+
<a href="#constructor">Constructor</a><br />
|
|
28
|
+
<a href="#requirements">Requirements</a><br />
|
|
29
|
+
<a href="#attributes">Attributes</a><br />
|
|
30
|
+
<a href="#properties">Properties</a><br />
|
|
31
|
+
<a href="#methods">Methods</a><br />
|
|
32
|
+
</div>
|
|
33
|
+
</details>
|
|
34
|
+
|
|
35
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
36
|
+
<p>Create a directory viewer using the <code>k-directory-viewer</code> component. Load a directory by calling the <code>loadDirectory()</code> method.</p>
|
|
37
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-directory-viewer</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"dv1"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-directory-viewer</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> DirectoryViewer <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/DirectoryViewer.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'dv1'</span>).loadDirectory();<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
38
|
+
<k-directory-viewer id="dv1"></k-directory-viewer>
|
|
39
|
+
<script type="module">
|
|
40
|
+
import DirectoryViewer from '/kempo/components/DirectoryViewer.js';
|
|
41
|
+
// document.getElementById('dv1').loadDirectory();
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
45
|
+
|
|
46
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
47
|
+
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
48
|
+
<h5>
|
|
49
|
+
<code>new DirectoryViewer(handle)</code>
|
|
50
|
+
</h5>
|
|
51
|
+
|
|
52
|
+
<h4>Parameters</h4>
|
|
53
|
+
<h5><code>handle<i>: FileSystemDirectoryHandle</i></code></h5>
|
|
54
|
+
<p>The handle to the directory.</p>
|
|
55
|
+
|
|
56
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
57
|
+
<ul>
|
|
58
|
+
<li><a href="./component.html">Component</a></li>
|
|
59
|
+
</ul>
|
|
60
|
+
|
|
61
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
62
|
+
<h5><code>hasHandle<i>: boolean</i></code></h5>
|
|
63
|
+
<p>Whether the directory viewer has a handle.</p>
|
|
64
|
+
<h5><code>selected<i>: boolean</i></code></h5>
|
|
65
|
+
<p>Whether the directory viewer is selected.</p>
|
|
66
|
+
|
|
67
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
68
|
+
<h5><code>handle<i>: FileSystemDirectoryHandle</i></code></h5>
|
|
69
|
+
<p>The handle to the directory.</p>
|
|
70
|
+
<h5><code>filters<i>: Array</i></code></h5>
|
|
71
|
+
<p>An array of filters applied to the directory viewer.</p>
|
|
72
|
+
|
|
73
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
74
|
+
<h5><code>loadDirectory()<i>: Promise</i></code></h5>
|
|
75
|
+
<p>Loads a directory using the file picker API.</p>
|
|
76
|
+
<h5><code>clearDirectoryHandle()<i>: void</i></code></h5>
|
|
77
|
+
<p>Clears the directory handle.</p>
|
|
78
|
+
<h5><code>updateContents()<i>: void</i></code></h5>
|
|
79
|
+
<p>Updates the contents of the directory viewer.</p>
|
|
80
|
+
<h5><code>select()<i>: void</i></code></h5>
|
|
81
|
+
<p>Selects the directory viewer.</p>
|
|
82
|
+
<h5><code>addFilter(filter)<i>: void</i></code></h5>
|
|
83
|
+
<p>Adds a filter to the directory viewer.</p>
|
|
84
|
+
|
|
85
|
+
</main>
|
|
86
|
+
<div style="height:33vh"></div>
|
|
87
|
+
<script type="module" src="../src/components/Import.js"></script>
|
|
88
|
+
<script type="module" src="../src/components/DirectoryViewer.js"></script>
|
|
89
|
+
</body>
|
|
90
|
+
</html>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>FocusCapture - Components - Kempo Docs - A Web Components Solution</title>
|
|
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" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
|
+
<script type="module">
|
|
10
|
+
import Import from '../src/components/Import.js';
|
|
11
|
+
import Icon from '../src/components/Icon.js';
|
|
12
|
+
Import.replacements.root = '../';
|
|
13
|
+
Icon.pathToIcons = ['../icons'];
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<k-import src="../nav.inc.html"></k-import>
|
|
18
|
+
<h1 class="ta-center">FocusCapture</h1>
|
|
19
|
+
<main>
|
|
20
|
+
<details class="b r mb">
|
|
21
|
+
<summary class="p">Table of Contents</summary>
|
|
22
|
+
<div class="m mt0 pl">
|
|
23
|
+
<h6>Examples</h6>
|
|
24
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
25
|
+
|
|
26
|
+
<h6 class="mt">JavaScript Reference</h6>
|
|
27
|
+
<a href="#constructor">Constructor</a><br />
|
|
28
|
+
<a href="#requirements">Requirements</a><br />
|
|
29
|
+
<a href="#attributes">Attributes</a><br />
|
|
30
|
+
<a href="#properties">Properties</a><br />
|
|
31
|
+
<a href="#methods">Methods</a><br />
|
|
32
|
+
</div>
|
|
33
|
+
</details>
|
|
34
|
+
|
|
35
|
+
<h3>Description</h3>
|
|
36
|
+
<p>The <code>FocusCapture</code> class extends the <a href="./lazy-component.html">LazyComponent</a> class and provides functionality to capture focus within the component.</p>
|
|
37
|
+
|
|
38
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
39
|
+
<p>Use the <code>FocusCapture</code> component to capture focus within the component. When the focus moves out of the component, it will automatically move back to the first focusable element inside the component.</p>
|
|
40
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-focus-capture</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span>></span>Button 1<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span>></span>Button 2<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-focus-capture</span>></span></code></pre>
|
|
41
|
+
<k-focus-capture>
|
|
42
|
+
<button>Button 1</button>
|
|
43
|
+
<button>Button 2</button>
|
|
44
|
+
</k-focus-capture>
|
|
45
|
+
|
|
46
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
47
|
+
|
|
48
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
49
|
+
<h6>Extends <a href="./lazy-component.html">LazyComponent</a></h6>
|
|
50
|
+
<h5>
|
|
51
|
+
<code>new FocusCapture()</code>
|
|
52
|
+
</h5>
|
|
53
|
+
|
|
54
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
55
|
+
<ul>
|
|
56
|
+
<li><a href="./lazy-component.html">LazyComponent</a></li>
|
|
57
|
+
</ul>
|
|
58
|
+
|
|
59
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
60
|
+
<p>The <code>FocusCapture</code> class does not introduce any new attributes beyond those provided by the <a href="./lazy-component.html">LazyComponent</a> class.</p>
|
|
61
|
+
|
|
62
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
63
|
+
<p>The <code>FocusCapture</code> class does not introduce any new methods beyond those provided by the <a href="./lazy-component.html">LazyComponent</a> class.</p>
|
|
64
|
+
|
|
65
|
+
</main>
|
|
66
|
+
<script type="module" src="../src/components/Import.js"></script>
|
|
67
|
+
</body>
|
|
68
|
+
</html>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Icon - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
+
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.css" />
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />
|
|
9
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
10
|
+
<script type="module">
|
|
11
|
+
import Import from '../src/components/Import.js';
|
|
12
|
+
import Icon from '../src/components/Icon.js';
|
|
13
|
+
// import Search from '../src/components/Search.js';
|
|
14
|
+
Import.replacements.root = '../';
|
|
15
|
+
Icon.pathToIcons = ['../icons'];
|
|
16
|
+
// Search.searchDataUrl = '../search.json';
|
|
17
|
+
</script>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<k-import src="../nav.inc.html"></k-import>
|
|
21
|
+
<h1 class="ta-center">Icon</h1>
|
|
22
|
+
<main>
|
|
23
|
+
<details class="b r mb">
|
|
24
|
+
<summary class="p">Table of Contents</summary>
|
|
25
|
+
<div class="m mt0 pl">
|
|
26
|
+
<h6>Examples</h6>
|
|
27
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
28
|
+
<a href="#explicitSource">Explicitly Set the Source</a><br />
|
|
29
|
+
<a href="#fallbackIcon">Fallback Icon</a><br />
|
|
30
|
+
<a href="#changingIconDirectory">Changing the Icon Directory Location</a><br />
|
|
31
|
+
<a href="#addingIcons">Adding Icons</a><br />
|
|
32
|
+
<a href="#updatingIconDirectoryPath">Updating the Icon Directory Path</a><br />
|
|
33
|
+
|
|
34
|
+
<h6 class="mt">JavaScript Reference</h6>
|
|
35
|
+
<a href="#constructor">Constructor</a><br />
|
|
36
|
+
<a href="#requirements">Requirements</a><br />
|
|
37
|
+
<a href="#attributes">Attributes</a><br />
|
|
38
|
+
<a href="#properties">Properties</a><br />
|
|
39
|
+
<a href="#methods">Methods</a><br />
|
|
40
|
+
</div>
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
44
|
+
<p>Create an icon using the <code>k-icon</code> component. You can specify the icon by setting the <code>name</code> or <code>src</code> attribute.</p>
|
|
45
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"folder"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/path/to/icon.svg"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
46
|
+
<div class="row -mx mb">
|
|
47
|
+
<div class="col d-span-6 m-span-12 px">
|
|
48
|
+
<k-icon name="folder"></k-icon>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="col d-span-6 m-span-12 px">
|
|
51
|
+
<k-icon src="/path/to/icon.svg"></k-icon>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
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-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"menu"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"close"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"play"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"pause"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</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-icon name="menu"></k-icon>
|
|
64
|
+
<k-icon name="close"></k-icon>
|
|
65
|
+
<k-icon name="play"></k-icon>
|
|
66
|
+
<k-icon name="pause"></k-icon>
|
|
67
|
+
</k-card>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<h3 id="explicitSource"><a href="#explicitSource" class="no-link">Explicitly Set the Source</a></h3>
|
|
72
|
+
<p>You can use any svg file that is publically available (on your site or any other public domain) buy using the <code>src</code> attribute instead of <code>name</code>. The code will attempt to ensure compatability.</p>
|
|
73
|
+
<div class="row -mx mb">
|
|
74
|
+
<div class="col d-span-6 m-span-12 px">
|
|
75
|
+
<k-card label="HTML">
|
|
76
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/wysiwyg/default/24px.svg"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
77
|
+
</k-card>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="col d-span-6 m-span-12 px">
|
|
80
|
+
<k-card label="Output*">
|
|
81
|
+
<k-icon src="https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/wysiwyg/default/24px.svg"></k-icon>
|
|
82
|
+
</k-card>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<h3 id="fallbackIcon"><a href="#fallbackIcon" class="no-link">Fallback Icon</a></h3>
|
|
87
|
+
<p>Put an SVG inside of the <code>k-icon</code> to be the fallback if one is not found that matches the provided name or source. Otherwise a <k-icon></k-icon> will be the fallback icon.</p>
|
|
88
|
+
<div class="row -mx mb">
|
|
89
|
+
<div class="col d-span-6 m-span-12 px">
|
|
90
|
+
<k-card label="HTML">
|
|
91
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"invalid"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"invalid"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">svg</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 -960 960 960"</span>></span><span class="hljs-tag"><<span class="hljs-name">path</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"currentColor"</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M240-280h200v-80H240v80Zm400 0h80v-80h-80v80ZM240-440h200v-80H240v80Zm400 0h80v-240h-80v240ZM240-600h200v-80H240v80Zm-80 480q-33 0-56.5-23.5T80-200v-560q0-33 23.5-56.5T160-840h640q33 0 56.5 23.5T880-760v560q0 33-23.5 56.5T800-120H160Zm0-80h640v-560H160v560Zm0 0v-560 560Z"</span>/></span><span class="hljs-tag"></<span class="hljs-name">svg</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
92
|
+
</k-card>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="col d-span-6 m-span-12 px">
|
|
95
|
+
<k-card label="Output*">
|
|
96
|
+
<k-icon name="invalid"></k-icon>
|
|
97
|
+
<k-icon name="invalid">
|
|
98
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M240-280h200v-80H240v80Zm400 0h80v-80h-80v80ZM240-440h200v-80H240v80Zm400 0h80v-240h-80v240ZM240-600h200v-80H240v80Zm-80 480q-33 0-56.5-23.5T80-200v-560q0-33 23.5-56.5T160-840h640q33 0 56.5 23.5T880-760v560q0 33-23.5 56.5T800-120H160Zm0-80h640v-560H160v560Zm0 0v-560 560Z"/></svg>
|
|
99
|
+
</k-icon>
|
|
100
|
+
</k-card>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<h3 id="changingIconDirectory"><a href="#changingIconDirectory" class="no-link">Changing the Icon Directory Location</a></h3>
|
|
105
|
+
<p>To change the location of the directory holding the icons import the <code>Icon</code> class, and set the static member <code>pathToIcons</code> to point to the correct location, do this before icons are loaded (for example in the head of the document).</p>
|
|
106
|
+
<pre><code class="hljs xml"><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> Icon <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Icon.js'</span>;<br /> Icon.pathToIcons = <span class="hljs-string">'./pathTo/icons'</span>;<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
107
|
+
|
|
108
|
+
<h3 id="addingIcons"><a href="#addingIcons" class="no-link">Adding Icons</a></h3>
|
|
109
|
+
<p>Add your SVGs to the directory, remove the <code>height</code> and <code>width</code> attributes from the <code>svg</code> tag (if you do not, the Icon component will attempt to do it for you). The height and width will be managed by CSS to match the font-size. Give all objects (path, rect, circle) a fill of <code>currentColor</code>, this will allow the icon to adapt to the font color where it is rendered.</p>
|
|
110
|
+
<div class="row -mx mb">
|
|
111
|
+
<div class="col d-span-6 m-span-12 px">
|
|
112
|
+
<k-card label="Before">
|
|
113
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">svg</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 -960 960 960"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"24"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"24"</span>></span><span class="hljs-tag"><<span class="hljs-name">path</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M480-200 240-440l56-56 184 183 184-183 56 56-240 240Zm0-240L240-680l56-56 184 183 184-183 56 56-240 240Z"</span>/></span><span class="hljs-tag"></<span class="hljs-name">svg</span>></span></code></pre>
|
|
114
|
+
</k-card>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="col d-span-6 m-span-12 px">
|
|
117
|
+
<k-card label="After">
|
|
118
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">svg</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 -960 960 960"</span>></span><span class="hljs-tag"><<span class="hljs-name">path</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"currentColor"</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M480-200 240-440l56-56 184 183 184-183 56 56-240 240Zm0-240L240-680l56-56 184 183 184-183 56 56-240 240Z"</span>/></span><span class="hljs-tag"></<span class="hljs-name">svg</span>></span></code></pre>
|
|
119
|
+
</k-card>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<h3 id="updatingIconDirectoryPath"><a href="#updatingIconDirectoryPath" class="no-link">Updating the Icon Directory Path</a></h3>
|
|
124
|
+
<p>To change the location of the directory holding the icons, import the <code>Icon</code> class, and set the static member <code>pathToIcons</code> to point to the correct location. Do this before icons are loaded (for example, in the head of the document).</p>
|
|
125
|
+
<pre><code class="hljs xml"><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> Icon <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Icon.js'</span>;<br /> Icon.pathToIcons = [<span class="hljs-string">'./pathTo/icons'</span>];<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
126
|
+
|
|
127
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
128
|
+
|
|
129
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
130
|
+
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
131
|
+
<h5>
|
|
132
|
+
<code>new Icon()</code><br />
|
|
133
|
+
<code>new Icon(<i>string</i> name)</code>
|
|
134
|
+
</h5>
|
|
135
|
+
|
|
136
|
+
<h4>Parameters</h4>
|
|
137
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
138
|
+
<p>The name of the icon.</p>
|
|
139
|
+
|
|
140
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
141
|
+
<ul>
|
|
142
|
+
<li><a href="./component.html">Component</a></li>
|
|
143
|
+
</ul>
|
|
144
|
+
|
|
145
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
146
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
147
|
+
<p>The name of the icon.</p>
|
|
148
|
+
<h5><code>src<i>: string</i></code></h5>
|
|
149
|
+
<p>The source URL of the icon.</p>
|
|
150
|
+
|
|
151
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
152
|
+
<h5><code>pathToIcons<i>: Array</i></code></h5>
|
|
153
|
+
<p>An array of paths to directories containing icons.</p>
|
|
154
|
+
|
|
155
|
+
</main>
|
|
156
|
+
<div style="height:33vh"></div>
|
|
157
|
+
<script type="module" src="../src/components/Import.js"></script>
|
|
158
|
+
<script type="module" src="../src/components/Card.js"></script>
|
|
159
|
+
<script type="module" src="../src/components/Icon.js"></script>
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|