kempo-ui 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/.github/workflows/publish-major.yml +39 -0
  2. package/.github/workflows/publish-minor.yml +39 -0
  3. package/.github/workflows/{publish-npm.yml → publish-patch.yml} +1 -1
  4. package/.vscode/settings.json +2 -0
  5. package/dist/kempo-hljs.css +1 -0
  6. package/dist/src/components/Accordion.js +36 -0
  7. package/dist/src/components/Card.js +37 -0
  8. package/dist/src/components/Collapsible.js +41 -0
  9. package/dist/src/components/ContentSlider.js +44 -0
  10. package/dist/src/components/Dialog.js +120 -0
  11. package/dist/src/components/Icon.js +2 -2
  12. package/dist/src/components/PersistantCollapsible.js +1 -0
  13. package/dist/src/components/PhotoViewer.js +135 -0
  14. package/dist/src/components/Resize.js +96 -0
  15. package/dist/src/components/ShadowComponent.js +1 -1
  16. package/dist/src/components/ShowMore.js +42 -0
  17. package/dist/src/components/SideMenu.js +1 -1
  18. package/dist/src/components/Sortable.js +45 -0
  19. package/dist/src/components/Split.js +84 -0
  20. package/dist/src/components/Table.js +151 -0
  21. package/dist/src/components/Tabs.js +155 -0
  22. package/dist/src/components/Tags.js +69 -0
  23. package/dist/src/components/ThemeSwitcher.js +23 -0
  24. package/dist/src/components/Timestamp.js +1 -0
  25. package/dist/src/components/Toast.js +141 -0
  26. package/dist/src/components/Toggle.js +74 -0
  27. package/dist/src/components/tableControls/DeleteRecord.js +7 -0
  28. package/dist/src/components/tableControls/Edit.js +18 -0
  29. package/dist/src/components/tableControls/ExportCSV.js +8 -0
  30. package/dist/src/components/tableControls/ExportJson.js +8 -0
  31. package/dist/src/components/tableControls/FieldSortHide.js +26 -0
  32. package/dist/src/components/tableControls/Filters.js +47 -0
  33. package/dist/src/components/tableControls/FirstPage.js +9 -0
  34. package/dist/src/components/tableControls/HiddenCount.js +3 -0
  35. package/dist/src/components/tableControls/Hide.js +5 -0
  36. package/dist/src/components/tableControls/LastPage.js +9 -0
  37. package/dist/src/components/tableControls/NextPage.js +9 -0
  38. package/dist/src/components/tableControls/PageSelect.js +22 -0
  39. package/dist/src/components/tableControls/PageSize.js +5 -0
  40. package/dist/src/components/tableControls/PrevPage.js +9 -0
  41. package/dist/src/components/tableControls/Search.js +9 -0
  42. package/dist/src/components/tableControls/ShowAll.js +5 -0
  43. package/dist/src/components/tableControls/TableControl.js +16 -0
  44. package/dist/src/utils/debounce.js +1 -0
  45. package/dist/src/utils/drag.js +1 -0
  46. package/dist/src/utils/formatTimestamp.js +1 -0
  47. package/dist/src/utils/propConverters.js +1 -0
  48. package/dist/src/utils/toTitleCase.js +1 -0
  49. package/dist/src/utils/watchWindowSize.js +1 -0
  50. package/docs/components/accordion.html +69 -25
  51. package/docs/components/card.html +6 -5
  52. package/docs/components/collapsible.html +198 -0
  53. package/docs/components/content-slider.html +56 -26
  54. package/docs/components/dialog.html +54 -48
  55. package/docs/components/focus-capture.html +59 -15
  56. package/docs/components/hybrid-component.html +112 -0
  57. package/docs/components/icon.html +5 -10
  58. package/docs/components/import.html +1 -6
  59. package/docs/components/light-component.html +99 -0
  60. package/docs/components/persistant-collapsible.html +123 -0
  61. package/docs/components/photo-viewer.html +226 -0
  62. package/docs/components/resize.html +44 -18
  63. package/docs/components/shadow-component.html +88 -0
  64. package/docs/components/show-more.html +12 -6
  65. package/docs/components/side-menu.html +3 -12
  66. package/docs/components/sortable.html +91 -55
  67. package/docs/components/split.html +26 -5
  68. package/docs/components/tablePagination.html +4 -4
  69. package/docs/components/tableRecordFiltering.html +16 -3
  70. package/docs/components/tableRecordSelection.html +2 -2
  71. package/docs/components/tabs.html +24 -7
  72. package/docs/components/tags.html +24 -8
  73. package/docs/components/theme-switcher.html +3 -6
  74. package/docs/components/timestamp.html +20 -24
  75. package/docs/components/toast.html +23 -32
  76. package/docs/components/toggle.html +4 -3
  77. package/docs/icons/error.svg +1 -1
  78. package/docs/icons/warning.svg +1 -1
  79. package/docs/index.html +197 -5
  80. package/docs/kempo-hljs.css +1 -0
  81. package/docs/kempo.min.css +1 -1
  82. package/docs/media/civic.jpg +0 -0
  83. package/docs/media/corvette.jpg +0 -0
  84. package/docs/media/evo.jpg +0 -0
  85. package/docs/media/gtr.jpg +0 -0
  86. package/docs/media/nsx.jpg +0 -0
  87. package/docs/nav.inc.html +19 -24
  88. package/docs/src/components/Accordion.js +36 -0
  89. package/docs/src/components/Card.js +37 -0
  90. package/docs/src/components/Collapsible.js +41 -0
  91. package/docs/src/components/ContentSlider.js +44 -0
  92. package/docs/src/components/Dialog.js +120 -0
  93. package/docs/src/components/Icon.js +2 -2
  94. package/docs/src/components/PersistantCollapsible.js +1 -0
  95. package/docs/src/components/PhotoViewer.js +135 -0
  96. package/docs/src/components/Resize.js +96 -0
  97. package/docs/src/components/ShadowComponent.js +1 -1
  98. package/docs/src/components/ShowMore.js +42 -0
  99. package/docs/src/components/SideMenu.js +1 -1
  100. package/docs/src/components/Sortable.js +45 -0
  101. package/docs/src/components/Split.js +84 -0
  102. package/docs/src/components/Table.js +151 -0
  103. package/docs/src/components/Tabs.js +155 -0
  104. package/docs/src/components/Tags.js +69 -0
  105. package/docs/src/components/ThemeSwitcher.js +23 -0
  106. package/docs/src/components/Timestamp.js +1 -0
  107. package/docs/src/components/Toast.js +141 -0
  108. package/docs/src/components/Toggle.js +74 -0
  109. package/docs/src/components/tableControls/DeleteRecord.js +7 -0
  110. package/docs/src/components/tableControls/Edit.js +18 -0
  111. package/docs/src/components/tableControls/ExportCSV.js +8 -0
  112. package/docs/src/components/tableControls/ExportJson.js +8 -0
  113. package/docs/src/components/tableControls/FieldSortHide.js +26 -0
  114. package/docs/src/components/tableControls/Filters.js +47 -0
  115. package/docs/src/components/tableControls/FirstPage.js +9 -0
  116. package/docs/src/components/tableControls/HiddenCount.js +3 -0
  117. package/docs/src/components/tableControls/Hide.js +5 -0
  118. package/docs/src/components/tableControls/LastPage.js +9 -0
  119. package/docs/src/components/tableControls/NextPage.js +9 -0
  120. package/docs/src/components/tableControls/PageSelect.js +22 -0
  121. package/docs/src/components/tableControls/PageSize.js +5 -0
  122. package/docs/src/components/tableControls/PrevPage.js +9 -0
  123. package/docs/src/components/tableControls/Search.js +9 -0
  124. package/docs/src/components/tableControls/ShowAll.js +5 -0
  125. package/docs/src/components/tableControls/TableControl.js +16 -0
  126. package/docs/src/utils/debounce.js +1 -0
  127. package/docs/src/utils/drag.js +1 -0
  128. package/docs/src/utils/formatTimestamp.js +1 -0
  129. package/docs/src/utils/propConverters.js +1 -0
  130. package/docs/src/utils/toTitleCase.js +1 -0
  131. package/docs/src/utils/watchWindowSize.js +1 -0
  132. package/docs/utils/debounce.html +78 -0
  133. package/docs/utils/drag.html +89 -0
  134. package/docs/utils/formatTimestamp.html +114 -0
  135. package/docs/utils/propConverters.html +132 -0
  136. package/docs/utils/toTitleCase.html +71 -0
  137. package/docs/utils/watchWindowSize.html +166 -0
  138. package/icons/error.svg +1 -1
  139. package/icons/warning.svg +1 -1
  140. package/package.json +1 -1
  141. package/scripts/build.js +4 -1
  142. package/scripts/docs.js +4 -2
  143. package/src/components/Accordion.js +229 -0
  144. package/src/components/Collapsible.js +109 -0
  145. package/src/components/ContentSlider.js +205 -0
  146. package/src/components/Dialog.js +376 -0
  147. package/src/components/PersistantCollapsible.js +69 -0
  148. package/src/components/PhotoViewer.js +368 -0
  149. package/src/components/Resize.js +210 -0
  150. package/src/components/ShadowComponent.js +3 -1
  151. package/src/components/ShowMore.js +109 -0
  152. package/src/components/Sortable.js +193 -0
  153. package/src/components/Split.js +192 -0
  154. package/src/components/Table.js +1202 -0
  155. package/src/components/Tabs.js +428 -0
  156. package/src/components/Tags.js +253 -0
  157. package/src/components/Timestamp.js +31 -0
  158. package/src/components/Toast.js +454 -0
  159. package/src/components/Toggle.js +173 -0
  160. package/src/components/tableControls/DeleteRecord.js +29 -0
  161. package/src/components/tableControls/Edit.js +88 -0
  162. package/src/components/tableControls/ExportCSV.js +71 -0
  163. package/src/components/tableControls/ExportJson.js +55 -0
  164. package/src/components/tableControls/FieldSortHide.js +76 -0
  165. package/src/components/tableControls/Filters.js +114 -0
  166. package/src/components/tableControls/FirstPage.js +65 -0
  167. package/src/components/tableControls/HiddenCount.js +45 -0
  168. package/src/components/tableControls/Hide.js +34 -0
  169. package/src/components/tableControls/LastPage.js +65 -0
  170. package/src/components/tableControls/NextPage.js +65 -0
  171. package/src/components/tableControls/PageSelect.js +109 -0
  172. package/src/components/tableControls/PageSize.js +68 -0
  173. package/src/components/tableControls/PrevPage.js +65 -0
  174. package/src/components/tableControls/Search.js +58 -0
  175. package/src/components/tableControls/ShowAll.js +34 -0
  176. package/src/components/tableControls/TableControl.js +105 -0
  177. package/src/utils/debounce.js +9 -0
  178. package/src/utils/drag.js +80 -0
  179. package/src/utils/formatTimestamp.js +27 -0
  180. package/src/utils/toTitleCase.js +9 -0
  181. package/src/utils/watchWindowSize.js +16 -0
  182. package/dist/src/utils/cli.js +0 -1
  183. package/dist/src/utils/fs-utils.js +0 -1
  184. package/docs/components/component.html +0 -90
  185. package/docs/components/directory-viewer.html +0 -90
  186. package/docs/components/lazy-component.html +0 -84
  187. package/docs/components/reactive-component.html +0 -69
  188. package/docs/components/reactive-lazy-component.html +0 -69
  189. package/docs/components/search.html +0 -102
  190. package/docs/src/utils/cli.js +0 -1
  191. package/docs/src/utils/fs-utils.js +0 -1
  192. package/src/utils/cli.js +0 -43
  193. package/src/utils/fs-utils.js +0 -41
