@zanichelli/zanichelli-it-frontend-kit 1.0.0 → 1.0.2

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 (102) hide show
  1. package/dist/cjs/index-xkrZykI_.js +1532 -0
  2. package/dist/cjs/index-xkrZykI_.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +5 -0
  4. package/dist/cjs/index.cjs.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/loader.cjs.js.map +1 -0
  7. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js +27 -0
  8. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js.map +1 -0
  9. package/dist/cjs/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.cjs.js.map +1 -0
  10. package/dist/cjs/zanit-menubar_3.cjs.entry.js +676 -0
  11. package/dist/cjs/zanit-menubar_3.cjs.entry.js.map +1 -0
  12. package/dist/collection/collection-manifest.json +14 -0
  13. package/dist/collection/components/menubar/menu/menu.css +98 -0
  14. package/dist/collection/components/menubar/menu/menu.js +38 -0
  15. package/dist/collection/components/menubar/menu/menu.js.map +1 -0
  16. package/dist/collection/components/menubar/menubar.css +167 -0
  17. package/{www/build/zanit-menubar.entry.js → dist/collection/components/menubar/menubar.js} +157 -25
  18. package/dist/collection/components/menubar/menubar.js.map +1 -0
  19. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.css +114 -0
  20. package/{www/build/zanit-mobile-menubar.entry.js → dist/collection/components/menubar/mobile-menubar/mobile-menubar.js} +149 -25
  21. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js.map +1 -0
  22. package/dist/collection/components/menubar/search-form/search-form.css +147 -0
  23. package/{www/build/zanit-search-form.entry.js → dist/collection/components/menubar/search-form/search-form.js} +98 -22
  24. package/dist/collection/components/menubar/search-form/search-form.js.map +1 -0
  25. package/dist/collection/index.js +11 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/collection/utils/types.js +2 -0
  28. package/dist/collection/utils/types.js.map +1 -0
  29. package/dist/{zanichelli-it-frontend-kit/utils-CaxAWyZI.js → collection/utils/utils.js} +3 -7
  30. package/dist/collection/utils/utils.js.map +1 -0
  31. package/dist/components/index.js +1290 -0
  32. package/dist/components/index.js.map +1 -0
  33. package/dist/{zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js → components/p-CQEWv_Pv.js} +87 -14
  34. package/dist/components/p-CQEWv_Pv.js.map +1 -0
  35. package/dist/{zanichelli-it-frontend-kit/zanit-search-form.entry.js → components/p-CiHl-h3q.js} +52 -13
  36. package/dist/components/p-CiHl-h3q.js.map +1 -0
  37. package/dist/{zanichelli-it-frontend-kit/zanit-menubar.entry.js → components/zanit-menubar.js} +56 -13
  38. package/dist/components/zanit-menubar.js.map +1 -0
  39. package/dist/components/zanit-mobile-menubar.js +9 -0
  40. package/dist/components/zanit-mobile-menubar.js.map +1 -0
  41. package/dist/components/zanit-search-form.js +9 -0
  42. package/dist/components/zanit-search-form.js.map +1 -0
  43. package/dist/esm/index-BWVQ0LD4.js +1504 -0
  44. package/dist/esm/index-BWVQ0LD4.js.map +1 -0
  45. package/dist/esm/index.js +4 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/loader.js +13 -0
  48. package/dist/esm/loader.js.map +1 -0
  49. package/dist/esm/zanichelli-it-frontend-kit.js +23 -0
  50. package/dist/esm/zanichelli-it-frontend-kit.js.map +1 -0
  51. package/dist/esm/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.js.map +1 -0
  52. package/dist/esm/zanit-menubar_3.entry.js +672 -0
  53. package/dist/esm/zanit-menubar_3.entry.js.map +1 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/zanichelli-it-frontend-kit/index.esm.js +0 -10
  57. package/dist/zanichelli-it-frontend-kit/index.esm.js.map +1 -1
  58. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js +3 -0
  59. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js.map +1 -0
  60. package/dist/zanichelli-it-frontend-kit/p-b6c74a1e.entry.js +2 -0
  61. package/dist/zanichelli-it-frontend-kit/p-b6c74a1e.entry.js.map +1 -0
  62. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.css +1 -993
  63. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js +1 -49
  64. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js.map +1 -1
  65. package/dist/zanichelli-it-frontend-kit/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +1 -0
  66. package/package.json +1 -1
  67. package/www/build/index.esm.js +0 -10
  68. package/www/build/index.esm.js.map +1 -1
  69. package/www/build/p-984b8fa6.css +1 -0
  70. package/www/build/p-BWVQ0LD4.js +3 -0
  71. package/www/build/p-BWVQ0LD4.js.map +1 -0
  72. package/www/build/p-b6c74a1e.entry.js +2 -0
  73. package/www/build/p-b6c74a1e.entry.js.map +1 -0
  74. package/www/build/p-d36eb550.js +2 -0
  75. package/www/build/zanichelli-it-frontend-kit.css +1 -993
  76. package/www/build/zanichelli-it-frontend-kit.esm.js +1 -49
  77. package/www/build/zanichelli-it-frontend-kit.esm.js.map +1 -1
  78. package/www/build/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +1 -0
  79. package/www/index.html +2 -11
  80. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js +0 -4170
  81. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js.map +0 -1
  82. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js +0 -46
  83. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js.map +0 -1
  84. package/dist/zanichelli-it-frontend-kit/utils-CaxAWyZI.js.map +0 -1
  85. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.esm.js.map +0 -1
  86. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.js.map +0 -1
  87. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.esm.js.map +0 -1
  88. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js.map +0 -1
  89. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.esm.js.map +0 -1
  90. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.js.map +0 -1
  91. package/www/build/index-Cn3aX5eK.js +0 -4170
  92. package/www/build/index-Cn3aX5eK.js.map +0 -1
  93. package/www/build/menu-DZlhu_pe.js +0 -46
  94. package/www/build/menu-DZlhu_pe.js.map +0 -1
  95. package/www/build/utils-CaxAWyZI.js +0 -21
  96. package/www/build/utils-CaxAWyZI.js.map +0 -1
  97. package/www/build/zanit-menubar.entry.esm.js.map +0 -1
  98. package/www/build/zanit-menubar.entry.js.map +0 -1
  99. package/www/build/zanit-mobile-menubar.entry.esm.js.map +0 -1
  100. package/www/build/zanit-mobile-menubar.entry.js.map +0 -1
  101. package/www/build/zanit-search-form.entry.esm.js.map +0 -1
  102. package/www/build/zanit-search-form.entry.js.map +0 -1
