@zanichelli/zanichelli-it-frontend-kit 0.1.6 → 1.0.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 (103) hide show
  1. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js +4170 -0
  2. package/dist/zanichelli-it-frontend-kit/index-Cn3aX5eK.js.map +1 -0
  3. package/dist/zanichelli-it-frontend-kit/index.esm.js +10 -0
  4. package/dist/zanichelli-it-frontend-kit/index.esm.js.map +1 -1
  5. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js +46 -0
  6. package/dist/zanichelli-it-frontend-kit/menu-DZlhu_pe.js.map +1 -0
  7. package/dist/{collection/utils/utils.js → zanichelli-it-frontend-kit/utils-CaxAWyZI.js} +7 -3
  8. package/dist/zanichelli-it-frontend-kit/utils-CaxAWyZI.js.map +1 -0
  9. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.css +993 -1
  10. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js +49 -1
  11. package/dist/zanichelli-it-frontend-kit/zanichelli-it-frontend-kit.esm.js.map +1 -1
  12. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.esm.js.map +1 -0
  13. package/dist/{components/zanit-menubar.js → zanichelli-it-frontend-kit/zanit-menubar.entry.js} +12 -55
  14. package/dist/zanichelli-it-frontend-kit/zanit-menubar.entry.js.map +1 -0
  15. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.esm.js.map +1 -0
  16. package/dist/{components/p-DGmSfTXD.js → zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js} +13 -86
  17. package/dist/zanichelli-it-frontend-kit/zanit-mobile-menubar.entry.js.map +1 -0
  18. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.esm.js.map +1 -0
  19. package/dist/{components/p-CiHl-h3q.js → zanichelli-it-frontend-kit/zanit-search-form.entry.js} +13 -52
  20. package/dist/zanichelli-it-frontend-kit/zanit-search-form.entry.js.map +1 -0
  21. package/package.json +1 -1
  22. package/www/build/index-Cn3aX5eK.js +4170 -0
  23. package/www/build/index-Cn3aX5eK.js.map +1 -0
  24. package/www/build/index.esm.js +10 -0
  25. package/www/build/index.esm.js.map +1 -1
  26. package/www/build/menu-DZlhu_pe.js +46 -0
  27. package/www/build/menu-DZlhu_pe.js.map +1 -0
  28. package/www/build/utils-CaxAWyZI.js +21 -0
  29. package/www/build/utils-CaxAWyZI.js.map +1 -0
  30. package/www/build/zanichelli-it-frontend-kit.css +993 -1
  31. package/www/build/zanichelli-it-frontend-kit.esm.js +49 -1
  32. package/www/build/zanichelli-it-frontend-kit.esm.js.map +1 -1
  33. package/www/build/zanit-menubar.entry.esm.js.map +1 -0
  34. package/{dist/collection/components/menubar/menubar.js → www/build/zanit-menubar.entry.js} +25 -157
  35. package/www/build/zanit-menubar.entry.js.map +1 -0
  36. package/www/build/zanit-mobile-menubar.entry.esm.js.map +1 -0
  37. package/www/build/zanit-mobile-menubar.entry.js +166 -0
  38. package/www/build/zanit-mobile-menubar.entry.js.map +1 -0
  39. package/www/build/zanit-search-form.entry.esm.js.map +1 -0
  40. package/{dist/collection/components/menubar/search-form/search-form.js → www/build/zanit-search-form.entry.js} +22 -98
  41. package/www/build/zanit-search-form.entry.js.map +1 -0
  42. package/www/index.html +297 -244
  43. package/dist/cjs/index-xkrZykI_.js +0 -1532
  44. package/dist/cjs/index-xkrZykI_.js.map +0 -1
  45. package/dist/cjs/index.cjs.js +0 -5
  46. package/dist/cjs/index.cjs.js.map +0 -1
  47. package/dist/cjs/loader.cjs.js +0 -15
  48. package/dist/cjs/loader.cjs.js.map +0 -1
  49. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js +0 -27
  50. package/dist/cjs/zanichelli-it-frontend-kit.cjs.js.map +0 -1
  51. package/dist/cjs/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.cjs.js.map +0 -1
  52. package/dist/cjs/zanit-menubar_3.cjs.entry.js +0 -676
  53. package/dist/cjs/zanit-menubar_3.cjs.entry.js.map +0 -1
  54. package/dist/collection/collection-manifest.json +0 -14
  55. package/dist/collection/components/menubar/menu/menu.css +0 -98
  56. package/dist/collection/components/menubar/menu/menu.js +0 -38
  57. package/dist/collection/components/menubar/menu/menu.js.map +0 -1
  58. package/dist/collection/components/menubar/menubar.css +0 -167
  59. package/dist/collection/components/menubar/menubar.js.map +0 -1
  60. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.css +0 -114
  61. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js +0 -290
  62. package/dist/collection/components/menubar/mobile-menubar/mobile-menubar.js.map +0 -1
  63. package/dist/collection/components/menubar/search-form/search-form.css +0 -147
  64. package/dist/collection/components/menubar/search-form/search-form.js.map +0 -1
  65. package/dist/collection/index.js +0 -11
  66. package/dist/collection/index.js.map +0 -1
  67. package/dist/collection/utils/types.js +0 -2
  68. package/dist/collection/utils/types.js.map +0 -1
  69. package/dist/collection/utils/utils.js.map +0 -1
  70. package/dist/components/index.js +0 -1290
  71. package/dist/components/index.js.map +0 -1
  72. package/dist/components/p-CiHl-h3q.js.map +0 -1
  73. package/dist/components/p-DGmSfTXD.js.map +0 -1
  74. package/dist/components/zanit-menubar.js.map +0 -1
  75. package/dist/components/zanit-mobile-menubar.js +0 -9
  76. package/dist/components/zanit-mobile-menubar.js.map +0 -1
  77. package/dist/components/zanit-search-form.js +0 -9
  78. package/dist/components/zanit-search-form.js.map +0 -1
  79. package/dist/esm/index-BWVQ0LD4.js +0 -1504
  80. package/dist/esm/index-BWVQ0LD4.js.map +0 -1
  81. package/dist/esm/index.js +0 -4
  82. package/dist/esm/index.js.map +0 -1
  83. package/dist/esm/loader.js +0 -13
  84. package/dist/esm/loader.js.map +0 -1
  85. package/dist/esm/zanichelli-it-frontend-kit.js +0 -23
  86. package/dist/esm/zanichelli-it-frontend-kit.js.map +0 -1
  87. package/dist/esm/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.js.map +0 -1
  88. package/dist/esm/zanit-menubar_3.entry.js +0 -672
  89. package/dist/esm/zanit-menubar_3.entry.js.map +0 -1
  90. package/dist/index.cjs.js +0 -1
  91. package/dist/index.js +0 -1
  92. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js +0 -3
  93. package/dist/zanichelli-it-frontend-kit/p-BWVQ0LD4.js.map +0 -1
  94. package/dist/zanichelli-it-frontend-kit/p-eece6410.entry.js +0 -2
  95. package/dist/zanichelli-it-frontend-kit/p-eece6410.entry.js.map +0 -1
  96. package/dist/zanichelli-it-frontend-kit/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
  97. package/www/build/p-984b8fa6.css +0 -1
  98. package/www/build/p-BWVQ0LD4.js +0 -3
  99. package/www/build/p-BWVQ0LD4.js.map +0 -1
  100. package/www/build/p-eece6410.entry.js +0 -2
  101. package/www/build/p-eece6410.entry.js.map +0 -1
  102. package/www/build/p-fedb810b.js +0 -2
  103. package/www/build/zanit-menubar.zanit-mobile-menubar.zanit-search-form.entry.esm.js.map +0 -1