@@ -7,8 +7,10 @@
7
7
  <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
8
  <link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
9
9
  <script type="module">
10
+ import ShadowComponent from '../src/components/ShadowComponent.js';
10
11
  import Import from '../src/components/Import.js';
11
12
  import Icon from '../src/components/Icon.js';
13
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
12
14
  Import.replacements.root = '../';
13
15
  Icon.pathToIcons = ['../icons'];
14
16
  </script>
@@ -29,9 +31,9 @@
29
31
  <h6 class="mt">JavaScript Reference</h6>
30
32
  <a href="#constructor">Constructor</a><br />
31
33
  <a href="#requirements">Requirements</a><br />
32
- <a href="#attributes">Attributes</a><br />
33
34
  <a href="#properties">Properties</a><br />
34
35
  <a href="#methods">Methods</a><br />
36
+ <a href="#events">Events</a><br />
35
37
  </div>
36
38
  </details>
37
39
 
@@ -135,17 +137,24 @@
135
137
 
136
138
  <h2 id="jsRef">JavaScript Reference</h2>
137
139
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
138
- <h6>Extends <a href="./component.html">Component</a></h6>
140
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
139
141
  <h5><code>new Tabs()</code></h5>
142
+
140
143
  <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
141
144
  <ul>
142
- <li><a href="./component.html">Component</a></li>
145
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
143
146
  </ul>
