scb-wc 0.1.104 → 0.1.105
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/wrappers/ScbSelect.razor +42 -0
- package/blazor/wrappers/ScbTextfield.razor +12 -0
- package/index.js +69 -69
- package/mvc/components/scb-datepicker/scb-datepicker.js +16 -16
- package/mvc/components/scb-select/scb-select.js +37 -18
- package/mvc/components/scb-slider/scb-slider.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +56 -72
- package/mvc/components/scb-tooltip/scb-tooltip.js +8 -8
- package/mvc/components/scb-viz/scb-viz.js +3 -3
- package/mvc/vendor/vendor.js +1 -1
- package/package.json +2 -2
- package/scb-components/scb-select/scb-select.d.ts +7 -2
- package/scb-components/scb-textfield/scb-textfield.d.ts +4 -0
- package/scb-components/scb-tooltip/scb-tooltip.d.ts +4 -0
- package/scb-datepicker/scb-datepicker.js +5 -5
- package/scb-select/scb-select.js +82 -28
- package/scb-textfield/scb-textfield.js +78 -58
- package/scb-tooltip/scb-tooltip.js +37 -24
- package/scb-wc.bundle.js +137 -94
|
@@ -14,8 +14,15 @@
|
|
|
14
14
|
[Parameter] public string? Id { get; set; }
|
|
15
15
|
[Parameter] public string? Variant { get; set; }
|
|
16
16
|
[Parameter] public string? Value { get; set; }
|
|
17
|
+
[Parameter] public string? Label { get; set; }
|
|
18
|
+
[Parameter] public string? SupportingText { get; set; }
|
|
19
|
+
[Parameter] public string? HelpText { get; set; }
|
|
20
|
+
[Parameter] public string? HelpLabel { get; set; }
|
|
21
|
+
[Parameter] public string? Name { get; set; }
|
|
22
|
+
[Parameter] public string? Placeholder { get; set; }
|
|
17
23
|
[Parameter] public bool Open { get; set; }
|
|
18
24
|
[Parameter] public bool Disabled { get; set; }
|
|
25
|
+
[Parameter] public bool Required { get; set; }
|
|
19
26
|
[Parameter] public RenderFragment? ChildContent { get; set; }
|
|
20
27
|
[Parameter] public EventCallback<string?> ValueChanged { get; set; }
|
|
21
28
|
[Parameter] public EventCallback<ScbCustomEventArgs> OnValueChange { get; set; }
|
|
@@ -44,6 +51,36 @@
|
|
|
44
51
|
attributes["value"] = Value;
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
if (!string.IsNullOrWhiteSpace(Label))
|
|
55
|
+
{
|
|
56
|
+
attributes["label"] = Label!;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!string.IsNullOrWhiteSpace(SupportingText))
|
|
60
|
+
{
|
|
61
|
+
attributes["supporting-text"] = SupportingText!;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!string.IsNullOrWhiteSpace(HelpText))
|
|
65
|
+
{
|
|
66
|
+
attributes["help-text"] = HelpText!;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!string.IsNullOrWhiteSpace(HelpLabel))
|
|
70
|
+
{
|
|
71
|
+
attributes["help-label"] = HelpLabel!;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!string.IsNullOrWhiteSpace(Name))
|
|
75
|
+
{
|
|
76
|
+
attributes["name"] = Name!;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!string.IsNullOrWhiteSpace(Placeholder))
|
|
80
|
+
{
|
|
81
|
+
attributes["placeholder"] = Placeholder!;
|
|
82
|
+
}
|
|
83
|
+
|
|
47
84
|
if (Open)
|
|
48
85
|
{
|
|
49
86
|
attributes["open"] = string.Empty;
|
|
@@ -53,6 +90,11 @@
|
|
|
53
90
|
{
|
|
54
91
|
attributes["disabled"] = string.Empty;
|
|
55
92
|
}
|
|
93
|
+
|
|
94
|
+
if (Required)
|
|
95
|
+
{
|
|
96
|
+
attributes["required"] = string.Empty;
|
|
97
|
+
}
|
|
56
98
|
|
|
57
99
|
if (AdditionalAttributes is not null)
|
|
58
100
|
{
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
[Parameter] public string? Value { get; set; }
|
|
14
14
|
[Parameter] public string? Label { get; set; }
|
|
15
15
|
[Parameter] public string? SupportingText { get; set; }
|
|
16
|
+
[Parameter] public string? HelpText { get; set; }
|
|
17
|
+
[Parameter] public string? HelpLabel { get; set; }
|
|
16
18
|
[Parameter] public string? Name { get; set; }
|
|
17
19
|
[Parameter] public string? Type { get; set; }
|
|
18
20
|
[Parameter] public string? ErrorText { get; set; }
|
|
@@ -50,6 +52,16 @@
|
|
|
50
52
|
attributes["supporting-text"] = SupportingText!;
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
if (!string.IsNullOrWhiteSpace(HelpText))
|
|
56
|
+
{
|
|
57
|
+
attributes["help-text"] = HelpText!;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!string.IsNullOrWhiteSpace(HelpLabel))
|
|
61
|
+
{
|
|
62
|
+
attributes["help-label"] = HelpLabel!;
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
if (!string.IsNullOrWhiteSpace(Name))
|
|
54
66
|
{
|
|
55
67
|
attributes["name"] = Name!;
|
package/index.js
CHANGED
|
@@ -16,18 +16,19 @@ import { SCBBreadcrumb as x } from "./scb-breadcrumb/scb-breadcrumb.js";
|
|
|
16
16
|
import { ScbCalendarEvent as S } from "./scb-calendar/scb-calendar-event.js";
|
|
17
17
|
import { ScbDivider as C } from "./scb-divider/scb-divider.js";
|
|
18
18
|
import { ScbDatepicker as w } from "./scb-datepicker/scb-datepicker.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
19
|
+
import { ScbTooltip as T } from "./scb-tooltip/scb-tooltip.js";
|
|
20
|
+
import { ScbTextField as E } from "./scb-textfield/scb-textfield.js";
|
|
21
|
+
import { ScbCheckboxGroup as D } from "./scb-checkbox/scb-checkbox-group.js";
|
|
22
|
+
import { ScbCheckbox as O } from "./scb-checkbox/scb-checkbox.js";
|
|
23
|
+
import { ScbRadioGroup as k } from "./scb-radio-button/scb-radio-group.js";
|
|
24
|
+
import { ScbRadioButton as A } from "./scb-radio-button/scb-radio-button.js";
|
|
25
|
+
import { ScbSwitch as j } from "./scb-switch/scb-switch.js";
|
|
26
|
+
import { ScbChip as M } from "./scb-chip/scb-chip.js";
|
|
27
|
+
import { ScbDialog as N } from "./scb-dialog/scb-dialog.js";
|
|
28
|
+
import { ScbListItem as P } from "./scb-list/scb-list-item.js";
|
|
29
|
+
import { ScbList as F } from "./scb-list/scb-list.js";
|
|
30
|
+
import { ScbCalendar as I } from "./scb-calendar/scb-calendar.js";
|
|
31
|
+
import { ScbCalendarCard as L } from "./scb-calendar-card/scb-calendar-card.js";
|
|
31
32
|
import "./scb-card/scb-action-card.js";
|
|
32
33
|
import "./scb-container-card/scb-container-card.js";
|
|
33
34
|
import "./scb-card/scb-container-card.js";
|
|
@@ -37,62 +38,61 @@ import "./scb-list-card/scb-list-card.js";
|
|
|
37
38
|
import "./scb-card/scb-list-card.js";
|
|
38
39
|
import "./scb-social-card/scb-social-card.js";
|
|
39
40
|
import "./scb-card/scb-social-card.js";
|
|
40
|
-
import { ScbCollapse as
|
|
41
|
-
import { ScbCookiesConsent as
|
|
42
|
-
import { ScbDrawer as
|
|
43
|
-
import { ScbDropZone as
|
|
44
|
-
import { ScbOptionsMenuItem as
|
|
45
|
-
import { ScbOptionsSubMenu as
|
|
46
|
-
import { ScbOptionsMenu as
|
|
47
|
-
import { ScbDropdown as
|
|
48
|
-
import { ScbFab as
|
|
49
|
-
import { ScbFactCardContent as
|
|
50
|
-
import { ScbFactCard as
|
|
51
|
-
import { ScbFooterSection as
|
|
52
|
-
import { ScbGridItem as
|
|
53
|
-
import { ScbStack as
|
|
54
|
-
import { ScbGrid as
|
|
55
|
-
import { ScbFooter as
|
|
56
|
-
import { hasScbSvgIcon as
|
|
57
|
-
import { ScbHorizontalScroller as
|
|
58
|
-
import { ScbOverlay as
|
|
59
|
-
import { ScbGalleryGrid as
|
|
60
|
-
import { ScbHeaderMenuGroup as
|
|
61
|
-
import { ScbHeaderMenuItem as
|
|
62
|
-
import { ScbHeaderTab as
|
|
63
|
-
import { ScbHeaderUtility as
|
|
64
|
-
import { ScbHeader as
|
|
65
|
-
import { ScbKeyFigureCard as
|
|
66
|
-
import { ScbMenuItem as
|
|
67
|
-
import { ScbmenuSection as
|
|
68
|
-
import { ScbSubmenu as
|
|
69
|
-
import { ScbMenu as
|
|
70
|
-
import { ScbNavItem as
|
|
71
|
-
import { ScbNav as
|
|
72
|
-
import { ScbNotificationCard as
|
|
73
|
-
import { ScbPagination as
|
|
74
|
-
import { ScbProgressIndicator as
|
|
75
|
-
import { ScbProgressStep as
|
|
76
|
-
import { ScbProgressStepper as
|
|
77
|
-
import { ScbScrollspy as
|
|
78
|
-
import { ScbSegmentedItem as
|
|
79
|
-
import { ScbSegmentedButton as
|
|
80
|
-
import { ScbSelectOption as
|
|
81
|
-
import { ScbSelect as
|
|
82
|
-
import { ScbSkeleton as
|
|
83
|
-
import { ScbSlider as
|
|
84
|
-
import { ScbSnackbar as
|
|
85
|
-
import { ScbStatusPill as
|
|
86
|
-
import { ScbStep as
|
|
87
|
-
import { ScbStepper as
|
|
88
|
-
import { ScbTable as
|
|
89
|
-
import { ScbTableAdvanced as
|
|
90
|
-
import { ScbPrimaryTab as
|
|
91
|
-
import { ScbSecondaryTab as
|
|
92
|
-
import { ScbTabs as
|
|
93
|
-
import { ScbTocItem as
|
|
94
|
-
import { ScbToc as
|
|
95
|
-
import { ScbTooltip as ze } from "./scb-tooltip/scb-tooltip.js";
|
|
41
|
+
import { ScbCollapse as R } from "./scb-collapse/scb-collapse.js";
|
|
42
|
+
import { ScbCookiesConsent as z } from "./scb-cookies-consent/scb-cookies-consent.js";
|
|
43
|
+
import { ScbDrawer as B } from "./scb-drawer/scb-drawer.js";
|
|
44
|
+
import { ScbDropZone as V } from "./scb-drop-zone/scb-drop-zone.js";
|
|
45
|
+
import { ScbOptionsMenuItem as H } from "./scb-options-menu/scb-options-menu-item.js";
|
|
46
|
+
import { ScbOptionsSubMenu as U } from "./scb-options-menu/scb-options-sub-menu.js";
|
|
47
|
+
import { ScbOptionsMenu as W } from "./scb-options-menu/scb-options-menu.js";
|
|
48
|
+
import { ScbDropdown as G } from "./scb-dropdown/scb-dropdown.js";
|
|
49
|
+
import { ScbFab as K } from "./scb-fab/scb-fab.js";
|
|
50
|
+
import { ScbFactCardContent as q } from "./scb-fact-card/scb-fact-card-content.js";
|
|
51
|
+
import { ScbFactCard as J } from "./scb-fact-card/scb-fact-card.js";
|
|
52
|
+
import { ScbFooterSection as Y } from "./scb-footer/scb-footer-section.js";
|
|
53
|
+
import { ScbGridItem as X } from "./scb-grid/scb-grid-item.js";
|
|
54
|
+
import { ScbStack as Z } from "./scb-grid/scb-stack.js";
|
|
55
|
+
import { ScbGrid as Q } from "./scb-grid/scb-grid.js";
|
|
56
|
+
import { ScbFooter as $ } from "./scb-footer/scb-footer.js";
|
|
57
|
+
import { hasScbSvgIcon as ee, renderScbIcon as te } from "./shared/scb-icon-svg.js";
|
|
58
|
+
import { ScbHorizontalScroller as ne } from "./scb-horizontal-scroller/scb-horizontal-scroller.js";
|
|
59
|
+
import { ScbOverlay as re } from "./scb-overlay/scb-overlay.js";
|
|
60
|
+
import { ScbGalleryGrid as ie } from "./scb-gallery-grid/scb-gallery-grid.js";
|
|
61
|
+
import { ScbHeaderMenuGroup as ae } from "./scb-header/scb-header-menu-group.js";
|
|
62
|
+
import { ScbHeaderMenuItem as oe } from "./scb-header/scb-header-menu-item.js";
|
|
63
|
+
import { ScbHeaderTab as se } from "./scb-header/scb-header-tab.js";
|
|
64
|
+
import { ScbHeaderUtility as ce } from "./scb-header/scb-header-utility.js";
|
|
65
|
+
import { ScbHeader as le } from "./scb-header/scb-header.js";
|
|
66
|
+
import { ScbKeyFigureCard as ue } from "./scb-keyfigure-card/scb-keyfigure-card.js";
|
|
67
|
+
import { ScbMenuItem as de } from "./scb-menu/scb-menu-item.js";
|
|
68
|
+
import { ScbmenuSection as fe } from "./scb-menu/scb-menu-section.js";
|
|
69
|
+
import { ScbSubmenu as pe } from "./scb-menu/scb-sub-menu.js";
|
|
70
|
+
import { ScbMenu as me } from "./scb-menu/scb-menu.js";
|
|
71
|
+
import { ScbNavItem as he } from "./scb-nav/scb-nav-item.js";
|
|
72
|
+
import { ScbNav as ge } from "./scb-nav/scb-nav.js";
|
|
73
|
+
import { ScbNotificationCard as _e } from "./scb-notification-card/scb-notification-card.js";
|
|
74
|
+
import { ScbPagination as ve } from "./scb-pagination/scb-pagination.js";
|
|
75
|
+
import { ScbProgressIndicator as ye } from "./scb-progress-indicator/scb-progress-indicator.js";
|
|
76
|
+
import { ScbProgressStep as be } from "./scb-progress-stepper/scb-progress-step.js";
|
|
77
|
+
import { ScbProgressStepper as xe } from "./scb-progress-stepper/scb-progress-stepper.js";
|
|
78
|
+
import { ScbScrollspy as Se } from "./scb-scrollspy/scb-scrollspy.js";
|
|
79
|
+
import { ScbSegmentedItem as Ce } from "./scb-segmented-button/scb-segmented-item.js";
|
|
80
|
+
import { ScbSegmentedButton as we } from "./scb-segmented-button/scb-segmented-button.js";
|
|
81
|
+
import { ScbSelectOption as Te } from "./scb-select/scb-select-option.js";
|
|
82
|
+
import { ScbSelect as Ee } from "./scb-select/scb-select.js";
|
|
83
|
+
import { ScbSkeleton as De } from "./scb-skeleton/scb-skeleton.js";
|
|
84
|
+
import { ScbSlider as Oe } from "./scb-slider/scb-slider.js";
|
|
85
|
+
import { ScbSnackbar as ke } from "./scb-snackbar/scb-snackbar.js";
|
|
86
|
+
import { ScbStatusPill as Ae } from "./scb-status-pill/scb-status-pill.js";
|
|
87
|
+
import { ScbStep as je } from "./scb-stepper/scb-step.js";
|
|
88
|
+
import { ScbStepper as Me } from "./scb-stepper/scb-stepper.js";
|
|
89
|
+
import { ScbTable as Ne } from "./scb-table/scb-table.js";
|
|
90
|
+
import { ScbTableAdvanced as Pe } from "./scb-table-advanced/scb-table-advanced.js";
|
|
91
|
+
import { ScbPrimaryTab as Fe } from "./scb-tabs/scb-primary-tab.js";
|
|
92
|
+
import { ScbSecondaryTab as Ie } from "./scb-tabs/scb-secondary-tab.js";
|
|
93
|
+
import { ScbTabs as Le } from "./scb-tabs/scb-tabs.js";
|
|
94
|
+
import { ScbTocItem as Re } from "./scb-toc/scb-toc-item.js";
|
|
95
|
+
import { ScbToc as ze } from "./scb-toc/scb-toc.js";
|
|
96
96
|
import { buildScbVizExportFileName as Be, createScbVizCsvBlob as Ve, createScbVizRasterBlobFromElement as He, createScbVizRasterDataUrlFromElement as Ue, downloadScbVizBlob as We, getScbVizCurrentFullscreenElement as Ge, getScbVizExportBaseFileName as Ke, getScbVizFullscreenDocument as qe, isScbVizFullscreenSupported as Je, openScbVizPrintFrame as Ye, runWithScbVizForcedPrintLightMode as Xe, toggleScbVizFullscreen as Ze } from "./scb-viz/scb-viz-actions-runtime.js";
|
|
97
97
|
import { buildScbVizPrintDocumentHtml as Qe, buildScbVizPrintableFooterHtml as $e, buildScbVizPrintableTableHtml as et } from "./scb-viz/scb-viz-print-runtime.js";
|
|
98
98
|
import { appendScbVizSeriesDifferentiationPatternMarks as tt, getScbVizSeriesDifferentiationPatternDefinition as nt, getScbVizSeriesDifferentiationPatternKinds as rt, getScbVizSeriesDifferentiationRegistry as it, getScbVizSeriesDifferentiationVariant as at, scbVizSeriesDifferentiationRegistry as ot } from "./scb-viz/scb-viz-series-differentiation-registry.js";
|
|
@@ -100,4 +100,4 @@ import { clearScbVizSeriesDifferentiationColorClass as st, clearScbVizSeriesDiff
|
|
|
100
100
|
import { buildScbVizResolvedTableView as Et, createScbVizCsvRows as Dt, inferScbVizTableAlignments as Ot, normalizeScbVizRenderableCell as kt, readScbVizTableDataFromSlot as At } from "./scb-viz/scb-viz-table-runtime.js";
|
|
101
101
|
import { ScbViz as jt } from "./scb-viz/scb-viz.js";
|
|
102
102
|
import { ensureRippleReady as Mt, syncRippleToControl as Nt } from "./shared/lazy-ripple.js";
|
|
103
|
-
export { x as SCBBreadcrumb, b as SCBBreadcrumbItem, s as ScbAccordion, a as ScbAccordionItem, c as ScbActionCard, _ as ScbAppBar, g as ScbAvatar, v as ScbBadge, o as ScbButton,
|
|
103
|
+
export { x as SCBBreadcrumb, b as SCBBreadcrumbItem, s as ScbAccordion, a as ScbAccordionItem, c as ScbActionCard, _ as ScbAppBar, g as ScbAvatar, v as ScbBadge, o as ScbButton, I as ScbCalendar, L as ScbCalendarCard, S as ScbCalendarEvent, l as ScbCard, O as ScbCheckbox, D as ScbCheckboxGroup, i as ScbChevron, M as ScbChip, R as ScbCollapse, u as ScbContainerCard, z as ScbCookiesConsent, w as ScbDatepicker, N as ScbDialog, C as ScbDivider, B as ScbDrawer, V as ScbDropZone, G as ScbDropdown, K as ScbFab, J as ScbFactCard, q as ScbFactCardContent, $ as ScbFooter, Y as ScbFooterSection, ie as ScbGalleryGrid, Q as ScbGrid, X as ScbGridItem, le as ScbHeader, ae as ScbHeaderMenuGroup, oe as ScbHeaderMenuItem, se as ScbHeaderTab, ce as ScbHeaderUtility, ne as ScbHorizontalScroller, m as ScbIconButton, ue as ScbKeyFigureCard, y as ScbLink, d as ScbLinkCard, F as ScbList, f as ScbListCard, P as ScbListItem, me as ScbMenu, de as ScbMenuItem, ge as ScbNav, he as ScbNavItem, _e as ScbNotificationCard, W as ScbOptionsMenu, H as ScbOptionsMenuItem, U as ScbOptionsSubMenu, re as ScbOverlay, ve as ScbPagination, Fe as ScbPrimaryTab, ye as ScbProgressIndicator, be as ScbProgressStep, xe as ScbProgressStepper, A as ScbRadioButton, k as ScbRadioGroup, Se as ScbScrollspy, h as ScbSearch, Ie as ScbSecondaryTab, we as ScbSegmentedButton, Ce as ScbSegmentedItem, Ee as ScbSelect, Te as ScbSelectOption, De as ScbSkeleton, Oe as ScbSlider, ke as ScbSnackbar, p as ScbSocialCard, Z as ScbStack, Ae as ScbStatusPill, je as ScbStep, Me as ScbStepper, pe as ScbSubmenu, j as ScbSwitch, Ne as ScbTable, Pe as ScbTableAdvanced, Le as ScbTabs, E as ScbTextField, ze as ScbToc, Re as ScbTocItem, T as ScbTooltip, jt as ScbViz, fe as ScbmenuSection, e as addLazyFocusRingListeners, tt as appendScbVizSeriesDifferentiationPatternMarks, Be as buildScbVizExportFileName, Qe as buildScbVizPrintDocumentHtml, $e as buildScbVizPrintableFooterHtml, et as buildScbVizPrintableTableHtml, Et as buildScbVizResolvedTableView, st as clearScbVizSeriesDifferentiationColorClass, ct as clearScbVizSeriesDifferentiationMetadata, Ve as createScbVizCsvBlob, Dt as createScbVizCsvRows, He as createScbVizRasterBlobFromElement, Ue as createScbVizRasterDataUrlFromElement, We as downloadScbVizBlob, t as ensureFocusRingOnFocusVisible, n as ensureFocusRingOnTab, r as ensureFocusRingReady, Mt as ensureRippleReady, lt as ensureScbVizGroupedSeriesDifferentiationStore, ut as ensureScbVizStyledModeSeriesPattern, Ge as getScbVizCurrentFullscreenElement, Ke as getScbVizExportBaseFileName, qe as getScbVizFullscreenDocument, dt as getScbVizGroupedSeriesDifferentiationKey, ft as getScbVizGroupedSeriesDifferentiationVariant, pt as getScbVizGroupedSeriesDifferentiationVariantIndex, mt as getScbVizHighchartsColorClassName, ht as getScbVizHighchartsSvgElement, gt as getScbVizHighchartsSvgRoot, _t as getScbVizLegendSeriesDifferentiationTargets, vt as getScbVizSeriesDifferentiationColorIndex, nt as getScbVizSeriesDifferentiationPatternDefinition, rt as getScbVizSeriesDifferentiationPatternKinds, it as getScbVizSeriesDifferentiationRegistry, at as getScbVizSeriesDifferentiationVariant, yt as getScbVizSeriesDifferentiationVariantByIndex, ee as hasScbSvgIcon, Ot as inferScbVizTableAlignments, Je as isScbVizFullscreenSupported, bt as isScbVizGroupedSeriesDifferentiationChart, xt as isScbVizHighchartsStyledMode, kt as normalizeScbVizRenderableCell, Ye as openScbVizPrintFrame, At as readScbVizTableDataFromSlot, te as renderScbIcon, Xe as runWithScbVizForcedPrintLightMode, ot as scbVizSeriesDifferentiationRegistry, St as setScbVizSeriesDifferentiationColorClass, Ct as setScbVizSeriesDifferentiationMetadata, wt as shouldShowScbVizSeriesDifferentiationAction, Nt as syncRippleToControl, Ze as toggleScbVizFullscreen, Tt as usesScbVizGroupedPointDifferentiation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{addLazyFocusRingListeners as $}from"../shared/lazy-focus-ring.js";import{t as h}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,d){try{customElements.get(e)||t(e,o,d)}catch(r){var a=String(r||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var w,p=(w=class extends D{constructor(...t){super(...t),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="date",this.lang="sv",this.selectedValue="",this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang=="sv"?"Januari":"January",this.lang=="sv"?"Februari":"February",this.lang=="sv"?"Mars":"March",(this.lang=="sv","April"),this.lang=="sv"?"Maj":"May",this.lang=="sv"?"Juni":"June",this.lang=="sv"?"Juli":"July",this.lang=="sv"?"Augusti":"August",(this.lang=="sv","September"),this.lang=="sv"?"Oktober":"October",(this.lang=="sv","November"),(this.lang=="sv","December")],this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();o===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,o-1,1)},this._prevYear=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();this._currentDate=new Date(e-1,o,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();o===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,o+1,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();this._currentDate=new Date(e+1,o,1)},this._onTimeChange=e=>{const[o,d]=e.target.value.split(":"),a=parseInt(o,10),r=parseInt(d,10);this._selectedHour=isNaN(a)?0:Math.max(0,Math.min(23,a)),this._selectedMinute=isNaN(r)?0:Math.max(0,Math.min(59,r)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){const t=this.getRootNode(),e=t instanceof ShadowRoot?t.host:null;return e instanceof HTMLElement&&e.closest("scb-dialog")?!0:!!this.closest("scb-dialog")}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=$(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;const t=this.renderRoot.querySelector(".datepicker-popup");if(!t)return;const e=this.parentElement?.getBoundingClientRect();if(!e)return;const o=window.innerWidth,d=window.innerHeight,a=Math.max(220,o-this._viewportMargin*2);if(this._isRenderedInsideDialog()){const v=Math.min(t.offsetWidth||380,a),b=t.offsetHeight||420,f=(o-v)/2,y=(d-b)/2;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-top",`${y}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-left",`${f}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-computed-width",`${v}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(220,d-this._viewportMargin*2)}px`);return}const r=Math.min(t.offsetWidth||380,a),s=t.offsetHeight||420,i=Math.min(Math.max(e.left,this._viewportMargin),o-this._viewportMargin-r),n=d-e.bottom-this._viewportMargin,u=e.top-this._viewportMargin,_=n<s+this._popupOffset&&u>n;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-computed-width",`${r}px`),this.style.setProperty("--scb-datepicker-left",`${i}px`),this.style.setProperty("--scb-datepicker-transform","none"),_?(this.style.setProperty("--scb-datepicker-top",`${Math.max(this._viewportMargin,e.top-s-this._popupOffset)}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,u-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,n-this._popupOffset)}px`))}updated(t){if(super.updated(t),this.open?(window.addEventListener("mousedown",this._outsideClickHandler),window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}),requestAnimationFrame(()=>this._positionPopupWithinViewport())):(window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0)),t.has("selectedValue")&&this.selectedValue){const e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant==="datetime-local"&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}this.open&&requestAnimationFrame(()=>this._positionPopupWithinViewport())}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),super.disconnectedCallback()}render(){if(!this.open)return c``;const t=this._currentDate.getFullYear(),e=this._currentDate.getMonth(),o=new Date,d=this._getMonthDays(t,e),a=Array.from({length:101},(s,i)=>o.getFullYear()-50+i),r=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return c`
|
|
2
2
|
<div class="datepicker-popup popup">
|
|
3
3
|
<div class="header">
|
|
4
4
|
<div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
|
|
@@ -8,7 +8,7 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
8
8
|
tabindex=${this._showYearDropdown?-1:0}
|
|
9
9
|
class="dropdown-selected"
|
|
10
10
|
@click=${()=>this._toggleMonthDropdown()}
|
|
11
|
-
@keydown=${
|
|
11
|
+
@keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._toggleMonthDropdown())}}
|
|
12
12
|
>
|
|
13
13
|
${this._monthNames[e].slice(0,3)}
|
|
14
14
|
<md-icon>arrow_drop_down</md-icon>
|
|
@@ -25,7 +25,7 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
25
25
|
tabindex=${this._showMonthDropdown?-1:0}
|
|
26
26
|
class="dropdown-selected"
|
|
27
27
|
@click=${()=>this._toggleYearDropdown()}
|
|
28
|
-
@keydown=${
|
|
28
|
+
@keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._toggleYearDropdown())}}
|
|
29
29
|
>
|
|
30
30
|
${t}
|
|
31
31
|
<md-icon>arrow_drop_down</md-icon>
|
|
@@ -40,7 +40,7 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
40
40
|
<div class="datepicker-content" style="position:relative;">
|
|
41
41
|
${this._showMonthDropdown?c`
|
|
42
42
|
<div class="dropdown-list">
|
|
43
|
-
${this._monthNames.map((
|
|
43
|
+
${this._monthNames.map((s,i)=>c`
|
|
44
44
|
<div
|
|
45
45
|
@keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._onMonthChangeCustom(i))}}
|
|
46
46
|
tabindex="0"
|
|
@@ -49,7 +49,7 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
49
49
|
id=${i===e?"selected-month":""}
|
|
50
50
|
>
|
|
51
51
|
${i===e?c`<md-icon>check</md-icon>`:""}
|
|
52
|
-
${
|
|
52
|
+
${s}
|
|
53
53
|
<md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
|
|
54
54
|
</div>
|
|
55
55
|
`)}
|
|
@@ -57,16 +57,16 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
57
57
|
`:""}
|
|
58
58
|
${this._showYearDropdown?c`
|
|
59
59
|
<div class="dropdown-list">
|
|
60
|
-
${a.map(
|
|
60
|
+
${a.map(s=>c`
|
|
61
61
|
<div
|
|
62
|
-
@keydown=${i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._onYearChangeCustom(
|
|
62
|
+
@keydown=${i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._onYearChangeCustom(s))}}
|
|
63
63
|
tabindex="0"
|
|
64
|
-
class="dropdown-item${
|
|
65
|
-
@click=${()=>this._onYearChangeCustom(
|
|
66
|
-
id=${
|
|
64
|
+
class="dropdown-item${s===t?" selected":""}"
|
|
65
|
+
@click=${()=>this._onYearChangeCustom(s)}
|
|
66
|
+
id=${s===t?"selected-year":""}
|
|
67
67
|
>
|
|
68
|
-
${
|
|
69
|
-
${
|
|
68
|
+
${s===t?c`<md-icon>check</md-icon>`:""}
|
|
69
|
+
${s}
|
|
70
70
|
<md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
|
|
71
71
|
</div>
|
|
72
72
|
`)}
|
|
@@ -81,15 +81,15 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
81
81
|
</tr>
|
|
82
82
|
</thead>
|
|
83
83
|
<tbody>
|
|
84
|
-
${d.map(
|
|
84
|
+
${d.map(s=>c`
|
|
85
85
|
<tr>
|
|
86
|
-
${
|
|
86
|
+
${s.map(i=>i?c`
|
|
87
87
|
<td>
|
|
88
88
|
<div
|
|
89
89
|
@keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._selectDate(i))}}
|
|
90
90
|
role="button"
|
|
91
91
|
tabindex="0"
|
|
92
|
-
class="day${this._isToday(i,
|
|
92
|
+
class="day${this._isToday(i,o)?" today":""}${this._isSelected(i)?" selected":""}"
|
|
93
93
|
@click=${()=>this._selectDate(i)}
|
|
94
94
|
>${i.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
|
|
95
95
|
</td>
|
|
@@ -115,4 +115,4 @@ import{f as h,h as x,m as $,p as m,v as c,y as M}from"../../vendor/vendor.js";im
|
|
|
115
115
|
`:""}
|
|
116
116
|
</div>
|
|
117
117
|
</div>
|
|
118
|
-
`}_getMonthDays(t,e){const
|
|
118
|
+
`}_getMonthDays(t,e){const o=new Date(Date.UTC(t,e,1)),d=new Date(Date.UTC(t,e+1,0)),a=[];let r=[],s=o.getUTCDay(),i=s===0?6:s-1;for(let n=0;n<i;n++)r.push(null);for(let n=1;n<=d.getUTCDate();n++){const u=new Date(Date.UTC(t,e,n));r.push(u),r.length===7&&(a.push(r),r=[])}if(r.length){for(;r.length<7;)r.push(null);a.push(r)}return a}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{const t=this.renderRoot.querySelector("#selected-month");t&&t.scrollIntoView({block:"center"})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{const t=this.renderRoot.querySelector("#selected-year");t&&t.scrollIntoView({block:"center"})},0))}_onMonthChangeCustom(t){const e=this._currentDate.getFullYear();this._currentDate=new Date(e,t,1),this._showMonthDropdown=!1}_onYearChangeCustom(t){const e=this._currentDate.getMonth();this._currentDate=new Date(t,e,1),this._showYearDropdown=!1}_isToday(t,e){return t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}_isSelected(t){return this._selectedDate&&t.getDate()===this._selectedDate.getDate()&&t.getMonth()===this._selectedDate.getMonth()&&t.getFullYear()===this._selectedDate.getFullYear()}_selectDate(t){if(this._selectedDate=t,this.variant==="datetime-local"){const e=new Date(t);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes();const o=a=>a.toString().padStart(2,"0"),d=`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:d},bubbles:!0,composed:!0}))}else{const e=t.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:e},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant==="datetime-local"&&this._selectedDate){const t=new Date(this._selectedDate);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);const e=d=>d.toString().padStart(2,"0"),o=`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:o},bubbles:!0,composed:!0}))}}},w.styles=[x`:host{--scb-datepicker-width:380px;--scb-datepicker-z-index:1100;--scb-datepicker-viewport-margin:8px;--scb-datepicker-offset:var(--spacing-2, 4px);max-width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));font-family:var(--brand-font);color:var(--md-sys-color-on-surface);display:block;position:var(--scb-datepicker-position, fixed);top:var(--scb-datepicker-top, calc(100% + var(--scb-datepicker-offset)));bottom:var(--scb-datepicker-bottom, auto);left:var(--scb-datepicker-left, 0);width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));transform:var(--scb-datepicker-transform, translateX(0px));z-index:var(--scb-datepicker-z-index)}.dropdown-selected,.month-selector,.year-selector{display:flex;align-items:center}.dropdown-selected{position:relative;border-radius:8px;font-size:16px;cursor:pointer;text-align:left;gap:8px;padding:4px 8px}.dropdown-selected:focus{outline:0}.dropdown-selected md-focus-ring{border-radius:8px}.dropdown-list{position:relative;background:var(--md-sys-color-surface);padding:4px 0}.dropdown-item{display:flex;position:relative;cursor:pointer;padding:var(--spacing-3) 56px;min-height:40px;align-items:center}.dropdown-item:focus-within{outline:0}.datepicker-popup,.dropdown-item md-focus-ring{border-radius:var(--md-sys-shape-corner-small)}.dropdown-item.selected{background:var(--md-sys-color-secondary-container, #e3f2fd);font-weight:500;padding-left:16px;gap:16px}.datepicker-popup{background:var(--md-sys-color-surface);box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);max-width:100%;width:100%;max-height:var(--scb-datepicker-max-height, 80vh);overflow:auto;font-family:var(--brand-font)}.datepicker-content{overflow-y:auto;max-height:290px}.datepicker-content::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.datepicker-content::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.datepicker-content::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.popup{position:absolute;top:0;left:0;z-index:1}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;padding:20px 16px 0;flex-wrap:wrap}.datepicker-footer{padding:8px 16px 24px}.month-label{font-size:18px;font-weight:500}.datepicker-calendar{padding:0 16px}table{width:100%;border-collapse:collapse;margin-bottom:8px}th{color:var(--md-sys-color-on-surface-variant, #757575);font-size:16px;font-weight:600;padding-bottom:20px}td{text-align:center}.day:focus-within{outline:0}.close-datepicker,.day{background:0 0;font-size:16px;cursor:pointer}.day{position:relative;width:40px;height:40px;border-radius:50%;border:0;font-family:"Inter";align-content:center}.day.selected{background:var(--md-sys-color-secondary-container)}.close-datepicker{margin-top:8px;border-color:none;color:var(--md-sys-color-primary, #0057b8);padding:4px 12px;border-radius:8px}.close-datepicker:hover{background:var(--md-sys-color-primary-container, #e3f2fd)}`],w);h([l()],p.prototype,"_currentDate",void 0);h([l()],p.prototype,"_selectedDate",void 0);h([l()],p.prototype,"_showMonthDropdown",void 0);h([l()],p.prototype,"_showYearDropdown",void 0);h([m({type:String})],p.prototype,"variant",void 0);h([m({type:String})],p.prototype,"lang",void 0);h([m({type:String})],p.prototype,"selectedValue",void 0);h([m({type:Boolean})],p.prototype,"open",void 0);h([l()],p.prototype,"_selectedHour",void 0);h([l()],p.prototype,"_selectedMinute",void 0);p=h([k("scb-datepicker")],p);
|
|
@@ -1,18 +1,36 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
${this.label?d`
|
|
1
|
+
import{a as d,h as u,m as b,p as a,v as c,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{ensureFocusRingOnFocusVisible as m}from"../shared/lazy-focus-ring.js";import{t as l}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-tooltip/scb-tooltip.js";import"./scb-select-option.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,o){try{customElements.get(t)||e(t,s,o)}catch(r){var n=String(r||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var p,i=(p=class extends u{constructor(){super(),this._optionsObserver=null,this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.required=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.helpText="",this.helpLabel="Visa hjälptext",this.withRadiobuttons=!1,this.noHighlightSelected=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.zIndex=void 0,this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._initialValues=[],this._customValidationMessage="",this._selectId=`scb-select-${Math.random().toString(36).slice(2,11)}`,this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this._setOpen(!1))},this._onSlotClick=e=>{const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option"),o=e.composedPath(),n=s.find(r=>o.includes(r));n&&(this._selectOption(n),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option"),o=e.composedPath(),n=s.find(r=>o.includes(r));n&&this._selectOption(n)}},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick),this._optionsObserver=new MutationObserver(()=>{this.requestUpdate()}),this._optionsObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","value","disabled"]}),this._syncDensityForSize(),this._initialValue=this.value,this._initialValues=Array.isArray(this.values)?[...this.values]:[],this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.values=Array.isArray(this._initialValues)?[...this._initialValues]:[],this._syncFormValue(),this._syncValidity(),this.requestUpdate()},this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("reset",this._formResetHandler,!0),this._form.addEventListener("submit",this._formSubmitHandler,!0))}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._optionsObserver?.disconnect(),this._optionsObserver=null,super.disconnectedCallback()}_getMultiValues(){return Array.isArray(this.values)&&this.values.length>0?this.values:this.value?this.value.split(",").map(e=>e.trim()).filter(Boolean):[]}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e,o=this._mapSpacingToken(this.spacingLeft),n=this._mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-select-spacing-block-start",t):this.style.removeProperty("--scb-select-spacing-block-start"),s?this.style.setProperty("--scb-select-spacing-block-end",s):this.style.removeProperty("--scb-select-spacing-block-end"),o?this.style.setProperty("--scb-select-spacing-inline-start",o):this.style.removeProperty("--scb-select-spacing-inline-start"),n?this.style.setProperty("--scb-select-spacing-inline-end",n):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){this.open!==e&&(this.open=e,e?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_hasMoreThanFourOptions(){const e=this.shadowRoot?.querySelector("slot");if(!e)return!1;const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");return["extra-small","small","medium"].includes(this.size)?t.length>5:t.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const t=this._getMultiValues();t.indexOf(e.value)>-1?this.values=t.filter(s=>s!==e.value):this.values=[...t,e.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))}else this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this._setOpen(!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this.shadowRoot?.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const s=this._getMultiValues(),o=t.filter(n=>s.includes(n.value));return o&&o.length>0?o.map(n=>this._getOptionLabel(n)).join(", "):""}else{const s=t.find(o=>o.value===this.value);return s?this._getOptionLabel(s):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name){this._internals.setFormValue(null);return}if(this.variant==="multi-select"){const e=this._getMultiValues();if(e.length===0){this._internals.setFormValue(null);return}const t=new FormData;e.forEach(s=>t.append(this.name,s)),this._internals.setFormValue(t);return}this._internals.setFormValue(this.value||null)}}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.variant==="multi-select"?this._getMultiValues().length>0:this.value)?"Välj ett alternativ.":""}_syncValidity(){if(!this._internals)return;const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value");if(!e){this._internals.setValidity({}),this.removeAttribute("aria-invalid"),t&&t.setCustomValidity("");return}t&&t.setCustomValidity(e),this._internals.setValidity({valueMissing:!0},e,t??void 0),this.setAttribute("aria-invalid","true")}checkValidity(){return!this._getValidationMessage()}reportValidity(){return this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}_updateOptionsChecked(){const e=this.shadowRoot?.querySelector("slot");e&&e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option").forEach(t=>{if(this.noHighlightSelected?t.setAttribute("no-highlight-selected",""):t.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const s=this._getMultiValues();t.showCheckbox=!0,t.checked=s.includes(t.value),t.showRadio=!1}else t.showCheckbox=!1,t.checked=this.value===t.value,this.withRadiobuttons&&(t.showRadio=!0)})}_renderLabel(){if(!this.label)return null;const e=!!this.supportingText,t=`${this._selectId}-label`,s=c`
|
|
3
2
|
<label
|
|
4
|
-
class="select-label ${this.
|
|
5
|
-
id
|
|
3
|
+
class="select-label ${!e&&!this.helpText?"select-label--without-supporting":""}"
|
|
4
|
+
id=${t}
|
|
6
5
|
>
|
|
7
6
|
${this.label}
|
|
8
7
|
</label>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
`;return this.helpText?c`
|
|
9
|
+
<div class="select-label-row ${e?"":"select-label-row--without-supporting"}">
|
|
10
|
+
${s}
|
|
11
|
+
<scb-tooltip
|
|
12
|
+
class="select-help-tooltip"
|
|
13
|
+
supporting-text=${this.helpText}
|
|
14
|
+
trigger="hover-click"
|
|
15
|
+
position="top"
|
|
16
|
+
arrow
|
|
17
|
+
>
|
|
18
|
+
<scb-icon-button
|
|
19
|
+
class="select-help-button"
|
|
20
|
+
icon="help"
|
|
21
|
+
size="small"
|
|
22
|
+
aria-label=${this.helpLabel||"Visa hjälptext"}
|
|
23
|
+
></scb-icon-button>
|
|
24
|
+
</scb-tooltip>
|
|
25
|
+
</div>
|
|
26
|
+
`:s}_renderSupportingText(){return this.supportingText?c`
|
|
27
|
+
<span class="select-sub-label" id="${this._selectId}-supporting-text">${this.supportingText}</span>
|
|
28
|
+
`:null}render(){const e=this.label?`${this._selectId}-label`:void 0,t=this.supportingText?`${this._selectId}-supporting-text`:void 0;return c`
|
|
29
|
+
${this._renderLabel()}
|
|
30
|
+
${this._renderSupportingText()}
|
|
31
|
+
<div class="select">
|
|
32
|
+
<div class="selected-value-container" tabindex="0" @click="${this._toggleOpen}" @keydown="${this._onKeyDown}" @focusin=${m}>
|
|
33
|
+
<md-focus-ring inward></md-focus-ring>
|
|
16
34
|
<md-ripple></md-ripple>
|
|
17
35
|
<input
|
|
18
36
|
tabindex="-1"
|
|
@@ -20,11 +38,12 @@ import{a as p,h as u,m as b,p as l,v as d,y as g}from"../../vendor/vendor.js";im
|
|
|
20
38
|
type="text"
|
|
21
39
|
readonly
|
|
22
40
|
.value="${this._getSelectedLabel()||this.placeholder}"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
name="${this.name}"
|
|
42
|
+
?required=${this.required}
|
|
43
|
+
aria-required="${this.required?"true":"false"}"
|
|
44
|
+
aria-labelledby=${d(e)}
|
|
45
|
+
aria-describedby=${d(t)}
|
|
46
|
+
aria-label="${!this.label&&this.placeholder?this.placeholder:""}"
|
|
28
47
|
title="${!this.label&&this.placeholder?this.placeholder:""}"
|
|
29
48
|
placeholder="${this.placeholder}"
|
|
30
49
|
/>
|
|
@@ -34,11 +53,11 @@ import{a as p,h as u,m as b,p as l,v as d,y as g}from"../../vendor/vendor.js";im
|
|
|
34
53
|
</div>
|
|
35
54
|
<div
|
|
36
55
|
class="${this._hasMoreThanFourOptions()?"options options--scroll":"options"}"
|
|
37
|
-
style=${
|
|
56
|
+
style=${d(this.zIndex?`z-index: ${this.zIndex};`:void 0)}
|
|
38
57
|
@click=${this._onSlotClick}
|
|
39
58
|
@keydown=${this._onOptionKeyDown}
|
|
40
59
|
>
|
|
41
60
|
<slot @slotchange="${()=>{this.requestUpdate()}}"></slot>
|
|
42
61
|
</div>
|
|
43
62
|
</div>
|
|
44
|
-
`}},
|
|
63
|
+
`}},p.formAssociated=!0,p.styles=g`:host{display:flex;flex-direction:column;color:var(--md-sys-color-on-surface);font-family:var(--brand-font);--scb-select-max-width:400px;--scb-select-padding-x:var(--spacing-5);--scb-select-padding-y:var(--spacing-2);--scb-select-min-height:56px;--scb-select-font-size:var(--md-sys-typescale-body-large-size);--scb-select-line-height:var(--md-sys-typescale-body-large-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-large-tracking);--scb-select-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-select-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-label-gap:var(--spacing-3);max-width:var(--scb-select-max-width);width:100%;margin-block-start:var(--scb-select-spacing-block-start, 0);margin-block-end:var(--scb-select-spacing-block-end, 0);margin-inline-start:var(--scb-select-spacing-inline-start, 0);margin-inline-end:var(--scb-select-spacing-inline-end, 0)}:host([disabled]){pointer-events:none;opacity:.38}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-select-label-font-size:var(--md-sys-typescale-label-small-size);--scb-select-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-select-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-select-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-select-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-padding-y:var(--spacing-2)}:host([size='medium']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:48px;--scb-select-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-font-size:var(--md-sys-typescale-body-medium-size);--scb-select-option-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']),:host([size='small']){--scb-select-font-size:var(--md-sys-typescale-body-small-size);--scb-select-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-select-option-font-size:var(--md-sys-typescale-body-small-size);--scb-select-option-line-height:var(--md-sys-typescale-body-small-line-height);--scb-select-option-letter-spacing:var(--md-sys-typescale-body-small-tracking)}:host([size='small']){--scb-select-padding-x:var(--spacing-4);--scb-select-padding-y:var(--spacing-3);--scb-select-min-height:40px;--scb-select-option-padding-x:var(--spacing-4);--scb-select-option-gap:var(--spacing-3);--scb-select-option-min-height:40px;--scb-select-option-icon-size:var(--icon-size-small, 20px)}:host([size='extra-small']){--scb-select-padding-x:var(--spacing-3);--scb-select-padding-y:var(--spacing-2);--scb-select-min-height:32px;--scb-select-option-padding-x:var(--spacing-3);--scb-select-option-gap:var(--spacing-2);--scb-select-option-min-height:32px;--scb-select-option-icon-size:var(--icon-size-extra-small, 16px)}.select{position:relative;background:var(--md-sys-color-surface);cursor:pointer;border-radius:var(--md-sys-shape-corner-small);border:1px solid var(--md-sys-color-outline);outline:1px solid transparent;transition:border .2s}:host .select:hover,:host([open]) .select{outline:1px solid var(--md-sys-color-outline)}.selected-value{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;border:0;background:0 0;font:inherit;color:inherit;padding:0;outline:0;cursor:pointer;font-size:var(--scb-select-font-size);line-height:var(--scb-select-line-height);letter-spacing:var(--scb-select-letter-spacing)}.selected-value-container:focus-within{outline:0}.select-label{display:block;font-size:var(--scb-select-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-select-label-line-height);letter-spacing:var(--scb-select-label-letter-spacing)}.select-label-row{display:flex;align-items:center;gap:var(--spacing-1, 2px)}.select-label-row--without-supporting{margin-bottom:var(--scb-select-label-gap)}.select-help-tooltip{display:inline-flex;align-items:center;flex:0 0 auto;line-height:0}.select-help-button{--scb-icon-button-container-size:var(--scale-06, 24px);--scb-icon-button-icon-size:var(--icon-size-extra-small, 16px)}.select-label--without-supporting,.select-sub-label{margin-bottom:var(--scb-select-label-gap)}.select-sub-label{display:block;font-size:var(--scb-select-supporting-font-size);line-height:var(--scb-select-supporting-line-height);letter-spacing:var(--scb-select-supporting-letter-spacing);font-weight:var(--weight-regular);color:var(--md-sys-color-on-surface-variant)}md-focus-ring{position:absolute;border-radius:8px}.arrow,.options{position:absolute;pointer-events:none}.arrow{right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.options{left:0;right:0;top:calc(100% + 3px);z-index:10;max-height:0;overflow-y:hidden;transition:max-height .3s cubic-bezier(.4,0,.2,1),opacity .15s linear .15s,visibility 0s linear .3s;visibility:hidden;opacity:0;border-radius:var(--md-sys-shape-corner-small);background:var(--md-sys-color-surface);padding:8px 0;box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15)}.options::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.options::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.options::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}:host([open]) .options{max-height:240px;visibility:visible;pointer-events:auto;transition:max-height .3s cubic-bezier(.4,0,.2,1),opacity 0s linear 0s,visibility 0s linear 0s;opacity:1}.options.options--scroll{overflow-y:auto}.option[aria-selected=true]{background:#e6f0fa}.option[aria-disabled=true]{color:#aaa;pointer-events:none}.selected-value-container{height:100%;min-height:var(--scb-select-min-height);box-sizing:border-box;position:relative;display:flex;align-items:center;padding:var(--scb-select-padding-y) 52px var(--scb-select-padding-y) var(--scb-select-padding-x)}:host([size='extra-small']) .selected-value-container{padding-right:44px}`,p);l([a({type:String})],i.prototype,"variant",void 0);l([a({type:String})],i.prototype,"value",void 0);l([a({type:Array})],i.prototype,"values",void 0);l([a({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0);l([a({type:Boolean,reflect:!0})],i.prototype,"required",void 0);l([a({type:Boolean,reflect:!0})],i.prototype,"open",void 0);l([a({type:String})],i.prototype,"label",void 0);l([a({type:String})],i.prototype,"name",void 0);l([a({type:String})],i.prototype,"placeholder",void 0);l([a({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",void 0);l([a({type:String,attribute:"help-text"})],i.prototype,"helpText",void 0);l([a({type:String,attribute:"help-label"})],i.prototype,"helpLabel",void 0);l([a({type:Boolean,attribute:"with-radiobuttons"})],i.prototype,"withRadiobuttons",void 0);l([a({type:Boolean,attribute:"no-highlight-selected",reflect:!0})],i.prototype,"noHighlightSelected",void 0);l([a({type:String,reflect:!0})],i.prototype,"size",void 0);l([a({type:String,reflect:!0})],i.prototype,"spacing",void 0);l([a({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",void 0);l([a({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",void 0);l([a({type:String,attribute:"spacing-left",reflect:!0})],i.prototype,"spacingLeft",void 0);l([a({type:String,attribute:"spacing-right",reflect:!0})],i.prototype,"spacingRight",void 0);l([a({type:String,attribute:"z-index"})],i.prototype,"zIndex",void 0);i=l([b("scb-select")],i);
|