kempo-ui 0.3.17 → 0.4.1

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 (83) hide show
  1. package/bin/get_icon.js +0 -0
  2. package/bin/highlight_code.js +0 -0
  3. package/bin/icon.js +0 -0
  4. package/bin/list_icons.js +0 -0
  5. package/dist/components/Progress.js +86 -0
  6. package/dist/components/Spinner.js +2 -2
  7. package/dist/components/Split.js +31 -13
  8. package/docs/components/accordion.html +3 -0
  9. package/docs/components/aside.html +3 -0
  10. package/docs/components/card.html +3 -0
  11. package/docs/components/code-editor.html +3 -0
  12. package/docs/components/color-picker.html +3 -0
  13. package/docs/components/combobox.html +3 -0
  14. package/docs/components/content-slider.html +3 -0
  15. package/docs/components/context.html +3 -0
  16. package/docs/components/dialog.html +3 -0
  17. package/docs/components/dropdown.html +3 -0
  18. package/docs/components/filter-list.html +3 -0
  19. package/docs/components/focus-capture.html +3 -0
  20. package/docs/components/html-editor.html +3 -0
  21. package/docs/components/hybrid-component.html +3 -0
  22. package/docs/components/icon.html +3 -0
  23. package/docs/components/import.html +3 -0
  24. package/docs/components/light-component.html +3 -0
  25. package/docs/components/nav-spacer.html +3 -0
  26. package/docs/components/nav.html +3 -0
  27. package/docs/components/photo-viewer.html +3 -0
  28. package/docs/components/progress.html +625 -0
  29. package/docs/components/resize.html +3 -0
  30. package/docs/components/shadow-component.html +3 -0
  31. package/docs/components/show-more.html +3 -0
  32. package/docs/components/sortable.html +3 -0
  33. package/docs/components/spinner.html +3 -0
  34. package/docs/components/split.html +31 -3
  35. package/docs/components/table.html +3 -0
  36. package/docs/components/tableControls.html +3 -0
  37. package/docs/components/tableCustomFields.html +3 -0
  38. package/docs/components/tableFetchRecords.html +3 -0
  39. package/docs/components/tableFieldSortHide.html +3 -0
  40. package/docs/components/tablePagination.html +3 -0
  41. package/docs/components/tablePlaceholder.html +3 -0
  42. package/docs/components/tableRecordEditing.html +3 -0
  43. package/docs/components/tableRecordFiltering.html +3 -0
  44. package/docs/components/tableRecordHiding.html +3 -0
  45. package/docs/components/tableRecordSearching.html +3 -0
  46. package/docs/components/tableRecordSelection.html +3 -0
  47. package/docs/components/tableRowControls.html +3 -0
  48. package/docs/components/tableServerSync.html +3 -0
  49. package/docs/components/tableSorting.html +3 -0
  50. package/docs/components/tabs.html +3 -0
  51. package/docs/components/tags.html +3 -0
  52. package/docs/components/theme-select.html +3 -0
  53. package/docs/components/theme-switcher.html +3 -0
  54. package/docs/components/timestamp.html +3 -0
  55. package/docs/components/toast.html +3 -0
  56. package/docs/components/toggle.html +3 -0
  57. package/docs/components/tree.html +3 -0
  58. package/docs/index.html +9 -0
  59. package/docs/src/components/Progress.js +86 -0
  60. package/docs/src/components/Spinner.js +2 -2
  61. package/docs/src/components/Split.js +31 -13
  62. package/docs/utils/context.html +3 -0
  63. package/docs/utils/cookie.html +3 -0
  64. package/docs/utils/debounce.html +3 -0
  65. package/docs/utils/drag.html +3 -0
  66. package/docs/utils/elevation.html +3 -0
  67. package/docs/utils/formatTimestamp.html +3 -0
  68. package/docs/utils/object.html +3 -0
  69. package/docs/utils/propConverters.html +3 -0
  70. package/docs/utils/string.html +3 -0
  71. package/docs/utils/theme.html +3 -0
  72. package/docs/utils/toTitleCase.html +3 -0
  73. package/docs/utils/type.html +3 -0
  74. package/docs/utils/wait.html +3 -0
  75. package/docs-src/components/progress.page.html +182 -0
  76. package/docs-src/components/split.page.html +28 -3
  77. package/docs-src/index.page.html +6 -0
  78. package/docs-src/nav.fragment.html +3 -0
  79. package/package.json +2 -2
  80. package/src/components/Progress.js +148 -0
  81. package/src/components/Spinner.js +19 -18
  82. package/src/components/Split.js +163 -132
  83. package/tests/components/Progress.browser-test.js +444 -0