144
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
147
+
148
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
145
149
  <h5><code>active<i>: string</i></code></h5>
146
- <p>The name of the active tab.</p>
147
- <h5><code>fixed-height<i>: boolean</i></code></h5>
148
- <p>When true, the tabs component will fill its container height and enable content scrolling.</p>
150
+ <p>The name of the active tab. Syncs to <code>active</code> attribute.</p>
151
+ <h5><code>fixedHeight<i>: boolean</i></code></h5>
152
+ <p>Whether the tabs component uses fixed height mode. Syncs to <code>fixed-height</code> attribute.</p>
153
+ <h5><code>contents<i>: TabContent[]</i></code></h5>
154
+ <p>Returns an array of all tab content elements.</p>
155
+ <h5><code>tabs<i>: Tab[]</i></code></h5>
156
+ <p>Returns an array of all tab elements.</p>
157
+
149
158
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
150
159
  <h5><code>getActiveTab()<i>: Tab</i></code></h5>
151
160
  <p>Returns the currently active tab.</p>
@@ -155,6 +164,14 @@
155
164
  <p>Returns the currently active tab content.</p>
156
165
  <h5><code>getContent(id)<i>: TabContent</i></code></h5>
157
166
  <p>Returns the tab content with the specified id.</p>
167
+ <h5><code>updateActiveElements()<i>: void</i></code></h5>
168
+ <p>Updates the active state of tabs and content based on the current active property.</p>
169
+ <h5><code>updateScrollIndicators()<i>: void</i></code></h5>
170
+ <p>Updates the visibility of scroll indicators based on tab overflow.</p>
171
+
172
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
173
+ <h5><code>tab</code></h5>
174
+ <p>Fired when the active tab changes. Detail contains <code>{ tab }</code> with the name of the new active tab.</p>
158
175
  </main>
