@iyulab/components 2.27.0 → 2.28.0
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 +23 -0
- package/README.md +1 -1
- package/dist/components/input/UInput.d.ts +5 -0
- package/dist/components/input/UInput.js +23 -9
- package/dist/components/option-group/UOptionGroup.d.ts +45 -0
- package/dist/components/option-group/UOptionGroup.js +69 -0
- package/dist/components/option-group/UOptionGroup.styles.d.ts +1 -0
- package/dist/components/option-group/UOptionGroup.styles.js +33 -0
- package/dist/components/select/USelect.d.ts +5 -0
- package/dist/components/select/USelect.js +22 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/plugins/dts-globals.d.ts +5 -2
- package/dist/plugins/dts-globals.js +33 -16
- package/dist/react/UOptionGroup.d.ts +14 -0
- package/dist/react/UOptionGroup.js +10 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/components/option-group.md +56 -0
- package/skills/iyulab-components/references/components/select.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.28.0] - 2026-10-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `u-option-group` — a labelled group of `u-option`s in `u-select` and the `u-input` combobox, the native `<optgroup>`.
|
|
8
|
+
The heading is not an option (no focus, no selection; the arrow keys pass from group to group), the group is
|
|
9
|
+
`role="group"` named by its `label`, and a group whose options a search filtered out is hidden, heading included.
|
|
10
|
+
Options added to a group later are picked up.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `plugins/dts-globals`: augmentations of a bare module — `declare module 'react' { namespace JSX … }` — are resolved like
|
|
15
|
+
`declare global` blocks. The bundler copies them into every entry the same way, so a JSX props type the entry did not
|
|
16
|
+
reach was left undeclared (`TS2304` with `skipLibCheck: false`).
|
|
17
|
+
|
|
18
|
+
## [2.27.1] - 2026-10-15
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- `plugins/dts-globals`: a class the declaration bundler inlined into an entry as a private copy (declared there, exported
|
|
23
|
+
only by another entry) is now pointed at the public export as well. The copy is a second nominal type for the same tag,
|
|
24
|
+
so a program that loaded both entries failed with `TS2717`.
|
|
25
|
+
|
|
3
26
|
## [2.27.0] - 2026-10-15
|
|
4
27
|
|
|
5
28
|
### Added
|
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ npx skills add ./node_modules/@iyulab/components
|
|
|
126
126
|
|
|
127
127
|
**Buttons & Actions** — `u-button`, `u-button-group`, `u-icon-button`, `u-copy-button`, `u-chip`
|
|
128
128
|
|
|
129
|
-
**Form Controls** — `u-input`, `u-textarea`, `u-select`, `u-date-picker`, `u-date-range-picker`, `u-file-input`, `u-checkbox`, `u-radio`, `u-switch`, `u-slider`, `u-rating`, `u-field`, `u-form`, `u-option`
|
|
129
|
+
**Form Controls** — `u-input`, `u-textarea`, `u-select`, `u-date-picker`, `u-date-range-picker`, `u-file-input`, `u-checkbox`, `u-radio`, `u-switch`, `u-slider`, `u-rating`, `u-field`, `u-form`, `u-option`, `u-option-group`
|
|
130
130
|
|
|
131
131
|
**Overlay & Floating** — `u-dialog`, `u-drawer`, `u-popover`, `u-tooltip`
|
|
132
132
|
|
|
@@ -115,6 +115,9 @@ export declare class UInput extends UFormControlElement<string> {
|
|
|
115
115
|
/** The value as a number — `NaN` when empty or not a number (same as the native input). */
|
|
116
116
|
get valueAsNumber(): number;
|
|
117
117
|
private options;
|
|
118
|
+
/** 묶음(`u-option-group`) 안의 선택지가 바뀌어도 모은다 — 슬롯의 `slotchange` 는 직속 자식의 변화만 알린다. */
|
|
119
|
+
private readonly groupObserver;
|
|
120
|
+
connectedCallback(): void;
|
|
118
121
|
disconnectedCallback(): void;
|
|
119
122
|
render(): import('lit-html').TemplateResult<1>;
|
|
120
123
|
/** `value`가 바뀌는 모든 경로(초기 속성 설정 · 프로그램적 대입 · clear 버튼)에서
|
|
@@ -139,6 +142,8 @@ export declare class UInput extends UFormControlElement<string> {
|
|
|
139
142
|
private setup;
|
|
140
143
|
private cleanup;
|
|
141
144
|
private handleSlotChange;
|
|
145
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
146
|
+
private collectOptions;
|
|
142
147
|
private composing;
|
|
143
148
|
private handleCompositionStart;
|
|
144
149
|
private handleCompositionEnd;
|
|
@@ -9,7 +9,7 @@ import { parseNumber } from "../../utilities/format.js";
|
|
|
9
9
|
import "../field/UField.js";
|
|
10
10
|
import "../popover/UPopover.js";
|
|
11
11
|
import { CharsWidthController } from "../../utilities/chars.js";
|
|
12
|
-
import {
|
|
12
|
+
import { UOptionGroup, collectOptions } from "../option-group/UOptionGroup.js";
|
|
13
13
|
import { styles } from "./UInput.styles.js";
|
|
14
14
|
import { html } from "lit";
|
|
15
15
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
@@ -36,14 +36,10 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
36
36
|
this.numberText = "";
|
|
37
37
|
this.syncingFromText = false;
|
|
38
38
|
this.options = [];
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.setup(this.options);
|
|
44
|
-
if (this.options.length === 0) this.popoverEl?.hide();
|
|
45
|
-
else if (this.matches(":focus-within")) this.popoverEl?.show(this.containerEl);
|
|
46
|
-
};
|
|
39
|
+
this.groupObserver = new MutationObserver((records) => {
|
|
40
|
+
if (records.some((r) => r.target instanceof UOptionGroup)) this.collectOptions();
|
|
41
|
+
});
|
|
42
|
+
this.handleSlotChange = () => this.collectOptions();
|
|
47
43
|
this.composing = false;
|
|
48
44
|
this.handleCompositionStart = () => {
|
|
49
45
|
this.composing = true;
|
|
@@ -178,7 +174,15 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
178
174
|
if (this.type !== "number" || !this.value) return NaN;
|
|
179
175
|
return parseNumber(this.value, "en") ?? NaN;
|
|
180
176
|
}
|
|
177
|
+
connectedCallback() {
|
|
178
|
+
super.connectedCallback();
|
|
179
|
+
this.groupObserver.observe(this, {
|
|
180
|
+
childList: true,
|
|
181
|
+
subtree: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
181
184
|
disconnectedCallback() {
|
|
185
|
+
this.groupObserver.disconnect();
|
|
182
186
|
this.cleanup(this.options);
|
|
183
187
|
super.disconnectedCallback();
|
|
184
188
|
}
|
|
@@ -426,6 +430,16 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
426
430
|
option.removeEventListener("keydown", this.handleOptionKeydown);
|
|
427
431
|
}
|
|
428
432
|
}
|
|
433
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
434
|
+
collectOptions() {
|
|
435
|
+
const slot = this.renderRoot.querySelector("u-popover > slot:not([name])");
|
|
436
|
+
if (!slot) return;
|
|
437
|
+
this.cleanup(this.options);
|
|
438
|
+
this.options = collectOptions(slot.assignedElements({ flatten: true }));
|
|
439
|
+
this.setup(this.options);
|
|
440
|
+
if (this.options.length === 0) this.popoverEl?.hide();
|
|
441
|
+
else if (this.matches(":focus-within")) this.popoverEl?.show(this.containerEl);
|
|
442
|
+
}
|
|
429
443
|
/**
|
|
430
444
|
* 네이티브 단일 행 `<input>` 의 **암묵 제출**(HTML «implicit submission»)을 흉내 낸다 — 내부 `<input>` 은 섀도
|
|
431
445
|
* 안에 있어 바깥 `<form>` 의 폼 소유자가 아니므로, 흉내 내지 않으면 Enter 가 아무것도 하지 않는다.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UElement } from '../UElement.js';
|
|
2
|
+
import { UOption } from '../option/UOption.js';
|
|
3
|
+
/**
|
|
4
|
+
* A labelled group of `u-option`s inside a `u-select` or a `u-input` combobox — the native `<optgroup>`.
|
|
5
|
+
*
|
|
6
|
+
* The heading is not an option: it takes no focus, cannot be selected, and keyboard movement goes from the last option
|
|
7
|
+
* of one group to the first of the next. For assistive technology the group is `role="group"` named by `label`, the
|
|
8
|
+
* listbox pattern's grouping. While none of its options is visible — a search filtered them all out, or it has none —
|
|
9
|
+
* the whole group, heading included, is hidden (`:state(empty)`).
|
|
10
|
+
*
|
|
11
|
+
* @slot - `u-option` items
|
|
12
|
+
*
|
|
13
|
+
* @csspart label - The heading
|
|
14
|
+
* @csspart options - The box around the options
|
|
15
|
+
*/
|
|
16
|
+
export declare class UOptionGroup extends UElement {
|
|
17
|
+
static styles: import('lit').CSSResultGroup[];
|
|
18
|
+
/** The heading, and the group's accessible name. */
|
|
19
|
+
label: string;
|
|
20
|
+
private readonly aria;
|
|
21
|
+
private readonly internals;
|
|
22
|
+
/** Watches the options: added or removed, hidden or shown by a search. */
|
|
23
|
+
private readonly observer;
|
|
24
|
+
/**
|
|
25
|
+
* The group's options, in order. Matched by tag, not class: a group parsed together with its options is connected
|
|
26
|
+
* before they are upgraded, and the `instanceof` test then saw none — the group hid itself as empty.
|
|
27
|
+
*/
|
|
28
|
+
get options(): UOption[];
|
|
29
|
+
connectedCallback(): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
32
|
+
private syncEmpty;
|
|
33
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'u-option-group': UOptionGroup;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The options among a listbox's slotted elements, in order — the elements themselves and the options inside groups.
|
|
42
|
+
* `u-select` and the `u-input` combobox collect through this, so a group is transparent to their keyboard, filter and
|
|
43
|
+
* selection.
|
|
44
|
+
*/
|
|
45
|
+
export declare function collectOptions(elements: Element[]): UOption[];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { UElement } from "../UElement.js";
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.js";
|
|
4
|
+
import { HostAria } from "../../utilities/hostAria.js";
|
|
5
|
+
import { UOption } from "../option/UOption.js";
|
|
6
|
+
import { styles } from "./UOptionGroup.styles.js";
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
//#region src/components/option-group/UOptionGroup.ts
|
|
10
|
+
var UOptionGroup = class UOptionGroup extends UElement {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.label = "";
|
|
14
|
+
this.aria = new HostAria(this);
|
|
15
|
+
this.internals = this.attachInternals();
|
|
16
|
+
this.observer = new MutationObserver(() => this.syncEmpty());
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = [super.styles, styles];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The group's options, in order. Matched by tag, not class: a group parsed together with its options is connected
|
|
23
|
+
* before they are upgraded, and the `instanceof` test then saw none — the group hid itself as empty.
|
|
24
|
+
*/
|
|
25
|
+
get options() {
|
|
26
|
+
return [...this.children].filter((el) => el.localName === "u-option");
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this.aria.set("role", "group");
|
|
31
|
+
this.observer.observe(this, {
|
|
32
|
+
childList: true,
|
|
33
|
+
subtree: true,
|
|
34
|
+
attributes: true,
|
|
35
|
+
attributeFilter: ["hidden"]
|
|
36
|
+
});
|
|
37
|
+
this.syncEmpty();
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
this.observer.disconnect();
|
|
41
|
+
super.disconnectedCallback();
|
|
42
|
+
}
|
|
43
|
+
updated(changed) {
|
|
44
|
+
super.updated(changed);
|
|
45
|
+
if (changed.has("label")) this.aria.set("aria-label", this.label || null);
|
|
46
|
+
}
|
|
47
|
+
syncEmpty() {
|
|
48
|
+
if (!this.options.some((option) => !option.hidden)) this.internals.states.add("empty");
|
|
49
|
+
else this.internals.states.delete("empty");
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return html`
|
|
53
|
+
<div class="label" part="label" aria-hidden="true">${this.label}</div>
|
|
54
|
+
<div class="options" part="options"><slot></slot></div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UOptionGroup.prototype, "label", void 0);
|
|
59
|
+
UOptionGroup = __decorate([customElement("u-option-group")], UOptionGroup);
|
|
60
|
+
/**
|
|
61
|
+
* The options among a listbox's slotted elements, in order — the elements themselves and the options inside groups.
|
|
62
|
+
* `u-select` and the `u-input` combobox collect through this, so a group is transparent to their keyboard, filter and
|
|
63
|
+
* selection.
|
|
64
|
+
*/
|
|
65
|
+
function collectOptions(elements) {
|
|
66
|
+
return elements.flatMap((el) => el instanceof UOption ? [el] : el instanceof UOptionGroup ? el.options.filter((o) => o instanceof UOption) : []);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { UOptionGroup, collectOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/option-group/UOptionGroup.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
:host(:state(empty)) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.label {
|
|
15
|
+
padding: 0.5em 0.5em 0.25em;
|
|
16
|
+
font-size: var(--u-text-overline-size, 11px);
|
|
17
|
+
font-weight: var(--u-text-overline-weight, 700);
|
|
18
|
+
line-height: var(--u-text-overline-leading, 1.45);
|
|
19
|
+
letter-spacing: var(--u-text-overline-tracking, 0.06em);
|
|
20
|
+
color: var(--u-txt-color-weak, #616161);
|
|
21
|
+
cursor: default;
|
|
22
|
+
user-select: none;
|
|
23
|
+
}
|
|
24
|
+
.label:empty {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.options {
|
|
29
|
+
display: contents;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { styles };
|
|
@@ -104,6 +104,9 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
104
104
|
private get valueAsString();
|
|
105
105
|
private get valueAsArray();
|
|
106
106
|
private get hasValue();
|
|
107
|
+
/** 묶음(`u-option-group`) 안의 선택지가 바뀌어도 모은다 — 슬롯의 `slotchange` 는 직속 자식의 변화만 알린다. */
|
|
108
|
+
private readonly groupObserver;
|
|
109
|
+
connectedCallback(): void;
|
|
107
110
|
disconnectedCallback(): void;
|
|
108
111
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
109
112
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -125,6 +128,8 @@ export declare class USelect extends UFormControlElement<string | string[]> {
|
|
|
125
128
|
* updated() 경로는 base의 silent setValidity()만 수행해 Lit 중복 업데이트를 피한다). */
|
|
126
129
|
private emitChange;
|
|
127
130
|
private handleSlotChange;
|
|
131
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
132
|
+
private collectOptions;
|
|
128
133
|
/**
|
|
129
134
|
* 목록이 닫힐 때 포커스가 그 «안»(옵션·검색 입력)에 있었으면 콤보박스로 되돌린다.
|
|
130
135
|
*
|
|
@@ -9,7 +9,7 @@ import "../chip/UChip.js";
|
|
|
9
9
|
import "../field/UField.js";
|
|
10
10
|
import "../popover/UPopover.js";
|
|
11
11
|
import { CharsWidthController } from "../../utilities/chars.js";
|
|
12
|
-
import {
|
|
12
|
+
import { UOptionGroup, collectOptions } from "../option-group/UOptionGroup.js";
|
|
13
13
|
import { CompositionTracker } from "../../utilities/composition.js";
|
|
14
14
|
import { styles } from "./USelect.styles.js";
|
|
15
15
|
import { html } from "lit";
|
|
@@ -39,13 +39,10 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
39
39
|
this.idBase = `u-select-${Math.random().toString(36).slice(2, 8)}`;
|
|
40
40
|
this.listboxId = `${this.idBase}-listbox`;
|
|
41
41
|
this.popupId = `${this.idBase}-popup`;
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.setup(this.options);
|
|
47
|
-
this.applyFilter();
|
|
48
|
-
};
|
|
42
|
+
this.groupObserver = new MutationObserver((records) => {
|
|
43
|
+
if (records.some((r) => r.target instanceof UOptionGroup)) this.collectOptions();
|
|
44
|
+
});
|
|
45
|
+
this.handleSlotChange = () => this.collectOptions();
|
|
49
46
|
this.handlePopoverHide = () => {
|
|
50
47
|
this.open = false;
|
|
51
48
|
this.setActiveOption(void 0);
|
|
@@ -165,7 +162,15 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
165
162
|
get hasValue() {
|
|
166
163
|
return this.multiple ? this.valueAsArray.length > 0 : !!this.value;
|
|
167
164
|
}
|
|
165
|
+
connectedCallback() {
|
|
166
|
+
super.connectedCallback();
|
|
167
|
+
this.groupObserver.observe(this, {
|
|
168
|
+
childList: true,
|
|
169
|
+
subtree: true
|
|
170
|
+
});
|
|
171
|
+
}
|
|
168
172
|
disconnectedCallback() {
|
|
173
|
+
this.groupObserver.disconnect();
|
|
169
174
|
this.cleanup(this.options);
|
|
170
175
|
super.disconnectedCallback();
|
|
171
176
|
}
|
|
@@ -356,6 +361,15 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
356
361
|
composed: true
|
|
357
362
|
}));
|
|
358
363
|
}
|
|
364
|
+
/** 슬롯의 선택지를 모은다 — 직속 `u-option` 과 묶음 안의 것(문서 순서). */
|
|
365
|
+
collectOptions() {
|
|
366
|
+
const slot = this.renderRoot.querySelector(".listbox slot");
|
|
367
|
+
if (!slot) return;
|
|
368
|
+
this.cleanup(this.options);
|
|
369
|
+
this.options = collectOptions(slot.assignedElements({ flatten: true }));
|
|
370
|
+
this.setup(this.options);
|
|
371
|
+
this.applyFilter();
|
|
372
|
+
}
|
|
359
373
|
updateSearch(input) {
|
|
360
374
|
const { query, composing } = this.composition.searchQuery(input);
|
|
361
375
|
this.query = query.trim();
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './components/input/UInput.js';
|
|
|
29
29
|
export * from './components/menu/UMenu.js';
|
|
30
30
|
export * from './components/menu-item/UMenuItem.js';
|
|
31
31
|
export * from './components/option/UOption.js';
|
|
32
|
+
export * from './components/option-group/UOptionGroup.js';
|
|
32
33
|
export * from './components/pagination/UPagination.js';
|
|
33
34
|
export * from './components/panel/UPanel.js';
|
|
34
35
|
export * from './components/popover/UPopover.js';
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import { UExpander } from "./components/expander/UExpander.js";
|
|
|
40
40
|
import { UFileInput } from "./components/file-input/UFileInput.js";
|
|
41
41
|
import { UForm } from "./components/form/UForm.js";
|
|
42
42
|
import { UOption } from "./components/option/UOption.js";
|
|
43
|
+
import { UOptionGroup, collectOptions } from "./components/option-group/UOptionGroup.js";
|
|
43
44
|
import { UInput } from "./components/input/UInput.js";
|
|
44
45
|
import { UMenuItem } from "./components/menu-item/UMenuItem.js";
|
|
45
46
|
import { UMenu } from "./components/menu/UMenu.js";
|
|
@@ -69,4 +70,4 @@ import { Dialog } from "./utilities/Dialog.js";
|
|
|
69
70
|
import { Theme } from "./utilities/Theme.js";
|
|
70
71
|
import { Toast } from "./utilities/Toast.js";
|
|
71
72
|
import { decodeDelimited, decodeTsv, encodeTsv } from "./utilities/tsv.js";
|
|
72
|
-
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, devWarnOnce, encodeTsv, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
73
|
+
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, collectOptions, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, devWarnOnce, encodeTsv, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
@@ -39,6 +39,8 @@ export declare function indexExportedTypes(packageName: string, entries: {
|
|
|
39
39
|
key: string;
|
|
40
40
|
source: string;
|
|
41
41
|
}[]): Map<string, string>;
|
|
42
|
+
/** Type-capable names a declaration file exports (`export declare class X` · `export { X }` of a declared `X`). */
|
|
43
|
+
export declare function exportedTypeNames(source: string): Set<string>;
|
|
42
44
|
/** Names a declaration file can use as types: its own type declarations and its imports. */
|
|
43
45
|
export declare function localTypeNames(source: string): Set<string>;
|
|
44
46
|
/**
|
|
@@ -48,8 +50,9 @@ export declare function localTypeNames(source: string): Set<string>;
|
|
|
48
50
|
*/
|
|
49
51
|
export declare function libGlobalNames(packageRoot: string): Set<string>;
|
|
50
52
|
/**
|
|
51
|
-
* Rewrites the dangling names inside each top-level `declare global { … }` block
|
|
52
|
-
*
|
|
53
|
+
* Rewrites the dangling names inside each top-level `declare global { … }` block — and each
|
|
54
|
+
* augmentation of a bare module specifier, `declare module 'react' { … }` — of one declaration file
|
|
55
|
+
* (see `fixPublishedDtsGlobals`). Everything outside those blocks is untouched.
|
|
53
56
|
*/
|
|
54
57
|
export declare function resolveDanglingGlobals(source: string, exportedFrom: Map<string, string>, globals?: Set<string>): string;
|
|
55
58
|
export {};
|
|
@@ -61,24 +61,28 @@ export function indexExportedTypes(packageName, entries) {
|
|
|
61
61
|
const ordered = [...entries].sort((a, b) => (a.key === '.' ? -1 : b.key === '.' ? 1 : 0));
|
|
62
62
|
for (const { key, source } of ordered) {
|
|
63
63
|
const specifier = key === '.' ? packageName : `${packageName}/${key.replace(/^\.\//, '')}`;
|
|
64
|
-
const
|
|
65
|
-
const exported = new Set();
|
|
66
|
-
for (const m of source.matchAll(/^export\s+declare\s+(?:abstract\s+)?(?:class|interface|type|enum)\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
67
|
-
exported.add(m[1]);
|
|
68
|
-
}
|
|
69
|
-
for (const m of source.matchAll(/^export\s*\{([^}]*)\}\s*;?\s*$/gm)) {
|
|
70
|
-
for (const part of m[1].split(',')) {
|
|
71
|
-
const [local, alias] = part.trim().replace(/^type\s+/, '').split(/\s+as\s+/);
|
|
72
|
-
if (local && declared.has(local))
|
|
73
|
-
exported.add((alias ?? local).trim());
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
for (const name of exported)
|
|
64
|
+
for (const name of exportedTypeNames(source))
|
|
77
65
|
if (!index.has(name))
|
|
78
66
|
index.set(name, specifier);
|
|
79
67
|
}
|
|
80
68
|
return index;
|
|
81
69
|
}
|
|
70
|
+
/** Type-capable names a declaration file exports (`export declare class X` · `export { X }` of a declared `X`). */
|
|
71
|
+
export function exportedTypeNames(source) {
|
|
72
|
+
const declared = localTypeNames(source);
|
|
73
|
+
const exported = new Set();
|
|
74
|
+
for (const m of source.matchAll(/^export\s+declare\s+(?:abstract\s+)?(?:class|interface|type|enum)\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
75
|
+
exported.add(m[1]);
|
|
76
|
+
}
|
|
77
|
+
for (const m of source.matchAll(/^export\s*\{([^}]*)\}\s*;?\s*$/gm)) {
|
|
78
|
+
for (const part of m[1].split(',')) {
|
|
79
|
+
const [local, alias] = part.trim().replace(/^type\s+/, '').split(/\s+as\s+/);
|
|
80
|
+
if (local && declared.has(local))
|
|
81
|
+
exported.add((alias ?? local).trim());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return exported;
|
|
85
|
+
}
|
|
82
86
|
/** Names a declaration file can use as types: its own type declarations and its imports. */
|
|
83
87
|
export function localTypeNames(source) {
|
|
84
88
|
const names = new Set();
|
|
@@ -130,17 +134,30 @@ export function libGlobalNames(packageRoot) {
|
|
|
130
134
|
return names;
|
|
131
135
|
}
|
|
132
136
|
/**
|
|
133
|
-
* Rewrites the dangling names inside each top-level `declare global { … }` block
|
|
134
|
-
*
|
|
137
|
+
* Rewrites the dangling names inside each top-level `declare global { … }` block — and each
|
|
138
|
+
* augmentation of a bare module specifier, `declare module 'react' { … }` — of one declaration file
|
|
139
|
+
* (see `fixPublishedDtsGlobals`). Everything outside those blocks is untouched.
|
|
135
140
|
*/
|
|
136
141
|
export function resolveDanglingGlobals(source, exportedFrom, globals = new Set()) {
|
|
137
142
|
const local = localTypeNames(source);
|
|
143
|
+
// A class the bundler inlined as a private copy (declared here, exported only by another entry) is a second nominal
|
|
144
|
+
// type for the same tag — merging both copies into one global map fails with TS2717. Point at the public one.
|
|
145
|
+
const exportedHere = exportedTypeNames(source);
|
|
146
|
+
for (const name of [...local]) {
|
|
147
|
+
if (exportedHere.has(name) || !exportedFrom.has(name))
|
|
148
|
+
continue;
|
|
149
|
+
const declared = new RegExp(`^\\s*(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?(?:class|interface|type|enum)\\s+${name}\\b`, 'm');
|
|
150
|
+
if (declared.test(source))
|
|
151
|
+
local.delete(name); // an import is an explicit binding — kept
|
|
152
|
+
}
|
|
138
153
|
for (const name of globals)
|
|
139
154
|
if (!exportedFrom.has(name))
|
|
140
155
|
local.add(name);
|
|
141
156
|
let out = '';
|
|
142
157
|
let cursor = 0;
|
|
143
|
-
|
|
158
|
+
// A module augmentation (`declare module 'react' { namespace JSX … }`) is copied the same way and
|
|
159
|
+
// dangles the same way. Only bare specifiers: an entry file is a module, so these are augmentations.
|
|
160
|
+
const marker = /declare\s+(?:global|module\s+(['"])[^'"./][^'"]*\1)\s*\{/g;
|
|
144
161
|
for (let m = marker.exec(source); m; m = marker.exec(source)) {
|
|
145
162
|
const open = m.index + m[0].length - 1;
|
|
146
163
|
const close = matchingBrace(source, open);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UOptionGroup as UOptionGroupElement } from '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
3
|
+
|
|
4
|
+
type UOptionGroupOwnProps = Omit<UOptionGroupElement, keyof HTMLElement>;
|
|
5
|
+
|
|
6
|
+
export declare const UOptionGroup: React.ForwardRefExoticComponent<
|
|
7
|
+
Partial<Omit<UOptionGroupElement, Exclude<keyof React.HTMLAttributes<UOptionGroupElement>, keyof UOptionGroupOwnProps>>>
|
|
8
|
+
& Omit<React.HTMLAttributes<UOptionGroupElement>, keyof UOptionGroupOwnProps | never>
|
|
9
|
+
& React.RefAttributes<UOptionGroupElement>
|
|
10
|
+
& {
|
|
11
|
+
}
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export type UOptionGroupProps = React.ComponentProps<typeof UOptionGroup>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UOptionGroup as UOptionGroupElement } from '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
4
|
+
|
|
5
|
+
export const UOptionGroup = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-option-group',
|
|
8
|
+
elementClass: UOptionGroupElement,
|
|
9
|
+
events: {},
|
|
10
|
+
});
|
package/dist/react/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { UProgressBar, UProgressBarProps } from './UProgressBar';
|
|
|
21
21
|
export { UPopover, UPopoverProps } from './UPopover';
|
|
22
22
|
export { UPanel, UPanelProps } from './UPanel';
|
|
23
23
|
export { UPagination, UPaginationProps } from './UPagination';
|
|
24
|
+
export { UOptionGroup, UOptionGroupProps } from './UOptionGroup';
|
|
24
25
|
export { UOption, UOptionProps } from './UOption';
|
|
25
26
|
export { UMenuItem, UMenuItemProps } from './UMenuItem';
|
|
26
27
|
export { UMenu, UMenuProps } from './UMenu';
|
package/dist/react/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { UProgressBar } from './UProgressBar.js';
|
|
|
21
21
|
export { UPopover } from './UPopover.js';
|
|
22
22
|
export { UPanel } from './UPanel.js';
|
|
23
23
|
export { UPagination } from './UPagination.js';
|
|
24
|
+
export { UOptionGroup } from './UOptionGroup.js';
|
|
24
25
|
export { UOption } from './UOption.js';
|
|
25
26
|
export { UMenuItem } from './UMenuItem.js';
|
|
26
27
|
export { UMenu } from './UMenu.js';
|
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
78
78
|
- [`u-field`](./references/components/field.md) — Layout wrapper providing label, description, and validation message
|
|
79
79
|
- [`u-form`](./references/components/form.md) — Form group with two-way model binding and validation
|
|
80
80
|
- [`u-option`](./references/components/option.md) — Selectable option item for `u-select`, `u-radio`, `u-input`
|
|
81
|
+
- [`u-option-group`](./references/components/option-group.md) — Labelled group of `u-option`s in `u-select` / `u-input` (the native `<optgroup>`)
|
|
81
82
|
|
|
82
83
|
**`disabled` is exposed where assistive technology and test tools look for it** — on the node that
|
|
83
84
|
carries the control's role, not on the host element. Native nodes use native `disabled`
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# u-option-group
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/option-group/UOptionGroup.js';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Tag:** `u-option-group`
|
|
8
|
+
|
|
9
|
+
A labelled group of `u-option`s inside `u-select` or a `u-input` combobox — the native `<optgroup>`. Use it when one
|
|
10
|
+
list mixes kinds (regions and zones, projects and monitors) instead of repeating the kind inside every label.
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<u-select label="Context" searchable>
|
|
14
|
+
<u-option value="all">Everything</u-option>
|
|
15
|
+
<u-option-group label="Workspaces">
|
|
16
|
+
<u-option value="w-north">North plant</u-option>
|
|
17
|
+
<u-option value="w-south">South plant</u-option>
|
|
18
|
+
</u-option-group>
|
|
19
|
+
<u-option-group label="Monitors">
|
|
20
|
+
<u-option value="m-press">Press line</u-option>
|
|
21
|
+
</u-option-group>
|
|
22
|
+
</u-select>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- The heading is not an option — it takes no focus, cannot be selected, and the arrow keys go from the last option of
|
|
26
|
+
one group to the first of the next.
|
|
27
|
+
- For assistive technology the group is `role="group"` named by `label` (the listbox pattern's grouping); the heading
|
|
28
|
+
itself is not read a second time.
|
|
29
|
+
- While none of its options is visible — a `searchable` select's local filter hid them all, or it has none — the whole
|
|
30
|
+
group, heading included, is hidden (`:state(empty)`). The heading takes no part in the search.
|
|
31
|
+
- Options added to or removed from a group later are picked up by the owning select or input.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
| Property | Type | Default | Reflect | Description |
|
|
38
|
+
|----------|------|---------|---------|-------------|
|
|
39
|
+
| `label` | `string` | `''` | — | The heading, and the group's accessible name |
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| (default) | `u-option` items |
|
|
46
|
+
|
|
47
|
+
## CSS Parts
|
|
48
|
+
|
|
49
|
+
| Part | Description |
|
|
50
|
+
|------|-------------|
|
|
51
|
+
| `label` | The heading |
|
|
52
|
+
| `options` | The box around the options |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
None of its own — the heading uses the overline type tokens (`--u-text-overline-*`) and `--u-txt-color-weak`.
|
|
@@ -24,6 +24,8 @@ Dropdown select with single or multiple selection, search, and clear support. Fo
|
|
|
24
24
|
</u-select>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
Options of different kinds can be grouped under headings with [`u-option-group`](./option-group.md) — the native `<optgroup>`; a group whose options a search filtered out is hidden.
|
|
28
|
+
|
|
27
29
|
---
|
|
28
30
|
|
|
29
31
|
## Slots
|