@tristan2828/ui-foundation 4.83.0 → 4.85.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 (43) hide show
  1. package/README.md +1 -1
  2. package/conventions/docs/add-an-entity.md +68 -23
  3. package/conventions/docs/design-language.md +82 -30
  4. package/dist/components/app/entity-form.d.ts +27 -3
  5. package/dist/components/app/entity-form.js +124 -3
  6. package/dist/components/app/form-dialog.js +16 -4
  7. package/dist/components/app/form-leave-guard.d.ts +4 -0
  8. package/dist/components/app/form-leave-guard.js +42 -0
  9. package/dist/components/app/form-section.d.ts +9 -0
  10. package/dist/components/app/form-section.js +15 -0
  11. package/dist/components/app/freshness.d.ts +14 -0
  12. package/dist/components/app/freshness.js +25 -0
  13. package/dist/components/app/list-header.d.ts +44 -0
  14. package/dist/components/app/list-header.js +27 -0
  15. package/dist/components/app/needs-you.d.ts +19 -0
  16. package/dist/components/app/needs-you.js +30 -0
  17. package/dist/components/app/option-select.d.ts +30 -0
  18. package/dist/components/app/option-select.js +21 -0
  19. package/dist/components/app/part-empty.d.ts +20 -0
  20. package/dist/components/app/part-empty.js +17 -0
  21. package/dist/components/app/timeline.d.ts +25 -0
  22. package/dist/components/app/timeline.js +31 -0
  23. package/dist/components/app/value-list.d.ts +14 -0
  24. package/dist/components/app/value-list.js +13 -0
  25. package/dist/components/app/widget-card.d.ts +9 -1
  26. package/dist/components/app/widget-card.js +3 -2
  27. package/dist/components/ui/button.js +1 -1
  28. package/dist/components/ui/combobox.js +1 -1
  29. package/dist/components/ui/field.d.ts +28 -3
  30. package/dist/components/ui/field.js +116 -8
  31. package/dist/components/ui/input-group.js +1 -1
  32. package/dist/components/ui/input.js +1 -1
  33. package/dist/components/ui/select.js +1 -1
  34. package/dist/index.d.ts +11 -0
  35. package/dist/index.js +11 -0
  36. package/dist/lib/field-rows.d.ts +18 -0
  37. package/dist/lib/field-rows.js +53 -0
  38. package/dist/lib/form-errors.d.ts +6 -0
  39. package/dist/lib/form-errors.js +19 -0
  40. package/dist/lib/freshness.d.ts +6 -0
  41. package/dist/lib/freshness.js +37 -0
  42. package/package.json +1 -1
  43. package/styles/index.css +60 -0
@@ -6,7 +6,7 @@ import { Button } from "./button.js";
6
6
  import { Input } from "./input.js";
7
7
  import { Textarea } from "./textarea.js";
8
8
  function InputGroup({ className, ...props }) {
9
- return (_jsx("div", { "data-slot": "input-group", role: "group", className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className), ...props }));
9
+ return (_jsx("div", { "data-slot": "input-group", role: "group", className: cn("group/input-group relative flex h-[var(--control-height,--spacing(9))] w-full min-w-0 items-center rounded-md border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className), ...props }));
10
10
  }
11
11
  const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
12
12
  variants: {
@@ -3,6 +3,6 @@ import * as React from "react";
3
3
  import { Input as InputPrimitive } from "@base-ui/react/input";
4
4
  import { cn } from "cn";
5
5
  function Input({ className, type, ...props }) {
6
- return (_jsx(InputPrimitive, { type: type, "data-slot": "input", className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent palette:text-foreground px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className), ...props }));
6
+ return (_jsx(InputPrimitive, { type: type, "data-slot": "input", className: cn("h-[var(--control-height,--spacing(9))] w-full min-w-0 rounded-md border border-input bg-transparent palette:text-foreground px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className), ...props }));
7
7
  }
8
8
  export { Input };
@@ -12,7 +12,7 @@ function SelectValue({ className, ...props }) {
12
12
  return (_jsx(SelectPrimitive.Value, { "data-slot": "select-value", className: cn("flex flex-1 text-left", className), ...props }));
13
13
  }
14
14
  function SelectTrigger({ className, size = "default", children, ...props }) {
15
- return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent palette:text-foreground py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })] }));
15
+ return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent palette:text-foreground py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-[var(--control-height,--spacing(9))] data-[size=sm]:h-8 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })] }));
16
16
  }
17
17
  function SelectContent({ className, children, side = "bottom", sideOffset = 4, align = "center", alignOffset = 0, alignItemWithTrigger = true, ...props }) {
18
18
  return (_jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, alignItemWithTrigger: alignItemWithTrigger, className: "isolate z-50", children: _jsxs(SelectPrimitive.Popup, { "data-slot": "select-content", "data-align-trigger": alignItemWithTrigger, className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.List, { children: children }), _jsx(SelectScrollDownButton, {})] }) }) }));
