@kubex/zinc 1.1.123 → 1.1.125

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.
@@ -29,7 +29,8 @@ Use the `placeholder` attribute to customize the input placeholder text.
29
29
 
30
30
  ### Help Text
31
31
 
32
- Add descriptive help text to guide users with the `help-text` attribute.
32
+ Use the `help-text` attribute to explain what can be searched. It shows an information icon inside the search field,
33
+ before the search icon, and reads out as a tooltip on hover or focus.
33
34
 
34
35
  ```html:preview
35
36
  <zn-data-table-search
@@ -404,7 +405,7 @@ The component is built with accessibility in mind:
404
405
  - Includes a visible trailing search icon for visual recognition
405
406
  - Supports keyboard navigation and clearing via the clearable input
406
407
  - Integrates with form validation and submission
407
- - Provides proper labeling through the help-text attribute
408
+ - Explains what is searchable through the help-text attribute, shown from an information icon
408
409
 
409
410
  ## Properties
410
411
 
@@ -413,7 +414,7 @@ The component is built with accessibility in mind:
413
414
  | `name` | `name` | `string` | `'search'` | The name of the search input field for form submission |
414
415
  | `value` | `value` | `string` | `''` | The current search value |
415
416
  | `placeholder` | `placeholder` | `string` | `'Search...'`| The placeholder text for the search input |
416
- | `helpText` | `help-text` | `string` | `''` | Help text displayed below the search input |
417
+ | `helpText` | `help-text` | `string` | `''` | Help text, shown from an information icon inside the search input |
417
418
  | `searchUri` | `search-uri` | `string` | `undefined` | Optional URI to use for search operations |
418
419
  | `debounceDelay`| `debounce-delay` | `number` | `350` | The delay in milliseconds before triggering a search after the user stops typing |
419
420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubex/zinc",
3
- "version": "1.1.123",
3
+ "version": "1.1.125",
4
4
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
5
5
  "keywords": [
6
6
  "web components",
@@ -204,8 +204,8 @@
204
204
  --zn-input-height-large: 40px; // 50px // 43.75px
205
205
 
206
206
  /* Input background colors */
207
- --zn-input-background-color: var(--zn-color-neutral-50);
208
- --zn-input-background-color-hover: var(--zn-color-neutral-100);
207
+ --zn-input-background-color: rgb(var(--zn-color-body));
208
+ --zn-input-background-color-hover: color-mix(in srgb, rgb(var(--zn-color-body)) 98%, black);
209
209
  --zn-input-background-color-focus: var(--zn-color-neutral-100);
210
210
  --zn-input-background-color-disabled: var(--zn-color-neutral-400);
211
211
 
@@ -112,7 +112,6 @@
112
112
  justify-content: center;
113
113
  width: var(--toggle-size);
114
114
  height: var(--toggle-size);
115
- box-shadow: var(--zn-shadow-x-small);
116
115
  border: solid var(--zn-input-border-width) var(--checkbox-border-color);
117
116
  background-color: var(--checkbox-bg-color);
118
117
  border-radius: var(--zn-border-radius-small);
@@ -227,7 +227,7 @@ table {
227
227
  display: flex;
228
228
  flex-direction: row;
229
229
  justify-content: space-between;
230
- align-items: flex-start;
230
+ align-items: center;
231
231
  padding: var(--zn-spacing-x-small) var(--zn-spacing-medium);
232
232
  gap: var(--zn-spacing-small);
233
233
 
@@ -246,20 +246,16 @@ table {
246
246
  &__caption {
247
247
  @include wc.text-style(h1);
248
248
 
249
- // Sits on the same 36px line as the controls opposite it
250
- line-height: 36px;
251
249
  margin: 0;
252
250
  overflow: hidden;
253
251
  white-space: nowrap;
254
252
  text-overflow: ellipsis;
255
253
  }
256
254
 
257
- // Controls are a uniform 36px, so topping them out keeps them on one line while
258
- // a search's help text grows the header downwards
259
255
  &__right {
260
256
  display: flex;
261
257
  flex-direction: row;
262
- align-items: flex-start;
258
+ align-items: center;
263
259
  gap: var(--zn-spacing-x-small);
264
260
  margin-left: auto;
265
261
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  // Fields inside a panel that already draws its own edge
4
4
  @mixin flush-input {
5
- --zn-input-box-shadow: none;
6
5
  --zn-input-background-color: transparent;
7
6
  --zn-input-background-color-hover: transparent;
8
7
  --zn-input-background-color-focus: transparent;
@@ -1,8 +1,9 @@
1
- import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
1
+ import {type CSSResultGroup, html, nothing, type PropertyValues, unsafeCSS} from 'lit';
2
2
  import {FormControlController, validValidityState} from "../../internal/form";
3
3
  import {property} from 'lit/decorators.js';
4
4
  import ZincElement, {type ZincFormControl} from '../../internal/zinc-element';
5
5
  import ZnInput from "../input";
6
+ import ZnTooltip from "../tooltip";
6
7
  import type ZnDataSelect from "../data-select";
7
8
  import type ZnQueryBuilder from "../query-builder";
8
9
  import type ZnSelect from "../select";
@@ -25,6 +26,7 @@ type AllowedInputElement =
25
26
  * @since 1.0
26
27
  *
27
28
  * @dependency zn-input
29
+ * @dependency zn-tooltip
28
30
  *
29
31
  * @event zn-search-change - Emitted when the search value changes (debounced).
30
32
  *
@@ -35,7 +37,7 @@ type AllowedInputElement =
35
37
  * @property {string} name - The name of the search input field (default: "search").
36
38
  * @property {string} value - The current search value.
37
39
  * @property {string} placeholder - The placeholder text for the search input (default: "Search...").
38
- * @property {string} helpText - Help text displayed below the search input.
40
+ * @property {string} helpText - Help text, shown from an information icon inside the search input.
39
41
  * @property {string} searchUri - Optional URI to use for search operations.
40
42
  * @property {number} debounceDelay - The delay in milliseconds before triggering a search (default: 500).
41
43
  */
@@ -43,6 +45,7 @@ export default class ZnDataTableSearch extends ZincElement implements ZincFormCo
43
45
  static styles: CSSResultGroup = unsafeCSS(styles);
44
46
  static dependencies = {
45
47
  'zn-input': ZnInput,
48
+ 'zn-tooltip': ZnTooltip,
46
49
  };
47
50
 
48
51
  private _formController: FormControlController = new FormControlController(this, {});
@@ -187,6 +190,10 @@ export default class ZnDataTableSearch extends ZincElement implements ZincFormCo
187
190
  clearable
188
191
  @zn-input="${this.handleInput}"
189
192
  @zn-clear="${this.handleClear}">
193
+ ${this.helpText ? html`
194
+ <zn-tooltip slot="suffix" class="data-table-search__tooltip" content="${this.helpText}">
195
+ <zn-icon src="info@lu" size="20"></zn-icon>
196
+ </zn-tooltip>` : nothing}
190
197
  <zn-icon slot="suffix" src="search@lu" size="20"></zn-icon>
191
198
  </zn-input>
192
199
  <slot style="display: none"></slot>
@@ -11,12 +11,36 @@
11
11
  min-width: 200px;
12
12
  }
13
13
 
14
- // Flush so the input box is exactly the 36px control height the toolbar tops align on
14
+ // Keeps the focus ring inside the component's own box, so a toolbar or header that
15
+ // hugs the input can't clip it
15
16
  zn-input::part(form-control-input) {
16
- margin: 0;
17
+ margin: var(--zn-focus-ring-width);
17
18
  }
18
19
 
20
+ // The help text is shown from the info icon instead, but zn-input still points the
21
+ // input's aria-describedby at it, so hide it rather than dropping it
19
22
  zn-input::part(form-control-help-text) {
20
- font-size: var(--zn-input-help-text-font-size-small);
21
- padding-left: var(--zn-spacing-2x-small);
23
+ position: absolute;
24
+ width: 1px;
25
+ height: 1px;
26
+ overflow: hidden;
27
+ clip-path: inset(50%);
28
+ }
29
+
30
+ // zn-input pads the clear button out to 1em + 2 * --zn-input-spacing-medium, which
31
+ // leaves it sitting further from its neighbour than the suffix icons are from theirs
32
+ zn-input::part(clear-button) {
33
+ width: auto;
34
+ margin-inline-end: var(--zn-spacing-small);
35
+ }
36
+
37
+ // Slotted into the input's suffix, out of reach of zn-input's own icon rules
38
+ .data-table-search__tooltip {
39
+ display: flex;
40
+ align-items: center;
41
+
42
+ zn-icon {
43
+ color: var(--zn-input-icon-color);
44
+ cursor: help;
45
+ }
22
46
  }
@@ -12,7 +12,6 @@
12
12
  justify-content: start;
13
13
  position: relative;
14
14
  width: 100%;
15
- box-shadow: var(--zn-shadow-x-small);
16
15
  font-family: var(--zn-input-font-family), sans-serif;
17
16
  font-weight: var(--zn-input-font-weight);
18
17
  letter-spacing: var(--zn-input-letter-spacing);
@@ -131,6 +131,8 @@
131
131
  flex-grow: 1;
132
132
  flex-shrink: 1;
133
133
  overflow-x: clip;
134
+ // Enough slack for a focused control's ring to sit outside its box uncut
135
+ overflow-clip-margin: var(--zn-focus-ring-width);
134
136
  overflow-y: visible;
135
137
  min-width: 20px;
136
138
  }
@@ -68,7 +68,6 @@ import styles from './input.scss';
68
68
  * @csspart password-toggle-button - The password toggle button.
69
69
  * @csspart suffix - The container that wraps the suffix.
70
70
  *
71
- * @cssproperty --zn-input-box-shadow - Shadow cast by the field; set to `none` inside a panel that draws its own edge.
72
71
  * @cssproperty --zn-range-track-height - The height of a range input's track.
73
72
  * @cssproperty --zn-range-track-color - The color of a range input's track.
74
73
  * @cssproperty --zn-range-thumb-size - The diameter of a range input's thumb.
@@ -1064,7 +1063,7 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
1064
1063
  @click=${this.handleClearClick}
1065
1064
  tabindex="-1">
1066
1065
  <slot name="clear-icon">
1067
- <zn-icon src="cancel"></zn-icon>
1066
+ <zn-icon src="circle-x@lu" size="20"></zn-icon>
1068
1067
  </slot>
1069
1068
  </button>`
