@eifi1/ui-kit 0.28.0 → 0.29.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/README.md +22 -4
- package/dist/auth/accept-invitation.d.ts +90 -0
- package/dist/auth/accept-invitation.js +117 -0
- package/dist/auth/accept-invitation.js.map +1 -0
- package/dist/auth/auth-errors.d.ts +60 -0
- package/dist/auth/auth-errors.js +32 -0
- package/dist/auth/auth-errors.js.map +1 -0
- package/dist/auth/complete-name-dialog.d.ts +71 -0
- package/dist/auth/complete-name-dialog.js +168 -0
- package/dist/auth/complete-name-dialog.js.map +1 -0
- package/dist/auth/email-tag.d.ts +60 -0
- package/dist/auth/email-tag.js +23 -0
- package/dist/auth/email-tag.js.map +1 -0
- package/dist/auth/forgot-password-form.d.ts +79 -0
- package/dist/auth/forgot-password-form.js +120 -0
- package/dist/auth/forgot-password-form.js.map +1 -0
- package/dist/auth/form-rules.d.ts +27 -0
- package/dist/auth/form-rules.js +23 -0
- package/dist/auth/form-rules.js.map +1 -0
- package/dist/auth/new-password-fields.d.ts +38 -0
- package/dist/auth/new-password-fields.js +54 -0
- package/dist/auth/new-password-fields.js.map +1 -0
- package/dist/auth/not-found-page.d.ts +57 -0
- package/dist/auth/not-found-page.js +40 -0
- package/dist/auth/not-found-page.js.map +1 -0
- package/dist/auth/register-form.d.ts +86 -0
- package/dist/auth/register-form.js +268 -0
- package/dist/auth/register-form.js.map +1 -0
- package/dist/auth/reset-password-form.d.ts +124 -0
- package/dist/auth/reset-password-form.js +164 -0
- package/dist/auth/reset-password-form.js.map +1 -0
- package/dist/auth/sign-in-form.d.ts +243 -0
- package/dist/auth/sign-in-form.js +345 -0
- package/dist/auth/sign-in-form.js.map +1 -0
- package/dist/auth/status-parts.d.ts +78 -0
- package/dist/auth/status-parts.js +83 -0
- package/dist/auth/status-parts.js.map +1 -0
- package/dist/auth/verify-email.d.ts +121 -0
- package/dist/auth/verify-email.js +207 -0
- package/dist/auth/verify-email.js.map +1 -0
- package/dist/chart.d.ts +17 -2
- package/dist/components/amount-input.d.ts +18 -2
- package/dist/components/button-group.d.ts +18 -2
- package/dist/components/calculator.d.ts +18 -2
- package/dist/components/confirm-dialog.d.ts +18 -2
- package/dist/components/copy-button.d.ts +18 -2
- package/dist/components/danger-confirm.d.ts +18 -2
- package/dist/components/facing-pair.d.ts +18 -2
- package/dist/components/file-button.d.ts +18 -2
- package/dist/components/file-dropzone.d.ts +18 -2
- package/dist/components/form-actions.d.ts +18 -2
- package/dist/components/iban-input.d.ts +18 -2
- package/dist/components/language-select.d.ts +18 -9
- package/dist/components/legal-page.d.ts +26 -4
- package/dist/components/legal-page.js +24 -5
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +18 -2
- package/dist/components/legal.js +49 -5
- package/dist/components/legal.js.map +1 -1
- package/dist/components/money-field.d.ts +18 -2
- package/dist/components/number-field.d.ts +18 -2
- package/dist/components/number-input.d.ts +18 -2
- package/dist/components/numpad-sheet.d.ts +18 -2
- package/dist/components/phone-input.d.ts +18 -2
- package/dist/components/series-chart.d.ts +18 -2
- package/dist/components/settings-fields.d.ts +15 -2
- package/dist/components/share-card.d.ts +18 -2
- package/dist/components/text-link.d.ts +18 -2
- package/dist/components/time-input.d.ts +18 -2
- package/dist/components/ui.d.ts +17 -1
- package/dist/components/user-avatar.d.ts +16 -2
- package/dist/components/user-avatar.js +7 -3
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +18 -2
- package/dist/feedback/feedback-context.d.ts +18 -2
- package/dist/feedback/feedback-crash.d.ts +18 -2
- package/dist/feedback/feedback-dialog.d.ts +18 -2
- package/dist/feedback/feedback-inbox.d.ts +18 -2
- package/dist/feedback/feedback-labels.d.ts +18 -2
- package/dist/feedback/feedback-menu.d.ts +18 -2
- package/dist/feedback/feedback-record.d.ts +18 -2
- package/dist/feedback/feedback-row-detail.d.ts +18 -2
- package/dist/feedback/feedback-status-undo.d.ts +18 -2
- package/dist/feedback/feedback-submit.d.ts +18 -2
- package/dist/feedback/feedback-swipe.d.ts +18 -2
- package/dist/feedback/feedback-table.d.ts +18 -2
- package/dist/feedback/feedback-thread.d.ts +18 -2
- package/dist/feedback.d.ts +18 -2
- package/dist/hooks/use-file-drop.d.ts +18 -2
- package/dist/i18n/defaults.d.ts +18 -2
- package/dist/i18n/defaults.js +18 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +18 -2
- package/dist/i18n/german.js +145 -0
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +18 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +13 -201
- package/dist/i18n/locales/de-CH.d.ts +18 -2
- package/dist/i18n/locales/en.d.ts +18 -2
- package/dist/i18n/locales/es.d.ts +18 -2
- package/dist/i18n/locales/es.js +147 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +18 -2
- package/dist/i18n/locales/fr.js +147 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +18 -2
- package/dist/i18n/locales/hu.js +149 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +18 -2
- package/dist/i18n/locales/it.js +146 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +18 -2
- package/dist/i18n/locales/zh.js +146 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +18 -2
- package/dist/i18n/review.js +17 -7
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/person-name.d.ts +69 -0
- package/dist/lib/person-name.js +65 -0
- package/dist/lib/person-name.js.map +1 -0
- package/dist/{kit-labels-SBN0biPl.d.ts → register-form-V1OeNlMr.d.ts} +423 -6
- package/dist/rhf/fields.d.ts +18 -2
- package/dist/rhf/form.d.ts +18 -2
- package/dist/rhf.d.ts +18 -2
- package/dist/shell/app-shell.d.ts +18 -2
- package/dist/shell/company-switcher.d.ts +59 -0
- package/dist/shell/company-switcher.js +85 -0
- package/dist/shell/company-switcher.js.map +1 -0
- package/dist/shell/top-bar-brand.d.ts +18 -2
- package/dist/shell/topbar-action-menu.d.ts +1 -0
- package/dist/shell.d.ts +12 -2
- package/dist/wizard/stepper-nav.d.ts +18 -2
- package/dist/wizard.d.ts +18 -2
- package/package.json +1 -1
- package/src/auth/accept-invitation.tsx +227 -0
- package/src/auth/auth-errors.ts +105 -0
- package/src/auth/complete-name-dialog.tsx +253 -0
- package/src/auth/email-tag.ts +75 -0
- package/src/auth/forgot-password-form.tsx +213 -0
- package/src/auth/form-rules.ts +40 -0
- package/src/auth/new-password-fields.tsx +85 -0
- package/src/auth/not-found-page.tsx +98 -0
- package/src/auth/register-form.tsx +459 -0
- package/src/auth/reset-password-form.tsx +337 -0
- package/src/auth/sign-in-form.tsx +687 -0
- package/src/auth/status-parts.tsx +138 -0
- package/src/auth/verify-email.tsx +358 -0
- package/src/components/legal-page.tsx +35 -0
- package/src/components/legal.tsx +93 -7
- package/src/components/user-avatar.tsx +22 -4
- package/src/i18n/defaults.ts +18 -0
- package/src/i18n/german.ts +153 -0
- package/src/i18n/kit-labels.tsx +27 -0
- package/src/i18n/locales/es.ts +156 -3
- package/src/i18n/locales/fr.ts +157 -0
- package/src/i18n/locales/hu.ts +159 -3
- package/src/i18n/locales/it.ts +154 -1
- package/src/i18n/locales/zh.ts +149 -1
- package/src/i18n/review.ts +15 -6
- package/src/index.ts +63 -1
- package/src/lib/person-name.ts +157 -0
- package/src/shell/company-switcher.tsx +140 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const CJK = /\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}/u;
|
|
3
|
+
function language(locale) {
|
|
4
|
+
return (locale ?? "").split(/[-_]/)[0].toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
function nameOrder(locale, first, last) {
|
|
7
|
+
const lang = language(locale);
|
|
8
|
+
if (lang === "hu") return "family-first";
|
|
9
|
+
if (lang === "zh" && (!first || CJK.test(first)) && (!last || CJK.test(last))) {
|
|
10
|
+
return "family-first-joined";
|
|
11
|
+
}
|
|
12
|
+
return "given-first";
|
|
13
|
+
}
|
|
14
|
+
function clean(part) {
|
|
15
|
+
return (part ?? "").trim();
|
|
16
|
+
}
|
|
17
|
+
function formatPersonName(name, locale) {
|
|
18
|
+
const first = clean(name.first);
|
|
19
|
+
const last = clean(name.last);
|
|
20
|
+
if (!last) return first;
|
|
21
|
+
if (!first) return last;
|
|
22
|
+
switch (nameOrder(locale, first, last)) {
|
|
23
|
+
case "family-first":
|
|
24
|
+
return `${last} ${first}`;
|
|
25
|
+
case "family-first-joined":
|
|
26
|
+
return `${last}${first}`;
|
|
27
|
+
default:
|
|
28
|
+
return `${first} ${last}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let graphemes;
|
|
32
|
+
function firstGrapheme(text) {
|
|
33
|
+
graphemes ??= typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
34
|
+
if (graphemes) {
|
|
35
|
+
const segment = graphemes.segment(text)[Symbol.iterator]().next();
|
|
36
|
+
if (!segment.done) return segment.value.segment;
|
|
37
|
+
}
|
|
38
|
+
return [...text][0] ?? "";
|
|
39
|
+
}
|
|
40
|
+
function upper(text, locale) {
|
|
41
|
+
try {
|
|
42
|
+
return text.toLocaleUpperCase(locale);
|
|
43
|
+
} catch {
|
|
44
|
+
return text.toUpperCase();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function personInitials(name, locale) {
|
|
48
|
+
const first = clean(name.first);
|
|
49
|
+
const last = clean(name.last);
|
|
50
|
+
if (!first && !last) return "";
|
|
51
|
+
const order = nameOrder(locale, first, last);
|
|
52
|
+
if (order === "family-first-joined") return upper(firstGrapheme(last || first), locale);
|
|
53
|
+
if (!first || !last) {
|
|
54
|
+
const words = (first || last).split(/\s+/);
|
|
55
|
+
const initials = words.length >= 2 ? firstGrapheme(words[0]) + firstGrapheme(words[1]) : [...words[0]].slice(0, 2).join("");
|
|
56
|
+
return upper(initials, locale);
|
|
57
|
+
}
|
|
58
|
+
const pair = order === "family-first" ? [last, first] : [first, last];
|
|
59
|
+
return upper(firstGrapheme(pair[0]) + firstGrapheme(pair[1]), locale);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
formatPersonName,
|
|
63
|
+
personInitials
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=person-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/person-name.ts"],"sourcesContent":["/**\n * A person's name as the reader's language writes it — the one rule of\n * docs/auth-harmonization.md §3.2 for every place a name is shown: the top bar, the\n * account menu, user lists, avatars, feedback, the greeting in a mail.\n *\n * WHY A FUNCTION AND NOT `${first} ${last}`. The three apps move from one free-text\n * `display_name` to `first_name` + `last_name` (§2.3), and the moment a name has two\n * parts, their ORDER is a language rule, not a data rule:\n *\n * - \"First Last\" in de-CH, en, fr, it and es — \"Ada Example\";\n * - **\"Last First\" in hu** — Hungarian puts the family name first: \"Example Ada\";\n * - **\"LastFirst\" with no space in zh** — a Chinese name is written family name first\n * and run together: 李 + 小龙 → \"李小龙\". Only a name written in CJK characters,\n * though: BOTH parts must hold Han (or kana, or hangul) characters. A Latin name read\n * in Chinese stays as it is written — \"Ada Lovelace\", not \"LovelaceAda\" (the\n * coordinator's refinement of §3.2, 2026-10-06).\n *\n * WHOSE language (§3.2, §10.6): on screen the READER's, so this takes the locale of the\n * UI, never the locale stored with the person. A mail uses the recipient's and a frozen\n * stamp the author's — that is server-kit's `full_name(first, last, locale)`, which\n * follows exactly these rules so a name reads the same in the app and in its mails.\n *\n * NOTHING IS GUESSED. Both parts are trimmed, and an empty part simply drops out: a\n * migrated keksdose or Kurvenschmiede user keeps the whole old display name as the\n * first name and an empty last name until they complete it (§3.3), and \"Ada Example\"\n * with no last name must still read \"Ada Example\" — not \"Ada Example \" and not a split\n * at the space. Inner spaces are the person's own and stay as typed.\n *\n * Only the language subtag counts (\"de-CH\" → \"de\", \"zh-Hant-TW\" → \"zh\"), and a language\n * this does not know reads \"First Last\", the order of the kit's five other languages.\n */\n\n/** The two parts of a person's name. Either may be missing or blank: a migrated row\n * has an empty `last` until it is completed (§3.3), and APIs send `null` for \"none\". */\nexport interface PersonName {\n /** The given name — `first_name`. */\n first?: string | null;\n /** The family name — `last_name`. */\n last?: string | null;\n}\n\ntype NameOrder = \"given-first\" | \"family-first\" | \"family-first-joined\";\n\n/** A part written in CJK characters: Han, and kana or hangul where they occur (a\n * Japanese or Korean name in a Chinese UI). One such character is enough. */\nconst CJK = /\\p{Script=Han}|\\p{Script=Hiragana}|\\p{Script=Katakana}|\\p{Script=Hangul}/u;\n\nfunction language(locale: string | undefined): string {\n return (locale ?? \"\").split(/[-_]/)[0]!.toLowerCase();\n}\n\n/**\n * The order the reader's language writes THIS name in. See the module note: hu puts the\n * family name first for every name; zh runs a CJK name together family-first and leaves\n * any other name as it is written; the rest write the given name first. A part that is\n * empty passes the CJK test, so a one-part name orders by the part it has. Called with\n * at least one part filled in.\n */\nfunction nameOrder(locale: string | undefined, first: string, last: string): NameOrder {\n const lang = language(locale);\n if (lang === \"hu\") return \"family-first\";\n if (lang === \"zh\" && (!first || CJK.test(first)) && (!last || CJK.test(last))) {\n return \"family-first-joined\";\n }\n return \"given-first\";\n}\n\nfunction clean(part: string | null | undefined): string {\n return (part ?? \"\").trim();\n}\n\n/**\n * The full name in the reader's order: \"Ada Example\" (en, de, fr, it, es), \"Example Ada\"\n * (hu), \"李小龙\" (zh, for a name in CJK characters — \"Ada Lovelace\" stays so). Trimmed;\n * with one part empty, the other alone; with both empty, `\"\"` — so a caller can fall\n * back with `||` (`formatPersonName(p, l) || email`).\n *\n * `locale` is the READER's — the UI language, `useKitLocale()` in a component. Left out,\n * the given-name-first order.\n */\nexport function formatPersonName(name: PersonName, locale?: string): string {\n const first = clean(name.first);\n const last = clean(name.last);\n if (!last) return first;\n if (!first) return last;\n switch (nameOrder(locale, first, last)) {\n case \"family-first\":\n return `${last} ${first}`;\n case \"family-first-joined\":\n return `${last}${first}`;\n default:\n return `${first} ${last}`;\n }\n}\n\n/** One segmenter for every avatar on the page, made on first use. `null`: the runtime\n * has none, and code points have to do. */\nlet graphemes: Intl.Segmenter | null | undefined;\n\n/** The first user-perceived character — \"É\" whether it was typed as one code point or\n * as E + a combining accent, a whole emoji rather than half a surrogate pair. */\nfunction firstGrapheme(text: string): string {\n graphemes ??=\n typeof Intl !== \"undefined\" && \"Segmenter\" in Intl\n ? new Intl.Segmenter(undefined, { granularity: \"grapheme\" })\n : null;\n if (graphemes) {\n const segment = graphemes.segment(text)[Symbol.iterator]().next();\n if (!segment.done) return segment.value.segment;\n }\n return [...text][0] ?? \"\";\n}\n\n/** Upper case under the reader's rules (Turkish \"i\" → \"İ\"), and plain upper case for a\n * locale tag the runtime refuses rather than a thrown RangeError in a render. */\nfunction upper(text: string, locale: string | undefined): string {\n try {\n return text.toLocaleUpperCase(locale);\n } catch {\n return text.toUpperCase();\n }\n}\n\n/**\n * The initials for an avatar, in the same order as {@link formatPersonName}:\n *\n * - \"AE\" for Ada Example in en, de, fr, it and es;\n * - \"EA\" in hu, family name first;\n * - **one character in zh for a name in CJK characters, the family name's first** —\n * \"李\" for 李小龙. Two Chinese characters are not initials, they are most of a name.\n * A Latin name in zh is \"AE\", as it is written.\n *\n * With only one part (a migrated user's whole old display name in `first`, §3.3), the\n * initials are what {@link avatarInitials} has always made of a display name: the first\n * letters of its first two words (\"Ada Example\" → \"AE\"), or the first two letters of a\n * single word (\"Ada\" → \"AD\") — so nobody's avatar changes when their account migrates.\n * In zh, a part in CJK characters gives its first character.\n *\n * `\"\"` when both parts are blank; {@link UserAvatar} then falls back to the email.\n */\nexport function personInitials(name: PersonName, locale?: string): string {\n const first = clean(name.first);\n const last = clean(name.last);\n if (!first && !last) return \"\";\n const order = nameOrder(locale, first, last);\n if (order === \"family-first-joined\") return upper(firstGrapheme(last || first), locale);\n if (!first || !last) {\n const words = (first || last).split(/\\s+/);\n const initials =\n words.length >= 2\n ? firstGrapheme(words[0]!) + firstGrapheme(words[1]!)\n : [...words[0]!].slice(0, 2).join(\"\");\n return upper(initials, locale);\n }\n const pair = order === \"family-first\" ? [last, first] : [first, last];\n return upper(firstGrapheme(pair[0]!) + firstGrapheme(pair[1]!), locale);\n}\n"],"mappings":";AA6CA,MAAM,MAAM;AAEZ,SAAS,SAAS,QAAoC;AACpD,UAAQ,UAAU,IAAI,MAAM,MAAM,EAAE,CAAC,EAAG,YAAY;AACtD;AASA,SAAS,UAAU,QAA4B,OAAe,MAAyB;AACrF,QAAM,OAAO,SAAS,MAAM;AAC5B,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,SAAS,SAAS,CAAC,SAAS,IAAI,KAAK,KAAK,OAAO,CAAC,QAAQ,IAAI,KAAK,IAAI,IAAI;AAC7E,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,MAAM,MAAyC;AACtD,UAAQ,QAAQ,IAAI,KAAK;AAC3B;AAWO,SAAS,iBAAiB,MAAkB,QAAyB;AAC1E,QAAM,QAAQ,MAAM,KAAK,KAAK;AAC9B,QAAM,OAAO,MAAM,KAAK,IAAI;AAC5B,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,CAAC,MAAO,QAAO;AACnB,UAAQ,UAAU,QAAQ,OAAO,IAAI,GAAG;AAAA,IACtC,KAAK;AACH,aAAO,GAAG,IAAI,IAAI,KAAK;AAAA,IACzB,KAAK;AACH,aAAO,GAAG,IAAI,GAAG,KAAK;AAAA,IACxB;AACE,aAAO,GAAG,KAAK,IAAI,IAAI;AAAA,EAC3B;AACF;AAIA,IAAI;AAIJ,SAAS,cAAc,MAAsB;AAC3C,gBACE,OAAO,SAAS,eAAe,eAAe,OAC1C,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAW,CAAC,IACzD;AACN,MAAI,WAAW;AACb,UAAM,UAAU,UAAU,QAAQ,IAAI,EAAE,OAAO,QAAQ,EAAE,EAAE,KAAK;AAChE,QAAI,CAAC,QAAQ,KAAM,QAAO,QAAQ,MAAM;AAAA,EAC1C;AACA,SAAO,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK;AACzB;AAIA,SAAS,MAAM,MAAc,QAAoC;AAC/D,MAAI;AACF,WAAO,KAAK,kBAAkB,MAAM;AAAA,EACtC,QAAQ;AACN,WAAO,KAAK,YAAY;AAAA,EAC1B;AACF;AAmBO,SAAS,eAAe,MAAkB,QAAyB;AACxE,QAAM,QAAQ,MAAM,KAAK,KAAK;AAC9B,QAAM,OAAO,MAAM,KAAK,IAAI;AAC5B,MAAI,CAAC,SAAS,CAAC,KAAM,QAAO;AAC5B,QAAM,QAAQ,UAAU,QAAQ,OAAO,IAAI;AAC3C,MAAI,UAAU,sBAAuB,QAAO,MAAM,cAAc,QAAQ,KAAK,GAAG,MAAM;AACtF,MAAI,CAAC,SAAS,CAAC,MAAM;AACnB,UAAM,SAAS,SAAS,MAAM,MAAM,KAAK;AACzC,UAAM,WACJ,MAAM,UAAU,IACZ,cAAc,MAAM,CAAC,CAAE,IAAI,cAAc,MAAM,CAAC,CAAE,IAClD,CAAC,GAAG,MAAM,CAAC,CAAE,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE;AACxC,WAAO,MAAM,UAAU,MAAM;AAAA,EAC/B;AACA,QAAM,OAAO,UAAU,iBAAiB,CAAC,MAAM,KAAK,IAAI,CAAC,OAAO,IAAI;AACpE,SAAO,MAAM,cAAc,KAAK,CAAC,CAAE,IAAI,cAAc,KAAK,CAAC,CAAE,GAAG,MAAM;AACxE;","names":[]}
|