kempo-ui 0.0.8 → 0.0.10

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.
Files changed (61) hide show
  1. package/dist/src/components/Card.js +3 -3
  2. package/dist/src/components/Dialog.js +11 -11
  3. package/dist/src/components/Icon.js +1 -1
  4. package/dist/src/components/Toggle.js +15 -14
  5. package/dist/src/components/Tree.js +11 -3
  6. package/docs/components/accordion.html +2 -3
  7. package/docs/components/card.html +2 -3
  8. package/docs/components/collapsible.html +2 -3
  9. package/docs/components/content-slider.html +3 -3
  10. package/docs/components/dialog.html +237 -5
  11. package/docs/components/focus-capture.html +2 -3
  12. package/docs/components/hybrid-component.html +2 -3
  13. package/docs/components/icon.html +6 -7
  14. package/docs/components/import.html +2 -3
  15. package/docs/components/light-component.html +2 -3
  16. package/docs/components/persistant-collapsible.html +19 -37
  17. package/docs/components/photo-viewer.html +129 -84
  18. package/docs/components/resize.html +2 -3
  19. package/docs/components/shadow-component.html +2 -3
  20. package/docs/components/show-more.html +2 -4
  21. package/docs/components/side-menu.html +2 -3
  22. package/docs/components/sortable.html +3 -3
  23. package/docs/components/split.html +2 -3
  24. package/docs/components/table.html +2 -3
  25. package/docs/components/tableControls.html +2 -3
  26. package/docs/components/tableCustomFields.html +2 -3
  27. package/docs/components/tableFetchRecords.html +2 -3
  28. package/docs/components/tableFieldSortHide.html +2 -3
  29. package/docs/components/tablePagination.html +2 -3
  30. package/docs/components/tableRecordEditing.html +2 -3
  31. package/docs/components/tableRecordFiltering.html +2 -3
  32. package/docs/components/tableRecordHiding.html +2 -3
  33. package/docs/components/tableRecordSearching.html +2 -3
  34. package/docs/components/tableRecordSelection.html +2 -3
  35. package/docs/components/tableRowControls.html +2 -3
  36. package/docs/components/tableSorting.html +2 -3
  37. package/docs/components/tabs.html +89 -70
  38. package/docs/components/tags.html +45 -16
  39. package/docs/components/theme-switcher.html +3 -4
  40. package/docs/components/timestamp.html +40 -10
  41. package/docs/components/toast.html +311 -4
  42. package/docs/components/toggle.html +3 -5
  43. package/docs/components/tree.html +76 -64
  44. package/docs/src/components/Card.js +3 -3
  45. package/docs/src/components/Dialog.js +11 -11
  46. package/docs/src/components/Icon.js +1 -1
  47. package/docs/src/components/Toggle.js +15 -14
  48. package/docs/src/components/Tree.js +11 -3
  49. package/docs/utils/debounce.html +5 -24
  50. package/docs/utils/drag.html +3 -13
  51. package/docs/utils/formatTimestamp.html +7 -25
  52. package/docs/utils/propConverters.html +7 -46
  53. package/docs/utils/toTitleCase.html +2 -2
  54. package/docs/utils/watchWindowSize.html +7 -98
  55. package/package.json +1 -1
  56. package/src/components/Card.js +3 -3
  57. package/src/components/Dialog.js +48 -34
  58. package/src/components/Icon.js +25 -18
  59. package/src/components/Toggle.js +69 -69
  60. package/src/components/Tree.js +10 -2
  61. package/scripts/fix-docs-paths.js +0 -62
@@ -1,4 +1,4 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";export default class Card extends ShadowComponent{static properties={label:{type:String,reflect:!0}};constructor(){super(),this.label=""}static styles=css`
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";export default class Card extends ShadowComponent{static properties={label:{type:String,reflect:!0}};constructor(){super(),this.label=null}static styles=css`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -20,11 +20,11 @@ import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-al
20
20
  padding: var(--spacer_h);
21
21
  }
22
22
  :host([label]) {
23
- padding-top: calc(1.5 * var(--spacer));
24
- margin-top: var(--spacer);
23
+ padding-top: 0.1px; /* Prevent Collapsing Margins */
25
24
  }
26
25
  :host([label]) #card {
27
26
  padding-top: calc(1.5 * var(--spacer));
27
+ margin-top: var(--spacer);
28
28
  }
29
29
  :host(:not([label])) #label {
30
30
  display: none;