@@ -0,0 +1,182 @@
1
+ <page pageName="Progress" title="Progress - Components - Kempo Docs - A Web Components Solution">
2
+ <content location="header"></content>
3
+ <content>
4
+ <h1 class="ta-center">Progress</h1>
5
+
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="#basicUsage">Basic Usage</a><br />
12
+ <a href="#offset">Offset</a><br />
13
+ <a href="#color">Color</a><br />
14
+ <a href="#label">Label</a><br />
15
+ <a href="#styles">Styles</a><br />
16
+ <a href="#multiple">Multiple Bars</a><br />
17
+ <a href="#indeterminate">Indeterminate</a><br />
18
+
19
+ <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
20
+ <a href="#constructor">Constructor</a><br />
21
+ <a href="#requirements">Requirements</a><br />
22
+ <a href="#attributes">Attributes</a><br />
23
+ </div>
24
+ </k-accordion-panel>
25
+ </k-accordion>
26
+
27
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
28
+ <p>Create a progress bar using the <code>k-progress</code> component, set the size with the <code>percentage</code> attribute.</p>
29
+ <div class="row -mx">
30
+ <div class="col m-span-12 px">
31
+ <k-card label="HTML">
32
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"50"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
33
+ </k-card>
34
+ </div>
35
+ <div class="col m-span-12 px">
36
+ <k-card label="Output">
37
+ <k-progress percentage="50"></k-progress>
38
+ </k-card>
39
+ </div>
40
+ </div>
41
+
42
+ <h3 id="offset"><a href="#offset" class="no-link">Offset</a></h3>
43
+ <p>Set the bar offset with the <code>offset</code> attribute.</p>
44
+ <div class="row -mx">
45
+ <div class="col m-span-12 px">
46
+ <k-card label="HTML">
47
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"50"</span> <span class="hljs-attr">offset</span>=<span class="hljs-string">"25"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
48
+ </k-card>
49
+ </div>
50
+ <div class="col m-span-12 px">
51
+ <k-card label="Output">
52
+ <k-progress percentage="50" offset="25"></k-progress>
53
+ </k-card>
54
+ </div>
55
+ </div>
56
+
57
+ <h3 id="color"><a href="#color" class="no-link">Color</a></h3>
58
+ <p>Set the color with the <code>color</code> attribute.</p>
59
+ <div class="row -mx">
60
+ <div class="col m-span-12 px">
61
+ <k-card label="HTML">
62
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"50"</span> <span class="hljs-attr">color</span>=<span class="hljs-string">"green"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
63
+ </k-card>
64
+ </div>
65
+ <div class="col m-span-12 px">
66
+ <k-card label="Output">
67
+ <k-progress percentage="50" color="green"></k-progress>
68
+ </k-card>
69
+ </div>
70
+ </div>
71
+
72
+ <h3 id="label"><a href="#label" class="no-link">Label</a></h3>
73
+ <p>Add a <code>label</code> attribute to see the percentage label added to the bar.</p>
74
+ <div class="row -mx">
75
+ <div class="col m-span-12 px">
76
+ <k-card label="HTML">
77
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"33"</span> <span class="hljs-attr">label</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
78
+ </k-card>
79
+ </div>
80
+ <div class="col m-span-12 px">
81
+ <k-card label="Output">
82
+ <k-progress percentage="33" label></k-progress>
83
+ </k-card>
84
+ </div>
85
+ </div>
86
+
87
+ <h3 id="styles"><a href="#styles" class="no-link">Styles</a></h3>
88
+ <p>You can do quite a bit of customization with the css.</p>
89
+ <div class="row -mx">
90
+ <div class="col m-span-12 px">
91
+ <k-card label="HTML">
92
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"<br /> --radius: 0;<br /> height: 3rem;<br /> color: pink;<br /> font-size: 3rem;<br /> background-color: #ccf;<br /> "</span><br /> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"33"</span><br /> <span class="hljs-attr">label</span><br />&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
93
+ </k-card>
94
+ </div>
95
+ <div class="col m-span-12 px">
96
+ <k-card label="Output">
97
+ <k-progress
98
+ style="
99
+ --radius: 0;
100
+ height: 3rem;
101
+ color: pink;
102
+ font-size: 3rem;
103
+ background-color: #ccf;
104
+ "
105
+ percentage="33"
106
+ label
107
+ ></k-progress>
108
+ </k-card>
109
+ </div>
110
+ </div>
111
+
112
+ <h3 id="multiple"><a href="#multiple" class="no-link">Multiple Bars</a></h3>
113
+ <p>Use a pipe-delimited (<code>|</code>) list in <code>percentage</code>, <code>color</code>, and <code>offset</code> to make multiple bars.</p>
114
+ <div class="row -mx">
115
+ <div class="col m-span-12 px">
116
+ <k-card label="HTML">
117
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span><br /> <span class="hljs-attr">percentage</span>=<span class="hljs-string">"25|25"</span><br /> <span class="hljs-attr">color</span>=<span class="hljs-string">"blue|red"</span><br /> <span class="hljs-attr">offset</span>=<span class="hljs-string">"0|50"</span><br />&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
118
+ </k-card>
119
+ </div>
120
+ <div class="col m-span-12 px">
121
+ <k-card label="Output">
122
+ <k-progress
123
+ percentage="25|25"
124
+ color="blue|red"
125
+ offset="0|50"
126
+ ></k-progress>
127
+ </k-card>
128
+ </div>
129
+ </div>
130
+
131
+ <h3 id="indeterminate"><a href="#indeterminate" class="no-link">Indeterminate</a></h3>
132
+ <p>Use the <code>indeterminate</code> attribute to add infinite animations to the progress bar. set the speed by giving it a value of the animation time (defualt = <code>2s</code>)</p>
133
+ <div class="row -mx">
134
+ <div class="col m-span-12 px">
135
+ <k-card label="HTML">
136
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">indeterminate</span> &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">indeterminate</span>=<span class="hljs-string">"1s"</span> &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">k-progress</span> <span class="hljs-attr">indeterminate</span>=<span class="hljs-string">"4s"</span> <span class="hljs-attr">color</span>=<span class="hljs-string">"linear-gradient(to right, var(--c_secondary) 0%, var(--c_primary) 100%)"</span> &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-progress</span>&gt;</span></code></pre>
137
+ </k-card>
138
+ </div>
139
+ <div class="col m-span-12 px">
140
+ <k-card label="Output">
141
+ <k-progress indeterminate ></k-progress>
142
+ <br />
143
+ <k-progress indeterminate="1s" ></k-progress>
144
+ <br />
145
+ <k-progress indeterminate="4s" color="linear-gradient(to right, var(--c_secondary) 0%, var(--c_primary) 100%)" ></k-progress>
146
+ </k-card>
147
+ </div>
148
+ </div>
149
+
150
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
151
+
152
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
153
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
154
+ <h5><code>new Progress()</code></h5>
155
+
156
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
157
+ <ul>
158
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
159
+ </ul>
160
+
161
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
162
+ <h5><code>percentage<i>: string</i></code></h5>
163
+ <p>The progress percentage(s). Accepts values from <code>0</code> to <code>100</code>. Use pipe-delimited (<code>|</code>) values for multiple bars. Default is <code>25</code>.</p>
164
+
165
+ <h5><code>offset<i>: string</i></code></h5>
166
+ <p>The offset position for the bar(s). Use pipe-delimited (<code>|</code>) values to match the number of bars in <code>percentage</code>. Default is <code>0</code>.</p>
167
+
168
+ <h5><code>color<i>: string</i></code></h5>
169
+ <p>The fill color for the bar(s). Supports any CSS color value including hex, rgb, variables, and gradients. Use pipe-delimited (<code>|</code>) values for multiple bars. Default is <code>var(--c_primary)</code>.</p>
170
+
171
+ <h5><code>label<i>: boolean</i></code></h5>
172
+ <p>When present, displays the percentage value inside the progress bar.</p>
173
+
174
+ <h5><code>indeterminate<i>: string</i></code></h5>
175
+ <p>When present, creates an animated indeterminate progress bar. Optionally set the animation duration (e.g., <code>indeterminate="1s"</code>, <code>indeterminate="4s"</code>). Default duration is <code>2s</code>.</p>
176
+ </content>
177
+ <content location="scripts">
178
+ <script type="module" src="{{pathToRoot}}src/components/Progress.js"></script>
179
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
180
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
181
+ </content>
182
+ </page>
@@ -9,6 +9,7 @@
9
9
  <a href="#resizing">Resizing</a><br />