@@ -0,0 +1,147 @@
1
+ :host,
2
+ *,
3
+ ::before,
4
+ ::after {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ *:focus:focus-visible {
9
+ box-shadow: var(--shadow-focus-primary);
10
+ outline: none;
11
+ }
12
+
13
+ button {
14
+ all: unset;
15
+ cursor: pointer;
16
+ }
17
+
18
+ @media (width < 768px) {
19
+ .searchbar {
20
+ display: flex;
21
+ align-items: center;
22
+ border: 1px solid #000;
23
+ border-radius: 4px;
24
+ }
25
+
26
+ .searchbar > *:first-child {
27
+ /* To have a seamless appearance of the border radius of an internal child element nested within a parent element with rounded borders, we need to subtract the parent's border thickness from the child's border radius. Inner Radius = Outer Radius - Border Thickness */
28
+ border-bottom-left-radius: 3px;
29
+ border-top-left-radius: 3px;
30
+ }
31
+
32
+ .searchbar button[type='reset'] {
33
+ display: flex;
34
+ padding: 0 0 0 8px;
35
+ cursor: pointer;
36
+ }
37
+
38
+ .searchbar input {
39
+ width: 100%;
40
+ height: 100%;
41
+ padding: 4px 8px;
42
+ border: none;
43
+ background-color: #fff;
44
+ font-family: var(--font-family-sans);
45
+ font-size: 1rem;
46
+ }
47
+
48
+ .searchbar input[type='search']::-webkit-search-cancel-button,
49
+ .searchbar input[type='search']::-webkit-search-decoration {
50
+ appearance: none;
51
+ }
52
+
53
+ .searchbar input::placeholder {
54
+ color: var(--gray500);
55
+ }
56
+
57
+ .searchbar .searchbar-button {
58
+ padding: 4px 8px;
59
+ border-left: 1px solid #000;
60
+ background: var(--zanit-accent-color);
61
+ border-bottom-right-radius: 3px;
62
+ border-top-right-radius: 3px;
63
+ }
64
+
65
+ .searchbar input:focus:focus-visible,
66
+ .searchbar .searchbar-button:focus:focus-visible {
67
+ z-index: 1;
68
+ }
69
+ }
70
+
71
+ @media (width >= 768px) {
72
+ .searchbar {
73
+ display: flex;
74
+ font-size: 1.5rem;
75
+ }
76
+
77
+ .searchbar.searchbar-open {
78
+ position: absolute;
79
+ width: 100%;
80
+ height: 100%;
81
+ inset: 0;
82
+ }
83
+
84
+ .searchbar .input-wrapper {
85
+ display: none;
86
+ width: 100%;
87
+ align-items: center;
88
+ padding: 0 0 0 var(--grid-margin);
89
+ background-color: #fff;
90
+ gap: 6px; /* diventa 14px sommato al padding a sinistra della input */
91
+ }
92
+
93
+ .searchbar .input-wrapper:not(.hide) {
94
+ display: flex;
95
+ }
96
+
97
+ .searchbar button[type='reset'] {
98
+ display: flex;
99
+ align-items: center;
100
+ border-radius: 4px;
101
+ cursor: pointer;
102
+ }
103
+
104
+ .searchbar input {
105
+ z-index: 1;
106
+ width: 100%;
107
+ height: 100%;
108
+ padding: 8px;
109
+ border: none;
110
+ background-color: #fff;
111
+ font-family: var(--font-family-sans);
112
+ font-size: inherit;
113
+ }
114
+
115
+ .searchbar input[type='search']::-webkit-search-cancel-button,
116
+ .searchbar input[type='search']::-webkit-search-decoration {
117
+ appearance: none;
118
+ }
119
+
120
+ .searchbar input::placeholder {
121
+ color: var(--gray500);
122
+ }
123
+
124
+ .searchbar .searchbar-button {
125
+ display: flex;
126
+ align-items: center;
127
+ padding: 8px 16px;
128
+ border-right: 1px solid #000;
129
+ border-left: 1px solid #000;
130
+ background: var(--zanit-accent-color);
131
+ font-family: inherit;
132
+ font-size: inherit;
133
+ gap: 64px;
134
+ line-height: 1;
135
+ }
136
+
137
+ .searchbar input:focus:focus-visible,
138
+ .searchbar .searchbar-button:focus:focus-visible {
139
+ z-index: 1;
140
+ }
141
+ }
142
+
143
+ @media (width >= 768px) and (width < 1152px) {
144
+ .searchbar .searchbar-button > .searchbar-button-label {
145
+ display: none;
146
+ }
147
+ }
@@ -1,16 +1,8 @@
1
- import { r as registerInstance, d as createEvent, a as getElement, h } from './index-Cn3aX5eK.js';
2
- import { c as containsTarget } from './utils-CaxAWyZI.js';
3
-
4
- const searchFormCss = ":host,*,::before,::after{box-sizing:border-box}*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}button{all:unset;cursor:pointer}@media (width < 768px){.searchbar{display:flex;align-items:center;border:1px solid #000;border-radius:4px}.searchbar>*:first-child{border-bottom-left-radius:3px;border-top-left-radius:3px}.searchbar button[type='reset']{display:flex;padding:0 0 0 8px;cursor:pointer}.searchbar input{width:100%;height:100%;padding:4px 8px;border:none;background-color:#fff;font-family:var(--font-family-sans);font-size:1rem}.searchbar input[type='search']::-webkit-search-cancel-button,.searchbar input[type='search']::-webkit-search-decoration{appearance:none}.searchbar input::placeholder{color:var(--gray500)}.searchbar .searchbar-button{padding:4px 8px;border-left:1px solid #000;background:var(--zanit-accent-color);border-bottom-right-radius:3px;border-top-right-radius:3px}.searchbar input:focus:focus-visible,.searchbar .searchbar-button:focus:focus-visible{z-index:1}}@media (width >= 768px){.searchbar{display:flex;font-size:1.5rem}.searchbar.searchbar-open{position:absolute;width:100%;height:100%;inset:0}.searchbar .input-wrapper{display:none;width:100%;align-items:center;padding:0 0 0 var(--grid-margin);background-color:#fff;gap:6px;}.searchbar .input-wrapper:not(.hide){display:flex}.searchbar button[type='reset']{display:flex;align-items:center;border-radius:4px;cursor:pointer}.searchbar input{z-index:1;width:100%;height:100%;padding:8px;border:none;background-color:#fff;font-family:var(--font-family-sans);font-size:inherit}.searchbar input[type='search']::-webkit-search-cancel-button,.searchbar input[type='search']::-webkit-search-decoration{appearance:none}.searchbar input::placeholder{color:var(--gray500)}.searchbar .searchbar-button{display:flex;align-items:center;padding:8px 16px;border-right:1px solid #000;border-left:1px solid #000;background:var(--zanit-accent-color);font-family:inherit;font-size:inherit;gap:64px;line-height:1}.searchbar input:focus:focus-visible,.searchbar .searchbar-button:focus:focus-visible{z-index:1}}@media (width >= 768px) and (width < 1152px){.searchbar .searchbar-button>.searchbar-button-label{display:none}}";
5
-
6
- const ZanitSearchForm = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.search = createEvent(this, "search", 7);
10
- this.resetSearch = createEvent(this, "resetSearch", 7);
11
- }
1
+ import { h } from "@stencil/core";
2
+ import { containsTarget } from "../../../utils/utils";
3
+ export class ZanitSearchForm {
12
4
  formElement;
13
- get host() { return getElement(this); }
5
+ host;
14
6
  isMobile = false;
15
7
  /** Indicates whether the searchbar is visible and usable. */
16
8
  showSearchbar = false;
@@ -77,13 +69,97 @@ const ZanitSearchForm = class {
77
69
  }
78
70
  return (h("form", { class: { 'searchbar': true, 'searchbar-open': this.showSearchbar }, ref: (el) => (this.formElement = el), role: "search", "aria-label": "Cerca", method: "get", action: "/ricerca", onSubmit: (event) => this.onSearchSubmit(event), onReset: () => this.resetSearchQuery() }, h("div", { class: { 'hide': !this.showSearchbar, 'input-wrapper': true }, role: "none" }, this.searchQuery && (h("button", { type: "reset", "aria-label": "Svuota campo di ricerca" }, h("z-icon", { name: "multiply-circled", width: "1.5rem", height: "1.5rem" }))), h("input", { id: "searchbar-input", name: "q", type: "search", placeholder: "Cerca per parola chiave o ISBN", onInput: (event) => this.handleInputChange(event), value: this.searchQuery, required: true })), h("button", { class: "searchbar-button", "aria-label": "Cerca", "aria-controls": "searchbar-input", type: this.showSearchbar ? 'submit' : 'button', onClick: () => this.openSearchbar() }, this.showSearchbar ? null : h("span", { class: "searchbar-button-label" }, "Cerca"), h("z-icon", { name: "search", width: "2rem", height: "2rem" }))));
79
71
  }
