@kubex/zinc 1.1.177 → 1.1.178
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/dist/custom-elements.json +4 -4
- package/dist/vscode.html-custom-data.json +1 -1
- package/dist/web-types.json +2 -2
- package/dist/zn.d.ts +1 -1
- package/dist/zn.min.js +2 -2
- package/package.json +1 -1
- package/src/components/chip/chip.component.ts +2 -2
- package/src/components/chip/chip.scss +1 -1
- package/src/components/chip/chip.test.ts +17 -0
|
@@ -5887,8 +5887,8 @@
|
|
|
5887
5887
|
"name": "ZnChip",
|
|
5888
5888
|
"cssProperties": [
|
|
5889
5889
|
{
|
|
5890
|
-
"description": "
|
|
5891
|
-
"name": "--
|
|
5890
|
+
"description": "The text, icon and tinted background colour of a `custom` chip.",
|
|
5891
|
+
"name": "--chip-color-override"
|
|
5892
5892
|
}
|
|
5893
5893
|
],
|
|
5894
5894
|
"cssParts": [
|
|
@@ -6054,7 +6054,7 @@
|
|
|
6054
6054
|
"tagNameWithoutPrefix": "chip",
|
|
6055
6055
|
"tagName": "zn-chip",
|
|
6056
6056
|
"customElement": true,
|
|
6057
|
-
"jsDoc": "/**\n * @summary Short summary of the component's intended use.\n * @documentation https://zinc.style/components/chip\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-example\n *\n * @event zn-event-name - Emitted as an example.\n *\n * @slot - The default slot.\n * @slot example - An example slot.\n *\n * @csspart base - The component's base wrapper.\n *\n * @cssproperty --
|
|
6057
|
+
"jsDoc": "/**\n * @summary Short summary of the component's intended use.\n * @documentation https://zinc.style/components/chip\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-example\n *\n * @event zn-event-name - Emitted as an example.\n *\n * @slot - The default slot.\n * @slot example - An example slot.\n *\n * @csspart base - The component's base wrapper.\n *\n * @cssproperty --chip-color-override - The text, icon and tinted background colour of a `custom` chip.\n */",
|
|
6058
6058
|
"documentation": "https://zinc.style/components/chip",
|
|
6059
6059
|
"status": "experimental",
|
|
6060
6060
|
"since": "1.0",
|
|
@@ -53936,7 +53936,7 @@
|
|
|
53936
53936
|
"package": {
|
|
53937
53937
|
"name": "@kubex/zinc",
|
|
53938
53938
|
"description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
|
|
53939
|
-
"version": "1.1.
|
|
53939
|
+
"version": "1.1.178",
|
|
53940
53940
|
"author": "",
|
|
53941
53941
|
"license": "MIT"
|
|
53942
53942
|
}
|
|
@@ -857,7 +857,7 @@
|
|
|
857
857
|
},
|
|
858
858
|
{
|
|
859
859
|
"name": "zn-chip",
|
|
860
|
-
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--
|
|
860
|
+
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--chip-color-override** - The text, icon and tinted background colour of a `custom` chip. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
861
861
|
"attributes": [
|
|
862
862
|
{ "name": "icon", "values": [] },
|
|
863
863
|
{ "name": "caption", "values": [] },
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@kubex/zinc",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.178",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -1862,7 +1862,7 @@
|
|
|
1862
1862
|
},
|
|
1863
1863
|
{
|
|
1864
1864
|
"name": "zn-chip",
|
|
1865
|
-
"description": "Short summary of the component's intended use.\n\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--
|
|
1865
|
+
"description": "Short summary of the component's intended use.\n\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--chip-color-override** - The text, icon and tinted background colour of a `custom` chip. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
1866
1866
|
"doc-url": "",
|
|
1867
1867
|
"attributes": [
|
|
1868
1868
|
{ "name": "icon", "value": { "type": "string", "default": "''" } },
|
package/dist/zn.d.ts
CHANGED
|
@@ -1743,7 +1743,7 @@ declare module "components/chip/chip.component" {
|
|
|
1743
1743
|
*
|
|
1744
1744
|
* @csspart base - The component's base wrapper.
|
|
1745
1745
|
*
|
|
1746
|
-
* @cssproperty --
|
|
1746
|
+
* @cssproperty --chip-color-override - The text, icon and tinted background colour of a `custom` chip.
|
|
1747
1747
|
*/
|
|
1748
1748
|
export default class ZnChip extends ZincElement {
|
|
1749
1749
|
static styles: CSSResultGroup;
|
package/dist/zn.min.js
CHANGED
|
@@ -258,8 +258,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
258
258
|
<zn-icon part="icon" class="paperclip@lu" src=${this.icon} size="20"></zn-icon>`:V}
|
|
259
259
|
<span part="label" class="attachment__label"><slot>${this.name}</slot></span>
|
|
260
260
|
</a>
|
|
261
|
-
`}};Ui.styles=k(ky),Ui.dependencies={"zn-icon":he},c([p()],Ui.prototype,"href",2),c([p()],Ui.prototype,"name",2),c([p()],Ui.prototype,"icon",2),c([p({reflect:!0})],Ui.prototype,"target",2),c([p({type:Boolean})],Ui.prototype,"download",2);var Y9=Ui;Ui.define("zn-chat-message-attachment");var Sy=S`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}*,*::before,*::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host{display:inline-flex;vertical-align:middle}.chip{display:inline-flex;font-size:var(--zn-text-chip-font-size);font-family:var(--zn-font-family-sans);font-weight:var(--zn-text-chip-font-weight);border-radius:var(--zn-border-radius-x-large);padding-inline:var(--zn-spacing-x-small);padding-block:0;height:var(--zn-spacing-medium);text-align:center;gap:var(--zn-spacing-x-small);width:-moz-fit-content;width:fit-content;justify-content:center;align-items:center;line-height:var(--zn-text-chip-line-height);letter-spacing:var(--zn-letter-spacing-loose);white-space:nowrap}.chip--flush{padding:0;height:auto}.chip--flush-x{padding-inline:0}.chip--flush-y{padding-block:0;height:auto}.chip--primary{color:rgba(var(--zn-primary),0.9);background:rgba(var(--zn-primary),0.1)}.chip--error{color:rgb(var(--zn-color-error));background:rgba(var(--zn-color-error),0.1)}.chip--info{color:rgb(var(--zn-color-info));background:rgba(var(--zn-color-info),0.1)}.chip--warning{color:rgb(var(--zn-color-warning));background:rgba(var(--zn-color-warning),0.1)}.chip--success{color:rgb(var(--zn-color-success));background:rgba(var(--zn-color-success),0.1)}.chip--neutral{color:rgb(var(--zn-text));background:rgba(var(--zn-border-color),0.1)}.chip--transparent{color:rgb(var(--zn-text));background:transparent}.chip--custom{color:rgb(var(--zn-text));background-color:hsl(from var(--chip-color-override,inherit) h s l/0.1)}.chip__value{overflow:hidden;text-overflow:ellipsis;text-transform:var(--zn-text-chip-transform)}.chip__caption{opacity:0.7;font-weight:var(--zn-text-chip-font-weight);text-transform:var(--zn-text-chip-transform)}.chip__caption::after{content:":"}.chip--no-content{padding:var(--zn-spacing-3x-small) var(--zn-spacing-2x-small)}.chip--with-icon{padding-left:var(--zn-spacing-2x-small)}`;var yi=class extends T{constructor(){super(...arguments);this.icon="";this.caption="";this.iconSize=18;this.type="neutral";this.flush=!1;this.flushX=!1;this.flushY=!1;this.hasSlotController=new te(this,"[default]","action")}render(){let t=this.hasSlotController.test("[default]");return u`
|
|
262
|
-
<div class="${q({chip:!0,"chip--with-content":t,"chip--no-content":!t,"chip--with-icon":this.icon,"chip--flush":this.flush,"chip--flush-x":this.flushX,"chip--flush-y":this.flushY,"chip--info":this.type==="info","chip--success":this.type==="success","chip--warning":this.type==="warning","chip--error":this.type==="error","chip--primary":this.type==="primary","chip--transparent":this.type==="transparent","chip--custom":this.type==="custom","chip--neutral":this.type==="neutral"})}">
|
|
261
|
+
`}};Ui.styles=k(ky),Ui.dependencies={"zn-icon":he},c([p()],Ui.prototype,"href",2),c([p()],Ui.prototype,"name",2),c([p()],Ui.prototype,"icon",2),c([p({reflect:!0})],Ui.prototype,"target",2),c([p({type:Boolean})],Ui.prototype,"download",2);var Y9=Ui;Ui.define("zn-chat-message-attachment");var Sy=S`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}*,*::before,*::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host{display:inline-flex;vertical-align:middle}.chip{display:inline-flex;font-size:var(--zn-text-chip-font-size);font-family:var(--zn-font-family-sans);font-weight:var(--zn-text-chip-font-weight);border-radius:var(--zn-border-radius-x-large);padding-inline:var(--zn-spacing-x-small);padding-block:0;height:var(--zn-spacing-medium);text-align:center;gap:var(--zn-spacing-x-small);width:-moz-fit-content;width:fit-content;justify-content:center;align-items:center;line-height:var(--zn-text-chip-line-height);letter-spacing:var(--zn-letter-spacing-loose);white-space:nowrap}.chip--flush{padding:0;height:auto}.chip--flush-x{padding-inline:0}.chip--flush-y{padding-block:0;height:auto}.chip--primary{color:rgba(var(--zn-primary),0.9);background:rgba(var(--zn-primary),0.1)}.chip--error{color:rgb(var(--zn-color-error));background:rgba(var(--zn-color-error),0.1)}.chip--info{color:rgb(var(--zn-color-info));background:rgba(var(--zn-color-info),0.1)}.chip--warning{color:rgb(var(--zn-color-warning));background:rgba(var(--zn-color-warning),0.1)}.chip--success{color:rgb(var(--zn-color-success));background:rgba(var(--zn-color-success),0.1)}.chip--neutral{color:rgb(var(--zn-text));background:rgba(var(--zn-border-color),0.1)}.chip--transparent{color:rgb(var(--zn-text));background:transparent}.chip--custom{color:var(--chip-color-override,rgb(var(--zn-text)));background-color:hsl(from var(--chip-color-override,inherit) h s l/0.1)}.chip__value{overflow:hidden;text-overflow:ellipsis;text-transform:var(--zn-text-chip-transform)}.chip__caption{opacity:0.7;font-weight:var(--zn-text-chip-font-weight);text-transform:var(--zn-text-chip-transform)}.chip__caption::after{content:":"}.chip--no-content{padding:var(--zn-spacing-3x-small) var(--zn-spacing-2x-small)}.chip--with-icon{padding-left:var(--zn-spacing-2x-small)}`;var yi=class extends T{constructor(){super(...arguments);this.icon="";this.caption="";this.iconSize=18;this.type="neutral";this.flush=!1;this.flushX=!1;this.flushY=!1;this.hasSlotController=new te(this,"[default]","action")}render(){let t=this.hasSlotController.test("[default]");return u`
|
|
262
|
+
<div part="base" class="${q({chip:!0,"chip--with-content":t,"chip--no-content":!t,"chip--with-icon":this.icon,"chip--flush":this.flush,"chip--flush-x":this.flushX,"chip--flush-y":this.flushY,"chip--info":this.type==="info","chip--success":this.type==="success","chip--warning":this.type==="warning","chip--error":this.type==="error","chip--primary":this.type==="primary","chip--transparent":this.type==="transparent","chip--custom":this.type==="custom","chip--neutral":this.type==="neutral"})}">
|
|
263
263
|
${this.icon?u`
|
|
264
264
|
<zn-icon src="${this.icon}" size="${this.iconSize}"></zn-icon>`:""}
|
|
265
265
|
${this.caption?u`
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ import styles from './chip.scss';
|
|
|
21
21
|
*
|
|
22
22
|
* @csspart base - The component's base wrapper.
|
|
23
23
|
*
|
|
24
|
-
* @cssproperty --
|
|
24
|
+
* @cssproperty --chip-color-override - The text, icon and tinted background colour of a `custom` chip.
|
|
25
25
|
*/
|
|
26
26
|
export default class ZnChip extends ZincElement {
|
|
27
27
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
@@ -43,7 +43,7 @@ export default class ZnChip extends ZincElement {
|
|
|
43
43
|
render() {
|
|
44
44
|
const hasContent = this.hasSlotController.test('[default]')
|
|
45
45
|
return html`
|
|
46
|
-
<div class="${classMap({
|
|
46
|
+
<div part="base" class="${classMap({
|
|
47
47
|
'chip': true,
|
|
48
48
|
'chip--with-content': hasContent,
|
|
49
49
|
'chip--no-content': !hasContent,
|
|
@@ -7,4 +7,21 @@ describe('<zn-chip>', () => {
|
|
|
7
7
|
|
|
8
8
|
expect(el).to.exist;
|
|
9
9
|
});
|
|
10
|
+
|
|
11
|
+
it('should colour a custom chip from its override', async () => {
|
|
12
|
+
const el = await fixture<HTMLElement>(html`
|
|
13
|
+
<zn-chip type="custom" style="--chip-color-override: rgb(15, 118, 110)">Ticket</zn-chip>`);
|
|
14
|
+
const base = el.shadowRoot!.querySelector<HTMLElement>('[part="base"]')!;
|
|
15
|
+
|
|
16
|
+
expect(getComputedStyle(base).color).to.equal('rgb(15, 118, 110)');
|
|
17
|
+
expect(getComputedStyle(base).backgroundColor).to.match(/0\.1\)$/);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should use the text colour for a custom chip without an override', async () => {
|
|
21
|
+
const el = await fixture<HTMLElement>(html`<zn-chip type="custom">Ticket</zn-chip>`);
|
|
22
|
+
const neutral = await fixture<HTMLElement>(html`<zn-chip>Ticket</zn-chip>`);
|
|
23
|
+
const colour = (chip: HTMLElement) => getComputedStyle(chip.shadowRoot!.querySelector('[part="base"]')!).color;
|
|
24
|
+
|
|
25
|
+
expect(colour(el)).to.equal(colour(neutral));
|
|
26
|
+
});
|
|
10
27
|
});
|