kempo-ui 0.4.11 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/SegmentedControl.js +16 -0
- package/docs/components/SegmentedControl.html +649 -0
- package/docs/components/accordion.html +3 -0
- package/docs/components/aside.html +3 -0
- package/docs/components/calendar.html +3 -0
- package/docs/components/card.html +3 -0
- package/docs/components/chat.html +3 -0
- package/docs/components/code-editor.html +3 -0
- package/docs/components/color-picker.html +3 -0
- package/docs/components/combobox.html +3 -0
- package/docs/components/content-slider.html +3 -0
- package/docs/components/context.html +3 -0
- package/docs/components/dialog.html +3 -0
- package/docs/components/dropdown.html +3 -0
- package/docs/components/filter-list.html +3 -0
- package/docs/components/focus-capture.html +3 -0
- package/docs/components/html-editor.html +3 -0
- package/docs/components/hybrid-component.html +3 -0
- package/docs/components/icon.html +3 -0
- package/docs/components/import.html +3 -0
- package/docs/components/light-component.html +3 -0
- package/docs/components/markdown-editor.html +3 -0
- package/docs/components/markdown.html +3 -0
- package/docs/components/nav-spacer.html +3 -0
- package/docs/components/nav.html +3 -0
- package/docs/components/photo-viewer.html +3 -0
- package/docs/components/progress.html +3 -0
- package/docs/components/resize.html +3 -0
- package/docs/components/segmented-control.html +728 -0
- package/docs/components/shadow-component.html +3 -0
- package/docs/components/show-more.html +3 -0
- package/docs/components/slider.html +3 -0
- package/docs/components/sortable.html +3 -0
- package/docs/components/speech-to-text.html +3 -0
- package/docs/components/spinner.html +3 -0
- package/docs/components/split.html +3 -0
- package/docs/components/table.html +3 -0
- package/docs/components/tableControls.html +3 -0
- package/docs/components/tableCustomFields.html +3 -0
- package/docs/components/tableFetchRecords.html +3 -0
- package/docs/components/tableFieldSortHide.html +3 -0
- package/docs/components/tablePagination.html +3 -0
- package/docs/components/tablePlaceholder.html +3 -0
- package/docs/components/tableRecordEditing.html +3 -0
- package/docs/components/tableRecordFiltering.html +3 -0
- package/docs/components/tableRecordHiding.html +3 -0
- package/docs/components/tableRecordSearching.html +3 -0
- package/docs/components/tableRecordSelection.html +3 -0
- package/docs/components/tableRowControls.html +3 -0
- package/docs/components/tableServerSync.html +3 -0
- package/docs/components/tableSorting.html +3 -0
- package/docs/components/tabs.html +3 -0
- package/docs/components/tags.html +3 -0
- package/docs/components/text-to-speech.html +3 -0
- package/docs/components/theme-select.html +3 -0
- package/docs/components/theme-switcher.html +3 -0
- package/docs/components/time.html +3 -0
- package/docs/components/timestamp.html +3 -0
- package/docs/components/toast.html +3 -0
- package/docs/components/toggle.html +3 -0
- package/docs/components/tree.html +3 -0
- package/docs/components/voice-selector.html +3 -0
- package/docs/icons/account-circle.svg +1 -1
- package/docs/index.html +9 -0
- package/docs/src/components/SegmentedControl.js +16 -0
- package/docs/utils/context.html +3 -0
- package/docs/utils/cookie.html +3 -0
- package/docs/utils/debounce.html +3 -0
- package/docs/utils/drag.html +3 -0
- package/docs/utils/elevation.html +3 -0
- package/docs/utils/formatTimestamp.html +3 -0
- package/docs/utils/object.html +3 -0
- package/docs/utils/propConverters.html +3 -0
- package/docs/utils/sanitizeHtml.html +3 -0
- package/docs/utils/string.html +3 -0
- package/docs/utils/theme.html +3 -0
- package/docs/utils/toTitleCase.html +3 -0
- package/docs/utils/type.html +3 -0
- package/docs/utils/voice.html +3 -0
- package/docs/utils/wait.html +3 -0
- package/docs-src/components/segmented-control.page.html +236 -0
- package/docs-src/index.page.html +6 -0
- package/docs-src/nav.fragment.html +3 -0
- package/icons/account-circle.svg +1 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
- package/src/components/SegmentedControl.js +118 -0
- package/tasks/released/0004-create-segmented-control-component/component-rendering.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/final-component-page.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/form-integration-section.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/option-element-section.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/page-screenshot.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/validation-form-integration.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/validation-screenshot-1-full-page.png +0 -0
- package/tasks/released/0004-create-segmented-control-component/validation-screenshot-2-icon-options.png +0 -0
- package/tasks/released/0004-create-segmented-control-component.md +106 -0
- package/tests/components/SegmentedControl.browser-test.js +223 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.4.12] - 2026-05-03
|
|
10
|
+
### Added
|
|
11
|
+
- **SegmentedControl component**: New form-integrated segmented control component
|
|
12
|
+
- Renders child `<k-sc-option>` elements as a button group using Kempo-CSS utility classes
|
|
13
|
+
- Supports rich content in options including text and icon elements (via `<k-icon>`)
|
|
14
|
+
- Full form integration using ElementInternals API (`formAssociated`) for proper form submission and reset
|
|
15
|
+
- `name` attribute for form field identification
|
|
16
|
+
- `value` property reflects and controls the selected option
|
|
17
|
+
- Dispatches `change` events when selection changes
|
|
18
|
+
- Comprehensive unit test suite with 13 test cases covering element creation, properties, option recognition, selection, styling, and events
|
|
19
|
+
- Complete documentation with examples: Basic Usage, Selected By Default, JavaScript Usage, Icon Options, and Form Integration
|
|
20
|
+
- Test file: `tests/components/SegmentedControl.browser-test.js`
|
|
21
|
+
- Documentation: `docs-src/components/segmented-control.page.html`
|
|
22
|
+
|
|
9
23
|
## [0.4.11] - 2026-05-01
|
|
10
24
|
### Added
|
|
11
25
|
- **Chat component**: Comprehensive unit test suite with 62 test cases
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{html as t,css as e,unsafeHTML as s}from"../lit-all.min.js";import n from"./ShadowComponent.js";class i extends n{static formAssociated=!0;static properties={value:{type:String,reflect:!0},name:{type:String}};constructor(){if(super(),this.value="",this.name="",this.initialValue="","function"==typeof this.attachInternals)try{this.internals=this.attachInternals()}catch(t){}}connectedCallback(){super.connectedCallback(),this.initialValue=this.getAttribute("value")||"",this.addEventListener("slotchange",this.handleSlotChange,!0);const t=this.closest("form");t&&t.addEventListener("reset",this.handleReset,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slotchange",this.handleSlotChange,!0);const t=this.closest("form");t&&t.removeEventListener("reset",this.handleReset,!0)}updated(t){if(super.updated(t),t.has("value")){if(this.internals&&"function"==typeof this.internals.setFormValue)try{this.internals.setFormValue(this.value||null)}catch(t){}this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}}handleSlotChange=()=>{this.requestUpdate()};handleReset=()=>{this.value=this.initialValue};handleButtonClick=t=>{this.value=t};getOptions=()=>Array.from(this.children).filter(t=>"K-SC-OPTION"===t.tagName);render(){const e=this.getOptions();return t`
|
|
2
|
+
<div class="btn-grp">
|
|
3
|
+
${e.map(e=>{const n=e.getAttribute("value")||"",i=n===this.value;return t`
|
|
4
|
+
<button
|
|
5
|
+
class="${i?"primary":""}"
|
|
6
|
+
@click=${()=>this.handleButtonClick(n)}
|
|
7
|
+
?aria-pressed=${i}
|
|
8
|
+
>${s(e.innerHTML)}</button>
|
|
9
|
+
`})}
|
|
10
|
+
</div>
|
|
11
|
+
<slot style="display:none;"></slot>
|
|
12
|
+
`}static styles=e`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
`}class a extends HTMLElement{connectedCallback(){this.hasAttribute("value")||this.setAttribute("value","")}}export default i;customElements.define("k-segmented-control",i),customElements.define("k-sc-option",a);
|