80
- static get watchers() { return {
81
- "searchQuery": ["onSearchQueryChange"]
82
- }; }
83
- };
84
- ZanitSearchForm.style = searchFormCss;
85
-
86
- export { ZanitSearchForm as zanit_search_form };
87
- //# sourceMappingURL=zanit-search-form.entry.esm.js.map
88
-
89
- //# sourceMappingURL=zanit-search-form.entry.js.map
72
+ static get is() { return "zanit-search-form"; }
73
+ static get encapsulation() { return "shadow"; }
74
+ static get originalStyleUrls() {
75
+ return {
76
+ "$": ["search-form.css"]
77
+ };
78
+ }
79
+ static get styleUrls() {
80
+ return {
81
+ "$": ["search-form.css"]
82
+ };
83
+ }
84
+ static get properties() {
85
+ return {
86
+ "searchQuery": {
87
+ "type": "string",
88
+ "attribute": "search-query",
89
+ "mutable": true,
90
+ "complexType": {
91
+ "original": "string | undefined",
92
+ "resolved": "string",
93
+ "references": {}
94
+ },
95
+ "required": false,
96
+ "optional": false,
97
+ "docs": {
98
+ "tags": [],
99
+ "text": "Initial search query"
100
+ },
101
+ "getter": false,
102
+ "setter": false,
103
+ "reflect": false,
104
+ "defaultValue": "undefined"
105
+ }
106
+ };
107
+ }
108
+ static get states() {
109
+ return {
110
+ "isMobile": {},
111
+ "showSearchbar": {},
112
+ "_searchQuery": {}
113
+ };
114
+ }
115
+ static get events() {
116
+ return [{
117
+ "method": "search",
118
+ "name": "search",
119
+ "bubbles": true,
120
+ "cancelable": true,
121
+ "composed": true,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "Emitted on search form submission."
125
+ },
126
+ "complexType": {
127
+ "original": "{ query: string }",
128
+ "resolved": "{ query: string; }",
129
+ "references": {}
130
+ }
131
+ }, {
132
+ "method": "resetSearch",
133
+ "name": "resetSearch",
134
+ "bubbles": true,
135
+ "cancelable": true,
136
+ "composed": true,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": ""
140
+ },
141
+ "complexType": {
142
+ "original": "void",
143
+ "resolved": "void",
144
+ "references": {}
145
+ }
146
+ }];
147
+ }
148
+ static get elementRef() { return "host"; }
149
+ static get watchers() {
150
+ return [{
151
+ "propName": "searchQuery",
152
+ "methodName": "onSearchQueryChange"
153
+ }];
154
+ }
155
+ static get listeners() {
156
+ return [{
157
+ "name": "click",
158
+ "method": "handleOutsideClick",
159
+ "target": "document",
160
+ "capture": false,
161
+ "passive": true
162
+ }];
163
+ }
164
+ }
165
+ //# sourceMappingURL=search-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-form.js","sourceRoot":"","sources":["../../../../src/components/menubar/search-form/search-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtD,MAAM,OAAO,eAAe;IAClB,WAAW,CAAkB;IAE1B,IAAI,CAA6B;IAG5C,QAAQ,GAAY,KAAK,CAAC;IAE1B,6DAA6D;IAE7D,aAAa,GAAY,KAAK,CAAC;IAE/B,6BAA6B;IAE7B,YAAY,GAAuB,SAAS,CAAC;IAE7C,2BAA2B;IAE3B,WAAW,GAAuB,SAAS,CAAC;IAG5C,mBAAmB;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IAED,yCAAyC;IACZ,MAAM,CAAkC;IAE5D,WAAW,CAAqB;IAEzC,KAAK,CAAC,iBAAiB;QACrB,IAAI,CA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,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAC9C,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;gBAElC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAM,KAAK,EAAC,wBAAwB,YAAa;gBAC9E,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,GACL,CACH,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, State, Watch } from '@stencil/core';\nimport { containsTarget } from '../../../utils/utils';\n\n@Component({\n tag: 'zanit-search-form',\n styleUrl: 'search-form.css',\n shadow: true,\n})\nexport class ZanitSearchForm {\n private formElement: HTMLFormElement;\n\n @Element() host: HTMLZanitSearchFormElement;\n\n @State()\n isMobile: boolean = false;\n\n /** Indicates whether the searchbar is visible and usable. */\n @State()\n showSearchbar: boolean = false;\n\n /** Search query to apply. */\n @State()\n _searchQuery: string | undefined = undefined;\n\n /** Initial search query */\n @Prop({ mutable: true })\n searchQuery: string | undefined = undefined;\n\n @Watch('searchQuery')\n onSearchQueryChange() {\n this._searchQuery = this.searchQuery;\n if (this.searchQuery) {\n this.openSearchbar();\n }\n }\n\n /** Emitted on search form submission. */\n @Event({ cancelable: true }) search: EventEmitter<{ query: string }>;\n\n @Event() resetSearch: EventEmitter<void>;\n\n async connectedCallback() {\n this.showSearchbar = !!this.searchQuery;\n const mobileMediaQuery = window.matchMedia('(width < 768px)');\n this.isMobile = mobileMediaQuery.matches;\n mobileMediaQuery.onchange = (mql) => {\n this.isMobile = mql.matches;\n };\n }\n\n /** Close open searchbar when clicking outside. */\n @Listen('click', { target: 'document', passive: true })\n handleOutsideClick(event: MouseEvent) {\n if (this.showSearchbar && this.formElement && !containsTarget(this.formElement, event)) {\n this.showSearchbar = false;\n }\n }\n\n private openSearchbar() {\n this.showSearchbar = true;\n setTimeout(() => {\n const searchbarInput = this.host.shadowRoot.querySelector('#searchbar-input') as HTMLInputElement;\n searchbarInput.focus();\n }, 100);\n }\n\n private resetSearchQuery() {\n this.searchQuery = undefined;\n this.resetSearch.emit();\n }\n\n private handleInputChange(event: Event) {\n this._searchQuery = (event.target as HTMLInputElement).value;\n if (!this._searchQuery) {\n this.searchQuery = undefined;\n }\n }\n\n private onSearchSubmit(event: Event) {\n event.preventDefault();\n if (!this._searchQuery) {\n return;\n }\n\n this.showSearchbar = false;\n const searchEv = this.search.emit({ query: this._searchQuery });\n // do not submit the form if the event default behavior was prevented\n if (searchEv.defaultPrevented) {\n return;\n }\n\n this.formElement.submit();\n }\n\n render() {\n if (this.isMobile) {\n return (\n <form\n class=\"searchbar\"\n ref={(el) => (this.formElement = el)}\n role=\"search\"\n aria-label=\"Cerca\"\n method=\"get\"\n action=\"/ricerca\"\n onSubmit={(event) => this.onSearchSubmit(event)}\n onReset={() => this.resetSearchQuery()}\n >\n {this.searchQuery && (\n <button\n type=\"reset\"\n aria-label=\"Svuota campo di ricerca\"\n >\n <z-icon\n name=\"multiply-circled\"\n width=\"1rem\"\n height=\"1rem\"\n />\n </button>\n )}\n <input\n id=\"searchbar-input\"\n name=\"q\"\n type=\"search\"\n placeholder=\"Cerca per parola chiave o ISBN\"\n onInput={(event) => this.handleInputChange(event)}\n value={this.searchQuery}\n required\n ></input>\n <button\n class=\"searchbar-button\"\n aria-controls=\"searchbar-input\"\n aria-label=\"Cerca\"\n type=\"submit\"\n >\n <z-icon\n name=\"search\"\n width=\"1.25rem\"\n height=\"1.25rem\"\n ></z-icon>\n </button>\n </form>\n );\n }\n\n return (\n <form\n class={{ 'searchbar': true, 'searchbar-open': this.showSearchbar }}\n ref={(el) => (this.formElement = el)}\n role=\"search\"\n aria-label=\"Cerca\"\n method=\"get\"\n action=\"/ricerca\"\n onSubmit={(event) => this.onSearchSubmit(event)}\n onReset={() => this.resetSearchQuery()}\n >\n <div\n class={{ 'hide': !this.showSearchbar, 'input-wrapper': true }}\n role=\"none\"\n >\n {this.searchQuery && (\n <button\n type=\"reset\"\n aria-label=\"Svuota campo di ricerca\"\n >\n <z-icon\n name=\"multiply-circled\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n />\n </button>\n )}\n <input\n id=\"searchbar-input\"\n name=\"q\"\n type=\"search\"\n placeholder=\"Cerca per parola chiave o ISBN\"\n onInput={(event) => this.handleInputChange(event)}\n value={this.searchQuery}\n required\n ></input>\n </div>\n\n <button\n class=\"searchbar-button\"\n aria-label=\"Cerca\"\n aria-controls=\"searchbar-input\"\n type={this.showSearchbar ? 'submit' : 'button'}\n onClick={() => this.openSearchbar()}\n >\n {this.showSearchbar ? null : <span class=\"searchbar-button-label\">Cerca</span>}\n <z-icon\n name=\"search\"\n width=\"2rem\"\n height=\"2rem\"\n ></z-icon>\n </button>\n </form>\n );\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview entry point for your component library
3
+ *
4
+ * This is the entry point for your component library. Use this file to export utilities,
5
+ * constants or data structure that accompany your components.
6
+ *
7
+ * DO NOT use this file to export your components. Instead, use the recommended approaches
8
+ * to consume components of this package as outlined in the `README.md`.
9
+ */
10
+ export * from './utils/types';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,eAAe,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport type * from './components.d.ts';\nexport * from './utils/types';\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MenuItem = {\n label: string;\n href?: string;\n target?: '_self' | '_blank' | '_parent' | '_top';\n highlight?: boolean;\n id?: string;\n group?: { id: string; label: string };\n};\n\nexport type MenubarItem = Omit<MenuItem, 'group' | 'highlight'> & {\n navbarItems?: MenubarItem[];\n menuItems?: MenuItem[];\n};\n"]}
@@ -2,20 +2,16 @@
2
2
  * Check if an element contains an event target by checking its composedPath.
