@nova-design-system/nova-react 3.0.0-beta.40 → 3.0.0-beta.42

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 (89) hide show
  1. package/dist/cjs/_commonjsHelpers-1789f0cf-BJu3ubxk.js +10 -0
  2. package/dist/cjs/clsx-297c1ffe-BtxeOLZW.js +5 -0
  3. package/dist/cjs/constants-98e2dcc2-C0SBCapP.js +250 -0
  4. package/dist/cjs/dom.utils-ac71e0ef-CmIwRr6O.js +168 -0
  5. package/dist/cjs/events.utils-fe1d907f-01N__3wY.js +23 -0
  6. package/dist/cjs/fade.animation-2a077983-aKN0EDTo.js +1832 -0
  7. package/dist/cjs/index-C8UfzrMI.js +26405 -0
  8. package/dist/cjs/index-CinzsZ8D.js +26405 -0
  9. package/dist/cjs/index.js +48 -0
  10. package/dist/cjs/inputmask-edcad3c1-B9Omti4z.js +3749 -0
  11. package/dist/cjs/nv-alert.entry-8esWDUyU.js +173 -0
  12. package/dist/cjs/nv-alert.entry-BVY_rxey.js +173 -0
  13. package/dist/cjs/nv-avatar.entry-CO6bt4k6.js +67 -0
  14. package/dist/cjs/nv-avatar.entry-pREKtiv2.js +67 -0
  15. package/dist/cjs/nv-badge_2.entry-wDuiCwys.js +195 -0
  16. package/dist/cjs/nv-badge_2.entry-xfXsesV0.js +195 -0
  17. package/dist/cjs/nv-base.entry-BO-6krwg.js +71 -0
  18. package/dist/cjs/nv-base.entry-DwtTXK_n.js +71 -0
  19. package/dist/cjs/nv-breadcrumb.entry-B0hIeE83.js +45 -0
  20. package/dist/cjs/nv-breadcrumb.entry-DTwjCmMI.js +45 -0
  21. package/dist/cjs/nv-breadcrumbs.entry-Cq0LsIFs.js +20 -0
  22. package/dist/cjs/nv-breadcrumbs.entry-jn5hRjpQ.js +20 -0
  23. package/dist/cjs/nv-button.entry-DaSGnB1L.js +162 -0
  24. package/dist/cjs/nv-button.entry-DxzA6-My.js +162 -0
  25. package/dist/cjs/nv-calendar.entry-BC6NDsVl.js +1036 -0
  26. package/dist/cjs/nv-calendar.entry-DKz-iBnp.js +1036 -0
  27. package/dist/cjs/nv-col.entry-DNUY559i.js +37 -0
  28. package/dist/cjs/nv-col.entry-X7jkNThH.js +37 -0
  29. package/dist/cjs/nv-datagrid.entry-Cp8RCSEv.js +3671 -0
  30. package/dist/cjs/nv-datagrid.entry-DL-Fyo4l.js +3671 -0
  31. package/dist/cjs/nv-datagridcolumn.entry-CR9_1fsZ.js +18 -0
  32. package/dist/cjs/nv-datagridcolumn.entry-CyTG5E7M.js +18 -0
  33. package/dist/cjs/nv-dialog.entry-BjTJ5FFL.js +784 -0
  34. package/dist/cjs/nv-dialog.entry-Do_uALC6.js +784 -0
  35. package/dist/cjs/nv-dialogfooter_2.entry-DJ8qS9q6.js +134 -0
  36. package/dist/cjs/nv-dialogfooter_2.entry-DJkKzEgO.js +134 -0
  37. package/dist/cjs/nv-fieldcheckbox.entry-C0DmeqXD.js +137 -0
  38. package/dist/cjs/nv-fieldcheckbox.entry-DoGQX-5D.js +137 -0
  39. package/dist/cjs/nv-fielddate.entry-D-PjbYaA.js +278 -0
  40. package/dist/cjs/nv-fielddate.entry-DRX2mfZL.js +278 -0
  41. package/dist/cjs/nv-fielddaterange.entry-BrC5jKLp.js +355 -0
  42. package/dist/cjs/nv-fielddaterange.entry-ka3JiDvT.js +355 -0
  43. package/dist/cjs/nv-fielddropdown.entry-DUAKFYgw.js +391 -0
  44. package/dist/cjs/nv-fielddropdown.entry-MsUR1kVe.js +391 -0
  45. package/dist/cjs/nv-fielddropdownitem.entry-BsbvJERH.js +70 -0
  46. package/dist/cjs/nv-fielddropdownitem.entry-DRM-Zljt.js +70 -0
  47. package/dist/cjs/nv-fieldmultiselect.entry-DFr-ZICs.js +1060 -0
  48. package/dist/cjs/nv-fieldmultiselect.entry-Dr8FfT_W.js +1060 -0
  49. package/dist/cjs/nv-fieldnumber.entry-DZsM1vmO.js +126 -0
  50. package/dist/cjs/nv-fieldnumber.entry-ezdDvJh_.js +126 -0
  51. package/dist/cjs/nv-fieldpassword.entry-Biw__M2W.js +115 -0
  52. package/dist/cjs/nv-fieldpassword.entry-D4a8SnGr.js +115 -0
  53. package/dist/cjs/nv-fieldradio.entry-Co7WX2vI.js +102 -0
  54. package/dist/cjs/nv-fieldradio.entry-ZL7KgEZ7.js +102 -0
  55. package/dist/cjs/nv-fieldselect.entry-D6eRsM9T.js +365 -0
  56. package/dist/cjs/nv-fieldselect.entry-sTbv_flF.js +365 -0
  57. package/dist/cjs/nv-fieldtext.entry-DKdxC2cG.js +119 -0
  58. package/dist/cjs/nv-fieldtext.entry-DRPCH6Sf.js +119 -0
  59. package/dist/cjs/nv-fieldtextarea.entry-BwJCUiVW.js +194 -0
  60. package/dist/cjs/nv-fieldtextarea.entry-Dc_TGlmI.js +194 -0
  61. package/dist/cjs/nv-fieldtime.entry-CXRtpWt1.js +1011 -0
  62. package/dist/cjs/nv-fieldtime.entry-uU-IET2k.js +1011 -0
  63. package/dist/cjs/nv-icon.entry-iipuvT3D.js +79 -0
  64. package/dist/cjs/nv-icon.entry-xltjoSa2.js +79 -0
  65. package/dist/cjs/nv-iconbutton_2.entry-BsXvYbCi.js +163 -0
  66. package/dist/cjs/nv-iconbutton_2.entry-Dx4usGkY.js +163 -0
  67. package/dist/cjs/nv-menu.entry-D3qvf_0H.js +227 -0
  68. package/dist/cjs/nv-menu.entry-DFEYw_KZ.js +227 -0
  69. package/dist/cjs/nv-menuitem.entry-3t6TixM7.js +58 -0
  70. package/dist/cjs/nv-menuitem.entry-BeTXOtir.js +58 -0
  71. package/dist/cjs/nv-popover.entry-Bv6kuTK_.js +1960 -0
  72. package/dist/cjs/nv-popover.entry-Zt25YeAv.js +1960 -0
  73. package/dist/cjs/nv-row.entry-BPK1Li7w.js +21 -0
  74. package/dist/cjs/nv-row.entry-Bwzlub3i.js +21 -0
  75. package/dist/cjs/nv-stack.entry-ByaO-0TJ.js +30 -0
  76. package/dist/cjs/nv-stack.entry-bhess4lQ.js +30 -0
  77. package/dist/cjs/nv-table.entry-C7Hd57Iq.js +338 -0
  78. package/dist/cjs/nv-table.entry-D3U4dFcw.js +338 -0
  79. package/dist/cjs/nv-tablecolumn.entry-BDCw_45v.js +18 -0
  80. package/dist/cjs/nv-tablecolumn.entry-BzwWPlLf.js +18 -0
  81. package/dist/cjs/nv-toggle.entry-BTqGH_H0.js +79 -0
  82. package/dist/cjs/nv-toggle.entry-DXpNGkbz.js +79 -0
  83. package/dist/cjs/nv-tooltip.entry-BDZfrLHv.js +44 -0
  84. package/dist/cjs/nv-tooltip.entry-CvCZZV88.js +44 -0
  85. package/dist/cjs/timeline.animation-1b88f052-B8-vCVrY.js +105 -0
  86. package/dist/cjs/v4-a79185f4-2n0dOd_Y.js +56 -0
  87. package/dist/generated/components.js +16 -0
  88. package/dist/types/generated/components.d.ts +19 -3
  89. package/package.json +14 -5
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C8UfzrMI.js');
4
+ var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
5
+ require('react');
6
+
7
+ const nvIconbuttonCss = "nv-iconbutton.root{display:inline-flex;justify-content:center;align-items:center;font-style:normal;font-weight:500;font-family:\"TT Norms Pro\", sans-serif;transition:background-color 150ms ease-out;height:fit-content;width:fit-content}nv-iconbutton.size-xs{padding:var(--button-xs-icon-button-padding);gap:var(--button-xs-gap);border-radius:var(--button-xs-border-radius);line-height:var(--button-xs-line-height);font-size:var(--button-xs-font-size)}nv-iconbutton.size-sm{padding:var(--button-sm-icon-button-padding);gap:var(--button-sm-gap);border-radius:var(--button-sm-border-radius);line-height:var(--button-sm-line-height);font-size:var(--button-sm-font-size)}nv-iconbutton.size-md{padding:var(--button-md-icon-button-padding);gap:var(--button-md-gap);border-radius:var(--button-md-border-radius);line-height:var(--button-md-line-height);font-size:var(--button-md-font-size)}nv-iconbutton.size-lg{padding:var(--button-lg-icon-button-padding);gap:var(--button-lg-gap);border-radius:var(--button-lg-border-radius);line-height:var(--button-lg-line-height);font-size:var(--button-lg-font-size)}nv-iconbutton.emphasis-high{background:var(--components-button-high-background);border:1px solid var(--components-button-high-border);color:var(--components-button-high-text)}nv-iconbutton.emphasis-high:hover{background:var(--components-button-high-background-hover);color:var(--components-button-high-text-hover)}nv-iconbutton.emphasis-high:focus,nv-iconbutton.emphasis-high:focus-within{outline:none}nv-iconbutton.emphasis-high:focus-visible,nv-iconbutton.emphasis-high:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-high:disabled{background:var(--components-button-high-background);color:var(--components-button-high-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-high nv-icon>svg{color:var(--components-button-high-icon)}nv-iconbutton.emphasis-medium{background:var(--components-button-medium-background);border:1px solid var(--components-button-medium-border);color:var(--components-button-medium-text)}nv-iconbutton.emphasis-medium:hover{background:var(--components-button-medium-background-hover);color:var(--components-button-medium-text-hover)}nv-iconbutton.emphasis-medium:focus,nv-iconbutton.emphasis-medium:focus-within{outline:none}nv-iconbutton.emphasis-medium:focus-visible,nv-iconbutton.emphasis-medium:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-medium:disabled{background:var(--components-button-medium-background);color:var(--components-button-medium-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-medium nv-icon>svg{color:var(--components-button-medium-icon)}nv-iconbutton.emphasis-low{background:var(--components-button-low-background);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text)}nv-iconbutton.emphasis-low:hover{background:var(--components-button-low-background-hover);color:var(--components-button-low-text-hover)}nv-iconbutton.emphasis-low:focus,nv-iconbutton.emphasis-low:focus-within{outline:none}nv-iconbutton.emphasis-low:focus-visible,nv-iconbutton.emphasis-low:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-low:disabled{background:var(--components-button-low-background);color:var(--components-button-low-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-low nv-icon>svg{color:var(--components-button-low-icon)}nv-iconbutton.emphasis-lower{background:var(--components-button-lower-background);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text)}nv-iconbutton.emphasis-lower:hover{background:var(--components-button-lower-background-hover);color:var(--components-button-lower-text-hover)}nv-iconbutton.emphasis-lower:focus,nv-iconbutton.emphasis-lower:focus-within{outline:none}nv-iconbutton.emphasis-lower:focus-visible,nv-iconbutton.emphasis-lower:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-lower:disabled{background:var(--components-button-lower-background);color:var(--components-button-lower-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-lower nv-icon>svg{color:var(--components-button-lower-icon)}nv-iconbutton.loading [slot=leading-icon]{display:none}nv-iconbutton.shape-rounded{border-radius:var(--radius-rounded-full)}";
8
+ const NvIconbuttonStyle0 = nvIconbuttonCss;
9
+
10
+ const NvIconbutton = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ if (hostRef.$hostElement$["s-ei"]) {
14
+ this.internals = hostRef.$hostElement$["s-ei"];
15
+ }
16
+ else {
17
+ this.internals = hostRef.$hostElement$.attachInternals();
18
+ hostRef.$hostElement$["s-ei"] = this.internals;
19
+ }
20
+ /****************************************************************************/
21
+ //#region PROPERTIES
22
+ /**
23
+ * Determines how large or small the button appears, allowing for
24
+ * customization of the button's dimensions to fit different design
25
+ * specifications and user needs.
26
+ */
27
+ this.size = 'md';
28
+ /**
29
+ * Adjusts the button’s emphasis to make it more or less visually prominent
30
+ * to users. Use this to draw attention to important actions or reduce focus
31
+ * on less critical ones.
32
+ */
33
+ this.emphasis = 'high';
34
+ /**
35
+ * Set this to true to show a spinner on the button, letting users know that
36
+ * their action is being processed. It helps improve user experience by
37
+ * indicating ongoing activities. The icon is not displayed when the button
38
+ * is loading. Also, the button is disabled. If you want to disable the
39
+ * button, it is not possible. It is automatically disabled when loading.
40
+ */
41
+ this.loading = false;
42
+ /**
43
+ * Disables the button, preventing user interaction.
44
+ */
45
+ this.disabled = false;
46
+ /**
47
+ * Makes the button look active when it’s within a compatible component
48
+ * like a button group.
49
+ */
50
+ this.active = false;
51
+ /**
52
+ * Sets the button type to control its function in forms. Use 'submit' to send
53
+ * form data, 'reset' to clear the form, or 'button' for a standard button
54
+ * that doesn’t interact with form submission by default.
55
+ */
56
+ this.type = 'button';
57
+ /**
58
+ * Sets the shape of the button. Choose between square and rounded.
59
+ */
60
+ this.shape = 'square';
61
+ //#endregion PROPERTIES
62
+ /****************************************************************************/
63
+ //#region METHODS
64
+ /**
65
+ * Handles form-related actions when the button is clicked.
66
+ * - Submits the form if the button type is 'submit'.
67
+ * - Resets the form if the button type is 'reset'.
68
+ * @param {Event} event - The click event.
69
+ */
70
+ this.handleClick = (event) => {
71
+ var _a, _b, _c, _d;
72
+ if (this.disabled) {
73
+ event.preventDefault();
74
+ return;
75
+ }
76
+ if (this.type === 'submit') {
77
+ (_b = (_a = this.internals) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.requestSubmit();
78
+ }
79
+ if (this.type === 'reset') {
80
+ (_d = (_c = this.internals) === null || _c === void 0 ? void 0 : _c.form) === null || _d === void 0 ? void 0 : _d.reset();
81
+ }
82
+ };
83
+ }
84
+ //#endregion METHODS
85
+ /****************************************************************************/
86
+ //#region WATCHERS
87
+ handleLoadingChange(loading) {
88
+ this.loading = loading;
89
+ this.disabled = loading;
90
+ }
91
+ handleDisabledChange(disabled) {
92
+ if (this.loading) {
93
+ this.disabled = this.loading;
94
+ }
95
+ else {
96
+ this.disabled = disabled;
97
+ }
98
+ }
99
+ //#endregion WATCHERS
100
+ /****************************************************************************/
101
+ //#region EVENTS
102
+ handleKeyDown(event) {
103
+ if (event.key === 'Enter' || event.key === ' ') {
104
+ event.preventDefault();
105
+ this.el.click();
106
+ }
107
+ }
108
+ handleTouchStart(event) {
109
+ if (event.touches.length > 1)
110
+ return;
111
+ event.preventDefault();
112
+ this.el.click();
113
+ }
114
+ //#endregion EVENTS
115
+ /****************************************************************************/
116
+ //#region LIFECYCLE
117
+ componentWillLoad() {
118
+ if (this.loading) {
119
+ this.disabled = this.loading;
120
+ }
121
+ }
122
+ //#endregion LIFECYCLE
123
+ /****************************************************************************/
124
+ //#region RENDER
125
+ render() {
126
+ return (index.h(index.Host, { key: '3cb0f36cea2cfcefe2792893742fa7478068377f', role: "button", type: this.type, tabindex: "0", disabled: this.disabled ? true : undefined, class: clsx297c1ffe.clsx('root', `size-${this.size}`, `emphasis-${this.emphasis}`, this.loading && 'loading', `shape-${this.shape}`), onClick: this.handleClick }, this.loading && index.h("nv-loader", { key: '9e982898299e460a1828c6a52cc4f0560bb13c68', size: this.size }), !this.loading && index.h("nv-icon", { key: 'b8f0337dd42132b28d8a7d75d0cdce9ebebb1fc4', name: this.name, size: this.size }), index.h("slot", { key: '31aaff45c890e8eaf961b3cb82136caabbbe0eaf' })));
127
+ }
128
+ static get formAssociated() { return true; }
129
+ get el() { return index.getElement(this); }
130
+ static get watchers() { return {
131
+ "loading": ["handleLoadingChange"],
132
+ "disabled": ["handleDisabledChange"]
133
+ }; }
134
+ };
135
+ NvIconbutton.style = NvIconbuttonStyle0;
136
+
137
+ const nvLoaderCss = "@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}nv-loader{display:inline-block;position:relative;aspect-ratio:1/1;border-radius:9999px;color:inherit}nv-loader.size-xs{width:var(--loader-size-xs);height:var(--loader-size-xs)}nv-loader.size-xs::before,nv-loader.size-xs::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xs::before{content:\" \";border:calc(var(--loader-size-xs) / 10) solid;opacity:0.3}nv-loader.size-xs::after{content:\" \";border-top:calc(var(--loader-size-xs) / 10) solid transparent;border-left:calc(var(--loader-size-xs) / 10) solid transparent;border-right:calc(var(--loader-size-xs) / 10) solid transparent;border-bottom:calc(var(--loader-size-xs) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-sm{width:var(--loader-size-sm);height:var(--loader-size-sm)}nv-loader.size-sm::before,nv-loader.size-sm::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-sm::before{content:\" \";border:calc(var(--loader-size-sm) / 10) solid;opacity:0.3}nv-loader.size-sm::after{content:\" \";border-top:calc(var(--loader-size-sm) / 10) solid transparent;border-left:calc(var(--loader-size-sm) / 10) solid transparent;border-right:calc(var(--loader-size-sm) / 10) solid transparent;border-bottom:calc(var(--loader-size-sm) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-md{width:var(--loader-size-md);height:var(--loader-size-md)}nv-loader.size-md::before,nv-loader.size-md::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-md::before{content:\" \";border:calc(var(--loader-size-md) / 10) solid;opacity:0.3}nv-loader.size-md::after{content:\" \";border-top:calc(var(--loader-size-md) / 10) solid transparent;border-left:calc(var(--loader-size-md) / 10) solid transparent;border-right:calc(var(--loader-size-md) / 10) solid transparent;border-bottom:calc(var(--loader-size-md) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-lg{width:var(--loader-size-lg);height:var(--loader-size-lg)}nv-loader.size-lg::before,nv-loader.size-lg::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-lg::before{content:\" \";border:calc(var(--loader-size-lg) / 10) solid;opacity:0.3}nv-loader.size-lg::after{content:\" \";border-top:calc(var(--loader-size-lg) / 10) solid transparent;border-left:calc(var(--loader-size-lg) / 10) solid transparent;border-right:calc(var(--loader-size-lg) / 10) solid transparent;border-bottom:calc(var(--loader-size-lg) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-xl{width:var(--loader-size-xl);height:var(--loader-size-xl)}nv-loader.size-xl::before,nv-loader.size-xl::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xl::before{content:\" \";border:calc(var(--loader-size-xl) / 10) solid;opacity:0.3}nv-loader.size-xl::after{content:\" \";border-top:calc(var(--loader-size-xl) / 10) solid transparent;border-left:calc(var(--loader-size-xl) / 10) solid transparent;border-right:calc(var(--loader-size-xl) / 10) solid transparent;border-bottom:calc(var(--loader-size-xl) / 10) solid;animation:rotation 1s linear infinite}nv-loader.color-brand::before{border-color:var(--components-loader-brand-background);opacity:1}nv-loader.color-brand::after{border-bottom-color:var(--components-loader-brand-foreground)}nv-loader.color-white::before{border-color:var(--components-loader-white-background);opacity:1}nv-loader.color-white::after{border-bottom-color:var(--components-loader-white-foreground)}";
138
+ const NvLoaderStyle0 = nvLoaderCss;
139
+
140
+ const NvLoader = class {
141
+ constructor(hostRef) {
142
+ index.registerInstance(this, hostRef);
143
+ /****************************************************************************/
144
+ //#region PROPERTIES
145
+ /**
146
+ * Choose the size of the loader to best fit your application’s needs, whether
147
+ * it’s a small spinner for subtle loading indicators or a large one for more
148
+ * prominent displays.
149
+ */
150
+ this.size = 'md';
151
+ }
152
+ //#endregion PROPERTIES
153
+ /****************************************************************************/
154
+ //#region RENDER
155
+ /* <slot> empty to force rendering change */
156
+ render() {
157
+ return (index.h(index.Host, { key: '9e9d2153c7fbb074e143bf01409eca65ec7ba08c', class: clsx297c1ffe.clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
158
+ }
159
+ };
160
+ NvLoader.style = NvLoaderStyle0;
161
+
162
+ exports.nv_iconbutton = NvIconbutton;
163
+ exports.nv_loader = NvLoader;
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-CinzsZ8D.js');
4
+ var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
5
+ require('react');
6
+
7
+ const nvIconbuttonCss = "nv-iconbutton.root{display:inline-flex;justify-content:center;align-items:center;font-style:normal;font-weight:500;font-family:\"TT Norms Pro\", sans-serif;transition:background-color 150ms ease-out;height:fit-content;width:fit-content}nv-iconbutton.size-xs{padding:var(--button-xs-icon-button-padding);gap:var(--button-xs-gap);border-radius:var(--button-xs-border-radius);line-height:var(--button-xs-line-height);font-size:var(--button-xs-font-size)}nv-iconbutton.size-sm{padding:var(--button-sm-icon-button-padding);gap:var(--button-sm-gap);border-radius:var(--button-sm-border-radius);line-height:var(--button-sm-line-height);font-size:var(--button-sm-font-size)}nv-iconbutton.size-md{padding:var(--button-md-icon-button-padding);gap:var(--button-md-gap);border-radius:var(--button-md-border-radius);line-height:var(--button-md-line-height);font-size:var(--button-md-font-size)}nv-iconbutton.size-lg{padding:var(--button-lg-icon-button-padding);gap:var(--button-lg-gap);border-radius:var(--button-lg-border-radius);line-height:var(--button-lg-line-height);font-size:var(--button-lg-font-size)}nv-iconbutton.emphasis-high{background:var(--components-button-high-background);border:1px solid var(--components-button-high-border);color:var(--components-button-high-text)}nv-iconbutton.emphasis-high:hover{background:var(--components-button-high-background-hover);color:var(--components-button-high-text-hover)}nv-iconbutton.emphasis-high:focus,nv-iconbutton.emphasis-high:focus-within{outline:none}nv-iconbutton.emphasis-high:focus-visible,nv-iconbutton.emphasis-high:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-high:disabled{background:var(--components-button-high-background);color:var(--components-button-high-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-high nv-icon>svg{color:var(--components-button-high-icon)}nv-iconbutton.emphasis-medium{background:var(--components-button-medium-background);border:1px solid var(--components-button-medium-border);color:var(--components-button-medium-text)}nv-iconbutton.emphasis-medium:hover{background:var(--components-button-medium-background-hover);color:var(--components-button-medium-text-hover)}nv-iconbutton.emphasis-medium:focus,nv-iconbutton.emphasis-medium:focus-within{outline:none}nv-iconbutton.emphasis-medium:focus-visible,nv-iconbutton.emphasis-medium:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-medium:disabled{background:var(--components-button-medium-background);color:var(--components-button-medium-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-medium nv-icon>svg{color:var(--components-button-medium-icon)}nv-iconbutton.emphasis-low{background:var(--components-button-low-background);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text)}nv-iconbutton.emphasis-low:hover{background:var(--components-button-low-background-hover);color:var(--components-button-low-text-hover)}nv-iconbutton.emphasis-low:focus,nv-iconbutton.emphasis-low:focus-within{outline:none}nv-iconbutton.emphasis-low:focus-visible,nv-iconbutton.emphasis-low:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-low:disabled{background:var(--components-button-low-background);color:var(--components-button-low-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-low nv-icon>svg{color:var(--components-button-low-icon)}nv-iconbutton.emphasis-lower{background:var(--components-button-lower-background);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text)}nv-iconbutton.emphasis-lower:hover{background:var(--components-button-lower-background-hover);color:var(--components-button-lower-text-hover)}nv-iconbutton.emphasis-lower:focus,nv-iconbutton.emphasis-lower:focus-within{outline:none}nv-iconbutton.emphasis-lower:focus-visible,nv-iconbutton.emphasis-lower:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-iconbutton.emphasis-lower:disabled{background:var(--components-button-lower-background);color:var(--components-button-lower-text);opacity:0.5;cursor:not-allowed;box-shadow:none}nv-iconbutton.emphasis-lower nv-icon>svg{color:var(--components-button-lower-icon)}nv-iconbutton.loading [slot=leading-icon]{display:none}nv-iconbutton.shape-rounded{border-radius:var(--radius-rounded-full)}";
8
+ const NvIconbuttonStyle0 = nvIconbuttonCss;
9
+
10
+ const NvIconbutton = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ if (hostRef.$hostElement$["s-ei"]) {
14
+ this.internals = hostRef.$hostElement$["s-ei"];
15
+ }
16
+ else {
17
+ this.internals = hostRef.$hostElement$.attachInternals();
18
+ hostRef.$hostElement$["s-ei"] = this.internals;
19
+ }
20
+ /****************************************************************************/
21
+ //#region PROPERTIES
22
+ /**
23
+ * Determines how large or small the button appears, allowing for
24
+ * customization of the button's dimensions to fit different design
25
+ * specifications and user needs.
26
+ */
27
+ this.size = 'md';
28
+ /**
29
+ * Adjusts the button’s emphasis to make it more or less visually prominent
30
+ * to users. Use this to draw attention to important actions or reduce focus
31
+ * on less critical ones.
32
+ */
33
+ this.emphasis = 'high';
34
+ /**
35
+ * Set this to true to show a spinner on the button, letting users know that
36
+ * their action is being processed. It helps improve user experience by
37
+ * indicating ongoing activities. The icon is not displayed when the button
38
+ * is loading. Also, the button is disabled. If you want to disable the
39
+ * button, it is not possible. It is automatically disabled when loading.
40
+ */
41
+ this.loading = false;
42
+ /**
43
+ * Disables the button, preventing user interaction.
44
+ */
45
+ this.disabled = false;
46
+ /**
47
+ * Makes the button look active when it’s within a compatible component
48
+ * like a button group.
49
+ */
50
+ this.active = false;
51
+ /**
52
+ * Sets the button type to control its function in forms. Use 'submit' to send
53
+ * form data, 'reset' to clear the form, or 'button' for a standard button
54
+ * that doesn’t interact with form submission by default.
55
+ */
56
+ this.type = 'button';
57
+ /**
58
+ * Sets the shape of the button. Choose between square and rounded.
59
+ */
60
+ this.shape = 'square';
61
+ //#endregion PROPERTIES
62
+ /****************************************************************************/
63
+ //#region METHODS
64
+ /**
65
+ * Handles form-related actions when the button is clicked.
66
+ * - Submits the form if the button type is 'submit'.
67
+ * - Resets the form if the button type is 'reset'.
68
+ * @param {Event} event - The click event.
69
+ */
70
+ this.handleClick = (event) => {
71
+ var _a, _b, _c, _d;
72
+ if (this.disabled) {
73
+ event.preventDefault();
74
+ return;
75
+ }
76
+ if (this.type === 'submit') {
77
+ (_b = (_a = this.internals) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.requestSubmit();
78
+ }
79
+ if (this.type === 'reset') {
80
+ (_d = (_c = this.internals) === null || _c === void 0 ? void 0 : _c.form) === null || _d === void 0 ? void 0 : _d.reset();
81
+ }
82
+ };
83
+ }
84
+ //#endregion METHODS
85
+ /****************************************************************************/
86
+ //#region WATCHERS
87
+ handleLoadingChange(loading) {
88
+ this.loading = loading;
89
+ this.disabled = loading;
90
+ }
91
+ handleDisabledChange(disabled) {
92
+ if (this.loading) {
93
+ this.disabled = this.loading;
94
+ }
95
+ else {
96
+ this.disabled = disabled;
97
+ }
98
+ }
99
+ //#endregion WATCHERS
100
+ /****************************************************************************/
101
+ //#region EVENTS
102
+ handleKeyDown(event) {
103
+ if (event.key === 'Enter' || event.key === ' ') {
104
+ event.preventDefault();
105
+ this.el.click();
106
+ }
107
+ }
108
+ handleTouchStart(event) {
109
+ if (event.touches.length > 1)
110
+ return;
111
+ event.preventDefault();
112
+ this.el.click();
113
+ }
114
+ //#endregion EVENTS
115
+ /****************************************************************************/
116
+ //#region LIFECYCLE
117
+ componentWillLoad() {
118
+ if (this.loading) {
119
+ this.disabled = this.loading;
120
+ }
121
+ }
122
+ //#endregion LIFECYCLE
123
+ /****************************************************************************/
124
+ //#region RENDER
125
+ render() {
126
+ return (index.h(index.Host, { key: '4c8d155b8feb2c43c71075facd4aba91187859e0', role: "button", type: this.type, tabindex: "0", disabled: this.disabled ? true : undefined, class: clsx297c1ffe.clsx('root', `size-${this.size}`, `emphasis-${this.emphasis}`, this.loading && 'loading', `shape-${this.shape}`), onClick: this.handleClick }, this.loading && index.h("nv-loader", { key: '98e022b368e278aed21335cf593aeea19dba29ee', size: this.size }), !this.loading && index.h("nv-icon", { key: '5298a3d0a85e97826693e47e04ed9eddcb4f9cd3', name: this.name, size: this.size }), index.h("slot", { key: '7e239aacae35715d4dc309919a21f0def9c0fa5d' })));
127
+ }
128
+ static get formAssociated() { return true; }
129
+ get el() { return index.getElement(this); }
130
+ static get watchers() { return {
131
+ "loading": ["handleLoadingChange"],
132
+ "disabled": ["handleDisabledChange"]
133
+ }; }
134
+ };
135
+ NvIconbutton.style = NvIconbuttonStyle0;
136
+
137
+ const nvLoaderCss = "@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}nv-loader{display:inline-block;position:relative;aspect-ratio:1/1;border-radius:9999px;color:inherit}nv-loader.size-xs{width:var(--loader-size-xs);height:var(--loader-size-xs)}nv-loader.size-xs::before,nv-loader.size-xs::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xs::before{content:\" \";border:calc(var(--loader-size-xs) / 10) solid;opacity:0.3}nv-loader.size-xs::after{content:\" \";border-top:calc(var(--loader-size-xs) / 10) solid transparent;border-left:calc(var(--loader-size-xs) / 10) solid transparent;border-right:calc(var(--loader-size-xs) / 10) solid transparent;border-bottom:calc(var(--loader-size-xs) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-sm{width:var(--loader-size-sm);height:var(--loader-size-sm)}nv-loader.size-sm::before,nv-loader.size-sm::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-sm::before{content:\" \";border:calc(var(--loader-size-sm) / 10) solid;opacity:0.3}nv-loader.size-sm::after{content:\" \";border-top:calc(var(--loader-size-sm) / 10) solid transparent;border-left:calc(var(--loader-size-sm) / 10) solid transparent;border-right:calc(var(--loader-size-sm) / 10) solid transparent;border-bottom:calc(var(--loader-size-sm) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-md{width:var(--loader-size-md);height:var(--loader-size-md)}nv-loader.size-md::before,nv-loader.size-md::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-md::before{content:\" \";border:calc(var(--loader-size-md) / 10) solid;opacity:0.3}nv-loader.size-md::after{content:\" \";border-top:calc(var(--loader-size-md) / 10) solid transparent;border-left:calc(var(--loader-size-md) / 10) solid transparent;border-right:calc(var(--loader-size-md) / 10) solid transparent;border-bottom:calc(var(--loader-size-md) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-lg{width:var(--loader-size-lg);height:var(--loader-size-lg)}nv-loader.size-lg::before,nv-loader.size-lg::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-lg::before{content:\" \";border:calc(var(--loader-size-lg) / 10) solid;opacity:0.3}nv-loader.size-lg::after{content:\" \";border-top:calc(var(--loader-size-lg) / 10) solid transparent;border-left:calc(var(--loader-size-lg) / 10) solid transparent;border-right:calc(var(--loader-size-lg) / 10) solid transparent;border-bottom:calc(var(--loader-size-lg) / 10) solid;animation:rotation 1s linear infinite}nv-loader.size-xl{width:var(--loader-size-xl);height:var(--loader-size-xl)}nv-loader.size-xl::before,nv-loader.size-xl::after{content:\" \";position:absolute;top:0;left:0;border-radius:inherit;width:100%;height:100%}nv-loader.size-xl::before{content:\" \";border:calc(var(--loader-size-xl) / 10) solid;opacity:0.3}nv-loader.size-xl::after{content:\" \";border-top:calc(var(--loader-size-xl) / 10) solid transparent;border-left:calc(var(--loader-size-xl) / 10) solid transparent;border-right:calc(var(--loader-size-xl) / 10) solid transparent;border-bottom:calc(var(--loader-size-xl) / 10) solid;animation:rotation 1s linear infinite}nv-loader.color-brand::before{border-color:var(--components-loader-brand-background);opacity:1}nv-loader.color-brand::after{border-bottom-color:var(--components-loader-brand-foreground)}nv-loader.color-white::before{border-color:var(--components-loader-white-background);opacity:1}nv-loader.color-white::after{border-bottom-color:var(--components-loader-white-foreground)}";
138
+ const NvLoaderStyle0 = nvLoaderCss;
139
+
140
+ const NvLoader = class {
141
+ constructor(hostRef) {
142
+ index.registerInstance(this, hostRef);
143
+ /****************************************************************************/
144
+ //#region PROPERTIES
145
+ /**
146
+ * Choose the size of the loader to best fit your application’s needs, whether
147
+ * it’s a small spinner for subtle loading indicators or a large one for more
148
+ * prominent displays.
149
+ */
150
+ this.size = 'md';
151
+ }
152
+ //#endregion PROPERTIES
153
+ /****************************************************************************/
154
+ //#region RENDER
155
+ /* <slot> empty to force rendering change */
156
+ render() {
157
+ return (index.h(index.Host, { key: 'b6b029b8231c2d4a1a6a7f074f42a27b85dff71b', class: clsx297c1ffe.clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
158
+ }
159
+ };
160
+ NvLoader.style = NvLoaderStyle0;
161
+
162
+ exports.nv_iconbutton = NvIconbutton;
163
+ exports.nv_loader = NvLoader;
@@ -0,0 +1,227 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-CinzsZ8D.js');
4
+ require('react');
5
+
6
+ const nvMenuCss = "nv-menuitem{display:flex;align-items:center;max-width:300px;width:100vw;font-size:var(--menu-contextual-item-font-size);font-weight:var(--menu-contextual-item-font-weight);color:var(--components-menu-contextual-item-content);border-radius:var(--menu-contextual-item-radius);gap:var(--menu-contextual-item-gap-x);padding:var(--menu-contextual-item-padding-y) var(--menu-contextual-item-padding-x);transition:background-color 150ms ease-out;cursor:pointer}nv-menuitem:hover,nv-menuitem:focus,nv-menuitem:focus-within{background-color:var(--components-menu-contextual-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-menuitem *{pointer-events:none}nv-menuitem kbd{color:var(--components-menu-contextual-item-shortcut)}nv-menuitem [data-scope=text]{margin-right:auto}nv-menuitem[disabled]:not([disabled=false]){cursor:unset;background-color:unset;color:var(--components-menu-contextual-item-content-disabled)}nv-menu{display:inline-block;position:relative}nv-menu:has([fluid]:not([fluid=false])){display:block}nv-menu nv-popover{display:unset}nv-menu nv-popover [data-scope=popover]{background-color:transparent !important;padding:0 !important}nv-menu [slot=content]{padding:var(--menu-contextual-padding-y) var(--menu-contextual-padding-x);border-radius:var(--menu-contextual-radius);gap:var(--menu-contextual-gap-y);background-color:var(--components-menu-contextual-background);border-color:var(--components-menu-contextual-border);display:flex;flex-direction:column}nv-menu nv-menu[open]:not([open=false])>nv-menuitem{background-color:var(--components-menu-contextual-item-background-hover);color:var(--components-menu-contextual-item-content-hover)}nv-menu hr{display:block;margin:var(--menu-contextual-divider-padding-top) var(--menu-contextual-divider-padding-x) var(--menu-contextual-divider-padding-bottom) var(--menu-contextual-divider-padding-x)}";
7
+ const NvMenuStyle0 = nvMenuCss;
8
+
9
+ const NvMenu = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.menuitemSelected = index.createEvent(this, "menuitemSelected");
13
+ this.isHandlingKeyDown = false;
14
+ /****************************************************************************/
15
+ //#region PROPERTIES
16
+ /**
17
+ * Use this to toggle the initial visibility of the menu, by default the menu
18
+ * is hidden.
19
+ */
20
+ this.open = false;
21
+ /**
22
+ * Use this if the menu is nested inside another menu. This will prevent the
23
+ * parent menu from closing when the child menu is opened.
24
+ */
25
+ this.nested = false;
26
+ /**
27
+ * Use this to disable the menu from closing automatically when a menu item is
28
+ * selected.
29
+ */
30
+ this.disableCloseOnSelect = false;
31
+ /**
32
+ * Decides where the menu shows up next to the button it’s linked to (above,
33
+ * below, to the sides). If there isn’t enough room, it will adjust its
34
+ * position on the axis to fit on the screen, so users can always see it.
35
+ */
36
+ this.placement = 'bottom-end';
37
+ /**
38
+ * Parsed items stored in state.
39
+ */
40
+ this.parsedItems = [];
41
+ }
42
+ /**
43
+ * Watcher to parse the items when the `items` property changes.
44
+ * @param {string} newValue - The new value of the `items` property.
45
+ */
46
+ handleItemsChange(newValue) {
47
+ if (typeof newValue === 'string') {
48
+ try {
49
+ this.parsedItems = JSON.parse(newValue);
50
+ }
51
+ catch (error) {
52
+ console.error('Error parsing menu items:', error);
53
+ this.parsedItems = [];
54
+ }
55
+ }
56
+ }
57
+ //#endregion PROPERTIES
58
+ /****************************************************************************/
59
+ //#region METHODS
60
+ /**
61
+ * Opens the menu.
62
+ */
63
+ async show() {
64
+ this.open = true;
65
+ }
66
+ /**
67
+ * Closes the menu.
68
+ */
69
+ async close() {
70
+ this.open = false;
71
+ }
72
+ handleMenuItemSelect(event) {
73
+ if (this.disableCloseOnSelect)
74
+ return;
75
+ if (event.detail.hasSubmenu)
76
+ return;
77
+ this.open = false;
78
+ }
79
+ handleKeydown(event) {
80
+ // If the menu is not open, check if the trigger is focused
81
+ // and the user presses Enter or ArrowDown, open the menu
82
+ if (!this.open) {
83
+ if ((event.key === 'Enter' ||
84
+ event.key === 'ArrowDown' ||
85
+ event.key === ' ') &&
86
+ document.activeElement === this.triggerElement) {
87
+ event.preventDefault();
88
+ this.show();
89
+ // Then, put the focus on the first menuitem
90
+ const firstMenuItem = this.popoverElement.querySelector('nv-menuitem');
91
+ if (firstMenuItem) {
92
+ requestAnimationFrame(() => firstMenuItem.focus());
93
+ }
94
+ }
95
+ return;
96
+ }
97
+ if (this.isHandlingKeyDown)
98
+ return;
99
+ this.isHandlingKeyDown = true;
100
+ if (event.key === 'ArrowDown' ||
101
+ event.key === 'ArrowUp' ||
102
+ event.key === 'ArrowLeft' ||
103
+ event.key === 'ArrowRight' ||
104
+ event.key === 'Escape') {
105
+ event.preventDefault();
106
+ }
107
+ if (event.key === 'Escape' && !this.nested) {
108
+ this.close();
109
+ this.triggerElement.focus();
110
+ this.isHandlingKeyDown = false;
111
+ return;
112
+ }
113
+ const menuContent = this.el.querySelector('[slot="content"]');
114
+ const menuItems = Array.from(menuContent.childNodes).filter(item => { var _a; return (_a = item.matches) === null || _a === void 0 ? void 0 : _a.call(item, 'nv-menuitem, nv-menu'); });
115
+ let currentIndex = menuItems.indexOf(document.activeElement);
116
+ if (currentIndex === -1)
117
+ currentIndex = menuItems.indexOf(document.activeElement.parentElement);
118
+ if (currentIndex === -1 &&
119
+ menuItems.find(item => item.matches('nv-menu[open]'))) {
120
+ this.isHandlingKeyDown = false;
121
+ return;
122
+ }
123
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
124
+ menuItems.forEach(item => {
125
+ if (item.matches('nv-menu'))
126
+ item.close();
127
+ });
128
+ }
129
+ if (event.key === 'ArrowDown') {
130
+ let nextIndex = (currentIndex + 1) % menuItems.length;
131
+ while (menuItems[nextIndex].matches('nv-menuitem[disabled]')) {
132
+ nextIndex = (nextIndex + 1) % menuItems.length;
133
+ }
134
+ const nextFocusable = menuItems[nextIndex];
135
+ if (nextFocusable.matches('nv-menuitem')) {
136
+ nextFocusable.focus();
137
+ }
138
+ else if (nextFocusable.matches('nv-menu')) {
139
+ nextFocusable.querySelector('nv-menuitem').focus();
140
+ }
141
+ }
142
+ if (event.key === 'ArrowUp') {
143
+ let prevIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
144
+ while (menuItems[prevIndex].matches('nv-menuitem[disabled]')) {
145
+ prevIndex = (prevIndex - 1 + menuItems.length) % menuItems.length;
146
+ }
147
+ const prevFocusable = menuItems[prevIndex];
148
+ if (prevFocusable.matches('nv-menuitem')) {
149
+ prevFocusable.focus();
150
+ }
151
+ else if (prevFocusable.matches('nv-menu')) {
152
+ prevFocusable.querySelector('nv-menuitem').focus();
153
+ }
154
+ }
155
+ if (event.key === 'ArrowRight') {
156
+ const submenu = menuItems[currentIndex];
157
+ if (!submenu.matches('nv-menu')) {
158
+ this.isHandlingKeyDown = false;
159
+ return;
160
+ }
161
+ submenu.show();
162
+ }
163
+ if (event.key === 'ArrowLeft' && this.nested) {
164
+ if (menuItems.find(item => item.matches('nv-menu[open]'))) {
165
+ this.isHandlingKeyDown = false;
166
+ return;
167
+ }
168
+ this.close();
169
+ this.triggerElement.focus();
170
+ }
171
+ this.isHandlingKeyDown = false;
172
+ }
173
+ handleOpenChanged(event) {
174
+ if (event.target === this.el.querySelector('nv-popover')) {
175
+ this.open = event.detail;
176
+ }
177
+ const triggerHasFocus = this.triggerElement === document.activeElement;
178
+ const triggerHasFocusVisible = this.triggerElement.matches(':focus-visible');
179
+ if (triggerHasFocus && triggerHasFocusVisible)
180
+ this.focusFirstItem();
181
+ }
182
+ focusFirstItem() {
183
+ const firstButton = this.popoverElement.querySelector('nv-menuitem');
184
+ if (firstButton) {
185
+ requestAnimationFrame(() => firstButton.focus());
186
+ }
187
+ }
188
+ //#endregion EVENTS
189
+ /****************************************************************************/
190
+ //#region LIFECYCLE
191
+ componentWillLoad() {
192
+ this.triggerElement = Array.from(this.el.children).find(child => {
193
+ return child.getAttribute('slot') === 'trigger';
194
+ });
195
+ // If the items attribute is provided, parse its value.
196
+ if (this.items) {
197
+ this.handleItemsChange(this.items);
198
+ }
199
+ }
200
+ //#endregion LIFECYCLE
201
+ /****************************************************************************/
202
+ //#region RENDER
203
+ /**
204
+ * Generates menu items from the `items` property.
205
+ * @param {MenuItem[]} items - The items to display in the menu.
206
+ * @returns {HTMLElement[]} The rendered items.
207
+ */
208
+ renderMenuItems(items) {
209
+ return items.map(item => {
210
+ var _a;
211
+ if (item.hasSubmenu && ((_a = item.submenuItems) === null || _a === void 0 ? void 0 : _a.length) > 0) {
212
+ return (index.h("nv-menu", { nested: true, placement: "right-start", items: JSON.stringify(item.submenuItems) }, index.h("nv-menuitem", { slot: "trigger", "has-submenu": true, disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label })));
213
+ }
214
+ return (index.h("nv-menuitem", { disabled: item.disabled, icon: item.icon, shortcut: item.shortcut, id: item.value, name: item.label, label: item.label }));
215
+ });
216
+ }
217
+ render() {
218
+ return (index.h(index.Host, { key: '848044034b707f29f791fa984cc51b606498b162' }, index.h("slot", { key: '385c9081f84034215745ea79d096cf8e3cebbf8e', name: "trigger" }), index.h("nv-popover", { key: 'b47a09258a76f608e0eba173039ec8ec49b6186a', ref: el => (this.popoverElement = el), triggerMode: "click", triggerElement: this.triggerElement, placement: this.placement, nested: this.nested, open: this.open }, this.parsedItems.length > 0 ? (index.h("ul", { slot: "content" }, this.renderMenuItems(this.parsedItems))) : (index.h("slot", { name: "content" })))));
219
+ }
220
+ get el() { return index.getElement(this); }
221
+ static get watchers() { return {
222
+ "items": ["handleItemsChange"]
223
+ }; }
224
+ };
225
+ NvMenu.style = NvMenuStyle0;
226
+
227
+ exports.nv_menu = NvMenu;