@kubex/zinc 1.1.122 → 1.1.124

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.122",
3
+ "version": "1.1.124",
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",
@@ -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,7 +11,36 @@
11
11
  min-width: 200px;
12
12
  }
13
13
 
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
16
+ zn-input::part(form-control-input) {
17
+ margin: var(--zn-focus-ring-width);
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
14
22
  zn-input::part(form-control-help-text) {
15
- font-size: var(--zn-input-help-text-font-size-small);
16
- 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
+ }
17
46
  }
@@ -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
  }
@@ -1064,7 +1064,7 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
1064
1064
  @click=${this.handleClearClick}
1065
1065
  tabindex="-1">
1066
1066
  <slot name="clear-icon">
1067
- <zn-icon src="cancel"></zn-icon>
1067
+ <zn-icon src="circle-x@lu" size="20"></zn-icon>
1068
1068
  </slot>
1069
1069
  </button>`
1070
1070
  : ''}
@@ -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
  : ''}