kempo-ui 0.4.0 → 0.4.2

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 (82) 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/Slider.js +188 -0
  6. package/dist/components/Split.js +31 -13
  7. package/docs/components/accordion.html +4 -0
  8. package/docs/components/aside.html +4 -0
  9. package/docs/components/card.html +4 -0
  10. package/docs/components/code-editor.html +4 -0
  11. package/docs/components/color-picker.html +4 -0
  12. package/docs/components/combobox.html +4 -0
  13. package/docs/components/content-slider.html +4 -0
  14. package/docs/components/context.html +4 -0
  15. package/docs/components/dialog.html +4 -0
  16. package/docs/components/dropdown.html +4 -0
  17. package/docs/components/filter-list.html +4 -0
  18. package/docs/components/focus-capture.html +4 -0
  19. package/docs/components/html-editor.html +4 -0
  20. package/docs/components/hybrid-component.html +4 -0
  21. package/docs/components/icon.html +4 -0
  22. package/docs/components/import.html +4 -0
  23. package/docs/components/light-component.html +4 -0
  24. package/docs/components/nav-spacer.html +4 -0
  25. package/docs/components/nav.html +4 -0
  26. package/docs/components/photo-viewer.html +4 -0
  27. package/docs/components/progress.html +4 -0
  28. package/docs/components/resize.html +4 -0
  29. package/docs/components/shadow-component.html +4 -0
  30. package/docs/components/show-more.html +4 -0
  31. package/docs/components/slider.html +781 -0
  32. package/docs/components/sortable.html +4 -0
  33. package/docs/components/spinner.html +4 -0
  34. package/docs/components/split.html +32 -3
  35. package/docs/components/table.html +4 -0
  36. package/docs/components/tableControls.html +4 -0
  37. package/docs/components/tableCustomFields.html +4 -0
  38. package/docs/components/tableFetchRecords.html +4 -0
  39. package/docs/components/tableFieldSortHide.html +4 -0
  40. package/docs/components/tablePagination.html +4 -0
  41. package/docs/components/tablePlaceholder.html +4 -0
  42. package/docs/components/tableRecordEditing.html +4 -0
  43. package/docs/components/tableRecordFiltering.html +4 -0
  44. package/docs/components/tableRecordHiding.html +4 -0
  45. package/docs/components/tableRecordSearching.html +4 -0
  46. package/docs/components/tableRecordSelection.html +4 -0
  47. package/docs/components/tableRowControls.html +4 -0
  48. package/docs/components/tableServerSync.html +4 -0
  49. package/docs/components/tableSorting.html +4 -0
  50. package/docs/components/tabs.html +4 -0
  51. package/docs/components/tags.html +4 -0
  52. package/docs/components/theme-select.html +4 -0
  53. package/docs/components/theme-switcher.html +4 -0
  54. package/docs/components/timestamp.html +4 -0
  55. package/docs/components/toast.html +4 -0
  56. package/docs/components/toggle.html +4 -0
  57. package/docs/components/tree.html +4 -0
  58. package/docs/index.html +10 -0
  59. package/docs/src/components/Slider.js +188 -0
  60. package/docs/src/components/Split.js +31 -13
  61. package/docs/utils/context.html +4 -0
  62. package/docs/utils/cookie.html +4 -0
  63. package/docs/utils/debounce.html +4 -0
  64. package/docs/utils/drag.html +4 -0
  65. package/docs/utils/elevation.html +4 -0
  66. package/docs/utils/formatTimestamp.html +4 -0
  67. package/docs/utils/object.html +4 -0
  68. package/docs/utils/propConverters.html +4 -0
  69. package/docs/utils/string.html +4 -0
  70. package/docs/utils/theme.html +4 -0
  71. package/docs/utils/toTitleCase.html +4 -0
  72. package/docs/utils/type.html +4 -0
  73. package/docs/utils/wait.html +4 -0
  74. package/docs-src/components/slider.page.html +331 -0
  75. package/docs-src/components/split.page.html +28 -3
  76. package/docs-src/index.page.html +6 -0
  77. package/docs-src/nav.fragment.html +4 -0
  78. package/llms.txt +1 -0
  79. package/package.json +1 -1
  80. package/src/components/Slider.js +480 -0
  81. package/src/components/Split.js +163 -132
  82. package/tests/components/Slider.browser-test.js +823 -0
