wj-elements 0.1.137 → 0.1.139
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 +3 -2
- package/dist/localize.js +6 -4
- package/dist/localize.js.map +1 -1
- package/dist/packages/bundle.d.ts +0 -0
- package/dist/packages/index.d.ts +102 -0
- package/dist/packages/localize/localize.d.ts +17 -0
- package/dist/packages/translations/en-gb.d.ts +13 -0
- package/dist/packages/translations/sk-sk.d.ts +13 -0
- package/dist/packages/utils/animations.d.ts +2 -0
- package/dist/packages/utils/date.d.ts +1 -0
- package/dist/packages/utils/element-utils.d.ts +46 -0
- package/dist/packages/utils/event.d.ts +67 -0
- package/dist/packages/utils/localize.d.ts +4 -0
- package/dist/packages/utils/permissions-api.d.ts +34 -0
- package/dist/packages/utils/utils.d.ts +1 -0
- package/dist/packages/utils/wje-import-firefox.d.ts +0 -0
- package/dist/packages/utils/wje-import.d.ts +0 -0
- package/dist/packages/wje-accordion/accordion.d.ts +2 -0
- package/dist/packages/wje-accordion/accordion.element.d.ts +72 -0
- package/dist/packages/wje-accordion-item/accordion-item.d.ts +2 -0
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +40 -0
- package/dist/packages/wje-animation/animation.d.ts +2 -0
- package/dist/packages/wje-animation/animation.element.d.ts +153 -0
- package/dist/packages/wje-animation/animation.test.d.ts +1 -0
- package/dist/packages/wje-aside/aside.d.ts +2 -0
- package/dist/packages/wje-aside/aside.element.d.ts +31 -0
- package/dist/packages/wje-avatar/avatar.d.ts +2 -0
- package/dist/packages/wje-avatar/avatar.element.d.ts +37 -0
- package/dist/packages/wje-avatar/service/service.d.ts +40 -0
- package/dist/packages/wje-badge/badge.d.ts +2 -0
- package/dist/packages/wje-badge/badge.element.d.ts +35 -0
- package/dist/packages/wje-badge/badge.test.d.ts +1 -0
- package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +80 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +2 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +97 -0
- package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/wje-button/button.d.ts +2 -0
- package/dist/packages/wje-button/button.element.d.ts +173 -0
- package/dist/packages/wje-button/button.test.d.ts +1 -0
- package/dist/packages/wje-button-group/button-group.d.ts +2 -0
- package/dist/packages/wje-button-group/button-group.element.d.ts +39 -0
- package/dist/packages/wje-card/card.d.ts +2 -0
- package/dist/packages/wje-card/card.element.d.ts +29 -0
- package/dist/packages/wje-card-content/card-content.d.ts +2 -0
- package/dist/packages/wje-card-content/card-content.element.d.ts +22 -0
- package/dist/packages/wje-card-controls/card-controls.d.ts +2 -0
- package/dist/packages/wje-card-controls/card-controls.element.d.ts +23 -0
- package/dist/packages/wje-card-header/card-header.d.ts +2 -0
- package/dist/packages/wje-card-header/card-header.element.d.ts +22 -0
- package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +2 -0
- package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +30 -0
- package/dist/packages/wje-card-title/card-title.d.ts +2 -0
- package/dist/packages/wje-card-title/card-title.element.d.ts +32 -0
- package/dist/packages/wje-carousel/carousel.d.ts +2 -0
- package/dist/packages/wje-carousel/carousel.element.d.ts +146 -0
- package/dist/packages/wje-carousel-item/carousel-item.d.ts +2 -0
- package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +38 -0
- package/dist/packages/wje-checkbox/checkbox.d.ts +2 -0
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +171 -0
- package/dist/packages/wje-chip/chip.d.ts +2 -0
- package/dist/packages/wje-chip/chip.element.d.ts +29 -0
- package/dist/packages/wje-col/col.d.ts +2 -0
- package/dist/packages/wje-col/col.element.d.ts +16 -0
- package/dist/packages/wje-color-picker/color-picker.d.ts +2 -0
- package/dist/packages/wje-color-picker/color-picker.element.d.ts +187 -0
- package/dist/packages/wje-container/container.d.ts +2 -0
- package/dist/packages/wje-container/container.element.d.ts +31 -0
- package/dist/packages/wje-copy-button/copy-button.d.ts +2 -0
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +89 -0
- package/dist/packages/wje-copy-button/service/service.d.ts +12 -0
- package/dist/packages/wje-dialog/dialog.d.ts +2 -0
- package/dist/packages/wje-dialog/dialog.element.d.ts +116 -0
- package/dist/packages/wje-divider/divider.d.ts +2 -0
- package/dist/packages/wje-divider/divider.element.d.ts +32 -0
- package/dist/packages/wje-dropdown/dropdown.d.ts +2 -0
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +85 -0
- package/dist/packages/wje-element/element.d.ts +313 -0
- package/dist/packages/wje-element/service/universal-service.d.ts +18 -0
- package/dist/packages/wje-file-upload/file-upload.d.ts +2 -0
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +191 -0
- package/dist/packages/wje-file-upload/service/service.d.ts +70 -0
- package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +2 -0
- package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +66 -0
- package/dist/packages/wje-footer/footer.d.ts +2 -0
- package/dist/packages/wje-footer/footer.element.d.ts +28 -0
- package/dist/packages/wje-form/form.d.ts +2 -0
- package/dist/packages/wje-form/form.element.d.ts +28 -0
- package/dist/packages/wje-format-digital/format-digital.d.ts +2 -0
- package/dist/packages/wje-format-digital/format-digital.element.d.ts +87 -0
- package/dist/packages/wje-format-digital/format-digital.test.d.ts +1 -0
- package/dist/packages/wje-grid/grid.d.ts +2 -0
- package/dist/packages/wje-grid/grid.element.d.ts +26 -0
- package/dist/packages/wje-header/header.d.ts +2 -0
- package/dist/packages/wje-header/header.element.d.ts +35 -0
- package/dist/packages/wje-icon/icon.d.ts +2 -0
- package/dist/packages/wje-icon/icon.element.d.ts +40 -0
- package/dist/packages/wje-icon/service/service.d.ts +11 -0
- package/dist/packages/wje-icon-picker/icon-picker.d.ts +2 -0
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +197 -0
- package/dist/packages/wje-img/img.d.ts +2 -0
- package/dist/packages/wje-img/img.element.d.ts +36 -0
- package/dist/packages/wje-img-comparer/img-comparer.d.ts +2 -0
- package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +60 -0
- package/dist/packages/wje-img-comparer/service/service.d.ts +1 -0
- package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +2 -0
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +134 -0
- package/dist/packages/wje-input/input.d.ts +2 -0
- package/dist/packages/wje-input/input.element.d.ts +204 -0
- package/dist/packages/wje-input-file/input-file.d.ts +2 -0
- package/dist/packages/wje-input-file/input-file.element.d.ts +50 -0
- package/dist/packages/wje-item/item.d.ts +2 -0
- package/dist/packages/wje-item/item.element.d.ts +68 -0
- package/dist/packages/wje-kanban/kanban.d.ts +2 -0
- package/dist/packages/wje-kanban/kanban.element.d.ts +183 -0
- package/dist/packages/wje-label/label.d.ts +2 -0
- package/dist/packages/wje-label/label.element.d.ts +34 -0
- package/dist/packages/wje-list/list.d.ts +2 -0
- package/dist/packages/wje-list/list.element.d.ts +31 -0
- package/dist/packages/wje-main/main.d.ts +2 -0
- package/dist/packages/wje-main/main.element.d.ts +30 -0
- package/dist/packages/wje-masonry/masonry.d.ts +2 -0
- package/dist/packages/wje-masonry/masonry.element.d.ts +114 -0
- package/dist/packages/wje-masonry/service/service.d.ts +32 -0
- package/dist/packages/wje-menu/menu.d.ts +2 -0
- package/dist/packages/wje-menu/menu.element.d.ts +47 -0
- package/dist/packages/wje-menu-button/menu-button.d.ts +2 -0
- package/dist/packages/wje-menu-button/menu-button.element.d.ts +34 -0
- package/dist/packages/wje-menu-item/menu-item.d.ts +2 -0
- package/dist/packages/wje-menu-item/menu-item.element.d.ts +139 -0
- package/dist/packages/wje-menu-label/menu-label.d.ts +2 -0
- package/dist/packages/wje-menu-label/menu-label.element.d.ts +39 -0
- package/dist/packages/wje-option/option.d.ts +2 -0
- package/dist/packages/wje-option/option.element.d.ts +59 -0
- package/dist/packages/wje-options/options.d.ts +2 -0
- package/dist/packages/wje-options/options.element.d.ts +183 -0
- package/dist/packages/wje-orgchart/orgchart.d.ts +2 -0
- package/dist/packages/wje-orgchart/orgchart.element.d.ts +24 -0
- package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +2 -0
- package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +28 -0
- package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +2 -0
- package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +49 -0
- package/dist/packages/wje-panel/panel.d.ts +2 -0
- package/dist/packages/wje-panel/panel.element.d.ts +34 -0
- package/dist/packages/wje-popup/popup.d.ts +2 -0
- package/dist/packages/wje-popup/popup.element.d.ts +93 -0
- package/dist/packages/wje-progress-bar/progress-bar.d.ts +2 -0
- package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +96 -0
- package/dist/packages/wje-qr-code/qr-code.d.ts +2 -0
- package/dist/packages/wje-qr-code/qr-code.element.d.ts +33 -0
- package/dist/packages/wje-radio/radio.d.ts +2 -0
- package/dist/packages/wje-radio/radio.element.d.ts +53 -0
- package/dist/packages/wje-radio-group/radio-group.d.ts +2 -0
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +137 -0
- package/dist/packages/wje-rate/rate.d.ts +2 -0
- package/dist/packages/wje-rate/rate.element.d.ts +156 -0
- package/dist/packages/wje-relative-time/relative-time.d.ts +2 -0
- package/dist/packages/wje-relative-time/relative-time.element.d.ts +55 -0
- package/dist/packages/wje-relative-time/relative-time.test.d.ts +1 -0
- package/dist/packages/wje-reorder/reorder.d.ts +2 -0
- package/dist/packages/wje-reorder/reorder.element.d.ts +119 -0
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +2 -0
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +23 -0
- package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +2 -0
- package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +75 -0
- package/dist/packages/wje-reorder-item/reorder-item.d.ts +2 -0
- package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +24 -0
- package/dist/packages/wje-route/route.d.ts +2 -0
- package/dist/packages/wje-route/route.element.d.ts +22 -0
- package/dist/packages/wje-router/router.d.ts +2 -0
- package/dist/packages/wje-router/router.element.d.ts +39 -0
- package/dist/packages/wje-router-link/router-link.d.ts +2 -0
- package/dist/packages/wje-router-link/router-link.element.d.ts +31 -0
- package/dist/packages/wje-router-outlet/router-outlet.d.ts +2 -0
- package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +15 -0
- package/dist/packages/wje-row/row.d.ts +2 -0
- package/dist/packages/wje-row/row.element.d.ts +23 -0
- package/dist/packages/wje-select/select.d.ts +2 -0
- package/dist/packages/wje-select/select.element.d.ts +315 -0
- package/dist/packages/wje-slider/slider.d.ts +2 -0
- package/dist/packages/wje-slider/slider.element.d.ts +103 -0
- package/dist/packages/wje-split-view/service/service.d.ts +1 -0
- package/dist/packages/wje-split-view/split-view.d.ts +2 -0
- package/dist/packages/wje-split-view/split-view.element.d.ts +66 -0
- package/dist/packages/wje-status/status.d.ts +2 -0
- package/dist/packages/wje-status/status.element.d.ts +26 -0
- package/dist/packages/wje-step/step.d.ts +2 -0
- package/dist/packages/wje-step/step.element.d.ts +23 -0
- package/dist/packages/wje-stepper/stepper.d.ts +2 -0
- package/dist/packages/wje-stepper/stepper.element.d.ts +78 -0
- package/dist/packages/wje-store/default-store-actions.d.ts +25 -0
- package/dist/packages/wje-store/pubsub.d.ts +21 -0
- package/dist/packages/wje-store/store.d.ts +153 -0
- package/dist/packages/wje-tab/tab.d.ts +2 -0
- package/dist/packages/wje-tab/tab.element.d.ts +41 -0
- package/dist/packages/wje-tab-group/tab-group.d.ts +2 -0
- package/dist/packages/wje-tab-group/tab-group.element.d.ts +67 -0
- package/dist/packages/wje-tab-panel/tab-panel.d.ts +2 -0
- package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +23 -0
- package/dist/packages/wje-textarea/textarea.d.ts +2 -0
- package/dist/packages/wje-textarea/textarea.element.d.ts +176 -0
- package/dist/packages/wje-thumbnail/thumbnail.d.ts +2 -0
- package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +31 -0
- package/dist/packages/wje-timeline/timeline.d.ts +2 -0
- package/dist/packages/wje-timeline/timeline.element.d.ts +25 -0
- package/dist/packages/wje-timeline-item/timeline-item.d.ts +2 -0
- package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +27 -0
- package/dist/packages/wje-toast/toast.d.ts +2 -0
- package/dist/packages/wje-toast/toast.element.d.ts +173 -0
- package/dist/packages/wje-toast/toast.test.d.ts +1 -0
- package/dist/packages/wje-toggle/toggle.d.ts +2 -0
- package/dist/packages/wje-toggle/toggle.element.d.ts +65 -0
- package/dist/packages/wje-toolbar/toolbar.d.ts +2 -0
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +39 -0
- package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +2 -0
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +35 -0
- package/dist/packages/wje-tooltip/tooltip.d.ts +2 -0
- package/dist/packages/wje-tooltip/tooltip.element.d.ts +71 -0
- package/dist/packages/wje-tree/tree.d.ts +2 -0
- package/dist/packages/wje-tree/tree.element.d.ts +104 -0
- package/dist/packages/wje-tree-item/tree-item.d.ts +2 -0
- package/dist/packages/wje-tree-item/tree-item.element.d.ts +155 -0
- package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +2 -0
- package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +29 -0
- package/dist/wje-animation.js +2 -4
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-file-upload-item.js +6 -4
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-master.js +218 -58
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-textarea.js +4 -1
- package/dist/wje-textarea.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `wje-tree-item` is a custom web component used as a child of the `wje-tree`.
|
|
3
|
+
* It represents a node within a tree structure, capable of nesting other items.
|
|
4
|
+
* @summary Represents a single item in a tree structure.
|
|
5
|
+
* @documentation https://elements.webjet.sk/components/tree-item
|
|
6
|
+
* @status stable
|
|
7
|
+
* @augments {HTMLElement}
|
|
8
|
+
* @slot - Default slot for rendering the tree item's content (e.g., text or custom elements).
|
|
9
|
+
* @csspart native - The native container of the tree item.
|
|
10
|
+
* @cssproperty [--wje-tree-item-indent=var(--wje-spacing-large)] - Defines the indentation for nested tree items.
|
|
11
|
+
* @cssproperty [--wje-tree-item-indent-guid-width=0px] - Specifies the width of the guide element shown next to a tree item.
|
|
12
|
+
* @cssproperty [--wje-tree-item-border-radius=var(--wje-border-radius-medium)] - Sets the border radius of the tree item’s container.
|
|
13
|
+
* @tag wje-tree-item
|
|
14
|
+
*/
|
|
15
|
+
export default class TreeItem extends HTMLElement {
|
|
16
|
+
/**
|
|
17
|
+
* Returns the CSS stylesheet for the component.
|
|
18
|
+
* @static
|
|
19
|
+
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
20
|
+
*/
|
|
21
|
+
static get cssStyleSheet(): CSSStyleSheet;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the list of attributes to observe for changes.
|
|
24
|
+
* @static
|
|
25
|
+
* @returns {Array<string>}
|
|
26
|
+
*/
|
|
27
|
+
static get observedAttributes(): Array<string>;
|
|
28
|
+
_selection: string;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the expanded state of the element. When set to a truthy value,
|
|
31
|
+
* the 'expanded' attribute will be added to the element. When set to a falsy
|
|
32
|
+
* value, the 'expanded' attribute will be removed.
|
|
33
|
+
* @param {boolean} value A boolean value indicating whether the
|
|
34
|
+
* element should be expanded (true) or collapsed (false).
|
|
35
|
+
*/
|
|
36
|
+
set expanded(value: boolean);
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves the value of the 'expanded' state for the current element.
|
|
39
|
+
* This getter checks whether the 'expanded' attribute is present on the element.
|
|
40
|
+
* If the attribute exists, it returns true, representing that the element is expanded.
|
|
41
|
+
* Otherwise, it returns false, indicating that the element is not expanded.
|
|
42
|
+
* @returns {boolean} True if the 'expanded' attribute is present, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
get expanded(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the 'selected' attribute of the element. Removes the attribute if the provided value is falsy; otherwise, sets it.
|
|
47
|
+
* @param {boolean} value The value indicating whether the element should have the 'selected' attribute.
|
|
48
|
+
*/
|
|
49
|
+
set selected(value: boolean);
|
|
50
|
+
/**
|
|
51
|
+
* Getter method for determining if the 'selected' attribute is present on the element.
|
|
52
|
+
* @returns {boolean} Returns true if the 'selected' attribute is present, otherwise false.
|
|
53
|
+
*/
|
|
54
|
+
get selected(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the selection mode for the component.
|
|
57
|
+
* @param {string} value The selection mode to apply. Defaults to 'single'
|
|
58
|
+
* if no value is provided. Possible options may be
|
|
59
|
+
* specific to the implementation of the component
|
|
60
|
+
* (e.g., 'single', 'multiple').
|
|
61
|
+
*/
|
|
62
|
+
set selection(value: string);
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the current selection.
|
|
65
|
+
* @returns {*} The value of the current selection.
|
|
66
|
+
*/
|
|
67
|
+
get selection(): any;
|
|
68
|
+
/**
|
|
69
|
+
* Sets or removes the 'indeterminate' attribute based on the provided value.
|
|
70
|
+
* This can be used to visually indicate an indeterminate state for elements like checkboxes.
|
|
71
|
+
* @param {boolean} value A boolean indicating whether to set the element to an indeterminate state.
|
|
72
|
+
* If true, the 'indeterminate' attribute is added to the element; if false, the attribute is removed.
|
|
73
|
+
*/
|
|
74
|
+
set indeterminate(value: boolean);
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves the state of the indeterminate attribute.
|
|
77
|
+
* @returns {boolean} True if the indeterminate attribute is present, otherwise false.
|
|
78
|
+
*/
|
|
79
|
+
get indeterminate(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Setup attributes for the Button element.
|
|
82
|
+
*/
|
|
83
|
+
setupAttributes(): void;
|
|
84
|
+
isShadowRoot: string;
|
|
85
|
+
/**
|
|
86
|
+
* Handles updates when observed attributes of the element are changed.
|
|
87
|
+
* Updates the checkbox state based on changes to the "selected" or "indeterminate" attributes.
|
|
88
|
+
* @param {string} name The name of the attribute that was changed.
|
|
89
|
+
* @param {string|null} oldValue The previous value of the attribute before the change.
|
|
90
|
+
* @param {string|null} newValue The new value of the attribute after the change.
|
|
91
|
+
* @returns {void}
|
|
92
|
+
*/
|
|
93
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
94
|
+
/**
|
|
95
|
+
* Custom logic executed before the draw process begins.
|
|
96
|
+
* Determines and sets the appropriate slot if the current item is nested.
|
|
97
|
+
* @returns {void} No return value.
|
|
98
|
+
*/
|
|
99
|
+
beforeDraw(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Creates and returns a document fragment representing the structure of a tree item component.
|
|
102
|
+
* The method constructs the DOM elements including the native container, indentation, toggle button,
|
|
103
|
+
* selection checkbox, label, and children container, along with their respective slots and attributes.
|
|
104
|
+
* It dynamically handles the creation of expand and collapse icons, as well as appending slots for
|
|
105
|
+
* child components.
|
|
106
|
+
* @returns {DocumentFragment} A fragment containing the complete tree item structure to be rendered.
|
|
107
|
+
*/
|
|
108
|
+
draw(): DocumentFragment;
|
|
109
|
+
checkbox: HTMLElement;
|
|
110
|
+
native: HTMLDivElement;
|
|
111
|
+
button: HTMLDivElement;
|
|
112
|
+
childrenElement: HTMLDivElement;
|
|
113
|
+
childrenSlot: HTMLSlotElement;
|
|
114
|
+
/**
|
|
115
|
+
* Executes operations to be performed after the draw action is completed.
|
|
116
|
+
* If the state indicates it is expanded, toggles its children.
|
|
117
|
+
* Additionally, sets up an event listener on the button element to handle toggling children upon click.
|
|
118
|
+
* @returns {void} Does not return a value.
|
|
119
|
+
*/
|
|
120
|
+
afterDraw(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Determines if the current item is a nested item within a tree structure.
|
|
123
|
+
* Checks if the item's parent element exists and is also a tree item.
|
|
124
|
+
* @returns {boolean} Returns true if the current item is a nested tree item; otherwise, false.
|
|
125
|
+
*/
|
|
126
|
+
isNestedItem(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Checks whether the given node is a tree item.
|
|
129
|
+
* @param {object} node The node to check.
|
|
130
|
+
* @returns {boolean} Returns true if the node is an Element and has a class name of 'TreeItem', otherwise false.
|
|
131
|
+
*/
|
|
132
|
+
isTreeItem(node: object): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Toggles the visibility state of the children element and updates the class of the parent element.
|
|
135
|
+
* The method toggles the 'open' class on the children elements and the 'expanded' class on the parent element,
|
|
136
|
+
* effectively showing or hiding the children and indicating the expanded state.
|
|
137
|
+
* @returns {void} Does not return a value.
|
|
138
|
+
*/
|
|
139
|
+
toggleChildren(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Retrieves the child items from the `childrenSlot` that match specific criteria.
|
|
142
|
+
* @param {object} [options] Configuration options.
|
|
143
|
+
* @param {boolean} [options.includeDisabled] Determines whether disabled items should be included in the result. Defaults to true.
|
|
144
|
+
* @returns {Array} An array of child items that are valid tree items and meet the criteria specified in the options.
|
|
145
|
+
*/
|
|
146
|
+
getChildrenItems(options?: {
|
|
147
|
+
includeDisabled?: boolean;
|
|
148
|
+
}): any[];
|
|
149
|
+
/**
|
|
150
|
+
* Retrieves all descendant children of the current object in a flattened array structure.
|
|
151
|
+
* @param {object} [options] An optional object specifying filters or configurations for retrieving children.
|
|
152
|
+
* @returns {Array} An array containing all children and their descendants in a flat structure.
|
|
153
|
+
*/
|
|
154
|
+
getAllChildrenFlat(options?: object): any[];
|
|
155
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as WJElement } from '../wje-element/element.js';
|
|
2
|
+
/**
|
|
3
|
+
* `VisuallyHidden` is a custom web component that represents a visually hidden element.
|
|
4
|
+
* @summary This element represents a visually hidden element.
|
|
5
|
+
* @documentation https://elements.webjet.sk/components/visually-hidden
|
|
6
|
+
* @status stable
|
|
7
|
+
* @augments {WJElement}
|
|
8
|
+
* @slot - The default slot for the visually hidden element.
|
|
9
|
+
* @tag wje-visually-hidden
|
|
10
|
+
*/
|
|
11
|
+
export default class VisuallyHidden extends WJElement {
|
|
12
|
+
/**
|
|
13
|
+
* Returns the CSS stylesheet for the component.
|
|
14
|
+
* @static
|
|
15
|
+
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
16
|
+
*/
|
|
17
|
+
static get cssStyleSheet(): CSSStyleSheet;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the list of observed attributes.
|
|
20
|
+
* @static
|
|
21
|
+
* @returns {Array} An empty array
|
|
22
|
+
*/
|
|
23
|
+
static get observedAttributes(): any[];
|
|
24
|
+
/**
|
|
25
|
+
* Draws the component for the visually hidden element.
|
|
26
|
+
* @returns {object} Document fragment
|
|
27
|
+
*/
|
|
28
|
+
draw(): object;
|
|
29
|
+
}
|
package/dist/wje-animation.js
CHANGED
|
@@ -4270,9 +4270,8 @@ class Animation extends WJElement {
|
|
|
4270
4270
|
this.destroyAnimation();
|
|
4271
4271
|
const element = this.slotEl.assignedElements()[0];
|
|
4272
4272
|
this.animations = await this.getAnimationsArray();
|
|
4273
|
-
const selected =
|
|
4274
|
-
|
|
4275
|
-
this.animation = element == null ? void 0 : element.animate(selected == null ? void 0 : selected.keyframes, {
|
|
4273
|
+
const selected = this.animations.find((k) => k.name === this.name);
|
|
4274
|
+
this.animation = element == null ? void 0 : element.animate(selected.keyframes, {
|
|
4276
4275
|
delay: +this.delay,
|
|
4277
4276
|
endDelay: +this.endDelay,
|
|
4278
4277
|
fill: this.fill,
|
|
@@ -4316,7 +4315,6 @@ class Animation extends WJElement {
|
|
|
4316
4315
|
} else {
|
|
4317
4316
|
console.warn("Animation is not initialized or cancel is not available");
|
|
4318
4317
|
}
|
|
4319
|
-
console.log("ANIMATION CANCELLED", this.animation.playState);
|
|
4320
4318
|
}
|
|
4321
4319
|
}
|
|
4322
4320
|
Animation.define("wje-animation", Animation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-animation.js","sources":["../packages/wje-animation/animation.element.js","../packages/wje-animation/animation.js"],"sourcesContent":["import animations from 'animate.css?inline';\n\nimport styles from '../styles/styles.css?inline';\nimport { fetchAndParseCSS } from '../utils/animations.js';\nimport { default as WJElement } from '../wje-element/element.js';\n\n/**\n * @summary This class represents an Animation element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/animation\n * @status stable\n * @augments WJElement\n * @slot - The animation main content.\n * @cssproperty --size - The size of the avatar.\n * @tag wje-animation\n */\nexport default class Animation extends WJElement {\n /**\n * Constructor for the Animation class.\n */\n constructor() {\n super();\n this._animations = [];\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set name(value) {\n this.setAttribute('name', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get name() {\n return this.getAttribute('name') || 'heartBeat';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration') || 1000;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set delay(value) {\n this.setAttribute('delay', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get delay() {\n return +this.getAttribute('delay') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set endDelay(value) {\n this.setAttribute('endDelay', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get endDelay() {\n return +this.getAttribute('endDelay') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set fill(value) {\n this.setAttribute('fill', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get fill() {\n return this.getAttribute('fill') || 'auto';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set iterations(value) {\n this.setAttribute('iterations', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string|number}\n */\n get iterations() {\n return this.getAttribute('iterations') || Infinity;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set iterationStart(value) {\n this.setAttribute('iterationStart', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get iterationStart() {\n return +this.getAttribute('iterationStart') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set direction(value) {\n this.setAttribute('direction', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get direction() {\n return this.getAttribute('direction') || 'normal';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set easing(value) {\n this.setAttribute('easing', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get easing() {\n return this.getAttribute('easing') || 'linear';\n }\n\n /**\n * Setter for the animations property.\n * @param {Array} value The new value for the animations property.\n */\n set animations(value) {\n this._animations = value;\n }\n\n /**\n * Getter for the animations' property.\n * @returns {Array} The current value of the animations' property.\n */\n get animations() {\n return this._animations;\n }\n\n /**\n * The class name for the Animation element.\n * @type {string}\n */\n className = 'Animation';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {object} The styles for the Animation element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observed attributes.\n * @returns {Array} An array containing the name of the observed attribute.\n */\n static get observedAttributes() {\n return ['name'];\n }\n\n /**\n * Method to setup attributes for the Animation element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Method to draw the Animation element.\n * @returns {object} The document fragment containing the drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n this.slotEl = slot;\n\n return fragment;\n }\n\n /**\n * Method to perform actions after the Animation element is drawn.\n * This method destroys any existing animation, fetches a new animations array,\n * selects the appropriate animation, and applies it to the element.\n */\n async afterDraw() {\n this.destroyAnimation();\n\n const element = this.slotEl.assignedElements()[0];\n this.animations = await this.getAnimationsArray();\n const selected = await this.animations.find((k) => k.name === this.name);\n console.log(\"SELECTED:\", selected, element);\n this.animation = element?.animate(selected?.keyframes, {\n delay: +this.delay,\n endDelay: +this.endDelay,\n fill: this.fill,\n duration: +this.duration,\n iterationStart: +this.iterationStart,\n iterations: this.iterations,\n direction: this.direction,\n easing: this.easing,\n });\n if (this.animation) this.animation.play();\n }\n\n /**\n * Method to fetch and parse the animations array from a CSS file.\n * @returns {Array} An array of animation definitions parsed from the CSS file.\n */\n async getAnimationsArray() {\n return await fetchAndParseCSS(animations);\n }\n\n /**\n * Method to destroy the current animation.\n */\n destroyAnimation() {\n if (this.animation) {\n this.cancel();\n }\n }\n\n /**\n * Method to play the current animation.\n */\n play() {\n if (this.animation) {\n this.animation.play();\n }\n }\n\n /**\n * Method to cancel the current animation.\n */\n cancel() {\n if (this.animation && typeof this.animation.cancel === 'function') {\n this.animation.cancel();\n } else {\n console.warn('Animation is not initialized or cancel is not available');\n }\n\n console.log(\"ANIMATION CANCELLED\", this.animation.playState);\n }\n}\n","import Animation from './animation.element.js';\n\nexport default Animation;\n\nAnimation.define('wje-animation', Animation);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK;AAAA,MAChB,MAAM,KAAK;AAAA,MACX,UAAU,CAAC,KAAK;AAAA,MAChB,gBAAgB,CAAC,KAAK;AAAA,MACtB,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA,MAChB,QAAQ,KAAK;AAAA,IACzB;AACQ,QAAI,KAAK,UAAW,MAAK,UAAU,KAAM;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,MAAM,qBAAqB;AACvB,WAAO,MAAM,iBAAiB,UAAU;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA,EAKI,mBAAmB;AACf,QAAI,KAAK,WAAW;AAChB,WAAK,OAAQ;AAAA,IACzB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAKI,OAAO;AACH,QAAI,KAAK,WAAW;AAChB,WAAK,UAAU,KAAM;AAAA,IACjC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAKI,SAAS;AACL,QAAI,KAAK,aAAa,OAAO,KAAK,UAAU,WAAW,YAAY;AAC/D,WAAK,UAAU,OAAQ;AAAA,IACnC,OAAe;AACH,cAAQ,KAAK,yDAAyD;AAAA,IAClF;AAEQ,YAAQ,IAAI,uBAAuB,KAAK,UAAU,SAAS;AAAA,EACnE;AACA;AChSA,UAAU,OAAO,iBAAiB,SAAS;"}
|
|
1
|
+
{"version":3,"file":"wje-animation.js","sources":["../packages/wje-animation/animation.element.js","../packages/wje-animation/animation.js"],"sourcesContent":["import animations from 'animate.css?inline';\n\nimport styles from '../styles/styles.css?inline';\nimport { fetchAndParseCSS } from '../utils/animations.js';\nimport { default as WJElement } from '../wje-element/element.js';\n\n/**\n * @summary This class represents an Animation element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/animation\n * @status stable\n * @augments WJElement\n * @slot - The animation main content.\n * @cssproperty --size - The size of the avatar.\n * @tag wje-animation\n */\nexport default class Animation extends WJElement {\n /**\n * Constructor for the Animation class.\n */\n constructor() {\n super();\n this._animations = [];\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set name(value) {\n this.setAttribute('name', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get name() {\n return this.getAttribute('name') || 'heartBeat';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration') || 1000;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set delay(value) {\n this.setAttribute('delay', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get delay() {\n return +this.getAttribute('delay') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set endDelay(value) {\n this.setAttribute('endDelay', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get endDelay() {\n return +this.getAttribute('endDelay') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set fill(value) {\n this.setAttribute('fill', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get fill() {\n return this.getAttribute('fill') || 'auto';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set iterations(value) {\n this.setAttribute('iterations', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string|number}\n */\n get iterations() {\n return this.getAttribute('iterations') || Infinity;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set iterationStart(value) {\n this.setAttribute('iterationStart', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {number}\n */\n get iterationStart() {\n return +this.getAttribute('iterationStart') || 0;\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set direction(value) {\n this.setAttribute('direction', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get direction() {\n return this.getAttribute('direction') || 'normal';\n }\n\n /**\n * Setter for the name attribute.\n * @param value\n */\n set easing(value) {\n this.setAttribute('easing', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string}\n */\n get easing() {\n return this.getAttribute('easing') || 'linear';\n }\n\n /**\n * Setter for the animations property.\n * @param {Array} value The new value for the animations property.\n */\n set animations(value) {\n this._animations = value;\n }\n\n /**\n * Getter for the animations' property.\n * @returns {Array} The current value of the animations' property.\n */\n get animations() {\n return this._animations;\n }\n\n /**\n * The class name for the Animation element.\n * @type {string}\n */\n className = 'Animation';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {object} The styles for the Animation element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observed attributes.\n * @returns {Array} An array containing the name of the observed attribute.\n */\n static get observedAttributes() {\n return ['name'];\n }\n\n /**\n * Method to setup attributes for the Animation element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Method to draw the Animation element.\n * @returns {object} The document fragment containing the drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n this.slotEl = slot;\n\n return fragment;\n }\n\n /**\n * Method to perform actions after the Animation element is drawn.\n * This method destroys any existing animation, fetches a new animations array,\n * selects the appropriate animation, and applies it to the element.\n */\n async afterDraw() {\n this.destroyAnimation();\n\n const element = this.slotEl.assignedElements()[0];\n this.animations = await this.getAnimationsArray();\n const selected = this.animations.find((k) => k.name === this.name);\n\n this.animation = element?.animate(selected.keyframes, {\n delay: +this.delay,\n endDelay: +this.endDelay,\n fill: this.fill,\n duration: +this.duration,\n iterationStart: +this.iterationStart,\n iterations: this.iterations,\n direction: this.direction,\n easing: this.easing,\n });\n if (this.animation) this.animation.play();\n }\n\n /**\n * Method to fetch and parse the animations array from a CSS file.\n * @returns {Array} An array of animation definitions parsed from the CSS file.\n */\n async getAnimationsArray() {\n return await fetchAndParseCSS(animations);\n }\n\n /**\n * Method to destroy the current animation.\n */\n destroyAnimation() {\n if (this.animation) {\n this.cancel();\n }\n }\n\n /**\n * Method to play the current animation.\n */\n play() {\n if (this.animation) {\n this.animation.play();\n }\n }\n\n /**\n * Method to cancel the current animation.\n */\n cancel() {\n if (this.animation && typeof this.animation.cancel === 'function') {\n this.animation.cancel();\n } else {\n console.warn('Animation is not initialized or cancel is not available');\n }\n }\n}\n","import Animation from './animation.element.js';\n\nexport default Animation;\n\nAnimation.define('wje-animation', Animation);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAClF;AAAA,EACA;AACA;AC9RA,UAAU,OAAO,iBAAiB,SAAS;"}
|
|
@@ -57,10 +57,12 @@ class FileUploadItem extends WJElement {
|
|
|
57
57
|
return ["uploaded"];
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* @param {string}
|
|
63
|
-
* @param {string}
|
|
60
|
+
* Handles updates to the attributes of a custom element whenever one of the observed attributes is changed.
|
|
61
|
+
* Updates the related elements based on the changed attribute and its new value.
|
|
62
|
+
* @param {string} name The name of the attribute being changed.
|
|
63
|
+
* @param {string | null} oldValue The previous value of the attribute before the change, or null if the attribute was not previously set.
|
|
64
|
+
* @param {string | null} newValue The new value of the attribute after the change, or null if the attribute is being removed.
|
|
65
|
+
* @returns {void} Does not return a value.
|
|
64
66
|
*/
|
|
65
67
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
66
68
|
if (name === "uploaded" && oldValue !== newValue && this.uploadedEl) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-file-upload-item.js","sources":["../packages/wje-file-upload-item/file-upload-item.element.js","../packages/wje-file-upload-item/file-upload-item.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\nimport Button from '../wje-button/button.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport FormatDigital from '../wje-format-digital/format-digital.js';\nimport Icon from '../wje-icon/icon.js';\nimport Slider from '../wje-slider/slider.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This element allows users to upload files.\n * `FileUploadItem` is a custom web component that represents a file upload item.\n * It extends from `WJElement` and uses the `Localizer` utility for localization.\n * @documentation https://elements.webjet.sk/components/file-upload\n * @status stable\n * @augments WJElement\n * @csspart button - The delete button part\n * @csspart image - The image part\n * @csspart name - The name part\n * @csspart size - The size part\n * @slot img - Slot for the image\n * @slot action - Slot for the action buttons\n * @cssproperty --primary-color - The primary color of the file upload item.\n * //@fires wje-button:click - Dispatches when the delete button is clicked\n * @tag wje-file-upload\n */\nexport default class FileUploadItem extends WJElement {\n /**\n * Creates an instance of FileUploadItem.\n * @class\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n }\n\n set size(value) {\n this.setAttribute('size', value);\n }\n\n get size() {\n return this.getAttribute('size');\n }\n\n /**\n * Dependencies for the component.\n * @type {object}\n */\n dependencies = {\n 'wje-format-digital': FormatDigital,\n 'wje-button': Button,\n 'wje-slider': Slider,\n 'wje-icon': Icon,\n };\n\n className = 'FileUploadItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['uploaded'];\n }\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"wje-file-upload-item.js","sources":["../packages/wje-file-upload-item/file-upload-item.element.js","../packages/wje-file-upload-item/file-upload-item.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\nimport Button from '../wje-button/button.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport FormatDigital from '../wje-format-digital/format-digital.js';\nimport Icon from '../wje-icon/icon.js';\nimport Slider from '../wje-slider/slider.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This element allows users to upload files.\n * `FileUploadItem` is a custom web component that represents a file upload item.\n * It extends from `WJElement` and uses the `Localizer` utility for localization.\n * @documentation https://elements.webjet.sk/components/file-upload\n * @status stable\n * @augments WJElement\n * @csspart button - The delete button part\n * @csspart image - The image part\n * @csspart name - The name part\n * @csspart size - The size part\n * @slot img - Slot for the image\n * @slot action - Slot for the action buttons\n * @cssproperty --primary-color - The primary color of the file upload item.\n * //@fires wje-button:click - Dispatches when the delete button is clicked\n * @tag wje-file-upload\n */\nexport default class FileUploadItem extends WJElement {\n /**\n * Creates an instance of FileUploadItem.\n * @class\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n }\n\n set size(value) {\n this.setAttribute('size', value);\n }\n\n get size() {\n return this.getAttribute('size');\n }\n\n /**\n * Dependencies for the component.\n * @type {object}\n */\n dependencies = {\n 'wje-format-digital': FormatDigital,\n 'wje-button': Button,\n 'wje-slider': Slider,\n 'wje-icon': Icon,\n };\n\n className = 'FileUploadItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['uploaded'];\n }\n\n /**\n * Handles updates to the attributes of a custom element whenever one of the observed attributes is changed.\n * Updates the related elements based on the changed attribute and its new value.\n * @param {string} name The name of the attribute being changed.\n * @param {string | null} oldValue The previous value of the attribute before the change, or null if the attribute was not previously set.\n * @param {string | null} newValue The new value of the attribute after the change, or null if the attribute is being removed.\n * @returns {void} Does not return a value.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'uploaded' && oldValue !== newValue && this.uploadedEl) {\n this.uploadedEl.setAttribute('value', newValue);\n\n let progress = ((+newValue / +this.size) * 100) || 0;\n\n this.sliderEl.setAttribute(\"progress\", Math.round(progress, 0));\n }\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Method to draw the component on the screen.\n * @returns {DocumentFragment} The fragment containing the component.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.classList.add('native-file-upload-item');\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'img');\n\n let image = document.createElement('div');\n image.setAttribute('part', 'image');\n image.classList.add('image');\n\n let name = document.createElement('span');\n name.classList.add('name');\n name.innerText = this.name;\n\n let actions = document.createElement('slot');\n actions.classList.add('actions');\n actions.setAttribute('name', 'action');\n\n let button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n button.setAttribute('size', 'small');\n button.innerHTML = `<wje-icon name=\"x\" size=\"small\"></wje-icon>`;\n\n let sizeWrapper = document.createElement('span');\n sizeWrapper.classList.add('size');\n\n let uploaded = document.createElement('wje-format-digital');\n uploaded.setAttribute('value', this.uploaded || 0);\n uploaded.innerHTML = `<span slot=\"start\">${this.localizer.translate('wj.file.upload.uploaded')}</span>`;\n\n let size = document.createElement('wje-format-digital');\n size.setAttribute('value', this.size || 0);\n size.innerHTML = `<span slot=\"start\"> ${this.localizer.translate('wj.file.upload.from')} </span>`;\n\n let slider = document.createElement('wje-progress-bar');\n slider.classList.add('file-progress');\n slider.setAttribute('id', 'id-' + this.lastModified);\n slider.setAttribute('progress', this.progress);\n slider.setAttribute('color', 'success');\n\n image.appendChild(slot);\n actions.appendChild(button);\n\n sizeWrapper.appendChild(uploaded);\n sizeWrapper.appendChild(size);\n\n native.appendChild(image);\n native.appendChild(name);\n native.appendChild(sizeWrapper);\n native.appendChild(actions);\n native.appendChild(slider);\n\n fragment.appendChild(native);\n\n this.button = button;\n this.uploadedEl = uploaded;\n this.sliderEl = slider;\n\n return fragment;\n }\n\n /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.button.addEventListener('wje-button:click', this.onDelete);\n }\n\n /**\n * Handles the delete action.\n */\n onDelete = () => {\n this.remove();\n };\n}\n","import FileUploadItem from './file-upload-item.element.js';\n\nexport default FileUploadItem;\n\nFileUploadItem.define('wje-file-upload-item', FileUploadItem);\n"],"names":[],"mappings":";;;;;;;;;;AAyBe,MAAM,uBAAuB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlD,cAAc;AACV,UAAO;AAgBX;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACX,sBAAsB;AAAA,MACtB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,IACf;AAED,qCAAY;AA2HZ;AAAA;AAAA;AAAA,oCAAW,MAAM;AACb,WAAK,OAAQ;AAAA,IAChB;AAnJG,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EAC3C;AAAA,EAEI,IAAI,KAAK,OAA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