@kubex/zinc 1.0.118 → 1.1.0

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 (98) hide show
  1. package/dist/custom-elements.json +634 -201
  2. package/dist/vscode.html-custom-data.json +115 -39
  3. package/dist/web-types.json +220 -64
  4. package/dist/zn.d.ts +149 -25
  5. package/dist/zn.min.css +1 -1
  6. package/dist/zn.min.js +911 -874
  7. package/docs/assets/styles/docs.css +1 -1
  8. package/docs/pages/components/button.md +25 -7
  9. package/docs/pages/components/chat-message.md +62 -0
  10. package/docs/pages/components/data-table-search.md +6 -6
  11. package/docs/pages/components/editor.md +1 -1
  12. package/docs/pages/components/file.md +1 -1
  13. package/docs/pages/components/form-group.md +1 -1
  14. package/docs/pages/components/icon.md +19 -2
  15. package/docs/pages/components/menu.md +23 -2
  16. package/docs/pages/components/select.md +2 -2
  17. package/docs/pages/components/tile-group.md +92 -0
  18. package/docs/pages/components/tile.md +80 -25
  19. package/package.json +1 -1
  20. package/scss/_root.scss +1 -1
  21. package/scss/mixins/_spacing-mixins.scss +20 -0
  22. package/scss/mixins/_typography-mixins.scss +22 -0
  23. package/scss/mixins/index.scss +2 -1
  24. package/scss/shared/_base.scss +18 -20
  25. package/scss/shared/_button.scss +5 -3
  26. package/scss/shared/_table.scss +4 -1
  27. package/scss/shared/layout.scss +2 -2
  28. package/scss/themes/_index.scss +2 -0
  29. package/scss/themes/_light.scss +22 -45
  30. package/scss/themes/_spacing.scss +44 -0
  31. package/scss/themes/_typography.scss +62 -0
  32. package/src/components/animated-button/README.md +1 -1
  33. package/src/components/button/button.component.ts +27 -5
  34. package/src/components/button/button.scss +86 -30
  35. package/src/components/button-menu/button-menu.component.ts +22 -9
  36. package/src/components/button-menu/button-menu.scss +1 -2
  37. package/src/components/button-menu/button-menu.test.ts +18 -0
  38. package/src/components/chat-message/chat-message.component.ts +73 -0
  39. package/src/components/chat-message/chat-message.scss +60 -0
  40. package/src/components/chat-message/index.ts +12 -0
  41. package/src/components/checkbox/checkbox.scss +2 -2
  42. package/src/components/chip/chip.component.ts +0 -5
  43. package/src/components/chip/chip.scss +14 -34
  44. package/src/components/content-block/content-block.component.ts +46 -45
  45. package/src/components/content-block/content-block.scss +58 -27
  46. package/src/components/data-table/data-table.scss +10 -7
  47. package/src/components/data-table-sort/data-table-sort.scss +1 -1
  48. package/src/components/dialog/dialog.component.ts +3 -3
  49. package/src/components/dialog/dialog.scss +2 -2
  50. package/src/components/dropdown/dropdown.component.ts +1 -0
  51. package/src/components/editor/editor.component.ts +3 -1
  52. package/src/components/editor/editor.scss +9 -2
  53. package/src/components/editor/modules/ai/panel/ai-panel.scss +2 -2
  54. package/src/components/editor/modules/ai/tooltip/ai-tooltip.scss +1 -1
  55. package/src/components/editor/modules/context-menu/context-menu.ts +20 -20
  56. package/src/components/editor/modules/dialog/dialog.component.ts +3 -4
  57. package/src/components/editor/modules/dialog/dialog.scss +2 -1
  58. package/src/components/editor/modules/dialog/dialog.ts +12 -8
  59. package/src/components/editor/modules/toolbar/tool/tool.component.ts +1 -5
  60. package/src/components/editor/modules/toolbar/toolbar.component.ts +54 -50
  61. package/src/components/editor/modules/toolbar/toolbar.scss +4 -29
  62. package/src/components/editor/modules/toolbar/toolbar.ts +15 -17
  63. package/src/components/expanding-action/expanding-action.component.ts +14 -7
  64. package/src/components/expanding-action/expanding-action.scss +44 -2
  65. package/src/components/file/file.scss +2 -2
  66. package/src/components/header/header.component.ts +1 -1
  67. package/src/components/header/header.scss +3 -3
  68. package/src/components/hover-container/hover-container.scss +1 -1
  69. package/src/components/icon/icon.component.ts +6 -1
  70. package/src/components/icon/icon.scss +31 -0
  71. package/src/components/icon-picker/icon-picker.scss +3 -3
  72. package/src/components/input/input.scss +3 -3
  73. package/src/components/input-group/input-group.scss +16 -16
  74. package/src/components/markdown-editor/markdown-editor.scss +2 -2
  75. package/src/components/menu/menu.component.ts +32 -1
  76. package/src/components/menu/menu.scss +28 -5
  77. package/src/components/menu-item/menu-item.component.ts +6 -2
  78. package/src/components/menu-item/menu-item.scss +49 -5
  79. package/src/components/navbar/navbar.component.ts +7 -4
  80. package/src/components/navbar/navbar.scss +93 -21
  81. package/src/components/page/page.component.ts +1 -1
  82. package/src/components/page/page.scss +7 -26
  83. package/src/components/panel/panel.scss +5 -8
  84. package/src/components/priority-list/priority-list.scss +1 -1
  85. package/src/components/rating/rating.scss +1 -1
  86. package/src/components/scroll-container/scroll-container.scss +2 -1
  87. package/src/components/select/select.scss +1 -1
  88. package/src/components/settings-container/settings-container.scss +2 -2
  89. package/src/components/stat/stat.scss +8 -5
  90. package/src/components/tile/tile.component.ts +10 -2
  91. package/src/components/tile/tile.scss +108 -67
  92. package/src/components/tile-group/index.ts +12 -0
  93. package/src/components/tile-group/tile-group.component.ts +66 -0
  94. package/src/components/tile-group/tile-group.scss +23 -0
  95. package/src/form-control.scss +2 -1
  96. package/src/wc.scss +1 -0
  97. package/src/zinc.ts +2 -0
  98. package/src/components/editor/modules/toolbar/tool/tool.scss +0 -5
