@sincpro/web-ui 2.10.0 → 2.12.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 (152) hide show
  1. package/README.md +36 -4
  2. package/dist/components/activity/Messages.d.ts +3 -23
  3. package/dist/components/activity/Messages.js +3 -17
  4. package/dist/components/activity/index.d.ts +2 -1
  5. package/dist/components/activity/index.js +2 -1
  6. package/dist/components/activity/messageKind.d.ts +23 -0
  7. package/dist/components/activity/messageKind.js +17 -0
  8. package/dist/components/assist/assist.d.ts +1 -1
  9. package/dist/components/assist/assist.js +1 -1
  10. package/dist/components/attachments/FileValue.d.ts +10 -0
  11. package/dist/components/attachments/FileValue.js +40 -0
  12. package/dist/components/attachments/index.d.ts +1 -0
  13. package/dist/components/attachments/index.js +3 -1
  14. package/dist/components/frame/model.js +1 -1
  15. package/dist/components/guide/index.d.ts +2 -1
  16. package/dist/components/guide/index.js +2 -1
  17. package/dist/components/guide/selector.d.ts +25 -0
  18. package/dist/components/guide/selector.js +14 -0
  19. package/dist/components/guide/target.d.ts +3 -25
  20. package/dist/components/guide/target.js +2 -14
  21. package/dist/components/listing/AxisLevels.d.ts +2 -5
  22. package/dist/components/listing/AxisLevels.js +5 -22
  23. package/dist/components/listing/ColumnsMenu.d.ts +3 -7
  24. package/dist/components/listing/ColumnsMenu.js +4 -8
  25. package/dist/components/listing/collapsed.d.ts +2 -0
  26. package/dist/components/listing/collapsed.js +8 -0
  27. package/dist/components/listing/columnSpecs.d.ts +34 -0
  28. package/dist/components/listing/columnSpecs.js +54 -0
  29. package/dist/components/listing/columns.d.ts +3 -21
  30. package/dist/components/listing/columns.js +2 -39
  31. package/dist/components/listing/index.d.ts +9 -5
  32. package/dist/components/listing/index.js +13 -6
  33. package/dist/components/listing/levels.d.ts +9 -0
  34. package/dist/components/listing/levels.js +27 -0
  35. package/dist/components/listing/pageSizes.d.ts +9 -0
  36. package/dist/components/listing/pageSizes.js +11 -0
  37. package/dist/components/listing/pages.d.ts +2 -9
  38. package/dist/components/listing/pages.js +5 -9
  39. package/dist/components/listing/tree.d.ts +2 -1
  40. package/dist/components/listing/tree.js +4 -5
  41. package/dist/components/preview/FilePreview.d.ts +3 -3
  42. package/dist/components/preview/FilePreview.js +3 -15
  43. package/dist/components/preview/index.d.ts +2 -1
  44. package/dist/components/preview/index.js +2 -1
  45. package/dist/components/preview/previewKind.d.ts +3 -0
  46. package/dist/components/preview/previewKind.js +17 -0
  47. package/dist/components/search/FilterBuilder.d.ts +5 -139
  48. package/dist/components/search/FilterBuilder.js +5 -579
  49. package/dist/components/search/JsonEditor.d.ts +2 -8
  50. package/dist/components/search/JsonEditor.js +5 -15
  51. package/dist/components/search/RuleValue.d.ts +2 -2
  52. package/dist/components/search/RuleValue.js +5 -4
  53. package/dist/components/search/datePeriods.js +1 -1
  54. package/dist/components/search/filterTree.d.ts +183 -0
  55. package/dist/components/search/filterTree.js +570 -0
  56. package/dist/components/search/formatJson.d.ts +8 -0
  57. package/dist/components/search/formatJson.js +17 -0
  58. package/dist/components/search/index.d.ts +5 -3
  59. package/dist/components/search/index.js +7 -3
  60. package/dist/components/search/query.js +1 -1
  61. package/dist/foundations/calendar.js +1 -1
  62. package/dist/foundations/catalog.d.ts +7 -8
  63. package/dist/foundations/catalog.js +10 -35
  64. package/dist/foundations/chart.js +1 -1
  65. package/dist/foundations/controlName.d.ts +12 -0
  66. package/dist/foundations/controlName.js +14 -0
  67. package/dist/foundations/copy.d.ts +3 -1130
  68. package/dist/foundations/copy.es.d.ts +1 -1
  69. package/dist/foundations/copy.js +13 -747
  70. package/dist/foundations/copyStore.d.ts +21 -0
  71. package/dist/foundations/copyStore.js +47 -0
  72. package/dist/foundations/density.d.ts +4 -8
  73. package/dist/foundations/density.js +2 -9
  74. package/dist/foundations/form.d.ts +2 -12
  75. package/dist/foundations/form.js +4 -14
  76. package/dist/foundations/index.d.ts +18 -11
  77. package/dist/foundations/index.js +21 -11
  78. package/dist/foundations/keys.d.ts +8 -0
  79. package/dist/foundations/keys.js +6 -0
  80. package/dist/foundations/pickBy.d.ts +16 -0
  81. package/dist/foundations/pickBy.js +17 -0
  82. package/dist/foundations/pivotSheet.js +0 -0
  83. package/dist/foundations/shortcut.d.ts +3 -9
  84. package/dist/foundations/shortcut.js +2 -7
  85. package/dist/foundations/sticky.d.ts +2 -6
  86. package/dist/foundations/sticky.js +5 -8
  87. package/dist/foundations/stickyStyle.d.ts +12 -0
  88. package/dist/foundations/stickyStyle.js +13 -0
  89. package/dist/foundations/surface.d.ts +2 -2
  90. package/dist/foundations/surface.js +4 -2
  91. package/dist/foundations/theme.d.ts +3 -13
  92. package/dist/foundations/theme.js +2 -15
  93. package/dist/foundations/themeChoice.d.ts +19 -0
  94. package/dist/foundations/themeChoice.js +22 -0
  95. package/dist/foundations/types.d.ts +3 -0
  96. package/dist/foundations/uiCopy.d.ts +1135 -0
  97. package/dist/foundations/uiCopy.js +749 -0
  98. package/dist/foundations/xlsx.d.ts +4 -10
  99. package/dist/foundations/xlsx.js +0 -0
  100. package/dist/foundations/xlsxDownload.d.ts +8 -0
  101. package/dist/foundations/xlsxDownload.js +28 -0
  102. package/dist/primitives/button/Button.d.ts +3 -15
  103. package/dist/primitives/button/Button.js +2 -65
  104. package/dist/primitives/button/classes.d.ts +21 -0
  105. package/dist/primitives/button/classes.js +65 -0
  106. package/dist/primitives/button/index.d.ts +2 -1
  107. package/dist/primitives/button/index.js +3 -1
  108. package/dist/primitives/field/Field.d.ts +2 -6
  109. package/dist/primitives/field/Field.js +4 -10
  110. package/dist/primitives/field/classes.d.ts +6 -0
  111. package/dist/primitives/field/classes.js +13 -0
  112. package/dist/primitives/field/index.d.ts +2 -1
  113. package/dist/primitives/field/index.js +3 -1
  114. package/dist/primitives/menu/Menu.d.ts +2 -19
  115. package/dist/primitives/menu/Menu.js +4 -30
  116. package/dist/primitives/menu/classes.d.ts +18 -0
  117. package/dist/primitives/menu/classes.js +33 -0
  118. package/dist/primitives/menu/index.d.ts +2 -1
  119. package/dist/primitives/menu/index.js +3 -1
  120. package/dist/primitives/table/EditableTable.d.ts +3 -37
  121. package/dist/primitives/table/EditableTable.js +2 -47
  122. package/dist/primitives/table/Table.d.ts +2 -4
  123. package/dist/primitives/table/Table.js +4 -11
  124. package/dist/primitives/table/cellTone.d.ts +5 -0
  125. package/dist/primitives/table/cellTone.js +13 -0
  126. package/dist/primitives/table/editRules.d.ts +43 -0
  127. package/dist/primitives/table/editRules.js +53 -0
  128. package/dist/primitives/table/index.d.ts +4 -2
  129. package/dist/primitives/table/index.js +4 -2
  130. package/dist/primitives/tag/Count.d.ts +2 -3
  131. package/dist/primitives/tag/Count.js +4 -5
  132. package/dist/primitives/tag/countText.d.ts +3 -0
  133. package/dist/primitives/tag/countText.js +7 -0
  134. package/dist/primitives/tag/index.d.ts +2 -1
  135. package/dist/primitives/tag/index.js +2 -1
  136. package/dist/primitives/value/DateValue.d.ts +2 -5
  137. package/dist/primitives/value/DateValue.js +6 -44
  138. package/dist/primitives/value/Meter.d.ts +3 -8
  139. package/dist/primitives/value/Meter.js +2 -9
  140. package/dist/primitives/value/RichText.d.ts +2 -4
  141. package/dist/primitives/value/RichText.js +5 -20
  142. package/dist/primitives/value/Value.d.ts +10 -7
  143. package/dist/primitives/value/Value.js +7 -24
  144. package/dist/primitives/value/format.d.ts +16 -0
  145. package/dist/primitives/value/format.js +81 -0
  146. package/dist/primitives/value/index.d.ts +7 -4
  147. package/dist/primitives/value/index.js +9 -4
  148. package/dist/primitives/value/meterLevel.d.ts +10 -0
  149. package/dist/primitives/value/meterLevel.js +12 -0
  150. package/dist/primitives/value/richTextPlain.d.ts +4 -0
  151. package/dist/primitives/value/richTextPlain.js +23 -0
  152. package/package.json +1 -1
