@forgeroute/ui 0.5.40 → 0.5.41
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/fesm2022/forgeroute-ui-copy-field.mjs +40 -8
- package/fesm2022/forgeroute-ui-copy-field.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-CZOL2U-t.mjs → forgeroute-ui-core-ui-labels.es-Co-rBvSY.mjs} +23 -1
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Co-rBvSY.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-core.mjs +23 -1
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-editor.mjs +87 -18
- package/fesm2022/forgeroute-ui-editor.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs +6 -6
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-copy-field.d.ts +7 -0
- package/types/forgeroute-ui-core.d.ts +22 -0
- package/types/forgeroute-ui-editor.d.ts +11 -0
- package/types/forgeroute-ui-quickbooks.d.ts +1 -1
- package/types/forgeroute-ui-reminder-alerts.d.ts +4 -0
- package/types/forgeroute-ui-square.d.ts +5 -5
- package/types/forgeroute-ui-stripe.d.ts +4 -4
- package/fesm2022/forgeroute-ui-core-ui-labels.es-CZOL2U-t.mjs.map +0 -1
|
@@ -2302,6 +2302,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2302
2302
|
this.loadedBody = signal(null, ...ngDevMode ? [{ debugName: "loadedBody" }] : /* istanbul ignore next */ []);
|
|
2303
2303
|
this.bodyEdited = signal(false, ...ngDevMode ? [{ debugName: "bodyEdited" }] : /* istanbul ignore next */ []);
|
|
2304
2304
|
this.savedSnapshot = signal(null, ...ngDevMode ? [{ debugName: "savedSnapshot" }] : /* istanbul ignore next */ []);
|
|
2305
|
+
this.loadedSnapshot = signal(null, ...ngDevMode ? [{ debugName: "loadedSnapshot" }] : /* istanbul ignore next */ []);
|
|
2305
2306
|
this.dragFromPalette = null;
|
|
2306
2307
|
this.currentColor = signal("#1e293b", ...ngDevMode ? [{ debugName: "currentColor" }] : /* istanbul ignore next */ []);
|
|
2307
2308
|
this.blockSpacing = signal("", ...ngDevMode ? [{ debugName: "blockSpacing" }] : /* istanbul ignore next */ []);
|
|
@@ -2566,6 +2567,11 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2566
2567
|
this.syncActiveBlockHtml();
|
|
2567
2568
|
this.editingId.set(id);
|
|
2568
2569
|
this.savedSnapshot.set(this.snapshot());
|
|
2570
|
+
this.loadedSnapshot.set(this.snapshot());
|
|
2571
|
+
}
|
|
2572
|
+
hasUnsavedWork() {
|
|
2573
|
+
this.syncActiveBlockHtml();
|
|
2574
|
+
return this.canWrite() && this.loadedSnapshot() !== null && this.loadedSnapshot() !== this.snapshot();
|
|
2569
2575
|
}
|
|
2570
2576
|
closeTestSend() {
|
|
2571
2577
|
this.showTestSendDialog.set(false);
|
|
@@ -2599,6 +2605,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2599
2605
|
this.assignedKeys.set([...t?.assignments ?? []]);
|
|
2600
2606
|
this.assignmentsTouched.set(false);
|
|
2601
2607
|
this.savedSnapshot.set(t?.id ? this.snapshot() : null);
|
|
2608
|
+
this.loadedSnapshot.set(this.snapshot());
|
|
2602
2609
|
}
|
|
2603
2610
|
onBodyFocusOut(event) {
|
|
2604
2611
|
const next = event.relatedTarget;
|
|
@@ -2945,12 +2952,36 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2945
2952
|
if (range.collapsed || !insideEditorBlock(range.commonAncestorContainer)) return;
|
|
2946
2953
|
this.bodyEdited.set(true);
|
|
2947
2954
|
try {
|
|
2948
|
-
const
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2955
|
+
const pieces = [];
|
|
2956
|
+
const root = range.commonAncestorContainer;
|
|
2957
|
+
const walker = document.createTreeWalker(root.nodeType === Node.TEXT_NODE ? root.parentNode : root, NodeFilter.SHOW_TEXT);
|
|
2958
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) {
|
|
2959
|
+
if (!range.intersectsNode(n)) continue;
|
|
2960
|
+
const start = n === range.startContainer ? range.startOffset : 0;
|
|
2961
|
+
const end = n === range.endContainer ? range.endOffset : n.length;
|
|
2962
|
+
if (end > start) pieces.push({
|
|
2963
|
+
node: n,
|
|
2964
|
+
start,
|
|
2965
|
+
end
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
const spans = [];
|
|
2969
|
+
for (const { node, start, end } of pieces) {
|
|
2970
|
+
if (end < node.length) node.splitText(end);
|
|
2971
|
+
const target = start > 0 ? node.splitText(start) : node;
|
|
2972
|
+
const span = document.createElement("span");
|
|
2973
|
+
span.style.fontSize = size;
|
|
2974
|
+
target.parentNode.insertBefore(span, target);
|
|
2975
|
+
span.appendChild(target);
|
|
2976
|
+
spans.push(span);
|
|
2977
|
+
}
|
|
2978
|
+
if (spans.length > 0) {
|
|
2979
|
+
const after = document.createRange();
|
|
2980
|
+
after.setStartBefore(spans[0]);
|
|
2981
|
+
after.setEndAfter(spans[spans.length - 1]);
|
|
2982
|
+
sel.removeAllRanges();
|
|
2983
|
+
sel.addRange(after);
|
|
2984
|
+
}
|
|
2954
2985
|
} catch {
|
|
2955
2986
|
document.execCommand("insertHTML", false, `<span style="font-size:${escapeHtml(size)}">${escapeHtml(sel.toString())}</span>`);
|
|
2956
2987
|
}
|
|
@@ -2973,6 +3004,44 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2973
3004
|
this.showSpecialPanel.set(false);
|
|
2974
3005
|
this.colorPanel.update((v) => v === which ? null : which);
|
|
2975
3006
|
}
|
|
3007
|
+
closePanel(which) {
|
|
3008
|
+
if (which === "emoji") this.showEmojiPanel.set(false);
|
|
3009
|
+
else if (which === "special") this.showSpecialPanel.set(false);
|
|
3010
|
+
else this.colorPanel.set(null);
|
|
3011
|
+
const id = which === "text" ? "text-color-button" : which === "highlight" ? "highlight-color-button" : which === "emoji" ? "emoji-button" : "special-button";
|
|
3012
|
+
this.host.nativeElement.querySelector(`[data-testid="${id}"] button`)?.focus();
|
|
3013
|
+
}
|
|
3014
|
+
colorName(index) {
|
|
3015
|
+
const GREYS = [
|
|
3016
|
+
"black",
|
|
3017
|
+
"charcoal",
|
|
3018
|
+
"darkSlate",
|
|
3019
|
+
"slate",
|
|
3020
|
+
"lightSlate",
|
|
3021
|
+
"silver",
|
|
3022
|
+
"lightGrey",
|
|
3023
|
+
"paleGrey",
|
|
3024
|
+
"offWhite",
|
|
3025
|
+
"white"
|
|
3026
|
+
];
|
|
3027
|
+
const HUES = [
|
|
3028
|
+
"red",
|
|
3029
|
+
"orange",
|
|
3030
|
+
"amber",
|
|
3031
|
+
"yellow",
|
|
3032
|
+
"green",
|
|
3033
|
+
"teal",
|
|
3034
|
+
"skyBlue",
|
|
3035
|
+
"blue",
|
|
3036
|
+
"violet",
|
|
3037
|
+
"magenta"
|
|
3038
|
+
];
|
|
3039
|
+
const row = Math.floor(index / 10), col = index % 10;
|
|
3040
|
+
if (row === 0) return this.labels.t(`emailTemplateEditor.colorName.${GREYS[col]}`);
|
|
3041
|
+
const hue = this.labels.t(`emailTemplateEditor.colorName.${HUES[col]}`);
|
|
3042
|
+
if (row === 1) return hue;
|
|
3043
|
+
return this.labels.t(row === 2 ? "emailTemplateEditor.colorLight" : "emailTemplateEditor.colorDark", { color: hue.toLowerCase() });
|
|
3044
|
+
}
|
|
2976
3045
|
pickColor(which, color) {
|
|
2977
3046
|
this.colorPanel.set(null);
|
|
2978
3047
|
if (which === "text") this.applyTextColor(color);
|
|
@@ -3714,11 +3783,11 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
3714
3783
|
<div class="assignment-group" role="heading" aria-level="5" data-testid="assignment-group">{{ item.group }}</div>
|
|
3715
3784
|
}
|
|
3716
3785
|
<div class="assignment-item" data-testid="assignment-item" [attr.data-assignment]="item.key" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
|
|
3717
|
-
[attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
|
|
3786
|
+
[attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null" [attr.aria-describedby]="canWrite() ? idPrefix() + '-assignment-desc-' + item.key : null"
|
|
3718
3787
|
(click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
|
|
3719
3788
|
<div class="assignment-text">
|
|
3720
3789
|
<strong data-testid="assignment-name">{{ item.name }}</strong>
|
|
3721
|
-
<span>{{ item.description }}</span>
|
|
3790
|
+
<span [id]="idPrefix() + '-assignment-desc-' + item.key">{{ item.description }}</span>
|
|
3722
3791
|
</div>
|
|
3723
3792
|
<div class="assignment-channels">
|
|
3724
3793
|
<span class="channel-badge" [class.active]="item.assigned" role="img" [attr.aria-label]="item.assigned ? labels.t('emailTemplateEditor.emailOn') : labels.t('emailTemplateEditor.emailOff')">
|
|
@@ -3885,7 +3954,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
3885
3954
|
|
|
3886
3955
|
<!-- Colour picker (inline panel, for the text colour and the highlight): a grid of ready colours, a custom colour (the browser's own dialog) and Remove -->
|
|
3887
3956
|
@if (canWrite() && colorPanel(); as which) {
|
|
3888
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="colorPanel
|
|
3957
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel(colorPanel() === 'highlight' ? 'highlight' : 'text')">
|
|
3889
3958
|
<div class="emoji-panel-head">
|
|
3890
3959
|
<span class="link-dialog-title">{{ labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor') }}</span>
|
|
3891
3960
|
<ui-button variant="secondary" size="sm" data-testid="color-remove" (click)="removeColor(which)">{{ labels.t('emailTemplateEditor.removeColor') }}</ui-button>
|
|
@@ -3894,7 +3963,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
3894
3963
|
</div>
|
|
3895
3964
|
<div class="color-grid" data-testid="color-grid">
|
|
3896
3965
|
@for (c of colorSwatches; track c) {
|
|
3897
|
-
<button type="button" class="color-swatch" data-testid="color-swatch" [style.background]="c" [attr.aria-label]="
|
|
3966
|
+
<button type="button" class="color-swatch" data-testid="color-swatch" [style.background]="c" [attr.data-color]="c" [attr.aria-label]="colorName($index)" [attr.title]="colorName($index)" [class.selected]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" [attr.aria-pressed]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" (click)="pickColor(which, c)"></button>
|
|
3898
3967
|
}
|
|
3899
3968
|
</div>
|
|
3900
3969
|
</div>
|
|
@@ -3902,7 +3971,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
3902
3971
|
|
|
3903
3972
|
<!-- Emoji picker (inline popover): a search box, category tabs and a skin tone; a click inserts the emoji at the caret and the panel stays open for more -->
|
|
3904
3973
|
@if (canWrite() && showEmojiPanel()) {
|
|
3905
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)">
|
|
3974
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel('emoji')">
|
|
3906
3975
|
<div class="emoji-panel-head">
|
|
3907
3976
|
<ui-text-input class="emoji-search" data-testid="emoji-search" [ariaLabel]="labels.t('emailTemplateEditor.emojiSearch')" [placeholder]="labels.t('emailTemplateEditor.emojiSearch')" [(ngModel)]="emojiSearch" (mousedown)="saveSelection()" />
|
|
3908
3977
|
<ui-select class="emoji-tone" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emojiSkinTone')" [options]="skinToneOptions()" [(ngModel)]="emojiTone" (mousedown)="saveSelection()" />
|
|
@@ -3927,7 +3996,7 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
3927
3996
|
|
|
3928
3997
|
<!-- Special characters (inline popover) -->
|
|
3929
3998
|
@if (canWrite() && showSpecialPanel()) {
|
|
3930
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)">
|
|
3999
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel('special')">
|
|
3931
4000
|
<div class="emoji-panel-head">
|
|
3932
4001
|
<span class="link-dialog-title">{{ labels.t('emailTemplateEditor.specialCharactersTitle') }}</span>
|
|
3933
4002
|
<ui-button variant="secondary" size="sm" (click)="showSpecialPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
|
|
@@ -4589,11 +4658,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4589
4658
|
<div class="assignment-group" role="heading" aria-level="5" data-testid="assignment-group">{{ item.group }}</div>
|
|
4590
4659
|
}
|
|
4591
4660
|
<div class="assignment-item" data-testid="assignment-item" [attr.data-assignment]="item.key" [class.assignment-readonly]="!canWrite()" [attr.role]="canWrite() ? 'switch' : null" [attr.tabindex]="canWrite() ? 0 : null"
|
|
4592
|
-
[attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null"
|
|
4661
|
+
[attr.aria-checked]="canWrite() ? item.assigned : null" [attr.aria-label]="canWrite() ? item.name : null" [attr.aria-describedby]="canWrite() ? idPrefix() + '-assignment-desc-' + item.key : null"
|
|
4593
4662
|
(click)="toggleAssignment(item)" (keydown.enter)="toggleAssignment(item); $event.preventDefault()" (keydown.space)="toggleAssignment(item); $event.preventDefault()">
|
|
4594
4663
|
<div class="assignment-text">
|
|
4595
4664
|
<strong data-testid="assignment-name">{{ item.name }}</strong>
|
|
4596
|
-
<span>{{ item.description }}</span>
|
|
4665
|
+
<span [id]="idPrefix() + '-assignment-desc-' + item.key">{{ item.description }}</span>
|
|
4597
4666
|
</div>
|
|
4598
4667
|
<div class="assignment-channels">
|
|
4599
4668
|
<span class="channel-badge" [class.active]="item.assigned" role="img" [attr.aria-label]="item.assigned ? labels.t('emailTemplateEditor.emailOn') : labels.t('emailTemplateEditor.emailOff')">
|
|
@@ -4760,7 +4829,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4760
4829
|
|
|
4761
4830
|
<!-- Colour picker (inline panel, for the text colour and the highlight): a grid of ready colours, a custom colour (the browser's own dialog) and Remove -->
|
|
4762
4831
|
@if (canWrite() && colorPanel(); as which) {
|
|
4763
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="colorPanel
|
|
4832
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor')" data-testid="color-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel(colorPanel() === 'highlight' ? 'highlight' : 'text')">
|
|
4764
4833
|
<div class="emoji-panel-head">
|
|
4765
4834
|
<span class="link-dialog-title">{{ labels.t(which === 'text' ? 'emailTemplateEditor.textColor' : 'emailTemplateEditor.highlightColor') }}</span>
|
|
4766
4835
|
<ui-button variant="secondary" size="sm" data-testid="color-remove" (click)="removeColor(which)">{{ labels.t('emailTemplateEditor.removeColor') }}</ui-button>
|
|
@@ -4769,7 +4838,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4769
4838
|
</div>
|
|
4770
4839
|
<div class="color-grid" data-testid="color-grid">
|
|
4771
4840
|
@for (c of colorSwatches; track c) {
|
|
4772
|
-
<button type="button" class="color-swatch" data-testid="color-swatch" [style.background]="c" [attr.aria-label]="
|
|
4841
|
+
<button type="button" class="color-swatch" data-testid="color-swatch" [style.background]="c" [attr.data-color]="c" [attr.aria-label]="colorName($index)" [attr.title]="colorName($index)" [class.selected]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" [attr.aria-pressed]="(which === 'text' ? currentColor() : currentHighlight()).toLowerCase() === c" (click)="pickColor(which, c)"></button>
|
|
4773
4842
|
}
|
|
4774
4843
|
</div>
|
|
4775
4844
|
</div>
|
|
@@ -4777,7 +4846,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4777
4846
|
|
|
4778
4847
|
<!-- Emoji picker (inline popover): a search box, category tabs and a skin tone; a click inserts the emoji at the caret and the panel stays open for more -->
|
|
4779
4848
|
@if (canWrite() && showEmojiPanel()) {
|
|
4780
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)">
|
|
4849
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.emoji')" data-testid="emoji-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel('emoji')">
|
|
4781
4850
|
<div class="emoji-panel-head">
|
|
4782
4851
|
<ui-text-input class="emoji-search" data-testid="emoji-search" [ariaLabel]="labels.t('emailTemplateEditor.emojiSearch')" [placeholder]="labels.t('emailTemplateEditor.emojiSearch')" [(ngModel)]="emojiSearch" (mousedown)="saveSelection()" />
|
|
4783
4852
|
<ui-select class="emoji-tone" size="sm" [ariaLabel]="labels.t('emailTemplateEditor.emojiSkinTone')" [options]="skinToneOptions()" [(ngModel)]="emojiTone" (mousedown)="saveSelection()" />
|
|
@@ -4802,7 +4871,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4802
4871
|
|
|
4803
4872
|
<!-- Special characters (inline popover) -->
|
|
4804
4873
|
@if (canWrite() && showSpecialPanel()) {
|
|
4805
|
-
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)">
|
|
4874
|
+
<div class="link-dialog emoji-panel" role="group" [attr.aria-label]="labels.t('emailTemplateEditor.specialCharacters')" data-testid="special-panel" (mousedown)="preventFocusLoss($event)" (keydown.escape)="closePanel('special')">
|
|
4806
4875
|
<div class="emoji-panel-head">
|
|
4807
4876
|
<span class="link-dialog-title">{{ labels.t('emailTemplateEditor.specialCharactersTitle') }}</span>
|
|
4808
4877
|
<ui-button variant="secondary" size="sm" (click)="showSpecialPanel.set(false)">{{ labels.t('emailTemplateEditor.emojiClose') }}</ui-button>
|