kempo-ui 0.3.5 → 0.3.7
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/AGENTS.md +2 -1
- package/dist/components/Aside.js +1 -1
- package/dist/components/Main.js +1 -1
- package/docs/components/accordion.html +240 -8
- package/docs/components/aside-items.html +13 -9
- package/docs/components/aside-menu.html +13 -9
- package/docs/components/aside-push.html +11 -6
- package/docs/components/aside.html +289 -115
- package/docs/components/card.html +238 -7
- package/docs/components/color-picker.html +245 -14
- package/docs/components/content-slider.html +240 -8
- package/docs/components/context.html +241 -7
- package/docs/components/dialog.html +238 -7
- package/docs/components/dropdown.html +238 -7
- package/docs/components/filter-list.html +239 -10
- package/docs/components/focus-capture.html +241 -10
- package/docs/components/html-editor.html +266 -35
- package/docs/components/hybrid-component.html +238 -6
- package/docs/components/icon.html +239 -9
- package/docs/components/import.html +239 -8
- package/docs/components/light-component.html +239 -7
- package/docs/components/nav.html +240 -8
- package/docs/components/photo-viewer.html +239 -9
- package/docs/components/resize.html +240 -9
- package/docs/components/shadow-component.html +239 -7
- package/docs/components/show-more.html +237 -8
- package/docs/components/sortable.html +239 -8
- package/docs/components/spinner.html +237 -6
- package/docs/components/split.html +241 -10
- package/docs/components/table.html +241 -11
- package/docs/components/tableControls.html +240 -7
- package/docs/components/tableCustomFields.html +241 -8
- package/docs/components/tableFetchRecords.html +239 -7
- package/docs/components/tableFieldSortHide.html +239 -7
- package/docs/components/tablePagination.html +246 -13
- package/docs/components/tablePlaceholder.html +241 -8
- package/docs/components/tableRecordEditing.html +241 -8
- package/docs/components/tableRecordFiltering.html +239 -7
- package/docs/components/tableRecordHiding.html +241 -9
- package/docs/components/tableRecordSearching.html +239 -7
- package/docs/components/tableRecordSelection.html +240 -7
- package/docs/components/tableRowControls.html +241 -8
- package/docs/components/tableServerSync.html +245 -11
- package/docs/components/tableSorting.html +239 -7
- package/docs/components/tabs.html +240 -7
- package/docs/components/tags.html +239 -7
- package/docs/components/theme-select.html +239 -7
- package/docs/components/theme-switcher.html +240 -8
- package/docs/components/timestamp.html +239 -8
- package/docs/components/toast.html +240 -8
- package/docs/components/toggle.html +240 -9
- package/docs/components/tree.html +239 -8
- package/docs/index.html +244 -6
- package/docs/prod.config.json +0 -4
- package/docs/src/components/Aside.js +1 -1
- package/docs/src/components/Main.js +1 -1
- package/docs/utils/context.html +237 -6
- package/docs/utils/cookie.html +251 -21
- package/docs/utils/debounce.html +236 -5
- package/docs/utils/drag.html +236 -5
- package/docs/utils/elevation.html +238 -6
- package/docs/utils/formatTimestamp.html +239 -9
- package/docs/utils/object.html +236 -5
- package/docs/utils/propConverters.html +233 -3
- package/docs/utils/string.html +236 -5
- package/docs/utils/theme.html +237 -6
- package/docs/utils/toTitleCase.html +239 -9
- package/docs/utils/type.html +236 -5
- package/docs/utils/wait.html +236 -5
- package/docs-src/.config.js +16 -0
- package/docs-src/bare.template.html +16 -0
- package/docs-src/components/accordion.page.html +201 -0
- package/docs-src/components/aside-items.page.html +36 -0
- package/docs-src/components/aside-menu.page.html +36 -0
- package/docs-src/components/aside-push.page.html +20 -0
- package/docs-src/components/aside.page.html +494 -0
- package/docs-src/components/card.page.html +78 -0
- package/docs-src/components/color-picker.page.html +559 -0
- package/docs-src/components/content-slider.page.html +266 -0
- package/docs-src/components/context.page.html +214 -0
- package/docs-src/components/dialog.page.html +365 -0
- package/docs-src/components/dropdown.page.html +300 -0
- package/docs-src/components/filter-list.page.html +117 -0
- package/docs-src/components/focus-capture.page.html +97 -0
- package/docs-src/components/html-editor.page.html +423 -0
- package/docs-src/components/hybrid-component.page.html +96 -0
- package/docs-src/components/icon.page.html +208 -0
- package/docs-src/components/import.page.html +76 -0
- package/docs-src/components/light-component.page.html +99 -0
- package/docs-src/components/nav.page.html +106 -0
- package/docs-src/components/photo-viewer.page.html +253 -0
- package/docs-src/components/resize.page.html +161 -0
- package/docs-src/components/shadow-component.page.html +84 -0
- package/docs-src/components/show-more.page.html +113 -0
- package/docs-src/components/sortable.page.html +117 -0
- package/docs-src/components/spinner.page.html +197 -0
- package/docs-src/components/split.page.html +195 -0
- package/docs-src/components/table.page.html +283 -0
- package/docs-src/components/tableControls.page.html +64 -0
- package/docs-src/components/tableCustomFields.page.html +124 -0
- package/docs-src/components/tableFetchRecords.page.html +95 -0
- package/docs-src/components/tableFieldSortHide.page.html +56 -0
- package/docs-src/components/tablePagination.page.html +85 -0
- package/docs-src/components/tablePlaceholder.page.html +73 -0
- package/docs-src/components/tableRecordEditing.page.html +161 -0
- package/docs-src/components/tableRecordFiltering.page.html +69 -0
- package/docs-src/components/tableRecordHiding.page.html +65 -0
- package/docs-src/components/tableRecordSearching.page.html +56 -0
- package/docs-src/components/tableRecordSelection.page.html +60 -0
- package/docs-src/components/tableRowControls.page.html +62 -0
- package/docs-src/components/tableServerSync.page.html +129 -0
- package/docs-src/components/tableSorting.page.html +54 -0
- package/docs-src/components/tabs.page.html +201 -0
- package/docs-src/components/tags.page.html +157 -0
- package/docs-src/components/theme-select.page.html +106 -0
- package/docs-src/components/theme-switcher.page.html +122 -0
- package/docs-src/components/timestamp.page.html +109 -0
- package/docs-src/components/toast.page.html +338 -0
- package/docs-src/components/toggle.page.html +177 -0
- package/docs-src/components/tree.page.html +356 -0
- package/docs-src/default.template.html +28 -0
- package/docs-src/index.page.html +312 -0
- package/docs-src/nav.fragment.html +228 -0
- package/docs-src/utils/context.page.html +143 -0
- package/docs-src/utils/cookie.page.html +128 -0
- package/docs-src/utils/debounce.page.html +42 -0
- package/docs-src/utils/drag.page.html +64 -0
- package/docs-src/utils/elevation.page.html +144 -0
- package/docs-src/utils/formatTimestamp.page.html +76 -0
- package/docs-src/utils/object.page.html +76 -0
- package/docs-src/utils/propConverters.page.html +73 -0
- package/docs-src/utils/string.page.html +66 -0
- package/docs-src/utils/theme.page.html +136 -0
- package/docs-src/utils/toTitleCase.page.html +52 -0
- package/docs-src/utils/type.page.html +31 -0
- package/docs-src/utils/wait.page.html +31 -0
- package/package.json +4 -4
- package/scripts/build.js +5 -0
- package/scripts/docs.js +5 -52
- package/src/components/Aside.js +12 -1
- package/src/components/Main.js +1 -1
- package/tests/components/Aside.browser-test.js +75 -0
- package/docs/dev.config.json +0 -20
- package/docs/nav-1.inc.html +0 -168
- package/docs/nav.inc.html +0 -168
- package/docs/nav.inc.js +0 -70
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<page pageName="Icon" title="Icon - Components - Kempo Docs - A Web Components Solution">
|
|
2
|
+
<content>
|
|
3
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
4
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
5
|
+
<k-accordion-panel name="toc-panel">
|
|
6
|
+
<div class="m ">
|
|
7
|
+
<h6>Examples</h6>
|
|
8
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
9
|
+
<a href="#rotation">Rotation and Direction</a><br />
|
|
10
|
+
<a href="#animation">Animation</a><br />
|
|
11
|
+
<a href="#explicitSource">Explicitly Set the Source</a><br />
|
|
12
|
+
<a href="#fallbackIcon">Fallback Icon</a><br />
|
|
13
|
+
<a href="#changingIconDirectory">Changing the Icon Directory Location</a><br />
|
|
14
|
+
<a href="#cliTool">Adding Icons with the CLI</a><br />
|
|
15
|
+
<a href="#addingIcons">Adding Icons Manually</a><br />
|
|
16
|
+
|
|
17
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
18
|
+
<a href="#constructor">Constructor</a><br />
|
|
19
|
+
<a href="#requirements">Requirements</a><br />
|
|
20
|
+
<a href="#properties">Properties</a><br />
|
|
21
|
+
</div>
|
|
22
|
+
</k-accordion-panel>
|
|
23
|
+
</k-accordion>
|
|
24
|
+
|
|
25
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
26
|
+
<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>
|
|
27
|
+
<div class="row -mx mb">
|
|
28
|
+
<div class="col d-span-6 m-span-12 px">
|
|
29
|
+
<k-card label="HTML">
|
|
30
|
+
<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>
|
|
31
|
+
</k-card>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="col d-span-6 m-span-12 px">
|
|
34
|
+
<k-card label="Results">
|
|
35
|
+
<k-icon name="folder"></k-icon>
|
|
36
|
+
<k-icon src="/path/to/icon.svg"></k-icon>
|
|
37
|
+
</k-card>
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="row -mx mb">
|
|
43
|
+
<div class="col d-span-6 m-span-12 px">
|
|
44
|
+
<k-card label="HTML">
|
|
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">"arrow"</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">"arrow-line"</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">"arrow-circle"</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">"chevron"</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">"chevron-double"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
46
|
+
</k-card>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="col d-span-6 m-span-12 px">
|
|
49
|
+
<k-card label="Results">
|
|
50
|
+
<k-icon name="arrow"></k-icon>
|
|
51
|
+
<k-icon name="arrow-line"></k-icon>
|
|
52
|
+
<k-icon name="arrow-circle"></k-icon>
|
|
53
|
+
<k-icon name="chevron"></k-icon>
|
|
54
|
+
<k-icon name="chevron-double"></k-icon>
|
|
55
|
+
</k-card>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<h3 id="rotation"><a href="#rotation" class="no-link">Rotation and Direction</a></h3>
|
|
60
|
+
<p>Use the <code>rotation</code> attribute to rotate an icon by a specific degree value, or use the <code>direction</code> attribute for semantic rotation (down=90°, left=180°, up=270°). Only set one attribute at a time.</p>
|
|
61
|
+
<div class="row -mx mb">
|
|
62
|
+
<div class="col d-span-6 m-span-12 px">
|
|
63
|
+
<k-card label="HTML">
|
|
64
|
+
<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">"arrow"</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">"arrow"</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"down"</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">"arrow"</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"left"</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">"arrow"</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"up"</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">"chevron"</span> <span class="hljs-attr">rotation</span>=<span class="hljs-string">"45"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
65
|
+
</k-card>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="col d-span-6 m-span-12 px">
|
|
68
|
+
<k-card label="Results">
|
|
69
|
+
<k-icon name="arrow"></k-icon>
|
|
70
|
+
<k-icon name="arrow" direction="down"></k-icon>
|
|
71
|
+
<k-icon name="arrow" direction="left"></k-icon>
|
|
72
|
+
<k-icon name="arrow" direction="up"></k-icon>
|
|
73
|
+
<k-icon name="chevron" rotation="45"></k-icon>
|
|
74
|
+
</k-card>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<h3 id="animation"><a href="#animation" class="no-link">Animation</a></h3>
|
|
79
|
+
<p>Use the <code>animation</code> attribute to add built-in animations to icons. Available options are <code>spin</code>, <code>blink</code>, and <code>pulse</code>.</p>
|
|
80
|
+
<div class="row -mx mb">
|
|
81
|
+
<div class="col d-span-6 m-span-12 px">
|
|
82
|
+
<k-card label="HTML">
|
|
83
|
+
<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">"arrow-circle"</span> <span class="hljs-attr">animation</span>=<span class="hljs-string">"spin"</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">"arrow"</span> <span class="hljs-attr">animation</span>=<span class="hljs-string">"blink"</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">"chevron"</span> <span class="hljs-attr">animation</span>=<span class="hljs-string">"pulse"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
84
|
+
</k-card>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="col d-span-6 m-span-12 px">
|
|
87
|
+
<k-card label="Results">
|
|
88
|
+
<k-icon name="arrow-circle" animation="spin"></k-icon>
|
|
89
|
+
<k-icon name="arrow" animation="blink"></k-icon>
|
|
90
|
+
<k-icon name="chevron" animation="pulse"></k-icon>
|
|
91
|
+
</k-card>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<h3 id="explicitSource"><a href="#explicitSource" class="no-link">Explicitly Set the Source</a></h3>
|
|
96
|
+
<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>
|
|
97
|
+
<div class="row -mx mb">
|
|
98
|
+
<div class="col d-span-6 m-span-12 px">
|
|
99
|
+
<k-card label="HTML">
|
|
100
|
+
<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">"wysiwyg"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span></code></pre>
|
|
101
|
+
</k-card>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="col d-span-6 m-span-12 px">
|
|
104
|
+
<k-card label="Results">
|
|
105
|
+
<k-icon name="wysiwyg"></k-icon>
|
|
106
|
+
</k-card>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<h3 id="fallbackIcon"><a href="#fallbackIcon" class="no-link">Fallback Icon</a></h3>
|
|
111
|
+
<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>
|
|
112
|
+
<div class="row -mx mb">
|
|
113
|
+
<div class="col d-span-6 m-span-12 px">
|
|
114
|
+
<k-card label="HTML">
|
|
115
|
+
<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>
|
|
116
|
+
</k-card>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="col d-span-6 m-span-12 px">
|
|
119
|
+
<k-card label="Results">
|
|
120
|
+
<k-icon name="invalid"></k-icon>
|
|
121
|
+
<k-icon name="invalid">
|
|
122
|
+
<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>
|
|
123
|
+
</k-icon>
|
|
124
|
+
</k-card>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<p>You can also set a global fallback icon that will be used for all icons when no icon is found and no slotted content is provided:</p>
|
|
129
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="javascript"><br /> window.kempo = {<br /> fallbackIcon: <span class="hljs-string">`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"/></svg>`</span><br /> };<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
130
|
+
|
|
131
|
+
<h3 id="changingIconDirectory"><a href="#changingIconDirectory" class="no-link">Changing the Icon Directory Location</a></h3>
|
|
132
|
+
<p>To change the location of the directory holding the icons, set the global <code>kempo.pathsToIcons</code> config before any components are loaded (for example in the head of the document). An array of paths is accepted — directories are checked in order and the first match is used, allowing you to override built-in icons or add your own alongside them.</p>
|
|
133
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="javascript"><br /> window.kempo = {<br /> pathsToIcons: [<span class="hljs-string">'./my-icons'</span>, <span class="hljs-string">'./node_modules/kempo-ui/icons'</span>]<br /> };<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
134
|
+
|
|
135
|
+
<h3 id="cliTool"><a href="#cliTool" class="no-link">Adding Icons with the CLI</a></h3>
|
|
136
|
+
<p>kempo-ui ships CLI tools for searching and downloading icons from the <a href="https://fonts.google.com/icons" target="_blank">Google Material Symbols</a> library. They are available via <code>npx</code> after installing kempo-ui.</p>
|
|
137
|
+
<p>Use the interactive picker to search and download in one step — type to filter, arrow keys to navigate, Enter to select:</p>
|
|
138
|
+
<pre><code class="hljs bash">npx kempo-icon</code></pre>
|
|
139
|
+
<p>Or use the individual commands for scripting:</p>
|
|
140
|
+
<pre><code class="hljs bash"># Search by name or tag
|
|
141
|
+
npx kempo-listicons chevron
|
|
142
|
+
|
|
143
|
+
# Download by name (saves to icons/ by default)
|
|
144
|
+
npx kempo-geticon chevron_right
|
|
145
|
+
|
|
146
|
+
# Download with a custom name
|
|
147
|
+
npx kempo-geticon content_copy copy
|
|
148
|
+
|
|
149
|
+
# Save to a custom directory
|
|
150
|
+
npx kempo-geticon format_bold --dir src/assets/icons
|
|
151
|
+
|
|
152
|
+
# Auto-accept directional icon prompt
|
|
153
|
+
npx kempo-geticon chevron_left -y</code></pre>
|
|
154
|
+
<p>Directional icons (those with <code>_left</code>, <code>_up</code>, <code>_down</code> etc. variants) are handled automatically — the CLI downloads the right-facing version and names it without the direction suffix. Use the <code>direction</code> attribute on <code><k-icon></code> to rotate it.</p>
|
|
155
|
+
|
|
156
|
+
<h3 id="addingIcons"><a href="#addingIcons" class="no-link">Adding Icons Manually</a></h3>
|
|
157
|
+
<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>
|
|
158
|
+
<div class="row -mx mb">
|
|
159
|
+
<div class="col d-span-6 m-span-12 px">
|
|
160
|
+
<k-card label="Before">
|
|
161
|
+
<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>
|
|
162
|
+
</k-card>
|
|
163
|
+
</div>
|
|
164
|
+
<div class="col d-span-6 m-span-12 px">
|
|
165
|
+
<k-card label="After">
|
|
166
|
+
<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>
|
|
167
|
+
</k-card>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
172
|
+
|
|
173
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
174
|
+
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
175
|
+
<h5>
|
|
176
|
+
<code>new Icon()</code><br />
|
|
177
|
+
<code>new Icon(<i>string</i> name)</code>
|
|
178
|
+
</h5>
|
|
179
|
+
|
|
180
|
+
<h4>Parameters</h4>
|
|
181
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
182
|
+
<p>The name of the icon.</p>
|
|
183
|
+
|
|
184
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
185
|
+
<ul>
|
|
186
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
187
|
+
</ul>
|
|
188
|
+
|
|
189
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
190
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
191
|
+
<p>The name of the icon. Syncs with the <code>name</code> attribute.</p>
|
|
192
|
+
<h5><code>src<i>: string</i></code></h5>
|
|
193
|
+
<p>The source URL of the icon. Syncs with the <code>src</code> attribute.</p>
|
|
194
|
+
<h5><code>rotation<i>: string</i></code></h5>
|
|
195
|
+
<p>The rotation angle in degrees (e.g., "45" or "180"). Syncs with the <code>rotation</code> attribute. Do not use with <code>direction</code>.</p>
|
|
196
|
+
<h5><code>direction<i>: string</i></code></h5>
|
|
197
|
+
<p>Semantic direction for icon rotation. Options: "down" (90°), "left" (180°), "up" (270°). Syncs with the <code>direction</code> attribute. Do not use with <code>rotation</code>.</p>
|
|
198
|
+
<h5><code>animation<i>: string</i></code></h5>
|
|
199
|
+
<p>Built-in animation to apply. Options: "spin" (continuous rotation), "blink" (fade in/out), "pulse" (scale up/down). Syncs with the <code>animation</code> attribute.</p>
|
|
200
|
+
<h5><code>pathsToIcons<i>: Array</i></code></h5>
|
|
201
|
+
<p>An array of paths to directories containing icons. This is configured via the global <code>window.kempo.pathsToIcons</code> config object. Directories are checked in order — the first match wins.</p>
|
|
202
|
+
</content>
|
|
203
|
+
<content location="scripts">
|
|
204
|
+
<script type="module" src="{{pathToRoot}}src/components/Icon.js"></script>
|
|
205
|
+
<script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
|
|
206
|
+
<script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
|
|
207
|
+
</content>
|
|
208
|
+
</page>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<page pageName="Import" title="Import - Components - Kempo Docs - A Web Components Solution">
|
|
2
|
+
<content>
|
|
3
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
4
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
5
|
+
<k-accordion-panel name="toc-panel">
|
|
6
|
+
<div class="m ">
|
|
7
|
+
<h6>Examples</h6>
|
|
8
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
9
|
+
|
|
10
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
11
|
+
<a href="#constructor">Constructor</a><br />
|
|
12
|
+
<a href="#requirements">Requirements</a><br />
|
|
13
|
+
<a href="#properties">Properties</a><br />
|
|
14
|
+
<a href="#methods">Methods</a><br />
|
|
15
|
+
<a href="#events">Events</a><br />
|
|
16
|
+
</div>
|
|
17
|
+
</k-accordion-panel>
|
|
18
|
+
</k-accordion>
|
|
19
|
+
|
|
20
|
+
<h3 class="basicUsage">Basic Usage</h3>
|
|
21
|
+
<p>Import an external HTML snippets.</p>
|
|
22
|
+
<div class="row -mx mb">
|
|
23
|
+
<div class="col d-span-6 m-span-12 px">
|
|
24
|
+
<k-card label="import-me.html">
|
|
25
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">p</span>></span>I am html<span class="hljs-tag"></<span class="hljs-name">p</span>></span></code></pre>
|
|
26
|
+
</k-card>
|
|
27
|
+
<k-card label="HTML">
|
|
28
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-import</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"import-me.html"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-import</span>></span></code></pre>
|
|
29
|
+
</k-card>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="col d-span-6 m-span-12 px">
|
|
32
|
+
<k-card label="Results">
|
|
33
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-import</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"import-me.html"</span> <span class="hljs-attr">rendered</span>=<span class="hljs-string">"true"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span>></span>I am html<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-import</span>></span></code></pre>
|
|
34
|
+
</k-card>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
39
|
+
|
|
40
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
41
|
+
<h6>Extends <a href="./component.html">Component</a></h6>
|
|
42
|
+
<h5>
|
|
43
|
+
<code>new Import()</code>
|
|
44
|
+
</h5>
|
|
45
|
+
|
|
46
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
47
|
+
<ul>
|
|
48
|
+
<li><a href="./component.html">Component</a></li>
|
|
49
|
+
</ul>
|
|
50
|
+
|
|
51
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
52
|
+
<h5><code>src<i>: string</i></code></h5>
|
|
53
|
+
<p>The source URL of the HTML snippet to import. Syncs to <code>src</code> attribute.</p>
|
|
54
|
+
|
|
55
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
56
|
+
<h5><code>fetch()<i>: Promise</i></code></h5>
|
|
57
|
+
<p>Fetches and renders the HTML snippet from the current <code>src</code> URL. Called automatically when <code>src</code> changes.</p>
|
|
58
|
+
|
|
59
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
60
|
+
<h5><code>src-change</code></h5>
|
|
61
|
+
<p>Fired when the <code>src</code> property changes. <code>detail: { src }</code></p>
|
|
62
|
+
<h5><code>fetch-start</code></h5>
|
|
63
|
+
<p>Fired when the HTTP fetch begins. <code>detail: { src }</code></p>
|
|
64
|
+
<h5><code>fetch-response</code></h5>
|
|
65
|
+
<p>Fired when the HTTP response is received. <code>detail: { src, status }</code></p>
|
|
66
|
+
<h5><code>content-rendered</code></h5>
|
|
67
|
+
<p>Fired after the HTML content has been injected into the DOM and all inline scripts have been executed.</p>
|
|
68
|
+
<k-card label="JavaScript">
|
|
69
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">const</span> importer = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">'k-import'</span>);<br>importer.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'src-change'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'src set:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">src</span>));<br>importer.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'fetch-start'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'fetching:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">src</span>));<br>importer.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'fetch-response'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'response status:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">status</span>));<br>importer.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'content-rendered'</span>, <span class="hljs-function">() =></span> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'content ready'</span>));</code></pre>
|
|
70
|
+
</k-card>
|
|
71
|
+
</content>
|
|
72
|
+
<content location="scripts">
|
|
73
|
+
<script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
|
|
74
|
+
<script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
|
|
75
|
+
</content>
|
|
76
|
+
</page>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<page pageName="LightComponent" title="LightComponent - Base Components - Kempo Docs - A Web Components Solution">
|
|
2
|
+
<content>
|
|
3
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
4
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
5
|
+
<k-accordion-panel name="toc-panel">
|
|
6
|
+
<div class="m ">
|
|
7
|
+
<h6>Guide</h6>
|
|
8
|
+
<a href="#overview">Overview</a><br />
|
|
9
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
10
|
+
<a href="#whenToUse">When to Use</a><br />
|
|
11
|
+
|
|
12
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
13
|
+
<a href="#constructor">Constructor</a><br />
|
|
14
|
+
<a href="#requirements">Requirements</a><br />
|
|
15
|
+
<a href="#properties">Properties</a><br />
|
|
16
|
+
<a href="#methods">Methods</a><br />
|
|
17
|
+
</div>
|
|
18
|
+
</k-accordion-panel>
|
|
19
|
+
</k-accordion>
|
|
20
|
+
|
|
21
|
+
<h3 id="overview"><a href="#overview" class="no-link">Overview</a></h3>
|
|
22
|
+
<p>LightComponent is a base class that extends LitElement and renders directly to the light DOM instead of shadow
|
|
23
|
+
DOM. Use this when you want your component to:</p>
|
|
24
|
+
<ul>
|
|
25
|
+
<li>Render content in the light DOM (no shadow DOM encapsulation)</li>
|
|
26
|
+
<li>Allow global CSS to style component content</li>
|
|
27
|
+
<li>Interact naturally with parent page styles</li>
|
|
28
|
+
<li>Support natural children alongside rendered content</li>
|
|
29
|
+
</ul>
|
|
30
|
+
<p>Components like <a href="persistant-collapsible.html">PersistantCollapsible</a> and <a
|
|
31
|
+
href="theme-switcher.html">ThemeSwitcher</a> extend LightComponent.</p>
|
|
32
|
+
|
|
33
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
34
|
+
<p>Create a custom component by extending LightComponent and implementing <code>renderLightDom()</code>:</p>
|
|
35
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">import</span> LightComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'./LightComponent.js'</span>;<br /><span class="hljs-keyword">import</span> { html } <span class="hljs-keyword">from</span> <span class="hljs-string">'../lit-all.min.js'</span>;<br /><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyLightComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title class_">LightComponent</span> {<br /> <span class="hljs-keyword">static</span> properties = {<br /> <span class="hljs-attr">message</span>: { <span class="hljs-attr">type</span>: <span class="hljs-title class_">String</span> }<br /> };<br /><br /> <span class="hljs-title function_">constructor</span>() {<br /> <span class="hljs-variable language_">super</span>();<br /> <span class="hljs-variable language_">this</span>.message = <span class="hljs-string">'Hello'</span>;<br /> }<br /><br /> <span class="hljs-title function_">renderLightDom</span>() {<br /> <span class="hljs-keyword">return</span> html<span class="hljs-string">`<br /> <div class="card p"><br /> <p><span class="hljs-subst">${<span class="hljs-variable language_">this</span>.message}</span> from Light DOM!</p><br /> </div><br /> `</span>;<br /> }<br />}<br /><br /><span class="hljs-variable language_">customElements</span>.<span class="hljs-title function_">define</span>(<span class="hljs-string">'my-light-component'</span>, MyLightComponent);</code></pre>
|
|
36
|
+
|
|
37
|
+
<p><strong>Important:</strong> Always call <code>super.updated()</code> when overriding the <code>updated()</code>
|
|
38
|
+
lifecycle method:</p>
|
|
39
|
+
<pre><code class="hljs javascript"><span class="hljs-title function_">updated</span>(changedProperties) {<br /> <span class="hljs-variable language_">super</span>.<span class="hljs-title function_">updated</span>(); <span class="hljs-comment">// Required!</span><br /> <br /> <span class="hljs-comment">// Your custom logic here</span><br /> <span class="hljs-keyword">if</span>(changedProperties.<span class="hljs-title function_">has</span>(<span class="hljs-string">'message'</span>)) {<br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Message changed'</span>);<br /> }<br />}</code></pre>
|
|
40
|
+
|
|
41
|
+
<h3 id="whenToUse"><a href="#whenToUse" class="no-link">When to Use</a></h3>
|
|
42
|
+
<p>Use LightComponent when:</p>
|
|
43
|
+
<ul>
|
|
44
|
+
<li>You want global page styles to apply to your component</li>
|
|
45
|
+
<li>You need to render alongside natural children</li>
|
|
46
|
+
<li>Shadow DOM encapsulation would interfere with your component's purpose</li>
|
|
47
|
+
<li>You're working with third-party libraries that expect light DOM</li>
|
|
48
|
+
</ul>
|
|
49
|
+
<p>Use <a href="./components/shadow-component.html">ShadowComponent</a> instead when you need style encapsulation and scoped CSS.
|
|
50
|
+
</p>
|
|
51
|
+
<p>Use <a href="./components/hybrid-component.html">HybridComponent</a> when you need both shadow DOM styles and light DOM
|
|
52
|
+
rendering.</p>
|
|
53
|
+
|
|
54
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
55
|
+
|
|
56
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
57
|
+
<h6>Extends LitElement</h6>
|
|
58
|
+
<h5><code>new LightComponent()</code></h5>
|
|
59
|
+
<p>Creates a new LightComponent instance that renders to the light DOM.</p>
|
|
60
|
+
|
|
61
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
62
|
+
<ul>
|
|
63
|
+
<li>Lit (LitElement, html, render)</li>
|
|
64
|
+
</ul>
|
|
65
|
+
|
|
66
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
67
|
+
<h5><code>lightRoot<i>: HTMLElement</i></code></h5>
|
|
68
|
+
<p>A container element with <code>display: contents</code> that holds the rendered light DOM content. Created
|
|
69
|
+
automatically by <code>createRenderRoot()</code>.</p>
|
|
70
|
+
|
|
71
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
72
|
+
<h5><code>createRenderRoot()<i>: Element</i></code></h5>
|
|
73
|
+
<p>Creates the light DOM render container instead of shadow DOM. This method:</p>
|
|
74
|
+
<ul>
|
|
75
|
+
<li>Creates a <code>div</code> with <code>display: contents</code> for layout transparency</li>
|
|
76
|
+
<li>Appends it to the component as <code>lightRoot</code></li>
|
|
77
|
+
<li>Returns <code>this</code> instead of a shadow root</li>
|
|
78
|
+
</ul>
|
|
79
|
+
|
|
80
|
+
<h5><code>updated()<i>: void</i></code></h5>
|
|
81
|
+
<p>Called automatically by Lit when the component updates. Renders the result of <code>renderLightDom()</code> into
|
|
82
|
+
<code>lightRoot</code>. Override this method if needed, but always call <code>super.updated()</code>.</p>
|
|
83
|
+
|
|
84
|
+
<h5><code>childrenUpdated()<i>: void</i></code></h5>
|
|
85
|
+
<p>A custom lifecycle callback that is automatically triggered whenever a child element is added or removed from the
|
|
86
|
+
component. After this callback returns, <code>requestUpdate()</code> is automatically called to trigger a
|
|
87
|
+
re-render.</p>
|
|
88
|
+
<p>Override this method to react to child changes:</p>
|
|
89
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title class_">LightComponent</span> {<br /> <span class="hljs-title function_">childrenUpdated</span>() {<br /> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Children changed!'</span>);<br /> <span class="hljs-variable language_">this</span>.validateChildren();<br /> }<br />}</code></pre>
|
|
90
|
+
|
|
91
|
+
<h5><code>renderLightDom()<i>: TemplateResult</i></code></h5>
|
|
92
|
+
<p>Override this method to define what should be rendered to the light DOM. Returns an empty template by default.
|
|
93
|
+
Use Lit's <code>html</code> tagged template literal to return your content.</p>
|
|
94
|
+
</content>
|
|
95
|
+
<content location="scripts">
|
|
96
|
+
<script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
|
|
97
|
+
<script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
|
|
98
|
+
</content>
|
|
99
|
+
</page>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<page pageName="Nav" title="Nav - Kempo UI">
|
|
2
|
+
<content location="header"></content>
|
|
3
|
+
<content>
|
|
4
|
+
|
|
5
|
+
<h1>Nav</h1>
|
|
6
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
7
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
8
|
+
<k-accordion-panel name="toc-panel">
|
|
9
|
+
<div class="m">
|
|
10
|
+
<h6>Examples</h6>
|
|
11
|
+
<a href="#fixedNav">Fixed Navbar</a><br />
|
|
12
|
+
<a href="#inlineNav">Inline Navbar</a><br />
|
|
13
|
+
<h6>Reference</h6>
|
|
14
|
+
<a href="#attributes">Attributes & Properties</a><br />
|
|
15
|
+
<a href="#slots">Slots</a><br />
|
|
16
|
+
</div>
|
|
17
|
+
</k-accordion-panel>
|
|
18
|
+
</k-accordion>
|
|
19
|
+
|
|
20
|
+
<p>
|
|
21
|
+
A semantic navigation bar component. When <code>fixed</code> is set, it automatically positions itself at the
|
|
22
|
+
top of the viewport and applies elevation level 5 (<code>z-index: 50</code>), keeping it above push-mode
|
|
23
|
+
drawers and below overlay-mode drawers — no manual <code>z-index</code> needed.
|
|
24
|
+
</p>
|
|
25
|
+
<p>
|
|
26
|
+
Content is placed via a default slot. Apply background and other visual styles with kempo-css utility classes
|
|
27
|
+
directly on the element.
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<h2 id="fixedNav"><a href="#fixedNav" class="no-link">Fixed Navbar</a></h2>
|
|
31
|
+
<p>
|
|
32
|
+
Add the <code>fixed</code> attribute to pin the nav to the top of the viewport. Add a spacer element after it
|
|
33
|
+
so page content is not hidden beneath it.
|
|
34
|
+
</p>
|
|
35
|
+
<k-card class="mb">
|
|
36
|
+
<k-nav fixed class="bg-primary" style="position:relative;z-index:auto;">
|
|
37
|
+
<button class="link"><k-icon name="menu"></k-icon></button>
|
|
38
|
+
<a href="#fixedNav" class="d-if ph" style="align-items:center;">My App</a>
|
|
39
|
+
<div class="flex"></div>
|
|
40
|
+
<a href="#fixedNav" class="ph">Account</a>
|
|
41
|
+
</k-nav>
|
|
42
|
+
</k-card>
|
|
43
|
+
<pre><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">k-nav</span> <span class="hljs-attr">fixed</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-primary"</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">button</span>></span>Menu<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>></span>My App<span class="hljs-tag"></<span class="hljs-name">a</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"flex: 1"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/account"</span>></span>Account<span class="hljs-tag"></<span class="hljs-name">a</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-nav</span>></span><br><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 4rem;"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span></code></pre>
|
|
44
|
+
|
|
45
|
+
<h2 id="inlineNav"><a href="#inlineNav" class="no-link">Inline Navbar</a></h2>
|
|
46
|
+
<p>Without <code>fixed</code>, the nav sits in normal document flow.</p>
|
|
47
|
+
<k-card class="mb">
|
|
48
|
+
<k-nav class="bg-primary">
|
|
49
|
+
<button class="link"><k-icon name="menu"></k-icon></button>
|
|
50
|
+
<a href="#inlineNav" class="d-if ph" style="align-items:center;">My App</a>
|
|
51
|
+
<div class="flex"></div>
|
|
52
|
+
<a href="#inlineNav" class="ph">Account</a>
|
|
53
|
+
</k-nav>
|
|
54
|
+
</k-card>
|
|
55
|
+
<pre><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">k-nav</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-primary"</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">button</span>></span>Menu<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>></span>My App<span class="hljs-tag"></<span class="hljs-name">a</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"flex: 1"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/account"</span>></span>Account<span class="hljs-tag"></<span class="hljs-name">a</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-nav</span>></span></code></pre>
|
|
56
|
+
|
|
57
|
+
<h2 id="attributes"><a href="#attributes" class="no-link">Attributes & Properties</a></h2>
|
|
58
|
+
<div class="table-wrapper mb">
|
|
59
|
+
<table>
|
|
60
|
+
<thead>
|
|
61
|
+
<tr>
|
|
62
|
+
<th>Attribute / Property</th>
|
|
63
|
+
<th>Type</th>
|
|
64
|
+
<th>Default</th>
|
|
65
|
+
<th>Description</th>
|
|
66
|
+
</tr>
|
|
67
|
+
</thead>
|
|
68
|
+
<tbody>
|
|
69
|
+
<tr>
|
|
70
|
+
<td><code>fixed</code></td>
|
|
71
|
+
<td>Boolean</td>
|
|
72
|
+
<td><code>false</code></td>
|
|
73
|
+
<td>
|
|
74
|
+
Pins the nav to the top of the viewport (<code>position: fixed</code>) and applies
|
|
75
|
+
<a href="{{pathToRoot}}utils/elevation.html">elevation</a> level 5 (<code>z-index: 50</code>).
|
|
76
|
+
</td>
|
|
77
|
+
</tr>
|
|
78
|
+
</tbody>
|
|
79
|
+
</table>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<h2 id="slots"><a href="#slots" class="no-link">Slots</a></h2>
|
|
83
|
+
<div class="table-wrapper mb">
|
|
84
|
+
<table>
|
|
85
|
+
<thead>
|
|
86
|
+
<tr>
|
|
87
|
+
<th>Slot</th>
|
|
88
|
+
<th>Description</th>
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody>
|
|
92
|
+
<tr>
|
|
93
|
+
<td><em>default</em></td>
|
|
94
|
+
<td>All nav content — buttons, links, dropdowns, etc.</td>
|
|
95
|
+
</tr>
|
|
96
|
+
</tbody>
|
|
97
|
+
</table>
|
|
98
|
+
</div>
|
|
99
|
+
</content>
|
|
100
|
+
<content location="scripts">
|
|
101
|
+
<script src="{{pathToRoot}}src/components/Nav.js" type="module"></script>
|
|
102
|
+
<script src="{{pathToRoot}}src/components/Accordion.js" type="module"></script>
|
|
103
|
+
<script src="{{pathToRoot}}src/components/Card.js" type="module"></script>
|
|
104
|
+
<script src="{{pathToRoot}}src/components/Icon.js" type="module"></script>
|
|
105
|
+
</content>
|
|
106
|
+
</page>
|