package/dist/index.d.ts CHANGED
@@ -13,6 +13,10 @@ export { DataTable, type DataTableCardLayout, type DataTableOpens, type DataTabl
13
13
  export { type RowGroup } from './components/app/table-groups.js';
14
14
  export { byDay, type ByDayOptions } from './lib/group-by-day.js';
15
15
  export { EntityForm, type EntityFormProps } from './components/app/entity-form.js';
16
+ export { countFormErrors } from './lib/form-errors.js';
17
+ export { FormSection, type FormSectionProps } from './components/app/form-section.js';
18
+ export { OptionSelect, type OptionSelectOption, type OptionSelectProps } from './components/app/option-select.js';
19
+ export { fieldRows, type FieldKind, type FieldRowItem, type FieldRowPlace, type FieldSize } from './lib/field-rows.js';
16
20
  export { KeyStats, type KeyStat, type KeyStatsProps } from './components/app/key-stats.js';
17
21
  export { IconAction, type IconActionProps } from './components/app/icon-action.js';
18
22
  export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
@@ -49,6 +53,13 @@ export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionSt
49
53
  export { AllowReminders, type AllowRemindersProps } from './components/app/allow-reminders.js';
50
54
  export { StageCircle, type StageCircleProps, type StageCircleStage, type StageCircleTone, } from './components/app/stage-circle.js';
51
55
  export { Notice, type NoticeProps, type NoticeTone } from './components/app/notice.js';
56
+ export { ValueList, type ValueListItem, type ValueListProps } from './components/app/value-list.js';
57
+ export { ListHeader, type ListHeaderAction, type ListHeaderLink, type ListHeaderProps, } from './components/app/list-header.js';
58
+ export { Timeline, type TimelineItem, type TimelineProps } from './components/app/timeline.js';
59
+ export { NeedsYou, type NeedsYouItem, type NeedsYouProps, type NeedsYouTone } from './components/app/needs-you.js';
60
+ export { Freshness, type FreshnessProps } from './components/app/freshness.js';
61
+ export { isStale } from './lib/freshness.js';
62
+ export { PartEmpty, type PartEmptyAction, type PartEmptyProps, type PartEmptyState } from './components/app/part-empty.js';
52
63
  export { SourceCredit, type Source, type SourceCreditProps } from './components/app/source-credit.js';
53
64
  export { ProgressRing, type ProgressRingProps } from './components/app/progress-ring.js';
54
65
  export { LineChart, type LineChartMark, type LineChartPoint, type LineChartProps, } from './components/app/line-chart.js';
package/dist/index.js CHANGED
@@ -17,6 +17,10 @@ export { DataTable, } from './components/app/data-table.js';
17
17
  export {} from './components/app/table-groups.js';
18
18
  export { byDay } from './lib/group-by-day.js';
19
19
  export { EntityForm } from './components/app/entity-form.js';
20
+ export { countFormErrors } from './lib/form-errors.js';
21
+ export { FormSection } from './components/app/form-section.js';
22
+ export { OptionSelect } from './components/app/option-select.js';
23
+ export { fieldRows } from './lib/field-rows.js';
20
24
  export { KeyStats } from './components/app/key-stats.js';
21
25
  export { IconAction } from './components/app/icon-action.js';
22
26
  export { EntityView, } from './components/app/entity-view.js';
@@ -51,6 +55,13 @@ export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionSt
51
55
  export { AllowReminders } from './components/app/allow-reminders.js';
52
56
  export { StageCircle, } from './components/app/stage-circle.js';
53
57
  export { Notice } from './components/app/notice.js';
58
+ export { ValueList } from './components/app/value-list.js';
59
+ export { ListHeader, } from './components/app/list-header.js';
60
+ export { Timeline } from './components/app/timeline.js';
61
+ export { NeedsYou } from './components/app/needs-you.js';
62
+ export { Freshness } from './components/app/freshness.js';
63
+ export { isStale } from './lib/freshness.js';
64
+ export { PartEmpty } from './components/app/part-empty.js';
54
65
  export { SourceCredit } from './components/app/source-credit.js';
55
66
  export { ProgressRing } from './components/app/progress-ring.js';
56
67
  export { LineChart, } from './components/app/line-chart.js';
@@ -0,0 +1,18 @@
1
+ export type FieldSize = 's' | 'm' | 'l' | 'full';
2
+ export type FieldKind = 'date' | 'number';
3
+ export type FieldRowItem = {
4
+ size: FieldSize;
5
+ solo?: boolean;
6
+ kind?: FieldKind | null;
7
+ };
8
+ export type FieldRowPlace = {
9
+ /** Its share of the row's width (after the gaps), or null for a row of its own. */
10
+ share: number | null;
11
+ /** How many gaps its row has (fields in it, less one). */
12
+ gaps: number;
13
+ /** Stays beside its partner on a phone: two dates or two numbers. */
14
+ phonePair: boolean;
15
+ };
16
+ /** The most fields one row holds. */
17
+ export declare const FIELDS_PER_ROW = 3;
18
+ export declare function fieldRows(items: readonly FieldRowItem[]): FieldRowPlace[];
@@ -0,0 +1,53 @@
1
+ // Which fields of a form share a row (4.85, the form standard's F1),
2
+ // worked out from their order, never listed by hand. A field says how
3
+ // much it holds (`Field size`); consecutive short ones share a row, up to
4
+ // three, each as wide as its size: s 1, m 1.4, l 2.6 parts of the row.
5
+ // A long box (`l`) takes one short partner at most (a series and its
6
+ // number), never another long one, so the row ends with the pair and the
7
+ // next short fields start their own (Started, Finished, Rating). `full`
8
+ // (a field with no size), a `solo` field and anything that isn't a Field
9
+ // take a row of their own.
10
+ //
11
+ // Below 48rem every field takes its own row, except two dates or two
12
+ // numbers next to each other in a row, which stay side by side
13
+ // (`phonePair`).
14
+ const PARTS = { s: 1, m: 1.4, l: 2.6 };
15
+ /** The most fields one row holds. */
16
+ export const FIELDS_PER_ROW = 3;
17
+ export function fieldRows(items) {
18
+ const places = items.map(() => ({ share: null, gaps: 0, phonePair: false }));
19
+ let row = [];
20
+ const close = () => {
21
+ if (row.length > 1) {
22
+ const parts = row.map((at) => PARTS[items[at].size]);
23
+ const total = parts.reduce((sum, part) => sum + part, 0);
24
+ row.forEach((at, index) => {
25
+ places[at] = { share: parts[index] / total, gaps: row.length - 1, phonePair: false };
26
+ });
27
+ for (let index = 0; index + 1 < row.length; index++) {
28
+ const a = items[row[index]].kind;
29
+ const b = items[row[index + 1]].kind;
30
+ if (a && a === b && !places[row[index]].phonePair) {
31
+ places[row[index]].phonePair = true;
32
+ places[row[index + 1]].phonePair = true;
33
+ index++;
34
+ }
35
+ }
36
+ }
37
+ row = [];
38
+ };
39
+ items.forEach((item, at) => {
40
+ const shares = item.size !== 'full' && !item.solo;
41
+ if (!shares) {
42
+ close();
43
+ return;
44
+ }
45
+ 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))
48
+ close();
49
+ row.push(at);
50
+ });
51
+ close();
52
+ return places;
53
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * How many problems react-hook-form's `formState.errors` hold: one per
3
+ * field, one per list's own (`root`), however deep (4.85, EntityForm's
4
+ * "N to fix").
5
+ */
6
+ export declare function countFormErrors(errors: unknown): number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * How many problems react-hook-form's `formState.errors` hold: one per
3
+ * field, one per list's own (`root`), however deep (4.85, EntityForm's
4
+ * "N to fix").
5
+ */
6
+ export function countFormErrors(errors) {
7
+ if (!errors || typeof errors !== 'object')
8
+ return 0;
9
+ const entry = errors;
10
+ if (typeof entry.type === 'string' || typeof entry.message === 'string')
11
+ return 1;
12
+ let count = 0;
13
+ for (const [key, value] of Object.entries(entry)) {
14
+ if (key === 'ref')
15
+ continue;
16
+ count += countFormErrors(value);
17
+ }
18
+ return count;
19
+ }
@@ -0,0 +1,6 @@
1
+ /** A plain day as local midnight, anything else as the instant it names; null when it isn't a date. */
2
+ export declare function toDate(value: Date | string): Date | null;
3
+ /** "Aug 2" this year, "Aug 2, 2025" before it; '' when it isn't a date. */
4
+ export declare function showDate(value: Date | string, now: Date): string;
5
+ /** True once `staleAfter` is before `now`. Never for a missing or unreadable date. */
6
+ export declare function isStale(staleAfter: Date | string | undefined, now?: Date): boolean;
@@ -0,0 +1,37 @@
1
+ // The rules under <Freshness>: reading a date the way the wire writes it,
2
+ // showing it short, and saying whether a limit has passed. A plain day
3
+ // ('YYYY-MM-DD') is a calendar day, never shifted by the time zone; any
4
+ // other string is an instant (an ISO timestamp).
5
+ import { formatPlainDate } from './plain-date.js';
6
+ const PLAIN_DAY = /^\d{4}-\d{2}-\d{2}$/;
7
+ /** A plain day as local midnight, anything else as the instant it names; null when it isn't a date. */
8
+ export function toDate(value) {
9
+ if (value instanceof Date)
10
+ return Number.isNaN(value.getTime()) ? null : value;
11
+ if (PLAIN_DAY.test(value)) {
12
+ const [year, month, day] = value.split('-').map(Number);
13
+ return new Date(year, month - 1, day);
14
+ }
15
+ const parsed = new Date(value);
16
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
17
+ }
18
+ /** "Aug 2" this year, "Aug 2, 2025" before it; '' when it isn't a date. */
19
+ export function showDate(value, now) {
20
+ const date = toDate(value);
21
+ if (!date)
22
+ return '';
23
+ const sameYear = date.getFullYear() === now.getFullYear();
24
+ const options = sameYear
25
+ ? { month: 'short', day: 'numeric' }
26
+ : { month: 'short', day: 'numeric', year: 'numeric' };
27
+ if (typeof value === 'string' && PLAIN_DAY.test(value))
28
+ return formatPlainDate(value, options);
29
+ return date.toLocaleDateString(undefined, options);
30
+ }
31
+ /** True once `staleAfter` is before `now`. Never for a missing or unreadable date. */
32
+ export function isStale(staleAfter, now = new Date()) {
33
+ if (staleAfter === undefined || staleAfter === '')
34
+ return false;
35
+ const limit = toDate(staleAfter);
36
+ return limit !== null && limit.getTime() < now.getTime();
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.83.0",
3
+ "version": "4.85.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
@@ -615,3 +615,63 @@
615
615
  .page-removed .page-removed-note {
616
616
  margin-inline: 0;
617
617
  }
618
+
619
+ /* Forms (4.85, the form standard; field.tsx and entity-form.tsx).
620
+ Compact: controls inside a FieldGroup and on a form's bar read
621
+ --control-height (Input, SelectTrigger, InputGroup, the combobox's chips
622
+ box and a default Button), 32px, or 40px under 48rem or on a touch
623
+ screen, for the finger. Anywhere else they keep their 36px. Each is a
624
+ calc of --spacing, resolved here, so the large density grows it. */
625
+ [data-slot="field-group"],
626
+ [data-slot="entity-form-bar"],
627
+ [data-slot="form-dialog-bar"] {
628
+ --control-height: calc(var(--spacing) * 8);
629
+ }
630
+ @media (width < 48rem), (pointer: coarse) {
631
+ [data-slot="field-group"],
632
+ [data-slot="entity-form-bar"],
633
+ [data-slot="form-dialog-bar"] {
634
+ --control-height: calc(var(--spacing) * 10);
635
+ }
636
+ }
637
+
638
+ /* Short fields side by side (FieldGroup's layOut sets --field-share and
639
+ --field-gaps on each field of a shared row; lib/field-rows.ts): its
640
+ share of what the row's gaps leave. A hair under, so rounding never
641
+ pushes the last one onto the next line. Under 48rem every field takes
642
+ the row but two dates or two numbers. */
643
+ /* Everything else in a group takes the row, as it did when the group was
644
+ a column (a button, a fieldset, a line of text). In the base layer, so
645
+ a width utility on the child still wins. */
646
+ @layer base {
647
+ [data-slot="field-group"] > * {
648
+ width: 100%;
649
+ min-width: 0;
650
+ }
651
+ }
652
+ [data-slot="field-group"] > [data-field-row] {
653
+ flex: 0 0 auto;
654
+ width: calc((100% - var(--field-gaps) * var(--spacing) * 3) * var(--field-share) - 0.05px);
655
+ }
656
+ @media (width < 48rem) {
657
+ [data-slot="field-group"] > [data-field-row] {
658
+ width: 100%;
659
+ }
660
+ [data-slot="field-group"] > [data-field-row][data-phone-pair] {
661
+ width: calc((100% - var(--spacing) * 3) / 2 - 0.05px);
662
+ }
663
+ }
664
+
665
+ /* EntityForm's bar, stuck to the bottom of the window while the form is
666
+ taller than it. Above the shell's bottom bar on a phone, which then
667
+ has the safe area under it already. */
668
+ [data-slot="entity-form-bar"] {
669
+ bottom: var(--form-bar-bottom, 0px);
670
+ padding-bottom: calc(var(--spacing) * 3 + var(--form-bar-safe-area, env(safe-area-inset-bottom)));
671
+ }
672
+ @media (width < 48rem) {
673
+ :root:has([data-slot="app-shell-bottom-bar"]) {
674
+ --form-bar-bottom: calc(var(--spacing) * 16 + 1px + env(safe-area-inset-bottom));
675
+ --form-bar-safe-area: 0px;
676
+ }
677
+ }