159
176
  <div style="height:33vh"></div>
160
177
  <script type="module" src="../src/components/Tabs.js"></script>
@@ -7,8 +7,10 @@
7
7
  <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
8
  <link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
9
9
  <script type="module">
10
+ import ShadowComponent from '../src/components/ShadowComponent.js';
10
11
  import Import from '../src/components/Import.js';
11
12
  import Icon from '../src/components/Icon.js';
13
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
12
14
  Import.replacements.root = '../';
13
15
  Icon.pathToIcons = ['../icons'];
14
16
  </script>
@@ -28,14 +30,14 @@
28
30
  <h6 class="mt">JavaScript Reference</h6>
29
31
  <a href="#constructor">Constructor</a><br />
30
32
  <a href="#requirements">Requirements</a><br />
31
- <a href="#attributes">Attributes</a><br />
32
33
  <a href="#properties">Properties</a><br />
33
34
  <a href="#methods">Methods</a><br />
35
+ <a href="#events">Events</a><br />
34
36
  </div>
35
37
  </details>
36
38
 
37
39
  <h3>Description</h3>
38
- <p>The <code>Tags</code> component allows users to add and remove tags. It extends the <a href="./component.html">Component</a> class.</p>
40
+ <p>The <code>Tags</code> component allows users to add and remove tags. It extends the <a href="./shadow-component.html">ShadowComponent</a> class.</p>
39
41
 
40
42
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
41
43
  <p>Use the <code>Tags</code> component to allow users to add and remove tags. Tags can be added by typing them into the input field and pressing Enter or by pasting a comma-separated list of tags. You can delete a tag by clicking on it.</p>
@@ -61,23 +63,23 @@
61
63
  <h2 id="jsRef">JavaScript Reference</h2>
62
64
 
63
65
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
64
- <h6>Extends <a href="./component.html">Component</a></h6>
66
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
65
67
  <h5>
66
68
  <code>new Tags()</code>
67
69
  </h5>
68
70
 
69
71
  <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
70
72
  <ul>
71
- <li><a href="./component.html">Component</a></li>
73
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
72
74
  </ul>
73
75
 
74
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
76
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
75
77
  <h5><code>value<i>: string</i></code></h5>
76
- <p>A comma-separated list of tags.</p>
78
+ <p>A comma-separated list of tags. Syncs with the <code>value</code> attribute.</p>
77
79
  <h5><code>allowedTags<i>: string</i></code></h5>
78
- <p>A comma-separated list of allowed tags. If specified, only these tags can be added.</p>
80
+ <p>A comma-separated list of allowed tags. If specified, only these tags can be added. Syncs with the <code>allowed-tags</code> attribute.</p>
79
81
  <h5><code>disallowedTags<i>: string</i></code></h5>
80
- <p>A comma-separated list of disallowed tags. If specified, these tags cannot be added.</p>
82
+ <p>A comma-separated list of disallowed tags. If specified, these tags cannot be added. Syncs with the <code>disallowed-tags</code> attribute.</p>
81
83
 
82
84
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
83
85
  <h5><code>addTag(tag)<i>: void</i></code></h5>
@@ -86,6 +88,20 @@
86
88
  <p>Removes a tag from the list of tags.</p>
87
89
  <h5><code>validateTags()<i>: string</i></code></h5>
88
90
  <p>Validates the list of tags against the allowed and disallowed tags and returns the valid tags as a comma-separated string.</p>
91
+ <h5><code>renderTags()<i>: Promise&lt;void&gt;</i></code></h5>
92
+ <p>Re-renders the tag elements in the component.</p>
93
+
94
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
95
+ <h5><code>change</code></h5>
96
+ <p>Fired when the value changes. Detail contains <code>{ oldValue, newValue }</code>.</p>
97
+ <h5><code>addtag</code></h5>
98
+ <p>Fired when a tag is added. Detail contains <code>{ tag }</code>.</p>
99
+ <h5><code>removetag</code></h5>
100
+ <p>Fired when a tag is removed. Detail contains <code>{ tag }</code>.</p>
101
+ <h5><code>allowedtagschange</code></h5>
102
+ <p>Fired when the allowed tags list changes. Detail contains <code>{ oldValue, newValue }</code>.</p>
103
+ <h5><code>disallowedtagschange</code></h5>
104
+ <p>Fired when the disallowed tags list changes. Detail contains <code>{ oldValue, newValue }</code>.</p>
89
105
 
90
106
  </main>
91
107
  <script type="module" src="../src/components/Import.js"></script>
@@ -7,8 +7,10 @@
7
7
  <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
8
  <link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
9
9
  <script type="module">
10
+ import ShadowComponent from '../src/components/ShadowComponent.js';
10
11
  import Import from '../src/components/Import.js';
11
12
  import Icon from '../src/components/Icon.js';
13
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
12
14
  Import.replacements.root = '../';
