@nuraly/lumenui 0.3.5 → 0.3.7
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/nuralyui.bundle.js +2577 -1486
- package/dist/nuralyui.bundle.js.gz +0 -0
- package/dist/src/components/button/bundle.js +130 -39
- package/dist/src/components/button/bundle.js.gz +0 -0
- package/dist/src/components/button/button.component.js +7 -4
- package/dist/src/components/button/button.style.js +92 -2
- package/dist/src/components/canvas/base-canvas.component.d.ts +8 -0
- package/dist/src/components/canvas/base-canvas.component.js +75 -3
- package/dist/src/components/canvas/bundle.js +2540 -1201
- package/dist/src/components/canvas/bundle.js.gz +0 -0
- package/dist/src/components/canvas/controllers/collaboration.controller.d.ts +24 -11
- package/dist/src/components/canvas/controllers/collaboration.controller.js +176 -120
- package/dist/src/components/canvas/controllers/selection.controller.js +20 -0
- package/dist/src/components/canvas/interfaces/collaboration.interface.d.ts +8 -0
- package/dist/src/components/canvas/templates/index.d.ts +1 -0
- package/dist/src/components/canvas/templates/index.js +2 -0
- package/dist/src/components/canvas/templates/lock-overlay.template.d.ts +20 -0
- package/dist/src/components/canvas/templates/lock-overlay.template.js +33 -0
- package/dist/src/components/canvas/workflow-canvas.component.js +52 -24
- package/dist/src/components/canvas/workflow-canvas.style.js +62 -1
- package/dist/src/components/canvas/workflow-canvas.types.js +50 -4
- package/dist/src/components/chat-panel/bundle.js +10 -10
- package/dist/src/components/chat-panel/bundle.js.gz +0 -0
- package/dist/src/components/chat-panel/chat-panel.component.js +8 -8
- package/dist/src/components/chatbot/bundle.js +400 -242
- package/dist/src/components/chatbot/bundle.js.gz +0 -0
- package/dist/src/components/chatbot/chatbot.style.js +156 -22
- package/dist/src/components/chatbot/chatbot.types.d.ts +1 -0
- package/dist/src/components/chatbot/core/chatbot-core.controller.js +13 -7
- package/dist/src/components/chatbot/plugins/artifact-plugin.js +0 -19
- package/dist/src/components/chatbot/plugins/flight-card-plugin.js +0 -35
- package/dist/src/components/chatbot/plugins/markdown-plugin.js +0 -4
- package/dist/src/components/chatbot/plugins/print-job-card-plugin.js +0 -36
- package/dist/src/components/chatbot/plugins/selection-card-plugin.js +0 -34
- package/dist/src/components/chatbot/providers/workflow-socket-provider.js +1 -2
- package/dist/src/components/chatbot/templates/input-box.template.js +58 -30
- package/dist/src/components/chatbot/templates/message.template.js +41 -31
- package/dist/src/components/chatbot/templates/thread-sidebar.template.js +38 -39
- package/dist/src/components/colorpicker/bundle.js +15 -10
- package/dist/src/components/colorpicker/bundle.js.gz +0 -0
- package/dist/src/components/colorpicker/color-picker.component.js +15 -10
- package/dist/src/components/datepicker/bundle.js +10 -10
- package/dist/src/components/datepicker/bundle.js.gz +0 -0
- package/dist/src/components/datepicker/datepicker.component.js +14 -22
- package/dist/src/components/dropdown/bundle.js +15 -14
- package/dist/src/components/dropdown/bundle.js.gz +0 -0
- package/dist/src/components/dropdown/dropdown.component.js +10 -9
- package/dist/src/components/dropdown/dropdown.style.js +2 -2
- package/dist/src/components/file-upload/bundle.js +15 -14
- package/dist/src/components/file-upload/bundle.js.gz +0 -0
- package/dist/src/components/file-upload/file-upload.component.js +15 -14
- package/dist/src/components/icon/bundle.js +7 -7
- package/dist/src/components/icon/bundle.js.gz +0 -0
- package/dist/src/components/icon/icon-paths.js +15 -0
- package/dist/src/components/iconpicker/bundle.js +216 -124
- package/dist/src/components/iconpicker/bundle.js.gz +0 -0
- package/dist/src/components/iconpicker/icon-picker.component.js +4 -4
- package/dist/src/components/menu/bundle.js +5 -2
- package/dist/src/components/menu/bundle.js.gz +0 -0
- package/dist/src/components/menu/menu.component.js +5 -2
- package/dist/src/components/modal/bundle.js +16 -13
- package/dist/src/components/modal/bundle.js.gz +0 -0
- package/dist/src/components/modal/modal.component.js +16 -13
- package/dist/src/components/panel/bundle.js +28 -28
- package/dist/src/components/panel/bundle.js.gz +0 -0
- package/dist/src/components/popconfirm/bundle.js +135 -41
- package/dist/src/components/popconfirm/bundle.js.gz +0 -0
- package/dist/src/components/popconfirm/popconfirm.component.d.ts +15 -119
- package/dist/src/components/popconfirm/popconfirm.component.js +158 -162
- package/dist/src/components/popconfirm/popconfirm.style.js +94 -0
- package/dist/src/components/presence/bundle.js +2 -1
- package/dist/src/components/presence/bundle.js.gz +0 -0
- package/dist/src/components/presence/presence.component.js +2 -1
- package/dist/src/components/table/bundle.js +3 -2
- package/dist/src/components/table/bundle.js.gz +0 -0
- package/dist/src/components/table/table.component.js +3 -2
- package/dist/src/components/tabs/bundle.js +3 -3
- package/dist/src/components/tabs/bundle.js.gz +0 -0
- package/dist/src/components/timepicker/bundle.js +3 -3
- package/dist/src/components/timepicker/bundle.js.gz +0 -0
- package/package.json +1 -1
- package/packages/common/dist/VERSIONS.md +1 -1
- package/packages/common/dist/shared/controllers/dropdown.controller.d.ts +4 -0
- package/packages/common/dist/shared/controllers/dropdown.controller.d.ts.map +1 -1
- package/packages/common/dist/shared/controllers/dropdown.controller.js +29 -3
- package/packages/common/dist/shared/controllers/dropdown.controller.js.map +1 -1
|
Binary file
|
|
@@ -214,10 +214,10 @@ let NrIconPickerElement = class NrIconPickerElement extends NuralyUIBaseMixin(Li
|
|
|
214
214
|
// Limit visible icons for performance
|
|
215
215
|
const visibleIcons = this.filteredIcons.slice(0, this.maxVisible);
|
|
216
216
|
return html `
|
|
217
|
-
<div class="dropdown-content">
|
|
217
|
+
<div class="dropdown-content" part="panel">
|
|
218
218
|
${this.showSearch
|
|
219
219
|
? html `
|
|
220
|
-
<div class="search-container">
|
|
220
|
+
<div class="search-container" part="search">
|
|
221
221
|
<nr-input
|
|
222
222
|
size="small"
|
|
223
223
|
.placeholder=${DEFAULT_SEARCH_PLACEHOLDER}
|
|
@@ -230,7 +230,7 @@ let NrIconPickerElement = class NrIconPickerElement extends NuralyUIBaseMixin(Li
|
|
|
230
230
|
</div>
|
|
231
231
|
`
|
|
232
232
|
: nothing}
|
|
233
|
-
<div class="icons-grid-container">
|
|
233
|
+
<div class="icons-grid-container" part="grid">
|
|
234
234
|
<lit-virtualizer
|
|
235
235
|
.items=${visibleIcons}
|
|
236
236
|
.layout=${grid({ itemSize: '40px' })}
|
|
@@ -268,7 +268,7 @@ let NrIconPickerElement = class NrIconPickerElement extends NuralyUIBaseMixin(Li
|
|
|
268
268
|
'--dropdown-max-height': 'var(--icon-picker-dropdown-max-height)'
|
|
269
269
|
})}
|
|
270
270
|
>
|
|
271
|
-
<div slot="trigger" class="trigger-container">
|
|
271
|
+
<div slot="trigger" class="trigger-container" part="trigger">
|
|
272
272
|
${this.renderTrigger()}
|
|
273
273
|
</div>
|
|
274
274
|
<div slot="content">
|
|
@@ -405,6 +405,7 @@ const p=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
|
|
|
405
405
|
*/var x=function(e,t,i,n){for(var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n,a=e.length-1;a>=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};let k=class extends((e=>c(l(h(p(e)))))(n)){constructor(){super(),this.requiredComponents=["nr-icon","nr-dropdown"],this.items=[],this.size="medium",this.arrowPosition="right",this._contextMenuState=null,this._editingPath=null,this._editingValue="",this._pendingClickTimeout=null,this._pendingClickPath=null,this._linkIndex=0,this.stateController=new f(this),this.keyboardController=new w(this,this.stateController),this.accessibilityController=new y(this,this.stateController)}firstUpdated(){this._initializeSelectedState(),this.accessibilityController.updateAriaAttributes()}updated(e){e.has("items")&&(this._initializeSelectedState(),this._initializeOpenedState()),this.accessibilityController.updateAriaAttributes()}_initializeOpenedState(){this._openSubMenusFromItems(this.items,[])}_openSubMenusFromItems(e,t){for(let i=0;i<e.length;i++){const n=e[i],s=[...t,i];n.children&&(n.opened&&this.stateController.openSubMenu(s),this._openSubMenusFromItems(n.children,s))}}_initializeSelectedState(){this._linkIndex=0,this._findSelectedPath(this.items)}_findSelectedPath(e,t=[]){for(let i=0;i<e.length;i++){const n=e[i],s=[...t,i];if(n.children){if(this._findSelectedPath(n.children,s))return!0}else if(n.selected)return this.stateController.setSelectedPath(s),!0}return!1}_handleLinkClick(e,t,i,n){var s;if(null===(s=null==n?void 0:n.target)||void 0===s?void 0:s.classList.contains("action-icon"))return;if("click"===(null==n?void 0:n.type)){if(n.detail>0)return}const o=e.join("-");if(i&&"mousedown"===(null==n?void 0:n.type))return this._pendingClickTimeout&&clearTimeout(this._pendingClickTimeout),this._pendingClickPath=o,void(this._pendingClickTimeout=setTimeout(()=>{this._pendingClickPath===o&&(this._executeClick(e,t),this._pendingClickPath=null)},200));this._executeClick(e,t)}_executeClick(e,t){this.stateController.setSelectedPath(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:e,value:t}})),this.requestUpdate()}_handleSubMenuClick(e,t,i,n){const s=n,o=n.target;if("toggle-icon"===o.id||o.closest("#toggle-icon"))return;if("click"===n.type)return 0===s.detail?(this.stateController.toggleSubMenu(e),void this.requestUpdate()):void 0;const r=e.join("-");if(i)return this._pendingClickTimeout&&clearTimeout(this._pendingClickTimeout),this._pendingClickPath=r,void(this._pendingClickTimeout=setTimeout(()=>{this._pendingClickPath===r&&(this._executeSubMenuClick(e,t),this._pendingClickPath=null)},200));this._executeSubMenuClick(e,t)}_executeSubMenuClick(e,t){this.stateController.setSelectedPath([]),this.stateController.clearHighlights(),this.stateController.setHighlighted(e,!0),this.stateController.toggleSubMenu(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:e,value:t}})),this.requestUpdate()}_toggleSubMenu(e,t){t.stopPropagation(),this.stateController.toggleSubMenu(e),this.requestUpdate()}_handleSubMenuMouseEnter(e){this.stateController.setHovered(e,!0),this.requestUpdate()}_handleSubMenuMouseLeave(e){this.stateController.setHovered(e,!1),this.requestUpdate()}_handleActionClick(e,t){const i=t.detail.item,n=t.detail.originalEvent,s=t.detail.dropdown;this.dispatchEvent(new CustomEvent("action-click",{detail:{value:i.value,path:e,item:i,originalEvent:n,close:()=>{s&&("function"==typeof s.hide?s.hide():"function"==typeof s.close&&s.close())}},composed:!0,bubbles:!0}))}_handleContextMenu(e,t,i){var n,s;(null===(s=null===(n=t.menu)||void 0===n?void 0:n.actions)||void 0===s?void 0:s.length)&&(i.preventDefault(),i.stopPropagation(),this._contextMenuState={path:e,x:i.clientX,y:i.clientY,actions:t.menu.actions},this.requestUpdate(),this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("#context-menu-dropdown");t&&"function"==typeof t.show&&t.show()}))}_handleContextMenuAction(e,t){const i=t.detail.item,n=t.detail.originalEvent,s=t.detail.dropdown,o=()=>{this._contextMenuState=null,s&&("function"==typeof s.hide?s.hide():"function"==typeof s.close&&s.close()),this.requestUpdate()};this.dispatchEvent(new CustomEvent("action-click",{detail:{value:i.value,path:e,item:i,originalEvent:n,close:o},composed:!0,bubbles:!0})),o()}_handleContextMenuClose(){this._contextMenuState=null,this.requestUpdate()}_handleDoubleClick(e,t,i){if(t.disabled)return;i.preventDefault(),i.stopPropagation(),this._pendingClickTimeout&&(clearTimeout(this._pendingClickTimeout),this._pendingClickTimeout=null,this._pendingClickPath=null);const n=e.join("-");this._editingPath=n,this._editingValue=t.text,this.requestUpdate(),this.updateComplete.then(()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`input[data-edit-path="${n}"]`);t&&(t.focus(),t.select())})}_handleEditInput(e){e.stopPropagation();const t=e.target;this._editingValue=t.value}_handleEditKeyDown(e,t,i){if(i.stopPropagation(),console.log("Edit keydown:",i.key,"editingValue:",this._editingValue),"Enter"===i.key){i.preventDefault();const n=i.target;this._editingValue=n.value,console.log("Saving with value:",this._editingValue),this._saveEdit(e,t)}else"Escape"===i.key&&(i.preventDefault(),this._cancelEdit())}_handleEditBlur(e,t,i){var n;const s=i.relatedTarget;s&&(null===(n=this.shadowRoot)||void 0===n?void 0:n.contains(s))||setTimeout(()=>{this._editingPath===e.join("-")&&this._saveEdit(e,t)},200)}_saveEdit(e,t){const i=this._editingValue.trim();if(console.log("_saveEdit called:",{newValue:i,originalText:t,willEmit:i&&i!==t}),i&&i!==t){const n={path:e,oldValue:t,newValue:i};this.onLabelEdit&&(console.log("Calling onLabelEdit callback"),this.onLabelEdit(n)),console.log("Dispatching label-edit event from:",this.tagName);const s=new CustomEvent("label-edit",{bubbles:!0,composed:!0,detail:n});this.dispatchEvent(s)}this._editingPath=null,this._editingValue="",this.requestUpdate()}_cancelEdit(){this._editingPath=null,this._editingValue="",this.requestUpdate()}_isEditing(e){return this._editingPath===e.join("-")}_isPathSelected(e){return this.stateController.isPathSelected(e)}_convertActionsToDropdownItems(e){return e.map(e=>({id:e.value,label:e.label,value:e.value,icon:e.icon,additionalData:e.additionalData}))}_renderMenuLink(e,n){var s,o,r;const a=n.join("-"),l=this._isPathSelected(n),d=this._isEditing(n),c=this._linkIndex++;return t`
|
|
406
406
|
<li
|
|
407
407
|
class="menu-link ${l?"selected":""} ${e.disabled?"disabled":""} ${d?"editing":""}"
|
|
408
|
+
part="link"
|
|
408
409
|
data-path=${a}
|
|
409
410
|
data-index=${c}
|
|
410
411
|
tabindex=${d?-1:0}
|
|
@@ -452,6 +453,7 @@ const p=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
|
|
|
452
453
|
`}_renderSubMenu(e,n){var s,o,r;const a=n.join("-"),l=this.stateController.isSubMenuOpen(n)||e.opened,d=this.stateController.isSubMenuHovered(n),c=this.stateController.isSubMenuHighlighted(n),h=e.selected,u=this._isEditing(n),m=e.iconPosition||this.arrowPosition,p="left"===m||"left"===m;return t`
|
|
453
454
|
<ul
|
|
454
455
|
class="sub-menu ${c?"highlighted":""} ${e.disabled?"disabled":""} ${h?"selected":""} ${p?"arrow-left":"arrow-right"} ${u?"editing":""}"
|
|
456
|
+
part="submenu"
|
|
455
457
|
data-path=${a}
|
|
456
458
|
tabindex=${u?-1:0}
|
|
457
459
|
@mouseenter=${()=>this._handleSubMenuMouseEnter(n)}
|
|
@@ -459,6 +461,7 @@ const p=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
|
|
|
459
461
|
@click=${e.disabled||u?i:e=>{const t=e;e.target.classList.contains("sub-menu")&&0===t.detail&&(e.stopPropagation(),this.stateController.toggleSubMenu(n),this.requestUpdate())}}>
|
|
460
462
|
<div
|
|
461
463
|
class="sub-menu-header"
|
|
464
|
+
part="submenu-header"
|
|
462
465
|
@mousedown=${e.disabled||u?i:t=>this._handleSubMenuClick(n,e.text,!!e.editable,t)}
|
|
463
466
|
@click=${e.disabled||u?i:t=>this._handleSubMenuClick(n,e.text,!!e.editable,t)}
|
|
464
467
|
@dblclick=${!e.disabled&&e.editable?t=>this._handleDoubleClick(n,e,t):i}
|
|
@@ -506,7 +509,7 @@ const p=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
|
|
|
506
509
|
`:i}
|
|
507
510
|
</div>
|
|
508
511
|
</div>
|
|
509
|
-
<div class="sub-menu-children" style="display: ${l?"block":"none"}">
|
|
512
|
+
<div class="sub-menu-children" part="submenu-content" style="display: ${l?"block":"none"}">
|
|
510
513
|
${e.children?this._renderMenuItems(e.children,n):i}
|
|
511
514
|
</div>
|
|
512
515
|
</ul>
|
|
@@ -523,7 +526,7 @@ const p=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
|
|
|
523
526
|
<span slot="trigger" style="display: block; width: 1px; height: 1px;"></span>
|
|
524
527
|
</nr-dropdown>
|
|
525
528
|
`}render(){return this._linkIndex=0,t`
|
|
526
|
-
<ul class="menu-root menu--${this.size}">
|
|
529
|
+
<ul class="menu-root menu--${this.size}" part="root">
|
|
527
530
|
${this._renderMenuItems(this.items)}
|
|
528
531
|
</ul>
|
|
529
532
|
${this._renderContextMenu()}
|
|
Binary file
|
|
@@ -396,6 +396,7 @@ let NrMenuElement = class NrMenuElement extends NuralyUIBaseMixin(LitElement) {
|
|
|
396
396
|
return html `
|
|
397
397
|
<li
|
|
398
398
|
class="menu-link ${isSelected ? 'selected' : ''} ${menu.disabled ? 'disabled' : ''} ${isEditing ? 'editing' : ''}"
|
|
399
|
+
part="link"
|
|
399
400
|
data-path=${pathKey}
|
|
400
401
|
data-index=${linkIndex}
|
|
401
402
|
tabindex=${isEditing ? -1 : 0}
|
|
@@ -458,6 +459,7 @@ let NrMenuElement = class NrMenuElement extends NuralyUIBaseMixin(LitElement) {
|
|
|
458
459
|
return html `
|
|
459
460
|
<ul
|
|
460
461
|
class="sub-menu ${isHighlighted ? 'highlighted' : ''} ${menu.disabled ? 'disabled' : ''} ${isSelected ? 'selected' : ''} ${isLeftPosition ? 'arrow-left' : 'arrow-right'} ${isEditing ? 'editing' : ''}"
|
|
462
|
+
part="submenu"
|
|
461
463
|
data-path=${pathKey}
|
|
462
464
|
tabindex=${isEditing ? -1 : 0}
|
|
463
465
|
@mouseenter=${() => this._handleSubMenuMouseEnter(path)}
|
|
@@ -475,6 +477,7 @@ let NrMenuElement = class NrMenuElement extends NuralyUIBaseMixin(LitElement) {
|
|
|
475
477
|
} : nothing}>
|
|
476
478
|
<div
|
|
477
479
|
class="sub-menu-header"
|
|
480
|
+
part="submenu-header"
|
|
478
481
|
@mousedown=${!menu.disabled && !isEditing ? (e) => this._handleSubMenuClick(path, menu.text, !!menu.editable, e) : nothing}
|
|
479
482
|
@click=${!menu.disabled && !isEditing ? (e) => this._handleSubMenuClick(path, menu.text, !!menu.editable, e) : nothing}
|
|
480
483
|
@dblclick=${!menu.disabled && menu.editable ? (e) => this._handleDoubleClick(path, menu, e) : nothing}
|
|
@@ -522,7 +525,7 @@ let NrMenuElement = class NrMenuElement extends NuralyUIBaseMixin(LitElement) {
|
|
|
522
525
|
` : nothing}
|
|
523
526
|
</div>
|
|
524
527
|
</div>
|
|
525
|
-
<div class="sub-menu-children" style="display: ${isOpen ? 'block' : 'none'}">
|
|
528
|
+
<div class="sub-menu-children" part="submenu-content" style="display: ${isOpen ? 'block' : 'none'}">
|
|
526
529
|
${menu.children ? this._renderMenuItems(menu.children, path) : nothing}
|
|
527
530
|
</div>
|
|
528
531
|
</ul>
|
|
@@ -560,7 +563,7 @@ let NrMenuElement = class NrMenuElement extends NuralyUIBaseMixin(LitElement) {
|
|
|
560
563
|
render() {
|
|
561
564
|
this._linkIndex = 0;
|
|
562
565
|
return html `
|
|
563
|
-
<ul class="menu-root menu--${this.size}">
|
|
566
|
+
<ul class="menu-root menu--${this.size}" part="root">
|
|
564
567
|
${this._renderMenuItems(this.items)}
|
|
565
568
|
</ul>
|
|
566
569
|
${this._renderContextMenu()}
|
|
@@ -392,25 +392,26 @@ const D=t=>{class e extends t{constructor(){super(...arguments),this.t=null}crea
|
|
|
392
392
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
393
393
|
* SPDX-License-Identifier: MIT
|
|
394
394
|
*/var B=function(t,e,o,i){for(var s,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,r=t.length-1;r>=0;r--)(s=t[r])&&(n=(a<3?s(n):a>3?s(e,o,n):s(e,o))||n);return a>3&&n&&Object.defineProperty(e,o,n),n};let I=class extends((t=>E(C(M(D(t)))))(i)){constructor(){super(...arguments),this.open=!1,this.size=l.Medium,this.position=h.Center,this.animation=c.Fade,this.backdrop=m.Closable,this.closable=!0,this.modalDraggable=!1,this.resizable=!1,this.fullscreen=!1,this.modalTitle=p,this.showCloseButton=!0,this.headerIcon=p,this.zIndex=1e3,this.width=p,this.height=p,this.isDragging=!1,this.offsetX=0,this.offsetY=0,this.animationState="closed",this.previousActiveElement=null,this.requiredComponents=["nr-icon","nr-button"],this.dragController=new A(this),this.keyboardController=new T(this),this.closeModal=()=>{if(!this.closable)return;const t=new CustomEvent("modal-before-close",{bubbles:!0,cancelable:!0,detail:{modal:this,cancel:()=>t.preventDefault()}});this.dispatchEvent(t)&&(this.open=!1,this.dispatchEvent(new CustomEvent("modal-close",{bubbles:!0,composed:!0,detail:{modal:this}})))},this.handleBackdropClick=t=>{this.backdrop===m.Closable&&t.target===t.currentTarget&&j.handleBackdropClick(this)&&this.closeModal()}}connectedCallback(){super.connectedCallback(),this.validateDependencies()}disconnectedCallback(){super.disconnectedCallback(),this.previousActiveElement instanceof HTMLElement&&this.previousActiveElement.focus()}willUpdate(t){super.willUpdate(t),t.has("open")&&(this.open?this.handleOpen():this.handleClose())}handleOpen(){const t=j.openModal(this);this.zIndex=t,this.animationState="opening",this.dispatchEvent(new CustomEvent("modal-open",{bubbles:!0,detail:{modal:this,stackDepth:j.getStackDepth()}})),this.updateComplete.then(()=>{this.startOpenAnimation()})}startOpenAnimation(){var t,e;const o=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".modal"),i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".modal-backdrop");if(!o||!i)return;const{modalKeyframes:s}=this.getAnimationKeyframes(),a=o.animate(s,{duration:300,easing:"ease",fill:"forwards"});a.addEventListener("finish",()=>{this.animationState="open",a.commitStyles(),a.cancel(),o.style.transform="",j.isTopModal(this)&&this.keyboardController.focusFirstElement(),this.dispatchEvent(new CustomEvent("modal-after-open",{bubbles:!0,detail:{modal:this,stackDepth:j.getStackDepth()}}))})}getAnimationKeyframes(){let t;switch(this.animation){case"fade":default:t=[{opacity:0,transform:"scale(0.9)"},{opacity:1,transform:"scale(1)"}];break;case"zoom":t=[{opacity:0,transform:"scale(0.7)"},{opacity:1,transform:"scale(1)"}];break;case"slide-up":t=[{opacity:0,transform:"translateY(20px)"},{opacity:1,transform:"translateY(0)"}];break;case"slide-down":t=[{opacity:0,transform:"translateY(-20px)"},{opacity:1,transform:"translateY(0)"}]}return{modalKeyframes:t,backdropKeyframes:[{opacity:0},{opacity:1}]}}handleClose(){this.animationState="closing",j.closeModal(this),this.dragController.resetPosition(),setTimeout(()=>{this.animationState="closed"},300)}openModal(){this.open=!0}getBackdropClasses(){return{"modal-backdrop":!0,"modal-backdrop--hidden":!this.open,[`modal-backdrop--position-${this.position}`]:!0}}getModalClasses(){return{modal:!0,[`modal--size-${this.size}`]:!this.fullscreen,"modal--fullscreen":this.fullscreen,[`modal--animation-${this.animation}`]:"opening"===this.animationState||"open"===this.animationState,"modal--dragging":this.isDragging,"modal--resizable":this.resizable}}getModalStyles(){const t={};return this.zIndex&&(t["--nuraly-z-modal-backdrop"]=this.zIndex.toString()),this.width&&(t.width=this.width),this.height&&(t.height=this.height),t}renderHeader(){const t=this.querySelector('[slot="header"]'),i=this.modalTitle||this.headerIcon;return t||i||this.showCloseButton?o`
|
|
395
|
-
<div class="modal-header ${this.modalDraggable?"modal-header--draggable":""}">
|
|
395
|
+
<div class="modal-header ${this.modalDraggable?"modal-header--draggable":""}" part="header">
|
|
396
396
|
${t?o`
|
|
397
|
-
<div class="modal-header-content">
|
|
397
|
+
<div class="modal-header-content" part="header-content">
|
|
398
398
|
<slot name="header"></slot>
|
|
399
399
|
</div>
|
|
400
400
|
`:i?o`
|
|
401
|
-
<div class="modal-header-content">
|
|
401
|
+
<div class="modal-header-content" part="header-content">
|
|
402
402
|
${this.headerIcon?o`
|
|
403
|
-
<nr-icon class="modal-header-icon" name="${this.headerIcon}"></nr-icon>
|
|
403
|
+
<nr-icon class="modal-header-icon" part="header-icon" name="${this.headerIcon}"></nr-icon>
|
|
404
404
|
`:e}
|
|
405
405
|
${this.modalTitle?o`
|
|
406
|
-
<h2 class="modal-title">${this.modalTitle}</h2>
|
|
406
|
+
<h2 class="modal-title" part="title">${this.modalTitle}</h2>
|
|
407
407
|
`:e}
|
|
408
408
|
</div>
|
|
409
409
|
`:e}
|
|
410
|
-
|
|
410
|
+
|
|
411
411
|
${this.showCloseButton?o`
|
|
412
412
|
<button
|
|
413
413
|
class="modal-close-button"
|
|
414
|
+
part="close-button"
|
|
414
415
|
@click=${t=>{t.stopPropagation(),this.open=!1,this.dispatchEvent(new CustomEvent("modal-close",{bubbles:!0,composed:!0,detail:{modal:this}}))}}
|
|
415
416
|
aria-label="Close modal"
|
|
416
417
|
type="button">
|
|
@@ -419,25 +420,27 @@ const D=t=>{class e extends t{constructor(){super(...arguments),this.t=null}crea
|
|
|
419
420
|
`:e}
|
|
420
421
|
</div>
|
|
421
422
|
`:e}renderFooter(){return this.querySelector('[slot="footer"]')?o`
|
|
422
|
-
<div class="modal-footer">
|
|
423
|
+
<div class="modal-footer" part="footer">
|
|
423
424
|
<slot name="footer"></slot>
|
|
424
425
|
</div>
|
|
425
426
|
`:e}updated(){this.updateDataTheme()}updateDataTheme(){this.closest("[data-theme]")||this.setAttribute("data-theme",this.currentTheme)}render(){return this.open||"closed"!==this.animationState?o`
|
|
426
|
-
<div
|
|
427
|
+
<div
|
|
427
428
|
class=${r(this.getBackdropClasses())}
|
|
429
|
+
part="backdrop"
|
|
428
430
|
@click=${this.handleBackdropClick}
|
|
429
431
|
style=${d(this.getModalStyles())}>
|
|
430
|
-
|
|
431
|
-
<div
|
|
432
|
+
|
|
433
|
+
<div
|
|
432
434
|
class=${r(this.getModalClasses())}
|
|
435
|
+
part="panel"
|
|
433
436
|
role="dialog"
|
|
434
437
|
aria-modal="true"
|
|
435
438
|
aria-labelledby=${this.modalTitle?"modal-title":e}
|
|
436
439
|
tabindex="-1">
|
|
437
|
-
|
|
440
|
+
|
|
438
441
|
${this.renderHeader()}
|
|
439
|
-
|
|
440
|
-
<div class="modal-body">
|
|
442
|
+
|
|
443
|
+
<div class="modal-body" part="body">
|
|
441
444
|
<slot></slot>
|
|
442
445
|
</div>
|
|
443
446
|
|
|
Binary file
|
|
@@ -308,25 +308,26 @@ let NrModalElement = class NrModalElement extends NuralyUIBaseMixin(LitElement)
|
|
|
308
308
|
return nothing;
|
|
309
309
|
}
|
|
310
310
|
return html `
|
|
311
|
-
<div class="modal-header ${this.modalDraggable ? 'modal-header--draggable' : ''}">
|
|
311
|
+
<div class="modal-header ${this.modalDraggable ? 'modal-header--draggable' : ''}" part="header">
|
|
312
312
|
${hasCustomHeader ? html `
|
|
313
|
-
<div class="modal-header-content">
|
|
313
|
+
<div class="modal-header-content" part="header-content">
|
|
314
314
|
<slot name="header"></slot>
|
|
315
315
|
</div>
|
|
316
316
|
` : hasTitle ? html `
|
|
317
|
-
<div class="modal-header-content">
|
|
317
|
+
<div class="modal-header-content" part="header-content">
|
|
318
318
|
${this.headerIcon ? html `
|
|
319
|
-
<nr-icon class="modal-header-icon" name="${this.headerIcon}"></nr-icon>
|
|
319
|
+
<nr-icon class="modal-header-icon" part="header-icon" name="${this.headerIcon}"></nr-icon>
|
|
320
320
|
` : nothing}
|
|
321
321
|
${this.modalTitle ? html `
|
|
322
|
-
<h2 class="modal-title">${this.modalTitle}</h2>
|
|
322
|
+
<h2 class="modal-title" part="title">${this.modalTitle}</h2>
|
|
323
323
|
` : nothing}
|
|
324
324
|
</div>
|
|
325
325
|
` : nothing}
|
|
326
|
-
|
|
326
|
+
|
|
327
327
|
${this.showCloseButton ? html `
|
|
328
328
|
<button
|
|
329
329
|
class="modal-close-button"
|
|
330
|
+
part="close-button"
|
|
330
331
|
@click=${(e) => {
|
|
331
332
|
e.stopPropagation();
|
|
332
333
|
this.open = false;
|
|
@@ -350,7 +351,7 @@ let NrModalElement = class NrModalElement extends NuralyUIBaseMixin(LitElement)
|
|
|
350
351
|
return nothing;
|
|
351
352
|
}
|
|
352
353
|
return html `
|
|
353
|
-
<div class="modal-footer">
|
|
354
|
+
<div class="modal-footer" part="footer">
|
|
354
355
|
<slot name="footer"></slot>
|
|
355
356
|
</div>
|
|
356
357
|
`;
|
|
@@ -368,21 +369,23 @@ let NrModalElement = class NrModalElement extends NuralyUIBaseMixin(LitElement)
|
|
|
368
369
|
return nothing;
|
|
369
370
|
}
|
|
370
371
|
return html `
|
|
371
|
-
<div
|
|
372
|
+
<div
|
|
372
373
|
class=${classMap(this.getBackdropClasses())}
|
|
374
|
+
part="backdrop"
|
|
373
375
|
@click=${this.handleBackdropClick}
|
|
374
376
|
style=${styleMap(this.getModalStyles())}>
|
|
375
|
-
|
|
376
|
-
<div
|
|
377
|
+
|
|
378
|
+
<div
|
|
377
379
|
class=${classMap(this.getModalClasses())}
|
|
380
|
+
part="panel"
|
|
378
381
|
role="dialog"
|
|
379
382
|
aria-modal="true"
|
|
380
383
|
aria-labelledby=${this.modalTitle ? 'modal-title' : nothing}
|
|
381
384
|
tabindex="-1">
|
|
382
|
-
|
|
385
|
+
|
|
383
386
|
${this.renderHeader()}
|
|
384
|
-
|
|
385
|
-
<div class="modal-body">
|
|
387
|
+
|
|
388
|
+
<div class="modal-body" part="body">
|
|
386
389
|
<slot></slot>
|
|
387
390
|
</div>
|
|
388
391
|
|