@@ -29,8 +29,9 @@
29
29
  *
30
30
  * `writeXlsx` returns BYTES and not a file: `Uint8Array` exists
31
31
  * everywhere, and so the same thing serves to download a file, to send it over the network or
32
- * to write it in a test. Downloading it is `downloadXlsx`, which is the only
33
- * function of this file that needs a browser.
32
+ * to write it in a test. Downloading it is `downloadXlsx`, the only piece that needs a
33
+ * browser — so it lives in `xlsxDownload.ts`, with `"use client"`, and this module stays
34
+ * without it: a server component (a route that answers with the file) calls `writeXlsx`.
34
35
  */
35
36
  /** A cell. The position goes in the cell and not in a matrix because a grid
36
37
  * with holes is mostly empty, and a matrix of 288 positions for 40
@@ -76,11 +77,4 @@ export type XlsxSheet = {
76
77
  export declare function columnName(index: number): string;
77
78
  /** The bytes of an `.xlsx` with one sheet. */
78
79
  export declare function writeXlsx(sheet: XlsxSheet): Uint8Array<ArrayBuffer>;
79
- /**
80
- * Download the bytes as a file.
81
- *
82
- * It is the only function of this file that needs a browser, and that is why it is
83
- * separate from `writeXlsx`: what is written and what is downloaded are two things, and
84
- * on the other side —the server, a phone, a test— the second does not exist.
85
- */
86
- export declare function downloadXlsx(name: string, bytes: Uint8Array): void;
80
+ export { downloadXlsx } from "./xlsxDownload.js";
Binary file
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Download the bytes as a file.
3
+ *
4
+ * It is the only piece of the spreadsheet that needs a browser, and that is why it is
5
+ * separate from `writeXlsx` (`xlsx.ts`): what is written and what is downloaded are two
6
+ * things, and on the other side —the server, a phone, a test— the second does not exist.
7
+ */
8
+ export declare function downloadXlsx(name: string, bytes: Uint8Array): void;
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ /**
3
+ * Download the bytes as a file.
4
+ *
5
+ * It is the only piece of the spreadsheet that needs a browser, and that is why it is
6
+ * separate from `writeXlsx` (`xlsx.ts`): what is written and what is downloaded are two
7
+ * things, and on the other side —the server, a phone, a test— the second does not exist.
8
+ */
9
+ export function downloadXlsx(name, bytes) {
10
+ const file = name.endsWith(".xlsx") ? name : `${name}.xlsx`;
11
+ /* A copy, and not the bytes that arrived: a `Blob` only accepts a view
12
+ over a plain `ArrayBuffer`, and what comes through the door might be
13
+ over a shared one. It is a few kilobytes and the alternative is an
14
+ assertion that says it cannot happen. */
15
+ const blob = new Blob([new Uint8Array(bytes)], {
16
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
17
+ });
18
+ const url = URL.createObjectURL(blob);
19
+ const link = document.createElement("a");
20
+ link.href = url;
21
+ link.download = file;
22
+ link.click();
23
+ /* The URL is released after the click, not before: releasing it in the same turn
24
+ cancels the download in some browsers. */
25
+ setTimeout(() => {
26
+ URL.revokeObjectURL(url);
27
+ }, 0);
28
+ }
@@ -1,22 +1,10 @@
1
1
  import type { Surface } from "../../foundations/types.js";
