wj-elements 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/light.css CHANGED
@@ -414,6 +414,7 @@
414
414
  --wje-header-border-style: solid;
415
415
  --wje-header-top: 0;
416
416
  --wje-header-height: 60px;
417
+ --wje-header-z-index: 100;
417
418
 
418
419
  /* Icon */
419
420
  --wje-icon-stroke: 2;
@@ -6,6 +6,10 @@ export const enGb: {
6
6
  'wj.file.upload.button': string;
7
7
  'wj.file.upload.uploaded': string;
8
8
  'wj.file.upload.from': string;
9
+ 'wj.file.upload.error.invalid.type': string;
10
+ 'wj.file.upload.error.file.too.large': string;
11
+ 'wj.file.upload.error.max.files': string;
12
+ 'wj.file.upload.error.generic': string;
9
13
  'wj.stepper.button.next': string;
10
14
  'wj.stepper.button.finish': string;
11
15
  'wj.stepper.button.previous': string;
@@ -6,6 +6,10 @@ export const skSk: {
6
6
  'wj.file.upload.button': string;
7
7
  'wj.file.upload.uploaded': string;
8
8
  'wj.file.upload.from': string;
9
+ 'wj.file.upload.error.invalid.type': string;
10
+ 'wj.file.upload.error.file.too.large': string;
11
+ 'wj.file.upload.error.max.files': string;
12
+ 'wj.file.upload.error.generic': string;
9
13
  'wj.stepper.button.next': string;
10
14
  'wj.stepper.button.finish': string;
11
15
  'wj.stepper.button.previous': string;
@@ -6,7 +6,9 @@ import { default as WJElement } from '../wje-element/element.js';
6
6
  * @documentation https://elements.webjet.sk/components/chip
7
7
  * @status stable
8
8
  * @augments WJElement
9
+ * @slot start - The chip leading content.
9
10
  * @slot - The chip main content.
11
+ * @slot end - The chip trailing content.
10
12
  * @csspart native - The component's native wrapper.
11
13
  * //@fires wje-chip:remove - Dispatched when the chip is removed;
12
14
  */
@@ -70,6 +72,7 @@ export default class Chip extends WJElement {
70
72
  */
71
73
  draw(): DocumentFragment;
72
74
  removeElement: HTMLElement;
75
+ slotStart: HTMLSlotElement;
73
76
  slotEnd: HTMLSlotElement;
74
77
  /**
75
78
  * Syncs ARIA attributes on the host element.
@@ -153,6 +153,7 @@ export default class FileUpload extends WJElement {
153
153
  native: HTMLDivElement;
154
154
  fileList: HTMLSlotElement;
155
155
  fileInput: HTMLInputElement;
156
+ errorMessage: HTMLDivElement;
156
157
  /**
157
158
  * Method to perform actions after the component is drawn.
158
159
  */
@@ -211,4 +212,19 @@ export default class FileUpload extends WJElement {
211
212
  * Method to reset the form state.
212
213
  */
213
214
  resetFormState(): void;
215
+ /**
216
+ * Shows a user-facing validation error inside the dropzone.
217
+ * @param {object|Error} error Error payload to display inside the dropzone.
218
+ */
219
+ showError(error: object | Error): void;
220
+ /**
221
+ * Clears the currently displayed validation error.
222
+ */
223
+ clearError(): void;
224
+ /**
225
+ * Resolves a readable upload error message.
226
+ * @param {object|Error} error Error payload used to resolve the translated message.
227
+ * @returns {string}
228
+ */
229
+ getErrorMessage(error?: object | Error): string;
214
230
  }
@@ -12,6 +12,7 @@ import { default as WJElement } from '../wje-element/element.js';
12
12
  * @cssproperty [--wje-header-border-style=solid] - The border styles of the header
13
13
  * @cssproperty [--wje-header-top=0] - The position top of the header
14
14
  * @cssproperty [--wje-header-height=60px] - The height of the header element.
15
+ * @cssproperty [--wje-header-z-index=100] - The z-index used when the header is sticky.
15
16
  * @tag wje-header
16
17
  */
17
18
  export default class Header extends WJElement {
@@ -24,8 +24,8 @@ import { default as WJElement } from '../wje-element/element.js';
24
24
  * @property {string} mobileBreakPoint - The viewport width where mobile presentation becomes active.
25
25
  * @property {boolean} backdropDismiss - Closes the mobile bottom sheet when the backdrop is clicked.
26
26
  * @property {boolean} sheetResizable - Enables mobile bottom sheet resizing.
27
- * @property {string} sheetScope - Defines whether the mobile bottom sheet is scoped to the container or viewport.
28
- * @property {string} sheetBoundary - CSS selector for the composed ancestor that bounds the mobile bottom sheet.
27
+ * @property {string} sheetScope - Defines whether the mobile bottom sheet panel is scoped to the container or viewport.
28
+ * @property {string} sheetBoundary - CSS selector for the composed ancestor that bounds the mobile bottom sheet panel.
29
29
  * @property {string} sheetHeight - The mobile bottom sheet height after opening.
30
30
  * @property {string} sheetMinHeight - The minimum mobile bottom sheet height while resizing.
31
31
  * @property {string} sheetMaxHeight - The maximum mobile bottom sheet height while resizing.
@@ -33,12 +33,17 @@ import { default as WJElement } from '../wje-element/element.js';
33
33
  * @attribute {string} mobile-break-point - Viewport width where mobile presentation becomes active. Defaults to "768".
34
34
  * @attribute {boolean} backdrop-dismiss - Closes the mobile bottom sheet when the backdrop is clicked.
35
35
  * @attribute {boolean} sheet-resizable - Enables resizing the mobile bottom sheet with a handle.
36
- * @attribute {string} sheet-scope - Defines whether the sheet is scoped to "viewport", "parent", or a bounded container.
37
- * @attribute {string} sheet-boundary - CSS selector for the composed ancestor that bounds the mobile bottom sheet.
36
+ * @attribute {string} sheet-scope - Defines whether the sheet panel is scoped to "viewport", "parent", or a bounded container.
37
+ * @attribute {string} sheet-boundary - CSS selector for the composed ancestor that bounds the mobile bottom sheet panel.
38
38
  * @attribute {string} sheet-height - The mobile bottom sheet height after opening.
39
39
  * @attribute {string} sheet-min-height - The minimum mobile bottom sheet height while resizing.
40
40
  * @attribute {string} sheet-max-height - The maximum mobile bottom sheet height while resizing.
41
41
  * @cssproperty [--wje-sliding-container-background=var(--wje-background)] - Background of the sliding panel.
42
+ * @cssproperty [--wje-sliding-container-z-index=1000] - z-index of the side sliding container.
43
+ * @cssproperty [--wje-sliding-container-bottom-sheet-z-index=var(--wje-sliding-container-z-index, 1000)] - z-index of the mobile bottom sheet host.
44
+ * @cssproperty [--wje-sliding-container-bottom-sheet-backdrop-z-index=0] - z-index of the mobile bottom sheet backdrop inside the host layer.
45
+ * @cssproperty [--wje-sliding-container-bottom-sheet-panel-z-index=1] - z-index of the mobile bottom sheet panel inside the host layer.
46
+ * @cssproperty [--wje-sliding-container-portal-backdrop-z-index] - z-index of the body-level mobile bottom sheet backdrop.
42
47
  * @cssproperty [--wje-sliding-container-backdrop-background=var(--wje-backdrop)] - Background of the mobile bottom sheet backdrop.
43
48
  * @cssproperty [--wje-sliding-container-backdrop-opacity=1] - Backdrop opacity while the mobile bottom sheet is open.
44
49
  * @cssproperty [--wje-sliding-container-box-shadow=var(--wje-sliding-container-shadow)] - Shadow of the mobile bottom sheet panel.
@@ -92,7 +97,6 @@ export default class SlidingContainer extends WJElement {
92
97
  hasMoved: boolean;
93
98
  };
94
99
  _sheetBackdropHandledUntil: number;
95
- _hasLockedDocumentScroll: boolean;
96
100
  _bottomSheetScopeFrame: {
97
101
  top: number;
98
102
  left: number;
@@ -242,22 +246,22 @@ export default class SlidingContainer extends WJElement {
242
246
  */
243
247
  get sheetResizable(): boolean;
244
248
  /**
245
- * Sets the mobile bottom sheet scope.
249
+ * Sets the mobile bottom sheet panel scope.
246
250
  * @param {string} value The new boundary mode for the mobile sheet.
247
251
  */
248
252
  set sheetScope(value: string);
249
253
  /**
250
- * Gets the mobile bottom sheet scope.
254
+ * Gets the mobile bottom sheet panel scope. The backdrop always covers the viewport.
251
255
  * @returns {string} Either 'viewport', 'container', or 'parent'.
252
256
  */
253
257
  get sheetScope(): string;
254
258
  /**
255
- * Sets the selector used for container-scoped mobile bottom sheets.
259
+ * Sets the selector used for container-scoped mobile bottom sheet panels.
256
260
  * @param {string} value Selector for the boundary element.
257
261
  */
258
262
  set sheetBoundary(value: string);
259
263
  /**
260
- * Gets the selector used for container-scoped mobile bottom sheets.
264
+ * Gets the selector used for container-scoped mobile bottom sheet panels.
261
265
  * @returns {string|null} A CSS selector used to find the composed boundary ancestor.
262
266
  */
263
267
  get sheetBoundary(): string | null;
@@ -338,6 +342,60 @@ export default class SlidingContainer extends WJElement {
338
342
  * @returns {boolean}
339
343
  */
340
344
  isBottomSheet(): boolean;
345
+ /**
346
+ * Adds interaction listeners to a backdrop element.
347
+ * @param {HTMLElement} backdrop The backdrop element.
348
+ */
349
+ addBackdropListeners(backdrop: HTMLElement): void;
350
+ /**
351
+ * Removes interaction listeners from a backdrop element.
352
+ * @param {HTMLElement} backdrop The backdrop element.
353
+ */
354
+ removeBackdropListeners(backdrop: HTMLElement): void;
355
+ /**
356
+ * Checks whether an element is one of this component's backdrop layers.
357
+ * @param {EventTarget|null} element The event target.
358
+ * @returns {boolean}
359
+ */
360
+ isBackdropElement(element: EventTarget | null): boolean;
361
+ /**
362
+ * Gets the backdrop element that is active for the current presentation.
363
+ * @param {object} options Options for resolving the backdrop.
364
+ * @param {boolean} options.createPortal Creates the body-level mobile backdrop when needed.
365
+ * @returns {HTMLElement|null}
366
+ */
367
+ getBackdropElement({ createPortal }?: {
368
+ createPortal: boolean;
369
+ }): HTMLElement | null;
370
+ /**
371
+ * Creates the body-level backdrop used by mobile bottom sheets.
372
+ * @returns {HTMLElement} Element appended to document.body for page-level dimming.
373
+ */
374
+ ensurePortalBackdrop(): HTMLElement;
375
+ _portalBackdropElement: HTMLDivElement;
376
+ /**
377
+ * Removes the body-level mobile backdrop.
378
+ */
379
+ removePortalBackdrop(): void;
380
+ /**
381
+ * Gets the full-page z-index for the body-level mobile backdrop.
382
+ * @returns {string}
383
+ */
384
+ getPortalBackdropZIndex(): string;
385
+ /**
386
+ * Gets the target opacity for the active mobile backdrop.
387
+ * @returns {string}
388
+ */
389
+ getBackdropOpenOpacity(): string;
390
+ /**
391
+ * Syncs visual styles from the component to the body-level backdrop.
392
+ */
393
+ syncPortalBackdropStyles(): void;
394
+ /**
395
+ * Handles backdrop click dismissal.
396
+ * @param {MouseEvent} e The click event.
397
+ */
398
+ handleBackdropClick: (e: MouseEvent) => void;
341
399
  /**
342
400
  * Sync ARIA attributes on host.
343
401
  */
@@ -378,12 +436,12 @@ export default class SlidingContainer extends WJElement {
378
436
  height: number;
379
437
  };
380
438
  /**
381
- * Returns the element that bounds the mobile bottom sheet.
439
+ * Returns the element that bounds the mobile bottom sheet panel.
382
440
  * @returns {Element|null} The scope element, or null for viewport scope.
383
441
  */
384
442
  getBottomSheetScopeElement(): Element | null;
385
443
  /**
386
- * Returns the frame used by the mobile bottom sheet.
444
+ * Returns the frame used by the mobile bottom sheet panel.
387
445
  * @returns {{top: number, left: number, right: number, bottom: number, width: number, height: number}}
388
446
  */
389
447
  getBottomSheetScopeFrame(): {
@@ -488,14 +546,6 @@ export default class SlidingContainer extends WJElement {
488
546
  * @param {Event} e The scroll event.
489
547
  */
490
548
  preventBottomSheetScroll: (e: Event) => void;
491
- /**
492
- * Prevents the page behind the mobile bottom sheet from scrolling.
493
- */
494
- lockDocumentScroll(): void;
495
- /**
496
- * Restores page scrolling after the mobile bottom sheet is closed.
497
- */
498
- unlockDocumentScroll(): void;
499
549
  /**
500
550
  * Stores the initial drag state for the mobile bottom sheet.
501
551
  * @param {number|string} pointerId The pointer identifier.