@@ -0,0 +1,331 @@
1
+ <page pageName="Slider" title="Slider - 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 pl">
7
+ <h6>Examples</h6>
8
+ <a href="#basicUsage">Basic Usage</a><br />
9
+ <a href="#withSteps">With Steps</a><br />
10
+ <a href="#rangeSlider">Range Slider</a><br />
11
+ <a href="#vertical">Vertical</a><br />
12
+ <a href="#verticalRange">Vertical Range</a><br />
13
+ <a href="#customStyles">Custom Styles</a><br />
14
+ <a href="#formatTooltip">Format Tooltip</a><br />
15
+ <a href="#javascriptUsage">JavaScript Usage</a><br />
16
+ <a href="#formUsage">Form Usage</a><br />
17
+ <a href="#disabled">Disabled</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="#properties">Properties</a><br />
23
+ <a href="#methods">Methods</a><br />
24
+ <a href="#cssVariables">CSS Variables</a><br />
25
+ <a href="#events">Events</a><br />
26
+ </div>
27
+ </k-accordion-panel>
28
+ </k-accordion>
29
+
30
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
31
+ <p>A continuous slider from 0 to 100.</p>
32
+ <div class="row -mx">
33
+ <div class="col m-span-12 px">
34
+ <k-card label="HTML">
35
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;25&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
36
+ </k-card>
37
+ </div>
38
+ <div class="col m-span-12 px">
39
+ <k-card label="Output">
40
+ <k-slider value="25" class="my"></k-slider>
41
+ </k-card>
42
+ </div>
43
+ </div>
44
+
45
+ <h3 id="withSteps"><a href="#withSteps" class="no-link">With Steps</a></h3>
46
+ <p>Use the <code>steps</code> attribute to define specific snap points. The slider will only stop on those values.</p>
47
+ <div class="row -mx">
48
+ <div class="col m-span-12 px">
49
+ <k-card label="HTML">
50
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">min</span>=<span class="hljs-string">&quot;0&quot;</span> <span class="hljs-attr">max</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;50&quot;</span> <span class="hljs-attr">steps</span>=<span class="hljs-string">&quot;0,25,50,75,100&quot;</span>&gt;</span>Volume<span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
51
+ </k-card>
52
+ </div>
53
+ <div class="col m-span-12 px">
54
+ <k-card label="Output">
55
+ <k-slider min="0" max="100" value="50" steps="0,25,50,75,100" class="my">Volume</k-slider>
56
+ </k-card>
57
+ </div>
58
+ </div>
59
+
60
+ <h3 id="rangeSlider"><a href="#rangeSlider" class="no-link">Range Slider</a></h3>
61
+ <p>Pass two comma-separated numbers as the <code>value</code> to create a range slider with two handles. The first number is the lower bound and the second is the upper bound. The handles cannot cross each other.</p>
62
+ <div class="row -mx">
63
+ <div class="col m-span-12 px">
64
+ <k-card label="HTML">
65
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;20,80&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
66
+ </k-card>
67
+ </div>
68
+ <div class="col m-span-12 px">
69
+ <k-card label="Output">
70
+ <k-slider value="20,80" class="my"></k-slider>
71
+ </k-card>
72
+ </div>
73
+ </div>
74
+
75
+ <h4>Range with Steps</h4>
76
+ <div class="row -mx">
77
+ <div class="col m-span-12 px">
78
+ <k-card label="HTML">
79
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;25,75&quot;</span> <span class="hljs-attr">steps</span>=<span class="hljs-string">&quot;0,25,50,75,100&quot;</span>&gt;</span>Price Range<span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
80
+ </k-card>
81
+ </div>
82
+ <div class="col m-span-12 px">
83
+ <k-card label="Output">
84
+ <k-slider value="25,75" steps="0,25,50,75,100" class="my">Price Range</k-slider>
85
+ </k-card>
86
+ </div>
87
+ </div>
88
+
89
+ <h3 id="vertical"><a href="#vertical" class="no-link">Vertical</a></h3>
90
+ <p>Add the <code>vertical</code> attribute to render the slider vertically. Set a height on the element or its container.</p>
91
+ <div class="row -mx">
92
+ <div class="col m-span-12 px">
93
+ <k-card label="HTML">
94
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">vertical</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;40&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
95
+ </k-card>
96
+ </div>
97
+ <div class="col m-span-12 px">
98
+ <k-card label="Output">
99
+ <k-slider vertical value="40"></k-slider>
100
+ </k-card>
101
+ </div>
102
+ </div>
103
+
104
+ <h3 id="verticalRange"><a href="#verticalRange" class="no-link">Vertical Range</a></h3>
105
+ <p>Combine <code>vertical</code> with a comma-separated <code>value</code> for a vertical range slider.</p>
106
+ <div class="row -mx">
107
+ <div class="col m-span-12 px">
108
+ <k-card label="HTML">
109
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">vertical</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;20,80&quot;</span> <span class="hljs-attr">steps</span>=<span class="hljs-string">&quot;0,20,40,60,80,100&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
110
+ </k-card>
111
+ </div>
112
+ <div class="col m-span-12 px">
113
+ <k-card label="Output">
114
+ <k-slider vertical value="20,80"></k-slider>
115
+ </k-card>
116
+ </div>
117
+ </div>
118
+
119
+ <h3 id="customStyles"><a href="#customStyles" class="no-link">Custom Styles</a></h3>
120
+ <div class="row -mx">
121
+ <div class="col m-span-12 px">
122
+ <k-card label="HTML">
123
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;50&quot;</span> <span class="hljs-attr">style</span>=<span class="hljs-string">&quot;<br> --track_height: 10px;<br> --fill_background: var(--c_success);<br> --thumb_size: 28px;<br> --thumb_background: var(--c_success);<br> --step_dot_size: 12px;<br> &quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
124
+ </k-card>
125
+ </div>
126
+ <div class="col m-span-12 px">
127
+ <k-card label="Output">
128
+ <k-slider
129
+ value="50"
130
+ style="
131
+ --track_height: 10px;
132
+ --fill_background: var(--c_success);
133
+ --thumb_size: 28px;
134
+ --thumb_background: var(--c_success);
135
+ --step_dot_size: 12px;
136
+ "
137
+ ></k-slider>
138
+ </k-card>
139
+ </div>
140
+ </div>
141
+
142
+ <h3 id="formatTooltip"><a href="#formatTooltip" class="no-link">Format Tooltip</a></h3>
143
+ <p>Add the <code>tooltip</code> attribute to show a value tooltip above the handle while dragging. Use the <code>format</code> attribute to control how the value is displayed in the tooltip, change event, and form submission. The pattern <code>0.00</code> in the format string is replaced with the numeric value at the matching decimal precision.</p>
144
+ <div class="row -mx">
145
+ <div class="col m-span-12 px">
146
+ <k-card label="HTML">
147
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;25&quot;</span> <span class="hljs-attr">min</span>=<span class="hljs-string">&quot;0&quot;</span> <span class="hljs-attr">max</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">format</span>=<span class="hljs-string">&quot;$0.00&quot;</span> <span class="hljs-attr">tooltip</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
148
+ </k-card>
149
+ </div>
150
+ <div class="col m-span-12 px">
151
+ <k-card label="Output">
152
+ <k-slider value="25" min="0" max="100" format="$0.00" tooltip class="my"></k-slider>
153
+ </k-card>
154
+ </div>
155
+ </div>
156
+
157
+ <h3 id="javascriptUsage"><a href="#javascriptUsage" class="no-link">JavaScript Usage</a></h3>
158
+ <h4>Single Value</h4>
159
+ <div class="row -mx">
160
+ <div class="col m-span-12 px">
161
+ <k-card label="HTML">
162
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;jsSlider&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;0&quot;</span> <span class="hljs-attr">format</span>=<span class="hljs-string">&quot;0&quot;</span> <span class="hljs-attr">tooltip</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Value: <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;sliderVal&quot;</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="language-javascript"><br> <span class="hljs-keyword">const</span> $jsSlider = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;jsSlider&#x27;</span>);<br> <span class="hljs-keyword">const</span> $sliderVal = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;sliderVal&#x27;</span>);<br> $jsSlider.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&#x27;change&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {<br> $sliderVal.<span class="hljs-property">textContent</span> = e.<span class="hljs-property">detail</span>.<span class="hljs-property">value</span>;<br> });<br></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
163
+ </k-card>
164
+ </div>
165
+ <div class="col m-span-12 px">
166
+ <k-card label="Output">
167
+ <k-slider id="jsSlider" value="0" format="0" tooltip class="my"></k-slider>
168
+ <p>Value: <span id="sliderVal">0</span></p>
169
+ <script>
170
+ const $jsSlider = document.getElementById('jsSlider');
171
+ const $sliderVal = document.getElementById('sliderVal');
172
+ $jsSlider.addEventListener('change', (e) => {
173
+ $sliderVal.textContent = e.detail.value;
174
+ });
175
+ </script>
176
+ </k-card>
177
+ </div>
178
+ </div>
179
+
180
+ <h4>Range</h4>
181
+ <div class="row -mx">
182
+ <div class="col m-span-12 px">
183
+ <k-card label="HTML">
184
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;jsRangeSlider&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;10,90&quot;</span> <span class="hljs-attr">format</span>=<span class="hljs-string">&quot;0&quot;</span> <span class="hljs-attr">tooltip</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Range: <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;rangeDisplay&quot;</span>&gt;</span>10 - 90<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="language-javascript"><br> <span class="hljs-keyword">const</span> $rs = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;jsRangeSlider&#x27;</span>);<br> <span class="hljs-keyword">const</span> $rd = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;rangeDisplay&#x27;</span>);<br> $rs.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&#x27;change&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {<br> <span class="hljs-keyword">const</span> [lo, hi] = e.<span class="hljs-property">detail</span>.<span class="hljs-property">value</span>.<span class="hljs-title function_">split</span>(<span class="hljs-string">&#x27;,&#x27;</span>);<br> $rd.<span class="hljs-property">textContent</span> = lo + <span class="hljs-string">&#x27; - &#x27;</span> + hi;<br> });<br></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
185
+ </k-card>
186
+ </div>
187
+ <div class="col m-span-12 px">
188
+ <k-card label="Output">
189
+ <k-slider id="jsRangeSlider" class="my" value="10,90" format="0" tooltip></k-slider>
190
+ <p>Range: <span id="rangeDisplay">10 - 90</span></p>
191
+ <script>
192
+ const $rs = document.getElementById('jsRangeSlider');
193
+ const $rd = document.getElementById('rangeDisplay');
194
+ $rs.addEventListener('change', (e) => {
195
+ const [lo, hi] = e.detail.value.split(',');
196
+ $rd.textContent = lo + ' - ' + hi;
197
+ });
198
+ </script>
199
+ </k-card>
200
+ </div>
201
+ </div>
202
+
203
+ <h3 id="formUsage"><a href="#formUsage" class="no-link">Form Usage</a></h3>
204
+ <p>The slider is form-associated. Set a <code>name</code> attribute so it participates in form submission. When a <code>format</code> is set, the submitted value is the formatted string.</p>
205
+ <div class="row -mx">
206
+ <div class="col m-span-12 px">
207
+ <k-card label="HTML">
208
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;sliderForm&quot;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;volume&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;75&quot;</span> <span class="hljs-attr">format</span>=<span class="hljs-string">&quot;0%&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;priceRange&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;20,80&quot;</span> <span class="hljs-attr">format</span>=<span class="hljs-string">&quot;$0&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;submit&quot;</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Form Data: <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;formOutput&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="language-javascript"><br> <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;sliderForm&#x27;</span>).<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&#x27;submit&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {<br> e.<span class="hljs-title function_">preventDefault</span>();<br> <span class="hljs-keyword">const</span> fd = <span class="hljs-keyword">new</span> <span class="hljs-title class_">FormData</span>(e.<span class="hljs-property">target</span>);<br> <span class="hljs-keyword">const</span> entries = [...fd.<span class="hljs-title function_">entries</span>()].<span class="hljs-title function_">map</span>(<span class="hljs-function">(<span class="hljs-params">[k, v]</span>) =&gt;</span> k + <span class="hljs-string">&#x27;=&#x27;</span> + v);<br> <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;formOutput&#x27;</span>).<span class="hljs-property">textContent</span> = entries.<span class="hljs-title function_">join</span>(<span class="hljs-string">&#x27;, &#x27;</span>);<br> });<br></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
209
+ </k-card>
210
+ </div>
211
+ <div class="col m-span-12 px">
212
+ <k-card label="Output">
213
+ <form id="sliderForm">
214
+ <k-slider name="volume" value="75" format="0%" class="my"></k-slider>
215
+ <k-slider name="priceRange" value="20,80" format="$0" class="my"></k-slider>
216
+ <button type="submit">Submit</button>
217
+ </form>
218
+ <p>Form Data: <span id="formOutput"></span></p>
219
+ <script>
220
+ document.getElementById('sliderForm').addEventListener('submit', (e) => {
221
+ e.preventDefault();
222
+ const fd = new FormData(e.target);
223
+ const entries = [...fd.entries()].map(([k, v]) => k + '=' + v);
224
+ document.getElementById('formOutput').textContent = entries.join(', ');
225
+ });
226
+ </script>
227
+ </k-card>
228
+ </div>
229
+ </div>
230
+
231
+ <h3 id="disabled"><a href="#disabled" class="no-link">Disabled</a></h3>
232
+ <p>The <code>disabled</code> attribute prevents user interaction while displaying the current value.</p>
233
+ <div class="row -mx">
234
+ <div class="col m-span-12 px">
235
+ <k-card label="HTML">
236
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-slider</span> <span class="hljs-attr">disabled</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;40&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-slider</span>&gt;</span></code></pre>
237
+ </k-card>
238
+ </div>
239
+ <div class="col m-span-12 px">
240
+ <k-card label="Output">
241
+ <k-slider disabled class="my" value="40"></k-slider>
242
+ </k-card>
243
+ </div>
244
+ </div>
245
+
246
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
247
+
248
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
249
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
250
+ <h5><code>new Slider()</code></h5>
251
+
252
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
253
+ <ul>
254
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
255
+ </ul>
256
+
257
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
258
+ <h5><code>value<i>: String</i></code></h5>
259
+ <p>The current value. A single number (e.g. <code>"50"</code>) for a standard slider, or two comma-separated numbers (e.g. <code>"20,80"</code>) for a range slider. Default is <code>"0"</code>. Syncs to <code>value</code> attribute.</p>
260
+
261
+ <h5><code>name<i>: String</i></code></h5>
262
+ <p>The form field name. When set inside a <code>&lt;form&gt;</code>, the slider participates in form submission. Syncs to <code>name</code> attribute.</p>
263
+
264
+ <h5><code>min<i>: Number</i></code></h5>
265
+ <p>The minimum value of the slider range. Default is <code>0</code>. Syncs to <code>min</code> attribute.</p>
266
+
267
+ <h5><code>max<i>: Number</i></code></h5>
268
+ <p>The maximum value of the slider range. Default is <code>100</code>. Syncs to <code>max</code> attribute.</p>
269
+
270
+ <h5><code>steps<i>: String</i></code></h5>
271
+ <p>A comma-separated list of specific values the slider can snap to (e.g. <code>"0,25,50,75,100"</code>). When set, the slider only stops on these values. When not set, the slider is continuous. Syncs to <code>steps</code> attribute.</p>
272
+
273
+ <h5><code>format<i>: String</i></code></h5>
274
+ <p>A pattern string for formatting the slider value. Applied to the tooltip display, the <code>change</code> event <code>detail.value</code>, and the form submission value. Use <code>0</code>s as digit placeholders — the number of <code>0</code>s after the decimal separator controls precision. For example <code>"$0.00"</code> formats <code>25</code> as <code>"$25.00"</code>. Default is <code>null</code> (raw number). Syncs to <code>format</code> attribute.</p>
275
+
276
+ <h5><code>tooltip<i>: Boolean</i></code></h5>
277
+ <p>When <code>true</code>, a tooltip showing the current value appears above the thumb handle during drag. Default is <code>false</code>. Syncs to <code>tooltip</code> attribute.</p>
278
+
279
+ <h5><code>vertical<i>: Boolean</i></code></h5>
280
+ <p>When <code>true</code>, the slider renders vertically. Set a height on the element to control the track length. Default is <code>false</code>. Syncs to <code>vertical</code> attribute.</p>
281
+
282
+ <h5><code>disabled<i>: Boolean</i></code></h5>
283
+ <p>When <code>true</code>, the slider cannot be changed by user interaction. The element appears at 50% opacity. Syncs to <code>disabled</code> attribute.</p>
284
+
285
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
286
+ <h5><code>setValue(newValue)<i>: void</i></code></h5>
287
+ <p>Sets the lower value, clamped to min/max and snapped to the nearest step. In range mode, it cannot exceed the upper value.</p>
288
+
289
+ <h5><code>setUpper(newValue)<i>: void</i></code></h5>
290
+ <p>Sets the upper value (range mode only), clamped to min/max and snapped to the nearest step. Cannot go below the lower value.</p>
291
+
292
+ <h5><code>isRange<i>: Boolean</i></code> (getter)</h5>
293
+ <p>Returns <code>true</code> when the <code>value</code> contains a comma (i.e. two handles are active).</p>
294
+
295
+ <h5><code>formattedValue<i>: String</i></code> (getter)</h5>
296
+ <p>Returns the value formatted with the <code>format</code> pattern. For range sliders, both halves are formatted (e.g. <code>"$20.00,$80.00"</code>). Returns the raw <code>value</code> when no format is set.</p>
297
+
298
+ <h5><code>lower<i>: Number</i></code> (getter)</h5>
299
+ <p>The numeric lower bound parsed from <code>value</code>.</p>
300
+
301
+ <h5><code>upper<i>: Number</i></code> (getter)</h5>
302
+ <p>The numeric upper bound parsed from <code>value</code>. Equals <code>max</code> when not in range mode.</p>
303
+
304
+ <h3 id="cssVariables"><a href="#cssVariables" class="no-link">CSS Variables</a></h3>
305
+ <table class="b">
306
+ <thead><tr><th>Variable</th><th>Default</th><th>Description</th></tr></thead>
307
+ <tbody>
308
+ <tr><td><code>--track_height</code></td><td><code>6px</code></td><td>Thickness of the track (height when horizontal, width when vertical)</td></tr>
309
+ <tr><td><code>--track_background</code></td><td><code>var(--c_border)</code></td><td>Background color of the track</td></tr>
310
+ <tr><td><code>--track_radius</code></td><td><code>99999px</code></td><td>Border radius of the track</td></tr>
311
+ <tr><td><code>--fill_background</code></td><td><code>var(--c_primary)</code></td><td>Color of the filled portion</td></tr>
312
+ <tr><td><code>--thumb_size</code></td><td><code>20px</code></td><td>Diameter of the thumb handle(s)</td></tr>
313
+ <tr><td><code>--thumb_background</code></td><td><code>var(--c_primary)</code></td><td>Background color of the thumb(s)</td></tr>
314
+ <tr><td><code>--thumb_border</code></td><td><code>2px solid white</code></td><td>Border of the thumb(s)</td></tr>
315
+ <tr><td><code>--thumb_shadow</code></td><td><code>0 1px 3px rgba(0,0,0,.3)</code></td><td>Box shadow of the thumb(s)</td></tr>
316
+ <tr><td><code>--step_dot_size</code></td><td><code>8px</code></td><td>Diameter of step indicator dots</td></tr>
317
+ <tr><td><code>--step_dot_background</code></td><td><code>var(--c_bg__alt)</code></td><td>Background of step dots</td></tr>
318
+ <tr><td><code>--step_dot_border</code></td><td><code>1px solid var(--c_border)</code></td><td>Border of step dots</td></tr>
319
+ </tbody>
320
+ </table>
321
+
322
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
323
+ <h5><code>change</code></h5>
324
+ <p>Fired when the value changes. The event <code>detail</code> contains <code>{ value: String }</code>. When a <code>format</code> is set, the value is formatted (e.g. <code>"$50.00"</code> or <code>"$20.00,$80.00"</code>). Without a format, the raw number string is used (e.g. <code>"50"</code> or <code>"20,80"</code>).</p>
325
+ </content>
326
+ <content location="scripts">
327
+ <script type="module" src="{{pathToRoot}}src/components/Slider.js"></script>
328
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
329
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
330
+ </content>
331
+ </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>
@@ -161,6 +161,12 @@
161
161
  <p class="tc-muted">Truncate long content with a "show more" button to expand.</p>
