@lazhus/kg-ui 0.5.2 → 0.5.3
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/custom-elements.json
CHANGED
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
"text": "object"
|
|
415
415
|
},
|
|
416
416
|
"static": true,
|
|
417
|
-
"default": "{ color: { type: String }, // primary, secondary, tertiary, red, green, etc. size: { type: String }, // mini, tiny, small, medium, large, big, huge, massive fullwidth: { type: Boolean }, circular: { type: Boolean }, square: { type: Boolean }, loading: { type: Boolean }, disabled: { type: Boolean }, basic: { type: Boolean }, inverted: { type: Boolean }, active: { type: Boolean }, text: { type: Boolean }, hasText: { type: Boolean, state: true }, hasLeft: { type: Boolean, state: true }, hasRight: { type: Boolean, state: true } }"
|
|
417
|
+
"default": "{ color: { type: String }, // primary, secondary, tertiary, red, green, etc. size: { type: String }, // mini, tiny, small, medium, large, big, huge, massive fullwidth: { type: Boolean }, circular: { type: Boolean }, square: { type: Boolean }, loading: { type: Boolean }, disabled: { type: Boolean }, basic: { type: Boolean }, inverted: { type: Boolean }, active: { type: Boolean }, text: { type: Boolean }, hasText: { type: Boolean, state: true }, hasLeft: { type: Boolean, state: true }, hasRight: { type: Boolean, state: true }, type: { type: String } }"
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
"kind": "field",
|
|
@@ -483,6 +483,14 @@
|
|
|
483
483
|
"text": "boolean"
|
|
484
484
|
},
|
|
485
485
|
"default": "false"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"kind": "field",
|
|
489
|
+
"name": "type",
|
|
490
|
+
"type": {
|
|
491
|
+
"text": "string"
|
|
492
|
+
},
|
|
493
|
+
"default": "'button'"
|
|
486
494
|
}
|
|
487
495
|
],
|
|
488
496
|
"superclass": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var t=Object.defineProperty,o=(o,r,e)=>((o,r,e)=>r in o?t(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e)(o,"symbol"!=typeof r?r+"":r,e);import{LitElement as r,css as e,html as a}from"lit";import{classMap as i}from"lit/directives/class-map.js";class n extends r{constructor(){super(),this.color="",this.size="medium",this.hasText=!1,this.hasLeft=!1,this.hasRight=!1}_handleSlotChange(t){const o=t.target,r=o.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent.trim().length>0).length>0;o.name?"left"===o.name?this.hasLeft=r:"right"===o.name&&(this.hasRight=r):this.hasText=r}render(){const t=["primary","secondary","tertiary","error"].includes(this.color),o=this.color&&!t,r=!this.hasText&&(this.hasLeft||this.hasRight),e={[this.color]:t,"custom-color":o,[this.size]:!!this.size,fullwidth:this.fullwidth,circular:this.circular,square:this.square,loading:this.loading,basic:this.basic,text:this.text,inverted:this.inverted,disabled:this.disabled,"icon-only":r},n=o?`border: none; --kg-custom-color: ${this.color};`:"";return a`
|
|
1
|
+
var t=Object.defineProperty,o=(o,r,e)=>((o,r,e)=>r in o?t(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e)(o,"symbol"!=typeof r?r+"":r,e);import{LitElement as r,css as e,html as a}from"lit";import{classMap as i}from"lit/directives/class-map.js";class n extends r{constructor(){super(),this.color="",this.size="medium",this.hasText=!1,this.hasLeft=!1,this.hasRight=!1,this.type="button"}_handleSlotChange(t){const o=t.target,r=o.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent.trim().length>0).length>0;o.name?"left"===o.name?this.hasLeft=r:"right"===o.name&&(this.hasRight=r):this.hasText=r}render(){const t=["primary","secondary","tertiary","error"].includes(this.color),o=this.color&&!t,r=!this.hasText&&(this.hasLeft||this.hasRight),e={[this.color]:t,"custom-color":o,[this.size]:!!this.size,fullwidth:this.fullwidth,circular:this.circular,square:this.square,loading:this.loading,basic:this.basic,text:this.text,inverted:this.inverted,disabled:this.disabled,"icon-only":r},n=o?`border: none; --kg-custom-color: ${this.color};`:"";return a`
|
|
2
2
|
<button
|
|
3
3
|
class="${i(e)}"
|
|
4
4
|
style="${n}"
|
|
@@ -13,7 +13,7 @@ var t=Object.defineProperty,o=(o,r,e)=>((o,r,e)=>r in o?t(o,r,{enumerable:!0,con
|
|
|
13
13
|
|
|
14
14
|
<slot name="right" @slotchange=${this._handleSlotChange}></slot>
|
|
15
15
|
</button>
|
|
16
|
-
`}_handleClick(t){(this.loading||this.disabled)
|
|
16
|
+
`}_handleClick(t){if(this.loading||this.disabled)return t.preventDefault(),void t.stopPropagation();if("submit"===this.type){const t=this.closest("form");t&&(t.requestSubmit?t.requestSubmit():t.submit())}if("reset"===this.type){const t=this.closest("form");t&&t.reset()}}}o(n,"properties",{color:{type:String},size:{type:String},fullwidth:{type:Boolean},circular:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},basic:{type:Boolean},inverted:{type:Boolean},active:{type:Boolean},text:{type:Boolean},hasText:{type:Boolean,state:!0},hasLeft:{type:Boolean,state:!0},hasRight:{type:Boolean,state:!0},type:{type:String}}),o(n,"styles",e`
|
|
17
17
|
:host {
|
|
18
18
|
display: inline-block;
|
|
19
19
|
vertical-align: middle;
|
package/package.json
CHANGED
|
@@ -12,6 +12,8 @@ export class kgbutton extends LitElement {
|
|
|
12
12
|
hasLeft: boolean;
|
|
13
13
|
/** */
|
|
14
14
|
hasRight: boolean;
|
|
15
|
+
/** */
|
|
16
|
+
type: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
declare global {
|
|
@@ -27,6 +29,7 @@ declare global {
|
|
|
27
29
|
hasText?: boolean;
|
|
28
30
|
hasLeft?: boolean;
|
|
29
31
|
hasRight?: boolean;
|
|
32
|
+
type?: string;
|
|
30
33
|
[key: string]: any;
|
|
31
34
|
};
|
|
32
35
|
}
|