kempo-ui 0.0.3 → 0.0.4
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/.github/workflows/publish-major.yml +39 -0
- package/.github/workflows/publish-minor.yml +39 -0
- package/.github/workflows/{publish-npm.yml → publish-patch.yml} +1 -1
- package/.vscode/settings.json +2 -0
- package/dist/kempo-hljs.css +1 -0
- package/dist/src/components/Accordion.js +36 -0
- package/dist/src/components/Card.js +37 -0
- package/dist/src/components/Collapsible.js +41 -0
- package/dist/src/components/ContentSlider.js +44 -0
- package/dist/src/components/Dialog.js +113 -0
- package/dist/src/components/Icon.js +2 -2
- package/dist/src/components/PersistantCollapsible.js +1 -0
- package/dist/src/components/PhotoViewer.js +135 -0
- package/dist/src/components/Resize.js +96 -0
- package/dist/src/components/ShowMore.js +42 -0
- package/dist/src/components/SideMenu.js +1 -1
- package/dist/src/components/Split.js +84 -0
- package/dist/src/components/Tabs.js +155 -0
- package/dist/src/components/Tags.js +69 -0
- package/dist/src/components/ThemeSwitcher.js +23 -0
- package/dist/src/components/Timestamp.js +1 -0
- package/dist/src/utils/debounce.js +1 -0
- package/dist/src/utils/drag.js +1 -0
- package/dist/src/utils/formatTimestamp.js +1 -0
- package/dist/src/utils/propConverters.js +1 -0
- package/dist/src/utils/watchWindowSize.js +1 -0
- package/docs/components/accordion.html +69 -25
- package/docs/components/card.html +6 -5
- package/docs/components/collapsible.html +198 -0
- package/docs/components/content-slider.html +56 -26
- package/docs/components/dialog.html +54 -48
- package/docs/components/focus-capture.html +2 -3
- package/docs/components/icon.html +5 -8
- package/docs/components/import.html +1 -6
- package/docs/components/persistant-collapsible.html +123 -0
- package/docs/components/photo-viewer.html +226 -0
- package/docs/components/resize.html +44 -18
- package/docs/components/show-more.html +12 -6
- package/docs/components/side-menu.html +3 -12
- package/docs/components/split.html +26 -5
- package/docs/components/tablePagination.html +4 -4
- package/docs/components/tableRecordFiltering.html +16 -3
- package/docs/components/tableRecordSelection.html +2 -2
- package/docs/components/tabs.html +24 -7
- package/docs/components/tags.html +24 -8
- package/docs/components/theme-switcher.html +3 -6
- package/docs/components/timestamp.html +20 -24
- package/docs/components/toast.html +23 -32
- package/docs/components/toggle.html +4 -3
- package/docs/kempo-hljs.css +1 -0
- package/docs/media/civic.jpg +0 -0
- package/docs/media/corvette.jpg +0 -0
- package/docs/media/evo.jpg +0 -0
- package/docs/media/gtr.jpg +0 -0
- package/docs/media/nsx.jpg +0 -0
- package/docs/nav.inc.html +11 -17
- package/docs/src/components/Accordion.js +36 -0
- package/docs/src/components/Card.js +37 -0
- package/docs/src/components/Collapsible.js +41 -0
- package/docs/src/components/ContentSlider.js +44 -0
- package/docs/src/components/Dialog.js +113 -0
- package/docs/src/components/Icon.js +2 -2
- package/docs/src/components/PersistantCollapsible.js +1 -0
- package/docs/src/components/PhotoViewer.js +135 -0
- package/docs/src/components/Resize.js +96 -0
- package/docs/src/components/ShowMore.js +42 -0
- package/docs/src/components/SideMenu.js +1 -1
- package/docs/src/components/Split.js +84 -0
- package/docs/src/components/Tabs.js +155 -0
- package/docs/src/components/Tags.js +69 -0
- package/docs/src/components/ThemeSwitcher.js +23 -0
- package/docs/src/components/Timestamp.js +1 -0
- package/docs/src/utils/debounce.js +1 -0
- package/docs/src/utils/drag.js +1 -0
- package/docs/src/utils/formatTimestamp.js +1 -0
- package/docs/src/utils/propConverters.js +1 -0
- package/docs/src/utils/watchWindowSize.js +1 -0
- package/docs/utils/debounce.html +78 -0
- package/docs/utils/drag.html +104 -0
- package/docs/utils/formatTimestamp.html +114 -0
- package/docs/utils/propConverters.html +132 -0
- package/docs/utils/watchWindowSize.html +166 -0
- package/icons/error.svg +1 -1
- package/icons/warning.svg +1 -1
- package/package.json +1 -1
- package/scripts/build.js +1 -1
- package/scripts/docs.js +4 -2
- package/src/components/Accordion.js +229 -0
- package/src/components/Collapsible.js +109 -0
- package/src/components/ContentSlider.js +205 -0
- package/src/components/Dialog.js +368 -0
- package/src/components/PersistantCollapsible.js +69 -0
- package/src/components/PhotoViewer.js +368 -0
- package/src/components/Resize.js +210 -0
- package/src/components/ShadowComponent.js +3 -1
- package/src/components/ShowMore.js +109 -0
- package/src/components/Sortable.js +193 -0
- package/src/components/Split.js +192 -0
- package/src/components/Table.js +1202 -0
- package/src/components/Tabs.js +428 -0
- package/src/components/Tags.js +253 -0
- package/src/components/Timestamp.js +31 -0
- package/src/components/Toast.js +454 -0
- package/src/components/Toggle.js +173 -0
- package/src/components/tableControls/DeleteRecord.js +29 -0
- package/src/components/tableControls/Edit.js +88 -0
- package/src/components/tableControls/ExportCSV.js +71 -0
- package/src/components/tableControls/ExportJson.js +55 -0
- package/src/components/tableControls/FieldSortHide.js +76 -0
- package/src/components/tableControls/Filters.js +114 -0
- package/src/components/tableControls/FirstPage.js +65 -0
- package/src/components/tableControls/HiddenCount.js +45 -0
- package/src/components/tableControls/Hide.js +34 -0
- package/src/components/tableControls/LastPage.js +65 -0
- package/src/components/tableControls/NextPage.js +65 -0
- package/src/components/tableControls/PageSelect.js +109 -0
- package/src/components/tableControls/PageSize.js +68 -0
- package/src/components/tableControls/PrevPage.js +65 -0
- package/src/components/tableControls/Search.js +58 -0
- package/src/components/tableControls/ShowAll.js +34 -0
- package/src/components/tableControls/TableControl.js +105 -0
- package/src/utils/debounce.js +9 -0
- package/src/utils/drag.js +80 -0
- package/src/utils/formatTimestamp.js +27 -0
- package/src/utils/toTitleCase.js +9 -0
- package/src/utils/watchWindowSize.js +16 -0
- package/dist/src/utils/cli.js +0 -1
- package/dist/src/utils/fs-utils.js +0 -1
- package/docs/components/component.html +0 -90
- package/docs/components/directory-viewer.html +0 -90
- package/docs/components/lazy-component.html +0 -84
- package/docs/components/reactive-component.html +0 -69
- package/docs/components/reactive-lazy-component.html +0 -69
- package/docs/components/search.html +0 -102
- package/docs/components/sortable.html +0 -96
- package/src/utils/cli.js +0 -43
- package/src/utils/fs-utils.js +0 -41
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import{LitElement,html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";import Icon from"./Icon.js";import{boolExists}from"../utils/propConverters.js";export default class ShowMore extends ShadowComponent{static properties={opened:{type:Boolean,converter:boolExists,reflect:!0}};constructor(){super(),this.opened=!1}updated(e){super.updated(e),e.has("opened")&&(this.dispatchEvent(new CustomEvent("change",{detail:{opened:this.opened}})),this.dispatchEvent(new CustomEvent(this.opened?"opened":"closed")))}handleToggleClick=()=>{this.toggle()};more(){this.opened=!0}less(){this.opened=!1}toggle(){this.opened=!this.opened}static styles=css`
|
|
2
|
+
:host {
|
|
3
|
+
--closed_height: 7rem;
|
|
4
|
+
|
|
5
|
+
display: block;
|
|
6
|
+
}
|
|
7
|
+
:host(:not([opened])) #content {
|
|
8
|
+
height: var(--closed_height);
|
|
9
|
+
overflow-y: hidden;
|
|
10
|
+
}
|
|
11
|
+
:host(:not([opened])) #content {
|
|
12
|
+
margin-bottom: calc(var(--closed_height) * -0.9);
|
|
13
|
+
}
|
|
14
|
+
:host(:not([opened])) #toggle {
|
|
15
|
+
padding-top: calc(var(--closed_height) - 2rem);
|
|
16
|
+
background: linear-gradient(to bottom, transparent 0%, var(--c_bg) 95%);
|
|
17
|
+
}
|
|
18
|
+
#toggle {
|
|
19
|
+
width: 100%;
|
|
20
|
+
padding: var(--spacer_h);
|
|
21
|
+
text-align: center;
|
|
22
|
+
background: var(--c_bg);
|
|
23
|
+
}
|
|
24
|
+
:host([opened]) #more,
|
|
25
|
+
:host(:not([opened])) #less {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
`;render(){return html`
|
|
29
|
+
<div id="wrapper">
|
|
30
|
+
<div id="content">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|
|
33
|
+
<button id="toggle" @click=${this.handleToggleClick} class="no-btn">
|
|
34
|
+
<span id="more">
|
|
35
|
+
<slot name="more">Show More <k-icon name="arrow-down-double"></k-icon></slot>
|
|
36
|
+
</span>
|
|
37
|
+
<span id="less">
|
|
38
|
+
<slot name="less">Show Less <k-icon name="arrow-up-double"></k-icon></slot>
|
|
39
|
+
</span>
|
|
40
|
+
</button>
|
|
41
|
+
</div>
|
|
42
|
+
`}}customElements.define("k-show-more",ShowMore);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";import"./FocusCapture.js";export default class SideMenu extends ShadowComponent{static properties={opened:{type:Boolean,reflect:!0},overlayClose:{type:Boolean,reflect:!0,attribute:"overlay-close"},side:{type:String,reflect:!0}};constructor(){super(),this.opened=!1,this.overlayClose=!0,this.side="left"}overlayClick=()=>{this.overlayClose&&this.close()};updated(e){super.updated(e),e.has("opened")&&(this.opened?(this.dispatchEvent(new CustomEvent("change",{detail:"open"})),this.dispatchEvent(new CustomEvent("open"))):(this.dispatchEvent(new CustomEvent("change",{detail:"close"})),this.dispatchEvent(new CustomEvent("close"))))}open(){this.opened=!0}close(){this.opened=!1}toggle(){this.opened?this.close():this.open(),this.dispatchEvent(new CustomEvent("toggle"))}render(){return html`
|
|
1
|
+
import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";import{boolTrueFalse}from"../utils/propConverters.js";import"./FocusCapture.js";export default class SideMenu extends ShadowComponent{static properties={opened:{type:Boolean,reflect:!0},overlayClose:{type:Boolean,reflect:!0,attribute:"overlay-close",converter:boolTrueFalse},side:{type:String,reflect:!0}};constructor(){super(),this.opened=!1,this.overlayClose=!0,this.side="left"}overlayClick=()=>{this.overlayClose&&this.close()};updated(e){super.updated(e),e.has("opened")&&(this.opened?(this.dispatchEvent(new CustomEvent("change",{detail:"open"})),this.dispatchEvent(new CustomEvent("open"))):(this.dispatchEvent(new CustomEvent("change",{detail:"close"})),this.dispatchEvent(new CustomEvent("close"))))}open(){this.opened=!0}close(){this.opened=!1}toggle(){this.opened?this.close():this.open(),this.dispatchEvent(new CustomEvent("toggle"))}render(){return html`
|
|
2
2
|
<k-focus-capture>
|
|
3
3
|
<div id="container">
|
|
4
4
|
<button id="overlay" @click=${this.overlayClick}>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";import drag from"../utils/drag.js";import{watchWindowSize,unwatchWindowSize}from"../utils/watchWindowSize.js";export default class Split extends ShadowComponent{static properties={resizing:{type:Boolean,reflect:!0},stacked:{type:Boolean,reflect:!0},stackWidth:{type:Number,attribute:"stack-width"}};constructor(){super(),this.resizing=!1,this.stacked=!1,this.stackWidth=0,this.dragStartWidth=0,this.dragCleanup=()=>{},this.windowResizeHandler=this.handleWindowResize.bind(this)}firstUpdated(){super.firstUpdated(),this.setupDragHandler(),this.stacked=watchWindowSize(this.windowResizeHandler)<=this.stackWidth}disconnectedCallback(){super.disconnectedCallback(),this.dragCleanup(),unwatchWindowSize(this.windowResizeHandler)}handleWindowResize=t=>{this.stacked=t<=this.stackWidth};handleDragStart=()=>{this.resizing=!0,this.dragStartWidth=Math.round(this.shadowRoot.getElementById("left").getBoundingClientRect().width),this.dispatchEvent(new CustomEvent("resizestart",{detail:{startSize:this.dragStartWidth},bubbles:!0}))};handleDrag=({x:t})=>{const e=`${this.dragStartWidth+t}px`;this.setSize(e),this.dispatchEvent(new CustomEvent("resize",{detail:{size:e},bubbles:!0}))};handleDragEnd=({x:t})=>{this.resizing=!1;const e=`${this.dragStartWidth+t}px`;this.setSize(e),this.dispatchEvent(new CustomEvent("resizeend",{detail:{size:e},bubbles:!0}))};setSize(t){this.style.setProperty("--left_width",t)}setupDragHandler(){const t=this.shadowRoot.getElementById("divider-handle");t&&(this.dragCleanup=drag({element:t,callback:this.handleDrag,startCallback:this.handleDragStart,endCallback:this.handleDragEnd}))}static styles=css`
|
|
2
|
+
:host {
|
|
3
|
+
--left_width: calc((100% - var(--handle_width)) / 2);
|
|
4
|
+
--handle_width: 0.5rem;
|
|
5
|
+
--min_pane_width: 6rem;
|
|
6
|
+
|
|
7
|
+
height: 100%;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
flex: 1 1 auto;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.pane, #divider-handle {
|
|
15
|
+
display: inline-block;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pane {
|
|
19
|
+
min-width: var(--min_pane_width);
|
|
20
|
+
max-width: calc(100% - var(--min_pane_width));
|
|
21
|
+
max-height: 100%;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#left {
|
|
26
|
+
flex: 0 0 var(--left_width);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#divider-handle {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: var(--handle_width);
|
|
33
|
+
cursor: ew-resize;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([resizing]) #divider-handle {
|
|
37
|
+
background-color: var(--tc_primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host([resizing]) .pane {
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
user-select: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#divider-border {
|
|
46
|
+
width: 1px;
|
|
47
|
+
height: 100%;
|
|
48
|
+
border-left: 1px solid var(--c_border);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#right {
|
|
52
|
+
flex: 1 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([stacked]) #left,
|
|
56
|
+
:host([stacked]) #right {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([stacked]) #divider-handle {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([stacked]) .pane {
|
|
65
|
+
min-width: 0;
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
max-height: none;
|
|
68
|
+
overflow: auto;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([stacked]) {
|
|
72
|
+
display: block;
|
|
73
|
+
}
|
|
74
|
+
`;render(){return html`
|
|
75
|
+
<div id="left" class="pane">
|
|
76
|
+
<slot></slot>
|
|
77
|
+
</div>
|
|
78
|
+
<div id="divider-handle">
|
|
79
|
+
<div id="divider-border"></div>
|
|
80
|
+
</div>
|
|
81
|
+
<div id="right" class="pane">
|
|
82
|
+
<slot name="right"></slot>
|
|
83
|
+
</div>
|
|
84
|
+
`}}customElements.define("k-split",Split);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";import{boolExists}from"../utils/propConverters.js";export class Tabs extends ShadowComponent{static properties={active:{type:String,reflect:!0},fixedHeight:{type:Boolean,reflect:!0,attribute:"fixed-height",converter:boolExists}};constructor(){super(),this.active="",this.fixedHeight=!1}firstUpdated(){if(super.firstUpdated(),!this.active){const t=this.querySelector("k-tab-content");t&&(this.active=t.name)}this.setupScrollListeners(),this.updateScrollIndicators(),new ResizeObserver(()=>this.updateScrollIndicators()).observe(this.shadowRoot.getElementById("tabs"))}updated(t){super.updated(t),t.has("active")&&this.updateActiveElements()}setupScrollListeners(){const t=this.shadowRoot.getElementById("tabs"),e=this.shadowRoot.getElementById("scroll-left"),o=this.shadowRoot.getElementById("scroll-right");t.addEventListener("scroll",()=>this.updateScrollIndicators()),e.addEventListener("click",()=>{t.scrollBy({left:-200,behavior:"smooth"})}),o.addEventListener("click",()=>{t.scrollBy({left:200,behavior:"smooth"})})}updateScrollIndicators(){const t=this.shadowRoot.getElementById("tabs"),e=this.shadowRoot.getElementById("scroll-left"),o=this.shadowRoot.getElementById("scroll-right"),s=t.scrollLeft>0,i=t.scrollLeft<t.scrollWidth-t.clientWidth;e.classList.toggle("visible",s),o.classList.toggle("visible",i)}updateActiveElements(){const t=this.getActiveTab();t&&(t.active=!1);const e=this.getActiveContent();e&&(e.active=!1);const o=this.getTab(this.active);o&&(o.active=!0);const s=this.getContent(this.active);s&&(s.active=!0),this.dispatchEvent(new CustomEvent("tab",{detail:{tab:this.active},bubbles:!0}))}get contents(){return[...this.querySelectorAll(":scope > k-tab-content")]}get tabs(){return[...this.querySelectorAll(":scope > k-tab")]}getTab(t){let e;if("string"==typeof t&&(e=this.querySelector(`k-tab[for="${t}"]`)),!e){let o=parseInt(t);o||(o=0),e=this.querySelectorAll("k-tab")[o]}return e}getActiveTab(){return this.querySelector(":scope > k-tab[active]")}getContent(t){let e;if("string"==typeof t&&(e=this.querySelector(`k-tab-content[name="${t}"]`)),!e){let o=parseInt(t);o||(o=0),e=this.querySelectorAll("k-tab-content")[o]}return e}getActiveContent(){return this.querySelector(":scope > k-tab-content[active]")}static styles=css`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
#wrapper {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#tabs-container {
|
|
15
|
+
position: relative;
|
|
16
|
+
border-bottom: 1px solid var(--c_border);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#tabs {
|
|
20
|
+
display: flex;
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
overflow-y: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#tabs ::slotted(*) {
|
|
26
|
+
flex: 0 0 auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.scroll-indicator {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
width: 72px;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
opacity: 0;
|
|
36
|
+
transition: opacity 0.2s;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
padding-bottom: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.scroll-indicator .arrow {
|
|
44
|
+
color: var(--tc_base);
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.scroll-indicator.visible {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#scroll-left {
|
|
53
|
+
left: 0;
|
|
54
|
+
background: linear-gradient(90deg,
|
|
55
|
+
var(--c_bg) 0%,
|
|
56
|
+
var(--c_bg) 30%,
|
|
57
|
+
transparent 100%
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#scroll-right {
|
|
62
|
+
right: 0;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
background: linear-gradient(-90deg,
|
|
65
|
+
var(--c_bg) 0%,
|
|
66
|
+
var(--c_bg) 30%,
|
|
67
|
+
transparent 100%
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([fixed-height]) #wrapper {
|
|
72
|
+
height: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([fixed-height]) #contents {
|
|
76
|
+
height: 100%;
|
|
77
|
+
flex: 1;
|
|
78
|
+
min-height: 1.35rem;
|
|
79
|
+
overflow: auto;
|
|
80
|
+
}
|
|
81
|
+
`;render(){return html`
|
|
82
|
+
<div id="wrapper">
|
|
83
|
+
<div id="tabs-container">
|
|
84
|
+
<div id="scroll-left" class="scroll-indicator">
|
|
85
|
+
<svg class="arrow" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
86
|
+
<path d="M12 15L7 10L12 5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
87
|
+
</svg>
|
|
88
|
+
</div>
|
|
89
|
+
<div id="tabs">
|
|
90
|
+
<slot name="tabs"></slot>
|
|
91
|
+
</div>
|
|
92
|
+
<div id="scroll-right" class="scroll-indicator">
|
|
93
|
+
<svg class="arrow" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
94
|
+
<path d="M8 15L13 10L8 5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
95
|
+
</svg>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
<div id="contents">
|
|
99
|
+
<slot></slot>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`}}export class Tab extends ShadowComponent{static properties={active:{type:Boolean,reflect:!0,converter:boolExists},for:{type:String,reflect:!0}};constructor(){super(),this.active=!1,this.for="",this.slot="tabs"}handleClick=()=>{if(!this.active){const t=this.parentElement;t&&"K-TABS"===t.tagName&&(t.active=this.for||t.tabs.indexOf(this).toString())}};get tabs(){return"K-TABS"===this.parentElement?.tagName?this.parentElement:null}static styles=css`
|
|
103
|
+
:host {
|
|
104
|
+
margin-bottom: -1px;
|
|
105
|
+
flex: 0 0 auto;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#button {
|
|
109
|
+
padding: var(--spacer_h);
|
|
110
|
+
background-color: transparent;
|
|
111
|
+
border: none;
|
|
112
|
+
cursor: inherit;
|
|
113
|
+
box-shadow: none;
|
|
114
|
+
color: inherit;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host(:not([active])) #button {
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([active]) {
|
|
123
|
+
border-bottom: 2px solid var(--c_primary);
|
|
124
|
+
margin-bottom: -1px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([active]) #button {
|
|
128
|
+
color: var(--tc_primary);
|
|
129
|
+
}
|
|
130
|
+
`;render(){return html`
|
|
131
|
+
<button id="button" @click=${this.handleClick}>
|
|
132
|
+
<slot></slot>
|
|
133
|
+
</button>
|
|
134
|
+
`}}export class TabContent extends ShadowComponent{static properties={active:{type:Boolean,reflect:!0,converter:boolExists},name:{type:String,reflect:!0}};constructor(){super(),this.active=!1,this.name=""}get tabs(){return"K-TABS"===this.parentElement?.tagName?this.parentElement:null}static styles=css`
|
|
135
|
+
:host {
|
|
136
|
+
display: block;
|
|
137
|
+
height: 100%;
|
|
138
|
+
max-height: 100%;
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
overflow: auto;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host([active]) {
|
|
144
|
+
display: block;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host(:not([active])) {
|
|
148
|
+
display: none;
|
|
149
|
+
}
|
|
150
|
+
`;render(){return html`<slot></slot>`}}export class TabSpacer extends ShadowComponent{constructor(){super(),this.slot="tabs"}static styles=css`
|
|
151
|
+
:host {
|
|
152
|
+
flex: 1 1 auto !important;
|
|
153
|
+
height: 1px;
|
|
154
|
+
}
|
|
155
|
+
`;render(){return html`<slot></slot>`}}customElements.define("k-tabs",Tabs),customElements.define("k-tab",Tab),customElements.define("k-tab-content",TabContent),customElements.define("k-tab-spacer",TabSpacer);export default{Tab:Tab,TabContent:TabContent,Tabs:Tabs,TabSpacer:TabSpacer};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import{html,css}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";export default class Tags extends ShadowComponent{static properties={value:{type:String,reflect:!0},allowedTags:{type:String,reflect:!0,attribute:"allowed-tags"},disallowedTags:{type:String,reflect:!0,attribute:"disallowed-tags"}};constructor(){super(),this.value="",this.allowedTags="",this.disallowedTags=""}firstUpdated(){super.firstUpdated(),this.renderTags()}updated(t){if(super.updated(t),t.has("value")){const a=t.get("value"),e=this.validateTags();e!==this.value?this.value=e:(this.dispatchEvent(new CustomEvent("change",{detail:{oldValue:a,newValue:this.value},bubbles:!0})),this.renderTags())}if(t.has("allowedTags")||t.has("disallowedTags")){const a=t.get("allowedTags")||t.get("disallowedTags"),e=this.allowedTags||this.disallowedTags,s=this.validateTags();if(s!==this.value)this.value=s;else{const s=t.has("allowedTags")?"allowedtagschange":"disallowedtagschange";this.dispatchEvent(new CustomEvent(s,{detail:{oldValue:a,newValue:e},bubbles:!0})),this.renderTags()}}}handleInputChange=()=>{const t=this.shadowRoot.getElementById("tagsInput"),a=t.value.trim();a&&(this.addTag(a),t.value="")};handleInputInput=t=>{if(","===t.data||"insertFromPaste"===t.inputType){const t=this.shadowRoot.getElementById("tagsInput"),a=t.value.split(",").filter(t=>!!t.trim());a.length&&(a.forEach(t=>this.addTag(t.trim())),t.value="")}};async renderTags(){await this.updateComplete;const t=this.shadowRoot.getElementById("tags");t.innerHTML="",this.value&&this.value.split(",").forEach(a=>{const e=new Tag(a.trim(),this);t.appendChild(e)})}addTag(t){const a=new Set(this.value.split(",").filter(t=>!!t.trim()));a.add(t.trim()),this.value=[...a].filter(t=>!!t).join(","),this.dispatchEvent(new CustomEvent("addtag",{detail:{tag:t},bubbles:!0}))}removeTag(t){const a=new Set(this.value.split(",").filter(t=>!!t.trim()));a.delete(t),this.value=[...a].join(","),this.dispatchEvent(new CustomEvent("removetag",{detail:{tag:t},bubbles:!0}))}validateTags(){return this.value.split(",").map(t=>t.trim()).map(t=>{const a=new Set(this.allowedTags.split(",").filter(t=>!!t.trim()));if(a.size)return a.has(t)?t:"";const e=new Set(this.disallowedTags.split(",").filter(t=>!!t.trim()));return e.size&&e.has(t)?"":t}).filter(t=>!!t).join(",")}static styles=css`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
|
|
5
|
+
#tagsHolder {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
background-color: var(--input_bg);
|
|
11
|
+
color: var(--input_tc);
|
|
12
|
+
border: var(--input_border_width) solid var(--c_border);
|
|
13
|
+
padding: var(--spacer_q);
|
|
14
|
+
margin-bottom: var(--spacer);
|
|
15
|
+
border-radius: var(--radius);
|
|
16
|
+
outline: none;
|
|
17
|
+
transition: box-shadow var(--animation_ms);
|
|
18
|
+
cursor: default;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#tagsHolder:focus-within {
|
|
22
|
+
box-shadow: var(--focus_shadow);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#tags {
|
|
26
|
+
display: contents;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#tagsInput {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
min-width: 5rem;
|
|
32
|
+
width: auto;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
background-color: transparent;
|
|
35
|
+
color: inherit;
|
|
36
|
+
border: 0 solid transparent;
|
|
37
|
+
margin: var(--spacer_q);
|
|
38
|
+
padding: var(--spacer_q) 0;
|
|
39
|
+
border-radius: 0;
|
|
40
|
+
transition: none;
|
|
41
|
+
box-shadow: 0 0 0 transparent;
|
|
42
|
+
}
|
|
43
|
+
`;render(){return html`
|
|
44
|
+
<label for="tagsInput">
|
|
45
|
+
<slot></slot>
|
|
46
|
+
<div id="tagsHolder">
|
|
47
|
+
<span id="tags"></span>
|
|
48
|
+
<input
|
|
49
|
+
id="tagsInput"
|
|
50
|
+
@change=${this.handleInputChange}
|
|
51
|
+
@input=${this.handleInputInput}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</label>
|
|
55
|
+
`}}class Tag extends ShadowComponent{constructor(t,a){super(),this.tag=t,this.tagsComponent=a,this.innerHTML=t}handleClick=()=>{this.tagsComponent.removeTag(this.tag)};static styles=css`
|
|
56
|
+
:host {
|
|
57
|
+
display: inline-block;
|
|
58
|
+
width: min-content;
|
|
59
|
+
margin: var(--spacer_q);
|
|
60
|
+
padding: var(--spacer_q) var(--spacer_h);
|
|
61
|
+
border: 1px solid var(--c_border);
|
|
62
|
+
border-radius: var(--radius);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host(:hover) {
|
|
67
|
+
text-decoration: line-through;
|
|
68
|
+
}
|
|
69
|
+
`;render(){return html`<span @click=${this.handleClick}><slot></slot></span>`}}customElements.define("k-tags",Tags),customElements.define("k-tag",Tag);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ShadowComponent from"./ShadowComponent.js";import{html,css}from"../lit-all.min.js";import"./Icon.js";export default class ThemeSwitcher extends ShadowComponent{static properties={currentTheme:{type:String,reflect:!0,attribute:"current-theme"}};constructor(){super(),this.currentTheme=ThemeSwitcher.getCurrentTheme()}handleClick=()=>{const e=ThemeSwitcher.getCurrentTheme();"auto"===e&&ThemeSwitcher.setTheme("light"),"light"===e&&ThemeSwitcher.setTheme("dark"),"dark"===e&&ThemeSwitcher.setTheme("auto")};handleStorageChange=()=>{this.currentTheme=ThemeSwitcher.getCurrentTheme()};connectedCallback(){super.connectedCallback(),window.addEventListener("storage",this.handleStorageChange)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("storage",this.handleStorageChange)}static styles=css`
|
|
2
|
+
:host {
|
|
3
|
+
--padding: var(--spacer);
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
button {
|
|
7
|
+
padding: var(--padding);
|
|
8
|
+
}
|
|
9
|
+
`;render(){const e="auto"===this.currentTheme?"mode-auto":"light"===this.currentTheme?"mode-light":"mode-dark";return html`
|
|
10
|
+
<button
|
|
11
|
+
class="no-btn"
|
|
12
|
+
@click=${this.handleClick}
|
|
13
|
+
>
|
|
14
|
+
<k-icon name=${e}></k-icon>
|
|
15
|
+
</button>
|
|
16
|
+
`}static styles=css`
|
|
17
|
+
:host {
|
|
18
|
+
--padding: var(--spacer, 1rem);
|
|
19
|
+
}
|
|
20
|
+
button.no-btn {
|
|
21
|
+
padding: var(--padding);
|
|
22
|
+
}
|
|
23
|
+
`;static setTheme(e){localStorage.setItem("theme",e),document.documentElement.setAttribute("theme",e),window.dispatchEvent(new StorageEvent("storage",{key:"theme",newValue:e}))}static getCurrentTheme(){let e=document.documentElement.getAttribute("theme");return e||(e=localStorage.getItem("theme")),e||"auto"}}const colorSchemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),colorSchemeChangeHandler=e=>document.documentElement.setAttribute("auto-theme",e.matches?"dark":"light");colorSchemeQuery.addEventListener("change",colorSchemeChangeHandler),colorSchemeChangeHandler(colorSchemeQuery),ThemeSwitcher.setTheme(ThemeSwitcher.getCurrentTheme()),customElements.define("k-theme-switcher",ThemeSwitcher);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{html}from"../lit-all.min.js";import ShadowComponent from"./ShadowComponent.js";import formatTimestamp from"../utils/formatTimestamp.js";export default class Timestamp extends ShadowComponent{static properties={timestamp:{type:Number,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp=0,this.format="",this.locale=""}render(){const t=this.timestamp?formatTimestamp(this.timestamp,this.format,this.locale||navigator.language):"";return html`<span>${t}</span>`}}window.customElements.define("k-timestamp",Timestamp);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function debounce(e,t=300){let u;return(...o)=>{clearTimeout(u),u=setTimeout(()=>{e.apply(this,o)},t)}}export default debounce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default(e={})=>{let t,n,o;const{element:s,callback:a=()=>{},startCallback:r=()=>{},moveCallback:c=()=>{},endCallback:u=()=>{},preventScroll:v=!1}=e,d=s=>{v&&s.preventDefault(),clearTimeout(o);const r=s.pageX||s.touches[0].pageX,u=s.pageY||s.touches[0].pageY,d={x:r-t,y:u-n,...e};a(d),c(d)},i=s=>{clearTimeout(o);const r=s.pageX||s.changedTouches&&s.changedTouches[0].pageX||0,c=s.pageY||s.changedTouches&&s.changedTouches[0].pageY||0,v={x:r-t,y:c-n,...e};a(v),u(v),m()},p=s=>{if(s.button&&0!==s.button)return;clearTimeout(o),t=s.pageX||s.touches[0].pageX,n=s.pageY||s.touches[0].pageY;const a={x:0,y:0,...e};r(a),window.addEventListener("mousemove",d,{passive:!v}),window.addEventListener("mouseup",i,{passive:!v}),window.addEventListener("touchmove",d,{passive:!v}),window.addEventListener("touchend",i,{passive:!v})},m=()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",i),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",i)};return s.addEventListener("mousedown",p,{passive:!v}),s.addEventListener("touchstart",p,{passive:!v}),()=>{s.removeEventListener("mousedown",p),s.removeEventListener("touchstart",p),m()}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default(e,i,t)=>{const s=new Date(parseInt(e));if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:s.getFullYear(),YY:String(s.getFullYear()).slice(-2),MM:e(s.getMonth()+1,2),M:s.getMonth()+1,DD:e(s.getDate(),2),D:s.getDate(),hh:e(s.getHours(),2),h:s.getHours(),mm:e(s.getMinutes(),2),m:s.getMinutes(),ss:e(s.getSeconds(),2),s:s.getSeconds(),iiii:e(s.getMilliseconds(),3),iii:e(s.getMilliseconds(),3),ii:e(s.getMilliseconds(),2),i:s.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return s.toLocaleString(t||navigator.language)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const boolTrueFalse={fromAttribute:t=>null===t?void 0:"true"===t.toLowerCase(),toAttribute:t=>t?"true":"false"};export const boolExists={fromAttribute:t=>null!==t,toAttribute:t=>t?"":null};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import debounce from"./debounce.js";const handlers=new Set;window.addEventListener("resize",debounce(()=>{const e=window.innerWidth;handlers.forEach(n=>n(e))}));export const watchWindowSize=e=>(handlers.add(e),window.innerWidth);export const unwatchWindowSize=e=>{handlers.delete(e)};
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
8
|
<link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
9
|
<script type="module">
|
|
10
|
+
import ShadowComponent from '../src/components/ShadowComponent.js';
|
|
10
11
|
import Import from '../src/components/Import.js';
|
|
11
12
|
import Icon from '../src/components/Icon.js';
|
|
13
|
+
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
12
14
|
Import.replacements.root = '../';
|
|
13
15
|
Icon.pathToIcons = ['../icons'];
|
|
14
16
|
</script>
|
|
@@ -28,9 +30,9 @@
|
|
|
28
30
|
<h6 class="mt">JavaScript Reference</h6>
|
|
29
31
|
<a href="#constructor">Constructor</a><br />
|
|
30
32
|
<a href="#requirements">Requirements</a><br />
|
|
31
|
-
<a href="#attributes">Attributes</a><br />
|
|
32
33
|
<a href="#properties">Properties</a><br />
|
|
33
34
|
<a href="#methods">Methods</a><br />
|
|
35
|
+
<a href="#events">Events</a><br />
|
|
34
36
|
</div>
|
|
35
37
|
</details>
|
|
36
38
|
|
|
@@ -79,43 +81,85 @@
|
|
|
79
81
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
80
82
|
|
|
81
83
|
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
82
|
-
<h6>Extends <a href="./component.html">
|
|
84
|
+
<h6>Extends <a href="./component.html">ShadowComponent</a></h6>
|
|
83
85
|
<h5>
|
|
84
86
|
<code>new Accordion()</code><br />
|
|
85
87
|
</h5>
|
|
86
88
|
|
|
87
89
|
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
88
90
|
<ul>
|
|
89
|
-
<li><a href="
|
|
91
|
+
<li><a href="./component.html">ShadowComponent</a></li>
|
|
90
92
|
</ul>
|
|
91
93
|
|
|
92
|
-
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
93
|
-
<h5><code>forPanel: string</code></h5>
|
|
94
|
-
<p>Specifies the panel associated with the header.</p>
|
|
95
|
-
<h5><code>active: boolean</code></h5>
|
|
96
|
-
<p>Indicates whether the panel or header is active.</p>
|
|
97
|
-
<h5><code>transitioning: boolean</code></h5>
|
|
98
|
-
<p>Indicates whether the panel is in the process of transitioning.</p>
|
|
99
|
-
|
|
100
94
|
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
<h5><code>
|
|
104
|
-
<p>Returns the currently active panel
|
|
95
|
+
|
|
96
|
+
<h4>Accordion (Main Component)</h4>
|
|
97
|
+
<h5><code>activeHeader<i>: HTMLElement | null</i></code></h5>
|
|
98
|
+
<p>Returns the currently active header element, or <code>null</code> if no panel is open.</p>
|
|
99
|
+
<h5><code>activePanel<i>: HTMLElement | null</i></code></h5>
|
|
100
|
+
<p>Returns the currently active panel element, or <code>null</code> if no panel is open.</p>
|
|
101
|
+
|
|
102
|
+
<h4>AccordionHeader</h4>
|
|
103
|
+
<h5><code>forPanel<i>: string</i></code></h5>
|
|
104
|
+
<p>The panel name that this header controls. Syncs with the <code>for-panel</code> attribute.</p>
|
|
105
|
+
<h5><code>active<i>: boolean</i></code></h5>
|
|
106
|
+
<p>Whether this header is currently active (its associated panel is open). Syncs with the <code>active</code> attribute.</p>
|
|
107
|
+
<h5><code>accordion<i>: Accordion | null</i></code></h5>
|
|
108
|
+
<p>Returns the parent accordion component, or <code>null</code> if not inside an accordion.</p>
|
|
109
|
+
|
|
110
|
+
<h4>AccordionPanel</h4>
|
|
111
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
112
|
+
<p>Unique identifier for this panel. Must match the <code>for-panel</code> attribute of its associated header. Syncs with the <code>name</code> attribute.</p>
|
|
113
|
+
<h5><code>active<i>: boolean</i></code></h5>
|
|
114
|
+
<p>Whether this panel is currently open. Syncs with the <code>active</code> attribute.</p>
|
|
115
|
+
<h5><code>transitioning<i>: boolean</i></code></h5>
|
|
116
|
+
<p>Whether this panel is currently animating (opening or closing). Syncs with the <code>transitioning</code> attribute.</p>
|
|
117
|
+
<h5><code>accordion<i>: Accordion | null</i></code></h5>
|
|
118
|
+
<p>Returns the parent accordion component, or <code>null</code> if not inside an accordion.</p>
|
|
105
119
|
|
|
106
120
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
<h5><code>
|
|
110
|
-
<p>Returns the
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<h5><code>
|
|
116
|
-
<p>
|
|
121
|
+
|
|
122
|
+
<h4>Accordion (Main Component)</h4>
|
|
123
|
+
<h5><code>getHeader(panelName)<i>: HTMLElement | null</i></code></h5>
|
|
124
|
+
<p>Returns the header element associated with the specified panel name, or <code>null</code> if not found.</p>
|
|
125
|
+
<ul>
|
|
126
|
+
<li><strong>panelName</strong> <code>string</code> - The name of the panel whose header to retrieve</li>
|
|
127
|
+
</ul>
|
|
128
|
+
|
|
129
|
+
<h5><code>getPanel(panelName)<i>: HTMLElement | null</i></code></h5>
|
|
130
|
+
<p>Returns the panel element with the specified name, or <code>null</code> if not found.</p>
|
|
131
|
+
<ul>
|
|
132
|
+
<li><strong>panelName</strong> <code>string</code> - The name of the panel to retrieve</li>
|
|
133
|
+
</ul>
|
|
134
|
+
|
|
135
|
+
<h5><code>openPanel(panelName)<i>: void</i></code></h5>
|
|
136
|
+
<p>Opens the panel with the specified name. Closes any currently open panel first. Dispatches an <code>openpanel</code> event.</p>
|
|
137
|
+
<ul>
|
|
138
|
+
<li><strong>panelName</strong> <code>string</code> - The name of the panel to open</li>
|
|
139
|
+
</ul>
|
|
140
|
+
|
|
141
|
+
<h5><code>closePanel(panelName)<i>: void</i></code></h5>
|
|
142
|
+
<p>Closes the panel with the specified name. Dispatches a <code>closepanel</code> event.</p>
|
|
143
|
+
<ul>
|
|
144
|
+
<li><strong>panelName</strong> <code>string</code> - The name of the panel to close</li>
|
|
145
|
+
</ul>
|
|
146
|
+
|
|
147
|
+
<h5><code>togglePanel(panelName)<i>: void</i></code></h5>
|
|
148
|
+
<p>Toggles the panel with the specified name (opens if closed, closes if open). Dispatches a <code>togglepanel</code> event.</p>
|
|
149
|
+
<ul>
|
|
150
|
+
<li><strong>panelName</strong> <code>string</code> - The name of the panel to toggle</li>
|
|
151
|
+
</ul>
|
|
152
|
+
|
|
153
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
154
|
+
<h5><code>openpanel</code></h5>
|
|
155
|
+
<p>Fired when a panel is opened. The event detail contains <code>{ panelName }</code>.</p>
|
|
156
|
+
<h5><code>closepanel</code></h5>
|
|
157
|
+
<p>Fired when a panel is closed. The event detail contains <code>{ panelName }</code>.</p>
|
|
158
|
+
<h5><code>togglepanel</code></h5>
|
|
159
|
+
<p>Fired when a panel is toggled. The event detail contains <code>{ panelName }</code>.</p>
|
|
117
160
|
|
|
118
161
|
</main>
|
|
162
|
+
<div style="height:33vh"></div>
|
|
119
163
|
<script type="module" src="../src/components/Import.js"></script>
|
|
120
164
|
<script type="module" src="../src/components/Accordion.js"></script>
|
|
121
165
|
</body>
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
8
|
<link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
9
|
<script type="module">
|
|
10
|
+
import ShadowComponent from '../src/components/ShadowComponent.js';
|
|
10
11
|
import Import from '../src/components/Import.js';
|
|
11
12
|
import Icon from '../src/components/Icon.js';
|
|
13
|
+
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
12
14
|
Import.replacements.root = '../';
|
|
13
15
|
Icon.pathToIcons = ['../icons'];
|
|
14
16
|
</script>
|
|
@@ -26,7 +28,6 @@
|
|
|
26
28
|
<h6 class="mt">JavaScript Reference</h6>
|
|
27
29
|
<a href="#constructor">Constructor</a><br />
|
|
28
30
|
<a href="#requirements">Requirements</a><br />
|
|
29
|
-
<a href="#attributes">Attributes</a><br />
|
|
30
31
|
<a href="#properties">Properties</a><br />
|
|
31
32
|
<a href="#methods">Methods</a><br />
|
|
32
33
|
</div>
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
61
62
|
|
|
62
63
|
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
63
|
-
<h6>Extends <a href="./component.html">
|
|
64
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
64
65
|
<h5>
|
|
65
66
|
<code>new Card()</code><br />
|
|
66
67
|
<code>new Card(<i>string</i> label)</code>
|
|
@@ -72,12 +73,12 @@
|
|
|
72
73
|
|
|
73
74
|
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
74
75
|
<ul>
|
|
75
|
-
<li><a href="./component.html">
|
|
76
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
76
77
|
</ul>
|
|
77
78
|
|
|
78
|
-
<h3 id="
|
|
79
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
79
80
|
<h5><code>label<i>: string</i></code></h5>
|
|
80
|
-
<p>The label for the card.</p>
|
|
81
|
+
<p>The label for the card. Syncs with the <code>label</code> attribute.</p>
|
|
81
82
|
|
|
82
83
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
83
84
|
<h5><code>setLabel(<i>string</i> label)<i>: void</i></code></h5>
|