13
15
  Icon.pathToIcons = ['../icons'];
14
16
  </script>
@@ -27,7 +29,6 @@
27
29
  <h6 class="mt">JavaScript Reference</h6>
28
30
  <a href="#constructor">Constructor</a><br />
29
31
  <a href="#requirements">Requirements</a><br />
30
- <a href="#attributes">Attributes</a><br />
31
32
  <a href="#properties">Properties</a><br />
32
33
  <a href="#cssCustomProperties">CSS Custom Properties</a><br />
33
34
  <a href="#methods">Methods</a><br />
@@ -85,13 +86,9 @@
85
86
  <li><a href="./icon.html">Icon</a></li>
86
87
  </ul>
87
88
 
88
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
89
- <h5><code>current-theme<i>: string</i></code></h5>
90
- <p>Reflects the current theme state. Possible values are <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code>. This attribute is automatically updated when the theme changes.</p>
91
-
92
89
  <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
93
90
  <h5><code>currentTheme<i>: string</i></code></h5>
94
- <p>Gets or sets the current theme. Possible values are <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code>. This property is reactive and will trigger a re-render when changed.</p>
91
+ <p>Gets or sets the current theme. Possible values are <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code>. This property is reactive and will trigger a re-render when changed. Syncs to <code>current-theme</code> attribute.</p>
95
92
 
96
93
  <h3 id="cssCustomProperties"><a href="#cssCustomProperties" class="no-link">CSS Custom Properties</a></h3>
97
94
  <h5><code>--padding<i>: length</i></code></h5>
@@ -7,8 +7,10 @@
7
7
  <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
8
  <link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
9
9
  <script type="module">
10
+ import ShadowComponent from '../src/components/ShadowComponent.js';
10
11
  import Import from '../src/components/Import.js';
11
12
  import Icon from '../src/components/Icon.js';
13
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
12
14
  Import.replacements.root = '../';
13
15
  Icon.pathToIcons = ['../icons'];
14
16
  </script>
@@ -27,59 +29,53 @@
27
29
  <h6 class="mt">JavaScript Reference</h6>
28
30
  <a href="#constructor">Constructor</a><br />
29
31
  <a href="#requirements">Requirements</a><br />
30
- <a href="#attributes">Attributes</a><br />
31
32
  <a href="#properties">Properties</a><br />
32
33
  <a href="#methods">Methods</a><br />
33
34
  </div>
34
35
  </details>
35
36
 
36
37
  <h3>Description</h3>
37
- <p>The <code>Timestamp</code> component displays a formatted timestamp. It extends the <a href="./component.html">Component</a> class.</p>
38
+ <p>The <code>Timestamp</code> component displays a formatted timestamp using custom format tokens. It extends the ShadowComponent class for encapsulated styling.</p>
38
39
 
39
40
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
40
- <p>Use the <code>Timestamp</code> component to display a formatted timestamp. The component will automatically format the timestamp based on the provided locale or the user's current locale if no locale is provided.</p>
41
+ <p>Use the <code>Timestamp</code> component to display a formatted timestamp. The component will automatically format the timestamp using the default format or a custom format with tokens.</p>
41
42
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
42
43
  <k-timestamp timestamp="1633024800000"></k-timestamp>
43
44
 
44
45
  <h3 id="customFormat"><a href="#customFormat" class="no-link">Custom Format</a></h3>
45
- <p>Use the <code>format</code> attribute to specify a custom format for the timestamp. The format should be a string like <code>YYYY-MM-DD hh:mm:ss:iiii</code>.</p>
46
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"YYYY-MM-DD hh:mm:ss"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
47
- <k-timestamp timestamp="1633024800000" format="YYYY-MM-DD hh:mm:ss"></k-timestamp>
46
+ <p>Use the <code>format</code> attribute to specify a custom format using tokens like <code>YYYY</code> (4-digit year), <code>MM</code> (2-digit month), <code>DD</code> (2-digit day), <code>hh</code> (2-digit hour), <code>mm</code> (2-digit minute), and <code>ss</code> (2-digit second).</p>
47
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"MM/DD/YYYY"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
48
+ <k-timestamp timestamp="1633024800000" format="MM/DD/YYYY"></k-timestamp>
49
+
50
+ <h3 id="timeFormat"><a href="#timeFormat" class="no-link">Time Format</a></h3>
51
+ <p>Display time with custom formatting using hour, minute, and second tokens.</p>
52
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"hh:mm:ss"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
53
+ <k-timestamp timestamp="1633024800000" format="hh:mm:ss"></k-timestamp>
48
54
 
49
55
  <h2 id="jsRef">JavaScript Reference</h2>
50
56
 
