@kubex/zinc 1.0.6 → 1.0.8

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 (40) hide show
  1. package/dist/custom-elements.json +464 -34
  2. package/dist/vscode.html-custom-data.json +38 -6
  3. package/dist/web-types.json +97 -10
  4. package/dist/zn.d.ts +73 -8
  5. package/dist/zn.min.js +393 -349
  6. package/docs/data/products-table.json +203 -0
  7. package/docs/pages/components/button.md +25 -0
  8. package/docs/pages/components/data-table.md +21 -0
  9. package/docs/pages/components/header.md +7 -0
  10. package/docs/pages/components/order-table.md +82 -5
  11. package/package.json +1 -1
  12. package/src/components/button/button.component.ts +168 -10
  13. package/src/components/button/button.scss +115 -0
  14. package/src/components/content-block/content-block.component.ts +186 -107
  15. package/src/components/content-block/content-block.scss +4 -2
  16. package/src/components/data-select/data-select.component.ts +50 -10
  17. package/src/components/data-table/data-table.component.ts +130 -43
  18. package/src/components/data-table/data-table.scss +85 -7
  19. package/src/components/data-table-filter/data-table-filter.component.ts +1 -1
  20. package/src/components/editor/editor.scss +1 -0
  21. package/src/components/editor/modules/attachment/attachment.ts +53 -41
  22. package/src/components/editor/modules/toolbar/toolbar.ts +42 -0
  23. package/src/components/empty-state/empty-state.component.ts +16 -8
  24. package/src/components/expanding-action/expanding-action.component.ts +1 -1
  25. package/src/components/header/header.component.ts +8 -2
  26. package/src/components/header/header.scss +5 -1
  27. package/src/components/icon/icon.component.ts +2 -0
  28. package/src/components/icon/icon.scss +13 -0
  29. package/src/components/item/item.component.ts +11 -3
  30. package/src/components/item/item.scss +7 -4
  31. package/src/components/linked-select/linked-select.component.ts +1 -0
  32. package/src/components/menu/menu.component.ts +0 -1
  33. package/src/components/navbar/navbar.component.ts +1 -1
  34. package/src/components/note/note.component.ts +70 -2
  35. package/src/components/note/note.scss +26 -4
  36. package/src/components/order-table/order-table.component.ts +49 -28
  37. package/src/components/panel/panel.component.ts +5 -1
  38. package/src/components/panel/panel.scss +6 -0
  39. package/src/components/rating/rating.component.ts +10 -9
  40. package/src/components/rating/rating.scss +15 -1
@@ -1,7 +1,8 @@
1
- import {property} from 'lit/decorators.js';
1
+ import {classMap} from "lit/directives/class-map.js";
2
2
  import {type CSSResultGroup, html, unsafeCSS} from 'lit';
3
+ import {HasSlotController} from "../../internal/slot";
4
+ import {property} from 'lit/decorators.js';
3
5
  import ZincElement from '../../internal/zinc-element';
4
- import {classMap} from "lit/directives/class-map.js";
5
6
 
6
7
  import styles from './empty-state.scss';
7
8
 
