@fiestaboard/ui 3.0.1 → 3.2.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 (115) hide show
  1. package/dist/components/containment/json-tree.d.ts +59 -0
  2. package/dist/components/containment/json-tree.js +122 -0
  3. package/dist/components/containment/json-tree.js.map +1 -0
  4. package/dist/components/editor/color-picker-content.d.ts +25 -0
  5. package/dist/components/editor/color-picker-content.js +118 -0
  6. package/dist/components/editor/color-picker-content.js.map +1 -0
  7. package/dist/components/editor/constants.d.ts +87 -0
  8. package/dist/components/editor/constants.js +29 -0
  9. package/dist/components/editor/constants.js.map +1 -0
  10. package/dist/components/editor/draw-char-picker-content.d.ts +22 -0
  11. package/dist/components/editor/draw-char-picker-content.js +79 -0
  12. package/dist/components/editor/draw-char-picker-content.js.map +1 -0
  13. package/dist/components/editor/extensions/color-tile-node.d.ts +10 -0
  14. package/dist/components/editor/extensions/color-tile-node.js +43 -0
  15. package/dist/components/editor/extensions/color-tile-node.js.map +1 -0
  16. package/dist/components/editor/extensions/fill-space-node.d.ts +10 -0
  17. package/dist/components/editor/extensions/fill-space-node.js +40 -0
  18. package/dist/components/editor/extensions/fill-space-node.js.map +1 -0
  19. package/dist/components/editor/extensions/formula-node.d.ts +6 -0
  20. package/dist/components/editor/extensions/formula-node.js +40 -0
  21. package/dist/components/editor/extensions/formula-node.js.map +1 -0
  22. package/dist/components/editor/extensions/line-navigation.d.ts +18 -0
  23. package/dist/components/editor/extensions/line-navigation.js +16 -0
  24. package/dist/components/editor/extensions/line-navigation.js.map +1 -0
  25. package/dist/components/editor/extensions/single-paragraph-doc.d.ts +15 -0
  26. package/dist/components/editor/extensions/single-paragraph-doc.js +11 -0
  27. package/dist/components/editor/extensions/single-paragraph-doc.js.map +1 -0
  28. package/dist/components/editor/extensions/trailing-newline.d.ts +13 -0
  29. package/dist/components/editor/extensions/trailing-newline.js +27 -0
  30. package/dist/components/editor/extensions/trailing-newline.js.map +1 -0
  31. package/dist/components/editor/extensions/variable-node.d.ts +15 -0
  32. package/dist/components/editor/extensions/variable-node.js +56 -0
  33. package/dist/components/editor/extensions/variable-node.js.map +1 -0
  34. package/dist/components/editor/extensions/wrapped-text-node.d.ts +9 -0
  35. package/dist/components/editor/extensions/wrapped-text-node.js +31 -0
  36. package/dist/components/editor/extensions/wrapped-text-node.js.map +1 -0
  37. package/dist/components/editor/filter-picker-content.d.ts +24 -0
  38. package/dist/components/editor/filter-picker-content.js +146 -0
  39. package/dist/components/editor/filter-picker-content.js.map +1 -0
  40. package/dist/components/editor/formatting-picker-content.d.ts +30 -0
  41. package/dist/components/editor/formatting-picker-content.js +154 -0
  42. package/dist/components/editor/formatting-picker-content.js.map +1 -0
  43. package/dist/components/editor/formula/formula-editor-panel.d.ts +102 -0
  44. package/dist/components/editor/formula/formula-editor-panel.js +527 -0
  45. package/dist/components/editor/formula/formula-editor-panel.js.map +1 -0
  46. package/dist/components/editor/node-views/color-tile-node-view.d.ts +21 -0
  47. package/dist/components/editor/node-views/color-tile-node-view.js +66 -0
  48. package/dist/components/editor/node-views/color-tile-node-view.js.map +1 -0
  49. package/dist/components/editor/node-views/fill-space-node-view.d.ts +16 -0
  50. package/dist/components/editor/node-views/fill-space-node-view.js +43 -0
  51. package/dist/components/editor/node-views/fill-space-node-view.js.map +1 -0
  52. package/dist/components/editor/node-views/formula-node-view.d.ts +39 -0
  53. package/dist/components/editor/node-views/formula-node-view.js +109 -0
  54. package/dist/components/editor/node-views/formula-node-view.js.map +1 -0
  55. package/dist/components/editor/node-views/node-view-context.d.ts +58 -0
  56. package/dist/components/editor/node-views/node-view-context.js +22 -0
  57. package/dist/components/editor/node-views/node-view-context.js.map +1 -0
  58. package/dist/components/editor/node-views/variable-node-view.d.ts +16 -0
  59. package/dist/components/editor/node-views/variable-node-view.js +63 -0
  60. package/dist/components/editor/node-views/variable-node-view.js.map +1 -0
  61. package/dist/components/editor/node-views/wrapped-text-view.d.ts +14 -0
  62. package/dist/components/editor/node-views/wrapped-text-view.js +46 -0
  63. package/dist/components/editor/node-views/wrapped-text-view.js.map +1 -0
  64. package/dist/components/editor/template-editor-toolbar.d.ts +146 -0
  65. package/dist/components/editor/template-editor-toolbar.js +434 -0
  66. package/dist/components/editor/template-editor-toolbar.js.map +1 -0
  67. package/dist/components/editor/template-editor.d.ts +109 -0
  68. package/dist/components/editor/template-editor.js +662 -0
  69. package/dist/components/editor/template-editor.js.map +1 -0
  70. package/dist/components/editor/toolbar-dropdown.d.ts +20 -0
  71. package/dist/components/editor/toolbar-dropdown.js +88 -0
  72. package/dist/components/editor/toolbar-dropdown.js.map +1 -0
  73. package/dist/components/editor/utils/draw-mode.d.ts +55 -0
  74. package/dist/components/editor/utils/draw-mode.js +79 -0
  75. package/dist/components/editor/utils/draw-mode.js.map +1 -0
  76. package/dist/components/editor/utils/insertion.d.ts +11 -0
  77. package/dist/components/editor/utils/insertion.js +26 -0
  78. package/dist/components/editor/utils/insertion.js.map +1 -0
  79. package/dist/components/editor/utils/length-calculator.d.ts +36 -0
  80. package/dist/components/editor/utils/length-calculator.js +32 -0
  81. package/dist/components/editor/utils/length-calculator.js.map +1 -0
  82. package/dist/components/editor/utils/serialization.d.ts +34 -0
  83. package/dist/components/editor/utils/serialization.js +184 -0
  84. package/dist/components/editor/utils/serialization.js.map +1 -0
  85. package/dist/components/editor/utils/stroke-transaction.d.ts +36 -0
  86. package/dist/components/editor/utils/stroke-transaction.js +57 -0
  87. package/dist/components/editor/utils/stroke-transaction.js.map +1 -0
  88. package/dist/components/editor/variable-picker-content.d.ts +130 -0
  89. package/dist/components/editor/variable-picker-content.js +422 -0
  90. package/dist/components/editor/variable-picker-content.js.map +1 -0
  91. package/dist/components/feedback/status-dot.d.ts +49 -0
  92. package/dist/components/feedback/status-dot.js +58 -0
  93. package/dist/components/feedback/status-dot.js.map +1 -0
  94. package/dist/components/forms/secret-input.d.ts +38 -0
  95. package/dist/components/forms/secret-input.js +42 -0
  96. package/dist/components/forms/secret-input.js.map +1 -0
  97. package/dist/components/forms/time-picker.d.ts +87 -0
  98. package/dist/components/forms/time-picker.js +260 -0
  99. package/dist/components/forms/time-picker.js.map +1 -0
  100. package/dist/components/forms/toggle-card.d.ts +120 -0
  101. package/dist/components/forms/toggle-card.js +211 -0
  102. package/dist/components/forms/toggle-card.js.map +1 -0
  103. package/dist/components/overlays/popover.d.ts +65 -0
  104. package/dist/components/overlays/popover.js +89 -0
  105. package/dist/components/overlays/popover.js.map +1 -0
  106. package/dist/editor.css +164 -0
  107. package/dist/index.d.ts +34 -0
  108. package/dist/index.js +95 -61
  109. package/dist/lib/board-colors.d.ts +16 -0
  110. package/dist/lib/board-colors.js +14 -14
  111. package/dist/lib/board-colors.js.map +1 -1
  112. package/dist/lib/use-deps-changed.d.ts +33 -0
  113. package/dist/lib/use-deps-changed.js +11 -0
  114. package/dist/lib/use-deps-changed.js.map +1 -0
  115. package/package.json +50 -2