3
3
  * Useful when an event target may come from a component's shadow DOM.
4
4
  */
5
- const containsTarget = (ancestor, event) => {
5
+ export const containsTarget = (ancestor, event) => {
6
6
  return event
7
7
  .composedPath()
8
8
  .filter((el) => el !== document && el !== window.window)
9
9
  .some((el) => ancestor.contains(el));
10
10
  };
11
11
  /** Move the focus to `next` element, set tabindex to 0 for `next` and -1 to `current`. */
12
- const moveFocus = (current, next) => {
12
+ export const moveFocus = (current, next) => {
13
13
  current.tabIndex = -1;
14
14
  next.tabIndex = 0;
15
15
  next.focus();
16
16
  };
17
-
18
- export { containsTarget as c, moveFocus as m };
19
- //# sourceMappingURL=utils-CaxAWyZI.js.map
20
-
21
- //# sourceMappingURL=utils-CaxAWyZI.js.map
17
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAqB,EAAE,KAAY,EAAE,EAAE;IACpE,OAAO,KAAK;SACT,YAAY,EAAE;SACd,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC;SACvD,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAiB,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAoB,EAAE,IAAiB,EAAE,EAAE;IACnE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,CAAC;AACf,CAAC,CAAC","sourcesContent":["/**\n * Check if an element contains an event target by checking its composedPath.\n * Useful when an event target may come from a component's shadow DOM.\n */\nexport const containsTarget = (ancestor: HTMLElement, event: Event) => {\n return event\n .composedPath()\n .filter((el) => el !== document && el !== window.window)\n .some((el) => ancestor.contains(el as HTMLElement));\n};\n\n/** Move the focus to `next` element, set tabindex to 0 for `next` and -1 to `current`. */\nexport const moveFocus = (current: HTMLElement, next: HTMLElement) => {\n current.tabIndex = -1;\n next.tabIndex = 0;\n next.focus();\n};\n"]}