162
162
  </a>
163
163
  </div>
164
+ <div class="span-12 t-span-6 d-span-4 px">
165
+ <a href="{{pathToRoot}}components/slider.html" class="card mb no-link d-b">
166
+ <h3 class="tc-primary">Slider</h3>
167
+ <p class="tc-muted">Range input with configurable min, max, and discrete step snap points.</p>
168
+ </a>
169
+ </div>
164
170
  <div class="span-12 t-span-6 d-span-4 px">
165
171
  <a href="{{pathToRoot}}components/sortable.html" class="card mb no-link d-b">
166
172
  <h3 class="tc-primary">Sortable</h3>
@@ -95,6 +95,9 @@
95
95
  <k-filter-item filter-keywords="show more showmore components"><a
96
96
  href="{{pathToRoot}}components/show-more.html"
97
97
  >Show More<br><small>Component</small></a></k-filter-item>
98
+ <k-filter-item filter-keywords="slider range input step components"><a
99
+ href="{{pathToRoot}}components/slider.html"
100
+ >Slider<br><small>Component</small></a></k-filter-item>
98
101
  <k-filter-item filter-keywords="sortable drag drop sort components"><a
99
102
  href="{{pathToRoot}}components/sortable.html"
100
103
  >Sortable<br><small>Component</small></a></k-filter-item>
