@nordhealth/components 4.12.9 → 4.14.0
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/custom-elements.json +17539 -8491
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/Card.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/DatePicker.js +1 -1
- package/lib/Dropdown.js +1 -1
- package/lib/IconManager.js +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/Modal.js +1 -1
- package/lib/Modal.js.map +1 -1
- package/lib/ModalController.js +1 -1
- package/lib/ModalController.js.map +1 -1
- package/lib/Navigation.js +1 -1
- package/lib/Navigation.js.map +1 -1
- package/lib/Popout-vR6LxNS9.js +2 -0
- package/lib/Popout-vR6LxNS9.js.map +1 -0
- package/lib/Popout.js +1 -1
- package/lib/bundle.js +12 -12
- package/lib/bundle.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/react.d.ts +12 -2
- package/lib/src/button/Button.d.ts +1 -0
- package/lib/src/card/Card.d.ts +8 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/input/Input.d.ts +12 -0
- package/lib/src/modal/Modal.d.ts +23 -3
- package/lib/src/modal/ModalController.d.ts +2 -2
- package/lib/src/navigation/Navigation.d.ts +9 -0
- package/lib/src/popout/Popout.d.ts +7 -0
- package/lib/vue.d.ts +24 -3
- package/package.json +29 -24
- package/lib/Popout-pKfh0-Zv.js +0 -2
- package/lib/Popout-pKfh0-Zv.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as Avatar}from"./Avatar.js";export{default as Badge}from"./Badge.js";export{default as Banner}from"./Banner.js";export{default as ButtonGroup}from"./ButtonGroup.js";export{default as Button}from"./Button.js";export{C as Calendar}from"./Calendar-CL_eqbiT.js";export{default as Card}from"./Card.js";export{default as Checkbox}from"./Checkbox.js";export{default as CommandMenu}from"./CommandMenu.js";export{default as CommandMenuAction}from"./CommandMenuAction.js";export{default as DatePicker}from"./DatePicker.js";export{default as Divider}from"./Divider.js";export{default as Drawer}from"./Drawer.js";export{default as DropdownGroup}from"./DropdownGroup.js";export{default as DropdownItem}from"./DropdownItem.js";export{default as Dropdown}from"./Dropdown.js";export{default as EmptyState}from"./EmptyState.js";export{default as Fieldset}from"./Fieldset.js";export{default as Footer}from"./Footer.js";export{default as Header}from"./Header.js";export{default as Icon}from"./Icon.js";export{default as Input}from"./Input.js";export{default as Layout}from"./Layout.js";export{isTranslationRegistered,registerTranslation}from"./translation.js";export{default as Message}from"./Message.js";export{default as Modal}from"./Modal.js";export{default as NavGroup}from"./NavGroup.js";export{default as NavItem}from"./NavItem.js";export{N as NavToggle}from"./NavToggle-DL74d1aQ.js";export{default as Navigation}from"./Navigation.js";export{default as NotificationGroup}from"./NotificationGroup.js";export{default as Notification}from"./Notification.js";export{P as Popout}from"./Popout-
|
|
1
|
+
export{default as Avatar}from"./Avatar.js";export{default as Badge}from"./Badge.js";export{default as Banner}from"./Banner.js";export{default as ButtonGroup}from"./ButtonGroup.js";export{default as Button}from"./Button.js";export{C as Calendar}from"./Calendar-CL_eqbiT.js";export{default as Card}from"./Card.js";export{default as Checkbox}from"./Checkbox.js";export{default as CommandMenu}from"./CommandMenu.js";export{default as CommandMenuAction}from"./CommandMenuAction.js";export{default as DatePicker}from"./DatePicker.js";export{default as Divider}from"./Divider.js";export{default as Drawer}from"./Drawer.js";export{default as DropdownGroup}from"./DropdownGroup.js";export{default as DropdownItem}from"./DropdownItem.js";export{default as Dropdown}from"./Dropdown.js";export{default as EmptyState}from"./EmptyState.js";export{default as Fieldset}from"./Fieldset.js";export{default as Footer}from"./Footer.js";export{default as Header}from"./Header.js";export{default as Icon}from"./Icon.js";export{default as Input}from"./Input.js";export{default as Layout}from"./Layout.js";export{isTranslationRegistered,registerTranslation}from"./translation.js";export{default as Message}from"./Message.js";export{default as Modal,ModalCancelEvent,ModalCloseEvent}from"./Modal.js";export{default as NavGroup}from"./NavGroup.js";export{default as NavItem}from"./NavItem.js";export{N as NavToggle}from"./NavToggle-DL74d1aQ.js";export{default as Navigation}from"./Navigation.js";export{default as NotificationGroup}from"./NotificationGroup.js";export{default as Notification}from"./Notification.js";export{P as Popout}from"./Popout-vR6LxNS9.js";export{default as ProgressBar}from"./ProgressBar.js";export{default as Progress}from"./Progress.js";export{default as Qrcode}from"./Qrcode.js";export{default as Radio}from"./Radio.js";export{default as Range}from"./Range.js";export{default as SegmentedControlItem}from"./SegmentedControlItem.js";export{default as SegmentedControl}from"./SegmentedControl.js";export{default as Select}from"./Select.js";export{default as Skeleton}from"./Skeleton.js";export{default as Spinner}from"./Spinner.js";export{default as Stack}from"./Stack.js";export{default as TabGroup}from"./TabGroup.js";export{default as TabPanel}from"./TabPanel.js";export{default as Tab}from"./Tab.js";export{default as Table}from"./Table.js";export{default as TagGroup}from"./TagGroup.js";export{default as Tag}from"./Tag.js";export{default as Textarea}from"./Textarea.js";export{default as ToastGroup}from"./ToastGroup.js";export{default as Toast}from"./Toast.js";export{default as Toggle}from"./Toggle.js";export{default as Tooltip}from"./Tooltip.js";export{default as TopBar}from"./TopBar.js";export{default as VisuallyHidden}from"./VisuallyHidden.js";import"./tslib.es6-CmLYFWVC.js";import"lit";import"lit/decorators.js";import"./observe-D0n0zOfU.js";import"./fsm-Bq5jMQrK.js";import"./Component-DSU3Qp0O.js";import"lit/directives/class-map.js";import"./DirectionController-ChvNGESZ.js";import"./SlotController-Z6eG7LSZ.js";import"./EventController-BBOmvfLa.js";import"lit/directives/ref.js";import"./LightDomController-DIwtVelV.js";import"./cond-CI1KbneT.js";import"./FocusableMixin-BlQLNPdJ.js";import"./InputMixin-LetXsCyv.js";import"lit/directives/repeat.js";import"./tinykeys.module-_6MZt7MP.js";import"./collection-Dvg2XbxV.js";import"./dates-CAAlPKZi.js";import"./number-Dg2vCfGd.js";import"./LocalizeController.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./DateSelectEvent.js";import"./events-Bv6wNHwJ.js";import"./interface-checked-small-BtICPEsp.js";import"lit/directives/if-defined.js";import"./FormAssociatedMixin-DFL7yabe.js";import"./FormDataController-OUt5L5uC.js";import"./SizeMixin-CU9cLbLC.js";import"./FormField--eLuhPue.js";import"./LightDismissController-4pH8cdko.js";import"./ShortcutController-BIb3WGzH.js";import"./KeyboardController.js";import"./SelectEvent.js";import"./interface-close-small-CnpAFMO3.js";import"./TextField-BdEdZ0_b.js";import"./date-adapter.js";import"./DropdownItem-Cy6lHtoG.js";import"lit/directives/unsafe-html.js";import"./IconManager.js";import"lit/directives/style-map.js";import"./AutocompleteMixin-D8eiOxvO.js";import"./TextSelectableMixin-Cfv__lHS.js";import"./Sticky-DqnqENYN.js";import"./ModalController.js";import"./ScrollbarController-BFC67Y2x.js";import"./NotificationMixin-DOUQsx7N.js";import"./positioning-D-K8Mueq.js";import"./LightSlotController-Coyy4nqS.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/react.d.ts
CHANGED
|
@@ -223,14 +223,24 @@ declare module "react" {
|
|
|
223
223
|
React.HTMLAttributes<HTMLElement> &
|
|
224
224
|
React.Attributes & {
|
|
225
225
|
/**
|
|
226
|
-
* Dispatched before the modal has closed when a user attempts to dismiss a modal. Call `preventDefault()` on the event to prevent the modal closing.
|
|
226
|
+
* {ModalCancelEvent} - Dispatched before the modal has closed when a user attempts to dismiss a modal. The event includes a `trigger` property containing the original event that caused the dismiss. Call `preventDefault()` on the event to prevent the modal closing.
|
|
227
227
|
*/
|
|
228
228
|
oncancel?: (event: Event) => void;
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
|
-
* Dispatched when a modal is closed for any reason.
|
|
231
|
+
* {ModalCloseEvent} - Dispatched when a modal is closed for any reason. The event includes an optional `trigger` property containing the original event that caused the close, if the modal was closed by a user action.
|
|
232
232
|
*/
|
|
233
233
|
onclose?: (event: Event) => void;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* undefined
|
|
237
|
+
*/
|
|
238
|
+
onclosetrigger?: (event: Event) => void;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* undefined
|
|
242
|
+
*/
|
|
243
|
+
ontrigger?: (event: Event) => void;
|
|
234
244
|
};
|
|
235
245
|
|
|
236
246
|
"nord-nav-group": WCProps<Components.NavGroup> &
|
|
@@ -26,6 +26,7 @@ declare const Button_base: (new (...args: any[]) => import("../common/mixins/Inp
|
|
|
26
26
|
* @cssprop [--n-button-font-weight=var(--n-font-weight)] - Controls the weight of the text within the button, using our [font tokens](/tokens/#font).
|
|
27
27
|
* @cssprop [--n-button-min-block-size=var(--n-space-xl)] - Controls the minimum block size, or height, of the button using our [spacing tokens](/tokens/#space).
|
|
28
28
|
* @cssprop [--n-button-toggle-icon-color=var(--n-color-icon)] - Controls the color of toggle icon that gets rendered when the button is used as a [Dropdown](/components/dropdown/) toggle.
|
|
29
|
+
* @cssprop [--n-button-user-select=none] - Controls the text selection behavior of the button text.
|
|
29
30
|
*/
|
|
30
31
|
export default class Button extends Button_base {
|
|
31
32
|
static styles: import("lit").CSSResult[];
|
package/lib/src/card/Card.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ import { LitElement } from 'lit';
|
|
|
16
16
|
* @cssprop [--n-card-padding=var(--n-space-m)] - Controls the padding on all sides of the card.
|
|
17
17
|
* @cssprop [--n-card-slot-padding=var(--n-space-m)] - Controls the padding of items slotted within the card. This does not affect the block padding of items slotted into the header.
|
|
18
18
|
* @cssprop [--n-card-header-background=transparent] - Controls the background color of the card header.
|
|
19
|
+
* @cssprop [--n-card-border-color=var(--n-color-border)] - Controls the border color of the card header and footer divider.
|
|
20
|
+
* @cssprop [--n-card-header-padding-block=var(--n-space-m)] - Controls the block (top and bottom) padding of the card header.
|
|
21
|
+
* @cssprop [--n-card-header-padding-inline=var(--n-card-slot-padding)] - Controls the inline (left and right) padding of the card header.
|
|
22
|
+
* @cssprop [--n-card-header-slot-flex-grow=0] - Controls the flex-grow value of the header slot.
|
|
19
23
|
*/
|
|
20
24
|
export default class Card extends LitElement {
|
|
21
25
|
static styles: import("lit").CSSResult[];
|
|
@@ -27,6 +31,10 @@ export default class Card extends LitElement {
|
|
|
27
31
|
* the header and footer slots will still have padding.
|
|
28
32
|
*/
|
|
29
33
|
padding: 'm' | 'l' | 'none';
|
|
34
|
+
/**
|
|
35
|
+
* When set, adds a divider border above the footer slot.
|
|
36
|
+
*/
|
|
37
|
+
footerDivider: boolean;
|
|
30
38
|
render(): import("lit").TemplateResult<1>;
|
|
31
39
|
}
|
|
32
40
|
declare global {
|
package/lib/src/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { default as Layout } from './layout/Layout.js';
|
|
|
24
24
|
export { isTranslationRegistered, registerTranslation } from './localization/translation.js';
|
|
25
25
|
export type { Translation } from './localization/translation.js';
|
|
26
26
|
export { default as Message } from './message/Message.js';
|
|
27
|
-
export { default as Modal } from './modal/Modal.js';
|
|
27
|
+
export { default as Modal, ModalCancelEvent, ModalCloseEvent } from './modal/Modal.js';
|
|
28
28
|
export { default as NavGroup } from './nav-group/NavGroup.js';
|
|
29
29
|
export { default as NavItem } from './nav-item/NavItem.js';
|
|
30
30
|
export { default as NavToggle } from './nav-toggle/NavToggle.js';
|
package/lib/src/input/Input.d.ts
CHANGED
|
@@ -39,6 +39,18 @@ export default class Input extends Input_base {
|
|
|
39
39
|
* Optionally disallow certain characters from being used inside the input, using a regex pattern.
|
|
40
40
|
*/
|
|
41
41
|
disallowPattern?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The inputmode attribute provides a hint to the browser about what type of keyboard to open on mobile devices.
|
|
44
|
+
* Valid values: none, text, decimal, numeric, tel, search, email, url
|
|
45
|
+
* When not explicitly set, defaults based on input type:
|
|
46
|
+
* - type="number" → inputmode="numeric"
|
|
47
|
+
* - type="email" → inputmode="email"
|
|
48
|
+
* - type="tel" → inputmode="tel"
|
|
49
|
+
* - type="url" → inputmode="url"
|
|
50
|
+
* - type="search" → inputmode="search"
|
|
51
|
+
* Can be explicitly overridden for any type.
|
|
52
|
+
*/
|
|
53
|
+
inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
42
54
|
render(): import("lit").TemplateResult<1>;
|
|
43
55
|
private handleKeydown;
|
|
44
56
|
private handleInputChange;
|
package/lib/src/modal/Modal.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { NordEvent } from '../common/events.js';
|
|
2
3
|
import '../footer/Footer.js';
|
|
4
|
+
/**
|
|
5
|
+
* Event dispatched when a modal is about to be dismissed.
|
|
6
|
+
* The `trigger` property contains the original event that caused the dismiss.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ModalCancelEvent extends NordEvent {
|
|
9
|
+
trigger: Event;
|
|
10
|
+
constructor(trigger: Event);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Event dispatched when a modal is closed.
|
|
14
|
+
* The `trigger` property contains the original event that caused the close, if available.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ModalCloseEvent extends NordEvent {
|
|
17
|
+
trigger: Event | undefined;
|
|
18
|
+
constructor(trigger?: Event);
|
|
19
|
+
}
|
|
3
20
|
/**
|
|
4
21
|
* Modal component is used to display content that temporarily blocks interactions
|
|
5
22
|
* with the main view of an application. Modal should be used sparingly and
|
|
@@ -11,8 +28,8 @@ import '../footer/Footer.js';
|
|
|
11
28
|
* @slot header - Slot which holds the header of the modal, positioned next to the close button.
|
|
12
29
|
* @slot feature - Slot for full bleed content like an image.
|
|
13
30
|
* @slot footer - Slot which is typically used to hold call to action buttons, but can also be used to build custom footers.
|
|
14
|
-
* @fires cancel - Dispatched before the modal has closed when a user attempts to dismiss a modal. Call `preventDefault()` on the event to prevent the modal closing.
|
|
15
|
-
* @fires close - Dispatched when a modal is closed for any reason.
|
|
31
|
+
* @fires cancel {ModalCancelEvent} - Dispatched before the modal has closed when a user attempts to dismiss a modal. The event includes a `trigger` property containing the original event that caused the dismiss. Call `preventDefault()` on the event to prevent the modal closing.
|
|
32
|
+
* @fires close {ModalCloseEvent} - Dispatched when a modal is closed for any reason. The event includes an optional `trigger` property containing the original event that caused the close, if the modal was closed by a user action.
|
|
16
33
|
*
|
|
17
34
|
* @cssprop [--n-modal-padding-inline=var(--n-space-m)] - Controls the padding on the sides of the modal, using our [spacing tokens](/tokens/#space).
|
|
18
35
|
* @cssprop [--n-modal-padding-block=var(--n-space-m)] - Controls the padding above and below the header of the modal, using our [spacing tokens](/tokens/#space).
|
|
@@ -24,6 +41,7 @@ export default class Modal extends LitElement {
|
|
|
24
41
|
static styles: import("lit").CSSResult[];
|
|
25
42
|
private modal;
|
|
26
43
|
private backdrop;
|
|
44
|
+
private lastTrigger?;
|
|
27
45
|
private defaultSlot;
|
|
28
46
|
private headerSlot;
|
|
29
47
|
private featureSlot;
|
|
@@ -52,6 +70,7 @@ export default class Modal extends LitElement {
|
|
|
52
70
|
*/
|
|
53
71
|
scrollable: boolean;
|
|
54
72
|
connectedCallback(): void;
|
|
73
|
+
disconnectedCallback(): void;
|
|
55
74
|
/**
|
|
56
75
|
* Show the modal, automatically moving focus to the modal or a child
|
|
57
76
|
* element with an `autofocus` attribute.
|
|
@@ -60,8 +79,9 @@ export default class Modal extends LitElement {
|
|
|
60
79
|
/**
|
|
61
80
|
* Programmatically close the modal.
|
|
62
81
|
* @param returnValue An optional value to indicate why the modal was closed.
|
|
82
|
+
* @param trigger An optional event that triggered the close.
|
|
63
83
|
*/
|
|
64
|
-
close(returnValue?: string): void;
|
|
84
|
+
close(returnValue?: string, trigger?: Event): void;
|
|
65
85
|
/**
|
|
66
86
|
* Programmatically focus the modal.
|
|
67
87
|
* @param options An object which controls aspects of the focusing process.
|
|
@@ -2,8 +2,8 @@ import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
|
2
2
|
import type { LightDismissOptions } from '../common/controllers/LightDismissController.js';
|
|
3
3
|
interface ModalControllerOptions {
|
|
4
4
|
isOpen: LightDismissOptions['isOpen'];
|
|
5
|
-
onDismiss:
|
|
6
|
-
close: (returnValue?: string) => void;
|
|
5
|
+
onDismiss: (trigger: Event) => void;
|
|
6
|
+
close: (returnValue?: string, trigger?: Event) => void;
|
|
7
7
|
backdrop: () => HTMLElement;
|
|
8
8
|
dialog: () => HTMLElement;
|
|
9
9
|
}
|
|
@@ -19,12 +19,21 @@ export default class Navigation extends LitElement {
|
|
|
19
19
|
static styles: import("lit").CSSResult[];
|
|
20
20
|
private headerSlot;
|
|
21
21
|
private events;
|
|
22
|
+
private footerObserver;
|
|
22
23
|
private allowItemsToRemainOpen;
|
|
23
24
|
/**
|
|
24
25
|
* Controls whether the navigations's footer has sticky positioning.
|
|
25
26
|
*/
|
|
26
27
|
stickyFooter: boolean;
|
|
27
28
|
connectedCallback(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Observe the footer slot element for visibility changes.
|
|
32
|
+
* Watches style and class attributes on the footer element itself, and
|
|
33
|
+
* childList on the host to detect footer being added/removed (e.g. v-if).
|
|
34
|
+
*/
|
|
35
|
+
private observeFooter;
|
|
36
|
+
private get isFooterVisible();
|
|
28
37
|
render(): import("lit").TemplateResult<1>;
|
|
29
38
|
private handleActivate;
|
|
30
39
|
}
|
|
@@ -59,6 +59,13 @@ export default class Popout extends Popout_base {
|
|
|
59
59
|
protected handleOpenChange(): void;
|
|
60
60
|
protected handleAnchorChange(): void;
|
|
61
61
|
private enableScroll;
|
|
62
|
+
/**
|
|
63
|
+
* Place the element in the top layer via the Popover API so that
|
|
64
|
+
* position: fixed works relative to the viewport regardless of
|
|
65
|
+
* container queries or other containing block ancestors.
|
|
66
|
+
*/
|
|
67
|
+
private enterTopLayer;
|
|
68
|
+
private leaveTopLayer;
|
|
62
69
|
/**
|
|
63
70
|
* Get the position of the element toggling the popout
|
|
64
71
|
* and position the popout underneath it, taking into account the optional placement.
|
package/lib/vue.d.ts
CHANGED
|
@@ -2,8 +2,19 @@ import type * as Components from "./src/index";
|
|
|
2
2
|
import type { LitElement } from "lit";
|
|
3
3
|
import type { DefineComponent } from "vue";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Overrides for properties whose TypeScript type differs between
|
|
7
|
+
* the Lit class and the HTML attribute interface.
|
|
8
|
+
*
|
|
9
|
+
* "form" — InputMixin's getter returns `HTMLFormElement | null`, but in
|
|
10
|
+
* templates the attribute is always a plain string (the form's id).
|
|
11
|
+
* Without this override, Vue/JSX would expect an HTMLFormElement.
|
|
12
|
+
*/
|
|
13
|
+
type WCPropsOverrides = { form: string };
|
|
14
|
+
|
|
5
15
|
type WCProps<TWebComponent extends HTMLElement> = Partial<
|
|
6
|
-
Omit<TWebComponent, keyof LitElement | "render">
|
|
16
|
+
Omit<TWebComponent, keyof LitElement | "render" | keyof WCPropsOverrides> &
|
|
17
|
+
WCPropsOverrides
|
|
7
18
|
>;
|
|
8
19
|
|
|
9
20
|
interface NordComponents {
|
|
@@ -160,14 +171,24 @@ interface NordComponents {
|
|
|
160
171
|
"nord-modal": DefineComponent<
|
|
161
172
|
WCProps<Components.Modal> & {
|
|
162
173
|
/**
|
|
163
|
-
* Dispatched before the modal has closed when a user attempts to dismiss a modal. Call `preventDefault()` on the event to prevent the modal closing.
|
|
174
|
+
* {ModalCancelEvent} - Dispatched before the modal has closed when a user attempts to dismiss a modal. The event includes a `trigger` property containing the original event that caused the dismiss. Call `preventDefault()` on the event to prevent the modal closing.
|
|
164
175
|
*/
|
|
165
176
|
onCancel?: (event: Event) => void;
|
|
166
177
|
|
|
167
178
|
/**
|
|
168
|
-
* Dispatched when a modal is closed for any reason.
|
|
179
|
+
* {ModalCloseEvent} - Dispatched when a modal is closed for any reason. The event includes an optional `trigger` property containing the original event that caused the close, if the modal was closed by a user action.
|
|
169
180
|
*/
|
|
170
181
|
onClose?: (event: Event) => void;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* undefined
|
|
185
|
+
*/
|
|
186
|
+
onCloseTrigger?: (event: Event) => void;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* undefined
|
|
190
|
+
*/
|
|
191
|
+
onTrigger?: (event: Event) => void;
|
|
171
192
|
}
|
|
172
193
|
>;
|
|
173
194
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhealth/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.14.0",
|
|
5
5
|
"description": "This package includes Nord Design System Web Components",
|
|
6
6
|
"author": "Nordhealth <support@nordhealth.design>",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -17,18 +17,19 @@
|
|
|
17
17
|
"lib"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"start": "concurrently -k -n TSC,
|
|
20
|
+
"start": "concurrently -k -n TSC,SB -c blue.bold,magenta.bold \"tsc -w --noEmit\" \"storybook dev -p 6006\"",
|
|
21
21
|
"prebuild": "pnpm clean",
|
|
22
22
|
"build": "rollup -c",
|
|
23
23
|
"postbuild": "pnpm analyze && pnpm build:react-types && pnpm build:vue-types",
|
|
24
|
-
"build:docker": "node scripts/generate-docker-package.mjs && docker compose build test",
|
|
25
24
|
"clean": "rm -rf lib/",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"test": "docker compose run --rm -
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
25
|
+
"test": "vitest run --project=components",
|
|
26
|
+
"test:watch": "vitest --project=components",
|
|
27
|
+
"test:docker": "docker compose run --rm unit-tests",
|
|
28
|
+
"e2e": "docker compose run --rm visual-tests",
|
|
29
|
+
"e2e:update": "docker compose run --rm visual-tests --update-snapshots",
|
|
30
|
+
"e2e:build": "docker compose build visual-tests",
|
|
31
|
+
"storybook": "storybook dev -p 6006",
|
|
32
|
+
"build-storybook": "storybook build -o storybook-static",
|
|
32
33
|
"analyze": "custom-elements-manifest analyze --litelement",
|
|
33
34
|
"scaffold": "node ./scripts/scaffold.mjs",
|
|
34
35
|
"build:react-types": "node ./scripts/build-react-types.mjs",
|
|
@@ -36,35 +37,34 @@
|
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@floating-ui/dom": "^1.7.5",
|
|
39
|
-
"@nordhealth/icons": "^3.15.
|
|
40
|
+
"@nordhealth/icons": "^3.15.5",
|
|
40
41
|
"lit": "^3.3.2",
|
|
41
42
|
"qr": "^0.4.2",
|
|
42
43
|
"tinykeys": "^1.4.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
46
|
-
"@lit-labs/testing": "^0.2.8",
|
|
47
47
|
"@nordhealth/css": "^4.4.1",
|
|
48
48
|
"@nordhealth/fonts": "^3.0.4",
|
|
49
|
-
"@nordhealth/themes": "^9.0.
|
|
50
|
-
"@nordhealth/tokens": "^8.0.
|
|
49
|
+
"@nordhealth/themes": "^9.0.2",
|
|
50
|
+
"@nordhealth/tokens": "^8.0.2",
|
|
51
51
|
"@open-wc/eslint-config": "^12.0.3",
|
|
52
|
-
"@open-wc/testing": "^
|
|
52
|
+
"@open-wc/testing-helpers": "^3.0.1",
|
|
53
|
+
"@playwright/test": "1.58.0",
|
|
53
54
|
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
54
55
|
"@rollup/plugin-replace": "^5.0.7",
|
|
55
56
|
"@rollup/plugin-terser": "^0.4.4",
|
|
56
57
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
57
|
-
"@
|
|
58
|
+
"@storybook/addon-a11y": "^10.2.14",
|
|
59
|
+
"@storybook/addon-docs": "^10.2.14",
|
|
60
|
+
"@storybook/addon-themes": "^10.2.14",
|
|
61
|
+
"@storybook/web-components-vite": "^10.2.14",
|
|
58
62
|
"@types/node": "^22.19.11",
|
|
59
63
|
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
60
64
|
"@typescript-eslint/parser": "^8.56.0",
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"@web/test-runner": "~0.20.2",
|
|
65
|
-
"@web/test-runner-commands": "~0.9.0",
|
|
66
|
-
"@web/test-runner-playwright": "~0.11.1",
|
|
67
|
-
"@web/test-runner-visual-regression": "~0.10.0",
|
|
65
|
+
"@vitest/browser": "^4.0.18",
|
|
66
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
67
|
+
"axe-core": "^4.10.3",
|
|
68
68
|
"concurrently": "^9.2.1",
|
|
69
69
|
"eslint": "^8.57.1",
|
|
70
70
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -72,18 +72,23 @@
|
|
|
72
72
|
"eslint-plugin-lit-a11y": "^4.1.4",
|
|
73
73
|
"eslint-plugin-wc": "^1.5.0",
|
|
74
74
|
"glob": "^11.1.0",
|
|
75
|
+
"http-server": "^14.1.1",
|
|
75
76
|
"prettier": "^3.8.1",
|
|
77
|
+
"react": "19.2.4",
|
|
76
78
|
"rollup": "~4.21.3",
|
|
77
79
|
"rollup-plugin-lit-css": "^5.0.2",
|
|
78
80
|
"rollup-plugin-minify-html-literals-v3": "^1.3.4",
|
|
79
81
|
"rollup-plugin-summary": "^2.0.1",
|
|
82
|
+
"storybook": "^10.2.14",
|
|
80
83
|
"tslib": "^2.8.1",
|
|
81
|
-
"typescript": "~5.5.4"
|
|
84
|
+
"typescript": "~5.5.4",
|
|
85
|
+
"vitest": "^4.0.18",
|
|
86
|
+
"vitest-browser-lit": "^1.0.1"
|
|
82
87
|
},
|
|
83
88
|
"overrides": {
|
|
84
89
|
"rollup-plugin-summary": {
|
|
85
90
|
"rollup": "~4.21.3"
|
|
86
91
|
}
|
|
87
92
|
},
|
|
88
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "26e0364993a580c858a1a6e54ee0594af78937d7"
|
|
89
94
|
}
|
package/lib/Popout-pKfh0-Zv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{o,a as i,s as e,h as s,l as n,c as a,b as r,f as l}from"./positioning-D-K8Mueq.js";import{css as h,html as p,LitElement as d}from"lit";import{property as c,query as m,state as u,customElement as g}from"lit/decorators.js";import{D as v}from"./DirectionController-ChvNGESZ.js";import{E as f}from"./EventController-BBOmvfLa.js";import{L as y}from"./LightDismissController-4pH8cdko.js";import{S as w}from"./ScrollbarController-BFC67Y2x.js";import{o as b}from"./observe-D0n0zOfU.js";import{N as E,t as x}from"./events-Bv6wNHwJ.js";import{s as C}from"./Component-DSU3Qp0O.js";function k(o){class i extends o{constructor(){super(...arguments),this.open=!1,this.align="start",this.position="block-end"}}return t([c({type:Boolean,reflect:!0})],i.prototype,"open",void 0),t([c({reflect:!0})],i.prototype,"align",void 0),t([c({reflect:!0})],i.prototype,"position",void 0),i}const A=h`:host{position:fixed;pointer-events:none;z-index:var(--n-index-popout);left:var(--_n-popout-position-x);top:var(--_n-popout-position-y);color:var(--n-color-text);opacity:0;transition:opacity var(--n-transition-slowly)}.n-popout{pointer-events:none;transform:translateY(-10px) scale(.97);visibility:hidden;transition:transform var(--n-transition-slowly),visibility var(--n-transition-slowly);transform-origin:top left;will-change:transform,opacity,visibility;background:var(--n-color-surface);box-shadow:var(--n-box-shadow-popout);border-radius:var(--n-border-radius-s)}:host([open]){opacity:1}:host([open]) .n-popout{transition-property:transform;visibility:visible;pointer-events:auto;transform:translateY(0) translateX(0) scale(1)}@media (max-width:35.9375em){:host(:not([always-floating])){position:fixed;inset:0;overflow-y:auto;opacity:1;background:0 0;transition:background var(--n-transition-mobile)}:host([open]:not([always-floating])){pointer-events:auto;background:var(--n-color-overlay)}:host([open]:not([always-floating])) .n-popout{transform:translateY(0)}:host(:not([always-floating])) .n-popout{position:fixed;inset:0;inset-block-start:auto;transform:translateY(100%);transition:transform var(--n-transition-mobile),visibility var(--n-transition-mobile);transform-origin:bottom center;border-radius:0}}.top-end,.top-start{transform:translateY(10px) scale(.97)}.left-end,.left-start{transform:translateX(10px) scale(.97)}.right-end,.right-start{transform:translateX(-10px) scale(.97)}.bottom-start.is-rtl,.left-end,.top-end{transform-origin:bottom right}.bottom-end,.left-start,.top-start.is-rtl{transform-origin:top right}.bottom-end.is-rtl,.right-end,.right-start{transform-origin:bottom left}.right-start,.top-end.is-rtl{transform-origin:top left}`,P="undefined"==typeof matchMedia?{matches:!1,addEventListener(){}}:matchMedia("(max-width: 35.9375em)");let S=class extends(k(d)){constructor(){super(...arguments),this.scrollBar=new w(this),this.dismiss=new y(this,{isOpen:()=>this.open,onDismiss:t=>this.hide("click"!==t.type),isDismissible:t=>t!==this.popout&&t!==this.targetElement}),this.events=new f(this),this.direction=new v(this),this.smallViewport=P.matches,this.id="",this.alwaysFloating=!1,this.enableScroll=()=>{this.open||this.scrollBar.unlockScroll()},this.updatePosition=async()=>{var t;if(!this.anchorElement)return;const r={strategy:"fixed"};"auto"===this.position?r.middleware=[o(8),i({alignment:this.align,padding:8}),e({padding:8}),s()]:(r.placement=n(this.position,this.align,this.direction.dir),r.middleware=[o(8),l(),e({padding:8}),s()]);const{x:h,y:p,placement:d,middlewareData:c}=await a(this.anchorElement,this,r);this.computedPosition=d,this.style.setProperty("--_n-popout-position-x",`${h}px`),this.style.setProperty("--_n-popout-position-y",`${p}px`),(null===(t=c.hide)||void 0===t?void 0:t.referenceHidden)&&this.hide()},this.toggleOpen=t=>{t.preventDefault(),this.open?this.hide(!1):!this.smallViewport||this.alwaysFloating?this.updatePosition().then((()=>this.show())):this.show()},this.handleMediaQueryChange=()=>{var t;this.smallViewport=P.matches,null===(t=this.cleanupAutoUpdate)||void 0===t||t.call(this),(!this.smallViewport||this.alwaysFloating)&&this.open&&this.anchorElement?(this.cleanupAutoUpdate=r(this.anchorElement,this,this.updatePosition),this.scrollBar.unlockScroll()):this.open&&this.scrollBar.lockScroll()}}async show(){return this.open?Promise.resolve():(this.open=!0,await this.updateComplete,this.dispatchEvent(new E("open")),x(this.popout))}async hide(t=!0){var o,i;return this.open?(this.open=!1,null===(o=this.cleanupAutoUpdate)||void 0===o||o.call(this),this.dispatchEvent(new E("close")),t&&(null===(i=this.targetElement)||void 0===i||i.focus({preventScroll:!0})),x(this.popout)):Promise.resolve()}firstUpdated(){this.smallViewport&&!this.alwaysFloating||this.updatePosition()}connectedCallback(){super.connectedCallback(),this.events.listen(P,"change",this.handleMediaQueryChange),this.initializeElements()}disconnectedCallback(){var t,o;super.disconnectedCallback(),null===(t=this.cleanupAutoUpdate)||void 0===t||t.call(this),null===(o=this.targetElement)||void 0===o||o.removeAttribute("aria-expanded")}render(){return p`<div class="n-popout ${this.computedPosition} is-${this.direction.dir}" aria-hidden="${this.open?"false":"true"}" @transitionend="${this.enableScroll}"><slot></slot></div>`}handleIdChange(){var t;null===(t=this.targetElement)||void 0===t||t.removeEventListener("click",this.toggleOpen),this.id?this.initializeElements():console.warn("NORD: popout requires an id attribute and value")}initializeElements(){this.targetElement=this.getToggle(),this.anchorElement=this.getAnchor(),this.events.listen(this.targetElement,"click",this.toggleOpen)}handleOpenChange(){var t,o;null===(t=this.targetElement)||void 0===t||t.setAttribute("aria-expanded",`${this.open}`),this.open?this.smallViewport&&!this.alwaysFloating?this.scrollBar.lockScroll():this.anchorElement&&(this.cleanupAutoUpdate=r(this.anchorElement,this,this.updatePosition)):null===(o=this.cleanupAutoUpdate)||void 0===o||o.call(this)}handleAnchorChange(){var t;null===(t=this.cleanupAutoUpdate)||void 0===t||t.call(this),this.anchorElement=this.getAnchor(),this.open&&(!this.smallViewport||this.alwaysFloating)&&this.anchorElement&&(this.cleanupAutoUpdate=r(this.anchorElement,this,this.updatePosition))}getToggle(){const t=this.getRootNode().querySelector(`[aria-controls='${this.id}']`);return t instanceof HTMLSlotElement?t.assignedElements()[0]:t}getAnchor(){if(!this.anchor)return this.targetElement;const t=this.getRootNode().querySelector(`#${this.anchor}`);return t instanceof HTMLSlotElement?t.assignedElements()[0]:t}};S.styles=[C,A],t([m(".n-popout",!0)],S.prototype,"popout",void 0),t([u()],S.prototype,"computedPosition",void 0),t([u()],S.prototype,"smallViewport",void 0),t([c({reflect:!0})],S.prototype,"id",void 0),t([c({reflect:!0})],S.prototype,"anchor",void 0),t([c({reflect:!0,type:Boolean,attribute:"always-floating"})],S.prototype,"alwaysFloating",void 0),t([b("id")],S.prototype,"handleIdChange",null),t([b("open")],S.prototype,"handleOpenChange",null),t([b("anchor")],S.prototype,"handleAnchorChange",null),S=t([g("nord-popout")],S);var j=S;export{k as F,j as P};
|
|
2
|
-
//# sourceMappingURL=Popout-pKfh0-Zv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Popout-pKfh0-Zv.js","sources":["../src/common/mixins/FloatingComponentMixin.ts","../src/popout/Popout.ts"],"sourcesContent":["import type { Alignment } from '@floating-ui/dom'\nimport type { LitElement } from 'lit'\nimport type { LogicalSide } from '../positioning.js'\nimport { property } from 'lit/decorators.js'\n\ntype Constructor<T = Record<string, unknown>> = new (...args: any[]) => T\n\nexport declare class FloatingMixinInterface {\n open: boolean\n align: Alignment\n position: LogicalSide | 'auto'\n}\n\nexport function FloatingMixin<T extends Constructor<LitElement>>(\n superClass: T,\n): Constructor<FloatingMixinInterface> & T {\n class FloatingElement extends superClass {\n /**\n * Controls whether the component is open or not.\n */\n @property({ type: Boolean, reflect: true }) open = false\n\n /**\n * Set the alignment in relation to the toggle (or anchor) depending on the position.\n * `start` will align it to the left of the toggle (or anchor).\n * `end` will align it to the right of the toggle (or anchor).\n * Setting the `position` to `inline-start` or `inline-end` will switch\n * `start` and `end` to the top and bottom respectively.\n */\n @property({ reflect: true }) align: 'start' | 'end' = 'start'\n\n /**\n * Set the position in relation to the toggle (or anchor).\n * Options follow logical properties.\n * `block-start` and `block-end` referring to top and bottom respectively,\n * `inline-start` and `inline-end` referring to left and right respectively.\n * You can also set it to `auto` for automatic positioning depending on\n * which side has the most space available.\n */\n @property({ reflect: true }) position: 'block-end' | 'block-start' | 'inline-start' | 'inline-end' | 'auto'\n = 'block-end'\n }\n\n return FloatingElement\n}\n","import type {\n ComputePositionConfig,\n Placement,\n} from '@floating-ui/dom'\nimport {\n autoPlacement,\n autoUpdate,\n computePosition,\n flip,\n hide,\n offset,\n shift,\n} from '@floating-ui/dom'\nimport { html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { DirectionController } from '../common/controllers/DirectionController.js'\nimport { EventController } from '../common/controllers/EventController.js'\nimport { LightDismissController } from '../common/controllers/LightDismissController.js'\nimport { ScrollbarController } from '../common/controllers/ScrollbarController.js'\n\nimport { observe } from '../common/decorators/observe.js'\nimport { NordEvent, transition } from '../common/events.js'\nimport { FloatingMixin } from '../common/mixins/FloatingComponentMixin.js'\nimport { logicalToPhysical } from '../common/positioning.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './Popout.css'\n\n/*\n * The breakpoint width to switch between \"sheet\" design and floating design\n */\nconst mediaQuery\n = typeof matchMedia === 'undefined'\n ? ({\n matches: false,\n addEventListener() {\n /* noop */\n },\n } as unknown as MediaQueryList)\n : matchMedia('(max-width: 35.9375em)')\n\n/**\n * Popouts are small overlays that open on demand. They let users access additional content and actions without cluttering the page.\n *\n * @status ready\n * @category overlay\n * @slot - The popout content.\n */\n@customElement('nord-popout')\nexport default class Popout extends FloatingMixin(LitElement) {\n static styles = [componentStyle, style]\n\n private targetElement?: HTMLElement\n private anchorElement?: HTMLElement\n private cleanupAutoUpdate?: ReturnType<typeof autoUpdate>\n\n @query('.n-popout', true) private popout!: HTMLDivElement\n\n private scrollBar = new ScrollbarController(this)\n\n /**\n * Handle dismissal of the popout, clicking outside the target button and popout.\n */\n private dismiss = new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: e => this.hide(e.type !== 'click'),\n isDismissible: node => node !== this.popout && node !== this.targetElement,\n })\n\n private events = new EventController(this)\n private direction = new DirectionController(this)\n\n @state() private computedPosition?: Placement\n\n @state() private smallViewport = mediaQuery.matches\n\n /**\n * The id for the active element to reference via aria-controls.\n */\n\n @property({ reflect: true }) id: string = ''\n\n /**\n * Set an optional anchor element to align against, replacing the triggering element.\n */\n @property({ reflect: true }) anchor?: string\n\n /**\n * Set to true to always display the popout as a floating overlay, even on smaller viewports.\n */\n @property({ reflect: true, type: Boolean, attribute: 'always-floating' }) alwaysFloating: boolean = false\n\n /**\n * Show the popout.\n * A promise that resolves to a `TransitionEvent` when the popout's show animation ends or is cancelled.\n * If the popout is already open, the promise resolves immediately with `undefined`.\n */\n async show(): Promise<TransitionEvent | void> {\n if (this.open) {\n return Promise.resolve()\n }\n\n this.open = true\n\n // we should only focus once the popout is visible after render is complete\n await this.updateComplete\n\n /**\n * Dispatched when the popout is opened.\n */\n this.dispatchEvent(new NordEvent('open'))\n\n return transition(this.popout)\n }\n\n /**\n * Hide the popout.\n * Returns a promise that resolves to a `TransitionEvent` when the popout's hide animation ends or is cancelled.\n * If the popout is already closed, the promise resolves immediately with `undefined`.\n * @param {boolean} moveFocusToButton prevent focus returning to the target button. Default is true.\n */\n async hide(moveFocusToButton: boolean = true): Promise<TransitionEvent | void> {\n if (!this.open) {\n return Promise.resolve()\n }\n\n this.open = false\n\n this.cleanupAutoUpdate?.()\n\n /**\n * Dispatched when the popout is closed.\n */\n this.dispatchEvent(new NordEvent('close'))\n\n if (moveFocusToButton) {\n this.targetElement?.focus({ preventScroll: true })\n }\n\n return transition(this.popout)\n }\n\n /**\n * Position the popout on load.\n */\n firstUpdated() {\n if (!this.smallViewport || this.alwaysFloating) {\n this.updatePosition()\n }\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.events.listen(mediaQuery, 'change', this.handleMediaQueryChange)\n\n this.initializeElements()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.cleanupAutoUpdate?.()\n this.targetElement?.removeAttribute('aria-expanded')\n }\n\n render() {\n return html`\n <div\n class=\"n-popout ${this.computedPosition} is-${this.direction.dir}\"\n aria-hidden=${this.open ? 'false' : 'true'}\n @transitionend=${this.enableScroll}\n >\n <slot></slot>\n </div>\n `\n }\n\n @observe('id')\n protected handleIdChange() {\n // clean up any old listeners\n this.targetElement?.removeEventListener('click', this.toggleOpen)\n\n if (!this.id) {\n console.warn('NORD: popout requires an id attribute and value')\n }\n else {\n this.initializeElements()\n }\n }\n\n private initializeElements() {\n this.targetElement = this.getToggle()\n this.anchorElement = this.getAnchor()\n\n this.events.listen(this.targetElement, 'click', this.toggleOpen)\n }\n\n @observe('open')\n protected handleOpenChange() {\n this.targetElement?.setAttribute('aria-expanded', `${this.open}`)\n\n if (this.open) {\n if (this.smallViewport && !this.alwaysFloating) {\n // hide scrollbar and prevent scroll on body\n this.scrollBar.lockScroll()\n }\n else if (this.anchorElement) {\n this.cleanupAutoUpdate = autoUpdate(this.anchorElement, this, this.updatePosition)\n }\n }\n else {\n this.cleanupAutoUpdate?.()\n }\n }\n\n @observe('anchor')\n protected handleAnchorChange() {\n this.cleanupAutoUpdate?.()\n this.anchorElement = this.getAnchor()\n\n // if the popout is already open when the anchor changes, we should update its position\n if (this.open && (!this.smallViewport || this.alwaysFloating) && this.anchorElement) {\n this.cleanupAutoUpdate = autoUpdate(this.anchorElement, this, this.updatePosition)\n }\n }\n\n private enableScroll = () => {\n // scrollbar should only be restored when the backdrop has transitioned\n // that way we avoid awkward double scrollbars.\n if (!this.open) {\n this.scrollBar.unlockScroll()\n }\n }\n\n /**\n * Get the position of the element toggling the popout\n * and position the popout underneath it, taking into account the optional placement.\n */\n private updatePosition = async () => {\n if (!this.anchorElement) {\n return\n }\n\n const computePositionConfig: ComputePositionConfig = {\n strategy: 'fixed',\n }\n\n if (this.position === 'auto') {\n computePositionConfig.middleware = [\n offset(8),\n autoPlacement({ alignment: this.align, padding: 8 }),\n shift({\n padding: 8,\n }),\n hide(),\n ]\n }\n else {\n computePositionConfig.placement = logicalToPhysical(this.position, this.align, this.direction.dir)\n computePositionConfig.middleware = [\n offset(8),\n flip(),\n shift({\n padding: 8,\n }),\n hide(),\n ]\n }\n\n const { x, y, placement, middlewareData } = await computePosition(this.anchorElement, this, computePositionConfig)\n\n this.computedPosition = placement\n\n // use physical properties here since floating-ui\n // works exclusively in physical dimensions\n // we do all the mapping in logicalToPhysical\n this.style.setProperty('--_n-popout-position-x', `${x}px`)\n this.style.setProperty('--_n-popout-position-y', `${y}px`)\n\n if (middlewareData.hide?.referenceHidden) {\n this.hide()\n }\n }\n\n /**\n * Toggle the popout open or closed using state.\n * Updating the position to underneath the target button before the popout is opened.\n */\n private toggleOpen = (e: Event) => {\n e.preventDefault()\n if (this.open) {\n this.hide(false)\n }\n else if (!this.smallViewport || this.alwaysFloating) {\n this.updatePosition().then(() => this.show())\n }\n else {\n this.show()\n }\n }\n\n private getToggle() {\n const rootNode = this.getRootNode() as Document | ShadowRoot\n const toggle = <HTMLElement>rootNode.querySelector(`[aria-controls='${this.id}']`)\n\n if (toggle instanceof HTMLSlotElement) {\n return toggle.assignedElements()[0] as HTMLElement\n }\n\n return toggle\n }\n\n private getAnchor() {\n if (!this.anchor) {\n return this.targetElement\n }\n\n const rootNode = this.getRootNode() as Document | ShadowRoot\n const anchor = <HTMLElement>rootNode.querySelector(`#${this.anchor}`)\n\n if (anchor instanceof HTMLSlotElement) {\n return anchor.assignedElements()[0] as HTMLElement\n }\n\n return anchor\n }\n\n /**\n * Update the smallViewport flag to switch between \"sheet\" and \"floating\".\n * autoUpdate is needed when a viewport gets larger and the popout is open.\n */\n private handleMediaQueryChange = () => {\n this.smallViewport = mediaQuery.matches\n\n this.cleanupAutoUpdate?.()\n\n if ((!this.smallViewport || this.alwaysFloating) && this.open && this.anchorElement) {\n this.cleanupAutoUpdate = autoUpdate(this.anchorElement, this, this.updatePosition)\n this.scrollBar.unlockScroll()\n }\n else if (this.open) {\n this.scrollBar.lockScroll()\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-popout': Popout\n }\n}\n"],"names":["FloatingMixin","superClass","FloatingElement","constructor","this","open","align","position","__decorate","property","type","Boolean","reflect","prototype","mediaQuery","matchMedia","matches","addEventListener","Popout","LitElement","scrollBar","ScrollbarController","dismiss","LightDismissController","isOpen","onDismiss","e","hide","isDismissible","node","popout","targetElement","events","EventController","direction","DirectionController","smallViewport","id","alwaysFloating","enableScroll","unlockScroll","updatePosition","async","anchorElement","computePositionConfig","strategy","middleware","offset","autoPlacement","alignment","padding","shift","placement","logicalToPhysical","dir","flip","x","y","middlewareData","computePosition","computedPosition","style","setProperty","_a","referenceHidden","toggleOpen","preventDefault","then","show","handleMediaQueryChange","cleanupAutoUpdate","call","autoUpdate","lockScroll","Promise","resolve","updateComplete","dispatchEvent","NordEvent","transition","moveFocusToButton","_b","focus","preventScroll","firstUpdated","connectedCallback","super","listen","initializeElements","disconnectedCallback","removeAttribute","render","html","handleIdChange","removeEventListener","console","warn","getToggle","getAnchor","handleOpenChange","setAttribute","handleAnchorChange","toggle","getRootNode","querySelector","HTMLSlotElement","assignedElements","anchor","styles","componentStyle","query","state","attribute","observe","customElement"],"mappings":"6mBAaM,SAAUA,EACdC,GAEA,MAAMC,UAAwBD,EAA9B,WAAAE,uBAI8CC,KAAIC,MAAG,EAStBD,KAAKE,MAAoB,QAUzBF,KAAQG,SACjC,WACL,EAED,OAvB8CC,EAAA,CAA3CC,EAAS,CAAEC,KAAMC,QAASC,SAAS,KAAoBV,EAAAW,UAAA,YAAA,GAS3BL,EAAA,CAA5BC,EAAS,CAAEG,SAAS,KAAwCV,EAAAW,UAAA,aAAA,GAUhCL,EAAA,CAA5BC,EAAS,CAAEG,SAAS,KACNV,EAAAW,UAAA,gBAAA,GAGVX,CACT,gvDCdMY,EACoB,oBAAfC,WACJ,CACCC,SAAS,EACT,gBAAAC,GAEC,GAEHF,WAAW,0BAUF,IAAMG,EAAN,cAAqBlB,EAAcmB,IAAnC,WAAAhB,uBASLC,K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