2
+ import { buttonClasses, type ButtonRole, type ButtonSize } from "./classes.js";
2
3
  import { type LucideIcon } from "lucide-react";
3
4
  import type { ComponentPropsWithRef, ReactNode } from "react";
4
- export type ButtonRole = "primary" | "secondary" | "ghost" | "danger";
5
- export type ButtonSize = "sm" | "md" | "lg";
6
5
  export type { Surface };
7
- /** The icon accompanies the label and never replaces it.
8
- *
9
- * Size `sm` (12px) on the small button and `md` (16px) on the medium one, with
10
- * the stroke that belongs to each — see the iconography scale: what stays
11
- * constant is the optical weight, not the number. */
12
- /** The look of a button, without the button.
13
- *
14
- * Context: it exists because there are things that LOOK like a button and are
15
- * not — a menu trigger is the case. Without this, each one copies the classes
16
- * and by the third copy they no longer match: that is exactly what happened
17
- * with «+ Crear», which was the only primary button in the product with a
18
- * different height. */
19
- export declare function buttonClasses(role?: ButtonRole, size?: ButtonSize, surface?: Surface): string;
6
+ export type { ButtonRole, ButtonSize };
7
+ export { buttonClasses };
20
8
  /** What kind of thing a trigger opens. `menu` is the default because it is what the
21
9
  * `expanded` prop always announced; a `PopoverTrigger` opens a `dialog`, a picker a
22
10
  * `listbox`. */
@@ -59,78 +59,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
59
59
  * it would not be a primitive.
60
60
  * ==================================================================== */
61
61
  import { useSurface } from "../../foundations/surface.js";
62
+ import { buttonClasses, } from "./classes.js";
62
63
  import { Tooltip, TooltipTrigger, useInTooltipTrigger, } from "../overlay/Tooltip.js";
63
64
  import { LoaderCircle } from "lucide-react";
64
- /** The height comes from `--size-control-*`; the padding and the type follow.
65
- *
66
- * sm a row, the header of a block
67
- * md the working size — the action bar of a record
68
- * lg a SINGLE, prominent action: a dialog's CTA, an empty state
69
- *
70
- * **Every button in the same row measures the same.** `lg` is not «the
71
- * primary»: it is for when the button is alone. Mixing heights in a bar looks
72
- * like an alignment mistake, not like hierarchy — and hierarchy is already
73
- * done by the color and the weight, which work without changing the size of
74
- * anything.
75
- *
76
- * The padding grows FASTER than the height (3 → 4 → 6). A tall, narrow button
77
- * reads as a stretched icon; what gives it presence is the air on the sides of
78
- * the label, not the height alone. */
79
- const SIZE = {
80
- sm: "h-(--size-control-sm) px-3 gap-1.5 text-meta",
81
- md: "h-(--size-control-md) px-4 gap-2 text-body",
82
- lg: "h-(--size-control-lg) px-6 gap-2 text-lead",
83
- };
84
- /** The weight per role. See the header note: it is not aesthetics, it is half
85
- * of the hierarchy — the half that keeps working out of the corner of your
86
- * eye. */
87
- const WEIGHT = {
88
- primary: "font-semibold",
89
- secondary: "font-medium",
90
- ghost: "font-medium",
91
- danger: "font-semibold",
92
- };
93
- /** Each role on its two surfaces. The table exists so that adding a third
94
- * surface is one column here and not an `if` scattered across the tree — and
95
- * so that the day a combination is missing, the compiler says so. */
96
- const ROLE = {
97
- primary: {
98
- // `btn-accent` is the brand gradient, use 3 of 4. Barely a glint of metal:
99
- // a strong gradient turns a tool into a landing page.
100
- canvas: "btn-accent border border-transparent hover:brightness-[1.04] active:brightness-95",
101
- chrome: "btn-accent border border-transparent hover:brightness-[1.04] active:brightness-95",
102
- },
103
- secondary: {
104
- // Quiet on purpose. The blue belongs to `ghost` (go) and the gold to
105
- // `primary` (do). A secondary painted in the action color is a second
106
- // primary, which is the defect this file exists to stop.
107
- canvas: "border border-line-strong bg-ink/6 text-ink hover:bg-ink/10",
108
- chrome: "border border-chrome-muted/30 bg-chrome-raised text-chrome-ink hover:bg-chrome-ink/10",
109
- },
110
- ghost: {
111
- canvas: "border border-transparent text-primary hover:bg-primary/8",
112
- chrome: "border border-transparent text-chrome-link hover:bg-chrome-ink/8",
113
- },
114
- danger: {
115
- canvas: "border border-transparent bg-danger text-surface hover:bg-danger-hover",
116
- chrome: "border border-transparent bg-danger text-surface hover:bg-danger-hover",
117
- },
118
- };
65
+ export { buttonClasses };
119
66
  /** The icon accompanies the label and never replaces it.
120
67
  *
121
68
  * Size `sm` (12px) on the small button and `md` (16px) on the medium one, with
122
69
  * the stroke that belongs to each — see the iconography scale: what stays
123
70
  * constant is the optical weight, not the number. */
