@iyulab/components 1.57.1 → 2.0.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 +208 -0
- package/README.md +3 -1
- package/dist/_virtual/_glob-assets_raw/dark.css.e8ac080d.js +1 -1
- package/dist/_virtual/_glob-assets_raw/light.css.637cb2f8.js +1 -1
- package/dist/assets/locales/ar.json.js +16 -2
- package/dist/assets/locales/de.json.js +16 -2
- package/dist/assets/locales/en.json.js +16 -2
- package/dist/assets/locales/es.json.js +18 -2
- package/dist/assets/locales/fr.json.js +16 -2
- package/dist/assets/locales/id.json.js +16 -2
- package/dist/assets/locales/ja.json.js +18 -2
- package/dist/assets/locales/ko.json.js +18 -2
- package/dist/assets/locales/pt-BR.json.js +16 -2
- package/dist/assets/locales/ru.json.js +16 -2
- package/dist/assets/locales/th.json.js +18 -2
- package/dist/assets/locales/vi.json.js +16 -2
- package/dist/assets/locales/zh-CN.json.js +18 -2
- package/dist/assets/locales/zh-TW.json.js +18 -2
- package/dist/components/UElement.styles.js +2 -2
- package/dist/components/alert/UAlert.d.ts +12 -7
- package/dist/components/alert/UAlert.js +3 -3
- package/dist/components/alert/UAlert.styles.js +6 -23
- package/dist/components/badge/UBadge.d.ts +5 -5
- package/dist/components/badge/UBadge.js +3 -3
- package/dist/components/badge/UBadge.styles.js +4 -4
- package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +1 -1
- package/dist/components/button/UButton.d.ts +32 -16
- package/dist/components/button/UButton.js +38 -5
- package/dist/components/button/UButton.styles.js +67 -50
- package/dist/components/button/forwarded-aria.d.ts +6 -0
- package/dist/components/button/forwarded-aria.js +15 -0
- package/dist/components/button-group/UButtonGroup.d.ts +4 -4
- package/dist/components/button-group/UButtonGroup.js +8 -8
- package/dist/components/button-group/UButtonGroup.styles.js +2 -2
- package/dist/components/calendar/UCalendar.d.ts +4 -0
- package/dist/components/calendar/UCalendar.js +5 -4
- package/dist/components/calendar/UCalendar.styles.js +4 -3
- package/dist/components/calendar/dates.d.ts +4 -0
- package/dist/components/calendar/dates.js +5 -1
- package/dist/components/calendar/datetime.d.ts +14 -0
- package/dist/components/calendar/datetime.js +35 -0
- package/dist/components/calendar/picker.styles.js +42 -2
- package/dist/components/card/UCard.d.ts +4 -3
- package/dist/components/card/UCard.js +3 -3
- package/dist/components/card/UCard.styles.js +2 -1
- package/dist/components/carousel/UCarousel.d.ts +7 -1
- package/dist/components/carousel/UCarousel.js +10 -3
- package/dist/components/carousel/UCarousel.styles.js +17 -6
- package/dist/components/checkbox/UCheckbox.d.ts +8 -9
- package/dist/components/checkbox/UCheckbox.js +3 -3
- package/dist/components/checkbox/UCheckbox.styles.js +22 -18
- package/dist/components/chip/UChip.d.ts +2 -2
- package/dist/components/chip/UChip.js +4 -4
- package/dist/components/copy-button/UCopyButton.d.ts +2 -2
- package/dist/components/copy-button/UCopyButton.js +4 -4
- package/dist/components/date-picker/UDatePicker.d.ts +32 -1
- package/dist/components/date-picker/UDatePicker.js +96 -33
- package/dist/components/date-picker/UDatePicker.styles.js +10 -18
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +72 -7
- package/dist/components/date-range-picker/UDateRangePicker.js +210 -34
- package/dist/components/date-range-picker/UDateRangePicker.styles.js +13 -3
- package/dist/components/dialog/UDialog.js +1 -1
- package/dist/components/divider/UDivider.d.ts +3 -3
- package/dist/components/divider/UDivider.js +2 -2
- package/dist/components/divider/UDivider.styles.js +5 -5
- package/dist/components/drawer/UDrawer.js +1 -1
- package/dist/components/expander/UExpander.styles.js +2 -2
- package/dist/components/file-input/UFileInput.styles.js +5 -2
- package/dist/components/icon-button/UIconButton.d.ts +4 -3
- package/dist/components/icon-button/UIconButton.js +16 -6
- package/dist/components/icon-button/UIconButton.styles.js +2 -2
- package/dist/components/input/UInput.d.ts +12 -5
- package/dist/components/input/UInput.js +7 -4
- package/dist/components/input/UInput.styles.js +60 -30
- package/dist/components/menu/UMenu.d.ts +5 -4
- package/dist/components/menu/UMenu.js +3 -3
- package/dist/components/menu/UMenu.styles.js +1 -1
- package/dist/components/menu-item/UMenuItem.styles.js +1 -1
- package/dist/components/option/UOption.d.ts +1 -0
- package/dist/components/option/UOption.js +6 -3
- package/dist/components/option/UOption.styles.js +1 -1
- package/dist/components/progress-bar/UProgressBar.styles.js +11 -0
- package/dist/components/radio/URadio.d.ts +27 -6
- package/dist/components/radio/URadio.js +48 -12
- package/dist/components/radio/URadio.styles.js +47 -13
- package/dist/components/rating/URating.styles.js +5 -1
- package/dist/components/select/USelect.d.ts +9 -2
- package/dist/components/select/USelect.js +7 -2
- package/dist/components/select/USelect.styles.js +55 -26
- package/dist/components/slider/USlider.styles.js +4 -4
- package/dist/components/spinner/USpinner.styles.js +2 -0
- package/dist/components/split-panel/USplitPanel.styles.js +2 -1
- package/dist/components/steps/USteps.d.ts +57 -0
- package/dist/components/steps/USteps.js +58 -0
- package/dist/components/steps/USteps.styles.d.ts +1 -0
- package/dist/components/steps/USteps.styles.js +110 -0
- package/dist/components/switch/USwitch.styles.js +5 -3
- package/dist/components/tab/UTab.js +2 -2
- package/dist/components/tab/UTab.styles.js +1 -1
- package/dist/components/tab-panel/UTabPanel.d.ts +11 -2
- package/dist/components/tab-panel/UTabPanel.js +33 -5
- package/dist/components/tab-panel/UTabPanel.styles.js +29 -29
- package/dist/components/tag/UTag.d.ts +14 -6
- package/dist/components/tag/UTag.js +8 -3
- package/dist/components/tag/UTag.styles.js +33 -26
- package/dist/components/textarea/UTextarea.d.ts +9 -3
- package/dist/components/textarea/UTextarea.js +7 -2
- package/dist/components/textarea/UTextarea.styles.js +41 -22
- package/dist/components/tree-item/UTreeItem.styles.js +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/plugins/vite-plugin-react-wrapper.js +14 -5
- package/dist/react/UAlert.d.ts +4 -2
- package/dist/react/UAvatar.d.ts +4 -2
- package/dist/react/UBadge.d.ts +4 -2
- package/dist/react/UBreadcrumb.d.ts +4 -2
- package/dist/react/UBreadcrumbItem.d.ts +4 -2
- package/dist/react/UButton.d.ts +4 -2
- package/dist/react/UButtonGroup.d.ts +4 -2
- package/dist/react/UCard.d.ts +4 -2
- package/dist/react/UCarousel.d.ts +4 -2
- package/dist/react/UCheckbox.d.ts +4 -2
- package/dist/react/UChip.d.ts +4 -2
- package/dist/react/UCopyButton.d.ts +4 -2
- package/dist/react/UDatePicker.d.ts +4 -2
- package/dist/react/UDateRangePicker.d.ts +4 -2
- package/dist/react/UDialog.d.ts +4 -2
- package/dist/react/UDivider.d.ts +4 -2
- package/dist/react/UDrawer.d.ts +4 -2
- package/dist/react/UExpander.d.ts +4 -2
- package/dist/react/UField.d.ts +4 -2
- package/dist/react/UFileInput.d.ts +4 -2
- package/dist/react/UForm.d.ts +4 -2
- package/dist/react/UIcon.d.ts +4 -2
- package/dist/react/UIconButton.d.ts +4 -2
- package/dist/react/UInput.d.ts +4 -2
- package/dist/react/UMenu.d.ts +4 -2
- package/dist/react/UMenuItem.d.ts +4 -2
- package/dist/react/UOption.d.ts +4 -2
- package/dist/react/UPanel.d.ts +4 -2
- package/dist/react/UPopover.d.ts +4 -2
- package/dist/react/UProgressBar.d.ts +4 -2
- package/dist/react/UProgressRing.d.ts +4 -2
- package/dist/react/URadio.d.ts +4 -2
- package/dist/react/URating.d.ts +4 -2
- package/dist/react/USelect.d.ts +4 -2
- package/dist/react/USkeleton.d.ts +4 -2
- package/dist/react/USlider.d.ts +4 -2
- package/dist/react/USpinner.d.ts +4 -2
- package/dist/react/USplitPanel.d.ts +4 -2
- package/dist/react/USteps.d.ts +14 -0
- package/dist/react/USteps.js +10 -0
- package/dist/react/USwitch.d.ts +4 -2
- package/dist/react/UTab.d.ts +4 -2
- package/dist/react/UTabPanel.d.ts +4 -2
- package/dist/react/UTag.d.ts +4 -2
- package/dist/react/UText.d.ts +4 -2
- package/dist/react/UTextarea.d.ts +4 -2
- package/dist/react/UTooltip.d.ts +4 -2
- package/dist/react/UTree.d.ts +4 -2
- package/dist/react/UTreeItem.d.ts +4 -2
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/styles/dark.css +42 -0
- package/dist/styles/light.css +44 -0
- package/dist/utilities/Dialog.d.ts +2 -2
- package/dist/utilities/Dialog.js +3 -3
- package/dist/utilities/Locale.d.ts +2 -2
- package/dist/utilities/Locale.js +2 -2
- package/dist/utilities/Toast.d.ts +2 -2
- package/dist/utilities/Toast.js +1 -1
- package/dist/utilities/format.d.ts +32 -4
- package/dist/utilities/format.js +131 -15
- package/dist/utilities/icons.d.ts +12 -3
- package/dist/utilities/icons.js +24 -6
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +3 -3
- package/skills/iyulab-components/references/components/alert.md +5 -5
- package/skills/iyulab-components/references/components/badge.md +3 -3
- package/skills/iyulab-components/references/components/button-group.md +3 -3
- package/skills/iyulab-components/references/components/button.md +34 -19
- package/skills/iyulab-components/references/components/card.md +3 -3
- package/skills/iyulab-components/references/components/carousel.md +3 -1
- package/skills/iyulab-components/references/components/checkbox.md +5 -5
- package/skills/iyulab-components/references/components/chip.md +2 -2
- package/skills/iyulab-components/references/components/copy-button.md +1 -1
- package/skills/iyulab-components/references/components/date-picker.md +35 -2
- package/skills/iyulab-components/references/components/date-range-picker.md +53 -5
- package/skills/iyulab-components/references/components/dialog.md +2 -2
- package/skills/iyulab-components/references/components/divider.md +2 -2
- package/skills/iyulab-components/references/components/drawer.md +1 -1
- package/skills/iyulab-components/references/components/field.md +1 -1
- package/skills/iyulab-components/references/components/icon-button.md +8 -2
- package/skills/iyulab-components/references/components/input.md +4 -2
- package/skills/iyulab-components/references/components/menu.md +1 -1
- package/skills/iyulab-components/references/components/radio.md +16 -4
- package/skills/iyulab-components/references/components/select.md +2 -1
- package/skills/iyulab-components/references/components/steps.md +66 -0
- package/skills/iyulab-components/references/components/tab-panel.md +10 -3
- package/skills/iyulab-components/references/components/tag.md +11 -7
- package/skills/iyulab-components/references/components/textarea.md +2 -1
- package/skills/iyulab-components/references/usage.md +1 -1
- package/skills/iyulab-components/references/utilities/dialog.md +2 -2
- package/skills/iyulab-components/references/utilities/icons.md +2 -2
- package/skills/iyulab-components/references/utilities/locale.md +1 -1
- package/skills/iyulab-components/references/utilities/theme.md +9 -5
- package/skills/iyulab-components/references/utilities/toast.md +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AlertAppearance, AlertStatus } from '../components/alert/UAlert.js';
|
|
2
2
|
/** 토스트 알림의 화면 위치 타입 */
|
|
3
3
|
export type ToastPosition = "top-left" | "top-center" | "top-right" | "middle-left" | "middle-center" | "middle-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
4
4
|
/** 토스트 알림 옵션 */
|
|
@@ -6,7 +6,7 @@ export interface ToastOptions {
|
|
|
6
6
|
/** 토스트를 표시할 대상 엘리먼트 (기본: document.body) */
|
|
7
7
|
target?: HTMLElement;
|
|
8
8
|
/** 형태 스타일 */
|
|
9
|
-
|
|
9
|
+
appearance?: AlertAppearance;
|
|
10
10
|
/** 알림 제목 */
|
|
11
11
|
title?: string;
|
|
12
12
|
/** 표시 화면 위치 */
|
package/dist/utilities/Toast.js
CHANGED
|
@@ -46,7 +46,7 @@ var Toast = class {
|
|
|
46
46
|
const el = new UAlert();
|
|
47
47
|
el.status = status;
|
|
48
48
|
el.innerHTML = content || "";
|
|
49
|
-
el.
|
|
49
|
+
el.appearance = merged.appearance || "soft";
|
|
50
50
|
el.title = merged.title || "";
|
|
51
51
|
el.closable = merged.closable ?? true;
|
|
52
52
|
el.duration = merged.duration ?? 4e3;
|
|
@@ -84,17 +84,22 @@ export declare function parseDate(text: string, options?: {
|
|
|
84
84
|
/**
|
|
85
85
|
* Reads a date and a time of day as people type them and returns local `YYYY-MM-DDTHH:mm`, or `null`.
|
|
86
86
|
* The date part is anything {@link parseDate} reads; the time follows a space or `T` as `HH:mm`
|
|
87
|
-
* (`9:05`, `09:05`, `09:05:30` — seconds are dropped).
|
|
88
|
-
*
|
|
87
|
+
* (`9:05`, `09:05`, `09:05:30` — seconds are dropped). With `seconds`, the result is
|
|
88
|
+
* `YYYY-MM-DDTHH:mm:ss` and typed seconds are kept (`:00` when none are typed). Text with only a date
|
|
89
|
+
* takes `defaultTime` (`00:00` unless given). An hour above 23, or a minute or second above 59, is `null`.
|
|
89
90
|
*/
|
|
90
91
|
export declare function parseDateTime(text: string, options?: {
|
|
91
92
|
format?: DateTextFormat;
|
|
92
93
|
locale?: LocaleTag;
|
|
93
94
|
referenceDate?: Date;
|
|
94
95
|
defaultTime?: string;
|
|
96
|
+
seconds?: boolean;
|
|
95
97
|
}): string | null;
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Writes local `YYYY-MM-DDTHH:mm` (or a longer ISO date-time) as `{date} HH:mm`, the date part as
|
|
100
|
+
* {@link formatDateText} writes it — `{date} HH:mm:ss` with `seconds`.
|
|
101
|
+
*/
|
|
102
|
+
export declare function formatDateTimeText(isoLocal: string, format?: DateTextFormat, locale?: LocaleTag, seconds?: boolean): string;
|
|
98
103
|
/**
|
|
99
104
|
* Reads a period of days as people type it — `2026-10-01 ~ 2026-10-31`, `2026-10-01 – 10-31`,
|
|
100
105
|
* the ISO interval `2026-10-01/2026-10-31`, or a single day (a one-day range) — and returns
|
|
@@ -112,3 +117,26 @@ export declare function parseDateRange(text: string, options?: {
|
|
|
112
117
|
} | null;
|
|
113
118
|
/** Writes a period as `{start} – {end}`, each day as {@link formatDateText} writes it. */
|
|
114
119
|
export declare function formatDateRangeText(start: string, end: string, format?: DateTextFormat, locale?: LocaleTag): string;
|
|
120
|
+
/**
|
|
121
|
+
* Reads a period with times of day — `2026-10-01 09:00 ~ 2026-10-31 18:00`, `2026-10-01 09:00 ~ 18:00`
|
|
122
|
+
* (a time alone ends on the first day), the ISO interval `2026-10-01T09:00/2026-10-31T18:00`, or the
|
|
123
|
+
* day forms {@link parseDateRange} reads — and returns `{ start, end }` as local `YYYY-MM-DDTHH:mm`,
|
|
124
|
+
* earlier first, or `null`. A day typed without a time takes `startTime` (default `00:00`) at the
|
|
125
|
+
* start and `endTime` (default `23:59`) at the end, so a period of days covers them whole; one day
|
|
126
|
+
* alone runs from `startTime` to `endTime` that day. A short second day takes the first day's year,
|
|
127
|
+
* or the next year when it would otherwise fall before the first day. With `seconds`, both ends are
|
|
128
|
+
* `YYYY-MM-DDTHH:mm:ss` (see {@link parseDateTime}).
|
|
129
|
+
*/
|
|
130
|
+
export declare function parseDateTimeRange(text: string, options?: {
|
|
131
|
+
format?: DateTextFormat;
|
|
132
|
+
locale?: LocaleTag;
|
|
133
|
+
referenceDate?: Date;
|
|
134
|
+
startTime?: string;
|
|
135
|
+
endTime?: string;
|
|
136
|
+
seconds?: boolean;
|
|
137
|
+
}): {
|
|
138
|
+
start: string;
|
|
139
|
+
end: string;
|
|
140
|
+
} | null;
|
|
141
|
+
/** Writes a period with times as `{start} – {end}`, each as {@link formatDateTimeText} writes it. */
|
|
142
|
+
export declare function formatDateTimeRangeText(start: string, end: string, format?: DateTextFormat, locale?: LocaleTag, seconds?: boolean): string;
|
package/dist/utilities/format.js
CHANGED
|
@@ -223,28 +223,78 @@ function parseDate(text, options = {}) {
|
|
|
223
223
|
/**
|
|
224
224
|
* Reads a date and a time of day as people type them and returns local `YYYY-MM-DDTHH:mm`, or `null`.
|
|
225
225
|
* The date part is anything {@link parseDate} reads; the time follows a space or `T` as `HH:mm`
|
|
226
|
-
* (`9:05`, `09:05`, `09:05:30` — seconds are dropped).
|
|
227
|
-
*
|
|
226
|
+
* (`9:05`, `09:05`, `09:05:30` — seconds are dropped). With `seconds`, the result is
|
|
227
|
+
* `YYYY-MM-DDTHH:mm:ss` and typed seconds are kept (`:00` when none are typed). Text with only a date
|
|
228
|
+
* takes `defaultTime` (`00:00` unless given). An hour above 23, or a minute or second above 59, is `null`.
|
|
228
229
|
*/
|
|
229
230
|
function parseDateTime(text, options = {}) {
|
|
230
231
|
const t = text.trim();
|
|
231
|
-
const
|
|
232
|
+
const words = meridiemWords(options.locale ?? Locale.get());
|
|
233
|
+
const joined = words.unspaced ? `|(?=${words.unspaced})` : "";
|
|
234
|
+
const m = new RegExp(`^(.*?)(?:(?:[T\\s]+${joined})(${words.timeOfDay}))?$`, "iu").exec(t);
|
|
232
235
|
if (!m) return null;
|
|
233
236
|
const date = parseDate(m[1], options);
|
|
234
237
|
if (!date) return null;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
const time = readTimeOfDay(m[2] ?? options.defaultTime ?? "00:00", words);
|
|
239
|
+
return time ? `${date}T${timeText(time.h, time.m, time.s, options.seconds)}` : null;
|
|
240
|
+
}
|
|
241
|
+
var escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
242
|
+
/**
|
|
243
|
+
* The morning/afternoon words read around a time: the locale's own (`timeAm`/`timePm` in its locale
|
|
244
|
+
* table — `오전`/`오후`, `午前`/`午後`, `上午`/`下午` …) and English `AM`/`PM` (also `a.m.`/`p.m.`).
|
|
245
|
+
* Not `Intl`'s day period: engines disagree on it (Node's ICU writes `PM` for `ko`, Chromium `오후`).
|
|
246
|
+
*/
|
|
247
|
+
function meridiemWords(locale) {
|
|
248
|
+
const pm = /* @__PURE__ */ new Map([["am", false], ["pm", true]]);
|
|
249
|
+
for (const [key, isPm] of [["timeAm", false], ["timePm", true]]) {
|
|
250
|
+
const word = Locale.getValue(key, void 0, locale).trim().toLowerCase().replace(/\./g, "");
|
|
251
|
+
if (word) pm.set(word, isPm);
|
|
252
|
+
}
|
|
253
|
+
const latin = (w) => /^[a-z]+$/.test(w);
|
|
254
|
+
const pattern = (w) => latin(w) ? w.split("").map((c) => `${escapeRegExp(c)}\\.?`).join("") : escapeRegExp(w);
|
|
255
|
+
const any = [...pm.keys()].map(pattern).join("|");
|
|
256
|
+
return {
|
|
257
|
+
pm,
|
|
258
|
+
any,
|
|
259
|
+
unspaced: [...pm.keys()].filter((w) => !latin(w)).map(escapeRegExp).join("|"),
|
|
260
|
+
timeOfDay: String.raw`(?:(?:${any})\s*)?\d{1,2}:\d{2}(?::\d{2})?(?:\s*(?:${any}))?`
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Reads a time of day — `9:05`, `09:05:30`, and the 12-hour forms `3:00 PM`, `3:00pm`, `p.m. 3:00`, or
|
|
265
|
+
* the locale's own words before or after (`Intl` day periods) — as 24-hour parts, or `null`. With a
|
|
266
|
+
* morning/afternoon word the hour must be 1–12 (`12 AM` is midnight, `12 PM` noon); without one 0–23.
|
|
267
|
+
*/
|
|
268
|
+
function readTimeOfDay(text, words) {
|
|
269
|
+
const r = new RegExp(String.raw`^(?:(${words.any})\s*)?(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\s*(${words.any}))?$`, "iu").exec(text.trim());
|
|
270
|
+
if (!r || r[1] && r[5]) return null;
|
|
271
|
+
const marker = r[1] ?? r[5];
|
|
272
|
+
let h = Number(r[2]);
|
|
273
|
+
if (marker) {
|
|
274
|
+
const pm = words.pm.get(marker.toLowerCase().replace(/\./g, ""));
|
|
275
|
+
if (pm === void 0 || h < 1 || h > 12) return null;
|
|
276
|
+
h = h % 12 + (pm ? 12 : 0);
|
|
238
277
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
278
|
+
if (h > 23 || Number(r[3]) > 59 || Number(r[4] ?? 0) > 59) return null;
|
|
279
|
+
return {
|
|
280
|
+
h: String(h),
|
|
281
|
+
m: r[3],
|
|
282
|
+
s: r[4]
|
|
283
|
+
};
|
|
243
284
|
}
|
|
244
|
-
/**
|
|
245
|
-
function
|
|
246
|
-
const
|
|
247
|
-
return
|
|
285
|
+
/** `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` when there are none). */
|
|
286
|
+
function timeText(h, min, s, seconds) {
|
|
287
|
+
const hm = `${h.padStart(2, "0")}:${min}`;
|
|
288
|
+
return seconds ? `${hm}:${(s ?? "00").padStart(2, "0")}` : hm;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Writes local `YYYY-MM-DDTHH:mm` (or a longer ISO date-time) as `{date} HH:mm`, the date part as
|
|
292
|
+
* {@link formatDateText} writes it — `{date} HH:mm:ss` with `seconds`.
|
|
293
|
+
*/
|
|
294
|
+
function formatDateTimeText(isoLocal, format = "iso", locale, seconds = false) {
|
|
295
|
+
const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(:\d{2})?/.exec(isoLocal);
|
|
296
|
+
if (!m) return isoLocal;
|
|
297
|
+
return `${formatDateText(m[1], format, locale)} ${m[2]}${seconds ? m[3] ?? ":00" : ""}`;
|
|
248
298
|
}
|
|
249
299
|
/** Separators read between the two days of a typed range: `~`, en/em dash, or ` - ` with spaces. */
|
|
250
300
|
var RANGE_SEPARATOR = /\s*[~–—]\s*|\s+-\s+/;
|
|
@@ -295,5 +345,71 @@ function parseDateRange(text, options = {}) {
|
|
|
295
345
|
function formatDateRangeText(start, end, format = "iso", locale) {
|
|
296
346
|
return `${formatDateText(start, format, locale)} – ${formatDateText(end, format, locale)}`;
|
|
297
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Reads a period with times of day — `2026-10-01 09:00 ~ 2026-10-31 18:00`, `2026-10-01 09:00 ~ 18:00`
|
|
350
|
+
* (a time alone ends on the first day), the ISO interval `2026-10-01T09:00/2026-10-31T18:00`, or the
|
|
351
|
+
* day forms {@link parseDateRange} reads — and returns `{ start, end }` as local `YYYY-MM-DDTHH:mm`,
|
|
352
|
+
* earlier first, or `null`. A day typed without a time takes `startTime` (default `00:00`) at the
|
|
353
|
+
* start and `endTime` (default `23:59`) at the end, so a period of days covers them whole; one day
|
|
354
|
+
* alone runs from `startTime` to `endTime` that day. A short second day takes the first day's year,
|
|
355
|
+
* or the next year when it would otherwise fall before the first day. With `seconds`, both ends are
|
|
356
|
+
* `YYYY-MM-DDTHH:mm:ss` (see {@link parseDateTime}).
|
|
357
|
+
*/
|
|
358
|
+
function parseDateTimeRange(text, options = {}) {
|
|
359
|
+
const t = text.trim();
|
|
360
|
+
if (!t) return null;
|
|
361
|
+
const startTime = options.startTime ?? "00:00";
|
|
362
|
+
const endTime = options.endTime ?? "23:59";
|
|
363
|
+
let parts = t.split(RANGE_SEPARATOR);
|
|
364
|
+
if (parts.length === 1 && t.includes("/")) {
|
|
365
|
+
const iso = /^(\d{4}-\d{2}-\d{2}(?:T[\d:]+)?)[^/]*\/(\d{4}-\d{2}-\d{2}(?:T[\d:]+)?)/.exec(t);
|
|
366
|
+
if (iso) parts = [iso[1], iso[2]];
|
|
367
|
+
}
|
|
368
|
+
if (parts.length > 2) return null;
|
|
369
|
+
const start = parseDateTime(parts[0], {
|
|
370
|
+
...options,
|
|
371
|
+
defaultTime: startTime
|
|
372
|
+
});
|
|
373
|
+
if (!start) return null;
|
|
374
|
+
const startDay = start.slice(0, 10);
|
|
375
|
+
if (parts.length === 1) {
|
|
376
|
+
const sameDayEnd = parseDateTime(startDay, {
|
|
377
|
+
...options,
|
|
378
|
+
defaultTime: endTime
|
|
379
|
+
});
|
|
380
|
+
if (!sameDayEnd) return null;
|
|
381
|
+
return {
|
|
382
|
+
start,
|
|
383
|
+
end: sameDayEnd < start ? start : sameDayEnd
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
let end;
|
|
387
|
+
if (new RegExp(`^${meridiemWords(options.locale ?? Locale.get()).timeOfDay}$`, "iu").test(parts[1].trim())) end = parseDateTime(`${startDay} ${parts[1].trim()}`, options);
|
|
388
|
+
else {
|
|
389
|
+
const [y, m, d] = startDay.split("-").map(Number);
|
|
390
|
+
end = parseDateTime(parts[1], {
|
|
391
|
+
...options,
|
|
392
|
+
referenceDate: new Date(y, m - 1, d),
|
|
393
|
+
defaultTime: endTime
|
|
394
|
+
});
|
|
395
|
+
if (end && end.slice(0, 10) < startDay && !/\d{4}/.test(parts[1])) end = parseDateTime(parts[1], {
|
|
396
|
+
...options,
|
|
397
|
+
referenceDate: new Date(y + 1, 0, 1),
|
|
398
|
+
defaultTime: endTime
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (!end) return null;
|
|
402
|
+
return start <= end ? {
|
|
403
|
+
start,
|
|
404
|
+
end
|
|
405
|
+
} : {
|
|
406
|
+
start: end,
|
|
407
|
+
end: start
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
/** Writes a period with times as `{start} – {end}`, each as {@link formatDateTimeText} writes it. */
|
|
411
|
+
function formatDateTimeRangeText(start, end, format = "iso", locale, seconds = false) {
|
|
412
|
+
return `${formatDateTimeText(start, format, locale, seconds)} – ${formatDateTimeText(end, format, locale, seconds)}`;
|
|
413
|
+
}
|
|
298
414
|
//#endregion
|
|
299
|
-
export { dateTextPattern, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeText, formatNumber, parseDate, parseDateRange, parseDateTime, parseNumber };
|
|
415
|
+
export { dateTextPattern, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber };
|
|
@@ -56,6 +56,11 @@ declare class IconRegistry {
|
|
|
56
56
|
private static libs;
|
|
57
57
|
/** 동일 (lib, name)의 동시 리졸브를 하나의 요청으로 합치는 in-flight 맵입니다. */
|
|
58
58
|
private static pending;
|
|
59
|
+
/**
|
|
60
|
+
* 라이브러리별 세대 — 교체·해제 때 올라간다. 그 전에 출발한 리졸브는 끝나도 캐시에 쓰지 않는다
|
|
61
|
+
* (옛 리졸버의 결과가 새 리졸버의 자리를 차지하지 않게).
|
|
62
|
+
*/
|
|
63
|
+
private static generation;
|
|
59
64
|
/** 클래스 생성 방지 */
|
|
60
65
|
private constructor();
|
|
61
66
|
/**
|
|
@@ -64,15 +69,19 @@ declare class IconRegistry {
|
|
|
64
69
|
static has(lib: string): boolean;
|
|
65
70
|
/**
|
|
66
71
|
* 지정된 아이콘 라이브러리를 등록합니다.
|
|
67
|
-
*
|
|
72
|
+
*
|
|
73
|
+
* 같은 이름이 이미 있으면 **교체**합니다 — 내장 라이브러리(`bootstrap` 등)를 로컬 리졸버로
|
|
74
|
+
* 바꾸는 것(폐쇄망)이 한 호출입니다. 교체하면 그 라이브러리의 캐시와 진행 중인 리졸브가
|
|
75
|
+
* 무효가 되어 옛 리졸버의 결과가 남지 않습니다. 같은 리졸버를 다시 넘기면 아무 일도 없습니다.
|
|
68
76
|
*/
|
|
69
77
|
static register(lib: string, resolver: IconResolver): void;
|
|
70
78
|
/**
|
|
71
79
|
* 지정된 아이콘 라이브러리를 등록 해제합니다.
|
|
72
|
-
* 해당 라이브러리의 캐시
|
|
73
|
-
* `unregister` 후 다른 리졸버를 재등록할 때 이전 결과가 남지 않도록 하기 위함입니다.
|
|
80
|
+
* 해당 라이브러리의 캐시 항목과 진행 중인 리졸브도 함께 무효가 됩니다.
|
|
74
81
|
*/
|
|
75
82
|
static unregister(lib: string): void;
|
|
83
|
+
/** 라이브러리의 캐시를 비우고 세대를 올려 진행 중인 리졸브가 결과를 쓰지 못하게 한다. */
|
|
84
|
+
private static invalidate;
|
|
76
85
|
/**
|
|
77
86
|
* 지정된 아이콘 라이브러리의 svg 아이콘 소스를 가져옵니다.
|
|
78
87
|
*
|
package/dist/utilities/icons.js
CHANGED
|
@@ -128,6 +128,9 @@ var IconRegistry = class {
|
|
|
128
128
|
static {
|
|
129
129
|
this.pending = /* @__PURE__ */ new Map();
|
|
130
130
|
}
|
|
131
|
+
static {
|
|
132
|
+
this.generation = /* @__PURE__ */ new Map();
|
|
133
|
+
}
|
|
131
134
|
/** 클래스 생성 방지 */
|
|
132
135
|
constructor() {}
|
|
133
136
|
/**
|
|
@@ -138,19 +141,31 @@ var IconRegistry = class {
|
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
140
143
|
* 지정된 아이콘 라이브러리를 등록합니다.
|
|
141
|
-
*
|
|
144
|
+
*
|
|
145
|
+
* 같은 이름이 이미 있으면 **교체**합니다 — 내장 라이브러리(`bootstrap` 등)를 로컬 리졸버로
|
|
146
|
+
* 바꾸는 것(폐쇄망)이 한 호출입니다. 교체하면 그 라이브러리의 캐시와 진행 중인 리졸브가
|
|
147
|
+
* 무효가 되어 옛 리졸버의 결과가 남지 않습니다. 같은 리졸버를 다시 넘기면 아무 일도 없습니다.
|
|
142
148
|
*/
|
|
143
149
|
static register(lib, resolver) {
|
|
144
|
-
|
|
150
|
+
const current = this.libs.get(lib);
|
|
151
|
+
if (current === resolver) return;
|
|
152
|
+
this.libs.set(lib, resolver);
|
|
153
|
+
if (current) this.invalidate(lib);
|
|
145
154
|
}
|
|
146
155
|
/**
|
|
147
156
|
* 지정된 아이콘 라이브러리를 등록 해제합니다.
|
|
148
|
-
* 해당 라이브러리의 캐시
|
|
149
|
-
* `unregister` 후 다른 리졸버를 재등록할 때 이전 결과가 남지 않도록 하기 위함입니다.
|
|
157
|
+
* 해당 라이브러리의 캐시 항목과 진행 중인 리졸브도 함께 무효가 됩니다.
|
|
150
158
|
*/
|
|
151
159
|
static unregister(lib) {
|
|
152
160
|
this.libs.delete(lib);
|
|
161
|
+
this.invalidate(lib);
|
|
162
|
+
}
|
|
163
|
+
/** 라이브러리의 캐시를 비우고 세대를 올려 진행 중인 리졸브가 결과를 쓰지 못하게 한다. */
|
|
164
|
+
static invalidate(lib) {
|
|
153
165
|
IconCache.clear(lib);
|
|
166
|
+
this.generation.set(lib, (this.generation.get(lib) ?? 0) + 1);
|
|
167
|
+
const prefix = `${lib}:`;
|
|
168
|
+
for (const key of this.pending.keys()) if (key.startsWith(prefix)) this.pending.delete(key);
|
|
154
169
|
}
|
|
155
170
|
/**
|
|
156
171
|
* 지정된 아이콘 라이브러리의 svg 아이콘 소스를 가져옵니다.
|
|
@@ -191,10 +206,11 @@ var IconRegistry = class {
|
|
|
191
206
|
const key = `${lib}:${name}`;
|
|
192
207
|
const inflight = this.pending.get(key);
|
|
193
208
|
if (inflight) return inflight;
|
|
209
|
+
const generation = this.generation.get(lib) ?? 0;
|
|
194
210
|
const task = (async () => {
|
|
195
211
|
try {
|
|
196
212
|
const svg = (await fn())?.trim();
|
|
197
|
-
IconCache.set(lib, name, svg);
|
|
213
|
+
if ((this.generation.get(lib) ?? 0) === generation) IconCache.set(lib, name, svg);
|
|
198
214
|
return svg;
|
|
199
215
|
} catch (error) {
|
|
200
216
|
console.error(`[IconRegistry] Failed to resolve icon '${key}' (will retry):`, error);
|
|
@@ -202,7 +218,9 @@ var IconRegistry = class {
|
|
|
202
218
|
}
|
|
203
219
|
})();
|
|
204
220
|
this.pending.set(key, task);
|
|
205
|
-
task.finally(() =>
|
|
221
|
+
task.finally(() => {
|
|
222
|
+
if (this.pending.get(key) === task) this.pending.delete(key);
|
|
223
|
+
});
|
|
206
224
|
return task;
|
|
207
225
|
}
|
|
208
226
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ description: Web component library built on Lit. Covers all u-* custom elements
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: iyulab
|
|
7
|
-
version: "1.4.0"
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
# @iyulab/components
|
|
@@ -57,10 +56,10 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
57
56
|
|
|
58
57
|
### Buttons & Actions
|
|
59
58
|
|
|
60
|
-
- [`u-button`](./references/components/button.md) — Versatile button with multiple
|
|
59
|
+
- [`u-button`](./references/components/button.md) — Versatile button with multiple appearances; renders as `<a>` when `href` is set
|
|
61
60
|
- [`u-icon-button`](./references/components/icon-button.md) — Square icon-only button with built-in tooltip
|
|
62
61
|
- [`u-copy-button`](./references/components/copy-button.md) — Copies text to the clipboard with a transient confirmation
|
|
63
|
-
- [`u-button-group`](./references/components/button-group.md) — Groups buttons with shared
|
|
62
|
+
- [`u-button-group`](./references/components/button-group.md) — Groups buttons with shared appearance and disabled state
|
|
64
63
|
|
|
65
64
|
### Form Controls
|
|
66
65
|
|
|
@@ -121,6 +120,7 @@ carries the control's role, not on the host element. Native nodes use native `di
|
|
|
121
120
|
- [`u-tag`](./references/components/tag.md) — Non-interactive label tag
|
|
122
121
|
- [`u-icon`](./references/components/icon.md) — SVG icon from built-in or external icon library
|
|
123
122
|
- [`u-text`](./references/components/text.md) — Semantic typography step; optional heading level
|
|
123
|
+
- [`u-steps`](./references/components/steps.md) — Display-only progress line: complete, current, on-hold and upcoming steps
|
|
124
124
|
|
|
125
125
|
---
|
|
126
126
|
|
|
@@ -13,9 +13,9 @@ Closable message banner with status icons, auto-dismiss timer, and open/hide tra
|
|
|
13
13
|
Your changes have been saved.
|
|
14
14
|
</u-alert>
|
|
15
15
|
|
|
16
|
-
<u-alert status="error"
|
|
16
|
+
<u-alert status="error" appearance="outlined" open>
|
|
17
17
|
Failed to load data.
|
|
18
|
-
<u-button slot="footer"
|
|
18
|
+
<u-button slot="footer" appearance="solid">Retry</u-button>
|
|
19
19
|
</u-alert>
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@ Closable message banner with status icons, auto-dismiss timer, and open/hide tra
|
|
|
34
34
|
|----------|------|---------|---------|-------------|
|
|
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
38
|
| `status` | `'error'\|'warning'\|'success'\|'info'\|'notice'` | — | ✓ | Status type; controls icon and color |
|
|
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 |
|
|
@@ -69,6 +69,6 @@ Closable message banner with status icons, auto-dismiss timer, and open/hide tra
|
|
|
69
69
|
|
|
70
70
|
| Property | Description |
|
|
71
71
|
|----------|-------------|
|
|
72
|
-
| `--alert-background-color` | Background color (auto-set by status) |
|
|
73
|
-
| `--alert-border-color` | Border color (auto-set by status) |
|
|
72
|
+
| `--alert-background-color` | Background color (auto-set by status; transparent for `appearance="outlined"`) |
|
|
73
|
+
| `--alert-border-color` | Border color (auto-set by status; transparent for `appearance="soft"`) |
|
|
74
74
|
| `--alert-icon-color` | Icon color (auto-set by status) |
|
|
@@ -15,7 +15,7 @@ Status badge for numbers, labels, or dot indicators. Use `anchor` to position it
|
|
|
15
15
|
<!-- Anchored on another element -->
|
|
16
16
|
<div style="position:relative; display:inline-block;">
|
|
17
17
|
<u-icon lib="tabler" name="bell"></u-icon>
|
|
18
|
-
<u-badge
|
|
18
|
+
<u-badge shape="dot" color="red" anchor="top-right"></u-badge>
|
|
19
19
|
</div>
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -40,7 +40,7 @@ Status badge for numbers, labels, or dot indicators. Use `anchor` to position it
|
|
|
40
40
|
|
|
41
41
|
| Property | Type | Default | Reflect | Description |
|
|
42
42
|
|----------|------|---------|---------|-------------|
|
|
43
|
-
| `
|
|
43
|
+
| `shape` | `'pill'\|'dot'\|'square'` | `'pill'` | ✓ | Shape; `dot` renders no content |
|
|
44
44
|
| `color` | `'neutral'\|'primary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'yellow'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'` | `'blue'` | ✓ | Badge color (role axis = semantics, decorative axis = the color itself) |
|
|
45
45
|
| `anchor` | `'top-right'\|'top-left'\|'bottom-right'\|'bottom-left'` | — | ✓ | Absolute anchor position relative to parent |
|
|
46
|
-
| `icon` | `boolean` | `false` | ✓ | Adds a status icon so the meaning survives without color (`info`/`success`/`warning`/`danger`; not drawn for `
|
|
46
|
+
| `icon` | `boolean` | `false` | ✓ | Adds a status icon so the meaning survives without color (`info`/`success`/`warning`/`danger`; not drawn for `shape="dot"`) |
|
|
@@ -6,10 +6,10 @@ import '@iyulab/components/dist/components/button-group/UButtonGroup.js';
|
|
|
6
6
|
|
|
7
7
|
**Tag:** `u-button-group`
|
|
8
8
|
|
|
9
|
-
Groups `u-button` or `u-icon-button` elements. Propagates `
|
|
9
|
+
Groups `u-button` or `u-icon-button` elements. Propagates `appearance` and `disabled` to all child buttons automatically.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
|
-
<u-button-group
|
|
12
|
+
<u-button-group appearance="outlined">
|
|
13
13
|
<u-button>Left</u-button>
|
|
14
14
|
<u-button>Center</u-button>
|
|
15
15
|
<u-button>Right</u-button>
|
|
@@ -33,6 +33,6 @@ Groups `u-button` or `u-icon-button` elements. Propagates `variant` and `disable
|
|
|
33
33
|
|
|
34
34
|
| Property | Type | Default | Reflect | Description |
|
|
35
35
|
|----------|------|---------|---------|-------------|
|
|
36
|
-
| `
|
|
36
|
+
| `appearance` | `'solid'\|'soft'\|'outlined'\|'plain'\|'link'` | `'solid'` | ✓ | Appearance propagated to all child buttons |
|
|
37
37
|
| `vertical` | `boolean` | `false` | ✓ | Stack buttons vertically |
|
|
38
38
|
| `disabled` | `boolean` | `false` | ✓ | Disable all child buttons |
|
|
@@ -6,24 +6,25 @@ import '@iyulab/components/dist/components/button/UButton.js';
|
|
|
6
6
|
|
|
7
7
|
**Tag:** `u-button`
|
|
8
8
|
|
|
9
|
-
Versatile button with multiple
|
|
9
|
+
Versatile button with multiple appearances. Renders as an `<a>` element when `href` is provided.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<u-button>Default</u-button>
|
|
13
|
-
<u-button
|
|
14
|
-
<u-button
|
|
13
|
+
<u-button appearance="outlined">Outlined</u-button>
|
|
14
|
+
<u-button appearance="plain" loading>Loading</u-button>
|
|
15
15
|
<u-button href="https://example.com" target="_blank">Link</u-button>
|
|
16
16
|
|
|
17
|
-
<!-- Semantic color (independent of
|
|
18
|
-
<u-button
|
|
19
|
-
<u-button
|
|
17
|
+
<!-- Semantic color (independent of appearance) -->
|
|
18
|
+
<u-button appearance="solid" color="red">Delete</u-button>
|
|
19
|
+
<u-button appearance="soft" color="green">Approve</u-button>
|
|
20
|
+
<u-button color="neutral">Cancel</u-button>
|
|
20
21
|
|
|
21
22
|
<!-- Size -->
|
|
22
23
|
<u-button size="sm">Small</u-button>
|
|
23
24
|
<u-button size="lg">Large</u-button>
|
|
24
25
|
|
|
25
26
|
<!-- With prefix/suffix icons -->
|
|
26
|
-
<u-button
|
|
27
|
+
<u-button appearance="solid">
|
|
27
28
|
<u-icon slot="prefix" lib="tabler" name="download"></u-icon>
|
|
28
29
|
Download
|
|
29
30
|
</u-button>
|
|
@@ -44,8 +45,8 @@ Versatile button with multiple visual variants. Renders as an `<a>` element when
|
|
|
44
45
|
|
|
45
46
|
| Property | Type | Default | Reflect | Description |
|
|
46
47
|
|----------|------|---------|---------|-------------|
|
|
47
|
-
| `
|
|
48
|
-
| `color` | `'neutral'\|'primary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'` |
|
|
48
|
+
| `appearance` | `'solid'\|'soft'\|'outlined'\|'plain'\|'link'` | `'solid'` | ✓ | How much chrome: `solid` filled with the colour · `soft` tint, no outline · `outlined` · `plain` no chrome · `link` |
|
|
49
|
+
| `color` | `'neutral'\|'primary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'` | — | ✓ | Color, independent of `appearance`. Unset paints like `primary` (the brand colour) without adding the attribute; `neutral` is an achromatic (grey) button (see notes below). |
|
|
49
50
|
| `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Button size (12px/14px/16px font-size; padding, spinner, and icon slots scale proportionally). |
|
|
50
51
|
| `rounded` | `boolean` | `false` | ✓ | Pill-shaped border radius |
|
|
51
52
|
| `disabled` | `boolean` | `false` | ✓ | Disable the button |
|
|
@@ -60,9 +61,23 @@ Versatile button with multiple visual variants. Renders as an `<a>` element when
|
|
|
60
61
|
|
|
61
62
|
### `color` notes
|
|
62
63
|
|
|
63
|
-
- `solid`/`
|
|
64
|
-
- `link`:
|
|
65
|
-
- `
|
|
64
|
+
- `solid`/`soft`/`outlined`: background/border switch to the chosen color's scale. `neutral` is an achromatic (grey) button — the brand colour is `primary`, which is also how a button with no `color` is painted.
|
|
65
|
+
- `plain`/`link`: these have no fill, so with no `color` or `neutral` they keep body text (`plain`) or link text (`link`); any other `color` switches the text color (e.g. `appearance="link" color="danger"` for a destructive link). A `plain` button with an explicit `color="primary"` draws brand-coloured text; a `link` stays link-coloured.
|
|
66
|
+
- `color` has no default value, so a bare button carries no `color` attribute — `u-button[color="primary"]` matches only buttons that set it.
|
|
67
|
+
|
|
68
|
+
## Accessibility
|
|
69
|
+
|
|
70
|
+
Set ARIA on the `u-button` host as you would on a native button — the component moves it to the
|
|
71
|
+
inner `<button>`/`<a>` that actually takes focus: `aria-label`, and the button states
|
|
72
|
+
`aria-pressed` (toggle), `aria-expanded` + `aria-controls` (disclosure) and `aria-haspopup`
|
|
73
|
+
(menu button). `aria-pressed` is dropped on a link (`href`), where it is not allowed.
|
|
74
|
+
`aria-controls` is an id reference, which cannot cross the shadow boundary, so it is carried as an
|
|
75
|
+
element reference (`ariaControlsElements`) resolved when the button renders.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<u-button aria-expanded="false" aria-controls="details">Details</u-button>
|
|
79
|
+
<u-button aria-pressed="true">Bold</u-button>
|
|
80
|
+
```
|
|
66
81
|
|
|
67
82
|
## CSS Parts
|
|
68
83
|
|
|
@@ -77,15 +92,15 @@ Versatile button with multiple visual variants. Renders as an `<a>` element when
|
|
|
77
92
|
|
|
78
93
|
| Property | Description |
|
|
79
94
|
|----------|-------------|
|
|
80
|
-
| `--u-primary-color` | Base color
|
|
95
|
+
| `--u-primary-color` | Base color for `color="primary"` and for a button with no `color` — set it and hover/active/soft tones auto-derive via `color-mix()` |
|
|
81
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 |
|
|
82
|
-
| `--btn-txt-color` | Text color on the fill, read by `
|
|
83
|
-
| `--btn-color-strong` | Text color on the surrounding page background, read by `
|
|
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
|
+
| `--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`) |
|
|
84
99
|
| `--btn-color-hover` / `--btn-color-active` | `solid` background hover/active (default: `--btn-color` at 85%/70% + black) |
|
|
85
|
-
| `--btn-color-surface` / `-hover` / `-active` | `
|
|
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 |
|
|
86
101
|
| `--btn-color-border` / `-hover` / `-active` | Border states (default: `--btn-color` at 45%/60%/75%) |
|
|
87
|
-
| `--btn-color-outline-hover` / `-active` | `outlined`/`
|
|
102
|
+
| `--btn-color-outline-hover` / `-active` | `outlined`/`plain` background hover/active (default: 6%/12%) |
|
|
88
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% + black) |
|
|
89
|
-
| `--btn-border-color` | Border color read by
|
|
104
|
+
| `--btn-border-color` | Border color read by appearance/hover/active rules (default: `transparent`) |
|
|
90
105
|
| `--btn-padding-block` | Vertical inner padding (default `0.5em`) |
|
|
91
|
-
| `--btn-padding-inline` | Horizontal inner padding (default `1em`, `0` for `
|
|
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 |
|
|
@@ -13,7 +13,7 @@ Content card with optional media, header, body, and footer sections.
|
|
|
13
13
|
<img slot="media" src="/cover.jpg" alt="Cover" />
|
|
14
14
|
<span slot="header">Title</span>
|
|
15
15
|
<p>Card body content.</p>
|
|
16
|
-
<u-button slot="footer"
|
|
16
|
+
<u-button slot="footer" appearance="plain">Read more</u-button>
|
|
17
17
|
</u-card>
|
|
18
18
|
|
|
19
19
|
<u-card orientation="horizontal" hoverable>
|
|
@@ -39,7 +39,7 @@ Content card with optional media, header, body, and footer sections.
|
|
|
39
39
|
|----------|------|---------|---------|-------------|
|
|
40
40
|
| `orientation` | `'vertical'\|'horizontal'` | `'vertical'` | ✓ | Layout direction |
|
|
41
41
|
| `shadowless` | `boolean` | `false` | ✓ | Remove drop shadow |
|
|
42
|
-
| `
|
|
42
|
+
| `appearance` | `'outlined'\|'plain'` | `'outlined'` | ✓ | `outlined` border and drop shadow · `plain` no border and no shadow (layout only) |
|
|
43
43
|
| `hoverable` | `boolean` | `false` | ✓ | Lift effect on hover |
|
|
44
44
|
|
|
45
45
|
## CSS Parts
|
|
@@ -57,5 +57,5 @@ Content card with optional media, header, body, and footer sections.
|
|
|
57
57
|
|
|
58
58
|
| Property | Description |
|
|
59
59
|
|----------|-------------|
|
|
60
|
-
| `--card-border-width` | Border thickness (`0`
|
|
60
|
+
| `--card-border-width` | Border thickness (`0` for `appearance="plain"`) |
|
|
61
61
|
| `--card-border-color` | Border color |
|
|
@@ -24,7 +24,9 @@ Slide carousel. Each direct child element becomes one slide.
|
|
|
24
24
|
With `autoplay`, the carousel renders a stop/start button as the first control of its indicator
|
|
25
25
|
row (WCAG 2.2.2). Rotation pauses while the mouse is over the carousel and stops when keyboard focus
|
|
26
26
|
moves into it, until the user presses start (WAI-ARIA APG carousel pattern). Slides are
|
|
27
|
-
`aria-live="off"` while rotating and `polite` when stopped.
|
|
27
|
+
`aria-live="off"` while rotating and `polite` when stopped. For a user who has asked for reduced
|
|
28
|
+
motion (`prefers-reduced-motion: reduce`) the carousel starts stopped — the start button turns
|
|
29
|
+
rotation on — and it stops if that setting is turned on while the page is open.
|
|
28
30
|
|
|
29
31
|
---
|
|
30
32
|
|
|
@@ -11,7 +11,7 @@ Checkbox with `indeterminate` state support. Form-associated (`formAssociated =
|
|
|
11
11
|
```html
|
|
12
12
|
<u-checkbox name="agree" required>I agree to the terms</u-checkbox>
|
|
13
13
|
|
|
14
|
-
<u-checkbox checked color="green"
|
|
14
|
+
<u-checkbox checked color="green" appearance="outlined">
|
|
15
15
|
Enabled feature
|
|
16
16
|
</u-checkbox>
|
|
17
17
|
|
|
@@ -33,8 +33,8 @@ Checkbox with `indeterminate` state support. Form-associated (`formAssociated =
|
|
|
33
33
|
|----------|------|---------|---------|-------------|
|
|
34
34
|
| `checked` | `boolean` | `false` | ✓ | Checked state |
|
|
35
35
|
| `indeterminate` | `boolean` | `false` | ✓ | Partial / indeterminate state |
|
|
36
|
-
| `
|
|
37
|
-
| `color` | `'primary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'\|'neutral'` | `'
|
|
36
|
+
| `appearance` | `'solid'\|'outlined'` | `'solid'` | ✓ | `solid` fills the checked box with the colour · `outlined` colours the border and checkmark |
|
|
37
|
+
| `color` | `'primary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'\|'neutral'` | `'primary'` | ✓ | Accent color — role axis (`primary`…`danger`, follows rebranding) and decorative axis (`blue`…, the palette colour itself, immune to it). `neutral` is grey |
|
|
38
38
|
| `disabled` | `boolean` | `false` | ✓ | Disable the control |
|
|
39
39
|
| `readonly` | `boolean` | `false` | ✓ | Read-only |
|
|
40
40
|
| `required` | `boolean` | `false` | ✓ | Required field |
|
|
@@ -67,6 +67,6 @@ Checkbox with `indeterminate` state support. Form-associated (`formAssociated =
|
|
|
67
67
|
|
|
68
68
|
| Property | Description |
|
|
69
69
|
|----------|-------------|
|
|
70
|
-
| `--checkbox-color` | Checkmark color |
|
|
70
|
+
| `--checkbox-color` | Checkmark color (`outlined`) |
|
|
71
71
|
| `--checkbox-border-color` | Border color |
|
|
72
|
-
| `--checkbox-background-color` | Fill color when checked |
|
|
72
|
+
| `--checkbox-background-color` | Fill color when checked (`solid`) |
|