@joewinke/jatui 0.1.30 → 0.1.33
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/actions/collapse.js +29 -15
- package/dist/actions/listNav.js +137 -108
- package/dist/actions/railNav.js +89 -72
- package/dist/components/markup.js +62 -59
- package/dist/components/session-nav/transcriptModel.js +66 -49
- package/dist/data/emojis.js +4 -4
- package/dist/dnd/autoScroll.js +12 -10
- package/dist/dnd/createDndBoard.svelte.js +110 -76
- package/dist/dnd/createDndBoard.test.js +161 -85
- package/dist/dnd/draggable.js +23 -15
- package/dist/dnd/dropTarget.js +29 -15
- package/dist/dnd/types.d.ts +0 -9
- package/dist/dnd/types.js +14 -2
- package/dist/index.d.ts +1 -6
- package/dist/index.js +6 -6
- package/dist/stores/confirmDialog.svelte.js +5 -5
- package/dist/stores/inputDialog.svelte.js +5 -5
- package/dist/types/booking.js +4 -4
- package/dist/types/comments.js +2 -2
- package/dist/types/messaging.js +3 -3
- package/dist/types/pipeline.js +2 -2
- package/dist/utils/currency.js +4 -2
- package/dist/utils/daisyuiColors.js +27 -25
- package/dist/utils/dateFormatters.d.ts +20 -0
- package/dist/utils/dateFormatters.js +65 -44
- package/dist/utils/googleMapsLoader.js +100 -46
- package/dist/utils/mentionParser.js +30 -30
- package/dist/utils/phone.js +27 -21
- package/dist/utils/phoneFormat.js +9 -9
- package/dist/utils/taskUtils.js +1 -1
- package/package.json +7 -2
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* routing via the `urlGenerator` parameter or by setting a default.
|
|
9
9
|
*/
|
|
10
10
|
// Regex to match mention pattern: [@Display Name](type:id)
|
|
11
|
-
|
|
11
|
+
var MENTION_REGEX = /\[@([^\]]+)\]\(([^:]+):([^)]+)\)/g;
|
|
12
12
|
// Default URL generator (apps can override)
|
|
13
|
-
|
|
13
|
+
var defaultUrlGenerator = function (type, id) { return "#".concat(type, "/").concat(id); };
|
|
14
14
|
/**
|
|
15
15
|
* Set the default URL generator for mentions.
|
|
16
16
|
* Call this once at app startup to configure mention link routing.
|
|
@@ -22,20 +22,20 @@ export function setMentionUrlGenerator(generator) {
|
|
|
22
22
|
* Parse message content and extract all mentions
|
|
23
23
|
*/
|
|
24
24
|
export function parseMentions(content, urlGenerator) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
var mentions = [];
|
|
26
|
+
var gen = urlGenerator !== null && urlGenerator !== void 0 ? urlGenerator : defaultUrlGenerator;
|
|
27
|
+
var match;
|
|
28
28
|
MENTION_REGEX.lastIndex = 0;
|
|
29
29
|
while ((match = MENTION_REGEX.exec(content)) !== null) {
|
|
30
|
-
|
|
30
|
+
var fullMatch = match[0], displayName = match[1], type = match[2], id = match[3];
|
|
31
31
|
mentions.push({
|
|
32
|
-
type,
|
|
33
|
-
id,
|
|
34
|
-
displayName,
|
|
32
|
+
type: type,
|
|
33
|
+
id: id,
|
|
34
|
+
displayName: displayName,
|
|
35
35
|
url: gen(type, id),
|
|
36
36
|
startIndex: match.index,
|
|
37
37
|
endIndex: match.index + fullMatch.length,
|
|
38
|
-
fullMatch
|
|
38
|
+
fullMatch: fullMatch
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return mentions;
|
|
@@ -44,15 +44,15 @@ export function parseMentions(content, urlGenerator) {
|
|
|
44
44
|
* Convert message content with mentions to HTML
|
|
45
45
|
*/
|
|
46
46
|
export function renderMentionsAsHTML(content, urlGenerator) {
|
|
47
|
-
|
|
47
|
+
var mentions = parseMentions(content, urlGenerator);
|
|
48
48
|
if (mentions.length === 0) {
|
|
49
49
|
return escapeHTML(content);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
mentions.forEach((mention)
|
|
51
|
+
var result = '';
|
|
52
|
+
var lastIndex = 0;
|
|
53
|
+
mentions.forEach(function (mention) {
|
|
54
54
|
result += escapeHTML(content.substring(lastIndex, mention.startIndex));
|
|
55
|
-
result +=
|
|
55
|
+
result += "<a href=\"".concat(mention.url, "\" class=\"mention-link mention-").concat(mention.type, "\" data-mention-type=\"").concat(mention.type, "\" data-mention-id=\"").concat(mention.id, "\">@").concat(escapeHTML(mention.displayName), "</a>");
|
|
56
56
|
lastIndex = mention.endIndex;
|
|
57
57
|
});
|
|
58
58
|
result += escapeHTML(content.substring(lastIndex));
|
|
@@ -62,7 +62,7 @@ export function renderMentionsAsHTML(content, urlGenerator) {
|
|
|
62
62
|
* Create a mention string for insertion into message input
|
|
63
63
|
*/
|
|
64
64
|
export function createMentionString(type, id, displayName) {
|
|
65
|
-
return
|
|
65
|
+
return "[@".concat(displayName, "](").concat(type, ":").concat(id, ")");
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Extract plain text from message content (remove mention markup)
|
|
@@ -75,18 +75,18 @@ export function extractPlainText(content) {
|
|
|
75
75
|
* Check if cursor is inside a mention
|
|
76
76
|
*/
|
|
77
77
|
export function findMentionAtCursor(content, cursorPosition) {
|
|
78
|
-
|
|
79
|
-
return (mentions.find((mention)
|
|
78
|
+
var mentions = parseMentions(content);
|
|
79
|
+
return (mentions.find(function (mention) { return cursorPosition >= mention.startIndex && cursorPosition <= mention.endIndex; }) || null);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Find @ symbol and following text that could be a mention being typed.
|
|
83
83
|
* Supported symbols: @ $ # ! ~ / +
|
|
84
84
|
*/
|
|
85
85
|
export function findPartialMention(content, cursorPosition) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
for (
|
|
89
|
-
|
|
86
|
+
var mentionSymbols = ['@', '$', '#', '!', '~', '/', '+'];
|
|
87
|
+
var symbolIndex = -1;
|
|
88
|
+
for (var i = cursorPosition - 1; i >= 0; i--) {
|
|
89
|
+
var char = content[i];
|
|
90
90
|
if (mentionSymbols.includes(char)) {
|
|
91
91
|
symbolIndex = i;
|
|
92
92
|
break;
|
|
@@ -97,21 +97,21 @@ export function findPartialMention(content, cursorPosition) {
|
|
|
97
97
|
}
|
|
98
98
|
if (symbolIndex === -1)
|
|
99
99
|
return null;
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
var query = content.substring(symbolIndex + 1, cursorPosition).trim();
|
|
101
|
+
var existingMention = findMentionAtCursor(content, symbolIndex);
|
|
102
102
|
if (existingMention)
|
|
103
103
|
return null;
|
|
104
|
-
return { start: symbolIndex, query };
|
|
104
|
+
return { start: symbolIndex, query: query };
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Replace partial mention with complete mention string
|
|
108
108
|
*/
|
|
109
109
|
export function replaceMentionInContent(content, startIndex, endIndex, mentionString) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return { newContent, newCursorPosition };
|
|
110
|
+
var before = content.substring(0, startIndex);
|
|
111
|
+
var after = content.substring(endIndex);
|
|
112
|
+
var newContent = before + mentionString + after;
|
|
113
|
+
var newCursorPosition = startIndex + mentionString.length;
|
|
114
|
+
return { newContent: newContent, newCursorPosition: newCursorPosition };
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Simple HTML escape function
|
package/dist/utils/phone.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { parsePhoneNumberFromString, getCountries, getCountryCallingCode, } from "libphonenumber-js";
|
|
2
|
-
export
|
|
3
|
-
export function toE164(raw, defaultCountry
|
|
2
|
+
export var DEFAULT_COUNTRY = "US";
|
|
3
|
+
export function toE164(raw, defaultCountry) {
|
|
4
|
+
if (defaultCountry === void 0) { defaultCountry = DEFAULT_COUNTRY; }
|
|
4
5
|
if (!raw)
|
|
5
6
|
return null;
|
|
6
|
-
|
|
7
|
+
var trimmed = raw.trim();
|
|
7
8
|
if (!trimmed)
|
|
8
9
|
return null;
|
|
9
|
-
|
|
10
|
-
if (parsed
|
|
10
|
+
var parsed = parsePhoneNumberFromString(trimmed, defaultCountry);
|
|
11
|
+
if (parsed === null || parsed === void 0 ? void 0 : parsed.isValid())
|
|
11
12
|
return parsed.number;
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
15
|
export function formatPhoneForDisplay(e164) {
|
|
15
16
|
if (!e164)
|
|
16
17
|
return "";
|
|
17
|
-
|
|
18
|
+
var parsed = parsePhoneNumberFromString(e164);
|
|
18
19
|
if (!parsed)
|
|
19
20
|
return e164;
|
|
20
21
|
return parsed.country === DEFAULT_COUNTRY ? parsed.formatNational() : parsed.formatInternational();
|
|
21
22
|
}
|
|
22
|
-
export function isValidPhone(raw, defaultCountry
|
|
23
|
+
export function isValidPhone(raw, defaultCountry) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (defaultCountry === void 0) { defaultCountry = DEFAULT_COUNTRY; }
|
|
23
26
|
if (!raw)
|
|
24
27
|
return false;
|
|
25
|
-
|
|
26
|
-
return parsed
|
|
28
|
+
var parsed = parsePhoneNumberFromString(raw.trim(), defaultCountry);
|
|
29
|
+
return (_a = parsed === null || parsed === void 0 ? void 0 : parsed.isValid()) !== null && _a !== void 0 ? _a : false;
|
|
27
30
|
}
|
|
28
|
-
|
|
31
|
+
var COUNTRY_NAMES = {
|
|
29
32
|
US: "United States", CA: "Canada", GB: "United Kingdom", AU: "Australia", NZ: "New Zealand",
|
|
30
33
|
IE: "Ireland", DE: "Germany", FR: "France", ES: "Spain", IT: "Italy", NL: "Netherlands",
|
|
31
34
|
BE: "Belgium", CH: "Switzerland", AT: "Austria", SE: "Sweden", NO: "Norway", DK: "Denmark",
|
|
@@ -40,22 +43,25 @@ function flagEmoji(code) {
|
|
|
40
43
|
return code
|
|
41
44
|
.toUpperCase()
|
|
42
45
|
.split("")
|
|
43
|
-
.map((c)
|
|
46
|
+
.map(function (c) { return String.fromCodePoint(127397 + c.charCodeAt(0)); })
|
|
44
47
|
.join("");
|
|
45
48
|
}
|
|
46
|
-
|
|
49
|
+
var countriesCache = null;
|
|
47
50
|
export function listCountries() {
|
|
48
51
|
if (countriesCache)
|
|
49
52
|
return countriesCache;
|
|
50
|
-
|
|
51
|
-
.map((code)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
var all = getCountries()
|
|
54
|
+
.map(function (code) {
|
|
55
|
+
var _a;
|
|
56
|
+
return ({
|
|
57
|
+
code: code,
|
|
58
|
+
name: (_a = COUNTRY_NAMES[code]) !== null && _a !== void 0 ? _a : code,
|
|
59
|
+
dialCode: "+".concat(getCountryCallingCode(code)),
|
|
60
|
+
flag: flagEmoji(code),
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
.sort(function (a, b) { return a.name.localeCompare(b.name); });
|
|
58
64
|
countriesCache = all;
|
|
59
65
|
return all;
|
|
60
66
|
}
|
|
61
|
-
export
|
|
67
|
+
export var PRIORITY_COUNTRIES = ["US", "CA", "GB", "AU", "MX"];
|
|
@@ -14,19 +14,19 @@ export function stripPhoneNumber(value) {
|
|
|
14
14
|
* Formats a phone number to (xxx) xxx-xxxx format
|
|
15
15
|
*/
|
|
16
16
|
export function formatPhoneNumber(value) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var digits = stripPhoneNumber(value);
|
|
18
|
+
var limitedDigits = digits.slice(0, 10);
|
|
19
19
|
if (limitedDigits.length === 0) {
|
|
20
20
|
return '';
|
|
21
21
|
}
|
|
22
22
|
else if (limitedDigits.length <= 3) {
|
|
23
|
-
return
|
|
23
|
+
return "(".concat(limitedDigits);
|
|
24
24
|
}
|
|
25
25
|
else if (limitedDigits.length <= 6) {
|
|
26
|
-
return
|
|
26
|
+
return "(".concat(limitedDigits.slice(0, 3), ") ").concat(limitedDigits.slice(3));
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
return
|
|
29
|
+
return "(".concat(limitedDigits.slice(0, 3), ") ").concat(limitedDigits.slice(3, 6), "-").concat(limitedDigits.slice(6));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
@@ -45,11 +45,11 @@ export function isValidPhoneNumber(value) {
|
|
|
45
45
|
* Handles input formatting with cursor position preservation
|
|
46
46
|
*/
|
|
47
47
|
export function updatePhoneInput(input, newValue, oldValue) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var cursorPosition = input.selectionStart || 0;
|
|
49
|
+
var oldLength = oldValue.length;
|
|
50
|
+
var newLength = newValue.length;
|
|
51
51
|
input.value = newValue;
|
|
52
|
-
|
|
52
|
+
var newCursorPosition = cursorPosition;
|
|
53
53
|
if (newLength > oldLength) {
|
|
54
54
|
newCursorPosition = cursorPosition + (newLength - oldLength);
|
|
55
55
|
}
|
package/dist/utils/taskUtils.js
CHANGED
|
@@ -67,5 +67,5 @@ export function typeIcon(type) {
|
|
|
67
67
|
* "in_progress" → "In Progress"
|
|
68
68
|
*/
|
|
69
69
|
export function statusLabel(status) {
|
|
70
|
-
return status.replace(/_/g, ' ').replace(/\b\w/g, (c)
|
|
70
|
+
return status.replace(/_/g, ' ').replace(/\b\w/g, function (c) { return c.toUpperCase(); });
|
|
71
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joewinke/jatui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared Svelte 5 component library for JAT projects",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"svelte": "./dist/index.js",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./dnd": {
|
|
16
|
+
"types": "./dist/dnd/index.d.ts",
|
|
17
|
+
"svelte": "./dist/dnd/index.js",
|
|
18
|
+
"default": "./dist/dnd/index.js"
|
|
19
|
+
},
|
|
15
20
|
"./styles/rail.css": "./dist/styles/rail.css"
|
|
16
21
|
},
|
|
17
22
|
"files": [
|
|
@@ -64,7 +69,7 @@
|
|
|
64
69
|
}
|
|
65
70
|
},
|
|
66
71
|
"devDependencies": {
|
|
67
|
-
"@atlaskit/pragmatic-drag-and-drop": "~2.0.
|
|
72
|
+
"@atlaskit/pragmatic-drag-and-drop": "~2.0.0",
|
|
68
73
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "~3.0.0",
|
|
69
74
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "~2.0.0",
|
|
70
75
|
"@atlaskit/pragmatic-drag-and-drop-live-region": "~2.0.0",
|