@nldd/design-system 0.13.1 → 0.13.2
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/NOTICES.md +18 -1
- package/README.md +32 -24
- package/custom-elements.json +1046 -6
- package/dist/components/actions/button-group/button-group.d.ts +22 -7
- package/dist/components/actions/button-group/button-group.d.ts.map +1 -1
- package/dist/components/actions/button-group/button-group.js +38 -19
- package/dist/components/actions/button-group/button-group.js.map +1 -1
- package/dist/components/actions/button-group/button-group.styles.d.ts.map +1 -1
- package/dist/components/actions/button-group/button-group.styles.js +43 -18
- package/dist/components/actions/button-group/button-group.styles.js.map +1 -1
- package/dist/components/actions/button-group/button-group.template.js +1 -1
- package/dist/components/actions/button-group/button-group.template.js.map +1 -1
- package/dist/components/actions/menu/menu.d.ts +14 -0
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +41 -0
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/components.js +2432 -97
- package/dist/components/content/avatar-group/avatar-group.styles.d.ts.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.styles.js +12 -1
- package/dist/components/content/avatar-group/avatar-group.styles.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +10 -5
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.js +4 -0
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +4 -2
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/text/text.d.ts +1 -1
- package/dist/components/content/text/text.js +1 -1
- package/dist/components/content/text/text.styles.d.ts.map +1 -1
- package/dist/components/content/text/text.styles.js +104 -1
- package/dist/components/content/text/text.styles.js.map +1 -1
- package/dist/components/content/token/token.styles.d.ts.map +1 -1
- package/dist/components/content/token/token.styles.js +2 -1
- package/dist/components/content/token/token.styles.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.styles.js +7 -7
- package/dist/components/forms/form-field/form-field.d.ts +9 -5
- package/dist/components/forms/form-field/form-field.d.ts.map +1 -1
- package/dist/components/forms/form-field/form-field.js +17 -6
- package/dist/components/forms/form-field/form-field.js.map +1 -1
- package/dist/components/{icon-DZ1UXCzO.js → icon-DRpTWSIg.js} +12 -6
- package/dist/components/{icon-button-984CwkU1.js → icon-button-DUEmWlBD.js} +8 -8
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.d.ts +12 -0
- package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.i18n.d.ts +1 -0
- package/dist/components/inputs/file-field/file-field.i18n.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.i18n.js +1 -0
- package/dist/components/inputs/file-field/file-field.i18n.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.js +28 -9
- package/dist/components/inputs/file-field/file-field.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.styles.js +91 -8
- package/dist/components/inputs/file-field/file-field.styles.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.template.d.ts +1 -0
- package/dist/components/inputs/file-field/file-field.template.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.template.js +51 -21
- package/dist/components/inputs/file-field/file-field.template.js.map +1 -1
- package/dist/components/inputs/slider/slider.d.ts +161 -0
- package/dist/components/inputs/slider/slider.d.ts.map +1 -0
- package/dist/components/inputs/slider/slider.i18n.d.ts +6 -0
- package/dist/components/inputs/slider/slider.i18n.d.ts.map +1 -0
- package/dist/components/inputs/slider/slider.i18n.js +5 -0
- package/dist/components/inputs/slider/slider.i18n.js.map +1 -0
- package/dist/components/inputs/slider/slider.js +436 -0
- package/dist/components/inputs/slider/slider.js.map +1 -0
- package/dist/components/inputs/slider/slider.styles.d.ts +2 -0
- package/dist/components/inputs/slider/slider.styles.d.ts.map +1 -0
- package/dist/components/inputs/slider/slider.styles.js +360 -0
- package/dist/components/inputs/slider/slider.styles.js.map +1 -0
- package/dist/components/inputs/slider/slider.template.d.ts +5 -0
- package/dist/components/inputs/slider/slider.template.d.ts.map +1 -0
- package/dist/components/inputs/slider/slider.template.js +99 -0
- package/dist/components/inputs/slider/slider.template.js.map +1 -0
- package/dist/components/layout/task-board/task-board-column.d.ts +80 -0
- package/dist/components/layout/task-board/task-board-column.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board-column.js +207 -0
- package/dist/components/layout/task-board/task-board-column.js.map +1 -0
- package/dist/components/layout/task-board/task-board-column.template.d.ts +3 -0
- package/dist/components/layout/task-board/task-board-column.template.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board-column.template.js +45 -0
- package/dist/components/layout/task-board/task-board-column.template.js.map +1 -0
- package/dist/components/layout/task-board/task-board.d.ts +169 -0
- package/dist/components/layout/task-board/task-board.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board.i18n.d.ts +11 -0
- package/dist/components/layout/task-board/task-board.i18n.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board.i18n.js +10 -0
- package/dist/components/layout/task-board/task-board.i18n.js.map +1 -0
- package/dist/components/layout/task-board/task-board.js +701 -0
- package/dist/components/layout/task-board/task-board.js.map +1 -0
- package/dist/components/layout/task-board/task-board.styles.d.ts +3 -0
- package/dist/components/layout/task-board/task-board.styles.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board.styles.js +259 -0
- package/dist/components/layout/task-board/task-board.styles.js.map +1 -0
- package/dist/components/layout/task-board/task-board.template.d.ts +3 -0
- package/dist/components/layout/task-board/task-board.template.d.ts.map +1 -0
- package/dist/components/layout/task-board/task-board.template.js +25 -0
- package/dist/components/layout/task-board/task-board.template.js.map +1 -0
- package/dist/components/navigation/link/link.d.ts +5 -0
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +20 -1
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/navigation/link/link.template.d.ts +1 -0
- package/dist/components/navigation/link/link.template.d.ts.map +1 -1
- package/dist/components/navigation/link/link.template.js +16 -14
- package/dist/components/navigation/link/link.template.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.js +1 -1
- package/dist/css/{global-system-font.css → global-open-font.css} +2 -0
- package/dist/css/global.css +1 -0
- package/dist/css/inter-font.css +47 -0
- package/dist/css/jetbrains-mono-font.css +22 -0
- package/dist/css/rijksoverheid-fonts.css +4 -21
- package/dist/css/themes/bruin.css +1 -0
- package/dist/css/themes/donkerblauw.css +1 -0
- package/dist/css/themes/donkerbruin.css +1 -0
- package/dist/css/themes/donkergeel.css +1 -0
- package/dist/css/themes/donkergroen.css +1 -0
- package/dist/css/themes/geel.css +1 -0
- package/dist/css/themes/groen.css +1 -0
- package/dist/css/themes/hemelblauw.css +1 -0
- package/dist/css/themes/lichtblauw.css +1 -0
- package/dist/css/themes/mintgroen.css +1 -0
- package/dist/css/themes/mosgroen.css +1 -0
- package/dist/css/themes/oranje.css +1 -0
- package/dist/css/themes/paars.css +1 -0
- package/dist/css/themes/robijnrood.css +1 -0
- package/dist/css/themes/rood.css +1 -0
- package/dist/css/themes/roze.css +1 -0
- package/dist/css/themes/violet.css +1 -0
- package/dist/css/themes.css +17 -0
- package/dist/css/tokens.css +1 -0
- package/dist/css/variables.css +27 -5
- package/dist/fonts/Inter-Latin-Italic[wght].woff2 +0 -0
- package/dist/fonts/Inter-LatinExt-Italic[wght].woff2 +0 -0
- package/dist/fonts/Inter-LatinExt[wght].woff2 +0 -0
- package/dist/fonts/Inter-Latin[wght].woff2 +0 -0
- package/dist/nldd.min.js +1765 -804
- package/dist/translations/en-US.d.ts.map +1 -1
- package/dist/translations/en-US.js +10 -0
- package/dist/translations/en-US.js.map +1 -1
- package/dist/translations/nl.generated.d.ts +10 -0
- package/dist/translations/nl.generated.d.ts.map +1 -1
- package/dist/translations/nl.generated.js +4 -0
- package/dist/translations/nl.generated.js.map +1 -1
- package/dist/types/vue.d.ts +107 -3
- package/dist/utilities/tab-order.d.ts +11 -0
- package/dist/utilities/tab-order.d.ts.map +1 -0
- package/dist/utilities/tab-order.js +55 -0
- package/dist/utilities/tab-order.js.map +1 -0
- package/package.json +12 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
|
|
2
2
|
import { n as slottedReset, t as inheritedTextReset } from "./shadow-resets-BwOyyZFH.js";
|
|
3
3
|
import { a as linkHintKey, i as downloadLinkHintKey, n as setTranslations, r as translate, s as linkRel, t as withTranslations } from "./with-translations-DRuOq3QK.js";
|
|
4
|
-
import { a as NLDDActivityIndicator, c as ShortcutAvailabilityController, d as shortcutsAvailable, i as releaseContext, l as hasShortcut, n as NLDDTooltip, o as PopupAnchorController, r as carryContext, s as NLDDKeyboardShortcut, t as NLDDIconButton, u as shortcutLabel } from "./icon-button-
|
|
4
|
+
import { a as NLDDActivityIndicator, c as ShortcutAvailabilityController, d as shortcutsAvailable, i as releaseContext, l as hasShortcut, n as NLDDTooltip, o as PopupAnchorController, r as carryContext, s as NLDDKeyboardShortcut, t as NLDDIconButton, u as shortcutLabel } from "./icon-button-DUEmWlBD.js";
|
|
5
5
|
import { t as reflectNonDefault } from "./reflect-non-default-B9wQcnne.js";
|
|
6
6
|
import { t as __decorate } from "./decorate-Cz9-peTN.js";
|
|
7
|
-
import { t as NLDDIcon } from "./icon-
|
|
7
|
+
import { t as NLDDIcon } from "./icon-DRpTWSIg.js";
|
|
8
8
|
import { n as isPointerMode, r as isTouchMode, t as isKeyboardMode } from "./input-modality-CiPLYYMN.js";
|
|
9
9
|
import { n as queryBreakpoints, r as rootFontSize, t as breakpointPx } from "./breakpoints-Bti55RWY.js";
|
|
10
10
|
import { t as VisibilityMixin } from "./visibility-mixin-C-K7ho5Q.js";
|
|
@@ -13,7 +13,7 @@ import { a as tags, c as NodeProp, f as Parser, h as parseMixed, l as NodeSet, p
|
|
|
13
13
|
import { i as completionStatus, n as autocompletion, s as startCompletion, t as CompletionContext } from "./dist-Bm3708s5.js";
|
|
14
14
|
import { n as html$2, r as htmlCompletionSource } from "./dist-BaLc58I_.js";
|
|
15
15
|
import { LitElement, css, html, nothing, svg, unsafeCSS } from "lit";
|
|
16
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
|
16
|
+
import { customElement, property, query, queryAll, state } from "lit/decorators.js";
|
|
17
17
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
18
18
|
import { classMap } from "lit/directives/class-map.js";
|
|
19
19
|
import { autoUpdate, computePosition, flip, offset, shift, size } from "@floating-ui/dom";
|
|
@@ -2834,29 +2834,25 @@ function inlineDialogTemplate(component) {
|
|
|
2834
2834
|
}
|
|
2835
2835
|
// src/components/actions/button-group/button-group.styles.ts
|
|
2836
2836
|
var buttonGroupStyles = css`
|
|
2837
|
-
:host {
|
|
2838
|
-
box-sizing: border-box;
|
|
2839
|
-
}
|
|
2840
2837
|
|
|
2841
2838
|
|
|
2842
2839
|
/* # Host */
|
|
2843
2840
|
|
|
2844
2841
|
:host {
|
|
2845
|
-
--_button-group-width: 100%;
|
|
2846
2842
|
--_button-group-flex-direction: column;
|
|
2847
2843
|
--_button-group-flex-wrap: nowrap;
|
|
2848
2844
|
--_button-group-gap: var(--primitives-space-8);
|
|
2849
2845
|
|
|
2846
|
+
box-sizing: border-box;
|
|
2850
2847
|
display: flex;
|
|
2851
2848
|
width: 100%;
|
|
2852
|
-
justify-content: flex-start;
|
|
2853
2849
|
}
|
|
2854
2850
|
|
|
2855
2851
|
/* Only auto asks its own width a question, so only auto becomes a container.
|
|
2856
2852
|
A container may not size itself from its contents, and a group pinned to a
|
|
2857
2853
|
row or a stack would then measure zero in a parent that shrink-wraps, for
|
|
2858
|
-
a query it never runs. */
|
|
2859
|
-
:host(:not([orientation="horizontal"], [orientation="vertical"])) {
|
|
2854
|
+
a query it never runs. width="full" asks what fits instead. */
|
|
2855
|
+
:host(:not([orientation="horizontal"], [orientation="vertical"], [width="full"])) {
|
|
2860
2856
|
container-type: inline-size;
|
|
2861
2857
|
}
|
|
2862
2858
|
|
|
@@ -2864,6 +2860,10 @@ var buttonGroupStyles = css`
|
|
|
2864
2860
|
--_button-group-gap: var(--primitives-space-6);
|
|
2865
2861
|
}
|
|
2866
2862
|
|
|
2863
|
+
:host([hidden]) {
|
|
2864
|
+
display: none;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
2867
|
/* ## In a row
|
|
2868
2868
|
The row keeps the full width (like the stack) so full-width children
|
|
2869
2869
|
can actually stretch; content-sized buttons still sit left within
|
|
@@ -2887,8 +2887,8 @@ var buttonGroupStyles = css`
|
|
|
2887
2887
|
beside it everywhere. */
|
|
2888
2888
|
|
|
2889
2889
|
@container (max-width: 30rem) {
|
|
2890
|
-
:host(:not([orientation="horizontal"], [orientation="vertical"])) .button-group {
|
|
2891
|
-
flex-direction: column;
|
|
2890
|
+
:host(:not([orientation="horizontal"], [orientation="vertical"], [width="full"])) .button-group {
|
|
2891
|
+
--_button-group-flex-direction: column;
|
|
2892
2892
|
--context-button-width: 100%;
|
|
2893
2893
|
}
|
|
2894
2894
|
|
|
@@ -2897,7 +2897,7 @@ var buttonGroupStyles = css`
|
|
|
2897
2897
|
An icon-only control is the exception: its size is its icon, and a
|
|
2898
2898
|
full-width bar with one glyph in the middle is not a bigger target for
|
|
2899
2899
|
the thumb, just a wider one. */
|
|
2900
|
-
:host(:not([orientation="horizontal"], [orientation="vertical"])) ::slotted(:not(nldd-icon-button)) {
|
|
2900
|
+
:host(:not([orientation="horizontal"], [orientation="vertical"], [width="full"])) ::slotted(:not(nldd-icon-button)) {
|
|
2901
2901
|
display: block;
|
|
2902
2902
|
width: 100%;
|
|
2903
2903
|
}
|
|
@@ -2905,11 +2905,13 @@ var buttonGroupStyles = css`
|
|
|
2905
2905
|
/* align-self as well: a column stretches its items across the full width
|
|
2906
2906
|
on its own, so without this the icon button is a wide bar regardless of
|
|
2907
2907
|
the width rule above. */
|
|
2908
|
-
:host(:not([orientation="horizontal"], [orientation="vertical"])) ::slotted(nldd-icon-button) {
|
|
2908
|
+
:host(:not([orientation="horizontal"], [orientation="vertical"], [width="full"])) ::slotted(nldd-icon-button) {
|
|
2909
2909
|
align-self: flex-start;
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
|
+
/* ## Vertical */
|
|
2914
|
+
|
|
2913
2915
|
:host([orientation="vertical"]) .button-group {
|
|
2914
2916
|
--context-button-width: 100%;
|
|
2915
2917
|
}
|
|
@@ -2923,14 +2925,37 @@ var buttonGroupStyles = css`
|
|
|
2923
2925
|
align-self: flex-start;
|
|
2924
2926
|
}
|
|
2925
2927
|
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
+
/* ## Full width
|
|
2929
|
+
Equal shares from zero. With auto no button shrinks below its label (or the
|
|
2930
|
+
group), so one that does not fit wraps and fills the next line. */
|
|
2931
|
+
|
|
2932
|
+
:host([width="full"]:not([orientation="vertical"])) .button-group {
|
|
2933
|
+
--context-button-width: 100%;
|
|
2928
2934
|
}
|
|
2929
2935
|
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2936
|
+
:host([width="full"][orientation="horizontal"]) .button-group {
|
|
2937
|
+
--_button-group-flex-wrap: nowrap;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
:host([width="full"]:not([orientation="vertical"])) ::slotted(:not(nldd-icon-button)) {
|
|
2941
|
+
flex-grow: 1;
|
|
2942
|
+
flex-shrink: 1;
|
|
2943
|
+
flex-basis: 0;
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
:host([width="full"]:not([orientation="horizontal"], [orientation="vertical"])) ::slotted(:not(nldd-icon-button)) {
|
|
2947
|
+
min-width: fit-content;
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
:host([width="full"]) ::slotted(nldd-icon-button) {
|
|
2951
|
+
flex-grow: 0;
|
|
2952
|
+
flex-shrink: 0;
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
/* The stack rules set display on slotted children at a higher specificity,
|
|
2956
|
+
so without !important a hidden or a fourth button still shows. */
|
|
2957
|
+
::slotted([hidden]),
|
|
2958
|
+
::slotted(:nth-child(n + 4)) {
|
|
2934
2959
|
display: none !important;
|
|
2935
2960
|
}
|
|
2936
2961
|
|
|
@@ -2939,7 +2964,7 @@ var buttonGroupStyles = css`
|
|
|
2939
2964
|
|
|
2940
2965
|
.button-group {
|
|
2941
2966
|
display: flex;
|
|
2942
|
-
width:
|
|
2967
|
+
width: 100%;
|
|
2943
2968
|
flex-direction: var(--_button-group-flex-direction);
|
|
2944
2969
|
flex-wrap: var(--_button-group-flex-wrap);
|
|
2945
2970
|
gap: var(--_button-group-gap);
|
|
@@ -2949,7 +2974,7 @@ var buttonGroupStyles = css`
|
|
|
2949
2974
|
function template$19() {
|
|
2950
2975
|
return html`
|
|
2951
2976
|
<div class="button-group">
|
|
2952
|
-
<slot @slotchange=${this.
|
|
2977
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
2953
2978
|
</div>
|
|
2954
2979
|
`;
|
|
2955
2980
|
}
|
|
@@ -2977,31 +3002,46 @@ function template$19() {
|
|
|
2977
3002
|
* keeps its own size: a bar with a single glyph in the middle is not a bigger
|
|
2978
3003
|
* target, only a wider one.
|
|
2979
3004
|
*
|
|
3005
|
+
* With `width="full"` the buttons fill the row and share it equally. A button
|
|
3006
|
+
* whose label does not fit its share takes the width it needs, and the others
|
|
3007
|
+
* share what is left. A button that does not fit beside the others moves to the
|
|
3008
|
+
* next line and fills it: two buttons stack, three end up as two over one. That
|
|
3009
|
+
* replaces the 480px rule of `auto`, and the group is no container then. With
|
|
3010
|
+
* `orientation="horizontal"` it stays a row, and a label that does not fit wraps
|
|
3011
|
+
* instead. An `nldd-icon-button` takes no share of the row.
|
|
3012
|
+
*
|
|
3013
|
+
* The group sets its `size` on every button in it: buttons in one group are the
|
|
3014
|
+
* same size. It holds three buttons at most and hides the rest.
|
|
3015
|
+
*
|
|
2980
3016
|
* @element nldd-button-group
|
|
2981
|
-
* @attr {string} size - Button group size: 'sm' | 'md' (default: 'md')
|
|
3017
|
+
* @attr {string} size - Button group size, set on every button in it: 'sm' | 'md' (default: 'md')
|
|
2982
3018
|
* @attr {string} orientation - Layout direction: 'auto' | 'horizontal' | 'vertical' (default: 'auto')
|
|
3019
|
+
* @attr {string} width - 'full': the buttons fill the row in equal shares, and a button that does not fit moves to a line of its own (default: unset, each button as wide as its label)
|
|
2983
3020
|
*
|
|
2984
3021
|
* @slot - Default slot for buttons (max 3)
|
|
2985
|
-
*
|
|
2986
|
-
* @csspart group - The button group container
|
|
2987
3022
|
*/
|
|
2988
3023
|
var _NLDDButtonGroup = class NLDDButtonGroup extends LitElement {
|
|
2989
3024
|
constructor(..._args) {
|
|
2990
3025
|
super(..._args);
|
|
2991
3026
|
this.size = "md";
|
|
2992
3027
|
this.orientation = "auto";
|
|
3028
|
+
this.width = "";
|
|
2993
3029
|
this._collapseObserver = null;
|
|
2994
3030
|
this._collapseVerdict = 0;
|
|
3031
|
+
this._sized = /* @__PURE__ */ new WeakSet();
|
|
2995
3032
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3033
|
+
/** @internal */
|
|
3034
|
+
_handleSlotChange() {
|
|
3035
|
+
const assigned = this._slot.assignedElements({ flatten: true });
|
|
3036
|
+
for (const el of assigned) {
|
|
3037
|
+
el.getAttribute("size");
|
|
2999
3038
|
el.setAttribute("size", this.size);
|
|
3000
|
-
|
|
3039
|
+
this._sized.add(el);
|
|
3040
|
+
}
|
|
3001
3041
|
}
|
|
3002
3042
|
updated(changedProperties) {
|
|
3003
|
-
if (changedProperties.has("size")) this.
|
|
3004
|
-
if (changedProperties.has("orientation")) this._watchForCollapse();
|
|
3043
|
+
if (changedProperties.has("size")) this._handleSlotChange();
|
|
3044
|
+
if (changedProperties.has("orientation") || changedProperties.has("width")) this._watchForCollapse();
|
|
3005
3045
|
}
|
|
3006
3046
|
connectedCallback() {
|
|
3007
3047
|
super.connectedCallback();
|
|
@@ -3012,9 +3052,9 @@ var _NLDDButtonGroup = class NLDDButtonGroup extends LitElement {
|
|
|
3012
3052
|
this._stopWatchingForCollapse();
|
|
3013
3053
|
}
|
|
3014
3054
|
/**
|
|
3015
|
-
* The group is an inline-size container while `orientation` is `auto
|
|
3016
|
-
* width has to come from its parent: a
|
|
3017
|
-
* own contents. In a parent that shrink-wraps (inline-flex, a float, a table
|
|
3055
|
+
* The group is an inline-size container while `orientation` is `auto` and
|
|
3056
|
+
* `width` is not `full`, so its width has to come from its parent: a
|
|
3057
|
+
* container may not size itself from its own contents. In a parent that shrink-wraps (inline-flex, a float, a table
|
|
3018
3058
|
* cell, a flex item at `width: auto`) there is nothing to take, the group
|
|
3019
3059
|
* measures zero and the buttons disappear without an error.
|
|
3020
3060
|
*
|
|
@@ -3051,6 +3091,10 @@ __decorate([property({
|
|
|
3051
3091
|
reflect: true,
|
|
3052
3092
|
converter: reflectNonDefault("auto")
|
|
3053
3093
|
})], NLDDButtonGroup.prototype, "orientation", void 0);
|
|
3094
|
+
__decorate([property({
|
|
3095
|
+
reflect: true,
|
|
3096
|
+
converter: reflectNonDefault("")
|
|
3097
|
+
})], NLDDButtonGroup.prototype, "width", void 0);
|
|
3054
3098
|
__decorate([query("slot")], NLDDButtonGroup.prototype, "_slot", void 0);
|
|
3055
3099
|
NLDDButtonGroup = __decorate([customElement("nldd-button-group")], NLDDButtonGroup);
|
|
3056
3100
|
// src/components/status-and-feedback/inline-dialog/inline-dialog.ts
|
|
@@ -3579,6 +3623,53 @@ var SafeTriangleController = class {
|
|
|
3579
3623
|
this._overlay = null;
|
|
3580
3624
|
}
|
|
3581
3625
|
};
|
|
3626
|
+
// src/utilities/tab-order.ts
|
|
3627
|
+
var TABBABLE = [
|
|
3628
|
+
"a[href]",
|
|
3629
|
+
"button:not([disabled])",
|
|
3630
|
+
"input:not([disabled]):not([type=\"hidden\"])",
|
|
3631
|
+
"select:not([disabled])",
|
|
3632
|
+
"textarea:not([disabled])",
|
|
3633
|
+
"[tabindex]:not([tabindex=\"-1\"])",
|
|
3634
|
+
"[contenteditable=\"\"]",
|
|
3635
|
+
"[contenteditable=\"true\"]",
|
|
3636
|
+
"details > summary:first-of-type"
|
|
3637
|
+
].join(",");
|
|
3638
|
+
function isTabbable(el) {
|
|
3639
|
+
return el instanceof HTMLElement && el.matches(TABBABLE) && el.tabIndex >= 0 && !el.closest("[inert]") && el.getClientRects().length > 0;
|
|
3640
|
+
}
|
|
3641
|
+
/** The children of an element as the flat tree has them: a shadow host its
|
|
3642
|
+
* shadow root's, a slot what is assigned to it, or its fallback without. */
|
|
3643
|
+
function flatChildren(el) {
|
|
3644
|
+
if (el instanceof HTMLSlotElement) {
|
|
3645
|
+
const assigned = el.assignedElements({ flatten: true });
|
|
3646
|
+
return assigned.length ? assigned : Array.from(el.children);
|
|
3647
|
+
}
|
|
3648
|
+
return Array.from((el.shadowRoot ?? el).children);
|
|
3649
|
+
}
|
|
3650
|
+
/**
|
|
3651
|
+
* The element Tab would reach after `anchor` in the page, walking the flat
|
|
3652
|
+
* tree the way the browser builds the tab order, with `skip` and everything in
|
|
3653
|
+
* it left out. For a control in the top layer, such as a menu that lives in
|
|
3654
|
+
* `<body>` while it shows: Tab past its last item should go on from the
|
|
3655
|
+
* control that opened it, not from the end of the document.
|
|
3656
|
+
*
|
|
3657
|
+
* Positive tabindex values are not ordered first; the components use none.
|
|
3658
|
+
*/
|
|
3659
|
+
function nextTabbableAfter(anchor, skip) {
|
|
3660
|
+
let passed = false;
|
|
3661
|
+
const visit = (el) => {
|
|
3662
|
+
if (el === skip) return null;
|
|
3663
|
+
if (passed && isTabbable(el)) return el;
|
|
3664
|
+
for (const child of flatChildren(el)) {
|
|
3665
|
+
const found = visit(child);
|
|
3666
|
+
if (found) return found;
|
|
3667
|
+
}
|
|
3668
|
+
if (el === anchor) passed = true;
|
|
3669
|
+
return null;
|
|
3670
|
+
};
|
|
3671
|
+
return visit(document.body);
|
|
3672
|
+
}
|
|
3582
3673
|
// src/components/actions/menu/menu-item.ts
|
|
3583
3674
|
var _NLDDMenuItem;
|
|
3584
3675
|
/** Makes `host` a list item while its menu is a navigation menu, and takes
|
|
@@ -3963,6 +4054,12 @@ var NLDDMenu = class NLDDMenu extends LitElement {
|
|
|
3963
4054
|
if (!item) return;
|
|
3964
4055
|
this._activateItem(item);
|
|
3965
4056
|
};
|
|
4057
|
+
this._handleMouseover = (event) => {
|
|
4058
|
+
if (isTouchMode() || this.variant === "listbox") return;
|
|
4059
|
+
if (this._activeSubmenu || this._safeTriangle.movingToward) return;
|
|
4060
|
+
if (event.composedPath().some((node) => node instanceof Element && node.localName === "nldd-menu-item")) return;
|
|
4061
|
+
this._clearHighlight();
|
|
4062
|
+
};
|
|
3966
4063
|
this._handleMouseleave = () => {
|
|
3967
4064
|
if (this.variant !== "listbox") this._clearHighlight();
|
|
3968
4065
|
this._cancelHoverOpen();
|
|
@@ -4025,6 +4122,7 @@ var NLDDMenu = class NLDDMenu extends LitElement {
|
|
|
4025
4122
|
this._collapseChain();
|
|
4026
4123
|
};
|
|
4027
4124
|
this._handleKeydown = (event) => {
|
|
4125
|
+
if (event.key === "Tab" && this._tabOut(event)) return;
|
|
4028
4126
|
if (event.key === "Tab" && this.variant === "navigation") {
|
|
4029
4127
|
this._tabbing = true;
|
|
4030
4128
|
clearTimeout(this._tabbingTimer);
|
|
@@ -4362,6 +4460,7 @@ var NLDDMenu = class NLDDMenu extends LitElement {
|
|
|
4362
4460
|
this.addEventListener("keydown", this._handleKeydown);
|
|
4363
4461
|
this.addEventListener("focusout", this._handleFocusOut);
|
|
4364
4462
|
this.addEventListener("mouseenter", this._handleMenuItemMouseenter, true);
|
|
4463
|
+
this.addEventListener("mouseover", this._handleMouseover);
|
|
4365
4464
|
this.addEventListener("mouseleave", this._handleMouseleave);
|
|
4366
4465
|
this.addEventListener("menu-item-focused", this._handleMenuItemFocused);
|
|
4367
4466
|
this.addEventListener("submenu-open", this._handleSubmenuOpen);
|
|
@@ -4391,6 +4490,7 @@ var NLDDMenu = class NLDDMenu extends LitElement {
|
|
|
4391
4490
|
clearTimeout(this._tabbingTimer);
|
|
4392
4491
|
this._tabbing = false;
|
|
4393
4492
|
this.removeEventListener("mouseenter", this._handleMenuItemMouseenter, true);
|
|
4493
|
+
this.removeEventListener("mouseover", this._handleMouseover);
|
|
4394
4494
|
this.removeEventListener("mouseleave", this._handleMouseleave);
|
|
4395
4495
|
this.removeEventListener("menu-item-focused", this._handleMenuItemFocused);
|
|
4396
4496
|
this.removeEventListener("submenu-open", this._handleSubmenuOpen);
|
|
@@ -4580,6 +4680,28 @@ var NLDDMenu = class NLDDMenu extends LitElement {
|
|
|
4580
4680
|
});
|
|
4581
4681
|
}
|
|
4582
4682
|
/**
|
|
4683
|
+
* Tab past the last item, or Shift+Tab before the first, of a menu that
|
|
4684
|
+
* hangs off a control. The menu lives in the top layer, often in `<body>`,
|
|
4685
|
+
* so left to the browser that Tab goes on from the end of the document and
|
|
4686
|
+
* skips everything after the control. It closes the menu and goes on from
|
|
4687
|
+
* the control instead: to what follows it, or back to it. A submenu leaves
|
|
4688
|
+
* Tab to its root menu, which sees no focused item of its own and lets the
|
|
4689
|
+
* browser move between the items.
|
|
4690
|
+
*/
|
|
4691
|
+
_tabOut(event) {
|
|
4692
|
+
const anchor = this._getAnchorEl();
|
|
4693
|
+
if (!anchor || this._isSubmenu || !this.matches(":popover-open")) return false;
|
|
4694
|
+
const items = this._getVisibleItems();
|
|
4695
|
+
const index = items.findIndex((item) => item.matches(":focus-within"));
|
|
4696
|
+
if (index === -1 || index !== (event.shiftKey ? 0 : items.length - 1)) return false;
|
|
4697
|
+
event.preventDefault();
|
|
4698
|
+
event.stopPropagation();
|
|
4699
|
+
const next = event.shiftKey ? anchor : nextTabbableAfter(anchor, this);
|
|
4700
|
+
this.hidePopover();
|
|
4701
|
+
(next ?? anchor).focus();
|
|
4702
|
+
return true;
|
|
4703
|
+
}
|
|
4704
|
+
/**
|
|
4583
4705
|
* Whether focus went to the control that opens this menu. Closing here
|
|
4584
4706
|
* would hand the click that follows a closed menu, and it would open it
|
|
4585
4707
|
* again; the toggle on the anchor does the closing. The node arrives
|
|
@@ -6998,6 +7120,8 @@ var avatarGroupStyles = css`
|
|
|
6998
7120
|
--_avatar-group-corner-radius: var(--primitives-corner-radius-full);
|
|
6999
7121
|
--_avatar-group-overflow-background-color: light-dark(var(--primitives-color-neutral-25), var(--primitives-color-neutral-150));
|
|
7000
7122
|
--_avatar-group-overflow-hover-background-color: light-dark(var(--primitives-color-neutral-50), var(--primitives-color-neutral-200));
|
|
7123
|
+
--_avatar-group-overflow-active-background-color: light-dark(var(--primitives-color-neutral-75), var(--primitives-color-neutral-250));
|
|
7124
|
+
--_avatar-group-overflow-expanded-hover-background-color: light-dark(var(--primitives-color-neutral-100), var(--primitives-color-neutral-300));
|
|
7001
7125
|
--_avatar-group-overflow-content-color: var(--semantics-content-secondary-color);
|
|
7002
7126
|
--_avatar-group-overflow-font: var(--primitives-font-body-xs-medium-flat);
|
|
7003
7127
|
--_avatar-group-overflow-font-scale: 0.235;
|
|
@@ -7084,7 +7208,7 @@ var avatarGroupStyles = css`
|
|
|
7084
7208
|
width: calc(var(--_avatar-group-overflow-icon-scale) * var(--_avatar-group-size));
|
|
7085
7209
|
}
|
|
7086
7210
|
|
|
7087
|
-
/*
|
|
7211
|
+
/* Each state is the smallest step the neutral scale has, one notch further.
|
|
7088
7212
|
No semantic hover token fits: the button-hover colors are meant for a
|
|
7089
7213
|
control that already looks like a button, and here they read as a jump.
|
|
7090
7214
|
It only has to confirm that this disc is clickable. */
|
|
@@ -7092,6 +7216,15 @@ var avatarGroupStyles = css`
|
|
|
7092
7216
|
background-color: var(--_avatar-group-overflow-hover-background-color);
|
|
7093
7217
|
}
|
|
7094
7218
|
|
|
7219
|
+
.avatar-group__overflow-button:active,
|
|
7220
|
+
.avatar-group__overflow-button[aria-expanded="true"] {
|
|
7221
|
+
background-color: var(--_avatar-group-overflow-active-background-color);
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
.avatar-group__overflow-button[aria-expanded="true"]:hover {
|
|
7225
|
+
background-color: var(--_avatar-group-overflow-expanded-hover-background-color);
|
|
7226
|
+
}
|
|
7227
|
+
|
|
7095
7228
|
.avatar-group__overflow-button:focus-visible {
|
|
7096
7229
|
outline: var(--semantics-focus-ring-outline);
|
|
7097
7230
|
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
@@ -15751,8 +15884,21 @@ var textStyles = css`
|
|
|
15751
15884
|
--_text-link-is-hovered-color: var(--semantics-links-is-hovered-color);
|
|
15752
15885
|
--_text-link-is-active-color: var(--semantics-links-is-active-color);
|
|
15753
15886
|
--_text-link-underline-offset: var(--primitives-space-2);
|
|
15754
|
-
--_text-
|
|
15887
|
+
--_text-link-corner-radius: var(--primitives-corner-radius-xxs);
|
|
15888
|
+
--_text-link-is-hovered-inherit-thickness: var(--primitives-border-width-regular);
|
|
15889
|
+
--_text-mention-color: var(--semantics-mentions-content-color);
|
|
15890
|
+
--_text-mention-icon-size: 0.95em;
|
|
15891
|
+
--_text-mention-inline-padding: 0.3em;
|
|
15892
|
+
--_text-mention-corner-radius: var(--primitives-corner-radius-sm);
|
|
15893
|
+
--_text-mention-border-width: var(--semantics-surfaces-highlight-border-width);
|
|
15894
|
+
--_text-mention-border-color: var(--semantics-mentions-highlight-border-color);
|
|
15895
|
+
--_text-mention-background-color: var(--semantics-mentions-background-color);
|
|
15896
|
+
--_text-mention-is-hovered-background-color: var(--semantics-mentions-is-hovered-background-color);
|
|
15897
|
+
--_text-mention-is-active-background-color: var(--semantics-mentions-is-active-background-color);
|
|
15898
|
+
--_text-code-padding: var(--primitives-space-2) var(--primitives-space-4);
|
|
15755
15899
|
--_text-code-corner-radius: var(--semantics-controls-xs-corner-radius);
|
|
15900
|
+
--_text-code-border-width: var(--semantics-surfaces-highlight-border-width);
|
|
15901
|
+
--_text-code-border-color: var(--semantics-surfaces-tinted-highlight-border-color);
|
|
15756
15902
|
--_text-code-background-color: var(--semantics-surfaces-tinted-background-color);
|
|
15757
15903
|
--_text-code-font-family: var(--primitives-font-family-monospace);
|
|
15758
15904
|
--_text-code-font-size: var(--semantics-code-inline-font-size);
|
|
@@ -15822,9 +15968,11 @@ var textStyles = css`
|
|
|
15822
15968
|
}
|
|
15823
15969
|
|
|
15824
15970
|
::slotted(a) {
|
|
15971
|
+
border-radius: var(--_text-link-corner-radius);
|
|
15825
15972
|
color: var(--_text-link-color);
|
|
15826
15973
|
text-decoration: underline;
|
|
15827
15974
|
text-underline-offset: var(--_text-link-underline-offset);
|
|
15975
|
+
cursor: pointer;
|
|
15828
15976
|
}
|
|
15829
15977
|
|
|
15830
15978
|
::slotted(a:hover) {
|
|
@@ -15835,18 +15983,106 @@ var textStyles = css`
|
|
|
15835
15983
|
color: var(--_text-link-is-active-color);
|
|
15836
15984
|
}
|
|
15837
15985
|
|
|
15986
|
+
::slotted(:focus-visible) {
|
|
15987
|
+
outline: var(--semantics-focus-ring-outline);
|
|
15988
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
15989
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
15990
|
+
}
|
|
15991
|
+
|
|
15992
|
+
::slotted(:focus:not(:focus-visible)) {
|
|
15993
|
+
outline: none;
|
|
15994
|
+
}
|
|
15995
|
+
|
|
15838
15996
|
:host([color="inherit"]) ::slotted(a) {
|
|
15839
15997
|
color: currentColor;
|
|
15998
|
+
text-decoration-color: currentColor;
|
|
15999
|
+
}
|
|
16000
|
+
|
|
16001
|
+
:host([color="inherit"]) ::slotted(a:hover) {
|
|
16002
|
+
color: currentColor;
|
|
16003
|
+
text-decoration-thickness: var(--_text-link-is-hovered-inherit-thickness);
|
|
16004
|
+
}
|
|
16005
|
+
|
|
16006
|
+
:host([color="inherit"]) ::slotted(a:active) {
|
|
16007
|
+
color: currentColor;
|
|
16008
|
+
}
|
|
16009
|
+
|
|
16010
|
+
::slotted([data-mention]) {
|
|
16011
|
+
color: var(--_text-mention-color);
|
|
16012
|
+
font-weight: var(--primitives-font-weight-body-bold);
|
|
16013
|
+
white-space: nowrap;
|
|
16014
|
+
}
|
|
16015
|
+
|
|
16016
|
+
::slotted([data-mention])::before {
|
|
16017
|
+
content: '';
|
|
16018
|
+
display: inline-block;
|
|
16019
|
+
margin-inline-end: 0.1em;
|
|
16020
|
+
background-color: currentColor;
|
|
16021
|
+
width: var(--_text-mention-icon-size);
|
|
16022
|
+
height: var(--_text-mention-icon-size);
|
|
16023
|
+
vertical-align: -0.16em;
|
|
16024
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 12c0 2.73 1.3 3.5 2 3.5s2-.77 2-3.5a8 8 0 1 0-5.93 7.73l.52 1.93A10 10 0 1 1 22 12c0 3.27-1.7 5.5-4 5.5-1.36 0-2.5-.78-3.22-2.08A4.3 4.3 0 0 1 11.5 17C9 17 7 14.76 7 12s2-5 4.5-5c.92 0 1.78.31 2.5.84V7h2zm-4.5-3C10.3 9 9 10.14 9 12s1.31 3 2.5 3 2.5-1.14 2.5-3-1.31-3-2.5-3'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
16025
|
+
|
|
16026
|
+
@media (forced-colors: active) {
|
|
16027
|
+
forced-color-adjust: none;
|
|
16028
|
+
background-color: CanvasText;
|
|
16029
|
+
}
|
|
16030
|
+
}
|
|
16031
|
+
|
|
16032
|
+
::slotted(a[data-mention]) {
|
|
16033
|
+
padding-block: max(0em, (1lh - 1.2em) / 2);
|
|
16034
|
+
padding-inline: max(0em, (max(1.2em, 1lh) - var(--_text-mention-icon-size)) / 2) var(--_text-mention-inline-padding);
|
|
16035
|
+
border-radius: var(--_text-mention-corner-radius);
|
|
16036
|
+
box-shadow: inset 0 0 0 var(--_text-mention-border-width) var(--_text-mention-border-color);
|
|
16037
|
+
background-color: var(--_text-mention-background-color);
|
|
16038
|
+
color: var(--_text-mention-color);
|
|
16039
|
+
text-decoration: none;
|
|
16040
|
+
cursor: default;
|
|
16041
|
+
-webkit-box-decoration-break: clone;
|
|
16042
|
+
box-decoration-break: clone;
|
|
16043
|
+
}
|
|
16044
|
+
|
|
16045
|
+
::slotted(a[data-mention]:hover) {
|
|
16046
|
+
background-color: var(--_text-mention-is-hovered-background-color);
|
|
16047
|
+
color: var(--_text-mention-color);
|
|
16048
|
+
}
|
|
16049
|
+
|
|
16050
|
+
::slotted(a[data-mention]:active) {
|
|
16051
|
+
background-color: var(--_text-mention-is-active-background-color);
|
|
16052
|
+
color: var(--_text-mention-color);
|
|
16053
|
+
}
|
|
16054
|
+
|
|
16055
|
+
:host([color="inherit"]) ::slotted(a[data-mention]) {
|
|
16056
|
+
color: var(--_text-mention-color);
|
|
16057
|
+
}
|
|
16058
|
+
|
|
16059
|
+
@media (forced-colors: active) {
|
|
16060
|
+
::slotted(a[data-mention])::before {
|
|
16061
|
+
background-color: LinkText;
|
|
16062
|
+
}
|
|
15840
16063
|
}
|
|
15841
16064
|
|
|
15842
16065
|
::slotted(code) {
|
|
15843
16066
|
border-radius: var(--_text-code-corner-radius);
|
|
16067
|
+
box-shadow: inset 0 0 0 var(--_text-code-border-width) var(--_text-code-border-color);
|
|
15844
16068
|
background-color: var(--_text-code-background-color);
|
|
15845
16069
|
padding: var(--_text-code-padding);
|
|
15846
16070
|
font-family: var(--_text-code-font-family);
|
|
15847
16071
|
font-size: var(--_text-code-font-size);
|
|
15848
16072
|
}
|
|
15849
16073
|
|
|
16074
|
+
::slotted(q) {
|
|
16075
|
+
font-style: italic;
|
|
16076
|
+
}
|
|
16077
|
+
|
|
16078
|
+
::slotted(q)::before {
|
|
16079
|
+
content: open-quote;
|
|
16080
|
+
}
|
|
16081
|
+
|
|
16082
|
+
::slotted(q)::after {
|
|
16083
|
+
content: close-quote;
|
|
16084
|
+
}
|
|
16085
|
+
|
|
15850
16086
|
::slotted(mark) {
|
|
15851
16087
|
border-radius: var(--_text-mark-corner-radius);
|
|
15852
16088
|
background-color: var(--_text-mark-background-color);
|
|
@@ -15946,7 +16182,7 @@ function template$11() {
|
|
|
15946
16182
|
* @attr {string} color - Text color: 'content' (the default) | 'secondary' | 'accent' | 'success' | 'warning' | 'critical' | 'inherit'. 'content' and 'secondary' follow the surrounding content channel; 'inherit' takes the color it inherits, for text on a painted surface.
|
|
15947
16183
|
* @attr {string} horizontal-alignment - Alignment of the text within the block: 'left' | 'center' | 'right' (default: 'left'). Aligns the words; `horizontal-alignment` on nldd-container moves the box.
|
|
15948
16184
|
*
|
|
15949
|
-
* @slot - The text. Inline elements look as they do in nldd-rich-text: `<strong>` and `<b>` take the bold weight from the scale, `<em>` and `<i>` are italic, `<a>` is an underlined link, `<code>` sits on a tinted surface in the monospace font,
|
|
16185
|
+
* @slot - The text. Inline elements look as they do in nldd-rich-text: `<strong>` and `<b>` take the bold weight from the scale, `<em>` and `<i>` are italic, `<a>` is an underlined link, `<code>` sits on a tinted surface in the monospace font, `<mark>` is highlighted, `<q>` is quoted in italics, and an element with `data-mention` is a mention (`<a href="…" data-mention>` as the tinted token, `<span data-mention>` without the tint; write the name without the `@`). This holds for elements directly in the text; one inside another (a link inside `<strong>`) keeps only the outer one's styling. Components such as `nldd-tag` are left alone.
|
|
15950
16186
|
*/
|
|
15951
16187
|
var _NLDDText = class NLDDText extends LitElement {
|
|
15952
16188
|
constructor(..._args) {
|
|
@@ -16553,6 +16789,7 @@ var tokenStyles = css`
|
|
|
16553
16789
|
/* # Host */
|
|
16554
16790
|
|
|
16555
16791
|
:host {
|
|
16792
|
+
--_token-background-color: light-dark(var(--primitives-color-neutral-50), var(--primitives-color-neutral-150));
|
|
16556
16793
|
--_token-highlight-border-color: var(--semantics-buttons-neutral-tinted-highlight-border-color);
|
|
16557
16794
|
--_token-focus-z-index: 1;
|
|
16558
16795
|
|
|
@@ -16594,7 +16831,7 @@ var tokenStyles = css`
|
|
|
16594
16831
|
border: none;
|
|
16595
16832
|
border-radius: var(--semantics-controls-sm-corner-radius);
|
|
16596
16833
|
background: none;
|
|
16597
|
-
background-color: var(--
|
|
16834
|
+
background-color: var(--_token-background-color);
|
|
16598
16835
|
position: relative;
|
|
16599
16836
|
height: var(--semantics-controls-sm-min-size);
|
|
16600
16837
|
max-width: 100%;
|
|
@@ -17682,6 +17919,7 @@ var NLDDFormField = (_NLDDFormField = class NLDDFormField extends LitElement {
|
|
|
17682
17919
|
this.optional = false;
|
|
17683
17920
|
this.optionalLabel = "Optioneel";
|
|
17684
17921
|
this._childObserver = null;
|
|
17922
|
+
this._listObserver = null;
|
|
17685
17923
|
this._appliedLabel = null;
|
|
17686
17924
|
this._warnedNoInput = false;
|
|
17687
17925
|
}
|
|
@@ -17702,6 +17940,7 @@ var NLDDFormField = (_NLDDFormField = class NLDDFormField extends LitElement {
|
|
|
17702
17940
|
disconnectedCallback() {
|
|
17703
17941
|
super.disconnectedCallback();
|
|
17704
17942
|
this._childObserver?.disconnect();
|
|
17943
|
+
this._listObserver?.disconnect();
|
|
17705
17944
|
}
|
|
17706
17945
|
/**
|
|
17707
17946
|
* Called when the label is clicked — focuses the slotted input.
|
|
@@ -17818,11 +18057,13 @@ var NLDDFormField = (_NLDDFormField = class NLDDFormField extends LitElement {
|
|
|
17818
18057
|
* that is the control itself, a native input or a host with a role of its
|
|
17819
18058
|
* own, is pointed at directly.
|
|
17820
18059
|
*
|
|
17821
|
-
* The
|
|
17822
|
-
*
|
|
17823
|
-
*
|
|
17824
|
-
*
|
|
17825
|
-
*
|
|
18060
|
+
* The items of a validation list that are on screen, not the list. Safari
|
|
18061
|
+
* passes nothing on to VoiceOver for an element whose text sits in a
|
|
18062
|
+
* `role="list"`, which the list renders, so a reference to the list was an
|
|
18063
|
+
* empty description there. Only the visible items, because an element
|
|
18064
|
+
* referenced directly is read even while it is hidden: a met requirement
|
|
18065
|
+
* would still be read out. The references change when an item shows or
|
|
18066
|
+
* hides, which is when the description changes anyway.
|
|
17826
18067
|
*
|
|
17827
18068
|
* The requirements before the plain help text: what is wrong is why you are
|
|
17828
18069
|
* here.
|
|
@@ -17832,7 +18073,16 @@ var NLDDFormField = (_NLDDFormField = class NLDDFormField extends LitElement {
|
|
|
17832
18073
|
if (!input) return;
|
|
17833
18074
|
const children = Array.from(this.children);
|
|
17834
18075
|
const tag = (el) => el.tagName.toLowerCase();
|
|
17835
|
-
const
|
|
18076
|
+
const lists = children.filter((el) => tag(el) === "nldd-validation-list");
|
|
18077
|
+
this._listObserver ?? (this._listObserver = new MutationObserver(() => this._syncDescription()));
|
|
18078
|
+
this._listObserver.disconnect();
|
|
18079
|
+
for (const list of lists) this._listObserver.observe(list, {
|
|
18080
|
+
childList: true,
|
|
18081
|
+
subtree: true,
|
|
18082
|
+
attributes: true,
|
|
18083
|
+
attributeFilter: ["visible"]
|
|
18084
|
+
});
|
|
18085
|
+
const describedBy = [...lists.flatMap((list) => Array.from(list.children).filter((el) => tag(el) === "nldd-validation-item" && el.hasAttribute("visible"))), ...children.filter((el) => tag(el) === "nldd-form-field-help-text")];
|
|
17836
18086
|
if ("describedByElements" in input) input.describedByElements = describedBy;
|
|
17837
18087
|
else applyDescribedBy(input, describedBy);
|
|
17838
18088
|
}
|
|
@@ -24972,12 +25222,13 @@ var fileFieldStyles = css`
|
|
|
24972
25222
|
--_file-field-highlight-border-width: var(--semantics-surfaces-highlight-border-width);
|
|
24973
25223
|
--_file-field-highlight-border-color: var(--semantics-surfaces-tinted-highlight-border-color);
|
|
24974
25224
|
--_file-field-background-color: var(--semantics-surfaces-tinted-background-color);
|
|
24975
|
-
--_file-field-drop-border-width: var(--semantics-
|
|
24976
|
-
--_file-field-page-drag-border-color:
|
|
24977
|
-
--_file-field-drop-border-color: var(--semantics-
|
|
24978
|
-
--_file-field-drop-background-color: var(--semantics-
|
|
25225
|
+
--_file-field-drop-border-width: var(--semantics-drop-targets-border-width);
|
|
25226
|
+
--_file-field-page-drag-border-color: var(--semantics-drop-targets-is-available-border-color);
|
|
25227
|
+
--_file-field-drop-border-color: var(--semantics-drop-targets-is-over-border-color);
|
|
25228
|
+
--_file-field-drop-background-color: var(--semantics-drop-targets-is-over-background-color);
|
|
24979
25229
|
--_file-field-rejected-color: var(--semantics-content-critical-color);
|
|
24980
|
-
--_file-field-rejected-
|
|
25230
|
+
--_file-field-rejected-border-color: var(--semantics-drop-targets-is-rejected-border-color);
|
|
25231
|
+
--_file-field-rejected-background-color: var(--semantics-drop-targets-is-rejected-background-color);
|
|
24981
25232
|
--_file-field-file-icon-size: var(--primitives-space-24);
|
|
24982
25233
|
--_file-field-actions-gap: var(--primitives-space-4);
|
|
24983
25234
|
--_file-field-browse-action-color: var(--semantics-controls-is-selected-indicator-color);
|
|
@@ -24986,6 +25237,14 @@ var fileFieldStyles = css`
|
|
|
24986
25237
|
--_file-field-browse-is-hovered-background-color: light-dark(var(--primitives-color-neutral-50), var(--primitives-color-neutral-100));
|
|
24987
25238
|
--_file-field-browse-is-active-background-color: light-dark(var(--primitives-color-neutral-75), var(--primitives-color-neutral-150));
|
|
24988
25239
|
--_file-field-browse-action-font: var(--semantics-buttons-md-primary-text-font);
|
|
25240
|
+
--_file-field-area-min-height: var(--primitives-area-160);
|
|
25241
|
+
--_file-field-area-padding: var(--primitives-space-16);
|
|
25242
|
+
--_file-field-area-gap: var(--primitives-space-2);
|
|
25243
|
+
--_file-field-area-icon-size: var(--primitives-space-40);
|
|
25244
|
+
--_file-field-area-actions-padding-top: var(--primitives-space-16);
|
|
25245
|
+
--_file-field-area-actions-max-width: var(--primitives-area-320);
|
|
25246
|
+
--_file-field-accepted-types-color: var(--semantics-content-secondary-color);
|
|
25247
|
+
--_file-field-accepted-types-font: var(--primitives-font-body-sm-regular-tight);
|
|
24989
25248
|
|
|
24990
25249
|
${inheritedTextReset}
|
|
24991
25250
|
display: block;
|
|
@@ -25013,6 +25272,8 @@ var fileFieldStyles = css`
|
|
|
25013
25272
|
--_file-field-validation-icon-size: var(--semantics-input-fields-sm-validation-icon-size);
|
|
25014
25273
|
--_file-field-file-icon-size: var(--primitives-space-20);
|
|
25015
25274
|
--_file-field-browse-action-font: var(--semantics-buttons-sm-primary-text-font);
|
|
25275
|
+
--_file-field-area-icon-size: var(--primitives-space-32);
|
|
25276
|
+
--_file-field-accepted-types-font: var(--primitives-font-body-xs-regular-tight);
|
|
25016
25277
|
}
|
|
25017
25278
|
|
|
25018
25279
|
|
|
@@ -25063,7 +25324,7 @@ var fileFieldStyles = css`
|
|
|
25063
25324
|
|
|
25064
25325
|
.file-field.is-drag-rejected {
|
|
25065
25326
|
--_file-field-highlight-border-width: var(--_file-field-drop-border-width);
|
|
25066
|
-
--_file-field-highlight-border-color: var(--_file-field-rejected-color);
|
|
25327
|
+
--_file-field-highlight-border-color: var(--_file-field-rejected-border-color);
|
|
25067
25328
|
--_file-field-background-color: var(--_file-field-rejected-background-color);
|
|
25068
25329
|
}
|
|
25069
25330
|
|
|
@@ -25112,8 +25373,8 @@ var fileFieldStyles = css`
|
|
|
25112
25373
|
outline: none;
|
|
25113
25374
|
}
|
|
25114
25375
|
|
|
25115
|
-
:host([valid]) :is(.file-field__browse-button, .file-field__replace-area),
|
|
25116
|
-
:host([invalid]) :is(.file-field__browse-button, .file-field__replace-area) {
|
|
25376
|
+
:host([valid]) .file-field:not(.file-field--area) :is(.file-field__browse-button, .file-field__replace-area),
|
|
25377
|
+
:host([invalid]) .file-field:not(.file-field--area) :is(.file-field__browse-button, .file-field__replace-area) {
|
|
25117
25378
|
padding-left: calc(var(--_file-field-validation-icon-size) + var(--_file-field-validation-icon-area-padding-right));
|
|
25118
25379
|
}
|
|
25119
25380
|
|
|
@@ -25304,6 +25565,78 @@ var fileFieldStyles = css`
|
|
|
25304
25565
|
}
|
|
25305
25566
|
|
|
25306
25567
|
|
|
25568
|
+
|
|
25569
|
+
/* # Area */
|
|
25570
|
+
|
|
25571
|
+
.file-field--area {
|
|
25572
|
+
min-height: var(--_file-field-area-min-height);
|
|
25573
|
+
}
|
|
25574
|
+
|
|
25575
|
+
.file-field--area :is(.file-field__browse-button, .file-field__replace-area, .file-field__chosen-file) {
|
|
25576
|
+
padding: var(--_file-field-area-padding);
|
|
25577
|
+
flex-direction: column;
|
|
25578
|
+
gap: var(--_file-field-area-gap);
|
|
25579
|
+
align-items: center;
|
|
25580
|
+
justify-content: center;
|
|
25581
|
+
}
|
|
25582
|
+
|
|
25583
|
+
.file-field--area :is(.file-field__upload-icon, .file-field__file-icon) {
|
|
25584
|
+
flex-shrink: 0;
|
|
25585
|
+
margin: 0;
|
|
25586
|
+
width: var(--_file-field-area-icon-size);
|
|
25587
|
+
height: var(--_file-field-area-icon-size);
|
|
25588
|
+
}
|
|
25589
|
+
|
|
25590
|
+
.file-field--area .file-field__upload-icon {
|
|
25591
|
+
color: var(--_file-field-accepted-types-color);
|
|
25592
|
+
}
|
|
25593
|
+
|
|
25594
|
+
.file-field--area.is-drag-over :is(.file-field__upload-icon, .file-field__accepted-types) {
|
|
25595
|
+
color: var(--_file-field-browse-action-color);
|
|
25596
|
+
}
|
|
25597
|
+
|
|
25598
|
+
.file-field--area.is-drag-rejected :is(.file-field__upload-icon, .file-field__accepted-types) {
|
|
25599
|
+
color: var(--_file-field-rejected-color);
|
|
25600
|
+
}
|
|
25601
|
+
|
|
25602
|
+
.file-field--area :is(.file-field__sentence, .file-field__value) {
|
|
25603
|
+
padding-block: 0;
|
|
25604
|
+
width: 100%;
|
|
25605
|
+
flex-grow: 0;
|
|
25606
|
+
text-align: center;
|
|
25607
|
+
}
|
|
25608
|
+
|
|
25609
|
+
/* The surface has a fixed height and centers its content, so only the
|
|
25610
|
+
shown text takes room; a hidden one that wraps would push the rest apart. */
|
|
25611
|
+
.file-field--area .file-field__text:not(.is-active) {
|
|
25612
|
+
display: none;
|
|
25613
|
+
}
|
|
25614
|
+
|
|
25615
|
+
.file-field--area .file-field__name {
|
|
25616
|
+
justify-content: center;
|
|
25617
|
+
}
|
|
25618
|
+
|
|
25619
|
+
.file-field--area .file-field__accepted-types {
|
|
25620
|
+
color: var(--_file-field-accepted-types-color);
|
|
25621
|
+
font: var(--_file-field-accepted-types-font);
|
|
25622
|
+
}
|
|
25623
|
+
|
|
25624
|
+
.file-field--area .file-field__actions {
|
|
25625
|
+
width: 100%;
|
|
25626
|
+
max-width: var(--_file-field-area-actions-max-width);
|
|
25627
|
+
padding-top: calc(var(--_file-field-area-actions-padding-top) - var(--_file-field-area-gap));
|
|
25628
|
+
padding-right: var(--primitives-space-0);
|
|
25629
|
+
}
|
|
25630
|
+
|
|
25631
|
+
.file-field--area .file-field__validation-icon-area {
|
|
25632
|
+
position: absolute;
|
|
25633
|
+
top: var(--_file-field-area-padding);
|
|
25634
|
+
right: var(--_file-field-area-padding);
|
|
25635
|
+
height: auto;
|
|
25636
|
+
padding-right: var(--primitives-space-0);
|
|
25637
|
+
}
|
|
25638
|
+
|
|
25639
|
+
|
|
25307
25640
|
/* # High contrast */
|
|
25308
25641
|
|
|
25309
25642
|
@media (forced-colors: active) {
|
|
@@ -25473,16 +25806,18 @@ function dragVariants(component, dragText, dropText) {
|
|
|
25473
25806
|
function renderBrowse(component) {
|
|
25474
25807
|
const drags = dragVariants(component, component.multiple ? component._t("components.file-field.drag-here-multiple-text") : component._t("components.file-field.drag-here-text"), component.multiple ? component._t("components.file-field.drop-here-multiple-text") : component._t("components.file-field.drop-here-text"));
|
|
25475
25808
|
const sentence = html`<span class="file-field__browse-action">${component._chooseLabel()}</span> <span class="file-field__hint">${component.multiple ? component._t("components.file-field.drop-hint-multiple-lowercase-text") : component._t("components.file-field.drop-hint-lowercase-text")}</span>`;
|
|
25809
|
+
const area = component.variant === "area";
|
|
25810
|
+
const types = area ? component._acceptTypes() : null;
|
|
25476
25811
|
return html`
|
|
25477
25812
|
<button class="file-field__browse-button"
|
|
25478
25813
|
type="button"
|
|
25479
25814
|
aria-label=${component._chooseAccessibleLabel() || component._chooseLabel()}
|
|
25480
25815
|
?disabled=${component.disabled}
|
|
25481
25816
|
@click=${component._handleChoose}
|
|
25482
|
-
|
|
25817
|
+
>${area ? html`<nldd-icon class="file-field__upload-icon" icon="upload-to-cloud" aria-hidden="true"></nldd-icon>` : nothing}<span class="file-field__sentence">${renderStack([{
|
|
25483
25818
|
content: sentence,
|
|
25484
25819
|
active: !drags.some((variant) => variant.active)
|
|
25485
|
-
}, ...drags])}</span>${renderValidationIcon$5(component)}</button>
|
|
25820
|
+
}, ...drags])}</span>${types ? html`<span class="file-field__accepted-types">${component._t("components.file-field.accepted-types-text", { types })}</span>` : nothing}${renderValidationIcon$5(component)}</button>
|
|
25486
25821
|
`;
|
|
25487
25822
|
}
|
|
25488
25823
|
/** A name as it fits: cut in the middle once measured, before that cut by CSS
|
|
@@ -25507,6 +25842,7 @@ function renderName(component, name) {
|
|
|
25507
25842
|
*/
|
|
25508
25843
|
function renderChosen(component) {
|
|
25509
25844
|
const files = component.files;
|
|
25845
|
+
const area = component.variant === "area";
|
|
25510
25846
|
const buttonSize = component.size === "sm" ? "xs" : "sm";
|
|
25511
25847
|
const dragging = component._drag !== "none";
|
|
25512
25848
|
const refused = component._rejection;
|
|
@@ -25543,31 +25879,56 @@ function renderChosen(component) {
|
|
|
25543
25879
|
})}>
|
|
25544
25880
|
<nldd-icon class="file-field__file-icon" icon=${fileIcon(files)} aria-hidden="true"></nldd-icon>
|
|
25545
25881
|
<span class="file-field__value">${renderStack(nameVariants)}</span>
|
|
25546
|
-
|
|
25547
|
-
<
|
|
25548
|
-
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
|
|
25559
|
-
|
|
25560
|
-
|
|
25561
|
-
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
|
|
25882
|
+
${area ? html`
|
|
25883
|
+
<div class="file-field__actions">
|
|
25884
|
+
<nldd-button-group
|
|
25885
|
+
size=${component.size}
|
|
25886
|
+
width="full"
|
|
25887
|
+
>
|
|
25888
|
+
<nldd-button
|
|
25889
|
+
appearance="neutral-tinted"
|
|
25890
|
+
text=${component._t("components.file-field.to-change-action")}
|
|
25891
|
+
accessible-label=${component._changeAccessibleLabel() || nothing}
|
|
25892
|
+
?disabled=${component.disabled}
|
|
25893
|
+
@click=${component._handleChoose}
|
|
25894
|
+
></nldd-button>
|
|
25895
|
+
<nldd-button
|
|
25896
|
+
appearance="neutral-base"
|
|
25897
|
+
text=${component._t("components.file-field.clear-action")}
|
|
25898
|
+
accessible-label=${component._clearAccessibleLabel()}
|
|
25899
|
+
?disabled=${component.disabled}
|
|
25900
|
+
@click=${component._handleClear}
|
|
25901
|
+
></nldd-button>
|
|
25902
|
+
</nldd-button-group>
|
|
25903
|
+
</div>
|
|
25904
|
+
` : html`
|
|
25905
|
+
<div class="file-field__actions">
|
|
25906
|
+
<nldd-button
|
|
25907
|
+
appearance="neutral-tinted"
|
|
25908
|
+
size=${buttonSize}
|
|
25909
|
+
text=${component._t("components.file-field.to-change-action")}
|
|
25910
|
+
accessible-label=${component._changeAccessibleLabel() || nothing}
|
|
25911
|
+
?disabled=${component.disabled}
|
|
25912
|
+
@click=${component._handleChoose}
|
|
25913
|
+
></nldd-button>
|
|
25914
|
+
<nldd-icon-button
|
|
25915
|
+
appearance="neutral-transparent"
|
|
25916
|
+
size=${buttonSize}
|
|
25917
|
+
icon="dismiss"
|
|
25918
|
+
text=${component._t("components.file-field.clear-action")}
|
|
25919
|
+
accessible-label=${component._clearAccessibleLabel()}
|
|
25920
|
+
?disabled=${component.disabled}
|
|
25921
|
+
@click=${component._handleClear}
|
|
25922
|
+
></nldd-icon-button>
|
|
25923
|
+
</div>
|
|
25924
|
+
`}
|
|
25565
25925
|
${renderValidationIcon$5(component)}
|
|
25566
25926
|
</div>
|
|
25567
25927
|
<div class=${classMap({
|
|
25568
25928
|
"file-field__replace-area": true,
|
|
25569
25929
|
"is-active": dragging
|
|
25570
25930
|
})}>
|
|
25931
|
+
${area ? html`<nldd-icon class="file-field__upload-icon" icon="upload-to-cloud" aria-hidden="true"></nldd-icon>` : nothing}
|
|
25571
25932
|
<span class="file-field__sentence">${renderStack(drags)}</span>
|
|
25572
25933
|
${renderValidationIcon$5(component)}
|
|
25573
25934
|
</div>
|
|
@@ -25579,6 +25940,7 @@ function fileFieldTemplate(component) {
|
|
|
25579
25940
|
return html`
|
|
25580
25941
|
<div class=${classMap({
|
|
25581
25942
|
"file-field": true,
|
|
25943
|
+
"file-field--area": component.variant === "area",
|
|
25582
25944
|
"has-files": hasFiles,
|
|
25583
25945
|
[`is-drag-${component._drag}`]: component._drag !== "none"
|
|
25584
25946
|
})}>
|
|
@@ -25623,7 +25985,8 @@ var nlddFileFieldTranslations = {
|
|
|
25623
25985
|
"components.file-field.file-count-text": "{count} bestanden",
|
|
25624
25986
|
"components.file-field.file-chosen-text": "{name} gekozen",
|
|
25625
25987
|
"components.file-field.clear-action": "Wis selectie",
|
|
25626
|
-
"components.file-field.required-error-text": "Kies een bestand"
|
|
25988
|
+
"components.file-field.required-error-text": "Kies een bestand",
|
|
25989
|
+
"components.file-field.accepted-types-text": "Toegestaan: {types}"
|
|
25627
25990
|
};
|
|
25628
25991
|
// src/components/inputs/file-field/file-field.drop.ts
|
|
25629
25992
|
var EXTENSION_TYPES = {
|
|
@@ -25820,7 +26183,15 @@ function unwatchDrags(target) {
|
|
|
25820
26183
|
* does not support. A page that does want to show the files renders its own list
|
|
25821
26184
|
* from the `File[]` in the change event.
|
|
25822
26185
|
*
|
|
26186
|
+
* `variant="area"` lays the same field out as a tall surface, for a page where
|
|
26187
|
+
* handing in files is the main task. Empty, it shows an upload icon, the
|
|
26188
|
+
* sentence and the types it takes ("Toegestaan: PDF of JPG"), named from
|
|
26189
|
+
* `accept`; with a file, the icon of its format, its name and the buttons
|
|
26190
|
+
* "Wijzigen" and "Wis selectie" stacked in the middle. Both states have the same
|
|
26191
|
+
* height, so the page does not move when a file is chosen.
|
|
26192
|
+
*
|
|
25823
26193
|
* @element nldd-file-field
|
|
26194
|
+
* @attr {string} variant - 'control' (default): a row the height of a field. 'area': a tall surface with the upload icon and the accepted types when empty, and the file icon, name and buttons stacked once chosen; both states keep the same height
|
|
25824
26195
|
* @attr {string} size - Field size: 'md' (default) | 'sm'. Set automatically by nldd-form-field.
|
|
25825
26196
|
* @attr {string} accept - Comma-separated list of accepted file types, forwarded to the input (e.g. ".pdf,image/*")
|
|
25826
26197
|
* @attr {boolean} multiple - Allows choosing more than one file
|
|
@@ -25849,6 +26220,7 @@ var FAMILY_KEYS = {
|
|
|
25849
26220
|
var NLDDFileField = (_NLDDFileField = class NLDDFileField extends DescribedBy(FormAssociated(LitElement)) {
|
|
25850
26221
|
constructor(..._args) {
|
|
25851
26222
|
super(..._args);
|
|
26223
|
+
this.variant = "control";
|
|
25852
26224
|
this.size = "md";
|
|
25853
26225
|
this.accept = "";
|
|
25854
26226
|
this.multiple = false;
|
|
@@ -25944,17 +26316,23 @@ var NLDDFileField = (_NLDDFileField = class NLDDFileField extends DescribedBy(Fo
|
|
|
25944
26316
|
_clearAccessibleLabel() {
|
|
25945
26317
|
return `${this._t("components.file-field.clear-action")}, ${this._valueLabel()}`;
|
|
25946
26318
|
}
|
|
25947
|
-
/** @internal
|
|
25948
|
-
|
|
25949
|
-
|
|
25950
|
-
if (reason === "folder") return this.multiple ? this._t("components.file-field.folder-multiple-error-text") : this._t("components.file-field.folder-error-text");
|
|
26319
|
+
/** @internal The types `accept` takes, named for a person ("PDF of JPG"), or
|
|
26320
|
+
* null when a type in it has no name. */
|
|
26321
|
+
_acceptTypes() {
|
|
25951
26322
|
const names = acceptNames(this.accept);
|
|
25952
|
-
if (!names) return
|
|
26323
|
+
if (!names) return null;
|
|
25953
26324
|
const named = names.map((name) => typeof name === "string" ? name : this._t(FAMILY_KEYS[name.family]));
|
|
25954
|
-
|
|
26325
|
+
return named.length === 1 ? named[0] : this._t("components.file-field.list-lowercase-text", {
|
|
25955
26326
|
items: named.slice(0, -1).join(", "),
|
|
25956
26327
|
last: named[named.length - 1]
|
|
25957
26328
|
});
|
|
26329
|
+
}
|
|
26330
|
+
/** @internal */
|
|
26331
|
+
_rejectionText(reason) {
|
|
26332
|
+
if (reason === "count") return this._t("components.file-field.too-many-files-error-text");
|
|
26333
|
+
if (reason === "folder") return this.multiple ? this._t("components.file-field.folder-multiple-error-text") : this._t("components.file-field.folder-error-text");
|
|
26334
|
+
const types = this._acceptTypes();
|
|
26335
|
+
if (!types) return this._t("components.file-field.wrong-file-type-error-text");
|
|
25958
26336
|
return this.multiple ? this._t("components.file-field.files-type-error-text", { types }) : this._t("components.file-field.file-type-error-text", { types });
|
|
25959
26337
|
}
|
|
25960
26338
|
/** @internal */
|
|
@@ -25987,7 +26365,7 @@ var NLDDFileField = (_NLDDFileField = class NLDDFileField extends DescribedBy(Fo
|
|
|
25987
26365
|
this.removeEventListener("keydown", this._handleKeydown);
|
|
25988
26366
|
}
|
|
25989
26367
|
updated(changed) {
|
|
25990
|
-
if (changed.has("_files") || changed.has("size") || changed.has("_drag")) this._fitNameAfterRender();
|
|
26368
|
+
if (changed.has("_files") || changed.has("size") || changed.has("variant") || changed.has("_drag")) this._fitNameAfterRender();
|
|
25991
26369
|
}
|
|
25992
26370
|
/** Measures once the buttons beside the name have rendered and taken their
|
|
25993
26371
|
* width, and after this update rather than in it, where a state change
|
|
@@ -26133,6 +26511,10 @@ var NLDDFileField = (_NLDDFileField = class NLDDFileField extends DescribedBy(Fo
|
|
|
26133
26511
|
return fileFieldTemplate(this);
|
|
26134
26512
|
}
|
|
26135
26513
|
}, _NLDDFileField.styles = fileFieldStyles, _NLDDFileField.isFormInput = true, _NLDDFileField);
|
|
26514
|
+
__decorate([property({
|
|
26515
|
+
reflect: true,
|
|
26516
|
+
converter: reflectNonDefault("control")
|
|
26517
|
+
})], NLDDFileField.prototype, "variant", void 0);
|
|
26136
26518
|
__decorate([property({
|
|
26137
26519
|
reflect: true,
|
|
26138
26520
|
converter: reflectNonDefault("md")
|
|
@@ -42044,6 +42426,844 @@ __decorate([state()], NLDDTokenField.prototype, "_isOpen", void 0);
|
|
|
42044
42426
|
__decorate([state()], NLDDTokenField.prototype, "_highlightedId", void 0);
|
|
42045
42427
|
__decorate([state()], NLDDTokenField.prototype, "_rovingIndex", void 0);
|
|
42046
42428
|
NLDDTokenField = _NLDDTokenField = __decorate([customElement("nldd-token-field")], NLDDTokenField);
|
|
42429
|
+
// src/components/inputs/slider/slider.i18n.ts
|
|
42430
|
+
var nlddSliderTranslations = {
|
|
42431
|
+
"components.slider.start-value-label": "Minimum",
|
|
42432
|
+
"components.slider.end-value-label": "Maximum"
|
|
42433
|
+
};
|
|
42434
|
+
// src/components/inputs/slider/slider.styles.ts
|
|
42435
|
+
var sliderStyles = css`
|
|
42436
|
+
|
|
42437
|
+
|
|
42438
|
+
/* # Host */
|
|
42439
|
+
|
|
42440
|
+
:host {
|
|
42441
|
+
--_slider-gap: var(--primitives-space-8);
|
|
42442
|
+
--_slider-icon-size: var(--primitives-space-28);
|
|
42443
|
+
--_slider-icon-color: var(--semantics-content-color);
|
|
42444
|
+
--_slider-control-height: var(--semantics-controls-md-min-size);
|
|
42445
|
+
--_slider-start: 0;
|
|
42446
|
+
--_slider-end: 0;
|
|
42447
|
+
--_slider-track-height: var(--primitives-space-8);
|
|
42448
|
+
--_slider-track-color: light-dark(var(--primitives-color-neutral-50), var(--primitives-color-neutral-150));
|
|
42449
|
+
--_slider-track-border-color: light-dark(var(--primitives-color-neutral-100), var(--primitives-color-neutral-200));
|
|
42450
|
+
--_slider-track-border-width: var(--primitives-border-width-thin);
|
|
42451
|
+
--_slider-fill-color: var(--context-selected-indicator-color, var(--semantics-controls-is-selected-indicator-color));
|
|
42452
|
+
--_slider-fill-highlight-border-color: var(--semantics-controls-is-selected-indicator-highlight-border-color);
|
|
42453
|
+
--_slider-thumb-size: var(--primitives-space-28);
|
|
42454
|
+
--_slider-thumb-hit-size: var(--_slider-control-height);
|
|
42455
|
+
--_slider-thumb-inset: calc((var(--_slider-thumb-hit-size) - var(--_slider-thumb-size)) / 2);
|
|
42456
|
+
--_slider-thumb-background-color: var(--semantics-surfaces-base-background-color);
|
|
42457
|
+
--_slider-thumb-border-width: var(--primitives-border-width-regular);
|
|
42458
|
+
--_slider-thumb-border-color: light-dark(var(--primitives-color-neutral-550), var(--primitives-color-neutral-650));
|
|
42459
|
+
--_slider-thumb-ring-thickness: var(--semantics-surfaces-ring-thickness);
|
|
42460
|
+
--_slider-thumb-ring-color: var(--context-parent-background-color, var(--semantics-surfaces-base-background-color));
|
|
42461
|
+
--_slider-thumb-ring-extent: calc(var(--_slider-thumb-size) / 2);
|
|
42462
|
+
--_slider-thumb-is-hovered-border-color: light-dark(var(--primitives-color-neutral-650), var(--primitives-color-neutral-750));
|
|
42463
|
+
--_slider-thumb-is-active-border-color: light-dark(var(--primitives-color-neutral-750), var(--primitives-color-neutral-850));
|
|
42464
|
+
--_slider-histogram-height: var(--primitives-space-48);
|
|
42465
|
+
--_slider-histogram-gap: var(--primitives-space-1);
|
|
42466
|
+
--_slider-histogram-color: light-dark(var(--primitives-color-neutral-150), var(--primitives-color-neutral-300));
|
|
42467
|
+
--_slider-histogram-selected-color: color-mix(in oklab, var(--_slider-fill-color) 40%, transparent);
|
|
42468
|
+
--_slider-histogram-bar-corner-radius: var(--primitives-space-2);
|
|
42469
|
+
--_slider-histogram-bar-height: 0;
|
|
42470
|
+
--_slider-tooltip-offset: var(--primitives-space-8);
|
|
42471
|
+
--_slider-tooltip-shift: 0px;
|
|
42472
|
+
--_slider-tooltip-background-color: var(--semantics-tooltips-background-color);
|
|
42473
|
+
--_slider-tooltip-content-color: var(--semantics-tooltips-content-color);
|
|
42474
|
+
--_slider-tooltip-box-shadow: var(--semantics-tooltips-box-shadow);
|
|
42475
|
+
--_slider-tooltip-corner-radius: var(--semantics-tooltips-corner-radius);
|
|
42476
|
+
--_slider-tooltip-padding-block: var(--semantics-tooltips-padding-block);
|
|
42477
|
+
--_slider-tooltip-padding-inline: var(--semantics-tooltips-padding-inline);
|
|
42478
|
+
--_slider-tooltip-font: var(--semantics-tooltips-font);
|
|
42479
|
+
--_slider-tooltip-transition-duration: var(--primitives-transition-duration-fast);
|
|
42480
|
+
|
|
42481
|
+
${inheritedTextReset}
|
|
42482
|
+
box-sizing: border-box;
|
|
42483
|
+
display: block;
|
|
42484
|
+
width: 100%;
|
|
42485
|
+
-webkit-tap-highlight-color: transparent;
|
|
42486
|
+
}
|
|
42487
|
+
|
|
42488
|
+
:host([size="sm"]) {
|
|
42489
|
+
--_slider-icon-size: var(--primitives-space-24);
|
|
42490
|
+
--_slider-control-height: var(--semantics-controls-sm-min-size);
|
|
42491
|
+
--_slider-track-height: var(--primitives-space-6);
|
|
42492
|
+
--_slider-thumb-size: var(--primitives-space-24);
|
|
42493
|
+
--_slider-histogram-height: var(--primitives-space-32);
|
|
42494
|
+
}
|
|
42495
|
+
|
|
42496
|
+
:host([size="xs"]) {
|
|
42497
|
+
--_slider-gap: var(--primitives-space-4);
|
|
42498
|
+
--_slider-icon-size: var(--primitives-space-20);
|
|
42499
|
+
--_slider-control-height: var(--semantics-controls-xs-min-size);
|
|
42500
|
+
--_slider-track-height: var(--primitives-space-4);
|
|
42501
|
+
--_slider-thumb-size: var(--primitives-space-20);
|
|
42502
|
+
--_slider-histogram-height: var(--primitives-space-24);
|
|
42503
|
+
}
|
|
42504
|
+
|
|
42505
|
+
:host([hidden]) {
|
|
42506
|
+
display: none;
|
|
42507
|
+
}
|
|
42508
|
+
|
|
42509
|
+
:host([disabled]) {
|
|
42510
|
+
opacity: var(--primitives-opacity-disabled);
|
|
42511
|
+
pointer-events: none;
|
|
42512
|
+
}
|
|
42513
|
+
|
|
42514
|
+
|
|
42515
|
+
/* # Block */
|
|
42516
|
+
|
|
42517
|
+
.slider {
|
|
42518
|
+
display: flex;
|
|
42519
|
+
width: 100%;
|
|
42520
|
+
gap: var(--_slider-gap);
|
|
42521
|
+
align-items: center;
|
|
42522
|
+
}
|
|
42523
|
+
|
|
42524
|
+
.slider__start-icon,
|
|
42525
|
+
.slider__end-icon {
|
|
42526
|
+
display: flex;
|
|
42527
|
+
flex-shrink: 0;
|
|
42528
|
+
width: var(--_slider-icon-size);
|
|
42529
|
+
height: var(--_slider-icon-size);
|
|
42530
|
+
color: var(--_slider-icon-color);
|
|
42531
|
+
}
|
|
42532
|
+
|
|
42533
|
+
|
|
42534
|
+
/* # Control */
|
|
42535
|
+
|
|
42536
|
+
.slider__control {
|
|
42537
|
+
position: relative;
|
|
42538
|
+
min-width: 0;
|
|
42539
|
+
height: var(--_slider-control-height);
|
|
42540
|
+
flex-grow: 1;
|
|
42541
|
+
touch-action: pan-y;
|
|
42542
|
+
}
|
|
42543
|
+
|
|
42544
|
+
.slider__track,
|
|
42545
|
+
.slider__fill {
|
|
42546
|
+
position: absolute;
|
|
42547
|
+
top: 50%;
|
|
42548
|
+
border-radius: var(--_slider-track-height);
|
|
42549
|
+
pointer-events: none;
|
|
42550
|
+
height: var(--_slider-track-height);
|
|
42551
|
+
transform: translateY(-50%);
|
|
42552
|
+
}
|
|
42553
|
+
|
|
42554
|
+
.slider__track {
|
|
42555
|
+
inset-inline: 0;
|
|
42556
|
+
box-shadow: inset 0 0 0 var(--_slider-track-border-width) var(--_slider-track-border-color);
|
|
42557
|
+
background-color: var(--_slider-track-color);
|
|
42558
|
+
}
|
|
42559
|
+
|
|
42560
|
+
.slider__fill {
|
|
42561
|
+
inset-inline-start: 0;
|
|
42562
|
+
box-shadow: inset 0 0 0 var(--_slider-track-border-width) var(--_slider-fill-highlight-border-color);
|
|
42563
|
+
background-color: var(--_slider-fill-color);
|
|
42564
|
+
width: calc(var(--_slider-thumb-size) / 2 + (100% - var(--_slider-thumb-size)) * var(--_slider-end));
|
|
42565
|
+
}
|
|
42566
|
+
|
|
42567
|
+
:host([range]) .slider__fill {
|
|
42568
|
+
inset-inline-start: calc(var(--_slider-thumb-size) / 2 + (100% - var(--_slider-thumb-size)) * var(--_slider-start));
|
|
42569
|
+
width: calc((100% - var(--_slider-thumb-size)) * (var(--_slider-end) - var(--_slider-start)));
|
|
42570
|
+
}
|
|
42571
|
+
|
|
42572
|
+
|
|
42573
|
+
/* # Histogram */
|
|
42574
|
+
|
|
42575
|
+
.slider__control.has-histogram {
|
|
42576
|
+
margin-top: calc(var(--_slider-histogram-height) - (var(--_slider-control-height) - var(--_slider-track-height)) / 2);
|
|
42577
|
+
}
|
|
42578
|
+
|
|
42579
|
+
.slider__histogram {
|
|
42580
|
+
display: flex;
|
|
42581
|
+
position: absolute;
|
|
42582
|
+
bottom: 50%;
|
|
42583
|
+
inset-inline: 0;
|
|
42584
|
+
pointer-events: none;
|
|
42585
|
+
height: calc(var(--_slider-histogram-height) + var(--_slider-track-height) / 2);
|
|
42586
|
+
gap: var(--_slider-histogram-gap);
|
|
42587
|
+
align-items: flex-end;
|
|
42588
|
+
}
|
|
42589
|
+
|
|
42590
|
+
.slider__histogram-bar {
|
|
42591
|
+
border-start-start-radius: var(--_slider-histogram-bar-corner-radius);
|
|
42592
|
+
border-start-end-radius: var(--_slider-histogram-bar-corner-radius);
|
|
42593
|
+
background-color: var(--_slider-histogram-color);
|
|
42594
|
+
height: calc(var(--_slider-track-height) / 2 + var(--_slider-histogram-bar-height) * var(--_slider-histogram-height));
|
|
42595
|
+
flex-grow: 1;
|
|
42596
|
+
flex-shrink: 1;
|
|
42597
|
+
flex-basis: 0;
|
|
42598
|
+
}
|
|
42599
|
+
|
|
42600
|
+
.slider__histogram-bar.is-selected {
|
|
42601
|
+
background-color: var(--_slider-histogram-selected-color);
|
|
42602
|
+
}
|
|
42603
|
+
|
|
42604
|
+
|
|
42605
|
+
/* # Input and thumb */
|
|
42606
|
+
|
|
42607
|
+
/* The thumb is pressed on the full control height and drawn smaller inside a
|
|
42608
|
+
transparent ring, so the input runs past the edges by that ring. */
|
|
42609
|
+
.slider__input {
|
|
42610
|
+
position: absolute;
|
|
42611
|
+
inset-block: 0;
|
|
42612
|
+
inset-inline-start: calc(var(--_slider-thumb-inset) * -1);
|
|
42613
|
+
margin: 0;
|
|
42614
|
+
outline: none;
|
|
42615
|
+
background: transparent;
|
|
42616
|
+
cursor: default;
|
|
42617
|
+
width: calc(100% + var(--_slider-thumb-inset) * 2);
|
|
42618
|
+
height: 100%;
|
|
42619
|
+
padding: 0;
|
|
42620
|
+
appearance: none;
|
|
42621
|
+
}
|
|
42622
|
+
|
|
42623
|
+
/* In a range only the thumbs take a press; the track goes to the control,
|
|
42624
|
+
which moves the nearer thumb. */
|
|
42625
|
+
:host([range]) .slider__input {
|
|
42626
|
+
pointer-events: none;
|
|
42627
|
+
}
|
|
42628
|
+
|
|
42629
|
+
.slider__input--end {
|
|
42630
|
+
z-index: 1;
|
|
42631
|
+
}
|
|
42632
|
+
|
|
42633
|
+
.slider__control.is-start-on-top .slider__input--start {
|
|
42634
|
+
z-index: 2;
|
|
42635
|
+
}
|
|
42636
|
+
|
|
42637
|
+
.slider__control.is-stacked .slider__input::-webkit-slider-thumb {
|
|
42638
|
+
pointer-events: none;
|
|
42639
|
+
}
|
|
42640
|
+
|
|
42641
|
+
.slider__control.is-stacked .slider__input::-moz-range-thumb {
|
|
42642
|
+
pointer-events: none;
|
|
42643
|
+
}
|
|
42644
|
+
|
|
42645
|
+
.slider__input::-webkit-slider-runnable-track {
|
|
42646
|
+
border: none;
|
|
42647
|
+
background: transparent;
|
|
42648
|
+
height: 100%;
|
|
42649
|
+
}
|
|
42650
|
+
|
|
42651
|
+
.slider__input::-moz-range-track {
|
|
42652
|
+
border: none;
|
|
42653
|
+
background: transparent;
|
|
42654
|
+
height: 100%;
|
|
42655
|
+
}
|
|
42656
|
+
|
|
42657
|
+
/* The ring is a gradient in the transparent border, not a second inset
|
|
42658
|
+
shadow: two with one outer edge let the lower bleed through the edge. */
|
|
42659
|
+
.slider__input::-webkit-slider-thumb {
|
|
42660
|
+
box-sizing: border-box;
|
|
42661
|
+
margin-top: calc((var(--_slider-control-height) - var(--_slider-thumb-hit-size)) / 2);
|
|
42662
|
+
border: calc(var(--_slider-thumb-inset) + var(--_slider-thumb-ring-thickness)) solid transparent;
|
|
42663
|
+
border-radius: 50%;
|
|
42664
|
+
box-shadow: inset 0 0 0 var(--_slider-thumb-border-width) var(--_slider-thumb-border-color);
|
|
42665
|
+
background:
|
|
42666
|
+
linear-gradient(var(--_slider-thumb-background-color), var(--_slider-thumb-background-color)) padding-box,
|
|
42667
|
+
radial-gradient(circle closest-side, var(--_slider-thumb-ring-color) calc(var(--_slider-thumb-ring-extent) - 0.25px), transparent calc(var(--_slider-thumb-ring-extent) + 0.25px)) border-box;
|
|
42668
|
+
pointer-events: auto;
|
|
42669
|
+
width: var(--_slider-thumb-hit-size);
|
|
42670
|
+
height: var(--_slider-thumb-hit-size);
|
|
42671
|
+
appearance: none;
|
|
42672
|
+
}
|
|
42673
|
+
|
|
42674
|
+
.slider__input::-moz-range-thumb {
|
|
42675
|
+
box-sizing: border-box;
|
|
42676
|
+
border: calc(var(--_slider-thumb-inset) + var(--_slider-thumb-ring-thickness)) solid transparent;
|
|
42677
|
+
border-radius: 50%;
|
|
42678
|
+
box-shadow: inset 0 0 0 var(--_slider-thumb-border-width) var(--_slider-thumb-border-color);
|
|
42679
|
+
background:
|
|
42680
|
+
linear-gradient(var(--_slider-thumb-background-color), var(--_slider-thumb-background-color)) padding-box,
|
|
42681
|
+
radial-gradient(circle closest-side, var(--_slider-thumb-ring-color) calc(var(--_slider-thumb-ring-extent) - 0.25px), transparent calc(var(--_slider-thumb-ring-extent) + 0.25px)) border-box;
|
|
42682
|
+
pointer-events: auto;
|
|
42683
|
+
width: var(--_slider-thumb-hit-size);
|
|
42684
|
+
height: var(--_slider-thumb-hit-size);
|
|
42685
|
+
}
|
|
42686
|
+
|
|
42687
|
+
@media (hover: hover) {
|
|
42688
|
+
.slider__input::-webkit-slider-thumb:hover {
|
|
42689
|
+
--_slider-thumb-border-color: var(--_slider-thumb-is-hovered-border-color);
|
|
42690
|
+
}
|
|
42691
|
+
|
|
42692
|
+
.slider__input::-moz-range-thumb:hover {
|
|
42693
|
+
--_slider-thumb-border-color: var(--_slider-thumb-is-hovered-border-color);
|
|
42694
|
+
}
|
|
42695
|
+
}
|
|
42696
|
+
|
|
42697
|
+
.slider__input:active::-webkit-slider-thumb {
|
|
42698
|
+
--_slider-thumb-border-color: var(--_slider-thumb-is-active-border-color);
|
|
42699
|
+
}
|
|
42700
|
+
|
|
42701
|
+
.slider__input:active::-moz-range-thumb {
|
|
42702
|
+
--_slider-thumb-border-color: var(--_slider-thumb-is-active-border-color);
|
|
42703
|
+
}
|
|
42704
|
+
|
|
42705
|
+
.slider__input:focus-visible::-webkit-slider-thumb {
|
|
42706
|
+
--_slider-thumb-ring-extent: calc(var(--_slider-thumb-size) / 2 + var(--primitives-border-width-regular) + var(--_slider-thumb-ring-thickness));
|
|
42707
|
+
outline: var(--semantics-focus-ring-outline);
|
|
42708
|
+
outline-offset: calc(var(--_slider-thumb-inset) * -1);
|
|
42709
|
+
box-shadow:
|
|
42710
|
+
inset 0 0 0 var(--_slider-thumb-border-width) var(--_slider-thumb-border-color),
|
|
42711
|
+
0 0 0 max(0px, calc(var(--_slider-thumb-ring-extent) - var(--_slider-thumb-hit-size) / 2)) var(--_slider-thumb-ring-color);
|
|
42712
|
+
}
|
|
42713
|
+
|
|
42714
|
+
.slider__input:focus-visible::-moz-range-thumb {
|
|
42715
|
+
--_slider-thumb-ring-extent: calc(var(--_slider-thumb-size) / 2 + var(--primitives-border-width-regular) + var(--_slider-thumb-ring-thickness));
|
|
42716
|
+
outline: var(--semantics-focus-ring-outline);
|
|
42717
|
+
outline-offset: calc(var(--_slider-thumb-inset) * -1);
|
|
42718
|
+
box-shadow:
|
|
42719
|
+
inset 0 0 0 var(--_slider-thumb-border-width) var(--_slider-thumb-border-color),
|
|
42720
|
+
0 0 0 max(0px, calc(var(--_slider-thumb-ring-extent) - var(--_slider-thumb-hit-size) / 2)) var(--_slider-thumb-ring-color);
|
|
42721
|
+
}
|
|
42722
|
+
|
|
42723
|
+
|
|
42724
|
+
/* # Tooltip */
|
|
42725
|
+
|
|
42726
|
+
.slider__tooltip {
|
|
42727
|
+
box-sizing: border-box;
|
|
42728
|
+
position: absolute;
|
|
42729
|
+
z-index: 3;
|
|
42730
|
+
bottom: calc(100% + var(--_slider-tooltip-offset));
|
|
42731
|
+
inset-inline-start: calc(var(--_slider-thumb-size) / 2 + (100% - var(--_slider-thumb-size)) * var(--_slider-end));
|
|
42732
|
+
visibility: hidden;
|
|
42733
|
+
opacity: 0;
|
|
42734
|
+
border-radius: var(--_slider-tooltip-corner-radius);
|
|
42735
|
+
box-shadow: var(--_slider-tooltip-box-shadow);
|
|
42736
|
+
background-color: var(--_slider-tooltip-background-color);
|
|
42737
|
+
pointer-events: none;
|
|
42738
|
+
width: max-content;
|
|
42739
|
+
padding-block: var(--_slider-tooltip-padding-block);
|
|
42740
|
+
padding-inline: var(--_slider-tooltip-padding-inline);
|
|
42741
|
+
color: var(--_slider-tooltip-content-color);
|
|
42742
|
+
font: var(--_slider-tooltip-font);
|
|
42743
|
+
white-space: nowrap;
|
|
42744
|
+
transition: opacity var(--_slider-tooltip-transition-duration), visibility var(--_slider-tooltip-transition-duration);
|
|
42745
|
+
transform: translateX(calc(-50% + var(--_slider-tooltip-shift)));
|
|
42746
|
+
}
|
|
42747
|
+
|
|
42748
|
+
:host(:dir(rtl)) .slider__tooltip {
|
|
42749
|
+
transform: translateX(calc(50% + var(--_slider-tooltip-shift)));
|
|
42750
|
+
}
|
|
42751
|
+
|
|
42752
|
+
.slider__control.has-histogram .slider__tooltip {
|
|
42753
|
+
bottom: calc(50% + var(--_slider-track-height) / 2 + var(--_slider-histogram-height) + var(--_slider-tooltip-offset));
|
|
42754
|
+
}
|
|
42755
|
+
|
|
42756
|
+
.slider__tooltip--start {
|
|
42757
|
+
inset-inline-start: calc(var(--_slider-thumb-size) / 2 + (100% - var(--_slider-thumb-size)) * var(--_slider-start));
|
|
42758
|
+
}
|
|
42759
|
+
|
|
42760
|
+
.slider__tooltip--both {
|
|
42761
|
+
inset-inline-start: calc(var(--_slider-thumb-size) / 2 + (100% - var(--_slider-thumb-size)) * (var(--_slider-start) + var(--_slider-end)) / 2);
|
|
42762
|
+
}
|
|
42763
|
+
|
|
42764
|
+
/* Shown while the pointer is over the slider, a thumb has keyboard focus or
|
|
42765
|
+
is dragged: each thumb its own, or the two of a range as one where they
|
|
42766
|
+
would overlap. */
|
|
42767
|
+
.slider:not(.is-merged) .slider__control:is(:hover, .is-active, :has(.slider__input:focus-visible)) :is(.slider__tooltip--value, .slider__tooltip--start, .slider__tooltip--end),
|
|
42768
|
+
.slider.is-merged .slider__control:is(:hover, .is-active, :has(.slider__input:focus-visible)) .slider__tooltip--both {
|
|
42769
|
+
visibility: visible;
|
|
42770
|
+
opacity: 1;
|
|
42771
|
+
}
|
|
42772
|
+
|
|
42773
|
+
@media (prefers-reduced-motion: reduce) {
|
|
42774
|
+
.slider__tooltip {
|
|
42775
|
+
transition: none;
|
|
42776
|
+
}
|
|
42777
|
+
}
|
|
42778
|
+
|
|
42779
|
+
|
|
42780
|
+
/* # High contrast */
|
|
42781
|
+
|
|
42782
|
+
@media (forced-colors: active) {
|
|
42783
|
+
.slider__track {
|
|
42784
|
+
background-color: GrayText;
|
|
42785
|
+
}
|
|
42786
|
+
|
|
42787
|
+
.slider__fill {
|
|
42788
|
+
background-color: Highlight;
|
|
42789
|
+
}
|
|
42790
|
+
}
|
|
42791
|
+
`;
|
|
42792
|
+
// src/components/inputs/slider/slider.template.ts
|
|
42793
|
+
function thumbInput(component, thumb, value) {
|
|
42794
|
+
return html`
|
|
42795
|
+
<input class="slider__input slider__input--${thumb}"
|
|
42796
|
+
type="range"
|
|
42797
|
+
min=${component.min}
|
|
42798
|
+
max=${component.max}
|
|
42799
|
+
step=${component.step}
|
|
42800
|
+
.value=${String(value)}
|
|
42801
|
+
aria-label=${component._label(thumb) ?? nothing}
|
|
42802
|
+
aria-valuetext=${component._format(value)}
|
|
42803
|
+
aria-invalid=${component.invalid ? "true" : nothing}
|
|
42804
|
+
?disabled=${component.disabled}
|
|
42805
|
+
@input=${(event) => component._handleInput(event, thumb)}
|
|
42806
|
+
@change=${component._handleChange}
|
|
42807
|
+
>
|
|
42808
|
+
`;
|
|
42809
|
+
}
|
|
42810
|
+
function tooltip(thumb, text) {
|
|
42811
|
+
return html`
|
|
42812
|
+
<span class="slider__tooltip slider__tooltip--${thumb}"
|
|
42813
|
+
aria-hidden="true"
|
|
42814
|
+
>
|
|
42815
|
+
${text}
|
|
42816
|
+
</span>
|
|
42817
|
+
`;
|
|
42818
|
+
}
|
|
42819
|
+
/** Bars of equal width over the track; a bar whose middle lies within the
|
|
42820
|
+
* chosen value or range is colored. */
|
|
42821
|
+
function histogram(component, start, end) {
|
|
42822
|
+
const counts = component.histogram;
|
|
42823
|
+
const highest = Math.max(...counts, 1);
|
|
42824
|
+
const from = component._fraction(start);
|
|
42825
|
+
const to = component._fraction(end);
|
|
42826
|
+
return html`
|
|
42827
|
+
<span class="slider__histogram"
|
|
42828
|
+
aria-hidden="true"
|
|
42829
|
+
>
|
|
42830
|
+
${counts.map((count, index) => {
|
|
42831
|
+
const place = (index + .5) / counts.length;
|
|
42832
|
+
return html`
|
|
42833
|
+
<span class=${classMap({
|
|
42834
|
+
"slider__histogram-bar": true,
|
|
42835
|
+
"is-selected": place >= from - 1e-9 && place <= to + 1e-9
|
|
42836
|
+
})}
|
|
42837
|
+
style=${styleMap({ "--_slider-histogram-bar-height": String(count / highest) })}
|
|
42838
|
+
></span>
|
|
42839
|
+
`;
|
|
42840
|
+
})}
|
|
42841
|
+
</span>
|
|
42842
|
+
`;
|
|
42843
|
+
}
|
|
42844
|
+
function sliderTemplate(component) {
|
|
42845
|
+
const range = component.range;
|
|
42846
|
+
const start = range ? component._start : component.min;
|
|
42847
|
+
const end = range ? component._end : component._value;
|
|
42848
|
+
const startOnTop = range && start === end && start > (component.min + component.max) / 2;
|
|
42849
|
+
const tooltips = component.tooltipTiming !== "never";
|
|
42850
|
+
return html`
|
|
42851
|
+
<div class="slider">
|
|
42852
|
+
${component.startIcon ? html`
|
|
42853
|
+
<span class="slider__start-icon">
|
|
42854
|
+
<nldd-icon icon=${component.startIcon}></nldd-icon>
|
|
42855
|
+
</span>
|
|
42856
|
+
` : nothing}
|
|
42857
|
+
<div class=${classMap({
|
|
42858
|
+
"slider__control": true,
|
|
42859
|
+
"has-histogram": component.histogram.length > 0,
|
|
42860
|
+
"is-active": component._active,
|
|
42861
|
+
"is-start-on-top": startOnTop,
|
|
42862
|
+
"is-stacked": range && start === end
|
|
42863
|
+
})}
|
|
42864
|
+
style=${styleMap({
|
|
42865
|
+
"--_slider-start": String(component._fraction(start)),
|
|
42866
|
+
"--_slider-end": String(component._fraction(end))
|
|
42867
|
+
})}
|
|
42868
|
+
@pointerdown=${component._handlePointerDown}
|
|
42869
|
+
>
|
|
42870
|
+
${component.histogram.length ? histogram(component, start, end) : nothing}
|
|
42871
|
+
<span class="slider__track"></span>
|
|
42872
|
+
<span class="slider__fill"></span>
|
|
42873
|
+
${range ? html`
|
|
42874
|
+
${thumbInput(component, "start", start)}
|
|
42875
|
+
${thumbInput(component, "end", end)}
|
|
42876
|
+
${tooltips ? html`
|
|
42877
|
+
${tooltip("start", component._format(start))}
|
|
42878
|
+
${tooltip("end", component._format(end))}
|
|
42879
|
+
${tooltip("both", `${component._format(start)} – ${component._format(end)}`)}
|
|
42880
|
+
` : nothing}
|
|
42881
|
+
` : html`
|
|
42882
|
+
${thumbInput(component, "value", end)}
|
|
42883
|
+
${tooltips ? tooltip("value", component._format(end)) : nothing}
|
|
42884
|
+
`}
|
|
42885
|
+
</div>
|
|
42886
|
+
${component.endIcon ? html`
|
|
42887
|
+
<span class="slider__end-icon">
|
|
42888
|
+
<nldd-icon icon=${component.endIcon}></nldd-icon>
|
|
42889
|
+
</span>
|
|
42890
|
+
` : nothing}
|
|
42891
|
+
</div>
|
|
42892
|
+
`;
|
|
42893
|
+
}
|
|
42894
|
+
// src/components/inputs/slider/slider.ts
|
|
42895
|
+
/**
|
|
42896
|
+
* Nederlandse Digitale Dienst Slider Component (Lit + TypeScript)
|
|
42897
|
+
*
|
|
42898
|
+
* A value picked along a track, by dragging its thumb, pressing the track or
|
|
42899
|
+
* with the arrow keys. With `range` it picks a range instead, with a thumb for
|
|
42900
|
+
* each end. The names follow Apple's: the track, the thumb, and the minimum
|
|
42901
|
+
* track, the part filled up to the thumb, or between the thumbs of a range.
|
|
42902
|
+
*
|
|
42903
|
+
* A slider is for a value that may be roughly right, such as a filter ("a
|
|
42904
|
+
* price between …"). For a value that has to be exact, an `nldd-number-field`
|
|
42905
|
+
* is easier: a thumb is hard to put on one number, the more so with a hand
|
|
42906
|
+
* that is not steady.
|
|
42907
|
+
*
|
|
42908
|
+
* It is built on native range inputs, so the keyboard (arrows, Page Up and
|
|
42909
|
+
* Page Down, Home and End), touch, the form and a screen reader work as they do
|
|
42910
|
+
* for any slider. A range is two of them over each other, each with its own
|
|
42911
|
+
* name for a screen reader ("Prijs, minimum"), and a press on the track moves
|
|
42912
|
+
* the nearer thumb there. The thumbs do not pass each other; where they lie
|
|
42913
|
+
* on one value, the first move picks one, to the left the start one.
|
|
42914
|
+
*
|
|
42915
|
+
* The value shows in a tooltip above the thumb while the pointer is over the
|
|
42916
|
+
* slider, while a thumb has keyboard focus and while it is dragged; with
|
|
42917
|
+
* `tooltip-timing="never"` it does not, for a slider whose value already shows
|
|
42918
|
+
* elsewhere. Where the
|
|
42919
|
+
* two tooltips of a range would overlap, they show as one ("200 – 1.200").
|
|
42920
|
+
* `formatValue` turns a number into the text of the tooltip and of what a
|
|
42921
|
+
* screen reader hears, such as `(value) => \`€ ${value}\``; without it the
|
|
42922
|
+
* number is written the Dutch way.
|
|
42923
|
+
*
|
|
42924
|
+
* `histogram` draws counts as bars above the track, such as how many results
|
|
42925
|
+
* there are at each price, so the range can be chosen with the spread in view.
|
|
42926
|
+
* Give one count per bucket: n counts split min to max into n equal buckets of
|
|
42927
|
+
* (max - min) / n, the first count for the first bucket. Only the proportions
|
|
42928
|
+
* matter (the highest count is the full height), a 0 is an empty bucket, and
|
|
42929
|
+
* 20 to 40 buckets read best, whatever the `step`. A bar whose middle lies
|
|
42930
|
+
* within the chosen value or range is colored. The bars are decoration for a
|
|
42931
|
+
* screen reader: say what they show in the text around it.
|
|
42932
|
+
*
|
|
42933
|
+
* In a form a slider submits its value under `name`; a range submits both ends
|
|
42934
|
+
* under it, the start first.
|
|
42935
|
+
*
|
|
42936
|
+
* @element nldd-slider
|
|
42937
|
+
* @attr {string} size - Slider size: 'xs' | 'sm' | 'md' (default: 'md'), with the height of the other controls of that size. Set automatically by nldd-form-field.
|
|
42938
|
+
* @attr {boolean} range - Picks a range, with a thumb for each end: `start-value` and `end-value` in place of `value`
|
|
42939
|
+
* @attr {string} histogram - Counts drawn as bars above the track, one per bucket of (max - min) / n, comma- or space-separated; as a property, an array of numbers. The bars within the chosen value or range are colored.
|
|
42940
|
+
* @attr {string} start-icon - Icon at the start of the track, such as a quiet speaker for a volume
|
|
42941
|
+
* @attr {string} end-icon - Icon at the end of the track
|
|
42942
|
+
* @attr {string} accessible-label - Accessible name; a range adds "minimum" and "maximum" to it for its thumbs. Set automatically by nldd-form-field.
|
|
42943
|
+
* @attr {string} tooltip-timing - When the value shows above the thumb: 'instant' (the default: on hover, keyboard focus and while dragging) or 'never', for a slider whose value shows elsewhere, such as in fields above it
|
|
42944
|
+
* @attr {boolean} invalid - Marks the control as invalid. Announced with aria-invalid; nothing is drawn for it.
|
|
42945
|
+
* @attr {boolean} disabled - Disabled state
|
|
42946
|
+
* @attr {string} name - Name for form submission
|
|
42947
|
+
* @attr {number} value - The value (default: the middle between min and max)
|
|
42948
|
+
* @attr {number} start-value - The start of a range (default: min)
|
|
42949
|
+
* @attr {number} end-value - The end of a range (default: max)
|
|
42950
|
+
* @attr {number} min - Smallest value (default: 0)
|
|
42951
|
+
* @attr {number} max - Largest value (default: 100)
|
|
42952
|
+
* @attr {number} step - Step between values (default: 1)
|
|
42953
|
+
* @attr {object} translations - Override translation keys; unset keys fall back to Dutch
|
|
42954
|
+
*
|
|
42955
|
+
* @prop {(value: number) => string} formatValue - Turns a value into the text of its tooltip and of what a screen reader hears
|
|
42956
|
+
*
|
|
42957
|
+
* @fires input - While a thumb moves; detail: { value } or, with `range`, { startValue, endValue }
|
|
42958
|
+
* @fires change - When a thumb is let go, or a key moved it; detail as for input
|
|
42959
|
+
*/
|
|
42960
|
+
var _NLDDSlider;
|
|
42961
|
+
var NUMBER = new Intl.NumberFormat("nl-NL", { maximumFractionDigits: 6 });
|
|
42962
|
+
var NLDDSlider = (_NLDDSlider = class NLDDSlider extends DescribedBy(FormAssociated(LitElement)) {
|
|
42963
|
+
constructor(..._args) {
|
|
42964
|
+
super(..._args);
|
|
42965
|
+
this.size = "md";
|
|
42966
|
+
this.range = false;
|
|
42967
|
+
this.histogram = [];
|
|
42968
|
+
this.startIcon = "";
|
|
42969
|
+
this.endIcon = "";
|
|
42970
|
+
this.accessibleLabel = "";
|
|
42971
|
+
this.tooltipTiming = "instant";
|
|
42972
|
+
this.invalid = false;
|
|
42973
|
+
this.disabled = false;
|
|
42974
|
+
this.name = "";
|
|
42975
|
+
this.value = void 0;
|
|
42976
|
+
this.startValue = void 0;
|
|
42977
|
+
this.endValue = void 0;
|
|
42978
|
+
this.min = 0;
|
|
42979
|
+
this.max = 100;
|
|
42980
|
+
this.step = 1;
|
|
42981
|
+
this.translations = {};
|
|
42982
|
+
this.formatValue = null;
|
|
42983
|
+
this._active = false;
|
|
42984
|
+
this._initial = {};
|
|
42985
|
+
this._resizeObserver = null;
|
|
42986
|
+
this._trackThumb = null;
|
|
42987
|
+
this._stackedPress = null;
|
|
42988
|
+
this._handlePointerDown = (event) => {
|
|
42989
|
+
if (this.disabled || event.button !== 0) return;
|
|
42990
|
+
this._active = true;
|
|
42991
|
+
window.addEventListener("pointerup", this._handlePointerUp, { once: true });
|
|
42992
|
+
window.addEventListener("pointercancel", this._handlePointerUp, { once: true });
|
|
42993
|
+
if (!this.range || event.target.matches(".slider__input")) return;
|
|
42994
|
+
window.addEventListener("pointermove", this._handleTrackMove);
|
|
42995
|
+
event.preventDefault();
|
|
42996
|
+
if (this._start === this._end && this._onThumb(event.clientX)) {
|
|
42997
|
+
this._stackedPress = event.clientX;
|
|
42998
|
+
return;
|
|
42999
|
+
}
|
|
43000
|
+
const value = this._valueAt(event.clientX);
|
|
43001
|
+
const thumb = Math.abs(value - this._start) < Math.abs(value - this._end) || value < this._start ? "start" : "end";
|
|
43002
|
+
this._grab(thumb);
|
|
43003
|
+
this._set(thumb, value);
|
|
43004
|
+
this._emit("input");
|
|
43005
|
+
};
|
|
43006
|
+
this._handleTrackMove = (event) => {
|
|
43007
|
+
if (!this.isConnected) return;
|
|
43008
|
+
if (this._stackedPress !== null) {
|
|
43009
|
+
const moved = event.clientX - this._stackedPress;
|
|
43010
|
+
if (moved === 0) return;
|
|
43011
|
+
const rtl = getComputedStyle(this).direction === "rtl";
|
|
43012
|
+
this._grab(moved < 0 !== rtl ? "start" : "end");
|
|
43013
|
+
this._stackedPress = null;
|
|
43014
|
+
}
|
|
43015
|
+
if (!this._trackThumb) return;
|
|
43016
|
+
this._set(this._trackThumb, this._valueAt(event.clientX));
|
|
43017
|
+
this._emit("input");
|
|
43018
|
+
};
|
|
43019
|
+
this._handlePointerUp = () => {
|
|
43020
|
+
this._active = false;
|
|
43021
|
+
const thumb = this._trackThumb;
|
|
43022
|
+
this._stopPress();
|
|
43023
|
+
if (thumb) this._emit("change");
|
|
43024
|
+
};
|
|
43025
|
+
this._layoutTooltips = () => {
|
|
43026
|
+
const root = this.shadowRoot;
|
|
43027
|
+
const slider = root?.querySelector(".slider");
|
|
43028
|
+
if (!root || !slider) return;
|
|
43029
|
+
const tooltips = Array.from(root.querySelectorAll(".slider__tooltip"));
|
|
43030
|
+
for (const tooltip of tooltips) tooltip.style.removeProperty("--_slider-tooltip-shift");
|
|
43031
|
+
if (this.range && tooltips.length) {
|
|
43032
|
+
const [start, end] = root.querySelectorAll(".slider__tooltip--start, .slider__tooltip--end");
|
|
43033
|
+
const a = start.getBoundingClientRect();
|
|
43034
|
+
const b = end.getBoundingClientRect();
|
|
43035
|
+
const overlap = a.right > b.left - 4 && b.right > a.left - 4;
|
|
43036
|
+
slider.classList.toggle("is-merged", overlap);
|
|
43037
|
+
}
|
|
43038
|
+
const margin = 8;
|
|
43039
|
+
for (const tooltip of tooltips) {
|
|
43040
|
+
const rect = tooltip.getBoundingClientRect();
|
|
43041
|
+
if (!rect.width) continue;
|
|
43042
|
+
const shift = rect.left < margin ? margin - rect.left : rect.right > window.innerWidth - margin ? window.innerWidth - margin - rect.right : 0;
|
|
43043
|
+
if (shift) tooltip.style.setProperty("--_slider-tooltip-shift", `${shift}px`);
|
|
43044
|
+
}
|
|
43045
|
+
};
|
|
43046
|
+
}
|
|
43047
|
+
/** @internal */
|
|
43048
|
+
_t(key) {
|
|
43049
|
+
return translate(this.translations, nlddSliderTranslations, key);
|
|
43050
|
+
}
|
|
43051
|
+
/** @internal The value of a single slider, settled within min and max. */
|
|
43052
|
+
get _value() {
|
|
43053
|
+
return this._snap(this.value ?? (this.min + this.max) / 2);
|
|
43054
|
+
}
|
|
43055
|
+
/** @internal The start of a range. */
|
|
43056
|
+
get _start() {
|
|
43057
|
+
return Math.min(this._snap(this.startValue ?? this.min), this._end);
|
|
43058
|
+
}
|
|
43059
|
+
/** @internal The end of a range. */
|
|
43060
|
+
get _end() {
|
|
43061
|
+
return this._snap(this.endValue ?? this.max);
|
|
43062
|
+
}
|
|
43063
|
+
/** @internal Where a value sits along the track, from 0 to 1. */
|
|
43064
|
+
_fraction(value) {
|
|
43065
|
+
return this.max > this.min ? (value - this.min) / (this.max - this.min) : 0;
|
|
43066
|
+
}
|
|
43067
|
+
/** @internal A value as the tooltip and a screen reader say it. */
|
|
43068
|
+
_format(value) {
|
|
43069
|
+
return this.formatValue ? this.formatValue(value) : NUMBER.format(value);
|
|
43070
|
+
}
|
|
43071
|
+
/** @internal The name of a thumb for a screen reader. */
|
|
43072
|
+
_label(thumb) {
|
|
43073
|
+
if (thumb === "value") return this.accessibleLabel || void 0;
|
|
43074
|
+
const end = this._t(thumb === "start" ? "components.slider.start-value-label" : "components.slider.end-value-label");
|
|
43075
|
+
return this.accessibleLabel ? `${this.accessibleLabel}, ${end.toLowerCase()}` : end;
|
|
43076
|
+
}
|
|
43077
|
+
/** Rounds to the nearest step and keeps it within min and max. */
|
|
43078
|
+
_snap(value) {
|
|
43079
|
+
const step = this.step > 0 ? this.step : 1;
|
|
43080
|
+
const snapped = this.min + Math.round((value - this.min) / step) * step;
|
|
43081
|
+
const decimals = (String(step).split(".")[1] ?? "").length;
|
|
43082
|
+
return Math.max(this.min, Math.min(this.max, Number(snapped.toFixed(decimals))));
|
|
43083
|
+
}
|
|
43084
|
+
connectedCallback() {
|
|
43085
|
+
super.connectedCallback();
|
|
43086
|
+
if (!this.hasUpdated) this._initial = {
|
|
43087
|
+
value: this.value,
|
|
43088
|
+
startValue: this.startValue,
|
|
43089
|
+
endValue: this.endValue
|
|
43090
|
+
};
|
|
43091
|
+
this._resizeObserver = new ResizeObserver(this._layoutTooltips);
|
|
43092
|
+
this._resizeObserver.observe(this);
|
|
43093
|
+
window.addEventListener("resize", this._layoutTooltips);
|
|
43094
|
+
}
|
|
43095
|
+
disconnectedCallback() {
|
|
43096
|
+
super.disconnectedCallback();
|
|
43097
|
+
this._resizeObserver?.disconnect();
|
|
43098
|
+
this._resizeObserver = null;
|
|
43099
|
+
window.removeEventListener("resize", this._layoutTooltips);
|
|
43100
|
+
this._stopPress();
|
|
43101
|
+
this._active = false;
|
|
43102
|
+
}
|
|
43103
|
+
formValue() {
|
|
43104
|
+
if (!this.range) return String(this._value);
|
|
43105
|
+
if (!this.name) return null;
|
|
43106
|
+
const data = new FormData();
|
|
43107
|
+
data.append(this.name, String(this._start));
|
|
43108
|
+
data.append(this.name, String(this._end));
|
|
43109
|
+
return data;
|
|
43110
|
+
}
|
|
43111
|
+
formResetCallback() {
|
|
43112
|
+
this.value = this._initial.value;
|
|
43113
|
+
this.startValue = this._initial.startValue;
|
|
43114
|
+
this.endValue = this._initial.endValue;
|
|
43115
|
+
}
|
|
43116
|
+
formStateRestoreCallback(state) {
|
|
43117
|
+
const number = (entry) => {
|
|
43118
|
+
const value = parseFloat(String(entry));
|
|
43119
|
+
return Number.isFinite(value) ? value : void 0;
|
|
43120
|
+
};
|
|
43121
|
+
if (typeof state === "string") this.value = number(state) ?? this.value;
|
|
43122
|
+
if (state instanceof FormData && this.name) {
|
|
43123
|
+
const [start, end] = state.getAll(this.name).map(number);
|
|
43124
|
+
this.startValue = start ?? this.startValue;
|
|
43125
|
+
this.endValue = end ?? this.endValue;
|
|
43126
|
+
}
|
|
43127
|
+
}
|
|
43128
|
+
updated(changed) {
|
|
43129
|
+
super.updated?.(changed);
|
|
43130
|
+
this._layoutTooltips();
|
|
43131
|
+
}
|
|
43132
|
+
/** Moves focus to the thumb (the start one of a range). */
|
|
43133
|
+
focus(options) {
|
|
43134
|
+
this._inputs?.[0]?.focus(options);
|
|
43135
|
+
}
|
|
43136
|
+
describedTarget() {
|
|
43137
|
+
return this.shadowRoot?.querySelector(".slider__input") ?? null;
|
|
43138
|
+
}
|
|
43139
|
+
/** @internal */
|
|
43140
|
+
_handleInput(event, thumb) {
|
|
43141
|
+
event.stopPropagation();
|
|
43142
|
+
this._set(thumb, parseFloat(event.target.value), event.target);
|
|
43143
|
+
this._emit("input");
|
|
43144
|
+
}
|
|
43145
|
+
/** @internal */
|
|
43146
|
+
_handleChange(event) {
|
|
43147
|
+
event.stopPropagation();
|
|
43148
|
+
this._emit("change");
|
|
43149
|
+
}
|
|
43150
|
+
/** Makes a thumb the one a press drags, and gives it focus. */
|
|
43151
|
+
_grab(thumb) {
|
|
43152
|
+
this._trackThumb = thumb;
|
|
43153
|
+
this.shadowRoot?.querySelector(`.slider__input--${thumb}`)?.focus();
|
|
43154
|
+
}
|
|
43155
|
+
/** Ends a press: its listeners on the window, and the thumb it drags. */
|
|
43156
|
+
_stopPress() {
|
|
43157
|
+
window.removeEventListener("pointermove", this._handleTrackMove);
|
|
43158
|
+
window.removeEventListener("pointerup", this._handlePointerUp);
|
|
43159
|
+
window.removeEventListener("pointercancel", this._handlePointerUp);
|
|
43160
|
+
this._trackThumb = null;
|
|
43161
|
+
this._stackedPress = null;
|
|
43162
|
+
}
|
|
43163
|
+
/** The value under a point of the track, the way the native thumb places it. */
|
|
43164
|
+
_valueAt(x) {
|
|
43165
|
+
const control = this.shadowRoot.querySelector(".slider__control");
|
|
43166
|
+
const rect = control.getBoundingClientRect();
|
|
43167
|
+
const thumb = parseFloat(getComputedStyle(control).getPropertyValue("--_slider-thumb-size")) || 0;
|
|
43168
|
+
let fraction = (x - rect.left - thumb / 2) / Math.max(1, rect.width - thumb);
|
|
43169
|
+
if (getComputedStyle(this).direction === "rtl") fraction = 1 - fraction;
|
|
43170
|
+
return this._snap(this.min + Math.max(0, Math.min(1, fraction)) * (this.max - this.min));
|
|
43171
|
+
}
|
|
43172
|
+
/** Whether a point lies on the pressable area of the stacked thumbs. */
|
|
43173
|
+
_onThumb(x) {
|
|
43174
|
+
const control = this.shadowRoot.querySelector(".slider__control");
|
|
43175
|
+
const rect = control.getBoundingClientRect();
|
|
43176
|
+
const style = getComputedStyle(control);
|
|
43177
|
+
const thumb = parseFloat(style.getPropertyValue("--_slider-thumb-size")) || 0;
|
|
43178
|
+
const hit = parseFloat(style.getPropertyValue("--_slider-thumb-hit-size")) || thumb;
|
|
43179
|
+
let fraction = this._fraction(this._start);
|
|
43180
|
+
if (getComputedStyle(this).direction === "rtl") fraction = 1 - fraction;
|
|
43181
|
+
return Math.abs(x - (rect.left + thumb / 2 + (rect.width - thumb) * fraction)) <= hit / 2;
|
|
43182
|
+
}
|
|
43183
|
+
/** Sets a thumb, keeps the thumbs of a range from passing each other, and
|
|
43184
|
+
* puts the native input back where the value landed. */
|
|
43185
|
+
_set(thumb, raw, input) {
|
|
43186
|
+
const value = this._snap(raw);
|
|
43187
|
+
if (thumb === "value") this.value = value;
|
|
43188
|
+
if (thumb === "start") this.startValue = Math.min(value, this._end);
|
|
43189
|
+
if (thumb === "end") this.endValue = Math.max(value, this._start);
|
|
43190
|
+
const settled = thumb === "value" ? this.value : thumb === "start" ? this.startValue : this.endValue;
|
|
43191
|
+
if (input && parseFloat(input.value) !== settled) input.value = String(settled);
|
|
43192
|
+
this.commitFormValue();
|
|
43193
|
+
}
|
|
43194
|
+
_emit(type) {
|
|
43195
|
+
const detail = this.range ? {
|
|
43196
|
+
startValue: this._start,
|
|
43197
|
+
endValue: this._end
|
|
43198
|
+
} : { value: this._value };
|
|
43199
|
+
this.dispatchEvent(new CustomEvent(type, {
|
|
43200
|
+
detail,
|
|
43201
|
+
bubbles: true,
|
|
43202
|
+
composed: true
|
|
43203
|
+
}));
|
|
43204
|
+
}
|
|
43205
|
+
render() {
|
|
43206
|
+
return sliderTemplate(this);
|
|
43207
|
+
}
|
|
43208
|
+
}, _NLDDSlider.styles = sliderStyles, _NLDDSlider.isFormInput = true, _NLDDSlider);
|
|
43209
|
+
__decorate([property({
|
|
43210
|
+
reflect: true,
|
|
43211
|
+
converter: reflectNonDefault("md")
|
|
43212
|
+
})], NLDDSlider.prototype, "size", void 0);
|
|
43213
|
+
__decorate([property({
|
|
43214
|
+
type: Boolean,
|
|
43215
|
+
reflect: true
|
|
43216
|
+
})], NLDDSlider.prototype, "range", void 0);
|
|
43217
|
+
__decorate([property({ converter: {
|
|
43218
|
+
fromAttribute: (value) => (value ?? "").split(/[\s,]+/).filter(Boolean).map(Number).filter((n) => Number.isFinite(n)),
|
|
43219
|
+
toAttribute: (value) => value.join(",")
|
|
43220
|
+
} })], NLDDSlider.prototype, "histogram", void 0);
|
|
43221
|
+
__decorate([property({
|
|
43222
|
+
type: String,
|
|
43223
|
+
attribute: "start-icon"
|
|
43224
|
+
})], NLDDSlider.prototype, "startIcon", void 0);
|
|
43225
|
+
__decorate([property({
|
|
43226
|
+
type: String,
|
|
43227
|
+
attribute: "end-icon"
|
|
43228
|
+
})], NLDDSlider.prototype, "endIcon", void 0);
|
|
43229
|
+
__decorate([property({
|
|
43230
|
+
type: String,
|
|
43231
|
+
attribute: "accessible-label"
|
|
43232
|
+
})], NLDDSlider.prototype, "accessibleLabel", void 0);
|
|
43233
|
+
__decorate([property({
|
|
43234
|
+
reflect: true,
|
|
43235
|
+
attribute: "tooltip-timing",
|
|
43236
|
+
converter: reflectNonDefault("instant")
|
|
43237
|
+
})], NLDDSlider.prototype, "tooltipTiming", void 0);
|
|
43238
|
+
__decorate([property({
|
|
43239
|
+
type: Boolean,
|
|
43240
|
+
reflect: true
|
|
43241
|
+
})], NLDDSlider.prototype, "invalid", void 0);
|
|
43242
|
+
__decorate([property({
|
|
43243
|
+
type: Boolean,
|
|
43244
|
+
reflect: true
|
|
43245
|
+
})], NLDDSlider.prototype, "disabled", void 0);
|
|
43246
|
+
__decorate([property({
|
|
43247
|
+
reflect: true,
|
|
43248
|
+
converter: reflectNonDefault("")
|
|
43249
|
+
})], NLDDSlider.prototype, "name", void 0);
|
|
43250
|
+
__decorate([property({ type: Number })], NLDDSlider.prototype, "value", void 0);
|
|
43251
|
+
__decorate([property({
|
|
43252
|
+
type: Number,
|
|
43253
|
+
attribute: "start-value"
|
|
43254
|
+
})], NLDDSlider.prototype, "startValue", void 0);
|
|
43255
|
+
__decorate([property({
|
|
43256
|
+
type: Number,
|
|
43257
|
+
attribute: "end-value"
|
|
43258
|
+
})], NLDDSlider.prototype, "endValue", void 0);
|
|
43259
|
+
__decorate([property({ type: Number })], NLDDSlider.prototype, "min", void 0);
|
|
43260
|
+
__decorate([property({ type: Number })], NLDDSlider.prototype, "max", void 0);
|
|
43261
|
+
__decorate([property({ type: Number })], NLDDSlider.prototype, "step", void 0);
|
|
43262
|
+
__decorate([property({ type: Object })], NLDDSlider.prototype, "translations", void 0);
|
|
43263
|
+
__decorate([property({ attribute: false })], NLDDSlider.prototype, "formatValue", void 0);
|
|
43264
|
+
__decorate([state()], NLDDSlider.prototype, "_active", void 0);
|
|
43265
|
+
__decorate([queryAll(".slider__input")], NLDDSlider.prototype, "_inputs", void 0);
|
|
43266
|
+
NLDDSlider = __decorate([customElement("nldd-slider")], NLDDSlider);
|
|
42047
43267
|
// src/components/layout/shell/shell.styles.ts
|
|
42048
43268
|
var shellStyles = css`
|
|
42049
43269
|
:host {
|
|
@@ -49233,6 +50453,1113 @@ __decorate([state()], NLDDPageFooter.prototype, "_hasBreadcrumbs", void 0);
|
|
|
49233
50453
|
__decorate([state()], NLDDPageFooter.prototype, "_hasMain", void 0);
|
|
49234
50454
|
__decorate([state()], NLDDPageFooter.prototype, "_hasLegalBar", void 0);
|
|
49235
50455
|
NLDDPageFooter = __decorate([customElement("nldd-page-footer")], NLDDPageFooter);
|
|
50456
|
+
// src/components/layout/task-board/task-board.i18n.ts
|
|
50457
|
+
var nlddTaskBoardTranslations = {
|
|
50458
|
+
"components.task-board.accessible-label": "Takenbord",
|
|
50459
|
+
"components.task-board.moved-text": "Verplaatst naar {column}, {position} van {total}.",
|
|
50460
|
+
"components.task-board.no-change-text": "Neergezet, plek ongewijzigd.",
|
|
50461
|
+
"components.task-board.edge-text": "Kan niet verder.",
|
|
50462
|
+
"components.task-board.drag-canceled-text": "Slepen geannuleerd.",
|
|
50463
|
+
"components.task-board.readonly-text": "Dit bord is alleen-lezen",
|
|
50464
|
+
"components.task-board.drag-return-text": "Terug naar de oude plek"
|
|
50465
|
+
};
|
|
50466
|
+
// src/components/layout/task-board/task-board.styles.ts
|
|
50467
|
+
var taskBoardStyles = css`
|
|
50468
|
+
|
|
50469
|
+
|
|
50470
|
+
/* # Host */
|
|
50471
|
+
|
|
50472
|
+
:host {
|
|
50473
|
+
--_task-board-gap: var(--primitives-space-12);
|
|
50474
|
+
--_task-board-fade-size: var(--primitives-space-32);
|
|
50475
|
+
--_task-board-fade-left: var(--primitives-space-0);
|
|
50476
|
+
--_task-board-fade-right: var(--primitives-space-0);
|
|
50477
|
+
--_task-board-height: auto;
|
|
50478
|
+
|
|
50479
|
+
box-sizing: border-box;
|
|
50480
|
+
display: block;
|
|
50481
|
+
min-width: 0;
|
|
50482
|
+
height: var(--_task-board-height);
|
|
50483
|
+
}
|
|
50484
|
+
|
|
50485
|
+
:host([hidden]) {
|
|
50486
|
+
display: none;
|
|
50487
|
+
}
|
|
50488
|
+
|
|
50489
|
+
|
|
50490
|
+
/* # Block */
|
|
50491
|
+
|
|
50492
|
+
.task-board {
|
|
50493
|
+
display: flex;
|
|
50494
|
+
height: 100%;
|
|
50495
|
+
overflow-x: auto;
|
|
50496
|
+
gap: var(--_task-board-gap);
|
|
50497
|
+
align-items: stretch;
|
|
50498
|
+
scroll-snap-type: x proximity;
|
|
50499
|
+
scroll-padding-inline: var(--_task-board-gap);
|
|
50500
|
+
mask-image: linear-gradient(to right, transparent 0, black var(--_task-board-fade-left), black calc(100% - var(--_task-board-fade-right)), transparent 100%);
|
|
50501
|
+
}
|
|
50502
|
+
|
|
50503
|
+
.task-board.can-scroll-left {
|
|
50504
|
+
--_task-board-fade-left: var(--_task-board-fade-size);
|
|
50505
|
+
}
|
|
50506
|
+
|
|
50507
|
+
.task-board.can-scroll-right {
|
|
50508
|
+
--_task-board-fade-right: var(--_task-board-fade-size);
|
|
50509
|
+
}
|
|
50510
|
+
|
|
50511
|
+
/* Snapping would pull the board back after every step it scrolls while an
|
|
50512
|
+
item is dragged to its edge. */
|
|
50513
|
+
.task-board.is-dragging {
|
|
50514
|
+
scroll-snap-type: none;
|
|
50515
|
+
}
|
|
50516
|
+
|
|
50517
|
+
.task-board:focus-visible {
|
|
50518
|
+
outline: var(--semantics-focus-ring-outline);
|
|
50519
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
50520
|
+
}
|
|
50521
|
+
|
|
50522
|
+
::slotted(nldd-task-board-column) {
|
|
50523
|
+
scroll-snap-align: start;
|
|
50524
|
+
}
|
|
50525
|
+
|
|
50526
|
+
.task-board__announcer {
|
|
50527
|
+
position: absolute;
|
|
50528
|
+
width: 1px;
|
|
50529
|
+
height: 1px;
|
|
50530
|
+
clip-path: inset(50%);
|
|
50531
|
+
white-space: nowrap;
|
|
50532
|
+
overflow: hidden;
|
|
50533
|
+
}
|
|
50534
|
+
`;
|
|
50535
|
+
var taskBoardColumnStyles = css`
|
|
50536
|
+
|
|
50537
|
+
|
|
50538
|
+
/* # Host */
|
|
50539
|
+
|
|
50540
|
+
:host {
|
|
50541
|
+
--_task-board-column-width: var(--primitives-area-280);
|
|
50542
|
+
--_task-board-column-corner-radius: var(--semantics-surfaces-corner-radius);
|
|
50543
|
+
--_task-board-column-highlight-border-width: var(--semantics-surfaces-highlight-border-width);
|
|
50544
|
+
--_task-board-column-highlight-border-color: var(--semantics-surfaces-tinted-highlight-border-color);
|
|
50545
|
+
--_task-board-column-background-color: var(--semantics-surfaces-tinted-background-color);
|
|
50546
|
+
--_task-board-column-drop-border-width: var(--semantics-drop-targets-border-width);
|
|
50547
|
+
--_task-board-column-available-border-color: var(--semantics-drop-targets-is-available-border-color);
|
|
50548
|
+
--_task-board-column-over-border-color: var(--semantics-drop-targets-is-over-border-color);
|
|
50549
|
+
--_task-board-column-over-background-color: var(--semantics-drop-targets-is-over-background-color);
|
|
50550
|
+
--_task-board-column-header-padding: var(--primitives-space-12) var(--primitives-space-16) var(--primitives-space-4);
|
|
50551
|
+
--_task-board-column-header-gap: var(--primitives-space-8);
|
|
50552
|
+
--_task-board-column-title-font: var(--primitives-font-body-md-bold-tight);
|
|
50553
|
+
--_task-board-column-count-color: var(--semantics-content-secondary-color);
|
|
50554
|
+
--_task-board-column-count-font: var(--primitives-font-body-sm-regular-tight);
|
|
50555
|
+
--_task-board-column-main-gap: var(--primitives-space-8);
|
|
50556
|
+
--_task-board-column-main-padding: var(--primitives-space-8);
|
|
50557
|
+
--_task-board-column-main-min-height: var(--primitives-space-80);
|
|
50558
|
+
--_task-board-column-main-fade-size: var(--primitives-space-24);
|
|
50559
|
+
--_task-board-column-main-fade-top: var(--primitives-space-0);
|
|
50560
|
+
--_task-board-column-main-fade-bottom: var(--primitives-space-0);
|
|
50561
|
+
--_task-board-column-placeholder-background-color: var(--semantics-drop-targets-placeholder-background-color);
|
|
50562
|
+
--_task-board-column-placeholder-corner-radius: var(--semantics-surfaces-corner-radius);
|
|
50563
|
+
--_task-board-column-placeholder-border-width: var(--semantics-drop-targets-border-width);
|
|
50564
|
+
--_task-board-column-placeholder-border-color: var(--semantics-drop-indicators-color);
|
|
50565
|
+
--_task-board-column-placeholder-top: 0px;
|
|
50566
|
+
--_task-board-column-placeholder-left: 0px;
|
|
50567
|
+
--_task-board-column-placeholder-width: 0px;
|
|
50568
|
+
--_task-board-column-placeholder-height: 0px;
|
|
50569
|
+
--_task-board-column-indicator-top: 0px;
|
|
50570
|
+
--_task-board-column-indicator-inset: var(--primitives-space-8);
|
|
50571
|
+
--_task-board-column-indicator-thickness: var(--primitives-border-width-regular);
|
|
50572
|
+
--_task-board-column-indicator-color: var(--semantics-drop-indicators-color);
|
|
50573
|
+
|
|
50574
|
+
${inheritedTextReset}
|
|
50575
|
+
box-sizing: border-box;
|
|
50576
|
+
display: flex;
|
|
50577
|
+
flex-shrink: 0;
|
|
50578
|
+
width: var(--_task-board-column-width);
|
|
50579
|
+
min-height: 0;
|
|
50580
|
+
}
|
|
50581
|
+
|
|
50582
|
+
:host([hidden]) {
|
|
50583
|
+
display: none;
|
|
50584
|
+
}
|
|
50585
|
+
|
|
50586
|
+
|
|
50587
|
+
/* # Block */
|
|
50588
|
+
|
|
50589
|
+
.task-board-column {
|
|
50590
|
+
box-sizing: border-box;
|
|
50591
|
+
display: flex;
|
|
50592
|
+
border-radius: var(--_task-board-column-corner-radius);
|
|
50593
|
+
box-shadow: inset 0 0 0 var(--_task-board-column-highlight-border-width) var(--_task-board-column-highlight-border-color);
|
|
50594
|
+
background-color: var(--_task-board-column-background-color);
|
|
50595
|
+
width: 100%;
|
|
50596
|
+
min-height: 0;
|
|
50597
|
+
max-height: 100%;
|
|
50598
|
+
flex-direction: column;
|
|
50599
|
+
}
|
|
50600
|
+
|
|
50601
|
+
.task-board-column.is-drop-available {
|
|
50602
|
+
--_task-board-column-highlight-border-width: var(--_task-board-column-drop-border-width);
|
|
50603
|
+
--_task-board-column-highlight-border-color: var(--_task-board-column-available-border-color);
|
|
50604
|
+
}
|
|
50605
|
+
|
|
50606
|
+
.task-board-column.is-drop-over {
|
|
50607
|
+
--_task-board-column-highlight-border-width: var(--_task-board-column-drop-border-width);
|
|
50608
|
+
--_task-board-column-highlight-border-color: var(--_task-board-column-over-border-color);
|
|
50609
|
+
--_task-board-column-background-color: var(--_task-board-column-over-background-color);
|
|
50610
|
+
}
|
|
50611
|
+
|
|
50612
|
+
|
|
50613
|
+
/* # Elements */
|
|
50614
|
+
|
|
50615
|
+
.task-board-column__header {
|
|
50616
|
+
display: flex;
|
|
50617
|
+
flex-shrink: 0;
|
|
50618
|
+
padding: var(--_task-board-column-header-padding);
|
|
50619
|
+
gap: var(--_task-board-column-header-gap);
|
|
50620
|
+
align-items: center;
|
|
50621
|
+
}
|
|
50622
|
+
|
|
50623
|
+
.task-board-column__title {
|
|
50624
|
+
min-width: 0;
|
|
50625
|
+
flex-grow: 1;
|
|
50626
|
+
color: var(--semantics-content-color);
|
|
50627
|
+
font: var(--_task-board-column-title-font);
|
|
50628
|
+
}
|
|
50629
|
+
|
|
50630
|
+
.task-board-column__count {
|
|
50631
|
+
flex-shrink: 0;
|
|
50632
|
+
color: var(--_task-board-column-count-color);
|
|
50633
|
+
font: var(--_task-board-column-count-font);
|
|
50634
|
+
}
|
|
50635
|
+
|
|
50636
|
+
.task-board-column__main {
|
|
50637
|
+
box-sizing: border-box;
|
|
50638
|
+
display: flex;
|
|
50639
|
+
position: relative;
|
|
50640
|
+
min-height: var(--_task-board-column-main-min-height);
|
|
50641
|
+
overflow-y: auto;
|
|
50642
|
+
padding: var(--_task-board-column-main-padding);
|
|
50643
|
+
flex-direction: column;
|
|
50644
|
+
flex-grow: 1;
|
|
50645
|
+
gap: var(--_task-board-column-main-gap);
|
|
50646
|
+
mask-image: linear-gradient(to bottom, transparent 0, black var(--_task-board-column-main-fade-top), black calc(100% - var(--_task-board-column-main-fade-bottom)), transparent 100%);
|
|
50647
|
+
}
|
|
50648
|
+
|
|
50649
|
+
.task-board-column__main.can-scroll-up {
|
|
50650
|
+
--_task-board-column-main-fade-top: var(--_task-board-column-main-fade-size);
|
|
50651
|
+
}
|
|
50652
|
+
|
|
50653
|
+
.task-board-column__main.can-scroll-down {
|
|
50654
|
+
--_task-board-column-main-fade-bottom: var(--_task-board-column-main-fade-size);
|
|
50655
|
+
}
|
|
50656
|
+
|
|
50657
|
+
.task-board-column__footer {
|
|
50658
|
+
flex-shrink: 0;
|
|
50659
|
+
}
|
|
50660
|
+
|
|
50661
|
+
.task-board-column__footer[hidden] {
|
|
50662
|
+
display: none;
|
|
50663
|
+
}
|
|
50664
|
+
|
|
50665
|
+
::slotted(*) {
|
|
50666
|
+
flex-shrink: 0;
|
|
50667
|
+
-webkit-touch-callout: none;
|
|
50668
|
+
}
|
|
50669
|
+
|
|
50670
|
+
/* The item keeps its place while it is dragged, as an empty slot. */
|
|
50671
|
+
::slotted([data-task-board-dragging]) {
|
|
50672
|
+
visibility: hidden;
|
|
50673
|
+
}
|
|
50674
|
+
|
|
50675
|
+
.task-board-column__placeholder {
|
|
50676
|
+
position: absolute;
|
|
50677
|
+
top: var(--_task-board-column-placeholder-top);
|
|
50678
|
+
left: var(--_task-board-column-placeholder-left);
|
|
50679
|
+
border-radius: var(--_task-board-column-placeholder-corner-radius);
|
|
50680
|
+
background-color: var(--_task-board-column-placeholder-background-color);
|
|
50681
|
+
pointer-events: none;
|
|
50682
|
+
width: var(--_task-board-column-placeholder-width);
|
|
50683
|
+
height: var(--_task-board-column-placeholder-height);
|
|
50684
|
+
}
|
|
50685
|
+
|
|
50686
|
+
.task-board-column__placeholder.is-returning {
|
|
50687
|
+
box-shadow: inset 0 0 0 var(--_task-board-column-placeholder-border-width) var(--_task-board-column-placeholder-border-color);
|
|
50688
|
+
}
|
|
50689
|
+
|
|
50690
|
+
.task-board-column__placeholder[hidden] {
|
|
50691
|
+
display: none;
|
|
50692
|
+
}
|
|
50693
|
+
|
|
50694
|
+
.task-board-column__drop-indicator {
|
|
50695
|
+
position: absolute;
|
|
50696
|
+
top: var(--_task-board-column-indicator-top);
|
|
50697
|
+
right: var(--_task-board-column-indicator-inset);
|
|
50698
|
+
left: var(--_task-board-column-indicator-inset);
|
|
50699
|
+
border-radius: var(--_task-board-column-indicator-thickness);
|
|
50700
|
+
background-color: var(--_task-board-column-indicator-color);
|
|
50701
|
+
pointer-events: none;
|
|
50702
|
+
height: var(--_task-board-column-indicator-thickness);
|
|
50703
|
+
transform: translateY(-50%);
|
|
50704
|
+
}
|
|
50705
|
+
|
|
50706
|
+
.task-board-column__drop-indicator[hidden] {
|
|
50707
|
+
display: none;
|
|
50708
|
+
}
|
|
50709
|
+
|
|
50710
|
+
|
|
50711
|
+
/* # High contrast */
|
|
50712
|
+
|
|
50713
|
+
@media (forced-colors: active) {
|
|
50714
|
+
.task-board-column {
|
|
50715
|
+
border: var(--_task-board-column-highlight-border-width) solid CanvasText;
|
|
50716
|
+
}
|
|
50717
|
+
|
|
50718
|
+
.task-board-column__drop-indicator {
|
|
50719
|
+
background-color: Highlight;
|
|
50720
|
+
}
|
|
50721
|
+
}
|
|
50722
|
+
`;
|
|
50723
|
+
// src/components/layout/task-board/task-board.template.ts
|
|
50724
|
+
function taskBoardTemplate(component) {
|
|
50725
|
+
return html`
|
|
50726
|
+
<div class=${classMap({
|
|
50727
|
+
"task-board": true,
|
|
50728
|
+
"can-scroll-left": component._canScrollLeft,
|
|
50729
|
+
"can-scroll-right": component._canScrollRight,
|
|
50730
|
+
"is-dragging": component._dragging
|
|
50731
|
+
})}
|
|
50732
|
+
role="region"
|
|
50733
|
+
aria-label=${component.accessibleLabel || component._t("components.task-board.accessible-label")}
|
|
50734
|
+
tabindex=${component._canScrollLeft || component._canScrollRight ? "0" : nothing}
|
|
50735
|
+
@scroll=${component._updateScroll}
|
|
50736
|
+
>
|
|
50737
|
+
<slot @slotchange=${component._updateScroll}></slot>
|
|
50738
|
+
</div>
|
|
50739
|
+
<div class="task-board__announcer"
|
|
50740
|
+
role="status"
|
|
50741
|
+
aria-live="polite"
|
|
50742
|
+
aria-atomic="true"
|
|
50743
|
+
></div>
|
|
50744
|
+
`;
|
|
50745
|
+
}
|
|
50746
|
+
// src/components/layout/task-board/task-board-column.template.ts
|
|
50747
|
+
function taskBoardColumnTemplate(component) {
|
|
50748
|
+
return html`
|
|
50749
|
+
<section class=${classMap({
|
|
50750
|
+
"task-board-column": true,
|
|
50751
|
+
"is-drop-available": component._dropState === "available",
|
|
50752
|
+
"is-drop-over": component._dropState === "over"
|
|
50753
|
+
})}
|
|
50754
|
+
aria-label=${component.label || nothing}
|
|
50755
|
+
>
|
|
50756
|
+
<div class="task-board-column__header">
|
|
50757
|
+
<slot name="header">
|
|
50758
|
+
<span class="task-board-column__title">
|
|
50759
|
+
${component.text}
|
|
50760
|
+
</span>
|
|
50761
|
+
<span class="task-board-column__count">
|
|
50762
|
+
${component._count}
|
|
50763
|
+
</span>
|
|
50764
|
+
</slot>
|
|
50765
|
+
</div>
|
|
50766
|
+
<div class=${classMap({
|
|
50767
|
+
"task-board-column__main": true,
|
|
50768
|
+
"can-scroll-up": component._canScrollUp,
|
|
50769
|
+
"can-scroll-down": component._canScrollDown
|
|
50770
|
+
})}
|
|
50771
|
+
@scroll=${component._updateScroll}
|
|
50772
|
+
>
|
|
50773
|
+
<div class="task-board-column__placeholder${component._returning ? " is-returning" : ""}"
|
|
50774
|
+
?hidden=${!component._placeholder}
|
|
50775
|
+
></div>
|
|
50776
|
+
<slot @slotchange=${component._handleSlotChange}></slot>
|
|
50777
|
+
<div class="task-board-column__footer"
|
|
50778
|
+
?hidden=${!component._hasFooter}
|
|
50779
|
+
>
|
|
50780
|
+
<slot name="footer" @slotchange=${component._handleFooterChange}></slot>
|
|
50781
|
+
</div>
|
|
50782
|
+
<div class="task-board-column__drop-indicator"
|
|
50783
|
+
?hidden=${component._dropIndex === null}
|
|
50784
|
+
></div>
|
|
50785
|
+
</div>
|
|
50786
|
+
</section>
|
|
50787
|
+
`;
|
|
50788
|
+
}
|
|
50789
|
+
// src/components/layout/task-board/task-board-column.ts
|
|
50790
|
+
/**
|
|
50791
|
+
* One column of an `nldd-task-board`: a header and the items under it. The items
|
|
50792
|
+
* are whatever you put in the column, usually an `nldd-card` each; the board
|
|
50793
|
+
* moves them between columns.
|
|
50794
|
+
*
|
|
50795
|
+
* Without a `header` slot the column shows its `text` and the number of items.
|
|
50796
|
+
* With one, the header is yours: an `nldd-title`, a button to add an item, a
|
|
50797
|
+
* badge. `text` stays the column's name either way: it is what a screen reader
|
|
50798
|
+
* hears when an item moves here ("Verplaatst naar In behandeling"), so set it,
|
|
50799
|
+
* or `accessible-label`, also when the header comes from the slot.
|
|
50800
|
+
*
|
|
50801
|
+
* The column scrolls on its own once its items do not fit the height of the
|
|
50802
|
+
* board, and fades at the top or the bottom while there is more to scroll to.
|
|
50803
|
+
*
|
|
50804
|
+
* @element nldd-task-board-column
|
|
50805
|
+
* @attr {string} text - The column's name, shown in the header and used as its accessible name
|
|
50806
|
+
* @attr {string} accessible-label - Accessible name in place of `text`, for a column whose header comes from the slot
|
|
50807
|
+
* @attr {string} value - What the column stands for in your data, such as a status; `nldd-move` reports it as `fromColumn` and `toColumn`
|
|
50808
|
+
*
|
|
50809
|
+
* @slot header - The header, in place of `text` and the count
|
|
50810
|
+
* @slot - The items
|
|
50811
|
+
* @slot footer - Right under the last item, such as a button to add one; it scrolls along with the items
|
|
50812
|
+
*/
|
|
50813
|
+
var _NLDDTaskBoardColumn = class NLDDTaskBoardColumn extends LitElement {
|
|
50814
|
+
constructor(..._args) {
|
|
50815
|
+
super(..._args);
|
|
50816
|
+
this.text = "";
|
|
50817
|
+
this.accessibleLabel = "";
|
|
50818
|
+
this.value = "";
|
|
50819
|
+
this._count = 0;
|
|
50820
|
+
this._hasFooter = false;
|
|
50821
|
+
this._dropIndex = null;
|
|
50822
|
+
this._placeholder = null;
|
|
50823
|
+
this._returning = false;
|
|
50824
|
+
this._dropState = null;
|
|
50825
|
+
this._canScrollUp = false;
|
|
50826
|
+
this._canScrollDown = false;
|
|
50827
|
+
this._resizeObserver = null;
|
|
50828
|
+
this._updateScroll = () => {
|
|
50829
|
+
const main = this._mainElement;
|
|
50830
|
+
if (!main) return;
|
|
50831
|
+
this._canScrollUp = main.scrollTop > 1;
|
|
50832
|
+
this._canScrollDown = main.scrollTop < main.scrollHeight - main.clientHeight - 1;
|
|
50833
|
+
};
|
|
50834
|
+
}
|
|
50835
|
+
/** The column's name: what a screen reader hears for it. */
|
|
50836
|
+
get label() {
|
|
50837
|
+
return this.accessibleLabel || this.text;
|
|
50838
|
+
}
|
|
50839
|
+
/** The column's items, in order; a hidden one does not count. */
|
|
50840
|
+
get items() {
|
|
50841
|
+
return Array.from(this.children).filter((el) => el instanceof HTMLElement && !el.slot && !el.hidden);
|
|
50842
|
+
}
|
|
50843
|
+
/** @internal The element that scrolls the items. */
|
|
50844
|
+
get _main() {
|
|
50845
|
+
return this._mainElement;
|
|
50846
|
+
}
|
|
50847
|
+
/** @internal */
|
|
50848
|
+
_handleSlotChange() {
|
|
50849
|
+
this._count = this.items.length;
|
|
50850
|
+
this._observeItems();
|
|
50851
|
+
this._updateScroll();
|
|
50852
|
+
}
|
|
50853
|
+
/** The main area changes size with the board, and its content with the items. */
|
|
50854
|
+
_observeItems() {
|
|
50855
|
+
if (!this._resizeObserver || !this._mainElement) return;
|
|
50856
|
+
this._resizeObserver.disconnect();
|
|
50857
|
+
this._resizeObserver.observe(this._mainElement);
|
|
50858
|
+
for (const item of this.items) this._resizeObserver.observe(item);
|
|
50859
|
+
const footer = this.shadowRoot?.querySelector(".task-board-column__footer");
|
|
50860
|
+
if (footer) this._resizeObserver.observe(footer);
|
|
50861
|
+
}
|
|
50862
|
+
connectedCallback() {
|
|
50863
|
+
super.connectedCallback();
|
|
50864
|
+
if (this.hasUpdated && !this._resizeObserver) {
|
|
50865
|
+
this._resizeObserver = new ResizeObserver(this._updateScroll);
|
|
50866
|
+
this._observeItems();
|
|
50867
|
+
}
|
|
50868
|
+
}
|
|
50869
|
+
disconnectedCallback() {
|
|
50870
|
+
super.disconnectedCallback();
|
|
50871
|
+
this._resizeObserver?.disconnect();
|
|
50872
|
+
this._resizeObserver = null;
|
|
50873
|
+
}
|
|
50874
|
+
/** @internal */
|
|
50875
|
+
_handleFooterChange(event) {
|
|
50876
|
+
this._hasFooter = event.target.assignedNodes().length > 0;
|
|
50877
|
+
}
|
|
50878
|
+
firstUpdated() {
|
|
50879
|
+
this._resizeObserver = new ResizeObserver(this._updateScroll);
|
|
50880
|
+
this._observeItems();
|
|
50881
|
+
}
|
|
50882
|
+
updated(changed) {
|
|
50883
|
+
if (changed.has("_dropIndex")) this._placeIndicator();
|
|
50884
|
+
if (changed.has("_placeholder")) this._placePlaceholder();
|
|
50885
|
+
}
|
|
50886
|
+
/** Lays the placeholder over the empty place of the dragged item. */
|
|
50887
|
+
_placePlaceholder() {
|
|
50888
|
+
const item = this._placeholder;
|
|
50889
|
+
const placeholder = this.shadowRoot?.querySelector(".task-board-column__placeholder");
|
|
50890
|
+
if (!item || !placeholder) return;
|
|
50891
|
+
const main = this._mainElement.getBoundingClientRect();
|
|
50892
|
+
const rect = item.getBoundingClientRect();
|
|
50893
|
+
placeholder.style.setProperty("--_task-board-column-placeholder-top", `${rect.top - main.top + this._mainElement.scrollTop}px`);
|
|
50894
|
+
placeholder.style.setProperty("--_task-board-column-placeholder-left", `${rect.left - main.left + this._mainElement.scrollLeft}px`);
|
|
50895
|
+
placeholder.style.setProperty("--_task-board-column-placeholder-width", `${rect.width}px`);
|
|
50896
|
+
placeholder.style.setProperty("--_task-board-column-placeholder-height", `${rect.height}px`);
|
|
50897
|
+
}
|
|
50898
|
+
/** Puts the line between the items where a dropped item would land. */
|
|
50899
|
+
_placeIndicator() {
|
|
50900
|
+
if (this._dropIndex === null || !this._indicator) return;
|
|
50901
|
+
const items = this.items;
|
|
50902
|
+
const main = this._mainElement.getBoundingClientRect();
|
|
50903
|
+
const gap = parseFloat(getComputedStyle(this._mainElement).rowGap) || 0;
|
|
50904
|
+
const before = items[this._dropIndex];
|
|
50905
|
+
const after = items[this._dropIndex - 1];
|
|
50906
|
+
let top;
|
|
50907
|
+
if (before) top = before.getBoundingClientRect().top - gap / 2;
|
|
50908
|
+
else if (after) top = after.getBoundingClientRect().bottom + gap / 2;
|
|
50909
|
+
else top = main.top + parseFloat(getComputedStyle(this._mainElement).paddingTop);
|
|
50910
|
+
this._indicator.style.setProperty("--_task-board-column-indicator-top", `${top - main.top + this._mainElement.scrollTop}px`);
|
|
50911
|
+
}
|
|
50912
|
+
render() {
|
|
50913
|
+
return taskBoardColumnTemplate(this);
|
|
50914
|
+
}
|
|
50915
|
+
};
|
|
50916
|
+
var NLDDTaskBoardColumn = (_NLDDTaskBoardColumn.styles = taskBoardColumnStyles, _NLDDTaskBoardColumn);
|
|
50917
|
+
__decorate([property({
|
|
50918
|
+
reflect: true,
|
|
50919
|
+
converter: reflectNonDefault("")
|
|
50920
|
+
})], NLDDTaskBoardColumn.prototype, "text", void 0);
|
|
50921
|
+
__decorate([property({
|
|
50922
|
+
type: String,
|
|
50923
|
+
attribute: "accessible-label"
|
|
50924
|
+
})], NLDDTaskBoardColumn.prototype, "accessibleLabel", void 0);
|
|
50925
|
+
__decorate([property({
|
|
50926
|
+
reflect: true,
|
|
50927
|
+
converter: reflectNonDefault("")
|
|
50928
|
+
})], NLDDTaskBoardColumn.prototype, "value", void 0);
|
|
50929
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_count", void 0);
|
|
50930
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_hasFooter", void 0);
|
|
50931
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_dropIndex", void 0);
|
|
50932
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_placeholder", void 0);
|
|
50933
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_returning", void 0);
|
|
50934
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_dropState", void 0);
|
|
50935
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_canScrollUp", void 0);
|
|
50936
|
+
__decorate([state()], NLDDTaskBoardColumn.prototype, "_canScrollDown", void 0);
|
|
50937
|
+
__decorate([query(".task-board-column__main")], NLDDTaskBoardColumn.prototype, "_mainElement", void 0);
|
|
50938
|
+
__decorate([query(".task-board-column__drop-indicator")], NLDDTaskBoardColumn.prototype, "_indicator", void 0);
|
|
50939
|
+
NLDDTaskBoardColumn = __decorate([customElement("nldd-task-board-column")], NLDDTaskBoardColumn);
|
|
50940
|
+
// src/components/layout/task-board/task-board.ts
|
|
50941
|
+
/**
|
|
50942
|
+
* Nederlandse Digitale Dienst Task Board Component (Lit + TypeScript)
|
|
50943
|
+
*
|
|
50944
|
+
* Columns side by side, with items you move between them: a kanban board, or
|
|
50945
|
+
* any board where an item's column is one of its values, such as a status or a
|
|
50946
|
+
* team. Put `nldd-task-board-column`s in it, and the items in those, usually an
|
|
50947
|
+
* `nldd-card` each. The board scrolls sideways once its columns do not fit, and
|
|
50948
|
+
* a column scrolls on its own once its items do not fit the height you give the
|
|
50949
|
+
* board.
|
|
50950
|
+
*
|
|
50951
|
+
* An item moves in three ways, and all three fire the same `nldd-move`:
|
|
50952
|
+
*
|
|
50953
|
+
* - **Dragging.** Pick up the whole item and drop it in a column. A press that
|
|
50954
|
+
* does not move is still a click, so an item that is a link or a button keeps
|
|
50955
|
+
* working. Released outside the board, the item goes back to its place, which
|
|
50956
|
+
* a note above it says once it stays out a moment. On a touch screen you hold the item a moment before it lifts, so a
|
|
50957
|
+
* swipe still scrolls.
|
|
50958
|
+
* - **Keyboard.** With focus on an item, or on something inside it, Alt with
|
|
50959
|
+
* the up or down arrow moves it within its column, and Alt with the left or
|
|
50960
|
+
* right arrow to the column beside it.
|
|
50961
|
+
* - **`moveItem()`.** WCAG 2.5.7 asks for a way that does not drag. Give each
|
|
50962
|
+
* item a menu "Verplaatsen naar" with the other columns (`columns` lists them)
|
|
50963
|
+
* and call `moveItem()` from it. The menu is yours; the board only moves.
|
|
50964
|
+
*
|
|
50965
|
+
* With `readonly` nothing moves: no dragging and no Alt with the arrows, while
|
|
50966
|
+
* the items still work, so a card still opens. Use it for someone who may only
|
|
50967
|
+
* look, or a board that is closed. `moveItem()` still moves, so your app can
|
|
50968
|
+
* still show a move someone else made. An attempt to move an item, dragging it
|
|
50969
|
+
* past a click or Alt with an arrow, shows "Dit bord is alleen-lezen" at the
|
|
50970
|
+
* item, says it to a screen reader and fires `nldd-move-denied`, so your app
|
|
50971
|
+
* can say why in an `nldd-notification`. Say it above the board too: only
|
|
50972
|
+
* your app knows the reason, and then nobody has to try.
|
|
50973
|
+
*
|
|
50974
|
+
* The board moves nothing itself. `nldd-move` says which item goes where, and
|
|
50975
|
+
* your app moves it in its data, or in the DOM, in the handler: the app owns the
|
|
50976
|
+
* order, so a framework that renders the columns never fights the board over
|
|
50977
|
+
* them. `toIndex` is the place the item takes in `toColumn`, counted without
|
|
50978
|
+
* the item itself, so `splice(fromIndex, 1)` on the one list and
|
|
50979
|
+
* `splice(toIndex, 0, item)` on the other is the whole move. Move it
|
|
50980
|
+
* synchronously in the handler: the board puts focus back on the item right
|
|
50981
|
+
* after, and a screen reader hears where it landed.
|
|
50982
|
+
*
|
|
50983
|
+
* @element nldd-task-board
|
|
50984
|
+
* @attr {string} accessible-label - Accessible name of the board (default: "Takenbord")
|
|
50985
|
+
* @attr {string} height - Fixed height as a CSS length (e.g. '480px'): every column takes it, and scrolls its items once they do not fit. To fill a page or a pane, set the height in your layout instead (flex, or `height: 100%`)
|
|
50986
|
+
* @attr {boolean} readonly - Items cannot be dragged or moved with the keyboard; they still work, and `moveItem()` still moves
|
|
50987
|
+
* @attr {object} translations - Override translation keys; unset keys fall back to Dutch
|
|
50988
|
+
*
|
|
50989
|
+
* @slot - The columns: `nldd-task-board-column`
|
|
50990
|
+
*
|
|
50991
|
+
* @fires nldd-move - An item moves: `{ item, fromColumn, fromIndex, toColumn, toIndex }`, where a column is its `value` (or its `text` without one)
|
|
50992
|
+
* @fires nldd-move-denied - An item a `readonly` board does not move was dragged or moved with the keyboard: `{ item }`
|
|
50993
|
+
*
|
|
50994
|
+
* @method moveItem(item, toColumn, toIndex?) - Moves an item to a column, given as its `value` or as the element, at `toIndex` or at the end; fires `nldd-move` and says where it landed. Returns whether it moved.
|
|
50995
|
+
*/
|
|
50996
|
+
var _NLDDTaskBoard;
|
|
50997
|
+
/** How far a mouse or pen moves before a press becomes a drag, in pixels. */
|
|
50998
|
+
var DRAG_THRESHOLD$1 = 4;
|
|
50999
|
+
/** How far a finger may wander while it holds an item, and how long it holds. */
|
|
51000
|
+
var TOUCH_SLOP = 8;
|
|
51001
|
+
var TOUCH_HOLD_MS = 300;
|
|
51002
|
+
/** How close to an edge the pointer scrolls the board or a column, and how fast. */
|
|
51003
|
+
var SCROLL_EDGE = 48;
|
|
51004
|
+
var SCROLL_SPEED = 12;
|
|
51005
|
+
/** How long the note at an item a readonly board did not move stays. */
|
|
51006
|
+
var DENIED_MS = 1500;
|
|
51007
|
+
/** How long the pointer stays outside the board before the copy says it goes back. */
|
|
51008
|
+
var RETURN_NOTE_DELAY_MS = 300;
|
|
51009
|
+
var NLDDTaskBoard = (_NLDDTaskBoard = class NLDDTaskBoard extends withTranslations(LitElement, nlddTaskBoardTranslations) {
|
|
51010
|
+
constructor(..._args) {
|
|
51011
|
+
super(..._args);
|
|
51012
|
+
this.accessibleLabel = "";
|
|
51013
|
+
this.height = "";
|
|
51014
|
+
this.readonly = false;
|
|
51015
|
+
this._canScrollLeft = false;
|
|
51016
|
+
this._canScrollRight = false;
|
|
51017
|
+
this._dragging = false;
|
|
51018
|
+
this._scrollObserver = null;
|
|
51019
|
+
this._press = null;
|
|
51020
|
+
this._drag = null;
|
|
51021
|
+
this._grabbing = null;
|
|
51022
|
+
this._deniedNote = null;
|
|
51023
|
+
this._deniedCursor = null;
|
|
51024
|
+
this._deniedTimer = 0;
|
|
51025
|
+
this._updateScroll = () => {
|
|
51026
|
+
const el = this._scroller;
|
|
51027
|
+
if (!el) return;
|
|
51028
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
51029
|
+
const position = Math.abs(el.scrollLeft);
|
|
51030
|
+
const rtl = getComputedStyle(this).direction === "rtl";
|
|
51031
|
+
const before = position > 1;
|
|
51032
|
+
const after = position < max - 1;
|
|
51033
|
+
this._canScrollLeft = rtl ? after : before;
|
|
51034
|
+
this._canScrollRight = rtl ? before : after;
|
|
51035
|
+
};
|
|
51036
|
+
this._onKeyDown = (event) => {
|
|
51037
|
+
if (this._drag || !event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
51038
|
+
if (![
|
|
51039
|
+
"ArrowUp",
|
|
51040
|
+
"ArrowDown",
|
|
51041
|
+
"ArrowLeft",
|
|
51042
|
+
"ArrowRight"
|
|
51043
|
+
].includes(event.key)) return;
|
|
51044
|
+
const origin = event.composedPath()[0];
|
|
51045
|
+
if (origin instanceof HTMLElement && (origin.isContentEditable || origin.matches("input, textarea, select"))) return;
|
|
51046
|
+
const item = this._itemFrom(event);
|
|
51047
|
+
const from = item && this._columnOf(item);
|
|
51048
|
+
if (!item || !from) return;
|
|
51049
|
+
event.preventDefault();
|
|
51050
|
+
if (this.readonly) {
|
|
51051
|
+
this._deny(item);
|
|
51052
|
+
this._deniedTimer = window.setTimeout(() => this._hideDenied(), DENIED_MS);
|
|
51053
|
+
return;
|
|
51054
|
+
}
|
|
51055
|
+
const columns = this.columns;
|
|
51056
|
+
const fromIndex = from.items.indexOf(item);
|
|
51057
|
+
const rtl = getComputedStyle(this).direction === "rtl";
|
|
51058
|
+
const step = {
|
|
51059
|
+
ArrowUp: 0,
|
|
51060
|
+
ArrowDown: 0,
|
|
51061
|
+
ArrowLeft: rtl ? 1 : -1,
|
|
51062
|
+
ArrowRight: rtl ? -1 : 1
|
|
51063
|
+
}[event.key] ?? 0;
|
|
51064
|
+
if (step === 0) {
|
|
51065
|
+
const toIndex = fromIndex + (event.key === "ArrowUp" ? -1 : 1);
|
|
51066
|
+
if (toIndex < 0 || toIndex > from.items.length - 1) {
|
|
51067
|
+
this._announce(this._t("components.task-board.edge-text"));
|
|
51068
|
+
return;
|
|
51069
|
+
}
|
|
51070
|
+
this._move(item, from, fromIndex, from, toIndex);
|
|
51071
|
+
return;
|
|
51072
|
+
}
|
|
51073
|
+
const to = columns[columns.indexOf(from) + step];
|
|
51074
|
+
if (!to) {
|
|
51075
|
+
this._announce(this._t("components.task-board.edge-text"));
|
|
51076
|
+
return;
|
|
51077
|
+
}
|
|
51078
|
+
this._move(item, from, fromIndex, to, Math.min(fromIndex, to.items.length));
|
|
51079
|
+
};
|
|
51080
|
+
this._onPointerDown = (event) => {
|
|
51081
|
+
if (this._press || this._drag || !event.isPrimary || event.button !== 0) return;
|
|
51082
|
+
const origin = event.composedPath()[0];
|
|
51083
|
+
if (origin instanceof HTMLElement && (origin.isContentEditable || origin.matches("input, textarea, select"))) return;
|
|
51084
|
+
const item = this._itemFrom(event);
|
|
51085
|
+
if (!item) return;
|
|
51086
|
+
this._press = {
|
|
51087
|
+
item,
|
|
51088
|
+
pointerId: event.pointerId,
|
|
51089
|
+
pointerType: event.pointerType,
|
|
51090
|
+
startX: event.clientX,
|
|
51091
|
+
startY: event.clientY,
|
|
51092
|
+
timer: event.pointerType === "touch" ? window.setTimeout(() => this._startDrag(this._press.startX, this._press.startY), TOUCH_HOLD_MS) : 0
|
|
51093
|
+
};
|
|
51094
|
+
window.addEventListener("pointermove", this._onPointerMove);
|
|
51095
|
+
window.addEventListener("pointerup", this._onPointerUp);
|
|
51096
|
+
window.addEventListener("pointercancel", this._onPointerCancel);
|
|
51097
|
+
window.addEventListener("selectstart", this._preventSelect);
|
|
51098
|
+
};
|
|
51099
|
+
this._preventSelect = (event) => {
|
|
51100
|
+
event.preventDefault();
|
|
51101
|
+
};
|
|
51102
|
+
this._onPointerMove = (event) => {
|
|
51103
|
+
const press = this._press;
|
|
51104
|
+
if (press && event.pointerId === press.pointerId && !this._drag && !press.denied) {
|
|
51105
|
+
const distance = Math.hypot(event.clientX - press.startX, event.clientY - press.startY);
|
|
51106
|
+
if (press.pointerType === "touch") {
|
|
51107
|
+
if (distance > TOUCH_SLOP) this._endPress();
|
|
51108
|
+
return;
|
|
51109
|
+
}
|
|
51110
|
+
if (distance > DRAG_THRESHOLD$1) this._startDrag(event.clientX, event.clientY);
|
|
51111
|
+
}
|
|
51112
|
+
const drag = this._drag;
|
|
51113
|
+
if (!drag) return;
|
|
51114
|
+
drag.x = event.clientX;
|
|
51115
|
+
drag.y = event.clientY;
|
|
51116
|
+
this._follow();
|
|
51117
|
+
};
|
|
51118
|
+
this._onPointerUp = (event) => {
|
|
51119
|
+
const dragged = !!this._drag;
|
|
51120
|
+
const denied = this._press?.pointerId === event.pointerId && !!this._press.denied;
|
|
51121
|
+
if (dragged) this._drop();
|
|
51122
|
+
if (dragged || denied) this._swallowNextClick();
|
|
51123
|
+
if (this._press?.pointerId === event.pointerId) this._endPress();
|
|
51124
|
+
};
|
|
51125
|
+
this._onPointerCancel = () => {
|
|
51126
|
+
if (this._drag) this._cancelDrag();
|
|
51127
|
+
this._endPress();
|
|
51128
|
+
};
|
|
51129
|
+
this._swallowClick = (event) => {
|
|
51130
|
+
event.preventDefault();
|
|
51131
|
+
event.stopPropagation();
|
|
51132
|
+
};
|
|
51133
|
+
this._holdTouch = (event) => {
|
|
51134
|
+
event.preventDefault();
|
|
51135
|
+
};
|
|
51136
|
+
this._preventContextMenu = (event) => {
|
|
51137
|
+
event.preventDefault();
|
|
51138
|
+
};
|
|
51139
|
+
this._onDragKeyDown = (event) => {
|
|
51140
|
+
if (event.key !== "Escape") return;
|
|
51141
|
+
event.preventDefault();
|
|
51142
|
+
event.stopPropagation();
|
|
51143
|
+
this._cancelDrag();
|
|
51144
|
+
};
|
|
51145
|
+
this._scrollLoop = () => {
|
|
51146
|
+
const drag = this._drag;
|
|
51147
|
+
if (!drag) return;
|
|
51148
|
+
const board = this._scroller.getBoundingClientRect();
|
|
51149
|
+
const dx = drag.x < board.left + SCROLL_EDGE ? -12 : drag.x > board.right - SCROLL_EDGE ? SCROLL_SPEED : 0;
|
|
51150
|
+
if (dx) this._scroller.scrollBy({
|
|
51151
|
+
left: dx,
|
|
51152
|
+
behavior: "instant"
|
|
51153
|
+
});
|
|
51154
|
+
const main = drag.target?._main;
|
|
51155
|
+
if (main) {
|
|
51156
|
+
const rect = main.getBoundingClientRect();
|
|
51157
|
+
const dy = drag.y < rect.top + SCROLL_EDGE ? -12 : drag.y > rect.bottom - SCROLL_EDGE ? SCROLL_SPEED : 0;
|
|
51158
|
+
if (dy) main.scrollTop += dy;
|
|
51159
|
+
}
|
|
51160
|
+
if (dx || main) this._follow();
|
|
51161
|
+
drag.frame = requestAnimationFrame(this._scrollLoop);
|
|
51162
|
+
};
|
|
51163
|
+
}
|
|
51164
|
+
/** The columns, in order. */
|
|
51165
|
+
get columns() {
|
|
51166
|
+
return Array.from(this.children).filter((el) => el instanceof NLDDTaskBoardColumn && !el.hidden);
|
|
51167
|
+
}
|
|
51168
|
+
connectedCallback() {
|
|
51169
|
+
super.connectedCallback();
|
|
51170
|
+
this.addEventListener("pointerdown", this._onPointerDown);
|
|
51171
|
+
this.addEventListener("keydown", this._onKeyDown);
|
|
51172
|
+
}
|
|
51173
|
+
disconnectedCallback() {
|
|
51174
|
+
super.disconnectedCallback();
|
|
51175
|
+
this.removeEventListener("pointerdown", this._onPointerDown);
|
|
51176
|
+
this.removeEventListener("keydown", this._onKeyDown);
|
|
51177
|
+
this._scrollObserver?.disconnect();
|
|
51178
|
+
this._scrollObserver = null;
|
|
51179
|
+
this._endPress();
|
|
51180
|
+
this._endDrag();
|
|
51181
|
+
this._hideDenied();
|
|
51182
|
+
}
|
|
51183
|
+
updated(changed) {
|
|
51184
|
+
if (changed.has("height")) {
|
|
51185
|
+
const height = this.height;
|
|
51186
|
+
if (height && CSS.supports("height", height)) this.style.setProperty("--_task-board-height", height);
|
|
51187
|
+
else this.style.removeProperty("--_task-board-height");
|
|
51188
|
+
}
|
|
51189
|
+
if (changed.has("readonly")) {
|
|
51190
|
+
this._endPress();
|
|
51191
|
+
this._cancelDrag();
|
|
51192
|
+
this._hideDenied();
|
|
51193
|
+
}
|
|
51194
|
+
if (!this._scrollObserver && this._scroller) {
|
|
51195
|
+
this._scrollObserver = new ResizeObserver(() => this._updateScroll());
|
|
51196
|
+
this._scrollObserver.observe(this._scroller);
|
|
51197
|
+
for (const column of this.columns) this._scrollObserver.observe(column);
|
|
51198
|
+
}
|
|
51199
|
+
}
|
|
51200
|
+
moveItem(item, toColumn, toIndex) {
|
|
51201
|
+
const from = this._columnOf(item);
|
|
51202
|
+
const to = typeof toColumn === "string" ? this.columns.find((column) => this._columnKey(column) === toColumn) : toColumn;
|
|
51203
|
+
if (!from || !to || !this.columns.includes(to)) return false;
|
|
51204
|
+
const fromIndex = from.items.indexOf(item);
|
|
51205
|
+
const room = to.items.filter((el) => el !== item).length;
|
|
51206
|
+
const index = Math.max(0, Math.min(toIndex ?? room, room));
|
|
51207
|
+
if (from === to && index === fromIndex) {
|
|
51208
|
+
this._announce(this._t("components.task-board.no-change-text"));
|
|
51209
|
+
return false;
|
|
51210
|
+
}
|
|
51211
|
+
return this._move(item, from, fromIndex, to, index);
|
|
51212
|
+
}
|
|
51213
|
+
/** Fires nldd-move, says where the item landed and puts focus back on what
|
|
51214
|
+
* had it, once the app has moved the item in the handler. */
|
|
51215
|
+
_move(item, from, fromIndex, to, toIndex) {
|
|
51216
|
+
const focused = this._deepActiveElement();
|
|
51217
|
+
const hadFocus = !!focused && this._holds(item, focused);
|
|
51218
|
+
this.dispatchEvent(new CustomEvent("nldd-move", {
|
|
51219
|
+
detail: {
|
|
51220
|
+
item,
|
|
51221
|
+
fromColumn: this._columnKey(from),
|
|
51222
|
+
fromIndex,
|
|
51223
|
+
toColumn: this._columnKey(to),
|
|
51224
|
+
toIndex
|
|
51225
|
+
},
|
|
51226
|
+
bubbles: true,
|
|
51227
|
+
composed: true
|
|
51228
|
+
}));
|
|
51229
|
+
const total = to.items.filter((el) => el !== item).length + 1;
|
|
51230
|
+
this._announce(this._t("components.task-board.moved-text", {
|
|
51231
|
+
column: to.label,
|
|
51232
|
+
position: toIndex + 1,
|
|
51233
|
+
total
|
|
51234
|
+
}));
|
|
51235
|
+
if (hadFocus) requestAnimationFrame(() => {
|
|
51236
|
+
if (focused.isConnected) focused.focus();
|
|
51237
|
+
});
|
|
51238
|
+
return true;
|
|
51239
|
+
}
|
|
51240
|
+
_columnKey(column) {
|
|
51241
|
+
return column.value || column.text;
|
|
51242
|
+
}
|
|
51243
|
+
/** The column an element sits in as an item, if it is one in this board. */
|
|
51244
|
+
_columnOf(item) {
|
|
51245
|
+
const parent = item.parentElement;
|
|
51246
|
+
return parent instanceof NLDDTaskBoardColumn && parent.parentElement === this && !item.slot ? parent : null;
|
|
51247
|
+
}
|
|
51248
|
+
/** The item an event happened in: the child of a column it came through. */
|
|
51249
|
+
_itemFrom(event) {
|
|
51250
|
+
for (const node of event.composedPath()) {
|
|
51251
|
+
if (node instanceof HTMLElement && this._columnOf(node)) return node;
|
|
51252
|
+
if (node === this) break;
|
|
51253
|
+
}
|
|
51254
|
+
return null;
|
|
51255
|
+
}
|
|
51256
|
+
/** Whether `node` is in `item`, also inside the shadow root of an item such
|
|
51257
|
+
* as an nldd-card, where its own button takes the focus. */
|
|
51258
|
+
_holds(item, node) {
|
|
51259
|
+
let current = node;
|
|
51260
|
+
while (current) {
|
|
51261
|
+
if (current === item) return true;
|
|
51262
|
+
current = current.parentNode ?? (current instanceof ShadowRoot ? current.host : null);
|
|
51263
|
+
}
|
|
51264
|
+
return false;
|
|
51265
|
+
}
|
|
51266
|
+
_deepActiveElement() {
|
|
51267
|
+
let active = document.activeElement;
|
|
51268
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
51269
|
+
return active instanceof HTMLElement ? active : null;
|
|
51270
|
+
}
|
|
51271
|
+
_announce(message) {
|
|
51272
|
+
const region = this.shadowRoot?.querySelector(".task-board__announcer");
|
|
51273
|
+
if (!region) return;
|
|
51274
|
+
region.textContent = "";
|
|
51275
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
51276
|
+
region.textContent = message;
|
|
51277
|
+
}));
|
|
51278
|
+
}
|
|
51279
|
+
/** The release ends a drag, or an attempt at one, not a click on the item. */
|
|
51280
|
+
_swallowNextClick() {
|
|
51281
|
+
window.addEventListener("click", this._swallowClick, {
|
|
51282
|
+
capture: true,
|
|
51283
|
+
once: true
|
|
51284
|
+
});
|
|
51285
|
+
setTimeout(() => window.removeEventListener("click", this._swallowClick, { capture: true }), 0);
|
|
51286
|
+
}
|
|
51287
|
+
_endPress() {
|
|
51288
|
+
if (this._press?.timer) clearTimeout(this._press.timer);
|
|
51289
|
+
if (this._press?.denied) {
|
|
51290
|
+
this._deniedCursor?.remove();
|
|
51291
|
+
this._deniedCursor = null;
|
|
51292
|
+
this._deniedTimer = window.setTimeout(() => this._hideDenied(), DENIED_MS);
|
|
51293
|
+
}
|
|
51294
|
+
this._press = null;
|
|
51295
|
+
if (!this._drag) this._stopListening();
|
|
51296
|
+
}
|
|
51297
|
+
_stopListening() {
|
|
51298
|
+
window.removeEventListener("selectstart", this._preventSelect);
|
|
51299
|
+
window.removeEventListener("pointermove", this._onPointerMove);
|
|
51300
|
+
window.removeEventListener("pointerup", this._onPointerUp);
|
|
51301
|
+
window.removeEventListener("pointercancel", this._onPointerCancel);
|
|
51302
|
+
}
|
|
51303
|
+
_startDrag(x, y) {
|
|
51304
|
+
const press = this._press;
|
|
51305
|
+
const from = press && this._columnOf(press.item);
|
|
51306
|
+
if (!press || !from) return;
|
|
51307
|
+
if (this.readonly) {
|
|
51308
|
+
press.denied = true;
|
|
51309
|
+
this._deny(press.item);
|
|
51310
|
+
this._deniedCursor = this._cursorLayer("not-allowed");
|
|
51311
|
+
return;
|
|
51312
|
+
}
|
|
51313
|
+
const item = press.item;
|
|
51314
|
+
const rect = item.getBoundingClientRect();
|
|
51315
|
+
const ghost = item.cloneNode(true);
|
|
51316
|
+
ghost.removeAttribute("id");
|
|
51317
|
+
for (const name of ghost.getAttributeNames()) if (/focus|press|hover|active/i.test(name)) ghost.removeAttribute(name);
|
|
51318
|
+
ghost.setAttribute("aria-hidden", "true");
|
|
51319
|
+
ghost.inert = true;
|
|
51320
|
+
Object.assign(ghost.style, {
|
|
51321
|
+
position: "fixed",
|
|
51322
|
+
top: "0",
|
|
51323
|
+
left: "0",
|
|
51324
|
+
zIndex: "2147483647",
|
|
51325
|
+
width: `${rect.width}px`,
|
|
51326
|
+
height: `${rect.height}px`,
|
|
51327
|
+
margin: "0",
|
|
51328
|
+
boxSizing: "border-box",
|
|
51329
|
+
pointerEvents: "none",
|
|
51330
|
+
userSelect: "none",
|
|
51331
|
+
boxShadow: "var(--semantics-overlays-box-shadow)",
|
|
51332
|
+
borderRadius: this._cornerRadius(item)
|
|
51333
|
+
});
|
|
51334
|
+
document.body.append(ghost);
|
|
51335
|
+
item.setAttribute("data-task-board-dragging", "");
|
|
51336
|
+
document.getSelection()?.removeAllRanges();
|
|
51337
|
+
document.documentElement.style.setProperty("user-select", "none");
|
|
51338
|
+
document.documentElement.style.setProperty("-webkit-user-select", "none");
|
|
51339
|
+
window.addEventListener("touchmove", this._holdTouch, { passive: false });
|
|
51340
|
+
window.addEventListener("contextmenu", this._preventContextMenu);
|
|
51341
|
+
window.addEventListener("keydown", this._onDragKeyDown, true);
|
|
51342
|
+
for (const column of this.columns) column._dropState = "available";
|
|
51343
|
+
from._placeholder = item;
|
|
51344
|
+
this._grabbing = this._cursorLayer("grabbing");
|
|
51345
|
+
this._dragging = true;
|
|
51346
|
+
this._drag = {
|
|
51347
|
+
item,
|
|
51348
|
+
from,
|
|
51349
|
+
fromIndex: from.items.indexOf(item),
|
|
51350
|
+
ghost,
|
|
51351
|
+
offsetX: press.startX - rect.left,
|
|
51352
|
+
offsetY: press.startY - rect.top,
|
|
51353
|
+
x,
|
|
51354
|
+
y,
|
|
51355
|
+
target: null,
|
|
51356
|
+
index: 0,
|
|
51357
|
+
frame: requestAnimationFrame(this._scrollLoop),
|
|
51358
|
+
note: null,
|
|
51359
|
+
noteTimer: 0
|
|
51360
|
+
};
|
|
51361
|
+
this._follow();
|
|
51362
|
+
}
|
|
51363
|
+
/** The rounding of what an item draws: its own, or that of the first element
|
|
51364
|
+
* in its shadow root, where an nldd-card draws its surface. */
|
|
51365
|
+
_cornerRadius(item) {
|
|
51366
|
+
const own = getComputedStyle(item).borderRadius;
|
|
51367
|
+
const surface = item.shadowRoot?.firstElementChild;
|
|
51368
|
+
if (parseFloat(own) > 0 || !surface) return own;
|
|
51369
|
+
return getComputedStyle(surface).borderRadius;
|
|
51370
|
+
}
|
|
51371
|
+
/** Moves the ghost with the pointer and shows where it would land. */
|
|
51372
|
+
_follow() {
|
|
51373
|
+
const drag = this._drag;
|
|
51374
|
+
if (!drag) return;
|
|
51375
|
+
drag.ghost.style.transform = `translate(${drag.x - drag.offsetX}px, ${drag.y - drag.offsetY}px) rotate(2deg)`;
|
|
51376
|
+
const columns = this.columns;
|
|
51377
|
+
let target = null;
|
|
51378
|
+
let nearest = Infinity;
|
|
51379
|
+
const board = this._scroller.getBoundingClientRect();
|
|
51380
|
+
const inside = drag.x >= board.left && drag.x <= board.right && drag.y >= board.top && drag.y <= board.bottom;
|
|
51381
|
+
for (const column of inside ? columns : []) {
|
|
51382
|
+
const rect = column.getBoundingClientRect();
|
|
51383
|
+
const distance = drag.x < rect.left ? rect.left - drag.x : drag.x > rect.right ? drag.x - rect.right : 0;
|
|
51384
|
+
if (distance < nearest) {
|
|
51385
|
+
nearest = distance;
|
|
51386
|
+
target = column;
|
|
51387
|
+
}
|
|
51388
|
+
}
|
|
51389
|
+
const items = target ? target.items : [];
|
|
51390
|
+
let index = items.findIndex((el) => {
|
|
51391
|
+
const rect = el.getBoundingClientRect();
|
|
51392
|
+
return drag.y < rect.top + rect.height / 2;
|
|
51393
|
+
});
|
|
51394
|
+
if (index === -1) index = items.length;
|
|
51395
|
+
if (drag.target && drag.target !== target) {
|
|
51396
|
+
drag.target._dropIndex = null;
|
|
51397
|
+
drag.target._dropState = "available";
|
|
51398
|
+
}
|
|
51399
|
+
drag.target = target;
|
|
51400
|
+
drag.index = index;
|
|
51401
|
+
const returning = !target || target === drag.from && (index === drag.fromIndex || index === drag.fromIndex + 1);
|
|
51402
|
+
drag.from._returning = returning;
|
|
51403
|
+
if (target) {
|
|
51404
|
+
target._dropIndex = returning ? null : index;
|
|
51405
|
+
target._dropState = "over";
|
|
51406
|
+
}
|
|
51407
|
+
this._followReturnNote(inside);
|
|
51408
|
+
}
|
|
51409
|
+
/** Outside the board, after a moment, a note above the copy says a release
|
|
51410
|
+
* puts the item back; the placeholder that says so may be out of view. */
|
|
51411
|
+
_followReturnNote(inside) {
|
|
51412
|
+
const drag = this._drag;
|
|
51413
|
+
if (!drag) return;
|
|
51414
|
+
if (inside) {
|
|
51415
|
+
clearTimeout(drag.noteTimer);
|
|
51416
|
+
drag.noteTimer = 0;
|
|
51417
|
+
drag.note?.remove();
|
|
51418
|
+
drag.note = null;
|
|
51419
|
+
return;
|
|
51420
|
+
}
|
|
51421
|
+
if (!drag.note && !drag.noteTimer) drag.noteTimer = window.setTimeout(() => {
|
|
51422
|
+
if (this._drag !== drag) return;
|
|
51423
|
+
drag.note = this._note(this._t("components.task-board.drag-return-text"));
|
|
51424
|
+
this._followReturnNote(false);
|
|
51425
|
+
}, RETURN_NOTE_DELAY_MS);
|
|
51426
|
+
if (!drag.note) return;
|
|
51427
|
+
const x = drag.x - drag.offsetX + drag.ghost.offsetWidth / 2;
|
|
51428
|
+
const y = drag.y - drag.offsetY;
|
|
51429
|
+
drag.note.style.transform = `translate(${x}px, ${y}px) translate(-50%, calc(-100% - var(--primitives-space-8)))`;
|
|
51430
|
+
}
|
|
51431
|
+
_drop() {
|
|
51432
|
+
const drag = this._drag;
|
|
51433
|
+
if (!drag) return;
|
|
51434
|
+
const { item, from, fromIndex, target, index } = drag;
|
|
51435
|
+
this._endDrag();
|
|
51436
|
+
if (!target) {
|
|
51437
|
+
this._announce(this._t("components.task-board.drag-canceled-text"));
|
|
51438
|
+
return;
|
|
51439
|
+
}
|
|
51440
|
+
if (target === from && (index === fromIndex || index === fromIndex + 1)) {
|
|
51441
|
+
this._announce(this._t("components.task-board.no-change-text"));
|
|
51442
|
+
return;
|
|
51443
|
+
}
|
|
51444
|
+
this._move(item, from, fromIndex, target, target === from && index > fromIndex ? index - 1 : index);
|
|
51445
|
+
}
|
|
51446
|
+
_cancelDrag() {
|
|
51447
|
+
if (!this._drag) return;
|
|
51448
|
+
this._endDrag();
|
|
51449
|
+
this._announce(this._t("components.task-board.drag-canceled-text"));
|
|
51450
|
+
}
|
|
51451
|
+
_endDrag() {
|
|
51452
|
+
const drag = this._drag;
|
|
51453
|
+
if (!drag) return;
|
|
51454
|
+
cancelAnimationFrame(drag.frame);
|
|
51455
|
+
clearTimeout(drag.noteTimer);
|
|
51456
|
+
drag.note?.remove();
|
|
51457
|
+
drag.ghost.remove();
|
|
51458
|
+
drag.item.removeAttribute("data-task-board-dragging");
|
|
51459
|
+
if (drag.target) drag.target._dropIndex = null;
|
|
51460
|
+
for (const column of this.columns) column._dropState = null;
|
|
51461
|
+
drag.from._placeholder = null;
|
|
51462
|
+
drag.from._returning = false;
|
|
51463
|
+
this._grabbing?.remove();
|
|
51464
|
+
this._grabbing = null;
|
|
51465
|
+
document.documentElement.style.removeProperty("user-select");
|
|
51466
|
+
document.documentElement.style.removeProperty("-webkit-user-select");
|
|
51467
|
+
window.removeEventListener("touchmove", this._holdTouch);
|
|
51468
|
+
window.removeEventListener("contextmenu", this._preventContextMenu);
|
|
51469
|
+
window.removeEventListener("keydown", this._onDragKeyDown, true);
|
|
51470
|
+
this._dragging = false;
|
|
51471
|
+
this._drag = null;
|
|
51472
|
+
if (!this._press) this._stopListening();
|
|
51473
|
+
}
|
|
51474
|
+
/** A style in the document does not reach into shadow roots, where a
|
|
51475
|
+
* button or a link sets its own cursor. A layer over the whole viewport
|
|
51476
|
+
* does: the pointer is always over it. */
|
|
51477
|
+
_cursorLayer(cursor) {
|
|
51478
|
+
const layer = document.createElement("div");
|
|
51479
|
+
layer.setAttribute("aria-hidden", "true");
|
|
51480
|
+
Object.assign(layer.style, {
|
|
51481
|
+
position: "fixed",
|
|
51482
|
+
inset: "0",
|
|
51483
|
+
zIndex: "2147483646",
|
|
51484
|
+
cursor
|
|
51485
|
+
});
|
|
51486
|
+
document.body.append(layer);
|
|
51487
|
+
return layer;
|
|
51488
|
+
}
|
|
51489
|
+
/** Says at the item, and to a screen reader, that the board moves nothing,
|
|
51490
|
+
* and tells the app. */
|
|
51491
|
+
_deny(item) {
|
|
51492
|
+
this._hideDenied();
|
|
51493
|
+
const text = this._t("components.task-board.readonly-text");
|
|
51494
|
+
this._announce(text);
|
|
51495
|
+
const rect = item.getBoundingClientRect();
|
|
51496
|
+
const below = rect.top < SCROLL_EDGE;
|
|
51497
|
+
const note = this._note(text);
|
|
51498
|
+
Object.assign(note.style, {
|
|
51499
|
+
top: `${below ? rect.bottom : rect.top}px`,
|
|
51500
|
+
left: `${rect.left + rect.width / 2}px`,
|
|
51501
|
+
transform: `translate(-50%, ${below ? "var(--primitives-space-8)" : "calc(-100% - var(--primitives-space-8))"})`,
|
|
51502
|
+
maxWidth: `${rect.width}px`
|
|
51503
|
+
});
|
|
51504
|
+
this._deniedNote = note;
|
|
51505
|
+
this.dispatchEvent(new CustomEvent("nldd-move-denied", {
|
|
51506
|
+
detail: { item },
|
|
51507
|
+
bubbles: true,
|
|
51508
|
+
composed: true
|
|
51509
|
+
}));
|
|
51510
|
+
}
|
|
51511
|
+
/** A note in the look of a tooltip, over everything, for the eye only: what
|
|
51512
|
+
* it says, the board also says to a screen reader or in its own way. */
|
|
51513
|
+
_note(text) {
|
|
51514
|
+
const note = document.createElement("div");
|
|
51515
|
+
note.setAttribute("aria-hidden", "true");
|
|
51516
|
+
note.textContent = text;
|
|
51517
|
+
Object.assign(note.style, {
|
|
51518
|
+
position: "fixed",
|
|
51519
|
+
top: "0",
|
|
51520
|
+
left: "0",
|
|
51521
|
+
zIndex: "2147483647",
|
|
51522
|
+
boxSizing: "border-box",
|
|
51523
|
+
width: "max-content",
|
|
51524
|
+
padding: "var(--semantics-tooltips-padding-block) var(--semantics-tooltips-padding-inline)",
|
|
51525
|
+
borderRadius: "var(--semantics-tooltips-corner-radius)",
|
|
51526
|
+
boxShadow: "var(--semantics-tooltips-box-shadow)",
|
|
51527
|
+
backgroundColor: "var(--semantics-tooltips-background-color)",
|
|
51528
|
+
color: "var(--semantics-tooltips-content-color)",
|
|
51529
|
+
font: "var(--semantics-tooltips-font)",
|
|
51530
|
+
pointerEvents: "none"
|
|
51531
|
+
});
|
|
51532
|
+
document.body.append(note);
|
|
51533
|
+
return note;
|
|
51534
|
+
}
|
|
51535
|
+
_hideDenied() {
|
|
51536
|
+
clearTimeout(this._deniedTimer);
|
|
51537
|
+
this._deniedNote?.remove();
|
|
51538
|
+
this._deniedNote = null;
|
|
51539
|
+
this._deniedCursor?.remove();
|
|
51540
|
+
this._deniedCursor = null;
|
|
51541
|
+
}
|
|
51542
|
+
render() {
|
|
51543
|
+
return taskBoardTemplate(this);
|
|
51544
|
+
}
|
|
51545
|
+
}, _NLDDTaskBoard.styles = taskBoardStyles, _NLDDTaskBoard);
|
|
51546
|
+
__decorate([property({
|
|
51547
|
+
type: String,
|
|
51548
|
+
attribute: "accessible-label"
|
|
51549
|
+
})], NLDDTaskBoard.prototype, "accessibleLabel", void 0);
|
|
51550
|
+
__decorate([property({
|
|
51551
|
+
type: String,
|
|
51552
|
+
reflect: true
|
|
51553
|
+
})], NLDDTaskBoard.prototype, "height", void 0);
|
|
51554
|
+
__decorate([property({
|
|
51555
|
+
type: Boolean,
|
|
51556
|
+
reflect: true
|
|
51557
|
+
})], NLDDTaskBoard.prototype, "readonly", void 0);
|
|
51558
|
+
__decorate([query(".task-board")], NLDDTaskBoard.prototype, "_scroller", void 0);
|
|
51559
|
+
__decorate([state()], NLDDTaskBoard.prototype, "_canScrollLeft", void 0);
|
|
51560
|
+
__decorate([state()], NLDDTaskBoard.prototype, "_canScrollRight", void 0);
|
|
51561
|
+
__decorate([state()], NLDDTaskBoard.prototype, "_dragging", void 0);
|
|
51562
|
+
NLDDTaskBoard = __decorate([customElement("nldd-task-board")], NLDDTaskBoard);
|
|
49236
51563
|
// src/components/lists-and-tables/list-item-segment/list-item-segment.styles.ts
|
|
49237
51564
|
var listItemSegmentStyles = css`
|
|
49238
51565
|
:host {
|
|
@@ -52439,8 +54766,12 @@ function template$3(helpers) {
|
|
|
52439
54766
|
const linkHint = hintKey ? this._t(`components.link.${hintKey}`) : "";
|
|
52440
54767
|
const ariaLabel = this.accessibleLabel ? [this.accessibleLabel, linkHint].filter(Boolean).join(", ") : nothing;
|
|
52441
54768
|
const renderLinkHint = !!linkHint && !this.accessibleLabel;
|
|
52442
|
-
|
|
52443
|
-
|
|
54769
|
+
const hasStartIcon = !!this.startIcon || this._hasStartSlot;
|
|
54770
|
+
const hasEndIcon = !!this.endIcon || this._hasEndSlot;
|
|
54771
|
+
const startIcon = this.startIcon ? html`<span class="link__start-icon"><nldd-icon icon=${this.startIcon}></nldd-icon></span>` : html`<slot name="start-icon" @slotchange=${helpers.handleSlotChange}></slot>`;
|
|
54772
|
+
const endIcon = this.endIcon ? html`<span class="link__end-icon"><nldd-icon icon=${this.endIcon}></nldd-icon></span>` : html`<slot name="end-icon" @slotchange=${helpers.handleSlotChange}></slot>`;
|
|
54773
|
+
const label = html`<span class="link__label">${this.text ? this.text : html`<slot></slot>`}</span>`;
|
|
54774
|
+
return html`<a class="link"
|
|
52444
54775
|
href=${this.disabled ? nothing : this.href || nothing}
|
|
52445
54776
|
role=${this.disabled ? "link" : nothing}
|
|
52446
54777
|
tabindex=${this.noTab ? "-1" : this.disabled ? "0" : nothing}
|
|
@@ -52450,16 +54781,7 @@ function template$3(helpers) {
|
|
|
52450
54781
|
aria-disabled=${this.disabled ? "true" : nothing}
|
|
52451
54782
|
aria-label=${ariaLabel}
|
|
52452
54783
|
@click=${helpers.handleClick}
|
|
52453
|
-
|
|
52454
|
-
${this.startIcon ? html`
|
|
52455
|
-
<span class="link__start-icon"><nldd-icon icon=${this.startIcon}></nldd-icon></span>
|
|
52456
|
-
` : html`<slot name="start-icon"></slot>`}
|
|
52457
|
-
<span class="link__label">${this.text ? this.text : html`<slot></slot>`}</span>
|
|
52458
|
-
${this.endIcon ? html`
|
|
52459
|
-
<span class="link__end-icon"><nldd-icon icon=${this.endIcon}></nldd-icon></span>
|
|
52460
|
-
` : html`<slot name="end-icon"></slot>`}${renderLinkHint ? html`<span class="link__link-hint">, ${linkHint}</span>` : nothing}
|
|
52461
|
-
</a>
|
|
52462
|
-
`;
|
|
54784
|
+
>${startIcon}${hasStartIcon ? " " : nothing}${label}${hasEndIcon ? " " : nothing}${endIcon}${renderLinkHint ? html`<span class="link__link-hint">, ${linkHint}</span>` : nothing}</a>`;
|
|
52463
54785
|
}
|
|
52464
54786
|
// src/components/navigation/link/link.i18n.ts
|
|
52465
54787
|
var nlddLinkTranslations = {
|
|
@@ -52519,6 +54841,14 @@ var _NLDDLink = class NLDDLink extends withTranslations(LitElement, nlddLinkTran
|
|
|
52519
54841
|
this.accessibleLabel = "";
|
|
52520
54842
|
this.disabled = false;
|
|
52521
54843
|
this.noTab = false;
|
|
54844
|
+
this._hasStartSlot = false;
|
|
54845
|
+
this._hasEndSlot = false;
|
|
54846
|
+
}
|
|
54847
|
+
_handleSlotChange(e) {
|
|
54848
|
+
const slot = e.target;
|
|
54849
|
+
const filled = slot.assignedNodes().length > 0;
|
|
54850
|
+
if (slot.name === "start-icon") this._hasStartSlot = filled;
|
|
54851
|
+
else this._hasEndSlot = filled;
|
|
52522
54852
|
}
|
|
52523
54853
|
_handleClick(e) {
|
|
52524
54854
|
if (this.disabled) {
|
|
@@ -52527,7 +54857,10 @@ var _NLDDLink = class NLDDLink extends withTranslations(LitElement, nlddLinkTran
|
|
|
52527
54857
|
}
|
|
52528
54858
|
}
|
|
52529
54859
|
render() {
|
|
52530
|
-
return template$3.call(this, {
|
|
54860
|
+
return template$3.call(this, {
|
|
54861
|
+
handleClick: this._handleClick.bind(this),
|
|
54862
|
+
handleSlotChange: this._handleSlotChange.bind(this)
|
|
54863
|
+
});
|
|
52531
54864
|
}
|
|
52532
54865
|
};
|
|
52533
54866
|
var NLDDLink = (_NLDDLink.styles = linkStyles, _NLDDLink);
|
|
@@ -52567,6 +54900,8 @@ __decorate([property({
|
|
|
52567
54900
|
reflect: true,
|
|
52568
54901
|
attribute: "no-tab"
|
|
52569
54902
|
})], NLDDLink.prototype, "noTab", void 0);
|
|
54903
|
+
__decorate([state()], NLDDLink.prototype, "_hasStartSlot", void 0);
|
|
54904
|
+
__decorate([state()], NLDDLink.prototype, "_hasEndSlot", void 0);
|
|
52570
54905
|
NLDDLink = __decorate([customElement("nldd-link")], NLDDLink);
|
|
52571
54906
|
// src/components/navigation/skip-link/skip-link.styles.ts
|
|
52572
54907
|
var skipLinkStyles = css`
|
|
@@ -53565,7 +55900,7 @@ async function loadDependencies() {
|
|
|
53565
55900
|
Promise.resolve().then(() => list_item_exports),
|
|
53566
55901
|
Promise.resolve().then(() => text_cell_exports),
|
|
53567
55902
|
Promise.resolve().then(() => icon_cell_exports),
|
|
53568
|
-
import("./icon-
|
|
55903
|
+
import("./icon-DRpTWSIg.js").then((n) => n.n)
|
|
53569
55904
|
]);
|
|
53570
55905
|
}
|
|
53571
55906
|
/** The rows of a level, read from its container: the global menu bar's items
|
|
@@ -54252,7 +56587,7 @@ function tabBarTemplate(component) {
|
|
|
54252
56587
|
<nldd-icon-button
|
|
54253
56588
|
appearance="neutral-tinted"
|
|
54254
56589
|
no-highlight-border
|
|
54255
|
-
icon="
|
|
56590
|
+
icon="chevron-down-small"
|
|
54256
56591
|
text=${component._t("components.tab-bar.overflow-action")}
|
|
54257
56592
|
size=${component.size}
|
|
54258
56593
|
?hide-lg-text=${component.variant !== "icon-and-text"}
|
|
@@ -62008,4 +64343,4 @@ __decorate([property({
|
|
|
62008
64343
|
attribute: "no-arrow"
|
|
62009
64344
|
})], NLDDJustInTimeEducation.prototype, "noArrow", void 0);
|
|
62010
64345
|
NLDDJustInTimeEducation = _NLDDJustInTimeEducation = __decorate([customElement("nldd-just-in-time-education")], NLDDJustInTimeEducation);
|
|
62011
|
-
export { NLDDActivityIndicator, NLDDAvatar, NLDDAvatarGroup, NLDDBadge, NLDDBanner, NLDDBarSplitView, NLDDBlockquote, NLDDBox, NLDDBreadcrumbs, NLDDBreadcrumbsItem, NLDDButton, NLDDButtonBar, NLDDButtonGroup, NLDDCard, NLDDCell, NLDDCheckbox, NLDDCheckboxField, NLDDCodeEditor, NLDDCodeViewer, NLDDCollection, NLDDComboBox, NLDDContainer, NLDDDateField, NLDDDatePicker, NLDDDescriptionCell, NLDDDivider, NLDDDocumentTabBar, NLDDDragHandleCell, NLDDDropdown, NLDDFileField, NLDDForm, NLDDFormActions, NLDDFormField, NLDDFormSection, NLDDFullBleedSection, NLDDHero, NLDDIcon, NLDDIconButton, NLDDIconCell, NLDDIdentity, NLDDImage, NLDDInlineDialog, NLDDJustInTimeEducation, NLDDKeyboardShortcut, NLDDLink, NLDDList, NLDDListItem, NLDDListItemSegment, NLDDMenu, NLDDMenuBar, NLDDMenuBarItem, NLDDModalDialog, NLDDMultiLineTextField, NLDDNavigationSplitView, NLDDNotification, NLDDNumberField, NLDDOneHalfOneHalfSection, NLDDOneThirdTwoThirdsSection, NLDDPage, NLDDPageFooter, NLDDPageFooterLegalBar, NLDDPageFooterLegalBarItem, NLDDPagination, NLDDPasswordField, NLDDPopover, NLDDProgressBar, NLDDProgressBarSegmentIndicator, NLDDProgressCircle, NLDDProgressCircleSegmentIndicator, NLDDRadioButton, NLDDRadioButtonField, NLDDRadioButtonGroup, NLDDRichText, NLDDSearchField, NLDDSegmentedControl, NLDDSheet, NLDDShell, NLDDSideBySideSplitView, NLDDSidebarSection, NLDDSimpleSection, NLDDSkipLink, NLDDSpacer, NLDDSpacerCell, NLDDSplitButton, NLDDSplitViewDivider, NLDDSplitViewPane, NLDDStackedSplitView, NLDDStatusBar, NLDDStepBar, NLDDStepBarItem, NLDDStepCell, NLDDStepper, NLDDSwitch, NLDDSwitchField, NLDDTabBar, NLDDTable, NLDDTableRow, NLDDTag, NLDDText, NLDDTextCell, NLDDTextEditor, NLDDTextField, NLDDTimeField, NLDDTimePicker, NLDDTitle, NLDDTitleCell, NLDDToggleButton, NLDDToggleButtonGroup, NLDDToken, NLDDTokenField, NLDDToolbar, NLDDTooltip, NLDDTopNavigationBar, NLDDTopTitleBar, NLDDTwoThirdsOneThirdSection, NLDDValidationList, NLDDVisuallyHidden, NLDDWindow, setTranslations };
|
|
64346
|
+
export { NLDDActivityIndicator, NLDDAvatar, NLDDAvatarGroup, NLDDBadge, NLDDBanner, NLDDBarSplitView, NLDDBlockquote, NLDDBox, NLDDBreadcrumbs, NLDDBreadcrumbsItem, NLDDButton, NLDDButtonBar, NLDDButtonGroup, NLDDCard, NLDDCell, NLDDCheckbox, NLDDCheckboxField, NLDDCodeEditor, NLDDCodeViewer, NLDDCollection, NLDDComboBox, NLDDContainer, NLDDDateField, NLDDDatePicker, NLDDDescriptionCell, NLDDDivider, NLDDDocumentTabBar, NLDDDragHandleCell, NLDDDropdown, NLDDFileField, NLDDForm, NLDDFormActions, NLDDFormField, NLDDFormSection, NLDDFullBleedSection, NLDDHero, NLDDIcon, NLDDIconButton, NLDDIconCell, NLDDIdentity, NLDDImage, NLDDInlineDialog, NLDDJustInTimeEducation, NLDDKeyboardShortcut, NLDDLink, NLDDList, NLDDListItem, NLDDListItemSegment, NLDDMenu, NLDDMenuBar, NLDDMenuBarItem, NLDDModalDialog, NLDDMultiLineTextField, NLDDNavigationSplitView, NLDDNotification, NLDDNumberField, NLDDOneHalfOneHalfSection, NLDDOneThirdTwoThirdsSection, NLDDPage, NLDDPageFooter, NLDDPageFooterLegalBar, NLDDPageFooterLegalBarItem, NLDDPagination, NLDDPasswordField, NLDDPopover, NLDDProgressBar, NLDDProgressBarSegmentIndicator, NLDDProgressCircle, NLDDProgressCircleSegmentIndicator, NLDDRadioButton, NLDDRadioButtonField, NLDDRadioButtonGroup, NLDDRichText, NLDDSearchField, NLDDSegmentedControl, NLDDSheet, NLDDShell, NLDDSideBySideSplitView, NLDDSidebarSection, NLDDSimpleSection, NLDDSkipLink, NLDDSlider, NLDDSpacer, NLDDSpacerCell, NLDDSplitButton, NLDDSplitViewDivider, NLDDSplitViewPane, NLDDStackedSplitView, NLDDStatusBar, NLDDStepBar, NLDDStepBarItem, NLDDStepCell, NLDDStepper, NLDDSwitch, NLDDSwitchField, NLDDTabBar, NLDDTable, NLDDTableRow, NLDDTag, NLDDTaskBoard, NLDDTaskBoardColumn, NLDDText, NLDDTextCell, NLDDTextEditor, NLDDTextField, NLDDTimeField, NLDDTimePicker, NLDDTitle, NLDDTitleCell, NLDDToggleButton, NLDDToggleButtonGroup, NLDDToken, NLDDTokenField, NLDDToolbar, NLDDTooltip, NLDDTopNavigationBar, NLDDTopTitleBar, NLDDTwoThirdsOneThirdSection, NLDDValidationList, NLDDVisuallyHidden, NLDDWindow, setTranslations };
|