@@ -0,0 +1,154 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { Badge as t } from "../feedback/badge.js";
4
+ import { Button as n } from "../forms/button.js";
5
+ import { Input as r } from "../forms/input.js";
6
+ import { Box as i } from "../layout/box.js";
7
+ import { Flex as a } from "../layout/flex.js";
8
+ import { Grid as o } from "../layout/grid.js";
9
+ import { Text as s } from "../typography/text.js";
10
+ import { Stack as c } from "../layout/stack.js";
11
+ import { Tooltip as l, TooltipContent as u, TooltipProvider as d, TooltipTrigger as f } from "../overlays/tooltip.js";
12
+ import { AVAILABLE_COLORS as p, COLOR_DISPLAY as m } from "../../lib/board-colors.js";
13
+ import { FILL_SPACE_REPEAT_VAR as h } from "./constants.js";
14
+ import { ChevronRight as g, ChevronsLeftRight as _ } from "lucide-react";
15
+ import v from "react";
16
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
17
+ //#region src/components/editor/formatting-picker-content.tsx
18
+ var x = {
19
+ noFormattingAvailable: "No formatting options available",
20
+ back: "← Back",
21
+ selectColor: "Select color:",
22
+ orCustomPattern: "Or custom pattern:",
23
+ use: "Use",
24
+ customPatternPlaceholder: "e.g. - or =-",
25
+ colorNames: {
26
+ red: "Red",
27
+ orange: "Orange",
28
+ yellow: "Yellow",
29
+ green: "Green",
30
+ blue: "Blue",
31
+ violet: "Violet",
32
+ white: "White",
33
+ black: "Black"
34
+ },
35
+ colorOptionLabel: (e) => `${e} color`
36
+ };
37
+ function S({ formatting: S = {}, onInsert: C, labels: w }) {
38
+ let T = {
39
+ ...x,
40
+ ...w
41
+ }, [E, D] = v.useState(!1), [O, k] = v.useState(""), A = v.useId(), j = Object.entries(S).map(([e, t]) => ({
42
+ name: e.replace(/_/g, " "),
43
+ syntax: t.syntax,
44
+ description: t.description
45
+ }));
46
+ if (j.length === 0) return /* @__PURE__ */ y(s, {
47
+ tone: "muted",
48
+ className: "p-3",
49
+ children: T.noFormattingAvailable
50
+ });
51
+ let M = (e) => {
52
+ e.syntax.includes("fill_space_repeat") ? D(!0) : C(e.syntax);
53
+ }, N = (e) => {
54
+ C(`{{${h}:${e}}}`), D(!1), k("");
55
+ };
56
+ return E ? /* @__PURE__ */ y(d, { children: /* @__PURE__ */ b(i, {
57
+ className: "p-2 min-w-[240px] max-w-[280px]",
58
+ children: [
59
+ /* @__PURE__ */ y("button", {
60
+ type: "button",
61
+ onClick: () => D(!1),
62
+ className: "text-xs text-muted-foreground hover:text-foreground mb-2 flex items-center gap-1",
63
+ children: T.back
64
+ }),
65
+ /* @__PURE__ */ y(s, {
66
+ size: "xs",
67
+ tone: "muted",
68
+ weight: "medium",
69
+ className: "mb-2",
70
+ children: T.selectColor
71
+ }),
72
+ /* @__PURE__ */ y(o, {
73
+ cols: "4",
74
+ gap: "2",
75
+ className: "mb-3",
76
+ children: p.map((t) => /* @__PURE__ */ b(l, { children: [/* @__PURE__ */ y(f, {
77
+ asChild: !0,
78
+ children: /* @__PURE__ */ y("button", {
79
+ type: "button",
80
+ onClick: () => N(t),
81
+ className: e("h-10 rounded-md text-xs font-medium transition-all hover:scale-105 hover:shadow-md", "flex items-center justify-center", m[t].bg, m[t].text),
82
+ "aria-label": T.colorOptionLabel(T.colorNames[t]),
83
+ children: T.colorNames[t]
84
+ })
85
+ }), /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(s, { children: T.colorNames[t] }) })] }, t))
86
+ }),
87
+ /* @__PURE__ */ b(i, {
88
+ className: "pt-2 border-t border-border",
89
+ children: [/* @__PURE__ */ y(s, {
90
+ size: "xs",
91
+ tone: "muted",
92
+ className: "mb-1.5",
93
+ id: A,
94
+ children: T.orCustomPattern
95
+ }), /* @__PURE__ */ b(i, {
96
+ as: "form",
97
+ onSubmit: (e) => {
98
+ e.preventDefault(), O && N(O);
99
+ },
100
+ className: "flex gap-1.5",
101
+ children: [/* @__PURE__ */ y(r, {
102
+ type: "text",
103
+ value: O,
104
+ onChange: (e) => k(e.target.value),
105
+ placeholder: T.customPatternPlaceholder,
106
+ maxLength: 10,
107
+ "aria-labelledby": A,
108
+ className: "flex-1 font-mono"
109
+ }), /* @__PURE__ */ y(n, {
110
+ type: "submit",
111
+ size: "sm",
112
+ disabled: !O,
113
+ children: T.use
114
+ })]
115
+ })]
116
+ })
117
+ ]
118
+ }) }) : /* @__PURE__ */ y(d, { children: /* @__PURE__ */ y(i, {
119
+ className: "p-1.5 min-w-[240px] max-w-[280px]",
120
+ children: /* @__PURE__ */ y(c, {
121
+ gap: "0.5",
122
+ children: j.map((n) => {
123
+ let r = n.syntax.includes(h);
124
+ return /* @__PURE__ */ b(l, { children: [/* @__PURE__ */ y(f, {
125
+ asChild: !0,
126
+ children: /* @__PURE__ */ b("button", {
127
+ type: "button",
128
+ onClick: () => M(n),
129
+ className: e("w-full text-left px-2.5 py-1.5 rounded-md text-sm", "hover:bg-accent hover:text-accent-foreground transition-colors", "flex items-center justify-between gap-2 group"),
130
+ children: [/* @__PURE__ */ b(a, {
131
+ align: "center",
132
+ gap: "2",
133
+ className: "flex-1 min-w-0",
134
+ children: [/* @__PURE__ */ y(_, { className: "w-3.5 h-3.5 text-muted-foreground group-hover:text-accent-foreground flex-shrink-0" }), /* @__PURE__ */ y(s, {
135
+ as: "span",
136
+ weight: "medium",
137
+ className: "capitalize truncate group-hover:text-accent-foreground",
138
+ children: n.name
139
+ })]
140
+ }), r ? /* @__PURE__ */ y(g, { className: "w-3.5 h-3.5 text-muted-foreground group-hover:text-accent-foreground flex-shrink-0" }) : /* @__PURE__ */ y(t, {
141
+ variant: "secondary",
142
+ className: "font-mono text-[10px] px-1.5 py-0 flex-shrink-0",
143
+ children: n.syntax
144
+ })]
145
+ })
146
+ }), /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(s, { children: n.description ?? n.name }) })] }, n.syntax);
147
+ })
148
+ })
149
+ }) });
150
+ }
151
+ //#endregion
152
+ export { x as DEFAULT_FORMATTING_PICKER_LABELS, S as FormattingPickerContent };
153
+
154
+ //# sourceMappingURL=formatting-picker-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting-picker-content.js","names":[],"sources":["../../../src/components/editor/formatting-picker-content.tsx"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,IAAa,IAA2D;CACtE,uBAAuB;CACvB,MAAM;CACN,aAAa;CACb,iBAAiB;CACjB,KAAK;CACL,0BAA0B;CAC1B,YAAY;EACV,KAAK;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,MAAM;EACN,QAAQ;EACR,OAAO;EACP,OAAO;CACT;CACA,mBAAmB,MAAc,GAAG,EAAU;AAChD;AAaA,SAAgB,EAAwB,EAAE,gBAAa,CAAC,GAAG,aAAU,aAAwC;CAC3G,IAAM,IAAI;EAAE,GAAG;EAAkC,GAAG;CAAO,GACrD,CAAC,GAAuB,KAA4B,EAAM,SAAS,EAAK,GACxE,CAAC,GAAY,KAAiB,EAAM,SAAS,EAAE,GAI/C,IAAoB,EAAM,MAAM,GAEhC,IAA8B,OAAO,QAAQ,CAAU,CAAC,CAAC,KAAK,CAAC,GAAM,QAAW;EACpF,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GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAO,EAAO,eAAe,EAAO,KAAW,CAAA,EACjC,CAAA,CACT,EAAA,GAjCK,EAAO,MAiCZ;GAEb,CAAC;EACI,CAAA;CACJ,CAAA,EACU,CAAA;AAErB"}
@@ -0,0 +1,102 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * One built-in formula function, as the app's `getFormulaFunctions` describes
4
+ * it. Declared structurally here so a host can type-check its own payload
5
+ * without this package depending on the FiestaBoard API client.
6
+ */
7
+ export interface FormulaFunction {
8
+ /** Uppercase call name, e.g. `IF`. */
9
+ name: string;
10
+ /** Grouping key. The five FiestaBoard categories get an icon and an accent
11
+ * colour; anything else still renders, in a neutral group after them. */
12
+ category: string;
13
+ /** Human-readable call shape, e.g. `IF(cond, then, else)`. */
14
+ signature: string;
15
+ /** One-line description, shown in the hover tooltip. */
16
+ summary: string;
17
+ }
18
+ /** Result of an injected expression validation round-trip. */
19
+ export interface FormulaValidationResult {
20
+ valid: boolean;
21
+ /** Message to show under the editor when `valid` is false. */
22
+ error?: string;
23
+ }
24
+ export interface FormulaEditorLabels {
25
+ /** Tab that lists the built-in functions. */
26
+ functionsTab: string;
27
+ /** Tab that hosts the injected variable picker. */
28
+ variablesTab: string;
29
+ /** Accessible name for the function-list loading placeholder. */
30
+ loading: string;
31
+ /** Field label above the CodeMirror input. */
32
+ formulaExpression: string;
33
+ /** Confirm button, `mode="create"`. */
34
+ insert: string;
35
+ /** Confirm button, `mode="edit"`. */
36
+ done: string;
37
+ /** Dismiss button when the panel opened empty. */
38
+ cancel: string;
39
+ /** Dismiss button when the panel opened on an existing formula. */
40
+ close: string;
41
+ categoryLogic: string;
42
+ categoryMath: string;
43
+ categoryText: string;
44
+ categoryConversion: string;
45
+ categoryColor: string;
46
+ }
47
+ export declare const DEFAULT_FORMULA_EDITOR_LABELS: FormulaEditorLabels;
48
+ export interface FormulaEditorPanelProps {
49
+ /**
50
+ * Pre-populated expression body (no {{= }}). Used in edit mode.
51
+ *
52
+ * Read when the CodeMirror document is created, i.e. at mount: changing it
53
+ * afterwards does not rewrite what the user is editing. To reopen the panel
54
+ * on a different formula, give it a new `key`.
55
+ */
56
+ initialExpr?: string;
57
+ /** "create" → Insert button; "edit" → Done button + Cancel */
58
+ mode: "create" | "edit";
59
+ /** Called with the bare expression when the user confirms. */
60
+ onConfirm: (expr: string) => void;
61
+ /** Called when the user cancels (edit mode only). */
62
+ onCancel?: () => void;
63
+ /**
64
+ * Built-in function reference, already resolved by the host. Grouped by
65
+ * `category` and sorted by name for display.
66
+ */
67
+ formulaFunctions?: FormulaFunction[];
68
+ /** Show placeholders in the Functions tab while the host fetches. */
69
+ isLoadingFunctions?: boolean;
70
+ /**
71
+ * Validates the **bare expression body** — no `{{=` / `}}` wrapper, already
72
+ * trimmed. A host backed by a whole-template validator wraps it itself:
73
+ * `validateExpression={(e) => api.validateTemplate(`{{= ${e} }}`)}`.
74
+ *
75
+ * Calls are debounced 300 ms and results for a stale expression are
76
+ * discarded, so an implementation only has to be idempotent, not cancelable.
77
+ *
78
+ * Omitting it turns validation off entirely: the state indicator stays
79
+ * blank and Confirm enables on any non-empty expression. That is deliberate
80
+ * — a panel with no validator must not present a permanently disabled
81
+ * Confirm button.
82
+ */
83
+ validateExpression?: (expr: string) => Promise<FormulaValidationResult>;
84
+ /**
85
+ * Renders the Variables tab. Omitted, the tab strip disappears and the panel
86
+ * shows only functions — never a placeholder.
87
+ *
88
+ * A slot rather than a direct import of the group's `VariablePickerContent`:
89
+ * that component pulls in lucide-react's full `icons` barrel, and injecting
90
+ * it lets the host hand over the *same* lazy chunk its toolbar already
91
+ * loaded instead of duplicating the barrel into this already
92
+ * CodeMirror-heavy panel (FiestaBoard #1575). This panel wraps the slot in
93
+ * its own `<Suspense>`, so a bare `lazy()` component can be passed straight
94
+ * in.
95
+ */
96
+ renderVariablePicker?: (ctx: {
97
+ onInsert: (variable: string) => void;
98
+ }) => ReactNode;
99
+ labels?: Partial<FormulaEditorLabels>;
100
+ className?: string;
101
+ }
102
+ export declare function FormulaEditorPanel({ initialExpr, mode, onConfirm, onCancel, formulaFunctions, isLoadingFunctions, validateExpression, renderVariablePicker, labels, className, }: FormulaEditorPanelProps): import("react").JSX.Element;