@sincpro/web-ui 2.11.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 (148) hide show
  1. package/README.md +35 -3
  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/frame/model.js +1 -1
  11. package/dist/components/guide/index.d.ts +2 -1
  12. package/dist/components/guide/index.js +2 -1
  13. package/dist/components/guide/selector.d.ts +25 -0
  14. package/dist/components/guide/selector.js +14 -0
  15. package/dist/components/guide/target.d.ts +3 -25
  16. package/dist/components/guide/target.js +2 -14
  17. package/dist/components/listing/AxisLevels.d.ts +2 -5
  18. package/dist/components/listing/AxisLevels.js +5 -22
  19. package/dist/components/listing/ColumnsMenu.d.ts +3 -7
  20. package/dist/components/listing/ColumnsMenu.js +4 -8
  21. package/dist/components/listing/collapsed.d.ts +2 -0
  22. package/dist/components/listing/collapsed.js +8 -0
  23. package/dist/components/listing/columnSpecs.d.ts +34 -0
  24. package/dist/components/listing/columnSpecs.js +54 -0
  25. package/dist/components/listing/columns.d.ts +3 -21
  26. package/dist/components/listing/columns.js +2 -39
  27. package/dist/components/listing/index.d.ts +9 -5
  28. package/dist/components/listing/index.js +13 -6
  29. package/dist/components/listing/levels.d.ts +9 -0
  30. package/dist/components/listing/levels.js +27 -0
  31. package/dist/components/listing/pageSizes.d.ts +9 -0
  32. package/dist/components/listing/pageSizes.js +11 -0
  33. package/dist/components/listing/pages.d.ts +2 -9
  34. package/dist/components/listing/pages.js +5 -9
  35. package/dist/components/listing/tree.d.ts +2 -1
  36. package/dist/components/listing/tree.js +4 -5
  37. package/dist/components/preview/FilePreview.d.ts +3 -3
  38. package/dist/components/preview/FilePreview.js +3 -15
  39. package/dist/components/preview/index.d.ts +2 -1
  40. package/dist/components/preview/index.js +2 -1
  41. package/dist/components/preview/previewKind.d.ts +3 -0
  42. package/dist/components/preview/previewKind.js +17 -0
  43. package/dist/components/search/FilterBuilder.d.ts +5 -139
  44. package/dist/components/search/FilterBuilder.js +5 -579
  45. package/dist/components/search/JsonEditor.d.ts +2 -8
  46. package/dist/components/search/JsonEditor.js +5 -15
  47. package/dist/components/search/RuleValue.d.ts +2 -2
  48. package/dist/components/search/RuleValue.js +5 -4
  49. package/dist/components/search/datePeriods.js +1 -1
  50. package/dist/components/search/filterTree.d.ts +183 -0
  51. package/dist/components/search/filterTree.js +570 -0
  52. package/dist/components/search/formatJson.d.ts +8 -0
  53. package/dist/components/search/formatJson.js +17 -0
  54. package/dist/components/search/index.d.ts +5 -3
  55. package/dist/components/search/index.js +7 -3
  56. package/dist/components/search/query.js +1 -1
  57. package/dist/foundations/calendar.js +1 -1
  58. package/dist/foundations/catalog.d.ts +7 -8
  59. package/dist/foundations/catalog.js +10 -35
  60. package/dist/foundations/chart.js +1 -1
  61. package/dist/foundations/controlName.d.ts +12 -0
  62. package/dist/foundations/controlName.js +14 -0
  63. package/dist/foundations/copy.d.ts +3 -1130
  64. package/dist/foundations/copy.es.d.ts +1 -1
  65. package/dist/foundations/copy.js +13 -747
  66. package/dist/foundations/copyStore.d.ts +21 -0
  67. package/dist/foundations/copyStore.js +47 -0
  68. package/dist/foundations/density.d.ts +4 -8
  69. package/dist/foundations/density.js +2 -9
  70. package/dist/foundations/form.d.ts +2 -12
  71. package/dist/foundations/form.js +4 -14
  72. package/dist/foundations/index.d.ts +18 -11
  73. package/dist/foundations/index.js +21 -11
  74. package/dist/foundations/keys.d.ts +8 -0
  75. package/dist/foundations/keys.js +6 -0
  76. package/dist/foundations/pickBy.d.ts +16 -0
  77. package/dist/foundations/pickBy.js +17 -0
  78. package/dist/foundations/pivotSheet.js +0 -0
  79. package/dist/foundations/shortcut.d.ts +3 -9
  80. package/dist/foundations/shortcut.js +2 -7
  81. package/dist/foundations/sticky.d.ts +2 -6
  82. package/dist/foundations/sticky.js +5 -8
  83. package/dist/foundations/stickyStyle.d.ts +12 -0
  84. package/dist/foundations/stickyStyle.js +13 -0
  85. package/dist/foundations/surface.d.ts +2 -2
  86. package/dist/foundations/surface.js +4 -2
  87. package/dist/foundations/theme.d.ts +3 -13
  88. package/dist/foundations/theme.js +2 -15
  89. package/dist/foundations/themeChoice.d.ts +19 -0
  90. package/dist/foundations/themeChoice.js +22 -0
  91. package/dist/foundations/types.d.ts +3 -0
  92. package/dist/foundations/uiCopy.d.ts +1135 -0
  93. package/dist/foundations/uiCopy.js +749 -0
  94. package/dist/foundations/xlsx.d.ts +4 -10
  95. package/dist/foundations/xlsx.js +0 -0
  96. package/dist/foundations/xlsxDownload.d.ts +8 -0
  97. package/dist/foundations/xlsxDownload.js +28 -0
  98. package/dist/primitives/button/Button.d.ts +3 -15
  99. package/dist/primitives/button/Button.js +2 -65
  100. package/dist/primitives/button/classes.d.ts +21 -0
  101. package/dist/primitives/button/classes.js +65 -0
  102. package/dist/primitives/button/index.d.ts +2 -1
  103. package/dist/primitives/button/index.js +3 -1
  104. package/dist/primitives/field/Field.d.ts +2 -6
  105. package/dist/primitives/field/Field.js +4 -10
  106. package/dist/primitives/field/classes.d.ts +6 -0
  107. package/dist/primitives/field/classes.js +13 -0
  108. package/dist/primitives/field/index.d.ts +2 -1
  109. package/dist/primitives/field/index.js +3 -1
  110. package/dist/primitives/menu/Menu.d.ts +2 -19
  111. package/dist/primitives/menu/Menu.js +4 -30
  112. package/dist/primitives/menu/classes.d.ts +18 -0
  113. package/dist/primitives/menu/classes.js +33 -0
  114. package/dist/primitives/menu/index.d.ts +2 -1
  115. package/dist/primitives/menu/index.js +3 -1
  116. package/dist/primitives/table/EditableTable.d.ts +3 -37
  117. package/dist/primitives/table/EditableTable.js +2 -47
  118. package/dist/primitives/table/Table.d.ts +2 -4
  119. package/dist/primitives/table/Table.js +4 -11
  120. package/dist/primitives/table/cellTone.d.ts +5 -0
  121. package/dist/primitives/table/cellTone.js +13 -0
  122. package/dist/primitives/table/editRules.d.ts +43 -0
  123. package/dist/primitives/table/editRules.js +53 -0
  124. package/dist/primitives/table/index.d.ts +4 -2
  125. package/dist/primitives/table/index.js +4 -2
  126. package/dist/primitives/tag/Count.d.ts +2 -3
  127. package/dist/primitives/tag/Count.js +4 -5
  128. package/dist/primitives/tag/countText.d.ts +3 -0
  129. package/dist/primitives/tag/countText.js +7 -0
  130. package/dist/primitives/tag/index.d.ts +2 -1
  131. package/dist/primitives/tag/index.js +2 -1
  132. package/dist/primitives/value/DateValue.d.ts +2 -5
  133. package/dist/primitives/value/DateValue.js +6 -44
  134. package/dist/primitives/value/Meter.d.ts +3 -8
  135. package/dist/primitives/value/Meter.js +2 -9
  136. package/dist/primitives/value/RichText.d.ts +2 -4
  137. package/dist/primitives/value/RichText.js +5 -20
  138. package/dist/primitives/value/Value.d.ts +10 -7
  139. package/dist/primitives/value/Value.js +7 -24
  140. package/dist/primitives/value/format.d.ts +16 -0
  141. package/dist/primitives/value/format.js +81 -0
  142. package/dist/primitives/value/index.d.ts +7 -4
  143. package/dist/primitives/value/index.js +9 -4
  144. package/dist/primitives/value/meterLevel.d.ts +10 -0
  145. package/dist/primitives/value/meterLevel.js +12 -0
  146. package/dist/primitives/value/richTextPlain.d.ts +4 -0
  147. package/dist/primitives/value/richTextPlain.js +23 -0
  148. package/package.json +1 -1