10
10
  <a href="#verticalSplit">Vertical Split</a><br />
11
11
  <a href="#persistentState">Persistent State</a><br />
12
+ <a href="#grip">Grip</a><br />
12
13
  <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
13
14
  <a href="#constructor">Constructor</a><br />
14
15
  <a href="#requirements">Requirements</a><br />
@@ -59,11 +60,11 @@
59
60
  <h3>Sizes</h3>
60
61
  <p>Set the CSS Custom Property <code>--pane_1_size</code> to set the initial size of the first pane.</p>
61
62
  <p>Set the CSS Custom Property <code>--min_pane_size</code> to set the minimum size each pane can be.</p>
62
- <p>Set the CSS Custom Property <code>--handle_width</code> to set the size of the handle (the draggable region between the panes).</p>
63
+ <p>Set the CSS Custom Property <code>--handle_width</code> to set the size of the handle (the draggable region between the panes), odd sizes are recommended so it can be centered on the border.</p>
63
64
  <div class="row -mx">
64
65
  <div class="col m-span-12 px">
65
66
  <k-card label="HTML">
66
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-split</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"<br /> --pane_1_size: 100px;<br /> --min_pane_size: 100px;<br /> --handle_width: 20px;<br /> height: 10rem<br /> "</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"b"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>left<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"right"</span>&gt;</span>right<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-split</span>&gt;</span></code></pre>
67
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-split</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"<br /> --pane_1_size: 100px;<br /> --min_pane_size: 100px;<br /> --handle_width: 19px;<br /> height: 10rem<br /> "</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"b"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>left<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"right"</span>&gt;</span>right<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-split</span>&gt;</span></code></pre>
67
68
  </k-card>