@@ -1,2 +1,12 @@
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
+ //# sourceMappingURL=index.esm.js.map
1
11
 
2
12
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":["src/index.ts"],"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"],"names":[],"mappings":"AAAA;;;;;;;;AAQG"}
@@ -0,0 +1,46 @@
1
+ import { h } from './index-Cn3aX5eK.js';
2
+
3
+ const DEFAULT_GROUP_KEY = 'default';
4
+ const DEFAULT_GROUP = {
5
+ id: DEFAULT_GROUP_KEY,
6
+ label: DEFAULT_GROUP_KEY,
7
+ };
8
+ /** Get the items grouped by their group. */
9
+ const getGroupedItems = (items) => {
10
+ const groups = items.reduce((grouped, item) => {
11
+ const itemGroup = grouped.find(({ group }) => group.id === (item.group?.id || DEFAULT_GROUP.id));
12
+ if (!itemGroup) {
13
+ grouped.push({ group: item.group ?? DEFAULT_GROUP, items: [item] });
14
+ }
15
+ else {
16
+ itemGroup.items.push(item);
17
+ }
18
+ return grouped;
19
+ }, []);
20
+ // Sort to keep default group at the end
21
+ return groups.sort((a, b) => (a.group.id === DEFAULT_GROUP_KEY ? 1 : b.group.id === DEFAULT_GROUP_KEY ? -1 : 0));
22
+ };
23
+ /**
24
+ * Floating menu component. It shows a list of items that can be grouped.
25
+ */
26
+ const Menu = ({ controlledBy, items, currentPath = [], onItemKeyDown }) => {
27
+ if (!items?.length) {
28
+ return null;
29
+ }
30
+ const groups = getGroupedItems(items);
31
+ const isActive = (item) => currentPath.includes(controlledBy) && currentPath.includes(item.id);
32
+ return (h("div", { class: "menu-wrapper", role: "none" },
33
+ h("div", { class: "menu", "aria-labelledby": controlledBy ?? undefined, role: "menu" }, groups.map(({ group, items }) => (h("div", { class: { group: true, highlight: items.some((item) => item.highlight) } },
34
+ group.id !== DEFAULT_GROUP_KEY ? (h("div", { class: "group-name", id: group.id }, group.label)) : groups.length > 1 ? (
35
+ // empty div to keep the same height as the other groups
36
+ h("div", { class: "group-name" })) : null,
37
+ h("ul", { class: "menu-list", role: "group", "aria-labelledby": group.id !== DEFAULT_GROUP_KEY ? group.id : undefined }, items.map((item) => (h("li", { role: "none" }, item.href && (h("a", { class: {
38
+ 'menu-item': true,
39
+ 'active': isActive(item),
40
+ }, href: item.href, role: "menuitem", tabIndex: -1, "aria-current": isActive(item) ? 'page' : 'false', onKeyDown: (event) => onItemKeyDown(event), target: item.target }, item.label))))))))))));
41
+ };
42
+
43
+ export { Menu as M };
44
+ //# sourceMappingURL=menu-DZlhu_pe.js.map
45
+
46
+ //# sourceMappingURL=menu-DZlhu_pe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-DZlhu_pe.js","sources":["src/components/menubar/menu/menu.tsx"],"sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\nimport { MenuItem } from '../../../utils/types';\n\n/**\n * Menu of items that can be grouped.\n * @member {string} controlledBy - The HTML id of the element that controls the menu.\n * @member {MenuItem[]} items - The items to show in the menu.\n * @member {string[]} currentPath - Path of current item.\n * @member {function} onItemKeyDown - The function to call when a key is pressed from a menuitem.\n */\nexport interface MenuProps {\n controlledBy?: string;\n items?: MenuItem[];\n currentPath?: string[];\n onItemKeyDown?: (event: KeyboardEvent) => void;\n}\n\nconst DEFAULT_GROUP_KEY = 'default';\nconst DEFAULT_GROUP = {\n id: DEFAULT_GROUP_KEY,\n label: DEFAULT_GROUP_KEY,\n};\n\n/** Get the items grouped by their group. */\nconst getGroupedItems = (items: MenuItem[]) => {\n const groups = items.reduce<{ group: MenuProps['items'][number]['group']; items: MenuItem[] }[]>((grouped, item) => {\n const itemGroup = grouped.find(({ group }) => group.id === (item.group?.id || DEFAULT_GROUP.id));\n if (!itemGroup) {\n grouped.push({ group: item.group ?? DEFAULT_GROUP, items: [item] });\n } else {\n itemGroup.items.push(item);\n }\n\n return grouped;\n }, []);\n\n // Sort to keep default group at the end\n return groups.sort((a, b) => (a.group.id === DEFAULT_GROUP_KEY ? 1 : b.group.id === DEFAULT_GROUP_KEY ? -1 : 0));\n};\n\n/**\n * Floating menu component. It shows a list of items that can be grouped.\n */\nexport const Menu: FunctionalComponent<MenuProps> = ({ controlledBy, items, currentPath = [], onItemKeyDown }) => {\n if (!items?.length) {\n return null;\n }\n\n const groups = getGroupedItems(items);\n\n const isActive = (item: MenuItem) => currentPath.includes(controlledBy) && currentPath.includes(item.id);\n\n return (\n <div\n class=\"menu-wrapper\"\n role=\"none\"\n >\n <div\n class=\"menu\"\n aria-labelledby={controlledBy ?? undefined}\n role=\"menu\"\n >\n {groups.map(({ group, items }) => (\n <div class={{ group: true, highlight: items.some((item) => item.highlight) }}>\n {group.id !== DEFAULT_GROUP_KEY ? (\n <div\n class=\"group-name\"\n id={group.id}\n >\n {group.label}\n </div>\n ) : groups.length > 1 ? (\n // empty div to keep the same height as the other groups\n <div class=\"group-name\" />\n ) : null}\n <ul\n class=\"menu-list\"\n role=\"group\"\n aria-labelledby={group.id !== DEFAULT_GROUP_KEY ? group.id : undefined}\n >\n {items.map((item) => (\n <li role=\"none\">\n {item.href && (\n <a\n class={{\n 'menu-item': true,\n 'active': isActive(item),\n }}\n href={item.href}\n role=\"menuitem\"\n tabIndex={-1}\n aria-current={isActive(item) ? 'page' : 'false'}\n onKeyDown={(event) => onItemKeyDown(event)}\n target={item.target}\n >\n {item.label}\n </a>\n )}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;AAiBA,MAAM,iBAAiB,GAAG,SAAS;AACnC,MAAM,aAAa,GAAG;AACpB,IAAA,EAAE,EAAE,iBAAiB;AACrB,IAAA,KAAK,EAAE,iBAAiB;CACzB;AAED;AACA,MAAM,eAAe,GAAG,CAAC,KAAiB,KAAI;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAsE,CAAC,OAAO,EAAE,IAAI,KAAI;AACjH,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK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AA,KAAK,CAAC,EAAE,KAAK,iBAAiB,IAC7B,CAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,YAAY,EAClB,EAAE,EAAE,KAAK,CAAC,EAAE,EAAA,EAEX,KAAK,CAAC,KAAK,CACR,IACJ,MAAM,CAAC,MAAM,GAAG,CAAC;;YAEnB,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,YAAY,EAAA,CAAG,IACxB,IAAI;YACR,CACE,CAAA,IAAA,EAAA,EAAA,KAAK,EAAC,WAAW,EACjB,IAAI,EAAC,OAAO,qBACK,KAAK,CAAC,EAAE,KAAK,iBAAiB,GAAG,KAAK,CAAC,EAAE,GAAG,SAAS,IAErE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,MACd,CAAA,CAAA,IAAA,EAAA,EAAI,IAAI,EAAC,MAAM,IACZ,IAAI,CAAC,IAAI,KACR,CACE,CAAA,GAAA,EAAA,EAAA,KAAK,EAAE;AACL,oBAAA,WAAW,EAAE,IAAI;AACjB,oBAAA,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC;AACzB,iBAAA,EACD,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,EACE,cAAA,EAAA,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,OAAO,EAC/C,SAAS,EAAE,CAAC,KAAK,KAAK,aAAa,CAAC,KAAK,CAAC,EAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,EAAA,EAElB,IAAI,CAAC,KAAK,CACT,CACL,CACE,CACN,CAAC,CACC,CACD,CACP,CAAC,CACE,CACF;AAEV;;;;"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Check if an element contains an event target by checking its composedPath.
3
+ * Useful when an event target may come from a component's shadow DOM.
4
+ */
5
+ const containsTarget = (ancestor, event) => {
6
+ return event
7
+ .composedPath()
8
+ .filter((el) => el !== document && el !== window.window)
9
+ .some((el) => ancestor.contains(el));
10
+ };
11
+ /** Move the focus to `next` element, set tabindex to 0 for `next` and -1 to `current`. */
12
+ const moveFocus = (current, next) => {
13
+ current.tabIndex = -1;
14
+ next.tabIndex = 0;
15
+ next.focus();
16
+ };
17
+
18
+ export { containsTarget as c, moveFocus as m };
19
+ //# sourceMappingURL=utils-CaxAWyZI.js.map
20
+
21
+ //# sourceMappingURL=utils-CaxAWyZI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-CaxAWyZI.js","sources":["src/utils/utils.ts"],"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"],"names":[],"mappings":"AAAA;;;AAGG;MACU,cAAc,GAAG,CAAC,QAAqB,EAAE,KAAY,KAAI;AACpE,IAAA,OAAO;AACJ,SAAA,YAAY;AACZ,SAAA,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,CAAC,MAAM;AACtD,SAAA,IAAI,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,QAAQ,CAAC,EAAiB,CAAC,CAAC;AACvD;AAEA;MACa,SAAS,GAAG,CAAC,OAAoB,EAAE,IAAiB,KAAI;AACnE,IAAA,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACrB,IAAA,IAAI,CAAC,QAAQ,GAAG,CAAC;IACjB,IAAI,CAAC,KAAK,EAAE;AACd;;;;"}