@@ -1,4 +1,4 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";import{boolExists}from"../utils/propConverters.js";import"./Icon.js";import"./FocusCapture.js";const firstFocusable=t=>t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')[0];export default class Dialog extends ShadowComponent{static properties={opened:{type:Boolean,reflect:!0,converter:boolExists},closeBtn:{type:Boolean,reflect:!0,attribute:"close-btn",converter:boolExists},overlayClose:{type:Boolean,reflect:!0,attribute:"overlay-close",converter:boolExists},confirmText:{type:String,reflect:!0,attribute:"confirm-text"},confirmClasses:{type:String,reflect:!0,attribute:"confirm-classes"},cancelText:{type:String,reflect:!0,attribute:"cancel-text"},cancelClasses:{type:String,reflect:!0,attribute:"cancel-classes"}};constructor(){super(),this.opened=!1,this.closeBtn=!0,this.overlayClose=!0,this.confirmText="",this.confirmClasses="success ml",this.cancelText="",this.cancelClasses="",this.confirmAction=()=>{},this.cancelAction=()=>{},this.closeCallback=()=>{},this.previousFocus=null}handleClick=t=>{const{target:e}=t,o=e.id||e.closest("[id]")?.id;"overlay"===o&&this.overlayClose||"close"===o?this.close():"cancel"===o?(this.cancelAction(t),t.defaultPrevented||this.close()):"confirm"===o&&(this.confirmAction(t),t.defaultPrevented||this.close())};handleKeydown=t=>{27===t.keyCode&&this.close()};connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.handleKeydown)}updated(t){super.updated(t),t.has("opened")&&this.dispatchEvent(new CustomEvent(this.opened?"opened":"close"))}open(){this.opened=!0,window.addEventListener("keydown",this.handleKeydown);const t=this.updateComplete||this.requestUpdate();t&&t.then?t.then(()=>{const t=this.shadowRoot.querySelector("[autofocus]")||firstFocusable(this.shadowRoot);t&&t.focus()}):setTimeout(()=>{const t=this.shadowRoot.querySelector("[autofocus]")||firstFocusable(this.shadowRoot);t&&t.focus()},0)}close(){this.opened=!1,this.blur(),this.closeCallback(),window.removeEventListener("keydown",this.handleKeydown)}toggle(){this.opened?this.close():this.open()}focus(){const t=firstFocusable(this.shadowRoot);t&&(this.previousFocus=document.activeElement,t.focus())}blur(){this.previousFocus&&this.previousFocus.focus()}hasTitle(){return!!this.querySelector('[slot="title"]')}static styles=css`
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";import{boolExists}from"../utils/propConverters.js";import"./Icon.js";import"./FocusCapture.js";const firstFocusable=e=>e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')[0];export default class Dialog extends ShadowComponent{static properties={opened:{type:Boolean,reflect:!0,converter:boolExists},closeBtn:{type:Boolean,reflect:!0,attribute:"close-btn",converter:boolExists},overlayClose:{type:Boolean,reflect:!0,attribute:"overlay-close",converter:boolExists},confirmText:{type:String,reflect:!0,attribute:"confirm-text"},confirmClasses:{type:String,reflect:!0,attribute:"confirm-classes"},cancelText:{type:String,reflect:!0,attribute:"cancel-text"},cancelClasses:{type:String,reflect:!0,attribute:"cancel-classes"}};constructor(){super(),this.opened=!1,this.closeBtn=!0,this.overlayClose=!0,this.confirmText="",this.confirmClasses="success ml",this.cancelText="",this.cancelClasses="",this.confirmAction=()=>{},this.cancelAction=()=>{},this.closeCallback=()=>{},this.previousFocus=null}handleClick=e=>{const{target:t}=e,o=t.id||t.closest("[id]")?.id;"overlay"===o&&this.overlayClose||"close"===o?this.close():"cancel"===o?(this.cancelAction(e),e.defaultPrevented||this.close()):"confirm"===o&&(this.confirmAction(e),e.defaultPrevented||this.close())};handleKeydown=e=>{27===e.keyCode&&this.close()};connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.handleKeydown)}updated(e){super.updated(e),e.has("opened")&&this.dispatchEvent(new CustomEvent(this.opened?"opened":"close"))}open(){this.opened=!0,window.addEventListener("keydown",this.handleKeydown);const e=this.updateComplete||this.requestUpdate();e&&e.then?e.then(()=>{const e=this.shadowRoot.querySelector("[autofocus]")||firstFocusable(this.shadowRoot);e&&e.focus()}):setTimeout(()=>{const e=this.shadowRoot.querySelector("[autofocus]")||firstFocusable(this.shadowRoot);e&&e.focus()},0)}close(){this.opened=!1,this.blur(),this.closeCallback(),window.removeEventListener("keydown",this.handleKeydown)}toggle(){this.opened?this.close():this.open()}focus(){const e=firstFocusable(this.shadowRoot);e&&(this.previousFocus=document.activeElement,e.focus())}blur(){this.previousFocus&&this.previousFocus.focus()}hasTitle(){return!!this.querySelector('[slot="title"]')}static styles=css`
2
2
  :host {
3
3
  position: fixed;
4
4
  top: 0;
@@ -77,13 +77,13 @@ import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-al
77
77
  `;render(){return html`
78
78
  <button id="overlay" aria-label="Close the Dialog" @click=${this.handleClick}></button>
79
79
  <div id="wrapper">
80
- <div
81
- id="dialog"
82
- role="dialog"
83
- aria-modal="true"
84
- aria-labelledby="title"
85
- >
86
- <k-focus-capture>
80
+ <k-focus-capture>
81
+ <div
82
+ id="dialog"
83
+ role="dialog"
84
+ aria-modal="true"
85
+ aria-labelledby="title"
86
+ >
87
87
  <div
88
88
  id="header"
89
89
  class="${this.hasTitle()?"has-title":""}"
@@ -114,7 +114,7 @@ import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-al
114
114
  `:""}
115
115
  </div>
116
116
  `:""}
117
- </k-focus-capture>
118
- </div>
117
+ </div>
118
+ </k-focus-capture>
119
119
  </div>
