@tristan2828/ui-foundation 4.96.0 → 4.98.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.
Files changed (66) hide show
  1. package/conventions/AGENTS.md +1 -1
  2. package/conventions/docs/add-an-entity.md +92 -64
  3. package/conventions/docs/cell-patterns.md +64 -54
  4. package/conventions/docs/design-language.md +168 -76
  5. package/conventions/docs/entity-plan-template.md +15 -21
  6. package/conventions/docs/reminders.md +2 -2
  7. package/conventions/docs/timed-screens.md +1 -1
  8. package/dist/components/app/action-error.js +1 -1
  9. package/dist/components/app/allow-reminders.js +1 -1
  10. package/dist/components/app/app-shell.js +4 -4
  11. package/dist/components/app/board.js +1 -1
  12. package/dist/components/app/choice-buttons.js +6 -1
  13. package/dist/components/app/data-table-tools.js +2 -2
  14. package/dist/components/app/data-table.js +4 -4
  15. package/dist/components/app/date-field.js +1 -1
  16. package/dist/components/app/emoji-field-data.js +7 -7
  17. package/dist/components/app/entity-form.js +1 -1
  18. package/dist/components/app/entity-view.d.ts +29 -11
  19. package/dist/components/app/entity-view.js +106 -29
  20. package/dist/components/app/error-state.js +1 -1
  21. package/dist/components/app/field-rows.js +6 -3
  22. package/dist/components/app/fill-in-queue.js +2 -2
  23. package/dist/components/app/filter-bar.js +1 -1
  24. package/dist/components/app/form-dialog.js +1 -1
  25. package/dist/components/app/form-section.d.ts +1 -1
  26. package/dist/components/app/image-field.js +3 -2
  27. package/dist/components/app/key-stats.d.ts +3 -1
  28. package/dist/components/app/key-stats.js +2 -2
  29. package/dist/components/app/list-header.js +2 -2
  30. package/dist/components/app/milkdown-editor.js +4 -4
  31. package/dist/components/app/month-day-field.js +3 -3
  32. package/dist/components/app/multi-pick.js +1 -1
  33. package/dist/components/app/needs-you.js +1 -1
  34. package/dist/components/app/notes-outline.js +1 -1
  35. package/dist/components/app/password-input.js +1 -1
  36. package/dist/components/app/record-dialog-context.d.ts +9 -0
  37. package/dist/components/app/record-dialog.d.ts +8 -1
  38. package/dist/components/app/record-dialog.js +19 -3
  39. package/dist/components/app/rich-text-format-items.js +6 -6
  40. package/dist/components/app/rich-text-highlight-menu.js +1 -1
  41. package/dist/components/app/rich-text-table-grips.js +16 -16
  42. package/dist/components/app/rich-text-toolbar.js +2 -2
  43. package/dist/components/app/rich-text-widgets.js +2 -2
  44. package/dist/components/app/secondary-filters.js +2 -2
  45. package/dist/components/app/session-view.js +1 -1
  46. package/dist/components/app/status-mark.d.ts +17 -0
  47. package/dist/components/app/status-mark.js +12 -0
  48. package/dist/components/app/timeline.js +1 -1
  49. package/dist/components/app/widget-layout-sheet.js +1 -1
  50. package/dist/components/ui/combobox.js +1 -1
  51. package/dist/components/ui/dialog.js +1 -1
  52. package/dist/components/ui/field.d.ts +3 -2
  53. package/dist/components/ui/field.js +13 -2
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.js +3 -0
  56. package/dist/lib/field-rows.d.ts +3 -1
  57. package/dist/lib/field-rows.js +24 -6
  58. package/dist/lib/group-by-day.js +2 -2
  59. package/dist/lib/status-kinds.d.ts +10 -0
  60. package/dist/lib/status-kinds.js +33 -0
  61. package/dist/lib/title-case.d.ts +13 -0
  62. package/dist/lib/title-case.js +66 -0
  63. package/dist/routes/login.js +4 -4
  64. package/dist/routes/register.js +1 -1
  65. package/package.json +1 -1
  66. package/styles/index.css +9 -0
@@ -11,23 +11,38 @@
11
11
  // Below 48rem every field takes its own row, except two dates or two
12
12
  // numbers next to each other in a row, which stay side by side
13
13
  // (`phonePair`).