68
69
  </div>
69
70
  <div class="col m-span-12 px">
@@ -72,7 +73,7 @@
72
73
  style="
73
74
  --pane_1_size: 100px;
74
75
  --min_pane_size: 100px;
75
- --handle_width: 20px;
76
+ --handle_width: 19px;
76
77
  height: 10rem
77
78
  "
78
79
  class="b"
@@ -141,6 +142,28 @@
141
142
  </div>
142
143
  </div>
143
144
 
145
+ <h3 id="grip"><a href="#grip" class="no-link">Grip</a></h3>
146
+ <p>Add the <code>grip</code> attribute to render a visual grip indicator centered on the divider handle, making it easier to identify the draggable area.</p>
147
+ <div class="row -mx mb">
148
+ <div class="col d-span-6 m-span-12 px">
149
+ <k-card label="HTML">
150
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-split</span> <span class="hljs-attr">grip</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"b mb"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>Left Pane Content<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"right"</span>&gt;</span>Right Pane Content<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-split</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">k-split</span> <span class="hljs-attr">grip</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"vertical"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 16rem"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"b"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>Top Pane Content<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"right"</span>&gt;</span>Bottom Pane Content<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-split</span>&gt;</span></code></pre>
151
+ </k-card>
152
+ </div>
153
+ <div class="col d-span-6 m-span-12 px">
154
+ <k-card label="Results">
155
+ <k-split grip style="height: 10rem" class="b mb">
156
+ <div>Left Pane Content</div>
157
+ <div slot="right">Right Pane Content</div>
158
+ </k-split>
159
+ <k-split grip direction="vertical" style="height: 16rem" class="b">
160
+ <div>Top Pane Content</div>
161
+ <div slot="right">Bottom Pane Content</div>
162
+ </k-split>
163
+ </k-card>
164
+ </div>
165
+ </div>
166
+
144
167
  <h2 id="jsRef">JavaScript Reference</h2>
145
168
 
146
169
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
@@ -165,6 +188,8 @@
165
188
  <p>The direction of the split. Can be <code>"horizontal"</code> (default) or <code>"vertical"</code>. Syncs to <code>direction</code> attribute.</p>
166
189
  <h5><code>persistentId<i>: string</i></code></h5>
167
190
  <p>When set, the pane size is saved to <code>localStorage</code> on resize and restored on initialization. Must be unique per split instance. Syncs to <code>persistent-id</code> attribute.</p>
191
+ <h5><code>grip<i>: boolean</i></code></h5>
192
+ <p>When set, renders a visual grip indicator centered on the divider handle. Syncs to <code>grip</code> attribute.</p>
168
193
 
169
194
  <h3 id="cssCustomProperties"><a href="#cssCustomProperties" class="no-link">CSS Custom Properties</a></h3>
170
195
  <h5><code>--pane_1_size</code></h5>
