@iyulab/components 2.2.0 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.1] - 2026-10-06
4
+
5
+ ### Fixed
6
+
7
+ - **`u-select`'s `search` and `u-tab-panel`'s `change` are typed for TypeScript listeners.** Each element
8
+ declares its custom events (`USelectEventMap`, `UTabPanelEventMap`) and types `addEventListener` with
9
+ them — `select.addEventListener('search', (e) => e.detail.query)` no longer needs a cast. They are
10
+ element-scoped rather than global: `change` is already the native `Event` there.
11
+
12
+ ### Documentation
13
+
14
+ - **Quick Start** — a first page (token sheet, `u-input` and `u-button` in a native form, a toast) that
15
+ builds, type-checks and renders as written.
16
+
3
17
  ## [2.2.0] - 2026-10-06
4
18
 
5
19
  ### Added
package/README.md CHANGED
@@ -10,6 +10,31 @@ Lit 기반 웹 컴포넌트 라이브러리.
10
10
  npm install @iyulab/components
11
11
  ```
12
12
 
13
+ ## Quick Start
14
+
15
+ 아래 파일 하나가 그대로 돌아가는 첫 페이지입니다(Vite 기준 — `index.html` 이 `src/main.ts` 를 모듈로 싣는다).
16
+
17
+ ```ts
18
+ // src/main.ts
19
+ import '@iyulab/components/styles/tokens.css';
20
+ import { Toast } from '@iyulab/components';
21
+
22
+ document.body.innerHTML = `
23
+ <form id="signup" style="display: grid; gap: 12px; max-width: 320px; margin: 32px">
24
+ <u-input name="email" type="email" label="Email" required></u-input>
25
+ <u-button type="submit" color="primary">Sign up</u-button>
26
+ </form>
27
+ `;
28
+
29
+ const form = document.querySelector<HTMLFormElement>('#signup')!;
30
+ form.addEventListener('submit', (event) => {
31
+ event.preventDefault();
32
+ Toast.success(`Welcome, ${new FormData(form).get('email')}`);
33
+ });
34
+ ```
35
+
36
+ `u-input` 과 `u-button` 은 네이티브 폼에 참여하므로 `FormData`·`required` 검증·Enter 제출이 그대로 동작합니다.
37
+
13
38
  ## Usage
14
39
 
15
40
  ```ts
@@ -115,6 +115,22 @@ export declare class USelect extends UFormControlElement<string | string[]> {
115
115
  private handleClearKeydown;
116
116
  private handleChipRemove;
117
117
  }
118
+ /** Custom events `<u-select>` dispatches (its `change`/`input` are the native form-control events). */
119
+ export interface USelectEventMap {
120
+ /** The search box changed (`searchable`). `query` is the trimmed, lower-cased text. */
121
+ 'search': CustomEvent<{
122
+ query: string;
123
+ }>;
124
+ }
125
+ /** Typed listeners for {@link USelectEventMap} — element-scoped, the DOM's own pattern (`HTMLMediaElementEventMap`). */
126
+ export interface USelect {
127
+ addEventListener<K extends keyof USelectEventMap>(type: K, listener: (this: USelect, ev: USelectEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
128
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: USelect, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
129
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
130
+ removeEventListener<K extends keyof USelectEventMap>(type: K, listener: (this: USelect, ev: USelectEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
131
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: USelect, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
132
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
133
+ }
118
134
  declare global {
119
135
  interface HTMLElementTagNameMap {
120
136
  'u-select': USelect;
@@ -56,6 +56,20 @@ export declare class UTabPanel extends UElement {
56
56
  private handleTabKeydown;
57
57
  private handleNavWheel;
58
58
  }
59
+ /** Events `<u-tab-panel>` dispatches. */
60
+ export interface UTabPanelEventMap {
61
+ /** A tab was chosen by click or keyboard — not on first mount. Does not bubble; read `value` on the panel. */
62
+ 'change': CustomEvent<null>;
63
+ }
64
+ /** Typed listeners for {@link UTabPanelEventMap} — element-scoped, the DOM's own pattern (`HTMLMediaElementEventMap`). */
65
+ export interface UTabPanel {
66
+ addEventListener<K extends keyof UTabPanelEventMap>(type: K, listener: (this: UTabPanel, ev: UTabPanelEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
67
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UTabPanel, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
68
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
69
+ removeEventListener<K extends keyof UTabPanelEventMap>(type: K, listener: (this: UTabPanel, ev: UTabPanelEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
70
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UTabPanel, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
71
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
72
+ }
59
73
  declare global {
60
74
  interface HTMLElementTagNameMap {
61
75
  'u-tab-panel': UTabPanel;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",