@@ -269,6 +272,7 @@
269
272
  <a href="{{pathToRoot}}components/progress.html">Progress</a>
270
273
  <a href="{{pathToRoot}}components/resize.html">Resize</a>
271
274
  <a href="{{pathToRoot}}components/show-more.html">Show More</a>
275
+ <a href="{{pathToRoot}}components/slider.html">Slider</a>
272
276
  <a href="{{pathToRoot}}components/sortable.html">Sortable</a>
273
277
  <a href="{{pathToRoot}}components/spinner.html">Spinner</a>
274
278
  <a href="{{pathToRoot}}components/split.html">Split</a>
package/llms.txt CHANGED
@@ -73,6 +73,7 @@ import { html, css, LitElement } from 'kempo-ui/src/lit-all.min.js';
73
73
  | `<k-photo-viewer>` | `PhotoViewer.js` | Lightbox/gallery viewer | [photo-viewer.html](https://dustinpoissant.github.io/kempo-ui/components/photo-viewer.html) |
74
74
  | `<k-resize>` | `Resize.js` | Resizable pane with drag handle | [resize.html](https://dustinpoissant.github.io/kempo-ui/components/resize.html) |
75
75
  | `<k-show-more>` | `ShowMore.js` | Truncated content with expand toggle | [show-more.html](https://dustinpoissant.github.io/kempo-ui/components/show-more.html) |
76
+ | `<k-slider>` | `Slider.js` | Slider with min, max, discrete step snap points, vertical orientation, and dual-handle range mode via comma-separated `value` (e.g. `"20,80"`); `format` attribute for value formatting (e.g. `"$0.00"`) applied to change events, form submission, and optional drag `tooltip`; form-associated; fires `change` | [slider.html](https://dustinpoissant.github.io/kempo-ui/components/slider.html) |
76
77
  | `<k-sortable>` `<k-sortable-item>` | `Sortable.js` | Drag-to-reorder list | [sortable.html](https://dustinpoissant.github.io/kempo-ui/components/sortable.html) |
77
78
  | `<k-spinner>` | `Spinner.js` | Loading indicator; `size` (xs/sm/md/lg/xl), `variant` (spinner/dots/bar) | [spinner.html](https://dustinpoissant.github.io/kempo-ui/components/spinner.html) |
78
79
  | `<k-split>` | `Split.js` | Resizable split panes | [split.html](https://dustinpoissant.github.io/kempo-ui/components/split.html) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo-ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "A Lit based web-component library",
6
6
  "main": "index.js",