@zanichelli/albe-web-components 19.2.6 → 19.2.8-RC1
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/CHANGELOG.md +10 -0
- package/dist/cjs/index-D_S5lGcb.js +4 -4
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-Ctc6JP2n.js → utils-BY7xrW7W.js} +6 -0
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-alert.cjs.entry.js +1 -1
- package/dist/cjs/z-app-header_12.cjs.entry.js +141 -211
- package/dist/cjs/z-book-card-deprecated.cjs.entry.js +1 -1
- package/dist/cjs/z-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/z-color-picker.cjs.entry.js +1 -1
- package/dist/cjs/z-combobox.cjs.entry.js +7 -5
- package/dist/cjs/z-menu.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-alert.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-dictionary.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-footer-sections.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-footer.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-icon.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-info.cjs.entry.js +2 -2
- package/dist/cjs/z-myz-card-list.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card_4.cjs.entry.js +4 -4
- package/dist/cjs/z-myz-list-item.cjs.entry.js +2 -2
- package/dist/cjs/z-myz-list.cjs.entry.js +1 -1
- package/dist/cjs/z-otp.cjs.entry.js +2 -2
- package/dist/cjs/z-popover.cjs.entry.js +1 -1
- package/dist/cjs/z-select.cjs.entry.js +4 -8
- package/dist/cjs/z-skip-to-content.cjs.entry.js +2 -2
- package/dist/cjs/z-slideshow.cjs.entry.js +1 -1
- package/dist/cjs/z-stepper-item.cjs.entry.js +1 -1
- package/dist/cjs/z-stepper.cjs.entry.js +1 -1
- package/dist/cjs/z-table.cjs.entry.js +1 -1
- package/dist/cjs/z-td.cjs.entry.js +3 -3
- package/dist/cjs/z-th.cjs.entry.js +5 -3
- package/dist/cjs/z-toast-notification-list.cjs.entry.js +1 -1
- package/dist/cjs/z-toast-notification.cjs.entry.js +95 -34
- package/dist/cjs/z-toggle-button.cjs.entry.js +2 -2
- package/dist/cjs/z-toggle-switch.cjs.entry.js +4 -4
- package/dist/cjs/z-tool.cjs.entry.js +3 -3
- package/dist/cjs/z-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/z-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/z-tr.cjs.entry.js +1 -1
- package/dist/collection/components/css-components/z-scrollbar/styles.css +40 -0
- package/dist/collection/components/table/cells/{z-td/styles.css → z-table-cells.css} +0 -1
- package/dist/collection/components/table/cells/z-td/index.js +3 -3
- package/dist/collection/components/table/cells/z-th/index.js +3 -3
- package/dist/collection/components/table/cells/z-th/styles.css +0 -72
- package/dist/collection/components/z-app-header/index.js +21 -2
- package/dist/collection/components/z-app-header/index.stories.js +25 -9
- package/dist/collection/components/z-combobox/index.js +5 -5
- package/dist/collection/components/z-combobox/styles.css +0 -12
- package/dist/collection/components/z-input/index.js +51 -32
- package/dist/collection/components/z-input/styles-checkbox-radio.css +130 -0
- package/dist/collection/components/z-input/styles-general.css +166 -0
- package/dist/collection/components/z-input/styles-text.css +87 -0
- package/dist/collection/components/z-input/styles-textarea.css +19 -0
- package/dist/collection/components/z-searchbar/index.js +133 -193
- package/dist/collection/components/z-searchbar/index.stories.js +12 -16
- package/dist/collection/components/z-searchbar/styles.css +87 -201
- package/dist/collection/components/z-select/index.js +4 -8
- package/dist/collection/components/z-skip-to-content/index.js +1 -1
- package/dist/collection/components/z-stepper/index.js +1 -1
- package/dist/collection/components/z-stepper-item/index.js +1 -1
- package/dist/collection/components/z-toast-notification/index.js +3 -3
- package/dist/collection/components/z-toast-notification-list/index.js +1 -1
- package/dist/collection/components/z-toggle-button/index.js +2 -2
- package/dist/collection/components/z-toggle-switch/index.js +3 -3
- package/dist/collection/components/z-tool/index.js +2 -2
- package/dist/collection/components/z-toolbar/index.js +1 -1
- package/dist/collection/components/z-tooltip/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-alert/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-body/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-cover/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-dictionary/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-footer/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-footer-sections/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-header/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-icon/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-info/index.js +1 -1
- package/dist/collection/snowflakes/myz/card/z-myz-card-list/index.js +1 -1
- package/dist/collection/snowflakes/myz/list/z-myz-list/index.js +1 -1
- package/dist/collection/snowflakes/myz/list/z-myz-list-item/index.js +1 -1
- package/dist/collection/snowflakes/myz/z-alert/index.js +1 -1
- package/dist/collection/snowflakes/myz/z-otp/index.js +2 -2
- package/dist/collection/utils/utils.js +5 -0
- package/dist/components/index13.js +1 -1
- package/dist/components/index17.js +1 -1
- package/dist/components/index22.js +1 -1
- package/dist/components/index23.js +1 -1
- package/dist/components/index24.js +1 -1
- package/dist/components/index25.js +1 -1
- package/dist/components/index26.js +1 -1
- package/dist/components/index27.js +1 -1
- package/dist/components/index4.js +1 -1
- package/dist/components/index7.js +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/components/z-app-header.js +1 -1
- package/dist/components/z-combobox.js +1 -1
- package/dist/components/z-myz-card-alert.js +1 -1
- package/dist/components/z-myz-card-dictionary.js +1 -1
- package/dist/components/z-myz-card-footer-sections.js +1 -1
- package/dist/components/z-myz-card-footer.js +1 -1
- package/dist/components/z-myz-card-icon.js +1 -1
- package/dist/components/z-myz-card-info.js +1 -1
- package/dist/components/z-myz-card-list.js +1 -1
- package/dist/components/z-myz-list.js +1 -1
- package/dist/components/z-otp.js +1 -1
- package/dist/components/z-select.js +1 -1
- package/dist/components/z-skip-to-content.js +1 -1
- package/dist/components/z-slideshow.js +1 -1
- package/dist/components/z-stepper-item.js +1 -1
- package/dist/components/z-stepper.js +1 -1
- package/dist/components/z-td.js +1 -1
- package/dist/components/z-th.js +1 -1
- package/dist/components/z-toast-notification-list.js +1 -1
- package/dist/components/z-toast-notification.js +1 -1
- package/dist/components/z-toggle-button.js +1 -1
- package/dist/components/z-toggle-switch.js +1 -1
- package/dist/components/z-tool.js +1 -1
- package/dist/components/z-toolbar.js +1 -1
- package/dist/esm/index-DPdXlnVe.js +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-0PByxJyN.js → utils-BEzZQwOB.js} +7 -2
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-alert.entry.js +1 -1
- package/dist/esm/z-app-header_12.entry.js +142 -212
- package/dist/esm/z-book-card-deprecated.entry.js +1 -1
- package/dist/esm/z-breadcrumb.entry.js +1 -1
- package/dist/esm/z-color-picker.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +7 -5
- package/dist/esm/z-menu.entry.js +1 -1
- package/dist/esm/z-myz-card-alert.entry.js +1 -1
- package/dist/esm/z-myz-card-dictionary.entry.js +1 -1
- package/dist/esm/z-myz-card-footer-sections.entry.js +1 -1
- package/dist/esm/z-myz-card-footer.entry.js +1 -1
- package/dist/esm/z-myz-card-icon.entry.js +1 -1
- package/dist/esm/z-myz-card-info.entry.js +2 -2
- package/dist/esm/z-myz-card-list.entry.js +1 -1
- package/dist/esm/z-myz-card_4.entry.js +4 -4
- package/dist/esm/z-myz-list-item.entry.js +2 -2
- package/dist/esm/z-myz-list.entry.js +1 -1
- package/dist/esm/z-otp.entry.js +2 -2
- package/dist/esm/z-popover.entry.js +1 -1
- package/dist/esm/z-select.entry.js +4 -8
- package/dist/esm/z-skip-to-content.entry.js +2 -2
- package/dist/esm/z-slideshow.entry.js +1 -1
- package/dist/esm/z-stepper-item.entry.js +1 -1
- package/dist/esm/z-stepper.entry.js +1 -1
- package/dist/esm/z-table.entry.js +1 -1
- package/dist/esm/z-td.entry.js +3 -3
- package/dist/esm/z-th.entry.js +5 -3
- package/dist/esm/z-toast-notification-list.entry.js +1 -1
- package/dist/esm/z-toast-notification.entry.js +95 -34
- package/dist/esm/z-toggle-button.entry.js +2 -2
- package/dist/esm/z-toggle-switch.entry.js +4 -4
- package/dist/esm/z-tool.entry.js +3 -3
- package/dist/esm/z-toolbar.entry.js +1 -1
- package/dist/esm/z-tooltip.entry.js +1 -1
- package/dist/esm/z-tr.entry.js +1 -1
- package/dist/types/components/z-app-header/index.d.ts +4 -0
- package/dist/types/components/z-app-header/index.stories.d.ts +7 -0
- package/dist/types/components/z-input/index.d.ts +6 -4
- package/dist/types/components/z-searchbar/index.d.ts +26 -28
- package/dist/types/components/z-searchbar/index.stories.d.ts +4 -0
- package/dist/types/components/z-select/index.d.ts +0 -1
- package/dist/types/components.d.ts +46 -17
- package/dist/types/utils/utils.d.ts +2 -0
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-19d3a16b.entry.js → p-0105149a.entry.js} +1 -1
- package/dist/web-components-library/p-0da8eae7.entry.js +1 -0
- package/dist/web-components-library/{p-5fa910e4.entry.js → p-13e7f751.entry.js} +1 -1
- package/dist/web-components-library/{p-45866f64.entry.js → p-1580db58.entry.js} +1 -1
- package/dist/web-components-library/{p-eed4e897.entry.js → p-20d94cce.entry.js} +1 -1
- package/dist/web-components-library/{p-2ce3ac48.entry.js → p-271dfd9c.entry.js} +1 -1
- package/dist/web-components-library/{p-e2d94c86.entry.js → p-2abf765d.entry.js} +1 -1
- package/dist/web-components-library/{p-5b9cacd7.entry.js → p-2df6d169.entry.js} +1 -1
- package/dist/web-components-library/{p-de0b7109.entry.js → p-313fc91d.entry.js} +1 -1
- package/dist/web-components-library/p-41584e90.entry.js +1 -0
- package/dist/web-components-library/p-4a434f6e.entry.js +1 -0
- package/dist/web-components-library/{p-7a9d19b8.entry.js → p-4d1b3d16.entry.js} +1 -1
- package/dist/web-components-library/p-53670be4.entry.js +1 -0
- package/dist/web-components-library/{p-538a1bd2.entry.js → p-5d20fc3d.entry.js} +1 -1
- package/dist/web-components-library/p-61992f12.entry.js +1 -0
- package/dist/web-components-library/{p-d11d39f5.entry.js → p-62d2247e.entry.js} +1 -1
- package/dist/web-components-library/{p-7d9477ed.entry.js → p-64c025f6.entry.js} +1 -1
- package/dist/web-components-library/{p-364b0ca4.entry.js → p-658f022d.entry.js} +1 -1
- package/dist/web-components-library/{p-6fb8a984.entry.js → p-660737b0.entry.js} +1 -1
- package/dist/web-components-library/p-7371a543.entry.js +2 -0
- package/dist/web-components-library/{p-f94c360f.entry.js → p-788eaac7.entry.js} +1 -1
- package/dist/web-components-library/{p-c6ae9241.entry.js → p-88a3ba7c.entry.js} +1 -1
- package/{www/build/p-c6920758.entry.js → dist/web-components-library/p-89daaeb5.entry.js} +1 -1
- package/dist/web-components-library/p-B0bOjMSb.js +1 -0
- package/dist/web-components-library/{p-f5bbcaa6.entry.js → p-a4f673f8.entry.js} +1 -1
- package/{www/build/p-4ae7df7f.entry.js → dist/web-components-library/p-b01ff8e6.entry.js} +1 -1
- package/dist/web-components-library/{p-2d6a4515.entry.js → p-b6223d7e.entry.js} +1 -1
- package/dist/web-components-library/{p-7835fdda.entry.js → p-b9343431.entry.js} +1 -1
- package/dist/web-components-library/{p-c539ae57.entry.js → p-c42ddd93.entry.js} +1 -1
- package/{www/build/p-eadf2552.entry.js → dist/web-components-library/p-c4e7bd16.entry.js} +1 -1
- package/dist/web-components-library/{p-3f996a63.entry.js → p-c944a943.entry.js} +1 -1
- package/dist/web-components-library/{p-19f5fdd3.entry.js → p-cd33f4b1.entry.js} +1 -1
- package/dist/web-components-library/{p-a40ae683.entry.js → p-ce3bbaf2.entry.js} +1 -1
- package/dist/web-components-library/p-d121122f.entry.js +1 -0
- package/dist/web-components-library/p-dc5ab2cc.entry.js +1 -0
- package/dist/web-components-library/{p-91503030.entry.js → p-ef5018bb.entry.js} +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +5 -4
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-19d3a16b.entry.js → p-0105149a.entry.js} +1 -1
- package/www/build/p-0da8eae7.entry.js +1 -0
- package/www/build/{p-5fa910e4.entry.js → p-13e7f751.entry.js} +1 -1
- package/www/build/{p-45866f64.entry.js → p-1580db58.entry.js} +1 -1
- package/www/build/{p-eed4e897.entry.js → p-20d94cce.entry.js} +1 -1
- package/www/build/{p-2ce3ac48.entry.js → p-271dfd9c.entry.js} +1 -1
- package/www/build/{p-e2d94c86.entry.js → p-2abf765d.entry.js} +1 -1
- package/www/build/{p-5b9cacd7.entry.js → p-2df6d169.entry.js} +1 -1
- package/www/build/{p-de0b7109.entry.js → p-313fc91d.entry.js} +1 -1
- package/www/build/p-41584e90.entry.js +1 -0
- package/www/build/p-4a434f6e.entry.js +1 -0
- package/www/build/{p-7a9d19b8.entry.js → p-4d1b3d16.entry.js} +1 -1
- package/www/build/p-53670be4.entry.js +1 -0
- package/www/build/{p-538a1bd2.entry.js → p-5d20fc3d.entry.js} +1 -1
- package/www/build/p-61992f12.entry.js +1 -0
- package/www/build/{p-d11d39f5.entry.js → p-62d2247e.entry.js} +1 -1
- package/www/build/{p-7d9477ed.entry.js → p-64c025f6.entry.js} +1 -1
- package/www/build/{p-364b0ca4.entry.js → p-658f022d.entry.js} +1 -1
- package/www/build/{p-6fb8a984.entry.js → p-660737b0.entry.js} +1 -1
- package/www/build/p-7371a543.entry.js +2 -0
- package/www/build/{p-f94c360f.entry.js → p-788eaac7.entry.js} +1 -1
- package/www/build/{p-c6ae9241.entry.js → p-88a3ba7c.entry.js} +1 -1
- package/{dist/web-components-library/p-c6920758.entry.js → www/build/p-89daaeb5.entry.js} +1 -1
- package/www/build/p-B0bOjMSb.js +1 -0
- package/www/build/{p-f5bbcaa6.entry.js → p-a4f673f8.entry.js} +1 -1
- package/{dist/web-components-library/p-4ae7df7f.entry.js → www/build/p-b01ff8e6.entry.js} +1 -1
- package/www/build/{p-2d6a4515.entry.js → p-b6223d7e.entry.js} +1 -1
- package/www/build/{p-804ab9a4.js → p-b82f3aad.js} +1 -1
- package/www/build/{p-7835fdda.entry.js → p-b9343431.entry.js} +1 -1
- package/www/build/{p-c539ae57.entry.js → p-c42ddd93.entry.js} +1 -1
- package/{dist/web-components-library/p-eadf2552.entry.js → www/build/p-c4e7bd16.entry.js} +1 -1
- package/www/build/{p-3f996a63.entry.js → p-c944a943.entry.js} +1 -1
- package/www/build/{p-19f5fdd3.entry.js → p-cd33f4b1.entry.js} +1 -1
- package/www/build/{p-a40ae683.entry.js → p-ce3bbaf2.entry.js} +1 -1
- package/www/build/p-d121122f.entry.js +1 -0
- package/www/build/p-dc5ab2cc.entry.js +1 -0
- package/www/build/{p-91503030.entry.js → p-ef5018bb.entry.js} +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/collection/components/z-input/styles.css +0 -406
- package/dist/web-components-library/p-32440f4c.entry.js +0 -1
- package/dist/web-components-library/p-550ee6c3.entry.js +0 -1
- package/dist/web-components-library/p-8fd25c59.entry.js +0 -2
- package/dist/web-components-library/p-D4yqZKyM.js +0 -1
- package/dist/web-components-library/p-a9f848ef.entry.js +0 -1
- package/dist/web-components-library/p-ab50e989.entry.js +0 -1
- package/dist/web-components-library/p-ae69bb7d.entry.js +0 -1
- package/dist/web-components-library/p-f3436721.entry.js +0 -1
- package/dist/web-components-library/p-fc15a666.entry.js +0 -1
- package/www/build/p-32440f4c.entry.js +0 -1
- package/www/build/p-550ee6c3.entry.js +0 -1
- package/www/build/p-8fd25c59.entry.js +0 -2
- package/www/build/p-D4yqZKyM.js +0 -1
- package/www/build/p-a9f848ef.entry.js +0 -1
- package/www/build/p-ab50e989.entry.js +0 -1
- package/www/build/p-ae69bb7d.entry.js +0 -1
- package/www/build/p-f3436721.entry.js +0 -1
- package/www/build/p-fc15a666.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
|
2
|
-
import { ButtonVariant, ControlSize,
|
|
3
|
-
import {
|
|
2
|
+
import { ButtonVariant, ControlSize, KeyboardCode, } from "../../beans";
|
|
3
|
+
import { handleEnterKeydSubmit, randomId } from "../../utils/utils";
|
|
4
4
|
/**
|
|
5
5
|
* @cssprop --z-searchbar-results-height - Max height of the results container (default: 540px)
|
|
6
6
|
* @cssprop --z-searchbar-tag-text-color - Color of tag's text (default --color-primary03);
|
|
@@ -8,7 +8,7 @@ import { getDevice, handleEnterKeydSubmit, randomId } from "../../utils/utils";
|
|
|
8
8
|
*/
|
|
9
9
|
export class ZSearchbar {
|
|
10
10
|
constructor() {
|
|
11
|
-
/**
|
|
11
|
+
/** The id of the searchbar element */
|
|
12
12
|
this.htmlid = `searchbar-${randomId()}`;
|
|
13
13
|
/** Prevent submit action */
|
|
14
14
|
this.preventSubmit = false;
|
|
@@ -22,30 +22,28 @@ export class ZSearchbar {
|
|
|
22
22
|
this.sortResultsItems = false;
|
|
23
23
|
/** Show submit button */
|
|
24
24
|
this.showSearchButton = false;
|
|
25
|
-
/**
|
|
25
|
+
/** Hide the label of the submit button, showing only the icon */
|
|
26
26
|
this.searchButtonIconOnly = false;
|
|
27
|
-
/**
|
|
27
|
+
/** The label of the submit button */
|
|
28
|
+
this.searchButtonLabel = "CERCA";
|
|
29
|
+
/** Size of the `z-input` and submit `z-button` */
|
|
28
30
|
this.size = ControlSize.BIG;
|
|
29
|
-
/**
|
|
31
|
+
/** Submit `z-button` variant */
|
|
30
32
|
this.variant = ButtonVariant.PRIMARY;
|
|
31
33
|
this.searchString = this.value;
|
|
32
|
-
this.currResultsCount =
|
|
34
|
+
this.currResultsCount = this.resultsCount;
|
|
33
35
|
this.showResults = false;
|
|
34
36
|
this.isMobile = false;
|
|
35
37
|
this.resultsItemsList = null;
|
|
36
|
-
this.items = [];
|
|
37
|
-
}
|
|
38
|
-
emitSearchSubmit() {
|
|
39
|
-
this.searchSubmit.emit(this.inputRef.value);
|
|
40
|
-
}
|
|
41
|
-
emitSearchTyping(search) {
|
|
42
|
-
this.searchTyping.emit(search);
|
|
43
38
|
}
|
|
44
39
|
emitSearchItemClick(item) {
|
|
45
40
|
this.searchItemClick.emit(item);
|
|
46
41
|
this.selectedItem = item;
|
|
47
42
|
this.searchString = "";
|
|
48
43
|
}
|
|
44
|
+
emitSearchSubmit() {
|
|
45
|
+
this.searchSubmit.emit(this.inputRef.value);
|
|
46
|
+
}
|
|
49
47
|
watchItems() {
|
|
50
48
|
this.resultsItemsList = this.getResultsItemsList();
|
|
51
49
|
}
|
|
@@ -56,42 +54,17 @@ export class ZSearchbar {
|
|
|
56
54
|
this.searchString = this.value;
|
|
57
55
|
}
|
|
58
56
|
watchSearchString() {
|
|
59
|
-
this.
|
|
60
|
-
this.items = [];
|
|
57
|
+
this.searchTyping.emit(this.searchString);
|
|
61
58
|
if (!this.searchString) {
|
|
62
59
|
this.currResultsCount = this.resultsCount;
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
watchShowResults() {
|
|
66
|
-
if (!this.showResults) {
|
|
67
|
-
this.items = [];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
disconnectedCallback() {
|
|
71
|
-
var _a;
|
|
72
|
-
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
73
|
-
}
|
|
74
|
-
componentDidLoad() {
|
|
75
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
76
|
-
if (getDevice() === Device.MOBILE && !this.isMobile) {
|
|
77
|
-
this.isMobile = true;
|
|
78
|
-
}
|
|
79
|
-
if (getDevice() !== Device.MOBILE && this.isMobile) {
|
|
80
|
-
this.isMobile = false;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
this.resizeObserver.observe(this.element);
|
|
84
|
-
}
|
|
85
|
-
componentWillLoad() {
|
|
86
|
-
this.resultsItemsList = this.getResultsItemsList();
|
|
87
|
-
this.currResultsCount = this.resultsCount;
|
|
88
|
-
}
|
|
89
62
|
getResultsItemsList() {
|
|
90
63
|
return typeof this.resultsItems === "string" ? JSON.parse(this.resultsItems) : this.resultsItems;
|
|
91
64
|
}
|
|
92
|
-
getGroupedItems(
|
|
65
|
+
getGroupedItems() {
|
|
93
66
|
const groupedItems = {};
|
|
94
|
-
|
|
67
|
+
this.resultsItemsList.forEach((item) => {
|
|
95
68
|
var _a;
|
|
96
69
|
const key = `${item === null || item === void 0 ? void 0 : item.category}${item === null || item === void 0 ? void 0 : item.subcategory}`;
|
|
97
70
|
groupedItems[key] = (_a = groupedItems[key]) !== null && _a !== void 0 ? _a : {
|
|
@@ -121,148 +94,77 @@ export class ZSearchbar {
|
|
|
121
94
|
}
|
|
122
95
|
return groupedItems;
|
|
123
96
|
}
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
handleStopTyping(e) {
|
|
131
|
-
e.stopPropagation();
|
|
132
|
-
this.searchString = e.detail.value;
|
|
133
|
-
if (this.selectedItem) {
|
|
134
|
-
this.selectedItem = undefined;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
handleSubmit() {
|
|
138
|
-
if (this.preventSubmit) {
|
|
97
|
+
onListItemKeyDown(e, item) {
|
|
98
|
+
if (e.key === KeyboardCode.ENTER) {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
this.emitSearchItemClick(item);
|
|
139
101
|
return;
|
|
140
102
|
}
|
|
141
|
-
this.
|
|
103
|
+
this.handleArrowsNavigation(e);
|
|
142
104
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.showResults = false;
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (cp.find((elem) => { var _a; return (elem === null || elem === void 0 ? void 0 : elem.nodeName) === "Z-INPUT" || ((_a = elem === null || elem === void 0 ? void 0 : elem.classList) === null || _a === void 0 ? void 0 : _a.contains("results")); })) {
|
|
151
|
-
this.showResults = true;
|
|
105
|
+
onSearchHelperKeyDown(e) {
|
|
106
|
+
if (e.key === KeyboardCode.ENTER) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
this.emitSearchSubmit();
|
|
152
109
|
return;
|
|
153
110
|
}
|
|
154
|
-
this.
|
|
155
|
-
}
|
|
156
|
-
renderInput() {
|
|
157
|
-
var _a;
|
|
158
|
-
return (h("z-input", { ref: (val) => {
|
|
159
|
-
this.inputRef = val;
|
|
160
|
-
}, htmlid: `input-${this.htmlid}`, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => {
|
|
161
|
-
handleEnterKeydSubmit(e, () => this.handleSubmit());
|
|
162
|
-
this.handleArrowsNavigation(e);
|
|
163
|
-
}, value: this.searchString || ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.label), size: this.size, label: this.label, "aria-label": this.htmlAriaLabel || this.placeholder }));
|
|
164
|
-
}
|
|
165
|
-
renderButton() {
|
|
166
|
-
if (!this.showSearchButton) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
|
|
170
|
-
const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
|
|
171
|
-
const ariaLabel = this.searchButtonIconOnly ? { "aria-label": "CERCA" } : null;
|
|
172
|
-
const defaultProps = Object.assign(Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp), ariaLabel);
|
|
173
|
-
return h("z-button", Object.assign({}, defaultProps), buttonLabel);
|
|
174
|
-
}
|
|
175
|
-
renderResults() {
|
|
176
|
-
if (!this.showResults ||
|
|
177
|
-
!this.autocomplete ||
|
|
178
|
-
!this.searchString ||
|
|
179
|
-
this.searchString.length < this.autocompleteMinChars ||
|
|
180
|
-
!this.resultsItemsList) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
return (h("div", { class: "results-wrapper" }, h("div", { class: "results" }, this.renderResultsList())));
|
|
184
|
-
}
|
|
185
|
-
renderResultsList() {
|
|
186
|
-
var _a, _b;
|
|
187
|
-
if (this.preventSubmit && !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
188
|
-
return (h("span", { class: "item item-no-results" }, "Non abbiamo trovato risultati per ", h("b", null, this.searchString), h("br", null), h("br", null), "Cosa puoi fare?", h("ul", null, h("li", null, "Verificare di aver scritto bene"), h("li", null, "Provare a cercare un'altra parola"), h("li", null, "Provare a cercare qualcosa di pi\u00F9 generico"))));
|
|
189
|
-
}
|
|
190
|
-
return (h("z-list", { role: "listbox", id: `list-${this.htmlid}`, "aria-label": this.htmlAriaLabel || this.label }, this.renderSearchHelper(!!((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)), this.renderItems(), this.renderShowAllResults()));
|
|
191
|
-
}
|
|
192
|
-
renderItems() {
|
|
193
|
-
var _a;
|
|
194
|
-
if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
const groupedItems = this.getGroupedItems(this.resultsItemsList);
|
|
198
|
-
const listGroups = [];
|
|
199
|
-
let counter = 0;
|
|
200
|
-
Object.values(groupedItems).forEach((groupItem, index, array) => {
|
|
201
|
-
if (this.checkResultsCount(counter)) {
|
|
202
|
-
const listGroupsElements = [];
|
|
203
|
-
groupItem.items.forEach((item, subindex, subarray) => {
|
|
204
|
-
if (this.checkResultsCount(counter)) {
|
|
205
|
-
const isLast = index === array.length - 1 && subindex === subarray.length - 1;
|
|
206
|
-
listGroupsElements.push(this.renderItem(item, subindex, !isLast));
|
|
207
|
-
}
|
|
208
|
-
counter++;
|
|
209
|
-
});
|
|
210
|
-
if (listGroupsElements.length) {
|
|
211
|
-
listGroups.push(h("z-list-group", { "divider-type": ListDividerType.ELEMENT }, this.renderItemCategory(groupItem), listGroupsElements));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
return listGroups;
|
|
111
|
+
this.handleArrowsNavigation(e);
|
|
216
112
|
}
|
|
217
113
|
handleArrowsNavigation(e) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (!arrows.includes(e.key)) {
|
|
221
|
-
e.preventDefault();
|
|
114
|
+
var _a, _b, _c, _d, _e, _f;
|
|
115
|
+
if (![KeyboardCode.ARROW_DOWN, KeyboardCode.ARROW_UP].includes(e.key)) {
|
|
222
116
|
return;
|
|
223
117
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
this.items = Array.from(list.querySelectorAll(".list-element"));
|
|
230
|
-
}
|
|
231
|
-
this.items.forEach((item) => {
|
|
232
|
-
item.classList.toggle("focused", false);
|
|
233
|
-
});
|
|
234
|
-
const currentIndex = this.items.indexOf(currentElement);
|
|
118
|
+
const currentElement = e.target;
|
|
119
|
+
const items = Array.from((_b = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("z-list .list-item")) !== null && _b !== void 0 ? _b : []);
|
|
120
|
+
const currentIndex = items.indexOf(currentElement);
|
|
235
121
|
if (e.key === KeyboardCode.ARROW_DOWN) {
|
|
236
122
|
e.preventDefault();
|
|
237
123
|
const nextIndex = currentIndex + 1;
|
|
238
|
-
if (nextIndex <
|
|
239
|
-
|
|
240
|
-
this.items[nextIndex].classList.add("focused");
|
|
124
|
+
if (nextIndex < items.length) {
|
|
125
|
+
items[nextIndex].focus();
|
|
241
126
|
}
|
|
242
127
|
}
|
|
243
128
|
if (e.key === KeyboardCode.ARROW_UP) {
|
|
244
129
|
e.preventDefault();
|
|
245
130
|
const prevIndex = currentIndex - 1;
|
|
246
131
|
if (prevIndex < 0) {
|
|
247
|
-
this.
|
|
248
|
-
this.
|
|
249
|
-
.querySelector("input")
|
|
250
|
-
.setSelectionRange(this.inputRef.value.length, this.inputRef.value.length);
|
|
132
|
+
(_d = (_c = this.host.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector("input")) === null || _d === void 0 ? void 0 : _d.focus();
|
|
133
|
+
(_f = (_e = this.host.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector("input")) === null || _f === void 0 ? void 0 : _f.setSelectionRange(this.inputRef.value.length, this.inputRef.value.length);
|
|
251
134
|
}
|
|
252
135
|
if (prevIndex >= 0) {
|
|
253
|
-
|
|
254
|
-
this.items[prevIndex].classList.add("focused");
|
|
136
|
+
items[prevIndex].focus();
|
|
255
137
|
}
|
|
256
138
|
}
|
|
257
139
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
140
|
+
handleStopTyping(e) {
|
|
141
|
+
e.stopPropagation();
|
|
142
|
+
this.searchString = e.detail.value;
|
|
143
|
+
this.selectedItem = undefined;
|
|
144
|
+
}
|
|
145
|
+
handleSubmit() {
|
|
146
|
+
if (this.preventSubmit) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.emitSearchSubmit();
|
|
150
|
+
}
|
|
151
|
+
handleOutsideClick(e) {
|
|
152
|
+
const cp = e.composedPath();
|
|
153
|
+
if (cp.includes(this.host)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.showResults = false;
|
|
157
|
+
}
|
|
158
|
+
componentWillLoad() {
|
|
159
|
+
this.resultsItemsList = this.getResultsItemsList();
|
|
160
|
+
this.mql = matchMedia("(max-width: 767px)");
|
|
161
|
+
this.onMobileViewChange = (e) => (this.isMobile = e.matches);
|
|
162
|
+
this.mql.addEventListener("change", this.onMobileViewChange);
|
|
163
|
+
this.isMobile = this.mql.matches;
|
|
164
|
+
}
|
|
165
|
+
disconnectedCallback() {
|
|
166
|
+
var _a;
|
|
167
|
+
(_a = this.mql) === null || _a === void 0 ? void 0 : _a.removeEventListener("change", this.onMobileViewChange);
|
|
266
168
|
}
|
|
267
169
|
renderItemLabel(label) {
|
|
268
170
|
if (!this.searchString) {
|
|
@@ -270,41 +172,62 @@ export class ZSearchbar {
|
|
|
270
172
|
}
|
|
271
173
|
return label.replace(new RegExp(this.searchString.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gmi"), (found) => `<mark>${found}</mark>`);
|
|
272
174
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
return (h("span", { class: "category-heading", slot: "header-title" }, h("span", { class: "category" }, groupItem.category), (groupItem === null || groupItem === void 0 ? void 0 : groupItem.subcategory) && h("span", { class: "subcategory" }, groupItem.subcategory)));
|
|
175
|
+
renderItem(item, index) {
|
|
176
|
+
var _a;
|
|
177
|
+
return (h("z-list-element", { id: `list-item-${this.htmlid}-${index}`, role: "presentation", htmlTabindex: -1, onKeyDown: (e) => this.onListItemKeyDown(e, item), onClick: () => this.emitSearchItemClick(item) }, h("div", { class: "list-item ellipsis", role: "option", tabindex: 0 }, !!(item === null || item === void 0 ? void 0 : item.icon) && (h("z-icon", { class: "item-icon", name: item.icon })), h("div", { class: "item-label body-3 mobile-body-4", title: item.label, innerHTML: this.renderItemLabel(item.label) }), !!(item === null || item === void 0 ? void 0 : item.tag) && h("z-tag", { icon: item.tag.icon }, !this.isMobile ? item.tag.text : "")), !!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) && (h("z-list", { class: "sub-list", role: "group", "aria-label": item.label || undefined }, item.children.map((child, index) => this.renderItem(child, index))))));
|
|
278
178
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Renders the item grouped by category and subcategory. If `resultsCount` is set, it limits the number of rendered items.
|
|
181
|
+
*/
|
|
182
|
+
renderItemGroups() {
|
|
183
|
+
var _a;
|
|
184
|
+
if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
185
|
+
return;
|
|
282
186
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
187
|
+
const groupedItems = Object.values(this.getGroupedItems());
|
|
188
|
+
const listGroups = [];
|
|
189
|
+
const hasResultsLimit = !!this.currResultsCount;
|
|
190
|
+
let renderedCount = 0;
|
|
191
|
+
for (const groupItem of groupedItems) {
|
|
192
|
+
const remaining = hasResultsLimit ? this.currResultsCount - renderedCount : groupItem.items.length;
|
|
193
|
+
if (remaining <= 0) {
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
const visibleItems = groupItem.items.slice(0, remaining);
|
|
197
|
+
const listGroupsElements = visibleItems.map((item, subindex) => this.renderItem(item, subindex));
|
|
198
|
+
renderedCount += listGroupsElements.length;
|
|
199
|
+
if (!listGroupsElements.length) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const ariaLabel = [groupItem.category, groupItem.subcategory].filter(Boolean).join(" ");
|
|
203
|
+
listGroups.push(h("z-list-group", { "aria-label": ariaLabel || undefined }, groupItem.category && (h("z-list-element", { class: "category-heading body-3 mobile-body-4", slot: "header-title", role: "presentation", htmlTabindex: -1 }, h("div", { class: "category" }, groupItem.category), groupItem.subcategory && h("div", { class: "subcategory" }, groupItem.subcategory))), listGroupsElements));
|
|
292
204
|
}
|
|
293
|
-
return
|
|
205
|
+
return listGroups;
|
|
294
206
|
}
|
|
295
207
|
render() {
|
|
296
|
-
|
|
208
|
+
var _a, _b, _c, _d, _e;
|
|
209
|
+
return (h(Host, { key: 'cf8441e139a28aa53bd6d61c4b17a12739998d59', onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e), class: { "has-submit": !!this.showSearchButton, "has-results": !!this.autocomplete } }, h("div", { key: 'b24a5060ef65a27fa1096ca0056f1f2d566c9aca', class: "input-container" }, h("z-input", { key: 'fa2648f2a11a83dedbd9c1c5d00712675713936d', ref: (el) => (this.inputRef = el), htmlid: `input-${this.htmlid}`, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => {
|
|
210
|
+
handleEnterKeydSubmit(e, () => this.handleSubmit());
|
|
211
|
+
this.handleArrowsNavigation(e);
|
|
212
|
+
}, onFocus: () => (this.showResults = true), value: this.searchString || ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.label), size: this.size, label: this.label, "aria-label": this.htmlAriaLabel || this.placeholder || undefined }), !!(this.showResults &&
|
|
213
|
+
this.autocomplete &&
|
|
214
|
+
this.searchString &&
|
|
215
|
+
this.searchString.length >= this.autocompleteMinChars &&
|
|
216
|
+
this.resultsItemsList) && (h("div", { key: '060a4065341f54257d85e8989f55f3b6e8fe1505', class: "results z-scrollbar" }, this.preventSubmit && !((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length) ? (h("div", { class: "item-no-results body-3 mobile-body-4" }, "Non abbiamo trovato risultati per ", h("b", null, this.searchString), h("br", null), h("br", null), "Cosa puoi fare?", h("ul", null, h("li", null, "Verificare di aver scritto bene"), h("li", null, "Provare a cercare un'altra parola"), h("li", null, "Provare a cercare qualcosa di pi\u00F9 generico")))) : (h("z-list", { role: "listbox", id: `list-${this.htmlid}`, "aria-label": this.htmlAriaLabel || this.label || undefined }, this.autocomplete && !this.preventSubmit && !!this.searchString && (h("z-list-element", { role: "presentation", htmlTabindex: -1, id: `list-item-${this.htmlid}-search`, onKeyDown: (e) => this.onSearchHelperKeyDown(e), onClick: () => this.emitSearchSubmit() }, h("div", { class: "list-item item-search", role: "option", tabindex: 0 }, h("z-icon", { class: "search-icon", name: "left-magnifying-glass" }), h("div", { class: "item-label body-3 mobile-body-4", innerHTML: (_c = this.searchHelperLabel) === null || _c === void 0 ? void 0 : _c.replace("{searchString}", `<mark>${this.searchString}</mark>`) })))), this.renderItemGroups(), !!(this.searchString &&
|
|
217
|
+
((_d = this.resultsItemsList) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
218
|
+
this.currResultsCount &&
|
|
219
|
+
this.currResultsCount < ((_e = this.resultsItemsList) === null || _e === void 0 ? void 0 : _e.length)) && (h("z-list-element", { role: "presentation", htmlTabindex: -1, id: `list-item-${this.htmlid}-show-all` }, h("div", { role: "option", class: "item-show-all body-3 mobile-body-4", tabindex: 0, onClick: () => (this.currResultsCount = undefined) }, "Vedi tutti i risultati")))))))), this.showSearchButton && (h("z-button", { key: 'e37aec8f5feb61ab23fe0c497a11290d2b121375', icon: this.searchButtonIconOnly ? "search" : undefined, "aria-label": this.searchButtonIconOnly ? this.searchButtonLabel.trim() || "CERCA" : undefined, disabled: !!this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, this.searchButtonIconOnly ? "" : this.searchButtonLabel.trim() || "CERCA"))));
|
|
297
220
|
}
|
|
298
221
|
static get is() { return "z-searchbar"; }
|
|
299
222
|
static get encapsulation() { return "shadow"; }
|
|
300
223
|
static get originalStyleUrls() {
|
|
301
224
|
return {
|
|
302
|
-
"$": ["styles.css", "../css-components/z-label/styles.css"]
|
|
225
|
+
"$": ["styles.css", "../css-components/z-label/styles.css", "../css-components/z-scrollbar/styles.css", "../../tokens/typography.css"]
|
|
303
226
|
};
|
|
304
227
|
}
|
|
305
228
|
static get styleUrls() {
|
|
306
229
|
return {
|
|
307
|
-
"$": ["styles.css", "../css-components/z-label/styles.css"]
|
|
230
|
+
"$": ["styles.css", "../css-components/z-label/styles.css", "../css-components/z-scrollbar/styles.css", "../../tokens/typography.css"]
|
|
308
231
|
};
|
|
309
232
|
}
|
|
310
233
|
static get properties() {
|
|
@@ -321,7 +244,7 @@ export class ZSearchbar {
|
|
|
321
244
|
"optional": false,
|
|
322
245
|
"docs": {
|
|
323
246
|
"tags": [],
|
|
324
|
-
"text": "
|
|
247
|
+
"text": "The id of the searchbar element"
|
|
325
248
|
},
|
|
326
249
|
"getter": false,
|
|
327
250
|
"setter": false,
|
|
@@ -361,7 +284,7 @@ export class ZSearchbar {
|
|
|
361
284
|
"optional": true,
|
|
362
285
|
"docs": {
|
|
363
286
|
"tags": [],
|
|
364
|
-
"text": "
|
|
287
|
+
"text": "The input label"
|
|
365
288
|
},
|
|
366
289
|
"getter": false,
|
|
367
290
|
"setter": false,
|
|
@@ -380,7 +303,7 @@ export class ZSearchbar {
|
|
|
380
303
|
"optional": true,
|
|
381
304
|
"docs": {
|
|
382
305
|
"tags": [],
|
|
383
|
-
"text": "
|
|
306
|
+
"text": "The input aria-label"
|
|
384
307
|
},
|
|
385
308
|
"getter": false,
|
|
386
309
|
"setter": false,
|
|
@@ -477,7 +400,7 @@ export class ZSearchbar {
|
|
|
477
400
|
"optional": true,
|
|
478
401
|
"docs": {
|
|
479
402
|
"tags": [],
|
|
480
|
-
"text": "Number of results shown
|
|
403
|
+
"text": "Number of results shown. Default: all"
|
|
481
404
|
},
|
|
482
405
|
"getter": false,
|
|
483
406
|
"setter": false,
|
|
@@ -582,7 +505,7 @@ export class ZSearchbar {
|
|
|
582
505
|
"optional": true,
|
|
583
506
|
"docs": {
|
|
584
507
|
"tags": [],
|
|
585
|
-
"text": "
|
|
508
|
+
"text": "Hide the label of the submit button, showing only the icon"
|
|
586
509
|
},
|
|
587
510
|
"getter": false,
|
|
588
511
|
"setter": false,
|
|
@@ -590,6 +513,26 @@ export class ZSearchbar {
|
|
|
590
513
|
"attribute": "search-button-icon-only",
|
|
591
514
|
"defaultValue": "false"
|
|
592
515
|
},
|
|
516
|
+
"searchButtonLabel": {
|
|
517
|
+
"type": "string",
|
|
518
|
+
"mutable": false,
|
|
519
|
+
"complexType": {
|
|
520
|
+
"original": "string",
|
|
521
|
+
"resolved": "string",
|
|
522
|
+
"references": {}
|
|
523
|
+
},
|
|
524
|
+
"required": false,
|
|
525
|
+
"optional": true,
|
|
526
|
+
"docs": {
|
|
527
|
+
"tags": [],
|
|
528
|
+
"text": "The label of the submit button"
|
|
529
|
+
},
|
|
530
|
+
"getter": false,
|
|
531
|
+
"setter": false,
|
|
532
|
+
"reflect": false,
|
|
533
|
+
"attribute": "search-button-label",
|
|
534
|
+
"defaultValue": "\"CERCA\""
|
|
535
|
+
},
|
|
593
536
|
"size": {
|
|
594
537
|
"type": "string",
|
|
595
538
|
"mutable": false,
|
|
@@ -609,7 +552,7 @@ export class ZSearchbar {
|
|
|
609
552
|
"optional": true,
|
|
610
553
|
"docs": {
|
|
611
554
|
"tags": [],
|
|
612
|
-
"text": "
|
|
555
|
+
"text": "Size of the `z-input` and submit `z-button`"
|
|
613
556
|
},
|
|
614
557
|
"getter": false,
|
|
615
558
|
"setter": false,
|
|
@@ -636,7 +579,7 @@ export class ZSearchbar {
|
|
|
636
579
|
"optional": true,
|
|
637
580
|
"docs": {
|
|
638
581
|
"tags": [],
|
|
639
|
-
"text": "
|
|
582
|
+
"text": "Submit `z-button` variant"
|
|
640
583
|
},
|
|
641
584
|
"getter": false,
|
|
642
585
|
"setter": false,
|
|
@@ -710,7 +653,7 @@ export class ZSearchbar {
|
|
|
710
653
|
}
|
|
711
654
|
}];
|
|
712
655
|
}
|
|
713
|
-
static get elementRef() { return "
|
|
656
|
+
static get elementRef() { return "host"; }
|
|
714
657
|
static get watchers() {
|
|
715
658
|
return [{
|
|
716
659
|
"propName": "resultsItems",
|
|
@@ -724,9 +667,6 @@ export class ZSearchbar {
|
|
|
724
667
|
}, {
|
|
725
668
|
"propName": "searchString",
|
|
726
669
|
"methodName": "watchSearchString"
|
|
727
|
-
}, {
|
|
728
|
-
"propName": "showResults",
|
|
729
|
-
"methodName": "watchShowResults"
|
|
730
670
|
}];
|
|
731
671
|
}
|
|
732
672
|
static get listeners() {
|
|
@@ -22,31 +22,19 @@ const StoryMeta = {
|
|
|
22
22
|
"preventSubmit": false,
|
|
23
23
|
"showSearchButton": false,
|
|
24
24
|
"searchButtonIconOnly": false,
|
|
25
|
+
"searchButtonLabel": "",
|
|
25
26
|
"autocomplete": false,
|
|
26
27
|
"autocompleteMinChars": 3,
|
|
27
|
-
"resultsCount":
|
|
28
|
+
"resultsCount": undefined,
|
|
28
29
|
"searchHelperLabel": "Cerca {searchString}",
|
|
29
|
-
"resultsItems": [
|
|
30
|
-
{
|
|
31
|
-
label: "first item",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: "second item",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: "third item",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "fourth item",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
30
|
+
"resultsItems": [{ label: "first item" }, { label: "second item" }, { label: "third item" }, { label: "fourth item" }],
|
|
43
31
|
"sortResultsItems": false,
|
|
44
32
|
"htmlid": "myId",
|
|
45
33
|
"placeholder": "my placeholder",
|
|
46
34
|
"value": "",
|
|
47
35
|
"label": "",
|
|
48
36
|
"htmlAriaLabel": "",
|
|
49
|
-
"--z-searchbar-results-height": "",
|
|
37
|
+
"--z-searchbar-results-height": "540px",
|
|
50
38
|
"--z-searchbar-tag-text-color": "var(--color-primary03)",
|
|
51
39
|
"--z-searchbar-tag-bg": "var(--color-hover-primary)",
|
|
52
40
|
"size": ControlSize.BIG,
|
|
@@ -59,6 +47,7 @@ export const Default = {
|
|
|
59
47
|
<z-searchbar
|
|
60
48
|
prevent-submit=${args.preventSubmit}
|
|
61
49
|
show-search-button=${args.showSearchButton}
|
|
50
|
+
search-button-label=${args.searchButtonLabel}
|
|
62
51
|
search-button-icon-only=${args.searchButtonIconOnly}
|
|
63
52
|
autocomplete=${args.autocomplete}
|
|
64
53
|
autocomplete-min-chars=${args.autocompleteMinChars}
|
|
@@ -91,6 +80,7 @@ export const SimpleSearch = {
|
|
|
91
80
|
prevent-submit="false"
|
|
92
81
|
show-search-button=${args.showSearchButton}
|
|
93
82
|
search-button-icon-only=${args.searchButtonIconOnly}
|
|
83
|
+
search-button-label=${args.searchButtonLabel}
|
|
94
84
|
autcomplete="false"
|
|
95
85
|
value=${args.value}
|
|
96
86
|
placeholder=${args.placeholder}
|
|
@@ -107,12 +97,14 @@ export const Autocomplete = {
|
|
|
107
97
|
htmlid: "myIdAutocomplete",
|
|
108
98
|
showSearchButton: false,
|
|
109
99
|
searchButtonIconOnly: false,
|
|
100
|
+
searchButtonLabel: "Cliccami",
|
|
110
101
|
},
|
|
111
102
|
render: (args) => html `
|
|
112
103
|
<z-searchbar
|
|
113
104
|
prevent-submit=${args.preventSubmit}
|
|
114
105
|
show-search-button=${args.showSearchButton}
|
|
115
106
|
search-button-icon-only=${args.searchButtonIconOnly}
|
|
107
|
+
search-button-label=${args.searchButtonLabel}
|
|
116
108
|
autocomplete=${args.autocomplete}
|
|
117
109
|
autocomplete-min-chars=${args.autocompleteMinChars}
|
|
118
110
|
results-count=${args.resultsCount}
|
|
@@ -136,6 +128,7 @@ export const AutocompleteWithComplexItems = {
|
|
|
136
128
|
htmlid: "myIdGroupedAutocomplete",
|
|
137
129
|
showSearchButton: false,
|
|
138
130
|
searchButtonIconOnly: false,
|
|
131
|
+
searchButtonLabel: "Cliccami",
|
|
139
132
|
resultsItems: [
|
|
140
133
|
{
|
|
141
134
|
label: "first item",
|
|
@@ -184,6 +177,7 @@ export const AutocompleteWithComplexItems = {
|
|
|
184
177
|
prevent-submit=${args.preventSubmit}
|
|
185
178
|
show-search-button=${args.showSearchButton}
|
|
186
179
|
search-button-icon-only=${args.searchButtonIconOnly}
|
|
180
|
+
search-button-label=${args.searchButtonLabel}
|
|
187
181
|
autocomplete=${args.autocomplete}
|
|
188
182
|
autocomplete-min-chars=${args.autocompleteMinChars}
|
|
189
183
|
results-count=${args.resultsCount}
|
|
@@ -207,6 +201,7 @@ export const AutocompleteWithComplexTreeItems = {
|
|
|
207
201
|
htmlid: "myIdGroupedAutocomplete",
|
|
208
202
|
showSearchButton: false,
|
|
209
203
|
searchButtonIconOnly: false,
|
|
204
|
+
searchButtonLabel: "Cliccami",
|
|
210
205
|
resultsItems: [
|
|
211
206
|
{
|
|
212
207
|
label: "first item",
|
|
@@ -317,6 +312,7 @@ export const AutocompleteWithComplexTreeItems = {
|
|
|
317
312
|
prevent-submit=${args.preventSubmit}
|
|
318
313
|
show-search-button=${args.showSearchButton}
|
|
319
314
|
search-button-icon-only=${args.searchButtonIconOnly}
|
|
315
|
+
search-button-label=${args.searchButtonLabel}
|
|
320
316
|
autocomplete=${args.autocomplete}
|
|
321
317
|
autocomplete-min-chars=${args.autocompleteMinChars}
|
|
322
318
|
results-count=${args.resultsCount}
|