@@ -8,8 +8,7 @@ Apply default styles to the document, and shadow documents
8
8
 
9
9
  font-feature-settings: normal;
10
10
  font-variation-settings: normal;
11
- font-size: 14px;
12
- line-height: 1.5;
11
+ font-size: var(--zn-text-paragraph-font-size);
13
12
 
14
13
  -webkit-text-size-adjust: 100%;
15
14
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0%);
@@ -71,33 +70,32 @@ small {
71
70
  visibility: hidden;
72
71
  }
73
72
 
74
- h1, h2, h3, h4, h5, h6 {
75
- font-weight: var(--zn-font-weight-medium);
76
- color: rgb(var(--zn-text-heading));
77
- }
78
-
79
- h6 {
80
- font-size: var(--zn-font-size-x-small);
81
- }
82
-
83
- h5 {
84
- font-size: var(--zn-font-size-small);
73
+ p {
74
+ font-size: var(--zn-text-paragraph-font-size);
75
+ line-height: var(--zn-text-paragraph-line-height);
76
+ font-weight: var(--zn-text-paragraph-font-weight);
85
77
  }
86
78
 
87
- h4 {
88
- font-size: var(--zn-font-size-medium);
79
+ h1, h2, h3, h4, h5, h6 {
80
+ color: rgb(var(--zn-text-heading));
89
81
  }
90
82
 
91
- h3 {
92
- font-size: var(--zn-font-size-large);
83
+ h1 {
84
+ font-size: var(--zn-text-h1-font-size);
85
+ line-height: var(--zn-text-h1-line-height);
86
+ font-weight: var(--zn-text-h1-font-weight);
93
87
  }
94
88
 
95
89
  h2 {
96
- font-size: var(--zn-font-size-x-large);
90
+ font-size: var(--zn-text-h2-font-size);
91
+ line-height: var(--zn-text-h2-line-height);
92
+ font-weight: var(--zn-text-h2-font-weight);
97
93
  }
98
94
 
99
- h1 {
100
- font-size: var(--zn-font-size-2x-large);
95
+ h3, h4, h5, h6 {
96
+ font-size: var(--zn-text-h3-font-size);
97
+ line-height: var(--zn-text-h3-line-height);
98
+ font-weight: var(--zn-text-h3-font-weight);
101
99
  }
102
100
 
103
101
  kbd {
@@ -2,7 +2,7 @@
2
2
  @use '../variables';
3
3
 
4
4
  @mixin button {
5
- border-radius: var(--zn-border-radius-medium);
5
+ border-radius: var(--zn-border-radius);
6
6
  display: inline-flex;
7
7
  align-items: center;
8
8
  justify-content: center;
@@ -11,12 +11,14 @@
11
11
  width: fit-content;
12
12
  background-color: rgb(var(--zn-primary));
13
13
  color: rgba(255, 255, 255, 0.9);
14
- font-weight: 600;
14
+ font-size: var(--zn-text-button-label-font-size);
15
+ font-weight: var(--zn-text-button-label-font-weight);
16
+ line-height: var(--zn-text-button-label-line-height);
17
+ text-transform: var(--zn-text-button-label-transform);
15
18
  cursor: pointer;
16
19
  vertical-align: middle;
17
20
  border-color: transparent;
18
21
  white-space: nowrap;
19
- line-height: 20px;
20
22
 
21
23
  max-height: 36px;
22
24
  height: 36px;
@@ -8,9 +8,12 @@ table:not(.remarkd-table) {
8
8
  max-width: 100%;
9
9
  table-layout: auto;
10
10
  text-align: left;
11
+ font-size: var(--zn-text-table-content-font-size);
12
+ line-height: var(--zn-text-table-content-line-height);
13
+ font-weight: var(--zn-text-table-content-font-weight);
11
14
 
12
15
  thead {
13
- font-weight: 500;
16
+ font-weight: var(--zn-font-weight-medium);
14
17
  }
15
18
 
16
19
  tbody {
@@ -212,7 +212,7 @@
212
212
  .zn-panel {
213
213
  background-color: rgba(var(--zn-panel), var(--zn-panel-opacity));
214
214
  border: 1px solid rgb(var(--zn-border-color));
215
- border-radius: var(--zn-border-radius-large);
215
+ border-radius: var(--zn-border-radius);
216
216
  --zn-page-surface-background: var(--zn-panel);
217
217
  }
218
218
 
@@ -296,7 +296,7 @@
296
296
  }
297
297
 
298
298
  .zn-panel-bar--pill {
299
- border-radius: var(--zn-border-radius-large);
299
+ border-radius: var(--zn-border-radius);
300
300
  border: 1px solid rgb(var(--zn-border-color));
301
301
  }
302
302
 
@@ -1,3 +1,5 @@
1
1
  @use "light";
2
2
  @use "dark";
3
+ @use "spacing";
4
+ @use "typography";
3
5
  @use "utility";
@@ -110,10 +110,8 @@
110
110
  --zn-color-neutral-1000: hsl(0, 0%, 0%); // used: docs/assets/styles/docs.css:502 (+2 more)
111
111
 
112
112
  /* Border radii */
113
- --zn-border-radius-small: 0.1875rem; // 3px
114
- --zn-border-radius-medium: 0.325rem; // 5.2px
115
- --zn-border-radius-large: 0.5rem; // 8px
116
- --zn-border-radius-x-large: 1rem; // 16px
113
+ --zn-border-radius: 6px;
114
+ --zn-border-radius-small: 2px;
117
115
  --zn-border-radius-circle: 50%;
118
116
  --zn-border-radius-pill: 9999px;
119
117
 
@@ -123,27 +121,6 @@
123
121
  --zn-shadow-large: 0 6px 20px rgba(0, 0, 0, 0.15);
124
122
  --zn-shadow-x-large: 0 6px 20px rgba(0, 0, 0, 0.25);
125
123
 
126
- --zn-spacing-3x-small: 0.125rem; // 2px
127
- --zn-spacing-2x-small: 0.25rem; // 4px
128
- --zn-spacing-x-small: 0.5rem; // 8px
129
- --zn-spacing-small: 0.75rem; // 12px
130
- --zn-spacing-medium: 1rem; // 16px
131
- --zn-spacing-large: 1.25rem; // 20px
132
- --zn-spacing-x-large: 1.75rem; // 28px
133
- --zn-spacing-2x-large: 2.25rem; // 36px
134
- --zn-spacing-3x-large: 3rem; // 48px
135
- --zn-spacing-4x-large: 4.5rem; // 72px
136
-
137
- /* Fixed Spaces */
138
- --zn-spacing-narrow-bar: 45px;
139
- --zn-spacing-bar: 60px;
140
- --zn-spacing-tile: 80px;
141
- --zn-spacing-sidenav: 320px;
142
- --zn-spacing-small-panel: 200px;
143
- --zn-spacing-medium-panel: 320px;
144
- --zn-spacing-panel: 360px;
145
- --zn-spacing-lside: 460px; // Not sure what this is @mressex figure it out. (I never did)
146
-
147
124
  /** Container Sizes */
148
125
  --zn-container: var(--zn-container-hd);
149
126
  --zn-container-default: 100%;
@@ -195,18 +172,15 @@
195
172
  --zn-font-weight-bold: 700;
196
173
 
197
174
  /* Letter spacings */
198
- --zn-letter-spacing-denser: -0.03em;
199
- --zn-letter-spacing-dense: -0.015em;
200
175
  --zn-letter-spacing-normal: normal;
201
- --zn-letter-spacing-loose: 0.075em;
202
- --zn-letter-spacing-looser: 0.15em;
176
+ --zn-letter-spacing-loose: 0.5px;
203
177
 
204
178
  /* Line heights */
205
- --zn-line-height-denser: 1;
206
- --zn-line-height-dense: 1.4;
207
- --zn-line-height-normal: 1.8;
208
- --zn-line-height-loose: 2.2;
209
- --zn-line-height-looser: 2.6;
179
+ --zn-line-height-denser: 1; // 16px
180
+ --zn-line-height-dense: 1.5; // 24px
181
+ --zn-line-height-normal: 2; // 32px
182
+ --zn-line-height-loose: 2.5; // 40px
183
+ --zn-line-height-looser: 3; // 48px
210
184
 
211
185
  /* Focus rings */
212
186
  --zn-focus-ring-color: var(--zn-color-primary-600);
@@ -246,29 +220,30 @@
246
220
  --zn-input-required-content-color: var(--zn-input-label-color);
247
221
 
248
222
  /* Input border radii */
249
- --zn-input-border-radius-x-small: var(--zn-border-radius-medium);
250
- --zn-input-border-radius-small: var(--zn-border-radius-medium);
251
- --zn-input-border-radius-medium: var(--zn-border-radius-medium);
252
- --zn-input-border-radius-large: var(--zn-border-radius-medium);
223
+ --zn-input-border-radius-x-small: var(--zn-border-radius);
224
+ --zn-input-border-radius-small: var(--zn-border-radius);
225
+ --zn-input-border-radius-medium: var(--zn-border-radius);
226
+ --zn-input-border-radius-large: var(--zn-border-radius);
253
227
 
254
228
  /* Input fonts */
255
229
  --zn-input-font-family: var(--zn-font-sans);
256
- --zn-input-font-weight: var(--zn-font-weight-normal);
230
+ --zn-input-font-weight: var(--zn-text-input-content-font-weight);
257
231
  --zn-input-font-size-x-small: var(--zn-font-size-x-small);
258
232
  --zn-input-font-size-small: var(--zn-font-size-small);
259
- --zn-input-font-size-medium: var(--zn-font-size-medium);
233
+ --zn-input-font-size-medium: var(--zn-text-input-content-font-size);
260
234
  --zn-input-font-size-large: var(--zn-font-size-large);
235
+ --zn-input-line-height: var(--zn-text-input-content-line-height);
261
236
  --zn-input-letter-spacing: var(--zn-letter-spacing-normal);
262
237
 
263
238
  /* Input colors */
264
- --zn-input-color: var(--zn-color-neutral-800);
239
+ --zn-input-color: var(--zn-text-input-content-color);
265
240
  --zn-input-color-hover: var(--zn-color-neutral-800);
266
241
  --zn-input-color-focus: var(--zn-color-neutral-700);
267
242
  --zn-input-color-disabled: var(--zn-color-neutral-800);
268
243
  --zn-input-icon-color: var(--zn-color-neutral-500);
269
244
  --zn-input-icon-color-hover: var(--zn-color-neutral-600);
270
245
  --zn-input-icon-color-focus: var(--zn-color-neutral-600);
271
- --zn-input-placeholder-color: var(--zn-color-neutral-500);
246
+ --zn-input-placeholder-color: var(--zn-text-input-placeholder-color);
272
247
  --zn-input-placeholder-color-disabled: var(--zn-color-neutral-600);
273
248
 
274
249
  /* Input spacing */
@@ -281,9 +256,11 @@
281
256
  --zn-input-focus-ring-offset: 0;
282
257
 
283
258
  --zn-input-label-font-size-small: var(--zn-font-size-small);
284
- --zn-input-label-font-size-medium: var(--zn-font-size-medium);
259
+ --zn-input-label-font-size-medium: var(--zn-text-input-label-font-size);
285
260
  --zn-input-label-font-size-large: var(--zn-font-size-large);
286
- --zn-input-label-color: var(--zn-color-neutral-900);
261
+ --zn-input-label-font-weight: var(--zn-text-input-label-font-weight);
262
+ --zn-input-label-line-height: var(--zn-text-input-label-line-height);
263
+ --zn-input-label-color: var(--zn-text-input-label-color);
287
264
 
288
265
  /* Help text */
289
266
  --zn-input-help-text-font-size-small: var(--zn-font-size-x-small);
@@ -303,7 +280,7 @@
303
280
  --zn-panel-border-color: var(--zn-color-neutral-200);
304
281
  --zn-panel-border-width: 1px;
305
282
 
306
- --zn-tooltip-border-radius: var(--zn-border-radius-medium);
283
+ --zn-tooltip-border-radius: var(--zn-border-radius);
307
284
  --zn-tooltip-background-color: var(--zn-color-neutral-900);
308
285
  --zn-tooltip-color: var(--zn-color-neutral-0);
309
286
  --zn-tooltip-font-family: var(--zn-font-sans);
@@ -0,0 +1,44 @@
1
+ @use "sass:map";
2
+
3
+ /**************************************************************
4
+ * Spacing
5
+ *
6
+ * Uniform spacing tokens. The scale is built on iterations of
7
+ * the 8px base unit (--zn-spacing-unit); 3x-small and 2x-small
8
+ * are quarter/half steps for hairline gaps.
9
+ *
10
+ * Emits --zn-spacing-<name> for every step in $spacing-scale.
11
+ *************************************************************/
12
+
13
+ $spacing-unit: 8px;
14
+
15
+ $spacing-scale: (
16
+ "3x-small": 0.25, // 2px
17
+ "2x-small": 0.5, // 4px
18
+ "x-small": 1, // 8px
19
+ "small": 2, // 16px
20
+ "medium": 3, // 24px
21
+ "large": 4, // 32px
22
+ "x-large": 5, // 40px
23
+ "2x-large": 6, // 48px
24
+ "3x-large": 7, // 56px
25
+ "4x-large": 9, // 72px
26
+ );
27
+
28
+ :root {
29
+ --zn-spacing-unit: #{$spacing-unit};
30
+
31
+ @each $name, $multiplier in $spacing-scale {
32
+ --zn-spacing-#{$name}: #{$multiplier * $spacing-unit};
33
+ }
34
+
35
+ /* Fixed spaces */
36
+ --zn-spacing-narrow-bar: 45px;
37
+ --zn-spacing-bar: 60px;
38
+ --zn-spacing-tile: 80px;
39
+ --zn-spacing-sidenav: 320px;
40
+ --zn-spacing-small-panel: 200px;
41
+ --zn-spacing-medium-panel: 320px;
42
+ --zn-spacing-panel: 360px;
43
+ --zn-spacing-lside: 460px;
44
+ }
@@ -0,0 +1,62 @@
1
+ @use "sass:map";
2
+
3
+ /**************************************************************
4
+ * Text Styles
5
+ *
6
+ * Uniform, role-based typography tokens. Every role emits the
7
+ * same six custom properties:
8
+ *
9
+ * --zn-text-<role>-font-size
10
+ * --zn-text-<role>-line-height
11
+ * --zn-text-<role>-spacing (paragraph spacing — apply as margin-block-end)
12
+ * --zn-text-<role>-font-weight
13
+ * --zn-text-<role>-color
14
+ * --zn-text-<role>-transform
15
+ *
16
+ * All roles use the sans family (--zn-font-sans). Apply a role
17
+ * in a component with the text-style() mixin from scss/mixins.
18
+ *************************************************************/
19
+
20
+ $text-styles: (
21
+ "paragraph": ("size": 14px, "line": 21px, "spacing": 21px, "weight": normal, "color": default, "transform": none),
22
+ "table-content": ("size": 14px, "line": 16px, "spacing": 15px, "weight": normal, "color": default, "transform": none),
23
+ "chat": ("size": 16px, "line": 24px, "spacing": 15px, "weight": normal, "color": default, "transform": none),
24
+ "h1": ("size": 16px, "line": 16px, "spacing": 18px, "weight": semibold, "color": default, "transform": none),
25
+ "h2": ("size": 14px, "line": 16px, "spacing": 15px, "weight": semibold, "color": default, "transform": none),
26
+ "h3": ("size": 11px, "line": 16px, "spacing": 15px, "weight": semibold, "color": default, "transform": none),
27
+ "subheading": ("size": 14px, "line": 16px, "spacing": 15px, "weight": normal, "color": muted, "transform": none),
28
+ "subheading-small": ("size": 13px, "line": 16px, "spacing": 15px, "weight": normal, "color": muted, "transform": none),
29
+ "input-placeholder": ("size": 14px, "line": 24px, "spacing": 18px, "weight": normal, "color": muted, "transform": none),
30
+ "input-content": ("size": 14px, "line": 24px, "spacing": 18px, "weight": normal, "color": default, "transform": none),
31
+ "input-label": ("size": 14px, "line": 16px, "spacing": 15px, "weight": semibold, "color": default, "transform": none),
32
+ "chart-minor": ("size": 14px, "line": 16px, "spacing": 15px, "weight": semibold, "color": muted, "transform": none),
33
+ "chart-major": ("size": 21px, "line": 16px, "spacing": 18px, "weight": normal, "color": default, "transform": none),
34
+ "button-label": ("size": 13px, "line": 16px, "spacing": 18px, "weight": semibold, "color": default, "transform": uppercase),
35
+ "chip": ("size": 10px, "line": 16px, "spacing": 15px, "weight": semibold, "color": default, "transform": uppercase),
36
+ "navbar-link": ("size": 16px, "line": 16px, "spacing": 18px, "weight": semibold, "color": muted, "transform": none),
37
+ "tab-link": ("size": 14px, "line": 16px, "spacing": 15px, "weight": semibold, "color": muted, "transform": none),
38
+ "tab-link-active": ("size": 14px, "line": 16px, "spacing": 15px, "weight": semibold, "color": default, "transform": none),
39
+ "menu-link": ("size": 14px, "line": 16px, "spacing": 15px, "weight": normal, "color": muted, "transform": none),
40
+ "notification": ("size": 9px, "line": 11px, "spacing": 0, "weight": semibold, "color": white, "transform": none),
41
+ );
42
+
43
+ :root {
44
+ /* Text colors (themed via --zn-color-text / --zn-color-muted-text in _root.scss) */
45
+ --zn-text-color: rgb(var(--zn-color-text)); // light: rgba(33, 33, 33, 1)
46
+ --zn-text-color-muted: rgb(var(--zn-color-muted-text)); // light: rgba(125, 119, 146, 1)
47
+
48
+ @each $role, $style in $text-styles {
49
+ --zn-text-#{$role}-font-size: #{map.get($style, "size")};
50
+ --zn-text-#{$role}-line-height: #{map.get($style, "line")};
51
+ --zn-text-#{$role}-spacing: #{map.get($style, "spacing")};
52
+ --zn-text-#{$role}-font-weight: var(--zn-font-weight-#{map.get($style, "weight")});
53
+ @if map.get($style, "color") == muted {
54
+ --zn-text-#{$role}-color: var(--zn-text-color-muted);
55
+ } @else if map.get($style, "color") == white {
56
+ --zn-text-#{$role}-color: #fff;
57
+ } @else {
58
+ --zn-text-#{$role}-color: var(--zn-text-color);
59
+ }
60
+ --zn-text-#{$role}-transform: #{map.get($style, "transform")};
61
+ }
62
+ }
@@ -183,7 +183,7 @@ The component uses CSS custom properties from the Zinc design system:
183
183
  - `--zn-color-error`: Error color (red)
184
184
  - `--zn-transition-medium`: Transition duration for color changes
185
185
  - `--zn-transition-fast`: Transition duration for interactions
186
- - `--zn-border-radius-medium`: Border radius
186
+ - `--zn-border-radius`: Border radius
187
187
 
188
188
  ### CSS Parts
189
189
 
@@ -11,7 +11,7 @@ import ZincElement from '../../internal/zinc-element';
11
11
  import ZnDropdown from "../dropdown";
12
12
  import ZnIcon from "../icon";
13
13
  import ZnTooltip from "../tooltip";
14
- import type {IconColor} from "../icon";
14
+ import type {IconColor, IconLibrary} from "../icon";
15
15
  import type {ZincFormControl} from '../../internal/zinc-element';
16
16
 
17
17
  import styles from './button.scss';
@@ -67,7 +67,22 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
67
67
  @property({type: Boolean}) disabled = false;
68
68
  @property({type: Boolean}) grow = false;
69
69
  @property({type: Boolean}) square = false;
70
- @property({type: Boolean, attribute: 'icon-button'}) iconButton = false;
70
+ /** Renders the button as an icon button (40x36). Pass `small` for the
71
+ * 36x36 variant or `round` for a 36x36 circle: `icon-button`,
72
+ * `icon-button="small"` or `icon-button="round"`. */
73
+ @property({
74
+ attribute: 'icon-button',
75
+ converter: {
76
+ fromAttribute: (value: string | null) => (value === 'small' || value === 'round') ? value : value !== null,
77
+ toAttribute: (value: boolean | 'small' | 'round') =>
78
+ (value === 'small' || value === 'round') ? value : (value ? '' : null)
79
+ }
80
+ }) iconButton: boolean | 'small' | 'round' = false;
81
+ /** With `icon-button`, removes the white background and border while
82
+ * keeping the button's size. */
83
+ @property({type: Boolean}) plain = false;
84
+ /** Disables the hover background, for contexts where the tint doesn't fit. */
85
+ @property({type: Boolean, attribute: 'no-hover'}) noHover = false;
71
86
  @property({type: Boolean, attribute: 'panel-bg'}) panelBackground = false;
72
87
 
73
88
  @property({attribute: 'dropdown-closer', type: Boolean}) dropdownCloser = false;
@@ -83,6 +98,8 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
83
98
  @property({attribute: "icon-position"}) iconPosition: 'left' | 'right' = 'left';
84
99
  @property({attribute: "icon-size"}) iconSize: string;
85
100
  @property({attribute: "icon-color"}) iconColor: IconColor;
101
+ @property({attribute: "icon-fill"}) iconFill: IconColor;
102
+ @property({attribute: "icon-library"}) iconLibrary: IconLibrary;
86
103
  @property() type: 'button' | 'submit' | 'reset';
87
104
 
88
105
  @property() name: string;
@@ -259,7 +276,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
259
276
  case 'primary':
260
277
  return 'rgb(var(--zn-primary))';
261
278
  case 'secondary':
262
- return 'var(--zn-color-neutral-500)';
279
+ return 'rgb(var(--zn-text))';
263
280
  case 'error':
264
281
  return 'rgb(var(--zn-color-error))';
265
282
  case 'info':
@@ -348,7 +365,8 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
348
365
  const showCancel = this.loading && this.autoClick;
349
366
  const icon = this.icon && !this.loading ? html`
350
367
  <zn-icon part="icon" src="${this.icon}" id="xy2" size="${this.iconSize ? this.iconSize : 20}"
351
- color="${ifDefined(this.iconColor)}"></zn-icon>`
368
+ color="${ifDefined(this.iconColor)}" fill="${ifDefined(this.iconFill)}"
369
+ library="${ifDefined(this.iconLibrary)}"></zn-icon>`
352
370
  : '';
353
371
  const tag = isLink ? literal`a` : literal`button`;
354
372
  const iconButtonStyles = this.iconButton ? {
@@ -372,7 +390,11 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
372
390
  'button--star': this.color === 'star',
373
391
  'button--outline': this.outline,
374
392
  'button--text': (this.text && !this.outline),
375
- 'button--icon-button': this.iconButton,
393
+ 'button--icon-button': !!this.iconButton,
394
+ 'button--plain': !!this.iconButton && this.plain,
395
+ 'button--no-hover': this.noHover,
396
+ 'button--icon-button-small': this.iconButton === 'small',
397
+ 'button--icon-button-round': this.iconButton === 'round',
376
398
  'button--grow': this.grow,
377
399
  'button--standard': !this.outline && !this.text,
378
400
  'button--with-icon': this.icon,
@@ -50,18 +50,13 @@
50
50
  }
51
51
  }
52
52
 
53
- .button.button--icon-button {
54
- max-height: 20px;
55
- height: 20px;
56
- min-height: 20px;
57
- }
58
-
59
53
  .button.button--muted-notification {
60
54
  --notification-color: rgb(var(--zn-color-info));
61
55
  }
62
56
 
63
57
  .button--has-notification {
64
58
  position: relative;
59
+ overflow: visible;
65
60
 
66
61
  &::after {
67
62
  content: attr(data-notification);
@@ -69,25 +64,30 @@
69
64
  display: flex;
70
65
  justify-content: center;
71
66
  align-items: center;
72
- top: 1px;
67
+ top: -4px;
73
68
  left: auto;
74
- inset-inline-end: 1px;
75
- width: 15px;
76
- height: 15px;
77
- border-radius: 50%;
78
- font-size: 10px;
79
- color: white;
69
+ inset-inline-end: -4px;
70
+ box-sizing: border-box;
71
+ min-width: 13px;
72
+ height: 13px;
73
+ padding: 0 3px;
74
+ border-radius: 999px;
75
+ font-size: var(--zn-text-notification-font-size);
76
+ font-weight: var(--zn-text-notification-font-weight);
77
+ line-height: var(--zn-text-notification-line-height);
78
+ color: var(--zn-text-notification-color);
80
79
  background-color: var(--notification-color);
81
80
  }
82
81
  }
83
82
 
84
83
  .button--has-notification.button--notification-dot {
85
- &:after {
84
+ &::after {
86
85
  content: '';
87
- width: 5px;
88
- height: 5px;
89
- top: 5px;
90
- right: 3px;
86
+ min-width: 0;
87
+ width: 8px;
88
+ height: 8px;
89
+ padding: 0;
90
+ border-radius: 50%;
91
91
  }
92
92
  }
93
93
 
@@ -244,19 +244,33 @@
244
244
  }
245
245
  }
246
246
 
247
- .button--icon-button {
247
+ /**
248
+ * Icon buttons
249
+ *
250
+ * Standard: 40x36, white background, 1px border, 6px radius
251
+ * Small: 36x36 (`icon-button="small"`)
252
+ * Plain: either size without the background and border (`plain`)
253
+ *
254
+ * Doubled-up selector so the icon-button design out-cascades the color
255
+ * variant combos (.button--standard.button--secondary etc.)
256
+ */
257
+ .button.button--icon-button {
248
258
  --icon-button-color: rgb(var(--zn-text));
249
259
  --icon-button-hover-color: rgb(var(--zn-primary));
250
260
 
251
- background: transparent;
252
- border-color: var(--zn-button-border-color, transparent) !important;
261
+ width: 40px;
262
+ min-width: 40px;
263
+ height: 36px;
264
+ min-height: 36px;
265
+ max-height: 36px;
266
+ padding: 6px;
267
+ margin: 0;
268
+ background: rgb(var(--zn-panel));
269
+ border-color: var(--zn-button-border-color, rgb(var(--zn-border-color))) !important;
270
+ border-radius: var(--zn-border-radius);
253
271
  color: var(--icon-button-color);
254
272
  font-weight: inherit;
255
273
  line-height: 0;
256
- margin: 0;
257
- min-width: 0;
258
- padding: 0;
259
- width: auto;
260
274
 
261
275
  zn-icon,
262
276
  ::slotted(zn-icon) {
@@ -266,15 +280,57 @@
266
280
  line-height: 0;
267
281
  }
268
282
 
283
+ // Hovers tint the background only — the icon keeps its set colour
269
284
  &:hover:not([disabled]), &:active:not([disabled]) {
285
+ background: rgba(var(--zn-color-tab), 0.5);
286
+ }
287
+
288
+ &.button--icon-button-small {
289
+ width: 36px;
290
+ min-width: 36px;
291
+ }
292
+
293
+ // Round: 36x36 circle on the tab tint, muted icon by default
294
+ &.button--icon-button-round {
295
+ width: 36px;
296
+ min-width: 36px;
297
+ padding: 8px;
298
+ background: rgb(var(--zn-color-tab));
299
+ border-color: var(--zn-button-border-color, transparent) !important;
300
+ border-radius: var(--zn-border-radius-circle);
301
+
302
+ &:hover:not([disabled]), &:active:not([disabled]) {
303
+ background: rgb(var(--zn-color-border));
304
+ }
305
+ }
306
+
307
+ &.button--plain {
270
308
  background: transparent;
271
- color: var(--icon-button-hover-color);
309
+ border-color: var(--zn-button-border-color, transparent) !important;
310
+
311
+ &:hover:not([disabled]), &:active:not([disabled]) {
312
+ background: rgb(var(--zn-color-tab));
313
+ }
272
314
  }
273
- }
274
315
 
275
- .button--with-icon.button--icon-button {
276
- border: 0;
277
- margin: 0;
316
+ // `no-hover`: keep the resting background on hover/active
317
+ &.button--no-hover {
318
+ &:hover:not([disabled]), &:active:not([disabled]) {
319
+ background: rgb(var(--zn-panel));
320
+ }
321
+
322
+ &.button--plain:hover:not([disabled]), &.button--plain:active:not([disabled]) {
323
+ background: transparent;
324
+ }
325
+ }
326
+
327
+ &.button--has-notification::after {
328
+ --icon-inset: calc((100% - var(--notification-icon-size, 20px)) / 2);
329
+
330
+ top: calc(var(--icon-inset) - 4px);
331
+ inset-inline-end: calc(var(--icon-inset) - 4px);
332
+ transform: translate(50%, -50%);
333
+ }
278
334
  }
279
335
 
280
336
  .button--loading-bg {