kempo-ui 0.4.11 → 0.4.13

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 (104) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/SegmentedControl.js +16 -0
  3. package/dist/components/Tabs.js +4 -4
  4. package/docs/components/SegmentedControl.html +649 -0
  5. package/docs/components/accordion.html +3 -0
  6. package/docs/components/aside.html +3 -0
  7. package/docs/components/calendar.html +3 -0
  8. package/docs/components/card.html +3 -0
  9. package/docs/components/chat.html +3 -0
  10. package/docs/components/code-editor.html +3 -0
  11. package/docs/components/color-picker.html +3 -0
  12. package/docs/components/combobox.html +3 -0
  13. package/docs/components/content-slider.html +3 -0
  14. package/docs/components/context.html +3 -0
  15. package/docs/components/dialog.html +3 -0
  16. package/docs/components/dropdown.html +3 -0
  17. package/docs/components/filter-list.html +3 -0
  18. package/docs/components/focus-capture.html +3 -0
  19. package/docs/components/html-editor.html +3 -0
  20. package/docs/components/hybrid-component.html +3 -0
  21. package/docs/components/icon.html +3 -0
  22. package/docs/components/import.html +3 -0
  23. package/docs/components/light-component.html +3 -0
  24. package/docs/components/markdown-editor.html +3 -0
  25. package/docs/components/markdown.html +3 -0
  26. package/docs/components/nav-spacer.html +3 -0
  27. package/docs/components/nav.html +3 -0
  28. package/docs/components/photo-viewer.html +3 -0
  29. package/docs/components/progress.html +3 -0
  30. package/docs/components/resize.html +3 -0
  31. package/docs/components/segmented-control.html +728 -0
  32. package/docs/components/shadow-component.html +3 -0
  33. package/docs/components/show-more.html +3 -0
  34. package/docs/components/slider.html +3 -0
  35. package/docs/components/sortable.html +3 -0
  36. package/docs/components/speech-to-text.html +3 -0
  37. package/docs/components/spinner.html +3 -0
  38. package/docs/components/split.html +3 -0
  39. package/docs/components/table.html +3 -0
  40. package/docs/components/tableControls.html +3 -0
  41. package/docs/components/tableCustomFields.html +3 -0
  42. package/docs/components/tableFetchRecords.html +3 -0
  43. package/docs/components/tableFieldSortHide.html +3 -0
  44. package/docs/components/tablePagination.html +3 -0
  45. package/docs/components/tablePlaceholder.html +3 -0
  46. package/docs/components/tableRecordEditing.html +3 -0
  47. package/docs/components/tableRecordFiltering.html +3 -0
  48. package/docs/components/tableRecordHiding.html +3 -0
  49. package/docs/components/tableRecordSearching.html +3 -0
  50. package/docs/components/tableRecordSelection.html +3 -0
  51. package/docs/components/tableRowControls.html +3 -0
  52. package/docs/components/tableServerSync.html +3 -0
  53. package/docs/components/tableSorting.html +3 -0
  54. package/docs/components/tabs.html +32 -0
  55. package/docs/components/tags.html +3 -0
  56. package/docs/components/text-to-speech.html +3 -0
  57. package/docs/components/theme-select.html +3 -0
  58. package/docs/components/theme-switcher.html +3 -0
  59. package/docs/components/time.html +3 -0
  60. package/docs/components/timestamp.html +3 -0
  61. package/docs/components/toast.html +3 -0
  62. package/docs/components/toggle.html +3 -0
  63. package/docs/components/tree.html +3 -0
  64. package/docs/components/voice-selector.html +3 -0
  65. package/docs/icons/account-circle.svg +1 -1
  66. package/docs/index.html +9 -0
  67. package/docs/src/components/SegmentedControl.js +16 -0
  68. package/docs/src/components/Tabs.js +4 -4
  69. package/docs/utils/context.html +3 -0
  70. package/docs/utils/cookie.html +3 -0
  71. package/docs/utils/debounce.html +3 -0
  72. package/docs/utils/drag.html +3 -0
  73. package/docs/utils/elevation.html +3 -0
  74. package/docs/utils/formatTimestamp.html +3 -0
  75. package/docs/utils/object.html +3 -0
  76. package/docs/utils/propConverters.html +3 -0
  77. package/docs/utils/sanitizeHtml.html +3 -0
  78. package/docs/utils/string.html +3 -0
  79. package/docs/utils/theme.html +3 -0
  80. package/docs/utils/toTitleCase.html +3 -0
  81. package/docs/utils/type.html +3 -0
  82. package/docs/utils/voice.html +3 -0
  83. package/docs/utils/wait.html +3 -0
  84. package/docs-src/components/segmented-control.page.html +236 -0
  85. package/docs-src/components/tabs.page.html +29 -0
  86. package/docs-src/index.page.html +6 -0
  87. package/docs-src/nav.fragment.html +3 -0
  88. package/icons/account-circle.svg +1 -1
  89. package/llms.txt +2 -1
  90. package/package.json +1 -1
  91. package/src/components/SegmentedControl.js +118 -0
  92. package/src/components/Tabs.js +21 -1
  93. package/tasks/released/0004-create-segmented-control-component/component-rendering.png +0 -0
  94. package/tasks/released/0004-create-segmented-control-component/final-component-page.png +0 -0
  95. package/tasks/released/0004-create-segmented-control-component/form-integration-section.png +0 -0
  96. package/tasks/released/0004-create-segmented-control-component/option-element-section.png +0 -0
  97. package/tasks/released/0004-create-segmented-control-component/page-screenshot.png +0 -0
  98. package/tasks/released/0004-create-segmented-control-component/validation-form-integration.png +0 -0
  99. package/tasks/released/0004-create-segmented-control-component/validation-screenshot-1-full-page.png +0 -0
  100. package/tasks/released/0004-create-segmented-control-component/validation-screenshot-2-icon-options.png +0 -0
  101. package/tasks/released/0004-create-segmented-control-component.md +106 -0
  102. package/tasks/released/0005-add-persistent-id-to-tabs.md +98 -0
  103. package/tests/components/SegmentedControl.browser-test.js +223 -0
  104. package/tests/components/Tabs.browser-test.js +262 -0