120
- `}static create(t="",e={}){!1!==e.closeExisting&&document.querySelectorAll("k-dialog").forEach(t=>t.close());const{removeOnClose:o=!0,closeCallback:s=()=>{}}=e,i=new Dialog;return Object.assign(i,{opened:!0,...e,closeCallback:(...t)=>{o&&i.remove(),s(...t)}}),t instanceof HTMLElement||t instanceof DocumentFragment?i.appendChild(t):t&&(i.innerHTML=t),e.width&&i.style.setProperty("--width",e.width),e.minWidth&&i.style.setProperty("--min_width",e.minWidth),e.maxWidth&&i.style.setProperty("--max_width",e.maxWidth),e.height&&i.style.setProperty("--height",e.height),e.minHeight&&i.style.setProperty("--min_height",e.minHeight),e.maxHeight&&i.style.setProperty("--max_height",e.maxHeight),document.body.appendChild(i),i.open(),i}static confirm(t,e,o={}){const s=o.title||"Confirm";return Dialog.create(`\n\t\t\t<h5 slot="title" class="pyh px m0">${s}</h5>\n\t\t\t<p class="p">${t}</p>\n\t\t`,{closeBtn:!1,overlayClose:!1,confirmText:"Yes",confirmClasses:"success ml",confirmAction:()=>e(!0),cancelText:"No",cancelClasses:"danger",cancelAction:()=>e(!1),...o})}static alert(t,e,o={}){const s=o.title||"Alert";return Dialog.create(`\n\t\t\t<h5 slot="title" class="pyh px m0">${s}</h5>\n\t\t\t<p class="p">${t}</p>\n\t\t`,{closeCallback:e,cancelText:"Ok",...o})}static error(t,e,o={}){const s=o.title||"Error";return Dialog.create(`\n\t\t\t<h5 slot="title" class="pyh px m0 tc-danger">${s}</h5>\n\t\t\t<p class="p">${t}</p>\n\t\t`,{closeCallback:e,cancelText:"Ok",...o})}static success(t,e,o={}){const s=o.title||"Success";return Dialog.create(`\n\t\t\t<h5 slot="title" class="pyh px m0 tc-success">${s}</h5>\n\t\t\t<p class="p">${t}</p>\n\t\t`,{closeCallback:e,cancelText:"Ok",...o})}}customElements.define("k-dialog",Dialog);
120
+ `}static create(e="",t={}){!1!==t.closeExisting&&document.querySelectorAll("k-dialog").forEach(e=>e.close());const{removeOnClose:o=!0,closeCallback:s=()=>{},title:i="",titleClasses:l="pyh px m0"}=t,n=new Dialog;if(Object.assign(n,{opened:!0,...t,closeCallback:(...e)=>{o&&n.remove(),s(...e)}}),i){const e=document.createElement("h5");e.slot="title",e.className=l,i instanceof HTMLElement?e.appendChild(i):e.innerHTML=i,n.appendChild(e)}if(e instanceof HTMLElement||e instanceof DocumentFragment)n.appendChild(e);else if(e){if(/<[^>]+>/.test(e))n.innerHTML+=e;else{const t=document.createElement("p");t.className="p",t.textContent=e,n.appendChild(t)}}return t.width&&n.style.setProperty("--width",t.width),t.minWidth&&n.style.setProperty("--min_width",t.minWidth),t.maxWidth&&n.style.setProperty("--max_width",t.maxWidth),t.height&&n.style.setProperty("--height",t.height),t.minHeight&&n.style.setProperty("--min_height",t.minHeight),t.maxHeight&&n.style.setProperty("--max_height",t.maxHeight),document.body.appendChild(n),n.open(),n}static confirm(e,t,o={}){return Dialog.create(e,{title:o.title||"Confirm",closeBtn:!1,overlayClose:!1,confirmText:"Yes",confirmClasses:"success ml",confirmAction:()=>t(!0),cancelText:"No",cancelClasses:"danger",cancelAction:()=>t(!1),...o})}static alert(e,t=()=>{},o={}){return Dialog.create(e,{title:o.title||"Alert",closeCallback:t,cancelText:"Ok",...o})}static error(e,t=()=>{},o={}){return Dialog.create(e,{title:o.title||"Error",titleClasses:"pyh px m0 tc-danger",closeCallback:t,cancelText:"Ok",...o})}static success(e,t=()=>{},o={}){return Dialog.create(e,{title:o.title||"Success",titleClasses:"pyh px m0 tc-success",closeCallback:t,cancelText:"Ok",...o})}}customElements.define("k-dialog",Dialog);
@@ -1,4 +1,4 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const o=(new AbortController).signal;try{const n=await fetch(t,{signal:o});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>getIconByPath(`${e}/${t}.svg`);return new Promise(async(t,n)=>{let o;for(let t=0;t<Icon.pathToIcons.length&&!o;t++)try{o=await e(Icon.pathToIcons[t])}catch(t){}t(o||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon(),t.has("iconContent")&&this.fixSVG()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=t;else{const t=this.innerHTML.trim();this.iconContent=t||Icon.fallback}}fixSVG(){setTimeout(()=>{const t=this.querySelector("svg");t&&(t.removeAttribute("width"),t.removeAttribute("height"),t.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}))},0)}static styles=css`
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const o=(new AbortController).signal;try{const n=await fetch(t,{signal:o});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>getIconByPath(`${e}/${t}.svg`);return new Promise(async(t,n)=>{let o;for(let t=0;t<Icon.pathToIcons.length&&!o;t++)try{o=await e(Icon.pathToIcons[t])}catch(t){}t(o||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=this.fixSVG(t);else{const t=this.innerHTML.trim();this.iconContent=t?this.fixSVG(t):Icon.fallback}}fixSVG(t){if(!t)return t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");return e?(e.removeAttribute("width"),e.removeAttribute("height"),e.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}),(new XMLSerializer).serializeToString(e)):t}static styles=css`
2
2
  :host {
3
3
  display: inline-block;
4
4
  vertical-align: bottom;
@@ -1,4 +1,11 @@
1
- import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";export default class Toggle extends ShadowComponent{static properties={value:{type:Boolean,reflect:!0}};static styles=css`
1
+ import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";export default class Toggle extends ShadowComponent{static properties={value:{type:Boolean,reflect:!0}};constructor(){super(),this.value=!1,this.tabIndex=0}updated(e){super.updated(e),e.has("value")&&this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}handleClick=()=>{this.toggle()};handleKeyDown=e=>{["Space","Enter"].includes(e.code)&&(e.preventDefault(),this.toggle())};on(){return this.value=!0,this.dispatchEvent(new CustomEvent("on",{detail:{value:!0},bubbles:!0})),this}off(){return this.value=!1,this.dispatchEvent(new CustomEvent("off",{detail:{value:!1},bubbles:!0})),this}toggle(){return this.value?this.off():this.on(),this.dispatchEvent(new CustomEvent("toggle",{detail:{value:this.value},bubbles:!0})),this}render(){return html`
2
+ <div id="switch">
3
+ <div id="handle"></div>
4
+ </div>
5
+ <label id="label">
6
+ <slot></slot>
7
+ </label>
8
+ `}static styles=css`
2
9
  :host {
3
10
  --switch_height: 2rem;
4
11
  --switch_width: 3rem;
@@ -19,11 +26,6 @@ import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComp
19
26
  outline: none;
20
27
  }
21
28
 
22
- :host(:focus) {
23
- outline: 2px solid var(--c_primary, blue);
24
- outline-offset: 2px;
25
- }
26
-
27
29
  #switch {
28
30
  display: flex;
29
31
  align-items: center;
@@ -33,6 +35,12 @@ import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComp
33
35
  background: var(--switch_background__off);
34
36
  border-radius: 999rem;
35
37
  margin-right: var(--spacer);
38
+ box-shadow: 0 0 0 transparent;
39
+ will-change: box-shadow;
40
+ transition: box-shadow var(--animation_ms, 256ms);
41
+ }
42
+ :host(:focus) #switch {
43
+ box-shadow: var(--focus_shadow);
36
44
  }
