@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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{noChange as t,html as
|
|
1
|
+
import{noChange as t,html as e,LitElement as i,css as s,nothing as r}from"lit";import{property as o,customElement as n,state as a}from"lit/decorators.js";import{styleMap as h}from"lit/directives/style-map.js";import{classMap as l}from"lit/directives/class-map.js";import{property as c}from"lit/decorators/property.js";import{directive as d,PartType as p}from"lit/directive.js";import{AsyncDirective as u}from"lit/async-directive.js";import{repeat as g}from"lit/directives/repeat.js";import{unsafeHTML as m}from"lit/directives/unsafe-html.js";import{unsafeSVG as f}from"lit/directives/unsafe-svg.js";import{ifDefined as b}from"lit/directives/if-defined.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/const v=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i
|
|
6
|
+
*/const v=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},w=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},y=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(w())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!w())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const s=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,s):console.error(s.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter(t=>!this.isComponentAvailable(t))}areDependenciesAvailable(){return this.requiredComponents.every(t=>this.isComponentAvailable(t))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},x=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const s=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const s=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}},k=new Set,_=new Map;
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -14,34 +14,34 @@ import{noChange as t,html as i,LitElement as e,css as s,nothing as r}from"lit";i
|
|
|
14
14
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
15
15
|
* SPDX-License-Identifier: MIT
|
|
16
16
|
*/
|
|
17
|
-
const M=t=>{class
|
|
17
|
+
const M=t=>{class e extends t{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const t=this.constructor.useShadowDom;if(!t&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!t){const t=this.constructor,e=this.tagName.toLowerCase(),i=t.styles;if(i){const t=$(i);t&&function(t,e,i){var s;if(!_.has(t)){const i=new CSSStyleSheet;i.replaceSync(e),_.set(t,i)}const r=_.get(t),o=`doc:${t}`;if(k.has(o)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],k.add(o)),i){let e=i;for(;e;){const i=e.getRootNode();if(!(i instanceof ShadowRoot))break;{const o=`shadow:${((null===(s=i.host)||void 0===s?void 0:s.tagName)||"").toLowerCase()}:${t}`;k.has(o)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,r],k.add(o)),e=i.host}}}}(e,t,this)}}}get lightChildren(){return this.t?this.t.filter(t=>!(t instanceof Element&&t.hasAttribute("slot"))):[]}lightChildrenNamed(t){return this.t?this.t.filter(e=>e instanceof Element&&e.getAttribute("slot")===t):[]}}return e.useShadowDom=!1,e},z=t=>y(v(x(M(t))));function $(t){return Array.isArray(t)?t.map(t=>$(t)).filter(Boolean).join("\n"):t&&"string"==typeof t.cssText?t.cssText:"string"==typeof t?t:""}function S(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2021 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
22
|
*/
|
|
23
|
-
class V extends Event{constructor(t){super(V.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}V.eventName="rangeChanged";class A extends Event{constructor(t){super(A.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}A.eventName="visibilityChanged";class
|
|
23
|
+
class V extends Event{constructor(t){super(V.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}V.eventName="rangeChanged";class A extends Event{constructor(t){super(A.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}A.eventName="visibilityChanged";class q extends Event{constructor(){super(q.eventName,{bubbles:!1})}}q.eventName="unpinned";
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2021 Google LLC
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
28
|
*/
|
|
29
|
-
class
|
|
29
|
+
class E{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class C extends E{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.i=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const i=this._node;this._originalScrollTo=i.scrollTo,this._originalScrollBy=i.scrollBy,this._originalScroll=i.scroll,this._attach(t)}get _destination(){return this.i}get scrolling(){return null!==this._destination}scrollTo(t,e){const i="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;this._scrollTo(i)}scrollBy(t,e){const i="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;void 0!==i.top&&(i.top+=this.scrollTop),void 0!==i.left&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,i=null){null!==this._end&&this._end(),"smooth"===t.behavior?(this._setDestination(t),this._retarget=e,this._end=i):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:i}=t;return e=void 0===e?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),i=void 0===i?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),(null===this._destination||i!==this._destination.left||e!==this._destination.top)&&(this.i={top:e,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.i=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,i){return this._scrollTo(t,e,i),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(null!==this._destination){const{scrollTop:t,scrollLeft:e}=this;let{top:i,left:s}=this._destination;i=Math.min(i||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);const r=Math.abs(i-t),o=Math.abs(s-e);r<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),0===this._clients.size&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),1===this._clients.size&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2021 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/let I="undefined"!=typeof window?window.ResizeObserver:void 0;const T=Symbol("virtualizerRef"),L="virtualizer-sizer";let O;class R{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const
|
|
34
|
+
*/let I="undefined"!=typeof window?window.ResizeObserver:void 0;const T=Symbol("virtualizerRef"),L="virtualizer-sizer";let O;class R{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new I(()=>this._hostElementSizeChanged()),this._childrenRO=new I(this._childrenSizeChanged.bind(this))}_initHostElement(t){const e=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),e[T]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(t,e=!1){let i=!1;return function(t,e=!1){const i=[];let s=e?t:j(t);for(;null!==s;)i.push(s),s=j(s);return i}(t,e).filter(t=>{if(i)return!1;const e=getComputedStyle(t);return i="fixed"===e.position,"visible"!==e.overflow})}
|
|
35
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2021 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/(this._hostElement,t),this._scrollerController=new C(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let i=t.querySelector(`[${L}]`);i||(i=document.createElement("div"),i.setAttribute(L,""),t.appendChild(i)),Object.assign(i.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),i.textContent=" ",i.setAttribute(L,""),this._sizer=i}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const i=t.type||O;if("function"==typeof i&&this._layout instanceof i){const i={...t};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(t){let i,e;if("function"==typeof t.type){e=t.type;const s={...t};delete s.type,i=s}else i=t;void 0===e&&(O=e=(await Promise.resolve().then(function(){return ui})).FlowLayout),this._layout=new e(t=>this._handleLayoutMessage(t),i),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),i=t-this._benchmarkStart,e=performance.getEntriesByName("uv-virtualizing","measure").filter(i=>i.startTime>=this._benchmarkStart&&i.startTime<t).reduce((t,i)=>t+i.duration,0);return this._benchmarkStart=null,{timeElapsed:i,virtualizationTime:e}}return null}_measureChildren(){const t={},i=this._children,e=this._measureChildOverride||this._measureChild;for(let s=0;s<i.length;s++){const r=i[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(r))&&(t[o]=e.call(this,r,this._items[o]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:i,height:e}=t.getBoundingClientRect();return Object.assign({width:i,height:e},function(t){const i=window.getComputedStyle(t);return{marginTop:H(i.marginTop),marginRight:H(i.marginRight),marginBottom:H(i.marginBottom),marginLeft:H(i.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:i,_itemsChanged:e}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(i||e)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new E)}get _children(){const t=[];let i=this._hostElement.firstElementChild;for(;i;)i.hasAttribute(L)||t.push(i),i=i.nextElementSibling;return t}_updateView(){const t=this._hostElement,i=this._scrollerController?.element,e=this._layout;if(t&&i&&e){let s,r,o,n;const a=t.getBoundingClientRect();s=0,r=0,o=window.innerHeight,n=window.innerWidth;const h=this._clippingAncestors.map(t=>t.getBoundingClientRect());h.unshift(a);for(const t of h)s=Math.max(s,t.top),r=Math.max(r,t.left),o=Math.min(o,t.bottom),n=Math.min(n,t.right);const l=i.getBoundingClientRect(),c={left:a.left-l.left,top:a.top-l.top},d={width:i.scrollWidth,height:i.scrollHeight},p=s-a.top+t.scrollTop,u=r-a.left+t.scrollLeft,m=Math.max(0,o-s),g=Math.max(0,n-r);e.viewportSize={width:g,height:m},e.viewportScroll={top:p,left:u},e.totalScrollSize=d,e.offsetWithinScroller=c}}_sizeHostElement(t){const i=82e5,e=t&&null!==t.width?Math.min(i,t.width):0,s=t&&null!==t.height?Math.min(i,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${e}px, ${s}px)`;else{const t=this._hostElement.style;t.minWidth=e?`${e}px`:"100%",t.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:i,width:e,height:s,xOffset:r,yOffset:o},n)=>{const a=this._children[n-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${i}px, ${t}px)`,void 0!==e&&(a.style.width=e+"px"),void 0!==s&&(a.style.height=s+"px"),a.style.left=void 0===r?null:r+"px",a.style.top=void 0===o?null:o+"px")})}async _adjustRange(t){const{_first:i,_last:e,_firstVisible:s,_lastVisible:r}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==i||this._last!==e,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==r}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:i}=this._scrollerController,{top:e,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-e,left:i-s})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(i={})=>this._scrollElementIntoView({...i,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const i=this._layout.getScrollIntoViewCoordinates(t),{behavior:e}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(i,{behavior:e}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:i}=this._scrollIntoViewTarget||{};i&&t?.has(i)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new V({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new A({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,i)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=i})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const i of t)this._toBeMeasured.set(i.target,i.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function H(t){const i=t?parseFloat(t):NaN;return Number.isNaN(i)?0:i}function j(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const i=t.parentNode;return i&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&i.host||null}const N=t=>t,D=(t,e)=>i`${e}: ${JSON.stringify(t,null,2)}`;const P=d(class extends u{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,i)=>D(t,i+this._first),this._keyFunction=(t,i)=>N(t,this._first),this._items=[],t.type!==p.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const i=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)i.push(this._items[t]);return m(i,this._keyFunction,this._renderItem)}update(i,[e]){this._setFunctions(e);const s=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(i,e):this._initialize(i,e),s?t:this.render()}async _updateVirtualizerConfig(t,i){if(!await this._virtualizer.updateLayoutConfig(i.layout||{})){const e=t.parentNode;this._makeVirtualizer(e,i)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:i,keyFunction:e}=t;i&&(this._renderItem=(t,e)=>i(t,e+this._first)),e&&(this._keyFunction=(t,i)=>e(t,i+this._first))}_makeVirtualizer(t,i){this._virtualizer&&this._virtualizer.disconnected();const{layout:e,scroller:s,items:r}=i;this._virtualizer=new R({hostElement:t,layout:e,scroller:s}),this._virtualizer.items=r,this._virtualizer.connected()}_initialize(t,i){const e=t.parentNode;e&&1===e.nodeType&&(e.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(e,i))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});
|
|
39
|
+
*/(this._hostElement,t),this._scrollerController=new C(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${L}]`);e||(e=document.createElement("div"),e.setAttribute(L,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent=" ",e.setAttribute(L,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||O;if("function"==typeof e&&this._layout instanceof e){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let e,i;if("function"==typeof t.type){i=t.type;const s={...t};delete s.type,e=s}else e=t;void 0===i&&(O=i=(await Promise.resolve().then(function(){return ue})).FlowLayout),this._layout=new i(t=>this._handleLayoutMessage(t),e),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),e=t-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter(e=>e.startTime>=this._benchmarkStart&&e.startTime<t).reduce((t,e)=>t+e.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:i}}return null}_measureChildren(){const t={},e=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const r=e[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(r))&&(t[o]=i.call(this,r,this._items[o]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:i}=t.getBoundingClientRect();return Object.assign({width:e,height:i},function(t){const e=window.getComputedStyle(t);return{marginTop:H(e.marginTop),marginRight:H(e.marginRight),marginBottom:H(e.marginBottom),marginLeft:H(e.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new q)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(L)||t.push(e),e=e.nextElementSibling;return t}_updateView(){const t=this._hostElement,e=this._scrollerController?.element,i=this._layout;if(t&&e&&i){let s,r,o,n;const a=t.getBoundingClientRect();s=0,r=0,o=window.innerHeight,n=window.innerWidth;const h=this._clippingAncestors.map(t=>t.getBoundingClientRect());h.unshift(a);for(const t of h)s=Math.max(s,t.top),r=Math.max(r,t.left),o=Math.min(o,t.bottom),n=Math.min(n,t.right);const l=e.getBoundingClientRect(),c={left:a.left-l.left,top:a.top-l.top},d={width:e.scrollWidth,height:e.scrollHeight},p=s-a.top+t.scrollTop,u=r-a.left+t.scrollLeft,g=Math.max(0,o-s),m=Math.max(0,n-r);i.viewportSize={width:m,height:g},i.viewportScroll={top:p,left:u},i.totalScrollSize=d,i.offsetWithinScroller=c}}_sizeHostElement(t){const e=82e5,i=t&&null!==t.width?Math.min(e,t.width):0,s=t&&null!==t.height?Math.min(e,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${s}px)`;else{const t=this._hostElement.style;t.minWidth=i?`${i}px`:"100%",t.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:e,width:i,height:s,xOffset:r,yOffset:o},n)=>{const a=this._children[n-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${e}px, ${t}px)`,void 0!==i&&(a.style.width=i+"px"),void 0!==s&&(a.style.height=s+"px"),a.style.left=void 0===r?null:r+"px",a.style.top=void 0===o?null:o+"px")})}async _adjustRange(t){const{_first:e,_last:i,_firstVisible:s,_lastVisible:r}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==r}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-i,left:e-s})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:i}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new V({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new A({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function H(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function j(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const e=t.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}const N=t=>t,D=(t,i)=>e`${i}: ${JSON.stringify(t,null,2)}`;const P=d(class extends u{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>D(t,e+this._first),this._keyFunction=(t,e)=>N(t,this._first),this._items=[],t.type!==p.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)e.push(this._items[t]);return g(e,this._keyFunction,this._renderItem)}update(e,[i]){this._setFunctions(i);const s=this._items!==i.items;return this._items=i.items||[],this._virtualizer?this._updateVirtualizerConfig(e,i):this._initialize(e,i),s?t:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const i=t.parentNode;this._makeVirtualizer(i,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:i}=t;e&&(this._renderItem=(t,i)=>e(t,i+this._first)),i&&(this._keyFunction=(t,e)=>i(t,e+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:i,scroller:s,items:r}=e;this._virtualizer=new R({hostElement:t,layout:i,scroller:s}),this._virtualizer.items=r,this._virtualizer.connected()}_initialize(t,e){const i=t.parentNode;i&&1===i.nodeType&&(i.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(i,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2021 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/class B extends
|
|
44
|
+
*/class B extends i{constructor(){super(...arguments),this.items=[],this.renderItem=D,this.keyFunction=N,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){const{items:t,renderItem:i,keyFunction:s,layout:r,scroller:o}=this;return e`${P({items:t,renderItem:i,keyFunction:s,layout:r,scroller:o})}`}element(t){return this[T]?.element(t)}get layoutComplete(){return this[T]?.layoutComplete}scrollToIndex(t,e="start"){this.element(t)?.scrollIntoView({block:e})}}
|
|
45
45
|
/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2021 Google LLC
|
|
@@ -53,22 +53,22 @@ function F(t){return"horizontal"===t?"width":"height"}function U(t){return"horiz
|
|
|
53
53
|
* Copyright 2021 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
55
|
*/
|
|
56
|
-
customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,
|
|
56
|
+
customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,e){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then(()=>this.config=e||this._getDefaultConfig())}set config(t){Object.assign(this,Object.assign({},this._getDefaultConfig(),t))}get config(){return{direction:this.direction}}get items(){return this._items}set items(t){this._setItems(t)}_setItems(t){t!==this._items&&(this._items=t,this._scheduleReflow())}get direction(){return this._direction}set direction(t){(t="horizontal"===t?t:"vertical")!==this._direction&&(this._direction=t,this._sizeDim="horizontal"===t?"width":"height",this._secondarySizeDim="horizontal"===t?"height":"width",this._positionDim="horizontal"===t?"left":"top",this._secondaryPositionDim="horizontal"===t?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(t){const{_viewDim1:e,_viewDim2:i}=this;Object.assign(this._viewportSize,t),i!==this._viewDim2?this._scheduleLayoutUpdate():e!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(t){Object.assign(this._latestCoords,t);const e=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim];Math.abs(e-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(t=!1){(t||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(t){this._pin=t,this._triggerReflow()}get pin(){if(null!==this._pin){const{index:t,block:e}=this._pin;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null}_clampScrollPosition(t){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(t,this.totalScrollSize[F(this.direction)]-this._viewDim1))}unpin(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(null!==this.pin){const t=this._scrollPosition,{index:e,block:i}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:i||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=t-this._scrollPosition}}_calculateScrollIntoViewPosition(t){const{block:e}=t,i=Math.min(this.items.length,Math.max(0,t.index)),s=this._getItemPosition(i)[this._positionDim];let r=s;if("start"!==e){const t=this._getItemSize(i)[this._sizeDim];if("center"===e)r=s-.5*this._viewDim1+.5*t;else{const i=s-this._viewDim1+t;if("end"===e)r=i;else{const t=this._scrollPosition;r=Math.abs(t-s)<Math.abs(t-i)?s:i}}}return r+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(r)}getScrollIntoViewCoordinates(t){return{[this._positionDim]:this._calculateScrollIntoViewPosition(t)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){const t=new Map;if(-1!==this._first&&-1!==this._last)for(let e=this._first;e<=this._last;e++)t.set(e,this._getItemPosition(e));const e={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:t};this._scrollError&&(e.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(e)}get _num(){return-1===this._first||-1===this._last?0:this._last-this._first+1}_checkThresholds(){if(0===this._viewDim1&&this._num>0||null!==this._pin)this._scheduleReflow();else{const t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>t||this._physicalMax<e?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(t){if(-1===this._first||-1===this._last)return;let e=this._first;for(;e<this._last&&Math.round(this._getItemPosition(e)[this._positionDim]+this._getItemSize(e)[this._sizeDim])<=Math.round(this._scrollPosition);)e++;let i=this._last;for(;i>this._first&&Math.round(this._getItemPosition(i)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)i--;e===this._firstVisible&&i===this._lastVisible||(this._firstVisible=e,this._lastVisible=i,t&&t.emit&&this._sendVisibilityChangedMessage())}}
|
|
57
57
|
/**
|
|
58
58
|
* @license
|
|
59
59
|
* Copyright 2021 Google LLC
|
|
60
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
61
|
-
*/function W(t){return"horizontal"===t?"row":"column"}class K extends Z{constructor(){super(...arguments),this._itemSize={},this._gaps={},this._padding={}}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{itemSize:{width:"300px",height:"300px"},gap:"8px",padding:"match-gap"})}get _gap(){return this._gaps.row}get _idealSize(){return this._itemSize[F(this.direction)]}get _idealSize1(){return this._itemSize[F(this.direction)]}get _idealSize2(){return this._itemSize[U(this.direction)]}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[W(this.direction)]}get _padding1(){const t=this._padding,[i
|
|
61
|
+
*/function W(t){return"horizontal"===t?"row":"column"}class K extends Z{constructor(){super(...arguments),this._itemSize={},this._gaps={},this._padding={}}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{itemSize:{width:"300px",height:"300px"},gap:"8px",padding:"match-gap"})}get _gap(){return this._gaps.row}get _idealSize(){return this._itemSize[F(this.direction)]}get _idealSize1(){return this._itemSize[F(this.direction)]}get _idealSize2(){return this._itemSize[U(this.direction)]}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[W(this.direction)]}get _padding1(){const t=this._padding,[e,i]="horizontal"===this.direction?["left","right"]:["top","bottom"];return[t[e],t[i]]}get _padding2(){const t=this._padding,[e,i]="horizontal"===this.direction?["top","bottom"]:["left","right"];return[t[e],t[i]]}set itemSize(t){const e=this._itemSize;"string"==typeof t&&(t={width:t,height:t});const i=parseInt(t.width),s=parseInt(t.height);i!==e.width&&(e.width=i,this._triggerReflow()),s!==e.height&&(e.height=s,this._triggerReflow())}set gap(t){this._setGap(t)}_setGap(t){const e=t.split(" ").map(t=>function(t){return"auto"===t?1/0:parseInt(t)}(t)),i=this._gaps;e[0]!==i.row&&(i.row=e[0],this._triggerReflow()),void 0===e[1]?e[0]!==i.column&&(i.column=e[0],this._triggerReflow()):e[1]!==i.column&&(i.column=e[1],this._triggerReflow())}set padding(t){const e=this._padding,i=t.split(" ").map(t=>function(t){return"match-gap"===t?1/0:parseInt(t)}(t));1===i.length?(e.top=e.right=e.bottom=e.left=i[0],this._triggerReflow()):2===i.length?(e.top=e.bottom=i[0],e.right=e.left=i[1],this._triggerReflow()):3===i.length?(e.top=i[0],e.right=e.left=i[1],e.bottom=i[2],this._triggerReflow()):4===i.length&&(["top","right","bottom","left"].forEach((t,s)=>e[t]=i[s]),this._triggerReflow())}}
|
|
62
62
|
/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright 2021 Google LLC
|
|
65
65
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
-
*/class Y extends K{constructor(){super(...arguments),this._metrics=null,this.flex=null,this.justify=null}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{flex:!1,justify:"start"})}set gap(t){super._setGap(t)}_updateLayout(){const t=this.justify,[i
|
|
66
|
+
*/class Y extends K{constructor(){super(...arguments),this._metrics=null,this.flex=null,this.justify=null}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{flex:!1,justify:"start"})}set gap(t){super._setGap(t)}_updateLayout(){const t=this.justify,[e,i]=this._padding1,[s,r]=this._padding2;["_gap1","_gap2"].forEach(e=>{const i=this[e];if(i===1/0&&!["space-between","space-around","space-evenly"].includes(t))throw new Error("grid layout: gap can only be set to 'auto' when justify is set to 'space-between', 'space-around' or 'space-evenly'");if(i===1/0&&"_gap2"===e)throw new Error(`grid layout: ${W(this.direction)}-gap cannot be set to 'auto' when direction is set to ${this.direction}`)});const o=this.flex||["start","center","end"].includes(t),n={rolumns:-1,itemSize1:-1,itemSize2:-1,gap1:this._gap1===1/0?-1:this._gap1,gap2:o?this._gap2:0,padding1:{start:e===1/0?this._gap1:e,end:i===1/0?this._gap1:i},padding2:o?{start:s===1/0?this._gap2:s,end:r===1/0?this._gap2:r}:{start:0,end:0},positions:[]},a=this._viewDim2-n.padding2.start-n.padding2.end;if(a<=0)n.rolumns=0;else{const s=o?n.gap2:0;let r,h=0,l=0;if(a>=this._idealSize2&&(h=Math.floor((a-this._idealSize2)/(this._idealSize2+s))+1,l=h*this._idealSize2+(h-1)*s),this.flex){(a-l)/(this._idealSize2+s)>=.5&&(h+=1),n.rolumns=h,n.itemSize2=Math.round((a-s*(h-1))/h);switch(!0===this.flex?"area":this.flex.preserve){case"aspect-ratio":n.itemSize1=Math.round(this._idealSize1/this._idealSize2*n.itemSize2);break;case F(this.direction):n.itemSize1=Math.round(this._idealSize1);break;default:n.itemSize1=Math.round(this._idealSize1*this._idealSize2/n.itemSize2)}}else n.itemSize1=this._idealSize1,n.itemSize2=this._idealSize2,n.rolumns=h;if(o){const e=n.rolumns*n.itemSize2+(n.rolumns-1)*n.gap2;r=this.flex||"start"===t?n.padding2.start:"end"===t?this._viewDim2-n.padding2.end-e:Math.round(this._viewDim2/2-e/2)}else{const s=a-n.rolumns*n.itemSize2;"space-between"===t?(n.gap2=Math.round(s/(n.rolumns-1)),r=0):"space-around"===t?(n.gap2=Math.round(s/n.rolumns),r=Math.round(n.gap2/2)):(n.gap2=Math.round(s/(n.rolumns+1)),r=n.gap2),this._gap1===1/0&&(n.gap1=n.gap2,e===1/0&&(n.padding1.start=r),i===1/0&&(n.padding1.end=r))}for(let t=0;t<n.rolumns;t++)n.positions.push(r),r+=n.itemSize2+n.gap2}this._metrics=n}}
|
|
67
67
|
/**
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2021 Google LLC
|
|
70
70
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
-
*/class X extends Y{get _delta(){return this._metrics.itemSize1+this._metrics.gap1}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_getActiveItems(){const t=this._metrics,{rolumns:
|
|
71
|
+
*/class X extends Y{get _delta(){return this._metrics.itemSize1+this._metrics.gap1}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_getActiveItems(){const t=this._metrics,{rolumns:e}=t;if(0===e)this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;else{const{padding1:i}=t,s=Math.max(0,this._scrollPosition-this._overhang),r=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang),o=Math.max(0,Math.floor((s-i.start)/this._delta)),n=Math.max(0,Math.ceil((r-i.start)/this._delta));this._first=o*e,this._last=Math.min(n*e-1,this.items.length-1),this._physicalMin=i.start+this._delta*o,this._physicalMax=i.start+this._delta*n}}_getItemPosition(t){const{rolumns:e,padding1:i,positions:s,itemSize1:r,itemSize2:o}=this._metrics;return{[this._positionDim]:i.start+Math.floor(t/e)*this._delta,[this._secondaryPositionDim]:s[t%e],[F(this.direction)]:r,[U(this.direction)]:o}}_updateScrollSize(){const{rolumns:t,gap1:e,padding1:i,itemSize1:s}=this._metrics;let r=1;if(t>0){const o=Math.ceil(this.items.length/t);r=i.start+o*s+(o-1)*e+i.end}this._scrollSize=r}}const G=s`
|
|
72
72
|
:host {
|
|
73
73
|
display: inline-block;
|
|
74
74
|
position: relative;
|
|
@@ -93,7 +93,7 @@ customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{di
|
|
|
93
93
|
|
|
94
94
|
.dropdown__panel {
|
|
95
95
|
position: fixed;
|
|
96
|
-
z-index: 9999;
|
|
96
|
+
z-index: var(--nuraly-dropdown-z-index, 9999);
|
|
97
97
|
background: #ffffff;
|
|
98
98
|
border: 1px solid #e0e0e0;
|
|
99
99
|
border-radius: 6px;
|
|
@@ -410,7 +410,7 @@ customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{di
|
|
|
410
410
|
.dropdown__submenu {
|
|
411
411
|
position: absolute;
|
|
412
412
|
top: 0;
|
|
413
|
-
z-index: calc(9999 + 1);
|
|
413
|
+
z-index: calc(var(--nuraly-dropdown-z-index, 9999) + 1);
|
|
414
414
|
background: #ffffff;
|
|
415
415
|
border: 1px solid #e0e0e0;
|
|
416
416
|
border-radius: 6px;
|
|
@@ -530,50 +530,50 @@ customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{di
|
|
|
530
530
|
* @license
|
|
531
531
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
532
532
|
* SPDX-License-Identifier: MIT
|
|
533
|
-
*/;class J{constructor(t){this._host=t,t.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}handleError(t,
|
|
533
|
+
*/;class J{constructor(t){this._host=t,t.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}handleError(t,e){console.error(`[${this.constructor.name}] Error in ${e}:`,t);try{this._host.dispatchEvent(new CustomEvent("nr-controller-error",{detail:{error:t.message,context:e,controller:this.constructor.name},bubbles:!0,composed:!0}))}catch(t){}}safeExecute(t,e,i){try{return t()}catch(t){return this.handleError(t,e),i}}debounce(t,e){let i;const s=(...s)=>{void 0!==i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,t.apply(this,s)},e)};return s.cancel=()=>{void 0!==i&&(clearTimeout(i),i=void 0)},s}}
|
|
534
534
|
/**
|
|
535
535
|
* @license
|
|
536
536
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
537
537
|
* SPDX-License-Identifier: MIT
|
|
538
|
-
*/class Q extends J{constructor(){super(...arguments),this._isValid=!0,this._validationMessage="",this._validationState="pristine",this._rules=[]}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationState(){return this._validationState}addRule(t){this._rules.push(t),this.requestUpdate()}removeRule(t){this._rules=this._rules.filter(
|
|
538
|
+
*/class Q extends J{constructor(){super(...arguments),this._isValid=!0,this._validationMessage="",this._validationState="pristine",this._rules=[]}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationState(){return this._validationState}addRule(t){this._rules.push(t),this.requestUpdate()}removeRule(t){this._rules=this._rules.filter(e=>!t(e)),this.requestUpdate()}clearRules(){this._rules=[],this.clearValidation()}clearValidation(){this._isValid=!0,this._validationMessage="",this._validationState="pristine",this.requestUpdate(),this.dispatchValidationEvent()}checkValidity(){return this.validate()}reportValidity(){const t=this.checkValidity();return t||this.dispatchValidationEvent(),t}dispatchValidationEvent(){this.dispatchEvent(new CustomEvent("nr-validation",{detail:{isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState},bubbles:!0,composed:!0}))}}class tt extends J{findElement(t){var e;return null===(e=this._host.shadowRoot)||void 0===e?void 0:e.querySelector(t)}findElements(t){var e;return null===(e=this._host.shadowRoot)||void 0===e?void 0:e.querySelectorAll(t)}}class et extends tt{constructor(t){super(t),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._triggerElement=null,this._dropdownElement=null,this._outsideClickHandler=null,this._keydownHandler=null,this._hoverTimer=null,this._triggerClickHandler=null,this._triggerHoverHandler=null,this._triggerLeaveHandler=null,this._triggerFocusHandler=null,this._triggerBlurHandler=null,this._scrollHandler=null,this._resizeHandler=null,this._isOpen=t.open}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}hostConnected(){}hostUpdated(){this._isOpen!==this.host.open&&(this._isOpen=this.host.open),this._triggerElement||this.setupTriggerListeners()}hostDisconnected(){this.cleanup()}open(){try{this._isOpen||this.host.disabled||(this._isOpen=!0,this.host.open=!0,this.requestUpdate(),setTimeout(()=>{this.calculatePosition(),this.setupEventListeners()},10),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this.removeEventListeners(),this._isOpen=!1,this.host.open=!1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(t){this.handleError(t,"close")}}toggle(){try{this._isOpen?this.close():this.open()}catch(t){this.handleError(t,"toggle")}}removeTriggerListeners(){this._triggerElement&&(this._triggerClickHandler&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler),this._triggerClickHandler=null),this._triggerHoverHandler&&(this._triggerElement.removeEventListener("mouseenter",this._triggerHoverHandler),this._triggerHoverHandler=null),this._triggerLeaveHandler&&(this._triggerElement.removeEventListener("mouseleave",this._triggerLeaveHandler),this._triggerLeaveHandler=null),this._triggerFocusHandler&&(this._triggerElement.removeEventListener("focusin",this._triggerFocusHandler),this._triggerFocusHandler=null),this._triggerBlurHandler&&(this._triggerElement.removeEventListener("focusout",this._triggerBlurHandler),this._triggerBlurHandler=null))}findDropdownElements(){this._dropdownElement=this.findElement(".dropdown__panel"),this._triggerElement=this.findElement(".dropdown__trigger")}setupTriggerListeners(){if(this.findDropdownElements(),this._triggerElement)switch(this.removeTriggerListeners(),this.host.trigger){case"click":this._triggerClickHandler=this.handleTriggerClick.bind(this),this._triggerElement.addEventListener("click",this._triggerClickHandler);break;case"hover":this._triggerHoverHandler=this.handleTriggerHover.bind(this),this._triggerLeaveHandler=this.handleTriggerLeave.bind(this),this._triggerElement.addEventListener("mouseenter",this._triggerHoverHandler),this._triggerElement.addEventListener("mouseleave",this._triggerLeaveHandler);break;case"focus":this._triggerFocusHandler=this.handleTriggerFocus.bind(this),this._triggerBlurHandler=this.handleTriggerBlur.bind(this),this._triggerElement.addEventListener("focusin",this._triggerFocusHandler),this._triggerElement.addEventListener("focusout",this._triggerBlurHandler)}}setupEventListeners(){this.host.closeOnOutsideClick&&(this._outsideClickHandler=this.handleOutsideClick.bind(this),document.addEventListener("click",this._outsideClickHandler,!0)),this.host.closeOnEscape&&(this._keydownHandler=this.handleKeydown.bind(this),document.addEventListener("keydown",this._keydownHandler)),this._scrollHandler=this.handleScroll.bind(this),this._resizeHandler=this.handleResize.bind(this),window.addEventListener("scroll",this._scrollHandler,!0),window.addEventListener("resize",this._resizeHandler)}removeEventListeners(){this._outsideClickHandler&&(document.removeEventListener("click",this._outsideClickHandler,!0),this._outsideClickHandler=null),this._keydownHandler&&(document.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}handleTriggerClick(){this.host.disabled||this.toggle()}handleTriggerHover(){this.host.disabled||(this._hoverTimer&&clearTimeout(this._hoverTimer),this._hoverTimer=window.setTimeout(()=>{this.open()},this.host.delay))}handleTriggerLeave(){this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null),setTimeout(()=>{this.isHoveringDropdown()||this.close()},100)}handleTriggerFocus(){this.host.disabled||this.open()}handleTriggerBlur(){setTimeout(()=>{this.isDropdownFocused()||this.close()},100)}handleOutsideClick(t){var e,i,s,r;if(!this.host.closeOnOutsideClick)return;const o=t.target;if(null===(e=this._triggerElement)||void 0===e?void 0:e.contains(o))return;if(null===(i=this._dropdownElement)||void 0===i?void 0:i.contains(o))return;const n=t.composedPath();for(const t of n){if(t===this._dropdownElement)return;if(t instanceof Element&&(null===(s=this._dropdownElement)||void 0===s?void 0:s.contains(t)))return}let a=o;for(;a;){const t=a.getRootNode();if(!(t instanceof ShadowRoot&&t.host))break;if(null===(r=this._dropdownElement)||void 0===r?void 0:r.contains(t.host))return;a=t.host}this.close()}handleKeydown(t){"Escape"===t.key&&this.close()}handleScroll(){this._isOpen&&this.calculatePosition()}handleResize(){this._isOpen&&this.calculatePosition()}calculatePosition(){var t,e;try{if(this._dropdownElement&&this._triggerElement||this.findDropdownElements(),!this._dropdownElement||!this._triggerElement)return;const i=this._triggerElement.getBoundingClientRect(),s=this._dropdownElement.getBoundingClientRect(),r=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight,o=(null===(e=window.visualViewport)||void 0===e?void 0:e.width)||window.innerWidth,n=r-i.bottom,a=i.top,h=o-i.right,l=i.left,c=s.height||200,d=s.width||300,p=function(t,e,i){return i>=t?"bottom":e>=t||e>i?"top":"bottom"}(c,a,n),u=this.determineHorizontalPlacement(d,l,h);let g,m;g="bottom"===p?i.bottom+this.host.offset:i.top-c-this.host.offset,m="left"===u?i.right-d:i.left,m=Math.max(8,Math.min(m,o-d-8)),g=Math.max(8,Math.min(g,r-c-8)),this._dropdownElement.style.top=`${g}px`,this._dropdownElement.style.left=`${m}px`,this.applyPlacement(p,u)}catch(t){this.handleError(t,"calculatePosition")}}determineHorizontalPlacement(t,e,i){const s=this.host.placement;if(s.includes("left")||s.includes("right")){if(s.includes("left")&&e>=t)return"left";if(s.includes("right")&&i>=t)return"right"}return i>=t?"right":e>=t?"left":i>e?"right":"left"}applyPlacement(t,e){this._dropdownElement&&(this._dropdownElement.classList.remove("dropdown__panel--top","dropdown__panel--bottom","dropdown__panel--left-aligned","dropdown__panel--right-aligned"),this._dropdownElement.classList.add(`dropdown__panel--${t}`),"left"===e?this._dropdownElement.classList.add("dropdown__panel--right-aligned"):"right"===e&&this._dropdownElement.classList.add("dropdown__panel--left-aligned"),this._position.placement=t)}isHoveringDropdown(){var t;return(null===(t=this._dropdownElement)||void 0===t?void 0:t.matches(":hover"))||!1}isDropdownFocused(){var t;const e=document.activeElement;if(!e)return!1;if(null===(t=this._dropdownElement)||void 0===t?void 0:t.contains(e))return!0;if(e.closest(".dropdown__custom-content"))return!0;if(["INPUT","BUTTON","TEXTAREA","SELECT","A"].includes(e.tagName)){if(e.closest(".dropdown__panel"))return!0}return!1}handleItemClick(t,e){this.dispatchEvent(new CustomEvent("nr-dropdown-item-click",{bubbles:!0,composed:!0,detail:{item:t,dropdown:this.host,originalEvent:e}})),this.host.autoClose&&this.close()}cleanup(){this.removeEventListeners(),this.removeTriggerListeners(),this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null)}}
|
|
539
539
|
/**
|
|
540
540
|
* @license
|
|
541
541
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
542
542
|
* SPDX-License-Identifier: MIT
|
|
543
|
-
*/var
|
|
543
|
+
*/var it=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};let st=class extends(z(i)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.items=[],this.open=!1,this.placement="bottom",this.trigger="hover",this.size="medium",this.animation="fade",this.disabled=!1,this.arrow=!1,this.autoClose=!1,this.closeOnOutsideClick=!0,this.closeOnEscape=!0,this.offset=4,this.delay=50,this.maxHeight="300px",this.minWidth="auto",this.cascadeDirection="auto",this.cascadeDelay=50,this.cascadeOnHover=!0,this.allowOverflow=!1,this.dropdownController=new et(this),this.openSubmenus=new Set,this.submenuTimers=new Map,this.handleDropdownPanelClick=t=>{t.stopPropagation()},this.handleItemClick=(t,e)=>{t.disabled||(t.options&&t.options.length>0||t.customContent?this.toggleSubmenu(t.id):this.dropdownController.handleItemClick(t,e))},this.handleItemHover=t=>{var e;if(((null===(e=t.options)||void 0===e?void 0:e.length)||t.customContent)&&(this.clearSubmenuTimer(t.id),this.cascadeOnHover)){const e=window.setTimeout(()=>{this.showSubmenu(t.id)},this.cascadeDelay);this.submenuTimers.set(t.id,e)}},this.handleItemLeave=t=>{var e;if(!(null===(e=t.options)||void 0===e?void 0:e.length)&&!t.customContent)return;this.clearSubmenuTimer(t.id);const i=window.setTimeout(()=>{this.hideSubmenu(t.id)},100);this.submenuTimers.set(`hide-${t.id}`,i)},this.handleSubmenuEnter=t=>{this.clearSubmenuTimer(`hide-${t}`)},this.handleSubmenuLeave=t=>{const e=window.setTimeout(()=>{this.hideSubmenu(t)},100);this.submenuTimers.set(`hide-${t}`,e)}}connectedCallback(){super.connectedCallback(),this.updateCascadingAttribute()}updated(t){super.updated(t),t.has("items")&&this.updateCascadingAttribute()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){}updateCascadingAttribute(){this.items.some(t=>t.options&&t.options.length>0||!!t.customContent)?this.setAttribute("has-cascading",""):this.removeAttribute("has-cascading")}clearSubmenuTimer(t){const e=this.submenuTimers.get(t);e&&(clearTimeout(e),this.submenuTimers.delete(t))}toggleSubmenu(t){this.openSubmenus.has(t)?this.hideSubmenu(t):this.showSubmenu(t)}showSubmenu(t){this.openSubmenus.add(t),this.requestUpdate()}hideSubmenu(t){this.openSubmenus.delete(t),this.requestUpdate()}show(){this.dropdownController.open()}hide(){this.dropdownController.close()}toggle(){this.dropdownController.toggle()}renderCustomContent(t){return"string"==typeof t.customContent?e`<div>${m(t.customContent)}</div>`:t.customContent}renderSubmenuContent(t){return t.customContent?e`
|
|
544
544
|
<div class="dropdown__custom-content">
|
|
545
545
|
${this.renderCustomContent(t)}
|
|
546
546
|
</div>
|
|
547
|
-
`:
|
|
547
|
+
`:e`
|
|
548
548
|
<div class="dropdown__items">
|
|
549
|
-
${(t.options||[]).map(t=>t.divider?
|
|
549
|
+
${(t.options||[]).map(t=>t.divider?e`<div class="dropdown__divider"></div>`:e`
|
|
550
550
|
<button
|
|
551
551
|
class="dropdown__item ${l({"dropdown__item--disabled":!!t.disabled})}"
|
|
552
552
|
?disabled="${t.disabled}"
|
|
553
|
-
@click="${
|
|
553
|
+
@click="${e=>this.handleItemClick(t,e)}"
|
|
554
554
|
>
|
|
555
|
-
${t.icon?
|
|
555
|
+
${t.icon?e`<nr-icon name="${t.icon}" class="dropdown__item-icon"></nr-icon>`:r}
|
|
556
556
|
<span class="dropdown__item-label">${t.label}</span>
|
|
557
557
|
</button>
|
|
558
558
|
`)}
|
|
559
559
|
</div>
|
|
560
|
-
`}renderItems(){return this.items.length?
|
|
560
|
+
`}renderItems(){return this.items.length?e`
|
|
561
561
|
<div class="dropdown__items">
|
|
562
|
-
${this.items.map(t=>{if(t.divider)return
|
|
563
|
-
<div class="dropdown__item-container ${l({"dropdown__item-container--has-submenu":
|
|
562
|
+
${this.items.map(t=>{if(t.divider)return e`<div class="dropdown__divider"></div>`;const i=!!(t.options&&t.options.length>0)||!!t.customContent,s=i&&this.openSubmenus.has(t.id);return e`
|
|
563
|
+
<div class="dropdown__item-container ${l({"dropdown__item-container--has-submenu":i})}">
|
|
564
564
|
<button
|
|
565
|
-
class="dropdown__item ${l({"dropdown__item--disabled":!!t.disabled,"dropdown__item--has-submenu":
|
|
565
|
+
class="dropdown__item ${l({"dropdown__item--disabled":!!t.disabled,"dropdown__item--has-submenu":i})}"
|
|
566
566
|
?disabled="${t.disabled}"
|
|
567
|
-
@click="${
|
|
568
|
-
@mouseenter="${()=>
|
|
569
|
-
@mouseleave="${()=>
|
|
567
|
+
@click="${e=>this.handleItemClick(t,e)}"
|
|
568
|
+
@mouseenter="${()=>i&&this.handleItemHover(t)}"
|
|
569
|
+
@mouseleave="${()=>i&&this.handleItemLeave(t)}"
|
|
570
570
|
>
|
|
571
|
-
${t.icon?
|
|
571
|
+
${t.icon?e`<nr-icon name="${t.icon}" class="dropdown__item-icon"></nr-icon>`:r}
|
|
572
572
|
<span class="dropdown__item-label">${t.label}</span>
|
|
573
|
-
${e
|
|
573
|
+
${i?e`<nr-icon name="chevron-right" class="dropdown__submenu-arrow"></nr-icon>`:r}
|
|
574
574
|
</button>
|
|
575
575
|
|
|
576
|
-
${
|
|
576
|
+
${i&&s?e`
|
|
577
577
|
<div class="dropdown__submenu ${l({"dropdown__submenu--right":"right"===this.cascadeDirection||"auto"===this.cascadeDirection,"dropdown__submenu--left":"left"===this.cascadeDirection})}"
|
|
578
578
|
@mouseenter="${()=>this.handleSubmenuEnter(t.id)}"
|
|
579
579
|
@mouseleave="${()=>this.handleSubmenuLeave(t.id)}">
|
|
@@ -583,29 +583,30 @@ customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{di
|
|
|
583
583
|
</div>
|
|
584
584
|
`})}
|
|
585
585
|
</div>
|
|
586
|
-
`:r}render(){const t={dropdown__panel:!0,"dropdown__panel--open":this.open,[`dropdown__panel--${this.size}`]:!0,[`dropdown__panel--${this.animation}`]:!0,[`dropdown__panel--${this.placement}`]:!0,"dropdown__panel--with-arrow":this.arrow},
|
|
587
|
-
<div class="dropdown">
|
|
588
|
-
<div class="dropdown__trigger">
|
|
586
|
+
`:r}render(){const t={dropdown__panel:!0,"dropdown__panel--open":this.open,[`dropdown__panel--${this.size}`]:!0,[`dropdown__panel--${this.animation}`]:!0,[`dropdown__panel--${this.placement}`]:!0,"dropdown__panel--with-arrow":this.arrow},i={maxHeight:this.maxHeight,minWidth:this.minWidth};return e`
|
|
587
|
+
<div class="dropdown" part="container">
|
|
588
|
+
<div class="dropdown__trigger" part="trigger">
|
|
589
589
|
<slot name="trigger"></slot>
|
|
590
590
|
</div>
|
|
591
|
-
|
|
592
|
-
<div
|
|
591
|
+
|
|
592
|
+
<div
|
|
593
593
|
class="${l(t)}"
|
|
594
|
-
style="${h(
|
|
594
|
+
style="${h(i)}"
|
|
595
|
+
part="panel"
|
|
595
596
|
@click="${this.handleDropdownPanelClick}"
|
|
596
597
|
>
|
|
597
|
-
${this.arrow?
|
|
598
|
-
|
|
598
|
+
${this.arrow?e`<div class="dropdown__arrow" part="arrow"></div>`:r}
|
|
599
|
+
|
|
599
600
|
<slot name="header"></slot>
|
|
600
|
-
|
|
601
|
-
<div class="dropdown__content">
|
|
601
|
+
|
|
602
|
+
<div class="dropdown__content" part="content">
|
|
602
603
|
<slot name="content">${this.renderItems()}</slot>
|
|
603
604
|
</div>
|
|
604
|
-
|
|
605
|
+
|
|
605
606
|
<slot name="footer"></slot>
|
|
606
607
|
</div>
|
|
607
608
|
</div>
|
|
608
|
-
`}};st.useShadowDom=!0,st.styles=G,
|
|
609
|
+
`}};st.useShadowDom=!0,st.styles=G,it([o({type:Array})],st.prototype,"items",void 0),it([o({type:Boolean,reflect:!0})],st.prototype,"open",void 0),it([o({type:String})],st.prototype,"placement",void 0),it([o({type:String})],st.prototype,"trigger",void 0),it([o({type:String})],st.prototype,"size",void 0),it([o({type:String})],st.prototype,"animation",void 0),it([o({type:Boolean})],st.prototype,"disabled",void 0),it([o({type:Boolean})],st.prototype,"arrow",void 0),it([o({type:Boolean,attribute:"auto-close"})],st.prototype,"autoClose",void 0),it([o({type:Boolean,attribute:"close-on-outside-click"})],st.prototype,"closeOnOutsideClick",void 0),it([o({type:Boolean,attribute:"close-on-escape"})],st.prototype,"closeOnEscape",void 0),it([o({type:Number})],st.prototype,"offset",void 0),it([o({type:Number})],st.prototype,"delay",void 0),it([o({type:String,attribute:"max-height"})],st.prototype,"maxHeight",void 0),it([o({type:String,attribute:"min-width"})],st.prototype,"minWidth",void 0),it([o({type:String,attribute:"cascade-direction"})],st.prototype,"cascadeDirection",void 0),it([o({type:Number,attribute:"cascade-delay"})],st.prototype,"cascadeDelay",void 0),it([o({type:Boolean,attribute:"cascade-on-hover"})],st.prototype,"cascadeOnHover",void 0),it([o({type:Boolean,attribute:"allow-overflow"})],st.prototype,"allowOverflow",void 0),st=it([n("nr-dropdown")],st);const rt=s`
|
|
609
610
|
/* ========================================
|
|
610
611
|
* HOST ELEMENT
|
|
611
612
|
* ======================================== */
|
|
@@ -1109,43 +1110,43 @@ customElements.define("lit-virtualizer",B);class Z{_getDefaultConfig(){return{di
|
|
|
1109
1110
|
75% { opacity: 1; transform: scale(1.03); }
|
|
1110
1111
|
100% { opacity: 0.7; transform: scale(1); }
|
|
1111
1112
|
}
|
|
1112
|
-
`,ot={EMAIL:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,URL:/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,PHONE:/^[\+]?[1-9][\d]{0,15}$/,PASSWORD_STRONG:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,ALPHANUMERIC:/^[a-zA-Z0-9]+$/,NUMERIC:/^\d+$/,ALPHA:/^[a-zA-Z]+$/,USERNAME:/^[a-zA-Z0-9_-]{3,16}$/,HEX_COLOR:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,IPV4:/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,CREDIT_CARD:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/},nt=t=>({required:!0,message:t||"This field is required"}),at=t=>({type:"email",pattern:ot.EMAIL,message:t||"Please enter a valid email address"}),ht=t=>({type:"url",pattern:ot.URL,message:t||"Please enter a valid URL"}),lt=(t,
|
|
1113
|
+
`,ot={EMAIL:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,URL:/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,PHONE:/^[\+]?[1-9][\d]{0,15}$/,PASSWORD_STRONG:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,ALPHANUMERIC:/^[a-zA-Z0-9]+$/,NUMERIC:/^\d+$/,ALPHA:/^[a-zA-Z]+$/,USERNAME:/^[a-zA-Z0-9_-]{3,16}$/,HEX_COLOR:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,IPV4:/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,CREDIT_CARD:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/},nt=t=>({required:!0,message:t||"This field is required"}),at=t=>({type:"email",pattern:ot.EMAIL,message:t||"Please enter a valid email address"}),ht=t=>({type:"url",pattern:ot.URL,message:t||"Please enter a valid URL"}),lt=(t,e)=>({maxLength:t,message:e||`Maximum length is ${t} characters`}),ct=(t,e)=>({type:"number",min:t,message:e||`Minimum value is ${t}`}),dt=(t,e)=>({type:"number",max:t,message:e||`Maximum value is ${t}`});
|
|
1113
1114
|
/**
|
|
1114
1115
|
* @license
|
|
1115
1116
|
* Copyright 2023 Google Laabidi Aymen
|
|
1116
1117
|
* SPDX-License-Identifier: MIT
|
|
1117
1118
|
*/
|
|
1118
|
-
class pt{static validateNumericProperties(t,i,
|
|
1119
|
+
class pt{static validateNumericProperties(t,e,i,s){"number"===t&&(e&&Number.isNaN(Number(e))&&console.warn(`Invalid min value: "${e}" is not a valid number`),i&&Number.isNaN(Number(i))&&console.warn(`Invalid max value: "${i}" is not a valid number`),s&&Number.isNaN(Number(s))&&console.warn(`Invalid step value: "${s}" is not a valid number`),e&&i&&Number(e)>=Number(i)&&console.warn(`Invalid range: min value (${e}) should be less than max value (${i})`))}static preventNonNumericInput(t,e){const i=t.key,s=t.target,r=s.value,o=s.selectionStart||0;if(!(t.ctrlKey||t.metaKey||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(i)||/^\d$/.test(i))){if("."===i||","===i){if(!(r.includes(".")||r.includes(",")))return}if("-"===i){const t=r.includes("-"),i=!e||Number(e)<0;if(!t&&0===o&&i)return}if("+"===i){if(!r.includes("+")&&0===o)return}t.preventDefault()}}static validateNumericValue(t,e,i){const s=[];if(!t)return{isValid:!0,warnings:s};const r=Number(t);return Number.isNaN(r)?{isValid:!1,warnings:[`Invalid numeric value: "${t}"`]}:(e&&r<Number(e)&&s.push(`Value ${r} is below minimum ${e}`),i&&r>Number(i)&&s.push(`Value ${r} is above maximum ${i}`),{isValid:!0,warnings:s})}}
|
|
1119
1120
|
/**
|
|
1120
1121
|
* @license
|
|
1121
1122
|
* Copyright 2023 Google Laabidi Aymen
|
|
1122
1123
|
* SPDX-License-Identifier: MIT
|
|
1123
|
-
*/class ut{static renderPrefix(t=[]){return 0===t.length?r:
|
|
1124
|
+
*/class ut{static renderPrefix(t=[]){return 0===t.length?r:e`
|
|
1124
1125
|
<div class="input-prefix">
|
|
1125
1126
|
${t}
|
|
1126
1127
|
</div>
|
|
1127
|
-
`}static renderSuffix(t=[]){return 0===t.length?r:
|
|
1128
|
+
`}static renderSuffix(t=[]){return 0===t.length?r:e`
|
|
1128
1129
|
<div class="input-suffix">
|
|
1129
1130
|
${t}
|
|
1130
1131
|
</div>
|
|
1131
|
-
`}static renderAddonBefore(t,
|
|
1132
|
+
`}static renderAddonBefore(t,i=[]){return t?e`
|
|
1132
1133
|
<div class="input-addon-before">
|
|
1133
|
-
${
|
|
1134
|
+
${i}
|
|
1134
1135
|
</div>
|
|
1135
|
-
`:r}static renderAddonAfter(t,
|
|
1136
|
+
`:r}static renderAddonAfter(t,i=[]){return t?e`
|
|
1136
1137
|
<div class="input-addon-after">
|
|
1137
|
-
${
|
|
1138
|
+
${i}
|
|
1138
1139
|
</div>
|
|
1139
|
-
`:r}static renderCopyIcon(t,
|
|
1140
|
+
`:r}static renderCopyIcon(t,i,s,o,n){return t?e`<nr-icon
|
|
1140
1141
|
name="copy"
|
|
1141
1142
|
type="regular"
|
|
1142
1143
|
id="copy-icon"
|
|
1143
1144
|
role="button"
|
|
1144
1145
|
aria-label="Copy input value"
|
|
1145
1146
|
tabindex="0"
|
|
1146
|
-
@click=${
|
|
1147
|
+
@click=${i||s?r:o}
|
|
1147
1148
|
@keydown=${n}
|
|
1148
|
-
></nr-icon>`:r}static renderClearIcon(t,
|
|
1149
|
+
></nr-icon>`:r}static renderClearIcon(t,i,s,o,n,a){return!t||!i||s||o?r:e`<nr-icon
|
|
1149
1150
|
name="times-circle"
|
|
1150
1151
|
type="regular"
|
|
1151
1152
|
id="clear-icon"
|
|
@@ -1154,7 +1155,7 @@ class pt{static validateNumericProperties(t,i,e,s){"number"===t&&(i&&Number.isNa
|
|
|
1154
1155
|
tabindex="0"
|
|
1155
1156
|
@click=${n}
|
|
1156
1157
|
@keydown=${a}
|
|
1157
|
-
></nr-icon>`}static renderStateIcon(t){switch(t){case"warning":return
|
|
1158
|
+
></nr-icon>`}static renderStateIcon(t){switch(t){case"warning":return e`<nr-icon name="warning" id="warning-icon"></nr-icon>`;case"error":return e`<nr-icon name="exclamation-circle" id="error-icon"></nr-icon>`;default:return r}}static renderCalendarIcon(t,i){return"default"!==t||"calendar"!==i?r:e`<nr-icon name="calendar" type="regular" id="calendar-icon"></nr-icon>`}static renderPasswordIcon(t,i,s,o,n,a){return"password"!==t?r:"text"===i?e`<nr-icon
|
|
1158
1159
|
name="eye-slash"
|
|
1159
1160
|
type="regular"
|
|
1160
1161
|
id="password-icon"
|
|
@@ -1163,7 +1164,7 @@ class pt{static validateNumericProperties(t,i,e,s){"number"===t&&(i&&Number.isNa
|
|
|
1163
1164
|
tabindex="0"
|
|
1164
1165
|
@click=${s||o?r:n}
|
|
1165
1166
|
@keydown=${a}
|
|
1166
|
-
></nr-icon>`:
|
|
1167
|
+
></nr-icon>`:e`<nr-icon
|
|
1167
1168
|
name="eye"
|
|
1168
1169
|
type="regular"
|
|
1169
1170
|
id="password-icon"
|
|
@@ -1172,9 +1173,9 @@ class pt{static validateNumericProperties(t,i,e,s){"number"===t&&(i&&Number.isNa
|
|
|
1172
1173
|
tabindex="0"
|
|
1173
1174
|
@click=${s||o?r:n}
|
|
1174
1175
|
@keydown=${a}
|
|
1175
|
-
></nr-icon>`}static renderNumberIcons(t,
|
|
1176
|
+
></nr-icon>`}static renderNumberIcons(t,i,s,o,n,a,h){return"number"!==t?r:e`
|
|
1176
1177
|
<div id="number-icons">
|
|
1177
|
-
${"default"!==e
|
|
1178
|
+
${"default"!==i?e`<span id="icons-separator">|</span>`:r}
|
|
1178
1179
|
<nr-icon
|
|
1179
1180
|
name="minus"
|
|
1180
1181
|
aria-label="Decrease value"
|
|
@@ -1198,7 +1199,7 @@ class pt{static validateNumericProperties(t,i,e,s){"number"===t&&(i&&Number.isNa
|
|
|
1198
1199
|
* @license
|
|
1199
1200
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1200
1201
|
* SPDX-License-Identifier: MIT
|
|
1201
|
-
*/const
|
|
1202
|
+
*/const gt=t=>class extends t{get inputElement(){var t;const e=this.querySelector("#input, input, textarea");if(e)return e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#input, input, textarea");if(i)return i;throw new Error("SelectionMixin requires an input or textarea element")}selectAll(){const t=this.inputElement;t&&t.select()}selectRange(t,e){const i=this.inputElement;i&&i.setSelectionRange&&(i.focus(),i.setSelectionRange(t,e))}getCursorPosition(){const t=this.inputElement;return t&&"number"==typeof t.selectionStart?t.selectionStart:null}setCursorPosition(t){const e=this.inputElement;e&&e.setSelectionRange&&(e.focus(),e.setSelectionRange(t,t))}getSelectedText(){const t=this.inputElement;return t&&null!==t.selectionStart&&null!==t.selectionEnd?t.value.substring(t.selectionStart,t.selectionEnd):""}},mt=t=>class extends t{get inputElement(){var t;const e=this.querySelector("#input, input, textarea");if(e)return e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#input, input, textarea");if(i)return i;throw new Error("FocusMixin requires an input or textarea element")}focus(t={}){const e=this.inputElement;e&&(e.focus({preventScroll:t.preventScroll}),t.selectText&&e.select())}blur(){const t=this.inputElement;t&&t.blur()}isFocused(){const t=this.inputElement;return!!t&&document.activeElement===t}},ft=t=>class extends t{get inputElement(){var t;const e=this.querySelector("#input, input");if(e)return e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#input, input");if(i)return i;throw new Error("NumberMixin requires an input element")}dispatchInputEvent(t,e){"_dispatchInputEvent"in this&&"function"==typeof this._dispatchInputEvent?this._dispatchInputEvent(t,e):this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}increment(){try{const t=this.inputElement;if(!t.value){const e=t.getAttribute("min");t.value=e||"0"}t.stepUp();const e=t.value;this.dispatchInputEvent("nr-input",{value:e,target:t,action:"increment"}),"value"in this&&(this.value=e)}catch(t){console.warn("Failed to increment value:",t),this.dispatchInputEvent("nr-increment-error",{error:t,value:this.inputElement.value,target:this.inputElement})}}decrement(){try{const t=this.inputElement;t.stepDown();const e=t.value;this.dispatchInputEvent("nr-input",{value:e,target:t,action:"decrement"}),"value"in this&&(this.value=e)}catch(t){console.warn("Failed to decrement value:",t),this.dispatchInputEvent("nr-decrement-error",{error:t,value:this.inputElement.value,target:this.inputElement})}}setStep(t){const e=this.inputElement;t&&this.isValidStep(t)?e.setAttribute("step",t):e.removeAttribute("step")}isValidStep(t){if(!t)return!0;const e=Number.parseFloat(t);return!Number.isNaN(e)&&e>0}};
|
|
1202
1203
|
/**
|
|
1203
1204
|
* @license
|
|
1204
1205
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -1214,18 +1215,18 @@ class bt extends J{}
|
|
|
1214
1215
|
* @license
|
|
1215
1216
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1216
1217
|
* SPDX-License-Identifier: MIT
|
|
1217
|
-
*/var vt;!function(t){t.Pristine="pristine",t.Pending="pending",t.Valid="valid",t.Invalid="invalid",t.Warning="warning"}(vt||(vt={}));class wt extends bt{constructor(){super(...arguments),this._validationState=vt.Pristine,this._isValidating=!1,this._isValid=!0,this._validationMessage="",this._validationResult={isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1},this._debounceTimer=null}get stateHost(){return this.host}get validationState(){return this._validationState}get isValidating(){return this._isValidating}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationResult(){return this._validationResult}setValidationState(t){if(this._validationState!==t){const
|
|
1218
|
+
*/var vt;!function(t){t.Pristine="pristine",t.Pending="pending",t.Valid="valid",t.Invalid="invalid",t.Warning="warning"}(vt||(vt={}));class wt extends bt{constructor(){super(...arguments),this._validationState=vt.Pristine,this._isValidating=!1,this._isValid=!0,this._validationMessage="",this._validationResult={isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1},this._debounceTimer=null}get stateHost(){return this.host}get validationState(){return this._validationState}get isValidating(){return this._isValidating}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationResult(){return this._validationResult}setValidationState(t){if(this._validationState!==t){const e=this._validationState;this._validationState=t,this.dispatchStateChangeEvent(e,t),this.requestUpdate()}}setValidationResult(t){this._validationResult=t,this._isValid=t.isValid,this._validationMessage=t.hasError?t.errorMessage||"":t.hasWarning&&t.warningMessage||"";let e=vt.Valid;t.hasError?e=vt.Invalid:t.hasWarning&&this.stateHost.allowWarnings&&(e=vt.Warning),this.setValidationState(e)}setValidating(t){this._isValidating!==t&&(this._isValidating=t,t&&this.setValidationState(vt.Pending),this.requestUpdate())}shouldValidateOnChange(){return this.stateHost.validateOnChangeInput&&("change"===this.stateHost.validationTrigger||this._validationState!==vt.Pristine)}shouldValidateOnBlur(){return this.stateHost.validateOnBlurInput&&("blur"===this.stateHost.validationTrigger||"change"===this.stateHost.validationTrigger)}clearDebounceTimer(){null!==this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}debounceValidation(t){this.clearDebounceTimer();const e=this.stateHost.validationDebounce;e&&e>0?this._debounceTimer=window.setTimeout(()=>{this._debounceTimer=null,t()},e):t()}resetValidationState(){this.clearDebounceTimer(),this._validationState=vt.Pristine,this._isValidating=!1,this._isValid=!0,this._validationMessage="",this._validationResult={isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1},this.requestUpdate()}markAsTouched(){this._validationState===vt.Pristine&&this.setValidationState(vt.Valid)}isPristine(){return this._validationState===vt.Pristine}hasError(){return this._validationState===vt.Invalid}hasWarning(){return this._validationState===vt.Warning}isPending(){return this._validationState===vt.Pending}getStateSummary(){return{state:this._validationState,isValidating:this._isValidating,isValid:this._isValid,message:this._validationMessage,result:this._validationResult,isPristine:this.isPristine(),hasError:this.hasError(),hasWarning:this.hasWarning(),shouldValidateOnChange:this.shouldValidateOnChange(),shouldValidateOnBlur:this.shouldValidateOnBlur()}}hostDisconnected(){super.hostDisconnected(),this.clearDebounceTimer()}dispatchStateChangeEvent(t,e){this.dispatchEvent(new CustomEvent("nr-validation-state-change",{detail:{previousState:t,newState:e,isValidating:this._isValidating,isValid:this._isValid,validationResult:this._validationResult},bubbles:!0,composed:!0}))}}
|
|
1218
1219
|
/**
|
|
1219
1220
|
* @license
|
|
1220
1221
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1221
1222
|
* SPDX-License-Identifier: MIT
|
|
1222
|
-
*/var yt=function(t,i,e,s){return new(e||(e=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var i;t.done?r(t.value):(i=t.value,i instanceof e?i:new e(function(t){t(i)})).then(n,a)}h((s=s.apply(t,i||[])).next())})};class xt extends Q{constructor(){super(...arguments),this.stateController=new wt(this._host)}get validationHost(){return this._host}get isValid(){return this.stateController.isValid}get validationMessage(){return this.stateController.validationMessage}get validationState(){return this.stateController.validationState}get validationResult(){return this.stateController.validationResult}get isValidating(){return this.stateController.isValidating}hostConnected(){this.setupValidationRules()}hostUpdated(){}setupValidationRules(){const t=[],i=this.validationHost;"email"===i.type&&t.push(at()),"url"===i.type&&t.push(ht()),i.required&&t.push(nt(i.label?`${i.label} is required`:void 0)),i.maxLength&&t.push(lt(i.maxLength)),"number"===i.type&&(void 0!==i.min&&t.push(ct(Number(i.min))),void 0!==i.max&&t.push(dt(Number(i.max))));const e=i.rules||[],s=[...t.filter(t=>!e.some(i=>this.isSameRuleType(t,i))),...e];JSON.stringify(i.rules)!==JSON.stringify(s)&&(i.rules=s,this.requestUpdate())}validate(){try{this.stateController.setValidationState(vt.Pending),this.stateController.setValidating(!0),this.dispatchInputValidationEvent();if(this.hasAsyncValidators())return this.performAsyncValidation(this.validationHost.value),!0;const t=this.performDetailedValidation(this.validationHost.value);return this.stateController.setValidationResult(t),t.hasError?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):t.hasWarning&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):this.setValidationResult(!0,"",vt.Valid),this.stateController.setValidating(!1),this.updateHostValidationState(),t.isValid}catch(t){return this.handleError(t,"validate"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Validation error occurred",vt.Invalid),this.updateHostValidationState(),!1}}validateOnChange(){this.stateController.shouldValidateOnChange()&&this.stateController.debounceValidation(()=>{this.validate()})}validateOnBlur(){this.stateController.shouldValidateOnBlur()&&(this.stateController.clearDebounceTimer(),this.validate())}addInputRule(t){const i=this.validationHost.rules||[];this.validationHost.rules=[...i,t],this.requestUpdate()}removeInputRule(t){const i=this.validationHost.rules||[];this.validationHost.rules=i.filter(i=>!t(i)),this.requestUpdate()}clearInputRules(){this.validationHost.rules=[],this.reset()}hasAsyncValidators(){return(this.validationHost.rules||[]).some(t=>t.asyncValidator||t.validator&&this.isValidatorAsync(t.validator))}isValidatorAsync(t){const i=t.toString();return i.includes("Promise")||i.includes("async")||i.includes("setTimeout")||i.includes("new Promise")}performAsyncValidation(t){return yt(this,void 0,void 0,function*(){try{this.stateController.setValidating(!0),this.updateHostValidationState();const i=[],e=[],s=this.validationHost.rules||[];for(const r of s)if(!(r.asyncValidator||r.validator&&this.isValidatorAsync(r.validator))){const s=this.validateRule(r,t);s.isValid||(r.warningOnly&&this.validationHost.allowWarnings?e.push(s.message):i.push(s.message))}if(i.length>0)return this.stateController.setValidationResult({isValid:!1,errors:i,warnings:e,hasError:!0,hasWarning:e.length>0,errorMessage:i[0],warningMessage:e[0]}),this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid),this.stateController.setValidating(!1),void this.updateHostValidationState();for(const r of s)if(r.asyncValidator||r.validator&&this.isValidatorAsync(r.validator))try{yield this.validateAsyncRule(r,t)}catch(t){const s=t.message||r.message||"Validation failed";r.warningOnly&&this.validationHost.allowWarnings?e.push(s):i.push(s)}const r=i.length>0,o=e.length>0;this.stateController.setValidationResult({isValid:!r,errors:i,warnings:e,hasError:r,hasWarning:o,errorMessage:i[0],warningMessage:e[0]}),r?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):o&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):this.setValidationResult(!0,"",vt.Valid),this.stateController.setValidating(!1),this.updateHostValidationState()}catch(t){this.handleError(t,"performAsyncValidation"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Async validation error occurred",vt.Invalid),this.updateHostValidationState()}})}validateAsyncRule(t,i){return yt(this,void 0,void 0,function*(){if(t.asyncValidator)yield t.asyncValidator(t,i);else if(t.validator){const e=t.validator(t,i);e&&"object"==typeof e&&"then"in e&&(yield e)}})}reset(){this.stateController.setValidationResult({isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1}),this.stateController.setValidationState(vt.Pristine),this.stateController.setValidating(!1),this.updateHostValidationState(),this.dispatchInputValidationEvent()}getValidationStatus(){return{isValid:this.stateController.validationResult.isValid,isValidating:this.stateController.isValidating,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult}}setValidationStatus(t){this.stateController.setValidationResult(t),t.hasError?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):t.hasWarning?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):t.isValid?this.setValidationResult(!0,"",vt.Valid):this.setValidationResult(!0,"",vt.Pristine),this.updateHostValidationState()}performDetailedValidation(t){const i=[],e=[],s=this.validationHost.rules||[];for(const r of s){const s=this.validateRule(r,t);s.isValid||(r.warningOnly&&this.validationHost.allowWarnings?e.push(s.message):i.push(s.message))}const r=i.length>0;return{isValid:!r,errors:i,warnings:e,hasError:r,hasWarning:e.length>0,errorMessage:i[0],warningMessage:e[0]}}validateRule(t,i){if(t.asyncValidator||t.validator&&this.isValidatorAsync(t.validator))return{isValid:!0,message:""};const e=t.transform?t.transform(i):i;if(t.required&&this.isValueEmpty(i))return{isValid:!1,message:t.message||`${this.validationHost.label||"This field"} is required`};if(this.isValueEmpty(i)&&!t.required)return{isValid:!0,message:""};if(t.type){const i=this.validateType(t.type,e);if(!i.isValid)return{isValid:!1,message:t.message||i.message}}if(t.pattern&&!t.pattern.test(e))return{isValid:!1,message:t.message||"Invalid format"};if(void 0!==t.minLength&&e.length<t.minLength)return{isValid:!1,message:t.message||`Minimum length is ${t.minLength} characters`};if(void 0!==t.maxLength&&e.length>t.maxLength)return{isValid:!1,message:t.message||`Maximum length is ${t.maxLength} characters`};if("number"===t.type||"number"===this.validationHost.type){const i=Number(e);if(void 0!==t.min&&i<t.min)return{isValid:!1,message:t.message||`Minimum value is ${t.min}`};if(void 0!==t.max&&i>t.max)return{isValid:!1,message:t.message||`Maximum value is ${t.max}`}}if(t.enum&&!t.enum.includes(e))return{isValid:!1,message:t.message||`Value must be one of: ${t.enum.join(", ")}`};if(t.validator)try{const i=t.validator(t,e);return i&&"object"==typeof i&&"isValid"in i?{isValid:i.isValid,message:i.isValid?"":i.message||t.message||"Validation failed"}:{isValid:!0,message:""}}catch(i){return{isValid:!1,message:t.message||i.message||"Validation failed"}}return{isValid:!0,message:""}}validateType(t,i){switch(t){case"email":return{isValid:ot.EMAIL.test(i),message:"Please enter a valid email address"};case"url":return{isValid:ot.URL.test(i),message:"Please enter a valid URL"};case"number":case"integer":return{isValid:!Number.isNaN(Number(i))&&("number"===t||Number.isInteger(Number(i))),message:`Please enter a valid ${t}`};case"float":return{isValid:!Number.isNaN(Number.parseFloat(i)),message:"Please enter a valid number"};default:return{isValid:!0,message:""}}}isValueEmpty(t){return null==t||""===t}isSameRuleType(t,i){return t.type===i.type&&t.required===i.required&&!!t.pattern==!!i.pattern}setValidationResult(t,i,e){const s=this.stateController.isValid!==t||this.stateController.validationMessage!==i||this.stateController.validationState!==e;this.stateController.setValidationState(e),this.stateController.setValidationResult({isValid:t,errors:t?[]:[i],warnings:[],hasError:!t,hasWarning:!1,errorMessage:t?"":i,warningMessage:""}),this._isValid=t,this._validationMessage=i,this._validationState=e,s&&this.dispatchInputValidationEvent()}updateHostValidationState(){this.dispatchInputValidationEvent()}dispatchInputValidationEvent(){const t={isValid:this.stateController.isValid,validationMessage:this.stateController.validationMessage,validationState:this.stateController.validationState,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}getValidationClasses(){const t=this.host,i=this.host;return{valid:this.stateController.validationResult.isValid&&!this.stateController.validationResult.hasWarning,invalid:this.stateController.validationResult.hasError,warning:this.stateController.validationResult.hasWarning&&!this.stateController.validationResult.hasError,validating:this.stateController.isValidating,"has-feedback":i.hasFeedback||!1,touched:t.isTouched||!1,dirty:t.isDirty||!1,required:this.host.required||!1}}hasValidationFeedback(){const t=this.host;return!!t.hasFeedback&&(this.stateController.isValidating||this.stateController.validationResult.hasError||this.stateController.validationResult.hasWarning||this.stateController.validationResult.isValid&&t.value&&""!==t.value.trim()&&this.stateController.validationState!==vt.Pristine)}renderValidationIcon(){const t=this.host;if(!t.hasFeedback)return"";let e="",s="";return this.stateController.isValidating?(e="hourglass-half",s="validation-loading"):this.stateController.validationResult.hasError?(e="exclamation-circle",s="validation-error"):this.stateController.validationResult.hasWarning?(e="exclamation-triangle",s="validation-warning"):this.stateController.validationResult.isValid&&t.value&&""!==t.value.trim()&&this.stateController.validationState!==vt.Pristine&&(e="check-circle",s="validation-success"),e?i`
|
|
1223
|
+
*/var yt=function(t,e,i,s){return new(i||(i=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}h((s=s.apply(t,e||[])).next())})};class xt extends Q{constructor(){super(...arguments),this.stateController=new wt(this._host)}get validationHost(){return this._host}get isValid(){return this.stateController.isValid}get validationMessage(){return this.stateController.validationMessage}get validationState(){return this.stateController.validationState}get validationResult(){return this.stateController.validationResult}get isValidating(){return this.stateController.isValidating}hostConnected(){this.setupValidationRules()}hostUpdated(){}setupValidationRules(){const t=[],e=this.validationHost;"email"===e.type&&t.push(at()),"url"===e.type&&t.push(ht()),e.required&&t.push(nt(e.label?`${e.label} is required`:void 0)),e.maxLength&&t.push(lt(e.maxLength)),"number"===e.type&&(void 0!==e.min&&t.push(ct(Number(e.min))),void 0!==e.max&&t.push(dt(Number(e.max))));const i=e.rules||[],s=[...t.filter(t=>!i.some(e=>this.isSameRuleType(t,e))),...i];JSON.stringify(e.rules)!==JSON.stringify(s)&&(e.rules=s,this.requestUpdate())}validate(){try{this.stateController.setValidationState(vt.Pending),this.stateController.setValidating(!0),this.dispatchInputValidationEvent();if(this.hasAsyncValidators())return this.performAsyncValidation(this.validationHost.value),!0;const t=this.performDetailedValidation(this.validationHost.value);return this.stateController.setValidationResult(t),t.hasError?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):t.hasWarning&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):this.setValidationResult(!0,"",vt.Valid),this.stateController.setValidating(!1),this.updateHostValidationState(),t.isValid}catch(t){return this.handleError(t,"validate"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Validation error occurred",vt.Invalid),this.updateHostValidationState(),!1}}validateOnChange(){this.stateController.shouldValidateOnChange()&&this.stateController.debounceValidation(()=>{this.validate()})}validateOnBlur(){this.stateController.shouldValidateOnBlur()&&(this.stateController.clearDebounceTimer(),this.validate())}addInputRule(t){const e=this.validationHost.rules||[];this.validationHost.rules=[...e,t],this.requestUpdate()}removeInputRule(t){const e=this.validationHost.rules||[];this.validationHost.rules=e.filter(e=>!t(e)),this.requestUpdate()}clearInputRules(){this.validationHost.rules=[],this.reset()}hasAsyncValidators(){return(this.validationHost.rules||[]).some(t=>t.asyncValidator||t.validator&&this.isValidatorAsync(t.validator))}isValidatorAsync(t){const e=t.toString();return e.includes("Promise")||e.includes("async")||e.includes("setTimeout")||e.includes("new Promise")}performAsyncValidation(t){return yt(this,void 0,void 0,function*(){try{this.stateController.setValidating(!0),this.updateHostValidationState();const e=[],i=[],s=this.validationHost.rules||[];for(const r of s)if(!(r.asyncValidator||r.validator&&this.isValidatorAsync(r.validator))){const s=this.validateRule(r,t);s.isValid||(r.warningOnly&&this.validationHost.allowWarnings?i.push(s.message):e.push(s.message))}if(e.length>0)return this.stateController.setValidationResult({isValid:!1,errors:e,warnings:i,hasError:!0,hasWarning:i.length>0,errorMessage:e[0],warningMessage:i[0]}),this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid),this.stateController.setValidating(!1),void this.updateHostValidationState();for(const r of s)if(r.asyncValidator||r.validator&&this.isValidatorAsync(r.validator))try{yield this.validateAsyncRule(r,t)}catch(t){const s=t.message||r.message||"Validation failed";r.warningOnly&&this.validationHost.allowWarnings?i.push(s):e.push(s)}const r=e.length>0,o=i.length>0;this.stateController.setValidationResult({isValid:!r,errors:e,warnings:i,hasError:r,hasWarning:o,errorMessage:e[0],warningMessage:i[0]}),r?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):o&&this.validationHost.allowWarnings?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):this.setValidationResult(!0,"",vt.Valid),this.stateController.setValidating(!1),this.updateHostValidationState()}catch(t){this.handleError(t,"performAsyncValidation"),this.stateController.setValidating(!1),this.setValidationResult(!1,"Async validation error occurred",vt.Invalid),this.updateHostValidationState()}})}validateAsyncRule(t,e){return yt(this,void 0,void 0,function*(){if(t.asyncValidator)yield t.asyncValidator(t,e);else if(t.validator){const i=t.validator(t,e);i&&"object"==typeof i&&"then"in i&&(yield i)}})}reset(){this.stateController.setValidationResult({isValid:!0,errors:[],warnings:[],hasError:!1,hasWarning:!1}),this.stateController.setValidationState(vt.Pristine),this.stateController.setValidating(!1),this.updateHostValidationState(),this.dispatchInputValidationEvent()}getValidationStatus(){return{isValid:this.stateController.validationResult.isValid,isValidating:this.stateController.isValidating,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult}}setValidationStatus(t){this.stateController.setValidationResult(t),t.hasError?this.setValidationResult(!1,this.stateController.validationMessage,vt.Invalid):t.hasWarning?this.setValidationResult(!0,this.stateController.validationMessage,vt.Warning):t.isValid?this.setValidationResult(!0,"",vt.Valid):this.setValidationResult(!0,"",vt.Pristine),this.updateHostValidationState()}performDetailedValidation(t){const e=[],i=[],s=this.validationHost.rules||[];for(const r of s){const s=this.validateRule(r,t);s.isValid||(r.warningOnly&&this.validationHost.allowWarnings?i.push(s.message):e.push(s.message))}const r=e.length>0;return{isValid:!r,errors:e,warnings:i,hasError:r,hasWarning:i.length>0,errorMessage:e[0],warningMessage:i[0]}}validateRule(t,e){if(t.asyncValidator||t.validator&&this.isValidatorAsync(t.validator))return{isValid:!0,message:""};const i=t.transform?t.transform(e):e;if(t.required&&this.isValueEmpty(e))return{isValid:!1,message:t.message||`${this.validationHost.label||"This field"} is required`};if(this.isValueEmpty(e)&&!t.required)return{isValid:!0,message:""};if(t.type){const e=this.validateType(t.type,i);if(!e.isValid)return{isValid:!1,message:t.message||e.message}}if(t.pattern&&!t.pattern.test(i))return{isValid:!1,message:t.message||"Invalid format"};if(void 0!==t.minLength&&i.length<t.minLength)return{isValid:!1,message:t.message||`Minimum length is ${t.minLength} characters`};if(void 0!==t.maxLength&&i.length>t.maxLength)return{isValid:!1,message:t.message||`Maximum length is ${t.maxLength} characters`};if("number"===t.type||"number"===this.validationHost.type){const e=Number(i);if(void 0!==t.min&&e<t.min)return{isValid:!1,message:t.message||`Minimum value is ${t.min}`};if(void 0!==t.max&&e>t.max)return{isValid:!1,message:t.message||`Maximum value is ${t.max}`}}if(t.enum&&!t.enum.includes(i))return{isValid:!1,message:t.message||`Value must be one of: ${t.enum.join(", ")}`};if(t.validator)try{const e=t.validator(t,i);return e&&"object"==typeof e&&"isValid"in e?{isValid:e.isValid,message:e.isValid?"":e.message||t.message||"Validation failed"}:{isValid:!0,message:""}}catch(e){return{isValid:!1,message:t.message||e.message||"Validation failed"}}return{isValid:!0,message:""}}validateType(t,e){switch(t){case"email":return{isValid:ot.EMAIL.test(e),message:"Please enter a valid email address"};case"url":return{isValid:ot.URL.test(e),message:"Please enter a valid URL"};case"number":case"integer":return{isValid:!Number.isNaN(Number(e))&&("number"===t||Number.isInteger(Number(e))),message:`Please enter a valid ${t}`};case"float":return{isValid:!Number.isNaN(Number.parseFloat(e)),message:"Please enter a valid number"};default:return{isValid:!0,message:""}}}isValueEmpty(t){return null==t||""===t}isSameRuleType(t,e){return t.type===e.type&&t.required===e.required&&!!t.pattern==!!e.pattern}setValidationResult(t,e,i){const s=this.stateController.isValid!==t||this.stateController.validationMessage!==e||this.stateController.validationState!==i;this.stateController.setValidationState(i),this.stateController.setValidationResult({isValid:t,errors:t?[]:[e],warnings:[],hasError:!t,hasWarning:!1,errorMessage:t?"":e,warningMessage:""}),this._isValid=t,this._validationMessage=e,this._validationState=i,s&&this.dispatchInputValidationEvent()}updateHostValidationState(){this.dispatchInputValidationEvent()}dispatchInputValidationEvent(){const t={isValid:this.stateController.isValid,validationMessage:this.stateController.validationMessage,validationState:this.stateController.validationState,errors:this.stateController.validationResult.errors,warnings:this.stateController.validationResult.warnings,validationResult:this.stateController.validationResult};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}getValidationClasses(){const t=this.host,e=this.host;return{valid:this.stateController.validationResult.isValid&&!this.stateController.validationResult.hasWarning,invalid:this.stateController.validationResult.hasError,warning:this.stateController.validationResult.hasWarning&&!this.stateController.validationResult.hasError,validating:this.stateController.isValidating,"has-feedback":e.hasFeedback||!1,touched:t.isTouched||!1,dirty:t.isDirty||!1,required:this.host.required||!1}}hasValidationFeedback(){const t=this.host;return!!t.hasFeedback&&(this.stateController.isValidating||this.stateController.validationResult.hasError||this.stateController.validationResult.hasWarning||this.stateController.validationResult.isValid&&t.value&&""!==t.value.trim()&&this.stateController.validationState!==vt.Pristine)}renderValidationIcon(){const t=this.host;if(!t.hasFeedback)return"";let i="",s="";return this.stateController.isValidating?(i="hourglass-half",s="validation-loading"):this.stateController.validationResult.hasError?(i="exclamation-circle",s="validation-error"):this.stateController.validationResult.hasWarning?(i="exclamation-triangle",s="validation-warning"):this.stateController.validationResult.isValid&&t.value&&""!==t.value.trim()&&this.stateController.validationState!==vt.Pristine&&(i="check-circle",s="validation-success"),i?e`
|
|
1223
1224
|
<nr-icon
|
|
1224
|
-
name="${
|
|
1225
|
+
name="${i}"
|
|
1225
1226
|
class="validation-icon ${s}"
|
|
1226
1227
|
part="validation-icon">
|
|
1227
1228
|
</nr-icon>
|
|
1228
|
-
`:""}renderValidationMessage(){const t=this.stateController.validationResult.hasError,
|
|
1229
|
+
`:""}renderValidationMessage(){const t=this.stateController.validationResult.hasError,i=this.stateController.validationResult.hasWarning&&!t,s=t?this.stateController.validationResult.errorMessage:i?this.stateController.validationResult.warningMessage:"";return s?e`
|
|
1229
1230
|
<div class="validation-message ${t?"error":"warning"}"
|
|
1230
1231
|
part="validation-message"
|
|
1231
1232
|
role="alert"
|
|
@@ -1237,17 +1238,17 @@ class bt extends J{}
|
|
|
1237
1238
|
* @license
|
|
1238
1239
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1239
1240
|
* SPDX-License-Identifier: MIT
|
|
1240
|
-
*/var kt=function(t,i,
|
|
1241
|
+
*/var kt=function(t,e,i,s){return new(i||(i=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}h((s=s.apply(t,e||[])).next())})};class _t extends bt{constructor(){super(...arguments),this.debounceTimer=null,this.handleKeyDown=t=>{!this.eventHost.readonly||this.isReadonlyKeyAllowed(t)?"Enter"!==t.key?"number"===this.eventHost.type&&this.handleNumericKeyDown(t):this.dispatchEnterEvent(t):t.preventDefault()},this.handleValueChange=t=>{if(this.eventHost.readonly)return void t.preventDefault();const e=t.target,i=e.value;if(this.eventHost.maxLength&&i.length>this.eventHost.maxLength)return void t.preventDefault();"number"===this.eventHost.type&&i&&this.validateNumericValue(i,t),this.eventHost.value=i;const s=this.eventHost;s.validationController&&"function"==typeof s.validationController.validateOnChange&&s.validationController.validateOnChange();const r=this.eventHost.debounce||0;r>0?(this.clearDebounceTimer(),this.debounceTimer=setTimeout(()=>{this.eventHost.dispatchInputEvent("nr-input",{value:this.eventHost.value,target:e,originalEvent:t})},r)):this.eventHost.dispatchInputEvent("nr-input",{value:this.eventHost.value,target:e,originalEvent:t})},this.handleFocus=t=>{var e;this.setFocusState(!0);const i=t.target;this.restoreCursorPosition(i);const s={focused:!0,cursorPosition:null!==(e=this.getCursorPosition())&&void 0!==e?e:void 0,selectedText:this.getSelectedText()};this.eventHost.dispatchFocusEvent("nr-focus",Object.assign({target:t.target,value:this.eventHost.value},s)),this.eventHost.dispatchFocusEvent("nr-focus-change",s)},this.handleBlur=t=>{var e;this.setFocusState(!1);const i={focused:!1,cursorPosition:null!==(e=this.getCursorPosition())&&void 0!==e?e:void 0,selectedText:this.getSelectedText()},s=this.eventHost;s.validationController&&"function"==typeof s.validationController.validateOnBlur&&s.validationController.validateOnBlur(),this.eventHost.dispatchFocusEvent("nr-blur",Object.assign({target:t.target,value:this.eventHost.value},i)),this.eventHost.dispatchFocusEvent("nr-focus-change",i)},this.handleIconKeydown=t=>{if(!this.isActivationKey(t))return;t.preventDefault();const e=t.target;switch(e.id){case"copy-icon":this.handleCopy();break;case"clear-icon":this.handleClear();break;case"password-icon":this.handleTogglePassword();break;default:e.closest("#number-icons")&&this.handleNumberIconAction(e)}},this.handleCopy=()=>kt(this,void 0,void 0,function*(){if(this.eventHost.withCopy&&!this.eventHost.disabled)try{const t=this.inputElement;if(!t)return;t.select(),yield navigator.clipboard.writeText(t.value),this.eventHost.dispatchActionEvent("nr-copy-success",{value:t.value,action:"copy"})}catch(t){this.handleError(t,"copy"),this.eventHost.dispatchActionEvent("nr-copy-error",{error:t,action:"copy"})}}),this.handleClear=()=>{if(this.eventHost.disabled||this.eventHost.readonly||!this.eventHost.allowClear)return;const t=this.eventHost.value;this.eventHost.value="";const e=this.inputElement;e&&(e.value="",e.focus()),this.eventHost.dispatchActionEvent("nr-clear",{previousValue:t,newValue:this.eventHost.value,target:e,action:"clear"}),this.eventHost.dispatchInputEvent("nr-input",{value:this.eventHost.value,target:e,action:"clear"})},this.handleTogglePassword=()=>{if("password"!==this.eventHost.type)return;const t="password"===this.eventHost.inputType?"text":"password";this.eventHost.inputType=t,this.requestUpdate(),this.eventHost.dispatchActionEvent("nr-password-toggle",{visible:"text"===t,action:"password-toggle"})},this.handleIncrement=()=>{"number"===this.eventHost.type&&this.eventHost.increment&&this.eventHost.increment()},this.handleDecrement=()=>{"number"===this.eventHost.type&&this.eventHost.decrement&&this.eventHost.decrement()}}get eventHost(){return this.host}get inputElement(){var t,e;return(null===(e=(t=this.eventHost).querySelector)||void 0===e?void 0:e.call(t,"#input"))||null}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}handleNumericKeyDown(t){["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)||t.ctrlKey||t.metaKey||"."!==t.key&&"-"!==t.key&&(/^\d$/.test(t.key)||t.preventDefault())}handleNumberIconAction(t){const e=t.classList.contains("increment")||t.closest(".increment"),i=t.classList.contains("decrement")||t.closest(".decrement");e?this.handleIncrement():i&&this.handleDecrement()}dispatchEnterEvent(t){this.eventHost.dispatchInputEvent("nr-enter",{value:this.eventHost.value,target:t.target,originalEvent:t})}validateNumericValue(t,e){}restoreCursorPosition(t){if(t.dataset.restoreCursor){const e=Number.parseInt(t.dataset.restoreCursor,10);Number.isNaN(e)||t.setSelectionRange(e,e),delete t.dataset.restoreCursor}}setFocusState(t){this.eventHost.hasOwnProperty("focused")&&(this.eventHost.focused=t,this.requestUpdate())}getCursorPosition(){if(this.eventHost.getCursorPosition)return this.eventHost.getCursorPosition();const t=this.inputElement;return t?t.selectionStart:null}getSelectedText(){if(this.eventHost.getSelectedText)return this.eventHost.getSelectedText();const t=this.inputElement;return t&&null!==t.selectionStart&&null!==t.selectionEnd?t.value.substring(t.selectionStart,t.selectionEnd):""}isReadonlyKeyAllowed(t){if(this.eventHost.isReadonlyKeyAllowed)return this.eventHost.isReadonlyKeyAllowed(t);return t.ctrlKey||t.metaKey?["KeyA","KeyC"].includes(t.code):["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return this.eventHost.isActivationKey?this.eventHost.isActivationKey(t):"Enter"===t.key||" "===t.key}}
|
|
1241
1242
|
/**
|
|
1242
1243
|
* @license
|
|
1243
1244
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1244
1245
|
* SPDX-License-Identifier: MIT
|
|
1245
|
-
*/var Mt=function(t,i,
|
|
1246
|
+
*/var Mt=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n},zt=function(t,e,i,s){return new(i||(i=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}h((s=s.apply(t,e||[])).next())})};let $t=class extends(ft(mt(gt(z(i))))){constructor(){super(...arguments),this.validationController=new xt(this),this.eventController=new _t(this),this.disabled=!1,this.readonly=!1,this.state="default",this.value="",this.size="medium",this.variant="outlined",this.type="text",this.placeholder="",this.autocomplete="off",this.withCopy=!1,this.allowClear=!1,this.showCount=!1,this.rules=[],this.validateOnChangeInput=!0,this.validateOnBlurInput=!0,this.hasFeedback=!1,this.allowWarnings=!1,this.validationTrigger="change",this.debounce=0,this.inputType="",this.hasAddonBefore=!1,this.hasAddonAfter=!1,this.focused=!1,this.requiredComponents=["nr-icon"],this._handleValidationEvent=t=>{const e=t.detail;this.validationMessage=e.validationMessage||"";let i="default";e.validationResult.hasError?i="error":e.validationResult.hasWarning&&this.allowWarnings?i="warning":e.validationResult.isValid&&this.value&&this.hasFeedback&&(i="success"),this.state!==i&&(this.state=i),this.requestUpdate()},this._handleKeyDown=t=>{this.eventController.handleKeyDown(t)},this._valueChange=t=>{this.eventController.handleValueChange(t)},this._focusEvent=t=>{this.eventController.handleFocus(t)},this._blurEvent=t=>{this.eventController.handleBlur(t)},this._handleIconKeydown=t=>{this.eventController.handleIconKeydown(t)}}get _input(){return this.renderRoot.querySelector("#input")}get characterCountDisplay(){const t=this.value.length;return this.maxLength?`${t}/${this.maxLength}`:`${t}`}get isOverCharacterLimit(){return!!this.maxLength&&this.value.length>this.maxLength}get input(){return this._input}get inputElement(){return this._input}connectedCallback(){super.connectedCallback(),this.addEventListener("nr-validation",this._handleValidationEvent)}disconnectedCallback(){var t,e,i,s;super.disconnectedCallback(),this.removeEventListener("nr-validation",this._handleValidationEvent),null===(e=(t=this.validationController).clearDebounceTimer)||void 0===e||e.call(t),null===(s=(i=this.eventController).clearDebounceTimer)||void 0===s||s.call(i)}willUpdate(t){super.willUpdate(t),!t.has("type")&&this.inputType||(this.inputType=this.type),(t.has("type")||t.has("min"))&&"number"===this.type&&this.min&&!this.value&&(this.value=this.min),(t.has("type")||t.has("min")||t.has("max")||t.has("step"))&&pt.validateNumericProperties(this.type,this.min,this.max,this.step),(t.has("type")||t.has("required")||t.has("maxLength")||t.has("min")||t.has("max"))&&this.validationController.setupValidationRules()}updated(t){if(t.has("step")||t.has("min")||t.has("max")||t.has("maxLength")){const t=this.input;t&&(this.setStep(this.step),this.min?t.setAttribute("min",this.min):t.removeAttribute("min"),this.max?t.setAttribute("max",this.max):t.removeAttribute("max"),this.maxLength?t.setAttribute("maxlength",this.maxLength.toString()):t.removeAttribute("maxlength"))}if(t.has("value")){const t=this.input;t&&t.value!==this.value&&(t.value=this.value)}}firstUpdated(){this._checkInitialSlotContent()}_checkInitialSlotContent(){var t,e;const i=this.renderRoot.querySelector('slot[name="addon-before"]');this.hasAddonBefore=(null!==(t=null==i?void 0:i.assignedElements())&&void 0!==t?t:[]).length>0;const s=this.renderRoot.querySelector('slot[name="addon-after"]');this.hasAddonAfter=(null!==(e=null==s?void 0:s.assignedElements())&&void 0!==e?e:[]).length>0}_onCopy(){return zt(this,void 0,void 0,function*(){yield this.eventController.handleCopy()})}_onClear(){this.eventController.handleClear()}_increment(){this.eventController.handleIncrement()}_decrement(){this.eventController.handleDecrement()}_togglePasswordIcon(){this.eventController.handleTogglePassword()}_getAriaDescribedBy(){var t;const e=[],i=this.renderRoot.querySelector('slot[name="helper-text"]');return(null!==(t=null==i?void 0:i.assignedElements())&&void 0!==t?t:[]).length>0&&e.push("helper-text"),e.join(" ")||""}validateValue(t){return this.validationController.validate()}addRule(t){this.validationController.addInputRule(t)}removeRule(t){this.validationController.removeInputRule(t)}clearRules(){this.validationController.clearInputRules()}getValidationStatus(){return this.validationController.getValidationStatus()}validateInput(){return zt(this,void 0,void 0,function*(){const t=this.validationController.validate();return this.validationController.isValidating?new Promise(t=>{const e=()=>{this.validationController.isValidating?setTimeout(e,50):t(this.validationController.isValid)};e()}):t})}setValidationStatus(t){this.validationController.setValidationStatus(t)}getValidationClasses(){return this.validationController.getValidationClasses()}renderValidationIcon(){return this.validationController.renderValidationIcon()}renderValidationMessage(){return this.validationController.renderValidationMessage()}render(){const t=this.getValidationClasses(),i=this.validationController.getValidationRenderState();return e`
|
|
1246
1247
|
<slot name="label" part="label"></slot>
|
|
1247
1248
|
<div class="input-wrapper ${Object.entries(t).filter(([,t])=>t).map(([t])=>t).join(" ")}"
|
|
1248
1249
|
part="input-wrapper"
|
|
1249
|
-
?data-validating="${
|
|
1250
|
-
${this.hasAddonBefore?
|
|
1250
|
+
?data-validating="${i.isValidating}">
|
|
1251
|
+
${this.hasAddonBefore?e`
|
|
1251
1252
|
<div class="input-addon-before" part="addon-before">
|
|
1252
1253
|
<slot name="addon-before"></slot>
|
|
1253
1254
|
</div>
|
|
@@ -1265,7 +1266,7 @@ class bt extends J{}
|
|
|
1265
1266
|
.placeholder=${this.placeholder}
|
|
1266
1267
|
.type="${this.inputType}"
|
|
1267
1268
|
.autocomplete=${this.autocomplete}
|
|
1268
|
-
aria-invalid=${
|
|
1269
|
+
aria-invalid=${i.validationResult.hasError?"true":"false"}
|
|
1269
1270
|
aria-describedby=${this._getAriaDescribedBy()}
|
|
1270
1271
|
@input=${this._valueChange}
|
|
1271
1272
|
@focus=${this._focusEvent}
|
|
@@ -1277,12 +1278,12 @@ class bt extends J{}
|
|
|
1277
1278
|
</div>
|
|
1278
1279
|
${ut.renderCopyIcon(this.withCopy,this.disabled,this.readonly,()=>this._onCopy(),t=>this._handleIconKeydown(t))}
|
|
1279
1280
|
${ut.renderClearIcon(this.allowClear,this.value,this.disabled,this.readonly,()=>this._onClear(),t=>this._handleIconKeydown(t))}
|
|
1280
|
-
${
|
|
1281
|
+
${i.hasValidationFeedback?this.renderValidationIcon():ut.renderStateIcon(this.state)}
|
|
1281
1282
|
${ut.renderCalendarIcon(this.state,this.type)}
|
|
1282
1283
|
${ut.renderPasswordIcon(this.type,this.inputType,this.disabled,this.readonly,()=>this._togglePasswordIcon(),t=>this._handleIconKeydown(t))}
|
|
1283
1284
|
${ut.renderNumberIcons(this.type,this.state,this.disabled,this.readonly,()=>this._increment(),()=>this._decrement(),t=>this._handleIconKeydown(t))}
|
|
1284
1285
|
</div>
|
|
1285
|
-
${this.hasAddonAfter?
|
|
1286
|
+
${this.hasAddonAfter?e`
|
|
1286
1287
|
<div class="input-addon-after" part="addon-after">
|
|
1287
1288
|
<slot name="addon-after"></slot>
|
|
1288
1289
|
</div>
|
|
@@ -1290,7 +1291,7 @@ class bt extends J{}
|
|
|
1290
1291
|
</div>
|
|
1291
1292
|
<slot name="helper-text" part="helper-text"></slot>
|
|
1292
1293
|
${this.renderValidationMessage()}
|
|
1293
|
-
${this.showCount?
|
|
1294
|
+
${this.showCount?e`
|
|
1294
1295
|
<div class="character-count" ?data-over-limit=${this.isOverCharacterLimit}>
|
|
1295
1296
|
${this.characterCountDisplay}
|
|
1296
1297
|
</div>
|
|
@@ -1414,19 +1415,19 @@ class bt extends J{}
|
|
|
1414
1415
|
.svg-icon.clickable:hover,
|
|
1415
1416
|
.svg-icon.clickable:active { transform: none; }
|
|
1416
1417
|
}
|
|
1417
|
-
`],Vt={activity:'<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',anchor:'<path d="M12 22V8"/><path d="M5 12H2a10 10 0 0 0 20 0h-3"/><circle cx="12" cy="5" r="3"/>',"arrow-down":'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',"arrow-up":'<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',"arrow-up-down":'<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',box:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',braces:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',building:'<path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M12 6h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M16 6h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/><path d="M8 6h.01"/><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/><rect x="4" y="2" width="16" height="20" rx="2"/>',calendar:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',check:'<path d="M20 6 9 17l-5-5"/>',"check-square":'<path d="M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344"/><path d="m9 11 3 3L22 4"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-right":'<path d="m9 18 6-6-6-6"/>',"circle-check":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"circle-question":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',"clipboard-list":'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',code:'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',"credit-card":'<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',cube:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',document:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',download:'<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>',edit:'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',"exclamation-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',file:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>',"file-text":'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',filter:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',"folder-plus":'<path d="M12 10v6"/><path d="M9 13h6"/><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',frame:'<line x1="22" x2="2" y1="6" y2="6"/><line x1="22" x2="2" y1="18" y2="18"/><line x1="6" x2="6" y1="2" y2="22"/><line x1="18" x2="18" y1="2" y2="22"/>',"git-branch":'<line x1="6" x2="6" y1="3" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',globe:'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',"grip-vertical":'<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>',hand:'<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',home:'<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',"layout-sidebar":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',loader:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',"log-in":'<path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>',"log-out":'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',logout:'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',"panel-left":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',"square-pen":'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',menu:'<path d="M4 5h16"/><path d="M4 12h16"/><path d="M4 19h16"/>',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',"message-square":'<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',minimize:'<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',minus:'<path d="M5 12h14"/>',"more-vertical":'<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>',"mouse-pointer":'<path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/>',"mouse-pointer-click":'<path d="M14 4.1 12 6"/><path d="m5.1 8-2.9-.8"/><path d="m6 12-1.9 2"/><path d="M7.2 2.2 8 5.1"/><path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/>',navigation:'<polygon points="3 11 22 2 13 21 11 13 3 11"/>',notification:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',"pen-tool":'<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/>',phone:'<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>',play:'<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/>',plus:'<path d="M5 12h14"/><path d="M12 5v14"/>',radio:'<path d="M16.247 7.761a6 6 0 0 1 0 8.478"/><path d="M19.075 4.933a10 10 0 0 1 0 14.134"/><path d="M4.925 19.067a10 10 0 0 1 0-14.134"/><path d="M7.753 16.239a6 6 0 0 1 0-8.478"/><circle cx="12" cy="12" r="2"/>',"redo-2":'<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/>',"refresh-cw":'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',scissors:'<circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/>',search:'<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',"search-x":'<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',share:'<path d="M12 2v13"/><path d="m16 6-4-4-4 4"/><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/>',"shield-check":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',spinner:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',square:'<rect width="18" height="18" x="3" y="3" rx="2"/>',star:'<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',"sticky-note":'<path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"/><path d="M15 3v5a1 1 0 0 0 1 1h5"/>',table:'<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',"thumbs-up":'<path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>',tool:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',trash:'<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trash-2":'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trending-up":'<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',type:'<path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/>',user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',"user-check":'<path d="m16 11 2 2 4-4"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/>',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>',"window-maximize":'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 9h20"/>',warning:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',"zoom-in":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',"zoom-out":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',brain:'<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',circle:'<circle cx="12" cy="12" r="10"/>',clock:'<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',cloud:'<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',diamond:'<path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',"file-minus":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M9 15h6"/>',"gamepad-2":'<line x1="6" x2="10" y1="11" y2="11"/><line x1="8" x2="8" y1="9" y2="13"/><line x1="15" x2="15.01" y1="12" y2="12"/><line x1="18" x2="18.01" y1="10" y2="10"/><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>',"git-merge":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>',"git-pull-request":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M13 6h3a2 2 0 0 1 2 2v7"/><path d="M6 9v12"/>',"hard-drive":'<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>',hash:'<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',hexagon:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>',inbox:'<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',link:'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',list:'<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>',"mail-open":'<path d="M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"/><path d="m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"/>',"message-square-share":'<path d="M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7"/><path d="M16 3h5v5"/><path d="m16 8 5-5"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a6 6 0 0 1-6 6 6 6 0 0 1-6-6V8Z"/>',repeat:'<path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/>',scan:'<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>',shield:'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',"shopping-cart":'<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',shuffle:'<path d="M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22"/><path d="m18 2 4 4-4 4"/><path d="M2 6h1.9c1.5 0 2.9.9 3.6 2.2"/><path d="M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8"/><path d="m18 14 4 4-4 4"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/>',"smile-plus":'<path d="M22 11v1a10 10 0 1 1-9-10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/><path d="M16 5h6"/><path d="M19 2v6"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="1"/>',terminal:'<polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/>',ticket:'<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>',triangle:'<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>',"undo-2":'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>'};
|
|
1418
|
+
`],Vt={activity:'<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',anchor:'<path d="M12 22V8"/><path d="M5 12H2a10 10 0 0 0 20 0h-3"/><circle cx="12" cy="5" r="3"/>',"arrow-down":'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',"arrow-up":'<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',"arrow-up-down":'<path d="m21 16-4 4-4-4"/><path d="M17 20V4"/><path d="m3 8 4-4 4 4"/><path d="M7 4v16"/>',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',box:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',braces:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',building:'<path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M12 6h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M16 6h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/><path d="M8 6h.01"/><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/><rect x="4" y="2" width="16" height="20" rx="2"/>',calendar:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',check:'<path d="M20 6 9 17l-5-5"/>',"check-square":'<path d="M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344"/><path d="m9 11 3 3L22 4"/>',"chevron-down":'<path d="m6 9 6 6 6-6"/>',"chevron-left":'<path d="m15 18-6-6 6-6"/>',"chevron-right":'<path d="m9 18 6-6-6-6"/>',"chevron-up":'<path d="m18 15-6-6-6 6"/>',"circle-check":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"circle-question":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',"clipboard-list":'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',code:'<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',"credit-card":'<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',cube:'<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',document:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',download:'<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>',edit:'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',"exclamation-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',file:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>',"file-text":'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',filter:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',"folder-plus":'<path d="M12 10v6"/><path d="M9 13h6"/><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',frame:'<line x1="22" x2="2" y1="6" y2="6"/><line x1="22" x2="2" y1="18" y2="18"/><line x1="6" x2="6" y1="2" y2="22"/><line x1="18" x2="18" y1="2" y2="22"/>',"git-branch":'<line x1="6" x2="6" y1="3" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',globe:'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',"grip-vertical":'<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>',hand:'<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',home:'<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>',"layout-sidebar":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',loader:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',"log-in":'<path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>',"log-out":'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',logout:'<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',"panel-left":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',"square-pen":'<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',menu:'<path d="M4 5h16"/><path d="M4 12h16"/><path d="M4 19h16"/>',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',"message-square":'<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',minimize:'<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',minus:'<path d="M5 12h14"/>',"more-vertical":'<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>',"mouse-pointer":'<path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/>',"mouse-pointer-click":'<path d="M14 4.1 12 6"/><path d="m5.1 8-2.9-.8"/><path d="m6 12-1.9 2"/><path d="M7.2 2.2 8 5.1"/><path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/>',navigation:'<polygon points="3 11 22 2 13 21 11 13 3 11"/>',notification:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',"pen-tool":'<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/>',phone:'<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>',play:'<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/>',plus:'<path d="M5 12h14"/><path d="M12 5v14"/>',radio:'<path d="M16.247 7.761a6 6 0 0 1 0 8.478"/><path d="M19.075 4.933a10 10 0 0 1 0 14.134"/><path d="M4.925 19.067a10 10 0 0 1 0-14.134"/><path d="M7.753 16.239a6 6 0 0 1 0-8.478"/><circle cx="12" cy="12" r="2"/>',"redo-2":'<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/>',"refresh-cw":'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',scissors:'<circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/>',search:'<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',"search-x":'<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',share:'<path d="M12 2v13"/><path d="m16 6-4-4-4 4"/><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/>',"shield-check":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',spinner:'<path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/>',square:'<rect width="18" height="18" x="3" y="3" rx="2"/>',star:'<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',"sticky-note":'<path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"/><path d="M15 3v5a1 1 0 0 0 1 1h5"/>',table:'<path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/>',"thumbs-up":'<path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>',tool:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',trash:'<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trash-2":'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',"trending-up":'<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',type:'<path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/>',user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',"user-check":'<path d="m16 11 2 2 4-4"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/>',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>',"window-maximize":'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 9h20"/>',warning:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',"zoom-in":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',"zoom-out":'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',brain:'<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',circle:'<circle cx="12" cy="12" r="10"/>',clock:'<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',cloud:'<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',diamond:'<path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',"file-minus":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M9 15h6"/>',"gamepad-2":'<line x1="6" x2="10" y1="11" y2="11"/><line x1="8" x2="8" y1="9" y2="13"/><line x1="15" x2="15.01" y1="12" y2="12"/><line x1="18" x2="18.01" y1="10" y2="10"/><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>',"git-merge":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/>',"git-pull-request":'<circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M13 6h3a2 2 0 0 1 2 2v7"/><path d="M6 9v12"/>',"hard-drive":'<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>',hash:'<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',hexagon:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>',inbox:'<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',link:'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',list:'<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>',"mail-open":'<path d="M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"/><path d="m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"/>',"message-square-share":'<path d="M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7"/><path d="M16 3h5v5"/><path d="m16 8 5-5"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a6 6 0 0 1-6 6 6 6 0 0 1-6-6V8Z"/>',repeat:'<path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/>',scan:'<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>',shield:'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',"shopping-cart":'<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',shuffle:'<path d="M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22"/><path d="m18 2 4 4-4 4"/><path d="M2 6h1.9c1.5 0 2.9.9 3.6 2.2"/><path d="M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8"/><path d="m18 14 4 4-4 4"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/>',"smile-plus":'<path d="M22 11v1a10 10 0 1 1-9-10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/><path d="M16 5h6"/><path d="M19 2v6"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="1"/>',terminal:'<polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/>',ticket:'<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2"/><path d="M13 17v2"/><path d="M13 11v2"/>',triangle:'<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>',"undo-2":'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',"circle-stop":'<circle cx="12" cy="12" r="10"/><rect x="9" y="9" width="6" height="6" rx="1"/>',"git-fork":'<circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"/><path d="M12 12v3"/>',hourglass:'<path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>',merge:'<path d="m8 6 4-4 4 4"/><path d="M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22"/><path d="m20 22-5-5"/>',"shield-alert":'<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/>',timer:'<line x1="10" x2="14" y1="2" y2="2"/><line x1="12" x2="15" y1="14" y2="11"/><circle cx="12" cy="14" r="8"/>',add:'<path d="M5 12h14"/><path d="M12 5v14"/>',"check-circle":'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',"close-circle":'<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',"info-circle":'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',"question-circle":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>'};
|
|
1418
1419
|
/**
|
|
1419
1420
|
* @license
|
|
1420
1421
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1421
1422
|
* SPDX-License-Identifier: MIT
|
|
1422
1423
|
*/
|
|
1423
|
-
var At=function(t,i,
|
|
1424
|
+
var At=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};
|
|
1424
1425
|
/**
|
|
1425
1426
|
* @license
|
|
1426
1427
|
* Copyright 2023 Nuraly Laabidi Aymen
|
|
1427
1428
|
* SPDX-License-Identifier: MIT
|
|
1428
1429
|
*/
|
|
1429
|
-
var
|
|
1430
|
+
var qt=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const Et=(t=>{class e extends t{constructor(){super(...arguments),this.clickable=!1,this.disabled=!1}handleIconClick(t){if(this.disabled||!this.clickable)return t.preventDefault(),void t.stopPropagation();this.dispatchCustomEvent("icon-click",{iconName:this.name,iconType:this.type,originalEvent:t,timestamp:Date.now()})}handleIconKeydown(t){if(this.disabled||!this.clickable)return;("function"==typeof this.isActivationKey?this.isActivationKey(t):"Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleIconClick(t),"function"==typeof this.dispatchCustomEvent&&this.dispatchCustomEvent("icon-keyboard-activation",{iconName:this.name,iconType:this.type,key:t.key,originalEvent:t,timestamp:Date.now()}))}getIconRole(){return this.clickable?"button":"img"}getIconTabIndex(){return this.clickable?this.disabled?"-1":"0":"-1"}getAriaDisabled(){return this.clickable&&this.disabled?"true":void 0}}return At([o({type:Boolean,reflect:!0})],e.prototype,"clickable",void 0),At([o({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0),e})(z(i));let Ct=class extends Et{constructor(){super(...arguments),this.type="regular",this.alt=""}willUpdate(t){if(super.willUpdate(t),t.has("name")&&!this.name&&console.error('HyIconElement: "name" property is required'),t.has("type")&&"solid"!==this.type&&"regular"!==this.type&&(console.warn(`HyIconElement: Invalid type "${this.type}". Using default "solid"`),this.type="solid"),t.has("size")&&this.size){const t=["small","medium","large","xlarge","xxlarge"];t.includes(this.size)||console.warn(`HyIconElement: Invalid size "${this.size}". Valid sizes are: ${t.join(", ")}`)}}render(){let t="";this.color&&(t+=`color: ${this.color};`),this.width&&(t+=`width: ${this.width};`),this.height&&(t+=`height: ${this.height};`);const i=Vt[this.name];return e`
|
|
1430
1431
|
<div
|
|
1431
1432
|
part="container"
|
|
1432
1433
|
id="icon-slot"
|
|
@@ -1439,7 +1440,7 @@ var Et=function(t,i,e,s){for(var r,o=arguments.length,n=o<3?i:null===s?s=Object.
|
|
|
1439
1440
|
@click="${this.clickable?t=>this.handleIconClick(t):void 0}"
|
|
1440
1441
|
@keydown="${this.clickable?t=>this.handleIconKeydown(t):void 0}"
|
|
1441
1442
|
>
|
|
1442
|
-
${e
|
|
1443
|
+
${i?e`
|
|
1443
1444
|
<svg
|
|
1444
1445
|
part="svg"
|
|
1445
1446
|
class="svg-icon"
|
|
@@ -1452,10 +1453,10 @@ var Et=function(t,i,e,s){for(var r,o=arguments.length,n=o<3?i:null===s?s=Object.
|
|
|
1452
1453
|
stroke-width="2"
|
|
1453
1454
|
stroke-linecap="round"
|
|
1454
1455
|
stroke-linejoin="round"
|
|
1455
|
-
>${f(
|
|
1456
|
-
`:
|
|
1456
|
+
>${f(i)}</svg>
|
|
1457
|
+
`:e`<span part="fallback" class="icon-fallback">${this.name}</span>`}
|
|
1457
1458
|
</div>
|
|
1458
|
-
`}getIconRole(){return this.clickable?"button":this.alt?"img":"presentation"}getIconTabIndex(){return this.clickable&&!this.disabled?"0":"-1"}getAriaDisabled(){return this.disabled?"true":void 0}};Ct.useShadowDom=!0,Ct.styles=St,
|
|
1459
|
+
`}getIconRole(){return this.clickable?"button":this.alt?"img":"presentation"}getIconTabIndex(){return this.clickable&&!this.disabled?"0":"-1"}getAriaDisabled(){return this.disabled?"true":void 0}};Ct.useShadowDom=!0,Ct.styles=St,qt([o({type:String})],Ct.prototype,"name",void 0),qt([o()],Ct.prototype,"type",void 0),qt([o({type:String,attribute:"alt"})],Ct.prototype,"alt",void 0),qt([o({type:String,reflect:!0})],Ct.prototype,"size",void 0),qt([o({type:String})],Ct.prototype,"color",void 0),qt([o({type:String})],Ct.prototype,"width",void 0),qt([o({type:String})],Ct.prototype,"height",void 0),Ct=qt([n("nr-icon")],Ct);const It="",Tt=s`
|
|
1459
1460
|
:host {
|
|
1460
1461
|
display: inline-block;
|
|
1461
1462
|
vertical-align: middle;
|
|
@@ -1668,7 +1669,26 @@ var Et=function(t,i,e,s){for(var r,o=arguments.length,n=o<3?i:null===s?s=Object.
|
|
|
1668
1669
|
/* ======== Loading ======== */
|
|
1669
1670
|
:host([loading]) button {
|
|
1670
1671
|
cursor: not-allowed;
|
|
1671
|
-
opacity: 0.
|
|
1672
|
+
opacity: 0.7;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.button-spinner {
|
|
1676
|
+
display: inline-block;
|
|
1677
|
+
width: 1em;
|
|
1678
|
+
height: 1em;
|
|
1679
|
+
border: 2px solid currentColor;
|
|
1680
|
+
border-right-color: transparent;
|
|
1681
|
+
border-radius: 50%;
|
|
1682
|
+
animation: nr-button-spin 0.75s linear infinite;
|
|
1683
|
+
flex-shrink: 0;
|
|
1684
|
+
box-sizing: border-box;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
:host([size="small"]) .button-spinner { width: 0.875em; height: 0.875em; border-width: 2px; }
|
|
1688
|
+
:host([size="large"]) .button-spinner { width: 1.125em; height: 1.125em; border-width: 2px; }
|
|
1689
|
+
|
|
1690
|
+
@keyframes nr-button-spin {
|
|
1691
|
+
to { transform: rotate(360deg); }
|
|
1672
1692
|
}
|
|
1673
1693
|
|
|
1674
1694
|
/* ======== Shape: Round ======== */
|
|
@@ -1693,9 +1713,80 @@ var Et=function(t,i,e,s){for(var r,o=arguments.length,n=o<3?i:null===s?s=Object.
|
|
|
1693
1713
|
height: 44px;
|
|
1694
1714
|
}
|
|
1695
1715
|
|
|
1696
|
-
/* ======== Dashed ========
|
|
1716
|
+
/* ======== Dashed ========
|
|
1717
|
+
* Dashed turns any type into an outlined style so the dashed pattern
|
|
1718
|
+
* is visible against a transparent background (filled variants otherwise
|
|
1719
|
+
* hide the border because border-color matches background-color).
|
|
1720
|
+
*/
|
|
1697
1721
|
button.button-dashed {
|
|
1698
1722
|
border-style: dashed;
|
|
1723
|
+
border-width: 1px;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
:host([type="primary"]) button.button-dashed {
|
|
1727
|
+
background-color: transparent;
|
|
1728
|
+
border-color: #7c3aed;
|
|
1729
|
+
color: #7c3aed;
|
|
1730
|
+
}
|
|
1731
|
+
:host([type="primary"]) button.button-dashed nr-icon {
|
|
1732
|
+
color: #7c3aed !important;
|
|
1733
|
+
}
|
|
1734
|
+
:host([type="primary"]) button.button-dashed:hover:not(:disabled) {
|
|
1735
|
+
background-color: rgba(124, 58, 237, 0.08);
|
|
1736
|
+
border-color: #6d28d9;
|
|
1737
|
+
color: #6d28d9;
|
|
1738
|
+
}
|
|
1739
|
+
:host([type="primary"]) button.button-dashed:active:not(:disabled) {
|
|
1740
|
+
background-color: rgba(124, 58, 237, 0.15);
|
|
1741
|
+
filter: none;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
:host([type="secondary"]) button.button-dashed {
|
|
1745
|
+
background-color: transparent;
|
|
1746
|
+
border-color: #0f1419;
|
|
1747
|
+
color: #0f1419;
|
|
1748
|
+
}
|
|
1749
|
+
:host([type="secondary"]) button.button-dashed:hover:not(:disabled) {
|
|
1750
|
+
background-color: rgba(15, 20, 25, 0.06);
|
|
1751
|
+
border-color: #272c30;
|
|
1752
|
+
color: #272c30;
|
|
1753
|
+
}
|
|
1754
|
+
:host([type="secondary"]) button.button-dashed:active:not(:disabled) {
|
|
1755
|
+
background-color: rgba(15, 20, 25, 0.12);
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
:host([type="default"]) button.button-dashed {
|
|
1759
|
+
background-color: #fff;
|
|
1760
|
+
border-color: #8c8c8c;
|
|
1761
|
+
color: #536471;
|
|
1762
|
+
}
|
|
1763
|
+
:host([type="default"]) button.button-dashed:hover:not(:disabled) {
|
|
1764
|
+
border-color: #7c3aed;
|
|
1765
|
+
color: #7c3aed;
|
|
1766
|
+
background-color: #fff;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
:host([type="ghost"]) button.button-dashed {
|
|
1770
|
+
background-color: transparent;
|
|
1771
|
+
border-color: #7c3aed;
|
|
1772
|
+
color: #7c3aed;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
:host([type="danger"]) button.button-dashed {
|
|
1776
|
+
background-color: transparent;
|
|
1777
|
+
border-color: #dc2626;
|
|
1778
|
+
color: #dc2626;
|
|
1779
|
+
}
|
|
1780
|
+
:host([type="danger"]) button.button-dashed nr-icon {
|
|
1781
|
+
color: #dc2626 !important;
|
|
1782
|
+
}
|
|
1783
|
+
:host([type="danger"]) button.button-dashed:hover:not(:disabled) {
|
|
1784
|
+
background-color: rgba(220, 38, 38, 0.08);
|
|
1785
|
+
filter: none;
|
|
1786
|
+
}
|
|
1787
|
+
:host([type="danger"]) button.button-dashed:active:not(:disabled) {
|
|
1788
|
+
background-color: rgba(220, 38, 38, 0.15);
|
|
1789
|
+
filter: none;
|
|
1699
1790
|
}
|
|
1700
1791
|
|
|
1701
1792
|
/* ======== Ripple ======== */
|
|
@@ -1731,7 +1822,7 @@ class Lt extends J{}
|
|
|
1731
1822
|
* @license
|
|
1732
1823
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1733
1824
|
* SPDX-License-Identifier: MIT
|
|
1734
|
-
*/class Ot extends Lt{createRipple(t){try{if(!this.host.ripple||this.host.disabled)return;const
|
|
1825
|
+
*/class Ot extends Lt{createRipple(t){try{if(!this.host.ripple||this.host.disabled)return;const e=t.currentTarget,i=e.getBoundingClientRect(),s=2*Math.max(i.width,i.height),r=t.clientX-i.left-s/2,o=t.clientY-i.top-s/2,n=document.createElement("span");n.className="ripple",n.style.width=n.style.height=s+"px",n.style.left=r+"px",n.style.top=o+"px";e.querySelectorAll(".ripple").forEach(t=>t.remove()),e.appendChild(n),setTimeout(()=>{n.remove()},600)}catch(t){this.handleError(t,"createRipple")}}handleRippleClick(t){try{this.createRipple(t),this.dispatchEvent(new CustomEvent("button-click",{detail:{disabled:this.host.disabled,timestamp:Date.now(),coordinates:{x:t.clientX,y:t.clientY}},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleRippleClick")}}}
|
|
1735
1826
|
/**
|
|
1736
1827
|
* @license
|
|
1737
1828
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -1746,31 +1837,31 @@ class Lt extends J{}
|
|
|
1746
1837
|
* @license
|
|
1747
1838
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
1748
1839
|
* SPDX-License-Identifier: MIT
|
|
1749
|
-
*/var jt=function(t,i,
|
|
1840
|
+
*/var jt=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};let Nt=class extends(z(i)){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.size=It,this.type="default",this.shape="default",this.block=!1,this.dashed=!1,this.icon=[],this.iconPosition="left",this.href=It,this.target=It,this.ripple=!0,this.buttonAriaLabel=It,this.ariaDescribedBy=It,this.htmlType=It,this.requiredComponents=["nr-icon"],this.rippleController=new Ot(this),this.keyboardController=new Rt(this),this.linkController=new Ht(this)}connectedCallback(){super.connectedCallback(),this.validateDependencies()}getCommonAttributes(){return{"data-type":this.type,"data-shape":this.shape,"data-size":this.size||r,"data-state":this.loading?"loading":r,"data-block":this.block?"true":r,class:this.dashed?"button-dashed":"","aria-disabled":this.disabled?"true":"false","aria-label":this.buttonAriaLabel||r,"aria-describedby":this.ariaDescribedBy||r,tabindex:this.disabled?"-1":"0"}}renderIcon(t){if(!this.isComponentAvailable("nr-icon")){const e="string"==typeof t?t:t.name;return console.warn(`[nr-button] Icon component 'nr-icon' not available. Icon "${e}" will not render. Ensure the icon component is imported and registered.`),r}const i=()=>{switch(this.size){case"small":return"small";case"medium":default:return"medium";case"large":return"large"}};if("string"==typeof t){const s=i();return e`<nr-icon name=${t} size=${b(s)}></nr-icon>`}const{name:s,type:o="solid",size:n,color:a,alt:h}=t,l=n||i();return e`<nr-icon
|
|
1750
1841
|
name=${s}
|
|
1751
1842
|
type=${o}
|
|
1752
1843
|
alt=${h||""}
|
|
1753
1844
|
size=${b(l)}
|
|
1754
1845
|
color=${a||""}
|
|
1755
|
-
></nr-icon>`}handleClick(t){this.disabled
|
|
1846
|
+
></nr-icon>`}handleClick(t){if(this.disabled||this.loading)return t.preventDefault(),void t.stopImmediatePropagation();this.rippleController.handleRippleClick(t),this.linkController.isLinkType()&&this.linkController.handleLinkNavigation(t),this.dispatchEventWithMetadata("button-clicked",{type:this.type,disabled:this.disabled,loading:this.loading,href:this.href||null})}handleKeydown(t){this.keyboardController.handleKeydown(t)}getResolvedLeftIcon(){var t,e;return this.iconLeft?this.iconLeft:(null===(t=this.icons)||void 0===t?void 0:t.left)?this.icons.left:(null===(e=this.icon)||void 0===e?void 0:e.length)>0?this.icon[0]:void 0}getResolvedRightIcon(){var t,e;return this.iconRight?this.iconRight:(null===(t=this.icons)||void 0===t?void 0:t.right)?this.icons.right:2===(null===(e=this.icon)||void 0===e?void 0:e.length)?this.icon[1]:void 0}render(){const t=this.linkController.getElementTag(),i=this.getCommonAttributes(),s=this.linkController.getLinkAttributes(),o=this.getResolvedLeftIcon(),n=this.getResolvedRightIcon(),a=e`<span part="spinner" class="button-spinner" aria-hidden="true"></span>`,h=e`
|
|
1756
1847
|
<span part="container" class="button-container">
|
|
1757
|
-
${o?this.renderIcon(o):r}
|
|
1848
|
+
${this.loading?a:o?this.renderIcon(o):r}
|
|
1758
1849
|
<slot></slot>
|
|
1759
|
-
${n?this.renderIcon(n):r}
|
|
1850
|
+
${!this.loading&&n?this.renderIcon(n):r}
|
|
1760
1851
|
</span>
|
|
1761
|
-
`;return"a"===t?
|
|
1852
|
+
`;return"a"===t?e`
|
|
1762
1853
|
<a
|
|
1763
1854
|
part="button"
|
|
1764
1855
|
href="${s.href}"
|
|
1765
1856
|
target="${s.target||r}"
|
|
1766
1857
|
rel="${s.rel||r}"
|
|
1767
1858
|
role="${s.role}"
|
|
1768
|
-
data-type="${
|
|
1769
|
-
data-shape="${
|
|
1770
|
-
data-size="${
|
|
1771
|
-
data-state="${
|
|
1772
|
-
data-block="${
|
|
1773
|
-
class="${
|
|
1859
|
+
data-type="${i["data-type"]}"
|
|
1860
|
+
data-shape="${i["data-shape"]}"
|
|
1861
|
+
data-size="${i["data-size"]}"
|
|
1862
|
+
data-state="${i["data-state"]}"
|
|
1863
|
+
data-block="${i["data-block"]}"
|
|
1864
|
+
class="${i.class}"
|
|
1774
1865
|
aria-disabled="${this.disabled}"
|
|
1775
1866
|
aria-label="${this.buttonAriaLabel||r}"
|
|
1776
1867
|
aria-describedby="${this.ariaDescribedBy||r}"
|
|
@@ -1778,20 +1869,21 @@ class Lt extends J{}
|
|
|
1778
1869
|
@click="${this.handleClick}"
|
|
1779
1870
|
@keydown="${this.handleKeydown}"
|
|
1780
1871
|
>
|
|
1781
|
-
${
|
|
1872
|
+
${h}
|
|
1782
1873
|
</a>
|
|
1783
|
-
`:
|
|
1874
|
+
`:e`
|
|
1784
1875
|
<button
|
|
1785
1876
|
part="button"
|
|
1786
|
-
?disabled="${this.disabled}"
|
|
1877
|
+
?disabled="${this.disabled||this.loading}"
|
|
1878
|
+
aria-busy="${this.loading?"true":"false"}"
|
|
1787
1879
|
type="${this.htmlType||"button"}"
|
|
1788
1880
|
role="${s.role}"
|
|
1789
|
-
data-type="${
|
|
1790
|
-
data-shape="${
|
|
1791
|
-
data-size="${
|
|
1792
|
-
data-state="${
|
|
1793
|
-
data-block="${
|
|
1794
|
-
class="${
|
|
1881
|
+
data-type="${i["data-type"]}"
|
|
1882
|
+
data-shape="${i["data-shape"]}"
|
|
1883
|
+
data-size="${i["data-size"]}"
|
|
1884
|
+
data-state="${i["data-state"]}"
|
|
1885
|
+
data-block="${i["data-block"]}"
|
|
1886
|
+
class="${i.class}"
|
|
1795
1887
|
aria-disabled="${this.disabled}"
|
|
1796
1888
|
aria-label="${this.buttonAriaLabel||r}"
|
|
1797
1889
|
aria-describedby="${this.ariaDescribedBy||r}"
|
|
@@ -1799,7 +1891,7 @@ class Lt extends J{}
|
|
|
1799
1891
|
@click="${this.handleClick}"
|
|
1800
1892
|
@keydown="${this.handleKeydown}"
|
|
1801
1893
|
>
|
|
1802
|
-
${
|
|
1894
|
+
${h}
|
|
1803
1895
|
</button>
|
|
1804
1896
|
`}};Nt.styles=Tt,Nt.useShadowDom=!0,jt([o({type:Boolean})],Nt.prototype,"disabled",void 0),jt([o({type:Boolean})],Nt.prototype,"loading",void 0),jt([o({type:String})],Nt.prototype,"size",void 0),jt([o({type:String,reflect:!0})],Nt.prototype,"type",void 0),jt([o({type:String})],Nt.prototype,"shape",void 0),jt([o({type:Boolean})],Nt.prototype,"block",void 0),jt([o({type:Boolean})],Nt.prototype,"dashed",void 0),jt([o({type:Array})],Nt.prototype,"icon",void 0),jt([o({type:Object})],Nt.prototype,"iconLeft",void 0),jt([o({type:Object})],Nt.prototype,"iconRight",void 0),jt([o({type:Object})],Nt.prototype,"icons",void 0),jt([o({reflect:!0})],Nt.prototype,"iconPosition",void 0),jt([o({type:String})],Nt.prototype,"href",void 0),jt([o({type:String})],Nt.prototype,"target",void 0),jt([o({type:Boolean})],Nt.prototype,"ripple",void 0),jt([o({type:String})],Nt.prototype,"buttonAriaLabel",void 0),jt([o({type:String})],Nt.prototype,"ariaDescribedBy",void 0),jt([o({type:String})],Nt.prototype,"htmlType",void 0),Nt=jt([n("nr-button")],Nt);
|
|
1805
1897
|
/**
|
|
@@ -2044,39 +2136,39 @@ class Jt{constructor(t){(this.host=t).addController(this)}hostConnected(){}hostD
|
|
|
2044
2136
|
* @license
|
|
2045
2137
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2046
2138
|
* SPDX-License-Identifier: MIT
|
|
2047
|
-
*/class
|
|
2139
|
+
*/class te{static loadIcons(t=["solid"]){const e=[];return t.forEach(t=>{if(this.iconCache.has(t))e.push(...this.iconCache.get(t));else{const i=this.loadIconsByType(t);this.iconCache.set(t,i),e.push(...i)}}),e}static loadIconsByType(t){return this.extractLucideIcons(t)}static extractLucideIcons(t){return Qt.map(e=>({name:e,type:t,iconName:e,keywords:this.generateKeywords(e),category:this.categorizeIcon(e)}))}static generateKeywords(t){const e=t.replaceAll(/([a-z])([A-Z])/g,"$1 $2").replaceAll("-"," ").toLowerCase().split(" ").filter(Boolean);return[...new Set(e)]}static categorizeIcon(t){const e=t.toLowerCase();return e.includes("arrow")||e.includes("chevron")||e.includes("corner")||e.includes("move")?"arrow":e.includes("mail")||e.includes("message")||e.includes("phone")||e.includes("chat")?"communication":e.includes("file")||e.includes("document")||e.includes("folder")?"file":e.includes("menu")||e.includes("grid")||e.includes("layout")||e.includes("panel")?"interface":e.includes("video")||e.includes("audio")||e.includes("play")||e.includes("music")?"media":e.includes("facebook")||e.includes("twitter")||e.includes("linkedin")||e.includes("github")?"social":e.includes("text")||e.includes("type")||e.includes("font")?"text":e.includes("briefcase")||e.includes("building")||e.includes("calendar")||e.includes("chart")?"business":e.includes("pen")||e.includes("brush")||e.includes("palette")||e.includes("edit")?"design":e.includes("circle")||e.includes("square")||e.includes("triangle")||e.includes("hexagon")?"shapes":"all"}static getUniqueIcons(t){const e=new Set;return t.filter(t=>!e.has(t.name)&&(e.add(t.name),!0))}static clearCache(){this.iconCache.clear()}}te.iconCache=new Map;
|
|
2048
2140
|
/**
|
|
2049
2141
|
* @license
|
|
2050
2142
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2051
2143
|
* SPDX-License-Identifier: MIT
|
|
2052
2144
|
*/
|
|
2053
|
-
class
|
|
2145
|
+
class ee{static filterByName(t,e,i={}){if(!t||""===t.trim())return e;const s=i.caseSensitive?t:t.toLowerCase(),r=i.matchMode||"contains";return e.filter(t=>{const e=i.caseSensitive?t.name:t.name.toLowerCase();switch(r){case"exact":return e===s;case"startsWith":return e.startsWith(s);default:return e.includes(s)}})}static filterByCategory(t,e){return t&&"all"!==t?e.filter(e=>e.category===t):e}static rankResults(t,e){if(!t||""===t.trim())return e;const i=t.toLowerCase();return e.map(t=>({icon:t,score:this.calculateRelevanceScore(i,t)})).sort((t,e)=>e.score-t.score).map(t=>t.icon)}static calculateRelevanceScore(t,e){const i=e.name.toLowerCase();let s=0;return i===t?s+=100:i.startsWith(t)?s+=50:i.includes(t)&&(s+=25),e.keywords&&e.keywords.forEach(e=>{const i=e.toLowerCase();i===t?s+=30:i.includes(t)&&(s+=10)}),s-=.1*i.length,s}static searchAndRank(t,e,i={}){const s=this.filterByName(t,e,i);return this.rankResults(t,s)}}
|
|
2054
2146
|
/**
|
|
2055
2147
|
* @license
|
|
2056
2148
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2057
2149
|
* SPDX-License-Identifier: MIT
|
|
2058
|
-
*/class
|
|
2150
|
+
*/class ie{constructor(t,e=300){this.debounceTimer=null,this.debounceDelay=300,(this.host=t).addController(this),this.debounceDelay=e}hostConnected(){}hostDisconnected(){this.debounceTimer&&clearTimeout(this.debounceTimer)}search(t,e){this.host.searchQuery=t,this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.performSearch(t,e)},this.debounceDelay)}performSearch(t,e){t&&""!==t.trim()?this.host.filteredIcons=ee.searchAndRank(t,this.host.allIcons,e):this.host.filteredIcons=[...this.host.allIcons],this.host.requestUpdate()}clearSearch(){this.host.searchQuery="",this.host.filteredIcons=[...this.host.allIcons],this.host.requestUpdate()}}
|
|
2059
2151
|
/**
|
|
2060
2152
|
* @license
|
|
2061
2153
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2062
2154
|
* SPDX-License-Identifier: MIT
|
|
2063
|
-
*/class
|
|
2155
|
+
*/class se{constructor(t){(this.host=t).addController(this)}hostConnected(){}hostDisconnected(){}dispatchChangeEvent(t,e){const i={value:t,icon:e};this.host.dispatchEvent(new CustomEvent("nr-icon-picker-change",{detail:i,bubbles:!0,composed:!0}))}dispatchSearchEvent(t){this.host.dispatchEvent(new CustomEvent("nr-icon-picker-search",{detail:{query:t},bubbles:!0,composed:!0}))}dispatchClearEvent(){this.host.dispatchEvent(new CustomEvent("nr-icon-picker-clear",{detail:{},bubbles:!0,composed:!0}))}dispatchOpenEvent(){this.host.dispatchEvent(new CustomEvent("nr-icon-picker-open",{detail:{},bubbles:!0,composed:!0}))}dispatchCloseEvent(){this.host.dispatchEvent(new CustomEvent("nr-icon-picker-close",{detail:{},bubbles:!0,composed:!0}))}}
|
|
2064
2156
|
/**
|
|
2065
2157
|
* @license
|
|
2066
2158
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
2067
2159
|
* SPDX-License-Identifier: MIT
|
|
2068
|
-
*/var
|
|
2160
|
+
*/var re=function(t,e,i,s){for(var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};let oe=class extends(z(i)){constructor(){super(...arguments),this.requiredComponents=["nr-dropdown","nr-input","nr-icon","nr-button"],this.selectionController=new Jt(this),this.searchController=new ie(this,300),this.eventController=new se(this),this.value="",this.size="small",this.placement="auto",this.trigger="manual",this.disabled=!1,this.readonly=!1,this.placeholder=Bt,this.iconTypes=["solid"],this.showSearch=!0,this.showClear=!0,this.maxVisible=500,this.dropdownOpen=!1,this.allIcons=[],this.filteredIcons=[],this.searchQuery="",this.selectedIcon=null,this.isLoading=!1}connectedCallback(){super.connectedCallback(),this.loadIcons()}loadIcons(){this.isLoading=!0;try{this.allIcons=te.loadIcons(this.iconTypes),this.filteredIcons=[...this.allIcons],this.value&&(this.selectedIcon=this.allIcons.find(t=>t.name===this.value)||null)}catch(t){console.error("Failed to load icons:",t)}finally{this.isLoading=!1}}handleIconSelect(t){this.selectionController.selectIcon(t),this.eventController.dispatchChangeEvent(t.name,t),this.dropdownOpen=!1}handleSearchInput(t){const e=t.detail.value;this.searchController.search(e),this.eventController.dispatchSearchEvent(e)}handleClear(t){t.stopPropagation(),this.selectionController.clearSelection(),this.eventController.dispatchClearEvent(),this.eventController.dispatchChangeEvent("",null)}handleDropdownOpen(){this.dropdownOpen=!0,this.eventController.dispatchOpenEvent()}handleDropdownClose(){this.dropdownOpen=!1,this.searchController.clearSearch(),this.eventController.dispatchCloseEvent()}toggleDropdown(){this.dropdownOpen=!this.dropdownOpen}renderTrigger(){return e`
|
|
2069
2161
|
<nr-button
|
|
2070
2162
|
class="trigger-button"
|
|
2071
2163
|
.disabled=${this.disabled}
|
|
2072
2164
|
size=${this.size}
|
|
2073
2165
|
@click=${this.toggleDropdown}
|
|
2074
2166
|
>
|
|
2075
|
-
${this.selectedIcon?
|
|
2167
|
+
${this.selectedIcon?e`
|
|
2076
2168
|
<nr-icon class="icon-preview" .name=${this.selectedIcon.name}></nr-icon>
|
|
2077
2169
|
<span class="icon-name">${this.selectedIcon.name}</span>
|
|
2078
|
-
`:
|
|
2079
|
-
${this.showClear&&this.selectedIcon?
|
|
2170
|
+
`:e`<span class="placeholder">${this.placeholder}</span>`}
|
|
2171
|
+
${this.showClear&&this.selectedIcon?e`
|
|
2080
2172
|
<nr-icon
|
|
2081
2173
|
name="times"
|
|
2082
2174
|
@click=${this.handleClear}
|
|
@@ -2084,20 +2176,20 @@ class ii{static filterByName(t,i,e={}){if(!t||""===t.trim())return i;const s=e.c
|
|
|
2084
2176
|
></nr-icon>
|
|
2085
2177
|
`:r}
|
|
2086
2178
|
</nr-button>
|
|
2087
|
-
`}renderIconGrid(){if(this.isLoading)return
|
|
2179
|
+
`}renderIconGrid(){if(this.isLoading)return e`
|
|
2088
2180
|
<div class="loading-state">
|
|
2089
2181
|
<nr-icon name="spinner"></nr-icon>
|
|
2090
2182
|
<div class="empty-message">Loading icons...</div>
|
|
2091
2183
|
</div>
|
|
2092
|
-
`;if(0===this.filteredIcons.length)return
|
|
2184
|
+
`;if(0===this.filteredIcons.length)return e`
|
|
2093
2185
|
<div class="empty-state">
|
|
2094
2186
|
<nr-icon name="search"></nr-icon>
|
|
2095
2187
|
<div class="empty-message">${Ut}</div>
|
|
2096
2188
|
</div>
|
|
2097
|
-
`;const t=this.filteredIcons.slice(0,this.maxVisible);return
|
|
2098
|
-
<div class="dropdown-content">
|
|
2099
|
-
${this.showSearch?
|
|
2100
|
-
<div class="search-container">
|
|
2189
|
+
`;const t=this.filteredIcons.slice(0,this.maxVisible);return e`
|
|
2190
|
+
<div class="dropdown-content" part="panel">
|
|
2191
|
+
${this.showSearch?e`
|
|
2192
|
+
<div class="search-container" part="search">
|
|
2101
2193
|
<nr-input
|
|
2102
2194
|
size="small"
|
|
2103
2195
|
.placeholder=${Ft}
|
|
@@ -2109,11 +2201,11 @@ class ii{static filterByName(t,i,e={}){if(!t||""===t.trim())return i;const s=e.c
|
|
|
2109
2201
|
</nr-input>
|
|
2110
2202
|
</div>
|
|
2111
2203
|
`:r}
|
|
2112
|
-
<div class="icons-grid-container">
|
|
2204
|
+
<div class="icons-grid-container" part="grid">
|
|
2113
2205
|
<lit-virtualizer
|
|
2114
2206
|
.items=${t}
|
|
2115
|
-
.layout=${
|
|
2116
|
-
.renderItem=${t=>
|
|
2207
|
+
.layout=${i={itemSize:"40px"},Object.assign({type:X},i)}
|
|
2208
|
+
.renderItem=${t=>e`
|
|
2117
2209
|
<div
|
|
2118
2210
|
class=${l({"icon-item":!0,selected:this.selectionController.isSelected(t)})}
|
|
2119
2211
|
@click=${()=>this.handleIconSelect(t)}
|
|
@@ -2127,7 +2219,7 @@ class ii{static filterByName(t,i,e={}){if(!t||""===t.trim())return i;const s=e.c
|
|
|
2127
2219
|
></lit-virtualizer>
|
|
2128
2220
|
</div>
|
|
2129
2221
|
</div>
|
|
2130
|
-
`;var
|
|
2222
|
+
`;var i}render(){return e`
|
|
2131
2223
|
<nr-dropdown
|
|
2132
2224
|
.open=${this.dropdownOpen}
|
|
2133
2225
|
trigger="manual"
|
|
@@ -2138,22 +2230,22 @@ class ii{static filterByName(t,i,e={}){if(!t||""===t.trim())return i;const s=e.c
|
|
|
2138
2230
|
@nr-dropdown-close=${this.handleDropdownClose}
|
|
2139
2231
|
style=${h({"--dropdown-width":"var(--icon-picker-dropdown-width)","--dropdown-max-height":"var(--icon-picker-dropdown-max-height)"})}
|
|
2140
2232
|
>
|
|
2141
|
-
<div slot="trigger" class="trigger-container">
|
|
2233
|
+
<div slot="trigger" class="trigger-container" part="trigger">
|
|
2142
2234
|
${this.renderTrigger()}
|
|
2143
2235
|
</div>
|
|
2144
2236
|
<div slot="content">
|
|
2145
2237
|
${this.renderIconGrid()}
|
|
2146
2238
|
</div>
|
|
2147
2239
|
</nr-dropdown>
|
|
2148
|
-
`}};
|
|
2240
|
+
`}};oe.useShadowDom=!0,oe.styles=Dt,re([o({type:String,reflect:!0})],oe.prototype,"value",void 0),re([o({type:String,reflect:!0})],oe.prototype,"size",void 0),re([o({type:String})],oe.prototype,"placement",void 0),re([o({type:String})],oe.prototype,"trigger",void 0),re([o({type:Boolean,reflect:!0})],oe.prototype,"disabled",void 0),re([o({type:Boolean})],oe.prototype,"readonly",void 0),re([o({type:String})],oe.prototype,"placeholder",void 0),re([o({type:Array})],oe.prototype,"iconTypes",void 0),re([o({type:Boolean,attribute:"show-search"})],oe.prototype,"showSearch",void 0),re([o({type:Boolean,attribute:"show-clear"})],oe.prototype,"showClear",void 0),re([o({type:Number,attribute:"max-visible"})],oe.prototype,"maxVisible",void 0),re([a()],oe.prototype,"dropdownOpen",void 0),re([a()],oe.prototype,"allIcons",void 0),re([a()],oe.prototype,"filteredIcons",void 0),re([a()],oe.prototype,"searchQuery",void 0),re([a()],oe.prototype,"selectedIcon",void 0),re([a()],oe.prototype,"isLoading",void 0),oe=re([n("nr-icon-picker")],oe);
|
|
2149
2241
|
/**
|
|
2150
2242
|
* @license
|
|
2151
2243
|
* Copyright 2021 Google LLC
|
|
2152
2244
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2153
2245
|
*/
|
|
2154
|
-
class
|
|
2246
|
+
class ne{constructor(t){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===t?.roundAverageSize&&(this._roundAverageSize=!0)}set(t,e){const i=this._map.get(t)||0;this._map.set(t,e),this.totalSize+=e-i}get averageSize(){if(this._map.size>0){const t=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(t):t}return 0}getSize(t){return this._map.get(t)}clear(){this._map.clear(),this.totalSize=0}}
|
|
2155
2247
|
/**
|
|
2156
2248
|
* @license
|
|
2157
2249
|
* Copyright 2021 Google LLC
|
|
2158
2250
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2159
|
-
*/function
|
|
2251
|
+
*/function ae(t){return"horizontal"===t?"marginLeft":"marginTop"}function he(t){return"horizontal"===t?"marginRight":"marginBottom"}function le(t){return"horizontal"===t?"xOffset":"yOffset"}function ce(t,e){const i=[t,e].sort();return i[1]<=0?Math.min(...i):i[0]>=0?Math.max(...i):i[0]+i[1]}class de{constructor(){this._childSizeCache=new ne,this._marginSizeCache=new ne,this._metricsCache=new Map}update(t,e){const i=new Set;Object.keys(t).forEach(s=>{const r=Number(s);this._metricsCache.set(r,t[r]),this._childSizeCache.set(r,t[r][F(e)]),i.add(r),i.add(r+1)});for(const t of i){const i=this._metricsCache.get(t)?.[ae(e)]||0,s=this._metricsCache.get(t-1)?.[he(e)]||0;this._marginSizeCache.set(t,ce(i,s))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(t,e){return this._metricsCache.get(t)?.[ae(e)]||0}getChildSize(t){return this._childSizeCache.getSize(t)}getMarginSize(t){return this._marginSizeCache.getSize(t)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}class pe extends Z{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new de,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(t){this._metricsCache.update(t,this.direction),this._scheduleReflow()}_getPhysicalItem(t){return this._newPhysicalItems.get(t)??this._physicalItems.get(t)}_getSize(t){return this._getPhysicalItem(t)&&this._metricsCache.getChildSize(t)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(t){const e=this._metricsCache;if(-1===this._first||-1===this._last)return e.averageMarginSize+t*(e.averageMarginSize+this._getAverageSize());if(t<this._first){const i=this._first-t;return this._getPhysicalItem(this._first).pos-(e.getMarginSize(this._first-1)||e.averageMarginSize)-(i*e.averageChildSize+(i-1)*e.averageMarginSize)}{const i=t-this._last;return this._getPhysicalItem(this._last).pos+(e.getChildSize(this._last)||e.averageChildSize)+(e.getMarginSize(this._last)||e.averageMarginSize)+i*(e.averageChildSize+e.averageMarginSize)}}_getPosition(t){const e=this._getPhysicalItem(t),{averageMarginSize:i}=this._metricsCache;return 0===t?this._metricsCache.getMarginSize(0)??i:e?e.pos:this._estimatePosition(t)}_calculateAnchor(t,e){return t<=0?0:e>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((t+e)/2/this._delta)))}_getAnchor(t,e){if(0===this._physicalItems.size)return this._calculateAnchor(t,e);if(this._first<0)return this._calculateAnchor(t,e);if(this._last<0)return this._calculateAnchor(t,e);const i=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),r=i.pos;if(s.pos+this._metricsCache.getChildSize(this._last)<t)return this._calculateAnchor(t,e);if(r>e)return this._calculateAnchor(t,e);let o=this._firstVisible-1,n=-1/0;for(;n<t;){n=this._getPhysicalItem(++o).pos+this._metricsCache.getChildSize(o)}return o}_getActiveItems(){0===this._viewDim1||0===this.items.length?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;const t=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t,this._stable=!0}_getItems(){const t=this._newPhysicalItems;let e,i;if(this._stable=!0,null!==this.pin){const{index:t}=this.pin;this._anchorIdx=t,this._anchorPos=this._getPosition(t)}if(e=this._scrollPosition-this._overhang,i=this._scrollPosition+this._viewDim1+this._overhang,i<0||e>this._scrollSize)return void this._clearItems();null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(e,i),this._anchorPos=this._getPosition(this._anchorIdx));let s=this._getSize(this._anchorIdx);void 0===s&&(this._stable=!1,s=this._getAverageSize());const r=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,o=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=r),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-o-s);let n=0;for(this._anchorPos+s+o<e&&(n=e-(this._anchorPos+s+o)),this._anchorPos-r>i&&(n=i-(this._anchorPos-r)),n&&(this._scrollPosition-=n,e-=n,i-=n,this._scrollError+=n),t.set(this._anchorIdx,{pos:this._anchorPos,size:s}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-r,this._physicalMax=this._anchorPos+s+o;this._physicalMin>e&&this._first>0;){let e=this._getSize(--this._first);void 0===e&&(this._stable=!1,e=this._getAverageSize());let i=this._metricsCache.getMarginSize(this._first);void 0===i&&(this._stable=!1,i=this._metricsCache.averageMarginSize),this._physicalMin-=e;const s=this._physicalMin;if(t.set(this._first,{pos:s,size:e}),this._physicalMin-=i,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax<i&&this._last<this.items.length-1;){let e=this._getSize(++this._last);void 0===e&&(this._stable=!1,e=this._getAverageSize());let i=this._metricsCache.getMarginSize(this._last);void 0===i&&(this._stable=!1,i=this._metricsCache.averageMarginSize);const s=this._physicalMax;if(t.set(this._last,{pos:s,size:e}),this._physicalMax+=e+i,!this._stable&&!this._estimate)break}const a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,t.forEach(t=>t.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t)}_calculateError(){return 0===this._first?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){const{_first:t,_last:e}=this;super._reflow(),(-1===this._first&&-1==this._last||this._first===t&&this._last===e)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){const{averageMarginSize:t}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(t+this._getAverageSize())+t)}get _delta(){const{averageMarginSize:t}=this._metricsCache;return this._getAverageSize()+t}_getItemPosition(t){return{[this._positionDim]:this._getPosition(t),[this._secondaryPositionDim]:0,[le(this.direction)]:-(this._metricsCache.getLeadingMarginValue(t,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(t){return{[this._sizeDim]:this._getSize(t)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}var ue=Object.freeze({__proto__:null,flow:t=>Object.assign({type:pe},t),FlowLayout:pe});export{Yt as DEFAULT_DROPDOWN_MAX_HEIGHT,Kt as DEFAULT_DROPDOWN_WIDTH,Ut as DEFAULT_EMPTY_MESSAGE,Zt as DEFAULT_GRID_SIZE,Wt as DEFAULT_MAX_VISIBLE_ICONS,Bt as DEFAULT_PLACEHOLDER,Ft as DEFAULT_SEARCH_PLACEHOLDER,Pt as EMPTY_STRING,Xt as ICON_CATEGORIES,oe as NrIconPickerElement,Gt as SEARCH_DEBOUNCE_DELAY};
|