@iyulab/components 3.0.0 → 3.2.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 +144 -0
- package/README.md +12 -0
- package/dist/components/UElement.d.ts +11 -0
- package/dist/components/UElement.js +14 -0
- package/dist/components/UElement.styles.js +9 -0
- package/dist/components/UFloatingElement.d.ts +4 -0
- package/dist/components/UFloatingElement.js +7 -0
- package/dist/components/UFormControlElement.d.ts +20 -3
- package/dist/components/UFormControlElement.js +46 -4
- package/dist/components/UOverlayElement.d.ts +4 -0
- package/dist/components/UOverlayElement.js +7 -0
- package/dist/components/alert/UAlert.d.ts +4 -0
- package/dist/components/alert/UAlert.js +7 -0
- package/dist/components/auto-scroll/UAutoScroll.d.ts +6 -2
- package/dist/components/auto-scroll/UAutoScroll.js +7 -0
- package/dist/components/avatar/UAvatar.d.ts +4 -0
- package/dist/components/avatar/UAvatar.js +11 -0
- package/dist/components/badge/UBadge.d.ts +6 -0
- package/dist/components/badge/UBadge.js +36 -1
- package/dist/components/badge/UBadge.styles.js +8 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +2 -2
- package/dist/components/button/UButton.d.ts +7 -0
- package/dist/components/button/UButton.js +41 -1
- package/dist/components/button/UButton.styles.js +8 -0
- package/dist/components/button-group/UButtonGroup.d.ts +4 -0
- package/dist/components/button-group/UButtonGroup.js +13 -0
- package/dist/components/calendar/UCalendar.d.ts +8 -0
- package/dist/components/calendar/UCalendar.js +30 -14
- package/dist/components/calendar/UCalendar.styles.js +3 -0
- package/dist/components/calendar/dates.d.ts +12 -0
- package/dist/components/calendar/dates.js +25 -1
- package/dist/components/card/UCard.d.ts +6 -0
- package/dist/components/card/UCard.js +15 -0
- package/dist/components/carousel/UCarousel.d.ts +4 -0
- package/dist/components/carousel/UCarousel.js +7 -0
- package/dist/components/checkbox/UCheckbox.d.ts +6 -0
- package/dist/components/checkbox/UCheckbox.js +25 -1
- package/dist/components/chip/UChip.d.ts +5 -0
- package/dist/components/chip/UChip.js +30 -0
- package/dist/components/command-palette/UCommandPalette.js +3 -0
- package/dist/components/copy-button/UCopyButton.d.ts +4 -0
- package/dist/components/copy-button/UCopyButton.js +13 -0
- package/dist/components/date-picker/UDatePicker.d.ts +11 -5
- package/dist/components/date-picker/UDatePicker.js +13 -0
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +9 -2
- package/dist/components/date-range-picker/UDateRangePicker.js +13 -0
- package/dist/components/date-range-picker/presets.d.ts +2 -1
- package/dist/components/date-range-picker/presets.js +5 -5
- package/dist/components/dialog/UDialog.d.ts +5 -0
- package/dist/components/dialog/UDialog.js +17 -0
- package/dist/components/divider/UDivider.d.ts +5 -0
- package/dist/components/divider/UDivider.js +17 -1
- package/dist/components/divider/UDivider.styles.js +5 -0
- package/dist/components/drawer/UDrawer.d.ts +5 -0
- package/dist/components/drawer/UDrawer.js +12 -0
- package/dist/components/field/UField.d.ts +4 -0
- package/dist/components/field/UField.js +7 -0
- package/dist/components/icon-button/UIconButton.d.ts +4 -0
- package/dist/components/icon-button/UIconButton.js +13 -0
- package/dist/components/input/UInput.d.ts +7 -0
- package/dist/components/input/UInput.js +31 -0
- package/dist/components/input/UInput.styles.js +9 -0
- package/dist/components/menu/UMenu.d.ts +7 -0
- package/dist/components/menu/UMenu.js +18 -0
- package/dist/components/menu-item/UMenuItem.d.ts +5 -0
- package/dist/components/menu-item/UMenuItem.js +13 -1
- package/dist/components/option/UOption.d.ts +4 -0
- package/dist/components/option/UOption.js +8 -1
- package/dist/components/pagination/UPagination.d.ts +4 -0
- package/dist/components/pagination/UPagination.js +11 -0
- package/dist/components/popover/UPopover.d.ts +5 -0
- package/dist/components/popover/UPopover.js +13 -0
- package/dist/components/progress-bar/UProgressBar.d.ts +4 -0
- package/dist/components/progress-bar/UProgressBar.js +14 -1
- package/dist/components/progress-bar/UProgressBar.styles.js +5 -0
- package/dist/components/progress-ring/UProgressRing.d.ts +4 -0
- package/dist/components/progress-ring/UProgressRing.js +13 -0
- package/dist/components/radio/URadio.d.ts +7 -0
- package/dist/components/radio/URadio.js +15 -2
- package/dist/components/rating/URating.d.ts +5 -1
- package/dist/components/rating/URating.js +6 -2
- package/dist/components/select/USelect.d.ts +7 -0
- package/dist/components/select/USelect.js +19 -1
- package/dist/components/skeleton/USkeleton.d.ts +5 -0
- package/dist/components/skeleton/USkeleton.js +16 -0
- package/dist/components/spinner/USpinner.d.ts +4 -0
- package/dist/components/spinner/USpinner.js +24 -0
- package/dist/components/split-panel/USplitPanel.d.ts +4 -0
- package/dist/components/split-panel/USplitPanel.js +7 -0
- package/dist/components/steps/USteps.d.ts +4 -0
- package/dist/components/steps/USteps.js +12 -1
- package/dist/components/switch/USwitch.js +1 -1
- package/dist/components/tab/UTab.d.ts +4 -0
- package/dist/components/tab/UTab.js +12 -1
- package/dist/components/tab/UTab.styles.js +7 -0
- package/dist/components/tab-nav/UTabNav.d.ts +6 -2
- package/dist/components/tab-nav/UTabNav.js +7 -0
- package/dist/components/tab-panel/UTabPanel.d.ts +5 -0
- package/dist/components/tab-panel/UTabPanel.js +18 -0
- package/dist/components/tag/UTag.d.ts +6 -0
- package/dist/components/tag/UTag.js +32 -1
- package/dist/components/text/UText.d.ts +5 -0
- package/dist/components/text/UText.js +21 -0
- package/dist/components/textarea/UTextarea.d.ts +7 -0
- package/dist/components/textarea/UTextarea.js +24 -0
- package/dist/components/tree/UTree.d.ts +4 -0
- package/dist/components/tree/UTree.js +7 -0
- package/dist/components/tree-item/UTreeItem.d.ts +4 -0
- package/dist/components/tree-item/UTreeItem.js +8 -1
- package/dist/custom-elements.json +46557 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/plugins/cem-check.d.ts +29 -0
- package/dist/plugins/cem-check.js +90 -0
- package/dist/plugins/cem-config.d.ts +17 -0
- package/dist/plugins/cem-config.js +22 -0
- package/dist/plugins/cem-enumerated-plugin.d.ts +20 -0
- package/dist/plugins/cem-enumerated-plugin.js +105 -0
- package/dist/plugins/cem-events-plugin.d.ts +18 -0
- package/dist/plugins/cem-events-plugin.js +96 -0
- package/dist/utilities/collation.d.ts +11 -0
- package/dist/utilities/collation.js +52 -0
- package/dist/utilities/enumerated.d.ts +20 -0
- package/dist/utilities/enumerated.js +24 -0
- package/dist/utilities/format.js +49 -15
- package/package.json +18 -15
- package/skills/iyulab-components/SKILL.md +8 -2
- package/skills/iyulab-components/references/components/checkbox.md +1 -1
- package/skills/iyulab-components/references/components/date-picker.md +2 -2
- package/skills/iyulab-components/references/components/date-range-picker.md +4 -4
- package/skills/iyulab-components/references/components/field.md +5 -0
- package/skills/iyulab-components/references/components/file-input.md +1 -1
- package/skills/iyulab-components/references/components/input.md +1 -1
- package/skills/iyulab-components/references/components/select.md +1 -1
- package/skills/iyulab-components/references/components/textarea.md +1 -1
- package/skills/iyulab-components/references/utilities/locale.md +14 -0
package/dist/utilities/format.js
CHANGED
|
@@ -77,6 +77,37 @@ function decimalSeparatorOf(locale) {
|
|
|
77
77
|
}
|
|
78
78
|
/** Space-like characters and apostrophes that locales use to group digits (fr/ru NBSP, de-CH ’). */
|
|
79
79
|
var GROUP_MARKS = /[\s\u00A0\u202F\u2009'\u2019]/;
|
|
80
|
+
/** The direction marks a formatted number can carry (`formatNumber` in Arabic and Hebrew puts one before the minus sign). */
|
|
81
|
+
var DIRECTION_MARKS = /[--]/g;
|
|
82
|
+
var DECIMAL_DIGIT = /^\p{Nd}$/u;
|
|
83
|
+
/**
|
|
84
|
+
* The value `0`–`9` of a decimal digit written in any script. Unicode lays every script's ten digits out in one run, zero
|
|
85
|
+
* first, and runs that touch are still whole multiples of ten, so the distance from the start of the run decides it — no
|
|
86
|
+
* table of scripts to keep.
|
|
87
|
+
*/
|
|
88
|
+
function digitValue(digit) {
|
|
89
|
+
const code = digit.codePointAt(0);
|
|
90
|
+
if (code < 128) return digit;
|
|
91
|
+
let start = code;
|
|
92
|
+
while (start > 0 && DECIMAL_DIGIT.test(String.fromCodePoint(start - 1))) start--;
|
|
93
|
+
return String((code - start) % 10);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Text as a person types or pastes it, brought to the ASCII digits the readers below know: the digits of any script
|
|
97
|
+
* (Arabic-Indic `٠`–`٩`, Persian `۰`–`۹`, Bengali, Devanagari, full-width `0`–`9` from an IME …) become `0`–`9`, and the
|
|
98
|
+
* direction marks a formatted Arabic or Hebrew text carries are dropped. Text without any of these comes back unchanged.
|
|
99
|
+
*/
|
|
100
|
+
function asciiDigits(text) {
|
|
101
|
+
return text.replace(DIRECTION_MARKS, "").replace(/\p{Nd}/gu, digitValue);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* {@link asciiDigits}, and the separators of an Arabic keyboard brought to the ones the number reader below knows: the Arabic
|
|
105
|
+
* decimal separator `٫` becomes `.` and the Arabic thousands separator `٬` the apostrophe group mark (kept as a mark, so a
|
|
106
|
+
* leading one is still an error).
|
|
107
|
+
*/
|
|
108
|
+
function readableDigits(text) {
|
|
109
|
+
return asciiDigits(text).replace(/٫/g, ".").replace(/٬/g, "'");
|
|
110
|
+
}
|
|
80
111
|
/**
|
|
81
112
|
* Reads a number the way a person types it, in any locale — the inverse of {@link formatNumber}.
|
|
82
113
|
* Returns `null` for text that is not a number; never a partial number (`"1,5x"` is `null`, not 1.5).
|
|
@@ -99,7 +130,7 @@ var GROUP_MARKS = /[\s\u00A0\u202F\u2009'\u2019]/;
|
|
|
99
130
|
* `locale` defaults to the active `Locale`.
|
|
100
131
|
*/
|
|
101
132
|
function parseNumber(text, locale) {
|
|
102
|
-
const signed = text.trim().match(/^([+\-\u2212]?)(.*)$/s);
|
|
133
|
+
const signed = readableDigits(text).trim().match(/^([+\-\u2212]?)(.*)$/s);
|
|
103
134
|
const negative = signed[1] === "-" || signed[1] === "−";
|
|
104
135
|
const scientific = signed[2].match(/^(.*?)[eE]([+-]?)(\d+)$/s);
|
|
105
136
|
const body = scientific ? scientific[1] : signed[2];
|
|
@@ -130,13 +161,20 @@ function parseNumber(text, locale) {
|
|
|
130
161
|
const value = Number(`${negative ? "-" : ""}${digits || "0"}.${fracPart || "0"}e${exponent}`);
|
|
131
162
|
return Number.isFinite(value) ? value : null;
|
|
132
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* A date in a text field is always Gregorian, whatever calendar the locale prefers (`fa` writes the Persian year 1405, `th` the
|
|
166
|
+
* Buddhist 2569): the value is a Gregorian ISO date and the calendar next to the field is Gregorian, so a text in another
|
|
167
|
+
* calendar would read back as a different day.
|
|
168
|
+
*/
|
|
169
|
+
var TEXT_DATE_OPTIONS = {
|
|
170
|
+
calendar: "gregory",
|
|
171
|
+
year: "numeric",
|
|
172
|
+
month: "2-digit",
|
|
173
|
+
day: "2-digit"
|
|
174
|
+
};
|
|
133
175
|
/** The year/month/day order and separator the locale's numeric date uses (`en-US` → month/day/year · `/`). */
|
|
134
176
|
function numericDateLayout(locale) {
|
|
135
|
-
const parts = new Intl.DateTimeFormat(locale,
|
|
136
|
-
year: "numeric",
|
|
137
|
-
month: "2-digit",
|
|
138
|
-
day: "2-digit"
|
|
139
|
-
}).formatToParts(new Date(2026, 9, 2));
|
|
177
|
+
const parts = new Intl.DateTimeFormat(locale, TEXT_DATE_OPTIONS).formatToParts(new Date(2026, 9, 2));
|
|
140
178
|
return {
|
|
141
179
|
order: parts.filter((p) => p.type === "year" || p.type === "month" || p.type === "day").map((p) => p.type),
|
|
142
180
|
separator: parts.find((p) => p.type === "literal")?.value ?? "-"
|
|
@@ -150,11 +188,7 @@ function numericDateLayout(locale) {
|
|
|
150
188
|
function formatDateText(iso, format = "iso", locale) {
|
|
151
189
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
152
190
|
if (!m || format === "iso") return iso;
|
|
153
|
-
return new Intl.DateTimeFormat(locale ?? Locale.get(),
|
|
154
|
-
year: "numeric",
|
|
155
|
-
month: "2-digit",
|
|
156
|
-
day: "2-digit"
|
|
157
|
-
}).format(new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])));
|
|
191
|
+
return new Intl.DateTimeFormat(locale ?? Locale.get(), TEXT_DATE_OPTIONS).format(new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])));
|
|
158
192
|
}
|
|
159
193
|
/** The pattern a person should type for `format` — `YYYY-MM-DD`, or e.g. `MM/DD/YYYY` for `locale` in `en-US`. */
|
|
160
194
|
function dateTextPattern(format = "iso", locale) {
|
|
@@ -179,7 +213,7 @@ function dateTextPattern(format = "iso", locale) {
|
|
|
179
213
|
* (today by default). Two-digit years are not read.
|
|
180
214
|
*/
|
|
181
215
|
function parseDate(text, options = {}) {
|
|
182
|
-
const t = text.trim().replace(/\.$/, "");
|
|
216
|
+
const t = asciiDigits(text).trim().replace(/\.$/, "");
|
|
183
217
|
if (!t) return null;
|
|
184
218
|
let y, mo, d;
|
|
185
219
|
const compact = /^(\d{4})(\d{2})(\d{2})$/.exec(t);
|
|
@@ -226,7 +260,7 @@ function parseDate(text, options = {}) {
|
|
|
226
260
|
* takes `defaultTime` (`00:00` unless given). An hour above 23, or a minute or second above 59, is `null`.
|
|
227
261
|
*/
|
|
228
262
|
function parseDateTime(text, options = {}) {
|
|
229
|
-
const t = text.trim();
|
|
263
|
+
const t = asciiDigits(text).trim();
|
|
230
264
|
const words = meridiemWords(options.locale ?? Locale.get());
|
|
231
265
|
const joined = words.unspaced ? `|(?=${words.unspaced})` : "";
|
|
232
266
|
const m = new RegExp(`^(.*?)(?:(?:[T\\s]+${joined})(${words.timeOfDay}))?$`, "iu").exec(t);
|
|
@@ -304,7 +338,7 @@ var RANGE_SEPARATOR = /\s*[~–—]\s*|\s+-\s+/;
|
|
|
304
338
|
* fall before the first day (`2025-12-20 ~ 01-05`).
|
|
305
339
|
*/
|
|
306
340
|
function parseDateRange(text, options = {}) {
|
|
307
|
-
const t = text.trim();
|
|
341
|
+
const t = asciiDigits(text).trim();
|
|
308
342
|
if (!t) return null;
|
|
309
343
|
let parts = t.split(RANGE_SEPARATOR);
|
|
310
344
|
if (parts.length === 1) {
|
|
@@ -354,7 +388,7 @@ function formatDateRangeText(start, end, format = "iso", locale) {
|
|
|
354
388
|
* `YYYY-MM-DDTHH:mm:ss` (see {@link parseDateTime}).
|
|
355
389
|
*/
|
|
356
390
|
function parseDateTimeRange(text, options = {}) {
|
|
357
|
-
const t = text.trim();
|
|
391
|
+
const t = asciiDigits(text).trim();
|
|
358
392
|
if (!t) return null;
|
|
359
393
|
const startTime = options.startTime ?? "00:00";
|
|
360
394
|
const endTime = options.endTime ?? "23:59";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/components",
|
|
3
3
|
"description": "Lit-based UI elements for business web apps: buttons, inputs, selects, date pickers, dialogs, design tokens, theming and a locale registry",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"components",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"type": "module",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
|
+
"customElements": "./dist/custom-elements.json",
|
|
28
29
|
"engines": {
|
|
29
30
|
"node": ">=20"
|
|
30
31
|
},
|
|
@@ -54,9 +55,10 @@
|
|
|
54
55
|
"test:webkit": "vitest run --project=webkit",
|
|
55
56
|
"lint": "eslint src/",
|
|
56
57
|
"lint:fix": "eslint src/ --fix",
|
|
57
|
-
"build": "npm run typecheck && eslint && npm run typecheck:plugins && vite build && npm run build:plugins && npm run test:react-types",
|
|
58
|
+
"build": "npm run typecheck && eslint && npm run typecheck:plugins && vite build && npm run analyze && npm run build:plugins && npm run test:react-types",
|
|
58
59
|
"test:react-types": "tsc -p tsconfig.react-smoke.json",
|
|
59
60
|
"typecheck:plugins": "tsc -p plugins/tsconfig.json",
|
|
61
|
+
"analyze": "cem analyze",
|
|
60
62
|
"docs:cssprops": "node scripts/cssprops-doc.mjs --write",
|
|
61
63
|
"docs:react-events": "node scripts/react-events-doc.mjs --write",
|
|
62
64
|
"docs:tokens": "node scripts/design-tokens-doc.mjs --write",
|
|
@@ -66,9 +68,9 @@
|
|
|
66
68
|
},
|
|
67
69
|
"dependencies": {
|
|
68
70
|
"@floating-ui/dom": "^1.8.0",
|
|
69
|
-
"focus-trap": "^8.2.
|
|
71
|
+
"focus-trap": "^8.2.5",
|
|
70
72
|
"lit": "^3.3.3",
|
|
71
|
-
"tabbable": "^6.5.
|
|
73
|
+
"tabbable": "^6.5.2"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|
|
74
76
|
"@lit/react": "^1.0.8",
|
|
@@ -87,21 +89,22 @@
|
|
|
87
89
|
}
|
|
88
90
|
},
|
|
89
91
|
"devDependencies": {
|
|
92
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
90
93
|
"@eslint/js": "^10.0.1",
|
|
91
|
-
"@types/node": "^26.
|
|
94
|
+
"@types/node": "^26.6.6",
|
|
92
95
|
"@types/react": "^19.3.0",
|
|
93
|
-
"@vitest/browser-playwright": "^5.
|
|
94
|
-
"eslint": "^10.
|
|
96
|
+
"@vitest/browser-playwright": "^5.1.0",
|
|
97
|
+
"eslint": "^10.15.0",
|
|
95
98
|
"eslint-plugin-lit": "^2.3.1",
|
|
96
|
-
"glob": "^14.0.
|
|
97
|
-
"globals": "^17.
|
|
98
|
-
"happy-dom": "^21.0.
|
|
99
|
-
"react": "^19.
|
|
99
|
+
"glob": "^14.0.6",
|
|
100
|
+
"globals": "^17.14.0",
|
|
101
|
+
"happy-dom": "^21.0.4",
|
|
102
|
+
"react": "^19.3.1",
|
|
100
103
|
"typescript": "^6.0.2",
|
|
101
|
-
"typescript-eslint": "^8.
|
|
102
|
-
"vite": "^8.
|
|
103
|
-
"vite-plugin-dts": "^5.
|
|
104
|
+
"typescript-eslint": "^8.72.2",
|
|
105
|
+
"vite": "^8.3.8",
|
|
106
|
+
"vite-plugin-dts": "^5.1.2",
|
|
104
107
|
"vite-plugin-static-copy": "^4.1.1",
|
|
105
|
-
"vitest": "^5.
|
|
108
|
+
"vitest": "^5.1.0"
|
|
106
109
|
}
|
|
107
110
|
}
|
|
@@ -43,7 +43,9 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
43
43
|
|
|
44
44
|
> For detailed guidance on theming, icon setup, and advanced usage, see [./references/usage.md](./references/usage.md).
|
|
45
45
|
|
|
46
|
-
> **
|
|
46
|
+
> **Browser support:** the floor is the browsers that support `:state()` without the `--` prefix — Chrome/Edge 125, Firefox 126, Safari 17.4. Form controls expose states through `ElementInternals.states`, which throws on older engines (for example Chromium 120), so there is nothing to polyfill.
|
|
47
|
+
|
|
48
|
+
> **Direction:** layout follows the document direction — under `dir="rtl"` the prefix/suffix slots, inner padding and borders mirror (logical CSS properties). Placement values that name a physical side (`u-drawer placement="left"`, `u-tab-panel placement`) stay physical. The chevrons a component draws itself mirror too (breadcrumb separator, previous/next in pagination and calendar, the closed marker of expander and tree item, the submenu marker) — a chevron you pass through a `separator` or `expand-icon` slot stays as you drew it. Script-positioned parts follow the pointer and the arrow keys in a right-to-left page (`u-split-panel`, `u-slider`, `u-rating`, `u-carousel`). The badge corner placements stay physical on purpose; the virtualized grid and spreadsheet are mirrored in `@iyulab/flex-table` and `@iyulab/data-components`, and the timeline keeps time left to right. Values the app puts in (a name, a part number, a signed number) read in their own direction instead of the page's — `u-tag`, `u-chip`, `u-option`, `u-breadcrumb-item`, `u-button`, `u-menu-item`, `u-tree-item`, `u-checkbox`, `u-radio`, `u-switch`, `u-tab`, `u-badge`, the `u-divider` text, the `u-progress-bar` content, the `u-steps` titles and the closed `u-select` trigger isolate their one-line label with a shadow-tree `bdi` (`Blue Harbor Co.` stays `Blue Harbor Co.` in an RTL page; alignment is unchanged). Sentences (toast and alert bodies, descriptions) follow the page; wrap a value you interpolate into a sentence in `<bdi>` yourself.
|
|
47
49
|
|
|
48
50
|
---
|
|
49
51
|
|
|
@@ -148,7 +150,7 @@ set on the host yourself always wins and is never overwritten.
|
|
|
148
150
|
- [`IconRegistry`](./references/utilities/icons.md) — Register and resolve icon libraries
|
|
149
151
|
- [`BrowserStorage`](./references/utilities/browser-storage.md) — Unified localStorage / Cookie API
|
|
150
152
|
- [`converters`](./references/utilities/converters.md) — Lit property attribute converters (array, JSON, date, url…)
|
|
151
|
-
- [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility · search matching (`matchesSearch` — Hangul jamo and initials)
|
|
153
|
+
- [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility · search matching (`matchesSearch` — Hangul jamo and initials) · text order (`compareText` — digit runs as numbers, the app locale)
|
|
152
154
|
- [`elements`](./references/utilities/elements.md) — Shadow-DOM-aware DOM query helpers
|
|
153
155
|
- [`format`](./references/utilities/format.md) — Locale-aware number, currency and date formatting
|
|
154
156
|
- [`number-format`](./references/utilities/number-format.md) — One number format for tables, sheets and widgets: spreadsheet codes or `Intl` options
|
|
@@ -170,3 +172,7 @@ set on the host yourself always wins and is never overwritten.
|
|
|
170
172
|
- [`UFormControlElement<T>`](./references/extensions/form-control.md) — Base for form-associated controls; handles `disabled`, `readonly`, `invalid`, validation lifecycle
|
|
171
173
|
- [`UFloatingElement`](./references/extensions/floating.md) — Base for anchored floating UI (popover, tooltip); wraps `@floating-ui/dom`
|
|
172
174
|
- [`UOverlayElement`](./references/extensions/overlay.md) — Base for full-screen overlays (dialog, drawer); manages focus-trap, scroll-lock, ESC/backdrop close
|
|
175
|
+
|
|
176
|
+
## Machine-readable reference
|
|
177
|
+
|
|
178
|
+
The element surface is also published as a Custom Elements Manifest: the file named by the `customElements` field of this package's `package.json` (`dist/custom-elements.json`). It lists every element's attributes, properties, events (with the type of their `detail`), slots, CSS parts and CSS custom properties, generated from the source at build time. Read it instead of parsing the source when you need the exact surface of an element.
|
|
@@ -42,7 +42,7 @@ Checkbox with `indeterminate` state support. Form-associated (`formAssociated =
|
|
|
42
42
|
| `name` | `string` | — | — | Form field name |
|
|
43
43
|
| `value` | `string` | — | — | Submitted value |
|
|
44
44
|
| `label` | `string` | — | — | Label (alternative to slot) |
|
|
45
|
-
| `validationMessage` | `string` | — | — |
|
|
45
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
46
46
|
|
|
47
47
|
## Methods
|
|
48
48
|
|
|
@@ -16,7 +16,7 @@ time, so `2026-09-06T22:22:34Z` shows `2026-09-07 07:22` in Seoul and picking th
|
|
|
16
16
|
same moment one day later. The value keeps the string it was given until the person changes it.
|
|
17
17
|
Form-associated.
|
|
18
18
|
|
|
19
|
-
> The calendar week
|
|
19
|
+
> The calendar week starts on the locale's first day of the week (Monday in `de` `fr` `ru`, Saturday in `fa` `ar-EG`, Sunday in `en` `ko` `ja`); a browser that reports no week information gets Sunday.
|
|
20
20
|
|
|
21
21
|
**Typing a date (`mode="date"`).** The field is a text box. Type `2026-10-02`, `2026/10/2`,
|
|
22
22
|
`20261002`, or just `10-02` (this year), then press Enter or leave the field. The text shows as
|
|
@@ -101,7 +101,7 @@ starts from the value. Typing in the text box still commits on Enter or leaving
|
|
|
101
101
|
| `label` | `string` | — | — | Field label |
|
|
102
102
|
| `description` | `string` | — | — | Helper text |
|
|
103
103
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
104
|
-
| `validationMessage` | `string` | — | — |
|
|
104
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
105
105
|
|
|
106
106
|
## Events
|
|
107
107
|
|
|
@@ -22,7 +22,7 @@ range is half picked drops the anchor; Escape again closes the calendar. When th
|
|
|
22
22
|
picked, an off-screen status region announces it and asks for the end date. A reversed value set from
|
|
23
23
|
code is put in order (no `change`).
|
|
24
24
|
|
|
25
|
-
> The calendar week
|
|
25
|
+
> The calendar week starts on the locale's first day of the week (Monday in `de` `fr` `ru`, Saturday in `fa` `ar-EG`, Sunday in `en` `ko` `ja`); a browser that reports no week information gets Sunday. `thisWeek` and `lastWeek` follow it.
|
|
26
26
|
|
|
27
27
|
**Typing a range.** The field is a text box: type `2026-10-01 ~ 2026-10-31` (also `–`, ` - `, the ISO
|
|
28
28
|
interval `2026-10-01/2026-10-31`, a short second day such as `10-31` — the first day's year, or the
|
|
@@ -101,8 +101,8 @@ so "Last 7 days" is always the last seven days.
|
|
|
101
101
|
| `last30Days` | the 30 days ending today |
|
|
102
102
|
| `last3Months` | the 3 months ending today (from the day after the same date 3 months back; a day the earlier month lacks clamps to its end) |
|
|
103
103
|
| `last6Months` | the 6 months ending today, counted the same way |
|
|
104
|
-
| `thisWeek` |
|
|
105
|
-
| `lastWeek` |
|
|
104
|
+
| `thisWeek` | the seven days of this week, from the locale's first day of the week |
|
|
105
|
+
| `lastWeek` | the seven days of last week, counted the same way |
|
|
106
106
|
| `thisMonth` | the whole of this month |
|
|
107
107
|
| `lastMonth` | the whole of last month |
|
|
108
108
|
| `thisYear` | January 1 – December 31 of this year |
|
|
@@ -158,7 +158,7 @@ picker.addEventListener('change', () => {
|
|
|
158
158
|
| `label` | `string` | — | — | Field label |
|
|
159
159
|
| `description` | `string` | — | — | Helper text |
|
|
160
160
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
161
|
-
| `validationMessage` | `string` | — | — |
|
|
161
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
162
162
|
|
|
163
163
|
Validation: `required` with no value → `valueMissing`; a value that is not two ISO days joined by `/`
|
|
164
164
|
→ `badInput`; start before `min` → `rangeUnderflow`; end after `max` → `rangeOverflow`; start or end on a day
|
|
@@ -35,6 +35,11 @@ is copied onto the slotted element as `aria-label` (and `description` as `aria-d
|
|
|
35
35
|
label and the accessible name disagree (WCAG SC 2.5.3 Label in Name). Setting `label` on *both*
|
|
36
36
|
renders the label twice; a development-mode console warning points at that spot.
|
|
37
37
|
|
|
38
|
+
**Give the error text in one place too.** A `u-input`, `u-textarea`, `u-select` or date picker draws its own message when it is
|
|
39
|
+
`invalid` — the one the browser computed (`This field is required`) or the one you gave it with `validation-message`. Put
|
|
40
|
+
`validation-message` on a `u-field` around such a control and both lines show under it. Set the text on the control
|
|
41
|
+
(`<u-input invalid validation-message="Already taken">`), or on the `u-field` around a plain native control, which draws none.
|
|
42
|
+
|
|
38
43
|
**A label over several controls, or over one that names itself, names the group.** With two or more
|
|
39
44
|
controls slotted (a row of choice buttons), or a single button, link, checkbox, switch or radio that
|
|
40
45
|
has its own text, the field becomes a `group` named by the label (and described by `description`);
|
|
@@ -54,7 +54,7 @@ No drag-and-drop in this version — it is a minimal wrapper (trigger + status +
|
|
|
54
54
|
| `label` | `string` | — | — | Label text |
|
|
55
55
|
| `description` | `string` | — | — | Helper text below the control |
|
|
56
56
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
57
|
-
| `validationMessage` | `string` | — | — |
|
|
57
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
58
58
|
|
|
59
59
|
## Methods
|
|
60
60
|
|
|
@@ -84,7 +84,7 @@ the library does not infer one from field meaning.
|
|
|
84
84
|
| `label` | `string` | — | — | Field label |
|
|
85
85
|
| `description` | `string` | — | — | Helper text |
|
|
86
86
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
87
|
-
| `validationMessage` | `string` | — | — |
|
|
87
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
88
88
|
|
|
89
89
|
## Events
|
|
90
90
|
|
|
@@ -58,7 +58,7 @@ Options of different kinds can be grouped under headings with [`u-option-group`]
|
|
|
58
58
|
| `label` | `string` | — | — | Field label |
|
|
59
59
|
| `description` | `string` | — | — | Helper text |
|
|
60
60
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
61
|
-
| `validationMessage` | `string` | — | — |
|
|
61
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
62
62
|
|
|
63
63
|
## Events
|
|
64
64
|
|
|
@@ -48,7 +48,7 @@ Multi-line text input with auto-resize and optional character counter. Form-asso
|
|
|
48
48
|
| `label` | `string` | — | — | Field label |
|
|
49
49
|
| `description` | `string` | — | — | Helper text |
|
|
50
50
|
| `descriptionDisplay` | `'inline' \| 'hint'` | — | — | Attribute `description-display`. This field only — `hint` puts the description in a tooltip beside the label, `inline` under the control. Empty: the app-wide `UField.descriptionDisplay` |
|
|
51
|
-
| `validationMessage` | `string` | — | — |
|
|
51
|
+
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |
|
|
52
52
|
|
|
53
53
|
## Events
|
|
54
54
|
|
|
@@ -101,6 +101,20 @@ Locale.registerSearch('tr', (text, query, options) =>
|
|
|
101
101
|
text.toLocaleLowerCase('tr').includes(query.toLocaleLowerCase('tr')) || defaultSearchMatch(text, query, options));
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Text order
|
|
105
|
+
|
|
106
|
+
`compareText(a, b, locale?)` orders two texts the way a table column should (`getCollator(locale?)` is the
|
|
107
|
+
`Intl.Collator` behind it, one per locale, reusable as `array.sort(collator.compare)`):
|
|
108
|
+
|
|
109
|
+
- Digit runs inside text compare as numbers — `A-2` before `A-10`, `9` before `10`.
|
|
110
|
+
- Case and accents compare as the same letter, so rows that are equal keep their input order.
|
|
111
|
+
- The locale is the app's `Locale.get()` (`<html lang>` → browser language → `en`) unless you pass one — **not**
|
|
112
|
+
the browser's default. One app therefore puts Hangul before or after Latin letters the same way for every user:
|
|
113
|
+
`Locale.set('ko')` puts it first. A malformed tag compares as English instead of throwing.
|
|
114
|
+
|
|
115
|
+
`u-rich-table` (client mode), `flex-table`, the chat table block, `uw-table` and the `dimension-timeline` row
|
|
116
|
+
groups all order text this way — use it for your own sorted lists instead of `localeCompare`.
|
|
117
|
+
|
|
104
118
|
## Example
|
|
105
119
|
|
|
106
120
|
```ts
|