37
45
 
38
46
  #handle {
@@ -64,11 +72,4 @@ import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComp
64
72
  flex: 1 1 auto;
65
73
  padding: 0;
66
74
  }
67
- `;constructor(){super(),this.value=!1,this.tabIndex=0}updated(e){super.updated(e),e.has("value")&&this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}handleClick=()=>{this.toggle()};handleKeyDown=e=>{["Space","Enter"].includes(e.code)&&(e.preventDefault(),this.toggle())};on(){return this.value=!0,this.dispatchEvent(new CustomEvent("on",{detail:{value:!0},bubbles:!0})),this}off(){return this.value=!1,this.dispatchEvent(new CustomEvent("off",{detail:{value:!1},bubbles:!0})),this}toggle(){return this.value?this.off():this.on(),this.dispatchEvent(new CustomEvent("toggle",{detail:{value:this.value},bubbles:!0})),this}render(){return html`
68
- <div id="switch">
69
- <div id="handle"></div>
70
- </div>
71
- <label id="label">
72
- <slot></slot>
73
- </label>
74
- `}}window.customElements.define("k-toggle",Toggle);
75
+ `}window.customElements.define("k-toggle",Toggle);
@@ -6,12 +6,12 @@ import ShadowComponent from"./ShadowComponent.js";import{html,css,render}from"..
6
6
  <div class="tree-root">
7
7
  ${Tree.renderValue(this.data,null,0,this.depth)}
8
8
  </div>