124
- /** The look of a button, without the button.
125
- *
126
- * Context: it exists because there are things that LOOK like a button and are
127
- * not — a menu trigger is the case. Without this, each one copies the classes
128
- * and by the third copy they no longer match: that is exactly what happened
129
- * with «+ Crear», which was the only primary button in the product with a
130
- * different height. */
131
- export function buttonClasses(role = "secondary", size = "md", surface = "canvas") {
132
- return `inline-flex shrink-0 items-center justify-center rounded-ui-button whitespace-nowrap transition-[background-color,border-color,filter,color] duration-(--duration-instant) ease-(--ease-out) disabled:pointer-events-none disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${SIZE[size]} ${WEIGHT[role]} ${ROLE[role][surface]}`;
133
- }
134
71
  const ICON = {
135
72
  sm: { size: "size-(--size-icon-sm)", stroke: 2 },
136
73
  md: { size: "size-(--size-icon-md)", stroke: 1.75 },
@@ -0,0 +1,21 @@
1
+ import type { Surface } from "../../foundations/types.js";
2
+ /**
3
+ * THE LOOK OF A BUTTON, as classes — the four roles, the three sizes, the two surfaces. See
4
+ * the long note at the top of `Button.tsx` for why there are four roles and not one more.
5
+ *
6
+ * Context: it lives apart from `Button` because `Button.tsx` carries `"use client"` (a button
7
+ * reads its surface from context), and a React Server Components bundler turns every export
8
+ * of a client module into a client reference: `buttonClasses("primary", "md")` called from a
9
+ * server component returned a reference instead of a class string. Here, without the
10
+ * directive, it is a function anywhere.
11
+ */
12
+ export type ButtonRole = "primary" | "secondary" | "ghost" | "danger";
13
+ export type ButtonSize = "sm" | "md" | "lg";
14
+ /** The look of a button, without the button.
15
+ *
16
+ * Context: it exists because there are things that LOOK like a button and are
17
+ * not — a menu trigger is the case. Without this, each one copies the classes
18
+ * and by the third copy they no longer match: that is exactly what happened
19
+ * with «+ Crear», which was the only primary button in the product with a
20
+ * different height. */
21
+ export declare function buttonClasses(role?: ButtonRole, size?: ButtonSize, surface?: Surface): string;
@@ -0,0 +1,65 @@
1
+ /** The height comes from `--size-control-*`; the padding and the type follow.
2
+ *
3
+ * sm a row, the header of a block
4
+ * md the working size — the action bar of a record
5
+ * lg a SINGLE, prominent action: a dialog's CTA, an empty state
6
+ *
7
+ * **Every button in the same row measures the same.** `lg` is not «the
8
+ * primary»: it is for when the button is alone. Mixing heights in a bar looks
9
+ * like an alignment mistake, not like hierarchy — and hierarchy is already
10
+ * done by the color and the weight, which work without changing the size of
11
+ * anything.
12
+ *
13
+ * The padding grows FASTER than the height (3 → 4 → 6). A tall, narrow button
14
+ * reads as a stretched icon; what gives it presence is the air on the sides of
15
+ * the label, not the height alone. */
16
+ const SIZE = {
17
+ sm: "h-(--size-control-sm) px-3 gap-1.5 text-meta",
18
+ md: "h-(--size-control-md) px-4 gap-2 text-body",
19
+ lg: "h-(--size-control-lg) px-6 gap-2 text-lead",
20
+ };
21
+ /** The weight per role. See the header note: it is not aesthetics, it is half
22
+ * of the hierarchy — the half that keeps working out of the corner of your
23
+ * eye. */
24
+ const WEIGHT = {
25
+ primary: "font-semibold",
26
+ secondary: "font-medium",
27
+ ghost: "font-medium",
28
+ danger: "font-semibold",
29
+ };
30
+ /** Each role on its two surfaces. The table exists so that adding a third
31
+ * surface is one column here and not an `if` scattered across the tree — and
32
+ * so that the day a combination is missing, the compiler says so. */
33
+ const ROLE = {
34
+ primary: {
35
+ // `btn-accent` is the brand gradient, use 3 of 4. Barely a glint of metal:
36
+ // a strong gradient turns a tool into a landing page.
37
+ canvas: "btn-accent border border-transparent hover:brightness-[1.04] active:brightness-95",
38
+ chrome: "btn-accent border border-transparent hover:brightness-[1.04] active:brightness-95",
39
+ },
40
+ secondary: {
41
+ // Quiet on purpose. The blue belongs to `ghost` (go) and the gold to
42
+ // `primary` (do). A secondary painted in the action color is a second
43
+ // primary, which is the defect this file exists to stop.
44
+ canvas: "border border-line-strong bg-ink/6 text-ink hover:bg-ink/10",
45
+ chrome: "border border-chrome-muted/30 bg-chrome-raised text-chrome-ink hover:bg-chrome-ink/10",
46
+ },
47
+ ghost: {
48
+ canvas: "border border-transparent text-primary hover:bg-primary/8",
49
+ chrome: "border border-transparent text-chrome-link hover:bg-chrome-ink/8",
50
+ },
51
+ danger: {
52
+ canvas: "border border-transparent bg-danger text-surface hover:bg-danger-hover",
53
+ chrome: "border border-transparent bg-danger text-surface hover:bg-danger-hover",
54
+ },
55
+ };
56
+ /** The look of a button, without the button.
57
+ *
58
+ * Context: it exists because there are things that LOOK like a button and are
59
+ * not — a menu trigger is the case. Without this, each one copies the classes
60
+ * and by the third copy they no longer match: that is exactly what happened
61
+ * with «+ Crear», which was the only primary button in the product with a
62
+ * different height. */
63
+ export function buttonClasses(role = "secondary", size = "md", surface = "canvas") {
64
+ return `inline-flex shrink-0 items-center justify-center rounded-ui-button whitespace-nowrap transition-[background-color,border-color,filter,color] duration-(--duration-instant) ease-(--ease-out) disabled:pointer-events-none disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${SIZE[size]} ${WEIGHT[role]} ${ROLE[role][surface]}`;
65
+ }
@@ -1 +1,2 @@
1
- export { Button, buttonClasses, ButtonLink, type ButtonLinkProps, type ButtonPopup, type ButtonProps, type ButtonRole, type ButtonSize, IconButton, type IconButtonProps, IconLink, type IconLinkProps, type IconTone, } from "./Button.js";
1
+ export { Button, ButtonLink, type ButtonLinkProps, type ButtonPopup, type ButtonProps, IconButton, type IconButtonProps, IconLink, type IconLinkProps, type IconTone, } from "./Button.js";
2
+ export { buttonClasses, type ButtonRole, type ButtonSize, } from "./classes.js";
@@ -1,2 +1,4 @@
1
1
  /* DO. Four roles, three sizes, two surfaces. */
2
- export { Button, buttonClasses, ButtonLink, IconButton, IconLink, } from "./Button.js";
2
+ export { Button, ButtonLink, IconButton, IconLink, } from "./Button.js";
3
+ /* The look without the button, without `"use client"`: a server component calls it. */
4
+ export { buttonClasses, } from "./classes.js";
@@ -1,5 +1,6 @@
1
1
  import { type FieldIds } from "../../foundations/form.js";
2
2
  import { type FormMode } from "../../foundations/form.js";
3
+ import { controlClasses } from "./classes.js";
3
4
  import { type FieldNote } from "./note.js";
4
5
  import { type Rounding } from "../value/rounding.js";
5
6
  import { type ReactNode } from "react";
@@ -82,12 +83,7 @@ export declare function ReadValue({ value, mono }: {
82
83
  value: ReactNode;
83
84
  mono?: boolean;
84
85
  }): import("react").JSX.Element;
85
- /** The shared look of everything that is written into or chosen from.
86
- *
87
- * It exists as a function and not as a loose class so that a new control cannot
88
- * be born with another height, another radius or another focus. That was the
89
- * original defect: every file wrote its own `<input className="…">`. */
90
- export declare function controlClasses(invalid?: boolean): string;
86
+ export { controlClasses };
91
87
  /** What every text control shares: the field's wiring, overridable prop by prop. Exported for
92
88
  * the family's other controls (`PasswordInput`, `CardNumberInput`), not from the barrel. */
93
89
  export type ControlProps = {
@@ -7,6 +7,7 @@ import { FieldIdsContext, useFieldIds, } from "../../foundations/form.js";
7
7
  import { controlName, FormModeProvider, useFormMode, useFormStyle, } from "../../foundations/form.js";
8
8
  import { focusRing, tv } from "../../foundations/variants.js";
9
9
  import { FieldGroup, listOptionStyles } from "./aria.js";
10
+ import { controlClasses } from "./classes.js";
10
11
  import { FieldCopy, useFieldCopy } from "./clipboard.js";
11
12
  import { useSheetLayout } from "./layout.js";
12
13
  import { describedByOf, NoteCard, NoteFlag, } from "./note.js";
@@ -151,16 +152,9 @@ export function ReadValue({ value, mono = false }) {
151
152
  const empty = value === undefined || value === null || value === "";
152
153
  return (_jsx("span", { className: `flex min-h-(--size-control-md) min-w-0 items-center text-meta ${empty ? "text-muted italic" : "text-ink"} ${mono ? "font-mono tabular-nums" : ""}`, children: empty ? unset : value }));
153
154
  }
154
- /** The shared look of everything that is written into or chosen from.
155
- *
156
- * It exists as a function and not as a loose class so that a new control cannot
157
- * be born with another height, another radius or another focus. That was the
158
- * original defect: every file wrote its own `<input className="…">`. */
159
- export function controlClasses(invalid = false) {
160
- return `h-(--size-control-md) w-full min-w-0 rounded-ui-control border bg-ui-control px-2.5 text-meta text-ink transition-colors duration-(--duration-instant) placeholder:text-muted focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:bg-ground disabled:text-muted ${invalid
161
- ? "border-danger focus-visible:border-danger focus-visible:outline-danger"
162
- : "border-ui-control-border focus-visible:border-primary focus-visible:outline-primary"}`;
163
- }
155
+ /* `controlClasses` is a plain function (`classes.ts`), without the directive, so a server
156
+ component reads it; re-exported so every path that read it here keeps reading it. */
157
+ export { controlClasses };
164
158
  /* `aria-describedby` goes on the INPUT and not on React Aria's field: the field adds the ids
165
159
  of its own description and error slots, which this system never renders (`Field` draws
166
160
  them), and the input's own prop replaces that list with the field's real one. */
@@ -0,0 +1,6 @@
1
+ /** The shared look of everything that is written into or chosen from.
2
+ *
3
+ * It exists as a function and not as a loose class so that a new control cannot
4
+ * be born with another height, another radius or another focus. That was the
5
+ * original defect: every file wrote its own `<input className="…">`. */
6
+ export declare function controlClasses(invalid?: boolean): string;
@@ -0,0 +1,13 @@
1
+ /* Without `"use client"`: `Field.tsx` carries it (a control reads its field from context), and
2
+ a React Server Components bundler turns every export of a client module into a client
3
+ reference — the class string a server component asked for came back as a reference. */
4
+ /** The shared look of everything that is written into or chosen from.
5
+ *
6
+ * It exists as a function and not as a loose class so that a new control cannot
7
+ * be born with another height, another radius or another focus. That was the
8
+ * original defect: every file wrote its own `<input className="…">`. */
9
+ export function controlClasses(invalid = false) {
10
+ return `h-(--size-control-md) w-full min-w-0 rounded-ui-control border bg-ui-control px-2.5 text-meta text-ink transition-colors duration-(--duration-instant) placeholder:text-muted focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:bg-ground disabled:text-muted ${invalid
11
+ ? "border-danger focus-visible:border-danger focus-visible:outline-danger"
12
+ : "border-ui-control-border focus-visible:border-primary focus-visible:outline-primary"}`;
13
+ }
@@ -9,7 +9,8 @@ export { FieldCopyProvider, shownText, useFieldCopy, } from "./clipboard.js";
9
9
  export { DropZone, type DropZoneProps } from "./DropZone.js";
10
10
  export { formatDuration, parseDuration } from "./duration.js";
11
11
  export { DurationInput } from "./DurationInput.js";
12
- export { controlClasses, DataField, Field, NumberInput, ReadValue, Select, type SelectOption, TextArea, TextInput, } from "./Field.js";
12
+ export { controlClasses } from "./classes.js";
13
+ export { DataField, Field, NumberInput, ReadValue, Select, type SelectOption, TextArea, TextInput, } from "./Field.js";
13
14
  export { type ImageChange, ImageInput } from "./ImageInput.js";
14
15
  export { type FieldLayout, FieldLayoutProvider, useSheetLayout, } from "./layout.js";
15
16
  export { PasswordInput } from "./PasswordInput.js";
@@ -19,7 +19,9 @@ export { DropZone } from "./DropZone.js";
19
19
  /* A duration in hours, read «8:30». */
20
20
  export { formatDuration, parseDuration } from "./duration.js";
21
21
  export { DurationInput } from "./DurationInput.js";
22
- export { controlClasses, DataField, Field, NumberInput, ReadValue, Select, TextArea, TextInput, } from "./Field.js";
22
+ /* The look every control shares, without `"use client"`: a server component calls it. */
23
+ export { controlClasses } from "./classes.js";
24
+ export { DataField, Field, NumberInput, ReadValue, Select, TextArea, TextInput, } from "./Field.js";
23
25
  /* An image the record holds (chosen, dropped, pasted, cropped) and a signature (drawn or typed). */
24
26
  export { ImageInput } from "./ImageInput.js";
25
27
  export { FieldLayoutProvider, useSheetLayout, } from "./layout.js";
@@ -1,4 +1,5 @@
1
1
  import { type ButtonRole, type ButtonSize } from "../button/Button.js";
2
+ import { menuTriggerClasses } from "./classes.js";
2
3
  import type { LucideIcon } from "lucide-react";
3
4
  import { type ReactNode } from "react";
4
5
  import { type Key } from "react-aria-components";
@@ -74,24 +75,7 @@ declare const WIDTH: {
74
75
  /** Every option of the tree by id, children included: a submenu is a separate React Aria
75
76
  * menu with its own `onAction`, and both have to reach the same handlers. */
76
77
  export declare function indexOptions(options: readonly MenuOption[], into?: Map<string, MenuOption>): Map<string, MenuOption>;
77
- /**
78
- * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
79
- * the menu.
80
- *
81
- * Context: a control of the bar that opens a PANEL and not a list of options (the sort
82
- * criteria) still has to look like its neighbours; copying these classes is how the third
83
- * trigger ends up one pixel off. Same reason `buttonClasses` exists.
84
- */
85
- export declare function menuTriggerClasses({ variant, surface, active, current, open, focusVisible, iconOnly, }: {
86
- variant?: "button" | "text";
87
- surface?: "canvas" | "chrome";
88
- active?: boolean;
89
- /** The screen on view is inside this menu: a bar under the label. */
90
- current?: boolean;
91
- open?: boolean;
92
- focusVisible?: boolean;
93
- iconOnly?: boolean;
94
- }): string;
78
+ export { menuTriggerClasses };
95
79
  export declare function Menu({ label, groups, onSelect, surface, align, icon: Trigger,
96
80
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
97
81
  * actions `⋯` does not, because the icon already says there is more. */
@@ -164,4 +148,3 @@ export declare function MenuList({ label, groups, onAction, closeOnSelect, empty
164
148
  /** `false` shows every `collapsible` section open — under a search box. */
165
149
  foldable?: boolean;
166
150
  }): import("react").JSX.Element;
167
- export {};
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { buttonClasses, } from "../button/Button.js";
5
+ import { menuTriggerClasses } from "./classes.js";
5
6
  import { Popover } from "../overlay/Popover.js";
6
7
  import { Count } from "../tag/Count.js";
7
8
  import { Check, ChevronDown, ChevronRight } from "lucide-react";
@@ -39,36 +40,9 @@ export function indexOptions(options, into = new Map()) {
39
40
  }
40
41
  return into;
41
42
  }
42
- /**
43
- * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
44
- * the menu.
45
- *
46
- * Context: a control of the bar that opens a PANEL and not a list of options (the sort
47
- * criteria) still has to look like its neighbours; copying these classes is how the third
48
- * trigger ends up one pixel off. Same reason `buttonClasses` exists.
49
- */
50
- export function menuTriggerClasses({ variant = "button", surface = "canvas", active = false, current = false, open = false, focusVisible = false, iconOnly = false, }) {
51
- /* `text` is the menu of a BAR: no frame and no background, just the highlight
52
- on hover. Five bordered menus on top of an application are five buttons
53
- competing with the ones in the view, and the bar stops reading as an index.
54
- `button` is the menu of a CONTROL —"filters ▾", "group ▾"—, and there the
55
- frame is what says it can be pressed. */
56
- const tone = variant === "text"
57
- ? surface === "chrome"
58
- ? `border-transparent text-chrome-muted hover:bg-chrome-ink/12 hover:text-chrome-ink ${active || open ? "bg-chrome-ink/12 text-chrome-ink" : ""}`
59
- : `border-transparent text-muted hover:bg-ink/6 hover:text-ink ${active || open ? "bg-ink/6 text-ink" : ""}`
60
- : surface === "chrome"
61
- ? `border-chrome-muted/35 bg-chrome-raised text-chrome-ink hover:border-chrome-accent/45 ${active ? "border-chrome-accent/60" : ""}`
62
- : `border-line-strong bg-surface hover:border-primary/45 hover:bg-primary/5 ${active ? "border-primary/60 text-primary" : "text-ink"}`;
63
- /* «Here» is a SHAPE under the label, in the colour that marks the place on each surface:
64
- the gold on the chrome (where it is legible, 6.70:1), the navy on the canvas. */
65
- const here = current
66
- ? `relative after:absolute after:inset-x-2.5 after:bottom-0.5 after:h-0.5 after:rounded-pill ${surface === "chrome"
67
- ? "text-chrome-ink after:bg-chrome-accent"
68
- : "text-ink after:bg-primary"}`
69
- : "";
70
- return `inline-flex h-(--size-control-sm) shrink-0 cursor-default items-center gap-1.5 border text-micro font-medium whitespace-nowrap outline-0 transition-colors duration-(--duration-instant) ${focusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${iconOnly ? "w-(--size-control-sm) justify-center rounded-pill" : "rounded-control px-2.5"} ${tone} ${here}`;
71
- }
43
+ /* `menuTriggerClasses` is a plain function (`classes.ts`), without the directive, so a server
44
+ component reads it; re-exported so every path that read it here keeps reading it. */
45
+ export { menuTriggerClasses };
72
46
  export function Menu({ label, groups, onSelect, surface = "canvas", align = "start", icon: Trigger,
73
47
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
74
48
  * actions `⋯` does not, because the icon already says there is more. */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
3
+ * the menu.
4
+ *
5
+ * Context: a control of the bar that opens a PANEL and not a list of options (the sort
6
+ * criteria) still has to look like its neighbours; copying these classes is how the third
7
+ * trigger ends up one pixel off. Same reason `buttonClasses` exists.
8
+ */
9
+ export declare function menuTriggerClasses({ variant, surface, active, current, open, focusVisible, iconOnly, }: {
10
+ variant?: "button" | "text";
11
+ surface?: "canvas" | "chrome";
12
+ active?: boolean;
13
+ /** The screen on view is inside this menu: a bar under the label. */
14
+ current?: boolean;
15
+ open?: boolean;
16
+ focusVisible?: boolean;
17
+ iconOnly?: boolean;
18
+ }): string;
@@ -0,0 +1,33 @@
1
+ /* Without `"use client"`: `Menu.tsx` carries it, and a React Server Components bundler turns
2
+ every export of a client module into a client reference — a class string asked for on the
3
+ server came back as a reference. */
4
+ /**
5
+ * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
6
+ * the menu.
7
+ *
8
+ * Context: a control of the bar that opens a PANEL and not a list of options (the sort
9
+ * criteria) still has to look like its neighbours; copying these classes is how the third
10
+ * trigger ends up one pixel off. Same reason `buttonClasses` exists.
11
+ */
12
+ export function menuTriggerClasses({ variant = "button", surface = "canvas", active = false, current = false, open = false, focusVisible = false, iconOnly = false, }) {
13
+ /* `text` is the menu of a BAR: no frame and no background, just the highlight
14
+ on hover. Five bordered menus on top of an application are five buttons
15
+ competing with the ones in the view, and the bar stops reading as an index.
16
+ `button` is the menu of a CONTROL —"filters ▾", "group ▾"—, and there the
17
+ frame is what says it can be pressed. */
18
+ const tone = variant === "text"
19
+ ? surface === "chrome"
20
+ ? `border-transparent text-chrome-muted hover:bg-chrome-ink/12 hover:text-chrome-ink ${active || open ? "bg-chrome-ink/12 text-chrome-ink" : ""}`
21
+ : `border-transparent text-muted hover:bg-ink/6 hover:text-ink ${active || open ? "bg-ink/6 text-ink" : ""}`
22
+ : surface === "chrome"
23
+ ? `border-chrome-muted/35 bg-chrome-raised text-chrome-ink hover:border-chrome-accent/45 ${active ? "border-chrome-accent/60" : ""}`
24
+ : `border-line-strong bg-surface hover:border-primary/45 hover:bg-primary/5 ${active ? "border-primary/60 text-primary" : "text-ink"}`;
25
+ /* «Here» is a SHAPE under the label, in the colour that marks the place on each surface:
26
+ the gold on the chrome (where it is legible, 6.70:1), the navy on the canvas. */
27
+ const here = current
28
+ ? `relative after:absolute after:inset-x-2.5 after:bottom-0.5 after:h-0.5 after:rounded-pill ${surface === "chrome"
29
+ ? "text-chrome-ink after:bg-chrome-accent"
30
+ : "text-ink after:bg-primary"}`
31
+ : "";
32
+ return `inline-flex h-(--size-control-sm) shrink-0 cursor-default items-center gap-1.5 border text-micro font-medium whitespace-nowrap outline-0 transition-colors duration-(--duration-instant) ${focusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${iconOnly ? "w-(--size-control-sm) justify-center rounded-pill" : "rounded-control px-2.5"} ${tone} ${here}`;
33
+ }
@@ -1 +1,2 @@
1
- export { Menu, type MenuGroup, type MenuOption, menuTriggerClasses, } from "./Menu.js";
1
+ export { Menu, type MenuGroup, type MenuOption } from "./Menu.js";
2
+ export { menuTriggerClasses } from "./classes.js";
@@ -1,2 +1,4 @@
1
1
  /* A data-driven dropdown: the actions `⋯` and "+ Create". */
2
- export { Menu, menuTriggerClasses, } from "./Menu.js";
2
+ export { Menu } from "./Menu.js";
3
+ /* A trigger's look without the menu, without `"use client"`: a server component calls it. */
4
+ export { menuTriggerClasses } from "./classes.js";
@@ -1,10 +1,10 @@
1
1
  import { type Grouping } from "../../foundations/grouping.js";
2
2
  import { type FlagProps } from "../notice/Flag.js";
3
+ import { sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget } from "./editRules.js";
3
4
  import { type WindowedRow } from "./rowWindow.js";
4
5
  import { type ReactNode } from "react";
5
- /** Where a column goes when the row is drawn as a stacked card (a narrow box).
6
- * `trail` sits at the top right, beside the title — a state, the row's buttons. */
7
- export type StackPlace = "title" | "detail" | "amount" | "trail" | "hidden";
6
+ export type { StackPlace, TabTarget };
7
+ export { sectionLines, stackPlaces, tabTarget };
8
8
  /** How the rows are drawn: `auto` measures the box and stacks them below
9
9
  * `--container-handheld`; `table` and `stacked` force one — a side panel that is
10
10
  * always narrow, a test that has no box to measure. */
@@ -84,43 +84,9 @@ export type EditAdd = {
84
84
  /** As `onAdd`: return the new row's id and it opens. */
85
85
  onAdd: () => string | void | Promise<string | void>;
86
86
  };
87
- /** The lines each section heads: the rows after it up to the next section. Notes do not
88
- * cut a section, and are not lines. */
89
- export declare function sectionLines<T>(rows: readonly T[], getRowId: (row: T) => string, kind: (row: T) => "section" | "note" | null): Map<string, T[]>;
90
- /**
91
- * Where each column goes in the stacked card, defaults resolved: a declared `stack`
92
- * wins; otherwise the first undeclared column is the title (unless one was declared),
93
- * the last undeclared numeric one is the amount (unless one was declared), and the rest
94
- * are detail.
95
- */
96
- export declare function stackPlaces(columns: readonly {
97
- stack?: StackPlace;
98
- numeric?: boolean;
99
- }[]): StackPlace[];
100
87
  /** The first control of a row being edited: the first one in an editable cell, else
101
88
  * anything focusable in the row (a column without `edit` may still hold a button). */
102
89
  export declare function firstControl(row: HTMLElement): HTMLElement | null;
103
- /** Where `Tab` goes from the edge of an edited row: the next or previous row opened, a new
104
- * row added, or out of the table the browser's way. */
105
- export type TabTarget = {
106
- kind: "row";
107
- id: string;
108
- } | {
109
- kind: "add";
110
- } | {
111
- kind: "leave";
112
- };
113
- /**
114
- * Where `Tab` past the last control (`next`) or `Shift+Tab` before the first (`prev`) of
115
- * the edited row `from` goes, over the rows in the order they are drawn.
116
- *
117
- * Past the last row it adds one when the table can — unless `from` is itself a row just
118
- * added and still blank: one more `Tab` there means «I am done», not «another blank line».
119
- */
120
- export declare function tabTarget(order: readonly string[], from: string, direction: "next" | "prev", { canAdd, blank }: {
121
- canAdd: boolean;
122
- blank: boolean;
123
- }): TabTarget;
124
90
  export type RowKey = "ArrowDown" | "ArrowUp" | "Home" | "End";
125
91
  /**
126
92
  * One body row. Its own component so that it can hold React Aria's `useKeyboard`