@@ -1,10 +1,7 @@
1
+ import { type CopyOverride, type CopyStore, fillCopy, mergeCopyOver } from "./copyStore.js";
1
2
  import { type ReactNode } from "react";
2
- /** What changes, at any depth. A word is replaced; a section is merged. */
3
- export type CopyOverride<C> = {
4
- [K in keyof C]?: C[K] extends string ? string : C[K] extends readonly unknown[] ? C[K] : C[K] extends object ? CopyOverride<C[K]> : C[K];
5
- };
6
- /** `base` with `over` on top: sections merge, everything else is replaced. */
7
- export declare function mergeCopyOver<C extends object>(base: C, over: CopyOverride<C> | undefined): C;
3
+ export type { CopyOverride };
4
+ export { fillCopy, mergeCopyOver };
8
5
  export type CopyCatalog<C extends object> = {
9
6
  /** The factory words: what is there before anything is installed. */
10
7
  english: C;
@@ -23,5 +20,7 @@ export type CopyCatalog<C extends object> = {
23
20
  useCopy: () => C;
24
21
  };
25
22
  export declare function createCopy<C extends object>(english: C): CopyCatalog<C>;
26
- /** `{name}` → value. A missing key stays visible in the template. */
27
- export declare function fillCopy(template: string, params: Record<string, string | number>): string;
23
+ /** The React half over a store that already exists: web-ui's own words are built in a module
24
+ * without the directive (`uiCopy.ts`), and their `Provider` reads the same installed ones.
25
+ * Not public. */
26
+ export declare function catalogOver<C extends object>(store: CopyStore<C>): CopyCatalog<C>;
@@ -1,48 +1,23 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { copyStore, fillCopy, mergeCopyOver, } from "./copyStore.js";
3
4
  import { createContext, useContext, useMemo } from "react";
4
- const isSection = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5
- /** `base` with `over` on top: sections merge, everything else is replaced. */
6
- export function mergeCopyOver(base, over) {
7
- if (over === undefined)
8
- return base;
9
- const out = { ...base };
10
- for (const [key, value] of Object.entries(over)) {
11
- if (value === undefined)
12
- continue;
13
- const under = out[key];
14
- out[key] = isSection(under) && isSection(value) ? mergeCopyOver(under, value) : value;
15
- }
16
- return out;
17
- }
5
+ export { fillCopy, mergeCopyOver };
18
6
  export function createCopy(english) {
19
- let installed = english;
7
+ return catalogOver(copyStore(english));
8
+ }
9
+ /** The React half over a store that already exists: web-ui's own words are built in a module
10
+ * without the directive (`uiCopy.ts`), and their `Provider` reads the same installed ones.
11
+ * Not public. */
12
+ export function catalogOver(store) {
20
13
  /* `null` and not English: a context keeps the value it was created with, so with the
21
14
  factory words inside it a component without a provider would ignore `install`. */
22
15
  const Context = createContext(null);
23
- const current = () => installed;
24
- const useCopy = () => useContext(Context) ?? installed;
16
+ const useCopy = () => useContext(Context) ?? store.current();
25
17
  function Provider({ copy, children }) {
26
18
  const enclosing = useCopy();
27
19
  const merged = useMemo(() => mergeCopyOver(enclosing, copy), [enclosing, copy]);
28
20
  return _jsx(Context.Provider, { value: merged, children: children });
29
21
  }
30
- return {
31
- english,
32
- install: (over) => {
33
- installed = mergeCopyOver(english, over);
34
- return installed;
35
- },
36
- current,
37
- merge: (over) => mergeCopyOver(english, over),
38
- Provider,
39
- useCopy,
40
- };
41
- }
42
- /** `{name}` → value. A missing key stays visible in the template. */
43
- export function fillCopy(template, params) {
44
- return template.replace(/\{(\w+)\}/g, (whole, name) => {
45
- const value = params[name];
46
- return value === undefined ? whole : String(value);
47
- });
22
+ return { ...store, Provider, useCopy };
48
23
  }
@@ -1,7 +1,7 @@
1
1
  import { dateKeysBetween, dateKeyYear, dateTick } from "./calendar.js";
2
- import { currentCopy, fillCopy } from "./copy.js";
3
2
  import { pathKey } from "./grouping.js";
4
3
  import { axisLabels, } from "./pivot.js";
4
+ import { currentCopy, fillCopy } from "./uiCopy.js";
5
5
  /** The row count of each crossing, offered as one more measure: it is the only one that
6
6
  * can always be answered. */
7
7
  export const COUNT_MEASURE = "__count";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The `aria-label` a control puts on itself: none inside a `Field` — the field's label names
3
+ * it — and outside one the control's own, or as a last resort its placeholder (what a browser
4
+ * reads for a bare `<input placeholder>` anyway, so a control outside a form is never
5
+ * nameless).
6
+ *
7
+ * Context: a control inside a `Field` used to keep its `aria-label` too. With both, React Aria
8
+ * names the control by the label AND itself («Cliente Cliente», «Cantidad cantidad»), so the
9
+ * name was read twice. The field wins: an `aria-label` is for a control that has no label
10
+ * on screen — a table cell, a search box — and inside a field it is ignored.
11
+ */
12
+ export declare function controlName(labelledBy: string | undefined, ariaLabel: string | undefined, fallback?: string): string | undefined;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `aria-label` a control puts on itself: none inside a `Field` — the field's label names
3
+ * it — and outside one the control's own, or as a last resort its placeholder (what a browser
4
+ * reads for a bare `<input placeholder>` anyway, so a control outside a form is never
5
+ * nameless).
6
+ *
7
+ * Context: a control inside a `Field` used to keep its `aria-label` too. With both, React Aria
8
+ * names the control by the label AND itself («Cliente Cliente», «Cantidad cantidad»), so the
9
+ * name was read twice. The field wins: an `aria-label` is for a control that has no label
10
+ * on screen — a table cell, a search box — and inside a field it is ignored.
11
+ */
12
+ export function controlName(labelledBy, ariaLabel, fallback) {
13
+ return labelledBy === undefined ? (ariaLabel ?? fallback) : undefined;
14
+ }