@iyulab/components 2.6.0 → 2.8.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 +43 -0
- package/dist/assets/locales/ar.json.js +7 -1
- package/dist/assets/locales/de.json.js +7 -1
- package/dist/assets/locales/en.json.js +7 -1
- package/dist/assets/locales/es.json.js +7 -1
- package/dist/assets/locales/fr.json.js +7 -1
- package/dist/assets/locales/id.json.js +7 -1
- package/dist/assets/locales/ja.json.js +7 -1
- package/dist/assets/locales/ko.json.js +7 -1
- package/dist/assets/locales/pt-BR.json.js +7 -1
- package/dist/assets/locales/ru.json.js +7 -1
- package/dist/assets/locales/th.json.js +7 -1
- package/dist/assets/locales/vi.json.js +7 -1
- package/dist/assets/locales/zh-CN.json.js +7 -1
- package/dist/assets/locales/zh-TW.json.js +7 -1
- package/dist/components/UElement.d.ts +10 -0
- package/dist/components/UElement.js +18 -0
- package/dist/components/UFormControlElement.d.ts +5 -0
- package/dist/components/UFormControlElement.js +8 -0
- package/dist/components/alert/UAlert.js +16 -2
- package/dist/components/breadcrumb/UBreadcrumb.js +1 -1
- package/dist/components/calendar/UCalendar.js +1 -1
- package/dist/components/calendar/picker.styles.js +22 -1
- package/dist/components/carousel/UCarousel.d.ts +15 -0
- package/dist/components/carousel/UCarousel.js +45 -3
- package/dist/components/checkbox/UCheckbox.js +1 -1
- package/dist/components/chip/UChip.js +1 -1
- package/dist/components/copy-button/UCopyButton.js +1 -1
- package/dist/components/date-picker/UDatePicker.d.ts +4 -0
- package/dist/components/date-picker/UDatePicker.js +8 -2
- package/dist/components/date-picker/UDatePicker.styles.js +4 -0
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +4 -0
- package/dist/components/date-range-picker/UDateRangePicker.js +8 -2
- package/dist/components/date-range-picker/UDateRangePicker.styles.js +4 -0
- package/dist/components/dialog/UDialog.js +1 -1
- package/dist/components/drawer/UDrawer.js +1 -1
- package/dist/components/file-input/UFileInput.js +1 -1
- package/dist/components/file-input/UFileInput.styles.js +7 -0
- package/dist/components/input/UInput.d.ts +2 -0
- package/dist/components/input/UInput.js +6 -1
- package/dist/components/radio/URadio.js +1 -1
- package/dist/components/rating/URating.js +1 -1
- package/dist/components/select/USelect.d.ts +2 -0
- package/dist/components/select/USelect.js +2 -1
- package/dist/components/select/USelect.styles.js +12 -3
- package/dist/components/slider/USlider.js +1 -1
- package/dist/components/spinner/USpinner.d.ts +4 -0
- package/dist/components/spinner/USpinner.js +8 -1
- package/dist/components/split-panel/USplitPanel.d.ts +2 -0
- package/dist/components/split-panel/USplitPanel.js +6 -1
- package/dist/components/steps/USteps.js +1 -1
- package/dist/components/switch/USwitch.js +1 -1
- package/dist/components/tab/UTab.js +1 -1
- package/dist/components/textarea/UTextarea.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utilities/Dialog.js +1 -1
- package/dist/utilities/Locale.d.ts +12 -1
- package/dist/utilities/Locale.js +32 -0
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/alert.md +1 -1
- package/skills/iyulab-components/references/components/carousel.md +6 -0
- package/skills/iyulab-components/references/components/date-picker.md +1 -0
- package/skills/iyulab-components/references/components/date-range-picker.md +1 -0
- package/skills/iyulab-components/references/components/select.md +1 -0
- package/skills/iyulab-components/references/utilities/locale.md +15 -0
package/dist/utilities/Locale.js
CHANGED
|
@@ -50,6 +50,16 @@ function detectLocale() {
|
|
|
50
50
|
}
|
|
51
51
|
var active = detectLocale();
|
|
52
52
|
/**
|
|
53
|
+
* 로케일이 바뀌었음을 들을 곳 — 활성 로케일 전환(`set`)과 표 등록(`register`, 네임스페이스 포함).
|
|
54
|
+
* 이것이 없으면 이미 그려진 문장은 다음 재렌더까지 옛 언어로 남았다(런타임 언어 전환의 절반이 비었다).
|
|
55
|
+
*/
|
|
56
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
57
|
+
var revision = 0;
|
|
58
|
+
function notify() {
|
|
59
|
+
revision++;
|
|
60
|
+
for (const listener of [...listeners]) listener();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
53
63
|
* 내장 표가 **지역형으로만** 있는 언어의 기본 지역형 — 키는 태그의 접두(소문자).
|
|
54
64
|
*
|
|
55
65
|
* ⚠`lang="zh"`·`"pt"` 처럼 지역 없는 태그는 흔하고 정당하다(BCP 47). 사슬이 접두를 줄여 가기만
|
|
@@ -103,7 +113,27 @@ var Locale = class {
|
|
|
103
113
|
constructor() {}
|
|
104
114
|
/** 전역 활성 로케일을 지정합니다. */
|
|
105
115
|
static set(locale) {
|
|
116
|
+
if (locale === active) return;
|
|
106
117
|
active = locale;
|
|
118
|
+
notify();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 로케일이 바뀔 때(활성 로케일 전환 · 표 등록) 부를 함수를 등록하고, **구독을 푸는 함수**를 돌려줍니다.
|
|
122
|
+
* `UElement` 계열은 연결된 동안 스스로 구독해 다시 그리므로, 이것은 그 밖의 코드 — 직접 만든 요소, 앱 상태 —
|
|
123
|
+
* 를 위한 것입니다. React 에서는 `useSyncExternalStore(Locale.subscribe, () => Locale.revision)`.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* 로케일이 바뀔 때마다(구독자에게 알릴 때마다) 하나씩 느는 수 — «내가 마지막으로 본 뒤 바뀌었는가» 를 묻는 값.
|
|
127
|
+
* `get()` 은 표 등록으로 문장이 바뀌어도 그대로이므로, 스냅샷·캐시 키로는 이것을 쓴다.
|
|
128
|
+
*/
|
|
129
|
+
static get revision() {
|
|
130
|
+
return revision;
|
|
131
|
+
}
|
|
132
|
+
static subscribe(listener) {
|
|
133
|
+
listeners.add(listener);
|
|
134
|
+
return () => {
|
|
135
|
+
listeners.delete(listener);
|
|
136
|
+
};
|
|
107
137
|
}
|
|
108
138
|
/** 전역 활성 로케일을 반환합니다 (초기값은 `<html lang>` → 브라우저 언어 자동 감지, 실패 시 'en'). */
|
|
109
139
|
static get() {
|
|
@@ -120,6 +150,7 @@ var Locale = class {
|
|
|
120
150
|
...current,
|
|
121
151
|
...table
|
|
122
152
|
});
|
|
153
|
+
notify();
|
|
123
154
|
}
|
|
124
155
|
/**
|
|
125
156
|
* 현재 활성 로케일 기준으로 메시지를 조회합니다.
|
|
@@ -155,6 +186,7 @@ var Locale = class {
|
|
|
155
186
|
...table
|
|
156
187
|
});
|
|
157
188
|
namespaces.set(name, byLocale);
|
|
189
|
+
notify();
|
|
158
190
|
},
|
|
159
191
|
text: (key, params) => textIn(void 0, key, params),
|
|
160
192
|
textIn
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ Closable message banner with status icons, auto-dismiss timer, and open/hide tra
|
|
|
35
35
|
| `open` | `boolean` | `false` | ✓ | Show/hide the alert |
|
|
36
36
|
| `closable` | `boolean` | `false` | ✓ | Show close button |
|
|
37
37
|
| `appearance` | `'soft'\|'outlined'` | `'soft'` | ✓ | `soft` status-colour tint, no outline · `outlined` status-colour border on a transparent face |
|
|
38
|
-
| `status` | `'error'\|'warning'\|'success'\|'info'\|'notice'` | — | ✓ | Status type; controls icon and color |
|
|
38
|
+
| `status` | `'error'\|'warning'\|'success'\|'info'\|'notice'` | — | ✓ | Status type; controls icon, color and role (`error`/`warning` are `role="alert"`). An outcome word, not a palette word — buttons and badges say `color="danger"`, an alert says `status="error"`; an unknown value renders as a neutral notice and warns in development, naming the likely word |
|
|
39
39
|
| `title` | `string` | `''` | — | Title label. Left empty, the status name in the current locale is shown (`Locale.set('ko')` → 「오류」), not the raw status value |
|
|
40
40
|
| `duration` | `number` | `0` | — | Auto-dismiss delay in ms; `0` disables |
|
|
41
41
|
|
|
@@ -28,6 +28,12 @@ moves into it, until the user presses start (WAI-ARIA APG carousel pattern). Sli
|
|
|
28
28
|
motion (`prefers-reduced-motion: reduce`) the carousel starts stopped — the start button turns
|
|
29
29
|
rotation on — and it stops if that setting is turned on while the page is open.
|
|
30
30
|
|
|
31
|
+
Assistive technology gets the WAI-ARIA APG carousel structure: the host is a `region` described as a
|
|
32
|
+
"carousel" (in the active locale), and each slide is a `group` described as a "slide" and named by its
|
|
33
|
+
position ("2 of 5"). Name the carousel with `aria-label` on the host — a region needs a name to be a
|
|
34
|
+
landmark. A `role`, `aria-roledescription` or `aria-label` you put on a slide is kept; only the empty
|
|
35
|
+
ones are filled.
|
|
36
|
+
|
|
31
37
|
---
|
|
32
38
|
|
|
33
39
|
## Slots
|
|
@@ -137,4 +137,5 @@ starts from the value. Typing in the text box still commits on Enter or leaving
|
|
|
137
137
|
|----------|-------------|
|
|
138
138
|
| `--u-date-picker-display` | Host `display` (default: inline-block). Set `block` to fill the container width in forms and grid cells |
|
|
139
139
|
| `--u-date-picker-width` | Host `width` (default: auto). Set `100%` where `block` alone does not stretch the host (e.g. inside a flex container) |
|
|
140
|
+
| `--date-picker-min-text` | Minimum width of the text area (default `4ch`). The clear and calendar buttons never squeeze the typed date below it — a picker given less width overflows its host visibly |
|
|
140
141
|
| `--date-picker-popover-width` | Width of the calendar popover (default: 296px, independent of trigger width — a fixed-width calendar reads more naturally) |
|
|
@@ -204,3 +204,4 @@ The range look comes from theme tokens — `--u-primary-color` (end caps), `--u-
|
|
|
204
204
|
|----------|-------------|
|
|
205
205
|
| `--u-date-range-picker-display` | Host `display` (default: inline-block). Set `block` to fill the container width |
|
|
206
206
|
| `--u-date-range-picker-width` | Host `width` (default: auto). Set `100%` where `block` alone does not stretch the host |
|
|
207
|
+
| `--date-range-picker-min-text` | Minimum width of the text area (default `4ch`). The clear and calendar buttons never squeeze the typed range below it — a picker given less width overflows its host visibly |
|
|
@@ -96,3 +96,4 @@ the first/last visible option; on an option, arrows, `Home`/`End`, `Enter`/`Spac
|
|
|
96
96
|
| `--select-popover-width` | Dropdown width (fixed to anchor width by default; long option text ellipsizes instead of widening the popover) |
|
|
97
97
|
| `--select-popover-min-height` | Dropdown min-height |
|
|
98
98
|
| `--select-popover-max-height` | Dropdown max-height |
|
|
99
|
+
| `--select-min-text` | Minimum width of the displayed text (default `4ch`). The clear button and the dropdown arrow never squeeze the selection below it — a select given less width overflows its host visibly instead of showing nothing |
|
|
@@ -40,6 +40,21 @@ same chain.
|
|
|
40
40
|
| `Locale.register(locale, table)` | Register/override locale messages (partial merge supported) |
|
|
41
41
|
| `Locale.getValue(key, params?, locale?)` | Resolve a localized message for the current locale (or `locale`, along its fallback chain) |
|
|
42
42
|
| `Locale.namespace(name)` | A string table for a package or app area, keyed by its own union — returns a handle (below) |
|
|
43
|
+
| `Locale.subscribe(listener)` | Call `listener` whenever the locale changes (`set` to another locale, any `register`) — returns the unsubscribe function |
|
|
44
|
+
| `Locale.revision` | A number that grows on every change — a snapshot or cache key (`get()` stays the same when only a table changes) |
|
|
45
|
+
|
|
46
|
+
### Switching at runtime
|
|
47
|
+
|
|
48
|
+
`Locale.set()` and `Locale.register()` take effect on screen at once: every connected component
|
|
49
|
+
re-renders, including text it keeps outside its template — validation messages, accessible names,
|
|
50
|
+
the decimal separator of a number field. An element detached during the change catches up when it
|
|
51
|
+
is attached again. Your own code subscribes the same way:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const off = Locale.subscribe(() => renderMyView());
|
|
55
|
+
// React
|
|
56
|
+
const revision = useSyncExternalStore(Locale.subscribe, () => Locale.revision);
|
|
57
|
+
```
|
|
43
58
|
|
|
44
59
|
### Namespaces
|
|
45
60
|
|