@@ -0,0 +1,649 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Segmented Control - Components - Kempo Docs - A Web Components Solution</title>
7
+ <link rel="icon" type="image/png" sizes="48x48" href="../media/icon48.png">
8
+ <link rel="manifest" href="../manifest.json" />
9
+ <link rel="stylesheet" href="../kempo-vars.css" />
10
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@2/dist/kempo.min.css" />
11
+ <link rel="stylesheet" href="../kempo-hljs.css" />
12
+ <link rel="stylesheet" href="../styles.css" />
13
+ <script>window.litDisableBundleWarning = true;</script>
14
+
15
+ </head>
16
+ <body>
17
+
18
+ <k-nav
19
+ fixed
20
+ class="bg-primary"
21
+ >
22
+ <button
23
+ id="toggleNavSideMenu"
24
+ class="link"
25
+ >
26
+ <k-icon name="menu"></k-icon>
27
+ </button>
28
+ <a
29
+ href="../"
30
+ class="d-if ph"
31
+ style="align-items: center"
32
+ >
33
+ <img
34
+ src="../media/icon32.png"
35
+ alt="Kempo UI Icon"
36
+ class="pr"
37
+ />
38
+ Kempo UI
39
+ </a>
40
+ <div
41
+ style="position:relative;margin:0 .25rem;align-self:center;"
42
+ theme="light"
43
+ >
44
+ <input
45
+ id="navSearchInput"
46
+ type="search"
47
+ placeholder="Search docs..."
48
+ autocomplete="off"
49
+ style="width:11rem;"
50
+ />
51
+ <div
52
+ id="navSearchDropdown"
53
+ hidden
54
+ theme="light"
55
+ style="position:absolute;top:calc(100% + 4px);left:0;width:min(480px,90vw);max-height:70vh;background:var(--c_bg);border:1px solid var(--c_border);border-radius:var(--radius);overflow:auto;z-index:9999;box-shadow:0 4px 12px rgba(0,0,0,.3);"
56
+ >
57
+ <k-filter-list
58
+ id="navSearchList"
59
+ style="display:block;padding:.25rem 0;"
60
+ >
61
+ <k-filter-item filter-keywords="accordion components"><a
62
+ href="../components/accordion.html">Accordion<br><small>Component</small></a></k-filter-item>
63
+ <k-filter-item filter-keywords="aside sidebar components"><a
64
+ href="../components/aside.html">Aside<br><small>Component</small></a></k-filter-item>
65
+ <k-filter-item filter-keywords="calendar date picker range month day components"><a
66
+ href="../components/calendar.html"
67
+ >Calendar<br><small>Component</small></a></k-filter-item>
68
+ <k-filter-item filter-keywords="card components"><a
69
+ href="../components/card.html">Card<br><small>Component</small></a></k-filter-item>
70
+ <k-filter-item filter-keywords="chat message conversation messaging components"><a
71
+ href="../components/chat.html"
72
+ >Chat<br><small>Component</small></a></k-filter-item>
73
+ <k-filter-item filter-keywords="code editor codeeditor monaco components"><a
74
+ href="../components/code-editor.html"
75
+ >Code Editor<br><small>Component</small></a></k-filter-item>
76
+ <k-filter-item filter-keywords="combobox combo box search autocomplete components"><a
77
+ href="../components/combobox.html"
78
+ >Combobox<br><small>Component</small></a></k-filter-item>
79
+ <k-filter-item filter-keywords="color picker colorpicker components"><a
80
+ href="../components/color-picker.html"
81
+ >Color Picker<br><small>Component</small></a></k-filter-item>
82
+ <k-filter-item filter-keywords="content slider components"><a
83
+ href="../components/content-slider.html"
84
+ >Content Slider<br><small>Component</small></a></k-filter-item>
85
+ <k-filter-item filter-keywords="context state global components"><a
86
+ href="../components/context.html"
87
+ >Context<br><small>Component</small></a></k-filter-item>
88
+ <k-filter-item filter-keywords="dialog modal popup components"><a
89
+ href="../components/dialog.html">Dialog<br><small>Component</small></a></k-filter-item>
90
+ <k-filter-item filter-keywords="dropdown select components"><a
91
+ href="../components/dropdown.html">Dropdown<br><small>Component</small></a></k-filter-item>
92
+ <k-filter-item filter-keywords="filter list filterlist components"><a
93
+ href="../components/filter-list.html"
94
+ >Filter List<br><small>Component</small></a></k-filter-item>
95
+ <k-filter-item filter-keywords="focus capture focuscapture components"><a
96
+ href="../components/focus-capture.html"
97
+ >Focus Capture<br><small>Component</small></a></k-filter-item>
98
+ <k-filter-item filter-keywords="html editor components"><a
99
+ href="../components/html-editor.html">HTML
100
+ Editor<br><small>Component</small></a></k-filter-item>
101
+ <k-filter-item filter-keywords="markdown render parser marked gfm components"><a
102
+ href="../components/markdown.html"
103
+ >Markdown<br><small>Component</small></a></k-filter-item>
104
+ <k-filter-item filter-keywords="markdown editor markdowneditor write preview marked gfm tables components"><a
105
+ href="../components/markdown-editor.html"
106
+ >Markdown Editor<br><small>Component</small></a></k-filter-item>
107
+ <k-filter-item filter-keywords="icon components"><a
108
+ href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
109
+ <k-filter-item filter-keywords="import components"><a
110
+ href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
111
+ <k-filter-item filter-keywords="nav navbar navigation components"><a
112
+ href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
113
+ <k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a
114
+ href="../components/nav-spacer.html"
115
+ >Nav Spacer<br><small>Component</small></a></k-filter-item>
116
+ <k-filter-item filter-keywords="photo viewer photoviewer components"><a
117
+ href="../components/photo-viewer.html"
118
+ >Photo Viewer<br><small>Component</small></a></k-filter-item>
119
+ <k-filter-item filter-keywords="progress loading components"><a
120
+ href="../components/progress.html">Progress<br><small>Component</small></a></k-filter-item>
121
+ <k-filter-item filter-keywords="resize components"><a
122
+ href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
123
+ <k-filter-item filter-keywords="segmented control segment option button group components"><a
124
+ href="../components/segmented-control.html"
125
+ >Segmented Control<br><small>Component</small></a></k-filter-item>
126
+ <k-filter-item filter-keywords="show more showmore components"><a
127
+ href="../components/show-more.html"
128
+ >Show More<br><small>Component</small></a></k-filter-item>
129
+ <k-filter-item filter-keywords="slider range input step components"><a
130
+ href="../components/slider.html"
131
+ >Slider<br><small>Component</small></a></k-filter-item>
132
+ <k-filter-item filter-keywords="sortable drag drop sort components"><a
133
+ href="../components/sortable.html"
134
+ >Sortable<br><small>Component</small></a></k-filter-item>
135
+ <k-filter-item filter-keywords="speech to text speechtotext microphone voice recognition transcription components"><a
136
+ href="../components/speech-to-text.html"
137
+ >Speech To Text<br><small>Component</small></a></k-filter-item>
138
+ <k-filter-item filter-keywords="spinner loading components"><a
139
+ href="../components/spinner.html">Spinner<br><small>Component</small></a></k-filter-item>
140
+ <k-filter-item filter-keywords="split pane components"><a
141
+ href="../components/split.html">Split<br><small>Component</small></a></k-filter-item>
142
+ <k-filter-item filter-keywords="table data grid components"><a
143
+ href="../components/table.html">Table<br><small>Component</small></a></k-filter-item>
144
+ <k-filter-item filter-keywords="table controls advanced example"><a
145
+ href="../components/tableControls.html"
146
+ >Table &mdash; Controls<br><small>Advanced Example</small></a></k-filter-item>
147
+ <k-filter-item filter-keywords="table custom fields advanced example"><a
148
+ href="../components/tableCustomFields.html"
149
+ >Table &mdash; Custom Fields<br><small>Advanced Example</small></a></k-filter-item>
150
+ <k-filter-item filter-keywords="table fetch records advanced example"><a
151
+ href="../components/tableFetchRecords.html"
152
+ >Table &mdash; Fetch Records<br><small>Advanced Example</small></a></k-filter-item>
153
+ <k-filter-item filter-keywords="table field sort hide advanced example"><a
154
+ href="../components/tableFieldSortHide.html"
155
+ >Table &mdash; Field Sort &amp; Hide<br><small>Advanced Example</small></a></k-filter-item>
156
+ <k-filter-item filter-keywords="table pagination advanced example"><a
157
+ href="../components/tablePagination.html"
158
+ >Table &mdash; Pagination<br><small>Advanced Example</small></a></k-filter-item>
159
+ <k-filter-item filter-keywords="table record editing advanced example"><a
160
+ href="../components/tableRecordEditing.html"
161
+ >Table &mdash; Record Editing<br><small>Advanced Example</small></a></k-filter-item>
162
+ <k-filter-item filter-keywords="table record filtering advanced example"><a
163
+ href="../components/tableRecordFiltering.html"
164
+ >Table &mdash; Record Filtering<br><small>Advanced Example</small></a></k-filter-item>
165
+ <k-filter-item filter-keywords="table record hiding advanced example"><a
166
+ href="../components/tableRecordHiding.html"
167
+ >Table &mdash; Record Hiding<br><small>Advanced Example</small></a></k-filter-item>
168
+ <k-filter-item filter-keywords="table record searching advanced example"><a
169
+ href="../components/tableRecordSearching.html"
170
+ >Table &mdash; Record Searching<br><small>Advanced Example</small></a></k-filter-item>
171
+ <k-filter-item filter-keywords="table record selection advanced example"><a
172
+ href="../components/tableRecordSelection.html"
173
+ >Table &mdash; Record Selection<br><small>Advanced Example</small></a></k-filter-item>
174
+ <k-filter-item filter-keywords="table row controls advanced example"><a
175
+ href="../components/tableRowControls.html"
176
+ >Table &mdash; Row Controls<br><small>Advanced Example</small></a></k-filter-item>
177
+ <k-filter-item filter-keywords="table server sync advanced example"><a
178
+ href="../components/tableServerSync.html"
179
+ >Table &mdash; Server Sync<br><small>Advanced Example</small></a></k-filter-item>
180
+ <k-filter-item filter-keywords="table sorting advanced example"><a
181
+ href="../components/tableSorting.html"
182
+ >Table &mdash; Sorting<br><small>Advanced Example</small></a></k-filter-item>
183
+ <k-filter-item filter-keywords="table placeholder advanced example"><a
184
+ href="../components/tablePlaceholder.html"
185
+ >Table &mdash; Placeholder<br><small>Advanced Example</small></a></k-filter-item>
186
+ <k-filter-item filter-keywords="tabs tab panel components"><a
187
+ href="../components/tabs.html">Tabs<br><small>Component</small></a></k-filter-item>
188
+ <k-filter-item filter-keywords="tags tag input components"><a
189
+ href="../components/tags.html">Tags<br><small>Component</small></a></k-filter-item>
190
+ <k-filter-item filter-keywords="text to speech texttospeech tts speak voice synthesis components"><a
191
+ href="../components/text-to-speech.html"
192
+ >Text To Speech<br><small>Component</small></a></k-filter-item>
193
+ <k-filter-item filter-keywords="theme select dropdown dark light components"><a
194
+ href="../components/theme-select.html"
195
+ >Theme Select<br><small>Component</small></a></k-filter-item>
196
+ <k-filter-item filter-keywords="theme switcher dark light components"><a
197
+ href="../components/theme-switcher.html"
198
+ >Theme Switcher<br><small>Component</small></a></k-filter-item>
199
+ <k-filter-item filter-keywords="time picker clock hour minute form components"><a
200
+ href="../components/time.html"
201
+ >Time<br><small>Component</small></a></k-filter-item>
202
+ <k-filter-item filter-keywords="timestamp date time components"><a
203
+ href="../components/timestamp.html"
204
+ >Timestamp<br><small>Component</small></a></k-filter-item>
205
+ <k-filter-item filter-keywords="toast notification alert components"><a
206
+ href="../components/toast.html"
207
+ >Toast<br><small>Component</small></a></k-filter-item>
208
+ <k-filter-item filter-keywords="toggle switch checkbox components"><a
209
+ href="../components/toggle.html"
210
+ >Toggle<br><small>Component</small></a></k-filter-item>
211
+ <k-filter-item filter-keywords="tree treeview components"><a
212
+ href="../components/tree.html">Tree<br><small>Component</small></a></k-filter-item>
213
+ <k-filter-item filter-keywords="voice selector dropdown speech synthesis preference components"><a
214
+ href="../components/voice-selector.html"
215
+ >Voice Selector<br><small>Component</small></a></k-filter-item>
216
+ <k-filter-item filter-keywords="shadow component base"><a
217
+ href="../components/shadow-component.html"
218
+ >Shadow Component<br><small>Base Component</small></a></k-filter-item>
219
+ <k-filter-item filter-keywords="light component base"><a
220
+ href="../components/light-component.html">Light Component<br><small>Base
221
+ Component</small></a></k-filter-item>
222
+ <k-filter-item filter-keywords="hybrid component base"><a
223
+ href="../components/hybrid-component.html"
224
+ >Hybrid Component<br><small>Base Component</small></a></k-filter-item>
225
+ <k-filter-item filter-keywords="cookie utils utility"><a
226
+ href="../utils/cookie.html">cookie<br><small>Utility</small></a></k-filter-item>
227
+ <k-filter-item filter-keywords="context utils utility"><a
228
+ href="../utils/context.html">context<br><small>Utility</small></a></k-filter-item>
229
+ <k-filter-item filter-keywords="debounce utils utility"><a
230
+ href="../utils/debounce.html">debounce<br><small>Utility</small></a></k-filter-item>
231
+ <k-filter-item filter-keywords="drag utils utility"><a
232
+ href="../utils/drag.html">drag<br><small>Utility</small></a></k-filter-item>
233
+ <k-filter-item filter-keywords="elevation z-index stacking utils"><a
234
+ href="../utils/elevation.html">elevation<br><small>Utility</small></a></k-filter-item>
235
+ <k-filter-item filter-keywords="formattimestamp timestamp format date time utils utility"><a
236
+ href="../utils/formatTimestamp.html"
237
+ >formatTimestamp<br><small>Utility</small></a></k-filter-item>
238
+ <k-filter-item filter-keywords="object utils utility"><a
239
+ href="../utils/object.html">object<br><small>Utility</small></a></k-filter-item>
240
+ <k-filter-item filter-keywords="propconverters prop converters utils utility"><a
241
+ href="../utils/propConverters.html"
242
+ >propConverters<br><small>Utility</small></a></k-filter-item>
243
+ <k-filter-item filter-keywords="sanitizehtml sanitize html xss security utils utility"><a
244
+ href="../utils/sanitizeHtml.html"
245
+ >sanitizeHtml<br><small>Utility</small></a></k-filter-item>
246
+ <k-filter-item filter-keywords="string utils utility"><a
247
+ href="../utils/string.html">string<br><small>Utility</small></a></k-filter-item>
248
+ <k-filter-item filter-keywords="theme utils utility"><a
249
+ href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
250
+ <k-filter-item filter-keywords="type utils utility"><a
251
+ href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
252
+ <k-filter-item filter-keywords="voice speech synthesis preference utils utility"><a
253
+ href="../utils/voice.html">voice<br><small>Utility</small></a></k-filter-item>
254
+ <k-filter-item filter-keywords="wait async utils utility"><a
255
+ href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
256
+ </k-filter-list>
257
+ </div>
258
+ </div>
259
+ <div class="flex"></div>
260
+ <a
261
+ href="https://github.com/dustinpoissant/kempo-ui?tab=License-1-ov-file#creative-commons-attribution-noncommercial-sharealike-20"
262
+ target="_blank"
263
+ ><k-icon name="license"></k-icon></a>
264
+ <a
265
+ href="https://www.npmjs.com/package/kempo-ui"
266
+ target="_blank"
267
+ ><k-icon name="npm"></k-icon></a>
268
+ <a
269
+ href="https://github.com/dustinpoissant/kempo-ui"
270
+ target="_blank"
271
+ ><k-icon name="github-mark"></k-icon></a>
272
+ <k-theme-switcher
273
+ class="mr"
274
+ style="
275
+ --padding: 0.5rem;
276
+ --c_active: var(--tc_on_primary);
277
+ --tc_active: var(--c_primary);
278
+ --c_inactive__hover: rgba(255, 255, 255, 0.1);
279
+ "
280
+ ></k-theme-switcher>
281
+ </k-nav>
282
+ <div style="width: 100%; height: 4rem;"></div>
283
+ <k-aside
284
+ id="navSideMenu"
285
+ main="overlay"
286
+ state="offscreen"
287
+ >
288
+ <menu>
289
+ <a
290
+ href="../"
291
+ class="ta-center bb mb r0"
292
+ >
293
+ <h1 class="tc-primary">Kempo UI</h1>
294
+ <img
295
+ src="../media/icon128.png"
296
+ alt="Kempo UI Icon"
297
+ />
298
+ </a>
299
+
300
+ <div class="pl mb">
301
+ <h3>Components</h3>
302
+ <a href="../components/accordion.html">Accordion</a>
303
+ <a href="../components/aside.html">Aside</a>
304
+ <a href="../components/calendar.html">Calendar</a>
305
+ <a href="../components/card.html">Card</a>
306
+ <a href="../components/chat.html">Chat</a>
307
+ <a href="../components/code-editor.html">Code Editor</a>
308
+ <a href="../components/combobox.html">Combobox</a>
309
+ <a href="../components/color-picker.html">ColorPicker</a>
310
+ <a href="../components/content-slider.html">Content Slider</a>
311
+ <a href="../components/context.html">Context</a>
312
+ <a href="../components/dialog.html">Dialog</a>
313
+ <a href="../components/dropdown.html">Dropdown</a>
314
+ <a href="../components/filter-list.html">Filter List</a>
315
+ <a href="../components/focus-capture.html">FocusCapture</a>
316
+ <a href="../components/html-editor.html">HTML Editor</a>
317
+ <a href="../components/markdown.html">Markdown</a>
318
+ <a href="../components/markdown-editor.html">Markdown Editor</a>
319
+ <a href="../components/icon.html">Icon</a>
320
+ <a href="../components/import.html">Import</a>
321
+ <a href="../components/nav.html">Nav</a>
322
+ <a href="../components/nav-spacer.html">Nav Spacer</a>
323
+ <a href="../components/photo-viewer.html">Photo Viewer</a>
324
+ <a href="../components/progress.html">Progress</a>
325
+ <a href="../components/resize.html">Resize</a>
326
+ <a href="../components/show-more.html">Show More</a>
327
+ <a href="../components/slider.html">Slider</a>
328
+ <a href="../components/sortable.html">Sortable</a>
329
+ <a href="../components/speech-to-text.html">Speech To Text</a>
330
+ <a href="../components/spinner.html">Spinner</a>
331
+ <a href="../components/split.html">Split</a>
332
+ <a href="../components/table.html">Table</a>
333
+ <a href="../components/tabs.html">Tabs</a>
334
+ <a href="../components/tags.html">Tags</a>
335
+ <a href="../components/text-to-speech.html">Text To Speech</a>
336
+ <a href="../components/theme-select.html">Theme Select</a>
337
+ <a href="../components/theme-switcher.html">Theme Switcher</a>
338
+ <a href="../components/time.html">Time</a>
339
+ <a href="../components/timestamp.html">Timestamp</a>
340
+ <a href="../components/toast.html">Toast</a>
341
+ <a href="../components/toggle.html">Toggle</a>
342
+ <a href="../components/tree.html">Tree</a>
343
+ <a href="../components/voice-selector.html">Voice Selector</a>
344
+ </div>
345
+
346
+ <h5 class="mb0">Base Components</h5>
347
+ <div class="pl mb">
348
+ <a href="../components/shadow-component.html">Shadow Component</a>
349
+ <a href="../components/light-component.html">Light Component</a>
350
+ <a href="../components/hybrid-component.html">Hybrid Component</a>
351
+ </div>
352
+
353
+ <h5 class="mb0">Utils</h5>
354
+ <div class="pl mb">
355
+ <a href="../utils/cookie.html">cookie</a>
356
+ <a href="../utils/context.html">context</a>
357
+ <a href="../utils/debounce.html">debounce</a>
358
+ <a href="../utils/drag.html">drag</a>
359
+ <a href="../utils/elevation.html">elevation</a>
360
+ <a href="../utils/formatTimestamp.html">formatTimestamp</a>
361
+ <a href="../utils/object.html">object</a>
362
+ <a href="../utils/propConverters.html">propConverters</a>
363
+ <a href="../utils/sanitizeHtml.html">sanitizeHtml</a>
364
+ <a href="../utils/string.html">string</a>
365
+ <a href="../utils/theme.html">theme</a>
366
+ <a href="../utils/type.html">type</a>
367
+ <a href="../utils/voice.html">voice</a>
368
+ <a href="../utils/wait.html">wait</a>
369
+ </div>
370
+ </menu>
371
+ </k-aside>
372
+ <style>
373
+ #navSearchList a {
374
+ display: block;
375
+ padding: .25rem .5rem;
376
+ border-radius: var(--radius);
377
+ text-decoration: none;
378
+ color: var(--tc);
379
+ }
380
+
381
+ #navSearchList a:hover {
382
+ background: rgba(128, 128, 128, .15);
383
+ }
384
+
385
+ #navSearchList a small {
386
+ display: block;
387
+ color: var(--tc_muted);
388
+ }
389
+ </style>
390
+ <script
391
+ src="../src/components/Nav.js"
392
+ type="module"
393
+ ></script>
394
+ <script
395
+ src="../src/components/FilterList.js"
396
+ type="module"
397
+ ></script>
398
+ <script
399
+ src="../src/components/FilterItem.js"
400
+ type="module"
401
+ ></script>
402
+ <script
403
+ src="../src/components/Aside.js"
404
+ type="module"
405
+ ></script>
406
+ <script
407
+ src="../src/components/Icon.js"
408
+ type="module"
409
+ ></script>
410
+ <script
411
+ src="../src/components/ThemeSwitcher.js"
412
+ type="module"
413
+ ></script>
414
+ <script type="module">
415
+ import debounce from '../src/utils/debounce.js';
416
+
417
+ document.getElementById('toggleNavSideMenu').addEventListener('click', async () => {
418
+ await window.customElements.whenDefined('k-aside');
419
+ document.getElementById('navSideMenu').toggle();
420
+ });
421
+
422
+ document.addEventListener('click', function (e) {
423
+ if (e.target.matches('a[href^="#"]')) {
424
+ e.preventDefault();
425
+ const targetId = e.target.getAttribute('href').replace('#', '');
426
+ const target = document.getElementById(targetId);
427
+ if (target) {
428
+ target.scrollIntoView({ behavior: 'smooth' });
429
+ const url = window.location.pathname + window.location.search + '#' + targetId;
430
+ history.replaceState(null, '', url);
431
+ }
432
+ }
433
+ });
434
+
435
+ /*
436
+ Nav Search
437
+ */
438
+ const searchInput = document.getElementById('navSearchInput');
439
+ const searchDropdown = document.getElementById('navSearchDropdown');
440
+ let navSearchList = null;
441
+
442
+ const openSearch = async () => {
443
+ await customElements.whenDefined('k-filter-list');
444
+ if (!navSearchList) navSearchList = document.getElementById('navSearchList');
445
+ navSearchList.filter(searchInput.value);
446
+ searchDropdown.hidden = false;
447
+ };
448
+
449
+ const closeSearch = () => {
450
+ searchDropdown.hidden = true;
451
+ navSearchList?.clearFocus();
452
+ };
453
+
454
+ searchInput.addEventListener('focus', openSearch);
455
+
456
+ searchInput.addEventListener('input', debounce(e => {
457
+ navSearchList?.filter(e.target.value);
458
+ }, 150));
459
+
460
+ searchInput.addEventListener('keydown', e => {
461
+ if (e.key === 'Escape') {
462
+ searchInput.value = '';
463
+ searchInput.blur();
464
+ closeSearch();
465
+ } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') {
466
+ navSearchList?.handleKeydown(e);
467
+ }
468
+ });
469
+
470
+ searchInput.addEventListener('blur', () => {
471
+ setTimeout(closeSearch, 150);
472
+ });
473
+
474
+ document.addEventListener('keydown', e => {
475
+ let active = document.activeElement;
476
+ while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
477
+ const tag = active?.tagName;
478
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || active?.isContentEditable) return;
479
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
480
+ if (e.key.length === 1) {
481
+ searchInput.focus();
482
+ }
483
+ });
484
+ </script>
485
+
486
+
487
+ <h1 class="ta-center">Segmented Control</h1>
488
+
489
+ <k-main>
490
+
491
+ <k-accordion persistent-id="toc" class="b r mb">
492
+ <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
493
+ <k-accordion-panel name="toc-panel">
494
+ <div class="m pl">
495
+ <h6>Examples</h6>
496
+ <a href="#basicUsage">Basic Usage</a><br />
497
+ <a href="#selectedByDefault">Selected By Default</a><br />
498
+ <a href="#javascriptUsage">JavaScript Usage</a><br />
499
+ <a href="#customComponents">Custom Components as Options</a><br />
500
+
501
+ <h6 class="mt"><a href="jsRef" class="no-link">JavaScript Reference</a></h6>
502
+ <a href="#constructor">Constructor</a><br />
503
+ <a href="#requirements">Requirements</a><br />
504
+ <a href="#properties">Properties</a><br />
505
+ <a href="#events">Events</a><br />
506
+ </div>
507
+ </k-accordion-panel>
508
+ </k-accordion>
509
+
510
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
511
+ <p>A segmented control groups related options and allows the user to select one at a time. Provide your own sub-components as options.</p>
512
+ <div class="row -mx">
513
+ <div class="col m-span-12 px">
514
+ <k-card label="HTML">
515
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-segmented-control</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"small"</span>&gt;</span>Small<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">value</span>=<span class="hljs-string">"medium"</span>&gt;</span>Medium<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">value</span>=<span class="hljs-string">"large"</span>&gt;</span>Large<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-segmented-control</span>&gt;</span></code></pre>
516
+ </k-card>
517
+ </div>
518
+ <div class="col m-span-12 px">
519
+ <k-card label="Output">
520
+ <k-segmented-control>
521
+ <div value="small">Small</div>
522
+ <div value="medium">Medium</div>
523
+ <div value="large">Large</div>
524
+ </k-segmented-control>
525
+ </k-card>
526
+ </div>
527
+ </div>
528
+
529
+ <h3 id="selectedByDefault"><a href="#selectedByDefault" class="no-link">Selected By Default</a></h3>
530
+ <p>Set an initial value to select an option by default.</p>
531
+ <div class="row -mx">
532
+ <div class="col m-span-12 px">
533
+ <k-card label="HTML">
534
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-segmented-control</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"medium"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"small"</span>&gt;</span>Small<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">value</span>=<span class="hljs-string">"medium"</span>&gt;</span>Medium<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">value</span>=<span class="hljs-string">"large"</span>&gt;</span>Large<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-segmented-control</span>&gt;</span></code></pre>
535
+ </k-card>
536
+ </div>
537
+ <div class="col m-span-12 px">
538
+ <k-card label="Output">
539
+ <k-segmented-control value="medium">
540
+ <div value="small">Small</div>
541
+ <div value="medium">Medium</div>
542
+ <div value="large">Large</div>
543
+ </k-segmented-control>
544
+ </k-card>
545
+ </div>
546
+ </div>
547
+
548
+ <h3 id="javascriptUsage"><a href="#javascriptUsage" class="no-link">JavaScript Usage</a></h3>
549
+ <p>Get and set the selected value programmatically using JavaScript.</p>
550
+ <div class="row -mx">
551
+ <div class="col m-span-12 px">
552
+ <k-card label="HTML">
553
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-segmented-control</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sizes"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"medium"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"small"</span>&gt;</span>Small<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">value</span>=<span class="hljs-string">"medium"</span>&gt;</span>Medium<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">value</span>=<span class="hljs-string">"large"</span>&gt;</span>Large<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-segmented-control</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Selected: <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"output"</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="javascript"><br /> <span class="hljs-keyword">const</span> $sizes = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sizes'</span>);<br /> <span class="hljs-keyword">const</span> $output = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'output'</span>);<br /> <br /> $output.textContent = $sizes.value;<br /> <br /> $sizes.addEventListener(<span class="hljs-string">'change'</span>, (event) =&gt; {<br /> $output.textContent = event.detail.value;<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
554
+ </k-card>
555
+ </div>
556
+ <div class="col m-span-12 px">
557
+ <k-card label="Output">
558
+ <k-segmented-control id="sizes" value="medium">
559
+ <div value="small">Small</div>
560
+ <div value="medium">Medium</div>
561
+ <div value="large">Large</div>
562
+ </k-segmented-control>
563
+ <p>Selected: <span id="output"></span></p>
564
+ <script>
565
+ const $sizes = document.getElementById('sizes');
566
+ const $output = document.getElementById('output');
567
+
568
+ $output.textContent = $sizes.value;
569
+
570
+ $sizes.addEventListener('change', (event) => {
571
+ $output.textContent = event.detail.value;
572
+ });
573
+ </script>
574
+ </k-card>
575
+ </div>
576
+ </div>
577
+
578
+ <h3 id="customComponents"><a href="#customComponents" class="no-link">Custom Components as Options</a></h3>
579
+ <p>Use any custom components as the options within the segmented control.</p>
580
+ <div class="row -mx">
581
+ <div class="col m-span-12 px">
582
+ <k-card label="HTML">
583
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-segmented-control</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"list"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"grid"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"grid_view"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span><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">value</span>=<span class="hljs-string">"list"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"view_list"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-segmented-control</span>&gt;</span></code></pre>
584
+ </k-card>
585
+ </div>
586
+ <div class="col m-span-12 px">
587
+ <k-card label="Output">
588
+ <k-segmented-control value="list">
589
+ <button value="grid"><k-icon name="grid_view"></k-icon></button>
590
+ <button value="list"><k-icon name="view_list"></k-icon></button>
591
+ </k-segmented-control>
592
+ </k-card>
593
+ </div>
594
+ </div>
595
+
596
+ <hr class="mt" />
597
+
598
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
599
+
600
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
601
+ <pre><code class="hljs javascript"><span class="hljs-keyword">new</span> SegmentedControl();</code></pre>
602
+
603
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
604
+ <p>The segmented control component is a custom element and does not require any external dependencies beyond the Kempo-UI library.</p>
605
+
606
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
607
+ <table class="w-full">
608
+ <thead>
609
+ <tr>
610
+ <th>Property</th>
611
+ <th>Type</th>
612
+ <th>Default</th>
613
+ <th>Description</th>
614
+ </tr>
615
+ </thead>
616
+ <tbody>
617
+ <tr>
618
+ <td><code>value</code></td>
619
+ <td>String</td>
620
+ <td><code>''</code></td>
621
+ <td>The value of the currently selected option. Set this to match the <code>value</code> attribute of one of the child options.</td>
622
+ </tr>
623
+ </tbody>
624
+ </table>
625
+
626
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
627
+ <table class="w-full">
628
+ <thead>
629
+ <tr>
630
+ <th>Event</th>
631
+ <th>Detail</th>
632
+ <th>Description</th>
633
+ </tr>
634
+ </thead>
635
+ <tbody>
636
+ <tr>
637
+ <td><code>change</code></td>
638
+ <td><code>{ value: String }</code></td>
639
+ <td>Fired when the selected option changes. The detail contains the new value.</td>
640
+ </tr>
641
+ </tbody>
642
+ </table>
643
+
644
+ </k-main>
645
+ <div style="height:33vh"></div>
646
+ <script type="module" src="../src/components/Main.js"></script>
647
+
648
+ </body>
649
+ </html>