@burdenoff/fe-libs 2026.1116.6 → 2026.1116.8

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.
@@ -1,8 +1,24 @@
1
- function e(e) {
1
+ import { normalizeTagColor as e } from "./tagPalette.js";
2
+ // src/tag/tagColor.ts
3
+ var t = 12, n = 25;
4
+ function r(e, t) {
5
+ return `color-mix(in srgb, ${e} ${t}%, transparent)`;
6
+ }
7
+ function i(e) {
2
8
  return {
3
- backgroundColor: `color-mix(in srgb, ${e} 12%, transparent)`,
9
+ backgroundColor: r(e, t),
4
10
  color: e,
5
- borderColor: `color-mix(in srgb, ${e} 25%, transparent)`
11
+ borderColor: r(e, n)
6
12
  };
7
13
  }
8
- export { e as tagColorStyle };
14
+ function a(i) {
15
+ let a = e(i);
16
+ return {
17
+ backgroundColor: r(a, t),
18
+ borderColor: r(a, n)
19
+ };
20
+ }
21
+ function o(t) {
22
+ return { backgroundColor: e(t) };
23
+ }
24
+ export { i as tagColorStyle, o as tagDotStyle, a as tagTintStyle };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The tag colour palette (BOFF-15056).
3
+ *
4
+ * ★ These hex values are DATA, not UI styling. A tag's colour is stored in the
5
+ * database and read back by everything that shows a tag: the web apps, but
6
+ * also exports, the SDKs, the MCP tools, the API, emails and native code.
7
+ * Outside our web pages a design token such as `var(--color-chart-3)` is not a
8
+ * colour at all, so a stored tag colour must be a plain hex. UI code still
9
+ * styles itself with semantic tokens; it only paints a tag with the hex the
10
+ * tag carries. This file is exempt from the raw-colour lint guard for that
11
+ * reason (eslint.config.js), and is the only place the palette is written down.
12
+ *
13
+ * One value per colour, the same in light and dark mode. Every colour has a
14
+ * relative luminance of about 0.21, the point where a mid-tone reaches 3:1 or
15
+ * more against both the light surfaces (`--color-bg-*` in `:root`) and the
16
+ * dark ones (`:root.dark` and the forest, ocean, sunset and high-contrast
17
+ * themes). That is the WCAG 1.4.11 level for a non-text mark, which is how a
18
+ * tag colour is meant to be shown: as a dot or a tint beside a label drawn in
19
+ * the normal text colour, never as the label's own colour. tagPalette.test.ts
20
+ * reads the real token values and fails if any pair drops under 3:1.
21
+ */
22
+ /** The stable id of a palette colour. */
23
+ export type TagPaletteColorId = 'red' | 'orange' | 'amber' | 'green' | 'teal' | 'blue' | 'violet' | 'pink';
24
+ export interface TagPaletteColor {
25
+ /** Stable id, safe to use as a React key or a test id. */
26
+ readonly id: TagPaletteColorId;
27
+ /** English name, for tools and docs. UI shows its own translated label. */
28
+ readonly name: string;
29
+ /** The value a tag stores: `#RRGGBB`, upper case. */
30
+ readonly hex: string;
31
+ }
32
+ /** The eight tag colours, in hue order. Pickers show them in this order. */
33
+ export declare const TAG_COLOR_PALETTE: ReadonlyArray<TagPaletteColor>;
34
+ /**
35
+ * The palette colour that replaces each legacy chart token.
36
+ *
37
+ * The FluidGrids tag form stored `var(--color-chart-1)` … `var(--color-chart-8)`
38
+ * before this palette existed. Each chart token maps to the palette colour
39
+ * nearest to it, measured as the OKLab distance from the token's light value
40
+ * plus the distance from its dark value (the test recomputes this from
41
+ * semantic.css). Chart tokens 1 and 6, 2 and 7, and 3 and 8 are the same hue
42
+ * family and swapped shades between themes, so each pair lands on one colour.
43
+ * Tokens 9–12 were never offered as swatches but could be typed by hand.
44
+ */
45
+ export declare const LEGACY_CHART_TAG_COLORS: Readonly<Record<number, TagPaletteColorId>>;
46
+ /** The palette colour with this id. */
47
+ export declare function tagPaletteColor(id: TagPaletteColorId): TagPaletteColor;
48
+ /**
49
+ * The palette hex for a legacy `var(--color-chart-N)` tag colour, or `null`
50
+ * when the value is anything else.
51
+ */
52
+ export declare function legacyTagColorToHex(color: string): string | null;
53
+ /** True when a tag colour is a legacy chart token this module can convert. */
54
+ export declare function isLegacyTagColor(color: string): boolean;
55
+ /**
56
+ * The colour to store or paint for a tag: a legacy chart token becomes its
57
+ * palette hex; every other value comes back trimmed and otherwise unchanged.
58
+ */
59
+ export declare function normalizeTagColor(color: string): string;
@@ -0,0 +1,74 @@
1
+ // src/tag/tagPalette.ts
2
+ var e = [
3
+ {
4
+ id: "red",
5
+ name: "Red",
6
+ hex: "#E64142"
7
+ },
8
+ {
9
+ id: "orange",
10
+ name: "Orange",
11
+ hex: "#CC5F00"
12
+ },
13
+ {
14
+ id: "amber",
15
+ name: "Amber",
16
+ hex: "#AB7302"
17
+ },
18
+ {
19
+ id: "green",
20
+ name: "Green",
21
+ hex: "#269142"
22
+ },
23
+ {
24
+ id: "teal",
25
+ name: "Teal",
26
+ hex: "#038E88"
27
+ },
28
+ {
29
+ id: "blue",
30
+ name: "Blue",
31
+ hex: "#227EE6"
32
+ },
33
+ {
34
+ id: "violet",
35
+ name: "Violet",
36
+ hex: "#8E66E5"
37
+ },
38
+ {
39
+ id: "pink",
40
+ name: "Pink",
41
+ hex: "#DE3F8D"
42
+ }
43
+ ], t = {
44
+ 1: "blue",
45
+ 2: "green",
46
+ 3: "violet",
47
+ 4: "amber",
48
+ 5: "red",
49
+ 6: "blue",
50
+ 7: "green",
51
+ 8: "violet",
52
+ 9: "amber",
53
+ 10: "red",
54
+ 11: "green",
55
+ 12: "blue"
56
+ }, n = /^var\(\s*--color-chart-(\d+)\s*\)$/i;
57
+ function r(t) {
58
+ let n = e.find((e) => e.id === t);
59
+ if (!n) throw Error(`Unknown tag palette colour: ${t}`);
60
+ return n;
61
+ }
62
+ function i(e) {
63
+ let i = n.exec(e.trim());
64
+ if (!i) return null;
65
+ let a = t[Number(i[1])];
66
+ return a ? r(a).hex : null;
67
+ }
68
+ function a(e) {
69
+ return i(e) !== null;
70
+ }
71
+ function o(e) {
72
+ return i(e) ?? e.trim();
73
+ }
74
+ export { t as LEGACY_CHART_TAG_COLORS, e as TAG_COLOR_PALETTE, a as isLegacyTagColor, i as legacyTagColorToHex, o as normalizeTagColor, r as tagPaletteColor };
@@ -1,6 +1,8 @@
1
+ import { TagBadgeProps } from '../TagBadge';
1
2
  import { TagItem } from '../TagsWidget';
2
3
  export interface TagBadgeListProps {
3
4
  tags: TagItem[];
4
5
  onRemove: (tagId: string) => void;
6
+ appearance?: TagBadgeProps['appearance'];
5
7
  }
6
- export declare function TagBadgeList({ tags, onRemove }: TagBadgeListProps): import('react').JSX.Element;
8
+ export declare function TagBadgeList({ tags, onRemove, appearance }: TagBadgeListProps): import('react').JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { TagBadge as e } from "../TagBadge.js";
2
2
  import { Fragment as t, jsx as n } from "react/jsx-runtime";
3
3
  // src/tag/tagsWidget/TagBadgeList.tsx
4
- function r({ tags: r, onRemove: i }) {
4
+ function r({ tags: r, onRemove: i, appearance: a }) {
5
5
  return /* @__PURE__ */ n(t, { children: r.map((t) => /* @__PURE__ */ n(e, {
6
6
  id: t.id,
7
7
  label: t.label,
@@ -10,7 +10,8 @@ function r({ tags: r, onRemove: i }) {
10
10
  description: t.description ?? void 0,
11
11
  removable: !0,
12
12
  onRemove: () => i(t.id),
13
- size: "sm"
13
+ size: "sm",
14
+ appearance: a
14
15
  }, t.id)) });
15
16
  }
16
17
  export { r as TagBadgeList };
@@ -1,3 +1,4 @@
1
+ import { TagBadgeProps } from '../TagBadge';
1
2
  import { TagItem } from '../TagsWidget';
2
3
  export interface TagSearchPopoverProps {
3
4
  search: string;
@@ -12,5 +13,7 @@ export interface TagSearchPopoverProps {
12
13
  maxTags: number;
13
14
  onAssign: (tag: TagItem) => void;
14
15
  onCreate: () => void;
16
+ /** How a result shows its colour; matches the badges' `appearance`. */
17
+ appearance?: TagBadgeProps['appearance'];
15
18
  }
16
- export declare function TagSearchPopover({ search, onSearchChange, searching, searchResults, adding, creating, showCreateOption, createError, canAddMore, maxTags, onAssign, onCreate, }: TagSearchPopoverProps): import('react').JSX.Element;
19
+ export declare function TagSearchPopover({ search, onSearchChange, searching, searchResults, adding, creating, showCreateOption, createError, canAddMore, maxTags, onAssign, onCreate, appearance, }: TagSearchPopoverProps): import('react').JSX.Element;
@@ -1,79 +1,87 @@
1
1
  import { Command as e, CommandEmpty as t, CommandGroup as n, CommandInput as r, CommandItem as i, CommandList as a } from "../../ui/command.js";
2
- import { Loader2 as o, Plus as s, Search as c, X as l } from "lucide-react";
3
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
2
+ import { tagDotStyle as o } from "../tagColor.js";
3
+ import { Loader2 as s, Plus as c, Search as l, X as u } from "lucide-react";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
4
5
  // src/tag/tagsWidget/TagSearchPopover.tsx
5
- function f({ search: f, onSearchChange: p, searching: m, searchResults: h, adding: g, creating: _, showCreateOption: v, createError: y, canAddMore: b, maxTags: x, onAssign: S, onCreate: C }) {
6
- return /* @__PURE__ */ d(e, {
6
+ function p({ search: p, onSearchChange: m, searching: h, searchResults: g, adding: _, creating: v, showCreateOption: y, createError: b, canAddMore: x, maxTags: S, onAssign: C, onCreate: w, appearance: T = "text" }) {
7
+ let E = T === "dot";
8
+ return /* @__PURE__ */ f(e, {
7
9
  shouldFilter: !1,
8
10
  children: [
9
- /* @__PURE__ */ d("div", {
11
+ /* @__PURE__ */ f("div", {
10
12
  className: "flex items-center border-b border-border px-3",
11
13
  children: [
12
- /* @__PURE__ */ u(c, { className: "size-4 shrink-0 text-muted-foreground" }),
13
- /* @__PURE__ */ u(r, {
14
+ /* @__PURE__ */ d(l, { className: "size-4 shrink-0 text-muted-foreground" }),
15
+ /* @__PURE__ */ d(r, {
14
16
  placeholder: "Search or create a tag...",
15
- value: f,
16
- onValueChange: p,
17
+ value: p,
18
+ onValueChange: m,
17
19
  className: "h-9 flex-1 border-0 bg-transparent px-2 text-sm outline-none placeholder:text-muted-foreground"
18
20
  }),
19
- m && /* @__PURE__ */ u(o, { className: "size-3.5 shrink-0 animate-spin text-muted-foreground" })
21
+ h && /* @__PURE__ */ d(s, { className: "size-3.5 shrink-0 animate-spin text-muted-foreground" })
20
22
  ]
21
23
  }),
22
- /* @__PURE__ */ d(a, {
24
+ /* @__PURE__ */ f(a, {
23
25
  className: "max-h-48 overflow-y-auto",
24
26
  children: [
25
- f.trim() === "" && /* @__PURE__ */ u(t, {
27
+ p.trim() === "" && /* @__PURE__ */ d(t, {
26
28
  className: "py-4 text-center text-xs text-muted-foreground",
27
29
  children: "Type to search or create a tag"
28
30
  }),
29
- h.length > 0 && /* @__PURE__ */ u(n, { children: h.map((e) => /* @__PURE__ */ d(i, {
31
+ g.length > 0 && /* @__PURE__ */ d(n, { children: g.map((e) => /* @__PURE__ */ f(i, {
30
32
  value: e.id,
31
- onSelect: () => S(e),
33
+ onSelect: () => C(e),
32
34
  className: "flex items-center gap-2 px-3 py-2 cursor-pointer",
33
- disabled: g,
35
+ disabled: _,
34
36
  children: [
35
- e.icon && /* @__PURE__ */ u("span", {
37
+ E && e.color && /* @__PURE__ */ d("span", {
38
+ "aria-hidden": "true",
39
+ "data-tag-dot": "",
40
+ className: "size-2 shrink-0 rounded-full",
41
+ style: o(e.color)
42
+ }),
43
+ e.icon && /* @__PURE__ */ d("span", {
36
44
  className: "text-sm",
37
45
  children: e.icon
38
46
  }),
39
- /* @__PURE__ */ u("span", {
40
- className: "truncate text-sm",
41
- style: e.color ? { color: e.color } : void 0,
47
+ /* @__PURE__ */ d("span", {
48
+ className: E ? "truncate text-sm text-text-primary" : "truncate text-sm",
49
+ style: !E && e.color ? { color: e.color } : void 0,
42
50
  children: e.label
43
51
  }),
44
- g && /* @__PURE__ */ u(o, { className: "ms-auto size-3 animate-spin" })
52
+ _ && /* @__PURE__ */ d(s, { className: "ms-auto size-3 animate-spin" })
45
53
  ]
46
54
  }, e.id)) }),
47
- v && /* @__PURE__ */ u(n, { children: /* @__PURE__ */ d(i, {
48
- value: `__create__${f}`,
49
- onSelect: C,
55
+ y && /* @__PURE__ */ d(n, { children: /* @__PURE__ */ f(i, {
56
+ value: `__create__${p}`,
57
+ onSelect: w,
50
58
  className: "flex items-center gap-2 px-3 py-2 cursor-pointer text-primary",
51
- disabled: _,
52
- children: [_ ? /* @__PURE__ */ u(o, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ u(s, { className: "size-3.5" }), /* @__PURE__ */ u("span", {
59
+ disabled: v,
60
+ children: [v ? /* @__PURE__ */ d(s, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ d(c, { className: "size-3.5" }), /* @__PURE__ */ d("span", {
53
61
  className: "text-sm truncate",
54
- children: _ ? "Creating..." : `Create "${f}"`
62
+ children: v ? "Creating..." : `Create "${p}"`
55
63
  })]
56
64
  }) }),
57
- f.trim() !== "" && !m && h.length === 0 && !v && /* @__PURE__ */ u(t, {
65
+ p.trim() !== "" && !h && g.length === 0 && !y && /* @__PURE__ */ d(t, {
58
66
  className: "py-4 text-center text-xs text-muted-foreground",
59
67
  children: "No tags found"
60
68
  }),
61
- y && /* @__PURE__ */ u("div", {
69
+ b && /* @__PURE__ */ d("div", {
62
70
  className: "px-3 py-2 text-xs text-destructive border-t border-border",
63
- children: y
71
+ children: b
64
72
  })
65
73
  ]
66
74
  }),
67
- !b && /* @__PURE__ */ d("div", {
75
+ !x && /* @__PURE__ */ f("div", {
68
76
  className: "border-t border-border px-3 py-2 text-xs text-muted-foreground flex items-center gap-1",
69
77
  children: [
70
- /* @__PURE__ */ u(l, { className: "size-3" }),
78
+ /* @__PURE__ */ d(u, { className: "size-3" }),
71
79
  "Maximum ",
72
- x,
80
+ S,
73
81
  " tags reached"
74
82
  ]
75
83
  })
76
84
  ]
77
85
  });
78
86
  }
79
- export { f as TagSearchPopover };
87
+ export { p as TagSearchPopover };
package/dist/tag.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TagBadge as e } from "./tag/TagBadge.js";
2
- import { tagColorStyle as t } from "./tag/tagColor.js";
3
- import { TagsWidget as n } from "./tag/TagsWidget.js";
4
- export { e as TagBadge, n as TagsWidget, t as tagColorStyle };
2
+ import { tagColorStyle as t, tagDotStyle as n, tagTintStyle as r } from "./tag/tagColor.js";
3
+ import { LEGACY_CHART_TAG_COLORS as i, TAG_COLOR_PALETTE as a, isLegacyTagColor as o, legacyTagColorToHex as s, normalizeTagColor as c, tagPaletteColor as l } from "./tag/tagPalette.js";
4
+ import { TagsWidget as u } from "./tag/TagsWidget.js";
5
+ export { i as LEGACY_CHART_TAG_COLORS, a as TAG_COLOR_PALETTE, e as TagBadge, u as TagsWidget, o as isLegacyTagColor, s as legacyTagColorToHex, c as normalizeTagColor, t as tagColorStyle, n as tagDotStyle, l as tagPaletteColor, r as tagTintStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1116.6",
3
+ "version": "2026.1116.8",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "repository": {
6
6
  "type": "git",