@@ -143,6 +143,12 @@
143
143
  <p class="tc-muted">Lightbox gallery for viewing images with zoom and navigation.</p>
144
144
  </a>
145
145
  </div>
146
+ <div class="span-12 t-span-6 d-span-4 px">
147
+ <a href="{{pathToRoot}}components/progress.html" class="card mb no-link d-b">
148
+ <h3 class="tc-primary">Progress</h3>
149
+ <p class="tc-muted">A progress bar for loading states.</p>
150
+ </a>
151
+ </div>
146
152
  <div class="span-12 t-span-6 d-span-4 px">
147
153
  <a href="{{pathToRoot}}components/resize.html" class="card mb no-link d-b">
148
154
  <h3 class="tc-primary">Resize</h3>
@@ -88,6 +88,8 @@
88
88
  <k-filter-item filter-keywords="photo viewer photoviewer components"><a
89
89
  href="{{pathToRoot}}components/photo-viewer.html"
90
90
  >Photo Viewer<br><small>Component</small></a></k-filter-item>
91
+ <k-filter-item filter-keywords="progress loading components"><a
92
+ href="{{pathToRoot}}components/progress.html">Progress<br><small>Component</small></a></k-filter-item>
91
93
  <k-filter-item filter-keywords="resize components"><a
92
94
  href="{{pathToRoot}}components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
93
95
  <k-filter-item filter-keywords="show more showmore components"><a
@@ -264,6 +266,7 @@
264
266
  <a href="{{pathToRoot}}components/nav.html">Nav</a>
265
267
  <a href="{{pathToRoot}}components/nav-spacer.html">Nav Spacer</a>
266
268
  <a href="{{pathToRoot}}components/photo-viewer.html">Photo Viewer</a>
269
+ <a href="{{pathToRoot}}components/progress.html">Progress</a>
267
270
  <a href="{{pathToRoot}}components/resize.html">Resize</a>
268
271
  <a href="{{pathToRoot}}components/show-more.html">Show More</a>
269
272
  <a href="{{pathToRoot}}components/sortable.html">Sortable</a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo-ui",
3
- "version": "0.3.17",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "A Lit based web-component library",
6
6
  "main": "index.js",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "node scripts/build.js",
15
- "docs": "npx kempo-server --root docs --config docs/prod.config.json",
15
+ "docs": "npx kempo-server --root docs --config docs/prod.config.json --port 8084",
16
16
  "dev": "npx kempo-server --root docs-src --port 8083",
17
17
  "icon": "node bin/icon.js",
18
18
  "geticon": "node bin/get_icon.js",