1070
1069
  : ''}
@@ -11,7 +11,6 @@
11
11
  justify-content: start;
12
12
  position: relative;
13
13
  width: 100%;
14
- box-shadow: var(--zn-input-box-shadow, var(--zn-shadow-x-small));
15
14
  font-family: var(--zn-input-font-family), sans-serif;
16
15
  font-weight: var(--zn-input-font-weight);
17
16
  letter-spacing: var(--zn-input-letter-spacing);
@@ -55,7 +55,6 @@
55
55
  justify-content: center;
56
56
  width: var(--toggle-size);
57
57
  height: var(--toggle-size);
58
- box-shadow: var(--zn-shadow-x-small);
59
58
  border: solid var(--zn-input-border-width) var(--zn-input-border-color);
60
59
  border-radius: 50%;
61
60
  background-color: var(--zn-input-background-color);
@@ -1934,7 +1934,7 @@ export default class ZnSelect extends ZincElement implements ZincFormControl {
1934
1934
  @click=${this.handleClearClick}
1935
1935
  tabindex="-1">
1936
1936
  <slot name="clear-icon">
1937
- <zn-icon src="cancel"></zn-icon>
1937
+ <zn-icon src="circle-x@lu" size="20"></zn-icon>
1938
1938
  </slot>
1939
1939
  </button>`
1940
1940
  : ''}
@@ -37,7 +37,6 @@
37
37
  font-family: var(--zn-input-font-family);
38
38
  font-weight: var(--zn-input-font-weight);
39
39
  letter-spacing: var(--zn-input-letter-spacing);
40
- box-shadow: var(--zn-shadow-x-small);
41
40
  vertical-align: middle;
42
41
  overflow: hidden;
43
42
  cursor: pointer;
@@ -15,7 +15,6 @@
15
15
  align-items: center;
16
16
  position: relative;
17
17
  width: 100%;
18
- box-shadow: var(--zn-shadow-x-small);
19
18
  font-family: var(--zn-input-font-family);
20
19
  font-weight: var(--zn-input-font-weight);
21
20
  line-height: var(--zn-line-height-normal);
@@ -78,7 +77,6 @@
78
77
  color: var(--zn-input-color);
79
78
  border: none;
80
79
  background: none;
81
- box-shadow: var(--zn-shadow-x-small);
82
80
  cursor: inherit;
83
81
  -webkit-appearance: none;
84
82
  height: 100%;
@@ -102,8 +102,6 @@
102
102
  height: 20.32px;
103
103
  border-radius: 50%;
104
104
  background: #fff;
105
- box-shadow: 0 2px 4px 0 rgba(var(--zn-color-text), 0.1);
106
-
107
105
  transform: translateY(-50%);
108
106
  transition: left .3s ease-in-out, background-color .4s ease-in-out;
109
107
  outline: none;