14
+ //
15
+ // A choice (4.98, record standard 9C: a Field holding ChoiceButtons, found
16
+ // by itself) shares its row only with another choice, two to a row, so a
17
+ // group of buttons has room to stay joined: three choices are two on a row
18
+ // and the third on the next, and a choice beside a date starts a row of
19
+ // its own. Two choices side by side stay that way on a phone
20
+ // while both fit, and go one per row when they don't (`phoneFit`, a width
21
+ // the browser works out from the buttons, styles/index.css).
14
22
  const PARTS = { s: 1, m: 1.4, l: 2.6 };
15
23
  /** The most fields one row holds. */
16
24
  export const FIELDS_PER_ROW = 3;
17
25
  export function fieldRows(items) {
18
- const places = items.map(() => ({ share: null, gaps: 0, phonePair: false }));
26
+ const places = items.map(() => ({ share: null, gaps: 0, phonePair: false, phoneFit: false }));
19
27
  let row = [];
20
28
  const close = () => {
21
29
  if (row.length > 1) {
22
- const parts = row.map((at) => PARTS[items[at].size]);
30
+ // Two choices split the row evenly, whatever their sizes say.
31
+ const choices = row.every((at) => items[at].kind === 'choice');
32
+ const parts = row.map((at) => (choices ? 1 : PARTS[items[at].size]));
23
33
  const total = parts.reduce((sum, part) => sum + part, 0);
24
34
  row.forEach((at, index) => {
25
- places[at] = { share: parts[index] / total, gaps: row.length - 1, phonePair: false };
35
+ places[at] = { share: parts[index] / total, gaps: row.length - 1, phonePair: false, phoneFit: false };
26
36
  });
27
37
  for (let index = 0; index + 1 < row.length; index++) {
28
38
  const a = items[row[index]].kind;
29
39
  const b = items[row[index + 1]].kind;
30
- if (a && a === b && !places[row[index]].phonePair) {
40
+ if (a === 'choice' && b === 'choice') {
41
+ places[row[index]].phoneFit = true;
42
+ places[row[index + 1]].phoneFit = true;
43
+ index++;
44
+ }
45
+ else if (a && a === b && !places[row[index]].phonePair) {
31
46
  places[row[index]].phonePair = true;
32
47
  places[row[index + 1]].phonePair = true;
33
48
  index++;
@@ -43,8 +58,11 @@ export function fieldRows(items) {
43
58
  return;
44
59
  }
45
60
  const hasLong = row.some((index) => items[index].size === 'l');
46
- const full = row.length >= (hasLong || item.size === 'l' ? 2 : FIELDS_PER_ROW);
47
- if (full || (item.size === 'l' && hasLong))
61
+ const isChoice = item.kind === 'choice';
62
+ // Choices share a row with each other only, two at a time.
63
+ const mixes = row.length > 0 && row.some((index) => (items[index].kind === 'choice') !== isChoice);
64
+ const full = row.length >= (hasLong || item.size === 'l' || isChoice ? 2 : FIELDS_PER_ROW);
65
+ if (full || mixes || (item.size === 'l' && hasLong))
48
66
  close();
49
67
  row.push(at);
50
68
  });
@@ -26,7 +26,7 @@ export function byDay(field, { now = new Date(), timeZone, weekStartsOn = 1, loc
26
26
  const value = read(row);
27
27
  const date = value === null || value === undefined || value === '' ? null : new Date(value);
28
28
  if (date === null || Number.isNaN(date.getTime()))
29
- return { key: 'none', label: 'No date' };
29
+ return { key: 'none', label: 'No Date' };
30
30
  const day = dayOf(date);
31
31
  if (day > today)
32
32
  return { key: 'upcoming', label: 'Upcoming' };
@@ -35,7 +35,7 @@ export function byDay(field, { now = new Date(), timeZone, weekStartsOn = 1, loc
35
35
  if (day === today - 1)
36
36
  return { key: 'yesterday', label: 'Yesterday' };
37
37
  if (day >= thisWeek)
38
- return { key: 'this-week', label: 'Earlier this week' };
38
+ return { key: 'this-week', label: 'Earlier This Week' };
39
39
  const week = weekStart(day);
40
40
  if (week >= thisWeek - WEEKS_BY_WEEK * 7) {
41
41
  return { key: `week:${isoDay(week)}`, label: `Week of ${dayMonth.format(new Date(week * DAY_MS))}` };
@@ -0,0 +1,10 @@
1
+ import type { IconComponent } from '../components/app/icon-component.js';
2
+ export type StatusKind = 'active' | 'planned' | 'paused' | 'done' | 'ended' | 'attention';
3
+ /** Every kind, in the order a legend lists them. */
4
+ export declare const STATUS_KINDS: readonly StatusKind[];
5
+ /** Each kind's icon: the one place to change them. */
6
+ export declare const STATUS_KIND_ICONS: Record<StatusKind, IconComponent>;
7
+ /** Each kind's word, when the status has none of its own (a legend). */
8
+ export declare const STATUS_KIND_LABELS: Record<StatusKind, string>;
9
+ /** Each kind's colour, for the icon and the word: *-text tokens and the muted foreground only. */
10
+ export declare const STATUS_KIND_TONES: Record<StatusKind, string>;
@@ -0,0 +1,33 @@
1
+ // The six status kinds (4.98, record standard 5B) and how each is drawn:
2
+ // StatusMark (components/app/status-mark.tsx) reads these. The icons are
3
+ // one map, STATUS_KIND_ICONS: changing one here changes it everywhere.
4
+ import { CircleCheckIcon, CircleDashedIcon, CircleDotIcon, CirclePauseIcon, CircleSlash2Icon, TriangleAlertIcon, } from 'lucide-react';
5
+ /** Every kind, in the order a legend lists them. */
6
+ export const STATUS_KINDS = ['active', 'planned', 'paused', 'done', 'ended', 'attention'];
7
+ /** Each kind's icon: the one place to change them. */
8
+ export const STATUS_KIND_ICONS = {
9
+ active: CircleDotIcon,
10
+ planned: CircleDashedIcon,
11
+ paused: CirclePauseIcon,
12
+ done: CircleCheckIcon,
13
+ ended: CircleSlash2Icon,
14
+ attention: TriangleAlertIcon,
15
+ };
16
+ /** Each kind's word, when the status has none of its own (a legend). */
17
+ export const STATUS_KIND_LABELS = {
18
+ active: 'Active',
19
+ planned: 'Planned',
20
+ paused: 'Paused',
21
+ done: 'Done',
22
+ ended: 'Ended',
23
+ attention: 'Needs Attention',
24
+ };
25
+ /** Each kind's colour, for the icon and the word: *-text tokens and the muted foreground only. */
26
+ export const STATUS_KIND_TONES = {
27
+ active: 'text-success-text',
28
+ planned: 'text-info-text',
29
+ paused: 'text-warning-text',
30
+ done: 'text-muted-foreground',
31
+ ended: 'text-muted-foreground',
32
+ attention: 'text-destructive-text',
33
+ };
@@ -0,0 +1,13 @@
1
+ /** The short words a title keeps lowercase, unless first or last. */
2
+ export declare const TITLE_CASE_SMALL_WORDS: ReadonlySet<string>;
3
+ /**
4
+ * A label in Title Case: every word capitalised but the short ones
5
+ * (`TITLE_CASE_SMALL_WORDS`: a, an, the, and, or, of, to, in, on, for, by,
6
+ * with, ...), which stay lowercase unless first or last, or first after a
7
+ * colon. A word that already holds a capital is left as written, so names
8
+ * and acronyms survive: `titleCase('rows per page')` is "Rows per Page",
9
+ * `titleCase('move to')` is "Move To", `titleCase('open in GitHub')` is
10
+ * "Open in GitHub". For a label built from a value (`Any ${label}`); a
11
+ * label written in the code is written in Title Case to begin with.
12
+ */
13
+ export declare function titleCase(text: string): string;
@@ -0,0 +1,66 @@
1
+ // The words a label is written in (design-language.md "Words on screen"):
2
+ // titles, buttons, menu items, tabs, column headers and field labels are
3
+ // Title Case. Messages, help text, toasts, placeholders and screen-reader
4
+ // sentences stay sentence case, so they never go through this.
5
+ /** The short words a title keeps lowercase, unless first or last. */
6
+ export const TITLE_CASE_SMALL_WORDS = new Set([
7
+ 'a',
8
+ 'an',
9
+ 'the',
10
+ 'and',
11
+ 'but',
12
+ 'or',
13
+ 'nor',
14
+ 'as',
15
+ 'at',
16
+ 'by',
17
+ 'for',
18
+ 'in',
19
+ 'of',
20
+ 'on',
21
+ 'per',
22
+ 'to',
23
+ 'with',
24
+ ]);
25
+ const upperFirst = (part) => part.replace(/\p{L}/u, (letter) => letter.toUpperCase());
26
+ function casePart(part, edge) {
27
+ if (!/\p{L}/u.test(part))
28
+ return part;
29
+ // A word already holding a capital ("iPhone", "URL", "McKay") is written as its owner wrote it.
30
+ if (/\p{Lu}/u.test(part))
31
+ return part;
32
+ const bare = part.replace(/^[^\p{L}]+|[^\p{L}]+$/gu, '');
33
+ if (!edge && TITLE_CASE_SMALL_WORDS.has(bare))
34
+ return part;
35
+ return upperFirst(part);
36
+ }
37
+ /**
38
+ * A label in Title Case: every word capitalised but the short ones
39
+ * (`TITLE_CASE_SMALL_WORDS`: a, an, the, and, or, of, to, in, on, for, by,
40
+ * with, ...), which stay lowercase unless first or last, or first after a
41
+ * colon. A word that already holds a capital is left as written, so names
42
+ * and acronyms survive: `titleCase('rows per page')` is "Rows per Page",
43
+ * `titleCase('move to')` is "Move To", `titleCase('open in GitHub')` is
44
+ * "Open in GitHub". For a label built from a value (`Any ${label}`); a
45
+ * label written in the code is written in Title Case to begin with.
46
+ */
47
+ export function titleCase(text) {
48
+ const words = text.split(/(\s+)/);
49
+ const real = words.map((word, index) => (index % 2 === 0 && word !== '' ? index : -1)).filter((index) => index >= 0);
50
+ const first = real[0];
51
+ const last = real.at(-1);
52
+ let afterColon = false;
53
+ return words
54
+ .map((word, index) => {
55
+ if (index % 2 === 1 || word === '')
56
+ return word;
57
+ const edge = index === first || index === last || afterColon;
58
+ afterColon = /:$/.test(word);
59
+ return word
60
+ .split('-')
61
+ // Each part of a hyphenated word is a word ("Follow-Up"), small or not.
62
+ .map((part, partIndex) => casePart(part, edge || partIndex > 0))
63
+ .join('-');
64
+ })
65
+ .join('');
66
+ }
@@ -59,7 +59,7 @@ export function LoginRoute({ registerPath = '/register' } = {}) {
59
59
  setStep('password');
60
60
  }
61
61
  };
62
- return (_jsx("main", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs(Card, { className: "w-full max-w-sm", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-lg", children: _jsx("h1", { children: "Sign in" }) }), step === 'code' && _jsx(CardDescription, { children: "Your account has two-step sign-in." })] }), _jsx(CardContent, { children: step === 'password' ? (_jsx(PasswordStep, { registerPath: registerPath, restartReason: restartReason, onResult: onResult })) : (_jsx(CodeStep, { onResult: onResult, onStartOver: () => {
62
+ return (_jsx("main", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs(Card, { className: "w-full max-w-sm", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-lg", children: _jsx("h1", { children: "Sign In" }) }), step === 'code' && _jsx(CardDescription, { children: "Your account has two-step sign-in." })] }), _jsx(CardContent, { children: step === 'password' ? (_jsx(PasswordStep, { registerPath: registerPath, restartReason: restartReason, onResult: onResult })) : (_jsx(CodeStep, { onResult: onResult, onStartOver: () => {
63
63
  setRestartReason(null);
64
64
  setStep('password');
65
65
  } })) })] }) }));
@@ -98,7 +98,7 @@ function PasswordStep({ registerPath, restartReason, onResult, }) {
98
98
  setIsSubmitting(false);
99
99
  }
100
100
  });
101
- return (_jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [restartReason && _jsx(FieldError, { children: restartReason }), _jsxs(FieldGroup, { children: [_jsxs(Field, { "data-invalid": !!form.formState.errors.email, children: [_jsx(FieldLabel, { htmlFor: "login-email", children: "Email" }), _jsx(Input, { id: "login-email", type: "email", autoComplete: "username", "aria-invalid": !!form.formState.errors.email, ...form.register('email') }), _jsx(FieldError, { errors: [form.formState.errors.email] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.password, children: [_jsx(FieldLabel, { htmlFor: "login-password", children: "Password" }), _jsx(PasswordInput, { id: "login-password", autoComplete: "current-password", "aria-invalid": !!form.formState.errors.password, ...form.register('password') }), _jsx(FieldError, { errors: [form.formState.errors.password] })] })] }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting || held, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Sign in"] }), registerPath !== null && (_jsx(Button, { variant: "link", size: "sm", nativeButton: false, render: _jsx(Link, { to: registerPath, state: location.state }), children: "Create account" }))] }));
101
+ return (_jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [restartReason && _jsx(FieldError, { children: restartReason }), _jsxs(FieldGroup, { children: [_jsxs(Field, { "data-invalid": !!form.formState.errors.email, children: [_jsx(FieldLabel, { htmlFor: "login-email", children: "Email" }), _jsx(Input, { id: "login-email", type: "email", autoComplete: "username", "aria-invalid": !!form.formState.errors.email, ...form.register('email') }), _jsx(FieldError, { errors: [form.formState.errors.email] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.password, children: [_jsx(FieldLabel, { htmlFor: "login-password", children: "Password" }), _jsx(PasswordInput, { id: "login-password", autoComplete: "current-password", "aria-invalid": !!form.formState.errors.password, ...form.register('password') }), _jsx(FieldError, { errors: [form.formState.errors.password] })] })] }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting || held, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Sign In"] }), registerPath !== null && (_jsx(Button, { variant: "link", size: "sm", nativeButton: false, render: _jsx(Link, { to: registerPath, state: location.state }), children: "Create Account" }))] }));
102
102
  }
103
103
  function CodeStep({ onResult, onStartOver, }) {
104
104
  const [recovery, setRecovery] = useState(false);
@@ -138,7 +138,7 @@ function CodeForm({ recovery, onSwitchMode, onResult, onStartOver, }) {
138
138
  }
139
139
  });
140
140
  const invalid = !!form.formState.errors.code;
141
- return (_jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [_jsx(FieldGroup, { children: _jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: "login-code", children: recovery ? 'Recovery code' : 'Authentication code' }), _jsx(Input, { id: "login-code", autoComplete: recovery ? 'off' : 'one-time-code', inputMode: recovery ? 'text' : 'numeric', spellCheck: false, "aria-invalid": invalid, "aria-describedby": "login-code-description", ...form.register('code') }), _jsx(FieldDescription, { id: "login-code-description", children: recovery
141
+ return (_jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [_jsx(FieldGroup, { children: _jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: "login-code", children: recovery ? 'Recovery Code' : 'Authentication Code' }), _jsx(Input, { id: "login-code", autoComplete: recovery ? 'off' : 'one-time-code', inputMode: recovery ? 'text' : 'numeric', spellCheck: false, "aria-invalid": invalid, "aria-describedby": "login-code-description", ...form.register('code') }), _jsx(FieldDescription, { id: "login-code-description", children: recovery
142
142
  ? 'One of the recovery codes you saved when two-step sign-in was turned on. Each works once.'
143
- : 'The 6-digit code your authenticator app shows for this account.' }), _jsx(FieldError, { errors: [form.formState.errors.code] })] }) }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting || held, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Verify"] }), _jsxs("div", { className: "flex flex-wrap justify-between gap-2", children: [_jsx(Button, { type: "button", variant: "link", size: "sm", onClick: onSwitchMode, children: recovery ? 'Use your authenticator app' : 'Use a recovery code' }), _jsx(Button, { type: "button", variant: "link", size: "sm", onClick: onStartOver, children: "Start over" })] })] }));
143
+ : 'The 6-digit code your authenticator app shows for this account.' }), _jsx(FieldError, { errors: [form.formState.errors.code] })] }) }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting || held, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Verify"] }), _jsxs("div", { className: "flex flex-wrap justify-between gap-2", children: [_jsx(Button, { type: "button", variant: "link", size: "sm", onClick: onSwitchMode, children: recovery ? 'Use Your Authenticator App' : 'Use a Recovery Code' }), _jsx(Button, { type: "button", variant: "link", size: "sm", onClick: onStartOver, children: "Start Over" })] })] }));
144
144
  }
@@ -54,5 +54,5 @@ export function RegisterRoute() {
54
54
  setIsSubmitting(false);
55
55
  }
56
56
  });
57
- return (_jsx("main", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs(Card, { className: "w-full max-w-sm", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-lg", children: _jsx("h1", { children: "Create an account" }) }) }), _jsx(CardContent, { children: _jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [_jsxs(FieldGroup, { children: [_jsxs(Field, { "data-invalid": !!form.formState.errors.name, children: [_jsx(FieldLabel, { htmlFor: "register-name", children: "Name" }), _jsx(Input, { id: "register-name", autoComplete: "name", "aria-invalid": !!form.formState.errors.name, ...form.register('name') }), _jsx(FieldError, { errors: [form.formState.errors.name] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.email, children: [_jsx(FieldLabel, { htmlFor: "register-email", children: "Email" }), _jsx(Input, { id: "register-email", type: "email", autoComplete: "username", "aria-invalid": !!form.formState.errors.email, ...form.register('email') }), _jsx(FieldError, { errors: [form.formState.errors.email] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.password, children: [_jsx(FieldLabel, { htmlFor: "register-password", children: "Password" }), _jsx(PasswordInput, { id: "register-password", autoComplete: "new-password", "aria-invalid": !!form.formState.errors.password, ...form.register('password') }), _jsx(FieldError, { errors: [form.formState.errors.password] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.confirmPassword, children: [_jsx(FieldLabel, { htmlFor: "register-confirm-password", children: "Confirm password" }), _jsx(PasswordInput, { id: "register-confirm-password", autoComplete: "new-password", "aria-invalid": !!form.formState.errors.confirmPassword, ...form.register('confirmPassword') }), _jsx(FieldError, { errors: [form.formState.errors.confirmPassword] })] })] }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Create account"] }), _jsx(Button, { variant: "link", size: "sm", nativeButton: false, render: _jsx(Link, { to: "/login", state: location.state }), children: "Sign in instead" })] }) })] }) }));
57
+ return (_jsx("main", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs(Card, { className: "w-full max-w-sm", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-lg", children: _jsx("h1", { children: "Create an Account" }) }) }), _jsx(CardContent, { children: _jsxs("form", { onSubmit: onSubmit, noValidate: true, className: "flex flex-col gap-6", children: [_jsxs(FieldGroup, { children: [_jsxs(Field, { "data-invalid": !!form.formState.errors.name, children: [_jsx(FieldLabel, { htmlFor: "register-name", children: "Name" }), _jsx(Input, { id: "register-name", autoComplete: "name", "aria-invalid": !!form.formState.errors.name, ...form.register('name') }), _jsx(FieldError, { errors: [form.formState.errors.name] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.email, children: [_jsx(FieldLabel, { htmlFor: "register-email", children: "Email" }), _jsx(Input, { id: "register-email", type: "email", autoComplete: "username", "aria-invalid": !!form.formState.errors.email, ...form.register('email') }), _jsx(FieldError, { errors: [form.formState.errors.email] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.password, children: [_jsx(FieldLabel, { htmlFor: "register-password", children: "Password" }), _jsx(PasswordInput, { id: "register-password", autoComplete: "new-password", "aria-invalid": !!form.formState.errors.password, ...form.register('password') }), _jsx(FieldError, { errors: [form.formState.errors.password] })] }), _jsxs(Field, { "data-invalid": !!form.formState.errors.confirmPassword, children: [_jsx(FieldLabel, { htmlFor: "register-confirm-password", children: "Confirm Password" }), _jsx(PasswordInput, { id: "register-confirm-password", autoComplete: "new-password", "aria-invalid": !!form.formState.errors.confirmPassword, ...form.register('confirmPassword') }), _jsx(FieldError, { errors: [form.formState.errors.confirmPassword] })] })] }), submitError && _jsx(ErrorState, { error: submitError }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), "Create Account"] }), _jsx(Button, { variant: "link", size: "sm", nativeButton: false, render: _jsx(Link, { to: "/login", state: location.state }), children: "Sign In Instead" })] }) })] }) }));
58
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.96.0",
3
+ "version": "4.98.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/styles/index.css CHANGED
@@ -661,6 +661,15 @@
661
661
  [data-slot="field-group"] > [data-field-row][data-phone-pair] {
662
662
  width: calc((100% - var(--spacing) * 3) / 2 - 0.05px);
663
663
  }
664
+ /* Two choices (4.98, 9C): each starts as wide as its buttons on one
665
+ line (up to the row), so two that fit share the row, growing into
666
+ what's left, and when they don't the second wraps under the first
667
+ and each grows to the row. */
668
+ [data-slot="field-group"] > [data-field-row][data-phone-fit] {
669
+ flex: 1 1 max-content;
670
+ width: auto;
671
+ max-width: 100%;
672
+ }
664
673
  }
665
674
 
666
675
  /* EntityForm's bar, stuck to the bottom of the window while the form is