@lmvz-ds/components 0.25.0 → 0.26.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/CHANGELOG.md +11 -0
- package/cjs/{ds.constants-DSnxZ3ia.js → ds.constants-8fh6ItAF.js} +1 -1
- package/cjs/index.cjs.js +196 -2
- package/cjs/lmvz-button-group.cjs.entry.js +183 -0
- package/cjs/lmvz-button_2.cjs.entry.js +198 -0
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +1 -1
- package/cjs/lmvz-chip.cjs.entry.js +2 -2
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-menuitem.cjs.entry.js +1 -1
- package/cjs/lmvz-modal.cjs.entry.js +1 -1
- package/cjs/lmvz-radio.cjs.entry.js +1 -1
- package/cjs/lmvz-snackbar.cjs.entry.js +83 -0
- package/cjs/lmvz-toggle.cjs.entry.js +2 -2
- package/cjs/loader.cjs.js +1 -1
- package/collection/api/ds.constants.js +4 -1
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-button/lmvz-button.css +6 -6
- package/collection/components/lmvz-button-group/lmvz-button-group.css +2 -2
- package/collection/components/lmvz-card/lmvz-card.css +9 -9
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +4 -4
- package/collection/components/lmvz-chip/lmvz-chip.css +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.js +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
- package/collection/components/lmvz-modal/lmvz-modal.css +4 -16
- package/collection/components/lmvz-radio/lmvz-radio.css +4 -4
- package/collection/components/lmvz-snackbar/lmvz-snackbar.css +101 -0
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +266 -0
- package/collection/components/lmvz-snackbar/public.js +1 -0
- package/collection/components/lmvz-snackbar/snackbar-controller.js +194 -0
- package/collection/components/lmvz-toggle/lmvz-toggle.css +2 -2
- package/collection/components/lmvz-toggle/lmvz-toggle.js +1 -1
- package/collection/index.js +1 -0
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button-group.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-modal.js +1 -1
- package/components/lmvz-radio.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.d.ts +11 -0
- package/components/lmvz-snackbar.d.ts.bak +11 -0
- package/components/lmvz-snackbar.js +1 -0
- package/components/lmvz-toggle.js +1 -1
- package/components/{p-CNmHnJ1D.js → p-BOzeYzKk.js} +1 -1
- package/components/{p-CCcoDnH-.js → p-DYa3zcGE.js} +1 -1
- package/components/{p-DOTK1OW3.js → p-JAKQdFhF.js} +1 -1
- package/components/p-WLZ7VWNX.js +1 -0
- package/components/{p-DYr7Jc0V.js → p-c7OzBK8f.js} +1 -1
- package/components/p-lsUdmjdw.js +1 -0
- package/esm/{ds.constants-Bmi89ll1.js → ds.constants-BOOwq5dE.js} +1 -1
- package/esm/index.js +198 -1
- package/esm/lmvz-button-group.entry.js +181 -0
- package/esm/lmvz-button_2.entry.js +195 -0
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +1 -1
- package/esm/lmvz-chip.entry.js +2 -2
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-menuitem.entry.js +1 -1
- package/esm/lmvz-modal.entry.js +1 -1
- package/esm/lmvz-radio.entry.js +1 -1
- package/esm/lmvz-snackbar.entry.js +81 -0
- package/esm/lmvz-toggle.entry.js +2 -2
- package/esm/loader.js +1 -1
- package/hydrate/index.js +106 -10
- package/hydrate/index.mjs +106 -10
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/p-01aeca60.entry.js +1 -1
- package/lmvz-components/p-0a37e0f2.entry.js +1 -0
- package/lmvz-components/p-14c3d837.entry.js +1 -0
- package/lmvz-components/{p-3df070b0.entry.js → p-24e63b0a.entry.js} +1 -1
- package/lmvz-components/p-25f045b2.entry.js +1 -0
- package/lmvz-components/{p-2044a9ac.entry.js → p-3da301a6.entry.js} +1 -1
- package/lmvz-components/{p-e23d0054.entry.js → p-40228d48.entry.js} +1 -1
- package/lmvz-components/{p-0dced359.entry.js → p-4da9073a.entry.js} +1 -1
- package/lmvz-components/p-6de9981f.entry.js +1 -0
- package/lmvz-components/{p-c01a6c70.entry.js → p-8dae99f1.entry.js} +1 -1
- package/lmvz-components/p-BOOwq5dE.js +1 -0
- package/lmvz-components/p-f5cece32.entry.js +1 -0
- package/manifest.json +288 -9
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +9 -1
- package/types/components/lmvz-snackbar/lmvz-snackbar.d.ts +21 -0
- package/types/components/lmvz-snackbar/public.d.ts +2 -0
- package/types/components/lmvz-snackbar/snackbar-controller.d.ts +32 -0
- package/types/components.d.ts +61 -1
- package/types/index.d.ts +1 -0
- package/cjs/lmvz-button_3.cjs.entry.js +0 -375
- package/components/p-Bb-kEOmU.js +0 -1
- package/components/p-vUYpZZoR.js +0 -1
- package/esm/lmvz-button_3.entry.js +0 -371
- package/lmvz-components/p-3c2adbb4.entry.js +0 -1
- package/lmvz-components/p-90f5a19d.entry.js +0 -1
- package/lmvz-components/p-Bmi89ll1.js +0 -1
- package/lmvz-components/p-acfeae08.entry.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Snackbar } from '../../api';
|
|
2
|
+
export type SnackbarStatus = Snackbar.Status;
|
|
3
|
+
export type SnackbarPriority = Snackbar.Priority;
|
|
4
|
+
export type SnackbarDismissReason = Snackbar.DismissReason;
|
|
5
|
+
export type SnackbarOptions = {
|
|
6
|
+
message: string;
|
|
7
|
+
status?: SnackbarStatus;
|
|
8
|
+
duration?: number;
|
|
9
|
+
priority?: SnackbarPriority;
|
|
10
|
+
actionLabel?: string;
|
|
11
|
+
onAction?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export type SnackbarHandle = {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
dismiss: () => void;
|
|
16
|
+
readonly closed: Promise<{
|
|
17
|
+
reason: SnackbarDismissReason;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export declare class SnackbarController {
|
|
21
|
+
private hostEl?;
|
|
22
|
+
private active?;
|
|
23
|
+
private getHost;
|
|
24
|
+
private clearTimer;
|
|
25
|
+
private scheduleTimer;
|
|
26
|
+
private dismissActive;
|
|
27
|
+
private pauseTimer;
|
|
28
|
+
private resumeTimer;
|
|
29
|
+
private applyToHost;
|
|
30
|
+
open(options: SnackbarOptions): SnackbarHandle;
|
|
31
|
+
dismiss(id?: string): void;
|
|
32
|
+
}
|
package/types/components.d.ts
CHANGED
|
@@ -526,6 +526,24 @@ export declare namespace Components {
|
|
|
526
526
|
*/
|
|
527
527
|
"value"?: string;
|
|
528
528
|
}
|
|
529
|
+
export interface LmvzSnackbar {
|
|
530
|
+
"actionLabel"?: string;
|
|
531
|
+
"duration"?: number;
|
|
532
|
+
"hide": () => Promise<void>;
|
|
533
|
+
/**
|
|
534
|
+
* @default ''
|
|
535
|
+
*/
|
|
536
|
+
"message": string;
|
|
537
|
+
/**
|
|
538
|
+
* @default 'normal'
|
|
539
|
+
*/
|
|
540
|
+
"priority"?: Snackbar.Priority;
|
|
541
|
+
"show": () => Promise<void>;
|
|
542
|
+
/**
|
|
543
|
+
* @default 'success'
|
|
544
|
+
*/
|
|
545
|
+
"status": Snackbar.Status;
|
|
546
|
+
}
|
|
529
547
|
/**
|
|
530
548
|
* Toggle (switch) component. Wraps a native `<input type="checkbox" role="switch">` for full keyboard and form support.
|
|
531
549
|
* @example ```html
|
|
@@ -597,7 +615,7 @@ export declare namespace Icon {
|
|
|
597
615
|
|
|
598
616
|
declare const iconSizes: readonly ["xs", "sm", "md", "lg", "inherit"];
|
|
599
617
|
|
|
600
|
-
declare const iconWeights: readonly ["thin", "medium", "bold"
|
|
618
|
+
declare const iconWeights: readonly ["thin", "medium", "bold"];
|
|
601
619
|
|
|
602
620
|
export declare namespace Input {
|
|
603
621
|
export type Type = (typeof inputTypes)[number];
|
|
@@ -1111,6 +1129,23 @@ export declare namespace JSX {
|
|
|
1111
1129
|
*/
|
|
1112
1130
|
"value"?: string;
|
|
1113
1131
|
}
|
|
1132
|
+
export interface LmvzSnackbar {
|
|
1133
|
+
"actionLabel"?: string;
|
|
1134
|
+
"duration"?: number;
|
|
1135
|
+
/**
|
|
1136
|
+
* @default ''
|
|
1137
|
+
*/
|
|
1138
|
+
"message"?: string;
|
|
1139
|
+
"onLmvzClose"?: (event: LmvzSnackbarCustomEvent<{ reason: Snackbar.DismissReason }>) => void;
|
|
1140
|
+
/**
|
|
1141
|
+
* @default 'normal'
|
|
1142
|
+
*/
|
|
1143
|
+
"priority"?: Snackbar.Priority;
|
|
1144
|
+
/**
|
|
1145
|
+
* @default 'success'
|
|
1146
|
+
*/
|
|
1147
|
+
"status"?: Snackbar.Status;
|
|
1148
|
+
}
|
|
1114
1149
|
/**
|
|
1115
1150
|
* Toggle (switch) component. Wraps a native `<input type="checkbox" role="switch">` for full keyboard and form support.
|
|
1116
1151
|
* @example ```html
|
|
@@ -1258,6 +1293,13 @@ export declare namespace JSX {
|
|
|
1258
1293
|
"required": boolean;
|
|
1259
1294
|
"name": string;
|
|
1260
1295
|
}
|
|
1296
|
+
export interface LmvzSnackbarAttributes {
|
|
1297
|
+
"status": Snackbar.Status;
|
|
1298
|
+
"message": string;
|
|
1299
|
+
"duration": number;
|
|
1300
|
+
"priority": Snackbar.Priority;
|
|
1301
|
+
"actionLabel": string;
|
|
1302
|
+
}
|
|
1261
1303
|
export interface LmvzToggleAttributes {
|
|
1262
1304
|
"label": string;
|
|
1263
1305
|
"checked": boolean;
|
|
@@ -1282,6 +1324,7 @@ export declare namespace JSX {
|
|
|
1282
1324
|
"lmvz-modal": Omit<LmvzModal, keyof LmvzModalAttributes> & { [K in keyof LmvzModal & keyof LmvzModalAttributes]?: LmvzModal[K] } & { [K in keyof LmvzModal & keyof LmvzModalAttributes as `attr:${K}`]?: LmvzModalAttributes[K] } & { [K in keyof LmvzModal & keyof LmvzModalAttributes as `prop:${K}`]?: LmvzModal[K] };
|
|
1283
1325
|
"lmvz-radio": Omit<LmvzRadio, keyof LmvzRadioAttributes> & { [K in keyof LmvzRadio & keyof LmvzRadioAttributes]?: LmvzRadio[K] } & { [K in keyof LmvzRadio & keyof LmvzRadioAttributes as `attr:${K}`]?: LmvzRadioAttributes[K] } & { [K in keyof LmvzRadio & keyof LmvzRadioAttributes as `prop:${K}`]?: LmvzRadio[K] } & OneOf<"label", LmvzRadio["label"], LmvzRadioAttributes["label"]>;
|
|
1284
1326
|
"lmvz-select": Omit<LmvzSelect, keyof LmvzSelectAttributes> & { [K in keyof LmvzSelect & keyof LmvzSelectAttributes]?: LmvzSelect[K] } & { [K in keyof LmvzSelect & keyof LmvzSelectAttributes as `attr:${K}`]?: LmvzSelectAttributes[K] } & { [K in keyof LmvzSelect & keyof LmvzSelectAttributes as `prop:${K}`]?: LmvzSelect[K] } & OneOf<"label", LmvzSelect["label"], LmvzSelectAttributes["label"]>;
|
|
1327
|
+
"lmvz-snackbar": Omit<LmvzSnackbar, keyof LmvzSnackbarAttributes> & { [K in keyof LmvzSnackbar & keyof LmvzSnackbarAttributes]?: LmvzSnackbar[K] } & { [K in keyof LmvzSnackbar & keyof LmvzSnackbarAttributes as `attr:${K}`]?: LmvzSnackbarAttributes[K] } & { [K in keyof LmvzSnackbar & keyof LmvzSnackbarAttributes as `prop:${K}`]?: LmvzSnackbar[K] };
|
|
1285
1328
|
"lmvz-toggle": Omit<LmvzToggle, keyof LmvzToggleAttributes> & { [K in keyof LmvzToggle & keyof LmvzToggleAttributes]?: LmvzToggle[K] } & { [K in keyof LmvzToggle & keyof LmvzToggleAttributes as `attr:${K}`]?: LmvzToggleAttributes[K] } & { [K in keyof LmvzToggle & keyof LmvzToggleAttributes as `prop:${K}`]?: LmvzToggle[K] } & OneOf<"label", LmvzToggle["label"], LmvzToggleAttributes["label"]>;
|
|
1286
1329
|
}
|
|
1287
1330
|
}
|
|
@@ -1336,6 +1379,11 @@ export declare interface LmvzSelectCustomEvent<T> extends CustomEvent<T> {
|
|
|
1336
1379
|
target: HTMLLmvzSelectElement;
|
|
1337
1380
|
}
|
|
1338
1381
|
|
|
1382
|
+
export declare interface LmvzSnackbarCustomEvent<T> extends CustomEvent<T> {
|
|
1383
|
+
detail: T;
|
|
1384
|
+
target: HTMLLmvzSnackbarElement;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1339
1387
|
export declare interface LmvzToggleCustomEvent<T> extends CustomEvent<T> {
|
|
1340
1388
|
detail: T;
|
|
1341
1389
|
target: HTMLLmvzToggleElement;
|
|
@@ -1345,6 +1393,18 @@ declare const scaleValues: readonly ["small", "default", "large"];
|
|
|
1345
1393
|
|
|
1346
1394
|
declare const sizes: readonly ["xs", "sm", "md", "lg"];
|
|
1347
1395
|
|
|
1396
|
+
export declare namespace Snackbar {
|
|
1397
|
+
export type Status = (typeof snackbarStatuses)[number];
|
|
1398
|
+
export type Priority = (typeof snackbarPriorities)[number];
|
|
1399
|
+
export type DismissReason = (typeof snackbarDismissReasons)[number];
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
declare const snackbarDismissReasons: readonly ["timeout", "manual", "action", "overridden", "swallowed"];
|
|
1403
|
+
|
|
1404
|
+
declare const snackbarPriorities: readonly ["low", "normal", "high"];
|
|
1405
|
+
|
|
1406
|
+
declare const snackbarStatuses: readonly ["success", "warning", "error"];
|
|
1407
|
+
|
|
1348
1408
|
export declare type SVGString = string & Brand.Brand<'SVG'>;
|
|
1349
1409
|
|
|
1350
1410
|
declare const variants: readonly ["primary", "secondary", "tertiary"];
|
package/types/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export type * from './components.d.ts';
|
|
|
3
3
|
export { chipSizes, chipTypes, iconSizes, iconWeights, inputTypes, textSizes } from './api/ds.constants';
|
|
4
4
|
export type { LmvzDS, Typography } from './api';
|
|
5
5
|
export * from './utils/public';
|
|
6
|
+
export * from './components/lmvz-snackbar/public';
|
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-BCFBLj0e.js');
|
|
4
|
-
var index$1 = require('./index-Bp6Dd2i1.js');
|
|
5
|
-
var reactiveControllerHost = require('./reactive-controller-host-DrtMkMd7.js');
|
|
6
|
-
var elementActivationController = require('./element-activation-controller-DC_6T0Rt.js');
|
|
7
|
-
var component = require('./component-C7cavwmZ.js');
|
|
8
|
-
var ariaLoader = require('./aria-loader-BRo2FTGh.js');
|
|
9
|
-
var svg = require('./svg-BMBduILB.js');
|
|
10
|
-
var icons = require('./icons-BQASWgk-.js');
|
|
11
|
-
require('./logger-DsM6xg6V.js');
|
|
12
|
-
|
|
13
|
-
const lmvzButtonCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-secondary, #000000)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-gap-md, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --lmvz-button-font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); min-height: var(--lmvz-button-min-height); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); } button.primary { --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); --lmvz-button-color: var(--lmvz-semantic-color-int-on-primary, #ffffff); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; } button.primary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button.primary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary-hover, #000000); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-button-padding-block: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-button-gap: var(--lmvz-component-input-gap-sm, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --lmvz-button-font: var(--lmvz-typography-body-sm-strong, 500 clamp(0.69rem, 0.67rem + 0.06vw, 0.75rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-gap-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --lmvz-button-font: var(--lmvz-typography-body-lg-strong, 500 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: inline-block; } ::slotted(*) { --lmvz-component-color: var(--lmvz-button-color); } `;
|
|
14
|
-
|
|
15
|
-
const LmvzButton = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
16
|
-
get el() { return index.getElement(this); }
|
|
17
|
-
validationEl;
|
|
18
|
-
inheritedAttributes = {};
|
|
19
|
-
formEl = null;
|
|
20
|
-
formButtonEl = null;
|
|
21
|
-
lmvzActivation;
|
|
22
|
-
get ti() {
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
scale = 'default';
|
|
26
|
-
variant;
|
|
27
|
-
disabled = false;
|
|
28
|
-
type = 'button';
|
|
29
|
-
form;
|
|
30
|
-
formMethod;
|
|
31
|
-
name;
|
|
32
|
-
value;
|
|
33
|
-
constructor(hostRef) {
|
|
34
|
-
super();
|
|
35
|
-
index.registerInstance(this, hostRef);
|
|
36
|
-
this.lmvzActivation = index.createEvent(this, "lmvzActivation", 7);
|
|
37
|
-
this.addController(new reactiveControllerHost.AriaValidationController(this));
|
|
38
|
-
this.addController(new elementActivationController.ElementActivationController(this, {
|
|
39
|
-
localHandler: this.handleClick.bind(this),
|
|
40
|
-
keys: ['Enter'],
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
connectedCallback() {
|
|
44
|
-
this.inheritedAttributes = component.inheritAriaAttributes(this.el);
|
|
45
|
-
super.connectedCallback();
|
|
46
|
-
}
|
|
47
|
-
disconnectedCallback() {
|
|
48
|
-
this.formButtonEl?.remove();
|
|
49
|
-
this.formButtonEl = null;
|
|
50
|
-
this.formEl = null;
|
|
51
|
-
super.disconnectedCallback();
|
|
52
|
-
}
|
|
53
|
-
renderHiddenButton() {
|
|
54
|
-
if (this.type !== 'submit') {
|
|
55
|
-
this.formButtonEl?.remove();
|
|
56
|
-
this.formButtonEl = null;
|
|
57
|
-
this.formEl = null;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const formEl = component.findFormByRef(this.form, this.el);
|
|
61
|
-
if (!formEl) {
|
|
62
|
-
this.formButtonEl?.remove();
|
|
63
|
-
this.formButtonEl = null;
|
|
64
|
-
this.formEl = null;
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.formEl = formEl;
|
|
68
|
-
const formButtonEl = this.formButtonEl ?? document.createElement('button');
|
|
69
|
-
formButtonEl.type = 'submit';
|
|
70
|
-
formButtonEl.style.display = 'none';
|
|
71
|
-
formButtonEl.disabled = this.disabled;
|
|
72
|
-
formButtonEl.name = this.name ?? '';
|
|
73
|
-
formButtonEl.value = this.value ?? '';
|
|
74
|
-
if (this.formMethod) {
|
|
75
|
-
formButtonEl.setAttribute('formmethod', this.formMethod);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
formButtonEl.removeAttribute('formmethod');
|
|
79
|
-
}
|
|
80
|
-
if (this.formButtonEl !== formButtonEl) {
|
|
81
|
-
this.formButtonEl = formButtonEl;
|
|
82
|
-
}
|
|
83
|
-
if (formButtonEl.parentElement !== formEl) {
|
|
84
|
-
formButtonEl.remove();
|
|
85
|
-
formEl.appendChild(formButtonEl);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
submitForm(ev) {
|
|
89
|
-
if (this.formEl && this.formButtonEl) {
|
|
90
|
-
ev.preventDefault();
|
|
91
|
-
this.formButtonEl.click();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
handleClick = (ev) => {
|
|
95
|
-
if (this.type === 'submit') {
|
|
96
|
-
this.submitForm(ev);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
render() {
|
|
100
|
-
this.renderHiddenButton();
|
|
101
|
-
return (index.h(index.Host, { key: '8196de85afc3878c6f38e582d7c031f5d19bcd36', "aria-disabled": this.disabled ? 'true' : null }, index.h("button", { key: '8d73f979fa227de22a03403a2a3938684911060a', ref: (e) => (this.validationEl = e), part: "button", disabled: this.disabled, type: this.type, class: index$1.classNames(this.variant ?? 'secondary', { [this.scale ?? '']: !!this.scale, disabled: this.disabled }), ...this.inheritedAttributes }, index.h("slot", { key: '18e91a2f94ba0d7e5cf13150191003e2f0b2a03a' }))));
|
|
102
|
-
}
|
|
103
|
-
static get delegatesFocus() { return true; }
|
|
104
|
-
};
|
|
105
|
-
LmvzButton.style = lmvzButtonCss();
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Returns a function that delegates to the given predicate/filter and negates its result.
|
|
109
|
-
* The returned function preserves the input function's types, arguments and timing.
|
|
110
|
-
*
|
|
111
|
-
* @param delegate - The predicate/filter function to negate.
|
|
112
|
-
* @returns A function that returns the negated result.
|
|
113
|
-
*/
|
|
114
|
-
function negate(delegate) {
|
|
115
|
-
return (...args) => {
|
|
116
|
-
const result = delegate(...args);
|
|
117
|
-
return ariaLoader.isPromise(result) ? result.then((res) => !res) : !result;
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const lmvzButtonGroupCss = () => `:host{display:flex;justify-content:flex-end;gap:var(--lmvz-component-input-gap-md, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));font:var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router);flex-wrap:wrap}::slotted([hidden]){display:none !important}`;
|
|
122
|
-
|
|
123
|
-
const LmvzButtonGroup = class {
|
|
124
|
-
constructor(hostRef) {
|
|
125
|
-
index.registerInstance(this, hostRef);
|
|
126
|
-
}
|
|
127
|
-
actionsSlot;
|
|
128
|
-
validationMessageCache = [];
|
|
129
|
-
actionsStateObserver;
|
|
130
|
-
get primaryEnabledAction() {
|
|
131
|
-
return this.enabledButtons.find(isPrimaryAction) ?? this.enabledButtons[0];
|
|
132
|
-
}
|
|
133
|
-
get hasActions() {
|
|
134
|
-
return this.assignedButtons.some((element) => isVisible(element) && isActionButton(element) && !isDisabledButton(element));
|
|
135
|
-
}
|
|
136
|
-
componentDidLoad() {
|
|
137
|
-
this.handleActionsSlotChange();
|
|
138
|
-
}
|
|
139
|
-
disconnectedCallback() {
|
|
140
|
-
this.actionsStateObserver?.disconnect();
|
|
141
|
-
}
|
|
142
|
-
get assignedElements() {
|
|
143
|
-
return this.actionsSlot?.assignedElements({ flatten: true }) ?? [];
|
|
144
|
-
}
|
|
145
|
-
get assignedButtons() {
|
|
146
|
-
return this.assignedElements.filter(isActionButton);
|
|
147
|
-
}
|
|
148
|
-
get visibleButtons() {
|
|
149
|
-
return this.assignedButtons.filter(isVisible);
|
|
150
|
-
}
|
|
151
|
-
get enabledButtons() {
|
|
152
|
-
return this.visibleButtons.filter(negate(isDisabledButton));
|
|
153
|
-
}
|
|
154
|
-
getActionValidationResult() {
|
|
155
|
-
if (!this.visibleButtons.length) {
|
|
156
|
-
return [];
|
|
157
|
-
}
|
|
158
|
-
const primaryActions = this.visibleButtons.filter(isPrimaryAction);
|
|
159
|
-
const secondaryActions = this.visibleButtons.filter(isSecondaryAction);
|
|
160
|
-
const issues = [];
|
|
161
|
-
const order = this.visibleButtons.toReversed();
|
|
162
|
-
if (primaryActions.length !== 1)
|
|
163
|
-
issues.push('LmvzModal actions slot must contain exactly one primary action.');
|
|
164
|
-
if (secondaryActions.length > 1)
|
|
165
|
-
issues.push(`LmvzModal actions slot must contain at most one secondary action (received ${secondaryActions.length})`);
|
|
166
|
-
if (primaryActions.length) {
|
|
167
|
-
const primaryAction = primaryActions[0];
|
|
168
|
-
const secondaryAction = secondaryActions[0];
|
|
169
|
-
if (order.indexOf(primaryAction) !== 0)
|
|
170
|
-
issues.push('Primary action must be the last focusable element in the actions slot (i.e. rightmost button).');
|
|
171
|
-
if (secondaryAction && order.indexOf(secondaryAction) !== 1)
|
|
172
|
-
issues.push('Secondary action must be the second-to-last focusable element in the actions slot (i.e. left of primary button).');
|
|
173
|
-
}
|
|
174
|
-
else if (secondaryActions.length) {
|
|
175
|
-
const secondaryAction = secondaryActions[0];
|
|
176
|
-
if (order.indexOf(secondaryAction) !== 0)
|
|
177
|
-
issues.push('Secondary action must be the last focusable element in the actions slot when no primary action is present (i.e. rightmost button).');
|
|
178
|
-
}
|
|
179
|
-
return issues;
|
|
180
|
-
}
|
|
181
|
-
handleActionsSlotChange = () => {
|
|
182
|
-
this.observeActionState();
|
|
183
|
-
this.syncActionsState();
|
|
184
|
-
};
|
|
185
|
-
observeActionState() {
|
|
186
|
-
if (typeof MutationObserver === 'undefined')
|
|
187
|
-
return;
|
|
188
|
-
this.actionsStateObserver?.disconnect();
|
|
189
|
-
if (!this.assignedButtons.length)
|
|
190
|
-
return;
|
|
191
|
-
this.actionsStateObserver = new MutationObserver(() => {
|
|
192
|
-
this.syncActionsState();
|
|
193
|
-
});
|
|
194
|
-
this.assignedButtons.forEach((element) => {
|
|
195
|
-
this.actionsStateObserver?.observe(element, {
|
|
196
|
-
attributes: true,
|
|
197
|
-
attributeFilter: ['disabled', 'hidden', 'variant'],
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
syncActionsState() {
|
|
202
|
-
const assignedElements = this.assignedElements;
|
|
203
|
-
assignedElements.forEach((element) => {
|
|
204
|
-
const isAllowedAction = ['LMVZ-BUTTON', 'BUTTON'].includes(element.tagName.toUpperCase());
|
|
205
|
-
if (isAllowedAction)
|
|
206
|
-
return;
|
|
207
|
-
if (!element.hasAttribute('hidden')) {
|
|
208
|
-
element.setAttribute('hidden', '');
|
|
209
|
-
}
|
|
210
|
-
if (element.getAttribute('aria-hidden') !== 'true') {
|
|
211
|
-
element.setAttribute('aria-hidden', 'true');
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
this.checkActions();
|
|
215
|
-
const length = this.visibleButtons.length;
|
|
216
|
-
for (let i = 0; i < length; i++) {
|
|
217
|
-
const variant = i === length - 1 ? 'primary' : i === length - 2 ? 'secondary' : 'tertiary';
|
|
218
|
-
const element = this.visibleButtons.at(i);
|
|
219
|
-
if (!element)
|
|
220
|
-
continue;
|
|
221
|
-
if (isLmvzButton(element)) {
|
|
222
|
-
if (!element.getAttribute('variant'))
|
|
223
|
-
element.setAttribute('variant', variant);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
element.classList.add(variant);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
this.focusPrimaryAction();
|
|
230
|
-
}
|
|
231
|
-
focusPrimaryAction() {
|
|
232
|
-
const focusTarget = this.primaryEnabledAction;
|
|
233
|
-
if (!focusTarget || typeof window === 'undefined')
|
|
234
|
-
return;
|
|
235
|
-
window.requestAnimationFrame(() => {
|
|
236
|
-
if (component.canReceiveFocus(focusTarget)) {
|
|
237
|
-
focusTarget.focus();
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
checkActions() {
|
|
242
|
-
if (!ariaLoader.isAriaValidationEnabled())
|
|
243
|
-
return;
|
|
244
|
-
const issues = this.getActionValidationResult();
|
|
245
|
-
if (!issues.length) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
issues.forEach((issue) => {
|
|
249
|
-
if (this.validationMessageCache.includes(issue))
|
|
250
|
-
return;
|
|
251
|
-
console.warn(issue);
|
|
252
|
-
this.validationMessageCache.push(issue);
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
render() {
|
|
256
|
-
return (index.h(index.Host, { key: '56b60821ecaa2301d13e78d621e873aa74cd170e' }, index.h("slot", { key: 'e6a1422950fa5b0026356b7788a607a690116186', ref: (element) => (this.actionsSlot = element), onSlotchange: this.handleActionsSlotChange })));
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
function isActionButton(element) {
|
|
260
|
-
return ['LMVZ-BUTTON', 'BUTTON'].includes(element.tagName.toUpperCase());
|
|
261
|
-
}
|
|
262
|
-
function isLmvzButton(element) {
|
|
263
|
-
return element?.tagName.toUpperCase() === 'LMVZ-BUTTON';
|
|
264
|
-
}
|
|
265
|
-
function isDisabledButton(element) {
|
|
266
|
-
return element.hasAttribute('disabled') || element.disabled === true;
|
|
267
|
-
}
|
|
268
|
-
function isVisible(element) {
|
|
269
|
-
return !element.hasAttribute('hidden');
|
|
270
|
-
}
|
|
271
|
-
function getActionVariant(element) {
|
|
272
|
-
const variant = element.getAttribute('variant') ?? element.variant;
|
|
273
|
-
return variant === 'primary' || variant === 'secondary' || variant === 'tertiary' ? variant : 'secondary';
|
|
274
|
-
}
|
|
275
|
-
function isPrimaryAction(element) {
|
|
276
|
-
return getActionVariant(element) === 'primary';
|
|
277
|
-
}
|
|
278
|
-
function isSecondaryAction(element) {
|
|
279
|
-
return getActionVariant(element) === 'secondary';
|
|
280
|
-
}
|
|
281
|
-
LmvzButtonGroup.style = lmvzButtonGroupCss();
|
|
282
|
-
|
|
283
|
-
const lmvzIconCss = () => `.sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));--lmvz-icon-size:var(--lmvz-component-size, var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)));display:inline-block;line-height:0;svg{display:block;height:var(--lmvz-icon-size);width:auto}svg path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{--lmvz-icon-size:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem))}}[size='sm'].sc-lmvz-icon-h{svg{--lmvz-icon-size:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))}}[size='md'].sc-lmvz-icon-h{svg{--lmvz-icon-size:var(--lmvz-component-icon-size-md, clamp(1rem, 0.94rem + 0.26vw, 1.25rem))}}[size='lg'].sc-lmvz-icon-h{svg{--lmvz-icon-size:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.44rem + 0.26vw, 1.75rem))}}[size='inherit'].sc-lmvz-icon-h{svg{height:var(--lmvz-component-size, inherit)}}[weight='light'].sc-lmvz-icon-h{svg path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg path{stroke-width:2;fill:var(--lmvz-icon-color)}}`;
|
|
284
|
-
|
|
285
|
-
const LmvzIcon = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
286
|
-
intersectionObserver;
|
|
287
|
-
ariaValidationController = new reactiveControllerHost.AriaValidationController(this);
|
|
288
|
-
get el() { return index.getElement(this); }
|
|
289
|
-
validationEl;
|
|
290
|
-
icon;
|
|
291
|
-
weight = 'medium';
|
|
292
|
-
size = 'md';
|
|
293
|
-
iconset;
|
|
294
|
-
iconData;
|
|
295
|
-
visible = false;
|
|
296
|
-
ariaLabel;
|
|
297
|
-
get ariaHidden() {
|
|
298
|
-
return !this.ariaLabel;
|
|
299
|
-
}
|
|
300
|
-
constructor(hostRef) {
|
|
301
|
-
super();
|
|
302
|
-
index.registerInstance(this, hostRef);
|
|
303
|
-
this.addController(this.ariaValidationController);
|
|
304
|
-
}
|
|
305
|
-
connectedCallback() {
|
|
306
|
-
this.waitUntilVisible(() => {
|
|
307
|
-
this.visible = true;
|
|
308
|
-
this.loadIconPathData();
|
|
309
|
-
});
|
|
310
|
-
super.connectedCallback();
|
|
311
|
-
}
|
|
312
|
-
disconnectedCallback() {
|
|
313
|
-
if (this.intersectionObserver && typeof this.intersectionObserver.disconnect === 'function') {
|
|
314
|
-
this.intersectionObserver.disconnect();
|
|
315
|
-
}
|
|
316
|
-
this.intersectionObserver = undefined;
|
|
317
|
-
super.disconnectedCallback();
|
|
318
|
-
}
|
|
319
|
-
async loadIconPathData() {
|
|
320
|
-
const { icon, iconset, visible } = this;
|
|
321
|
-
if (!icon || !visible) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
const maybeIcon = svg.parseSvgString(icon);
|
|
325
|
-
if (maybeIcon) {
|
|
326
|
-
this.iconData = maybeIcon;
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
this.iconData = await icons.resolveIconSvg({
|
|
330
|
-
icon,
|
|
331
|
-
iconset,
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
componentDidRender() {
|
|
335
|
-
this.validationEl = this.el.querySelector('svg');
|
|
336
|
-
this.ariaValidationController.revalidateAria();
|
|
337
|
-
super.componentDidRender();
|
|
338
|
-
}
|
|
339
|
-
render() {
|
|
340
|
-
return index.h(index.Host, { key: '03b4391d02a77409257bcda51c2b65ad9a9e0a0c', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
341
|
-
}
|
|
342
|
-
waitUntilVisible(callback, rootMargin = 50) {
|
|
343
|
-
if (typeof window === 'undefined' || !window.IntersectionObserver) {
|
|
344
|
-
callback();
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
348
|
-
entries.some((entry) => {
|
|
349
|
-
if (entry.isIntersecting) {
|
|
350
|
-
if (this.intersectionObserver && typeof this.intersectionObserver.disconnect === 'function') {
|
|
351
|
-
this.intersectionObserver.disconnect();
|
|
352
|
-
}
|
|
353
|
-
this.intersectionObserver = undefined;
|
|
354
|
-
callback();
|
|
355
|
-
return true;
|
|
356
|
-
}
|
|
357
|
-
return false;
|
|
358
|
-
});
|
|
359
|
-
}, { rootMargin: `${rootMargin}px` });
|
|
360
|
-
this.intersectionObserver.observe(this.el);
|
|
361
|
-
}
|
|
362
|
-
static get watchers() { return {
|
|
363
|
-
"icon": [{
|
|
364
|
-
"loadIconPathData": 0
|
|
365
|
-
}],
|
|
366
|
-
"iconset": [{
|
|
367
|
-
"loadIconPathData": 0
|
|
368
|
-
}]
|
|
369
|
-
}; }
|
|
370
|
-
};
|
|
371
|
-
LmvzIcon.style = lmvzIconCss();
|
|
372
|
-
|
|
373
|
-
exports.lmvz_button = LmvzButton;
|
|
374
|
-
exports.lmvz_button_group = LmvzButtonGroup;
|
|
375
|
-
exports.lmvz_icon = LmvzIcon;
|
package/components/p-Bb-kEOmU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,d as e,h as n,H as s,t as i}from"./p-DYr7Jc0V.js";import{a as o,i as r}from"./p-CdDO7mQa.js";import{a}from"./p-DOTK1OW3.js";const c=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}actionsSlot;validationMessageCache=[];actionsStateObserver;get primaryEnabledAction(){return this.enabledButtons.find(p)??this.enabledButtons[0]}get hasActions(){return this.assignedButtons.some((t=>l(t)&&u(t)&&!h(t)))}componentDidLoad(){this.handleActionsSlotChange()}disconnectedCallback(){this.actionsStateObserver?.disconnect()}get assignedElements(){return this.actionsSlot?.assignedElements({flatten:!0})??[]}get assignedButtons(){return this.assignedElements.filter(u)}get visibleButtons(){return this.assignedButtons.filter(l)}get enabledButtons(){return this.visibleButtons.filter((t=h,(...e)=>{const n=t(...e);return o(n)?n.then((t=>!t)):!n}));var t}getActionValidationResult(){if(!this.visibleButtons.length)return[];const t=this.visibleButtons.filter(p),e=this.visibleButtons.filter(f),n=[],s=this.visibleButtons.toReversed();if(1!==t.length&&n.push("LmvzModal actions slot must contain exactly one primary action."),e.length>1&&n.push(`LmvzModal actions slot must contain at most one secondary action (received ${e.length})`),t.length){const i=e[0];0!==s.indexOf(t[0])&&n.push("Primary action must be the last focusable element in the actions slot (i.e. rightmost button)."),i&&1!==s.indexOf(i)&&n.push("Secondary action must be the second-to-last focusable element in the actions slot (i.e. left of primary button).")}else e.length&&0!==s.indexOf(e[0])&&n.push("Secondary action must be the last focusable element in the actions slot when no primary action is present (i.e. rightmost button).");return n}handleActionsSlotChange=()=>{this.observeActionState(),this.syncActionsState()};observeActionState(){"undefined"!=typeof MutationObserver&&(this.actionsStateObserver?.disconnect(),this.assignedButtons.length&&(this.actionsStateObserver=new MutationObserver((()=>{this.syncActionsState()})),this.assignedButtons.forEach((t=>{this.actionsStateObserver?.observe(t,{attributes:!0,attributeFilter:["disabled","hidden","variant"]})}))))}syncActionsState(){this.assignedElements.forEach((t=>{["LMVZ-BUTTON","BUTTON"].includes(t.tagName.toUpperCase())||(t.hasAttribute("hidden")||t.setAttribute("hidden",""),"true"!==t.getAttribute("aria-hidden")&&t.setAttribute("aria-hidden","true"))})),this.checkActions();const t=this.visibleButtons.length;for(let e=0;e<t;e++){const n=e===t-1?"primary":e===t-2?"secondary":"tertiary",s=this.visibleButtons.at(e);s&&(d(s)?s.getAttribute("variant")||s.setAttribute("variant",n):s.classList.add(n))}this.focusPrimaryAction()}focusPrimaryAction(){const t=this.primaryEnabledAction;t&&"undefined"!=typeof window&&window.requestAnimationFrame((()=>{a(t)&&t.focus()}))}checkActions(){if(!r())return;const t=this.getActionValidationResult();t.length&&t.forEach((t=>{this.validationMessageCache.includes(t)||(console.warn(t),this.validationMessageCache.push(t))}))}render(){return n(s,{key:"56b60821ecaa2301d13e78d621e873aa74cd170e"},n("slot",{key:"e6a1422950fa5b0026356b7788a607a690116186",ref:t=>this.actionsSlot=t,onSlotchange:this.handleActionsSlotChange}))}static get style(){return":host{display:flex;justify-content:flex-end;gap:var(--lmvz-component-input-gap-md, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));font:var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router);flex-wrap:wrap}::slotted([hidden]){display:none !important}"}},[257,"lmvz-button-group",{primaryEnabledAction:[2064],hasActions:[2052,"has-actions"]}]);function u(t){return["LMVZ-BUTTON","BUTTON"].includes(t.tagName.toUpperCase())}function d(t){return"LMVZ-BUTTON"===t?.tagName.toUpperCase()}function h(t){return t.hasAttribute("disabled")||!0===t.disabled}function l(t){return!t.hasAttribute("hidden")}function m(t){const e=t.getAttribute("variant")??t.variant;return"primary"===e||"secondary"===e||"tertiary"===e?e:"secondary"}function p(t){return"primary"===m(t)}function f(t){return"secondary"===m(t)}function y(){"undefined"!=typeof customElements&&["lmvz-button-group"].forEach((t=>{"lmvz-button-group"===t&&(customElements.get(i(t))||customElements.define(i(t),c))}))}export{c as L,y as d}
|
package/components/p-vUYpZZoR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,c as o,h as n,H as r,t as e}from"./p-DYr7Jc0V.js";import{c as a}from"./p-BfTCfPZ1.js";import{R as l,A as m}from"./p-CNmHnJ1D.js";import{E as i}from"./p-CN0JX9-m.js";import{i as s,f as v}from"./p-DOTK1OW3.js";const d=t(class extends l{get el(){return this}validationEl;inheritedAttributes={};formEl=null;formButtonEl=null;lmvzActivation;get ti(){return 0}scale="default";variant;disabled=!1;type="button";form;formMethod;name;value;constructor(t){super(!1),!1!==t&&this.__registerHost(),this.__attachShadow(),this.lmvzActivation=o(this,"lmvzActivation",7),this.addController(new m(this)),this.addController(new i(this,{localHandler:this.handleClick.bind(this),keys:["Enter"]}))}connectedCallback(){this.inheritedAttributes=s(this.el),super.connectedCallback()}disconnectedCallback(){this.formButtonEl?.remove(),this.formButtonEl=null,this.formEl=null,super.disconnectedCallback()}renderHiddenButton(){if("submit"!==this.type)return this.formButtonEl?.remove(),this.formButtonEl=null,void(this.formEl=null);const t=v(this.form,this.el);if(!t)return this.formButtonEl?.remove(),this.formButtonEl=null,void(this.formEl=null);this.formEl=t;const o=this.formButtonEl??document.createElement("button");o.type="submit",o.style.display="none",o.disabled=this.disabled,o.name=this.name??"",o.value=this.value??"",this.formMethod?o.setAttribute("formmethod",this.formMethod):o.removeAttribute("formmethod"),this.formButtonEl!==o&&(this.formButtonEl=o),o.parentElement!==t&&(o.remove(),t.appendChild(o))}submitForm(t){this.formEl&&this.formButtonEl&&(t.preventDefault(),this.formButtonEl.click())}handleClick=t=>{"submit"===this.type&&this.submitForm(t)};render(){return this.renderHiddenButton(),n(r,{key:"8196de85afc3878c6f38e582d7c031f5d19bcd36","aria-disabled":this.disabled?"true":null},n("button",{key:"8d73f979fa227de22a03403a2a3938684911060a",ref:t=>this.validationEl=t,part:"button",disabled:this.disabled,type:this.type,class:a(this.variant??"secondary",{[this.scale??""]:!!this.scale,disabled:this.disabled}),...this.inheritedAttributes},n("slot",{key:"18e91a2f94ba0d7e5cf13150191003e2f0b2a03a"})))}static get delegatesFocus(){return!0}static get style(){return" @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } } :host { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-secondary, #000000)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-gap-md, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --lmvz-button-font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); min-height: var(--lmvz-button-min-height); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); } button.primary { --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); --lmvz-button-color: var(--lmvz-semantic-color-int-on-primary, #ffffff); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; } button.primary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button.primary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary-hover, #000000); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-button-padding-block: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-button-gap: var(--lmvz-component-input-gap-sm, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --lmvz-button-font: var(--lmvz-typography-body-sm-strong, 500 clamp(0.69rem, 0.67rem + 0.06vw, 0.75rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-gap-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-button-min-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --lmvz-button-font: var(--lmvz-typography-body-lg-strong, 500 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: inline-block; } ::slotted(*) { --lmvz-component-color: var(--lmvz-button-color); } "}},[785,"lmvz-button",{ti:[2562,"tabindex"],scale:[513],variant:[513],disabled:[516],type:[1],form:[1],formMethod:[1,"form-method"],name:[1],value:[1]}]);function c(){"undefined"!=typeof customElements&&["lmvz-button"].forEach((t=>{"lmvz-button"===t&&(customElements.get(e(t))||customElements.define(e(t),d))}))}export{d as L,c as d}
|