kempo-ui 0.1.6 → 0.2.2

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 (119) hide show
  1. package/.github/skills/highlight-code/SKILL.md +22 -6
  2. package/.github/skills/new-component/SKILL.md +68 -4
  3. package/AGENTS.md +11 -0
  4. package/bin/highlight_code.js +7 -15
  5. package/dist/components/Aside.js +326 -0
  6. package/dist/components/Dialog.js +1 -1
  7. package/dist/components/Dropdown.js +1 -1
  8. package/dist/components/Main.js +2 -2
  9. package/dist/components/Nav.js +27 -0
  10. package/dist/components/PhotoViewer.js +1 -1
  11. package/dist/components/ShadowComponent.js +1 -1
  12. package/dist/components/ThemeSwitcher.js +1 -0
  13. package/dist/components/Toast.js +1 -1
  14. package/docs/components/accordion.html +4 -3
  15. package/docs/components/aside-items.html +43 -0
  16. package/docs/components/aside-menu.html +43 -0
  17. package/docs/components/aside-push.html +26 -0
  18. package/docs/components/aside.html +567 -0
  19. package/docs/components/card.html +4 -3
  20. package/docs/components/color-picker.html +4 -3
  21. package/docs/components/content-slider.html +4 -3
  22. package/docs/components/dialog.html +4 -3
  23. package/docs/components/dropdown.html +4 -3
  24. package/docs/components/filter-list.html +4 -3
  25. package/docs/components/focus-capture.html +6 -5
  26. package/docs/components/html-editor.html +5 -4
  27. package/docs/components/hybrid-component.html +5 -4
  28. package/docs/components/icon.html +4 -3
  29. package/docs/components/import.html +5 -4
  30. package/docs/components/light-component.html +4 -3
  31. package/docs/components/nav.html +117 -0
  32. package/docs/components/photo-viewer.html +5 -4
  33. package/docs/components/resize.html +5 -4
  34. package/docs/components/shadow-component.html +4 -3
  35. package/docs/components/show-more.html +5 -4
  36. package/docs/components/sortable.html +4 -3
  37. package/docs/components/spinner.html +4 -3
  38. package/docs/components/split.html +5 -4
  39. package/docs/components/table.html +4 -3
  40. package/docs/components/tableControls.html +4 -3
  41. package/docs/components/tableCustomFields.html +4 -3
  42. package/docs/components/tableFetchRecords.html +5 -4
  43. package/docs/components/tableFieldSortHide.html +5 -4
  44. package/docs/components/tablePagination.html +4 -3
  45. package/docs/components/tableRecordEditing.html +4 -3
  46. package/docs/components/tableRecordFiltering.html +5 -4
  47. package/docs/components/tableRecordHiding.html +4 -3
  48. package/docs/components/tableRecordSearching.html +5 -4
  49. package/docs/components/tableRecordSelection.html +4 -3
  50. package/docs/components/tableRowControls.html +4 -3
  51. package/docs/components/tableServerSync.html +5 -4
  52. package/docs/components/tableSorting.html +5 -4
  53. package/docs/components/tabs.html +4 -3
  54. package/docs/components/tags.html +4 -3
  55. package/docs/components/theme-select.html +4 -3
  56. package/docs/components/theme-switcher.html +5 -4
  57. package/docs/components/timestamp.html +4 -3
  58. package/docs/components/toast.html +4 -3
  59. package/docs/components/toggle.html +5 -4
  60. package/docs/components/tree.html +5 -4
  61. package/docs/index.html +22 -21
  62. package/docs/nav-1.inc.html +18 -12
  63. package/docs/nav.inc.html +20 -13
  64. package/docs/nav.inc.js +1 -1
  65. package/docs/src/components/Aside.js +326 -0
  66. package/docs/src/components/Dialog.js +1 -1
  67. package/docs/src/components/Dropdown.js +1 -1
  68. package/docs/src/components/Main.js +2 -2
  69. package/docs/src/components/Nav.js +27 -0
  70. package/docs/src/components/PhotoViewer.js +1 -1
  71. package/docs/src/components/ShadowComponent.js +1 -1
  72. package/docs/src/components/ThemeSwitcher.js +1 -0
  73. package/docs/src/components/Toast.js +1 -1
  74. package/docs/utils/context.html +4 -3
  75. package/docs/utils/cookie.html +4 -3
  76. package/docs/utils/debounce.html +4 -3
  77. package/docs/utils/drag.html +4 -3
  78. package/docs/utils/elevation.html +156 -0
  79. package/docs/utils/formatTimestamp.html +4 -3
  80. package/docs/utils/object.html +4 -3
  81. package/docs/utils/propConverters.html +4 -3
  82. package/docs/utils/string.html +4 -3
  83. package/docs/utils/theme.html +4 -3
  84. package/docs/utils/toTitleCase.html +4 -3
  85. package/docs/utils/type.html +4 -3
  86. package/docs/utils/wait.html +4 -3
  87. package/llm.txt +247 -0
  88. package/package.json +3 -4
  89. package/src/components/Aside.js +726 -0
  90. package/src/components/Dialog.js +1 -1
  91. package/src/components/Dropdown.js +1 -1
  92. package/src/components/Main.js +34 -30
  93. package/src/components/Nav.js +53 -0
  94. package/src/components/PhotoViewer.js +1 -1
  95. package/src/components/ShadowComponent.js +1 -1
  96. package/src/components/ThemeSwitcher.js +1 -0
  97. package/src/components/Toast.js +1 -1
  98. package/tests/bin/get_icon.node-test.js +26 -0
  99. package/tests/bin/highlight_code.node-test.js +108 -0
  100. package/tests/bin/list_icons.node-test.js +26 -0
  101. package/tests/components/Aside.browser-test.js +778 -0
  102. package/tests/components/Main.browser-test.js +115 -283
  103. package/dist/components/SideMenu.js +0 -97
  104. package/dist/components/SidePanel.js +0 -236
  105. package/docs/components/side-menu.html +0 -189
  106. package/docs/components/side-panel-basic.html +0 -44
  107. package/docs/components/side-panel-dual.html +0 -70
  108. package/docs/components/side-panel-menu.html +0 -50
  109. package/docs/components/side-panel-persistent.html +0 -90
  110. package/docs/components/side-panel-scroll.html +0 -176
  111. package/docs/components/side-panel.html +0 -245
  112. package/docs/src/components/SideMenu.js +0 -97
  113. package/docs/src/components/SidePanel.js +0 -236
  114. package/scripts/update-kempo-css.js +0 -53
  115. package/src/components/SideMenu.js +0 -178
  116. package/src/components/SidePanel.js +0 -513
  117. package/tests/components/SideMenu.browser-test.js +0 -667
  118. package/tests/components/SidePanel.browser-test.js +0 -520
  119. package/tools/highlight.js +0 -51