@@ -0,0 +1,148 @@
1
+ import { html, css } from '../lit-all.min.js';
2
+ import ShadowComponent from './ShadowComponent.js';
3
+ import { boolExists } from '../utils/propConverters.js';
4
+
5
+ export default class Progress extends ShadowComponent {
6
+ static properties = {
7
+ percentage: { type: String },
8
+ offset: { type: String },
9
+ color: { type: String },
10
+ label: { type: Boolean, converter: boolExists },
11
+ indeterminate: { type: String, reflect: true }
12
+ };
13
+
14
+ constructor() {
15
+ super();
16
+ this.percentage = '25';
17
+ this.offset = '0';
18
+ this.color = 'var(--c_primary)';
19
+ this.indeterminate = null;
20
+ }
21
+
22
+ /*
23
+ Public Members
24
+ */
25
+ get bars(){
26
+ const percentages = (this.percentage||'25').split('|').map(p=>p.trim());
27
+ const offsets = (this.offset||0).split('|').map(o=>o.trim());
28
+ const colors = (this.color||'var(--c_primary)').split('|').map(c=>c.trim());
29
+ return percentages.map( (percentage, i) => {
30
+ let offset = offsets[0];
31
+ if(offsets.length > i) offset = offsets[i];
32
+ let color = colors[0];
33
+ if(colors.length > i) color = colors[i];
34
+ return {
35
+ percentage,
36
+ offset,
37
+ color
38
+ }
39
+ });
40
+ }
41
+
42
+ /*
43
+ Rendering
44
+ */
45
+ render() {
46
+ const [{color}] = this.bars;
47
+ if(this.indeterminate !== null) return html`
48
+ <div id="bar1" class="bar indeterminate" style="background:${color};animation-duration:${this.indeterminate||'2s'}"></div>
49
+ <div id="bar2" class="bar indeterminate" style="background:${color};animation-duration:${this.indeterminate||'2s'}"></div>
50
+ `;
51
+ return html`${
52
+ this.bars.map(({
53
+ percentage,
54
+ offset,
55
+ color
56
+ }) => html`
57
+ <div
58
+ class="bar"
59
+ style="left:${offset}%;width:${percentage}%;background:${color}"
60
+ >
61
+ ${this.label?html`<div class="label">${percentage}%</div>`:''}
62
+ </div>
63
+ `)
64
+ }`;
65
+ }
66
+
67
+ /*
68
+ Styles
69
+ */
70
+ static styles = css`
71
+ :host {
72
+ --radius: 99999px;
73
+
74
+ display: block;
75
+ height: 1rem;
76
+ width: 100%;
77
+ background-color: var(--c_border);
78
+ position: relative;
79
+ overflow: hidden;
80
+ color: var(--tc_on_primary);
81
+ font-size: 0.75rem;
82
+ border-radius: var(--radius);
83
+ }
84
+
85
+ .bar {
86
+ display: flex;
87
+ align-items: center;
88
+ height: 100%;
89
+ transition: width 0.3s ease;
90
+ position: absolute;
91
+ left: 0;
92
+ border-radius: var(--radius);
93
+ }
94
+ .label {
95
+ padding: 0 var(--spacer);
96
+ }
97
+
98
+ :host([indeterminate]) .bar {
99
+ width: 25%;
100
+ transition: none;
101
+ }
102
+ :host([indeterminate]) #bar1 {
103
+ animation-name: indeterminate-bar1;
104
+ animation-timing-function: linear;
105
+ animation-iteration-count: infinite;
106
+ }
107
+ :host([indeterminate]) #bar2 {
108
+ animation-name: indeterminate-bar2;
109
+ animation-timing-function: linear;
110
+ animation-iteration-count: infinite;
111
+ }
112
+
113
+ @keyframes indeterminate-bar1 {
114
+ 0% {
115
+ left: 0%;
116
+ }
117
+ 100% {
118
+ left: 100%;
119
+ }
120
+ }
121
+ @keyframes indeterminate-bar2 {
122
+ 0% {
123
+ left: 0%;
124
+ opacity: 1;
125
+ }
126
+ 74% {
127
+ opacity: 1;
128
+ }
129
+ 75% {
130
+ left: 75%;
131
+ opacity: 0;
132
+ }
133
+ 76% {
134
+ left: -24%;
135
+ opacity: 0;
136
+ }
137
+ 76.5% {
138
+ opacity: 1;
139
+ }
140
+ 100% {
141
+ left: 0%;
142
+ opacity: 1;
143
+ }
144
+ }
145
+ `;
146
+ }
147
+
148
+ customElements.define('k-progress', Progress);
@@ -13,6 +13,25 @@ export default class Spinner extends ShadowComponent {
13
13
  this.variant = 'spinner';
14
14
  }
15
15
 
16
+
17
+
18
+ /*
19
+ Rendering
20
+ */
21
+ render() {
22
+ switch(this.variant) {
23
+ case 'dots':
24
+ return html`<div class="dots"><span></span><span></span><span></span></div>`;
25
+ case 'bars':
26
+ return html`<div class="bars"><span></span><span></span><span></span><span></span></div>`;
27
+ case 'pulse':
28
+ return html`<div class="pulse"></div>`;
29
+ case 'ring':
30
+ return html`<div class="ring"></div>`;
31
+ default:
32
+ return html`<div class="spinner"></div>`;
33
+ }
34
+ }
16
35
  /*
17
36
  Styles
18
37
  */
@@ -129,24 +148,6 @@ export default class Spinner extends ShadowComponent {
129
148
  100% { transform: rotate(360deg); border-color: var(--spinner-color) transparent transparent transparent; }
130
149
  }
131
150
  `;
132
-
133
- /*
134
- Rendering
135
- */
136
- render() {
137
- switch(this.variant) {
138
- case 'dots':
139
- return html`<div class="dots"><span></span><span></span><span></span></div>`;
140
- case 'bars':
141
- return html`<div class="bars"><span></span><span></span><span></span><span></span></div>`;
142
- case 'pulse':
143
- return html`<div class="pulse"></div>`;
144
- case 'ring':
145
- return html`<div class="ring"></div>`;
146
- default:
147
- return html`<div class="spinner"></div>`;
148
- }
149
- }
150
151
  }
151
152
 
152
153
  customElements.define('k-spinner', Spinner);