@burdenoff/fe-libs 2026.1116.6 → 2026.1116.7
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.
- package/dist/tag/TagBadge.d.ts +10 -1
- package/dist/tag/TagBadge.js +32 -25
- package/dist/tag/TagsWidget.d.ts +8 -1
- package/dist/tag/TagsWidget.js +39 -37
- package/dist/tag/index.d.ts +2 -1
- package/dist/tag/tagColor.d.ts +17 -0
- package/dist/tag/tagColor.js +20 -4
- package/dist/tag/tagPalette.d.ts +59 -0
- package/dist/tag/tagPalette.js +74 -0
- package/dist/tag/tagsWidget/TagBadgeList.d.ts +3 -1
- package/dist/tag/tagsWidget/TagBadgeList.js +3 -2
- package/dist/tag/tagsWidget/TagSearchPopover.d.ts +4 -1
- package/dist/tag/tagsWidget/TagSearchPopover.js +41 -33
- package/dist/tag.js +4 -3
- package/package.json +1 -1
package/dist/tag/TagBadge.d.ts
CHANGED
|
@@ -9,8 +9,17 @@ export interface TagBadgeProps {
|
|
|
9
9
|
onRemove?: () => void;
|
|
10
10
|
className?: string;
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
/**
|
|
13
|
+
* How the tag colour is shown (BOFF-15056).
|
|
14
|
+
* - `text` (default): the label is drawn in the tag colour, on a tint.
|
|
15
|
+
* - `dot`: the label stays in the normal text colour, with a dot and a tint
|
|
16
|
+
* in the tag colour. Tag colours are picked to read as a mark, not as
|
|
17
|
+
* text, so this is the readable choice; it is opt-in so other products'
|
|
18
|
+
* badges look as they did.
|
|
19
|
+
*/
|
|
20
|
+
appearance?: 'text' | 'dot';
|
|
12
21
|
}
|
|
13
22
|
/**
|
|
14
23
|
* A badge component for displaying a tag with optional icon, color, and remove button
|
|
15
24
|
*/
|
|
16
|
-
export declare function TagBadge({ label, icon, color, description, removable, onClick, onRemove, className, size, }: TagBadgeProps): import('react').JSX.Element;
|
|
25
|
+
export declare function TagBadge({ label, icon, color, description, removable, onClick, onRemove, className, size, appearance, }: TagBadgeProps): import('react').JSX.Element;
|
package/dist/tag/TagBadge.js
CHANGED
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
import { cn as e } from "../shared-utils.js";
|
|
2
2
|
import { Badge as t } from "../ui/badge.js";
|
|
3
3
|
import { Tooltip as n, TooltipContent as r, TooltipProvider as i, TooltipTrigger as a } from "../ui/tooltip.js";
|
|
4
|
-
import { tagColorStyle as o } from "./tagColor.js";
|
|
5
|
-
import { X as
|
|
6
|
-
import { jsx as
|
|
4
|
+
import { tagColorStyle as o, tagDotStyle as s, tagTintStyle as c } from "./tagColor.js";
|
|
5
|
+
import { X as l } from "lucide-react";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
7
|
// src/tag/TagBadge.tsx
|
|
8
|
-
var
|
|
8
|
+
var f = {
|
|
9
9
|
sm: "text-xs px-1.5 py-0.5",
|
|
10
10
|
md: "text-sm px-2 py-0.5",
|
|
11
11
|
lg: "text-base px-2.5 py-1"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
let
|
|
13
|
+
function p({ label: p, icon: m, color: h, description: g, removable: _ = !1, onClick: v, onRemove: y, className: b, size: x = "md", appearance: S = "text" }) {
|
|
14
|
+
let C = (e) => {
|
|
15
|
+
e.stopPropagation(), y?.();
|
|
16
|
+
}, w = S === "dot", T = h ? w ? c(h) : o(h) : void 0, E = /* @__PURE__ */ d(t, {
|
|
15
17
|
variant: "secondary",
|
|
16
|
-
className: e("inline-flex items-center gap-1 font-medium transition-colors",
|
|
17
|
-
style:
|
|
18
|
-
|
|
18
|
+
className: e("inline-flex items-center gap-1 font-medium transition-colors", f[x], w && "text-text-primary", v && "cursor-pointer hover:bg-secondary/80", b),
|
|
19
|
+
style: T,
|
|
20
|
+
"data-appearance": w ? "dot" : void 0,
|
|
21
|
+
onClick: v,
|
|
19
22
|
children: [
|
|
20
|
-
|
|
23
|
+
w && h && /* @__PURE__ */ u("span", {
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
"data-tag-dot": "",
|
|
26
|
+
className: "size-2 flex-shrink-0 rounded-full",
|
|
27
|
+
style: s(h)
|
|
28
|
+
}),
|
|
29
|
+
m && /* @__PURE__ */ u("span", {
|
|
21
30
|
className: "flex-shrink-0",
|
|
22
|
-
children:
|
|
31
|
+
children: m
|
|
23
32
|
}),
|
|
24
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ u("span", {
|
|
25
34
|
className: "truncate max-w-[150px]",
|
|
26
|
-
children:
|
|
35
|
+
children: p
|
|
27
36
|
}),
|
|
28
|
-
|
|
37
|
+
_ && y && /* @__PURE__ */ u("button", {
|
|
29
38
|
type: "button",
|
|
30
|
-
onClick:
|
|
31
|
-
e.stopPropagation(), _?.();
|
|
32
|
-
},
|
|
39
|
+
onClick: C,
|
|
33
40
|
className: "flex-shrink-0 ms-0.5 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors",
|
|
34
|
-
"aria-label": `Remove ${
|
|
35
|
-
children: /* @__PURE__ */
|
|
41
|
+
"aria-label": `Remove ${p}`,
|
|
42
|
+
children: /* @__PURE__ */ u(l, { className: "size-3" })
|
|
36
43
|
})
|
|
37
44
|
]
|
|
38
45
|
});
|
|
39
|
-
return
|
|
46
|
+
return g ? /* @__PURE__ */ u(i, { children: /* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(a, {
|
|
40
47
|
asChild: !0,
|
|
41
|
-
children:
|
|
42
|
-
}), /* @__PURE__ */
|
|
48
|
+
children: E
|
|
49
|
+
}), /* @__PURE__ */ u(r, { children: /* @__PURE__ */ u("p", {
|
|
43
50
|
className: "max-w-xs",
|
|
44
|
-
children:
|
|
45
|
-
}) })] }) }) :
|
|
51
|
+
children: g
|
|
52
|
+
}) })] }) }) : E;
|
|
46
53
|
}
|
|
47
|
-
export {
|
|
54
|
+
export { p as TagBadge };
|
package/dist/tag/TagsWidget.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TagBadgeProps } from './TagBadge';
|
|
1
2
|
export interface TagItem {
|
|
2
3
|
id: string;
|
|
3
4
|
key: string;
|
|
@@ -54,6 +55,12 @@ export interface TagsWidgetProps {
|
|
|
54
55
|
syncGraphNotifications?: boolean;
|
|
55
56
|
maxTags?: number;
|
|
56
57
|
className?: string;
|
|
58
|
+
/**
|
|
59
|
+
* How the badges and search results show a tag's colour. Default `text`
|
|
60
|
+
* (the label in the tag colour); `dot` keeps the label in the normal text
|
|
61
|
+
* colour with a colour dot and tint (BOFF-15056).
|
|
62
|
+
*/
|
|
63
|
+
appearance?: TagBadgeProps['appearance'];
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
66
|
* TagsWidget - compact, embeddable tag input (controlled).
|
|
@@ -99,4 +106,4 @@ export interface TagsWidgetProps {
|
|
|
99
106
|
* }
|
|
100
107
|
* ```
|
|
101
108
|
*/
|
|
102
|
-
export declare function TagsWidget({ entityType, entityId, workspaceId, tags, onAdd, onRemove, vocabularyId: vocabIdProp, allowCreate, syncGraphNotifications, maxTags, className, }: TagsWidgetProps): import('react').JSX.Element | null;
|
|
109
|
+
export declare function TagsWidget({ entityType, entityId, workspaceId, tags, onAdd, onRemove, vocabularyId: vocabIdProp, allowCreate, syncGraphNotifications, maxTags, className, appearance, }: TagsWidgetProps): import('react').JSX.Element | null;
|
package/dist/tag/TagsWidget.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { cn as e } from "../shared-utils.js";
|
|
2
2
|
import { useGatewayClient as t } from "../shared/graphql/GatewayContext.js";
|
|
3
3
|
import { Popover as n, PopoverContent as r, PopoverTrigger as i } from "../ui/popover.js";
|
|
4
|
-
import { CREATE_TAG as
|
|
5
|
-
import { useVocabResolver as
|
|
6
|
-
import { TagBadgeList as
|
|
7
|
-
import { AddTagTrigger as
|
|
4
|
+
import { CREATE_TAG as a, NOTIFY_TAG_ASSIGNED as o, NOTIFY_TAG_REMOVED as ee, SEARCH_TAGS as s } from "./tagsWidget/operations.js";
|
|
5
|
+
import { useVocabResolver as c } from "./tagsWidget/useVocabResolver.js";
|
|
6
|
+
import { TagBadgeList as l } from "./tagsWidget/TagBadgeList.js";
|
|
7
|
+
import { AddTagTrigger as te } from "./tagsWidget/AddTagTrigger.js";
|
|
8
8
|
import { TagSearchPopover as u } from "./tagsWidget/TagSearchPopover.js";
|
|
9
9
|
import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
|
|
10
10
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
|
-
import { useLazyQuery as
|
|
11
|
+
import { useLazyQuery as ne, useMutation as _ } from "@apollo/client/react";
|
|
12
12
|
// src/tag/TagsWidget.tsx
|
|
13
|
-
function
|
|
14
|
-
let [A, j] = m(!1), [M, N] = m(""), [P, F] = m(null), [I, L] = m(!1), R = p(null), z = t("workspace"), { resolvedVocabId: B, resolveVocabId: V } =
|
|
13
|
+
function v({ entityType: v, entityId: y, workspaceId: b, tags: x, onAdd: S, onRemove: C, vocabularyId: w, allowCreate: T = !0, syncGraphNotifications: E = !0, maxTags: D = 20, className: O, appearance: k }) {
|
|
14
|
+
let [A, j] = m(!1), [M, N] = m(""), [P, F] = m(null), [I, L] = m(!1), R = p(null), z = t("workspace"), { resolvedVocabId: B, resolveVocabId: V } = c(z, w), H = !b || !y, U = new Set(x.map((e) => e.id)), W = x.length < D, [G, { data: K, loading: q }] = ne(s, { client: z }), J = (K?.searchTags ?? []).filter((e) => !U.has(e.id)), [Y, { loading: X }] = _(a, { client: z }), [Z] = _(o, { client: z }), [Q] = _(ee, { client: z }), re = d((e) => {
|
|
15
15
|
N(e), P && F(null), R.current && clearTimeout(R.current), e.trim() && (R.current = setTimeout(() => {
|
|
16
16
|
G({ variables: {
|
|
17
17
|
query: e,
|
|
@@ -31,13 +31,13 @@ function y({ entityType: y, entityId: b, workspaceId: x, tags: S, onAdd: C, onRe
|
|
|
31
31
|
if (W && !I) {
|
|
32
32
|
L(!0);
|
|
33
33
|
try {
|
|
34
|
-
await
|
|
34
|
+
await S({
|
|
35
35
|
...e,
|
|
36
36
|
vocabularyKey: e.vocabularyKey ?? e.vocabulary?.key ?? null
|
|
37
|
-
}), N(""), j(!1),
|
|
37
|
+
}), N(""), j(!1), E && Z({ variables: { input: {
|
|
38
38
|
key: e.key,
|
|
39
|
-
entityType:
|
|
40
|
-
entityId:
|
|
39
|
+
entityType: v,
|
|
40
|
+
entityId: y,
|
|
41
41
|
source: "MANUAL"
|
|
42
42
|
} } });
|
|
43
43
|
} finally {
|
|
@@ -46,14 +46,14 @@ function y({ entityType: y, entityId: b, workspaceId: x, tags: S, onAdd: C, onRe
|
|
|
46
46
|
}
|
|
47
47
|
}, [
|
|
48
48
|
Z,
|
|
49
|
-
|
|
49
|
+
S,
|
|
50
|
+
v,
|
|
50
51
|
y,
|
|
51
|
-
b,
|
|
52
52
|
W,
|
|
53
53
|
I,
|
|
54
|
-
|
|
55
|
-
]),
|
|
56
|
-
if (
|
|
54
|
+
E
|
|
55
|
+
]), ie = d(async () => {
|
|
56
|
+
if (T && M.trim() && !X) {
|
|
57
57
|
F(null);
|
|
58
58
|
try {
|
|
59
59
|
let e = M.trim(), t = e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -73,40 +73,41 @@ function y({ entityType: y, entityId: b, workspaceId: x, tags: S, onAdd: C, onRe
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}, [
|
|
76
|
-
|
|
76
|
+
T,
|
|
77
77
|
M,
|
|
78
78
|
X,
|
|
79
79
|
V,
|
|
80
80
|
Y,
|
|
81
81
|
$
|
|
82
|
-
]),
|
|
83
|
-
let t =
|
|
84
|
-
await
|
|
82
|
+
]), ae = d(async (e) => {
|
|
83
|
+
let t = x.find((t) => t.id === e);
|
|
84
|
+
await C(e), t && E && Q({ variables: {
|
|
85
85
|
key: t.key,
|
|
86
|
-
entityType:
|
|
87
|
-
entityId:
|
|
86
|
+
entityType: v,
|
|
87
|
+
entityId: y
|
|
88
88
|
} });
|
|
89
89
|
}, [
|
|
90
90
|
Q,
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
C,
|
|
92
|
+
x,
|
|
93
|
+
v,
|
|
93
94
|
y,
|
|
94
|
-
|
|
95
|
-
D
|
|
95
|
+
E
|
|
96
96
|
]);
|
|
97
97
|
if (H) return null;
|
|
98
|
-
let
|
|
98
|
+
let oe = !!(T && M.trim() && !q && J.length === 0);
|
|
99
99
|
return /* @__PURE__ */ g("div", {
|
|
100
|
-
className: e("flex flex-wrap items-center gap-1.5",
|
|
101
|
-
children: [/* @__PURE__ */ h(
|
|
102
|
-
tags:
|
|
103
|
-
onRemove: (e) => void
|
|
100
|
+
className: e("flex flex-wrap items-center gap-1.5", O),
|
|
101
|
+
children: [/* @__PURE__ */ h(l, {
|
|
102
|
+
tags: x,
|
|
103
|
+
onRemove: (e) => void ae(e),
|
|
104
|
+
appearance: k
|
|
104
105
|
}), W && /* @__PURE__ */ g(n, {
|
|
105
106
|
open: A,
|
|
106
107
|
onOpenChange: j,
|
|
107
108
|
children: [/* @__PURE__ */ h(i, {
|
|
108
109
|
asChild: !0,
|
|
109
|
-
children: /* @__PURE__ */ h(
|
|
110
|
+
children: /* @__PURE__ */ h(te, { hasTags: x.length > 0 })
|
|
110
111
|
}), /* @__PURE__ */ h(r, {
|
|
111
112
|
className: "w-64 p-0",
|
|
112
113
|
align: "start",
|
|
@@ -114,20 +115,21 @@ function y({ entityType: y, entityId: b, workspaceId: x, tags: S, onAdd: C, onRe
|
|
|
114
115
|
sideOffset: 4,
|
|
115
116
|
children: /* @__PURE__ */ h(u, {
|
|
116
117
|
search: M,
|
|
117
|
-
onSearchChange:
|
|
118
|
+
onSearchChange: re,
|
|
118
119
|
searching: q,
|
|
119
120
|
searchResults: J,
|
|
120
121
|
adding: I,
|
|
121
122
|
creating: X,
|
|
122
|
-
showCreateOption:
|
|
123
|
+
showCreateOption: oe,
|
|
123
124
|
createError: P,
|
|
124
125
|
canAddMore: W,
|
|
125
|
-
maxTags:
|
|
126
|
+
maxTags: D,
|
|
126
127
|
onAssign: (e) => void $(e),
|
|
127
|
-
onCreate: () => void
|
|
128
|
+
onCreate: () => void ie(),
|
|
129
|
+
appearance: k
|
|
128
130
|
})
|
|
129
131
|
})]
|
|
130
132
|
})]
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
|
-
export {
|
|
135
|
+
export { v as TagsWidget };
|
package/dist/tag/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { TagBadge, type TagBadgeProps } from './TagBadge';
|
|
2
|
-
export { tagColorStyle } from './tagColor';
|
|
2
|
+
export { tagColorStyle, tagDotStyle, tagTintStyle } from './tagColor';
|
|
3
|
+
export { LEGACY_CHART_TAG_COLORS, TAG_COLOR_PALETTE, isLegacyTagColor, legacyTagColorToHex, normalizeTagColor, tagPaletteColor, type TagPaletteColor, type TagPaletteColorId, } from './tagPalette';
|
|
3
4
|
export { TagsWidget, type TagsWidgetProps, type TagItem } from './TagsWidget';
|
package/dist/tag/tagColor.d.ts
CHANGED
|
@@ -8,5 +8,22 @@ import { CSSProperties } from 'react';
|
|
|
8
8
|
* appended a hex alpha (`${color}20`), which only works for six-digit hex. A
|
|
9
9
|
* stored `var(--color-chart-N)` became `var(--color-chart-N)20`, invalid CSS
|
|
10
10
|
* the browser drops, so the tint and border vanished (BOFF-11867).
|
|
11
|
+
*
|
|
12
|
+
* Painting the label in the tag colour fails text contrast for most colours.
|
|
13
|
+
* New surfaces should use {@link tagTintStyle} with a label in the normal text
|
|
14
|
+
* colour (TagBadge `appearance="dot"`); this style stays for existing callers.
|
|
11
15
|
*/
|
|
12
16
|
export declare function tagColorStyle(color: string): CSSProperties;
|
|
17
|
+
/**
|
|
18
|
+
* Inline style for a tag tint only: a light background and a stronger border
|
|
19
|
+
* in the tag colour, leaving the text colour to the caller (use the normal
|
|
20
|
+
* text colour, `text-text-primary`). A legacy `var(--color-chart-N)` colour is
|
|
21
|
+
* painted as its tag palette hex (BOFF-15056), so it looks the same in light
|
|
22
|
+
* and dark mode and matches what the tag form saves.
|
|
23
|
+
*/
|
|
24
|
+
export declare function tagTintStyle(color: string): CSSProperties;
|
|
25
|
+
/**
|
|
26
|
+
* Inline style for a solid tag-colour dot shown beside a tag label. Like
|
|
27
|
+
* {@link tagTintStyle}, a legacy chart token is painted as its palette hex.
|
|
28
|
+
*/
|
|
29
|
+
export declare function tagDotStyle(color: string): CSSProperties;
|
package/dist/tag/tagColor.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
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:
|
|
9
|
+
backgroundColor: r(e, t),
|
|
4
10
|
color: e,
|
|
5
|
-
borderColor:
|
|
11
|
+
borderColor: r(e, n)
|
|
6
12
|
};
|
|
7
13
|
}
|
|
8
|
-
|
|
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 {
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
|
|
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__ */
|
|
11
|
+
/* @__PURE__ */ f("div", {
|
|
10
12
|
className: "flex items-center border-b border-border px-3",
|
|
11
13
|
children: [
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
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:
|
|
16
|
-
onValueChange:
|
|
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
|
-
|
|
21
|
+
h && /* @__PURE__ */ d(s, { className: "size-3.5 shrink-0 animate-spin text-muted-foreground" })
|
|
20
22
|
]
|
|
21
23
|
}),
|
|
22
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ f(a, {
|
|
23
25
|
className: "max-h-48 overflow-y-auto",
|
|
24
26
|
children: [
|
|
25
|
-
|
|
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
|
-
|
|
31
|
+
g.length > 0 && /* @__PURE__ */ d(n, { children: g.map((e) => /* @__PURE__ */ f(i, {
|
|
30
32
|
value: e.id,
|
|
31
|
-
onSelect: () =>
|
|
33
|
+
onSelect: () => C(e),
|
|
32
34
|
className: "flex items-center gap-2 px-3 py-2 cursor-pointer",
|
|
33
|
-
disabled:
|
|
35
|
+
disabled: _,
|
|
34
36
|
children: [
|
|
35
|
-
e.
|
|
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__ */
|
|
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
|
-
|
|
52
|
+
_ && /* @__PURE__ */ d(s, { className: "ms-auto size-3 animate-spin" })
|
|
45
53
|
]
|
|
46
54
|
}, e.id)) }),
|
|
47
|
-
|
|
48
|
-
value: `__create__${
|
|
49
|
-
onSelect:
|
|
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: [
|
|
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:
|
|
62
|
+
children: v ? "Creating..." : `Create "${p}"`
|
|
55
63
|
})]
|
|
56
64
|
}) }),
|
|
57
|
-
|
|
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
|
-
|
|
69
|
+
b && /* @__PURE__ */ d("div", {
|
|
62
70
|
className: "px-3 py-2 text-xs text-destructive border-t border-border",
|
|
63
|
-
children:
|
|
71
|
+
children: b
|
|
64
72
|
})
|
|
65
73
|
]
|
|
66
74
|
}),
|
|
67
|
-
!
|
|
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
|
|
78
|
+
/* @__PURE__ */ d(u, { className: "size-3" }),
|
|
71
79
|
"Maximum ",
|
|
72
|
-
|
|
80
|
+
S,
|
|
73
81
|
" tags reached"
|
|
74
82
|
]
|
|
75
83
|
})
|
|
76
84
|
]
|
|
77
85
|
});
|
|
78
86
|
}
|
|
79
|
-
export {
|
|
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 {
|
|
4
|
-
|
|
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 };
|