@@ -1,236 +0,0 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css,nothing}from"../lit-all.min.js";import"./Icon.js";class SidePanel extends ShadowComponent{static properties={collapsed:{type:Boolean,reflect:!0},side:{type:String,reflect:!0},persistentId:{type:String,reflect:!0,attribute:"persistent-id"}};constructor(){super(),this.collapsed=!1,this.side="left",this.persistentId=null,this.isInitialLoad=!0}toggleClick=()=>this.toggle();updated(e){if(super.updated(e),e.has("persistentId")&&this.persistentId&&window?.localStorage){const e=`side-panel-persistent-id-${this.persistentId}`,t=window.localStorage.getItem(e);null!==t&&(this.collapsed="true"===t,this.isInitialLoad=!1)}if(e.has("collapsed")){if(this.persistentId&&window?.localStorage&&!this.isInitialLoad){const e=`side-panel-persistent-id-${this.persistentId}`;window.localStorage.setItem(e,this.collapsed.toString())}this.isInitialLoad=!1;const e=this.collapsed?"collapse":"expand";this.dispatchEvent(new CustomEvent(e)),this.dispatchEvent(new CustomEvent("change",{detail:e})),window.dispatchEvent(new CustomEvent("side-panel-change",{detail:{collapsed:this.collapsed,width:this.collapsed?"3.5rem":"16rem",side:this.side}}))}}expand=()=>this.collapsed=!1;collapse=()=>this.collapsed=!0;toggle(){this.collapsed=!this.collapsed,this.dispatchEvent(new CustomEvent("toggle"))}render(){return html`
2
- <div id="header">
3
- <slot name="logo"></slot>
4
- <button id="toggle" @click=${this.toggleClick} aria-label="${this.collapsed?"Expand panel":"Collapse panel"}">
5
- <k-icon name="arrow-line" direction="${(()=>"right"===this.side?this.collapsed?"left":"right":this.collapsed?"right":"left")()}"></k-icon>
6
- </button>
7
- </div>
8
- <div id="content">
9
- <slot></slot>
10
- </div>
11
- `}static styles=css`
12
- :host {
13
- --bg: var(--c_bg);
14
- --width-expanded: 16rem;
15
- --transition-duration: var(--animation_ms, 256ms);
16
- display: flex;
17
- flex-direction: column;
18
- position: fixed;
19
- top: 0;
20
- left: 0;
21
- height: 100vh;
22
- width: var(--width-expanded);
23
- transition: width var(--transition-duration);
24
- background: var(--bg);
25
- border-right: 1px solid var(--c_border);
26
- z-index: 99;
27
- }
28
- :host([collapsed]) {
29
- width: auto;
30
- }
31
- :host([side="right"]) {
32
- left: auto;
33
- right: 0;
34
- border-right: none;
35
- border-left: 1px solid var(--c_border);
36
- }
37
- #header {
38
- display: flex;
39
- align-items: center;
40
- justify-content: flex-end;
41
- gap: var(--spacer_h);
42
- padding: var(--spacer_h);
43
- border-bottom: 1px solid var(--c_border);
44
- flex-shrink: 0;
45
- }
46
- ::slotted([slot="logo"]) {
47
- margin-right: auto;
48
- flex: 1;
49
- min-width: 0;
50
- opacity: 1;
51
- transition: opacity var(--transition-duration);
52
- }
53
- :host([collapsed]) ::slotted([slot="logo"]) {
54
- display: none;
55
- }
56
- #toggle {
57
- flex-shrink: 0;
58
- width: 2rem;
59
- height: 2rem;
60
- border: none;
61
- background: transparent;
62
- color: var(--c_text);
63
- cursor: pointer;
64
- display: flex;
65
- align-items: center;
66
- justify-content: center;
67
- border-radius: var(--radius);
68
- }
69
- #toggle:hover {
70
- background: var(--c_bg_hover);
71
- }
72
- #content {
73
- flex: 1;
74
- min-height: 0;
75
- overflow-y: auto;
76
- overflow-x: hidden;
77
- display: flex;
78
- flex-direction: column;
79
- }
80
- :host([collapsed]) #content {
81
- align-items: flex-start;
82
- }
83
- :host(:not([collapsed])) #content {
84
- /* scrollbar-gutter: stable; */
85
- }
86
- `}class SidePanelItem extends ShadowComponent{static properties={icon:{type:String},href:{type:String},active:{type:Boolean,reflect:!0},collapsed:{type:Boolean,reflect:!0},"no-expand":{type:Boolean,attribute:"no-expand"},"hide-when-collapsed":{type:Boolean,attribute:"hide-when-collapsed"}};constructor(){super(),this.icon="",this.href="#",this.active=!1,this.collapsed=!1,this["no-expand"]=!1,this["hide-when-collapsed"]=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};handleClick=e=>{this.collapsed&&!this["no-expand"]&&this.panel&&(e.preventDefault(),this.panel.expand())};render(){return html`
87
- <a href="${this.href}" class="item ${this.active?"active bg-primary":""}" @click=${this.handleClick}>
88
- ${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
89
- ${this.collapsed?nothing:html`<span class="label"><slot></slot></span>`}
90
- </a>
91
- `}static styles=css`
92
- :host {
93
- display: block;
94
- }
95
- :host([collapsed][hide-when-collapsed]) {
96
- display: none;
97
- }
98
- .item {
99
- display: flex;
100
- align-items: center;
101
- gap: var(--spacer_h);
102
- padding: var(--spacer_h);
103
- color: var(--c_text);
104
- text-decoration: none;
105
- border-radius: var(--radius);
106
- margin: 0 var(--spacer_h);
107
- transition: background var(--animation_ms), color var(--animation_ms);
108
- white-space: nowrap;
109
- }
110
- :host([collapsed]) .item {
111
- }
112
- .item:hover {
113
- background: var(--c_bg_hover);
114
- }
115
- .item.active {
116
- color: var(--tc_on_primary);
117
- }
118
- .item.active:hover {
119
- background: var(--c_primary);
120
- filter: brightness(1.1);
121
- }
122
- k-icon {
123
- flex-shrink: 0;
124
- }
125
- .label {
126
- min-width: 0;
127
- overflow: hidden;
128
- text-overflow: ellipsis;
129
- }
130
- `}class SidePanelLabel extends ShadowComponent{static properties={collapsed:{type:Boolean,reflect:!0}};constructor(){super(),this.collapsed=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};render(){return this.collapsed?html`<hr>`:html`<div class="label"><slot></slot></div>`}static styles=css`
131
- :host {
132
- display: block;
133
- margin: var(--spacer_h) 0;
134
- }
135
- :host([collapsed]) {
136
- margin: 0 var(--spacer_h);
137
- align-self: stretch;
138
- }
139
- .label {
140
- padding: 0 var(--spacer);
141
- font-size: 0.75rem;
142
- font-weight: 600;
143
- text-transform: uppercase;
144
- color: var(--c_text_muted);
145
- letter-spacing: 0.05em;
146
- }
147
- hr {
148
- border: none;
149
- border-top: 1px solid var(--c_border);
150
- margin: var(--spacer_h) var(--spacer);
151
- }
152
- :host([collapsed]) hr {
153
- margin: var(--spacer_h) 0;
154
- }
155
- `}class SidePanelMenu extends ShadowComponent{static properties={icon:{type:String},label:{type:String},open:{type:Boolean,reflect:!0},collapsed:{type:Boolean,reflect:!0},"no-expand":{type:Boolean,attribute:"no-expand"},"hide-when-collapsed":{type:Boolean,attribute:"hide-when-collapsed"}};constructor(){super(),this.icon="",this.label="",this.open=!1,this.collapsed=!1,this["no-expand"]=!1,this["hide-when-collapsed"]=!1}connectedCallback(){super.connectedCallback(),this.panel=this.closest("k-side-panel"),this.panel&&(this.collapsed=this.panel.collapsed,this.panel.addEventListener("collapse",this.handleCollapse),this.panel.addEventListener("expand",this.handleExpand))}disconnectedCallback(){super.disconnectedCallback(),this.panel&&(this.panel.removeEventListener("collapse",this.handleCollapse),this.panel.removeEventListener("expand",this.handleExpand))}handleCollapse=()=>{this.collapsed=!0,this.open=!1,this.requestUpdate()};handleExpand=()=>{this.collapsed=!1,this.requestUpdate()};toggleMenu=()=>{this.collapsed&&!this["no-expand"]&&this.panel?this.panel.expand():this.collapsed||(this.open=!this.open)};render(){return html`
156
- <div class="menu-container">
157
- <button class="no-btn menu-header ${this.open?"open":""}" @click=${this.toggleMenu}>
158
- ${this.icon?html`<k-icon name="${this.icon}"></k-icon>`:this.collapsed?html`<k-icon name="dot"></k-icon>`:nothing}
159
- ${this.collapsed?nothing:html`<span class="label">${this.label}</span>`}
160
- ${this.collapsed?nothing:html`<k-icon class="chevron" name="chevron" direction="${this.open?"down":"right"}"></k-icon>`}
161
- </button>
162
- <div class="menu-content ${this.open&&!this.collapsed?"open":""}">
163
- <slot></slot>
164
- </div>
165
- </div>
166
- `}static styles=css`
167
- :host {
168
- display: block;
169
- }
170
- :host([collapsed][hide-when-collapsed]) {
171
- display: none;
172
- }
173
- .menu-container {
174
- margin: 0;
175
- }
176
- .menu-header {
177
- display: flex !important;
178
- align-items: center;
179
- gap: var(--spacer_h);
180
- padding-top: var(--spacer_h) !important;
181
- padding-bottom: var(--spacer_h) !important;
182
- padding-left: var(--spacer_h) !important;
183
- padding-right: var(--spacer_h) !important;
184
- color: var(--c_text);
185
- background: transparent;
186
- border: none;
187
- border-radius: var(--radius);
188
- margin: 0 var(--spacer_h);
189
- width: calc(100% - var(--spacer));
190
- cursor: pointer;
191
- text-align: left;
192
- white-space: nowrap;
193
- transition: background var(--animation_ms);
194
- }
195
- :host([collapsed]) .menu-header {
196
- width: auto;
197
- }
198
- .menu-header:hover {
199
- background: var(--c_bg_hover);
200
- }
201
- k-icon {
202
- flex-shrink: 0;
203
- }
204
- .label {
205
- flex: 1;
206
- min-width: 0;
207
- overflow: hidden;
208
- text-overflow: ellipsis;
209
- }
210
- .chevron {
211
- transition: transform var(--animation_ms);
212
- }
213
- .menu-content {
214
- max-height: 0;
215
- overflow: hidden;
216
- transition: max-height var(--animation_ms);
217
- padding-left: calc(var(--spacer_h) * 2);
218
- }
219
- :host([collapsed]) .menu-content {
220
- padding-left: 0;
221
- }
222
- .menu-content.open {
223
- max-height: 500px;
224
- }
225
- ::slotted(*) {
226
- margin: 0.25rem 0;
227
- }
228
- `}class SidePanelSpacer extends ShadowComponent{render(){return html`<div class="spacer"></div>`}static styles=css`
229
- :host {
230
- display: block;
231
- flex: 1;
232
- }
233
- .spacer {
234
- height: 100%;
235
- }
236
- `}customElements.define("k-side-panel",SidePanel),customElements.define("k-side-panel-item",SidePanelItem),customElements.define("k-side-panel-label",SidePanelLabel),customElements.define("k-side-panel-menu",SidePanelMenu),customElements.define("k-side-panel-spacer",SidePanelSpacer);export default SidePanel;
@@ -1,189 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SideMenu - Components - Kempo Docs - A Web Components Solution</title>
7
- <link rel="icon" type="image/png" sizes="48x48" href="../media/icon48.png">
8
- <link rel="manifest" href="../manifest.json" />
9
- <link rel="stylesheet" href="../kempo-vars.css" />
10
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@1.3.11/dist/kempo.min.css" />
11
- <link rel="stylesheet" href="../kempo-hljs.css" />
12
- <link rel="stylesheet" href="../styles.css" />
13
- <script>window.litDisableBundleWarning = true;</script>
14
- </head>
15
- <body>
16
- <k-import src="../nav-1.inc.html"></k-import>
17
- <h1 class="ta-center">SideMenu</h1>
18
- <main>
19
- <details class="b r mb">
20
- <summary class="p">Table of Contents</summary>
21
- <div class="m mt0 pl">
22
- <h6>Examples</h6>
23
- <a href="#basicUsage">Basic Usage</a><br />
24
- <a href="#closing">Closing</a><br />
25
- <a href="#escClose">ESC Key Close</a><br />
26
- <a href="#rightSideMenu">Right Side Menu</a><br />
27
-
28
- <h6 class="mt">JavaScript Reference</h6>
29
- <a href="#constructor">Constructor</a><br />
30
- <a href="#requirements">Requirements</a><br />
31
- <a href="#properties">Properties</a><br />
32
- <a href="#events">Events</a><br />
33
- <a href="#methods">Methods</a><br />
34
- </div>
35
- </details>
36
-
37
- <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
38
- <p>Side Menus are closed by default, to open them call the <code>open()</code> method.</p>
39
- <div class="row -mx">
40
- <div class="col m-span-12 px">
41
- <k-card label="HTML">
42
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm1"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm1"</span>&gt;</span>Open Side Menu 1<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>&gt;</span><span class="javascript"><br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm1'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm1'</span>).open();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
43
- </k-card>
44
- </div>
45
- <div class="col m-span-12 px">
46
- <k-card label="Output">
47
- <k-side-menu id="sm1">
48
- <p>Side Menu 1</p>
49
- </k-side-menu>
50
- <button id="open-sm1">Open Side Menu 1</button>
51
- <script>
52
- document.getElementById('open-sm1').addEventListener('click',()=>{
53
- document.getElementById('sm1').open();
54
- });
55
- </script>
56
- </k-card>
57
- </div>
58
- </div>
59
-
60
- <h3 id="closing"><a href="#closing" class="no-link">Closing</a></h3>
61
- <p>By default clicking on the overlay (the part that covers the page while the Side Menu is open) will close the Side Menu. Use the <code>overlay-close="false"</code> attribute/value to disable this.</p>
62
- <p>By default pressing the ESC key will also close the Side Menu. Use the <code>esc-close="false"</code> attribute/value to disable this.</p>
63
- <p>Use the <code>close()</code> method to close the Side Menu, alternately you can use the <code>toggle()</code> method which can be used to open or close the Side Menu.</p>
64
- <div class="row -mx">
65
- <div class="col m-span-12 px">
66
- <k-card label="HTML">
67
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm2"</span> <span class="hljs-attr">overlay-close</span>=<span class="hljs-string">"false"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"close-sm2"</span>&gt;</span>Close<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm2"</span>&gt;</span>Open Side Menu 2<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>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">const</span> $sm2 = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm2'</span>);<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm2'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm2.open();<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'close-sm2'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm2.close();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
68
- </k-card>
69
- </div>
70
- <div class="col m-span-12 px">
71
- <k-card label="Output">
72
- <k-side-menu id="sm2" overlay-close="false">
73
- <p>Side Menu 2</p>
74
- <button id="close-sm2">Close</button>
75
- </k-side-menu>
76
- <button id="open-sm2">Open Side Menu 2</button>
77
- <script>
78
- const $sm2 = document.getElementById('sm2');
79
- document.getElementById('open-sm2').addEventListener('click',()=>{
80
- $sm2.open();
81
- });
82
- document.getElementById('close-sm2').addEventListener('click',()=>{
83
- $sm2.close();
84
- });
85
- </script>
86
- </k-card>
87
- </div>
88
- </div>
89
-
90
- <h3 id="escClose"><a href="#escClose" class="no-link">ESC Key Close</a></h3>
91
- <p>By default pressing the ESC key will close the Side Menu. Use the <code>esc-close="false"</code> attribute/value to disable this behavior.</p>
92
- <div class="row -mx">
93
- <div class="col m-span-12 px">
94
- <k-card label="HTML">
95
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm4"</span> <span class="hljs-attr">esc-close</span>=<span class="hljs-string">"false"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 4 - ESC won't close this<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"close-sm4"</span>&gt;</span>Close<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm4"</span>&gt;</span>Open Side Menu 4<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>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">const</span> $sm4 = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm4'</span>);<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm4'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm4.open();<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'close-sm4'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm4.close();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
96
- </k-card>
97
- </div>
98
- <div class="col m-span-12 px">
99
- <k-card label="Output">
100
- <k-side-menu id="sm4" esc-close="false">
101
- <p>Side Menu 4 - ESC won't close this</p>
102
- <button id="close-sm4">Close</button>
103
- </k-side-menu>
104
- <button id="open-sm4">Open Side Menu 4</button>
105
- <script>
106
- const $sm4 = document.getElementById('sm4');
107
- document.getElementById('open-sm4').addEventListener('click',()=>{
108
- $sm4.open();
109
- });
110
- document.getElementById('close-sm4').addEventListener('click',()=>{
111
- $sm4.close();
112
- });
113
- </script>
114
- </k-card>
115
- </div>
116
- </div>
117
-
118
- <h3 id="rightSideMenu"><a href="#rightSideMenu" class="no-link">Right Side Menu</a></h3>
119
- <p>Give the menu the <code>side="right"</code> attribute/value to make it open from the right side.</p>
120
- <div class="row -mx">
121
- <div class="col m-span-12 px">
122
- <k-card label="HTML">
123
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm3"</span> <span class="hljs-attr">side</span>=<span class="hljs-string">"right"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm3"</span>&gt;</span>Open Side Menu 3<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>&gt;</span><span class="javascript"><br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm3'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm3'</span>).open();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
124
- </k-card>
125
- </div>
126
- <div class="col m-span-12 px">
127
- <k-card label="Output">
128
- <k-side-menu id="sm3" side="right">
129
- <p>Side Menu 3</p>
130
- </k-side-menu>
131
- <button id="open-sm3">Open Side Menu 3</button>
132
- <script>
133
- document.getElementById('open-sm3').addEventListener('click',()=>{
134
- document.getElementById('sm3').open();
135
- });
136
- </script>
137
- </k-card>
138
- </div>
139
- </div>
140
-
141
- <h2 id="jsRef">JavaScript Reference</h2>
142
-
143
- <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
144
- <h6>Extends <a href="./shadowcomponent.html">ShadowComponent</a></h6>
145
- <h5>
146
- <code>new SideMenu()</code>
147
- </h5>
148
-
149
- <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
150
- <ul>
151
- <li><a href="./shadowcomponent.html">ShadowComponent</a></li>
152
- <li><a href="./focuscapture.html">FocusCapture</a></li>
153
- <li><strong>CSS:</strong> Add <code>html { scrollbar-gutter: stable; }</code> to your global styles to prevent layout shifts when the menu disables scrolling.</li>
154
- </ul>
155
-
156
- <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
157
- <h5><code>opened<i>: boolean</i></code></h5>
158
- <p>Whether the side menu is opened. Defaults to <code>false</code>. Syncs to <code>opened</code> attribute.</p>
159
- <h5><code>overlayClose<i>: boolean</i></code></h5>
160
- <p>Whether clicking the overlay closes the side menu. Defaults to <code>true</code>. Syncs to <code>overlay-close</code> attribute.</p>
161
- <h5><code>escClose<i>: boolean</i></code></h5>
162
- <p>Whether pressing the ESC key closes the side menu. Defaults to <code>true</code>. Syncs to <code>esc-close</code> attribute.</p>
163
- <h5><code>side<i>: string</i></code></h5>
164
- <p>The side from which the menu opens. Can be <code>"left"</code> or <code>"right"</code>. Defaults to <code>"left"</code>. Syncs to <code>side</code> attribute.</p>
165
-
166
- <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
167
- <h5><code>open</code></h5>
168
- <p>Dispatched when the side menu is opened.</p>
169
- <h5><code>close</code></h5>
170
- <p>Dispatched when the side menu is closed.</p>
171
- <h5><code>change</code></h5>
172
- <p>Dispatched when the side menu state changes. Event detail contains "open" or "close".</p>
173
- <h5><code>toggle</code></h5>
174
- <p>Dispatched when the toggle method is called.</p>
175
-
176
- <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
177
- <h5><code>open()<i>: void</i></code></h5>
178
- <p>Opens the side menu.</p>
179
- <h5><code>close()<i>: void</i></code></h5>
180
- <p>Closes the side menu.</p>
181
- <h5><code>toggle()<i>: void</i></code></h5>
182
- <p>Toggles the side menu open or closed and dispatches a toggle event.</p>
183
-
184
- </main>
185
- <div style="height:33vh"></div>
186
- <script type="module" src="../src/components/Import.js"></script>
187
- <script type="module" src="../src/components/SideMenu.js"></script>
188
- </body>
189
- </html>
@@ -1,44 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SidePanel Basic Example</title>
7
- <link rel="stylesheet" href="../kempo-vars.css" />
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@1.3.11/dist/kempo.min.css" />
9
- <script>window.litDisableBundleWarning = true;</script>
10
- <script type="module">
11
- import theme from '../src/utils/theme.js';
12
- theme.init();
13
- </script>
14
- <script type="module" src="../src/components/SidePanel.js"></script>
15
- <script type="module" src="../src/components/Main.js"></script>
16
- <style>
17
- body {
18
- margin: 0;
19
- padding: 0;
20
- height: 100vh;
21
- overflow: hidden;
22
- }
23
- </style>
24
- </head>
25
- <body>
26
- <k-side-panel>
27
- <h5 slot="logo" class="m0">Kempo</h5>
28
- <k-side-panel-item icon="cards" href="#" active>Dashboard</k-side-panel-item>
29
- <k-side-panel-item icon="check" href="#">Tasks</k-side-panel-item>
30
- <k-side-panel-item icon="label" href="#">Email</k-side-panel-item>
31
- <k-side-panel-label>Projects</k-side-panel-label>
32
- <k-side-panel-item icon="folder" href="#">Figma Design</k-side-panel-item>
33
- <k-side-panel-item icon="folder" href="#">Static Mania</k-side-panel-item>
34
- <k-side-panel-spacer></k-side-panel-spacer>
35
- <k-side-panel-item icon="settings" href="#">Settings</k-side-panel-item>
36
- <k-side-panel-item icon="account-circle" href="#">Profile</k-side-panel-item>
37
- </k-side-panel>
38
- <k-main>
39
- <h2>Main Content</h2>
40
- <p>This is an example of the side panel. Click the toggle button to collapse it.</p>
41
- <p>The Main component automatically adjusts its margin based on the panel state.</p>
42
- </k-main>
43
- </body>
44
- </html>
@@ -1,70 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SidePanel Dual - Components - Kempo Docs</title>
7
- <link rel="stylesheet" href="../kempo-vars.css" />
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@1.3.11/dist/kempo.min.css" />
9
- <script>window.litDisableBundleWarning = true;</script>
10
- <script type="module">
11
- import theme from '../src/utils/theme.js';
12
- theme.init();
13
- </script>
14
- <script type="module" src="../src/components/SidePanel.js"></script>
15
- <script type="module" src="../src/components/Main.js"></script>
16
- <style>
17
- body {
18
- margin: 0;
19
- padding: 0;
20
- }
21
- </style>
22
- </head>
23
- <body>
24
- <!-- Left Side Panel -->
25
- <k-side-panel>
26
- <h3 slot="logo" class="m0">Kempo</h3>
27
- <k-side-panel-item icon="cards" href="#" active>Dashboard</k-side-panel-item>
28
- <k-side-panel-item icon="check" href="#">Tasks</k-side-panel-item>
29
- <k-side-panel-item icon="label" href="#">Email</k-side-panel-item>
30
- <k-side-panel-label>Projects</k-side-panel-label>
31
- <k-side-panel-item icon="folder" href="#">Figma Design</k-side-panel-item>
32
- <k-side-panel-item icon="folder" href="#">Static Mania</k-side-panel-item>
33
- <k-side-panel-spacer></k-side-panel-spacer>
34
- <k-side-panel-item icon="settings" href="#">Settings</k-side-panel-item>
35
- <k-side-panel-item icon="account-circle" href="#">Profile</k-side-panel-item>
36
- </k-side-panel>
37
-
38
- <!-- Right Side Panel -->
39
- <k-side-panel side="right">
40
- <h3 slot="logo" class="m0">Tools</h3>
41
- <k-side-panel-item icon="notification" href="#">Notifications</k-side-panel-item>
42
- <k-side-panel-item icon="chat" href="#">Messages</k-side-panel-item>
43
- <k-side-panel-label>Recent</k-side-panel-label>
44
- <k-side-panel-item icon="document" href="#">Document 1</k-side-panel-item>
45
- <k-side-panel-item icon="document" href="#">Document 2</k-side-panel-item>
46
- <k-side-panel-spacer></k-side-panel-spacer>
47
- <k-side-panel-item icon="help" href="#">Help</k-side-panel-item>
48
- </k-side-panel>
49
-
50
- <!-- Main Content -->
51
- <k-main>
52
- <h1>Dual Side Panels</h1>
53
- <p>This page demonstrates two side panels working simultaneously - one on the left and one on the right.</p>
54
- <p>Try toggling each panel independently using the arrow buttons.</p>
55
-
56
- <h2>Features</h2>
57
- <ul>
58
- <li>Left panel defaults to left side</li>
59
- <li>Right panel uses <code>side="right"</code> attribute</li>
60
- <li>Both panels can be collapsed/expanded independently</li>
61
- <li>Main content automatically adjusts margins for both panels</li>
62
- <li>Toggle arrows point correctly for each side</li>
63
- </ul>
64
-
65
- <h2>Lorem Ipsum</h2>
66
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
67
- <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
68
- </k-main>
69
- </body>
70
- </html>
@@ -1,50 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SidePanel Menu Example</title>
7
- <link rel="stylesheet" href="../kempo-vars.css" />
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@1.3.11/dist/kempo.min.css" />
9
- <script>window.litDisableBundleWarning = true;</script>
10
- <script type="module">
11
- import theme from '../src/utils/theme.js';
12
- theme.init();
13
- </script>
14
- <script type="module" src="../src/components/SidePanel.js"></script>
15
- <style>
16
- body {
17
- margin: 0;
18
- padding: 0;
19
- height: 100vh;
20
- overflow: hidden;
21
- }
22
- </style>
23
- </head>
24
- <body>
25
- <k-side-panel>
26
- <h3 slot="logo" style="margin: 0; font-size: 1.25rem;">App</h3>
27
- <k-side-panel-item icon="cards" href="#">Dashboard</k-side-panel-item>
28
- <k-side-panel-menu icon="folder" label="Projects">
29
- <k-side-panel-item href="#">Website Redesign</k-side-panel-item>
30
- <k-side-panel-item href="#">Mobile App</k-side-panel-item>
31
- </k-side-panel-menu>
32
- <k-side-panel-spacer></k-side-panel-spacer>
33
- <k-side-panel-item icon="settings" href="#">Settings</k-side-panel-item>
34
- </k-side-panel>
35
- <div style="margin-left: 16rem; padding: 2rem; transition: margin-left 256ms;">
36
- <h2>Main Content</h2>
37
- <p>Click on the "Projects" menu to expand it and see sub-items.</p>
38
- </div>
39
- <script>
40
- const panel = document.querySelector('k-side-panel');
41
- const content = document.querySelector('div');
42
- panel.addEventListener('collapse', () => {
43
- content.style.marginLeft = '3.5rem';
44
- });
45
- panel.addEventListener('expand', () => {
46
- content.style.marginLeft = '16rem';
47
- });
48
- </script>
49
- </body>
50
- </html>