9
- `:html`<slot></slot>`}static leafs=[];static addLeaf=(...e)=>{e.forEach(e=>Tree.leafs.unshift(e))};static renderValue(e,t=null,s=0,r=0){const a=Tree.leafs.find(t=>t.detect(e));if(a){const s=document.createElement("span");if(s.className="d-b",null!==t){const e=document.createElement("span");e.className="number"==typeof t?"tc-muted":"",e.textContent=`${t}: `,s.appendChild(e)}const r=new a(e).render();if(r instanceof Node)s.appendChild(r);else{const e=document.createElement("span");render(r,e),s.appendChild(e)}return s}if("object"==typeof e&&null!==e){const a=new TreeBranch;return a.value=e,a.key=t,a.currentDepth=s,a.maxDepth=r,a}return html`<span class="d-b primitive">${null!==t?html`<span class="${"number"==typeof t?"tc-muted":""}">${t}: </span>`:""}${e}</span>`}}window.customElements.define("k-tree",Tree);export class TreeBranch extends ShadowComponent{static properties={value:{type:Object},key:{type:String},currentDepth:{type:Number},maxDepth:{type:Number},opened:{type:Boolean,converter:boolExists,reflect:!0}};constructor(){super(),this.value=null,this.key=null,this.currentDepth=0,this.maxDepth=0,this.opened=!1}connectedCallback(){super.connectedCallback(),this.currentDepth<=this.maxDepth&&(this.opened=!0)}get tree(){return this.closest("k-tree")}toggle=()=>{this.opened=!this.opened};render(){const e=null!==this.key?`${this.key}: `:"",t=Array.isArray(this.value)?"Array":"Object";return html`
9
+ `:html`<slot></slot>`}static leafs=[];static addLeaf=(...e)=>{e.forEach(e=>Tree.leafs.unshift(e))};static renderValue(e,t=null,s=0,a=0){const r=Tree.leafs.find(t=>t.detect(e));if(r){const s=document.createElement("span");if(s.className="d-b",null!==t){const e=document.createElement("span");e.className="number"==typeof t?"tc-muted":"",e.textContent=`${t}: `,s.appendChild(e)}const a=new r(e).render();if(a instanceof Node)s.appendChild(a);else{const e=document.createElement("span");render(a,e),s.appendChild(e)}return s}if("object"==typeof e&&null!==e){const r=new TreeBranch;return r.value=e,r.key=t,r.currentDepth=s,r.maxDepth=a,r}return html`<span class="d-b primitive">${null!==t?html`<span class="${"number"==typeof t?"tc-muted":""}">${t}: </span>`:""}${e}</span>`}}window.customElements.define("k-tree",Tree);export class TreeBranch extends ShadowComponent{static properties={value:{type:Object},key:{type:String},currentDepth:{type:Number},maxDepth:{type:Number},opened:{type:Boolean,converter:boolExists,reflect:!0}};constructor(){super(),this.value=null,this.key=null,this.currentDepth=0,this.maxDepth=0,this.opened=!1}connectedCallback(){super.connectedCallback(),this.currentDepth<=this.maxDepth&&(this.opened=!0)}get tree(){return this.closest("k-tree")}toggle=()=>{this.opened=!this.opened};render(){const e=null!==this.key?`${this.key}: `:"",t=Array.isArray(this.value)?"Array":"Object";return html`
10
10
  <div>
11
- <div class="branch-label" @click=${this.toggle}>
11
+ <button class="branch-label no-btn" @click=${this.toggle} aria-expanded="${this.opened}">
12
12
  <k-icon name="chevron-right" class="toggle-icon ${this.opened?"opened":""}"></k-icon>
13
13
  ${e}${t}
