@iyulab/components 2.23.0 → 2.23.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.
- package/CHANGELOG.md +20 -0
- package/dist/components/UOverlayElement.d.ts +8 -1
- package/dist/components/UOverlayElement.js +14 -4
- package/dist/components/button/UButton.d.ts +4 -4
- package/dist/components/button/UButton.styles.js +19 -4
- package/dist/utilities/elements.d.ts +2 -1
- package/dist/utilities/elements.js +3 -2
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/button.md +2 -2
- package/skills/iyulab-components/references/components/field.md +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.23.2] - 2026-10-13
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A dark button shows its hover and press.** `u-button` derived its hover and active colours by mixing toward black
|
|
8
|
+
(85% / 70%), so a near-black brand colour — an ink primary such as `#18191B` — had nowhere to go: the hover was
|
|
9
|
+
about 1.05:1 against the resting button and the most-pressed button on the screen showed no state. A colour darker
|
|
10
|
+
than OKLab lightness 0.4 now mixes toward white instead; mid and light colours derive exactly as before. The same
|
|
11
|
+
rule applies to the `link` text states of the decorative colours. Browsers without relative colour syntax keep the
|
|
12
|
+
old direction.
|
|
13
|
+
|
|
14
|
+
## [2.23.1] - 2026-10-13
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- A `u-dialog` or `u-drawer` whose controls are components — `u-button`, `u-icon-button` — gives the first of them the
|
|
19
|
+
focus when it opens. The focus stayed on the dialog itself: the initial-focus search did not count a host whose
|
|
20
|
+
shadow root delegates focus as focusable, and the trap's own «first tabbable» did not see inside it at that moment
|
|
21
|
+
(a native `<button>` was found). `autofocus` on a `u-icon-button` is honoured for the same reason.
|
|
22
|
+
|
|
3
23
|
## [2.23.0] - 2026-10-13
|
|
4
24
|
|
|
5
25
|
### Added
|
|
@@ -82,7 +82,12 @@ export declare abstract class UOverlayElement extends UElement {
|
|
|
82
82
|
/**
|
|
83
83
|
* 열릴 때 포커스를 받을 요소를 정한다 — **입력을 먼저 본다.**
|
|
84
84
|
*
|
|
85
|
-
* 순서: `[autofocus]` → 첫 입력 컨트롤 → (없으면) focus-trap
|
|
85
|
+
* 순서: `[autofocus]` → 첫 입력 컨트롤 → 첫 포커스 가능 요소(섀도 안까지) → (없으면) focus-trap 기본값.
|
|
86
|
+
*
|
|
87
|
+
* 셋째 단계는 우리가 찾는다 — focus-trap 의 «첫 tabbable» 은 여는 순간 슬롯 자식 컴포넌트(`u-button` 의
|
|
88
|
+
* 섀도 안 버튼)를 보지 못해, 버튼만 든 대화상자의 포커스가 호스트에 머물렀다(브라우저 실측 — 네이티브
|
|
89
|
+
* `<button>` 은 잡았다. 열린 뒤의 Tab 가두기는 그 버튼들을 정상으로 돈다). 후보마다 실제로 포커스해 보고,
|
|
90
|
+
* 포커스가 그 안에 들어간 첫 요소에서 멈춘다(`delegatesFocus` 호스트가 안에 포커스할 것이 없으면 다음으로).
|
|
86
91
|
*
|
|
87
92
|
* 🔴**두 분기가 «각각» 무엇을 하는지 되돌려 재서 갈랐다** — 이 함수는 그 기록이다.
|
|
88
93
|
*
|
|
@@ -97,6 +102,8 @@ export declare abstract class UOverlayElement extends UElement {
|
|
|
97
102
|
* (`tests/browser/overlay-initial-focus.browser.test.ts` 가 둘 다 감시한다.)
|
|
98
103
|
*/
|
|
99
104
|
private resolveInitialFocus;
|
|
105
|
+
/** `el` 을 포커스하고, 실제 포커스가 그 안(섀도 포함)에 들어갔는가. */
|
|
106
|
+
private focusLands;
|
|
100
107
|
/** 오버레이가 닫힐 때 설정을 해제합니다. */
|
|
101
108
|
private cleanup;
|
|
102
109
|
/** host 자체를 클릭한 경우(백드롭)만 닫기 요청 */
|
|
@@ -121,7 +121,12 @@ var UOverlayElement = class extends UElement {
|
|
|
121
121
|
/**
|
|
122
122
|
* 열릴 때 포커스를 받을 요소를 정한다 — **입력을 먼저 본다.**
|
|
123
123
|
*
|
|
124
|
-
* 순서: `[autofocus]` → 첫 입력 컨트롤 → (없으면) focus-trap
|
|
124
|
+
* 순서: `[autofocus]` → 첫 입력 컨트롤 → 첫 포커스 가능 요소(섀도 안까지) → (없으면) focus-trap 기본값.
|
|
125
|
+
*
|
|
126
|
+
* 셋째 단계는 우리가 찾는다 — focus-trap 의 «첫 tabbable» 은 여는 순간 슬롯 자식 컴포넌트(`u-button` 의
|
|
127
|
+
* 섀도 안 버튼)를 보지 못해, 버튼만 든 대화상자의 포커스가 호스트에 머물렀다(브라우저 실측 — 네이티브
|
|
128
|
+
* `<button>` 은 잡았다. 열린 뒤의 Tab 가두기는 그 버튼들을 정상으로 돈다). 후보마다 실제로 포커스해 보고,
|
|
129
|
+
* 포커스가 그 안에 들어간 첫 요소에서 멈춘다(`delegatesFocus` 호스트가 안에 포커스할 것이 없으면 다음으로).
|
|
125
130
|
*
|
|
126
131
|
* 🔴**두 분기가 «각각» 무엇을 하는지 되돌려 재서 갈랐다** — 이 함수는 그 기록이다.
|
|
127
132
|
*
|
|
@@ -138,11 +143,16 @@ var UOverlayElement = class extends UElement {
|
|
|
138
143
|
resolveInitialFocus() {
|
|
139
144
|
const content = Array.from(this.children);
|
|
140
145
|
const target = querySelectorDeep(content, "[autofocus]", isFocusCandidate) ?? querySelectorDeep(content, "input, select, textarea, u-input, u-textarea, u-select, u-checkbox, u-radio, u-switch, u-slider", isFocusCandidate);
|
|
141
|
-
if (
|
|
142
|
-
|
|
146
|
+
if (target && this.focusLands(target)) return false;
|
|
147
|
+
return querySelectorDeep(content, "*", (el) => isFocusCandidate(el) && this.focusLands(el)) ? false : void 0;
|
|
148
|
+
}
|
|
149
|
+
/** `el` 을 포커스하고, 실제 포커스가 그 안(섀도 포함)에 들어갔는가. */
|
|
150
|
+
focusLands(el) {
|
|
151
|
+
el.focus();
|
|
143
152
|
let active = document.activeElement;
|
|
144
153
|
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
145
|
-
for (let n = active; n; n = n.parentNode ?? n.host ?? null) if (n ===
|
|
154
|
+
for (let n = active; n; n = n.parentNode ?? n.host ?? null) if (n === el) return true;
|
|
155
|
+
return false;
|
|
146
156
|
}
|
|
147
157
|
/** 오버레이가 닫힐 때 설정을 해제합니다. */
|
|
148
158
|
cleanup() {
|
|
@@ -45,10 +45,10 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
45
45
|
* (기본: #fff · 역할 값 지정 시 --u-{role}-txt-color)
|
|
46
46
|
* @cssprop --btn-color-strong - **바탕 위**의 글자색 — appearance="link"·"plain" 이 읽는다.
|
|
47
47
|
* 면과 요구가 반대라 슬롯이 따로 있다 (기본: --btn-color 와 동일 · 역할 값 지정 시 --u-{role}-color-strong)
|
|
48
|
-
* @cssprop --btn-color-strong-hover - 바탕 위 글자 hover (기본: 85% + black · 역할 값은 움직이지 않고 밑줄로 강조)
|
|
49
|
-
* @cssprop --btn-color-strong-active - 바탕 위 글자 active (기본: 70% + black · 역할 값은 고정)
|
|
50
|
-
* @cssprop --btn-color-hover - solid 배경 hover (기본: --btn-color 85% + black)
|
|
51
|
-
* @cssprop --btn-color-active - solid 배경 active (기본: --btn-color 70% + black)
|
|
48
|
+
* @cssprop --btn-color-strong-hover - 바탕 위 글자 hover (기본: 85% + black, 어두운 색은 + white · 역할 값은 움직이지 않고 밑줄로 강조)
|
|
49
|
+
* @cssprop --btn-color-strong-active - 바탕 위 글자 active (기본: 70% + black, 어두운 색은 + white · 역할 값은 고정)
|
|
50
|
+
* @cssprop --btn-color-hover - solid 배경 hover (기본: --btn-color 85% + black — --btn-color 가 어두우면(OKLab 명도 0.4 미만) + white)
|
|
51
|
+
* @cssprop --btn-color-active - solid 배경 active (기본: --btn-color 70% + black — 어두우면 + white)
|
|
52
52
|
* @cssprop --btn-color-surface - soft 배경 (역할 색: --u-{role}-bg-color · 그 밖: --btn-color 12% + 배경색)
|
|
53
53
|
* @cssprop --btn-color-surface-hover - soft 배경 hover (역할 색: 면에 --btn-color 18% · 그 밖: 22%)
|
|
54
54
|
* @cssprop --btn-color-surface-active - soft 배경 active (역할 색: 면에 --btn-color 30% · 그 밖: 32%)
|
|
@@ -18,11 +18,18 @@ var styles = css`
|
|
|
18
18
|
|
|
19
19
|
--btn-txt-color: #fff;
|
|
20
20
|
--btn-color-strong: var(--btn-color);
|
|
21
|
-
--btn-color-strong-hover: color-mix(in srgb, var(--btn-color-strong) 85%, black);
|
|
22
|
-
--btn-color-strong-active: color-mix(in srgb, var(--btn-color-strong) 70%, black);
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
--_btn-state-ink: black;
|
|
27
|
+
--_btn-strong-state-ink: black;
|
|
28
|
+
--btn-color-strong-hover: color-mix(in srgb, var(--btn-color-strong) 85%, var(--_btn-strong-state-ink));
|
|
29
|
+
--btn-color-strong-active: color-mix(in srgb, var(--btn-color-strong) 70%, var(--_btn-strong-state-ink));
|
|
30
|
+
|
|
31
|
+
--btn-color-hover: color-mix(in srgb, var(--btn-color) 85%, var(--_btn-state-ink));
|
|
32
|
+
--btn-color-active: color-mix(in srgb, var(--btn-color) 70%, var(--_btn-state-ink));
|
|
26
33
|
--btn-color-surface: color-mix(in srgb, var(--btn-color) 12%, var(--u-bg-color, #FFFFFF));
|
|
27
34
|
--btn-color-surface-hover: color-mix(in srgb, var(--btn-color) 22%, var(--u-bg-color, #FFFFFF));
|
|
28
35
|
--btn-color-surface-active: color-mix(in srgb, var(--btn-color) 32%, var(--u-bg-color, #FFFFFF));
|
|
@@ -33,6 +40,14 @@ var styles = css`
|
|
|
33
40
|
--btn-color-outline-active: color-mix(in srgb, var(--btn-color) 12%, var(--u-bg-color, #FFFFFF));
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
@supports (color: oklch(from red l c h)) {
|
|
44
|
+
:host {
|
|
45
|
+
|
|
46
|
+
--_btn-state-ink: oklch(from var(--btn-color) clamp(0, (0.4 - l) * 1000, 1) 0 0);
|
|
47
|
+
--_btn-strong-state-ink: oklch(from var(--btn-color-strong) clamp(0, (0.4 - l) * 1000, 1) 0 0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
36
51
|
:host {
|
|
37
52
|
position: relative;
|
|
38
53
|
display: inline-flex;
|
|
@@ -23,7 +23,8 @@ export declare function querySelectorAllWithin(element: Element, selectors: stri
|
|
|
23
23
|
export declare function isCoarsePointer(event: PointerEvent): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* 포커스를 «받을 수 있는» 요소인가 — 초기 포커스 후보를 고를 때 쓴다.
|
|
26
|
-
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · `
|
|
26
|
+
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · 섀도 루트가 `delegatesFocus` 인
|
|
27
|
+
* 호스트(`u-button` · `u-icon-button` — `focus()` 를 플랫폼이 안쪽으로 넘긴다) · `tabindex` 를 가진 요소이고,
|
|
27
28
|
* 비활성·`inert`·안 보임이 아니어야 한다. 걸러진 호스트는 그 안쪽(섀도 루트)에서 계속 찾는다.
|
|
28
29
|
* `u-select` 의 섀도에는 속성 `autofocus` 를 가진 닫힌 `u-popover` 가 늘 있다 — 이것을 집으면
|
|
29
30
|
* 포커스가 아무 데도 가지 않는다.
|
|
@@ -44,7 +44,8 @@ function isCoarsePointer(event) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* 포커스를 «받을 수 있는» 요소인가 — 초기 포커스 후보를 고를 때 쓴다.
|
|
47
|
-
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · `
|
|
47
|
+
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · 섀도 루트가 `delegatesFocus` 인
|
|
48
|
+
* 호스트(`u-button` · `u-icon-button` — `focus()` 를 플랫폼이 안쪽으로 넘긴다) · `tabindex` 를 가진 요소이고,
|
|
48
49
|
* 비활성·`inert`·안 보임이 아니어야 한다. 걸러진 호스트는 그 안쪽(섀도 루트)에서 계속 찾는다.
|
|
49
50
|
* `u-select` 의 섀도에는 속성 `autofocus` 를 가진 닫힌 `u-popover` 가 늘 있다 — 이것을 집으면
|
|
50
51
|
* 포커스가 아무 데도 가지 않는다.
|
|
@@ -52,7 +53,7 @@ function isCoarsePointer(event) {
|
|
|
52
53
|
function isFocusCandidate(el) {
|
|
53
54
|
if (!(el instanceof HTMLElement)) return false;
|
|
54
55
|
const native = el.matches("input:not([type=\"hidden\"]), select, textarea, button, a[href], [contenteditable=\"\"], [contenteditable=\"true\"]");
|
|
55
|
-
const forwards = el.focus !== HTMLElement.prototype.focus;
|
|
56
|
+
const forwards = el.focus !== HTMLElement.prototype.focus || el.shadowRoot?.delegatesFocus === true;
|
|
56
57
|
if (!native && !forwards && !el.hasAttribute("tabindex")) return false;
|
|
57
58
|
if (el.matches(":disabled") || el.hasAttribute("disabled") || el.closest("[inert]")) return false;
|
|
58
59
|
return typeof el.checkVisibility === "function" ? el.checkVisibility() : true;
|
package/package.json
CHANGED
|
@@ -96,11 +96,11 @@ element reference (`ariaControlsElements`) resolved when the button renders.
|
|
|
96
96
|
| `--btn-color` | The button's **fill** color. Every derived token below is `color-mix()`'d from this one — usually the only one you need to override |
|
|
97
97
|
| `--btn-txt-color` | Text color on the fill, read by `appearance="solid"` (default `#fff`, or `--u-{role}-txt-color` when a semantic `color` is set) |
|
|
98
98
|
| `--btn-color-strong` | Text color on the surrounding page background, read by `appearance="link"` and `"plain"` — opposite contrast need from the fill, so it's a separate token (default: same as `--btn-color`, or `--u-{role}-color-strong` for a semantic `color`) |
|
|
99
|
-
| `--btn-color-hover` / `--btn-color-active` | `solid` background hover/active (default: `--btn-color` at 85%/70%
|
|
99
|
+
| `--btn-color-hover` / `--btn-color-active` | `solid` background hover/active (default: `--btn-color` at 85%/70% mixed with black — or with white when `--btn-color` is dark, OKLab lightness below 0.4, so a near-black brand still shows its states) |
|
|
100
100
|
| `--btn-color-surface` / `-hover` / `-active` | `soft` background states — role colors (`primary`·`info`·`success`·`warning`·`danger`) use `--u-{role}-bg-color` and deepen it with 18%/30% of `--btn-color`; other colors mix `--btn-color` at 12%/22%/32%. A colored `plain` button hovers onto the same surface |
|
|
101
101
|
| `--btn-color-border` / `-hover` / `-active` | Border states (default: `--btn-color` at 45%/60%/75%) |
|
|
102
102
|
| `--btn-color-outline-hover` / `-active` | `outlined`/`plain` background hover/active (default: 6%/12%) |
|
|
103
|
-
| `--btn-color-strong-hover` / `-active` | `link` text hover/active — the role value itself doesn't move; hover adds an underline instead (default: `--btn-color-strong` at 85%/70%
|
|
103
|
+
| `--btn-color-strong-hover` / `-active` | `link` text hover/active — the role value itself doesn't move; hover adds an underline instead (default: `--btn-color-strong` at 85%/70% mixed with black, or white when it is dark) |
|
|
104
104
|
| `--btn-border-color` | Border color read by appearance/hover/active rules (default: `transparent`) |
|
|
105
105
|
| `--btn-padding-block` | Vertical inner padding (default `0.5em`) |
|
|
106
106
|
| `--btn-padding-inline` | Horizontal inner padding (default `1em`, `0` for `appearance="link"`) — overriding it does not change the min-height, which is derived from `--btn-padding-block` instead |
|
|
@@ -108,6 +108,13 @@ The hint opens three ways — hovering the icon, entering the field's control fr
|
|
|
108
108
|
pins it until a tap elsewhere or a second tap). Escape closes it, and so does focus leaving the field. The icon itself
|
|
109
109
|
is not a Tab stop — a form of dozens of fields would otherwise double its Tabs.
|
|
110
110
|
|
|
111
|
+
## CSS Parts
|
|
112
|
+
|
|
113
|
+
| Part | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `hint` | The info icon beside the label (`description-display="hint"`) |
|
|
116
|
+
| `hint-tooltip` | The tooltip that holds the description |
|
|
117
|
+
|
|
111
118
|
## Methods
|
|
112
119
|
|
|
113
120
|
| Method | Description |
|