51
57
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
52
- <h6>Extends <a href="./component.html">Component</a></h6>
53
- <h5>
54
- <code>new Timestamp(timestamp, format, locale)</code>
55
- </h5>
56
-
57
- <h4>Parameters</h4>
58
- <h5><code>timestamp<i>: number</i></code></h5>
59
- <p>The timestamp to be formatted and displayed.</p>
60
- <h5><code>format<i>: string</i></code></h5>
61
- <p>The format to be used for formatting the timestamp. If not provided, the user's current locale format will be used.</p>
62
- <h5><code>locale<i>: string</i></code></h5>
63
- <p>The locale to be used for formatting the timestamp. If not provided, the user's current locale will be used.</p>
58
+ <h6>Extends ShadowComponent</h6>
64
59
 
65
60
  <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
66
61
  <ul>
67
- <li><a href="./component.html">Component</a></li>
62
+ <li>ShadowComponent</li>
68
63
  <li><a href="../utils/formatTimestamp.js">formatTimestamp Utility Function</a></li>
69
64
  </ul>
70
65
 
71
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
66
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
72
67
  <h5><code>timestamp<i>: number</i></code></h5>
73
- <p>The timestamp to be formatted and displayed.</p>
68
+ <p>The timestamp to be formatted and displayed. Syncs to <code>timestamp</code> attribute.</p>
74
69
  <h5><code>format<i>: string</i></code></h5>
75
- <p>The format to be used for formatting the timestamp. If not provided, the user's current locale format will be used.</p>
70
+ <p>The format to be used for formatting the timestamp using tokens like YYYY, MM, DD, hh, mm, ss. If not provided, uses the default format. Syncs to <code>format</code> attribute.</p>
76
71
  <h5><code>locale<i>: string</i></code></h5>
77
- <p>The locale to be used for formatting the timestamp. If not provided, the user's current locale will be used.</p>
72
+ <p>The locale to be used for formatting the timestamp. Syncs to <code>locale</code> attribute.</p>
78
73
 
79
74
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
80
- <p>The <code>Timestamp</code> class does not introduce any new methods beyond those provided by the <a href="./component.html">Component</a> class.</p>
75
+ <p>The <code>Timestamp</code> class does not introduce any new methods beyond those provided by the ShadowComponent class.</p>
81
76
 
82
77
  </main>
78
+ <div style="height:33vh"></div>
83
79
  <script type="module" src="../src/components/Import.js"></script>
84
80
  <script type="module" src="../src/components/Timestamp.js"></script>
85
81
  </body>
@@ -9,8 +9,10 @@
9
9
  <script type="module">
10
10
  import Import from '../src/components/Import.js';
11
11
  import Icon from '../src/components/Icon.js';
12
+ import ShadowComponent from '../src/components/ShadowComponent.js';
12
13
  Import.replacements.root = '../';
13
14
  Icon.pathToIcons = ['../icons'];
15
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
14
16
  </script>
15
17
  </head>
16
18
  <body>
@@ -32,7 +34,6 @@
32
34
  <a href="#constructor">Constructor</a><br />
33
35
  <a href="#staticMethods">Static Methods</a><br />
34
36
  <a href="#requirements">Requirements</a><br />
35
- <a href="#attributes">Attributes</a><br />
36
37
  <a href="#properties">Properties</a><br />
37
38
  <a href="#methods">Methods</a><br />
38
39
  <a href="#events">Events</a><br />
@@ -46,12 +47,12 @@
46
47
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
47
48
  <div class="row -mx">
48
49
  <div class="col d-span-6 t-span-6 m-span-12 px">
49
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example1"</span>&gt;</span>Open Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
50
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example1"</span>&gt;</span>Open Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
50
51
  </div>
51
52
  <div class="col d-span-6 t-span-6 m-span-12 px">
52
53
  <button id="example1" class="mb">Open Toast</button>
53
54
  <script type="module">
54
- import Toast from '/kempo/components/Toast.js';
55
+ import Toast from '/src/components/Toast.js';
55
56
  document.getElementById('example1').addEventListener('click', () => {
56
57
  Toast.create("Hello World");
57
58
  });
@@ -74,7 +75,7 @@
74
75
  <button id="example2-bottomcenter" class="mb">Bottom Center</button>
75
76
  <button id="example2-bottomright" class="mb">Bottom Right</button>
76
77
  <script type="module">
