@nova-design-system/nova-webcomponents 3.0.0-beta.45 → 3.0.0-beta.46
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-badge_2.cjs.entry.js +4 -4
- package/dist/cjs/nv-badge_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-base.cjs.entry.js +1 -1
- package/dist/cjs/nv-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/nv-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/nv-button.cjs.entry.js +1 -1
- package/dist/cjs/nv-calendar.cjs.entry.js +1 -1
- package/dist/cjs/nv-col.cjs.entry.js +1 -1
- package/dist/cjs/nv-datagrid.cjs.entry.js +38 -5
- package/dist/cjs/nv-datagrid.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js +5 -1
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-dialog.cjs.entry.js +1 -1
- package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +4 -4
- package/dist/cjs/nv-fielddate.cjs.entry.js +5 -5
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +4 -4
- package/dist/cjs/nv-fielddropdown.cjs.entry.js +3 -9
- package/dist/cjs/nv-fielddropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +3 -16
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +9 -7
- package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldradio.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldselect.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtext.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtime.cjs.entry.js +9 -9
- package/dist/cjs/nv-icon.cjs.entry.js +1 -1
- package/dist/cjs/nv-iconbutton_2.cjs.entry.js +2 -2
- package/dist/cjs/nv-menu.cjs.entry.js +3 -3
- package/dist/cjs/nv-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-popover.cjs.entry.js +1 -1
- package/dist/cjs/nv-row.cjs.entry.js +1 -1
- package/dist/cjs/nv-stack.cjs.entry.js +1 -1
- package/dist/cjs/nv-table.cjs.entry.js +2 -2
- package/dist/cjs/nv-toggle.cjs.entry.js +2 -2
- package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
- package/dist/collection/components/nv-badge/nv-badge.js +4 -3
- package/dist/collection/components/nv-badge/nv-badge.js.map +1 -1
- package/dist/collection/components/nv-base/nv-base.js +1 -1
- package/dist/collection/components/nv-breadcrumb/nv-breadcrumb.js +1 -1
- package/dist/collection/components/nv-breadcrumbs/nv-breadcrumbs.js +1 -1
- package/dist/collection/components/nv-button/nv-button.js +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.js +1 -1
- package/dist/collection/components/nv-col/nv-col.js +1 -1
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js +30 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js.map +1 -1
- package/dist/collection/components/nv-datagrid/nv-datagrid.js +40 -6
- package/dist/collection/components/nv-datagrid/nv-datagrid.js.map +1 -1
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js +27 -1
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js.map +1 -1
- package/dist/collection/components/nv-dialog/nv-dialog.js +1 -1
- package/dist/collection/components/nv-dialogfooter/nv-dialogfooter.js +1 -1
- package/dist/collection/components/nv-dialogheader/nv-dialogheader.js +1 -1
- package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.js +4 -4
- package/dist/collection/components/nv-fielddate/nv-fielddate.js +5 -5
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +4 -4
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +5 -14
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js.map +1 -1
- package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js +1 -1
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +1 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +3 -19
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +3 -3
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +9 -7
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js.map +1 -1
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +5 -5
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +3 -3
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +3 -3
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js +9 -9
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js +1 -1
- package/dist/collection/components/nv-menu/nv-menu.js +7 -7
- package/dist/collection/components/nv-menu/nv-menu.js.map +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js +2 -2
- package/dist/collection/components/nv-popover/nv-popover.js +1 -1
- package/dist/collection/components/nv-row/nv-row.js +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-table/nv-table.js +2 -2
- package/dist/collection/components/nv-toggle/nv-toggle.js +2 -2
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/components/nv-alert.js +1 -1
- package/dist/components/nv-avatar.js +1 -1
- package/dist/components/nv-badge.js +1 -1
- package/dist/components/nv-base.js +1 -1
- package/dist/components/nv-breadcrumb.js +3 -3
- package/dist/components/nv-breadcrumbs.js +1 -1
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-calendar.js +1 -1
- package/dist/components/nv-col.js +1 -1
- package/dist/components/nv-datagrid.js +40 -6
- package/dist/components/nv-datagrid.js.map +1 -1
- package/dist/components/nv-datagridcolumn.js +7 -2
- package/dist/components/nv-datagridcolumn.js.map +1 -1
- package/dist/components/nv-dialog.js +6 -6
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-dialogheader.js +1 -1
- package/dist/components/nv-fieldcheckbox.js +1 -1
- package/dist/components/nv-fielddate.js +12 -12
- package/dist/components/nv-fielddaterange.js +11 -11
- package/dist/components/nv-fielddropdown.js +9 -17
- package/dist/components/nv-fielddropdown.js.map +1 -1
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fielddropdownitemcheck.js +1 -1
- package/dist/components/nv-fieldmultiselect.js +12 -27
- package/dist/components/nv-fieldmultiselect.js.map +1 -1
- package/dist/components/nv-fieldnumber.js +6 -6
- package/dist/components/nv-fieldpassword.js +12 -10
- package/dist/components/nv-fieldpassword.js.map +1 -1
- package/dist/components/nv-fieldradio.js +3 -3
- package/dist/components/nv-fieldselect.js +8 -8
- package/dist/components/nv-fieldselect.js.map +1 -1
- package/dist/components/nv-fieldtext.js +4 -4
- package/dist/components/nv-fieldtextarea.js +3 -3
- package/dist/components/nv-fieldtime.js +13 -13
- package/dist/components/nv-icon.js +1 -1
- package/dist/components/nv-iconbutton.js +1 -1
- package/dist/components/nv-loader.js +1 -1
- package/dist/components/nv-menu.js +6 -6
- package/dist/components/nv-menu.js.map +1 -1
- package/dist/components/nv-menuitem.js +1 -1
- package/dist/components/nv-popover.js +1 -1
- package/dist/components/nv-row.js +1 -1
- package/dist/components/nv-stack.js +1 -1
- package/dist/components/nv-table.js +2 -2
- package/dist/components/nv-toggle.js +2 -2
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-863974b2.js → p-18bc0291.js} +3 -3
- package/dist/components/{p-863974b2.js.map → p-18bc0291.js.map} +1 -1
- package/dist/components/{p-ef255589.js → p-56ef8131.js} +3 -3
- package/dist/components/{p-ef255589.js.map → p-56ef8131.js.map} +1 -1
- package/dist/components/{p-0f59f38e.js → p-5a5f11c2.js} +5 -5
- package/dist/components/p-5a5f11c2.js.map +1 -0
- package/dist/components/{p-e46c2e31.js → p-664c5a14.js} +2 -2
- package/dist/components/{p-e46c2e31.js.map → p-664c5a14.js.map} +1 -1
- package/dist/components/{p-3a3ba5b1.js → p-7b89fb48.js} +2 -2
- package/dist/components/{p-3a3ba5b1.js.map → p-7b89fb48.js.map} +1 -1
- package/dist/components/{p-103756d6.js → p-8674c7af.js} +3 -3
- package/dist/components/{p-103756d6.js.map → p-8674c7af.js.map} +1 -1
- package/dist/components/{p-3561c093.js → p-8c5a861b.js} +3 -3
- package/dist/components/{p-3561c093.js.map → p-8c5a861b.js.map} +1 -1
- package/dist/components/{p-78b00756.js → p-91b58443.js} +2 -2
- package/dist/components/{p-78b00756.js.map → p-91b58443.js.map} +1 -1
- package/dist/components/{p-933d4d06.js → p-9d6aaf76.js} +5 -5
- package/dist/components/{p-933d4d06.js.map → p-9d6aaf76.js.map} +1 -1
- package/dist/components/{p-3b096098.js → p-a9e1bf70.js} +4 -4
- package/dist/components/{p-3b096098.js.map → p-a9e1bf70.js.map} +1 -1
- package/dist/components/{p-78e0e7b0.js → p-a9f162a8.js} +6 -6
- package/dist/components/{p-78e0e7b0.js.map → p-a9f162a8.js.map} +1 -1
- package/dist/components/{p-b5821dbb.js → p-b4768da6.js} +5 -5
- package/dist/components/{p-b5821dbb.js.map → p-b4768da6.js.map} +1 -1
- package/dist/components/{p-4c6d8df7.js → p-d88ced51.js} +2 -2
- package/dist/components/{p-4c6d8df7.js.map → p-d88ced51.js.map} +1 -1
- package/dist/components/{p-8ea5e3c0.js → p-dcabc6fa.js} +3 -3
- package/dist/components/{p-8ea5e3c0.js.map → p-dcabc6fa.js.map} +1 -1
- package/dist/components/{p-aeeb5b1c.js → p-f469df15.js} +2 -2
- package/dist/components/{p-aeeb5b1c.js.map → p-f469df15.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-badge_2.entry.js +4 -4
- package/dist/esm/nv-badge_2.entry.js.map +1 -1
- package/dist/esm/nv-base.entry.js +1 -1
- package/dist/esm/nv-breadcrumb.entry.js +1 -1
- package/dist/esm/nv-breadcrumbs.entry.js +1 -1
- package/dist/esm/nv-button.entry.js +1 -1
- package/dist/esm/nv-calendar.entry.js +1 -1
- package/dist/esm/nv-col.entry.js +1 -1
- package/dist/esm/nv-datagrid.entry.js +38 -5
- package/dist/esm/nv-datagrid.entry.js.map +1 -1
- package/dist/esm/nv-datagridcolumn.entry.js +5 -1
- package/dist/esm/nv-datagridcolumn.entry.js.map +1 -1
- package/dist/esm/nv-dialog.entry.js +1 -1
- package/dist/esm/nv-dialogfooter_2.entry.js +2 -2
- package/dist/esm/nv-fieldcheckbox.entry.js +4 -4
- package/dist/esm/nv-fielddate.entry.js +5 -5
- package/dist/esm/nv-fielddaterange.entry.js +4 -4
- package/dist/esm/nv-fielddropdown.entry.js +3 -9
- package/dist/esm/nv-fielddropdown.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdownitem.entry.js +1 -1
- package/dist/esm/nv-fieldmultiselect.entry.js +3 -16
- package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldnumber.entry.js +3 -3
- package/dist/esm/nv-fieldpassword.entry.js +9 -7
- package/dist/esm/nv-fieldpassword.entry.js.map +1 -1
- package/dist/esm/nv-fieldradio.entry.js +3 -3
- package/dist/esm/nv-fieldselect.entry.js +5 -5
- package/dist/esm/nv-fieldselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldtext.entry.js +3 -3
- package/dist/esm/nv-fieldtextarea.entry.js +3 -3
- package/dist/esm/nv-fieldtime.entry.js +9 -9
- package/dist/esm/nv-icon.entry.js +1 -1
- package/dist/esm/nv-iconbutton_2.entry.js +2 -2
- package/dist/esm/nv-menu.entry.js +3 -3
- package/dist/esm/nv-menu.entry.js.map +1 -1
- package/dist/esm/nv-menuitem.entry.js +1 -1
- package/dist/esm/nv-popover.entry.js +1 -1
- package/dist/esm/nv-row.entry.js +1 -1
- package/dist/esm/nv-stack.entry.js +1 -1
- package/dist/esm/nv-table.entry.js +2 -2
- package/dist/esm/nv-toggle.entry.js +2 -2
- package/dist/esm/nv-tooltip.entry.js +1 -1
- package/dist/native/native.css +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-162f4840.entry.js → p-000ef9c9.entry.js} +2 -2
- package/dist/native/{p-2281d5ef.entry.js → p-002e7bf1.entry.js} +2 -2
- package/dist/native/p-115ad66c.entry.js +2 -0
- package/dist/native/{p-7fade532.entry.js → p-1e5453be.entry.js} +2 -2
- package/dist/native/{p-1a46cb52.entry.js → p-2ed9934a.entry.js} +2 -2
- package/dist/native/{p-e197d90b.entry.js → p-3df6febe.entry.js} +2 -2
- package/dist/native/{p-464ef88f.entry.js → p-43cc98dc.entry.js} +2 -2
- package/dist/native/{p-46aa1136.entry.js → p-4977fcd0.entry.js} +2 -2
- package/dist/native/{p-725e0abd.entry.js → p-4c859a14.entry.js} +2 -2
- package/dist/native/{p-40f4a6e7.entry.js → p-4fe5ebe9.entry.js} +2 -2
- package/dist/native/{p-3af5bcc1.entry.js → p-50dcce07.entry.js} +2 -2
- package/dist/native/{p-ecc28398.entry.js → p-60d6ffa3.entry.js} +2 -2
- package/dist/native/p-60d6ffa3.entry.js.map +1 -0
- package/dist/native/{p-e6904ae4.entry.js → p-626a1372.entry.js} +2 -2
- package/dist/native/{p-0172095c.entry.js → p-6603d939.entry.js} +2 -2
- package/dist/native/{p-603a99ed.entry.js → p-74f7f404.entry.js} +2 -2
- package/dist/native/p-75f4bfe8.entry.js +2 -0
- package/dist/native/{p-54b6ce07.entry.js.map → p-75f4bfe8.entry.js.map} +1 -1
- package/dist/native/{p-abeda2cf.entry.js → p-76cd466a.entry.js} +2 -2
- package/dist/native/{p-45577c7f.entry.js → p-7e1fa44c.entry.js} +2 -2
- package/dist/native/{p-19fd6594.entry.js → p-8946883b.entry.js} +2 -2
- package/dist/native/p-8946883b.entry.js.map +1 -0
- package/dist/native/{p-c10e5113.entry.js → p-8f7c1bb8.entry.js} +2 -2
- package/dist/native/{p-17bf1233.entry.js → p-98030346.entry.js} +2 -2
- package/dist/native/{p-442f04f9.entry.js → p-aa957898.entry.js} +2 -2
- package/dist/native/{p-31184fdd.entry.js → p-aeac63ea.entry.js} +2 -2
- package/dist/native/{p-31184fdd.entry.js.map → p-aeac63ea.entry.js.map} +1 -1
- package/dist/native/{p-514101d6.entry.js → p-b11fdaed.entry.js} +2 -2
- package/dist/native/{p-332c5d6c.entry.js → p-b6164ebc.entry.js} +2 -2
- package/dist/native/p-b8b58064.entry.js +2 -0
- package/dist/native/p-b8b58064.entry.js.map +1 -0
- package/dist/native/{p-d9624254.entry.js → p-be5f62e5.entry.js} +2 -2
- package/dist/native/p-be5f62e5.entry.js.map +1 -0
- package/dist/native/p-c6fe73a9.entry.js +2 -0
- package/dist/native/p-c6fe73a9.entry.js.map +1 -0
- package/dist/native/{p-665db087.entry.js → p-ce64d562.entry.js} +2 -2
- package/dist/native/p-d352a8b3.entry.js +2 -0
- package/dist/native/p-d352a8b3.entry.js.map +1 -0
- package/dist/native/{p-314d2b34.entry.js → p-d4e48d08.entry.js} +2 -2
- package/dist/native/{p-f01a34c5.entry.js → p-d5158e27.entry.js} +2 -2
- package/dist/native/{p-942f8e92.entry.js → p-e200185a.entry.js} +2 -2
- package/dist/native/p-e200185a.entry.js.map +1 -0
- package/dist/native/{p-f5e0d5c5.entry.js → p-e4f84faa.entry.js} +2 -2
- package/dist/types/components/nv-badge/nv-badge.d.ts +1 -0
- package/dist/types/components/nv-base/nv-base.docs.d.ts +1 -1
- package/dist/types/components/nv-datagrid/nv-datagrid.d.ts +1 -0
- package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.d.ts +4 -0
- package/dist/types/components/nv-fielddropdown/nv-fielddropdown.d.ts +1 -3
- package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +1 -10
- package/dist/types/components/nv-fieldpassword/nv-fieldpassword.d.ts +2 -0
- package/dist/types/components/nv-menu/nv-menu.d.ts +4 -4
- package/dist/types/components.d.ts +18 -2
- package/dist/types/nova-docs.d.ts +5 -0
- package/dist/vscode-data.json +35 -31
- package/hydrate/index.js +136 -115
- package/hydrate/index.mjs +136 -115
- package/package.json +3 -2
- package/dist/components/p-0f59f38e.js.map +0 -1
- package/dist/native/p-19fd6594.entry.js.map +0 -1
- package/dist/native/p-331da074.entry.js +0 -2
- package/dist/native/p-42d020a7.entry.js +0 -2
- package/dist/native/p-42d020a7.entry.js.map +0 -1
- package/dist/native/p-4403e3af.entry.js +0 -2
- package/dist/native/p-4403e3af.entry.js.map +0 -1
- package/dist/native/p-54b6ce07.entry.js +0 -2
- package/dist/native/p-942f8e92.entry.js.map +0 -1
- package/dist/native/p-d9624254.entry.js.map +0 -1
- package/dist/native/p-ecc28398.entry.js.map +0 -1
- package/dist/native/p-f89b7d06.entry.js +0 -2
- package/dist/native/p-f89b7d06.entry.js.map +0 -1
- /package/dist/native/{p-162f4840.entry.js.map → p-000ef9c9.entry.js.map} +0 -0
- /package/dist/native/{p-2281d5ef.entry.js.map → p-002e7bf1.entry.js.map} +0 -0
- /package/dist/native/{p-331da074.entry.js.map → p-115ad66c.entry.js.map} +0 -0
- /package/dist/native/{p-7fade532.entry.js.map → p-1e5453be.entry.js.map} +0 -0
- /package/dist/native/{p-1a46cb52.entry.js.map → p-2ed9934a.entry.js.map} +0 -0
- /package/dist/native/{p-e197d90b.entry.js.map → p-3df6febe.entry.js.map} +0 -0
- /package/dist/native/{p-464ef88f.entry.js.map → p-43cc98dc.entry.js.map} +0 -0
- /package/dist/native/{p-46aa1136.entry.js.map → p-4977fcd0.entry.js.map} +0 -0
- /package/dist/native/{p-725e0abd.entry.js.map → p-4c859a14.entry.js.map} +0 -0
- /package/dist/native/{p-40f4a6e7.entry.js.map → p-4fe5ebe9.entry.js.map} +0 -0
- /package/dist/native/{p-3af5bcc1.entry.js.map → p-50dcce07.entry.js.map} +0 -0
- /package/dist/native/{p-e6904ae4.entry.js.map → p-626a1372.entry.js.map} +0 -0
- /package/dist/native/{p-0172095c.entry.js.map → p-6603d939.entry.js.map} +0 -0
- /package/dist/native/{p-603a99ed.entry.js.map → p-74f7f404.entry.js.map} +0 -0
- /package/dist/native/{p-abeda2cf.entry.js.map → p-76cd466a.entry.js.map} +0 -0
- /package/dist/native/{p-45577c7f.entry.js.map → p-7e1fa44c.entry.js.map} +0 -0
- /package/dist/native/{p-c10e5113.entry.js.map → p-8f7c1bb8.entry.js.map} +0 -0
- /package/dist/native/{p-17bf1233.entry.js.map → p-98030346.entry.js.map} +0 -0
- /package/dist/native/{p-442f04f9.entry.js.map → p-aa957898.entry.js.map} +0 -0
- /package/dist/native/{p-514101d6.entry.js.map → p-b11fdaed.entry.js.map} +0 -0
- /package/dist/native/{p-332c5d6c.entry.js.map → p-b6164ebc.entry.js.map} +0 -0
- /package/dist/native/{p-665db087.entry.js.map → p-ce64d562.entry.js.map} +0 -0
- /package/dist/native/{p-314d2b34.entry.js.map → p-d4e48d08.entry.js.map} +0 -0
- /package/dist/native/{p-f01a34c5.entry.js.map → p-d5158e27.entry.js.map} +0 -0
- /package/dist/native/{p-f5e0d5c5.entry.js.map → p-e4f84faa.entry.js.map} +0 -0
|
@@ -340,13 +340,13 @@ const NvFieldselect = class {
|
|
|
340
340
|
* @returns {HTMLStencilElement} The HTML element to render.
|
|
341
341
|
*/
|
|
342
342
|
render() {
|
|
343
|
-
return (h(Host, { key: '
|
|
343
|
+
return (h(Host, { key: '017364e5a5df156be42741e3acc4457414f8e6ee' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '2e4b247018a759307ea5e3920a4066a2c1c14e92', htmlFor: this.inputId }, h("slot", { key: '1bbad9d0b4be9fc35c0cc63859ba6dcdb4375377', name: "label" }, this.label))), h("div", { key: '572073518f738014fd27d8de84fc856a01889636', class: "select-wrapper" }, h("slot", { key: '490730d4fc16f78284a8ca40ab952870eb01b503', name: "before-input" }), h("div", { key: 'a92ea3295f64ce1c6d8da5cf439d7c796493fdf5', class: "select-container", onClick: this.handleSelectContainerClick }, h("slot", { key: 'f80e732415ec42a4c7b02922f1b50d2cf3950e88', name: "leading-input" }), this.internalReadonly && (h("input", { key: 'b1ee7e799434d0e36d1f98031338137347bcedea', id: this.inputId + '-readonly', type: "text", value: this.computedDisplayValue, readonly: true, class: "readonly-input", "aria-readonly": "true", "aria-label": this.label, "aria-describedby": this.error
|
|
344
344
|
? `${this.inputId}-error`
|
|
345
|
-
: `${this.inputId}-description` })), h("select", { key: '
|
|
345
|
+
: `${this.inputId}-description` })), h("select", { key: '9a8b48a7a41522b09b65a5c76b7e861b5d6eef49', id: this.inputId, ref: el => (this.selectElement = el), name: this.name, autofocus: this.autofocus, disabled: this.disabled, required: this.required, multiple: this.multiple, onChange: this.handleSelectChange, class: this.internalReadonly ? 'hidden' : '', "aria-label": this.label, "aria-describedby": this.error
|
|
346
346
|
? `${this.inputId}-error`
|
|
347
|
-
: `${this.inputId}-description` }, this.parsedOptions.length > 0 ? (this.parsedOptions.map(option => (h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (h("slot", null))), h("div", { key: '
|
|
348
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
349
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
347
|
+
: `${this.inputId}-description` }, this.parsedOptions.length > 0 ? (this.parsedOptions.map(option => (h("option", { value: option.value, selected: option.selected, disabled: option.disabled }, option.label)))) : (h("slot", null))), h("div", { key: '7ecac0a159ca2b4925b8a940c80f8aef94a2ca1d', class: "select-icons" }, this.error && (h("nv-icon", { key: 'fd3d75a5c621a49f45550d9596f4910ef01a56b2', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: '45b3e11a48f5f700ac9c21ba276ee9c93640d0d9', name: "circle-check", class: "validation", size: "md" })), !this.multiple && (h("nv-iconbutton", { key: '07171fbe1fc88f4c7af0513ed718376ce1a1aeb3', name: "chevron-down", size: "md", emphasis: "lower", tabindex: -1 })))), h("slot", { key: '096bf49c55359062fc790d31660b331a5988ad22', name: "after-input" })), (this.description ||
|
|
348
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '7b292eeb3a1ca29b7cb1b631926b591183ab50fc', class: "description", id: `${this.inputId}-description` }, h("slot", { key: 'a2fdc1929f7aa2571cd11d01e2c1ed165afb856c', name: "description" }, this.description))), (this.errorDescription ||
|
|
349
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '3d189e87ff7cee9a43ccad85c6e84fcdb3343f1f', class: "error-description", id: `${this.inputId}-error` }, h("slot", { key: '515059b75c8e2c1e600a28124135cbd7af87ccbf', name: "error-description" }, this.errorDescription)))));
|
|
350
350
|
}
|
|
351
351
|
static get formAssociated() { return true; }
|
|
352
352
|
get el() { return getElement(this); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nv-fieldselect.entry.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,u/NAAu/N,CAAC;AACjhO,4BAAe,gBAAgB;;MC2BlB,aAAa;IAN1B;;;;;;QAiCU,yBAAoB,GAAW,EAAE,CAAC;QAGlC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AAI,EACT,QAAQ,EAAC,OAAO,EAChB,QAAQ,EAAE,CAAC,CAAC,GACZ,CACH,CACG,CACF,EAEN,6DAAM,IAAI,EAAC,aAAa,GAAQ,CAC5B,EAEL,CAAC,IAAI,CAAC,WAAW;YAChB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,sBAAsB,CAAC,MAC7C,4DAAK,KAAK,EAAC,aAAa,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,cAAc,IACxD,6DAAM,IAAI,EAAC,aAAa,IAAE,IAAI,CAAC,WAAW,CAAQ,CAC9C,CACP,EAEA,CAAC,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,MACnD,4DAAK,KAAK,EAAC,mBAAmB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,QAAQ,IACxD,6DAAM,IAAI,EAAC,mBAAmB,IAAE,IAAI,CAAC,gBAAgB,CAAQ,CACzD,CACP,CACI,EACP;KACH;;;;;;;;;;;;;;","names":["uuidv4"],"sources":["src/components/nv-fieldselect/nv-fieldselect.scss?tag=nv-fieldselect","src/components/nv-fieldselect/nv-fieldselect.tsx"],"sourcesContent":["@import '../../styles/form-field';\n\n@mixin form-field-select-wrapper() {\n display: flex;\n flex-wrap: wrap;\n align-items: stretch;\n align-self: stretch;\n}\n\n@mixin form-field-select-container() {\n position: relative;\n display: flex;\n flex-grow: 1;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--form-field-radius);\n border-width: 1px;\n border-style: solid;\n border-color: var(--nv-field-border-default);\n opacity: var(--components-form-opacity-default);\n background: var(--nv-field-background);\n transition: all 150ms ease-out;\n\n &:hover {\n border-color: var(--nv-field-border-hover);\n }\n\n &:focus-within {\n border-color: var(--nv-field-border-focus);\n box-shadow: 0 0 0 var(--focus-field-stroke) var(--nv-field-focus-box-shadow);\n }\n\n &:has(select:disabled) {\n // opacity: var(--components-form-opacity-disabled, 0.5); broken token generation, is 50px instead of 0.5\n opacity: 0.5;\n background-color: var(--components-form-field-background-disabled);\n border-color: var(--nv-field-border-disabled);\n }\n}\n\n@mixin form-field-select() {\n display: flex;\n align-items: center;\n flex: 1 0 0;\n overflow: hidden;\n background-color: transparent;\n color: var(--components-form-field-content-text);\n text-overflow: ellipsis;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 500;\n height: var(--form-field-line-height);\n padding: var(--form-field-padding-y) var(--form-field-padding-x);\n box-sizing: content-box;\n -webkit-appearance: none;\n -moz-appearance: none;\n cursor: pointer;\n\n &:focus {\n outline: none;\n }\n\n &::placeholder {\n overflow: hidden;\n color: var(--components-form-field-content-placeholder);\n text-overflow: ellipsis;\n font-family: 'TT Norms Pro', sans-serif;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 400;\n line-height: var(--form-field-line-height);\n }\n}\n\n@mixin form-field-multi-select() {\n height: 100%;\n box-sizing: border-box;\n}\n\n@mixin form-field-select-icons() {\n position: absolute;\n right: 0;\n top: 0;\n pointer-events: none;\n}\n\nnv-fieldselect {\n @include form-field-variables();\n @include form-field-root();\n\n &[readonly]:not([readonly='false']) {\n @include form-field-readonly-variables();\n }\n\n &[display-value]:not([display-value='false']) {\n @include form-field-readonly-variables();\n }\n\n &[error]:not([error='false']) {\n @include form-field-error-variables();\n }\n\n &[success]:not([success='false']) {\n @include form-field-success-variables();\n }\n\n &[required]:not([required='false']) label {\n @include form-field-label-required();\n }\n\n &[multiple]:not([multiple='false']) {\n .select-wrapper > .select-container {\n > .select-icons {\n top: var(--form-field-padding-y);\n right: var(--form-field-padding-x);\n }\n > select {\n @include form-field-multi-select();\n }\n }\n }\n\n label {\n @include form-field-label();\n }\n\n .select-wrapper {\n @include form-field-select-wrapper();\n\n .select-container {\n @include form-field-select-container();\n\n > .select-icons {\n @include form-field-select-icons();\n > nv-iconbutton {\n @include form-field-action();\n }\n }\n\n input {\n @include form-field-input();\n\n &:read-only {\n // opacity: var(--components-form-opacity-disabled, 0.5); broken token generation, is 50px instead of 0.5\n opacity: 0.5;\n background-color: var(\n --components-form-field-background-readonly,\n rgb(0 0 0 / 10%)\n );\n border-color: var(--nv-field-border-readonly);\n }\n }\n\n select {\n @include form-field-select();\n\n & option {\n font-size: var(--form-field-font-size, 16px);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-field-line-height, 24px);\n }\n\n &.hidden {\n display: none;\n }\n }\n\n nv-icon.readonly-icon {\n @include form-field-icon();\n }\n\n nv-icon.validation {\n @include form-field-icon();\n }\n }\n }\n\n .description {\n @include form-field-description();\n }\n\n .error-description {\n @include form-field-error-description();\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Watch,\n Element,\n State,\n} from '@stencil/core';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Content to be placed inside the select element.\n * @slot leading-input - Content to be placed before the select input, within the select container.\n * @slot before-input - Content to be placed before the select input, outside the select container.\n * @slot after-input - Content to be placed after the select input, outside the select container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fieldselect',\n shadow: false,\n formAssociated: true,\n styleUrl: 'nv-fieldselect.scss',\n})\nexport class NvFieldselect {\n @Element() el: HTMLNvFieldselectElement;\n private selectElement!: HTMLSelectElement;\n private internals: ElementInternals;\n\n /****************************************************************************/\n //#region DEPRECATED\n\n /**\n * Message defines a 'hint ' message for the Select Field.\n * @deprecated Use `description` instead.\n */\n @Prop({ reflect: true })\n readonly message: string;\n\n /**\n * Add the message to the validation state.\n * @deprecated Use `errorDescription` and set the error prop instead.\n */\n @Prop({ reflect: true })\n readonly validation: string;\n\n //#endregion DEPRECATED\n /****************************************************************************/\n //#region STATES\n\n @State()\n private computedDisplayValue: string = '';\n\n @State()\n private internalReadonly: boolean = false;\n\n /**\n * Options to display in the select. Can be passed as a JSON string.\n * Format: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]\n */\n @Prop({ reflect: true })\n readonly options?: string;\n\n /**\n * Parsed options stored internally\n */\n @State()\n private parsedOptions: Array<{\n /**\n * The label of the option\n */\n label: string;\n /**\n * The value of the option\n */\n value: string;\n /**\n * Whether the option is selected\n */\n selected?: boolean;\n /**\n * Whether the option is disabled\n */\n disabled?: boolean;\n }> = [];\n\n //#endregion STATES\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the select element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated\n * to ensure unique identification, facilitating proper label association and\n * accessibility.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Lets you define the text that explains what users should choose in the\n * select field. It’s a crucial element for making forms clear and\n * user-friendly.\n */\n @Prop({ reflect: true })\n readonly label?: string;\n\n /**\n * Add helpful hints or extra information under the select field. This is\n * where you can clarify what users should choose or provide additional\n * instructions, making the form easier to fill out correctly.\n */\n @Prop({ reflect: true, mutable: true })\n description?: string;\n\n /**\n * Defines the name attribute of the select field, which is crucial for form\n * submission. This value is used as the key in the key-value pair sent to\n * the server, representing the selected data in form submissions. It should be\n * unique within the form to avoid conflicts\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * The disabled prop lets you turn off the select field so that users can’t\n * choose something. When disabled, the field is grayed out and won’t respond to\n * clicks or touches.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Display the select field’s content without allowing users to change it.\n * Users can still click on it, select, and copy the text, but they won’t be\n * able to change or delete anything.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the select field as required, ensuring that the user must fill it out\n * before submitting the form.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Alters the select field’s appearance to indicate an error, helping users\n * identify fields that need correction.\n * @validator error\n */\n @Prop({ reflect: true, mutable: true })\n error: boolean = false;\n\n /**\n * Show a helpful message under the select field when there’s a problem. It\n * explains what’s wrong and how users can fix it, making the error easier to\n * understand and resolve.\n * @validator message\n */\n @Prop({ reflect: true, mutable: true })\n errorDescription: string;\n\n /**\n * Changes the select field’s appearance to indicate successful input or\n * validation.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * When enabled, allows the select to handle multiple selections.\n */\n @Prop({ reflect: true })\n readonly multiple: boolean = false;\n\n /**\n * The value of the select field.\n * - If `multiple` is `false`, it's a single string.\n * - If `multiple` is `true`, it's a comma-separated string of selected values.\n */\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * When enabled, displays the value element instead of the label when readonly.\n * By default, the label is displayed in readonly mode. Also it automatically\n * sets the component to readonly.\n */\n @Prop({ reflect: true })\n readonly displayValue: boolean = false;\n\n /**\n * Applies focus to the input field as soon as the component is mounted. This\n * is equivalent to setting the native autofocus attribute on a <select>\n * element.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the selected value changes.\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>; // Emit as a string\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n /**\n * Updates the display value when the value property changes. This watcher is\n * used to update the display value when the selected value changes. This is\n * necessary for readonly select fields to display the selected value.\n * @internal This watcher is not intended to be called outside of the component.\n * @param {string} newValue - The new value of the select field.\n */\n @Watch('value')\n updateDisplayValueWatcher(newValue: string) {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n const selectedValues = newValue.split(',').map(val => val.trim());\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n\n if (!this.multiple) {\n this.selectElement.value = newValue; // Only set when not multiple\n }\n } else {\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Update form value\n this.setFormValue();\n }\n\n /**\n * Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.\n * @param {boolean} newValue - The new value of displayValue.\n */\n @Watch('displayValue')\n handleDisplayValueChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.readonly) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.\n * @param {boolean} newValue - The new value of readonly.\n */\n @Watch('readonly')\n handleReadonlyChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Parse options and update the internal state\n * @param {string} newValue - The new value of options\n */\n @Watch('options')\n handleOptionsChange(newValue: string) {\n if (typeof newValue === 'string') {\n try {\n const parsedOpts = JSON.parse(newValue);\n this.parsedOptions = [...parsedOpts];\n\n // Update the value if an option is pre-selected\n const selectedOption = parsedOpts.find(opt => opt.selected);\n if (selectedOption) {\n this.value = selectedOption.value;\n }\n } catch (error) {\n console.error('Error parsing options:', error);\n this.parsedOptions = [];\n }\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Handles the change event on the select element. This method is used to\n * update the value property when the selected options change. It is also\n * used to emit the selectChanged event when the selected value changes.\n * @param {Event} event - The change event on the select element.\n * @emits selectChanged\n */\n private readonly handleSelectChange = (event: Event) => {\n const select = event.target as HTMLSelectElement;\n let selectedValues: string[] = Array.from(select.selectedOptions).map(\n option => option.value,\n );\n\n if (!this.multiple) {\n selectedValues = selectedValues.slice(0, 1);\n }\n\n this.value = this.multiple\n ? selectedValues.join(', ')\n : selectedValues[0] || '';\n this.valueChanged.emit(this.value);\n\n // Update form value\n this.setFormValue();\n };\n\n /**\n * Handles focus when the select container is clicked.\n */\n private readonly handleSelectContainerClick = () => {\n if (!this.internalReadonly && this.selectElement) {\n this.selectElement.focus();\n }\n };\n\n /**\n * Updates the display value of the select field. This method is used to\n * update the display value when the selected value changes. This is necessary\n * for readonly select fields to display the selected value. This method is\n * called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher\n * watcher.\n * @internal This method is not intended to be called outside of the component.\n */\n private updateDisplayValue(): void {\n if (this.internalReadonly && !this.displayValue) {\n if (this.multiple) {\n const selectedLabels = this.value\n .split(',')\n .map(key => key.trim())\n .map(key => this.getLabelFromId(key) || '')\n .filter(label => label !== '');\n this.computedDisplayValue = selectedLabels.join(', ') || '';\n } else {\n this.computedDisplayValue = this.getLabelFromId(this.value) || '';\n }\n } else if (this.internalReadonly && this.displayValue) {\n this.computedDisplayValue = this.value || '';\n }\n }\n\n /**\n * Retrieves the label from the <option> elements based on the provided key (value).\n * This method uses the id or value attribute directly from the <select> options.\n * @param {string} key - The key (value) for which to find the corresponding label.\n * @returns {string} The label if found; otherwise, an empty string.\n */\n private getLabelFromId(key: string): string {\n this.ensureSelectElement();\n if (!this.selectElement) {\n return '';\n }\n\n // Cache the option list\n const options = this.selectElement.options;\n\n if (options) {\n const option = Array.from(options).find(option => option.value === key);\n return option ? option.textContent.trim() || '' : '';\n } else {\n return '';\n }\n }\n\n /**\n * Sets the value of the form element for form submission. This method is\n * called when the selected value changes or when the value property is set.\n * @internal This method is not intended to be called outside of the component.\n */\n private setFormValue(): void {\n this.internals.setFormValue(this.value);\n }\n\n /**\n * Ensures the select element is available. This method is used to ensure\n * the select element is available before attempting to access it.\n * @internal This method is not intended to be called outside of the component.\n */\n private ensureSelectElement(): void {\n if (!this.selectElement) {\n this.selectElement = this.el.querySelector('select') as HTMLSelectElement;\n }\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillRender() {\n this.updateDisplayValue(); // Ensure display value is updated before render\n\n if (this.message) {\n this.description = this.message;\n }\n\n if (this.validation) {\n this.errorDescription = this.validation;\n this.error = true;\n }\n }\n\n /**\n * Lifecycle method that is called before the component is rendered. This is\n * where the internal state is set up before rendering occurs.\n */\n componentWillLoad() {\n // Set internalReadonly based on the readonly prop\n this.internalReadonly = this.readonly;\n\n // Ensure internalReadonly is true if displayValue is true during loading\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n\n if ('attachInternals' in this.el) {\n this.internals = (\n this.el as HTMLElement & {\n /**\n * Attach the element to the form internals.\n * @returns {ElementInternals} - The element internals object.\n */\n attachInternals: () => ElementInternals;\n }\n ).attachInternals();\n } else {\n // Fallback logic for browsers without attachInternals support\n this.internals = {\n setFormValue: (value: string) => {\n const formElement = this.el.closest('form');\n if (formElement) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = this.name;\n input.value = value;\n formElement.appendChild(input);\n }\n },\n } as ElementInternals;\n }\n\n // Initialize value as an empty string if multiple is true\n if (this.multiple && typeof this.value !== 'string') {\n this.value = '';\n }\n\n // Parse initial options if present\n if (this.options) {\n this.handleOptionsChange(this.options);\n }\n }\n\n /**\n * Lifecycle method that is called after the component has been rendered.\n * This is where the display value is updated and the initial select element's\n * state is set.\n */\n componentDidLoad() {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n // Only set the value for single selection, skip for multiple\n if (!this.multiple) {\n this.selectElement.value = this.value;\n }\n\n const selectedValues = this.multiple\n ? this.value.split(',').map(v => v.trim())\n : [this.value];\n\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n } else {\n // Handle case where there are no options\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Set the initial form value\n this.setFormValue();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDERING\n\n /**\n * The render method creates the HTML structure for the component, including\n * the label, select element, and any error or description messages. It also\n * applies the appropriate CSS classes based on the readonly state and\n * displayValue prop. This method is called when the component is rendered.\n * @returns {HTMLStencilElement} The HTML element to render.\n */\n render() {\n return (\n <Host>\n {(this.label || this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <div class=\"select-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"select-container\"\n onClick={this.handleSelectContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n {this.internalReadonly && (\n <input\n id={this.inputId + '-readonly'}\n type=\"text\"\n value={this.computedDisplayValue}\n readonly\n class=\"readonly-input\"\n aria-readonly=\"true\"\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n />\n )}\n\n <select\n id={this.inputId}\n ref={el => (this.selectElement = el)}\n name={this.name}\n autofocus={this.autofocus}\n disabled={this.disabled}\n required={this.required}\n multiple={this.multiple}\n onChange={this.handleSelectChange}\n class={this.internalReadonly ? 'hidden' : ''}\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n >\n {this.parsedOptions.length > 0 ? (\n this.parsedOptions.map(option => (\n <option\n value={option.value}\n selected={option.selected}\n disabled={option.disabled}\n >\n {option.label}\n </option>\n ))\n ) : (\n <slot />\n )}\n </select>\n <div class=\"select-icons\">\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n {!this.multiple && (\n <nv-iconbutton\n name=\"chevron-down\"\n size=\"md\"\n emphasis=\"lower\"\n tabIndex={-1}\n />\n )}\n </div>\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n {(this.description ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\" id={`${this.inputId}-description`}>\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div class=\"error-description\" id={`${this.inputId}-error`}>\n <slot name=\"error-description\">{this.errorDescription}</slot>\n </div>\n )}\n </Host>\n );\n }\n\n //#endregion RENDERING\n}\n"],"version":3}
|
|
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O,KACX,gEAAS,IAAI,EAAC,cAAc,EAAC,KAAK,EAAC,YAAY,EAAC,IAAI,EAAC,IAAI,GAAG,CAC7D,EAEA,CAAC,IAAI,CAAC,QAAQ,KACb,sEACE,IAAI,EAAC,cAAc,EACnB,IAAI,EAAC,IAAI,EACT,QAAQ,EAAC,OAAO,EAChB,QAAQ,EAAE,CAAC,CAAC,GACZ,CACH,CACG,CACF,EAEN,6DAAM,IAAI,EAAC,aAAa,GAAQ,CAC5B,EAEL,CAAC,IAAI,CAAC,WAAW;YAChB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,sBAAsB,CAAC,MAC7C,4DAAK,KAAK,EAAC,aAAa,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,cAAc,IACxD,6DAAM,IAAI,EAAC,aAAa,IAAE,IAAI,CAAC,WAAW,CAAQ,CAC9C,CACP,EAEA,CAAC,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,MACnD,4DAAK,KAAK,EAAC,mBAAmB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,QAAQ,IACxD,6DAAM,IAAI,EAAC,mBAAmB,IAAE,IAAI,CAAC,gBAAgB,CAAQ,CACzD,CACP,CACI,EACP;KACH;;;;;;;;;;;;;;","names":["uuidv4"],"sources":["src/components/nv-fieldselect/nv-fieldselect.scss?tag=nv-fieldselect","src/components/nv-fieldselect/nv-fieldselect.tsx"],"sourcesContent":["@import '../../styles/form-field';\n\n@mixin form-field-select-wrapper() {\n display: flex;\n flex-wrap: wrap;\n align-items: stretch;\n align-self: stretch;\n}\n\n@mixin form-field-select-container() {\n position: relative;\n display: flex;\n flex-grow: 1;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--form-field-radius);\n border-width: 1px;\n border-style: solid;\n border-color: var(--nv-field-border-default);\n opacity: var(--components-form-opacity-default);\n background: var(--nv-field-background);\n transition: all 150ms ease-out;\n\n &:hover {\n border-color: var(--nv-field-border-hover);\n }\n\n &:focus-within {\n border-color: var(--nv-field-border-focus);\n box-shadow: 0 0 0 var(--focus-field-stroke) var(--nv-field-focus-box-shadow);\n }\n\n &:has(select:disabled) {\n // opacity: var(--components-form-opacity-disabled, 0.5); broken token generation, is 50px instead of 0.5\n opacity: 0.5;\n background-color: var(--components-form-field-background-disabled);\n border-color: var(--nv-field-border-disabled);\n }\n}\n\n@mixin form-field-select() {\n display: flex;\n align-items: center;\n flex: 1 0 0;\n overflow: hidden;\n background-color: transparent;\n color: var(--components-form-field-content-text);\n text-overflow: ellipsis;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 500;\n height: var(--form-field-line-height);\n padding: var(--form-field-padding-y) var(--form-field-padding-x);\n box-sizing: content-box;\n -webkit-appearance: none;\n -moz-appearance: none;\n cursor: pointer;\n\n &:focus {\n outline: none;\n }\n\n &::placeholder {\n overflow: hidden;\n color: var(--components-form-field-content-placeholder);\n text-overflow: ellipsis;\n font-family: 'TT Norms Pro', sans-serif;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 400;\n line-height: var(--form-field-line-height);\n }\n}\n\n@mixin form-field-multi-select() {\n height: 100%;\n box-sizing: border-box;\n}\n\n@mixin form-field-select-icons() {\n position: absolute;\n right: 0;\n top: 0;\n pointer-events: none;\n}\n\nnv-fieldselect {\n @include form-field-variables();\n @include form-field-root();\n\n &[readonly]:not([readonly='false']) {\n @include form-field-readonly-variables();\n }\n\n &[display-value]:not([display-value='false']) {\n @include form-field-readonly-variables();\n }\n\n &[error]:not([error='false']) {\n @include form-field-error-variables();\n }\n\n &[success]:not([success='false']) {\n @include form-field-success-variables();\n }\n\n &[required]:not([required='false']) label {\n @include form-field-label-required();\n }\n\n &[multiple]:not([multiple='false']) {\n .select-wrapper > .select-container {\n > .select-icons {\n top: var(--form-field-padding-y);\n right: var(--form-field-padding-x);\n }\n > select {\n @include form-field-multi-select();\n }\n }\n }\n\n label {\n @include form-field-label();\n }\n\n .select-wrapper {\n @include form-field-select-wrapper();\n\n .select-container {\n @include form-field-select-container();\n\n > .select-icons {\n @include form-field-select-icons();\n > nv-iconbutton {\n @include form-field-action();\n }\n }\n\n input {\n @include form-field-input();\n\n &:read-only {\n // opacity: var(--components-form-opacity-disabled, 0.5); broken token generation, is 50px instead of 0.5\n opacity: 0.5;\n background-color: var(\n --components-form-field-background-readonly,\n rgb(0 0 0 / 10%)\n );\n border-color: var(--nv-field-border-readonly);\n }\n }\n\n select {\n @include form-field-select();\n\n & option {\n font-size: var(--form-field-font-size, 16px);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-field-line-height, 24px);\n }\n\n &.hidden {\n display: none;\n }\n }\n\n nv-icon.readonly-icon {\n @include form-field-icon();\n }\n\n nv-icon.validation {\n @include form-field-icon();\n }\n }\n }\n\n .description {\n @include form-field-description();\n }\n\n .error-description {\n @include form-field-error-description();\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Watch,\n Element,\n State,\n} from '@stencil/core';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Content to be placed inside the select element.\n * @slot leading-input - Content to be placed before the select input, within the select container.\n * @slot before-input - Content to be placed before the select input, outside the select container.\n * @slot after-input - Content to be placed after the select input, outside the select container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fieldselect',\n shadow: false,\n formAssociated: true,\n styleUrl: 'nv-fieldselect.scss',\n})\nexport class NvFieldselect {\n @Element() el: HTMLNvFieldselectElement;\n private selectElement!: HTMLSelectElement;\n private internals: ElementInternals;\n\n /****************************************************************************/\n //#region DEPRECATED\n\n /**\n * Message defines a 'hint ' message for the Select Field.\n * @deprecated Use `description` instead.\n */\n @Prop({ reflect: true })\n readonly message: string;\n\n /**\n * Add the message to the validation state.\n * @deprecated Use `errorDescription` and set the error prop instead.\n */\n @Prop({ reflect: true })\n readonly validation: string;\n\n //#endregion DEPRECATED\n /****************************************************************************/\n //#region STATES\n\n @State()\n private computedDisplayValue: string = '';\n\n @State()\n private internalReadonly: boolean = false;\n\n /**\n * Options to display in the select. Can be passed as a JSON string.\n * Format: [{ label: string, value: string, selected?: boolean, disabled?: boolean }]\n */\n @Prop({ reflect: true })\n readonly options?: string;\n\n /**\n * Parsed options stored internally\n */\n @State()\n private parsedOptions: Array<{\n /**\n * The label of the option\n */\n label: string;\n /**\n * The value of the option\n */\n value: string;\n /**\n * Whether the option is selected\n */\n selected?: boolean;\n /**\n * Whether the option is disabled\n */\n disabled?: boolean;\n }> = [];\n\n //#endregion STATES\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the select element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated\n * to ensure unique identification, facilitating proper label association and\n * accessibility.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Lets you define the text that explains what users should choose in the\n * select field. It’s a crucial element for making forms clear and\n * user-friendly.\n */\n @Prop({ reflect: true })\n readonly label?: string;\n\n /**\n * Add helpful hints or extra information under the select field. This is\n * where you can clarify what users should choose or provide additional\n * instructions, making the form easier to fill out correctly.\n */\n @Prop({ reflect: true, mutable: true })\n description?: string;\n\n /**\n * Defines the name attribute of the select field, which is crucial for form\n * submission. This value is used as the key in the key-value pair sent to\n * the server, representing the selected data in form submissions. It should be\n * unique within the form to avoid conflicts\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * The disabled prop lets you turn off the select field so that users can’t\n * choose something. When disabled, the field is grayed out and won’t respond to\n * clicks or touches.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Display the select field’s content without allowing users to change it.\n * Users can still click on it, select, and copy the text, but they won’t be\n * able to change or delete anything.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the select field as required, ensuring that the user must fill it out\n * before submitting the form.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Alters the select field’s appearance to indicate an error, helping users\n * identify fields that need correction.\n * @validator error\n */\n @Prop({ reflect: true, mutable: true })\n error: boolean = false;\n\n /**\n * Show a helpful message under the select field when there’s a problem. It\n * explains what’s wrong and how users can fix it, making the error easier to\n * understand and resolve.\n * @validator message\n */\n @Prop({ reflect: true, mutable: true })\n errorDescription: string;\n\n /**\n * Changes the select field’s appearance to indicate successful input or\n * validation.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * When enabled, allows the select to handle multiple selections.\n */\n @Prop({ reflect: true })\n readonly multiple: boolean = false;\n\n /**\n * The value of the select field.\n * - If `multiple` is `false`, it's a single string.\n * - If `multiple` is `true`, it's a comma-separated string of selected values.\n */\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * When enabled, displays the value element instead of the label when readonly.\n * By default, the label is displayed in readonly mode. Also it automatically\n * sets the component to readonly.\n */\n @Prop({ reflect: true })\n readonly displayValue: boolean = false;\n\n /**\n * Applies focus to the input field as soon as the component is mounted. This\n * is equivalent to setting the native autofocus attribute on a <select>\n * element.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the selected value changes.\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>; // Emit as a string\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region WATCHERS\n\n /**\n * Updates the display value when the value property changes. This watcher is\n * used to update the display value when the selected value changes. This is\n * necessary for readonly select fields to display the selected value.\n * @internal This watcher is not intended to be called outside of the component.\n * @param {string} newValue - The new value of the select field.\n */\n @Watch('value')\n updateDisplayValueWatcher(newValue: string) {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n const selectedValues = newValue.split(',').map(val => val.trim());\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n\n if (!this.multiple) {\n this.selectElement.value = newValue; // Only set when not multiple\n }\n } else {\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Update form value\n this.setFormValue();\n }\n\n /**\n * Watcher for the displayValue prop to ensure internalReadonly is true when displayValue is true.\n * @param {boolean} newValue - The new value of displayValue.\n */\n @Watch('displayValue')\n handleDisplayValueChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.readonly) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Watcher for the readonly prop to ensure internalReadonly is true when readonly is true.\n * @param {boolean} newValue - The new value of readonly.\n */\n @Watch('readonly')\n handleReadonlyChange(newValue: boolean) {\n this.internalReadonly = newValue; // Set internalReadonly to true if displayValue is true\n\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n }\n\n /**\n * Parse options and update the internal state\n * @param {string} newValue - The new value of options\n */\n @Watch('options')\n handleOptionsChange(newValue: string) {\n if (typeof newValue === 'string') {\n try {\n const parsedOpts = JSON.parse(newValue);\n this.parsedOptions = [...parsedOpts];\n\n // Update the value if an option is pre-selected\n const selectedOption = parsedOpts.find(opt => opt.selected);\n if (selectedOption) {\n this.value = selectedOption.value;\n }\n } catch (error) {\n console.error('Error parsing options:', error);\n this.parsedOptions = [];\n }\n }\n }\n\n //#endregion WATCHERS\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Handles the change event on the select element. This method is used to\n * update the value property when the selected options change. It is also\n * used to emit the selectChanged event when the selected value changes.\n * @param {Event} event - The change event on the select element.\n * @emits selectChanged\n */\n private readonly handleSelectChange = (event: Event) => {\n const select = event.target as HTMLSelectElement;\n let selectedValues: string[] = Array.from(select.selectedOptions).map(\n option => option.value,\n );\n\n if (!this.multiple) {\n selectedValues = selectedValues.slice(0, 1);\n }\n\n this.value = this.multiple\n ? selectedValues.join(', ')\n : selectedValues[0] || '';\n this.valueChanged.emit(this.value);\n\n // Update form value\n this.setFormValue();\n };\n\n /**\n * Handles focus when the select container is clicked.\n */\n private readonly handleSelectContainerClick = () => {\n if (!this.internalReadonly && this.selectElement) {\n this.selectElement.focus();\n }\n };\n\n /**\n * Updates the display value of the select field. This method is used to\n * update the display value when the selected value changes. This is necessary\n * for readonly select fields to display the selected value. This method is\n * called in the componentDidLoad lifecycle hook and the updateDisplayValueWatcher\n * watcher.\n * @internal This method is not intended to be called outside of the component.\n */\n private updateDisplayValue(): void {\n if (this.internalReadonly && !this.displayValue) {\n if (this.multiple) {\n const selectedLabels = this.value\n .split(',')\n .map(key => key.trim())\n .map(key => this.getLabelFromId(key) || '')\n .filter(label => label !== '');\n this.computedDisplayValue = selectedLabels.join(', ') || '';\n } else {\n this.computedDisplayValue = this.getLabelFromId(this.value) || '';\n }\n } else if (this.internalReadonly && this.displayValue) {\n this.computedDisplayValue = this.value || '';\n }\n }\n\n /**\n * Retrieves the label from the <option> elements based on the provided key (value).\n * This method uses the id or value attribute directly from the <select> options.\n * @param {string} key - The key (value) for which to find the corresponding label.\n * @returns {string} The label if found; otherwise, an empty string.\n */\n private getLabelFromId(key: string): string {\n this.ensureSelectElement();\n if (!this.selectElement) {\n return '';\n }\n\n // Cache the option list\n const options = this.selectElement.options;\n\n if (options) {\n const option = Array.from(options).find(option => option.value === key);\n return option ? option.textContent.trim() || '' : '';\n } else {\n return '';\n }\n }\n\n /**\n * Sets the value of the form element for form submission. This method is\n * called when the selected value changes or when the value property is set.\n * @internal This method is not intended to be called outside of the component.\n */\n private setFormValue(): void {\n this.internals.setFormValue(this.value);\n }\n\n /**\n * Ensures the select element is available. This method is used to ensure\n * the select element is available before attempting to access it.\n * @internal This method is not intended to be called outside of the component.\n */\n private ensureSelectElement(): void {\n if (!this.selectElement) {\n this.selectElement = this.el.querySelector('select') as HTMLSelectElement;\n }\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillRender() {\n this.updateDisplayValue(); // Ensure display value is updated before render\n\n if (this.message) {\n this.description = this.message;\n }\n\n if (this.validation) {\n this.errorDescription = this.validation;\n this.error = true;\n }\n }\n\n /**\n * Lifecycle method that is called before the component is rendered. This is\n * where the internal state is set up before rendering occurs.\n */\n componentWillLoad() {\n // Set internalReadonly based on the readonly prop\n this.internalReadonly = this.readonly;\n\n // Ensure internalReadonly is true if displayValue is true during loading\n if (this.displayValue) {\n this.internalReadonly = true;\n }\n\n if ('attachInternals' in this.el) {\n this.internals = (\n this.el as HTMLElement & {\n /**\n * Attach the element to the form internals.\n * @returns {ElementInternals} - The element internals object.\n */\n attachInternals: () => ElementInternals;\n }\n ).attachInternals();\n } else {\n // Fallback logic for browsers without attachInternals support\n this.internals = {\n setFormValue: (value: string) => {\n const formElement = this.el.closest('form');\n if (formElement) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = this.name;\n input.value = value;\n formElement.appendChild(input);\n }\n },\n } as ElementInternals;\n }\n\n // Initialize value as an empty string if multiple is true\n if (this.multiple && typeof this.value !== 'string') {\n this.value = '';\n }\n\n // Parse initial options if present\n if (this.options) {\n this.handleOptionsChange(this.options);\n }\n }\n\n /**\n * Lifecycle method that is called after the component has been rendered.\n * This is where the display value is updated and the initial select element's\n * state is set.\n */\n componentDidLoad() {\n this.updateDisplayValue();\n\n if (this.selectElement) {\n // Only set the value for single selection, skip for multiple\n if (!this.multiple) {\n this.selectElement.value = this.value;\n }\n\n const selectedValues = this.multiple\n ? this.value.split(',').map(v => v.trim())\n : [this.value];\n\n const options = this.selectElement.options;\n\n if (options) {\n Array.from(options).forEach(option => {\n option.selected = this.multiple\n ? selectedValues.includes(option.value)\n : option.value === selectedValues[0];\n });\n } else {\n // Handle case where there are no options\n this.selectElement.value = selectedValues[0] || '';\n }\n }\n\n // Set the initial form value\n this.setFormValue();\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDERING\n\n /**\n * The render method creates the HTML structure for the component, including\n * the label, select element, and any error or description messages. It also\n * applies the appropriate CSS classes based on the readonly state and\n * displayValue prop. This method is called when the component is rendered.\n * @returns {HTMLStencilElement} The HTML element to render.\n */\n render() {\n return (\n <Host>\n {(this.label || this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <div class=\"select-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"select-container\"\n onClick={this.handleSelectContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n {this.internalReadonly && (\n <input\n id={this.inputId + '-readonly'}\n type=\"text\"\n value={this.computedDisplayValue}\n readonly\n class=\"readonly-input\"\n aria-readonly=\"true\"\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n />\n )}\n\n <select\n id={this.inputId}\n ref={el => (this.selectElement = el)}\n name={this.name}\n autofocus={this.autofocus}\n disabled={this.disabled}\n required={this.required}\n multiple={this.multiple}\n onChange={this.handleSelectChange}\n class={this.internalReadonly ? 'hidden' : ''}\n aria-label={this.label}\n aria-describedby={\n this.error\n ? `${this.inputId}-error`\n : `${this.inputId}-description`\n }\n >\n {this.parsedOptions.length > 0 ? (\n this.parsedOptions.map(option => (\n <option\n value={option.value}\n selected={option.selected}\n disabled={option.disabled}\n >\n {option.label}\n </option>\n ))\n ) : (\n <slot />\n )}\n </select>\n <div class=\"select-icons\">\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n {!this.multiple && (\n <nv-iconbutton\n name=\"chevron-down\"\n size=\"md\"\n emphasis=\"lower\"\n tabindex={-1}\n />\n )}\n </div>\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n {(this.description ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\" id={`${this.inputId}-description`}>\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div class=\"error-description\" id={`${this.inputId}-error`}>\n <slot name=\"error-description\">{this.errorDescription}</slot>\n </div>\n )}\n </Host>\n );\n }\n\n //#endregion RENDERING\n}\n"],"version":3}
|
|
@@ -104,9 +104,9 @@ const NvFieldtext = class {
|
|
|
104
104
|
/****************************************************************************/
|
|
105
105
|
//#region RENDER
|
|
106
106
|
render() {
|
|
107
|
-
return (h(Host, { key: '
|
|
108
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
109
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
107
|
+
return (h(Host, { key: 'ffcbe1c8f14257f6380d28f2c50fe8b77ae73027' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '3b84598a05eedc7625312def01ca726dc68fa247', htmlFor: this.inputId }, h("slot", { key: '8c8f0d2f86742dd0699b8b309cbea0dca1d294ce', name: "label" }, this.label))), h("div", { key: 'c2adf3acc7780a7eba5d4762b7275d1c63304bf5', class: "input-wrapper" }, h("slot", { key: 'c49756d1daaba476222ebda2df4854b1094655b3', name: "before-input" }), h("div", { key: '723c34f09e6c073bdef2db799246da72ffd52703', class: "input-container", onClick: this.handleInputContainerClick }, h("slot", { key: '4e94bcac72ac2e5147a8d5e33396a13359820009', name: "leading-input" }), h("input", { key: '96cbf022912735445467320600e372fba03de4e4', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autofocus: this.autofocus, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), this.error && (h("nv-icon", { key: '39a55c42a49006d316e5dcc5389793c6264d2b09', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: 'bf1b6040dbb392b5c46b3b9af665d7cdc7389d29', name: "circle-check", class: "validation", size: "md" }))), h("slot", { key: 'bb2256bf3fc5165e61f162fe89dd7be564a989c0', name: "after-input" })), (this.description ||
|
|
108
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '3d2c5a89247042184b3a110ca7982b793b0bd86a', class: "description" }, h("slot", { key: '2358cc5217d6ba65b4d4baa927b397dbe62982e8', name: "description" }, this.description))), (this.errorDescription ||
|
|
109
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: 'cdef4117d71b8a6bdde19fea1a0f4070ba02ab2e', hidden: !this.error, class: "error-description" }, h("slot", { key: '66a2b100ab641aa9c2e22fdfc9a987bb86cd44a0', name: "error-description" }, this.errorDescription)))));
|
|
110
110
|
}
|
|
111
111
|
static get formAssociated() { return true; }
|
|
112
112
|
get el() { return getElement(this); }
|
|
@@ -174,9 +174,9 @@ const NvFieldtextarea = class {
|
|
|
174
174
|
/****************************************************************************/
|
|
175
175
|
//#region RENDER
|
|
176
176
|
render() {
|
|
177
|
-
return (h(Host, { key: '
|
|
178
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
179
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
177
|
+
return (h(Host, { key: 'b5d6707fa7ebbd64f3b1616c9f61746f394e347d' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '6fd76411b08da2d22d86d0a4ef81ce99534d0112', htmlFor: this.inputId }, h("slot", { key: '634339fa1bd5ccb2627dab03117535b2bc09b9cc', name: "label" }, this.label))), h("div", { key: '6a521f191ebae60a874c4d48a1872b7a61181c54', class: "textarea-wrapper" }, h("div", { key: 'ecca606c8775282c5b21b8f8e12a9c98df7aa410', class: "textarea-container", onClick: this.handleTextareaContainerClick }, h("textarea", { key: '7547d01134c155c9f76e1978f08075d1e8ff50fd', id: this.inputId, ref: e => (this.textareaElement = e), placeholder: this.placeholder, autofocus: this.autofocus, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, autocomplete: "off", value: this.value, onInput: this.handleTextarea, rows: this.rows, class: clsx(this.resize === 'none' && 'resize-none', this.resize === 'vertical' && 'resize-y', this.resize === 'horizontal' && 'resize-x', this.resize === 'both' && 'resize') }))), (this.description ||
|
|
178
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: 'fc436e3cc4dbdf8730920173a74f4da249678e39', class: "description" }, h("slot", { key: '27aa71e73818742bc92f3860dd0071eef182474a', name: "description" }, this.description))), (this.errorDescription ||
|
|
179
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: 'cc3733783b2f5985358d1c21e502845f7bab8406', hidden: !this.error, class: "error-description" }, h("slot", { key: '1db584479ed23d616d88dc9fc28fe1e0acd7a463', name: "error-description" }, this.errorDescription)))));
|
|
180
180
|
}
|
|
181
181
|
static get formAssociated() { return true; }
|
|
182
182
|
get el() { return getElement(this); }
|
|
@@ -964,26 +964,26 @@ const NvFieldtime = class {
|
|
|
964
964
|
}, key: `${option}-${index}`, onClick: e => this.handleTimeOptionClick(e, type) }, option)))));
|
|
965
965
|
}
|
|
966
966
|
render() {
|
|
967
|
-
return (h(Host, { key: '
|
|
968
|
-
h("input", { key: '
|
|
967
|
+
return (h(Host, { key: 'd9b980ce6cf9d4c00da007608b03261983ae49b7', onclick: e => this.handleHostClick(e) }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: 'ff69b45e9b30ee4b0dd2034c1e29b698796f8796', htmlFor: this.inputId }, h("slot", { key: '6cfd62e39f69451c326b5266a3c8b33520366ac7', name: "label" }, this.label))), h("nv-popover", { key: 'f2c68b4286769203b9f4af8cc61375dc60795589', ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { key: 'eb45e4d83e5d9754336bc7d03a2937931fa56378', class: "input-wrapper", slot: "trigger" }, h("slot", { key: '644faecac37927eae57da8eb039a79154ebf5787', name: "before-input" }), h("div", { key: '10b656c08d991100a5ef0fe87299af7a3d0a7831', class: "input-container" }, h("slot", { key: '3908fc76c97f4a362974199f30bdc2535172e4dc', name: "leading-input" }), startsWithIgnoreCase(this.format, 'HH') && [
|
|
968
|
+
h("input", { key: 'b68e32193ab056a230138dfbb2d14240fa700b1d', ref: el => (this.inputElements[TimeType.Hours] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.hours, onInput: e => this.handleInputChange(e, TimeType.Hours), placeholder: this.format.includes('hh') ? 'hh' : 'HH', inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Hours), name: this.name
|
|
969
969
|
? `${TimeType.Hours}-${this.name}`
|
|
970
970
|
: TimeType.Hours, id: this.inputId, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
971
971
|
], this.format.includes('mm') && [
|
|
972
|
-
h("span", { key: '
|
|
973
|
-
h("input", { key: '
|
|
972
|
+
h("span", { key: 'ebef6f727c34aa8f9348c65c02ab970a409cce2e' }, ":"),
|
|
973
|
+
h("input", { key: 'd4aa6001b2f462d64eae1bdda7f46d97a926802e', ref: el => (this.inputElements[TimeType.Minutes] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.minutes, onInput: e => this.handleInputChange(e, TimeType.Minutes), placeholder: "mm", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Minutes), name: this.name
|
|
974
974
|
? `${TimeType.Minutes}-${this.name}`
|
|
975
975
|
: TimeType.Minutes, id: `${this.inputId}-minutes`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
976
976
|
], this.format.includes('ss') && [
|
|
977
|
-
h("span", { key: '
|
|
978
|
-
h("input", { key: '
|
|
977
|
+
h("span", { key: '9ce4067c241aae590f4cd4383b1ece3a7510a2c7' }, ":"),
|
|
978
|
+
h("input", { key: 'f42706c6e606c59e739b0460b9c9016c796542da', ref: el => (this.inputElements[TimeType.Seconds] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.seconds, onInput: e => this.handleInputChange(e, TimeType.Seconds), placeholder: "ss", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Seconds), name: this.name
|
|
979
979
|
? `${TimeType.Seconds}-${this.name}`
|
|
980
980
|
: TimeType.Seconds, id: `${this.inputId}-seconds`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
981
|
-
], h("nv-iconbutton", { key: '
|
|
981
|
+
], h("nv-iconbutton", { key: '4c233506c36553289c0e21d889e6c77c46e2862a', name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide time picker' : 'Show time picker', "aria-pressed": this.open.toString(), onClick: () => this.HandleDropdownIconClick() }), this.error && (h("nv-icon", { key: '9dcf992cc15a5462269208daecec4dbfc7fc9183', name: "alert-circle", class: "validation", size: "sm" })), this.success && (h("nv-icon", { key: '3614bfd444d8243c110bf2b458e0d2d5f296566f', name: "circle-check", class: "validation", size: "sm" }))), h("slot", { key: 'e703a923e7c98e2d9fd5d69a5741f1f67c9710b4', name: "after-input" })), h("div", { key: '6a56bd36fac3051ae1a40cbb450a51a415c00db2', class: "time-dropdown", slot: "content" }, h("div", { key: 'c001e4f3afa3fadf49df9186ef38ac10ca3c1f70', class: "time-columns" }, startsWithIgnoreCase(this.format, 'HH') &&
|
|
982
982
|
this.RenderTimeOptionsColumn(TimeType.Hours), this.format.includes('mm') &&
|
|
983
983
|
this.RenderTimeOptionsColumn(TimeType.Minutes), this.format.includes('ss') &&
|
|
984
984
|
this.RenderTimeOptionsColumn(TimeType.Seconds)))), (this.description ||
|
|
985
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
986
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
985
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '62782d291c7e065b79c91a51ebd61afcef60c058', class: "description" }, h("slot", { key: '70d29b36d481bfc5ec8a9435e2eadf0007aa95c3', name: "description" }, this.description))), (this.errorDescription ||
|
|
986
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '71818050156b31a39daf70e4cf8cb1a03f809458', hidden: !this.error, class: "error-description" }, h("slot", { key: 'cb7fb776375e7afaaa22ae90f8e6eb533e066e53', name: "error-description" }, this.errorDescription)))));
|
|
987
987
|
}
|
|
988
988
|
static get formAssociated() { return true; }
|
|
989
989
|
get el() { return getElement(this); }
|
|
@@ -54,7 +54,7 @@ const NvIcon = class {
|
|
|
54
54
|
/****************************************************************************/
|
|
55
55
|
//#region RENDER
|
|
56
56
|
render() {
|
|
57
|
-
return (h(Host, { key: '
|
|
57
|
+
return (h(Host, { key: 'a5d7dbfd9cf1be24ba19e8a8902a5a7adb89cc24', class: clsx(this.color && `${this.color}`), role: "img", "aria-label": `${this.name}-icon` }, h("svg", { key: 'b35bc42c038fd288022e13650556086d1dc3604d', stroke: "currentColor", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: `nv-icon-${this.size}` }, h("use", { key: '41833d3d27433422c859b513f28dc48a202d5919', href: `#${this.name}` }))));
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
NvIcon.style = NvIconStyle0;
|
|
@@ -120,7 +120,7 @@ const NvIconbutton = class {
|
|
|
120
120
|
/****************************************************************************/
|
|
121
121
|
//#region RENDER
|
|
122
122
|
render() {
|
|
123
|
-
return (h(Host, { key: '
|
|
123
|
+
return (h(Host, { key: 'e67f2cfb172fc315ea4d12290000cd92ff683e88', role: "button", type: this.type, tabindex: "0", disabled: this.disabled ? true : undefined, class: clsx('root', `size-${this.size}`, `emphasis-${this.emphasis}`, this.loading && 'loading', `shape-${this.shape}`), onClick: this.handleClick }, this.loading && h("nv-loader", { key: '6477c82dcaa79147d03ae730d9ab2835959bcde6', size: this.size }), !this.loading && h("nv-icon", { key: '8ffecf3db1d721ff88ba3c7b4e08543e48adedd5', name: this.name, size: this.size }), h("slot", { key: 'c03cccb5aff47a9f758fc23b4e2226301d2d2fcc' })));
|
|
124
124
|
}
|
|
125
125
|
static get formAssociated() { return true; }
|
|
126
126
|
get el() { return getElement(this); }
|
|
@@ -151,7 +151,7 @@ const NvLoader = class {
|
|
|
151
151
|
//#region RENDER
|
|
152
152
|
/* <slot> empty to force rendering change */
|
|
153
153
|
render() {
|
|
154
|
-
return (h(Host, { key: '
|
|
154
|
+
return (h(Host, { key: '701552c6cf9126e60d81f844648ec1d29079fdd3', class: clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
NvLoader.style = NvLoaderStyle0;
|
|
@@ -26,8 +26,8 @@ const NvMenu = class {
|
|
|
26
26
|
*/
|
|
27
27
|
this.disableCloseOnSelect = false;
|
|
28
28
|
/**
|
|
29
|
-
* Decides where the menu shows up next to the button it
|
|
30
|
-
* below, to the sides). If there isn
|
|
29
|
+
* Decides where the menu shows up next to the button it's linked to (above,
|
|
30
|
+
* below, to the sides). If there isn't enough room, it will adjust its
|
|
31
31
|
* position on the axis to fit on the screen, so users can always see it.
|
|
32
32
|
*/
|
|
33
33
|
this.placement = 'bottom-end';
|
|
@@ -212,7 +212,7 @@ const NvMenu = class {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
render() {
|
|
215
|
-
return (h(Host, { key: '
|
|
215
|
+
return (h(Host, { key: '8334eee36cadee43d5d78d227841b43da86a46c6' }, h("slot", { key: 'a4f260a9161dc239eabfc9c43178b1394721f37d', name: "trigger" }), h("nv-popover", { key: '6f163bc5c02afba3af1e9bb43cf3b6bfec1e9374', ref: el => (this.popoverElement = el), triggerMode: "click", triggerElement: this.triggerElement, placement: this.placement, nested: this.nested, open: this.open }, this.parsedItems.length > 0 ? (h("ul", { slot: "content" }, this.renderMenuItems(this.parsedItems))) : (h("slot", { name: "content" })))));
|
|
216
216
|
}
|
|
217
217
|
get el() { return getElement(this); }
|
|
218
218
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nv-menu.entry.js","mappings":";;AAAA,MAAM,SAAS,GAAG,k2DAAk2D,CAAC;AACr3D,qBAAe,SAAS;;MC8DX,MAAM;IALnB;;;QASU,sBAAiB,GAAY,KAAK,CAAC;;;;;;;QAU3C,SAAI,GAAY,KAAK,CAAC;;;;;QAOb,WAAM,GAAY,KAAK,CAAC;;;;;QAOxB,yBAAoB,GAAY,KAAK,CAAC;;;;;;QAQtC,cAAS,GAAc,YAAY,CAAC;;;;QAarC,gBAAW,GAAe,EAAE,CAAC;KAsRtC;;;;;IA/QC,iBAAiB,CAAC,QAAgB;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,IAAI;gBACF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;gBAClD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;aACvB;SACF;KACF;;;;;;;IAUD,MAAM,IAAI;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;;;;IAMD,MAAM,KAAK;QACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;KACnB;IAiBD,oBAAoB,CAClB,KAAqE;QAErE,IAAI,IAAI,CAAC,oBAAoB;YAAE,OAAO;QACtC,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACpC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;KACnB;IAGD,aAAa,CAAC,KAAoB;;;QAGhC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IACE,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO;gBACpB,KAAK,CAAC,GAAG,KAAK,WAAW;g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IAAI,CAAC,IAAgB,EAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,GACJ,CACP,EACV;aACH;YACD,QACE,mBACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAgB,EAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,GACJ,EACf;SACH,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,EAAC,IAAI,uDACH,6DAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,mEACE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,WAAW,EAAC,OAAO,EACnB,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IAEd,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAC1B,UAAI,IAAI,EAAC,SAAS,IAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAM,KAEhE,YAAM,IAAI,EAAC,SAAS,GAAQ,CAC7B,CACU,CACR,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/nv-menu/nv-menu.scss?tag=nv-menu","src/components/nv-menu/nv-menu.tsx"],"sourcesContent":["@use \"../nv-menuitem/nv-menuitem\" as nv-menuitem;\n\n@mixin root-styles() {\n display: inline-block;\n position: relative;\n\n &:has([fluid]:not([fluid=\"false\"])) {\n display: block;\n }\n}\n\n@mixin content-styles() {\n padding: var(--menu-contextual-padding-y)\n var(--menu-contextual-padding-x);\n border-radius: var(--menu-contextual-radius);\n gap: var(--menu-contextual-gap-y);\n background-color: var(--components-menu-contextual-background);\n border-color: var(--components-menu-contextual-border);\n display: flex;\n flex-direction: column;\n}\n\n@mixin separator-styles() {\n display: block;\n margin: var(--menu-contextual-divider-padding-top)\n var(--menu-contextual-divider-padding-x)\n var(--menu-contextual-divider-padding-bottom)\n var(--menu-contextual-divider-padding-x) ;\n}\n\nnv-menu {\n @include root-styles();\n\n nv-popover {\n display: unset;\n\n [data-scope=popover]{\n background-color: transparent !important;\n padding: 0 !important;\n }\n }\n\n [slot=\"content\"] {\n @include content-styles();\n }\n\n nv-menu[open]:not([open=\"false\"]) {\n > nv-menuitem {\n @include nv-menuitem.focused-styles();\n }\n }\n\n hr {\n @include separator-styles();\n }\n}\n","import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Listen,\n Event,\n EventEmitter,\n Method,\n State,\n Watch,\n} from '@stencil/core';\nimport type { Placement } from '@floating-ui/dom';\nimport { IconName } from '../nv-icon/nv-icons';\n\n/**\n * Interface to define the structure of a menu item\n */\ninterface MenuItem {\n /**\n * The label of the menu item.\n */\n label: string;\n /**\n * The value of the menu item.\n */\n value?: string;\n /**\n * Whether the menu item is disabled.\n */\n disabled?: boolean;\n /**\n * Whether the menu item has a submenu.\n */\n hasSubmenu?: boolean;\n /**\n * The icon of the menu item.\n */\n icon?: string;\n /**\n * The shortcut of the menu item.\n */\n shortcut?: string;\n /**\n * Whether the menu item is nested.\n */\n nested?: boolean;\n /**\n * The submenu items of the menu item.\n */\n submenuItems?: MenuItem[];\n}\n\n/**\n * @slot trigger - Button to toggle the menu popover.\n * @slot content - Use an <ul></ul> tag for the slot, and place <nv-menuitem> elements inside.\n */\n@Component({\n tag: 'nv-menu',\n styleUrl: 'nv-menu.scss',\n shadow: false,\n})\nexport class NvMenu {\n @Element() el: HTMLNvMenuElement;\n private triggerElement!: HTMLElement;\n private popoverElement!: HTMLNvPopoverElement;\n private isHandlingKeyDown: boolean = false;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Use this to toggle the initial visibility of the menu, by default the menu\n * is hidden.\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean = false;\n\n /**\n * Use this if the menu is nested inside another menu. This will prevent the\n * parent menu from closing when the child menu is opened.\n */\n @Prop({ reflect: true })\n readonly nested: boolean = false;\n\n /**\n * Use this to disable the menu from closing automatically when a menu item is\n * selected.\n */\n @Prop({ reflect: true })\n readonly disableCloseOnSelect: boolean = false;\n\n /**\n * Decides where the menu shows up next to the button it’s linked to (above,\n * below, to the sides). If there isn’t enough room, it will adjust its\n * position on the axis to fit on the screen, so users can always see it.\n */\n @Prop({ reflect: true })\n readonly placement: Placement = 'bottom-end';\n\n /**\n * (New feature) Items to display in the menu, provided as a JSON string.\n * Format: [{ label: string, value?: string, disabled?: boolean, hasSubmenu?: boolean, ... }]\n */\n @Prop({ reflect: true })\n readonly items?: string;\n\n /**\n * Parsed items stored in state.\n */\n @State()\n private parsedItems: MenuItem[] = [];\n\n /**\n * Watcher to parse the items when the `items` property changes.\n * @param {string} newValue - The new value of the `items` property.\n */\n @Watch('items')\n handleItemsChange(newValue: string) {\n if (typeof newValue === 'string') {\n try {\n this.parsedItems = JSON.parse(newValue);\n } catch (error) {\n console.error('Error parsing menu items:', error);\n this.parsedItems = [];\n }\n }\n }\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Opens the menu.\n */\n @Method()\n async show() {\n this.open = true;\n }\n\n /**\n * Closes the menu.\n */\n @Method()\n async close() {\n this.open = false;\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted from nv-menuitem elements with the corresponding id and name when\n * selected (via click or keyboard). This event listener can be attached to\n * either the nv-menu or the nv-menuitem element.\n */\n @Event()\n menuitemSelected: EventEmitter<\n HTMLNvMenuitemElementEventMap['menuitemSelected']\n >;\n\n @Listen('menuitemSelected')\n handleMenuItemSelect(\n event: CustomEvent<HTMLNvMenuitemElementEventMap['menuitemSelected']>,\n ) {\n if (this.disableCloseOnSelect) return;\n if (event.detail.hasSubmenu) return;\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeydown(event: KeyboardEvent) {\n // If the menu is not open, check if the trigger is focused\n // and the user presses Enter or ArrowDown, open the menu\n if (!this.open) {\n if (\n (event.key === 'Enter' ||\n event.key === 'ArrowDown' ||\n event.key === ' ') &&\n document.activeElement === this.triggerElement\n ) {\n event.preventDefault();\n this.show();\n // Then, put the focus on the first menuitem\n const firstMenuItem = this.popoverElement.querySelector('nv-menuitem');\n if (firstMenuItem) {\n requestAnimationFrame(() => (firstMenuItem as HTMLElement).focus());\n }\n }\n return;\n }\n\n if (this.isHandlingKeyDown) return;\n this.isHandlingKeyDown = true;\n\n if (\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp' ||\n event.key === 'ArrowLeft' ||\n event.key === 'ArrowRight' ||\n event.key === 'Escape'\n ) {\n event.preventDefault();\n }\n\n if (event.key === 'Escape' && !this.nested) {\n this.close();\n this.triggerElement.focus();\n this.isHandlingKeyDown = false;\n return;\n }\n\n const menuContent = this.el.querySelector('[slot=\"content\"]');\n const menuItems = (\n Array.from(menuContent.childNodes) as Array<\n HTMLNvMenuitemElement | HTMLNvMenuElement\n >\n ).filter(item => item.matches?.('nv-menuitem, nv-menu'));\n\n let currentIndex = menuItems.indexOf(\n document.activeElement as HTMLNvMenuitemElement,\n );\n if (currentIndex === -1)\n currentIndex = menuItems.indexOf(\n document.activeElement.parentElement as HTMLNvMenuitemElement,\n );\n if (\n currentIndex === -1 &&\n menuItems.find(item => item.matches('nv-menu[open]'))\n ) {\n this.isHandlingKeyDown = false;\n return;\n }\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n menuItems.forEach(item => {\n if (item.matches('nv-menu')) (item as HTMLNvMenuElement).close();\n });\n }\n\n if (event.key === 'ArrowDown') {\n let nextIndex = (currentIndex + 1) % menuItems.length;\n while (menuItems[nextIndex].matches('nv-menuitem[disabled]')) {\n nextIndex = (nextIndex + 1) % menuItems.length;\n }\n const nextFocusable = menuItems[nextIndex];\n if (nextFocusable.matches('nv-menuitem')) {\n nextFocusable.focus();\n } else if (nextFocusable.matches('nv-menu')) {\n nextFocusable.querySelector('nv-menuitem').focus();\n }\n }\n\n if (event.key === 'ArrowUp') {\n let prevIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;\n while (menuItems[prevIndex].matches('nv-menuitem[disabled]')) {\n prevIndex = (prevIndex - 1 + menuItems.length) % menuItems.length;\n }\n const prevFocusable = menuItems[prevIndex];\n if (prevFocusable.matches('nv-menuitem')) {\n prevFocusable.focus();\n } else if (prevFocusable.matches('nv-menu')) {\n prevFocusable.querySelector('nv-menuitem').focus();\n }\n }\n\n if (event.key === 'ArrowRight') {\n const submenu = menuItems[currentIndex];\n if (!submenu.matches('nv-menu')) {\n this.isHandlingKeyDown = false;\n return;\n }\n (submenu as HTMLNvMenuElement).show();\n }\n\n if (event.key === 'ArrowLeft' && this.nested) {\n if (menuItems.find(item => item.matches('nv-menu[open]'))) {\n this.isHandlingKeyDown = false;\n return;\n }\n this.close();\n this.triggerElement.focus();\n }\n\n this.isHandlingKeyDown = false;\n }\n\n @Listen('openChanged')\n handleOpenChanged(event: CustomEvent<boolean>) {\n if (event.target === this.el.querySelector('nv-popover')) {\n this.open = event.detail;\n }\n const triggerHasFocus = this.triggerElement === document.activeElement;\n const triggerHasFocusVisible =\n this.triggerElement.matches(':focus-visible');\n if (triggerHasFocus && triggerHasFocusVisible) this.focusFirstItem();\n }\n\n private focusFirstItem() {\n const firstButton = this.popoverElement.querySelector('nv-menuitem');\n if (firstButton) {\n requestAnimationFrame(() => firstButton.focus());\n }\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillLoad() {\n this.triggerElement = Array.from(this.el.children).find(child => {\n return child.getAttribute('slot') === 'trigger';\n }) as HTMLElement;\n\n // If the items attribute is provided, parse its value.\n if (this.items) {\n this.handleItemsChange(this.items);\n }\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDER\n\n /**\n * Generates menu items from the `items` property.\n * @param {MenuItem[]} items - The items to display in the menu.\n * @returns {HTMLElement[]} The rendered items.\n */\n private renderMenuItems(items: MenuItem[]) {\n return items.map(item => {\n if (item.hasSubmenu && item.submenuItems?.length > 0) {\n return (\n <nv-menu\n nested\n placement=\"right-start\"\n items={JSON.stringify(item.submenuItems)}\n >\n <nv-menuitem\n slot=\"trigger\"\n has-submenu\n disabled={item.disabled}\n icon={item.icon as IconName}\n shortcut={item.shortcut}\n id={item.value}\n name={item.label}\n label={item.label}\n ></nv-menuitem>\n </nv-menu>\n );\n }\n return (\n <nv-menuitem\n disabled={item.disabled}\n icon={item.icon as IconName}\n shortcut={item.shortcut}\n id={item.value}\n name={item.label}\n label={item.label}\n ></nv-menuitem>\n );\n });\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\"></slot>\n <nv-popover\n ref={el => (this.popoverElement = el)}\n triggerMode=\"click\"\n triggerElement={this.triggerElement}\n placement={this.placement}\n nested={this.nested}\n open={this.open}\n >\n {this.parsedItems.length > 0 ? (\n <ul slot=\"content\">{this.renderMenuItems(this.parsedItems)}</ul>\n ) : (\n <slot name=\"content\"></slot>\n )}\n </nv-popover>\n </Host>\n );\n }\n\n //#endregion RENDER\n}\n"],"version":3}
|
|
1
|
+
{"file":"nv-menu.entry.js","mappings":";;AAAA,MAAM,SAAS,GAAG,k2DAAk2D,CAAC;AACr3D,qBAAe,SAAS;;MC8DX,MAAM;IALnB;;;QASU,sBAAiB,GAAY,KAAK,CAAC;;;;;;;QAU3C,SAAI,GAAY,KAAK,CAAC;;;;;QAOb,WAAM,GAAY,KAAK,CAAC;;;;;QAOxB,yBAAoB,GAAY,KAAK,CAAC;;;;;;QAQtC,cAAS,GAAc,YAAY,CAAC;;;;QAarC,gBAAW,GAAe,EAAE,CAAC;KAsRtC;;;;;IA/QC,iBAA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;QACJ,QACE,EAAC,IAAI,uDACH,6DAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,mEACE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,WAAW,EAAC,OAAO,EACnB,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IAEd,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAC1B,UAAI,IAAI,EAAC,SAAS,IAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAM,KAEhE,YAAM,IAAI,EAAC,SAAS,GAAQ,CAC7B,CACU,CACR,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/nv-menu/nv-menu.scss?tag=nv-menu","src/components/nv-menu/nv-menu.tsx"],"sourcesContent":["@use \"../nv-menuitem/nv-menuitem\" as nv-menuitem;\n\n@mixin root-styles() {\n display: inline-block;\n position: relative;\n\n &:has([fluid]:not([fluid=\"false\"])) {\n display: block;\n }\n}\n\n@mixin content-styles() {\n padding: var(--menu-contextual-padding-y)\n var(--menu-contextual-padding-x);\n border-radius: var(--menu-contextual-radius);\n gap: var(--menu-contextual-gap-y);\n background-color: var(--components-menu-contextual-background);\n border-color: var(--components-menu-contextual-border);\n display: flex;\n flex-direction: column;\n}\n\n@mixin separator-styles() {\n display: block;\n margin: var(--menu-contextual-divider-padding-top)\n var(--menu-contextual-divider-padding-x)\n var(--menu-contextual-divider-padding-bottom)\n var(--menu-contextual-divider-padding-x) ;\n}\n\nnv-menu {\n @include root-styles();\n\n nv-popover {\n display: unset;\n\n [data-scope=popover]{\n background-color: transparent !important;\n padding: 0 !important;\n }\n }\n\n [slot=\"content\"] {\n @include content-styles();\n }\n\n nv-menu[open]:not([open=\"false\"]) {\n > nv-menuitem {\n @include nv-menuitem.focused-styles();\n }\n }\n\n hr {\n @include separator-styles();\n }\n}\n","import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Listen,\n Event,\n EventEmitter,\n Method,\n State,\n Watch,\n} from '@stencil/core';\nimport type { Placement } from '@floating-ui/dom';\nimport { IconName } from '../nv-icon/nv-icons';\n\n/**\n * Interface to define the structure of a menu item\n */\ninterface MenuItem {\n /**\n * The label of the menu item.\n */\n label: string;\n /**\n * The value of the menu item.\n */\n value?: string;\n /**\n * Whether the menu item is disabled.\n */\n disabled?: boolean;\n /**\n * Whether the menu item has a submenu.\n */\n hasSubmenu?: boolean;\n /**\n * The icon of the menu item.\n */\n icon?: string;\n /**\n * The shortcut of the menu item.\n */\n shortcut?: string;\n /**\n * Whether the menu item is nested.\n */\n nested?: boolean;\n /**\n * The submenu items of the menu item.\n */\n submenuItems?: MenuItem[];\n}\n\n/**\n * @slot trigger - The button element that toggles the menu popover\n * @slot content - The content of the menu, should be wrapped in a ul element containing nv-menuitem elements\n */\n@Component({\n tag: 'nv-menu',\n styleUrl: 'nv-menu.scss',\n shadow: false,\n})\nexport class NvMenu {\n @Element() el: HTMLNvMenuElement;\n private triggerElement!: HTMLElement;\n private popoverElement!: HTMLNvPopoverElement;\n private isHandlingKeyDown: boolean = false;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Use this to toggle the initial visibility of the menu, by default the menu\n * is hidden.\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean = false;\n\n /**\n * Use this if the menu is nested inside another menu. This will prevent the\n * parent menu from closing when the child menu is opened.\n */\n @Prop({ reflect: true })\n readonly nested: boolean = false;\n\n /**\n * Use this to disable the menu from closing automatically when a menu item is\n * selected.\n */\n @Prop({ reflect: true })\n readonly disableCloseOnSelect: boolean = false;\n\n /**\n * Decides where the menu shows up next to the button it's linked to (above,\n * below, to the sides). If there isn't enough room, it will adjust its\n * position on the axis to fit on the screen, so users can always see it.\n */\n @Prop({ reflect: true })\n readonly placement: Placement = 'bottom-end';\n\n /**\n * (New feature) Items to display in the menu, provided as a JSON string.\n * Format: [{ label: string, value?: string, disabled?: boolean, hasSubmenu?: boolean, ... }]\n */\n @Prop({ reflect: true })\n readonly items?: string;\n\n /**\n * Parsed items stored in state.\n */\n @State()\n private parsedItems: MenuItem[] = [];\n\n /**\n * Watcher to parse the items when the `items` property changes.\n * @param {string} newValue - The new value of the `items` property.\n */\n @Watch('items')\n handleItemsChange(newValue: string) {\n if (typeof newValue === 'string') {\n try {\n this.parsedItems = JSON.parse(newValue);\n } catch (error) {\n console.error('Error parsing menu items:', error);\n this.parsedItems = [];\n }\n }\n }\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Opens the menu.\n */\n @Method()\n async show() {\n this.open = true;\n }\n\n /**\n * Closes the menu.\n */\n @Method()\n async close() {\n this.open = false;\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted from nv-menuitem elements with the corresponding id and name when\n * selected (via click or keyboard). This event listener can be attached to\n * either the nv-menu or the nv-menuitem element.\n */\n @Event()\n menuitemSelected: EventEmitter<\n HTMLNvMenuitemElementEventMap['menuitemSelected']\n >;\n\n @Listen('menuitemSelected')\n handleMenuItemSelect(\n event: CustomEvent<HTMLNvMenuitemElementEventMap['menuitemSelected']>,\n ) {\n if (this.disableCloseOnSelect) return;\n if (event.detail.hasSubmenu) return;\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeydown(event: KeyboardEvent) {\n // If the menu is not open, check if the trigger is focused\n // and the user presses Enter or ArrowDown, open the menu\n if (!this.open) {\n if (\n (event.key === 'Enter' ||\n event.key === 'ArrowDown' ||\n event.key === ' ') &&\n document.activeElement === this.triggerElement\n ) {\n event.preventDefault();\n this.show();\n // Then, put the focus on the first menuitem\n const firstMenuItem = this.popoverElement.querySelector('nv-menuitem');\n if (firstMenuItem) {\n requestAnimationFrame(() => (firstMenuItem as HTMLElement).focus());\n }\n }\n return;\n }\n\n if (this.isHandlingKeyDown) return;\n this.isHandlingKeyDown = true;\n\n if (\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp' ||\n event.key === 'ArrowLeft' ||\n event.key === 'ArrowRight' ||\n event.key === 'Escape'\n ) {\n event.preventDefault();\n }\n\n if (event.key === 'Escape' && !this.nested) {\n this.close();\n this.triggerElement.focus();\n this.isHandlingKeyDown = false;\n return;\n }\n\n const menuContent = this.el.querySelector('[slot=\"content\"]');\n const menuItems = (\n Array.from(menuContent.childNodes) as Array<\n HTMLNvMenuitemElement | HTMLNvMenuElement\n >\n ).filter(item => item.matches?.('nv-menuitem, nv-menu'));\n\n let currentIndex = menuItems.indexOf(\n document.activeElement as HTMLNvMenuitemElement,\n );\n if (currentIndex === -1)\n currentIndex = menuItems.indexOf(\n document.activeElement.parentElement as HTMLNvMenuitemElement,\n );\n if (\n currentIndex === -1 &&\n menuItems.find(item => item.matches('nv-menu[open]'))\n ) {\n this.isHandlingKeyDown = false;\n return;\n }\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n menuItems.forEach(item => {\n if (item.matches('nv-menu')) (item as HTMLNvMenuElement).close();\n });\n }\n\n if (event.key === 'ArrowDown') {\n let nextIndex = (currentIndex + 1) % menuItems.length;\n while (menuItems[nextIndex].matches('nv-menuitem[disabled]')) {\n nextIndex = (nextIndex + 1) % menuItems.length;\n }\n const nextFocusable = menuItems[nextIndex];\n if (nextFocusable.matches('nv-menuitem')) {\n nextFocusable.focus();\n } else if (nextFocusable.matches('nv-menu')) {\n nextFocusable.querySelector('nv-menuitem').focus();\n }\n }\n\n if (event.key === 'ArrowUp') {\n let prevIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;\n while (menuItems[prevIndex].matches('nv-menuitem[disabled]')) {\n prevIndex = (prevIndex - 1 + menuItems.length) % menuItems.length;\n }\n const prevFocusable = menuItems[prevIndex];\n if (prevFocusable.matches('nv-menuitem')) {\n prevFocusable.focus();\n } else if (prevFocusable.matches('nv-menu')) {\n prevFocusable.querySelector('nv-menuitem').focus();\n }\n }\n\n if (event.key === 'ArrowRight') {\n const submenu = menuItems[currentIndex];\n if (!submenu.matches('nv-menu')) {\n this.isHandlingKeyDown = false;\n return;\n }\n (submenu as HTMLNvMenuElement).show();\n }\n\n if (event.key === 'ArrowLeft' && this.nested) {\n if (menuItems.find(item => item.matches('nv-menu[open]'))) {\n this.isHandlingKeyDown = false;\n return;\n }\n this.close();\n this.triggerElement.focus();\n }\n\n this.isHandlingKeyDown = false;\n }\n\n @Listen('openChanged')\n handleOpenChanged(event: CustomEvent<boolean>) {\n if (event.target === this.el.querySelector('nv-popover')) {\n this.open = event.detail;\n }\n const triggerHasFocus = this.triggerElement === document.activeElement;\n const triggerHasFocusVisible =\n this.triggerElement.matches(':focus-visible');\n if (triggerHasFocus && triggerHasFocusVisible) this.focusFirstItem();\n }\n\n private focusFirstItem() {\n const firstButton = this.popoverElement.querySelector('nv-menuitem');\n if (firstButton) {\n requestAnimationFrame(() => firstButton.focus());\n }\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentWillLoad() {\n this.triggerElement = Array.from(this.el.children).find(child => {\n return child.getAttribute('slot') === 'trigger';\n }) as HTMLElement;\n\n // If the items attribute is provided, parse its value.\n if (this.items) {\n this.handleItemsChange(this.items);\n }\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region RENDER\n\n /**\n * Generates menu items from the `items` property.\n * @param {MenuItem[]} items - The items to display in the menu.\n * @returns {HTMLElement[]} The rendered items.\n */\n private renderMenuItems(items: MenuItem[]) {\n return items.map(item => {\n if (item.hasSubmenu && item.submenuItems?.length > 0) {\n return (\n <nv-menu\n nested\n placement=\"right-start\"\n items={JSON.stringify(item.submenuItems)}\n >\n <nv-menuitem\n slot=\"trigger\"\n has-submenu\n disabled={item.disabled}\n icon={item.icon as IconName}\n shortcut={item.shortcut}\n id={item.value}\n name={item.label}\n label={item.label}\n ></nv-menuitem>\n </nv-menu>\n );\n }\n return (\n <nv-menuitem\n disabled={item.disabled}\n icon={item.icon as IconName}\n shortcut={item.shortcut}\n id={item.value}\n name={item.label}\n label={item.label}\n ></nv-menuitem>\n );\n });\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\"></slot>\n <nv-popover\n ref={el => (this.popoverElement = el)}\n triggerMode=\"click\"\n triggerElement={this.triggerElement}\n placement={this.placement}\n nested={this.nested}\n open={this.open}\n >\n {this.parsedItems.length > 0 ? (\n <ul slot=\"content\">{this.renderMenuItems(this.parsedItems)}</ul>\n ) : (\n <slot name=\"content\"></slot>\n )}\n </nv-popover>\n </Host>\n );\n }\n\n //#endregion RENDER\n}\n"],"version":3}
|
|
@@ -46,7 +46,7 @@ const NvMenuitem = class {
|
|
|
46
46
|
/****************************************************************************/
|
|
47
47
|
//#region RENDER
|
|
48
48
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
49
|
+
return (h(Host, { key: 'd1d9969a8e812f22d2097dca29b8e46b54115709', role: "menuitem", tabindex: this.disabled ? '-1' : '0' }, this.icon && h("nv-icon", { key: '4dd5c1c2fdd741cec06ca112788d8d00863b0ac7', name: this.icon }), h("slot", { key: '6030b5a030b46281d54ca139e55163e8ede064fe' }), this.label && h("span", { key: 'f253f5eb0fed0853a46ed08c211a42bace1784f6', "data-scope": "text" }, this.label), this.shortcut && !this.hasSubmenu && h("kbd", { key: 'b7c445db91af3ae3e2a845a839fee7c77a768045' }, this.shortcut), this.hasSubmenu && h("nv-icon", { key: '54bcd0bc879136d542b5e2c4241949f623258ad0', name: "chevron-right" })));
|
|
50
50
|
}
|
|
51
51
|
get el() { return getElement(this); }
|
|
52
52
|
};
|
|
@@ -2363,7 +2363,7 @@ const NvPopover = class {
|
|
|
2363
2363
|
/****************************************************************************/
|
|
2364
2364
|
//#region RENDER
|
|
2365
2365
|
render() {
|
|
2366
|
-
return (h(Host, { key: '
|
|
2366
|
+
return (h(Host, { key: 'efab8d78e1163d23e197ca04786b9f99f248ce05' }, h("slot", { key: 'b8197a385e5d9cda08d6b3e0232c052fb7238d01', name: "trigger" }), h("div", { key: '480c3cc8352bc833216cd64c8bfcf75ba9c79130', "data-scope": "popover", hidden: true, ref: el => (this.popoverElement = el) }, this.hasArrow && (h("div", { key: '8b1b10a15427ef05bc267460161e4a53be4cc3d1', "data-scope": "arrow", ref: el => (this.arrowElement = el) })), h("slot", { key: '8c9a8708a36fae6cac5e533b5c1a3128d7375195', name: "content" }))));
|
|
2367
2367
|
}
|
|
2368
2368
|
get el() { return getElement(this); }
|
|
2369
2369
|
static get watchers() { return {
|
package/dist/esm/nv-row.entry.js
CHANGED
|
@@ -10,7 +10,7 @@ const NvRow = class {
|
|
|
10
10
|
/****************************************************************************/
|
|
11
11
|
//#region RENDER
|
|
12
12
|
render() {
|
|
13
|
-
return (h(Host, { key: '
|
|
13
|
+
return (h(Host, { key: '0b27560267e6f5186ca4237658ad35f3a436b70d' }, h("slot", { key: 'b2805eb6abe9d02b57f030c91344ecf4927136d8' })));
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
NvRow.style = NvRowStyle0;
|
|
@@ -19,7 +19,7 @@ const NvStack = class {
|
|
|
19
19
|
/****************************************************************************/
|
|
20
20
|
//#region RENDER
|
|
21
21
|
render() {
|
|
22
|
-
return (h(Host, { key: '
|
|
22
|
+
return (h(Host, { key: '9869c0eaa423e363482bd4685dbd082dfba017f5', class: clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gutter-x-${this.gutter}`, this.gutter && this.vertical && `gutter-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, h("slot", { key: 'd4b597ec95f71c47edf99d58d22c95a5540e904c' })));
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
NvStack.style = NvStackStyle0;
|
|
@@ -311,14 +311,14 @@ const NvTable = class {
|
|
|
311
311
|
const rows = !this.table || this.table === undefined || this.parsedData.length === 0
|
|
312
312
|
? []
|
|
313
313
|
: this.table.data;
|
|
314
|
-
return (h(Host, { key: '
|
|
314
|
+
return (h(Host, { key: '89d230b38e5f853a9d8246b3634d25f3add88bb0' }, h("div", { key: '130f44d0833635aec8eb1ff5db6f92f5342e39b4', class: "hidden" }, h("slot", { key: 'e68523ead80fd187bfb0fc6710aaea42e1d9c4e7' })), h("slot", { key: '087164f8a817d99091d54ed841b4faa5f01b215e', name: "before" }), this.parsedColumns.length === 0 && this.parsedData.length === 0 ? (h("div", { class: "no-data" }, this.noColumnsNoDataMessage)) : (h("table", { class: "table" }, this.parsedColumns.length > 0 && headerGroups.length > 0 && (h("thead", { class: "table-header" }, h("tr", null, headerGroups &&
|
|
315
315
|
headerGroups.map(col => {
|
|
316
316
|
return (h("th", { key: col.name }, this.renderTemplate(this.headerTemplateCache.get(col.name), {}) || col.header));
|
|
317
317
|
})))), h("tbody", { class: "table-body" }, !rows || rows.length === 0 ? (h("tr", null, h("td", { colSpan: headerGroups.length || 12, class: "no-data" }, this.noDataMessage))) : (rows.map(row => (h("tr", { key: JSON.stringify(row) }, headerGroups.map(col => {
|
|
318
318
|
var _a;
|
|
319
319
|
return (h("td", null, this.renderTemplate(this.templateCache.get(col.name), row) ||
|
|
320
320
|
((_a = row[col.name]) !== null && _a !== void 0 ? _a : this.fallbackValue)));
|
|
321
|
-
})))))))), h("slot", { key: '
|
|
321
|
+
})))))))), h("slot", { key: '046b1b705c5885eb2685a0e8780e6eec2f1ca50e', name: "after" })));
|
|
322
322
|
}
|
|
323
323
|
get el() { return getElement(this); }
|
|
324
324
|
static get watchers() { return {
|
|
@@ -62,8 +62,8 @@ const NvToggle = class {
|
|
|
62
62
|
/****************************************************************************/
|
|
63
63
|
//#region RENDER
|
|
64
64
|
render() {
|
|
65
|
-
return (h(Host, { key: '
|
|
66
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
65
|
+
return (h(Host, { key: '6e18c6145fccdf7926bcc64a2414e6b41d364487', class: clsx(this.labelPlacement === 'before' && 'label-placement-before') }, h("div", { key: 'fda6ce7b087d1acef0f2afb24edbdc2566ca6cbf', class: "input-container" }, h("input", { key: '53569ce97f75b7a2ac0c94a702096d3f9215432a', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly })), h("div", { key: '26f0a6f570b8ef4150d53a7733c832f1c5f4343d', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '5ff30cca4abfd0c2f4283eab6c7ae678653748d3', htmlFor: this.inputId, class: clsx(this.hideLabel && 'visually-hidden') }, h("slot", { key: 'c6cc3536fa741fb89ebb24dfe455957b66edd77b', name: "label" }, this.label))), (this.description ||
|
|
66
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '0b1804f9e5407f15037fb6e5c80d7b8dafee5599', class: "description" }, h("slot", { key: '8f1b272158ffebb03992ed8c3b115e52504ff8ce', name: "description" }, this.description))))));
|
|
67
67
|
}
|
|
68
68
|
static get formAssociated() { return true; }
|
|
69
69
|
get el() { return getElement(this); }
|
|
@@ -32,7 +32,7 @@ const NvTooltip = class {
|
|
|
32
32
|
/****************************************************************************/
|
|
33
33
|
//#region RENDER
|
|
34
34
|
render() {
|
|
35
|
-
return (h(Host, { key: '
|
|
35
|
+
return (h(Host, { key: '42d55bd749a31fc808d6685b75b5002b10575b63' }, h("slot", { key: '7ccb801774290a4e47c9bf6e61994936f0cb793e' }), h("nv-popover", { key: '6c67ddae0787dbc9e24d239e3b34218dfa997747', triggerMode: "hover", hasArrow: true, placement: this.placement, triggerElement: this.triggerElement, groupName: 'tooltip', enterDelay: this.enterDelay }, h("p", { key: '900d3a61fc7adb7aee3f9982d932c6e2f9889ab3', slot: "content" }, this.message), h("slot", { key: '3f5e490d760e723271acef897cf4e0247ca7cd44', name: "content" }))));
|
|
36
36
|
}
|
|
37
37
|
get el() { return getElement(this); }
|
|
38
38
|
};
|