@crewlethq/ui 0.8.1 → 0.10.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.
- package/README.md +27 -2
- package/dist/Avatar/Avatar.d.ts +67 -15
- package/dist/Avatar/AvatarStack.d.ts +7 -3
- package/dist/Avatar/index.d.ts +2 -2
- package/dist/Avatar/index.js +2 -1
- package/dist/Avatar-QHYOFID3.css +322 -0
- package/dist/CharacterPicker/CharacterPicker.d.ts +38 -0
- package/dist/CharacterPicker/index.d.ts +3 -0
- package/dist/CharacterPicker/index.js +4 -0
- package/dist/CharacterPicker-ZEYIKUNQ.css +42 -0
- package/dist/CommandPalette/index.js +2 -2
- package/dist/DataTable/index.js +2 -2
- package/dist/DataView/index.js +6 -6
- package/dist/EntityChip/index.js +3 -2
- package/dist/HuePicker/HuePicker.d.ts +26 -0
- package/dist/HuePicker/index.d.ts +3 -0
- package/dist/HuePicker/index.js +8 -0
- package/dist/HuePicker-5QIUR6L7.css +18 -0
- package/dist/ImageUpload/index.js +3 -2
- package/dist/ListInput/index.js +2 -2
- package/dist/OrgLabel/index.js +3 -2
- package/dist/OrgNode/index.js +4 -3
- package/dist/OrgTable/index.js +4 -3
- package/dist/SegmentedControl/index.js +4 -2
- package/dist/Tabs/index.js +2 -1
- package/dist/Tabs/roving.d.ts +9 -1
- package/dist/TagsInput/index.js +2 -2
- package/dist/ThemeSwitcher/index.js +5 -3
- package/dist/TimeWindowPicker/index.js +3 -3
- package/dist/TreeCanvas/TreeCanvas.d.ts +5 -13
- package/dist/chunk-26TXVHN2.js +31 -0
- package/dist/chunk-3UK4VFSK.js +67 -0
- package/dist/{chunk-B47YUQGM.js → chunk-6OF2DBKY.js} +1 -1
- package/dist/{chunk-6SIG5I72.js → chunk-7FFDJQ23.js} +1 -1
- package/dist/chunk-AYKXMIOR.js +13 -0
- package/dist/chunk-CBOICT64.js +74 -0
- package/dist/{chunk-WSOFKOLP.js → chunk-DDTDN5L2.js} +1 -1
- package/dist/{chunk-A3K56LY6.js → chunk-EUT7VBQG.js} +4 -4
- package/dist/{chunk-DRHXRGB6.js → chunk-HEOVQZL7.js} +3 -62
- package/dist/chunk-HI6Q2UXQ.js +169 -0
- package/dist/{chunk-VCOELPCT.js → chunk-IHGKPEEV.js} +1 -1
- package/dist/{chunk-W4GQWFRX.js → chunk-LAQK4V3Z.js} +1 -1
- package/dist/{chunk-N5KCGFWI.js → chunk-LPHHDCN3.js} +2 -3
- package/dist/chunk-UI6HWAWE.js +2 -0
- package/dist/chunk-UO5UK7V2.js +73 -0
- package/dist/{chunk-RHHGLTXJ.js → chunk-X6K6OZ47.js} +1 -1
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +38 -32
- package/dist/index.js +38 -32
- package/dist/styles.css +223 -35
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/nodeHue.d.ts +25 -0
- package/dist/utils/tone.d.ts +4 -1
- package/package.json +3 -3
- package/dist/Avatar-XID7Z74C.css +0 -200
- package/dist/chunk-IA232OTU.js +0 -156
- package/dist/{chunk-4JHWMJZI.js → chunk-6HXH57BL.js} +1 -1
- package/dist/{chunk-IJ7QXNIJ.js → chunk-AER7UDD4.js} +0 -0
- package/dist/{chunk-KTIEJ5Q5.js → chunk-CVB7O3SZ.js} +1 -1
- package/dist/{chunk-BXPLX7YU.js → chunk-IGWPZZIB.js} +1 -1
- package/dist/{chunk-HVPC2GHY.js → chunk-IZHN5I3H.js} +1 -1
- package/dist/{chunk-DBUGBINU.js → chunk-MPXI6FM6.js} +1 -1
- /package/dist/{chunk-PKIN4IMB.js → chunk-YPTC4TX5.js} +0 -0
package/dist/chunk-IA232OTU.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { cx } from './chunk-ODEQTPFM.js';
|
|
2
|
-
import './Avatar-XID7Z74C.css';
|
|
3
|
-
import './AvatarStack-GEJBNV7E.css';
|
|
4
|
-
import { useState, useEffect } from 'react';
|
|
5
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var AVATAR_SIZES = { xs: 20, sm: 26, md: 32, lg: 40 };
|
|
8
|
-
var AVATAR_CORNER_RATIO = 0.29;
|
|
9
|
-
var getInitials = (name) => {
|
|
10
|
-
if (!name) return "?";
|
|
11
|
-
const words = name.trim().split(/[\s\-_.]+/).filter(Boolean);
|
|
12
|
-
if (words.length === 0) return "?";
|
|
13
|
-
const first = (word2) => (Array.from(word2)[0] ?? "").toUpperCase();
|
|
14
|
-
if (words.length >= 2) return words.slice(0, 2).map(first).join("") || "?";
|
|
15
|
-
const word = words[0];
|
|
16
|
-
const humps = word.split(/(?<=\p{Ll})(?=\p{Lu})/u);
|
|
17
|
-
if (humps.length >= 2) return humps.slice(0, 2).map(first).join("");
|
|
18
|
-
return Array.from(word).slice(0, 2).map((character) => character.toUpperCase()).join("") || "?";
|
|
19
|
-
};
|
|
20
|
-
var TINT_COUNT = 10;
|
|
21
|
-
var avatarTint = (seed) => {
|
|
22
|
-
let hash = 0;
|
|
23
|
-
for (let i = 0; i < seed.length; i += 1) {
|
|
24
|
-
hash = hash * 31 + seed.charCodeAt(i) >>> 0;
|
|
25
|
-
}
|
|
26
|
-
return hash % TINT_COUNT;
|
|
27
|
-
};
|
|
28
|
-
function avatarPixels(size) {
|
|
29
|
-
return typeof size === "number" ? size : AVATAR_SIZES[size];
|
|
30
|
-
}
|
|
31
|
-
function avatarCorner(pixels) {
|
|
32
|
-
return pixels * AVATAR_CORNER_RATIO;
|
|
33
|
-
}
|
|
34
|
-
var Avatar = ({
|
|
35
|
-
src,
|
|
36
|
-
name,
|
|
37
|
-
size = "md",
|
|
38
|
-
kind = "agent",
|
|
39
|
-
tone = "neutral",
|
|
40
|
-
ring,
|
|
41
|
-
decorative = false,
|
|
42
|
-
colorSeed,
|
|
43
|
-
className,
|
|
44
|
-
style,
|
|
45
|
-
...rest
|
|
46
|
-
}) => {
|
|
47
|
-
const [imageFailed, setImageFailed] = useState(false);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
setImageFailed(false);
|
|
50
|
-
}, [src]);
|
|
51
|
-
const step = typeof size === "number" ? null : size;
|
|
52
|
-
const pixels = avatarPixels(size);
|
|
53
|
-
const measured = step === null ? {
|
|
54
|
-
"--crewlet-avatar-size": `${pixels}px`,
|
|
55
|
-
fontSize: Math.max(9, Math.round(pixels * 0.36))
|
|
56
|
-
} : {};
|
|
57
|
-
const seeded = tone === "seeded" ? avatarTint(colorSeed ?? name ?? "") : null;
|
|
58
|
-
const classes = cx(
|
|
59
|
-
"crewlet-avatar",
|
|
60
|
-
`crewlet-avatar--${kind}`,
|
|
61
|
-
step === null ? null : `crewlet-avatar--${step}`,
|
|
62
|
-
ring === void 0 ? null : `crewlet-avatar--ring-${ring}`,
|
|
63
|
-
className
|
|
64
|
-
);
|
|
65
|
-
if (src && !imageFailed) {
|
|
66
|
-
return /* @__PURE__ */ jsx(
|
|
67
|
-
"img",
|
|
68
|
-
{
|
|
69
|
-
...rest,
|
|
70
|
-
className: cx(classes, "crewlet-avatar--image"),
|
|
71
|
-
style: { ...measured, ...style },
|
|
72
|
-
src,
|
|
73
|
-
alt: decorative ? "" : name ?? "",
|
|
74
|
-
"aria-hidden": decorative ? true : void 0,
|
|
75
|
-
onError: () => setImageFailed(true)
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return /* @__PURE__ */ jsx(
|
|
80
|
-
"span",
|
|
81
|
-
{
|
|
82
|
-
...rest,
|
|
83
|
-
className: cx(
|
|
84
|
-
classes,
|
|
85
|
-
"crewlet-avatar--fallback",
|
|
86
|
-
`crewlet-avatar--${tone}`,
|
|
87
|
-
seeded === null ? null : `crewlet-avatar--tint-${seeded}`
|
|
88
|
-
),
|
|
89
|
-
style: { ...measured, ...style },
|
|
90
|
-
role: decorative ? void 0 : "img",
|
|
91
|
-
"aria-hidden": decorative ? true : void 0,
|
|
92
|
-
"aria-label": decorative ? void 0 : name ? `${name} avatar` : "Avatar",
|
|
93
|
-
children: getInitials(name)
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
function counted(count, one, many) {
|
|
98
|
-
return `${count} ${count === 1 ? one : many}`;
|
|
99
|
-
}
|
|
100
|
-
function avatarStackLabel(members) {
|
|
101
|
-
const humans = members.filter((member) => member.kind === "human").length;
|
|
102
|
-
const agents = members.length - humans;
|
|
103
|
-
const agentWords = counted(agents, "agent", "agents");
|
|
104
|
-
const humanWords = counted(humans, "person", "people");
|
|
105
|
-
const who = humans === 0 ? agentWords : agents === 0 ? humanWords : `${agentWords} and ${humanWords}`;
|
|
106
|
-
return `${who}: ${members.map((member) => member.name).join(", ")}`;
|
|
107
|
-
}
|
|
108
|
-
function AvatarStack({
|
|
109
|
-
members,
|
|
110
|
-
max = 4,
|
|
111
|
-
size = "sm",
|
|
112
|
-
label,
|
|
113
|
-
decorative = false,
|
|
114
|
-
className,
|
|
115
|
-
style,
|
|
116
|
-
...rest
|
|
117
|
-
}) {
|
|
118
|
-
if (!Number.isInteger(max) || max < 1) {
|
|
119
|
-
throw new RangeError(`AvatarStack max must be a whole number of at least 1; it was ${max}`);
|
|
120
|
-
}
|
|
121
|
-
if (members.length === 0) return null;
|
|
122
|
-
const shown = members.slice(0, max);
|
|
123
|
-
const overflow = members.length - shown.length;
|
|
124
|
-
return /* @__PURE__ */ jsxs(
|
|
125
|
-
"span",
|
|
126
|
-
{
|
|
127
|
-
...rest,
|
|
128
|
-
className: cx("crewlet-avatar-stack", className),
|
|
129
|
-
style: { "--crewlet-avatar-stack-size": `${AVATAR_SIZES[size]}px`, ...style },
|
|
130
|
-
role: decorative ? void 0 : "img",
|
|
131
|
-
"aria-label": decorative ? void 0 : label ?? avatarStackLabel(members),
|
|
132
|
-
"aria-hidden": decorative ? true : void 0,
|
|
133
|
-
children: [
|
|
134
|
-
shown.map((member) => /* @__PURE__ */ jsx(
|
|
135
|
-
Avatar,
|
|
136
|
-
{
|
|
137
|
-
className: "crewlet-avatar-stack__member",
|
|
138
|
-
name: member.name,
|
|
139
|
-
kind: member.kind,
|
|
140
|
-
src: member.src,
|
|
141
|
-
ring: member.ring,
|
|
142
|
-
size,
|
|
143
|
-
decorative: true
|
|
144
|
-
},
|
|
145
|
-
member.id ?? member.name
|
|
146
|
-
)),
|
|
147
|
-
overflow > 0 ? /* @__PURE__ */ jsxs("span", { className: "crewlet-avatar-stack__member crewlet-avatar-stack__more", "aria-hidden": "true", children: [
|
|
148
|
-
"+",
|
|
149
|
-
overflow
|
|
150
|
-
] }) : null
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export { AVATAR_CORNER_RATIO, AVATAR_SIZES, Avatar, AvatarStack, avatarCorner, avatarPixels, avatarStackLabel, avatarTint, getInitials };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Kbd } from './chunk-SMBKXWML.js';
|
|
2
2
|
import { FormField, Textarea, Input } from './chunk-ZGX2DP7F.js';
|
|
3
|
+
import { announce } from './chunk-RSAQOKH3.js';
|
|
3
4
|
import { isComposing } from './chunk-R25RGPUB.js';
|
|
4
5
|
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
5
|
-
import { announce } from './chunk-RSAQOKH3.js';
|
|
6
6
|
import './ListInput-O7LJKOIG.css';
|
|
7
7
|
import { useState, useRef, useLayoutEffect } from 'react';
|
|
8
8
|
import { ArrowUpGlyph, ArrowDownGlyph, XGlyph, PlusGlyph } from '@crewlethq/icons/glyphs';
|
|
File without changes
|
|
@@ -2,8 +2,8 @@ import { Menu } from './chunk-LSB3EHBW.js';
|
|
|
2
2
|
import { EmptyValue } from './chunk-EUCC37WY.js';
|
|
3
3
|
import { Modal } from './chunk-BTHX2FS3.js';
|
|
4
4
|
import { useCardHeaderSlot } from './chunk-AV2DXAEL.js';
|
|
5
|
-
import { useClipboard } from './chunk-5VNUYO76.js';
|
|
6
5
|
import { Checkbox } from './chunk-YCTMKKRA.js';
|
|
6
|
+
import { useClipboard } from './chunk-5VNUYO76.js';
|
|
7
7
|
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
8
8
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
9
9
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Kbd } from './chunk-SMBKXWML.js';
|
|
2
|
-
import { Modal } from './chunk-BTHX2FS3.js';
|
|
3
2
|
import { useListbox } from './chunk-6MU7HNB4.js';
|
|
4
3
|
import { Input } from './chunk-ZGX2DP7F.js';
|
|
4
|
+
import { Modal } from './chunk-BTHX2FS3.js';
|
|
5
5
|
import { Count } from './chunk-BHHIIK3M.js';
|
|
6
6
|
import { isComposing } from './chunk-R25RGPUB.js';
|
|
7
7
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Select } from './chunk-SEFMO2EV.js';
|
|
2
|
+
import { Input } from './chunk-ZGX2DP7F.js';
|
|
2
3
|
import { Popover } from './chunk-PDUZO35I.js';
|
|
3
4
|
import { today, shiftMonth, CalendarGrid, compareDays } from './chunk-GXQ3B46I.js';
|
|
4
|
-
import { Input } from './chunk-ZGX2DP7F.js';
|
|
5
5
|
import { isComposing } from './chunk-R25RGPUB.js';
|
|
6
6
|
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
7
7
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Tag } from './chunk-LOECRMHA.js';
|
|
2
2
|
import { useListbox } from './chunk-6MU7HNB4.js';
|
|
3
|
+
import { announce } from './chunk-RSAQOKH3.js';
|
|
3
4
|
import { isComposing } from './chunk-R25RGPUB.js';
|
|
4
5
|
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
5
|
-
import { announce } from './chunk-RSAQOKH3.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
7
|
import './TagsInput-P2HS5QL4.css';
|
|
8
8
|
import { forwardRef, useState, useRef, useId, useImperativeHandle, useEffect, useMemo, useLayoutEffect } from 'react';
|
|
File without changes
|