77
- import Toast from '/kempo/components/Toast.js';
78
+ import Toast from '/src/components/Toast.js';
78
79
  document.getElementById('example2-topleft').addEventListener('click', () => {
79
80
  Toast.create("Hello Top Left", {
80
81
  position: "top left"
@@ -113,14 +114,14 @@
113
114
  <p>Toasts can automatically close after a specified timeout (in milliseconds). The default timeout when using <code>Toast.create</code> is <code>5000</code> (ms), or 5 seconds.</p>
114
115
  <div class="row -mx">
115
116
  <div class="col d-span-6 t-span-6 m-span-12 px">
116
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-1"</span>&gt;</span>Open 1 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-3"</span>&gt;</span>Open 3 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-10"</span>&gt;</span>Open 10 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 1 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">1000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-3'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 3 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">3000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-10'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 10 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">10000</span><br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
117
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-1"</span>&gt;</span>Open 1 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-3"</span>&gt;</span>Open 3 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example3-10"</span>&gt;</span>Open 10 Second Timeout Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-1'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 1 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">1000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-3'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 3 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">3000</span><br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example3-10'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"I will timeout in 10 second"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">10000</span><br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
117
118
  </div>
118
119
  <div class="col d-span-6 t-span-6 m-span-12 px">
119
120
  <button id="example3-1" class="mb">Open 1 Second Timeout Toast</button>
120
121
  <button id="example3-3" class="mb">Open 3 Second Timeout Toast</button>
121
122
  <button id="example3-10" class="mb">Open 10 Second Timeout Toast</button>
122
123
  <script type="module">
123
- import Toast from '/kempo/components/Toast.js';
124
+ import Toast from '/src/components/Toast.js';
124
125
  document.getElementById('example3-1').addEventListener('click', () => {
125
126
  Toast.create("I will timeout in 1 second", {
126
127
  timeout: 1000
@@ -145,14 +146,14 @@
145
146
  <p>Toasts can have action and close buttons that trigger callbacks when clicked.</p>
146
147
  <div class="row -mx">
147
148
  <div class="col d-span-6 t-span-6 m-span-12 px">
148
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action"</span>&gt;</span>Open Toast with Action<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-close"</span>&gt;</span>Open Toast with Close Button<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action-close"</span>&gt;</span>Open Toast with Action and Close Button<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'&lt;k-icon name="close"&gt;&lt;/div&gt;'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; <span class="hljs-comment">// return false to prevent closing</span><br /> },<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'&lt;k-icon name="close"&gt;&lt;/div&gt;'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
149
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action"</span>&gt;</span>Open Toast with Action<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-close"</span>&gt;</span>Open Toast with Close Button<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example4-action-close"</span>&gt;</span>Open Toast with Action and Close Button<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'&lt;k-icon name="close"&gt;&lt;/div&gt;'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example4-action-close'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.create(<span class="hljs-string">"Hello World"</span>, {<br /> <span class="hljs-attr">timeout</span>: <span class="hljs-number">0</span>,<br /> <span class="hljs-attr">action</span>: <span class="hljs-string">'Click Me'</span>,<br /> <span class="hljs-attr">actionCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You clicked the action"</span>);<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; <span class="hljs-comment">// return false to prevent closing</span><br /> },<br /> <span class="hljs-attr">close</span>: <span class="hljs-string">'&lt;k-icon name="close"&gt;&lt;/div&gt;'</span>,<br /> <span class="hljs-attr">closeCallback</span>: <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {<br /> Toast.create(<span class="hljs-string">"You closed the toast"</span>);<br /> }<br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
149
150
  </div>
150
151
  <div class="col d-span-6 t-span-6 m-span-12 px">
151
152
  <button id="example4-action" class="mb">Open Toast with Action</button>
152
153
  <button id="example4-close" class="mb">Open Toast with Close Button</button>
153
154
  <button id="example4-action-close" class="mb">Open Toast with Action and Close Button</button>
154
155
  <script type="module">
155
- import Toast from '/kempo/components/Toast.js';
156
+ import Toast from '/src/components/Toast.js';
156
157
  document.getElementById('example4-action').addEventListener('click', () => {
157
158
  Toast.create("Hello World", {
158
159
  timeout: 0,
@@ -193,14 +194,14 @@
193
194
  <p>Toasts can be created as a success, warning or error message.</p>
194
195
  <div class="row -mx">
195
196
  <div class="col d-span-6 t-span-6 m-span-12 px">
196
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-success"</span>&gt;</span>Success Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-warning"</span>&gt;</span>Warning Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-error"</span>&gt;</span>Error Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-success'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.success(<span class="hljs-string">"It Worked!"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-warning'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.warning(<span class="hljs-string">"Be Careful"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-error'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.error(<span class="hljs-string">"That's a very bad idea"</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
197
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-success"</span>&gt;</span>Success Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-warning"</span>&gt;</span>Warning Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"example5-error"</span>&gt;</span>Error Toast<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Toast <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Toast.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-success'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.success(<span class="hljs-string">"It Worked!"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-warning'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.warning(<span class="hljs-string">"Be Careful"</span>);<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'example5-error'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Toast.error(<span class="hljs-string">"That's a very bad idea"</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
197
198
  </div>
198
199
  <div class="col d-span-6 t-span-6 m-span-12 px">
199
200
  <button id="example5-success" class="mb">Success Toast</button>
200
201
  <button id="example5-warning" class="mb">Warning Toast</button>
201
202
  <button id="example5-error" class="mb">Error Toast</button>
202
203
  <script type="module">
203
- import Toast from '/kempo/components/Toast.js';
204
+ import Toast from '/src/components/Toast.js';
204
205
  document.getElementById('example5-success').addEventListener('click', () => {
205
206
  Toast.success("It Worked!");
206
207
  });
@@ -261,41 +262,29 @@
261
262
 
262
263
  <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
263
264
  <ul>
264
- <li><a href="./component.html">Component</a></li>
265
+ <li>ShadowComponent (configure <code>ShadowComponent.stylesheetPath</code> as needed for your server)</li>
266
+ <li><a href="./icon.html">Icon</a></li>
265
267
  </ul>
266
268
 
267
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
268
- <h5><code>action-html<i>: string</i></code></h5>
269
- <p>HTML content for the action button.</p>
269
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
270
+ <h5><code>actionHtml<i>: string</i></code></h5>
271
+ <p>HTML content for the action button. Syncs to <code>action-html</code> attribute.</p>
270
272
 
271
- <h5><code>close-html<i>: string</i></code></h5>
272
- <p>HTML content for the close button.</p>
273
+ <h5><code>closeHtml<i>: string</i></code></h5>
274
+ <p>HTML content for the close button. Syncs to <code>close-html</code> attribute.</p>
273
275
 
274
276
  <h5><code>timeout<i>: number</i></code></h5>
275
- <p>Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close).</p>
277
+ <p>Time in milliseconds before the toast automatically closes. Default is 0 (no auto-close). Syncs to <code>timeout</code> attribute.</p>
276
278
 
277
279
  <h5><code>opened<i>: boolean</i></code></h5>
278
- <p>Whether the toast is currently open. Default is false.</p>
280
+ <p>Whether the toast is currently open. Default is false. Syncs to <code>opened</code> attribute.</p>
279
281
 
280
- <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
281
282
  <h5><code>actionCallback<i>: function</i></code></h5>
282
283
  <p>Function to call when the action button is clicked.</p>
283
284
 
284
285
  <h5><code>closeCallback<i>: function</i></code></h5>
285
286
  <p>Function to call when the toast is closed.</p>
286
287
 
287
- <h5><code>actionHtml<i>: string</i></code></h5>
288
- <p>HTML content for the action button.</p>
289
-
290
- <h5><code>closeHtml<i>: string</i></code></h5>
291
- <p>HTML content for the close button.</p>
292
-
293
- <h5><code>timeout<i>: number</i></code></h5>
294
- <p>Time in milliseconds before the toast automatically closes.</p>
295
-
296
- <h5><code>opened<i>: boolean</i></code></h5>
297
- <p>Whether the toast is currently open.</p>
298
-
299
288
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
300
289
  <h5><code>open()<i>: void</i></code></h5>
301
290
  <p>Opens the toast. If a timeout is specified, this starts the timer for automatic closing.</p>
@@ -323,6 +312,8 @@
323
312
  <p>The position of the container on the screen. Valid values are: 'top left', 'top center', 'top right', 'bottom left', 'bottom center', 'bottom right'.</p>
324
313
 
325
314
  </main>
326
- <script type="module" src="../src/components/Import.js"></script>
315
+ <div style="height:33vh"></div>
316
+ <script type="module" src="../src/components/Import.js"></script>
317
+ <script type="module" src="../src/components/Toast.js"></script>
327
318
  </body>
328
319
  </html>
@@ -9,8 +9,10 @@
9
9
  <script type="module">
10
10
  import Import from '../src/components/Import.js';
11
11
  import Icon from '../src/components/Icon.js';
12
+ import ShadowComponent from '../src/components/ShadowComponent.js';
12
13
  Import.replacements.root = '../';
13
14
  Icon.pathToIcons = ['../icons'];
15
+ ShadowComponent.stylesheetPath = '../kempo.min.css';
14
16
  </script>
15
17
  </head>
16
18
  <body>
@@ -29,7 +31,6 @@
29
31
  <h6 class="mt">JavaScript Reference</h6>
30
32
  <a href="#constructor">Constructor</a><br />
31
33
  <a href="#requirements">Requirements</a><br />
32
- <a href="#attributes">Attributes</a><br />
33
34
  <a href="#properties">Properties</a><br />
34
35
  <a href="#methods">Methods</a><br />
35
36
  </div>
@@ -132,9 +133,9 @@
132
133
  <li><a href="./component.html">Component</a></li>
133
134
  </ul>
134
135
 
135
- <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
136
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
136
137
  <h5><code>value<i>: boolean</i></code></h5>
137
- <p>A boolean that indicates if the switch is on or off, the default value is <code>false</code>.</p>
138
+ <p>A boolean that indicates if the switch is on or off, the default value is <code>false</code>. Syncs to <code>value</code> attribute.</p>
138
139
  <p>This can be set directly, but it is not recommended as it only triggers the a <code>change</code> event and not a <code>on</code>, <code>off</code> or <code>toggle</code> event as the methods do, so the methods are preferrable.</p>
139
140
 
140
141
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="error" d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240ZM330-120 120-330v-300l210-210h300l210 210v300L630-120H330Zm34-80h232l164-164v-232L596-760H364L200-596v232l164 164Zm116-280Z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240ZM330-120 120-330v-300l210-210h300l210 210v300L630-120H330Zm34-80h232l164-164v-232L596-760H364L200-596v232l164 164Zm116-280Z"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="warning" d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>