@@ -35,6 +36,8 @@ export default class ZnEmptyState extends ZincElement {
35
36
 
36
37
  @property({type: Boolean}) padded: boolean = false;
37
38
 
39
+ private readonly hasSlotController = new HasSlotController(this, '[default]', 'caption', 'description');
40
+
38
41
  render() {
39
42
  return html`
40
43
  <div class="${classMap({
@@ -45,16 +48,21 @@ export default class ZnEmptyState extends ZincElement {
45
48
  'empty-state--padded': this.padded
46
49
  })}">
47
50
  <div class="empty-state__wrapper">
48
- ${this.icon
49
- ? html`<zn-icon src="${this.icon}" size="48" color="${this.type ? this.type : 'primary'}"></zn-icon>`
51
+ ${this.icon || this.hasSlotController.test('icon')
52
+ ? html`
53
+ <zn-icon src="${this.icon}" size="48" color="${this.type ? this.type : 'primary'}"></zn-icon>`
50
54
  : ''}
51
- ${this.caption
55
+ ${this.caption || this.hasSlotController.test('caption')
52
56
  ? html`
53
- <div class="caption">${this.caption}</div>`
57
+ <div class="caption">
58
+ <slot name="caption">${this.caption}</slot>
59
+ </div>`
54
60
  : ''}
55
- ${this.description
61
+ ${this.description || this.hasSlotController.test('description')
56
62
  ? html`
57
- <div class="description">${this.description}</div>`
63
+ <div class="description">
64
+ <slot name="description">${this.description}</slot>
65
+ </div>`
58
66
  : ''}
59
67
  <slot></slot>
60
68
  </div>
@@ -231,7 +231,7 @@ export default class ZnExpandingAction extends ZincElement {
231
231
  this.color = color;
232
232
  }
233
233
  } catch {
234
- console.log('Unable to fetch context headers');
234
+ //console.log('Unable to fetch context headers');
235
235
  }
236
236
  }
237
237
 
@@ -39,6 +39,7 @@ export default class ZnHeader extends ZincElement {
39
39
  @property({type: Boolean}) transparent: boolean = false;
40
40
 
41
41
  @property() caption: string;
42
+ @property() icon: string;
42
43
 
43
44
  @property() description: string;
44
45
 
@@ -136,7 +137,8 @@ export default class ZnHeader extends ZincElement {
136
137
 
137
138
 
138
139
  <div class="content" part="content">
139
- ${hasBreadcrumb ? html`<slot name="breadcrumb" class="breadcrumb"></slot>` : null}
140
+ ${hasBreadcrumb ? html`
141
+ <slot name="breadcrumb" class="breadcrumb"></slot>` : null}
140
142
 
141
143
  ${hasPreviousPath ? html`
142
144
  <a href="${this.previousPath}" class="caption__back"
@@ -151,7 +153,11 @@ export default class ZnHeader extends ZincElement {
151
153
 
152
154
  <div class="caption">
153
155
  <div part="header-left" class="header__left">
154
- <span class="header__caption" part="header-caption">${this.caption}</span>
156
+ <span class="header__caption" part="header-caption">
157
+ ${this.icon ? html`
158
+ <zn-icon class="header__icon" src="${this.icon}"></zn-icon>` : null}
159
+ <slot name="caption">${this.caption}</slot>
160
+ </span>
155
161
  ${this.description ? html`
156
162
  <span class="header__description"
157
163
  part="header-description">${this.description}</span>`
@@ -24,6 +24,10 @@
24
24
  overflow: hidden;
25
25
  white-space: nowrap;
26
26
  text-overflow: ellipsis;
27
+ display: flex;
28
+ gap: var(--zn-spacing-x-small);
29
+ align-items: center;
30
+ text-wrap: auto;
27
31
  }
28
32
 
29
33
  &--has-breadcrumb {
@@ -195,7 +199,7 @@
195
199
  text-decoration: none;
196
200
  }
197
201
 
198
- zn-icon {
202
+ a zn-icon {
199
203
  cursor: pointer;
200
204
 
201
205
  &:hover {
@@ -64,6 +64,7 @@ export default class ZnIcon extends ZincElement {
64
64
  @property({reflect: true}) color: IconColor;
65
65
 
66
66
  @property({type: Boolean}) padded: boolean = false;
67
+ @property({type: Boolean}) blink: boolean = false;
67
68
 
68
69
  @property({type: Boolean}) squared: boolean = false;
69
70
 
@@ -192,6 +193,7 @@ export default class ZnIcon extends ZincElement {
192
193
  'icon--grey': this.color === "grey",
193
194
  'icon--avatar': this.library === "avatar",
194
195
  'icon--padded': this.padded,
196
+ 'icon--blink': this.blink,
195
197
  'icon--squared': this.squared,
196
198
  })}" style="${styleMap({
197
199
  '--icon-size': this.size + "px",
@@ -119,6 +119,10 @@
119
119
  border-radius: 50%;
120
120
  }
121
121
 
122
+ &--blink {
123
+ animation: blink-animation 1.5s steps(5, start) infinite;
124
+ }
125
+
122
126
  &--avatar {
123
127
  background-color: var(--avatar-color, var(--icon-color));
124
128
  color: hsl(from var(--avatar-color, var(--icon-color)) h s 95);
@@ -197,3 +201,12 @@
197
201
  vertical-align: middle;
198
202
  }
199
203
  }
204
+
205
+ @keyframes blink-animation {
206
+ 0%, 100% {
207
+ opacity: 1;
208
+ }
209
+ 50% {
210
+ opacity: 0.5;
211
+ }
212
+ }
@@ -63,6 +63,12 @@ export default class ZnItem extends ZincElement {
63
63
  if (inlineEdit) {
64
64
  inlineEdit.setAttribute('size', this.size);
65
65
  }
66
+ this.shadowRoot?.querySelector('.item')?.classList.toggle('item--with-content', this._hasContent());
67
+ }
68
+
69
+ protected _hasContent(): boolean {
70
+ const slotContent = this.querySelectorAll(":scope > :not([slot])")?.length || 0;
71
+ return slotContent > 0 || this.innerText.length > 0 || !(this.value === undefined || this.value === null)
66
72
  }
67
73
 
68
74
  render() {
@@ -71,13 +77,15 @@ export default class ZnItem extends ZincElement {
71
77
  const headings = html`
72
78
  <div class="item__headings">
73
79
  <div class="item__caption" part="caption">${this.caption}</div>
74
- ${this.description ? html`<div class="item__description">${this.description}</div>` : ''}
80
+ ${this.description ? html`
81
+ <div class="item__description">${this.description}</div>` : ''}
75
82
  </div>`;
76
83
 
77
84
  return html`
78
85
  <div
79
- class=${classMap({
86
+ class="${classMap({
80
87
  'item': true,
88
+ 'item--with-content': this._hasContent(),
81
89
  'item--stacked': this.stacked,
82
90
  'item--edit-on-hover': this.editOnHover,
83
91
  'item--inline': this.inline,
@@ -88,7 +96,7 @@ export default class ZnItem extends ZincElement {
88
96
  'item--has-icon': hasIcon,
89
97
  'item--no-padding': this.noPadding,
90
98
  'item--align-end': this.alignEnd
91
- })}
99
+ })}"
92
100
  part="base">
93
101
 
94
102
  ${this.icon ? html`
@@ -14,11 +14,11 @@
14
14
  gap: var(--zn-spacing-2x-small);
15
15
 
16
16
  @include wc.container-query(null, md) {
17
- --zn-item-label-max-width: 200px;
17
+ --zn-item-label-max-width: 220px;
18
18
  }
19
19
 
20
20
  @include wc.container-query(null, smp) {
21
- --zn-item-label-max-width: 150px;
21
+ --zn-item-label-max-width: 180px;
22
22
  }
23
23
 
24
24
  @include wc.container-query(null, sm) {
@@ -54,12 +54,15 @@
54
54
  &__headings {
55
55
  display: flex;
56
56
  flex-direction: column;
57
- max-width: 40%;
57
+ flex-shrink: 0;
58
+ }
59
+
60
+ &--with-content &__headings {
61
+ max-width: 45%;
58
62
  @include wc.container-query(null, sm) {
59
63
  max-width: unset;
60
64
  }
61
65
  width: var(--zn-item-label-max-width);
62
- flex-shrink: 0;
63
66
  }
64
67
 
65
68
  &__content {
@@ -123,6 +123,7 @@ export default class ZnLinkedSelect extends ZincElement implements ZincFormContr
123
123
  }
124
124
 
125
125
  public handleLinkedSelectChange = () => {
126
+ this.value = "";
126
127
  this.requestUpdate();
127
128
  this.formControlController.updateValidity();
128
129
  };
@@ -169,7 +169,6 @@ export default class ZnMenu extends ZincElement {
169
169
  // get the parent dropdown and close it
170
170
  (closestMenu?.closest('zn-dropdown') as ZnDropdown | null)?.hide();
171
171
 
172
- console.log('emitting select')
173
172
  this.emit('zn-select', {detail: {item}});
174
173
  }
175
174
 
@@ -182,7 +182,7 @@ export default class ZnNavbar extends ZincElement {
182
182
  }
183
183
 
184
184
  showMore() {
185
- console.log("Showing More")
185
+ //console.log("Showing More")
186
186
  }
187
187
 
188
188
  render() {
@@ -1,7 +1,7 @@
1
1
  import {classMap} from "lit/directives/class-map.js";
2
2
  import {type colors} from "../data-select/providers/color-data-provider";
3
3
  import {type CSSResultGroup, html, unsafeCSS} from 'lit';
4
- import {property} from "lit/decorators.js";
4
+ import {property, state} from "lit/decorators.js";
5
5
  import ZincElement from '../../internal/zinc-element';
6
6
 
7
7
  import styles from './note.scss';
@@ -32,6 +32,58 @@ export default class ZnNote extends ZincElement {
32
32
  @property({reflect: true}) date: string = '';
33
33
  @property({type: HTMLElement, reflect: true}) body: string = '';
34
34
 
35
+ // Number of lines at which the note body collapses; 0 disables collapsing
36
+ @property({type: Number, attribute: 'collapse-at-lines', reflect: true}) collapseAtLines: number = 3;
37
+
38
+ // Internal state: whether the body is currently expanded
39
+ @state() private expanded = false;
40
+
41
+ // Internal state: whether the content actually overflows the clamp
42
+ @state() private _isOverflowing = false;
43
+
44
+ private _toggleExpand = () => {
45
+ this.expanded = !this.expanded;
46
+ // re-evaluate overflow after toggle (in case of dynamic content)
47
+ this.updateComplete.then(() => this._measureOverflow());
48
+ }
49
+
50
+ private _measureOverflow() {
51
+ // Only relevant when collapseAtLines is set and not expanded
52
+ const container = this.shadowRoot?.querySelector('.note__body-container') as HTMLElement | null;
53
+ if (!container) {
54
+ this._isOverflowing = false;
55
+ return;
56
+ }
57
+
58
+ if (this.collapseAtLines <= 0) {
59
+ this._isOverflowing = false;
60
+ return;
61
+ }
62
+
63
+ // Temporarily ensure clamped styles are applied to measure
64
+ container.style.setProperty('--note-collapse-lines', String(this.collapseAtLines));
65
+ container.classList.toggle('note__body--clamped', !this.expanded);
66
+
67
+ // element starts hidden, cannot measure
68
+ if (container.clientHeight === 0) {
69
+ this._isOverflowing = false;
70
+ return;
71
+ }
72
+
73
+ // Measure overflow
74
+ this._isOverflowing = container.scrollHeight > container.clientHeight + 1; // +1 for rounding errors
75
+ }
76
+
77
+ protected firstUpdated() {
78
+ // Initial measurement of overflow
79
+ this._measureOverflow();
80
+ }
81
+
82
+ protected updated() {
83
+ // Re-measure on any update to catch slot/content changes
84
+ this._measureOverflow();
85
+ }
86
+
35
87
  protected render(): unknown {
36
88
  return html`
37
89
  <div class="${classMap({
@@ -52,7 +104,23 @@ export default class ZnNote extends ZincElement {
52
104
  <small>${this.date}</small>
53
105
  </slot>
54
106
  </div>
55
- <slot class="note__body"></slot>
107
+ <div class="${classMap({
108
+ 'note__body-container': true,
109
+ 'note__body--clamped': this.collapseAtLines > 0 && !this.expanded
110
+ })}" style="--note-collapse-lines: ${this.collapseAtLines}">
111
+ <slot class="note__body"></slot>
112
+ </div>
113
+ ${this.collapseAtLines > 0 && this._isOverflowing ? html`
114
+ <div class="note__toggle">
115
+ <zn-button color="transparent"
116
+ size="content"
117
+ class="note__toggle__btn"
118
+ @click="${this._toggleExpand}"
119
+ aria-expanded="${String(this.expanded)}">
120
+ ${this.expanded ? 'Show less' : 'Show more'}
121
+ </zn-button>
122
+ </div>
123
+ ` : ''}
56
124
  <slot name="footer" class="note__footer"></slot>
57
125
  </div>
58
126
  `;
@@ -42,13 +42,35 @@ $colors: (
42
42
  }
43
43
  }
44
44
 
45
- &__body {
46
- display: flex;
47
- flex-direction: column;
48
- gap: var(--zn-spacing-3x-small);
45
+ &__body-container {
46
+ position: relative;
49
47
  max-width: var(--zn-container-md);
50
48
  }
51
49
 
50
+ &__body {
51
+ display: block;
52
+ }
53
+
54
+ &__body--clamped {
55
+ display: -webkit-box;
56
+ -webkit-box-orient: vertical;
57
+ -webkit-line-clamp: var(--note-collapse-lines, 0);
58
+ overflow: hidden;
59
+ }
60
+
61
+ &__toggle {
62
+ margin-top: var(--zn-spacing-2x-small);
63
+ }
64
+
65
+ &__toggle__btn {
66
+ background: none;
67
+ border: none;
68
+ color: var(--zn-color-primary-500, currentColor);
69
+ font: inherit;
70
+ cursor: pointer;
71
+ padding: 0;
72
+ }
73
+
52
74
  @each $name, $color in $colors {
53
75
  &--#{'' + $name} {
54
76
  .note__header__caption {
@@ -1,9 +1,28 @@
1
- import {property} from 'lit/decorators.js';
2
1
  import {type CSSResultGroup, html, unsafeCSS} from 'lit';
2
+ import {property} from 'lit/decorators.js';
3
3
  import ZincElement from '../../internal/zinc-element';
4
4
 
5
5
  import styles from './order-table.scss';
6
6
 
7
+ interface OrderTableData {
8
+ headers: string[];
9
+ items: {
10
+ caption?: string;
11
+ summary?: string;
12
+ data: string[];
13
+ sub?: {
14
+ caption?: string;
15
+ summary?: string;
16
+ data: string[];
17
+ }[];
18
+ }[];
19
+ tax?: string;
20
+ discount?: string;
21
+ total?: string;
22
+ paid?: string;
23
+ remaining?: string;
24
+ }
25
+
7
26
  /**
8
27
  * @summary Short summary of the component's intended use.
9
28
  * @documentation https://zinc.style/components/order-table
@@ -24,35 +43,23 @@ import styles from './order-table.scss';
24
43
  export default class ZnOrderTable extends ZincElement {
25
44
  static styles: CSSResultGroup = unsafeCSS(styles);
26
45
 
27
- @property({type: Object, reflect: true}) data: Object;
46
+ @property({type: Object, reflect: true}) data: OrderTableData;
28
47
 
29
48
  private isMobile: boolean = false;
30
- private modifiedData: any = null;
31
-
32
- constructor() {
33
- super();
34
- this.modifiedData = this.data;
35
- }
36
-
49
+ private modifiedData: OrderTableData;
37
50
 
38
51
  connectedCallback() {
39
52
  this.isMobile = window.innerWidth < 768;
53
+ this.modifiedData = this.data;
40
54
 
41
- window.addEventListener('resize', () => {
42
- if (window.innerWidth < 768 && !this.isMobile) {
43
- this.isMobile = true;
44
- this.requestUpdate();
45
- } else if (window.innerWidth >= 768 && this.isMobile) {
46
- this.isMobile = false;
47
- this.requestUpdate();
48
- }
49
- });
55
+ window.addEventListener('resize', this.resizeEventHandler);
50
56
 
51
57
  if (this.data === null || this.data === undefined) {
52
58
  if (this.childNodes.length > 0 && this.childNodes[0].nodeType === 3) {
53
- const data: any = this.childNodes[0];
59
+ // @ts-ignore
60
+ const data: ChildNode & { textContent: string } = this.childNodes[0];
54
61
  try {
55
- this.data = JSON.parse(data.textContent);
62
+ this.data = JSON.parse(data?.textContent) as OrderTableData;
56
63
  } catch (e) { /* empty */
57
64
  }
58
65
  }
@@ -61,6 +68,20 @@ export default class ZnOrderTable extends ZincElement {
61
68
  super.connectedCallback();
62
69
  }
63
70
 
71
+ disconnectedCallback() {
72
+ window.removeEventListener('resize', this.resizeEventHandler);
73
+ }
74
+
75
+ resizeEventHandler = () => {
76
+ if (window.innerWidth < 768 && !this.isMobile) {
77
+ this.isMobile = true;
78
+ this.requestUpdate();
79
+ } else if (window.innerWidth >= 768 && this.isMobile) {
80
+ this.isMobile = false;
81
+ this.requestUpdate();
82
+ }
83
+ }
84
+
64
85
  render() {
65
86
  this.modifiedData = this.data;
66
87
  if (this.isMobile) {
@@ -107,7 +128,7 @@ export default class ZnOrderTable extends ZincElement {
107
128
  const rows = [];
108
129
 
109
130
 
110
- if (data && data['items']) {
131
+ if (data?.['items']) {
111
132
  for (const item of data['items']) {
112
133
  const caption = this.getCaption(item);
113
134
  const rowData = item['data'];
@@ -136,8 +157,8 @@ export default class ZnOrderTable extends ZincElement {
136
157
  }
137
158
 
138
159
  getCaption(item: any) {
139
- const caption = item['caption'];
140
- const summary = item['summary'];
160
+ const caption: string = item['caption'];
161
+ const summary: string = item['summary'];
141
162
 
142
163
  return html`
143
164
  <div class="row-item row-caption">
@@ -184,7 +205,7 @@ export default class ZnOrderTable extends ZincElement {
184
205
 
185
206
  getSummary() {
186
207
  let tax = html``;
187
- if (this.modifiedData && this.modifiedData['tax']) {
208
+ if (this.modifiedData?.['tax']) {
188
209
  tax = html`
189
210
  <div class="summary-item">
190
211
  <div class="summary-item-title">Tax</div>
@@ -193,7 +214,7 @@ export default class ZnOrderTable extends ZincElement {
193
214
  }
194
215
 
195
216
  let discount = html``;
196
- if (this.modifiedData && this.modifiedData['discount']) {
217
+ if (this.modifiedData?.['discount']) {
197
218
  discount = html`
198
219
  <div class="summary-item">
199
220
  <div class="summary-item-title">Discount</div>
@@ -202,7 +223,7 @@ export default class ZnOrderTable extends ZincElement {
202
223
  }
203
224
 
204
225
  let total = html``;
205
- if (this.modifiedData && this.modifiedData['total']) {
226
+ if (this.modifiedData?.['total']) {
206
227
  total = html`
207
228
  <div class="summary-item">
208
229
  <div class="summary-item-title">Grand Total</div>
@@ -212,7 +233,7 @@ export default class ZnOrderTable extends ZincElement {
212
233
 
213
234
 
214
235
  let paid = html``;
215
- if (this.modifiedData && this.modifiedData['paid']) {
236
+ if (this.modifiedData?.['paid']) {
216
237
  paid = html`
217
238
  <div class="summary-item">
218
239
  <div class="summary-item-title">Amount Paid</div>
@@ -222,7 +243,7 @@ export default class ZnOrderTable extends ZincElement {
222
243
 
223
244
 
224
245
  let remaining = html``;
225
- if (this.modifiedData && this.modifiedData['remaining']) {
246
+ if (this.modifiedData?.['remaining']) {
226
247
  remaining = html`
227
248
  <div class="summary-item">
228
249
  <div class="summary-item-title">Amount Outstanding</div>
@@ -28,12 +28,14 @@ export default class ZnPanel extends ZincElement {
28
28
 
29
29
  @property({attribute: 'basis-px', type: Number}) basis: number;
30
30
  @property() caption: string;
31
+ @property() icon: string;
31
32
  @property() description: string;
32
33
  @property({type: Boolean}) tabbed: boolean;
33
34
  @property({type: Boolean}) cosmic: boolean;
34
35
  @property({type: Boolean}) flush: boolean;
35
36
  @property({attribute: 'flush-x', type: Boolean}) flushX: boolean;
36
37
  @property({attribute: 'flush-y', type: Boolean}) flushY: boolean;
38
+ @property({attribute: 'flush-footer', type: Boolean}) flushFooter: boolean;
37
39
  @property({type: Boolean}) transparent: boolean;
38
40
 
39
41
  protected firstUpdated(_changedProperties: PropertyValues) {
@@ -81,6 +83,7 @@ export default class ZnPanel extends ZincElement {
81
83
  'panel--flush': this.flush || this.tabbed,
82
84
  'panel--flush-x': this.flushX,
83
85
  'panel--flush-y': this.flushY,
86
+ 'panel--flush-footer': this.flushFooter,
84
87
  'panel--tabbed': this.tabbed,
85
88
  'panel--transparent': this.transparent,
86
89
  'panel--has-actions': hasActionSlot,
@@ -92,8 +95,9 @@ export default class ZnPanel extends ZincElement {
92
95
  <div class="panel__inner">
93
96
  ${hasHeader ? html`
94
97
  <zn-header class="panel__header"
98
+ icon="${this.icon}"
95
99
  caption="${this.caption}"
96
- description=${ifDefined(this.description)}
100
+ description="${ifDefined(this.description)}"
97
101
  transparent>
98
102
  ${hasActionSlot ? html`
99
103
  <slot name="actions" slot="actions" class="panel__header__actions"></slot>` : null}
@@ -120,6 +120,12 @@
120
120
  }
121
121
  }
122
122
 
123
+ &--flush-footer {
124
+ .panel__footer {
125
+ padding: 0;
126
+ }
127
+ }
128
+
123
129
  &--transparent {
124
130
  .panel__header {
125
131
  padding-left: 0;
@@ -54,7 +54,9 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
54
54
 
55
55
  @property({type: Boolean}) disabled: boolean = false;
56
56
 
57
- @property() getSymbol: (value: number) => string = () => '<zn-icon src="warning"></zn-icon>';
57
+ @property({}) size: 'small' | 'medium' | 'large' = 'medium';
58
+
59
+ @property() getSymbol: (value: number) => string = () => '<zn-icon src="star" library="material"></zn-icon>';
58
60
 
59
61
  /** Gets the validity state object */
60
62
  get validity() {
@@ -170,6 +172,9 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
170
172
  rating: true,
171
173
  'rating--readonly': this.readonly,
172
174
  'rating--disabled': this.disabled,
175
+ 'rating--small': this.size === 'small',
176
+ 'rating--medium': this.size === 'medium',
177
+ 'rating--large': this.size === 'large'
173
178
  })}"
174
179
  role="slider"
175
180
  aria-label="${this.label}"
@@ -196,21 +201,18 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
196
201
  'rating__partial-symbol-container': true,
197
202
  'rating__symbol--hover': this.isHovering && Math.ceil(displayValue) === index + 1
198
203
  })}
199
- role="presentation"
200
- >
204
+ role="presentation">
201
205
  <div
202
206
  style=${styleMap({
203
207
  clipPath: `inset(0 0 0 ${(displayValue - index) * 100}%)`
204
- })}
205
- >
208
+ })}>
206
209
  ${unsafeHTML(this.getSymbol(index + 1))}
207
210
  </div>
208
211
  <div
209
212
  class="rating__partial--filled"
210
213
  style=${styleMap({
211
214
  clipPath: `inset(0 ${100 - (displayValue - index) * 100}% 0 0)`
212
- })}
213
- >
215
+ })}>
214
216
  ${unsafeHTML(this.getSymbol(index + 1))}
215
217
  </div>
216
218
  </span>
@@ -223,8 +225,7 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
223
225
  'rating__symbol--hover': this.isHovering && Math.ceil(displayValue) === index + 1,
224
226
  'rating__symbol--active': displayValue >= index + 1
225
227
  })}
226
- role="presentation"
227
- >
228
+ role="presentation">
228
229
  ${unsafeHTML(this.getSymbol(index + 1))}
229
230
  </span>`;
230
231
  })}
@@ -2,7 +2,7 @@
2
2
 
3
3
  :host {
4
4
  --symbol-color: rgb(var(--zn-border-color));
5
- --symbol-color-active: rgb(var(--zn-primary));
5
+ --symbol-color-active: var(--zn-color-amber-400);
6
6
  --symbol-size: 1.2rem;
7
7
  --symbol-spacing: 4px;
8
8
 
@@ -79,4 +79,18 @@
79
79
  &--disabled .rating__symbols {
80
80
  cursor: not-allowed;
81
81
  }
82
+
83
+ &--small {
84
+ --symbol-size: 1rem;
85
+ --symbol-spacing: 2px;
86
+ }
87
+
88
+ &--medium {
89
+ --symbol-size: 1.2rem;
90
+ }
91
+
92
+ &--large {
93
+ --symbol-size: 1.5rem;
94
+ --symbol-spacing: 6px;
95
+ }
82
96
  }