scb-wc-test 0.1.129 → 0.1.131
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/blazor/ScbBlazorInteropBase.cs +170 -0
- package/blazor/scb-blazor-bridge.js +144 -0
- package/mvc/components/scb-calendar/scb-calendar.js +7 -6
- package/mvc/components/scb-dialog/scb-dialog.js +45 -16
- package/mvc/scb-blazor-bridge.js +144 -0
- package/package.json +2 -2
- package/scb-calendar/scb-calendar.js +20 -15
- package/scb-dialog/scb-dialog.js +80 -51
- package/scb-wc-test.bundle.js +34 -4
|
@@ -5,6 +5,7 @@ som kan användas direkt i Razor-vyer */
|
|
|
5
5
|
|
|
6
6
|
using System;
|
|
7
7
|
using System.Linq;
|
|
8
|
+
using System.Collections.Generic;
|
|
8
9
|
using System.Threading.Tasks;
|
|
9
10
|
using Microsoft.AspNetCore.Components;
|
|
10
11
|
using Microsoft.JSInterop;
|
|
@@ -112,6 +113,15 @@ namespace ScbBlazorDemo
|
|
|
112
113
|
// Alla innehållsförteckningar (scb-toc) på sidan
|
|
113
114
|
protected TocState[] Tocs { get; private set; } = Array.Empty<TocState>();
|
|
114
115
|
|
|
116
|
+
// Enskild scrollspy (scb-scrollspy) för scenarion där man bara bryr sig om en
|
|
117
|
+
protected ScrollspyState Scrollspy { get; private set; } = new();
|
|
118
|
+
|
|
119
|
+
// Alla scrollspy-instanser (scb-scrollspy) på sidan
|
|
120
|
+
protected ScrollspyState[] Scrollspies { get; private set; } = Array.Empty<ScrollspyState>();
|
|
121
|
+
|
|
122
|
+
// Uppslag med alla scrollspy-instanser (scb-scrollspy) nycklade på id-attributet
|
|
123
|
+
protected Dictionary<string, ScrollspyState> ScrollspiesById { get; private set; } = new Dictionary<string, ScrollspyState>(StringComparer.Ordinal);
|
|
124
|
+
|
|
115
125
|
// Alla viz-komponenter (scb-viz) på sidan
|
|
116
126
|
protected VizState[] Viz { get; private set; } = Array.Empty<VizState>();
|
|
117
127
|
|
|
@@ -808,6 +818,128 @@ namespace ScbBlazorDemo
|
|
|
808
818
|
Tocs = Array.Empty<TocState>();
|
|
809
819
|
}
|
|
810
820
|
|
|
821
|
+
|
|
822
|
+
// Enskild scrollspy: baseras på första scrollspy:n om en lista finns, annars på state.Scrollspy
|
|
823
|
+
if (state.Scrollspies is not null && state.Scrollspies.Length > 0)
|
|
824
|
+
{
|
|
825
|
+
var dto = state.Scrollspies[0];
|
|
826
|
+
Scrollspy.Id = dto.Id ?? string.Empty;
|
|
827
|
+
Scrollspy.ActiveId = dto.ActiveId ?? string.Empty;
|
|
828
|
+
Scrollspy.NavSelector = dto.NavSelector ?? string.Empty;
|
|
829
|
+
Scrollspy.OffsetTop = dto.OffsetTop;
|
|
830
|
+
Scrollspy.OffsetBottom = dto.OffsetBottom;
|
|
831
|
+
Scrollspy.UpdateHash = dto.UpdateHash;
|
|
832
|
+
Scrollspy.Layout = dto.Layout ?? string.Empty;
|
|
833
|
+
Scrollspy.SidebarNavWidth = dto.SidebarNavWidth ?? string.Empty;
|
|
834
|
+
Scrollspy.SidebarHeight = dto.SidebarHeight ?? string.Empty;
|
|
835
|
+
Scrollspy.StackHeight = dto.StackHeight ?? string.Empty;
|
|
836
|
+
Scrollspy.SidebarNavTop = dto.SidebarNavTop ?? string.Empty;
|
|
837
|
+
Scrollspy.ContentPadding = dto.ContentPadding ?? string.Empty;
|
|
838
|
+
}
|
|
839
|
+
else if (state.Scrollspy is not null)
|
|
840
|
+
{
|
|
841
|
+
Scrollspy.Id = state.Scrollspy.Id ?? string.Empty;
|
|
842
|
+
Scrollspy.ActiveId = state.Scrollspy.ActiveId ?? string.Empty;
|
|
843
|
+
Scrollspy.NavSelector = state.Scrollspy.NavSelector ?? string.Empty;
|
|
844
|
+
Scrollspy.OffsetTop = state.Scrollspy.OffsetTop;
|
|
845
|
+
Scrollspy.OffsetBottom = state.Scrollspy.OffsetBottom;
|
|
846
|
+
Scrollspy.UpdateHash = state.Scrollspy.UpdateHash;
|
|
847
|
+
Scrollspy.Layout = state.Scrollspy.Layout ?? string.Empty;
|
|
848
|
+
Scrollspy.SidebarNavWidth = state.Scrollspy.SidebarNavWidth ?? string.Empty;
|
|
849
|
+
Scrollspy.SidebarHeight = state.Scrollspy.SidebarHeight ?? string.Empty;
|
|
850
|
+
Scrollspy.StackHeight = state.Scrollspy.StackHeight ?? string.Empty;
|
|
851
|
+
Scrollspy.SidebarNavTop = state.Scrollspy.SidebarNavTop ?? string.Empty;
|
|
852
|
+
Scrollspy.ContentPadding = state.Scrollspy.ContentPadding ?? string.Empty;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// Lista med alla scrollspy-instanser
|
|
856
|
+
if (state.Scrollspies is not null && state.Scrollspies.Length > 0)
|
|
857
|
+
{
|
|
858
|
+
var scrollspies = new ScrollspyState[state.Scrollspies.Length];
|
|
859
|
+
for (var i = 0; i < state.Scrollspies.Length; i++)
|
|
860
|
+
{
|
|
861
|
+
var dto = state.Scrollspies[i];
|
|
862
|
+
scrollspies[i] = new ScrollspyState
|
|
863
|
+
{
|
|
864
|
+
Id = dto.Id ?? string.Empty,
|
|
865
|
+
ActiveId = dto.ActiveId ?? string.Empty,
|
|
866
|
+
NavSelector = dto.NavSelector ?? string.Empty,
|
|
867
|
+
OffsetTop = dto.OffsetTop,
|
|
868
|
+
OffsetBottom = dto.OffsetBottom,
|
|
869
|
+
UpdateHash = dto.UpdateHash,
|
|
870
|
+
Layout = dto.Layout ?? string.Empty,
|
|
871
|
+
SidebarNavWidth = dto.SidebarNavWidth ?? string.Empty,
|
|
872
|
+
SidebarHeight = dto.SidebarHeight ?? string.Empty,
|
|
873
|
+
StackHeight = dto.StackHeight ?? string.Empty,
|
|
874
|
+
SidebarNavTop = dto.SidebarNavTop ?? string.Empty,
|
|
875
|
+
ContentPadding = dto.ContentPadding ?? string.Empty
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
Scrollspies = scrollspies;
|
|
880
|
+
}
|
|
881
|
+
else
|
|
882
|
+
{
|
|
883
|
+
Scrollspies = Array.Empty<ScrollspyState>();
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Uppslag med alla scrollspy-instanser nycklade på id
|
|
887
|
+
if (state.ScrollspiesById is not null && state.ScrollspiesById.Count > 0)
|
|
888
|
+
{
|
|
889
|
+
var byId = new Dictionary<string, ScrollspyState>(state.ScrollspiesById.Count, StringComparer.Ordinal);
|
|
890
|
+
foreach (var kvp in state.ScrollspiesById)
|
|
891
|
+
{
|
|
892
|
+
var id = kvp.Key;
|
|
893
|
+
var dto = kvp.Value;
|
|
894
|
+
|
|
895
|
+
if (string.IsNullOrWhiteSpace(id) || dto is null)
|
|
896
|
+
{
|
|
897
|
+
continue;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
byId[id] = new ScrollspyState
|
|
901
|
+
{
|
|
902
|
+
Id = id,
|
|
903
|
+
ActiveId = dto.ActiveId ?? string.Empty,
|
|
904
|
+
NavSelector = dto.NavSelector ?? string.Empty,
|
|
905
|
+
OffsetTop = dto.OffsetTop,
|
|
906
|
+
OffsetBottom = dto.OffsetBottom,
|
|
907
|
+
UpdateHash = dto.UpdateHash,
|
|
908
|
+
Layout = dto.Layout ?? string.Empty,
|
|
909
|
+
SidebarNavWidth = dto.SidebarNavWidth ?? string.Empty,
|
|
910
|
+
SidebarHeight = dto.SidebarHeight ?? string.Empty,
|
|
911
|
+
StackHeight = dto.StackHeight ?? string.Empty,
|
|
912
|
+
SidebarNavTop = dto.SidebarNavTop ?? string.Empty,
|
|
913
|
+
ContentPadding = dto.ContentPadding ?? string.Empty
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
ScrollspiesById = byId;
|
|
918
|
+
}
|
|
919
|
+
else if (Scrollspies.Length > 0)
|
|
920
|
+
{
|
|
921
|
+
var byId = new Dictionary<string, ScrollspyState>(Scrollspies.Length, StringComparer.Ordinal);
|
|
922
|
+
for (var i = 0; i < Scrollspies.Length; i++)
|
|
923
|
+
{
|
|
924
|
+
var sp = Scrollspies[i];
|
|
925
|
+
var id = sp.Id;
|
|
926
|
+
|
|
927
|
+
if (string.IsNullOrWhiteSpace(id))
|
|
928
|
+
{
|
|
929
|
+
id = $"scrollspy-{i + 1}";
|
|
930
|
+
sp.Id = id;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
byId[id] = sp;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
ScrollspiesById = byId;
|
|
937
|
+
}
|
|
938
|
+
else
|
|
939
|
+
{
|
|
940
|
+
ScrollspiesById = new Dictionary<string, ScrollspyState>(StringComparer.Ordinal);
|
|
941
|
+
}
|
|
942
|
+
|
|
811
943
|
// Viz
|
|
812
944
|
if (state.Viz is not null && state.Viz.Length > 0)
|
|
813
945
|
{
|
|
@@ -1438,6 +1570,22 @@ namespace ScbBlazorDemo
|
|
|
1438
1570
|
public bool Divider { get; set; }
|
|
1439
1571
|
}
|
|
1440
1572
|
|
|
1573
|
+
protected sealed class ScrollspyState
|
|
1574
|
+
{
|
|
1575
|
+
public string Id { get; set; } = string.Empty;
|
|
1576
|
+
public string ActiveId { get; set; } = string.Empty;
|
|
1577
|
+
public double OffsetTop { get; set; }
|
|
1578
|
+
public double OffsetBottom { get; set; }
|
|
1579
|
+
public bool UpdateHash { get; set; }
|
|
1580
|
+
public string NavSelector { get; set; } = string.Empty;
|
|
1581
|
+
public string Layout { get; set; } = string.Empty;
|
|
1582
|
+
public string SidebarNavWidth { get; set; } = string.Empty;
|
|
1583
|
+
public string SidebarHeight { get; set; } = string.Empty;
|
|
1584
|
+
public string StackHeight { get; set; } = string.Empty;
|
|
1585
|
+
public string SidebarNavTop { get; set; } = string.Empty;
|
|
1586
|
+
public string ContentPadding { get; set; } = string.Empty;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1441
1589
|
protected sealed class VizState
|
|
1442
1590
|
{
|
|
1443
1591
|
public string Variant { get; set; } = string.Empty;
|
|
@@ -1515,6 +1663,12 @@ namespace ScbBlazorDemo
|
|
|
1515
1663
|
|
|
1516
1664
|
public TocDto[] Tocs { get; set; } = Array.Empty<TocDto>();
|
|
1517
1665
|
|
|
1666
|
+
public ScrollspyDto Scrollspy { get; set; } = new();
|
|
1667
|
+
|
|
1668
|
+
public ScrollspyDto[] Scrollspies { get; set; } = Array.Empty<ScrollspyDto>();
|
|
1669
|
+
|
|
1670
|
+
public Dictionary<string, ScrollspyDto> ScrollspiesById { get; set; } = new();
|
|
1671
|
+
|
|
1518
1672
|
public VizDto[] Viz { get; set; } = Array.Empty<VizDto>();
|
|
1519
1673
|
}
|
|
1520
1674
|
|
|
@@ -1779,6 +1933,22 @@ namespace ScbBlazorDemo
|
|
|
1779
1933
|
public string? Text { get; set; }
|
|
1780
1934
|
}
|
|
1781
1935
|
|
|
1936
|
+
private sealed class ScrollspyDto
|
|
1937
|
+
{
|
|
1938
|
+
public string? Id { get; set; }
|
|
1939
|
+
public string? ActiveId { get; set; }
|
|
1940
|
+
public double OffsetTop { get; set; }
|
|
1941
|
+
public double OffsetBottom { get; set; }
|
|
1942
|
+
public bool UpdateHash { get; set; }
|
|
1943
|
+
public string? NavSelector { get; set; }
|
|
1944
|
+
public string? Layout { get; set; }
|
|
1945
|
+
public string? SidebarNavWidth { get; set; }
|
|
1946
|
+
public string? SidebarHeight { get; set; }
|
|
1947
|
+
public string? StackHeight { get; set; }
|
|
1948
|
+
public string? SidebarNavTop { get; set; }
|
|
1949
|
+
public string? ContentPadding { get; set; }
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1782
1952
|
private sealed class TocDto
|
|
1783
1953
|
{
|
|
1784
1954
|
public bool Detached { get; set; }
|
|
@@ -81,6 +81,17 @@
|
|
|
81
81
|
else el.setAttribute('search-text', String(v));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
function mirrorScrollspyActive(el, ev) {
|
|
87
|
+
const id = (ev && ev.detail && (ev.detail.id ?? ev.detail.activeId)) ?? '';
|
|
88
|
+
try {
|
|
89
|
+
el.activeId = id;
|
|
90
|
+
} catch (_) {}
|
|
91
|
+
if (!id) el.removeAttribute('active-id');
|
|
92
|
+
else el.setAttribute('active-id', String(id));
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
/* Regler som beskriver hur komponenternas egna events ska översättas
|
|
85
96
|
till enklare, Blazor-vänliga events (och ibland speglas till properties). */
|
|
86
97
|
const RULES = [
|
|
@@ -664,6 +675,14 @@
|
|
|
664
675
|
from: 'scb-step-change',
|
|
665
676
|
to: 'stepchange',
|
|
666
677
|
},
|
|
678
|
+
|
|
679
|
+
// scb-scrollspy
|
|
680
|
+
{
|
|
681
|
+
sel: 'scb-scrollspy',
|
|
682
|
+
from: 'scb-scrollspy-active-changed',
|
|
683
|
+
to: 'scrollspyactivechange',
|
|
684
|
+
mirror: mirrorScrollspyActive,
|
|
685
|
+
},
|
|
667
686
|
];
|
|
668
687
|
|
|
669
688
|
/* Indexering av regler per source event för snabbare lookup vid dispatch. */
|
|
@@ -1066,6 +1085,7 @@ window.SCBBlazor.getState = function () {
|
|
|
1066
1085
|
const tooltips = document.querySelectorAll('scb-tooltip');
|
|
1067
1086
|
const textfields = document.querySelectorAll('scb-textfield');
|
|
1068
1087
|
const searches = document.querySelectorAll('scb-search');
|
|
1088
|
+
const scrollspies = document.querySelectorAll('scb-scrollspy');
|
|
1069
1089
|
const tocs = document.querySelectorAll('scb-toc');
|
|
1070
1090
|
const vizs = document.querySelectorAll('scb-viz');
|
|
1071
1091
|
const lists = document.querySelectorAll('scb-list');
|
|
@@ -1682,6 +1702,125 @@ window.SCBBlazor.getState = function () {
|
|
|
1682
1702
|
};
|
|
1683
1703
|
});
|
|
1684
1704
|
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
// Alla scb-scrollspy på sidan
|
|
1708
|
+
const scrollspiesState = Array.from(scrollspies).map((sp, index) => {
|
|
1709
|
+
const anySp = sp;
|
|
1710
|
+
|
|
1711
|
+
const id = (sp.getAttribute('id') || '').toString().trim() || `scrollspy-${index + 1}`;
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
const activeId = (
|
|
1715
|
+
anySp.activeId ??
|
|
1716
|
+
sp.getAttribute('active-id') ??
|
|
1717
|
+
''
|
|
1718
|
+
).toString();
|
|
1719
|
+
|
|
1720
|
+
const navSelector = (
|
|
1721
|
+
anySp.navSelector ??
|
|
1722
|
+
sp.getAttribute('nav-selector') ??
|
|
1723
|
+
''
|
|
1724
|
+
).toString();
|
|
1725
|
+
|
|
1726
|
+
const layout = (
|
|
1727
|
+
anySp.layout ??
|
|
1728
|
+
sp.getAttribute('layout') ??
|
|
1729
|
+
''
|
|
1730
|
+
).toString();
|
|
1731
|
+
|
|
1732
|
+
const sidebarNavWidth = (
|
|
1733
|
+
anySp.sidebarNavWidth ??
|
|
1734
|
+
sp.getAttribute('sidebar-nav-width') ??
|
|
1735
|
+
'320px'
|
|
1736
|
+
).toString();
|
|
1737
|
+
|
|
1738
|
+
const sidebarHeight = (
|
|
1739
|
+
anySp.sidebarHeight ??
|
|
1740
|
+
sp.getAttribute('sidebar-height') ??
|
|
1741
|
+
'560px'
|
|
1742
|
+
).toString();
|
|
1743
|
+
|
|
1744
|
+
const stackHeight = (
|
|
1745
|
+
anySp.stackHeight ??
|
|
1746
|
+
sp.getAttribute('stack-height') ??
|
|
1747
|
+
''
|
|
1748
|
+
).toString();
|
|
1749
|
+
|
|
1750
|
+
const sidebarNavTop = (
|
|
1751
|
+
anySp.sidebarNavTop ??
|
|
1752
|
+
sp.getAttribute('sidebar-nav-top') ??
|
|
1753
|
+
'0px'
|
|
1754
|
+
).toString();
|
|
1755
|
+
|
|
1756
|
+
const contentPadding = (
|
|
1757
|
+
anySp.contentPadding ??
|
|
1758
|
+
sp.getAttribute('content-padding') ??
|
|
1759
|
+
'0px'
|
|
1760
|
+
).toString();
|
|
1761
|
+
|
|
1762
|
+
let offsetTop = 0;
|
|
1763
|
+
if (typeof anySp.offsetTop === 'number') {
|
|
1764
|
+
offsetTop = anySp.offsetTop;
|
|
1765
|
+
} else {
|
|
1766
|
+
const v = parseFloat(sp.getAttribute('offset-top') || '0');
|
|
1767
|
+
offsetTop = Number.isFinite(v) ? v : 0;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
let offsetBottom = 0;
|
|
1771
|
+
if (typeof anySp.offsetBottom === 'number') {
|
|
1772
|
+
offsetBottom = anySp.offsetBottom;
|
|
1773
|
+
} else {
|
|
1774
|
+
const v = parseFloat(sp.getAttribute('offset-bottom') || '0');
|
|
1775
|
+
offsetBottom = Number.isFinite(v) ? v : 0;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
const updateHash =
|
|
1779
|
+
typeof anySp.updateHash === 'boolean'
|
|
1780
|
+
? anySp.updateHash
|
|
1781
|
+
: sp.hasAttribute('update-hash');
|
|
1782
|
+
|
|
1783
|
+
return {
|
|
1784
|
+
id,
|
|
1785
|
+
activeId,
|
|
1786
|
+
offsetTop,
|
|
1787
|
+
offsetBottom,
|
|
1788
|
+
updateHash,
|
|
1789
|
+
navSelector,
|
|
1790
|
+
layout,
|
|
1791
|
+
sidebarNavWidth,
|
|
1792
|
+
sidebarHeight,
|
|
1793
|
+
stackHeight,
|
|
1794
|
+
sidebarNavTop,
|
|
1795
|
+
contentPadding,
|
|
1796
|
+
};
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
const scrollspyState =
|
|
1800
|
+
scrollspiesState.length > 0
|
|
1801
|
+
? scrollspiesState[0]
|
|
1802
|
+
: {
|
|
1803
|
+
id: '',
|
|
1804
|
+
activeId: '',
|
|
1805
|
+
offsetTop: 0,
|
|
1806
|
+
offsetBottom: 0,
|
|
1807
|
+
updateHash: true,
|
|
1808
|
+
navSelector: '',
|
|
1809
|
+
layout: '',
|
|
1810
|
+
sidebarNavWidth: '320px',
|
|
1811
|
+
sidebarHeight: '560px',
|
|
1812
|
+
stackHeight: '',
|
|
1813
|
+
sidebarNavTop: '0px',
|
|
1814
|
+
contentPadding: '0px',
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
// Uppslag där scrollspy-instanser kan hämtas via sitt id-attribut
|
|
1818
|
+
const scrollspiesById = {};
|
|
1819
|
+
for (const sp of scrollspiesState) {
|
|
1820
|
+
if (!sp || !sp.id) continue;
|
|
1821
|
+
scrollspiesById[sp.id] = sp;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1685
1824
|
// Alla scb-viz på sidan
|
|
1686
1825
|
const vizState = Array.from(vizs).map((v) => {
|
|
1687
1826
|
const anyV = v;
|
|
@@ -1989,6 +2128,9 @@ const subMenusState = Array.from(subMenus).map((sm) => {
|
|
|
1989
2128
|
textfields: textfieldsState,
|
|
1990
2129
|
searches: searchesState,
|
|
1991
2130
|
tocs: tocsState,
|
|
2131
|
+
scrollspy: scrollspyState,
|
|
2132
|
+
scrollspies: scrollspiesState,
|
|
2133
|
+
scrollspiesById: scrollspiesById,
|
|
1992
2134
|
viz: vizState,
|
|
1993
2135
|
lists: listsState,
|
|
1994
2136
|
links: linksState,
|
|
@@ -2057,6 +2199,8 @@ window.SCBBlazor.registerScbEventHandlers = function (dotNetRef) {
|
|
|
2057
2199
|
'expandedchange',
|
|
2058
2200
|
'dividerchange',
|
|
2059
2201
|
'itemhrefchange',
|
|
2202
|
+
// scrollspy
|
|
2203
|
+
'scrollspyactivechange',
|
|
2060
2204
|
// viz
|
|
2061
2205
|
'descriptionchange',
|
|
2062
2206
|
'commentchange',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a as j,n as $,i as
|
|
1
|
+
import{a as j,n as $,i as q,x as v,t as P}from"../../vendor/vendor.js";import"./scb-calendar-event.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-dialog/scb-dialog.js";import"../scb-list/scb-list.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-button/scb-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-divider/scb-divider.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-checkbox/scb-checkbox-group.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-radio-button/scb-radio-group.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";import"../scb-list/scb-list-item.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,r,d){try{customElements.get(s)||e(s,r,d)}catch(c){var a=String(c||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var H=Object.defineProperty,L=Object.getOwnPropertyDescriptor,k=(t,e,s,r)=>{for(var d=r>1?void 0:r?L(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(d=(r?c(e,s,d):c(d))||d);return r&&d&&H(e,s,d),d};let D=class extends q{constructor(){super(...arguments),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=t=>{const s=Array.from(this.shadowRoot?.querySelectorAll(".calendar-day.has-event")??[]),r=this.shadowRoot?.activeElement,d=r&&s.includes(r)?r:document.activeElement,a=s.indexOf(d);if(a===-1)return;let c=a;const p=this.disableWeekend?5:7;switch(t.key){case"ArrowRight":c=a+1<s.length?a+1:a;break;case"ArrowLeft":c=a-1>=0?a-1:a;break;case"ArrowDown":c=a+p<s.length?a+p:a;break;case"ArrowUp":c=a-p>=0?a-p:a;break;default:return}c!==a&&(t.preventDefault(),s[c].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{this._lastActiveDay?.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}connectedCallback(){super.connectedCallback();const t=Number(this.displayYear),e=Number(this.displayMonth);!Number.isNaN(t)&&!Number.isNaN(e)&&e>=1&&e<=12&&(this._current=new Date(t,e-1,1)),this._syncDisplayFromCurrent(!1),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}updated(t){if(super.updated?.(t),!this._syncingDisplay&&(t.has("displayYear")||t.has("displayMonth"))){const e=Number(this.displayYear),s=Number(this.displayMonth);if(!Number.isNaN(e)&&!Number.isNaN(s)&&s>=1&&s<=12){const r=this._current.getFullYear(),d=this._current.getMonth()+1;(r!==e||d!==s)&&(this._current=new Date(e,s-1,1),this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:e,displayMonth:s}})),this.requestUpdate())}}}_syncDisplayFromCurrent(t=!0){const e=this._current.getFullYear(),s=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=e,this.displayMonth=s}finally{this._syncingDisplay=!1}t&&this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:e,displayMonth:s}}))}_daysInMonth(t,e){return new Date(t,e+1,0).getDate()}_firstDayOfWeek(t,e){const s=new Date(t,e,1).getDay();return s===0?6:s-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(t){this._popupEvent=t,this.selectedDate=t.date,this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:{selectedDate:t.date}})),this._lastActiveDay=this.shadowRoot?.activeElement||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{const e=this.shadowRoot?.querySelector("scb-dialog");e&&(document.activeElement&&(e.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.open=!0})}),e.addEventListener("close",this._restoreDayFocus,{once:!0}));const s=r=>{r.target?.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",s,{once:!0})})}_closePopup(){const t=this.shadowRoot?.querySelector("scb-dialog");t&&t.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}_addDays(t,e){const s=new Date(t.valueOf());return s.setDate(s.getDate()+e),s}_easterDay(t){if(typeof this._easterDateCalculated["Ar"+t]<"u")return new Date(this._easterDateCalculated["Ar"+t]);let e=t;e<100&&(e=e+1900),e<1950&&(e=e+100);const s=e%19,r=e%4,d=e%7,a=(19*s+24)%30,c=(2*r+4*d+6*a+5)%7;let p=22+a+c,T=0;p==57&&(p-=7),p==56&&a==28&&c==6&&s>10&&(p-=7),p>31?(p-=31,T=4):T=3;const _=new Date(e,T-1,p);return this._easterDateCalculated["Ar"+t]=_,new Date(this._easterDateCalculated["Ar"+t])}_swedishHolidayName(t){const e=t.getMonth();if(e===1||e===6||e===7||e===8)return null;const s=t.getMonth()+1,r=t.getDate(),d=t.getFullYear(),a=this._easterDay(d),c=this.lang==="en",p=[["Nyårsdagen","New Year's Day",s===1&&r===1],["Trettondedag jul","Epiphany",s===1&&r===6],["Långfredag","Good Friday",+t==+this._addDays(a,-2)],["Påskdagen","Easter Sunday",+t==+a],["Annandag påsk","Easter Monday",+t==+this._addDays(a,1)],["Kristi himmelsfärdsdag","Ascension Day",+t==+this._addDays(a,39)],["Pingstdagen","Pentecost",+t==+this._addDays(a,50)&&d<2005],["Första maj","May Day",s===5&&r===1],["Nationaldagen","National Day",s===6&&r===6&&d>=2005],["Midsommarafton","Midsummer's Eve",s===6&&r>=19&&r<=25&&t.getDay()===5],["Midsommardagen","Midsummer's Day",s===6&&r>=20&&r<=26&&t.getDay()===6],["Julafton","Christmas Eve",s===12&&r===24],["Juldagen","Christmas Day",s===12&&r===25],["Annandag jul","Boxing Day",s===12&&r===26],["Alla helgons dag","All Saints' Day",s===10&&r>=31&&t.getDay()===6||s===11&&r<=6&&t.getDay()===6]];for(const T of p){const[_,N,A]=T;if(A)return c?N:_}return null}render(){const t=this._current.getFullYear(),e=this._current.getMonth(),s=this._daysInMonth(t,e),r=this._firstDayOfWeek(t,e),d=this._today,a=this.lang==="en",c=a?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let p=a?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(p=p.slice(0,5));const T=Array.from(this.querySelectorAll("scb-calendar-event")),_=new Map;for(const n of T){const l=n.getAttribute("start-date")||"",y=n.getAttribute("end-date")||"";if(l&&y){const o=new Date(l),m=new Date(y);for(let u=new Date(o);u<=m;u.setDate(u.getDate()+1)){const f=u.toISOString().split("T")[0],x=_.get(f)||[];x.push({title:n.title,description:n.description,start:l,end:y}),_.set(f,x)}}else if(l&&n.title){const o=l.split("T")[0],m=_.get(o)||[];m.push({title:n.title,description:n.description,start:l}),_.set(o,m)}}const N=[];let A=1;for(let n=0;n<6;n++){const l=[],y=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let o=A;for(let m=0;m<y.length;m++){const u=y[m];if(n===0&&u<r){if(!this.disableWeekend||u<5){const f=e===0?11:e-1,x=e===0?t-1:t,S=this._daysInMonth(x,f)-(r-u-1);l.push(v`
|
|
2
2
|
<div class="calendar-day calendar-day--other">
|
|
3
3
|
<span class="calendar-day-number">${S}</span>
|
|
4
4
|
</div>
|
|
5
|
-
`)}}else if(o>s)l.push(v`<div></div>`);else{let
|
|
5
|
+
`)}}else if(o>s)l.push(v`<div></div>`);else{let f=new Date(t,e,o);if(this.disableWeekend)for(;f.getDay()===0||f.getDay()===6;)o++,f=new Date(t,e,o);if(o>s){l.push(v`<div></div>`);continue}const x=d.getFullYear()===t&&d.getMonth()===e&&d.getDate()===o,b=`${t}-${String(e+1).padStart(2,"0")}-${String(o).padStart(2,"0")}`,S=new Date(t,e,o);let F=!1,w=null;this.publicHolidays&&(w=this._swedishHolidayName(S),F=!!w);let h=_.get(b)||[];h=[...h].sort((i,g)=>{const E=i.start&&b===i.start.split("T")[0]?i.start:i.end&&b===i.end.split("T")[0]?i.end:"",M=g.start&&b===g.start.split("T")[0]?g.start:g.end&&g.end.split("T")[0]?g.end:"",C=E&&E.includes("T"),O=M&&M.includes("T");return C&&O?E.localeCompare(M):C?-1:O?1:i.title.localeCompare(g.title)});const Y=[...h].map(i=>{let g="",E="";if(i.start&&i.end){const M=i.start.split("T")[0],C=i.end.split("T")[0];b===M&&b===C&&i.start.includes("T")&&i.end.includes("T")?g=i.start.split("T")[1].substring(0,5)+"–"+i.end.split("T")[1].substring(0,5):b===M&&i.start.includes("T")?g=i.start.split("T")[1].substring(0,5):b===C&&i.end.includes("T")?(g=i.end.split("T")[1].substring(0,5),E=a?"cont. ":"fort. "):b!==M&&(g="",E=a?"cont. ":"fort. ")}else i.start&&i.start.includes("T")&&(g=i.start.split("T")[1].substring(0,5));return{...i,time:g,prefix:E}});l.push(v`
|
|
6
6
|
<div
|
|
7
7
|
class="calendar-day${x?" today":""}${h.length?" has-event":""}${F?" calendar-day--holiday":""}"
|
|
8
8
|
tabindex=${h.length?"0":void 0}
|
|
9
|
-
@click=${h.length?()=>this._showEventPopup({date:
|
|
10
|
-
@keydown=${h.length?i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._showEventPopup({date:
|
|
9
|
+
@click=${h.length?()=>this._showEventPopup({date:b,events:h}):null}
|
|
10
|
+
@keydown=${h.length?i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._showEventPopup({date:b,events:h}))}:null}
|
|
11
11
|
title=${w||(h.length===1?h[0].title:h.length>1?h.map(i=>i.title).join(", "):"")}
|
|
12
12
|
role=${h.length?"button":void 0}
|
|
13
13
|
aria-label=${w||(h.length?h.length===1?h[0].title:h.map(i=>i.title).join(", "):void 0)}
|
|
@@ -33,7 +33,7 @@ import{a as j,n as $,i as P,x as v,t as H}from"../../vendor/vendor.js";import"./
|
|
|
33
33
|
${this._popupEvent&&Array.isArray(this._popupEvent.events)?v`
|
|
34
34
|
<scb-dialog variant="floating" open label="${a?"Events":"Händelser"} ${this._popupEvent.date}">
|
|
35
35
|
<scb-list>
|
|
36
|
-
${[...this._popupEvent.events].sort((n,l)=>{const y=n.start&&n.start.includes("T")?n.start:n.end&&n.end.includes("T")?n.end:"",o=l.start&&l.start.includes("T")?l.start:l.end&&l.end.includes("T")?l.end:"",m=y&&y.includes("T"),u=o&&o.includes("T");return m&&u?y.localeCompare(o):m?-1:u?1:n.title.localeCompare(l.title)}).map(n=>{const l=this._popupEvent?.date??"";let y="",o="",m="";if(n.start&&n.end){const u=n.start.split("T")[0],
|
|
36
|
+
${[...this._popupEvent.events].sort((n,l)=>{const y=n.start&&n.start.includes("T")?n.start:n.end&&n.end.includes("T")?n.end:"",o=l.start&&l.start.includes("T")?l.start:l.end&&l.end.includes("T")?l.end:"",m=y&&y.includes("T"),u=o&&o.includes("T");return m&&u?y.localeCompare(o):m?-1:u?1:n.title.localeCompare(l.title)}).map(n=>{const l=this._popupEvent?.date??"";let y="",o="",m="";if(n.start&&n.end){const u=n.start.split("T")[0],f=n.end.split("T")[0];u===f&&n.start.includes("T")&&n.end.includes("T")?y=n.start.split("T")[1].substring(0,5)+" – "+n.end.split("T")[1].substring(0,5):l===u&&n.start.includes("T")&&(y="Start: "+n.start.split("T")[1].substring(0,5)+(a?" (Extended event) ":" (Flerdagsevenemang) ")),l===f&&n.end.includes("T")&&u!==f&&(m=(a?"End: ":"Slut: ")+n.end.split("T")[1].substring(0,5)),l!==u&&(o=a?"cont. ":"fort. ")}else n.start&&n.start.includes("T")&&(y=n.start.split("T")[1].substring(0,5));return v`
|
|
37
37
|
<scb-list-item label="${o}${n.title}" supporting-text="${n.description?n.description:""}" overline="${y||""}${m||""}">
|
|
38
38
|
</scb-list-item>`})}
|
|
39
39
|
</scb-list>
|
|
@@ -46,6 +46,7 @@ import{a as j,n as $,i as P,x as v,t as H}from"../../vendor/vendor.js";import"./
|
|
|
46
46
|
padding: var(--spacing-5);
|
|
47
47
|
border-radius: var(--md-sys-shape-corner-large);
|
|
48
48
|
background: var(--md-sys-color-surface);
|
|
49
|
+
font-family: var(--brand-font);
|
|
49
50
|
}
|
|
50
51
|
.calendar-header {
|
|
51
52
|
display: flex;
|
|
@@ -142,4 +143,4 @@ import{a as j,n as $,i as P,x as v,t as H}from"../../vendor/vendor.js";import"./
|
|
|
142
143
|
gap: var(--spacing-4);
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
`;k([$({type:String})],D.prototype,"lang",2);k([$({type:Boolean,attribute:"disable-weekend"})],D.prototype,"disableWeekend",2);k([$({type:Boolean,attribute:"public-holidays"})],D.prototype,"publicHolidays",2);k([$({type:Number,attribute:"display-year",reflect:!0})],D.prototype,"displayYear",2);k([$({type:Number,attribute:"display-month",reflect:!0})],D.prototype,"displayMonth",2);k([$({type:String,attribute:"selected-date",reflect:!0})],D.prototype,"selectedDate",2);D=k([
|
|
146
|
+
`;k([$({type:String})],D.prototype,"lang",2);k([$({type:Boolean,attribute:"disable-weekend"})],D.prototype,"disableWeekend",2);k([$({type:Boolean,attribute:"public-holidays"})],D.prototype,"publicHolidays",2);k([$({type:Number,attribute:"display-year",reflect:!0})],D.prototype,"displayYear",2);k([$({type:Number,attribute:"display-month",reflect:!0})],D.prototype,"displayMonth",2);k([$({type:String,attribute:"selected-date",reflect:!0})],D.prototype,"selectedDate",2);D=k([P("scb-calendar")],D);
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import{a as u,n,i as h,E as p,x as
|
|
1
|
+
import{a as u,n as s,i as h,E as p,x as a,t as m}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-divider/scb-divider.js";import"../scb-checkbox/scb-checkbox-group.js";import"../scb-radio-button/scb-radio-group.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,c,r){try{customElements.get(o)||e(o,c,r)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(t,e,o,c)=>{for(var r=c>1?void 0:c?f(e,o):e,l=t.length-1,d;l>=0;l--)(d=t[l])&&(r=(c?d(e,o,r):d(r))||r);return c&&r&&b(e,o,r),r};let i=class extends h{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{this.shadowRoot?.querySelector("form")?.reset(),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(e=>{const o=e.tagName;o==="SCB-TEXTFIELD"&&(e.value=""),o==="SCB-CHECKBOX"&&(e.checked=!1),o==="SCB-RADIO-BUTTON"&&(e.checked=!1),o==="SCB-SWITCH"&&(e.selected=!1),o==="SCB-CHIP"&&(e.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{this.shadowRoot?.querySelector("form")?.requestSubmit(),this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const e=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled"));if(!e.length)return;const o=e[0],c=e[e.length-1];t.shiftKey&&document.activeElement===o?(c.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===c&&(o.focus(),t.preventDefault())}}__getActionFromEvent(t){if(!this.id)return null;for(const e of t.composedPath())if(e instanceof Element){if(e.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=e,"toggle";if(e.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=e,"toggle"}return null}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}updated(t){if(t.has("open")){const e=t.get("open");this.__updateTriggersExpanded(),this.open&&!e?this.updateComplete.then(()=>{const o=this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');o?o.focus():this.shadowRoot?.querySelector(".container")?.focus()}):!this.open&&e&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(t){if(this.inSb)return;const e=document.documentElement;e.style.overflow=t?"hidden":""}__setOpen(t){this.open=t,this.__fire(t?"open":"close")}__fire(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}__slotIsEmpty(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).length===0:!0}renderHeader(t){const e=this.variant==="form"||this.variant==="floating";return a`
|
|
2
2
|
<div class="header">
|
|
3
3
|
<div class="title">
|
|
4
|
-
${this.icon?
|
|
4
|
+
${this.icon?a`<md-icon class="dialog-icon">${this.icon}</md-icon>`:p}
|
|
5
5
|
<div class="label" id=${t}>${this.label}</div>
|
|
6
6
|
</div>
|
|
7
|
-
${e?
|
|
7
|
+
${e?a`<scb-icon-button class="close" icon="close" @click=${this.__onCancel}></scb-icon-button>`:p}
|
|
8
8
|
</div>
|
|
9
|
-
`}renderContentDefault(t){const e=this.__slotIsEmpty();return
|
|
9
|
+
`}renderContentDefault(t){const e=this.__slotIsEmpty();return a`
|
|
10
10
|
<div class="content" id=${t}>
|
|
11
|
-
${e&&this.supportingText?
|
|
11
|
+
${e&&this.supportingText?a`${this.supportingText}`:a`<slot></slot>`}
|
|
12
12
|
</div>
|
|
13
|
-
`}renderActions(){switch(this.variant){case"alert":return
|
|
13
|
+
`}renderActions(){switch(this.variant){case"alert":return a`<div class="actions">
|
|
14
14
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
15
|
-
</div>`;case"confirm":return
|
|
15
|
+
</div>`;case"confirm":return a`<div class="actions">
|
|
16
16
|
<scb-button variant="text" label=${this.confirmButton} @click=${this.__onConfirm}></scb-button>
|
|
17
17
|
<scb-button variant="text" label=${this.denyButton} @click=${this.__onDeny}></scb-button>
|
|
18
|
-
</div>`;case"choose":return
|
|
18
|
+
</div>`;case"choose":return a`<div class="actions">
|
|
19
19
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
20
20
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
21
|
-
</div>`;case"form":return
|
|
21
|
+
</div>`;case"form":return a`<div class="actions">
|
|
22
22
|
<scb-button class="start" variant="text" label=${this.resetButton} @click=${this.__onReset}></scb-button>
|
|
23
23
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
24
24
|
<scb-button variant="text" label=${this.submitButton} @click=${this.__onSubmit}></scb-button>
|
|
25
|
-
</div>`;case"floating":return p;default:return
|
|
25
|
+
</div>`;case"floating":return p;default:return a`<div class="actions">
|
|
26
26
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
27
27
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
28
|
-
</div>`}}renderBody(t,e){return this.variant==="form"?
|
|
28
|
+
</div>`}}renderBody(t,e){return this.variant==="form"?a`
|
|
29
29
|
${this.renderHeader(t)}
|
|
30
30
|
<div class="content" id=${e}>
|
|
31
31
|
<form id=${this.formId} action=${this.formAction} method=${this.formMethod||p}>
|
|
@@ -33,7 +33,7 @@ import{a as u,n,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";import"
|
|
|
33
33
|
</form>
|
|
34
34
|
</div>
|
|
35
35
|
${this.renderActions()}
|
|
36
|
-
`:
|
|
36
|
+
`:a`${this.renderHeader(t)} ${this.renderContentDefault(e)} ${this.renderActions()}`}render(){const t="dlg-title",e="dlg-desc";return a`
|
|
37
37
|
<div class="scrim" @click=${this.__onScrimClick} aria-hidden="true"></div>
|
|
38
38
|
<div
|
|
39
39
|
class="container"
|
|
@@ -60,6 +60,7 @@ import{a as u,n,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";import"
|
|
|
60
60
|
z-index: var(--z-dialog-scrim, 1000);
|
|
61
61
|
opacity: 1;
|
|
62
62
|
transition: opacity var(--motion-duration-short, 0.25s);
|
|
63
|
+
transition-timing-function: var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
63
64
|
height: var(--scb-dialog-scrim-height, auto);
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -94,13 +95,30 @@ import{a as u,n,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";import"
|
|
|
94
95
|
z-index: var(--z-dialog, 1001);
|
|
95
96
|
opacity: 1;
|
|
96
97
|
transition:
|
|
97
|
-
opacity var(--motion-duration-
|
|
98
|
-
transform var(--motion-duration-
|
|
99
|
-
|
|
98
|
+
opacity var(--motion-duration-medium, 0.3s),
|
|
99
|
+
transform var(--motion-duration-medium, 0.3s);
|
|
100
|
+
transition-timing-function: var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1));
|
|
101
|
+
}
|
|
100
102
|
|
|
101
103
|
:host(:not([open])) .scrim,
|
|
102
104
|
:host(:not([open])) .container { opacity:0; pointer-events:none; }
|
|
103
105
|
|
|
106
|
+
:host([open]) .scrim {
|
|
107
|
+
animation:
|
|
108
|
+
var(--motion-keyframe-fade-in, scb-kf-fade-in)
|
|
109
|
+
var(--motion-duration-short, 0.25s)
|
|
110
|
+
var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1))
|
|
111
|
+
both;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([open]) .container {
|
|
115
|
+
animation:
|
|
116
|
+
var(--motion-keyframe-fade-in, scb-kf-fade-in)
|
|
117
|
+
var(--motion-duration-medium, 0.3s)
|
|
118
|
+
var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1))
|
|
119
|
+
both;
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
/* Header: ikon över rubrik */
|
|
105
123
|
.header {
|
|
106
124
|
display:flex;
|
|
@@ -160,4 +178,15 @@ import{a as u,n,i as h,E as p,x as r,t as m}from"../../vendor/vendor.js";import"
|
|
|
160
178
|
display:block;
|
|
161
179
|
margin-block: var(--scb-choice-gap, 6px);
|
|
162
180
|
}
|
|
163
|
-
|
|
181
|
+
/* Keyframes för motion-tokens (behövs för att animationer ska fungera i shadow DOM) */
|
|
182
|
+
@keyframes scb-kf-fade-in {
|
|
183
|
+
from { opacity: 0; }
|
|
184
|
+
to { opacity: 1; }
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@keyframes scb-kf-fade-out {
|
|
188
|
+
from { opacity: 1; }
|
|
189
|
+
to { opacity: 0; }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
`;n([s({type:Boolean,reflect:!0})],i.prototype,"open",2);n([s({type:Boolean,attribute:!1})],i.prototype,"inSb",2);n([s({type:Boolean,attribute:"scrim-close"})],i.prototype,"scrimClose",2);n([s({type:String})],i.prototype,"variant",2);n([s({type:String})],i.prototype,"label",2);n([s({type:String})],i.prototype,"icon",2);n([s({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);n([s({type:String,attribute:"ok-button"})],i.prototype,"okButton",2);n([s({type:String,attribute:"cancel-button"})],i.prototype,"cancelButton",2);n([s({type:String,attribute:"delete-button"})],i.prototype,"deleteButton",2);n([s({type:String,attribute:"confirm-button"})],i.prototype,"confirmButton",2);n([s({type:String,attribute:"deny-button"})],i.prototype,"denyButton",2);n([s({type:String,attribute:"reset-button"})],i.prototype,"resetButton",2);n([s({type:String,attribute:"submit-button"})],i.prototype,"submitButton",2);n([s({type:String,attribute:"form-id"})],i.prototype,"formId",2);n([s({type:String,attribute:"form-action"})],i.prototype,"formAction",2);n([s({type:String,attribute:"form-method"})],i.prototype,"formMethod",2);i=n([m("scb-dialog")],i);
|