@nordhealth/components 1.0.0 → 1.1.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/README.md +29 -1
- package/custom-elements.json +795 -588
- package/lib/Avatar.js +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Badge.js +1 -1
- package/lib/Badge.js.map +1 -1
- package/lib/Banner.js +1 -1
- package/lib/Banner.js.map +1 -1
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/Calendar-73a2fcfd.js +2 -0
- package/lib/Calendar-73a2fcfd.js.map +1 -0
- package/lib/Calendar.js +1 -1
- package/lib/Card.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/Checkbox.js.map +1 -1
- package/lib/CommandMenu.js +1 -1
- package/lib/CommandMenu.js.map +1 -1
- package/lib/CommandMenuAction.js +1 -1
- package/lib/CommandMenuAction.js.map +1 -1
- package/lib/{Component-9d373ef3.js → Component-fa316972.js} +2 -2
- package/lib/Component-fa316972.js.map +1 -0
- package/lib/DatePicker.js +1 -1
- package/lib/DatePicker.js.map +1 -1
- package/lib/DateSelectEvent.js.map +1 -1
- package/lib/DirectionController-8b298382.js +2 -0
- package/lib/DirectionController-8b298382.js.map +1 -0
- package/lib/DraftComponentMixin-9e4b7b34.js.map +1 -1
- package/lib/Dropdown.js +1 -1
- package/lib/Dropdown.js.map +1 -1
- package/lib/DropdownGroup.js +1 -1
- package/lib/DropdownGroup.js.map +1 -1
- package/lib/DropdownItem.js +1 -1
- package/lib/DropdownItem.js.map +1 -1
- package/lib/EmptyState.js +1 -1
- package/lib/EmptyState.js.map +1 -1
- package/lib/EventController-d99ebeef.js.map +1 -1
- package/lib/Fieldset.js +1 -1
- package/lib/Fieldset.js.map +1 -1
- package/lib/FocusableMixin-4c85ced9.js +2 -0
- package/lib/{FocusableMixin-ebb67709.js.map → FocusableMixin-4c85ced9.js.map} +1 -1
- package/lib/FormAssociatedMixin-9d38814c.js +2 -0
- package/lib/FormAssociatedMixin-9d38814c.js.map +1 -0
- package/lib/{FormField-50bd73d5.js → FormField-44e865a4.js} +2 -2
- package/lib/FormField-44e865a4.js.map +1 -0
- package/lib/Header.js +1 -1
- package/lib/Header.js.map +1 -1
- package/lib/Icon.js +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/{InputMixin-94d15730.js → InputMixin-84ca72ae.js} +2 -2
- package/lib/InputMixin-84ca72ae.js.map +1 -0
- package/lib/KeyboardController.js +1 -1
- package/lib/KeyboardController.js.map +1 -1
- package/lib/Layout.js +1 -1
- package/lib/Layout.js.map +1 -1
- package/lib/LightDismissController-a2645ae6.js +2 -0
- package/lib/LightDismissController-a2645ae6.js.map +1 -0
- package/lib/LightDomController-e0762f0d.js +2 -0
- package/lib/LightDomController-e0762f0d.js.map +1 -0
- package/lib/LocalizeController.js +1 -1
- package/lib/LocalizeController.js.map +1 -1
- package/lib/NavGroup.js +1 -1
- package/lib/NavGroup.js.map +1 -1
- package/lib/NavItem.js +1 -1
- package/lib/NavItem.js.map +1 -1
- package/lib/Navigation.js +1 -1
- package/lib/Navigation.js.map +1 -1
- package/lib/Popout.js +1 -1
- package/lib/Popout.js.map +1 -1
- package/lib/ProgressBar.js +1 -1
- package/lib/ProgressBar.js.map +1 -1
- package/lib/Radio.js +1 -1
- package/lib/Radio.js.map +1 -1
- package/lib/Select.js +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/SelectEvent.js.map +1 -1
- package/lib/ShortcutController-87615e31.js +2 -0
- package/lib/ShortcutController-87615e31.js.map +1 -0
- package/lib/SlotController-ea6eff46.js +2 -0
- package/lib/SlotController-ea6eff46.js.map +1 -0
- package/lib/Spinner.js +1 -1
- package/lib/Spinner.js.map +1 -1
- package/lib/Stack.js +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/Table.js +1 -1
- package/lib/Table.js.map +1 -1
- package/lib/TextField-f8848f28.js +2 -0
- package/lib/TextField-f8848f28.js.map +1 -0
- package/lib/Textarea.js +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/Tooltip.js.map +1 -1
- package/lib/VisuallyHidden.js +1 -1
- package/lib/VisuallyHidden.js.map +1 -1
- package/lib/bundle.js +17 -26
- package/lib/bundle.js.map +1 -1
- package/lib/{class-map-87423405.js → class-map-9e39244c.js} +2 -2
- package/lib/{class-map-87423405.js.map → class-map-9e39244c.js.map} +1 -1
- package/lib/collection-800f5002.js.map +1 -1
- package/lib/cond-ed8742b5.js +2 -0
- package/lib/cond-ed8742b5.js.map +1 -0
- package/lib/date-adapter.js +1 -1
- package/lib/date-adapter.js.map +1 -1
- package/lib/dates-56f73760.js +2 -0
- package/lib/dates-56f73760.js.map +1 -0
- package/lib/directive-de55b00a.js.map +1 -1
- package/lib/en-us.js.map +1 -1
- package/lib/events-731d0007.js.map +1 -1
- package/lib/fi-fi.js.map +1 -1
- package/lib/fsm-50373df9.js.map +1 -1
- package/lib/if-defined-4d1db15c.js +7 -0
- package/lib/{if-defined-fe657a02.js.map → if-defined-4d1db15c.js.map} +1 -1
- package/lib/index.js +1 -1
- package/lib/{lit-element-74b6bb4b.js → lit-element-e382250e.js} +3 -3
- package/lib/{lit-element-74b6bb4b.js.map → lit-element-e382250e.js.map} +1 -1
- package/lib/localization.js.map +1 -1
- package/lib/localization2.js.map +1 -1
- package/lib/localization3.js.map +1 -1
- package/lib/month-view.js +1 -1
- package/lib/month-view.js.map +1 -1
- package/lib/number-1c122a1e.js +7 -0
- package/lib/{number-3a8ef88a.js.map → number-1c122a1e.js.map} +1 -1
- package/lib/observe-a9c6dfb6.js +2 -0
- package/lib/observe-a9c6dfb6.js.map +1 -0
- package/lib/positioning-763efb3a.js +2 -0
- package/lib/positioning-763efb3a.js.map +1 -0
- package/lib/query-assigned-elements-ef860822.js +12 -0
- package/lib/query-assigned-elements-ef860822.js.map +1 -0
- package/lib/{ref-7d028e3a.js → ref-adf41565.js} +3 -3
- package/lib/ref-adf41565.js.map +1 -0
- package/lib/src/avatar/Avatar.d.ts +2 -2
- package/lib/src/calendar/Calendar.d.ts +3 -3
- package/lib/src/command-menu/CommandMenu.d.ts +4 -3
- package/lib/src/command-menu/CommandMenuAction.d.ts +3 -4
- package/lib/src/command-menu/SelectEvent.d.ts +1 -1
- package/lib/src/common/decorators/observe.d.ts +3 -0
- package/lib/src/common/directives/cond.d.ts +29 -7
- package/lib/src/common/fsm.d.ts +5 -3
- package/lib/src/common/mixins/InputMixin.d.ts +1 -1
- package/lib/src/fieldset/Fieldset.test.d.ts +2 -0
- package/lib/src/icon/Icon.d.ts +3 -4
- package/lib/src/nav-group/NavGroup.d.ts +2 -4
- package/lib/src/nav-item/NavItem.d.ts +1 -1
- package/lib/src/popout/Popout.d.ts +6 -5
- package/lib/src/radio/Radio.d.ts +1 -1
- package/lib/src/textarea/Textarea.d.ts +2 -3
- package/lib/src/tooltip/Tooltip.d.ts +3 -6
- package/lib/translation.js.map +1 -1
- package/lib/unsafe-html-76575c49.js +7 -0
- package/lib/{unsafe-html-989a642b.js.map → unsafe-html-76575c49.js.map} +1 -1
- package/package.json +15 -15
- package/lib/Calendar-d1632bb6.js +0 -2
- package/lib/Calendar-d1632bb6.js.map +0 -1
- package/lib/Component-9d373ef3.js.map +0 -1
- package/lib/DirectionController-b267af23.js +0 -2
- package/lib/DirectionController-b267af23.js.map +0 -1
- package/lib/FocusableMixin-ebb67709.js +0 -2
- package/lib/FormAssociatedMixin-1f97ed66.js +0 -2
- package/lib/FormAssociatedMixin-1f97ed66.js.map +0 -1
- package/lib/FormField-50bd73d5.js.map +0 -1
- package/lib/InputMixin-94d15730.js.map +0 -1
- package/lib/LightDismissController-a35d0f66.js +0 -2
- package/lib/LightDismissController-a35d0f66.js.map +0 -1
- package/lib/LightDomController-011334da.js +0 -2
- package/lib/LightDomController-011334da.js.map +0 -1
- package/lib/ShortcutController-93173ff4.js +0 -2
- package/lib/ShortcutController-93173ff4.js.map +0 -1
- package/lib/SlotController-683d0e7c.js +0 -2
- package/lib/SlotController-683d0e7c.js.map +0 -1
- package/lib/TextField-9bee8388.js +0 -2
- package/lib/TextField-9bee8388.js.map +0 -1
- package/lib/dates-9272b910.js +0 -2
- package/lib/dates-9272b910.js.map +0 -1
- package/lib/if-defined-fe657a02.js +0 -7
- package/lib/number-3a8ef88a.js +0 -7
- package/lib/positioning-72899e14.js +0 -2
- package/lib/positioning-72899e14.js.map +0 -1
- package/lib/query-assigned-elements-37b095c4.js +0 -26
- package/lib/query-assigned-elements-37b095c4.js.map +0 -1
- package/lib/ref-7d028e3a.js.map +0 -1
- package/lib/unsafe-html-989a642b.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
3
|
* Popouts are small overlays that open on demand. They let users access additional content and actions without cluttering the page.
|
|
4
4
|
*
|
|
@@ -10,6 +10,8 @@ export default class Popout extends LitElement {
|
|
|
10
10
|
static styles: import("lit").CSSResult[];
|
|
11
11
|
private targetElement;
|
|
12
12
|
private cleanupAutoUpdate?;
|
|
13
|
+
private breakpoint;
|
|
14
|
+
private viewportObserver;
|
|
13
15
|
/**
|
|
14
16
|
* Handle dismissal of the popout, clicking outside the target button and popout.
|
|
15
17
|
*/
|
|
@@ -17,6 +19,7 @@ export default class Popout extends LitElement {
|
|
|
17
19
|
private direction;
|
|
18
20
|
private open;
|
|
19
21
|
private computedPosition?;
|
|
22
|
+
private smallViewport;
|
|
20
23
|
/**
|
|
21
24
|
* Set the alignment of the popout in relation to the toggle depending on the position.
|
|
22
25
|
* `start` will align the left of the popout to the left of the toggle.
|
|
@@ -50,13 +53,11 @@ export default class Popout extends LitElement {
|
|
|
50
53
|
* Position the popout on load.
|
|
51
54
|
*/
|
|
52
55
|
firstUpdated(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Check if the popout has an id, warn them if not
|
|
55
|
-
*/
|
|
56
|
-
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
57
56
|
connectedCallback(): void;
|
|
58
57
|
disconnectedCallback(): void;
|
|
59
58
|
render(): import("lit-html").TemplateResult<1>;
|
|
59
|
+
protected handleIdChange(): void;
|
|
60
|
+
protected handleOpenChange(): void;
|
|
60
61
|
/**
|
|
61
62
|
* Get the position of the element toggling the popout
|
|
62
63
|
* and position the popout underneath it, taking into account the optional placement.
|
package/lib/src/radio/Radio.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export default class Radio extends Radio_base {
|
|
|
29
29
|
* Controls whether the checkbox is checked or not.
|
|
30
30
|
*/
|
|
31
31
|
checked: boolean;
|
|
32
|
-
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
33
32
|
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
protected handleCheckedChange(previousChecked: boolean): void;
|
|
34
34
|
private uncheckSiblings;
|
|
35
35
|
protected handleChange(e: Event): void;
|
|
36
36
|
private handleBlur;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
2
|
declare const Textarea_base: (new (...args: any[]) => import("../common/mixins/FormAssociatedMixin.js").FormAssociatedMixinInterface) & (new (...args: any[]) => import("../common/mixins/InputMixin.js").InputMixinInterface) & (new (...args: any[]) => import("../common/mixins/FocusableMixin.js").FocusableMixinInterface) & typeof LitElement;
|
|
3
3
|
/**
|
|
4
4
|
* Textarea is a component that allows user to write text over
|
|
@@ -20,9 +20,8 @@ export default class Textarea extends Textarea_base {
|
|
|
20
20
|
* Set to "auto" to enable auto-resizing as content grows.
|
|
21
21
|
*/
|
|
22
22
|
resize: "vertical" | "auto";
|
|
23
|
-
updated(changedProperties: PropertyValues<this>): void;
|
|
24
23
|
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
-
|
|
24
|
+
protected resizeToFitContent(): void;
|
|
26
25
|
}
|
|
27
26
|
declare global {
|
|
28
27
|
interface HTMLElementTagNameMap {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
3
|
* Tooltips are floating containers for displaying additional information
|
|
4
4
|
* for the currently focused element. A tooltip can be useful when you want
|
|
@@ -51,12 +51,9 @@ export default class Tooltip extends LitElement {
|
|
|
51
51
|
* Apply all event listeners
|
|
52
52
|
*/
|
|
53
53
|
connectedCallback(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Check if the tooltip has an id, warn them if not
|
|
56
|
-
*/
|
|
57
|
-
willUpdate(changedProperties: PropertyValues): void;
|
|
58
54
|
render(): import("lit-html").TemplateResult<1>;
|
|
59
|
-
|
|
55
|
+
protected handleIdChange(): void;
|
|
56
|
+
private handleStateChange;
|
|
60
57
|
/**
|
|
61
58
|
* Setting and updating the position of the tooltip
|
|
62
59
|
*/
|
package/lib/translation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.js","sources":["../src/localization/translation.ts"],"sourcesContent":["import en from \"./en-us.js\"\n\n// gets list of properties beginning prefix\ntype PickStartsWith<Type, Prefix extends string> = {\n [Property in keyof Type]: Property extends `${Prefix}${string}` ? Property : never\n}[keyof Type]\n\nexport type Translation = typeof en\nexport type WellKnownKeys = PickStartsWith<Translation, \"$\">\n\nconst subscribers = new Set<() => void>()\nconst translations = new Map<string, Translation>()\n\nfunction update() {\n for (const subscriber of subscribers) {\n subscriber()\n }\n}\n\n// observe changes to the document's lang\nconst observer = new MutationObserver(update)\nobserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"lang\"],\n})\n\n/**\n * Removes all registered translations\n */\nexport function clearTranslations() {\n translations.clear()\n}\n\n/**\n * Registers one or more translations\n */\nexport function registerTranslation(...translation: Translation[]) {\n translation.forEach(t => {\n const lang = t.$lang.toLowerCase()\n translations.set(lang, t)\n })\n\n update()\n}\n\n/**\n * subscribe to language changes\n * @param onChange callback for when either `lang` attr changes, or a new language is registered.\n * @returns cleanup function\n */\nexport function subscribe(onChange: () => void): () => void {\n subscribers.add(onChange)\n return () => subscribers.delete(onChange)\n}\n\n/**\n * Check whether there is a translation registered for the given lang\n * @param lang the lang code e.g. \"en\" or \"en-GB\"\n */\nexport function isTranslationRegistered(lang: string) {\n return translations.has(lang)\n}\n\n/**\n * Picks the most appropriate translation for the given language, from most specific to least specific.\n * First tries lang + region, then lang only, then fallback.\n */\nexport function resolveTranslation(langCode: string): Translation {\n const lang = langCode.toLowerCase()\n const [langOnly] = lang.split(\"-\")\n\n return translations.get(lang) || translations.get(langOnly) || en\n}\n"],"names":["subscribers","Set","translations","Map","update","subscriber","clearTranslations","clear","registerTranslation","translation","forEach","t","lang","$lang","toLowerCase","set","subscribe","onChange","add","delete","isTranslationRegistered","has","resolveTranslation","langCode","langOnly","split","get","en","MutationObserver","observe","document","documentElement","attributes","attributeFilter"],"mappings":"0GAUA,MAAMA,EAAc,IAAIC,IAClBC,EAAe,IAAIC,IAEzB,SAASC,IACP,IAAK,MAAMC,KAAcL,EACvBK,aAcYC,IACdJ,EAAaK,
|
|
1
|
+
{"version":3,"file":"translation.js","sources":["../src/localization/translation.ts"],"sourcesContent":["import en from \"./en-us.js\"\n\n// gets list of properties beginning prefix\ntype PickStartsWith<Type, Prefix extends string> = {\n [Property in keyof Type]: Property extends `${Prefix}${string}` ? Property : never\n}[keyof Type]\n\nexport type Translation = typeof en\nexport type WellKnownKeys = PickStartsWith<Translation, \"$\">\n\nconst subscribers = new Set<() => void>()\nconst translations = new Map<string, Translation>()\n\nfunction update() {\n for (const subscriber of subscribers) {\n subscriber()\n }\n}\n\n// observe changes to the document's lang\nconst observer = new MutationObserver(update)\nobserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"lang\"],\n})\n\n/**\n * Removes all registered translations\n */\nexport function clearTranslations() {\n translations.clear()\n}\n\n/**\n * Registers one or more translations\n */\nexport function registerTranslation(...translation: Translation[]) {\n translation.forEach(t => {\n const lang = t.$lang.toLowerCase()\n translations.set(lang, t)\n })\n\n update()\n}\n\n/**\n * subscribe to language changes\n * @param onChange callback for when either `lang` attr changes, or a new language is registered.\n * @returns cleanup function\n */\nexport function subscribe(onChange: () => void): () => void {\n subscribers.add(onChange)\n return () => subscribers.delete(onChange)\n}\n\n/**\n * Check whether there is a translation registered for the given lang\n * @param lang the lang code e.g. \"en\" or \"en-GB\"\n */\nexport function isTranslationRegistered(lang: string) {\n return translations.has(lang)\n}\n\n/**\n * Picks the most appropriate translation for the given language, from most specific to least specific.\n * First tries lang + region, then lang only, then fallback.\n */\nexport function resolveTranslation(langCode: string): Translation {\n const lang = langCode.toLowerCase()\n const [langOnly] = lang.split(\"-\")\n\n return translations.get(lang) || translations.get(langOnly) || en\n}\n"],"names":["subscribers","Set","translations","Map","update","subscriber","clearTranslations","clear","registerTranslation","translation","forEach","t","lang","$lang","toLowerCase","set","subscribe","onChange","add","delete","isTranslationRegistered","has","resolveTranslation","langCode","langOnly","split","get","en","MutationObserver","observe","document","documentElement","attributes","attributeFilter"],"mappings":"0GAUA,MAAMA,EAAc,IAAIC,IAClBC,EAAe,IAAIC,IAEzB,SAASC,IACP,IAAK,MAAMC,KAAcL,EACvBK,aAcYC,IACdJ,EAAaK,QAMC,SAAAC,KAAuBC,GACrCA,EAAYC,SAAQC,IAClB,MAAMC,EAAOD,EAAEE,MAAMC,cACrBZ,EAAaa,IAAIH,EAAMD,MAGzBP,IAQI,SAAUY,EAAUC,GAExB,OADAjB,EAAYkB,IAAID,GACT,IAAMjB,EAAYmB,OAAOF,GAO5B,SAAUG,EAAwBR,GACtC,OAAOV,EAAamB,IAAIT,GAOpB,SAAUU,EAAmBC,GACjC,MAAMX,EAAOW,EAAST,eACfU,GAAYZ,EAAKa,MAAM,KAE9B,OAAOvB,EAAawB,IAAId,IAASV,EAAawB,IAAIF,IAAaG,EAnDhD,IAAIC,iBAAiBxB,GAC7ByB,QAAQC,SAASC,gBAAiB,CACzCC,YAAY,EACZC,gBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{w as t,b as r}from"./lit-element-e382250e.js";import{e,i,t as s}from"./directive-de55b00a.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/class n extends i{constructor(r){if(super(r),this.it=t,r.type!==s.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===t||null==e)return this.ft=void 0,this.it=e;if(e===r)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this.ft;this.it=e;const i=[e];return i.raw=i,this.ft={_$litType$:this.constructor.resultType,strings:i,values:[]}}}n.directiveName="unsafeHTML",n.resultType=1;const o=e(n);export{o};
|
|
7
|
+
//# sourceMappingURL=unsafe-html-76575c49.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe-html-
|
|
1
|
+
{"version":3,"file":"unsafe-html-76575c49.js","sources":["../node_modules/lit-html/directives/unsafe-html.js"],"sourcesContent":["import{nothing as t,noChange as i}from\"../lit-html.js\";import{Directive as r,PartType as s,directive as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends r{constructor(i){if(super(i),this.it=t,i.type!==s.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this.ft=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this.ft;this.it=r;const s=[r];return s.raw=s,this.ft={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=n(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n"],"names":["e","r","constructor","i","super","this","it","t","type","s","CHILD","Error","directiveName","render","ft","raw","_$litType$","resultType","strings","values","o","n"],"mappings":";;;;;GAKG,MAAMA,UAAUC,EAAEC,YAAYC,GAAG,GAAGC,MAAMD,GAAGE,KAAKC,GAAGC,EAAEJ,EAAEK,OAAOC,EAAEC,MAAM,MAAMC,MAAMN,KAAKH,YAAYU,cAAc,yCAAyCC,OAAOZ,GAAG,GAAGA,IAAIM,GAAG,MAAMN,EAAE,OAAOI,KAAKS,QAAG,EAAOT,KAAKC,GAAGL,EAAE,GAAGA,IAAIE,EAAE,OAAOF,EAAE,GAAG,iBAAiBA,EAAE,MAAMU,MAAMN,KAAKH,YAAYU,cAAc,qCAAqC,GAAGX,IAAII,KAAKC,GAAG,OAAOD,KAAKS,GAAGT,KAAKC,GAAGL,EAAE,MAAMQ,EAAE,CAACR,GAAG,OAAOQ,EAAEM,IAAIN,EAAEJ,KAAKS,GAAG,CAACE,WAAWX,KAAKH,YAAYe,WAAWC,QAAQT,EAAEU,OAAO,KAAKnB,EAAEY,cAAc,aAAaZ,EAAEiB,WAAW,EAAO,MAACG,EAAEC,EAAErB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhealth/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "This package includes Nord Design System web components",
|
|
5
5
|
"author": "Nordhealth <support@nordhealth.design>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -19,39 +19,39 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"start": "concurrently -k -n TSC,HTTP -c blue.bold,magenta.bold \"tsc -w --noEmit\" \"wds\"",
|
|
21
21
|
"build": "npm run clean && rollup -c && npm run analyze",
|
|
22
|
+
"build:docker": "docker-compose build test",
|
|
22
23
|
"clean": "rm -rf lib/",
|
|
23
24
|
"lint": "eslint --ext .ts,.js,.html . --ignore-path ../../.gitignore && prettier \"**/*.ts\" --check --ignore-path ../../.gitignore",
|
|
24
25
|
"format": "eslint --ext .ts,.js,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
25
|
-
"test": "
|
|
26
|
-
"test:watch": "
|
|
26
|
+
"test": "docker-compose run --rm -e INCLUDE_VISUAL_REGRESSION test",
|
|
27
|
+
"test:watch": "docker-compose run --rm -e INCLUDE_VISUAL_REGRESSION test --watch",
|
|
27
28
|
"analyze": "custom-elements-manifest analyze --litelement",
|
|
28
|
-
"precommit": "INCLUDE_VISUAL_REGRESSION=true npm test",
|
|
29
29
|
"scaffold": "node ./utils/scaffold.mjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@floating-ui/dom": "0.4.4",
|
|
33
33
|
"@nordhealth/icons": "^1.3.7",
|
|
34
|
-
"lit": "2.2.
|
|
34
|
+
"lit": "2.2.2",
|
|
35
35
|
"tinykeys": "1.4.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "^0.5.5",
|
|
39
|
-
"@nordhealth/css": "^1.
|
|
39
|
+
"@nordhealth/css": "^1.1.1",
|
|
40
40
|
"@nordhealth/fonts": "^2.0.13",
|
|
41
|
-
"@nordhealth/themes": "^5.1.
|
|
42
|
-
"@nordhealth/tokens": "^4.2.
|
|
41
|
+
"@nordhealth/themes": "^5.1.8",
|
|
42
|
+
"@nordhealth/tokens": "^4.2.7",
|
|
43
43
|
"@open-wc/eslint-config": "^7.0.0",
|
|
44
|
-
"@open-wc/testing": "3.
|
|
45
|
-
"@rollup/plugin-node-resolve": "13.1
|
|
44
|
+
"@open-wc/testing": "3.1.3",
|
|
45
|
+
"@rollup/plugin-node-resolve": "13.2.1",
|
|
46
46
|
"@rollup/plugin-replace": "3.0.1",
|
|
47
47
|
"@rollup/plugin-typescript": "^8.2.5",
|
|
48
48
|
"@types/mocha": "9.1.0",
|
|
49
49
|
"@types/prettier": "2.4.4",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "5.11.0",
|
|
51
51
|
"@typescript-eslint/parser": "5.11.0",
|
|
52
|
-
"@web/dev-server": "0.1.
|
|
53
|
-
"@web/dev-server-esbuild": "
|
|
54
|
-
"@web/dev-server-rollup": "0.3.
|
|
52
|
+
"@web/dev-server": "0.1.31",
|
|
53
|
+
"@web/dev-server-esbuild": "0.2.16",
|
|
54
|
+
"@web/dev-server-rollup": "0.3.16",
|
|
55
55
|
"@web/test-runner": "0.13.27",
|
|
56
56
|
"@web/test-runner-commands": "0.6.1",
|
|
57
57
|
"@web/test-runner-visual-regression": "0.6.5",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-wc": "1.3.2",
|
|
65
65
|
"glob": "^7.2.0",
|
|
66
66
|
"prettier": "2.5.1",
|
|
67
|
-
"rollup": "2.
|
|
67
|
+
"rollup": "2.70.2",
|
|
68
68
|
"rollup-plugin-lit-css": "^3.0.2",
|
|
69
69
|
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
70
70
|
"rollup-plugin-summary": "1.3.0",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
}
|
|
169
169
|
]
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "351bea008a4cb566cfa89494f42fbfb6b00d09b2"
|
|
172
172
|
}
|
package/lib/Calendar-d1632bb6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,n as t}from"./query-assigned-elements-37b095c4.js";import{r as a,s as n,$ as o}from"./lit-element-74b6bb4b.js";import{e as i}from"./property-03f59dce.js";import{t as s}from"./state-70f38ceb.js";import{i as r}from"./query-2d22378e.js";import{c as l,r as d}from"./number-3a8ef88a.js";import{o as c}from"./tinykeys.module-84e6cc41.js";import"./Button.js";import"./VisuallyHidden.js";import h from"./Icon.js";import{E as u}from"./EventController-d99ebeef.js";import{D as p}from"./DirectionController-b267af23.js";import{LocalizeController as v}from"./LocalizeController.js";import{i as m,p as f,a as g,s as y,e as b,b as x,g as w,c as D,d as z,f as k,h as F,j as M,k as S,l as Y}from"./dates-9272b910.js";import{monthView as $}from"./month-view.js";import{DateSelectEvent as j}from"./DateSelectEvent.js";import{s as L}from"./Component-9d373ef3.js";var N=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M105 57.4 47.6 2.8a10.566 10.566 0 1 0-14.56 15.316l51.968 49.35a3.486 3.486 0 0 1 0 5.068l-51.968 49.35a10.502 10.502 0 0 0 14.462 15.232l57.638-54.74A17.584 17.584 0 0 0 105 57.4z"/></svg>',title:"arrow-right-small",tags:"nordicon arrow right small caret pointing triangle chevron"});var T=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M99.736 140a10.486 10.486 0 0 1-7.238-2.884L35 82.6a17.598 17.598 0 0 1-.14-24.976l57.638-54.74a10.502 10.502 0 1 1 14.462 15.232l-51.968 49.35a3.486 3.486 0 0 0 0 5.068l51.968 49.35A10.5 10.5 0 0 1 99.736 140z"/></svg>',title:"arrow-left-small",tags:"nordicon arrow left small caret pointing triangle chevron"});var C=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M70 110.236a17.332 17.332 0 0 1-12.306-5.096L2.884 47.502A10.502 10.502 0 1 1 18.116 33.04l49.35 51.968a3.486 3.486 0 0 0 5.068 0l49.35-51.968a10.502 10.502 0 1 1 15.232 14.462L82.6 105a17.766 17.766 0 0 1-12.6 5.236z"/></svg>',title:"arrow-down-small",tags:"nordicon arrow down small caret pointing triangle chevron"});const O=e=>e.preventDefault();class _{constructor(e,t){this.hadFirstUpdate=!1,this.initialTouchX=0,this.initialTouchY=0,this.handleTouchStart=e=>{const[{pageX:t,pageY:a}]=e.changedTouches;this.initialTouchX=t,this.initialTouchY=a},this.handleTouchEnd=e=>{const[{pageX:t,pageY:a}]=e.changedTouches,{matchesGesture:n,onSwipeEnd:o}=this.options,i=t-this.initialTouchX,s=a-this.initialTouchY,r={initialX:this.initialTouchX,initialY:this.initialTouchY,pageX:t,pageY:a,distX:i,distY:s};n(r)&&(e.preventDefault(),o(r))},e.addController(this),this.events=new u(e),this.options={target:()=>e,...t}}hostUpdated(){if(!this.hadFirstUpdate){this.hadFirstUpdate=!0;const e=this.options.target();this.events.listen(e,"touchstart",this.handleTouchStart),this.events.listen(e,"touchmove",O),this.events.listen(e,"touchend",this.handleTouchEnd)}}hostDisconnected(){this.hadFirstUpdate=!1}}const I=({distX:e,distY:t})=>Math.abs(e)>=70&&Math.abs(t)<=70,X=({distX:e,distY:t})=>Math.abs(t)>=70&&Math.abs(e)<=70&&t>0,A=a`:host{font-feature-settings:var(--n-font-features-reduced)}.n-calendar{-webkit-user-select:none;user-select:none;background:var(--n-color-surface);box-shadow:var(--n-calendar-box-shadow,var(--n-box-shadow-popout));border-radius:var(--n-border-radius-s);max-inline-size:310px;min-inline-size:290px;padding:var(--n-calendar-padding,16px 16px 20px)}:host([expand]) .n-calendar{max-inline-size:100%;inline-size:100%}@media (max-width:35.9375em){.n-calendar{max-inline-size:100%}}.n-calendar-table{border-collapse:collapse;border-spacing:0;color:var(--n-color-text);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight);line-height:var(--n-date-picker-line-height);text-align:center;inline-size:100%}.n-calendar-table-header{font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);letter-spacing:1px;line-height:var(--n-date-picker-line-height);padding-block-end:8px;text-decoration:none;text-transform:uppercase}.n-calendar-cell{text-align:center}.n-calendar-day{-moz-appearance:none;-webkit-appearance:none;appearance:none;background:0 0;border:0;border-radius:var(--n-border-radius-s);color:var(--n-color-text);cursor:pointer;display:inline-block;font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-variant-numeric:tabular-nums;font-weight:var(--n-font-weight);block-size:36px;padding:0 0 1px;position:relative;text-align:center;vertical-align:middle;inline-size:36px;z-index:1}.n-calendar-day[aria-current=date]{box-shadow:0 0 0 1px var(--n-color-accent);color:var(--n-color-text-link);position:relative;z-index:200}.n-calendar-day:hover{background:var(--n-color-active)}.n-calendar-day:focus,.n-calendar-day[aria-pressed=true]{background:var(--n-color-accent);box-shadow:none;color:var(--n-color-text-on-accent);outline:0}.n-calendar-day:active{background:var(--n-color-accent);box-shadow:none!important;color:var(--n-color-text-on-accent);z-index:200}.n-calendar-day:focus{box-shadow:0 0 5px var(--n-color-accent);z-index:200}.n-calendar-day:not(.is-month){box-shadow:none}.n-calendar-day:not(.is-month),.n-calendar-day[aria-disabled=true]{background:0 0;color:var(--n-color-text-weakest);cursor:default}.n-calendar-day[aria-disabled=true]{color:var(--n-color-text-weaker);text-decoration:line-through}.n-calendar-day:not(.is-month)[aria-disabled=true]{color:var(--n-color-text-weakest);text-decoration:none}.n-calendar-day[aria-disabled=true][aria-current=date]{box-shadow:0 0 0 1px var(--n-color-accent);color:var(--n-color-text-link)}.n-calendar-day[aria-disabled=true][aria-current=date]:focus{box-shadow:0 0 5px var(--n-color-accent);background:var(--n-color-accent);color:var(--n-color-text-on-accent)}.n-calendar-day[aria-disabled=true]:not([aria-current=date])::before{display:none}.n-calendar-day.is-outside{background:0 0;box-shadow:none;color:var(--n-color-text-weakest);cursor:default;pointer-events:none}.n-calendar-day.is-outside::before{display:none}.n-calendar-header{align-items:start;display:flex;justify-content:space-between;margin-block-end:16px;inline-size:100%}.n-calendar-nav{white-space:nowrap}.n-calendar-nav nord-button{--n-button-padding-x:11px;margin-inline-start:calc(var(--n-space-s)/ 2)}.n-calendar-select{display:inline-flex;margin-block-start:4px;position:relative;line-height:var(--n-line-height)}.n-calendar-select span{margin-inline-end:var(--n-space-s)}.n-calendar-select select{cursor:pointer;font-size:var(--n-font-size-l);block-size:100%;inset-inline-start:0;opacity:0;position:absolute;inset-block-start:0;inline-size:100%;z-index:2}.n-calendar-select select:focus+.n-calendar-select-label{box-shadow:0 0 0 2px var(--n-color-accent)}.n-calendar-select-label{align-items:center;border-radius:var(--n-border-radius-s);color:var(--n-color-text);display:flex;font-size:var(--n-font-size-xl);font-weight:var(--n-font-weight-active);line-height:var(--n-date-picker-line-height);padding:0 4px 0 8px;pointer-events:none;position:relative;inline-size:100%;z-index:1;text-transform:capitalize}`;h.registerIcon(N),h.registerIcon(T),h.registerIcon(C);const E=e=>t=>{t.preventDefault(),e(t)},W=()=>!1;let U=class extends n{constructor(){super(...arguments),this.dialogLabelId="dialog-header",this.direction=new p(this),this.swipe=new _(this,{matchesGesture:I,onSwipeEnd:({distX:e})=>this.addMonths(e<0?1:-1)}),this.shortcuts=c({ArrowRight:E((()=>this.addDays(this.direction.isLTR?1:-1))),ArrowLeft:E((()=>this.addDays(this.direction.isLTR?-1:1))),ArrowDown:E((()=>this.addDays(7))),ArrowUp:E((()=>this.addDays(-7))),Home:E((()=>this.startOfWeek())),End:E((()=>this.endOfWeek())),PageUp:E((()=>this.addMonths(-1))),PageDown:E((()=>this.addMonths(1))),"Shift+PageUp":E((()=>this.addYears(-1))),"Shift+PageDown":E((()=>this.addYears(1)))}),this.localize=new v(this,{onLangChange:()=>this.handleLangChange()}),this.value="",this.firstDayOfWeek=1,this.min="",this.max="",this.expand=!1,this.isDateDisabled=W,this.activeFocus=!1,this.focusedDay=new Date,this.handleDaySelect=e=>{const t=m(e,f(this.min),f(this.max)),a=!this.isDateDisabled(e);t&&a&&(this.value=g(e),this.dispatchEvent(new j("change",e)))},this.handleMonthSelect=e=>{this.setMonth(parseInt(e.target.value,10))},this.handleYearSelect=e=>{this.setYear(parseInt(e.target.value,10))},this.handleNextMonthClick=e=>{e.preventDefault(),this.addMonths(1)},this.handlePreviousMonthClick=e=>{e.preventDefault(),this.addMonths(-1)},this.enableActiveFocus=()=>{this.activeFocus=!0},this.disableActiveFocus=()=>{this.activeFocus=!1}}focus(e){var t;const a=null!==(t=null==e?void 0:e.target)&&void 0!==t?t:"day";"day"===a?this.focusedDayNode.focus():"month"===a&&this.monthSelectNode.focus()}willUpdate(e){e.has("value")&&this.setFocusedDay(f(this.value)||new Date)}updated(e){e.has("focusedDay")&&this.activeFocus&&this.focusedDayNode.focus()}render(){const e=f(this.value),t=this.focusedDay.getMonth(),a=this.focusedDay.getFullYear(),n=f(this.min),i=f(this.max),s=n?y(n):void 0,r=i?b(i):void 0,c=(e||this.focusedDay).getFullYear(),h=n?n.getFullYear():c-10,u=i?i.getFullYear():c+10;return o`<div class="n-calendar"><div class="n-calendar-header"><div><nord-visually-hidden><h2 id="${this.dialogLabelId}" aria-live="polite" aria-atomic="true">${this.monthNames[t]}, ${this.focusedDay.getFullYear()}</h2></nord-visually-hidden><div class="n-calendar-select"><select aria-label="${this.localize.term("monthSelectLabel")}" class="n-calendar-select-month" @input="${this.handleMonthSelect}">${this.monthNames.map(((e,n)=>o`<option value="${n}" ?selected="${n===t}" ?disabled="${!m(new Date(a,n,1),s,r)}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${this.monthNamesShort[t]}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xs"></nord-icon></div></div><div class="n-calendar-select"><select aria-label="${this.localize.term("yearSelectLabel")}" class="n-calendar-select-year" @input="${this.handleYearSelect}">${l(d(h,u),(e=>e),(e=>o`<option ?selected="${e===a}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${this.focusedDay.getFullYear()}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xs"></nord-icon></div></div></div><div class="n-calendar-nav"><nord-button class="n-calendar-prev" @click="${this.handlePreviousMonthClick}" ?disabled="${x(n,this.focusedDay)}" type="button"><nord-visually-hidden>${this.localize.term("prevMonthLabel")}</nord-visually-hidden><nord-icon color="var(--n-color-icon)" name="${this.direction.isLTR?"arrow-left-small":"arrow-right-small"}" size="s"></nord-icon></nord-button><nord-button class="n-calendar-next" @click="${this.handleNextMonthClick}" ?disabled="${x(i,this.focusedDay)}" type="button"><nord-visually-hidden>${this.localize.term("nextMonthLabel")}</nord-visually-hidden><nord-icon color="var(--n-color-icon)" name="${this.direction.isLTR?"arrow-right-small":"arrow-left-small"}" size="s"></nord-icon></nord-button></div></div>${$({onFocusOut:this.disableActiveFocus,onFocusIn:this.enableActiveFocus,dateFormatter:this.dateFormatShort,selectedDate:e,focusedDate:this.focusedDay,onDateSelect:this.handleDaySelect,onKeyboardNavigation:this.shortcuts,labelledById:this.dialogLabelId,dayNames:this.dayNames,dayNamesShort:this.dayNamesShort,firstDayOfWeek:this.firstDayOfWeek,min:n,max:i,isDateDisabled:this.isDateDisabled})}</div>`}handleLangChange(){const e=this.localize.resolvedLang;this.dateFormatShort=new Intl.DateTimeFormat(e,{day:"numeric",month:"long"}),this.monthNames=w(e,"long"),this.monthNamesShort=w(e,"short"),this.dayNames=D(e,"long"),this.dayNamesShort=D(e,"narrow")}addDays(e){this.setFocusedDay(z(this.focusedDay,e))}addMonths(e){this.setMonth(this.focusedDay.getMonth()+e)}addYears(e){this.setYear(this.focusedDay.getFullYear()+e)}startOfWeek(){this.setFocusedDay(k(this.focusedDay,this.firstDayOfWeek))}endOfWeek(){this.setFocusedDay(F(this.focusedDay,this.firstDayOfWeek))}setMonth(e){const t=M(y(this.focusedDay),e),a=b(t),n=M(this.focusedDay,e);this.setFocusedDay(S(n,t,a))}setYear(e){const t=Y(y(this.focusedDay),e),a=b(t),n=Y(this.focusedDay,e);this.setFocusedDay(S(n,t,a))}setFocusedDay(e){this.focusedDay=S(e,f(this.min),f(this.max)),this.dispatchEvent(new j("nord-focus-date",this.focusedDay))}};U.styles=[L,A],e([r(".n-calendar-select-month",!0)],U.prototype,"monthSelectNode",void 0),e([r('button[tabindex="0"]')],U.prototype,"focusedDayNode",void 0),e([i()],U.prototype,"value",void 0),e([i({type:Number})],U.prototype,"firstDayOfWeek",void 0),e([i()],U.prototype,"min",void 0),e([i()],U.prototype,"max",void 0),e([i({reflect:!0,type:Boolean})],U.prototype,"expand",void 0),e([i({attribute:!1})],U.prototype,"isDateDisabled",void 0),e([s()],U.prototype,"activeFocus",void 0),e([s()],U.prototype,"focusedDay",void 0),U=e([t("nord-calendar")],U);var B=U;export{B as C,_ as S,X as i};
|
|
2
|
-
//# sourceMappingURL=Calendar-d1632bb6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar-d1632bb6.js","sources":["../../icons/lib/assets/arrow-right-small.js","../../icons/lib/assets/arrow-left-small.js","../../icons/lib/assets/arrow-down-small.js","../src/common/controllers/SwipeController.ts","../src/calendar/Calendar.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"currentColor\" d=\"M105 57.4 47.6 2.8a10.566 10.566 0 1 0-14.56 15.316l51.968 49.35a3.486 3.486 0 0 1 0 5.068l-51.968 49.35a10.502 10.502 0 0 0 14.462 15.232l57.638-54.74A17.584 17.584 0 0 0 105 57.4z\"/></svg>'\nexport const title = \"arrow-right-small\"\nexport const tags = \"nordicon arrow right small caret pointing triangle chevron\"\n","export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"currentColor\" d=\"M99.736 140a10.486 10.486 0 0 1-7.238-2.884L35 82.6a17.598 17.598 0 0 1-.14-24.976l57.638-54.74a10.502 10.502 0 1 1 14.462 15.232l-51.968 49.35a3.486 3.486 0 0 0 0 5.068l51.968 49.35A10.5 10.5 0 0 1 99.736 140z\"/></svg>'\nexport const title = \"arrow-left-small\"\nexport const tags = \"nordicon arrow left small caret pointing triangle chevron\"\n","export default '<svg viewBox=\"0 0 140 140\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"currentColor\" d=\"M70 110.236a17.332 17.332 0 0 1-12.306-5.096L2.884 47.502A10.502 10.502 0 1 1 18.116 33.04l49.35 51.968a3.486 3.486 0 0 0 5.068 0l49.35-51.968a10.502 10.502 0 1 1 15.232 14.462L82.6 105a17.766 17.766 0 0 1-12.6 5.236z\"/></svg>'\nexport const title = \"arrow-down-small\"\nexport const tags = \"nordicon arrow down small caret pointing triangle chevron\"\n","import { ReactiveController, ReactiveElement } from \"lit\"\nimport { EventController } from \"./EventController.js\"\n\nexport type SwipeDetails = {\n initialX: number\n initialY: number\n pageX: number\n pageY: number\n distX: number\n distY: number\n}\n\nconst preventDefault = (e: Event) => e.preventDefault()\n\ntype SetRequired<T, K extends keyof T> = T & { [Property in K]-?: T[K] }\ntype SwipeControllerOptions = {\n target?: () => HTMLElement\n matchesGesture: (details: SwipeDetails) => boolean\n onSwipeEnd: (details: SwipeDetails) => void\n}\n\nexport class SwipeController implements ReactiveController {\n private events: EventController\n private hadFirstUpdate = false\n\n private initialTouchX: number = 0\n private initialTouchY: number = 0\n private options: SetRequired<SwipeControllerOptions, \"target\">\n\n constructor(host: ReactiveElement, options: SwipeControllerOptions) {\n host.addController(this)\n this.events = new EventController(host)\n\n this.options = {\n target: () => host,\n ...options,\n }\n }\n\n hostUpdated() {\n if (!this.hadFirstUpdate) {\n this.hadFirstUpdate = true\n\n const target = this.options.target()\n this.events.listen(target, \"touchstart\", this.handleTouchStart)\n this.events.listen(target, \"touchmove\", preventDefault)\n this.events.listen(target, \"touchend\", this.handleTouchEnd)\n }\n }\n\n hostDisconnected() {\n this.hadFirstUpdate = false\n }\n\n private handleTouchStart = (event: TouchEvent) => {\n const [{ pageX, pageY }] = event.changedTouches\n this.initialTouchX = pageX\n this.initialTouchY = pageY\n }\n\n private handleTouchEnd = (event: TouchEvent) => {\n const [{ pageX, pageY }] = event.changedTouches\n const { matchesGesture, onSwipeEnd } = this.options\n\n const distX = pageX - this.initialTouchX\n const distY = pageY - this.initialTouchY\n const details = { initialX: this.initialTouchX, initialY: this.initialTouchY, pageX, pageY, distX, distY }\n\n if (matchesGesture(details)) {\n event.preventDefault()\n onSwipeEnd(details)\n }\n }\n}\n\nconst THRESHOLD = 70\n\nexport const isHorizontalSwipe = ({ distX, distY }: SwipeDetails) =>\n Math.abs(distX) >= THRESHOLD && Math.abs(distY) <= THRESHOLD\n\nexport const isDownwardsSwipe = ({ distX, distY }: SwipeDetails) =>\n Math.abs(distY) >= THRESHOLD && Math.abs(distX) <= THRESHOLD && distY > 0\n","import { html, LitElement, PropertyValues } from \"lit\"\nimport { customElement, property, query, state } from \"lit/decorators.js\"\nimport { repeat } from \"lit/directives/repeat.js\"\nimport { createKeybindingsHandler } from \"tinykeys\"\nimport * as arrowRightIcon from \"@nordhealth/icons/lib/assets/arrow-right-small.js\"\nimport * as arrowLeftIcon from \"@nordhealth/icons/lib/assets/arrow-left-small.js\"\nimport * as arrowDownIcon from \"@nordhealth/icons/lib/assets/arrow-down-small.js\"\n\nimport \"../button/Button.js\"\nimport \"../visually-hidden/VisuallyHidden.js\"\nimport Icon from \"../icon/Icon.js\"\n\nimport { isHorizontalSwipe, SwipeController } from \"../common/controllers/SwipeController.js\"\nimport { DirectionController } from \"../common/controllers/DirectionController.js\"\nimport { LocalizeController } from \"../localization/LocalizeController.js\"\n\nimport { range } from \"../common/number.js\"\nimport {\n addDays,\n clamp,\n DaysOfWeek,\n endOfMonth,\n endOfWeek,\n getDayNames,\n getMonthNames,\n inRange,\n isEqualMonth,\n parseISODate,\n printISODate,\n setMonth,\n setYear,\n startOfMonth,\n startOfWeek,\n} from \"../common/dates.js\"\n\nimport { monthView } from \"./month-view.js\"\nimport { DateSelectEvent } from \"./DateSelectEvent.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Calendar.css\"\n\nexport type DateDisabledPredicate = (date: Date) => boolean\n\nIcon.registerIcon(arrowRightIcon)\nIcon.registerIcon(arrowLeftIcon)\nIcon.registerIcon(arrowDownIcon)\n\nconst preventDefault = (fn: EventListener) => (e: Event) => {\n e.preventDefault()\n fn(e)\n}\n\nconst isDateDisabled: DateDisabledPredicate = () => false\n\n/**\n * Calendar allows user to pick a date. It comes with built-in\n * functionality that allows you to set a minimum and a maximum allowed date.\n * Please note that the date must be passed in ISO-8601 format.\n *\n * @status ready\n * @category list\n * @fires {DateSelectEvent} change - Dispatched when a date is selected and the value changes.\n * @fires {DateSelectEvent} nord-focus-date - Dispatched when the calendar's focused date changes.\n */\n@customElement(\"nord-calendar\")\nexport default class Calendar extends LitElement {\n static styles = [componentStyle, style]\n\n private dialogLabelId = \"dialog-header\"\n\n @query(\".n-calendar-select-month\", true) private monthSelectNode!: HTMLElement\n @query(`button[tabindex=\"0\"]`) private focusedDayNode!: HTMLButtonElement\n\n private direction = new DirectionController(this)\n private swipe = new SwipeController(this, {\n matchesGesture: isHorizontalSwipe,\n onSwipeEnd: ({ distX }) => this.addMonths(distX < 0 ? 1 : -1),\n })\n\n private shortcuts = createKeybindingsHandler({\n ArrowRight: preventDefault(() => this.addDays(this.direction.isLTR ? 1 : -1)),\n ArrowLeft: preventDefault(() => this.addDays(this.direction.isLTR ? -1 : 1)),\n ArrowDown: preventDefault(() => this.addDays(7)),\n ArrowUp: preventDefault(() => this.addDays(-7)),\n Home: preventDefault(() => this.startOfWeek()),\n End: preventDefault(() => this.endOfWeek()),\n PageUp: preventDefault(() => this.addMonths(-1)),\n PageDown: preventDefault(() => this.addMonths(1)),\n \"Shift+PageUp\": preventDefault(() => this.addYears(-1)),\n \"Shift+PageDown\": preventDefault(() => this.addYears(1)),\n })\n\n private localize = new LocalizeController<\"nord-calendar\">(this, {\n onLangChange: () => this.handleLangChange(),\n })\n\n /**\n * Whilst dateAdapter is used for handling the formatting/parsing dates in the input,\n * these are used to format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatShort!: Intl.DateTimeFormat\n private monthNames!: string[]\n private monthNamesShort!: string[]\n private dayNames!: string[]\n private dayNamesShort!: string[]\n\n /**\n * The selected date on the calendar. Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @property() value: string = \"\"\n\n /**\n * Which day is considered first day of the week? `0` for Sunday, `1` for Monday, etc.\n * Default is Monday.\n */\n @property({ type: Number }) firstDayOfWeek: DaysOfWeek = DaysOfWeek.Monday\n\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @property() min: string = \"\"\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @property() max: string = \"\"\n\n /**\n * Controls whether the calendar expands to fill the width of its container.\n */\n @property({ reflect: true, type: Boolean }) expand = false\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @property({ attribute: false }) isDateDisabled: DateDisabledPredicate = isDateDisabled\n\n @state() private activeFocus = false\n @state() private focusedDay = new Date()\n\n /**\n * Programmatically move focus to the calendar.\n * @param options An object which controls aspects of the focusing process.\n */\n focus(options?: FocusOptions & { target: \"day\" | \"month\" }) {\n const target = options?.target ?? \"day\"\n\n if (target === \"day\") {\n this.focusedDayNode.focus()\n } else if (target === \"month\") {\n this.monthSelectNode.focus()\n }\n }\n\n willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"value\")) {\n this.setFocusedDay(parseISODate(this.value) || new Date())\n }\n }\n\n protected updated(changedProperties: PropertyValues<this>): void {\n // @ts-expect-error focusedDay is private so TS complains, but we don't want to loosen the param type\n if (changedProperties.has(\"focusedDay\") && this.activeFocus) {\n this.focusedDayNode.focus()\n }\n }\n\n render() {\n const valueAsDate = parseISODate(this.value)\n const focusedMonth = this.focusedDay.getMonth()\n const focusedYear = this.focusedDay.getFullYear()\n\n const minDate = parseISODate(this.min)\n const maxDate = parseISODate(this.max)\n const minDateStartOfMonth = minDate ? startOfMonth(minDate) : undefined\n const maxDateEndOfMonth = maxDate ? endOfMonth(maxDate) : undefined\n\n const selectedYear = (valueAsDate || this.focusedDay).getFullYear()\n const minYear = minDate ? minDate.getFullYear() : selectedYear - 10\n const maxYear = maxDate ? maxDate.getFullYear() : selectedYear + 10\n\n return html`\n <div class=\"n-calendar\">\n <div class=\"n-calendar-header\">\n <div>\n <nord-visually-hidden>\n <h2 id=${this.dialogLabelId} aria-live=\"polite\" aria-atomic=\"true\">\n ${this.monthNames[focusedMonth]}, ${this.focusedDay.getFullYear()}\n </h2>\n </nord-visually-hidden>\n\n <div class=\"n-calendar-select\">\n <select\n aria-label=${this.localize.term(\"monthSelectLabel\")}\n class=\"n-calendar-select-month\"\n @input=${this.handleMonthSelect}\n >\n ${this.monthNames.map(\n (month, i) =>\n html`\n <option\n value=${i}\n ?selected=${i === focusedMonth}\n ?disabled=${!inRange(new Date(focusedYear, i, 1), minDateStartOfMonth, maxDateEndOfMonth)}\n >\n ${month}\n </option>\n `\n )}\n </select>\n <div class=\"n-calendar-select-label\" aria-hidden=\"true\">\n <span>${this.monthNamesShort[focusedMonth]}</span>\n <nord-icon color=\"var(--n-color-icon)\" name=\"arrow-down-small\" size=\"xs\"></nord-icon>\n </div>\n </div>\n\n <div class=\"n-calendar-select\">\n <select\n aria-label=${this.localize.term(\"yearSelectLabel\")}\n class=\"n-calendar-select-year\"\n @input=${this.handleYearSelect}\n >\n ${repeat(\n range(minYear, maxYear),\n year => year,\n year => html`<option ?selected=${year === focusedYear}>${year}</option>`\n )}\n </select>\n <div class=\"n-calendar-select-label\" aria-hidden=\"true\">\n <span>${this.focusedDay.getFullYear()}</span>\n <nord-icon color=\"var(--n-color-icon)\" name=\"arrow-down-small\" size=\"xs\"></nord-icon>\n </div>\n </div>\n </div>\n\n <div class=\"n-calendar-nav\">\n <nord-button\n class=\"n-calendar-prev\"\n @click=${this.handlePreviousMonthClick}\n ?disabled=${isEqualMonth(minDate, this.focusedDay)}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term(\"prevMonthLabel\")}</nord-visually-hidden>\n <nord-icon\n color=\"var(--n-color-icon)\"\n name=${this.direction.isLTR ? \"arrow-left-small\" : \"arrow-right-small\"}\n size=\"s\"\n ></nord-icon>\n </nord-button>\n\n <nord-button\n class=\"n-calendar-next\"\n @click=${this.handleNextMonthClick}\n ?disabled=${isEqualMonth(maxDate, this.focusedDay)}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term(\"nextMonthLabel\")}</nord-visually-hidden>\n <nord-icon\n color=\"var(--n-color-icon)\"\n name=${this.direction.isLTR ? \"arrow-right-small\" : \"arrow-left-small\"}\n size=\"s\"\n ></nord-icon>\n </nord-button>\n </div>\n </div>\n\n ${monthView({\n onFocusOut: this.disableActiveFocus,\n onFocusIn: this.enableActiveFocus,\n dateFormatter: this.dateFormatShort,\n selectedDate: valueAsDate,\n focusedDate: this.focusedDay,\n onDateSelect: this.handleDaySelect,\n onKeyboardNavigation: this.shortcuts,\n labelledById: this.dialogLabelId,\n dayNames: this.dayNames,\n dayNamesShort: this.dayNamesShort,\n firstDayOfWeek: this.firstDayOfWeek,\n min: minDate,\n max: maxDate,\n isDateDisabled: this.isDateDisabled,\n })}\n </div>\n `\n }\n\n private handleLangChange() {\n const lang = this.localize.resolvedLang\n this.dateFormatShort = new Intl.DateTimeFormat(lang, { day: \"numeric\", month: \"long\" })\n this.monthNames = getMonthNames(lang, \"long\")\n this.monthNamesShort = getMonthNames(lang, \"short\")\n this.dayNames = getDayNames(lang, \"long\")\n this.dayNamesShort = getDayNames(lang, \"narrow\")\n }\n\n private handleDaySelect = (day: Date) => {\n const isInRange = inRange(day, parseISODate(this.min), parseISODate(this.max))\n const isAllowed = !this.isDateDisabled(day)\n\n if (isInRange && isAllowed) {\n this.value = printISODate(day)\n this.dispatchEvent(new DateSelectEvent(\"change\", day))\n }\n }\n\n private addDays(days: number) {\n this.setFocusedDay(addDays(this.focusedDay, days))\n }\n\n private addMonths(months: number) {\n this.setMonth(this.focusedDay.getMonth() + months)\n }\n\n private addYears(years: number) {\n this.setYear(this.focusedDay.getFullYear() + years)\n }\n\n private startOfWeek() {\n this.setFocusedDay(startOfWeek(this.focusedDay, this.firstDayOfWeek))\n }\n\n private endOfWeek() {\n this.setFocusedDay(endOfWeek(this.focusedDay, this.firstDayOfWeek))\n }\n\n private setMonth(month: number) {\n const min = setMonth(startOfMonth(this.focusedDay), month)\n const max = endOfMonth(min)\n const date = setMonth(this.focusedDay, month)\n\n this.setFocusedDay(clamp(date, min, max))\n }\n\n private setYear(year: number) {\n const min = setYear(startOfMonth(this.focusedDay), year)\n const max = endOfMonth(min)\n const date = setYear(this.focusedDay, year)\n\n this.setFocusedDay(clamp(date, min, max))\n }\n\n private setFocusedDay(day: Date) {\n this.focusedDay = clamp(day, parseISODate(this.min), parseISODate(this.max))\n this.dispatchEvent(new DateSelectEvent(\"nord-focus-date\", this.focusedDay))\n }\n\n private handleMonthSelect = (e: any) => {\n this.setMonth(parseInt(e.target.value, 10))\n }\n\n private handleYearSelect = (e: any) => {\n this.setYear(parseInt(e.target.value, 10))\n }\n\n private handleNextMonthClick = (event: MouseEvent) => {\n event.preventDefault()\n this.addMonths(1)\n }\n\n private handlePreviousMonthClick = (event: MouseEvent) => {\n event.preventDefault()\n this.addMonths(-1)\n }\n\n private enableActiveFocus = () => {\n this.activeFocus = true\n }\n\n private disableActiveFocus = () => {\n this.activeFocus = false\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-calendar\": Calendar\n }\n}\n"],"names":["preventDefault","e","SwipeController","constructor","host","options","this","event","pageX","pageY","changedTouches","initialTouchX","initialTouchY","matchesGesture","onSwipeEnd","distX","distY","details","initialX","initialY","addController","events","EventController","target","hostUpdated","hadFirstUpdate","listen","handleTouchStart","handleTouchEnd","hostDisconnected","isHorizontalSwipe","Math","abs","isDownwardsSwipe","Icon","registerIcon","arrowRightIcon","arrowLeftIcon","arrowDownIcon","fn","isDateDisabled","Calendar","LitElement","DirectionController","addMonths","createKeybindingsHandler","ArrowRight","addDays","direction","isLTR","ArrowLeft","ArrowDown","ArrowUp","Home","startOfWeek","End","endOfWeek","PageUp","PageDown","addYears","LocalizeController","onLangChange","handleLangChange","Date","day","isInRange","inRange","parseISODate","min","max","isAllowed","value","printISODate","dispatchEvent","DateSelectEvent","setMonth","parseInt","setYear","activeFocus","focus","focusedDayNode","monthSelectNode","willUpdate","changedProperties","has","setFocusedDay","updated","render","valueAsDate","focusedMonth","focusedDay","getMonth","focusedYear","getFullYear","minDate","maxDate","minDateStartOfMonth","startOfMonth","undefined","maxDateEndOfMonth","endOfMonth","selectedYear","minYear","maxYear","html","dialogLabelId","monthNames","localize","term","handleMonthSelect","map","month","i","monthNamesShort","handleYearSelect","repeat","range","year","handlePreviousMonthClick","isEqualMonth","handleNextMonthClick","monthView","onFocusOut","disableActiveFocus","onFocusIn","enableActiveFocus","dateFormatter","dateFormatShort","selectedDate","focusedDate","onDateSelect","handleDaySelect","onKeyboardNavigation","shortcuts","labelledById","dayNames","dayNamesShort","firstDayOfWeek","lang","resolvedLang","Intl","DateTimeFormat","getMonthNames","getDayNames","days","months","years","date","clamp","componentStyle","style","__decorate","query","property","type","Number","reflect","Boolean","attribute","state","customElement"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component-9d373ef3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
class t{constructor(t){this.host=t,this.host=t,t.addController(this)}get dir(){return document.documentElement.dir||"ltr"}get isLTR(){return"ltr"===this.dir}get isRTL(){return"rtl"===this.dir}hostConnected(){t.observer||(t.observer=new MutationObserver(t.observe),t.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]})),t.hosts.has(this.host)||t.hosts.add(this.host)}hostDisconnected(){t.hosts.delete(this.host)}static observe(){t.hosts.forEach((t=>t.requestUpdate()))}}t.hosts=new Set;export{t as D};
|
|
2
|
-
//# sourceMappingURL=DirectionController-b267af23.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionController-b267af23.js","sources":["../src/common/controllers/DirectionController.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from \"lit\"\n\nexport type WritingDirection = \"ltr\" | \"rtl\"\n\nexport class DirectionController implements ReactiveController {\n // these are all static as we only want a single observer on <html>\n private static hosts = new Set<ReactiveControllerHost>()\n private static observer?: MutationObserver\n\n // eslint-disable-next-line class-methods-use-this\n get dir(): WritingDirection {\n return (document.documentElement.dir as WritingDirection) || \"ltr\"\n }\n\n get isLTR() {\n return this.dir === \"ltr\"\n }\n\n get isRTL() {\n return this.dir === \"rtl\"\n }\n\n constructor(private host: ReactiveControllerHost) {\n this.host = host\n host.addController(this)\n }\n\n hostConnected() {\n if (!DirectionController.observer) {\n DirectionController.observer = new MutationObserver(DirectionController.observe)\n DirectionController.observer.observe(document.documentElement, { attributes: true, attributeFilter: [\"dir\"] })\n }\n\n if (!DirectionController.hosts.has(this.host)) {\n DirectionController.hosts.add(this.host)\n }\n }\n\n hostDisconnected() {\n DirectionController.hosts.delete(this.host)\n }\n\n private static observe() {\n DirectionController.hosts.forEach(host => host.requestUpdate())\n }\n}\n"],"names":["DirectionController","constructor","host","this","addController","dir","document","documentElement","isLTR","isRTL","hostConnected","observer","MutationObserver","observe","attributes","attributeFilter","hosts","has","add","hostDisconnected","delete","static","forEach","requestUpdate","Set"],"mappings":"MAIaA,EAkBXC,YAAoBC,GAAAC,UAAAD,EAClBC,KAAKD,KAAOA,EACZA,EAAKE,cAAcD,MAdjBE,UACF,OAAQC,SAASC,gBAAgBF,KAA4B,MAG3DG,YACF,MAAoB,QAAbL,KAAKE,IAGVI,YACF,MAAoB,QAAbN,KAAKE,IAQdK,gBACOV,EAAoBW,WACvBX,EAAoBW,SAAW,IAAIC,iBAAiBZ,EAAoBa,SACxEb,EAAoBW,SAASE,QAAQP,SAASC,gBAAiB,CAAEO,YAAY,EAAMC,gBAAiB,CAAC,UAGlGf,EAAoBgB,MAAMC,IAAId,KAAKD,OACtCF,EAAoBgB,MAAME,IAAIf,KAAKD,MAIvCiB,mBACEnB,EAAoBgB,MAAMI,OAAOjB,KAAKD,MAGhCmB,iBACNrB,EAAoBgB,MAAMM,SAAQpB,GAAQA,EAAKqB,mBArClCvB,QAAQ,IAAIwB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e}from"./ref-7d028e3a.js";function l(l){return class extends l{constructor(){super(...arguments),this.focusableRef=e()}focus(e){var l;null===(l=this.focusableRef.value)||void 0===l||l.focus(e)}blur(){var e;null===(e=this.focusableRef.value)||void 0===e||e.blur()}click(){var e;null===(e=this.focusableRef.value)||void 0===e||e.click()}}}export{l as F};
|
|
2
|
-
//# sourceMappingURL=FocusableMixin-ebb67709.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as t}from"./query-assigned-elements-37b095c4.js";import{$ as e}from"./lit-element-74b6bb4b.js";import{e as r}from"./property-03f59dce.js";import{E as o}from"./EventController-d99ebeef.js";import{S as i}from"./SlotController-683d0e7c.js";import{N as s}from"./events-731d0007.js";import"./VisuallyHidden.js";class n{constructor(t,e){this.host=t,this.options=e,this.handleFormData=t=>{const{disabled:e,name:r}=this.host;if(e)return;const o=this.options.value();r&&null!=o&&t.formData.append(r,o)},this.host=t,t.addController(this),this.options=e,this.events=new o(t)}hostConnected(){this.host.form&&this.events.listen(this.host.form,"formdata",this.handleFormData)}}function h(o){class h extends o{constructor(){super(...arguments),this.labelSlot=new i(this,"label"),this.errorSlot=new i(this,"error"),this.hintSlot=new i(this,"hint"),this.formData=new n(this,{value:()=>this.formValue}),this.inputId="input",this.errorId="error",this.hintId="hint",this.label="",this.hideLabel=!1,this.required=!1,this.expand=!1}get formValue(){return this.value}handleInput(t){t.stopPropagation();const e=t.target;this.value=e.value,this.dispatchEvent(new s("input"))}handleChange(t){t.stopPropagation(),this.dispatchEvent(new s("change"))}renderLabel(){const t=e`<label for="${this.inputId}"><slot name="label">${this.label}</slot></label><div class="n-caption n-hint" id="${this.hintId}" ?hidden="${!this.hasHint}"><slot name="hint">${this.hint}</slot></div>`;return this.hideLabel?e`<nord-visually-hidden>${t}</nord-visually-hidden>`:e`<div class="n-label-container">${t}</div>`}renderError(){return e`<div class="n-caption n-error" id="${this.errorId}" role="alert" ?hidden="${!this.hasError}"><slot name="error">${this.error}</slot></div>`}getDescribedBy(){const{hasHint:t,hasError:e}=this;return t&&e?`${this.hintId} ${this.errorId}`:t?this.hintId:e?this.errorId:void 0}getInvalid(){return this.hasError?"true":void 0}get hasHint(){return Boolean(this.hint)||this.hintSlot.hasContent}get hasError(){return Boolean(this.error)||this.errorSlot.hasContent}}return t([r()],h.prototype,"label",void 0),t([r()],h.prototype,"hint",void 0),t([r({type:Boolean,attribute:"hide-label"})],h.prototype,"hideLabel",void 0),t([r()],h.prototype,"placeholder",void 0),t([r()],h.prototype,"error",void 0),t([r({type:Boolean})],h.prototype,"required",void 0),t([r({reflect:!0,type:Boolean})],h.prototype,"expand",void 0),h}export{h as F};
|
|
2
|
-
//# sourceMappingURL=FormAssociatedMixin-1f97ed66.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormAssociatedMixin-1f97ed66.js","sources":["../src/common/controllers/FormDataController.ts","../src/common/mixins/FormAssociatedMixin.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from \"lit\"\nimport { InputMixinInterface } from \"../mixins/InputMixin.js\"\nimport { EventController } from \"./EventController.js\"\n\ntype FormDataOptions = {\n value: () => string | undefined\n}\n\nexport class FormDataController implements ReactiveController {\n private events: EventController\n constructor(private host: ReactiveControllerHost & InputMixinInterface, private options: FormDataOptions) {\n this.host = host\n host.addController(this)\n this.options = options\n this.events = new EventController(host)\n }\n\n hostConnected() {\n if (this.host.form) {\n this.events.listen(this.host.form, \"formdata\", this.handleFormData)\n }\n }\n\n private handleFormData = (e: FormDataEvent) => {\n const { disabled, name } = this.host\n\n if (disabled) {\n return\n }\n\n const value = this.options.value()\n\n if (name && value != null) {\n e.formData.append(name, value)\n }\n }\n}\n","/* eslint-disable max-classes-per-file */\nimport { html, LitElement, TemplateResult } from \"lit\"\nimport { property } from \"lit/decorators.js\"\nimport { FormDataController } from \"../controllers/FormDataController.js\"\nimport { SlotController } from \"../controllers/SlotController.js\"\nimport { NordEvent } from \"../events.js\"\nimport { InputMixinInterface } from \"./InputMixin.js\"\nimport \"../../visually-hidden/VisuallyHidden.js\"\n\ntype Constructor<T = Record<string, unknown>> = new (...args: any[]) => T\ntype NativeInputElement = HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement\n\nexport declare class FormAssociatedMixinInterface {\n label: string\n required: boolean\n hint?: string\n hideLabel: boolean\n placeholder?: string\n error?: string\n expand: boolean\n\n protected inputId: string\n protected errorId: string\n protected hintId: string\n protected labelSlot: SlotController\n protected hintSlot: SlotController\n protected errorSlot: SlotController\n protected formData: FormDataController\n\n protected get formValue(): string | undefined\n protected get hasError(): boolean\n protected get hasHint(): boolean\n\n protected handleChange(e: Event): void\n protected handleInput(e: Event): void\n protected renderLabel(): TemplateResult\n protected renderError(): TemplateResult\n protected getDescribedBy(): string | undefined\n protected getInvalid(): \"true\" | undefined\n}\n\nexport function FormAssociatedMixin<T extends Constructor<InputMixinInterface & LitElement>>(superClass: T) {\n // TODO: would be nice if custom elements analyzer could pick up the slot docs from the mixin\n\n /**\n * @slot label - Use when a label requires more than plain text.\n * @slot hint - Use when a hint requires more than plain text.\n * @slot error - Optional slot that holds error text for the input.\n */\n class FormAssociatedElement extends superClass {\n protected labelSlot = new SlotController(this, \"label\")\n protected errorSlot = new SlotController(this, \"error\")\n protected hintSlot = new SlotController(this, \"hint\")\n protected formData = new FormDataController(this, { value: () => this.formValue })\n\n protected get formValue() {\n return this.value\n }\n\n protected inputId = \"input\"\n protected errorId = \"error\"\n protected hintId = \"hint\"\n\n /**\n * Label for the input.\n */\n @property() label: string = \"\"\n\n /**\n * Optional hint text to be displayed with the input. Alternatively use the hint slot.\n */\n @property() hint?: string\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @property({ type: Boolean, attribute: \"hide-label\" }) hideLabel = false\n\n /**\n * Placeholder text to display within the input.\n */\n @property() placeholder?: string\n\n /**\n * Optional error to be shown with the input. Alternatively use the error slot.\n */\n @property() error?: string\n\n /**\n * Determines whether the input is required or not.\n * An input marked as required will be announced as such to users of assistive technology.\n * When using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors.\n */\n @property({ type: Boolean }) required = false\n\n /**\n * Controls whether the input expands to fill the width of its container.\n */\n @property({ reflect: true, type: Boolean }) expand = false\n\n protected handleInput(e: Event) {\n e.stopPropagation()\n const target = e.target as NativeInputElement\n this.value = target.value\n\n /**\n * Fired as the user types into the input.\n */\n this.dispatchEvent(new NordEvent(\"input\"))\n }\n\n protected handleChange(e: Event) {\n e.stopPropagation()\n\n /**\n * Fired whenever the input's value is changed via user interaction.\n */\n this.dispatchEvent(new NordEvent(\"change\"))\n }\n\n protected renderLabel() {\n const label = html`\n <label for=${this.inputId}>\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div class=\"n-caption n-hint\" id=${this.hintId} ?hidden=${!this.hasHint}>\n <slot name=\"hint\">${this.hint}</slot>\n </div>\n `\n\n return this.hideLabel\n ? html`<nord-visually-hidden>${label}</nord-visually-hidden>`\n : html`<div class=\"n-label-container\">${label}</div>`\n }\n\n protected renderError() {\n return html`\n <div class=\"n-caption n-error\" id=${this.errorId} role=\"alert\" ?hidden=${!this.hasError}>\n <slot name=\"error\">${this.error}</slot>\n </div>\n `\n }\n\n protected getDescribedBy() {\n const { hasHint, hasError } = this\n\n if (hasHint && hasError) {\n return `${this.hintId} ${this.errorId}`\n }\n if (hasHint) {\n return this.hintId\n }\n if (hasError) {\n return this.errorId\n }\n\n return undefined\n }\n\n protected getInvalid() {\n return this.hasError ? \"true\" : undefined\n }\n\n protected get hasHint() {\n return Boolean(this.hint) || this.hintSlot.hasContent\n }\n\n protected get hasError() {\n return Boolean(this.error) || this.errorSlot.hasContent\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedMixinInterface> & T\n}\n"],"names":["FormDataController","constructor","host","options","this","e","disabled","name","value","formData","append","addController","events","EventController","hostConnected","form","listen","handleFormData","FormAssociatedMixin","superClass","FormAssociatedElement","SlotController","formValue","handleInput","stopPropagation","target","dispatchEvent","NordEvent","handleChange","renderLabel","label","html","inputId","hintId","hasHint","hint","hideLabel","renderError","errorId","hasError","error","getDescribedBy","getInvalid","undefined","Boolean","hintSlot","hasContent","errorSlot","__decorate","property","type","attribute","reflect"],"mappings":"iUAQaA,EAEXC,YAAoBC,EAA4DC,GAA5DC,UAAAF,EAA4DE,aAAAD,EAaxEC,oBAAkBC,IACxB,MAAMC,SAAEA,EAAQC,KAAEA,GAASH,KAAKF,KAEhC,GAAII,EACF,OAGF,MAAME,EAAQJ,KAAKD,QAAQK,QAEvBD,GAAiB,MAATC,GACVH,EAAEI,SAASC,OAAOH,EAAMC,IAtB1BJ,KAAKF,KAAOA,EACZA,EAAKS,cAAcP,MACnBA,KAAKD,QAAUA,EACfC,KAAKQ,OAAS,IAAIC,EAAgBX,GAGpCY,gBACMV,KAAKF,KAAKa,MACZX,KAAKQ,OAAOI,OAAOZ,KAAKF,KAAKa,KAAM,WAAYX,KAAKa,0BCsB1CC,EAA6EC,GAQ3F,MAAMC,UAA8BD,EAApClB,kCACYG,eAAY,IAAIiB,EAAejB,KAAM,SACrCA,eAAY,IAAIiB,EAAejB,KAAM,SACrCA,cAAW,IAAIiB,EAAejB,KAAM,QACpCA,cAAW,IAAIJ,EAAmBI,KAAM,CAAEI,MAAO,IAAMJ,KAAKkB,YAM5DlB,aAAU,QACVA,aAAU,QACVA,YAAS,OAKPA,WAAgB,GAU0BA,gBAAY,EAiBrCA,eAAW,EAKIA,aAAS,EA3CvCkB,gBACZ,OAAOlB,KAAKI,MA4CJe,YAAYlB,GACpBA,EAAEmB,kBACF,MAAMC,EAASpB,EAAEoB,OACjBrB,KAAKI,MAAQiB,EAAOjB,MAKpBJ,KAAKsB,cAAc,IAAIC,EAAU,UAGzBC,aAAavB,GACrBA,EAAEmB,kBAKFpB,KAAKsB,cAAc,IAAIC,EAAU,WAGzBE,cACR,MAAMC,EAAQC,CAAI,eACH3B,KAAK4B,+BACK5B,KAAK0B,yDAGO1B,KAAK6B,qBAAmB7B,KAAK8B,8BAC1C9B,KAAK+B,oBAI7B,OAAO/B,KAAKgC,UACRL,CAAI,yBAAyBD,2BAC7BC,CAAI,kCAAkCD,UAGlCO,cACR,OAAON,CAAI,sCAC2B3B,KAAKkC,mCAAiClC,KAAKmC,gCACxDnC,KAAKoC,qBAKtBC,iBACR,MAAMP,QAAEA,EAAOK,SAAEA,GAAanC,KAE9B,OAAI8B,GAAWK,EACN,GAAGnC,KAAK6B,UAAU7B,KAAKkC,UAE5BJ,EACK9B,KAAK6B,OAEVM,EACKnC,KAAKkC,aADd,EAOQI,aACR,OAAOtC,KAAKmC,SAAW,YAASI,EAGpBT,cACZ,OAAOU,QAAQxC,KAAK+B,OAAS/B,KAAKyC,SAASC,WAG/BP,eACZ,OAAOK,QAAQxC,KAAKoC,QAAUpC,KAAK2C,UAAUD,YAIjD,OA3GcE,GAAXC,iCAKWD,GAAXC,gCAKqDD,GAArDC,EAAS,CAAEC,KAAMN,QAASO,UAAW,gDAK1BH,GAAXC,uCAKWD,GAAXC,iCAO4BD,GAA5BC,EAAS,CAAEC,KAAMN,0CAK0BI,GAA3CC,EAAS,CAAEG,SAAS,EAAMF,KAAMN,wCA2E5BxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormField-50bd73d5.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputMixin-94d15730.js","sources":["../src/common/mixins/InputMixin.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { LitElement } from \"lit\"\nimport { property } from \"lit/decorators.js\"\n\ntype Constructor<T = Record<string, unknown>> = new (...args: any[]) => T\n\nexport declare class InputMixinInterface {\n name: string\n value: string\n disabled: boolean\n form?: HTMLFormElement\n}\n\nexport function InputMixin<T extends Constructor<LitElement>>(superClass: T): Constructor<InputMixinInterface> & T {\n class InputElement extends superClass {\n /**\n * Makes the component disabled. This prevents users from\n * being able to interact with the component, and conveys\n * its inactive state to assistive technologies.\n */\n @property({ type: Boolean, reflect: true }) disabled = false\n\n /**\n * The name of the form component.\n */\n @property() name?: string\n\n /**\n * The value of the form component.\n */\n @property() value: string = \"\"\n\n /**\n * Gets the form, if any, associated with the form element.\n */\n protected get form() {\n return this.closest(\"form\") || undefined\n }\n }\n\n return InputElement as unknown as Constructor<InputMixinInterface> & T\n}\n"],"names":["InputMixin","superClass","InputElement","constructor","this","form","closest","undefined","__decorate","property","type","Boolean","reflect"],"mappings":"8GAagBA,EAA8CC,GAC5D,MAAMC,UAAqBD,EAA3BE,kCAM8CC,eAAW,EAU3CA,WAAgB,GAKdC,WACZ,OAAOD,KAAKE,QAAQ,cAAWC,GAInC,OApB8CC,GAA3CC,EAAS,CAAEC,KAAMC,QAASC,SAAS,oCAKxBJ,GAAXC,gCAKWD,GAAXC,iCAUIP"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as s}from"./EventController-d99ebeef.js";import{S as t}from"./ShortcutController-93173ff4.js";class i{constructor(i,o){this.host=i,this.options=o,this.handleEsc=s=>{this.options.isOpen()&&this.options.onDismiss(s)},this.handleClickOut=s=>{var t;if(!this.options.isOpen())return;const i=null!==(t=this.options.isDismissible)&&void 0!==t?t:s=>s!==this.host;s.composedPath().every(i)&&this.options.onDismiss(s)},this.host=i,i.addController(this),this.options=o,this.shortcut=new t(this.host,{Escape:this.handleEsc}),this.events=new s(i)}hostConnected(){this.events.listen(document,"click",this.handleClickOut,!0)}}export{i as L};
|
|
2
|
-
//# sourceMappingURL=LightDismissController-a35d0f66.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LightDismissController-a35d0f66.js","sources":["../src/common/controllers/LightDismissController.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from \"lit\"\nimport { EventController } from \"./EventController.js\"\nimport { ShortcutController } from \"./ShortcutController.js\"\n\ntype LightDismissOptions = {\n isOpen: () => boolean\n onDismiss: EventListener\n isDismissible?: (node: EventTarget) => boolean\n}\n\nexport class LightDismissController implements ReactiveController {\n private shortcut: ShortcutController\n private events: EventController\n\n constructor(private host: ReactiveControllerHost & Element, private options: LightDismissOptions) {\n this.host = host\n host.addController(this)\n\n this.options = options\n this.shortcut = new ShortcutController(this.host, { Escape: this.handleEsc })\n this.events = new EventController(host)\n }\n\n hostConnected() {\n this.events.listen(document, \"click\", this.handleClickOut, true)\n }\n\n private handleEsc = (e: KeyboardEvent) => {\n if (!this.options.isOpen()) {\n return\n }\n\n this.options.onDismiss(e)\n }\n\n private handleClickOut = (e: MouseEvent) => {\n if (!this.options.isOpen()) {\n return\n }\n\n const predicate: LightDismissOptions[\"isDismissible\"] = this.options.isDismissible ?? (node => node !== this.host)\n const isClickOutside = e.composedPath().every(predicate)\n\n if (isClickOutside) {\n this.options.onDismiss(e)\n }\n }\n}\n"],"names":["LightDismissController","constructor","host","options","this","e","isOpen","onDismiss","predicate","isDismissible","node","composedPath","every","addController","shortcut","ShortcutController","Escape","handleEsc","events","EventController","hostConnected","listen","document","handleClickOut"],"mappings":"6GAUaA,EAIXC,YAAoBC,EAAgDC,GAAhDC,UAAAF,EAAgDE,aAAAD,EAa5DC,eAAaC,IACdD,KAAKD,QAAQG,UAIlBF,KAAKD,QAAQI,UAAUF,IAGjBD,oBAAkBC,UACxB,IAAKD,KAAKD,QAAQG,SAChB,OAGF,MAAME,YAAkDJ,KAAKD,QAAQM,6BAAkBC,GAAQA,IAASN,KAAKF,KACtFG,EAAEM,eAAeC,MAAMJ,IAG5CJ,KAAKD,QAAQI,UAAUF,IA7BzBD,KAAKF,KAAOA,EACZA,EAAKW,cAAcT,MAEnBA,KAAKD,QAAUA,EACfC,KAAKU,SAAW,IAAIC,EAAmBX,KAAKF,KAAM,CAAEc,OAAQZ,KAAKa,YACjEb,KAAKc,OAAS,IAAIC,EAAgBjB,GAGpCkB,gBACEhB,KAAKc,OAAOG,OAAOC,SAAU,QAASlB,KAAKmB,gBAAgB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{x as t,w as s}from"./lit-element-74b6bb4b.js";class o{constructor(t,s){this.host=t,this.options=s,this.host=t,this.options=s,t.addController(this)}get container(){return this.options.container||this.host}hostUpdated(){this.render()}hostDisconnected(){t(s,this.container,this.options.renderOptions)}render(){t(this.options.render(),this.container,this.options.renderOptions)}}export{o as L};
|
|
2
|
-
//# sourceMappingURL=LightDomController-011334da.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LightDomController-011334da.js","sources":["../src/common/controllers/LightDomController.ts"],"sourcesContent":["import { nothing, ReactiveController, ReactiveControllerHost, render, RenderOptions } from \"lit\"\n\ntype LightDomOptions = {\n render: () => unknown\n renderOptions?: RenderOptions\n container?: HTMLElement\n}\n\nexport class LightDomController implements ReactiveController {\n constructor(private host: ReactiveControllerHost & HTMLElement, private options: LightDomOptions) {\n this.host = host\n this.options = options\n host.addController(this)\n }\n\n private get container(): HTMLElement {\n return this.options.container || this.host\n }\n\n hostUpdated() {\n this.render()\n }\n\n hostDisconnected() {\n render(nothing, this.container, this.options.renderOptions)\n }\n\n private render() {\n render(this.options.render(), this.container, this.options.renderOptions)\n }\n}\n"],"names":["LightDomController","constructor","host","options","this","addController","container","hostUpdated","render","hostDisconnected","nothing","renderOptions"],"mappings":"2DAQaA,EACXC,YAAoBC,EAAoDC,GAApDC,UAAAF,EAAoDE,aAAAD,EACtEC,KAAKF,KAAOA,EACZE,KAAKD,QAAUA,EACfD,EAAKG,cAAcD,MAGTE,gBACV,OAAOF,KAAKD,QAAQG,WAAaF,KAAKF,KAGxCK,cACEH,KAAKI,SAGPC,mBACED,EAAOE,EAASN,KAAKE,UAAWF,KAAKD,QAAQQ,eAGvCH,SACNA,EAAOJ,KAAKD,QAAQK,SAAUJ,KAAKE,UAAWF,KAAKD,QAAQQ"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as t}from"./tinykeys.module-84e6cc41.js";const s=/Arrow(Up|Down|Left|Right)/g,i=/Escape/g;class o{constructor(t,s,i=window){this.shortcuts=s,this.target=i,t.addController(this),this.shortcuts=s,this.target=i}hostConnected(){this.shortcuts&&this.bind(this.shortcuts)}hostDisconnected(){this.unbind()}unbind(){var t;null===(t=this.unregister)||void 0===t||t.call(this)}bind(o){this.unbind(),this.shortcuts=o,this.unregister=t(this.target,function(t){const o={};return Object.keys(t).forEach((r=>{if(o[r]=t[r],s.test(r)){const t=r.replace(s,((t,s)=>s));o[t]=o[r]}if(i.test(r)){const t=r.replace(i,(()=>"Esc"));o[t]=o[r]}})),o}(this.shortcuts))}}export{o as S};
|
|
2
|
-
//# sourceMappingURL=ShortcutController-93173ff4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ShortcutController-93173ff4.js","sources":["../src/common/controllers/ShortcutController.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from \"lit\"\nimport type { KeyBindingMap } from \"tinykeys\"\nimport tinykeys from \"tinykeys\"\n\ntype ShortcutTarget = Parameters<typeof tinykeys>[0]\n\nconst ARROW_RE = /Arrow(Up|Down|Left|Right)/g\nconst ESC_RE = /Escape/g\n\nfunction normalise(shortcuts: KeyBindingMap) {\n const normalised: KeyBindingMap = {}\n\n Object.keys(shortcuts).forEach(keybinding => {\n normalised[keybinding] = shortcuts[keybinding]\n\n // Arrow and Escape keys in IE/Edge have different names\n if (ARROW_RE.test(keybinding)) {\n const mapped = keybinding.replace(ARROW_RE, (_match, capture) => capture)\n normalised[mapped] = normalised[keybinding]\n }\n if (ESC_RE.test(keybinding)) {\n const mapped = keybinding.replace(ESC_RE, () => \"Esc\")\n normalised[mapped] = normalised[keybinding]\n }\n })\n\n return normalised\n}\n\nexport class ShortcutController implements ReactiveController {\n private unregister?: ReturnType<typeof tinykeys>\n\n constructor(\n host: ReactiveControllerHost,\n private shortcuts?: KeyBindingMap,\n private target: ShortcutTarget = window\n ) {\n host.addController(this)\n this.shortcuts = shortcuts\n this.target = target\n }\n\n hostConnected() {\n if (this.shortcuts) {\n this.bind(this.shortcuts)\n }\n }\n\n hostDisconnected() {\n this.unbind()\n }\n\n unbind() {\n this.unregister?.()\n }\n\n bind(shortcuts: KeyBindingMap) {\n this.unbind()\n this.shortcuts = shortcuts\n this.unregister = tinykeys(this.target, normalise(this.shortcuts))\n }\n}\n\nexport type { KeyBindingMap as ShortcutMap }\n"],"names":["ARROW_RE","ESC_RE","ShortcutController","constructor","host","shortcuts","target","window","this","addController","hostConnected","bind","hostDisconnected","unbind","unregister","tinykeys","normalised","Object","keys","forEach","keybinding","test","mapped","replace","_match","capture","normalise"],"mappings":"kDAMA,MAAMA,EAAW,6BACXC,EAAS,gBAsBFC,EAGXC,YACEC,EACQC,EACAC,EAAyBC,QADzBC,eAAAH,EACAG,YAAAF,EAERF,EAAKK,cAAcD,MACnBA,KAAKH,UAAYA,EACjBG,KAAKF,OAASA,EAGhBI,gBACMF,KAAKH,WACPG,KAAKG,KAAKH,KAAKH,WAInBO,mBACEJ,KAAKK,SAGPA,yBACEL,KAAKM,gCAALN,MAGFG,KAAKN,GACHG,KAAKK,SACLL,KAAKH,UAAYA,EACjBG,KAAKM,WAAaC,EAASP,KAAKF,OAlDpC,SAAmBD,GACjB,MAAMW,EAA4B,GAgBlC,OAdAC,OAAOC,KAAKb,GAAWc,SAAQC,IAI7B,GAHAJ,EAAWI,GAAcf,EAAUe,GAG/BpB,EAASqB,KAAKD,GAAa,CAC7B,MAAME,EAASF,EAAWG,QAAQvB,GAAU,CAACwB,EAAQC,IAAYA,IACjET,EAAWM,GAAUN,EAAWI,GAElC,GAAInB,EAAOoB,KAAKD,GAAa,CAC3B,MAAME,EAASF,EAAWG,QAAQtB,GAAQ,IAAM,QAChDe,EAAWM,GAAUN,EAAWI,OAI7BJ,EAiCmCU,CAAUlB,KAAKH"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as t}from"./EventController-d99ebeef.js";class s{constructor(s,e=""){this.host=s,this.slotName=e,this.handleSlotChange=t=>{t.target.name===this.slotName&&this.onChange(t)},this.host=s,s.addController(this),this.slotName=e,this.events=new t(s)}hostConnected(){this.host.shadowRoot&&this.events.listen(this.host.shadowRoot,"slotchange",this.handleSlotChange)}get hasContent(){return null!=this.content}get isEmpty(){return!this.hasContent}get content(){const t=this.slotName?`[slot="${this.slotName}"]`:":not([slot])";return this.host.querySelector(t)}onChange(t){this.host.requestUpdate()}}export{s as S};
|
|
2
|
-
//# sourceMappingURL=SlotController-683d0e7c.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SlotController-683d0e7c.js","sources":["../src/common/controllers/SlotController.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from \"lit\"\nimport { EventController } from \"./EventController.js\"\n\nexport class SlotController implements ReactiveController {\n private events: EventController\n\n constructor(protected host: ReactiveControllerHost & HTMLElement, public slotName: string = \"\") {\n this.host = host\n host.addController(this)\n this.slotName = slotName\n this.events = new EventController(host)\n }\n\n hostConnected() {\n if (this.host.shadowRoot) {\n this.events.listen(this.host.shadowRoot, \"slotchange\", this.handleSlotChange)\n }\n }\n\n get hasContent() {\n return this.content != null\n }\n\n get isEmpty() {\n return !this.hasContent\n }\n\n get content() {\n const selector = this.slotName ? `[slot=\"${this.slotName}\"]` : `:not([slot])`\n return this.host.querySelector(selector)\n }\n\n private handleSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement\n\n if (slot.name === this.slotName) {\n this.onChange(e)\n }\n }\n\n protected onChange(_e: Event) {\n this.host.requestUpdate()\n }\n}\n"],"names":["SlotController","constructor","host","slotName","this","e","target","name","onChange","addController","events","EventController","hostConnected","shadowRoot","listen","handleSlotChange","hasContent","content","isEmpty","selector","querySelector","_e","requestUpdate"],"mappings":"wDAGaA,EAGXC,YAAsBC,EAAmDC,EAAmB,IAAtEC,UAAAF,EAAmDE,cAAAD,EA0BjEC,sBAAoBC,IACbA,EAAEC,OAENC,OAASH,KAAKD,UACrBC,KAAKI,SAASH,IA7BhBD,KAAKF,KAAOA,EACZA,EAAKO,cAAcL,MACnBA,KAAKD,SAAWA,EAChBC,KAAKM,OAAS,IAAIC,EAAgBT,GAGpCU,gBACMR,KAAKF,KAAKW,YACZT,KAAKM,OAAOI,OAAOV,KAAKF,KAAKW,WAAY,aAAcT,KAAKW,kBAI5DC,iBACF,OAAuB,MAAhBZ,KAAKa,QAGVC,cACF,OAAQd,KAAKY,WAGXC,cACF,MAAME,EAAWf,KAAKD,SAAW,UAAUC,KAAKD,aAAe,eAC/D,OAAOC,KAAKF,KAAKkB,cAAcD,GAWvBX,SAASa,GACjBjB,KAAKF,KAAKoB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as n}from"./lit-element-74b6bb4b.js";const r=n`.n-input-container{position:relative}.n-input{background:var(--n-color-active);color:var(--n-color-text);padding-block-start:calc(var(--n-space-s) - 1px);padding-block-end:calc(var(--n-space-s) - 1px);padding-inline-start:calc(var(--n-space-s) * 1.6);padding-inline-end:calc(var(--n-space-s) * 1.6);border-radius:var(--n-border-radius-s);border:1px solid var(--n-input-border-color,var(--n-color-border-strong));font-family:var(--n-font-family);font-size:var(--n-font-size-m);line-height:var(--n-line-height-form);min-inline-size:240px;transition:border var(--n-transition-slowly),box-shadow var(--n-transition-slowly),background var(--n-transition-slowly)}@media (max-width:480px){.n-input{font-size:var(--n-font-size-l)}}:host([expand]){inline-size:100%}:host([expand]) .n-input{display:block;min-inline-size:0;inline-size:100%}.n-input:hover,.n-label-container:hover+.n-input-container .n-input{--n-input-border-color:var(--n-color-border-hover)}.n-input:focus{--n-input-border-color:var(--n-color-accent);background:var(--n-color-surface);outline:0;box-shadow:0 0 0 1px var(--n-input-border-color)}.n-input::placeholder{color:var(--n-color-text-weakest)}.n-input:disabled,.n-label-container:hover+.n-input-container .n-input:disabled{--n-input-border-color:var(--n-color-active);color:var(--n-color-text-weakest)}.n-input[aria-invalid=true]{--n-input-border-color:var(--n-color-status-danger)!important}`;export{r as s};
|
|
2
|
-
//# sourceMappingURL=TextField-9bee8388.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextField-9bee8388.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/dates-9272b910.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const t=/^(\d{4})-(\d{2})-(\d{2})$/;function e(t,e,n){const a=parseInt(n,10),r=parseInt(e,10),o=parseInt(t,10);if(Number.isInteger(o)&&Number.isInteger(r)&&Number.isInteger(a)&&r>0&&r<=12&&a>0&&a<=31&&o>0){const t=new Date(o,r-1,a);return t.setFullYear(o),t}}function n(n){if(!n)return;const a=n.match(t);return a?e(a[1],a[2],a[3]):void 0}function a(t){if(!t)return"";const e=t.getDate().toString(10),n=(t.getMonth()+1).toString(10);return`${t.getFullYear().toString(10).padStart(4,"0")}-${n.padStart(2,"0")}-${e.padStart(2,"0")}`}function r(){const t=new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0))}function o(t,e){const n=[],a={weekday:e},o=r();for(let e=0;e<7;e++)n[o.getDay()]=o.toLocaleDateString(t,a),o.setDate(o.getDate()+1);return n}function u(t,e){const n=[],a={month:e},o=r();for(let e=0;e<12;e++)n[o.getMonth()]=o.toLocaleDateString(t,a),o.setMonth(o.getMonth()+1);return n}function s(t,e){return null!=t&&null!=e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth())}function c(t,e){return null!=t&&null!=e&&(s(t,e)&&t.getDate()===e.getDate())}function g(t,e){const n=new Date(t);return n.setDate(n.getDate()+e),n}function l(t,e=1){const n=new Date(t),a=n.getDay(),r=(a<e?7:0)+a-e;return n.setDate(n.getDate()-r),n}function i(t,e=1){const n=new Date(t),a=n.getDay(),r=6+(a<e?-7:0)-(a-e);return n.setDate(n.getDate()+r),n}function D(t){const e=new Date(t.getFullYear(),t.getMonth(),1);return e.setFullYear(t.getFullYear()),e}function f(t){const e=new Date(t.getFullYear(),t.getMonth()+1,0);return e.setFullYear(t.getFullYear()),e}function h(t,e){const n=new Date(t);return n.setMonth(e),n}function F(t,e){const n=new Date(t);return n.setFullYear(e),n}function Y(t,e,n){const a=t.getTime();return e&&e instanceof Date&&a<e.getTime()?e:n&&n instanceof Date&&a>n.getTime()?n:t}function w(t,e,n){return Y(t,e,n)===t}function p(t,e=1){return function(t,e){const n=[];let a=t;for(;!c(a,e);)n.push(a),a=g(a,1);return n.push(a),n}(l(D(t),e),i(f(t),e))}export{a,s as b,o as c,g as d,f as e,l as f,u as g,i as h,w as i,h as j,Y as k,F as l,e as m,c as n,p as o,n as p,D as s};
|
|
2
|
-
//# sourceMappingURL=dates-9272b910.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dates-9272b910.js","sources":["../src/common/dates.ts"],"sourcesContent":["const ISO_DATE_FORMAT = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\nexport const enum DaysOfWeek {\n Sunday = 0,\n Monday = 1,\n Tuesday = 2,\n Wednesday = 3,\n Thursday = 4,\n Friday = 5,\n Saturday = 6,\n}\n\nexport function createDate(year: string, month: string, day: string): Date | undefined {\n const dayInt = parseInt(day, 10)\n const monthInt = parseInt(month, 10)\n const yearInt = parseInt(year, 10)\n\n const isValid =\n Number.isInteger(yearInt) && // all parts should be integers\n Number.isInteger(monthInt) &&\n Number.isInteger(dayInt) &&\n monthInt > 0 && // month must be 1-12\n monthInt <= 12 &&\n dayInt > 0 && // day must be 1-31\n dayInt <= 31 &&\n yearInt > 0\n\n if (isValid) {\n const date = new Date(yearInt, monthInt - 1, dayInt)\n // this handles values where year is 0-99, which JS \"helpfully\" interprets as 1900-1999\n date.setFullYear(yearInt)\n\n return date\n }\n\n return undefined\n}\n\n/**\n * @param value date string in ISO format YYYY-MM-DD\n */\nexport function parseISODate(value: string): Date | undefined {\n if (!value) {\n return undefined\n }\n\n const matches = value.match(ISO_DATE_FORMAT)\n\n if (matches) {\n return createDate(matches[1], matches[2], matches[3])\n }\n\n return undefined\n}\n\n/**\n * print date in format YYYY-MM-DD\n * @param date\n */\nexport function printISODate(date: Date): string {\n if (!date) {\n return \"\"\n }\n\n const d = date.getDate().toString(10)\n const m = (date.getMonth() + 1).toString(10)\n const y = date.getFullYear().toString(10)\n\n return `${y.padStart(4, \"0\")}-${m.padStart(2, \"0\")}-${d.padStart(2, \"0\")}`\n}\n\nfunction today() {\n const date = new Date()\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0))\n}\n\nexport function getDayNames(locale: string, weekday: Exclude<Intl.DateTimeFormatOptions[\"weekday\"], undefined>) {\n const days = []\n const options = { weekday }\n const day = today()\n\n for (let i = 0; i < 7; i++) {\n days[day.getDay()] = day.toLocaleDateString(locale, options)\n day.setDate(day.getDate() + 1)\n }\n\n return days\n}\n\nexport function getMonthNames(locale: string, month: Exclude<Intl.DateTimeFormatOptions[\"month\"], undefined>) {\n const months = []\n const options = { month }\n const day = today()\n\n for (let i = 0; i < 12; i++) {\n months[day.getMonth()] = day.toLocaleDateString(locale, options)\n day.setMonth(day.getMonth() + 1)\n }\n\n return months\n}\n\n/**\n * Compare if two dates are in the same month of the same year.\n */\nexport function isEqualMonth(a?: Date, b?: Date): boolean {\n if (a == null || b == null) {\n return false\n }\n\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth()\n}\n\n/**\n * Compare if two dates are equal in terms of day, month, and year\n */\nexport function isEqual(a?: Date, b?: Date): boolean {\n if (a == null || b == null) {\n return false\n }\n\n return isEqualMonth(a, b) && a.getDate() === b.getDate()\n}\n\nexport function addDays(date: Date, days: number): Date {\n const d = new Date(date)\n d.setDate(d.getDate() + days)\n return d\n}\n\nexport function addMonths(date: Date, months: number): Date {\n const d = new Date(date)\n d.setMonth(date.getMonth() + months)\n return d\n}\n\nexport function addYears(date: Date, years: number): Date {\n const d = new Date(date)\n d.setFullYear(date.getFullYear() + years)\n return d\n}\n\nexport function startOfWeek(date: Date, firstDayOfWeek: DaysOfWeek = DaysOfWeek.Monday): Date {\n const d = new Date(date)\n const day = d.getDay()\n const diff = (day < firstDayOfWeek ? 7 : 0) + day - firstDayOfWeek\n\n d.setDate(d.getDate() - diff)\n return d\n}\n\nexport function endOfWeek(date: Date, firstDayOfWeek: DaysOfWeek = DaysOfWeek.Monday): Date {\n const d = new Date(date)\n const day = d.getDay()\n const diff = (day < firstDayOfWeek ? -7 : 0) + 6 - (day - firstDayOfWeek)\n\n d.setDate(d.getDate() + diff)\n return d\n}\n\nexport function startOfMonth(date: Date): Date {\n const d = new Date(date.getFullYear(), date.getMonth(), 1)\n d.setFullYear(date.getFullYear())\n return d\n}\n\nexport function endOfMonth(date: Date): Date {\n const d = new Date(date.getFullYear(), date.getMonth() + 1, 0)\n d.setFullYear(date.getFullYear())\n return d\n}\n\nexport function setMonth(date: Date, month: number): Date {\n const d = new Date(date)\n d.setMonth(month)\n return d\n}\n\nexport function setYear(date: Date, year: number): Date {\n const d = new Date(date)\n d.setFullYear(year)\n return d\n}\n\n/**\n * Ensures date is within range, returns min or max if out of bounds\n */\nexport function clamp(date: Date, min?: Date, max?: Date): Date {\n const time = date.getTime()\n\n if (min && min instanceof Date && time < min.getTime()) {\n return min\n }\n\n if (max && max instanceof Date && time > max.getTime()) {\n return max\n }\n\n return date\n}\n\n/**\n * Check if date is within a min and max\n */\nexport function inRange(date: Date, min?: Date, max?: Date): boolean {\n return clamp(date, min, max) === date\n}\n\n/**\n * given start and end date, return an (inclusive) array of all dates in between\n * @param start\n * @param end\n */\nfunction getDaysInRange(start: Date, end: Date): Date[] {\n const days: Date[] = []\n let current = start\n\n while (!isEqual(current, end)) {\n days.push(current)\n current = addDays(current, 1)\n }\n\n days.push(current)\n\n return days\n}\n\n/**\n * given a date, return an array of dates from a calendar perspective\n * @param date\n * @param firstDayOfWeek\n */\nexport function getViewOfMonth(date: Date, firstDayOfWeek: DaysOfWeek = DaysOfWeek.Monday): Date[] {\n const start = startOfWeek(startOfMonth(date), firstDayOfWeek)\n const end = endOfWeek(endOfMonth(date), firstDayOfWeek)\n\n return getDaysInRange(start, end)\n}\n"],"names":["ISO_DATE_FORMAT","createDate","year","month","day","dayInt","parseInt","monthInt","yearInt","Number","isInteger","date","Date","setFullYear","parseISODate","value","matches","match","printISODate","d","getDate","toString","m","getMonth","getFullYear","padStart","today","UTC","getDayNames","locale","weekday","days","options","i","getDay","toLocaleDateString","setDate","getMonthNames","months","setMonth","isEqualMonth","a","b","isEqual","addDays","startOfWeek","firstDayOfWeek","diff","endOfWeek","startOfMonth","endOfMonth","setYear","clamp","min","max","time","getTime","inRange","getViewOfMonth","start","end","current","push","getDaysInRange"],"mappings":"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"}
|
package/lib/number-3a8ef88a.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./lit-element-74b6bb4b.js";import{e as t,i as s,t as r}from"./directive-de55b00a.js";import{a as n,c as o,u as l,m as i,s as u}from"./ref-7d028e3a.js";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2017 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const f=(e,t,s)=>{const r=new Map;for(let n=t;n<=s;n++)r.set(e[n],n);return r},a=t(class extends s{constructor(e){if(super(e),e.type!==r.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,s){let r;void 0===s?s=t:void 0!==t&&(r=t);const n=[],o=[];let l=0;for(const t of e)n[l]=r?r(t,l):l,o[l]=s(t,l),l++;return{values:o,keys:n}}render(e,t,s){return this.dt(e,t,s).values}update(t,[s,r,a]){var c;const d=n(t),{values:h,keys:p}=this.dt(s,r,a);if(!Array.isArray(d))return this.ut=p,h;const v=null!==(c=this.ut)&&void 0!==c?c:this.ut=[],m=[];let b,y,x=0,g=d.length-1,j=0,w=h.length-1;for(;x<=g&&j<=w;)if(null===d[x])x++;else if(null===d[g])g--;else if(v[x]===p[j])m[j]=o(d[x],h[j]),x++,j++;else if(v[g]===p[w])m[w]=o(d[g],h[w]),g--,w--;else if(v[x]===p[w])m[w]=o(d[x],h[w]),l(t,m[w+1],d[x]),x++,w--;else if(v[g]===p[j])m[j]=o(d[g],h[j]),l(t,d[x],d[g]),g--,j++;else if(void 0===b&&(b=f(p,j,w),y=f(v,x,g)),b.has(v[x]))if(b.has(v[g])){const e=y.get(p[j]),s=void 0!==e?d[e]:null;if(null===s){const e=l(t,d[x]);o(e,h[j]),m[j]=e}else m[j]=o(s,h[j]),l(t,d[x],s),d[e]=null;j++}else i(d[g]),g--;else i(d[x]),x++;for(;j<=w;){const e=l(t,m[w+1]);o(e,h[j]),m[j++]=e}for(;x<=g;){const e=d[x++];null!==e&&i(e)}return this.ut=p,u(t,m),e}});function c(e,t,s){return e>s?t:e<t?s:e}function d(e,t){const s=[];for(let r=e;r<=t;r++)s.push(r);return s}export{a as c,d as r,c as w};
|
|
7
|
-
//# sourceMappingURL=number-3a8ef88a.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function t(t){return t.split("-")[0]}function e(t){return t.split("-")[1]}function n(e){return["top","bottom"].includes(t(e))?"x":"y"}function o(t){return"y"===t?"height":"width"}function i(i,r,l){let{reference:s,floating:c}=i;const a=s.x+s.width/2-c.width/2,f=s.y+s.height/2-c.height/2,u=n(r),d=o(u),h=s[d]/2-c[d]/2,m="x"===u;let g;switch(t(r)){case"top":g={x:a,y:s.y-c.height};break;case"bottom":g={x:a,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-c.width,y:f};break;default:g={x:s.x,y:s.y}}switch(e(r)){case"start":g[u]-=h*(l&&m?-1:1);break;case"end":g[u]+=h*(l&&m?-1:1)}return g}function r(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function l(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:l,rects:s,elements:c,strategy:a}=t,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=e,g=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(m),p=c[h?"floating"===d?"reference":"floating":d],y=r(await l.getClippingRect({element:null==(n=await(null==l.isElement?void 0:l.isElement(p)))||n?p:p.contextElement||await(null==l.getDocumentElement?void 0:l.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:a})),w=r(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===d?{...s.floating,x:o,y:i}:s.reference,offsetParent:await(null==l.getOffsetParent?void 0:l.getOffsetParent(c.floating)),strategy:a}):s[d]);return{top:y.top-w.top+g.top,bottom:w.bottom-y.bottom+g.bottom,left:y.left-w.left+g.left,right:w.right-y.right+g.right}}const s=Math.min,c=Math.max;function a(t,e,n){return c(t,s(e,n))}const f={left:"right",right:"left",bottom:"top",top:"bottom"};function u(t){return t.replace(/left|right|bottom|top/g,(t=>f[t]))}const d={start:"end",end:"start"};function h(t){return t.replace(/start|end/g,(t=>d[t]))}const m=["top","right","bottom","left"];const g=function(i){return void 0===i&&(i={}),{name:"flip",options:i,async fn(r){var s;const{placement:c,middlewareData:a,rects:f,initialPlacement:d,platform:m,elements:g}=r,{mainAxis:p=!0,crossAxis:y=!0,fallbackPlacements:w,fallbackStrategy:x="bestFit",flipAlignment:v=!0,...b}=i,R=t(c),L=w||(R===d||!v?[u(d)]:function(t){const e=u(t);return[h(t),e,h(e)]}(d)),T=[d,...L],A=await l(r,b),E=[];let k=(null==(s=a.flip)?void 0:s.overflows)||[];if(p&&E.push(A[R]),y){const{main:t,cross:i}=function(t,i,r){void 0===r&&(r=!1);const l=e(t),s=n(t),c=o(s);let a="x"===s?l===(r?"end":"start")?"right":"left":"start"===l?"bottom":"top";return i.reference[c]>i.floating[c]&&(a=u(a)),{main:a,cross:u(a)}}(c,f,await(null==m.isRTL?void 0:m.isRTL(g.floating)));E.push(A[t],A[i])}if(k=[...k,{placement:c,overflows:E}],!E.every((t=>t<=0))){var H,C;const t=(null!=(H=null==(C=a.flip)?void 0:C.index)?H:0)+1,e=T[t];if(e)return{data:{index:t,overflows:k},reset:{placement:e}};let n="bottom";switch(x){case"bestFit":{var P;const t=null==(P=k.slice().sort(((t,e)=>t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)-e.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)))[0])?void 0:P.placement;t&&(n=t);break}case"initialPlacement":n=d}if(c!==n)return{reset:{placement:n}}}return{}}}};function p(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function y(t){return m.some((e=>t[e]>=0))}const w=function(t){let{strategy:e="referenceHidden",...n}=void 0===t?{}:t;return{name:"hide",async fn(t){const{rects:o}=t;switch(e){case"referenceHidden":{const e=p(await l(t,{...n,elementContext:"reference"}),o.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:y(e)}}}case"escaped":{const e=p(await l(t,{...n,altBoundary:!0}),o.floating);return{data:{escapedOffsets:e,escaped:y(e)}}}default:return{}}}}};const x=function(o){return void 0===o&&(o=0),{name:"offset",options:o,async fn(i){const{x:r,y:l,placement:s,rects:c,platform:a,elements:f}=i,u=function(o,i,r,l){void 0===l&&(l=!1);const s=t(o),c=e(o),a="x"===n(o),f=["left","top"].includes(s)?-1:1,u=l&&a?-1:1,d="function"==typeof r?r({...i,placement:o}):r,h="number"==typeof d;let{mainAxis:m,crossAxis:g,alignmentAxis:p}=h?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return c&&"number"==typeof p&&(g="end"===c?-1*p:p),a?{x:g*u,y:m*f}:{x:m*f,y:g*u}}(s,c,o,await(null==a.isRTL?void 0:a.isRTL(f.floating)));return{x:r+u.x,y:l+u.y,data:u}}}};const v=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(o){const{x:i,y:r,placement:s}=o,{mainAxis:c=!0,crossAxis:f=!1,limiter:u={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...d}=e,h={x:i,y:r},m=await l(o,d),g=n(t(s)),p="x"===g?"y":"x";let y=h[g],w=h[p];if(c){const t="y"===g?"bottom":"right";y=a(y+m["y"===g?"top":"left"],y,y-m[t])}if(f){const t="y"===p?"bottom":"right";w=a(w+m["y"===p?"top":"left"],w,w-m[t])}const x=u.fn({...o,[g]:y,[p]:w});return{...x,data:{x:x.x-i,y:x.y-r}}}}};function b(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function R(t){if(null==t)return window;if(!b(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function L(t){return R(t).getComputedStyle(t)}function T(t){return b(t)?"":t?(t.nodeName||"").toLowerCase():""}function A(t){return t instanceof R(t).HTMLElement}function E(t){return t instanceof R(t).Element}function k(t){return t instanceof R(t).ShadowRoot||t instanceof ShadowRoot}function H(t){const{overflow:e,overflowX:n,overflowY:o}=L(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function C(t){return["table","td","th"].includes(T(t))}function P(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=L(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function W(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const D=Math.min,O=Math.max,S=Math.round;function V(t,e,n){var o,i,r,l;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let c=1,a=1;e&&A(t)&&(c=t.offsetWidth>0&&S(s.width)/t.offsetWidth||1,a=t.offsetHeight>0&&S(s.height)/t.offsetHeight||1);const f=E(t)?R(t):window,u=!W()&&n,d=(s.left+(u&&null!=(o=null==(i=f.visualViewport)?void 0:i.offsetLeft)?o:0))/c,h=(s.top+(u&&null!=(r=null==(l=f.visualViewport)?void 0:l.offsetTop)?r:0))/a,m=s.width/c,g=s.height/a;return{width:m,height:g,top:h,right:d+m,bottom:h+g,left:d,x:d,y:h}}function N(t){return(e=t,(e instanceof R(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function B(t){return E(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function M(t){return V(N(t)).left+B(t).scrollLeft}function z(t,e,n){const o=A(e),i=N(e),r=V(t,o&&function(t){const e=V(t);return S(e.width)!==t.offsetWidth||S(e.height)!==t.offsetHeight}(e),"fixed"===n);let l={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==T(e)||H(i))&&(l=B(e)),A(e)){const t=V(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=M(i));return{x:r.left+l.scrollLeft-s.x,y:r.top+l.scrollTop-s.y,width:r.width,height:r.height}}function F(t){return"html"===T(t)?t:t.assignedSlot||t.parentNode||(k(t)?t.host:null)||N(t)}function X(t){return A(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function Y(t){const e=R(t);let n=X(t);for(;n&&C(n)&&"static"===getComputedStyle(n).position;)n=X(n);return n&&("html"===T(n)||"body"===T(n)&&"static"===getComputedStyle(n).position&&!P(n))?e:n||function(t){let e=F(t);for(k(e)&&(e=e.host);A(e)&&!["html","body"].includes(T(e));){if(P(e))return e;e=e.parentNode}return null}(t)||e}function $(t){if(A(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=V(t);return{width:e.width,height:e.height}}function j(t){const e=F(t);return["html","body","#document"].includes(T(e))?t.ownerDocument.body:A(e)&&H(e)?e:j(e)}function q(t,e){var n;void 0===e&&(e=[]);const o=j(t),i=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o),l=i?[r].concat(r.visualViewport||[],H(o)?o:[]):o,s=e.concat(l);return i?s:s.concat(q(l))}function I(t,e,n){return"viewport"===e?r(function(t,e){const n=R(t),o=N(t),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,c=0;if(i){r=i.width,l=i.height;const t=W();(t||!t&&"fixed"===e)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:r,height:l,x:s,y:c}}(t,n)):E(e)?function(t,e){const n=V(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(e,n):r(function(t){var e;const n=N(t),o=B(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=O(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),l=O(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let s=-o.scrollLeft+M(t);const c=-o.scrollTop;return"rtl"===L(i||n).direction&&(s+=O(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:l,x:s,y:c}}(N(t)))}function G(t){const e=q(t),n=["absolute","fixed"].includes(L(t).position)&&A(t)?Y(t):t;return E(n)?e.filter((t=>E(t)&&function(t,e){const n=null==e||null==e.getRootNode?void 0:e.getRootNode();if(null!=t&&t.contains(e))return!0;if(n&&k(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==T(t))):[]}const J={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?G(e):[].concat(n),o],l=r[0],s=r.reduce(((t,n)=>{const o=I(e,n,i);return t.top=O(o.top,t.top),t.right=D(o.right,t.right),t.bottom=D(o.bottom,t.bottom),t.left=O(o.left,t.left),t}),I(e,l,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=A(n),r=N(n);if(n===r)return e;let l={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==T(n)||H(r))&&(l=B(n)),A(n))){const t=V(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-l.scrollLeft+s.x,y:e.y-l.scrollTop+s.y}},isElement:E,getDimensions:$,getOffsetParent:Y,getDocumentElement:N,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:z(e,Y(n),o),floating:{...$(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===L(t).direction};function K(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:s=!1}=o;let c=!1;const a=i&&!s,f=r&&!s,u=l&&!s,d=a||f?[...E(t)?q(t):[],...q(e)]:[];d.forEach((t=>{a&&t.addEventListener("scroll",n,{passive:!0}),f&&t.addEventListener("resize",n)}));let h,m=null;u&&(m=new ResizeObserver(n),E(t)&&m.observe(t),m.observe(e));let g=s?V(t):null;return s&&function e(){if(c)return;const o=V(t);!g||o.x===g.x&&o.y===g.y&&o.width===g.width&&o.height===g.height||n();g=o,h=requestAnimationFrame(e)}(),()=>{var t;c=!0,d.forEach((t=>{a&&t.removeEventListener("scroll",n),f&&t.removeEventListener("resize",n)})),null==(t=m)||t.disconnect(),m=null,s&&cancelAnimationFrame(h)}}const Q=(t,e,n)=>(async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:l=[],platform:s}=n,c=await(null==s.isRTL?void 0:s.isRTL(e));let a=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:f,y:u}=i(a,o,c),d=o,h={};for(let n=0;n<l.length;n++){const{name:m,fn:g}=l[n],{x:p,y,data:w,reset:x}=await g({x:f,y:u,initialPlacement:o,placement:d,strategy:r,middlewareData:h,rects:a,platform:s,elements:{reference:t,floating:e}});f=null!=p?p:f,u=null!=y?y:u,h={...h,[m]:{...h[m],...w}},x&&("object"==typeof x&&(x.placement&&(d=x.placement),x.rects&&(a=!0===x.rects?await s.getElementRects({reference:t,floating:e,strategy:r}):x.rects),({x:f,y:u}=i(a,d,c))),n=-1)}return{x:f,y:u,placement:d,strategy:r,middlewareData:h}})(t,e,{platform:J,...n}),U={"inline-start-start":"left-start","inline-start-end":"left-end","inline-end-start":"right-start","inline-end-end":"right-end","block-start-start":"top-start","block-start-end":"top-end","block-end-start":"bottom-start","block-end-end":"bottom-end"},Z={"inline-start-start":"right-start","inline-start-end":"right-end","inline-end-start":"left-start","inline-end-end":"left-end","block-start-start":"top-start","block-start-end":"top-end","block-end-start":"bottom-start","block-end-end":"bottom-end"},_={"block-end":"bottom","block-start":"top","inline-start":"left","inline-end":"right"};function tt(t,e,n){if(null!=e&&null!=n){const o=`${t}-${e}`;return"ltr"===n?U[o]:Z[o]}return _[t]}export{K as a,Q as c,g as f,w as h,tt as l,x as o,v as s};
|
|
2
|
-
//# sourceMappingURL=positioning-72899e14.js.map
|