14
- </div>
14
+ </button>
15
15
  ${this.opened?html`
16
16
  <div class="pl">
17
17
  ${this.value?(Array.isArray(this.value)?this.value.map((e,t)=>[t,e]):Object.entries(this.value)).map(([e,t])=>Tree.renderValue(t,e,this.currentDepth+1,this.maxDepth)):""}
@@ -23,11 +23,19 @@ import ShadowComponent from"./ShadowComponent.js";import{html,css,render}from"..
23
23
  display: block;
24
24
  }
25
25
  .branch-label{
26
+ display: block;
27
+ width: 100%;
26
28
  cursor: pointer;
27
29
  }
28
30
  .branch-label:hover{
29
31
  background-color: var(--c_bg__alt, #f5f5f5);
30
32
  }
33
+ .branch-label:focus{
34
+ box-shadow: none;
35
+ }
36
+ .branch-label:focus-visible{
37
+ box-shadow: var(--focus_shadow);
38
+ }
31
39
  .toggle-icon{
32
40
  transition: transform var(--animation_ms, 200ms);
33
41
  }
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Accordion - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -154,7 +154,6 @@
154
154
 
155
155
  </main>
156
156
  <div style="height:33vh"></div>
157
- <script type="module" src="../src/components/Import.js"></script>
158
157
  <script type="module" src="../src/components/Accordion.js"></script>
159
158
  </body>
160
159
  </html>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Card - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -80,7 +80,6 @@
80
80
 
81
81
  </main>
82
82
  <div style="height:33vh"></div>
83
- <script type="module" src="../src/components/Import.js"></script>
84
83
  <script type="module" src="../src/components/Card.js"></script>
85
84
  </body>
86
85
  </html>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Collapsible - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -186,7 +186,6 @@
186
186
 
187
187
  </main>
188
188
  <div style="height:33vh"></div>
189
- <script type="module" src="../src/components/Import.js"></script>
190
189
  <script type="module" src="../src/components/Collapsible.js"></script>
191
190
  </body>
192
191
  </html>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Content Slider - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -211,7 +211,7 @@
211
211
  <p>Custom content for the next button. Defaults to a right chevron icon if not provided.</p>
212
212
 
213
213
  </main>
214
- <script type="module" src="../src/components/Import.js"></script>
214
+ <div style="height:33vh"></div>
215
215
  <script type="module" src="../src/components/ContentSlider.js"></script>
216
216
  </body>
217
217
  </html>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Dialog - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -22,10 +22,12 @@
22
22
  <a href="#titles">Titles</a><br />
23
23
  <a href="#actionButtons">Action Buttons</a><br />
24
24
  <a href="#jsUsage">JavaScript Usage</a><br />
25
+ <a href="#confirmDialog">Confirm Dialog</a><br />
25
26
 
26
27
  <h6 class="mt">JavaScript Reference</h6>
27
28
  <a href="#constructor">Constructor</a><br />
28
29
  <a href="#requirements">Requirements</a><br />
30
+ <a href="#attributes">Attributes</a><br />
29
31
  <a href="#properties">Properties</a><br />
30
32
  <a href="#methods">Methods</a><br />
31
33
  <a href="#staticMethods">Static Methods</a><br />
@@ -34,7 +36,7 @@
34
36
 
35
37
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
36
38
  <p>Create dialogs using the <code>k-dialog</code> component. Open the dialog by calling the <code>open()</code> method, and close it by calling the <code>close()</code> method. Or it can be closed using the dialog's GUI (clicking the overlay, clicking the close button, or the cancel or confirm action buttons).</p>
37
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d1"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>&gt;</span>Hello World<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-dialog</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"doument.getElementById('d1').open()"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></code></pre>
39
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d1"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>&gt;</span>Hello World<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-dialog</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"document.getElementById('d1').open()"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></code></pre>
38
40
  <button class="openDialog mb" data-dialog="d1" slot="right">Open Dialog</button>
39
41
  <k-dialog id="d1">
40
42
  <p class="p">Hello World</p>
@@ -88,9 +90,239 @@
88
90
 
89
91
  <h3 id="jsUsage"><a href="#jsUsage" class="no-link">JavaScript Usage</a></h3>
90
92
  <h5>Create Dialog</h5>
91
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d7'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Dialog.create(<span class="hljs-string">'&lt;p&gt;Hello World&lt;/p&gt;'</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
93
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d7'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Dialog.create(<span class="hljs-string">'Hello World'</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
92
94
  <button id="d7" class="mb">Open Dialog</button>
93
- <script type="module" src="./init.js"></script>
95
+ <script type="module">
96
+ import Dialog from '../src/components/Dialog.js';
97
+ document.getElementById('d7').addEventListener('click', () => {
98
+ Dialog.create('Hello World');
99
+ });
100
+ </script>
101
+
102
+ <h5>Dialog with Title</h5>
103
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7b"</span>&gt;</span>Open Dialog with Title<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d7b'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Dialog.create(<span class="hljs-string">'This is the dialog content'</span>, {<br /> <span class="hljs-attr">title</span>: <span class="hljs-string">'My Dialog Title'</span><br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
104
+ <button id="d7b" class="mb">Open Dialog with Title</button>
105
+ <script type="module">
106
+ import Dialog from '../src/components/Dialog.js';
107
+ document.getElementById('d7b').addEventListener('click', () => {
108
+ Dialog.create('This is the dialog content', {
109
+ title: 'My Dialog Title'
110
+ });
111
+ });
112
+ </script>
113
+
114
+ <h5>Error Dialog</h5>
115
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d8"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d8'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Dialog.error(<span class="hljs-string">"Oh no, don't do that!"</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
116
+ <button id="d8" class="mb">Open Dialog</button>
117
+ <script type="module">
118
+ import Dialog from '../src/components/Dialog.js';
119
+ document.getElementById('d8').addEventListener('click', () => {
120
+ Dialog.error("Oh no, don't do that!");
121
+ });
122
+ </script>
123
+
124
+ <h3 id="confirmDialog"><a href="#confirmDialog" class="no-link">Confirm Dialog</a></h3>
125
+ <p>Use the <code>Dialog.confirm</code> static method to create a confirmation dialog. This method takes a text message, a response callback, and an options object.</p>
126
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d9"</span>&gt;</span>Open Confirm Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d9'</span>).addEventListener(<span class="hljs-string">'click'</span>, () =&gt; {<br /> Dialog.confirm(<span class="hljs-string">"Are you sure you want to proceed?"</span>, <span class="hljs-function"><span class="hljs-params">response</span> =&gt;</span> {<br /> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"User response:"</span>, response);<br /> });<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
127
+ <button id="d9" class="mb">Open Confirm Dialog</button>
128
+ <script type="module">
129
+ import Dialog from '../src/components/Dialog.js';
130
+ document.getElementById('d9').addEventListener('click', () => {
131
+ Dialog.confirm("Are you sure you want to proceed?", response => {
132
+ console.log("User response:", response);
133
+ });
134
+ });
135
+ </script>
136
+
137
+ <h2 id="jsRef">JavaScript Reference</h2>
138
+
139
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
140
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
141
+ <h5>
142
+ <code>new Dialog()</code><br />
143
+ <code>new Dialog(<i>object</i> options)</code>
144
+ </h5>
145
+
146
+ <h4>Parameters</h4>
147
+ <h5><code>options<i>: object</i></code></h5>
148
+ <p>An object containing the initial configuration for the dialog. The options object can contain the following properties:</p>
149
+ <ul>
150
+ <li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened.</li>
151
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
152
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
153
+ <li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
154
+ <li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
155
+ <li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
156
+ <li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
157
+ <li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
158
+ <li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
159
+ <li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
160
+ </ul>
161
+
162
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
163
+ <ul>
164
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
165
+ <li><a href="./icon.html">Icon</a></li>
166
+ <li><a href="./focus-capture.html">FocusCapture</a></li>
167
+ </ul>
168
+
169
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
170
+ <h5><code>opened<i>: boolean</i></code></h5>
171
+ <p>Whether the dialog is opened.</p>
172
+
173
+ <h5><code>close-btn<i>: boolean</i></code></h5>
174
+ <p>Whether to show the close button. Default is <code>true</code>.</p>
175
+
176
+ <h5><code>overlay-close<i>: boolean</i></code></h5>
177
+ <p>Whether clicking the overlay closes the dialog. Default is <code>true</code>.</p>
178
+
179
+ <h5><code>confirm-text<i>: string</i></code></h5>
180
+ <p>Text for the confirm button.</p>
181
+
182
+ <h5><code>confirm-classes<i>: string</i></code></h5>
183
+ <p>Classes for the confirm button. Default is <code>'success ml'</code>.</p>
184
+
185
+ <h5><code>cancel-text<i>: string</i></code></h5>
186
+ <p>Text for the cancel button.</p>
187
+
188
+ <h5><code>cancel-classes<i>: string</i></code></h5>
189
+ <p>Classes for the cancel button.</p>
190
+
191
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
192
+ <h5><code>confirmAction<i>: function</i></code></h5>
193
+ <p>Action to perform on confirm. If the function calls <code>event.preventDefault()</code>, the dialog will not close automatically.</p>
194
+
195
+ <h5><code>cancelAction<i>: function</i></code></h5>
196
+ <p>Action to perform on cancel. If the function calls <code>event.preventDefault()</code>, the dialog will not close automatically.</p>
197
+
198
+ <h5><code>closeCallback<i>: function</i></code></h5>
199
+ <p>Callback to execute when the dialog is closed.</p>
200
+
201
+ <h5><code>previousFocus<i>: HTMLElement</i></code></h5>
202
+ <p>Reference to the element that had focus before the dialog was opened.</p>
203
+
204
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
205
+ <h5><code>open()<i>: void</i></code></h5>
206
+ <p>Opens the dialog and sets focus to the first focusable element or an element with the <code>autofocus</code> attribute.</p>
207
+
208
+ <h5><code>close()<i>: void</i></code></h5>
209
+ <p>Closes the dialog and calls the <code>closeCallback</code>.</p>
210
+
211
+ <h5><code>toggle()<i>: void</i></code></h5>
212
+ <p>Toggles the dialog open or closed.</p>
213
+
214
+ <h5><code>focus()<i>: void</i></code></h5>
215
+ <p>Focuses the first focusable element in the dialog and saves the previously focused element.</p>
216
+
217
+ <h5><code>blur()<i>: void</i></code></h5>
218
+ <p>Returns focus to the element that had focus before the dialog was opened.</p>
219
+
220
+ <h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
221
+ <h5><code>Dialog.create(contents, options)<i>: Dialog</i></code></h5>
222
+ <p>Creates and opens a new dialog with the specified contents and options. Returns the created Dialog instance.</p>
223
+ <p>If <code>contents</code> is plain text (no HTML tags), it will automatically be wrapped in a <code>&lt;p class="p"&gt;</code> tag. If it contains HTML, it will be inserted as-is. If it's an HTMLElement or DocumentFragment, it will be appended directly.</p>
224
+
225
+ <h6>Parameters</h6>
226
+ <ul>
227
+ <li><code>contents<i>: string | HTMLElement | DocumentFragment</i></code> - The content to display in the dialog. Plain text will be wrapped in a paragraph tag automatically.</li>
228
+ <li><code>options<i>: object</i></code> - Configuration options for the dialog.</li>
229
+ </ul>
230
+
231
+ <h6>Options</h6>
232
+ <ul>
233
+ <li><code>title</code>: <i>string | HTMLElement</i> - The title to display in the dialog header. Will be wrapped in an <code>&lt;h5&gt;</code> tag with the <code>title</code> slot.</li>
234
+ <li><code>titleClasses</code>: <i>string</i> - CSS classes for the title element. Default is <code>'pyh px m0'</code>.</li>
235
+ <li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened. Default is <code>true</code>.</li>
236
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
237
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
238
+ <li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
239
+ <li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
240
+ <li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
241
+ <li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
242
+ <li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
243
+ <li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
244
+ <li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
245
+ <li><code>removeOnClose</code>: <i>boolean</i> - Whether to remove the dialog from the DOM when closed. Default is <code>true</code>.</li>
246
+ <li><code>closeExisting</code>: <i>boolean</i> - Whether to close existing dialogs before opening this one. Default is <code>true</code>.</li>
247
+ <li><code>width</code>: <i>string</i> - CSS width value for the dialog.</li>
248
+ <li><code>minWidth</code>: <i>string</i> - CSS min-width value for the dialog.</li>
249
+ <li><code>maxWidth</code>: <i>string</i> - CSS max-width value for the dialog.</li>
250
+ <li><code>height</code>: <i>string</i> - CSS height value for the dialog.</li>
251
+ <li><code>minHeight</code>: <i>string</i> - CSS min-height value for the dialog.</li>
252
+ <li><code>maxHeight</code>: <i>string</i> - CSS max-height value for the dialog.</li>
253
+ </ul>
254
+
255
+ <h5><code>Dialog.confirm(text, responseCallback, options)<i>: Dialog</i></code></h5>
256
+ <p>Creates and opens a confirmation dialog with the specified text and options. The response callback receives a boolean value indicating whether the user confirmed (<code>true</code>) or canceled (<code>false</code>).</p>
257
+
258
+ <h6>Parameters</h6>
259
+ <ul>
260
+ <li><code>text<i>: string</i></code> - The message to display in the dialog.</li>
261
+ <li><code>responseCallback<i>: function</i></code> - Function called with the user's response (<code>true</code> for confirm, <code>false</code> for cancel).</li>
262
+ <li><code>options<i>: object</i></code> - Configuration options.</li>
263
+ </ul>
264
+
265
+ <h6>Options</h6>
266
+ <ul>
267
+ <li><code>title</code>: <i>string</i> - The title of the dialog. Default is <code>'Confirm'</code>.</li>
268
+ <li><code>confirmText</code>: <i>string</i> - Text for the confirm button. Default is <code>'Yes'</code>.</li>
269
+ <li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button. Default is <code>'success ml'</code>.</li>
270
+ <li><code>cancelText</code>: <i>string</i> - Text for the cancel button. Default is <code>'No'</code>.</li>
271
+ <li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button. Default is <code>'danger'</code>.</li>
272
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button. Default is <code>false</code>.</li>
273
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog. Default is <code>false</code>.</li>
274
+ </ul>
275
+
276
+ <h5><code>Dialog.alert(text, responseCallback, options)<i>: Dialog</i></code></h5>
277
+ <p>Creates and opens an alert dialog with the specified text and options.</p>
278
+
279
+ <h6>Parameters</h6>
280
+ <ul>
281
+ <li><code>text<i>: string</i></code> - The message to display in the dialog.</li>
282
+ <li><code>responseCallback<i>: function</i></code> - Function called when the dialog is closed.</li>
283
+ <li><code>options<i>: object</i></code> - Configuration options.</li>
284
+ </ul>
285
+
286
+ <h6>Options</h6>
287
+ <ul>
288
+ <li><code>title</code>: <i>string</i> - The title of the dialog. Default is <code>'Alert'</code>.</li>
289
+ <li><code>cancelText</code>: <i>string</i> - Text for the OK button. Default is <code>'Ok'</code>.</li>
290
+ </ul>
291
+
292
+ <h5><code>Dialog.error(text, responseCallback, options)<i>: Dialog</i></code></h5>
293
+ <p>Creates and opens an error dialog with the specified text and options. The title is displayed in red.</p>
294
+
295
+ <h6>Parameters</h6>
296
+ <ul>
297
+ <li><code>text<i>: string</i></code> - The error message to display in the dialog.</li>
298
+ <li><code>responseCallback<i>: function</i></code> - Function called when the dialog is closed.</li>
299
+ <li><code>options<i>: object</i></code> - Configuration options.</li>
300
+ </ul>
301
+
302
+ <h6>Options</h6>
303
+ <ul>
304
+ <li><code>title</code>: <i>string</i> - The title of the dialog. Default is <code>'Error'</code>.</li>
305
+ <li><code>cancelText</code>: <i>string</i> - Text for the OK button. Default is <code>'Ok'</code>.</li>
306
+ </ul>
307
+
308
+ <h5><code>Dialog.success(text, responseCallback, options)<i>: Dialog</i></code></h5>
309
+ <p>Creates and opens a success dialog with the specified text and options. The title is displayed in green.</p>
310
+
311
+ <h6>Parameters</h6>
312
+ <ul>
313
+ <li><code>text<i>: string</i></code> - The success message to display in the dialog.</li>
314
+ <li><code>responseCallback<i>: function</i></code> - Function called when the dialog is closed.</li>
315
+ <li><code>options<i>: object</i></code> - Configuration options.</li>
316
+ </ul>
317
+
318
+ <h6>Options</h6>
319
+ <ul>
320
+ <li><code>title</code>: <i>string</i> - The title of the dialog. Default is <code>'Success'</code>.</li>
321
+ <li><code>cancelText</code>: <i>string</i> - Text for the OK button. Default is <code>'Ok'</code>.</li>
322
+ </ul>
323
+
324
+ </main>
325
+ <div style="height:33vh"></div>
94
326
  <script type="module" src="../src/components/Dialog.js"></script>
95
327
  <script>
96
328
  document.querySelectorAll('.openDialog').forEach( $btn => {
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>FocusCapture - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -101,7 +101,6 @@
101
101
 
102
102
  </main>
103
103
  <div style="height:33vh"></div>
104
- <script type="module" src="../src/components/Import.js"></script>
105
104
  <script type="module" src="../src/components/FocusCapture.js"></script>
106
105
  <script type="module" src="../src/components/Dialog.js"></script>
107
106
  </body>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>HybridComponent - Base Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
- <link rel="stylesheet" href="../src/kempo-hljs.css" />
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
8
+ <link rel="stylesheet" href="../kempo-hljs.css" />
9
9
  <link rel="stylesheet" href="../styles.css" />
10
10
  <script type="module" src="./init.js"></script>
11
11
  </head>
@@ -103,6 +103,5 @@
103
103
 
104
104
  </main>
105
105
  <div style="height:33vh"></div>
106
- <script type="module" src="../src/components/Import.js"></script>
107
106
  </body>
108
107
  </html>