nish-ui 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/chart.js.map +1 -1
- package/dist/elements-charts.d.ts +53 -0
- package/dist/elements-charts.js +132 -0
- package/dist/elements-charts.js.map +1 -0
- package/dist/elements-data.d.ts +95 -0
- package/dist/elements-data.js +47 -0
- package/dist/elements-data.js.map +1 -0
- package/dist/elements-forms.d.ts +147 -0
- package/dist/elements-forms.js +92 -0
- package/dist/elements-forms.js.map +1 -0
- package/dist/elements.js +3 -3
- package/dist/elements.js.map +1 -1
- package/dist/files.json +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +54 -27
- package/dist/index.js.map +1 -1
- package/dist/nish-components.css +2598 -176
- package/dist/system-canvas.js.map +1 -1
- package/dist/theme.d.ts +3 -0
- package/dist/theme.global.js +16 -4
- package/dist/theme.global.js.map +1 -1
- package/dist/theme.js +13 -1
- package/dist/theme.js.map +1 -1
- package/package.json +30 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// The published types of nish-ui/elements/forms (copied to dist/elements-forms.d.ts by
|
|
2
|
+
// tsup.config.ts). Hand-written so the package never imports 'lit' (a devDependency) and every
|
|
3
|
+
// element stays an HTMLElement for consumers. Keep it in step with the classes in this folder.
|
|
4
|
+
|
|
5
|
+
/** Base of every nish-ui element (light DOM). */
|
|
6
|
+
export declare class NishElement extends HTMLElement {
|
|
7
|
+
readonly updateComplete: Promise<boolean>;
|
|
8
|
+
requestUpdate(): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Register a custom element unless the tag is already defined. */
|
|
12
|
+
export declare function define(tag: string, ctor: CustomElementConstructor): void;
|
|
13
|
+
|
|
14
|
+
export declare class NishField extends NishElement {
|
|
15
|
+
label: string | undefined;
|
|
16
|
+
hint: string | undefined;
|
|
17
|
+
error: string | undefined;
|
|
18
|
+
optional: boolean;
|
|
19
|
+
/** `stack` (default) or `inline`. */
|
|
20
|
+
layout: string;
|
|
21
|
+
labelWidth: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare class NishSearch extends NishElement {
|
|
25
|
+
value: string;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
label: string;
|
|
28
|
+
/** `xs`, `sm` or `md` (default). */
|
|
29
|
+
size: string;
|
|
30
|
+
/** `field` (default) or `bare`. */
|
|
31
|
+
variant: string;
|
|
32
|
+
name: string | undefined;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
/** The inner `<input>` (null until the first render). */
|
|
35
|
+
readonly input: HTMLInputElement | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare class NishSwitch extends NishElement {
|
|
39
|
+
checked: boolean;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
label: string | undefined;
|
|
42
|
+
description: string | undefined;
|
|
43
|
+
/** `md` (default) or `sm`. */
|
|
44
|
+
size: string;
|
|
45
|
+
/** `end` (default) or `start`. */
|
|
46
|
+
labelSide: string;
|
|
47
|
+
name: string | undefined;
|
|
48
|
+
/** The inner `<button role="switch">` (null until the first render). */
|
|
49
|
+
readonly button: HTMLButtonElement | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export declare class NishChipGroup extends NishElement {
|
|
53
|
+
label: string;
|
|
54
|
+
/** The `scroll` attribute: one row that scrolls sideways. */
|
|
55
|
+
scrollable: boolean;
|
|
56
|
+
single: boolean;
|
|
57
|
+
/** The values of the pressed chips (each chip's `value` attribute, else its text). */
|
|
58
|
+
values: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface NishComboboxOption {
|
|
62
|
+
value: string;
|
|
63
|
+
label: string;
|
|
64
|
+
/** Secondary text shown after the label and matched by the default filter. */
|
|
65
|
+
hint?: string;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface NishComboboxChangeDetail {
|
|
70
|
+
/** The chosen option's value, the typed text for a custom entry, or null when cleared. */
|
|
71
|
+
value: string | null;
|
|
72
|
+
/** The chosen option; null for a custom entry or a clear. */
|
|
73
|
+
option: NishComboboxOption | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare class NishCombobox extends NishElement {
|
|
77
|
+
value: string | null;
|
|
78
|
+
placeholder: string | null;
|
|
79
|
+
label: string | null;
|
|
80
|
+
allowCustom: boolean;
|
|
81
|
+
emptyText: string;
|
|
82
|
+
size: string | null;
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
loading: boolean;
|
|
85
|
+
name: string | null;
|
|
86
|
+
options: NishComboboxOption[];
|
|
87
|
+
/** Replaces the default filter. Return true for every option when the server filtered them. */
|
|
88
|
+
filter: ((option: NishComboboxOption, query: string) => boolean) | null;
|
|
89
|
+
/** The inner text input (null until the first render). */
|
|
90
|
+
readonly input: HTMLInputElement | null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare class NishTabs extends NishElement {
|
|
94
|
+
label: string;
|
|
95
|
+
value: string;
|
|
96
|
+
/** `pill`, or empty for the underline style. */
|
|
97
|
+
variant: string;
|
|
98
|
+
/** `sm`, `xs`, or empty. */
|
|
99
|
+
size: string;
|
|
100
|
+
block: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export declare class NishSegmented extends NishElement {
|
|
104
|
+
label: string;
|
|
105
|
+
value: string;
|
|
106
|
+
/** `xs`, `md`, or empty. */
|
|
107
|
+
size: string;
|
|
108
|
+
block: boolean;
|
|
109
|
+
/** `wrap`, or empty for one row that scrolls sideways. */
|
|
110
|
+
overflow: string;
|
|
111
|
+
name: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export declare class NishCopyButton extends NishElement {
|
|
115
|
+
value: string | null;
|
|
116
|
+
/** The id of the element whose text is copied when `value` is not set. */
|
|
117
|
+
for: string | null;
|
|
118
|
+
label: string;
|
|
119
|
+
copiedLabel: string;
|
|
120
|
+
icon: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export declare class NishSparkline extends NishElement {
|
|
124
|
+
/** Numbers, or null for a gap. The attribute is a comma list: `3,5,4,8`. */
|
|
125
|
+
values: (number | null)[];
|
|
126
|
+
tone: string;
|
|
127
|
+
label: string;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
fill: boolean;
|
|
131
|
+
min: number | undefined;
|
|
132
|
+
max: number | undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare global {
|
|
136
|
+
interface HTMLElementTagNameMap {
|
|
137
|
+
'nish-field': NishField;
|
|
138
|
+
'nish-search': NishSearch;
|
|
139
|
+
'nish-switch': NishSwitch;
|
|
140
|
+
'nish-chip-group': NishChipGroup;
|
|
141
|
+
'nish-combobox': NishCombobox;
|
|
142
|
+
'nish-tabs': NishTabs;
|
|
143
|
+
'nish-segmented': NishSegmented;
|
|
144
|
+
'nish-copy-button': NishCopyButton;
|
|
145
|
+
'nish-sparkline': NishSparkline;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var ze=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var x=function(r,e,t,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},E=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},U,ie,se,V,Se,j,ne,P,F,M,re,Ve;var b={__proto__:null};b.enumerable=!0;Object.freeze(b);var we=(M=class{constructor(e,t={}){if(U.set(this,!1),ie.set(this,!1),se.set(this,!1),V.set(this,!1),Se.set(this,Date.now()),j.set(this,!1),ne.set(this,void 0),P.set(this,void 0),F.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:i,cancelable:s,composed:n}=t;x(this,U,!!s,"f"),x(this,ie,!!i,"f"),x(this,se,!!n,"f"),x(this,ne,`${e}`,"f"),x(this,P,null,"f"),x(this,F,!1,"f")}initEvent(e,t,i){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){x(this,V,!0,"f")}get target(){return E(this,P,"f")}get currentTarget(){return E(this,P,"f")}get srcElement(){return E(this,P,"f")}get type(){return E(this,ne,"f")}get cancelable(){return E(this,U,"f")}get defaultPrevented(){return E(this,U,"f")&&E(this,V,"f")}get timeStamp(){return E(this,Se,"f")}composedPath(){return E(this,F,"f")?[E(this,P,"f")]:[]}get returnValue(){return!E(this,U,"f")||!E(this,V,"f")}get bubbles(){return E(this,ie,"f")}get composed(){return E(this,se,"f")}get eventPhase(){return E(this,F,"f")?M.AT_TARGET:M.NONE}get cancelBubble(){return E(this,j,"f")}set cancelBubble(e){e&&x(this,j,!0,"f")}stopPropagation(){x(this,j,!0,"f")}get isTrusted(){return!1}},U=new WeakMap,ie=new WeakMap,se=new WeakMap,V=new WeakMap,Se=new WeakMap,j=new WeakMap,ne=new WeakMap,P=new WeakMap,F=new WeakMap,M.NONE=0,M.CAPTURING_PHASE=1,M.AT_TARGET=2,M.BUBBLING_PHASE=3,M);Object.defineProperties(we.prototype,{initEvent:b,stopImmediatePropagation:b,preventDefault:b,target:b,currentTarget:b,srcElement:b,type:b,cancelable:b,defaultPrevented:b,timeStamp:b,composedPath:b,returnValue:b,bubbles:b,composed:b,eventPhase:b,cancelBubble:b,stopPropagation:b,isTrusted:b});var je=(Ve=class extends we{constructor(e,t={}){super(e,t),re.set(this,void 0),x(this,re,t?.detail??null,"f")}initCustomEvent(e,t,i,s){throw new Error("Method not implemented.")}get detail(){return E(this,re,"f")}},re=new WeakMap,Ve);Object.defineProperties(je.prototype,{detail:b});var C=we,Ae=je;var _;var ai=(_=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},_.STYLE_RULE=1,_.CHARSET_RULE=2,_.IMPORT_RULE=3,_.MEDIA_RULE=4,_.FONT_FACE_RULE=5,_.PAGE_RULE=6,_.NAMESPACE_RULE=10,_.KEYFRAMES_RULE=7,_.KEYFRAME_RULE=8,_.SUPPORTS_RULE=12,_.COUNTER_STYLE_RULE=11,_.FONT_FEATURE_VALUES_RULE=14,_.MARGIN_RULE=9,_);globalThis.Event??=C;globalThis.CustomEvent??=Ae;var $e=Symbol(),Fe=r=>typeof r=="boolean"?r:r?.capture??!1,T={__proto__:null};T.enumerable=!0;Object.freeze(T);var oe=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,i){if(t==null)return;let s=Fe(i)?this.__captureEventListeners:this.__eventListeners,n=s.get(e);if(n===void 0)n=new Map,s.set(e,n);else if(n.has(t))return;let o=typeof i=="object"&&i?i:{};o.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,i)),n.set(t,o??{})}removeEventListener(e,t,i){if(t==null)return;let s=Fe(i)?this.__captureEventListeners:this.__eventListeners,n=s.get(e);n!==void 0&&(n.delete(t),n.size||s.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let i=!1,s=!1,n=C.NONE,o=null,a=null,l=null,h=e.stopPropagation,d=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return o??a},...T},srcElement:{get(){return e.target},...T},currentTarget:{get(){return l},...T},eventPhase:{get(){return n},...T},composedPath:{value:()=>t,...T},stopPropagation:{value:()=>{i=!0,h.call(e)},...T},stopImmediatePropagation:{value:()=>{s=!0,d.call(e)},...T}});let c=(u,S,N)=>{typeof u=="function"?u(e):typeof u?.handleEvent=="function"&&u.handleEvent(e),S.once&&N.delete(u)},m=()=>(l=null,n=C.NONE,!e.defaultPrevented),f=t.slice().reverse();o=!this.__host||!e.composed?this:null;let A=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of f){!o&&(!a||a===u.__host)&&A(f.slice(f.indexOf(u))),l=u,n=u===e.target?C.AT_TARGET:C.CAPTURING_PHASE;let S=u.__captureEventListeners.get(e.type);if(S){for(let[N,_e]of S)if(c(N,_e,S),s)return m()}if(i)return m()}let z=e.bubbles?t:[this];a=null;for(let u of z){!o&&(!a||u===a.__host)&&A(z.slice(0,z.indexOf(u)+1)),l=u,n=u===e.target?C.AT_TARGET:C.BUBBLING_PHASE;let S=u.__eventListeners.get(e.type);if(S){for(let[N,_e]of S)if(c(N,_e,S),s)return m()}if(i)return m()}return m()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Ke,Tt]}};var qe=new WeakMap,q=r=>{let e=qe.get(r);return e===void 0&&qe.set(r,e=new Map),e},G=class extends oe{getRootNode(e){return e?.composed?xe:this.__host?.__shadowRoot??xe}};var Ge=class extends G{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Ke=new Ge,xe=Ke;var Xe=class extends G{constructor(e){if(super(),e!==$e)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ae,customElements:Te,document:xe,Document:Ge,Element:Ye,EventTarget:oe,HTMLElement:Ze,Node:G,ShadowRoot:Je,window:this,Window:Xe})}};var Ye=class extends G{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(q(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){q(this).set(e,String(t))}removeAttribute(e){q(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return q(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new Je($e,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new ze(this);return this.__internals=e,e}getAttribute(e){return q(this).get(e)??null}};var Ze=class extends Ye{},Ce=Ze;var Je=class extends G{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ce,"localName",{get(){return"lit-server-root"}});function $t(){let r,e;return{promise:new Promise((i,s)=>{r=i,e=s}),resolve:r,reject:e}}var ae=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let i=this.__pendingWhenDefineds.get(e);return i||(i=$t(),this.__pendingWhenDefineds.set(e,i)),i.promise}},Ct=ae;var Te=new Ct,Tt=new Xe($e);var K=globalThis,he=K.ShadowRoot&&(K.ShadyCSS===void 0||K.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,et=Symbol(),Qe=new WeakMap,le=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==et)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(he&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Qe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Qe.set(t,e))}return e}toString(){return this.cssText}},tt=r=>new le(typeof r=="string"?r:r+"",void 0,et);var it=(r,e)=>{if(he)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=K.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},Le=he||K.CSSStyleSheet===void 0?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return tt(t)})(r):r;var{is:Lt,defineProperty:Mt,getOwnPropertyDescriptor:Rt,getOwnPropertyNames:kt,getOwnPropertySymbols:Nt,getPrototypeOf:Pt}=Object,Y=globalThis;Y.customElements??=Te;var st=Y.trustedTypes,Ot=st?st.emptyScript:"",Ht=Y.reactiveElementPolyfillSupport,X=(r,e)=>r,Me={toAttribute(r,e){switch(e){case Boolean:r=r?Ot:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},rt=(r,e)=>!Lt(r,e),nt={attribute:!0,type:String,converter:Me,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),Y.litPropertyMetadata??=new WeakMap;var L=class extends(globalThis.HTMLElement??Ce){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=nt){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Mt(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:n}=Rt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){let a=s?.call(this);n?.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??nt}static _$Ei(){if(this.hasOwnProperty(X("elementProperties")))return;let e=Pt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(X("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){let t=this.properties,i=[...kt(t),...Nt(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(Le(s))}else e!==void 0&&t.push(Le(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return it(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:Me).toAttribute(t,i.type);this._$Em=e,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let n=i.getPropertyOptions(s),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Me;this._$Em=s;let a=o.fromAttribute(t,n.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,i,s=!1,n){if(e!==void 0){let o=this.constructor;if(s===!1&&(n=this[e]),i??=o.getPropertyOptions(e),!((i.hasChanged??rt)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,n]of i){let{wrapped:o}=n,a=this[s];o!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};L.elementStyles=[],L.shadowRootOptions={mode:"open"},L[X("elementProperties")]=new Map,L[X("finalized")]=new Map,Ht?.({ReactiveElement:L}),(Y.reactiveElementVersions??=[]).push("2.1.2");var de=globalThis,ot=r=>r,ce=de.trustedTypes,at=ce?ce.createPolicy("lit-html",{createHTML:r=>r}):void 0,pt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,mt="?"+R,Bt=`<${mt}>`,B=de.document===void 0?{createTreeWalker:()=>({})}:document,J=()=>B.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",Be=Array.isArray,It=r=>Be(r)||typeof r?.[Symbol.iterator]=="function",Re=`[
|
|
3
|
+
\f\r]`,Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lt=/-->/g,ht=/>/g,O=RegExp(`>|${Re}(?:([^\\s"'>=/]+)(${Re}*=${Re}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ct=/'/g,dt=/"/g,ft=/^(?:script|style|textarea|title)$/i,Ie=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),y=Ie(1),w=Ie(2),Wi=Ie(3),I=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ut=new WeakMap,H=B.createTreeWalker(B,129);function bt(r,e){if(!Be(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return at!==void 0?at.createHTML(e):e}var Ut=(r,e)=>{let t=r.length-1,i=[],s,n=e===2?"<svg>":e===3?"<math>":"",o=Z;for(let a=0;a<t;a++){let l=r[a],h,d,c=-1,m=0;for(;m<l.length&&(o.lastIndex=m,d=o.exec(l),d!==null);)m=o.lastIndex,o===Z?d[1]==="!--"?o=lt:d[1]!==void 0?o=ht:d[2]!==void 0?(ft.test(d[2])&&(s=RegExp("</"+d[2],"g")),o=O):d[3]!==void 0&&(o=O):o===O?d[0]===">"?(o=s??Z,c=-1):d[1]===void 0?c=-2:(c=o.lastIndex-d[2].length,h=d[1],o=d[3]===void 0?O:d[3]==='"'?dt:ct):o===dt||o===ct?o=O:o===lt||o===ht?o=Z:(o=O,s=void 0);let f=o===O&&r[a+1].startsWith("/>")?" ":"";n+=o===Z?l+Bt:c>=0?(i.push(h),l.slice(0,c)+pt+l.slice(c)+R+f):l+R+(c===-2?a:f)}return[bt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},ee=class r{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0,a=e.length-1,l=this.parts,[h,d]=Ut(e,t);if(this.el=r.createElement(h,i),H.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=H.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(pt)){let m=d[o++],f=s.getAttribute(c).split(R),A=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:A[2],strings:f,ctor:A[1]==="."?Ne:A[1]==="?"?Pe:A[1]==="@"?Oe:W}),s.removeAttribute(c)}else c.startsWith(R)&&(l.push({type:6,index:n}),s.removeAttribute(c));if(ft.test(s.tagName)){let c=s.textContent.split(R),m=c.length-1;if(m>0){s.textContent=ce?ce.emptyScript:"";for(let f=0;f<m;f++)s.append(c[f],J()),H.nextNode(),l.push({type:2,index:++n});s.append(c[m],J())}}}else if(s.nodeType===8)if(s.data===mt)l.push({type:2,index:n});else{let c=-1;for(;(c=s.data.indexOf(R,c+1))!==-1;)l.push({type:7,index:n}),c+=R.length-1}n++}}static createElement(e,t){let i=B.createElement("template");return i.innerHTML=e,i}};function D(r,e,t=r,i){if(e===I)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,n=Q(e)?void 0:e._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,t,i)),i!==void 0?(t._$Co??=[])[i]=s:t._$Cl=s),s!==void 0&&(e=D(r,s._$AS(r,e.values),s,i)),e}var ke=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??B).importNode(t,!0);H.currentNode=s;let n=H.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new te(n,n.nextSibling,this,e):l.type===1?h=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(h=new He(n,this,e)),this._$AV.push(h),l=i[++a]}o!==l?.index&&(n=H.nextNode(),o++)}return H.currentNode=B,s}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},te=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=D(this,e,t),Q(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==I&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):It(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=ee.createElement(bt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{let n=new ke(s,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=ut.get(e.strings);return t===void 0&&ut.set(e.strings,t=new ee(e)),t}k(e){Be(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,s=0;for(let n of e)s===t.length?t.push(i=new r(this.O(J()),this.O(J()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=ot(e).nextSibling;ot(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},W=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=p}_$AI(e,t=this,i,s){let n=this.strings,o=!1;if(n===void 0)e=D(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==I,o&&(this._$AH=e);else{let a=e,l,h;for(e=n[0],l=0;l<n.length-1;l++)h=D(this,a[i+l],t,l),h===I&&(h=this._$AH[l]),o||=!Q(h)||h!==this._$AH[l],h===p?e=p:e!==p&&(e+=(h??"")+n[l+1]),this._$AH[l]=h}o&&!s&&this.j(e)}j(e){e===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ne=class extends W{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===p?void 0:e}},Pe=class extends W{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==p)}},Oe=class extends W{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=D(this,e,t,0)??p)===I)return;let i=this._$AH,s=e===p&&i!==p||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==p&&(i===p||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},He=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){D(this,e)}};var Dt=de.litHtmlPolyfillSupport;Dt?.(ee,te),(de.litHtmlVersions??=[]).push("3.3.3");var vt=(r,e,t)=>{let i=t?.renderBefore??e,s=i._$litPart$;if(s===void 0){let n=t?.renderBefore??null;i._$litPart$=s=new te(e.insertBefore(J(),n),n,void 0,t??{})}return s._$AI(r),s};var Ue=globalThis,k=class extends L{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=vt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return I}};k._$litElement$=!0,k.finalized=!0,Ue.litElementHydrateSupport?.({LitElement:k});var Wt=Ue.litElementPolyfillSupport;Wt?.({LitElement:k});(Ue.litElementVersions??=[]).push("4.2.2");var v=class extends k{createRenderRoot(){return this}};function $(r){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r()}function g(r,e){customElements.get(r)||customElements.define(r,e)}var zt='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M18 6 6 18M6 6l12 12"></path></svg>',ue=class extends v{static properties={label:{type:String,reflect:!0},scrollable:{attribute:"scroll",type:Boolean,reflect:!0},single:{type:Boolean,reflect:!0}};#e=null;#i=null;#t=null;#n=e=>this.#d(e);constructor(){super(),this.label="",this.scrollable=!1,this.single=!1}get values(){return this.#e?this.#r().filter(e=>e.getAttribute("aria-pressed")==="true").map(e=>this.#c(e)):this.#t??[]}set values(e){if(!this.#e){this.#t=[...e];return}let t=new Set(e),i=!1;for(let s of this.#r()){let n=t.has(this.#c(s))&&!(this.single&&i);n&&(i=!0),s.setAttribute("aria-pressed",String(n))}}connectedCallback(){super.connectedCallback(),$(()=>this.#o())}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null,this.#e?.removeEventListener("click",this.#n),this.#e=null}updated(e){this.#h()}#r(){return this.#e?Array.from(this.#e.querySelectorAll(":scope > button, :scope > .nish-chip")):[]}#l(e){let t="";return e.childNodes.forEach(i=>{(i.nodeType===Node.TEXT_NODE||i instanceof HTMLElement&&!i.hasAttribute("data-nish-remove"))&&(t+=i.textContent??"")}),t.trim()}#c(e){return e.getAttribute("value")??this.#l(e)}#o(){if(!this.isConnected||this.#e)return;let e=this.querySelector(":scope > div.nish-chips");if(!e){for(e=document.createElement("div"),e.className="nish-chips";this.firstChild;)e.appendChild(this.firstChild);this.appendChild(e)}this.#e=e,e.setAttribute("role","group"),e.addEventListener("click",this.#n),this.#h(),this.#s(),this.#t&&(this.values=this.#t,this.#t=null),this.#i=new MutationObserver(()=>{this.#i?.disconnect(),this.#s(),this.#a()}),this.#a()}#a(){this.#e&&this.#i?.observe(this.#e,{childList:!0})}#h(){this.#e&&(this.label?this.#e.setAttribute("aria-label",this.label):this.#e.removeAttribute("aria-label"),this.#e.classList.toggle("nish-chips--scroll",this.scrollable))}#s(){for(let e of this.#r())if(e.classList.add("nish-chip"),e instanceof HTMLButtonElement)e.hasAttribute("type")||(e.type="button"),e.hasAttribute("aria-pressed")||e.setAttribute("aria-pressed","false");else if(e.hasAttribute("data-removable")&&!e.querySelector(":scope > [data-nish-remove]")){let t=this.#l(e),i=document.createElement("button");i.type="button",i.className="nish-icon-btn nish-icon-btn--xs",i.setAttribute("data-nish-remove",""),i.setAttribute("aria-label",t?`Remove ${t}`:"Remove"),i.innerHTML=zt,e.appendChild(i)}}#d(e){let t=e.target;if(!t||!this.#e)return;let i=t.closest("[data-nish-remove]");if(i&&this.#e.contains(i)){let o=i.parentElement,a=this.#c(o);o.remove(),this.dispatchEvent(new CustomEvent("nish-remove",{bubbles:!0,detail:{value:a}}));return}let s=t.closest("button");if(!s||s.parentElement!==this.#e||s.disabled||!s.hasAttribute("aria-pressed"))return;let n=s.getAttribute("aria-pressed")!=="true";if(n&&this.single)for(let o of this.#r())o!==s&&o.hasAttribute("aria-pressed")&&o.setAttribute("aria-pressed","false");s.setAttribute("aria-pressed",String(n)),this.dispatchEvent(new CustomEvent("nish-change",{bubbles:!0,detail:{values:this.values}}))}};g("nish-chip-group",ue);var gt=(r,e)=>{let t=e.trim().toLowerCase();return t?r.label.toLowerCase().includes(t)||(r.hint?.toLowerCase().includes(t)??!1):!0};var Ft=0,Et="http://www.w3.org/2000/svg",qt="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";function yt(r){let e=document.createElementNS(Et,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","16"),e.setAttribute("height","16"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("aria-hidden","true");let t=document.createElementNS(Et,"path");return t.setAttribute("d",r),e.append(t),e}var pe=class extends v{static properties={value:{type:String,reflect:!0},placeholder:{type:String},label:{type:String},allowCustom:{type:Boolean,attribute:"allow-custom",reflect:!0},emptyText:{type:String,attribute:"empty-text"},size:{type:String,reflect:!0},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},name:{type:String},options:{attribute:!1},filter:{attribute:!1}};#e=++Ft;#i=null;#t=null;#n=null;#r=null;#l=null;#c=null;#o=!1;#a="";#h=!1;#s=-1;#d;#p=!1;constructor(){super(),this.value=null,this.placeholder=null,this.label=null,this.allowCustom=!1,this.emptyText="No matches",this.size=null,this.disabled=!1,this.loading=!1,this.name=null,this.options=[],this.filter=null}get input(){return this.#t}connectedCallback(){if(super.connectedCallback(),this.#i){this.#u();return}this.#p||(this.#p=!0,$(()=>{this.#p=!1,this.isConnected&&this.#f()}))}disconnectedCallback(){super.disconnectedCallback(),window.clearTimeout(this.#d),this.#m()}#f(){if(this.#i)return;let e=Array.from(this.querySelectorAll(":scope > option")),t=e.map(l=>({value:l.value,label:l.textContent?.trim()??l.value,hint:l.dataset.hint||void 0,disabled:l.disabled||void 0}));for(let l of e)l.remove();this.options.length===0&&t.length>0&&(this.options=t);let i=document.createElement("div");i.className="nish-combobox";let s=document.createElement("input");s.type="text",s.className="nish-input nish-combobox-input",s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-expanded","false"),s.autocomplete="off",s.setAttribute("autocapitalize","off"),s.spellcheck=!1,s.addEventListener("input",()=>this.#M(s.value)),s.addEventListener("keydown",l=>this.#R(l)),s.addEventListener("focus",()=>this.#A()),s.addEventListener("click",()=>this.#A()),s.addEventListener("blur",()=>{this.#$()||(this.#m(),this.#E(),this.#u())}),s.addEventListener("change",l=>l.stopPropagation());let n=document.createElement("button");n.type="button",n.className="nish-icon-btn nish-combobox-clear",n.setAttribute("aria-label","Clear"),n.tabIndex=-1,n.hidden=!0,n.append(yt("M18 6 6 18M6 6l12 12")),n.addEventListener("mousedown",l=>l.preventDefault()),n.addEventListener("click",()=>{this.#m(),this.#g(null,null),s.focus()});let o=document.createElement("span");o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.style.cssText=qt;let a=document.createElement("input");a.type="hidden",i.append(s,n,o),this.append(i,a),this.#i=i,this.#t=s,this.#n=n,this.#r=o,this.#c=a,this.#u()}updated(e){e.has("value")&&e.get("value")!==void 0&&this.#E(),e.has("disabled")&&this.disabled&&this.#m(),(e.has("options")||e.has("filter")||e.has("loading"))&&this.#T(),this.#u()}get#b(){return this.options.find(e=>e.value===this.value)??null}get#w(){return this.value!=null&&this.value!==""}get#C(){return this.#h?this.#a:this.#b?.label??this.value??""}get#v(){let e=this.filter??gt;return(this.#h?this.options.filter(i=>e(i,this.#a)):this.options).slice(0,50)}#T(){this.#s>=this.#v.length&&(this.#s=-1)}#E(){this.#h=!1,this.#a=""}#A(){if(this.#o||this.disabled||!this.#t)return;this.#o=!0;let e=this.#b,t=e?this.#v.findIndex(i=>i.value===e.value):-1;this.#s=t>=0?t:-1,this.#u()}#m(){this.#o=!1,this.#s=-1,this.#l?.remove(),this.#l=null,this.#t&&(this.#t.setAttribute("aria-expanded","false"),this.#t.removeAttribute("aria-controls"),this.#t.removeAttribute("aria-activedescendant")),this.#r&&(this.#r.textContent="")}#y(e,t){let i=this.#v,s=i.length;if(s===0)return-1;let n=e;for(let o=0;o<s;o++)if(n=(n+t+s)%s,!i[n].disabled)return n;return-1}#_(e){return e===1?this.#y(-1,1):this.#y(0,-1)}#g(e,t){this.value=e,this.#E(),this.#u();let i={value:e,option:t};this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("nish-change",{bubbles:!0,detail:i}))}#x(e){e.disabled||(this.#m(),this.#g(e.value,e))}#$(){return!this.#h||this.#a.trim()!==""||!this.#w?!1:(this.#m(),this.#g(null,null),!0)}#L(){let e=this.#a.trim();if(!this.allowCustom||!this.#h||!e)return!1;let t=this.options.find(i=>!i.disabled&&i.label.toLowerCase()===e.toLowerCase());return this.#m(),t?this.#g(t.value,t):this.#g(e,null),!0}#M(e){this.#a=e,this.#h=!0,this.#o=!0,this.allowCustom||e.trim()===""?this.#s=-1:this.#s=this.#v.findIndex(t=>!t.disabled),window.clearTimeout(this.#d),this.#d=window.setTimeout(()=>{this.dispatchEvent(new CustomEvent("nish-query",{bubbles:!0,detail:{query:e}}))},200),this.#u()}#R(e){if(this.disabled)return;let t=this.#v;switch(e.key){case"ArrowDown":case"ArrowUp":{e.preventDefault();let i=e.key==="ArrowDown"?1:-1;if(this.#o){this.#S(this.#s<0?this.#_(i):this.#y(this.#s,i));break}else{this.#o=!0;let s=this.#b,n=s?t.findIndex(o=>o.value===s.value):-1;this.#s=n>=0?n:this.#_(i)}this.#u();break}case"Home":case"End":this.#o&&(e.preventDefault(),this.#S(this.#_(e.key==="Home"?1:-1)));break;case"Enter":this.#o&&this.#s>=0&&t[this.#s]?(e.preventDefault(),this.#x(t[this.#s])):(this.#$()||this.#L()||this.#o)&&e.preventDefault();break;case"Escape":this.#o?(e.preventDefault(),e.stopPropagation(),this.#m(),this.#u()):this.#h&&(e.preventDefault(),e.stopPropagation(),this.#E(),this.#u());break;case"Tab":this.#m();break}}#u(){let e=this.#t,t=this.#i;if(!e||!t||!this.#n||!this.#c||!this.#r)return;t.classList.toggle("nish-combobox--sm",this.size==="sm");let i=this.#C;e.value!==i&&(e.value=i),e.disabled=this.disabled,this.placeholder?e.placeholder=this.placeholder:e.removeAttribute("placeholder"),this.label?e.setAttribute("aria-label",this.label):e.removeAttribute("aria-label"),this.#n.hidden=!(this.#w&&!this.disabled);let s=this.#c;if(this.name?s.name=this.name:s.removeAttribute("name"),s.value=this.value??"",s.disabled=this.disabled,!this.#o){this.#l&&this.#m();return}this.#k(e,t,this.#r)}#S(e){let t=this.#s;this.#s=e;let i=this.#l,s=this.#t;if(!i||!s||!this.#o){this.#u();return}i.querySelector("[data-active]")?.removeAttribute("data-active");let n=e>=0?i.querySelector(`[data-index="${e}"]`):null;if(!n){t!==e?this.#u():s.removeAttribute("aria-activedescendant");return}n.dataset.active="",s.setAttribute("aria-activedescendant",n.id),n.scrollIntoView?.({block:"nearest"})}#k(e,t,i){let s=`nish-cb-list-${this.#e}`,n=this.#v,o=this.#b,a=this.#l;if(!a){a=document.createElement("ul"),a.id=s,a.className="nish-combobox-list",a.setAttribute("role","listbox");let h=d=>{let c=d.target?.closest("li[data-index]");if(!c||!a.contains(c))return null;let m=Number(c.dataset.index),f=this.#v[m];return f?{o:f,i:m}:null};a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("mousemove",d=>{let c=h(d);c&&!c.o.disabled&&this.#s!==c.i&&this.#S(c.i)}),a.addEventListener("click",d=>{let c=h(d);c&&this.#x(c.o)}),this.#l=a,t.append(a)}this.label?(a.setAttribute("aria-label",this.label),a.removeAttribute("aria-labelledby")):(a.removeAttribute("aria-label"),e.id||(e.id=`nish-cb-${this.#e}`),a.setAttribute("aria-labelledby",e.id));let l=n.map((h,d)=>{let c=document.createElement("li");c.id=`${s}-opt-${d}`,c.className="nish-combobox-option",c.setAttribute("role","option"),c.dataset.index=String(d),c.setAttribute("aria-selected",String(o?.value===h.value)),h.disabled&&c.setAttribute("aria-disabled","true"),d===this.#s&&(c.dataset.active="");let m=document.createElement("span");if(m.className="nish-combobox-label",m.textContent=h.label,c.append(m),h.hint){let f=document.createElement("span");f.className="nish-combobox-hint",f.textContent=h.hint,c.append(f)}return o?.value===h.value&&c.append(yt("M20 6 9 17l-5-5")),c});if(this.loading){let h=document.createElement("li");h.setAttribute("role","presentation"),h.className="nish-combobox-loading";let d=document.createElement("span");d.className="nish-spinner nish-spinner--sm",d.setAttribute("aria-hidden","true"),h.append(d,document.createTextNode("Searching\u2026")),l.push(h)}else if(n.length===0){let h=document.createElement("li");h.setAttribute("role","presentation"),h.className="nish-combobox-empty",h.textContent=this.emptyText,l.push(h)}a.replaceChildren(...l),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-controls",s),this.#s>=0&&n[this.#s]?e.setAttribute("aria-activedescendant",`${s}-opt-${this.#s}`):e.removeAttribute("aria-activedescendant"),i.textContent=this.loading?"Searching\u2026":n.length===0?this.emptyText:`${n.length} ${n.length===1?"result":"results"}`,this.#N(a,e),a.querySelector(`[data-index="${this.#s}"]`)?.scrollIntoView?.({block:"nearest"})}#N(e,t){e.style.top="",e.style.bottom="",e.style.marginTop="",e.style.marginBottom="",delete e.dataset.above;let i=t.getBoundingClientRect(),s=e.getBoundingClientRect().height,n=window.innerHeight-i.bottom;s>n&&i.top>n&&(e.dataset.above="",e.style.top="auto",e.style.bottom="100%",e.style.marginTop="0",e.style.marginBottom="4px")}};g("nish-combobox",pe);var _t=1500,St="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0",Gt=w`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="14" height="14" x="8" y="8" rx="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>`,Kt=w`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="var(--nish-ok)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20 6 9 17l-5-5"></path></svg>`;async function Xt(r){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(r),!0}catch{}let e=document.createElement("textarea");e.value=r,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:-1000px;opacity:0";let t=document.activeElement;document.body.appendChild(e),e.select();let i=!1;try{i=document.execCommand("copy")}catch{i=!1}return e.remove(),t?.focus?.(),i}var me=class extends v{static properties={value:{type:String,reflect:!0},for:{type:String,reflect:!0},label:{type:String,reflect:!0},copiedLabel:{attribute:"copied-label",reflect:!0},icon:{type:Boolean,reflect:!0},copied:{state:!0},manual:{state:!0}};#e=null;constructor(){super(),this.value=null,this.for=null,this.label="Copy",this.copiedLabel="Copied",this.icon=!1,this.copied=!1,this.manual=!1}disconnectedCallback(){super.disconnectedCallback(),this.#e&&clearTimeout(this.#e),this.#e=null,this.copied=!1,this.manual=!1}#i(){return this.value!=null?this.value:(this.for?document.getElementById(this.for):null)?.textContent??""}async#t(){let e=this.#i();if(!await Xt(e)){await this.#n();return}this.manual=!1,this.copied=!0,this.dispatchEvent(new CustomEvent("nish-copy",{bubbles:!0,detail:{text:e}})),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.copied=!1,this.#e=null},_t)}async#n(){this.copied=!1,this.manual=!0,await this.updateComplete;let e=this.value==null&&this.for?document.getElementById(this.for):null;if(e){let t=document.createRange();t.selectNodeContents(e);let i=window.getSelection();i?.removeAllRanges(),i?.addRange(t)}else{let t=this.querySelector("textarea[data-copy-source]");t?.focus(),t?.select()}this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{document.activeElement?.matches("textarea[data-copy-source]")&&this.contains(document.activeElement)&&this.querySelector("button")?.focus(),this.manual=!1,this.#e=null},_t)}render(){let e=this.copied?this.copiedLabel:this.manual?"Press Ctrl+C":this.label,t=this.copied?Kt:Gt;return y`${this.icon?y`<button type="button" class="nish-icon-btn nish-icon-btn--sm nish-copy-btn" aria-label=${e} title=${e} ?data-copied=${this.copied} @click=${()=>this.#t()}>
|
|
5
|
+
${t}
|
|
6
|
+
</button>`:y`<button type="button" class="nish-btn nish-btn--sm nish-copy-btn" ?data-copied=${this.copied} @click=${()=>this.#t()}>
|
|
7
|
+
${t}${e}
|
|
8
|
+
</button>`}<span role="status" aria-live="polite" style=${St}>${this.copied?this.copiedLabel:this.manual?"Press Ctrl+C":p}</span>${this.manual&&this.value!=null?y`<textarea data-copy-source readonly tabindex="-1" aria-label=${this.value} style=${St} .value=${this.value}></textarea>`:p}`}};g("nish-copy-button",me);var Yt=0,fe=class extends v{static properties={label:{type:String},hint:{type:String},error:{type:String},optional:{type:Boolean,reflect:!0},layout:{type:String,reflect:!0},labelWidth:{attribute:"label-width",reflect:!0}};#e=`nish-field-${++Yt}`;#i=null;#t=null;#n=null;#r=null;#l="";#c=!1;constructor(){super(),this.optional=!1,this.layout="stack"}connectedCallback(){super.connectedCallback(),$(()=>this.#o())}disconnectedCallback(){super.disconnectedCallback(),this.#n?.disconnect(),this.#n=null,this.#r?.disconnect(),this.#r=null,this.#i=null,this.#t=null}updated(e){this.#s()}#o(){if(!this.isConnected||this.#i)return;let e=this.querySelector(":scope > div.nish-field");if(!e){let t=this.firstElementChild;if(!t){this.#r||(this.#r=new MutationObserver(()=>{this.firstElementChild&&(this.#r?.disconnect(),this.#r=null,this.#o())}),this.#r.observe(this,{childList:!0}));return}e=document.createElement("div"),e.appendChild(t),this.appendChild(e)}e.classList.add("nish-field"),this.#i=e,this.#t=Array.from(e.children).find(t=>!t.matches("label.nish-field-label, small.nish-hint, small.nish-error")),this.#l=(this.#a()?.getAttribute("aria-describedby")??"").split(/\s+/).filter(t=>t&&t!==`${this.#e}-hint`&&t!==`${this.#e}-error`).join(" "),this.#s(),this.#t&&this.#t.localName.startsWith("nish-")&&(this.#n=new MutationObserver(()=>{this.#a()&&!this.#h()&&this.#s()}),this.#n.observe(this.#t,{childList:!0,subtree:!0}))}#a(){let e=this.#t;return e?e.localName==="nish-combobox"||e.localName==="nish-search"?e.querySelector("input"):e:null}#h(){let e=this.#a();return!!e&&!!e.id&&this.#i?.querySelector("label.nish-field-label")?.getAttribute("for")===e.id}#s(){let e=this.#i;if(!e)return;let t=this.layout==="inline";e.classList.toggle("nish-field--inline",t),t&&this.labelWidth?(e.style.setProperty("--nish-field-label-w",this.labelWidth),e.style.setProperty("--nish-field-label-width",this.labelWidth)):(e.style.removeProperty("--nish-field-label-w"),e.style.removeProperty("--nish-field-label-width"));let i=this.#a();i&&!i.id&&(i.id=`${this.#e}-control`);let s=i?.id??"",n=!!this.error,o=!!this.hint&&!n,a=e.querySelector(":scope > label.nish-field-label");if(this.label){if(a||(a=document.createElement("label"),a.className="nish-field-label",e.prepend(a)),s&&(a.htmlFor=s),a.textContent=this.label,this.optional){let d=document.createElement("span");d.className="nish-optional",d.textContent="Optional",a.appendChild(d)}}else a?.remove();let l=`${this.#e}-hint`,h=`${this.#e}-error`;if(this.#d(e,"hint",o?this.hint:"",l),this.#d(e,"error",n?this.error:"",h),i){let d=[this.#l,n?h:o?l:""].filter(Boolean).join(" ");d?i.setAttribute("aria-describedby",d):i.removeAttribute("aria-describedby"),n?(i.setAttribute("aria-invalid","true"),this.#c=!0):this.#c&&(i.removeAttribute("aria-invalid"),this.#c=!1)}}#d(e,t,i,s){let n=e.querySelector(`:scope > small.nish-${t}`);if(!i){n?.remove();return}n||(n=document.createElement("small"),n.className=`nish-${t}`,t==="error"&&n.setAttribute("role","alert"),e.appendChild(n)),n.id=s,n.textContent!==i&&(n.textContent=i)}};g("nish-field",fe);var Zt=r=>w`<svg width=${r} height=${r} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg>`,Jt=w`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M18 6 6 18M6 6l12 12"></path></svg>`,be=class extends v{static properties={value:{type:String},placeholder:{type:String},label:{type:String},size:{type:String,reflect:!0},variant:{type:String,reflect:!0},name:{type:String},disabled:{type:Boolean,reflect:!0}};constructor(){super(),this.value="",this.placeholder="Search",this.label="",this.size="md",this.variant="field",this.disabled=!1}get input(){return this.querySelector("input.nish-input")}focus(e){this.input?.focus(e)}#e(){this.dispatchEvent(new CustomEvent("nish-input",{bubbles:!0,detail:{value:this.value}}))}#i(e){this.value=e.target.value,this.#e()}#t(){this.value="";let e=this.input;e&&(e.value=""),this.#e(),this.dispatchEvent(new CustomEvent("nish-clear",{bubbles:!0})),e?.focus()}#n(e){e.key==="Escape"&&this.value&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.#t())}render(){let e=["nish-search"];return(this.size==="xs"||this.size==="sm")&&e.push(`nish-search--${this.size}`),this.variant==="bare"&&e.push("nish-search--bare"),y`<label class=${e.join(" ")}>
|
|
9
|
+
${Zt(this.size==="md"||!this.size?16:14)}
|
|
10
|
+
<input
|
|
11
|
+
class="nish-input"
|
|
12
|
+
type="search"
|
|
13
|
+
enterkeyhint="search"
|
|
14
|
+
autocomplete="off"
|
|
15
|
+
aria-label=${this.label||(this.closest("nish-field")?p:"Search")}
|
|
16
|
+
placeholder=${this.placeholder??""}
|
|
17
|
+
name=${this.name??p}
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
.value=${this.value??""}
|
|
20
|
+
@input=${t=>this.#i(t)}
|
|
21
|
+
@keydown=${t=>this.#n(t)}
|
|
22
|
+
/>
|
|
23
|
+
${this.value&&!this.disabled?y`<button type="button" class="nish-icon-btn nish-icon-btn--xs" aria-label="Clear" @click=${()=>this.#t()}>${Jt}</button>`:p}
|
|
24
|
+
</label>`}};g("nish-search",be);function De(r){let e=()=>{let n=r.scrollWidth-r.clientWidth;r.dataset.atStart=String(r.scrollLeft<=1),r.dataset.atEnd=String(n<=1||r.scrollLeft>=n-1)};e(),r.addEventListener("scroll",e,{passive:!0});let t,i=()=>{if(t)for(let n of Array.from(r.children))t.observe(n)};typeof ResizeObserver<"u"&&(t=new ResizeObserver(e),t.observe(r),i());let s;return typeof MutationObserver<"u"&&(s=new MutationObserver(()=>{e(),i()}),s.observe(r,{childList:!0})),()=>{r.removeEventListener("scroll",e),t?.disconnect(),s?.disconnect()}}function We(r,e){let t=r.getBoundingClientRect(),i=e.getBoundingClientRect(),s=8;i.left<t.left+s?r.scrollLeft+=i.left-t.left-s:i.right>t.right-s&&(r.scrollLeft+=i.right-t.right+s)}var Qt=0,wt=r=>r.replace(/[^\w-]+/g,"-"),ve=class extends v{static properties={label:{type:String,reflect:!0},value:{type:String,reflect:!0},variant:{type:String,reflect:!0},size:{type:String,reflect:!0},block:{type:Boolean,reflect:!0}};#e=null;#i="";#t=null;#n=null;#r=e=>{let t=e.target?.closest("button");t&&this.#e?.contains(t)&&this.#p(t)};#l=e=>{let t=this.#h();if(!t.length)return;let i=t.findIndex(o=>o===document.activeElement),s=i>=0?i:Math.max(0,t.findIndex(o=>o.getAttribute("aria-selected")==="true")),n;if(e.key==="ArrowRight")n=t[(s+1)%t.length];else if(e.key==="ArrowLeft")n=t[(s-1+t.length)%t.length];else if(e.key==="Home")n=t[0];else if(e.key==="End")n=t[t.length-1];else return;e.preventDefault(),this.#p(n),n.focus()};constructor(){super(),this.label="",this.value="",this.variant="",this.size="",this.block=!1}connectedCallback(){super.connectedCallback(),$(()=>this.#c())}disconnectedCallback(){super.disconnectedCallback(),this.#e?.removeEventListener("click",this.#r),this.#e?.removeEventListener("keydown",this.#l),this.#e=null,this.#t?.(),this.#t=null,this.#n?.disconnect(),this.#n=null}updated(e){this.#f()}#c(){if(!this.isConnected||this.#e)return;let e=this.querySelector(":scope > div.nish-tabs");if(!e){e=document.createElement("div");for(let t of Array.from(this.children))t instanceof HTMLButtonElement&&e.appendChild(t);this.insertBefore(e,this.firstChild)}this.#e=e,this.#i=this.id||`nish-tabs-${++Qt}`,e.setAttribute("role","tablist"),e.style.overflowX="auto",e.classList.add("nish-tabs","nish-no-scrollbar","nish-scroll-fade"),e.addEventListener("click",this.#r),e.addEventListener("keydown",this.#l),this.#t=De(e),this.#n=new MutationObserver(()=>{this.#n?.disconnect(),this.#f(),this.#o()}),this.#o(),this.#f()}#o(){this.#e&&this.#n?.observe(this.#e,{childList:!0})}#a(){return this.#e?Array.from(this.#e.querySelectorAll(":scope > button")):[]}#h(){return this.#a().filter(e=>!e.disabled)}#s(e){return e.getAttribute("value")??(e.textContent??"").trim()}#d(){let e=this.id?document:this,t=Array.from(e.querySelectorAll("[data-tab-panel]"));return this.id?t.filter(i=>i.getAttribute("data-tabs")===this.id):t}#p(e){if(e.disabled)return;let t=this.#s(e),i=t!==this.value;this.value=t,this.#b(),i&&this.dispatchEvent(new CustomEvent("nish-change",{detail:{value:t},bubbles:!0}))}#f(){let e=this.#e;if(!e)return;e.setAttribute("aria-label",this.label),e.classList.toggle("nish-tabs--pill",this.variant==="pill"),e.classList.toggle("nish-tabs--sm",this.size==="sm"),e.classList.toggle("nish-tabs--xs",this.size==="xs"),e.classList.toggle("nish-tabs--block",this.block);let t=this.#a();if(!t.some(i=>this.#s(i)===this.value&&!i.disabled)){let i=t.find(s=>!s.disabled);i&&(this.value=this.#s(i))}this.#b()}#b(){let e=this.#e;if(!e)return;let t=this.#a(),i=this.#d(),s=null;for(let o of t){let a=this.#s(o),l=a===this.value&&!o.disabled;l&&(s=o),o.id||(o.id=`${this.#i}-tab-${wt(a)}`),o.type="button",o.classList.add("nish-tab"),o.setAttribute("role","tab"),o.setAttribute("aria-selected",String(l));let h=i.find(d=>d.getAttribute("data-tab-panel")===a);h?(h.id||(h.id=`${this.#i}-panel-${wt(a)}`),o.setAttribute("aria-controls",h.id),h.setAttribute("role","tabpanel"),h.setAttribute("aria-labelledby",o.id),h.hidden=!l):o.removeAttribute("aria-controls")}let n=s??t.find(o=>!o.disabled)??null;for(let o of t)o.tabIndex=o===n?0:-1;s&&We(e,s)}};g("nish-tabs",ve);var ge=class extends v{static properties={label:{type:String,reflect:!0},value:{type:String,reflect:!0},size:{type:String,reflect:!0},block:{type:Boolean,reflect:!0},overflow:{type:String,reflect:!0},name:{type:String,reflect:!0}};#e=null;#i=null;#t=null;#n=null;#r=e=>{let t=e.target?.closest("button");t&&this.#e?.contains(t)&&this.#d(t)};#l=e=>{let t=this.#h();if(!t.length)return;let i=t.findIndex(a=>a===document.activeElement),s=t.findIndex(a=>a.getAttribute("aria-checked")==="true"),n=i>=0?i:s,o;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=n<0?t[0]:t[(n+1)%t.length];else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=n<0?t[t.length-1]:t[(n-1+t.length)%t.length];else if(e.key==="Home")o=t[0];else if(e.key==="End")o=t[t.length-1];else return;e.preventDefault(),this.#d(o),o.focus()};constructor(){super(),this.label="",this.value="",this.size="",this.block=!1,this.overflow="scroll",this.name=""}connectedCallback(){super.connectedCallback(),$(()=>this.#c())}disconnectedCallback(){super.disconnectedCallback(),this.#e?.removeEventListener("click",this.#r),this.#e?.removeEventListener("keydown",this.#l),this.#e=null,this.#t?.(),this.#t=null,this.#n?.disconnect(),this.#n=null}updated(e){this.#p()}#c(){if(!this.isConnected||this.#e)return;let e=this.querySelector(":scope > div.nish-seg");if(!e){e=document.createElement("div");for(let t of Array.from(this.children))t instanceof HTMLButtonElement&&e.appendChild(t);this.insertBefore(e,this.firstChild)}this.#e=e,e.classList.add("nish-seg"),e.setAttribute("role","radiogroup"),e.addEventListener("click",this.#r),e.addEventListener("keydown",this.#l),this.#n=new MutationObserver(()=>{this.#n?.disconnect(),this.#p(),this.#o()}),this.#o(),this.#p()}#o(){this.#e&&this.#n?.observe(this.#e,{childList:!0})}#a(){return this.#e?Array.from(this.#e.querySelectorAll(":scope > button")):[]}#h(){return this.#a().filter(e=>!e.disabled)}#s(e){return e.getAttribute("value")??(e.textContent??"").trim()}#d(e){if(e.disabled)return;let t=this.#s(e),i=t!==this.value;this.value=t,this.#f(),i&&(this.dispatchEvent(new CustomEvent("nish-change",{detail:{value:t},bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}#p(){let e=this.#e;if(!e)return;let t=this.overflow!=="wrap";e.setAttribute("aria-label",this.label),e.classList.toggle("nish-seg--xs",this.size==="xs"),e.classList.toggle("nish-seg--md",this.size==="md"),e.classList.toggle("nish-seg--block",this.block),e.classList.toggle("nish-no-scrollbar",t),e.classList.toggle("nish-scroll-fade",t),e.style.overflowX=t?"auto":"",t&&!this.#t?this.#t=De(e):!t&&this.#t&&(this.#t(),this.#t=null,delete e.dataset.atStart,delete e.dataset.atEnd),this.name?(this.#i||(this.#i=document.createElement("input"),this.#i.type="hidden",this.appendChild(this.#i)),this.#i.name=this.name):this.#i&&(this.#i.remove(),this.#i=null),this.#f()}#f(){let e=this.#e;if(!e)return;let t=this.#a(),i=null;for(let n of t){let o=this.#s(n)===this.value&&!n.disabled;o&&(i=n),n.type="button",n.setAttribute("role","radio"),n.setAttribute("aria-checked",String(o))}let s=i??t.find(n=>!n.disabled)??null;for(let n of t)n.tabIndex=n===s?0:-1;this.#i&&(this.#i.value=i?this.value:""),i&&this.overflow!=="wrap"&&We(e,i)}};g("nish-segmented",ge);function At(r,e,t,i,s){let n=r.filter(u=>u!=null&&Number.isFinite(u)),o=n.length===0,a=i??(o?0:Math.min(...n)),l=s??(o?1:Math.max(...n)),h=2,d=u=>r.length<=1?e/2:u/(r.length-1)*e,c=u=>l===a?t/2:h+(1-(u-a)/(l-a))*(t-2*h),m=[],f=[];r.forEach((u,S)=>{u==null||!Number.isFinite(u)?(f.length&&m.push(f),f=[]):f.push({x:d(S),y:c(u)})}),f.length&&m.push(f);let A=u=>u.length===1?`M${u[0].x},${u[0].y}h0`:u.map((S,N)=>`${N?"L":"M"}${S.x},${S.y}`).join(""),z=u=>u.length<2?"":`${A(u)}L${u[u.length-1].x},${t}L${u[0].x},${t}Z`;return{empty:o,lines:m.map(A),areas:m.map(z),baseline:`M0,${t/2}H${e}`}}var xt={"chart-1":"var(--nish-chart-1)","chart-2":"var(--nish-chart-2)","chart-3":"var(--nish-chart-3)","chart-4":"var(--nish-chart-4)","chart-5":"var(--nish-chart-5)","chart-6":"var(--nish-chart-6)","chart-7":"var(--nish-chart-7)","chart-8":"var(--nish-chart-8)",accent:"var(--nish-accent)",ok:"var(--nish-ok-fill)",warn:"var(--nish-warn-fill)",loss:"var(--nish-loss-fill)",info:"var(--nish-info-fill)"};function ei(r){if(r==null)return[];let e=r.trim();return e?e.split(",").map(t=>{let i=t.trim();if(i==="")return null;let s=Number(i);return Number.isFinite(s)?s:null}):[]}var Ee=class extends v{static properties={values:{attribute:"values",reflect:!0,converter:{fromAttribute:e=>ei(e),toAttribute:e=>e.map(t=>t==null?"":String(t)).join(",")}},tone:{type:String,reflect:!0},label:{type:String,reflect:!0},width:{type:Number,reflect:!0},height:{type:Number,reflect:!0},fill:{type:Boolean,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0}};constructor(){super(),this.values=[],this.tone="chart-1",this.label="",this.width=120,this.height=28,this.fill=!1}render(){let e=Array.isArray(this.values)?this.values:[];if(e.length<2)return p;let t=this.width>0?this.width:120,i=this.height>0?this.height:28,{empty:s,lines:n,areas:o,baseline:a}=At(e,t,i,this.min??void 0,this.max??void 0),l=s?"var(--nish-line-strong)":Object.hasOwn(xt,this.tone)?xt[this.tone]:"var(--nish-chart-1)",h=this.label||"Trend";return y`<svg
|
|
25
|
+
class="nish-sparkline"
|
|
26
|
+
role="img"
|
|
27
|
+
aria-label=${s?`${h}: no data`:h}
|
|
28
|
+
width=${t}
|
|
29
|
+
height=${i}
|
|
30
|
+
viewBox="0 0 ${t} ${i}"
|
|
31
|
+
preserveAspectRatio="none"
|
|
32
|
+
style="color:${l}"
|
|
33
|
+
>
|
|
34
|
+
${s?w`<path d=${a} stroke="currentColor" stroke-width="1.5" stroke-dasharray="3 3" vector-effect="non-scaling-stroke"></path>`:w`${this.fill?o.map(d=>w`<path d=${d} fill="currentColor" fill-opacity="0.15"></path>`):p}${n.map(d=>w`<path d=${d} fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" vector-effect="non-scaling-stroke"></path>`)}`}
|
|
35
|
+
</svg>`}};g("nish-sparkline",Ee);var ti=0,ye=class extends v{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},description:{type:String},size:{type:String,reflect:!0},labelSide:{attribute:"label-side",reflect:!0},name:{type:String}};#e=`nish-switch-${++ti}`;constructor(){super(),this.checked=!1,this.disabled=!1,this.size="md",this.labelSide="end"}get button(){return this.querySelector("button.nish-switch")}focus(e){this.button?.focus(e)}#i(){this.disabled||(this.checked=!this.checked,this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("nish-change",{bubbles:!0,detail:{checked:this.checked}})))}updated(e){e.has("checked")&&this.button?.setAttribute("aria-checked",String(this.checked))}render(){let e=!!this.label,t=e?y`<span style="min-width:0">
|
|
36
|
+
<span id=${`${this.#e}-label`} style="display:block;line-height:1.375">${this.label}</span>
|
|
37
|
+
${this.description?y`<span id=${`${this.#e}-desc`} style="display:block;margin-top:2px;font-size:var(--nish-text-xs);color:var(--nish-hi3)">${this.description}</span>`:p}
|
|
38
|
+
</span>`:p,i=this.labelSide==="start",s=y`<button
|
|
39
|
+
type="button"
|
|
40
|
+
class=${this.size==="sm"?"nish-switch nish-switch--sm":"nish-switch"}
|
|
41
|
+
role="switch"
|
|
42
|
+
aria-checked=${String(this.checked)}
|
|
43
|
+
aria-labelledby=${e?`${this.#e}-label`:p}
|
|
44
|
+
aria-describedby=${e&&this.description?`${this.#e}-desc`:p}
|
|
45
|
+
?disabled=${this.disabled}
|
|
46
|
+
@click=${()=>this.#i()}
|
|
47
|
+
></button>`;return y`<label class="nish-check-row" style=${i?"justify-content:space-between":p}>
|
|
48
|
+
${i?t:p}${s}${i?p:t}
|
|
49
|
+
${this.name?y`<input type="hidden" name=${this.name} value="on" ?disabled=${!this.checked||this.disabled} />`:p}
|
|
50
|
+
</label>`}};g("nish-switch",ye);export{ue as NishChipGroup,pe as NishCombobox,me as NishCopyButton,v as NishElement,fe as NishField,be as NishSearch,ge as NishSegmented,Ee as NishSparkline,ye as NishSwitch,ve as NishTabs,g as define};
|
|
51
|
+
/*! Bundled license information:
|
|
52
|
+
|
|
53
|
+
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
54
|
+
@lit-labs/ssr-dom-shim/lib/events.js:
|
|
55
|
+
(**
|
|
56
|
+
* @license
|
|
57
|
+
* Copyright 2023 Google LLC
|
|
58
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
+
*)
|
|
60
|
+
|
|
61
|
+
@lit-labs/ssr-dom-shim/lib/css.js:
|
|
62
|
+
@lit-labs/ssr-dom-shim/lib/observers.js:
|
|
63
|
+
(**
|
|
64
|
+
* @license
|
|
65
|
+
* Copyright 2024 Google LLC
|
|
66
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
+
*)
|
|
68
|
+
|
|
69
|
+
@lit-labs/ssr-dom-shim/index.js:
|
|
70
|
+
@lit/reactive-element/node/css-tag.js:
|
|
71
|
+
(**
|
|
72
|
+
* @license
|
|
73
|
+
* Copyright 2019 Google LLC
|
|
74
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
+
*)
|
|
76
|
+
|
|
77
|
+
lit-html/node/lit-html.js:
|
|
78
|
+
lit-element/lit-element.js:
|
|
79
|
+
(**
|
|
80
|
+
* @license
|
|
81
|
+
* Copyright 2017 Google LLC
|
|
82
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
83
|
+
*)
|
|
84
|
+
|
|
85
|
+
lit-html/node/is-server.js:
|
|
86
|
+
(**
|
|
87
|
+
* @license
|
|
88
|
+
* Copyright 2022 Google LLC
|
|
89
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
|
+
*)
|
|
91
|
+
*/
|
|
92
|
+
//# sourceMappingURL=elements-forms.js.map
|