@beeq/core 1.7.0 → 1.8.0-beta.1
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/beeq/beeq.esm.js +43 -1
- package/dist/beeq/beeq.esm.js.map +1 -1
- package/dist/beeq/index.esm.js +64 -1
- package/dist/beeq/index.esm.js.map +1 -1
- package/dist/beeq/p-063a3968.entry.js +388 -0
- package/dist/beeq/p-063a3968.entry.js.map +1 -0
- package/dist/beeq/p-0979fdfd.entry.js +297 -0
- package/dist/beeq/{p-a453d36c.entry.js.map → p-0979fdfd.entry.js.map} +1 -1
- package/dist/beeq/p-0ab0b58d.js +25 -1
- package/dist/beeq/p-0ab0b58d.js.map +1 -1
- package/dist/beeq/p-0c42c08a.js +1811 -0
- package/dist/beeq/p-0c42c08a.js.map +1 -0
- package/dist/beeq/p-0f48adcc.entry.js +117 -0
- package/dist/beeq/{p-bcf6e585.entry.js.map → p-0f48adcc.entry.js.map} +1 -1
- package/dist/beeq/p-115ed5b2.js +25 -1
- package/dist/beeq/p-115ed5b2.js.map +1 -1
- package/dist/beeq/p-14b44a4b.entry.js +205 -0
- package/dist/beeq/{p-4f8ce653.entry.js.map → p-14b44a4b.entry.js.map} +1 -1
- package/dist/beeq/p-1715ac80.entry.js +274 -0
- package/dist/beeq/{p-554d0f45.entry.js.map → p-1715ac80.entry.js.map} +1 -1
- package/dist/beeq/p-1c8b6eb4.js +12 -1
- package/dist/beeq/p-1c8b6eb4.js.map +1 -1
- package/dist/beeq/p-1f3a4359.js +11 -1
- package/dist/beeq/p-1f3a4359.js.map +1 -1
- package/dist/beeq/p-242ac28a.entry.js +145 -0
- package/dist/beeq/{p-64835973.entry.js.map → p-242ac28a.entry.js.map} +1 -1
- package/dist/beeq/p-297fb76b.entry.js +220 -0
- package/dist/beeq/{p-4291b23f.entry.js.map → p-297fb76b.entry.js.map} +1 -1
- package/dist/beeq/p-2bb65f53.entry.js +204 -0
- package/dist/beeq/p-2bb65f53.entry.js.map +1 -0
- package/dist/beeq/p-2e66fc4f.entry.js +434 -0
- package/dist/beeq/{p-bcc85103.entry.js.map → p-2e66fc4f.entry.js.map} +1 -1
- package/dist/beeq/p-36652891.entry.js +102 -0
- package/dist/beeq/{p-21a51ee0.entry.js.map → p-36652891.entry.js.map} +1 -1
- package/dist/beeq/p-38d4bd8a.js +1939 -0
- package/dist/beeq/p-38d4bd8a.js.map +1 -0
- package/dist/beeq/p-39b7c578.entry.js +84 -0
- package/dist/beeq/{p-3711298a.entry.js.map → p-39b7c578.entry.js.map} +1 -1
- package/dist/beeq/p-39d77ba6.entry.js +90 -0
- package/dist/beeq/{p-f7d3f428.entry.js.map → p-39d77ba6.entry.js.map} +1 -1
- package/dist/beeq/p-3fd0d92d.js +1228 -1
- package/dist/beeq/p-3fd0d92d.js.map +1 -1
- package/dist/beeq/p-4688e046.js +16 -0
- package/dist/beeq/{p-aee056e5.js.map → p-4688e046.js.map} +1 -1
- package/dist/beeq/p-49249dda.entry.js +156 -0
- package/dist/beeq/{p-a062b9c4.entry.js.map → p-49249dda.entry.js.map} +1 -1
- package/dist/beeq/p-548b45b7.entry.js +104 -0
- package/dist/beeq/{p-c3e33045.entry.js.map → p-548b45b7.entry.js.map} +1 -1
- package/dist/beeq/p-57621be1.js +9 -1
- package/dist/beeq/p-57621be1.js.map +1 -1
- package/dist/beeq/p-57a55ac5.entry.js +261 -0
- package/dist/beeq/{p-d4ca1283.entry.js.map → p-57a55ac5.entry.js.map} +1 -1
- package/dist/beeq/p-5e11b866.entry.js +102 -0
- package/dist/beeq/{p-39f3d9d2.entry.js.map → p-5e11b866.entry.js.map} +1 -1
- package/dist/beeq/p-687da041.js +20 -1
- package/dist/beeq/p-687da041.js.map +1 -1
- package/dist/beeq/p-6a4e104b.entry.js +263 -0
- package/dist/beeq/{p-7691bdfc.entry.js.map → p-6a4e104b.entry.js.map} +1 -1
- package/dist/beeq/p-6a5a79a3.entry.js +184 -0
- package/dist/beeq/{p-fbb780c2.entry.js.map → p-6a5a79a3.entry.js.map} +1 -1
- package/dist/beeq/p-7f301da8.entry.js +508 -0
- package/dist/beeq/p-7f301da8.entry.js.map +1 -0
- package/dist/beeq/p-81f1c3ba.entry.js +121 -0
- package/dist/beeq/{p-819acf02.entry.js.map → p-81f1c3ba.entry.js.map} +1 -1
- package/dist/beeq/p-822773ae.entry.js +195 -0
- package/dist/beeq/{p-b2c55a62.entry.js.map → p-822773ae.entry.js.map} +1 -1
- package/dist/beeq/p-951ba558.js +64 -1
- package/dist/beeq/p-951ba558.js.map +1 -1
- package/dist/beeq/p-99829fc7.js +8 -1
- package/dist/beeq/p-99829fc7.js.map +1 -1
- package/dist/beeq/p-9990889d.entry.js +222 -0
- package/dist/beeq/{p-a9ca89e7.entry.js.map → p-9990889d.entry.js.map} +1 -1
- package/dist/beeq/p-a1b43de6.entry.js +248 -0
- package/dist/beeq/{p-889e6317.entry.js.map → p-a1b43de6.entry.js.map} +1 -1
- package/dist/beeq/p-a5dc1c94.js +118 -1
- package/dist/beeq/p-a5dc1c94.js.map +1 -1
- package/dist/beeq/p-a6489187.entry.js +103 -0
- package/dist/beeq/{p-d62cad31.entry.js.map → p-a6489187.entry.js.map} +1 -1
- package/dist/beeq/p-a8cad5ab.js +5 -1
- package/dist/beeq/p-a8cad5ab.js.map +1 -1
- package/dist/beeq/p-ac969486.entry.js +330 -0
- package/dist/beeq/{p-d9a3844f.entry.js.map → p-ac969486.entry.js.map} +1 -1
- package/dist/beeq/p-af062402.js +12 -0
- package/dist/beeq/p-af062402.js.map +1 -0
- package/dist/beeq/p-afc9fd80.entry.js +144 -0
- package/dist/beeq/{p-8b870d05.entry.js.map → p-afc9fd80.entry.js.map} +1 -1
- package/dist/beeq/p-bef53750.js +79 -0
- package/dist/beeq/p-bef53750.js.map +1 -0
- package/dist/beeq/p-bf2320dd.entry.js +329 -0
- package/dist/beeq/{p-67367b7d.entry.js.map → p-bf2320dd.entry.js.map} +1 -1
- package/dist/beeq/p-c34e292e.entry.js +127 -0
- package/dist/beeq/{p-5402707e.entry.js.map → p-c34e292e.entry.js.map} +1 -1
- package/dist/beeq/p-d7a88b16.js +87 -1
- package/dist/beeq/p-d7a88b16.js.map +1 -1
- package/dist/beeq/p-db18eba1.entry.js +173 -0
- package/dist/beeq/{p-02202605.entry.js.map → p-db18eba1.entry.js.map} +1 -1
- package/dist/beeq/p-dd950c12.entry.js +309 -0
- package/dist/beeq/p-dd950c12.entry.js.map +1 -0
- package/dist/beeq/p-e301647a.entry.js +87 -0
- package/dist/beeq/{p-6b824dba.entry.js.map → p-e301647a.entry.js.map} +1 -1
- package/dist/beeq/p-e3aa2886.entry.js +203 -0
- package/dist/beeq/{p-9c3030c7.entry.js.map → p-e3aa2886.entry.js.map} +1 -1
- package/dist/beeq/p-e41f07ae.entry.js +173 -0
- package/dist/beeq/p-e41f07ae.entry.js.map +1 -0
- package/dist/beeq/p-e88257a8.entry.js +259 -0
- package/dist/beeq/p-e88257a8.entry.js.map +1 -0
- package/dist/beeq/p-e9a54b49.entry.js +145 -0
- package/dist/beeq/{p-61c97bdc.entry.js.map → p-e9a54b49.entry.js.map} +1 -1
- package/dist/beeq/p-ecd27cf2.js +11 -1
- package/dist/beeq/p-ecd27cf2.js.map +1 -1
- package/dist/beeq/p-f77d9b8b.entry.js +144 -0
- package/dist/beeq/{p-a2157e4d.entry.js.map → p-f77d9b8b.entry.js.map} +1 -1
- package/dist/beeq/p-fd658de1.entry.js +135 -0
- package/dist/beeq/{p-c88ca7e9.entry.js.map → p-fd658de1.entry.js.map} +1 -1
- package/dist/beeq/p-ffb48c40.entry.js +258 -0
- package/dist/beeq/p-ffb48c40.entry.js.map +1 -0
- package/dist/beeq/p-ffddc425.entry.js +149 -0
- package/dist/beeq/{p-2e8e7e37.entry.js.map → p-ffddc425.entry.js.map} +1 -1
- package/dist/cjs/app-globals-b11284b9.js.map +1 -1
- package/dist/cjs/assetsPath-3938a05d.js +78 -0
- package/dist/cjs/assetsPath-3938a05d.js.map +1 -0
- package/dist/cjs/beeq.cjs.js +2 -2
- package/dist/cjs/bq-accordion-group.cjs.entry.js +2 -2
- package/dist/cjs/bq-accordion.cjs.entry.js +2 -2
- package/dist/cjs/bq-alert.cjs.entry.js +2 -2
- package/dist/cjs/bq-avatar.cjs.entry.js +2 -2
- package/dist/cjs/bq-badge.cjs.entry.js +2 -2
- package/dist/cjs/bq-breadcrumb-item.cjs.entry.js +3 -3
- package/dist/cjs/bq-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/bq-button_2.cjs.entry.js +25 -21
- package/dist/cjs/bq-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-card.cjs.entry.js +2 -2
- package/dist/cjs/bq-checkbox.cjs.entry.js +57 -6
- package/dist/cjs/bq-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-date-picker.cjs.entry.js +3 -3
- package/dist/cjs/bq-dialog.cjs.entry.js +3 -3
- package/dist/cjs/bq-divider.cjs.entry.js +2 -2
- package/dist/cjs/bq-drawer.cjs.entry.js +7 -7
- package/dist/cjs/bq-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-dropdown_2.cjs.entry.js +2 -2
- package/dist/cjs/bq-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/bq-input.cjs.entry.js +43 -16
- package/dist/cjs/bq-input.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-notification.cjs.entry.js +2 -2
- package/dist/cjs/bq-option-group.cjs.entry.js +1 -1
- package/dist/cjs/bq-option-list_2.cjs.entry.js +5 -5
- package/dist/cjs/bq-option.cjs.entry.js +2 -2
- package/dist/cjs/bq-page-title.cjs.entry.js +2 -2
- package/dist/cjs/bq-progress.cjs.entry.js +2 -2
- package/dist/cjs/bq-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/bq-radio.cjs.entry.js +1 -1
- package/dist/cjs/bq-select.cjs.entry.js +78 -30
- package/dist/cjs/bq-select.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-side-menu-item.cjs.entry.js +2 -2
- package/dist/cjs/bq-side-menu.cjs.entry.js +2 -2
- package/dist/cjs/bq-slider.cjs.entry.js +2 -2
- package/dist/cjs/bq-spinner.cjs.entry.js +2 -2
- package/dist/cjs/bq-status.cjs.entry.js +2 -2
- package/dist/cjs/bq-step-item.cjs.entry.js +2 -2
- package/dist/cjs/bq-steps.cjs.entry.js +2 -2
- package/dist/cjs/bq-switch.cjs.entry.js +2 -2
- package/dist/cjs/bq-tab-group.cjs.entry.js +32 -16
- package/dist/cjs/bq-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-tab.cjs.entry.js +14 -8
- package/dist/cjs/bq-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/bq-tab.types-a8b320b0.js +15 -0
- package/dist/cjs/bq-tab.types-a8b320b0.js.map +1 -0
- package/dist/cjs/bq-textarea.cjs.entry.js +5 -5
- package/dist/cjs/bq-toast.cjs.entry.js +3 -3
- package/dist/cjs/bq-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/{index-76b0999c.js → index-1d3aac65.js} +48 -2
- package/dist/cjs/index-1d3aac65.js.map +1 -0
- package/dist/cjs/{index-a09d1c08.js → index-e4c116b6.js} +12 -9
- package/dist/cjs/index-e4c116b6.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{isDefined-4f4a320b.js → isDefined-750bffc4.js} +2 -2
- package/dist/cjs/{isDefined-4f4a320b.js.map → isDefined-750bffc4.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/checkbox/bq-checkbox.js +67 -3
- package/dist/collection/components/checkbox/bq-checkbox.js.map +1 -1
- package/dist/collection/components/dialog/scss/bq-dialog.css +1 -1
- package/dist/collection/components/drawer/bq-drawer.js +7 -5
- package/dist/collection/components/drawer/bq-drawer.js.map +1 -1
- package/dist/collection/components/drawer/scss/bq-drawer.css +1 -1
- package/dist/collection/components/icon/helper/request.js +23 -19
- package/dist/collection/components/icon/helper/request.js.map +1 -1
- package/dist/collection/components/input/bq-input.js +34 -13
- package/dist/collection/components/input/bq-input.js.map +1 -1
- package/dist/collection/components/select/bq-select.js +71 -29
- package/dist/collection/components/select/bq-select.js.map +1 -1
- package/dist/collection/components/tab/bq-tab.js +62 -4
- package/dist/collection/components/tab/bq-tab.js.map +1 -1
- package/dist/collection/components/tab/bq-tab.types.js +2 -0
- package/dist/collection/components/tab/bq-tab.types.js.map +1 -1
- package/dist/collection/components/tab/scss/bq-tab.css +1 -1
- package/dist/collection/components/tab-group/bq-tab-group.js +81 -14
- package/dist/collection/components/tab-group/bq-tab-group.js.map +1 -1
- package/dist/collection/components/tab-group/scss/bq-tab-group.css +1 -1
- package/dist/collection/components/tag/bq-tag.js +3 -3
- package/dist/collection/components/textarea/bq-textarea.js +3 -3
- package/dist/collection/components/toast/bq-toast.js +1 -1
- package/dist/collection/components/tooltip/bq-tooltip.js +1 -1
- package/dist/collection/shared/utils/assetsPath.js +52 -26
- package/dist/collection/shared/utils/assetsPath.js.map +1 -1
- package/dist/components/assetsPath.js +52 -26
- package/dist/components/assetsPath.js.map +1 -1
- package/dist/components/bq-checkbox.js +53 -6
- package/dist/components/bq-checkbox.js.map +1 -1
- package/dist/components/bq-dialog.js +1 -1
- package/dist/components/bq-drawer.js +5 -5
- package/dist/components/bq-drawer.js.map +1 -1
- package/dist/components/bq-icon2.js +23 -19
- package/dist/components/bq-icon2.js.map +1 -1
- package/dist/components/bq-input.js +35 -13
- package/dist/components/bq-input.js.map +1 -1
- package/dist/components/bq-select.js +71 -28
- package/dist/components/bq-select.js.map +1 -1
- package/dist/components/bq-tab-group.js +36 -16
- package/dist/components/bq-tab-group.js.map +1 -1
- package/dist/components/bq-tab.js +17 -7
- package/dist/components/bq-tab.js.map +1 -1
- package/dist/components/bq-tab.types.js +3 -1
- package/dist/components/bq-tab.types.js.map +1 -1
- package/dist/components/bq-tag2.js +3 -3
- package/dist/components/bq-textarea.js +3 -3
- package/dist/components/bq-toast.js +1 -1
- package/dist/components/bq-tooltip2.js +1 -1
- package/dist/components/index2.js +11 -8
- package/dist/components/index2.js.map +1 -1
- package/dist/esm/app-globals-de5a646b.js.map +1 -1
- package/dist/esm/assetsPath-a1b58980.js +75 -0
- package/dist/esm/assetsPath-a1b58980.js.map +1 -0
- package/dist/esm/beeq.js +3 -3
- package/dist/esm/bq-accordion-group.entry.js +2 -2
- package/dist/esm/bq-accordion.entry.js +2 -2
- package/dist/esm/bq-alert.entry.js +2 -2
- package/dist/esm/bq-avatar.entry.js +2 -2
- package/dist/esm/bq-badge.entry.js +2 -2
- package/dist/esm/bq-breadcrumb-item.entry.js +3 -3
- package/dist/esm/bq-breadcrumb.entry.js +2 -2
- package/dist/esm/bq-button_2.entry.js +25 -21
- package/dist/esm/bq-button_2.entry.js.map +1 -1
- package/dist/esm/bq-card.entry.js +2 -2
- package/dist/esm/bq-checkbox.entry.js +57 -6
- package/dist/esm/bq-checkbox.entry.js.map +1 -1
- package/dist/esm/bq-date-picker.entry.js +3 -3
- package/dist/esm/bq-dialog.entry.js +3 -3
- package/dist/esm/bq-divider.entry.js +2 -2
- package/dist/esm/bq-drawer.entry.js +7 -7
- package/dist/esm/bq-drawer.entry.js.map +1 -1
- package/dist/esm/bq-dropdown_2.entry.js +2 -2
- package/dist/esm/bq-empty-state.entry.js +2 -2
- package/dist/esm/bq-input.entry.js +43 -16
- package/dist/esm/bq-input.entry.js.map +1 -1
- package/dist/esm/bq-notification.entry.js +2 -2
- package/dist/esm/bq-option-group.entry.js +1 -1
- package/dist/esm/bq-option-list_2.entry.js +5 -5
- package/dist/esm/bq-option.entry.js +2 -2
- package/dist/esm/bq-page-title.entry.js +2 -2
- package/dist/esm/bq-progress.entry.js +2 -2
- package/dist/esm/bq-radio-group.entry.js +2 -2
- package/dist/esm/bq-radio.entry.js +1 -1
- package/dist/esm/bq-select.entry.js +79 -31
- package/dist/esm/bq-select.entry.js.map +1 -1
- package/dist/esm/bq-side-menu-item.entry.js +2 -2
- package/dist/esm/bq-side-menu.entry.js +2 -2
- package/dist/esm/bq-slider.entry.js +2 -2
- package/dist/esm/bq-spinner.entry.js +2 -2
- package/dist/esm/bq-status.entry.js +2 -2
- package/dist/esm/bq-step-item.entry.js +2 -2
- package/dist/esm/bq-steps.entry.js +2 -2
- package/dist/esm/bq-switch.entry.js +2 -2
- package/dist/esm/bq-tab-group.entry.js +32 -16
- package/dist/esm/bq-tab-group.entry.js.map +1 -1
- package/dist/esm/bq-tab.entry.js +14 -8
- package/dist/esm/bq-tab.entry.js.map +1 -1
- package/dist/esm/bq-tab.types-36e2666e.js +11 -0
- package/dist/esm/bq-tab.types-36e2666e.js.map +1 -0
- package/dist/esm/bq-textarea.entry.js +5 -5
- package/dist/esm/bq-toast.entry.js +3 -3
- package/dist/esm/bq-tooltip.entry.js +3 -3
- package/dist/esm/{index-138f308e.js → index-136429a6.js} +12 -9
- package/dist/esm/index-136429a6.js.map +1 -0
- package/dist/esm/{index-7eed7a88.js → index-f69556fe.js} +48 -2
- package/dist/esm/index-f69556fe.js.map +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/{isDefined-91ae4cd3.js → isDefined-170f3095.js} +2 -2
- package/dist/esm/{isDefined-91ae4cd3.js.map → isDefined-170f3095.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/hydrate/index.js +348 -133
- package/dist/hydrate/index.mjs +348 -133
- package/dist/types/components/checkbox/bq-checkbox.d.ts +9 -0
- package/dist/types/components/drawer/bq-drawer.d.ts +3 -1
- package/dist/types/components/input/bq-input.d.ts +4 -1
- package/dist/types/components/select/bq-select.d.ts +18 -0
- package/dist/types/components/tab/bq-tab.d.ts +5 -1
- package/dist/types/components/tab/bq-tab.types.d.ts +4 -0
- package/dist/types/components/tab-group/bq-tab-group.d.ts +5 -1
- package/dist/types/components.d.ts +42 -2
- package/dist/types/home/workflows/workspace/packages/beeq/.stencil/packages/beeq/stencil.config.d.ts +2 -0
- package/dist/types/shared/utils/assetsPath.d.ts +18 -11
- package/package.json +24 -24
- package/dist/beeq/p-02202605.entry.js +0 -6
- package/dist/beeq/p-0f528ec6.js +0 -6
- package/dist/beeq/p-0f528ec6.js.map +0 -1
- package/dist/beeq/p-1d3f236b.entry.js +0 -6
- package/dist/beeq/p-1d3f236b.entry.js.map +0 -1
- package/dist/beeq/p-21a51ee0.entry.js +0 -6
- package/dist/beeq/p-2e8e7e37.entry.js +0 -6
- package/dist/beeq/p-3711298a.entry.js +0 -6
- package/dist/beeq/p-39f3d9d2.entry.js +0 -6
- package/dist/beeq/p-3a1f06e1.entry.js +0 -6
- package/dist/beeq/p-3a1f06e1.entry.js.map +0 -1
- package/dist/beeq/p-4291b23f.entry.js +0 -6
- package/dist/beeq/p-463a17cf.js +0 -7
- package/dist/beeq/p-463a17cf.js.map +0 -1
- package/dist/beeq/p-48b27aef.entry.js +0 -6
- package/dist/beeq/p-48b27aef.entry.js.map +0 -1
- package/dist/beeq/p-4f8ce653.entry.js +0 -6
- package/dist/beeq/p-5402707e.entry.js +0 -6
- package/dist/beeq/p-554d0f45.entry.js +0 -6
- package/dist/beeq/p-61c97bdc.entry.js +0 -6
- package/dist/beeq/p-64835973.entry.js +0 -6
- package/dist/beeq/p-67367b7d.entry.js +0 -6
- package/dist/beeq/p-68fdea6a.js +0 -6
- package/dist/beeq/p-68fdea6a.js.map +0 -1
- package/dist/beeq/p-6b824dba.entry.js +0 -6
- package/dist/beeq/p-6edc8a33.js +0 -6
- package/dist/beeq/p-6edc8a33.js.map +0 -1
- package/dist/beeq/p-7567ae06.entry.js +0 -6
- package/dist/beeq/p-7567ae06.entry.js.map +0 -1
- package/dist/beeq/p-7691bdfc.entry.js +0 -6
- package/dist/beeq/p-819acf02.entry.js +0 -6
- package/dist/beeq/p-889e6317.entry.js +0 -6
- package/dist/beeq/p-8b870d05.entry.js +0 -6
- package/dist/beeq/p-9c3030c7.entry.js +0 -6
- package/dist/beeq/p-a062b9c4.entry.js +0 -6
- package/dist/beeq/p-a2157e4d.entry.js +0 -6
- package/dist/beeq/p-a453d36c.entry.js +0 -6
- package/dist/beeq/p-a9ca89e7.entry.js +0 -6
- package/dist/beeq/p-aae41e31.entry.js +0 -6
- package/dist/beeq/p-aae41e31.entry.js.map +0 -1
- package/dist/beeq/p-aee056e5.js +0 -6
- package/dist/beeq/p-b2c55a62.entry.js +0 -6
- package/dist/beeq/p-bcc85103.entry.js +0 -6
- package/dist/beeq/p-bcf6e585.entry.js +0 -6
- package/dist/beeq/p-c3e33045.entry.js +0 -6
- package/dist/beeq/p-c88ca7e9.entry.js +0 -6
- package/dist/beeq/p-cec068b9.entry.js +0 -6
- package/dist/beeq/p-cec068b9.entry.js.map +0 -1
- package/dist/beeq/p-d4ca1283.entry.js +0 -6
- package/dist/beeq/p-d62cad31.entry.js +0 -6
- package/dist/beeq/p-d9a3844f.entry.js +0 -6
- package/dist/beeq/p-ec4a6d10.entry.js +0 -6
- package/dist/beeq/p-ec4a6d10.entry.js.map +0 -1
- package/dist/beeq/p-f7d3f428.entry.js +0 -6
- package/dist/beeq/p-fbb780c2.entry.js +0 -6
- package/dist/cjs/assetsPath-eac0a3bf.js +0 -52
- package/dist/cjs/assetsPath-eac0a3bf.js.map +0 -1
- package/dist/cjs/bq-tab.types-9fe0234a.js +0 -11
- package/dist/cjs/bq-tab.types-9fe0234a.js.map +0 -1
- package/dist/cjs/index-76b0999c.js.map +0 -1
- package/dist/cjs/index-a09d1c08.js.map +0 -1
- package/dist/esm/assetsPath-ae18c25e.js +0 -49
- package/dist/esm/assetsPath-ae18c25e.js.map +0 -1
- package/dist/esm/bq-tab.types-f64aa67d.js +0 -9
- package/dist/esm/bq-tab.types-f64aa67d.js.map +0 -1
- package/dist/esm/index-138f308e.js.map +0 -1
- package/dist/esm/index-7eed7a88.js.map +0 -1
- package/dist/types/home/runner/work/BEEQ/BEEQ/packages/beeq/.stencil/packages/beeq/stencil.config.d.ts +0 -2
- /package/dist/types/home/{runner/work/BEEQ/BEEQ → workflows/workspace}/packages/beeq/.stencil/tailwind.config.d.ts +0 -0
|
@@ -4,37 +4,41 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
6
|
import { g as getBasePath } from './assetsPath.js';
|
|
7
|
+
import { i as isNil } from './isNil.js';
|
|
7
8
|
import { i as isString } from './isString.js';
|
|
8
9
|
import { g as getColorCSSVariable } from './cssVariables.js';
|
|
9
|
-
import { i as isNil } from './isNil.js';
|
|
10
10
|
|
|
11
11
|
/* -------------------------------------------------------------------------- */
|
|
12
12
|
const requests = new Map();
|
|
13
13
|
const fetchSvg = async (url, sanitize) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
if (typeof fetch === 'undefined' || typeof document === 'undefined')
|
|
15
|
+
return;
|
|
16
|
+
if (requests.has(url))
|
|
17
|
+
return requests.get(url);
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(url);
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
iconContent.set(url, '');
|
|
22
|
+
return;
|
|
23
23
|
}
|
|
24
|
+
let svgContent = (await response.text()) || '';
|
|
25
|
+
if (svgContent && sanitize !== false)
|
|
26
|
+
svgContent = validateContent(svgContent);
|
|
27
|
+
iconContent.set(url, svgContent);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(`[BqIcon] Failed to fetch SVG from ${url}:`, error);
|
|
24
31
|
iconContent.set(url, '');
|
|
25
|
-
// cache for the same requests
|
|
26
|
-
requests.set(url, req);
|
|
27
|
-
return req;
|
|
28
32
|
}
|
|
29
|
-
iconContent.set(url, '');
|
|
30
|
-
return Promise.resolve();
|
|
31
33
|
};
|
|
32
34
|
const iconContent = new Map();
|
|
33
35
|
const getSvgContent = async (url, sanitize) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
36
|
+
let req = requests.get(url);
|
|
37
|
+
// NOTE: if the request does not exists we will cache it
|
|
38
|
+
if (isNil(req)) {
|
|
39
|
+
req = fetchSvg(url, sanitize);
|
|
40
|
+
requests.set(url, req);
|
|
41
|
+
}
|
|
38
42
|
return req;
|
|
39
43
|
};
|
|
40
44
|
const validateContent = (svgContent) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"bq-icon2.js","mappings":";;;;;;;;;;AAAA;AAMA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,GAAW,EAAE,QAAiB;IACpD,IAAI,GAAqB,CAAC;IAE1B,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,GAAG,CAAC,EAAE,EAAE;YACV,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU;gBAChC,IAAI,UAAU,IAAI,QAAQ,KAAK,KAAK;oBAAE,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;gBAC/E,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;aACxC,CAAC,CAAC;SACJ;QACD,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;;QAEzB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC;KACZ;IAED,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACzB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEK,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE9C,MAAM,aAAa,GAAG,OAAO,GAAW,EAAE,QAAiB;;IAEhE,MAAM,G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E,CAAC;YAC1E,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SAC1D,CAAC;QAEF,QACE,EAAC,IAAI,qDAAC,KAAK,EAAE,MAAM,IACjB,0EACc,MAAA,IAAI,CAAC,KAAK,mCAAI,GAAG,IAAI,CAAC,IAAI,OAAO,EAC7C,KAAK,EAAC,8EAA8E,EACpF,SAAS,EAAE,IAAI,CAAC,WAAW,EAC3B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,KAAK,GACV,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["../../packages/beeq/src/components/icon/helper/request.ts","../../packages/beeq/src/components/icon/scss/bq-icon.scss?tag=bq-icon&encapsulation=shadow","../../packages/beeq/src/components/icon/bq-icon.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Icon request helper */\n/* -------------------------------------------------------------------------- */\n\nimport { isString } from '../../../shared/utils';\n\nconst requests = new Map<string, Promise<unknown>>();\n\nconst fetchSvg = async (url: string, sanitize: boolean): Promise<unknown> => {\n let req: Promise<unknown>;\n\n if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {\n const rsp = await fetch(url);\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) svgContent = validateContent(svgContent);\n iconContent.set(url, svgContent || '');\n });\n }\n iconContent.set(url, '');\n // cache for the same requests\n requests.set(url, req);\n return req;\n }\n\n iconContent.set(url, '');\n return Promise.resolve();\n};\n\nexport const iconContent = new Map<string, string>();\n\nexport const getSvgContent = async (url: string, sanitize: boolean) => {\n // see if we already have a request for this SVG file\n const req = await requests.get(url);\n if (!req) return fetchSvg(url, sanitize);\n\n return req;\n};\n\nexport const validateContent = (svgContent: string): string => {\n const svgTag = 'svg';\n const iconCssClass = 'bq-icon__svg';\n\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== svgTag) {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === svgTag) {\n // keep other CSS classes (if there's any) and add the `bq-icon__svg` CSS class\n const othersCssClasses = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', `${othersCssClasses} ${iconCssClass}`.trim());\n // set the shadow DOM part for the SVG element\n svgElm.setAttribute('part', svgTag);\n\n // remove height and width attribute, if for some reason they are still present in the SVG tag\n svgElm.removeAttribute('height');\n svgElm.removeAttribute('width');\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) return div.innerHTML;\n }\n\n return '';\n};\n\nexport const isValid = (elm: HTMLElement): boolean => {\n if (elm.nodeType === Node.ELEMENT_NODE) {\n if (elm.nodeName.toLowerCase() === 'script') return false;\n\n for (const attribute of Array.from(elm.attributes)) {\n const value = attribute.value;\n if (isString(value) && value.toLowerCase().startsWith('on')) {\n return false;\n }\n }\n\n for (const childNode of Array.from(elm.children) as HTMLElement[]) {\n if (!isValid(childNode)) return false;\n }\n }\n return true;\n};\n","/* -------------------------------------------------------------------------- */\n/* Icon styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-icon.variables';\n\n:host {\n @apply inline-block;\n}\n\n/**\n * This class is added on packages/beeq/src/components/icon/helper/request.ts\n * See lines 42 and 58 for details.\n */\n.bq-icon__svg {\n @apply scale-x-[--bq-icon--direction];\n}\n","import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\n\nimport { TIconWeight } from './bq-icon.types';\nimport { getSvgContent, iconContent } from './helper/request';\nimport { getBasePath, getColorCSSVariable, isNil } from '../../shared/utils';\n\n/**\n * Icons are simplified images that graphically explain the meaning of an object on the screen.\n *\n * @part base - The component's internal wrapper that holds the icon SVG content.\n * @part svg - The `<svg>` tag element inside the component.\n */\n@Component({\n assetsDirs: ['svg'],\n tag: 'bq-icon',\n styleUrl: './scss/bq-icon.scss',\n shadow: true,\n})\nexport class BqIcon {\n // Own Properties\n // ====================\n\n // Reference to host HTML element\n // ===================================\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private _svgContent: string;\n\n // Public Property API\n // ========================\n\n /** Label for the icon, used for accessibility */\n @Prop({ reflect: true }) label?: string;\n\n /** Set the stroke color of the SVG. The value should be a valid value of the palette color */\n @Prop({ reflect: true }) color?: string;\n\n /** Icon name to load. Please check all available icons [here](https://phosphoricons.com/) */\n @Prop({ reflect: true }) name!: string;\n\n /** Set the size of the SVG */\n @Prop({ reflect: true }) size?: string | number = 24;\n\n /** Set the source of the SVG. If the source is set, the name property will be ignored */\n @Prop({ reflect: true }) src?: string;\n\n /** @deprecated It set the icon weight/style */\n @Prop({ reflect: true }) weight?: TIconWeight = undefined;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('color')\n @Watch('name')\n @Watch('size')\n handlePropsChange() {\n this.loadIcon(this.name);\n }\n\n /**\n * !TO BE REMOVED: Delete this `@Watch()` once the deprecated `weight` property is removed\n * We need to maintain retro-compatibility until the next major release\n */\n @Watch('weight')\n handleWeightChange() {\n if (this.name.includes(this.weight)) return;\n\n console.warn(\n `❗️ [bq-icon]: the 'weight' property is deprecated, you should add the weight to the icon name.\\n\n For example, '<bq-icon name=\"bell-fill\"></bq-icon>' instead of '<bq-icon name=\"bell\" weight=\"fill\"></bq-icon>'`,\n );\n // Check if the icon is weighted. An icon is considered weighted if its weight is not 'regular' and ENV_SVG_PATH is not set.\n // Eg: if the weight is 'bold' and ENV_SVG_PATH is not set, isWeightedIcon will be true.\n const REGULAR = 'regular';\n const isWeightedIcon = !isNil(this.weight) && this.weight !== REGULAR;\n // If the icon is weighted, append the weight to the icon name. Otherwise, append nothing.\n // Eg: if isWeightedIcon is true and the weight is 'bold', weightSuffix will be '-bold'.\n const weightSuffix = isWeightedIcon ? `-${this.weight}` : '';\n // Construct the icon name by appending the weight suffix (if any) and the file extension.\n // Eg: if the name is 'my-icon' and weightSuffix is '-bold', iconName will be 'my-icon-bold.svg'.\n const iconName = `${this.name}${weightSuffix}`;\n this.loadIcon(iconName);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler to be called when the SVG has loaded */\n @Event() svgLoaded: EventEmitter;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n connectedCallback() {\n this.handlePropsChange();\n\n // !TO BE REMOVED: Delete this once the deprecated `weight` property is removed\n if (!isNil(this.weight)) this.handleWeightChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private getIconSource = (name: string) => {\n if (!this.name && !this.src) return;\n // Return the src if it is set\n if (this.src) return this.src;\n\n const SVG_EXTENSION = '.svg';\n const iconFileName = `${name}${SVG_EXTENSION}`;\n\n return getBasePath(iconFileName);\n };\n\n private loadIcon = (name: string) => {\n const url = this.getIconSource(name);\n getSvgContent(url, true).then(() => {\n this._svgContent = iconContent.get(url);\n this.svgLoaded.emit(this._svgContent);\n });\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const styles = {\n ...(this.color && { '--bq-icon--color': getColorCSSVariable(this.color) }),\n ...(this.size && { '--bq-icon--size': `${this.size}px` }),\n };\n\n return (\n <Host style={styles}>\n <div\n aria-label={this.label ?? `${this.name} icon`}\n class=\"flex text-[color:--bq-icon--color] bs-[--bq-icon--size] is-[--bq-icon--size]\"\n innerHTML={this._svgContent}\n part=\"base\"\n role=\"img\"\n />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"bq-icon2.js","mappings":";;;;;;;;;;AAAA;AAMA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4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EACc,MAAA,IAAI,CAAC,KAAK,mCAAI,GAAG,IAAI,CAAC,IAAI,OAAO,EAC7C,KAAK,EAAC,8EAA8E,EACpF,SAAS,EAAE,IAAI,CAAC,WAAW,EAC3B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,KAAK,GACV,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["../../packages/beeq/src/components/icon/helper/request.ts","../../packages/beeq/src/components/icon/scss/bq-icon.scss?tag=bq-icon&encapsulation=shadow","../../packages/beeq/src/components/icon/bq-icon.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Icon request helper */\n/* -------------------------------------------------------------------------- */\n\nimport { isNil, isString } from '../../../shared/utils';\n\nconst requests = new Map<string, Promise<unknown>>();\n\nconst fetchSvg = async (url: string, sanitize: boolean): Promise<unknown> => {\n if (typeof fetch === 'undefined' || typeof document === 'undefined') return;\n\n if (requests.has(url)) return requests.get(url);\n\n try {\n const response = await fetch(url);\n\n if (!response.ok) {\n iconContent.set(url, '');\n return;\n }\n\n let svgContent = (await response.text()) || '';\n\n if (svgContent && sanitize !== false) svgContent = validateContent(svgContent);\n\n iconContent.set(url, svgContent);\n } catch (error) {\n console.error(`[BqIcon] Failed to fetch SVG from ${url}:`, error);\n iconContent.set(url, '');\n }\n};\n\nexport const iconContent = new Map<string, string>();\n\nexport const getSvgContent = async (url: string, sanitize: boolean) => {\n let req = requests.get(url);\n\n // NOTE: if the request does not exists we will cache it\n if (isNil(req)) {\n req = fetchSvg(url, sanitize);\n requests.set(url, req);\n }\n return req;\n};\n\nexport const validateContent = (svgContent: string): string => {\n const svgTag = 'svg';\n const iconCssClass = 'bq-icon__svg';\n\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== svgTag) {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === svgTag) {\n // keep other CSS classes (if there's any) and add the `bq-icon__svg` CSS class\n const othersCssClasses = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', `${othersCssClasses} ${iconCssClass}`.trim());\n // set the shadow DOM part for the SVG element\n svgElm.setAttribute('part', svgTag);\n\n // remove height and width attribute, if for some reason they are still present in the SVG tag\n svgElm.removeAttribute('height');\n svgElm.removeAttribute('width');\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) return div.innerHTML;\n }\n\n return '';\n};\n\nexport const isValid = (elm: HTMLElement): boolean => {\n if (elm.nodeType === Node.ELEMENT_NODE) {\n if (elm.nodeName.toLowerCase() === 'script') return false;\n\n for (const attribute of Array.from(elm.attributes)) {\n const value = attribute.value;\n if (isString(value) && value.toLowerCase().startsWith('on')) {\n return false;\n }\n }\n\n for (const childNode of Array.from(elm.children) as HTMLElement[]) {\n if (!isValid(childNode)) return false;\n }\n }\n return true;\n};\n","/* -------------------------------------------------------------------------- */\n/* Icon styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-icon.variables';\n\n:host {\n @apply inline-block;\n}\n\n/**\n * This class is added on packages/beeq/src/components/icon/helper/request.ts\n * See lines 42 and 58 for details.\n */\n.bq-icon__svg {\n @apply scale-x-[--bq-icon--direction];\n}\n","import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\n\nimport { TIconWeight } from './bq-icon.types';\nimport { getSvgContent, iconContent } from './helper/request';\nimport { getBasePath, getColorCSSVariable, isNil } from '../../shared/utils';\n\n/**\n * Icons are simplified images that graphically explain the meaning of an object on the screen.\n *\n * @part base - The component's internal wrapper that holds the icon SVG content.\n * @part svg - The `<svg>` tag element inside the component.\n */\n@Component({\n assetsDirs: ['svg'],\n tag: 'bq-icon',\n styleUrl: './scss/bq-icon.scss',\n shadow: true,\n})\nexport class BqIcon {\n // Own Properties\n // ====================\n\n // Reference to host HTML element\n // ===================================\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private _svgContent: string;\n\n // Public Property API\n // ========================\n\n /** Label for the icon, used for accessibility */\n @Prop({ reflect: true }) label?: string;\n\n /** Set the stroke color of the SVG. The value should be a valid value of the palette color */\n @Prop({ reflect: true }) color?: string;\n\n /** Icon name to load. Please check all available icons [here](https://phosphoricons.com/) */\n @Prop({ reflect: true }) name!: string;\n\n /** Set the size of the SVG */\n @Prop({ reflect: true }) size?: string | number = 24;\n\n /** Set the source of the SVG. If the source is set, the name property will be ignored */\n @Prop({ reflect: true }) src?: string;\n\n /** @deprecated It set the icon weight/style */\n @Prop({ reflect: true }) weight?: TIconWeight = undefined;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('color')\n @Watch('name')\n @Watch('size')\n handlePropsChange() {\n this.loadIcon(this.name);\n }\n\n /**\n * !TO BE REMOVED: Delete this `@Watch()` once the deprecated `weight` property is removed\n * We need to maintain retro-compatibility until the next major release\n */\n @Watch('weight')\n handleWeightChange() {\n if (this.name.includes(this.weight)) return;\n\n console.warn(\n `❗️ [bq-icon]: the 'weight' property is deprecated, you should add the weight to the icon name.\\n\n For example, '<bq-icon name=\"bell-fill\"></bq-icon>' instead of '<bq-icon name=\"bell\" weight=\"fill\"></bq-icon>'`,\n );\n // Check if the icon is weighted. An icon is considered weighted if its weight is not 'regular' and ENV_SVG_PATH is not set.\n // Eg: if the weight is 'bold' and ENV_SVG_PATH is not set, isWeightedIcon will be true.\n const REGULAR = 'regular';\n const isWeightedIcon = !isNil(this.weight) && this.weight !== REGULAR;\n // If the icon is weighted, append the weight to the icon name. Otherwise, append nothing.\n // Eg: if isWeightedIcon is true and the weight is 'bold', weightSuffix will be '-bold'.\n const weightSuffix = isWeightedIcon ? `-${this.weight}` : '';\n // Construct the icon name by appending the weight suffix (if any) and the file extension.\n // Eg: if the name is 'my-icon' and weightSuffix is '-bold', iconName will be 'my-icon-bold.svg'.\n const iconName = `${this.name}${weightSuffix}`;\n this.loadIcon(iconName);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler to be called when the SVG has loaded */\n @Event() svgLoaded: EventEmitter;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n connectedCallback() {\n this.handlePropsChange();\n\n // !TO BE REMOVED: Delete this once the deprecated `weight` property is removed\n if (!isNil(this.weight)) this.handleWeightChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private getIconSource = (name: string) => {\n if (!this.name && !this.src) return;\n // Return the src if it is set\n if (this.src) return this.src;\n\n const SVG_EXTENSION = '.svg';\n const iconFileName = `${name}${SVG_EXTENSION}`;\n\n return getBasePath(iconFileName);\n };\n\n private loadIcon = (name: string) => {\n const url = this.getIconSource(name);\n getSvgContent(url, true).then(() => {\n this._svgContent = iconContent.get(url);\n this.svgLoaded.emit(this._svgContent);\n });\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const styles = {\n ...(this.color && { '--bq-icon--color': getColorCSSVariable(this.color) }),\n ...(this.size && { '--bq-icon--size': `${this.size}px` }),\n };\n\n return (\n <Host style={styles}>\n <div\n aria-label={this.label ?? `${this.name} icon`}\n class=\"flex text-[color:--bq-icon--color] bs-[--bq-icon--size] is-[--bq-icon--size]\"\n innerHTML={this._svgContent}\n part=\"base\"\n role=\"img\"\n />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -7,6 +7,7 @@ import './assetsPath.js';
|
|
|
7
7
|
import { d as debounce } from './debounce.js';
|
|
8
8
|
import { i as isDefined } from './isDefined.js';
|
|
9
9
|
import { i as isHTMLElement } from './isHTMLElement.js';
|
|
10
|
+
import { i as isNil } from './isNil.js';
|
|
10
11
|
import { b as hasSlotContent } from './slot.js';
|
|
11
12
|
import { d as defineCustomElement$3 } from './bq-button2.js';
|
|
12
13
|
import { d as defineCustomElement$2 } from './bq-icon2.js';
|
|
@@ -24,6 +25,7 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
|
|
|
24
25
|
this.bqClear = createEvent(this, "bqClear", 7);
|
|
25
26
|
this.bqFocus = createEvent(this, "bqFocus", 7);
|
|
26
27
|
this.bqInput = createEvent(this, "bqInput", 7);
|
|
28
|
+
this.internals = this.attachInternals();
|
|
27
29
|
this.fallbackInputId = 'input';
|
|
28
30
|
// Listeners
|
|
29
31
|
// ==============
|
|
@@ -55,6 +57,7 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
|
|
|
55
57
|
if (!isHTMLElement(ev.target, 'input'))
|
|
56
58
|
return;
|
|
57
59
|
this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;
|
|
60
|
+
this.internals.setFormValue(`${this.value}`);
|
|
58
61
|
this.debounceBqInput = debounce(() => {
|
|
59
62
|
this.bqInput.emit({ value: this.value, el: this.el });
|
|
60
63
|
}, this.debounceTime);
|
|
@@ -66,18 +69,29 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
|
|
|
66
69
|
if (!isHTMLElement(ev.target, 'input'))
|
|
67
70
|
return;
|
|
68
71
|
this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;
|
|
72
|
+
this.internals.setFormValue(`${this.value}`);
|
|
69
73
|
this.bqChange.emit({ value: this.value, el: this.el });
|
|
70
74
|
};
|
|
71
|
-
this.
|
|
75
|
+
this.handleClear = () => {
|
|
72
76
|
if (this.disabled)
|
|
73
77
|
return;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const { inputElem, internals } = this;
|
|
79
|
+
// Clear input element value
|
|
80
|
+
inputElem.value = '';
|
|
81
|
+
this.value = inputElem.value;
|
|
82
|
+
// Update associated form control value
|
|
83
|
+
internals.setFormValue(undefined);
|
|
84
|
+
};
|
|
85
|
+
this.handleClearClick = (ev) => {
|
|
80
86
|
ev.stopPropagation();
|
|
87
|
+
this.handleClear();
|
|
88
|
+
const { bqClear, bqChange, bqInput, el, inputElem } = this;
|
|
89
|
+
// Emit events
|
|
90
|
+
bqClear.emit(el);
|
|
91
|
+
bqInput.emit({ value: this.value, el });
|
|
92
|
+
bqChange.emit({ value: this.value, el });
|
|
93
|
+
// Refocus input element
|
|
94
|
+
inputElem.focus();
|
|
81
95
|
};
|
|
82
96
|
this.handleLabelSlotChange = () => {
|
|
83
97
|
this.hasLabel = hasSlotContent(this.labelElem);
|
|
@@ -125,41 +139,49 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
|
|
|
125
139
|
handleValueChange() {
|
|
126
140
|
if (Array.isArray(this.value)) {
|
|
127
141
|
this.hasValue = this.value.some((val) => val.length > 0);
|
|
142
|
+
this.internals.setFormValue(this.value.join(','));
|
|
128
143
|
return;
|
|
129
144
|
}
|
|
130
145
|
this.hasValue = isDefined(this.value);
|
|
146
|
+
this.internals.setFormValue(`${this.value}`);
|
|
131
147
|
}
|
|
132
148
|
// Component lifecycle events
|
|
133
149
|
// Ordered by their natural call order
|
|
134
150
|
// =====================================
|
|
135
|
-
|
|
151
|
+
componentWillLoad() {
|
|
136
152
|
this.handleValueChange();
|
|
137
153
|
}
|
|
154
|
+
formResetCallback() {
|
|
155
|
+
if (isNil(this.value))
|
|
156
|
+
return;
|
|
157
|
+
this.handleClear();
|
|
158
|
+
}
|
|
138
159
|
// render() function
|
|
139
160
|
// Always the last one in the class.
|
|
140
161
|
// ===================================
|
|
141
162
|
render() {
|
|
142
|
-
return (h("div", { key: '
|
|
163
|
+
return (h("div", { key: 'c9d184b8abfbaebda3478f7b8892c7d2bf024fdc', class: "bq-input", part: "base" }, h("label", { key: 'a938804cb78f78b65c1c2139d90fd98e5edecb52', class: { 'bq-input--label': true, '!hidden': !this.hasLabel }, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '37c407ab1b0399be8371629431d839f138f751df', name: "label", onSlotchange: this.handleLabelSlotChange })), h("div", { key: '130305745ed36bbe2d1012508f3ae2653b6794b2', class: {
|
|
143
164
|
'bq-input--control': true,
|
|
144
165
|
[`validation-${this.validationStatus}`]: true,
|
|
145
166
|
disabled: this.disabled,
|
|
146
|
-
}, part: "control" }, h("span", { key: '
|
|
167
|
+
}, part: "control" }, h("span", { key: '59c8d5f28373cae3741f4420da1fbc4744869806', class: { 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: '4f6a705b9a4e7deb46e334c11c6b242b091afec6', name: "prefix", onSlotchange: this.handlePrefixSlotChange })), h("input", { key: '6c238b5c2329d3f77dd4cb8a0aac9ffbfc937aad', id: this.name || this.fallbackInputId, class: "bq-input--control__input", "aria-disabled": this.disabled ? 'true' : 'false', autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, disabled: this.disabled, form: this.form, inputMode: this.inputmode, max: this.max, maxLength: this.maxlength, min: this.min, minLength: this.minlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, ref: (inputElem) => (this.inputElem = inputElem), readOnly: this.readonly, required: this.required, step: this.step, type: this.type, value: this.value, part: "input",
|
|
147
168
|
// Events
|
|
148
169
|
onBlur: this.handleBlur, onChange: this.handleChange, onFocus: this.handleFocus, onInput: this.handleInput }), this.hasValue && !this.disabled && !this.disableClear && (
|
|
149
170
|
// The clear button will be visible as long as the input has a value
|
|
150
171
|
// and the parent group is hovered or has focus-within
|
|
151
|
-
h("bq-button", { key: '
|
|
172
|
+
h("bq-button", { key: 'bae89f316a8c7cfb04d1bcff8df6e418c93fa838', class: "bq-input--control__clear ms-[--bq-input--gap] hidden", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button" }, h("slot", { key: 'd00287e78d20d2fdcbac8aa89a3bb30c40c6b8f1', name: "clear-icon" }, h("bq-icon", { key: '9be1f57ece6cea670a5c7adc76fb70feb66663c5', name: "x-circle", class: "flex" })))), h("span", { key: '93421c6d1e061e2a19315d1d8aadbcc2a01f19c3', class: { 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }, ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: 'ccb589bdc3b227467885d728c82f3fcedacb1695', name: "suffix", onSlotchange: this.handleSuffixSlotChange }))), h("div", { key: 'b0374c936b4e3839ed936ade23ad59aa3c69cf9a', class: {
|
|
152
173
|
[`bq-input--helper-text validation-${this.validationStatus}`]: true,
|
|
153
174
|
'!hidden': !this.hasHelperText,
|
|
154
|
-
}, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: '
|
|
175
|
+
}, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: 'a0a8c8d546efa959d6126e96ddf97a702263026f', name: "helper-text", onSlotchange: this.handleHelperTextSlotChange }))));
|
|
155
176
|
}
|
|
156
177
|
static get delegatesFocus() { return true; }
|
|
178
|
+
static get formAssociated() { return true; }
|
|
157
179
|
get el() { return this; }
|
|
158
180
|
static get watchers() { return {
|
|
159
181
|
"value": ["handleValueChange"]
|
|
160
182
|
}; }
|
|
161
183
|
static get style() { return BqInputStyle0; }
|
|
162
|
-
}, [
|
|
184
|
+
}, [81, "bq-input", {
|
|
163
185
|
"autocapitalize": [513],
|
|
164
186
|
"autocomplete": [513],
|
|
165
187
|
"autocorrect": [513],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"bq-input.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,0p5BAA0p5B,CAAC;AAC9q5B,sBAAe,UAAU;;MCsBZA,SAAO;;;;;;;;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ources":["../../packages/beeq/src/components/input/scss/bq-input.scss?tag=bq-input&encapsulation=shadow","../../packages/beeq/src/components/input/bq-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Input styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-input.variables';\n\n:host {\n @apply block is-full;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Label and Helper text */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--label {\n @apply flex flex-grow items-center m-be-[--bq-input--label-margin-bottom];\n @apply text-[length:--bq-input--label-text-size] text-[color:--bq-input--label-text-color];\n}\n\n.bq-input--helper-text {\n @apply text-[length:--bq-input--helper-text-size] text-[color:--bq-input--helper-text-color] m-bs-[--bq-input--helper-margin-top];\n}\n\n.bq-input--helper-text.validation-error {\n @apply text-text-danger;\n}\n\n.bq-input--helper-text.validation-success {\n @apply text-text-success;\n}\n\n.bq-input--helper-text.validation-warning {\n @apply text-text-warning;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input group control */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control {\n @apply flex items-center transition-[border-color,box-shadow] is-full;\n // Border\n @apply rounded-[--bq-input--border-radius] border-[length:--bq-input--border-width] border-[color:--bq-input--border-color];\n // Padding\n @apply pe-[--bq-input--padding-end] ps-[--bq-input--padding-start] p-b-[--bq-input--paddingY];\n // Text\n @apply text-[length:--bq-input--text-size] text-[color:--bq-input--text-color] placeholder:text-[color:--bq-input--text-placeholder-color];\n // Hover\n @apply [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-brand;\n\n border-style: var(--bq-input--border-style);\n\n // Focus\n &:not(.disabled):focus-within {\n --bq-ring-width: 1px;\n --bq-ring-offset-width: 0;\n --bq-ring-color-focus: var(--bq-input--border-color-focus);\n\n @apply focus border-[color:--bq-input--border-color-focus];\n }\n\n // Enable clear button whenever the input group control is hovered or has focus\n &:not(.disabled):hover,\n &:not(.disabled):focus-within {\n .bq-input--control__clear {\n @apply inline-block;\n }\n }\n}\n\n.bq-input--control.disabled {\n @apply cursor-not-allowed opacity-60;\n}\n\n/* ------------------------------- Validation ------------------------------- */\n\n.bq-input--control.validation-error {\n @apply border-stroke-danger [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-danger;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.danger);\n\n @apply border-active-stroke-danger;\n }\n}\n\n.bq-input--control.validation-success {\n @apply border-stroke-success [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-success;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.success);\n\n @apply border-active-stroke-success;\n }\n}\n\n.bq-input--control.validation-warning {\n @apply border-stroke-warning [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-warning;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.warning);\n\n @apply border-active-stroke-warning;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* Native HTML Input */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__input {\n @apply flex-auto cursor-[inherit] appearance-none bg-[inherit] font-[inherit] text-[length:inherit] text-[color:inherit];\n @apply border-none min-bs-[--bq-input--icon-size] min-is-0 m-b-0 m-i-0 p-b-0 p-i-0 focus:outline-none focus-visible:outline-none;\n\n box-shadow: none;\n font-weight: inherit;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Clear button */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__clear::part(button) {\n // Since the clear button is inside the input group control,\n // we need to reset the focus ring styles\n --bq-ring-width: initial;\n --bq-ring-offset-width: initial;\n --bq-ring-color-focus: initial;\n\n @apply rounded-xs border-none bs-auto p-b-0 p-i-0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Prefix and suffix */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__prefix,\n.bq-input--control__suffix {\n @apply pointer-events-none flex items-center text-[color:--bq-input--text-color];\n}\n\n.bq-input--control__prefix {\n @apply me-[--bq-input--gap];\n}\n\n.bq-input--control__suffix {\n @apply ms-[--bq-input--gap];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Slotted and internal icons */\n/* -------------------------------------------------------------------------- */\n\nbq-icon,\n::slotted(bq-icon) {\n --bq-icon--size: var(--bq-input--icon-size) !important;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Hide webkit clear button */\n/* -------------------------------------------------------------------------- */\n\n/* Remove clear controls from search input */\n\n.bq-input--control__input::-moz-search-cancel {\n @apply hidden appearance-none;\n}\n\n.bq-input--control__input::-webkit-search-decoration,\n.bq-input--control__input::-webkit-search-cancel-button,\n.bq-input--control__input::-webkit-search-results-button,\n.bq-input--control__input::-webkit-search-results-decoration {\n @apply hidden appearance-none;\n}\n\n/* Remove native control extra padding from input date and datetime */\n\n.bq-input--control__input::-webkit-datetime-edit-fields-wrapper,\n.bq-input--control__input::-webkit-datetime-edit,\n.bq-input--control__input::-webkit-datetime-edit-year-field,\n.bq-input--control__input::-webkit-datetime-edit-month-field,\n.bq-input--control__input::-webkit-datetime-edit-day-field,\n.bq-input--control__input::-webkit-datetime-edit-hour-field,\n.bq-input--control__input::-webkit-datetime-edit-minute-field,\n.bq-input--control__input::-webkit-datetime-edit-second-field,\n.bq-input--control__input::-webkit-datetime-edit-millisecond-field,\n.bq-input--control__input::-webkit-datetime-edit-meridiem-field {\n @apply p-b-0 p-i-0;\n}\n","import { Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\n\nimport { TInputType, TInputValidation, TInputValue } from './bq-input.types';\nimport { debounce, hasSlotContent, isDefined, isHTMLElement, TDebounce } from '../../shared/utils';\n\n/**\n * @part base - The component's base wrapper.\n * @part button - The native HTML button used under the hood in the clear button.\n * @part clear-btn - The clear button.\n * @part control - The input control wrapper.\n * @part helper-text - The helper text slot container.\n * @part label - The label slot container.\n * @part input - The native HTML input element used under the hood.\n * @part prefix - The prefix slot container.\n * @part suffix - The suffix slot container.\n */\n@Component({\n tag: 'bq-input',\n styleUrl: './scss/bq-input.scss',\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqInput {\n // Own Properties\n // ====================\n\n private helperTextElem?: HTMLElement;\n private inputElem?: HTMLInputElement;\n private labelElem?: HTMLElement;\n private prefixElem?: HTMLElement;\n private suffixElem?: HTMLElement;\n\n private debounceBqInput: TDebounce<void>;\n private fallbackInputId = 'input';\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqInputElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() hasHelperText = false;\n @State() hasLabel = false;\n @State() hasPrefix = false;\n @State() hasSuffix = false;\n @State() hasValue = false;\n\n // Public Property API\n // ========================\n\n /**\n * Controls whether or not the input field should be capitalized and how.\n * Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize\n */\n @Prop({ reflect: true }) autocapitalize: string = 'off';\n\n /**\n * Specifies whether or not the input field should have autocomplete enabled.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n */\n @Prop({ reflect: true }) autocomplete: string = 'off';\n\n /**\n * Controls whether or not the input field should have autocorrect enabled.\n * Possible values are 'on' and 'off'.\n */\n @Prop({ reflect: true }) autocorrect: 'on' | 'off' = 'off';\n\n /** If true, the input will be focused on component render */\n @Prop({ reflect: true }) autofocus: boolean;\n\n /** The clear button aria label */\n @Prop({ reflect: true }) clearButtonLabel? = 'Clear value';\n\n /**\n * The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes.\n * A value of 0 means no debouncing will occur.\n */\n @Prop({ reflect: true, mutable: true }) debounceTime? = 0;\n\n /**\n * Indicates whether the input is disabled or not.\n * If `true`, the input is disabled and cannot be interacted with.\n */\n @Prop({ mutable: true }) disabled?: boolean = false;\n\n /** If true, the clear button won't be displayed */\n @Prop({ reflect: true }) disableClear? = false;\n\n /** The ID of the form that the input field belongs to. */\n @Prop({ reflect: true }) form?: string;\n\n /**\n * The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field.\n * This allows a browser to display an appropriate virtual keyboard while editing.\n * Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.\n */\n @Prop() inputmode?: string;\n\n /**\n * The maximum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) max?: number | string;\n\n /** The maximum number of characters that the input field can accept. */\n @Prop({ reflect: true }) maxlength: number;\n\n /**\n * The minimum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) min?: number | string;\n\n /** The minimum number of characters that the input field can accept. */\n @Prop({ reflect: true }) minlength: number;\n\n /** The input field name. */\n @Prop({ reflect: true }) name!: string;\n\n /**\n * Specifies a regular expression the form control's value should match.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern\n */\n @Prop({ reflect: true }) pattern?: string;\n\n /** The input placeholder text value */\n @Prop({ reflect: true }) placeholder?: string;\n\n /** If true, the input field cannot be modified. */\n @Prop({ reflect: true }) readonly?: boolean;\n\n /** Indicates whether or not the input field is required to be filled out before submitting the form. */\n @Prop({ reflect: true }) required?: boolean;\n\n /**\n * A number that specifies the granularity that the value must adhere to.\n * Valid for date, month, week, time, datetime-local, number, and range.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @Prop({ reflect: true }) step: number | 'any';\n\n /**\n * The type attribute specifies the type of input field to display.\n * Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n */\n @Prop({ reflect: true }) type: TInputType = 'text';\n\n /**\n * The validation status of the input.\n *\n * @remarks\n * This property is used to indicate the validation status of the input. It can be set to one of the following values:\n * - `'none'`: No validation status is set.\n * - `'error'`: The input has a validation error.\n * - `'warning'`: The input has a validation warning.\n * - `'success'`: The input has passed validation.\n */\n @Prop({ reflect: true }) validationStatus: TInputValidation = 'none';\n\n /** The input value, it can be used to reset the input to a previous value */\n @Prop({ reflect: true, mutable: true }) value: TInputValue;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('value')\n handleValueChange() {\n if (Array.isArray(this.value)) {\n this.hasValue = this.value.some((val) => val.length > 0);\n return;\n }\n\n this.hasValue = isDefined(this.value);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler emitted when the input loses focus */\n @Event() bqBlur!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value has changed and the input loses focus.\n * This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.\n */\n @Event() bqChange!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n /** Callback handler emitted when the input value has been cleared */\n @Event() bqClear!: EventEmitter<HTMLBqInputElement>;\n\n /** Callback handler emitted when the input has received focus */\n @Event() bqFocus!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value changes.\n * This handler is called whenever the user types or pastes text into the input field.\n */\n @Event() bqInput!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n this.handleValueChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n if (this.disabled) return;\n\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n if (this.disabled) return;\n\n this.bqFocus.emit(this.el);\n };\n\n private handleInput = (ev: Event) => {\n if (this.disabled) return;\n\n this.debounceBqInput?.cancel();\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n\n this.debounceBqInput = debounce(() => {\n this.bqInput.emit({ value: this.value, el: this.el });\n }, this.debounceTime);\n this.debounceBqInput();\n };\n\n private handleChange = (ev: Event) => {\n if (this.disabled) return;\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n\n this.bqChange.emit({ value: this.value, el: this.el });\n };\n\n private handleClearClick = (ev: CustomEvent) => {\n if (this.disabled) return;\n\n this.inputElem.value = '';\n this.value = this.inputElem.value;\n\n this.bqClear.emit(this.el);\n this.bqInput.emit({ value: this.value, el: this.el });\n this.bqChange.emit({ value: this.value, el: this.el });\n this.inputElem.focus();\n\n ev.stopPropagation();\n };\n\n private handleLabelSlotChange = () => {\n this.hasLabel = hasSlotContent(this.labelElem);\n };\n\n private handlePrefixSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem);\n };\n\n private handleSuffixSlotChange = () => {\n this.hasSuffix = hasSlotContent(this.suffixElem);\n };\n\n private handleHelperTextSlotChange = () => {\n this.hasHelperText = hasSlotContent(this.helperTextElem);\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-input\" part=\"base\">\n {/* Label */}\n <label\n class={{ 'bq-input--label': true, '!hidden': !this.hasLabel }}\n htmlFor={this.name || this.fallbackInputId}\n ref={(labelElem) => (this.labelElem = labelElem)}\n part=\"label\"\n >\n <slot name=\"label\" onSlotchange={this.handleLabelSlotChange} />\n </label>\n {/* Input control group */}\n <div\n class={{\n 'bq-input--control': true,\n [`validation-${this.validationStatus}`]: true,\n disabled: this.disabled,\n }}\n part=\"control\"\n >\n {/* Prefix */}\n <span\n class={{ 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }}\n ref={(spanElem) => (this.prefixElem = spanElem)}\n part=\"prefix\"\n >\n <slot name=\"prefix\" onSlotchange={this.handlePrefixSlotChange} />\n </span>\n {/* HTML Input */}\n <input\n id={this.name || this.fallbackInputId}\n class=\"bq-input--control__input\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n disabled={this.disabled}\n form={this.form}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxlength}\n min={this.min}\n minLength={this.minlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n ref={(inputElem) => (this.inputElem = inputElem)}\n readOnly={this.readonly}\n required={this.required}\n step={this.step}\n type={this.type}\n value={this.value}\n part=\"input\"\n // Events\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onInput={this.handleInput}\n />\n {/* Clear Button */}\n {this.hasValue && !this.disabled && !this.disableClear && (\n // The clear button will be visible as long as the input has a value\n // and the parent group is hovered or has focus-within\n <bq-button\n class=\"bq-input--control__clear ms-[--bq-input--gap] hidden\"\n appearance=\"text\"\n aria-label={this.clearButtonLabel}\n size=\"small\"\n onBqClick={this.handleClearClick}\n part=\"clear-btn\"\n exportparts=\"button\"\n >\n <slot name=\"clear-icon\">\n <bq-icon name=\"x-circle\" class=\"flex\" />\n </slot>\n </bq-button>\n )}\n {/* Suffix */}\n <span\n class={{ 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }}\n ref={(spanElem) => (this.suffixElem = spanElem)}\n part=\"suffix\"\n >\n <slot name=\"suffix\" onSlotchange={this.handleSuffixSlotChange} />\n </span>\n </div>\n {/* Helper text */}\n <div\n class={{\n [`bq-input--helper-text validation-${this.validationStatus}`]: true,\n '!hidden': !this.hasHelperText,\n }}\n ref={(divElem) => (this.helperTextElem = divElem)}\n part=\"helper-text\"\n >\n <slot name=\"helper-text\" onSlotchange={this.handleHelperTextSlotChange} />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"bq-input.js","mappings":";;;;;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,0p5BAA0p5B,CAAC;AAC9q5B,sBAAe,UAAU;;MCuBZA,SAAO;;;;;;;;;;;QAWV,oBAAe,GAAG,OAAO,CAAC;;;;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Q,MAAM,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,EAC/C,IAAI,EAAC,QAAQ,IAEb,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,sBAAsB,GAAI,CAC5D,CACH,EAEN,4DACE,KAAK,EAAE;gBACL,CAAC,oCAAoC,IAAI,CAAC,gBAAgB,EAAE,GAAG,IAAI;gBACnE,SAAS,EAAE,CAAC,IAAI,CAAC,aAAa;aAC/B,EACD,GAAG,EAAE,CAAC,OAAO,MAAM,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,EACjD,IAAI,EAAC,aAAa,IAElB,6DAAM,IAAI,EAAC,aAAa,EAAC,YAAY,EAAE,IAAI,CAAC,0BAA0B,GAAI,CACtE,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["BqInput"],"sources":["../../packages/beeq/src/components/input/scss/bq-input.scss?tag=bq-input&encapsulation=shadow","../../packages/beeq/src/components/input/bq-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Input styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-input.variables';\n\n:host {\n @apply block is-full;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Label and Helper text */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--label {\n @apply flex flex-grow items-center m-be-[--bq-input--label-margin-bottom];\n @apply text-[length:--bq-input--label-text-size] text-[color:--bq-input--label-text-color];\n}\n\n.bq-input--helper-text {\n @apply text-[length:--bq-input--helper-text-size] text-[color:--bq-input--helper-text-color] m-bs-[--bq-input--helper-margin-top];\n}\n\n.bq-input--helper-text.validation-error {\n @apply text-text-danger;\n}\n\n.bq-input--helper-text.validation-success {\n @apply text-text-success;\n}\n\n.bq-input--helper-text.validation-warning {\n @apply text-text-warning;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input group control */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control {\n @apply flex items-center transition-[border-color,box-shadow] is-full;\n // Border\n @apply rounded-[--bq-input--border-radius] border-[length:--bq-input--border-width] border-[color:--bq-input--border-color];\n // Padding\n @apply pe-[--bq-input--padding-end] ps-[--bq-input--padding-start] p-b-[--bq-input--paddingY];\n // Text\n @apply text-[length:--bq-input--text-size] text-[color:--bq-input--text-color] placeholder:text-[color:--bq-input--text-placeholder-color];\n // Hover\n @apply [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-brand;\n\n border-style: var(--bq-input--border-style);\n\n // Focus\n &:not(.disabled):focus-within {\n --bq-ring-width: 1px;\n --bq-ring-offset-width: 0;\n --bq-ring-color-focus: var(--bq-input--border-color-focus);\n\n @apply focus border-[color:--bq-input--border-color-focus];\n }\n\n // Enable clear button whenever the input group control is hovered or has focus\n &:not(.disabled):hover,\n &:not(.disabled):focus-within {\n .bq-input--control__clear {\n @apply inline-block;\n }\n }\n}\n\n.bq-input--control.disabled {\n @apply cursor-not-allowed opacity-60;\n}\n\n/* ------------------------------- Validation ------------------------------- */\n\n.bq-input--control.validation-error {\n @apply border-stroke-danger [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-danger;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.danger);\n\n @apply border-active-stroke-danger;\n }\n}\n\n.bq-input--control.validation-success {\n @apply border-stroke-success [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-success;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.success);\n\n @apply border-active-stroke-success;\n }\n}\n\n.bq-input--control.validation-warning {\n @apply border-stroke-warning [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-warning;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.warning);\n\n @apply border-active-stroke-warning;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* Native HTML Input */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__input {\n @apply flex-auto cursor-[inherit] appearance-none bg-[inherit] font-[inherit] text-[length:inherit] text-[color:inherit];\n @apply border-none min-bs-[--bq-input--icon-size] min-is-0 m-b-0 m-i-0 p-b-0 p-i-0 focus:outline-none focus-visible:outline-none;\n\n box-shadow: none;\n font-weight: inherit;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Clear button */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__clear::part(button) {\n // Since the clear button is inside the input group control,\n // we need to reset the focus ring styles\n --bq-ring-width: initial;\n --bq-ring-offset-width: initial;\n --bq-ring-color-focus: initial;\n\n @apply rounded-xs border-none bs-auto p-b-0 p-i-0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Prefix and suffix */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__prefix,\n.bq-input--control__suffix {\n @apply pointer-events-none flex items-center text-[color:--bq-input--text-color];\n}\n\n.bq-input--control__prefix {\n @apply me-[--bq-input--gap];\n}\n\n.bq-input--control__suffix {\n @apply ms-[--bq-input--gap];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Slotted and internal icons */\n/* -------------------------------------------------------------------------- */\n\nbq-icon,\n::slotted(bq-icon) {\n --bq-icon--size: var(--bq-input--icon-size) !important;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Hide webkit clear button */\n/* -------------------------------------------------------------------------- */\n\n/* Remove clear controls from search input */\n\n.bq-input--control__input::-moz-search-cancel {\n @apply hidden appearance-none;\n}\n\n.bq-input--control__input::-webkit-search-decoration,\n.bq-input--control__input::-webkit-search-cancel-button,\n.bq-input--control__input::-webkit-search-results-button,\n.bq-input--control__input::-webkit-search-results-decoration {\n @apply hidden appearance-none;\n}\n\n/* Remove native control extra padding from input date and datetime */\n\n.bq-input--control__input::-webkit-datetime-edit-fields-wrapper,\n.bq-input--control__input::-webkit-datetime-edit,\n.bq-input--control__input::-webkit-datetime-edit-year-field,\n.bq-input--control__input::-webkit-datetime-edit-month-field,\n.bq-input--control__input::-webkit-datetime-edit-day-field,\n.bq-input--control__input::-webkit-datetime-edit-hour-field,\n.bq-input--control__input::-webkit-datetime-edit-minute-field,\n.bq-input--control__input::-webkit-datetime-edit-second-field,\n.bq-input--control__input::-webkit-datetime-edit-millisecond-field,\n.bq-input--control__input::-webkit-datetime-edit-meridiem-field {\n @apply p-b-0 p-i-0;\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\n\nimport { TInputType, TInputValidation, TInputValue } from './bq-input.types';\nimport { debounce, hasSlotContent, isDefined, isHTMLElement, isNil, TDebounce } from '../../shared/utils';\n\n/**\n * @part base - The component's base wrapper.\n * @part button - The native HTML button used under the hood in the clear button.\n * @part clear-btn - The clear button.\n * @part control - The input control wrapper.\n * @part helper-text - The helper text slot container.\n * @part label - The label slot container.\n * @part input - The native HTML input element used under the hood.\n * @part prefix - The prefix slot container.\n * @part suffix - The suffix slot container.\n */\n@Component({\n tag: 'bq-input',\n styleUrl: './scss/bq-input.scss',\n formAssociated: true,\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqInput {\n // Own Properties\n // ====================\n\n private helperTextElem?: HTMLElement;\n private inputElem?: HTMLInputElement;\n private labelElem?: HTMLElement;\n private prefixElem?: HTMLElement;\n private suffixElem?: HTMLElement;\n\n private debounceBqInput: TDebounce<void>;\n private fallbackInputId = 'input';\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqInputElement;\n @AttachInternals() internals!: ElementInternals;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() hasHelperText = false;\n @State() hasLabel = false;\n @State() hasPrefix = false;\n @State() hasSuffix = false;\n @State() hasValue = false;\n\n // Public Property API\n // ========================\n\n /**\n * Controls whether or not the input field should be capitalized and how.\n * Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize\n */\n @Prop({ reflect: true }) autocapitalize: string = 'off';\n\n /**\n * Specifies whether or not the input field should have autocomplete enabled.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n */\n @Prop({ reflect: true }) autocomplete: string = 'off';\n\n /**\n * Controls whether or not the input field should have autocorrect enabled.\n * Possible values are 'on' and 'off'.\n */\n @Prop({ reflect: true }) autocorrect: 'on' | 'off' = 'off';\n\n /** If true, the input will be focused on component render */\n @Prop({ reflect: true }) autofocus: boolean;\n\n /** The clear button aria label */\n @Prop({ reflect: true }) clearButtonLabel? = 'Clear value';\n\n /**\n * The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes.\n * A value of 0 means no debouncing will occur.\n */\n @Prop({ reflect: true, mutable: true }) debounceTime? = 0;\n\n /**\n * Indicates whether the input is disabled or not.\n * If `true`, the input is disabled and cannot be interacted with.\n */\n @Prop({ mutable: true }) disabled?: boolean = false;\n\n /** If true, the clear button won't be displayed */\n @Prop({ reflect: true }) disableClear? = false;\n\n /** The ID of the form that the input field belongs to. */\n @Prop({ reflect: true }) form?: string;\n\n /**\n * The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field.\n * This allows a browser to display an appropriate virtual keyboard while editing.\n * Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.\n */\n @Prop() inputmode?: string;\n\n /**\n * The maximum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) max?: number | string;\n\n /** The maximum number of characters that the input field can accept. */\n @Prop({ reflect: true }) maxlength: number;\n\n /**\n * The minimum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) min?: number | string;\n\n /** The minimum number of characters that the input field can accept. */\n @Prop({ reflect: true }) minlength: number;\n\n /** The input field name. */\n @Prop({ reflect: true }) name!: string;\n\n /**\n * Specifies a regular expression the form control's value should match.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern\n */\n @Prop({ reflect: true }) pattern?: string;\n\n /** The input placeholder text value */\n @Prop({ reflect: true }) placeholder?: string;\n\n /** If true, the input field cannot be modified. */\n @Prop({ reflect: true }) readonly?: boolean;\n\n /** Indicates whether or not the input field is required to be filled out before submitting the form. */\n @Prop({ reflect: true }) required?: boolean;\n\n /**\n * A number that specifies the granularity that the value must adhere to.\n * Valid for date, month, week, time, datetime-local, number, and range.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @Prop({ reflect: true }) step: number | 'any';\n\n /**\n * The type attribute specifies the type of input field to display.\n * Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n */\n @Prop({ reflect: true }) type: TInputType = 'text';\n\n /**\n * The validation status of the input.\n *\n * @remarks\n * This property is used to indicate the validation status of the input. It can be set to one of the following values:\n * - `'none'`: No validation status is set.\n * - `'error'`: The input has a validation error.\n * - `'warning'`: The input has a validation warning.\n * - `'success'`: The input has passed validation.\n */\n @Prop({ reflect: true }) validationStatus: TInputValidation = 'none';\n\n /** The input value, it can be used to reset the input to a previous value */\n @Prop({ reflect: true, mutable: true }) value: TInputValue;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('value')\n handleValueChange() {\n if (Array.isArray(this.value)) {\n this.hasValue = this.value.some((val) => val.length > 0);\n this.internals.setFormValue(this.value.join(','));\n return;\n }\n\n this.hasValue = isDefined(this.value);\n this.internals.setFormValue(`${this.value}`);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler emitted when the input loses focus */\n @Event() bqBlur!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value has changed and the input loses focus.\n * This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.\n */\n @Event() bqChange!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n /** Callback handler emitted when the input value has been cleared */\n @Event() bqClear!: EventEmitter<HTMLBqInputElement>;\n\n /** Callback handler emitted when the input has received focus */\n @Event() bqFocus!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value changes.\n * This handler is called whenever the user types or pastes text into the input field.\n */\n @Event() bqInput!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentWillLoad() {\n this.handleValueChange();\n }\n\n formResetCallback() {\n if (isNil(this.value)) return;\n\n this.handleClear();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n if (this.disabled) return;\n\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n if (this.disabled) return;\n\n this.bqFocus.emit(this.el);\n };\n\n private handleInput = (ev: Event) => {\n if (this.disabled) return;\n\n this.debounceBqInput?.cancel();\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n this.internals.setFormValue(`${this.value}`);\n\n this.debounceBqInput = debounce(() => {\n this.bqInput.emit({ value: this.value, el: this.el });\n }, this.debounceTime);\n this.debounceBqInput();\n };\n\n private handleChange = (ev: Event) => {\n if (this.disabled) return;\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n this.internals.setFormValue(`${this.value}`);\n\n this.bqChange.emit({ value: this.value, el: this.el });\n };\n\n private handleClear = () => {\n if (this.disabled) return;\n\n const { inputElem, internals } = this;\n\n // Clear input element value\n inputElem.value = '';\n this.value = inputElem.value;\n\n // Update associated form control value\n internals.setFormValue(undefined);\n };\n\n private handleClearClick = (ev: CustomEvent) => {\n ev.stopPropagation();\n this.handleClear();\n\n const { bqClear, bqChange, bqInput, el, inputElem } = this;\n // Emit events\n bqClear.emit(el);\n bqInput.emit({ value: this.value, el });\n bqChange.emit({ value: this.value, el });\n // Refocus input element\n inputElem.focus();\n };\n\n private handleLabelSlotChange = () => {\n this.hasLabel = hasSlotContent(this.labelElem);\n };\n\n private handlePrefixSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem);\n };\n\n private handleSuffixSlotChange = () => {\n this.hasSuffix = hasSlotContent(this.suffixElem);\n };\n\n private handleHelperTextSlotChange = () => {\n this.hasHelperText = hasSlotContent(this.helperTextElem);\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-input\" part=\"base\">\n {/* Label */}\n <label\n class={{ 'bq-input--label': true, '!hidden': !this.hasLabel }}\n htmlFor={this.name || this.fallbackInputId}\n ref={(labelElem) => (this.labelElem = labelElem)}\n part=\"label\"\n >\n <slot name=\"label\" onSlotchange={this.handleLabelSlotChange} />\n </label>\n {/* Input control group */}\n <div\n class={{\n 'bq-input--control': true,\n [`validation-${this.validationStatus}`]: true,\n disabled: this.disabled,\n }}\n part=\"control\"\n >\n {/* Prefix */}\n <span\n class={{ 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }}\n ref={(spanElem) => (this.prefixElem = spanElem)}\n part=\"prefix\"\n >\n <slot name=\"prefix\" onSlotchange={this.handlePrefixSlotChange} />\n </span>\n {/* HTML Input */}\n <input\n id={this.name || this.fallbackInputId}\n class=\"bq-input--control__input\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n disabled={this.disabled}\n form={this.form}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxlength}\n min={this.min}\n minLength={this.minlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n ref={(inputElem) => (this.inputElem = inputElem)}\n readOnly={this.readonly}\n required={this.required}\n step={this.step}\n type={this.type}\n value={this.value}\n part=\"input\"\n // Events\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onInput={this.handleInput}\n />\n {/* Clear Button */}\n {this.hasValue && !this.disabled && !this.disableClear && (\n // The clear button will be visible as long as the input has a value\n // and the parent group is hovered or has focus-within\n <bq-button\n class=\"bq-input--control__clear ms-[--bq-input--gap] hidden\"\n appearance=\"text\"\n aria-label={this.clearButtonLabel}\n size=\"small\"\n onBqClick={this.handleClearClick}\n part=\"clear-btn\"\n exportparts=\"button\"\n >\n <slot name=\"clear-icon\">\n <bq-icon name=\"x-circle\" class=\"flex\" />\n </slot>\n </bq-button>\n )}\n {/* Suffix */}\n <span\n class={{ 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }}\n ref={(spanElem) => (this.suffixElem = spanElem)}\n part=\"suffix\"\n >\n <slot name=\"suffix\" onSlotchange={this.handleSuffixSlotChange} />\n </span>\n </div>\n {/* Helper text */}\n <div\n class={{\n [`bq-input--helper-text validation-${this.validationStatus}`]: true,\n '!hidden': !this.hasHelperText,\n }}\n ref={(divElem) => (this.helperTextElem = divElem)}\n part=\"helper-text\"\n >\n <slot name=\"helper-text\" onSlotchange={this.handleHelperTextSlotChange} />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -7,8 +7,9 @@ import './assetsPath.js';
|
|
|
7
7
|
import { d as debounce } from './debounce.js';
|
|
8
8
|
import { i as isDefined } from './isDefined.js';
|
|
9
9
|
import { i as isHTMLElement } from './isHTMLElement.js';
|
|
10
|
+
import { i as isNil } from './isNil.js';
|
|
10
11
|
import { i as isString } from './isString.js';
|
|
11
|
-
import { b as hasSlotContent
|
|
12
|
+
import { b as hasSlotContent } from './slot.js';
|
|
12
13
|
import { d as defineCustomElement$7 } from './bq-button2.js';
|
|
13
14
|
import { d as defineCustomElement$6 } from './bq-dropdown2.js';
|
|
14
15
|
import { d as defineCustomElement$5 } from './bq-icon2.js';
|
|
@@ -28,6 +29,7 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
28
29
|
this.bqClear = createEvent(this, "bqClear", 7);
|
|
29
30
|
this.bqFocus = createEvent(this, "bqFocus", 7);
|
|
30
31
|
this.bqSelect = createEvent(this, "bqSelect", 7);
|
|
32
|
+
this.internals = this.attachInternals();
|
|
31
33
|
this.fallbackInputId = 'select';
|
|
32
34
|
// Local methods
|
|
33
35
|
// Internal business logic.
|
|
@@ -127,34 +129,58 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
127
129
|
this.options.forEach((item) => (item.hidden = false));
|
|
128
130
|
};
|
|
129
131
|
this.syncItemsFromValue = () => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!items.length)
|
|
132
|
+
const { internals, options, value } = this;
|
|
133
|
+
if (!options.length)
|
|
133
134
|
return;
|
|
134
135
|
// Sync selected state of the BqOption elements
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
this.syncSelectedOptionsState();
|
|
137
|
+
if (this.multiple) {
|
|
138
|
+
// Sync selected options for multiple selection mode
|
|
139
|
+
this.selectedOptions = options.filter((option) => { var _a; return (_a = this.value) === null || _a === void 0 ? void 0 : _a.includes(option.value); });
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Sync display label for single selection mode
|
|
143
|
+
this.updateDisplayLabel();
|
|
144
|
+
}
|
|
145
|
+
internals.setFormValue(!isNil(value) ? `${value}` : undefined);
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Syncs the selected state of the BqOption elements which value is included in the `value` property.
|
|
149
|
+
* Notice that value can be a string or an array of strings.
|
|
150
|
+
*
|
|
151
|
+
* @private
|
|
152
|
+
* @memberof BqSelect
|
|
153
|
+
*/
|
|
154
|
+
this.syncSelectedOptionsState = () => {
|
|
155
|
+
const { options, multiple, value } = this;
|
|
156
|
+
const lowerCaseValue = String(value).toLowerCase();
|
|
157
|
+
options.forEach((option) => {
|
|
158
|
+
if (multiple && Array.isArray(value)) {
|
|
159
|
+
option.selected = value.includes(option.value);
|
|
138
160
|
}
|
|
139
161
|
else {
|
|
140
|
-
option.selected = option.value.toLowerCase() ===
|
|
162
|
+
option.selected = option.value.toLowerCase() === lowerCaseValue;
|
|
141
163
|
}
|
|
142
164
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Updates the display value of the input element based on the selected option.
|
|
168
|
+
*
|
|
169
|
+
* @private
|
|
170
|
+
* @memberof BqSelect
|
|
171
|
+
*/
|
|
172
|
+
this.updateDisplayLabel = () => {
|
|
173
|
+
const { value, options, inputElem } = this;
|
|
174
|
+
const checkedItem = options.find((item) => item.value === value);
|
|
175
|
+
const displayValue = checkedItem ? this.getOptionLabel(checkedItem) : '';
|
|
176
|
+
inputElem.value = displayValue;
|
|
177
|
+
this.displayValue = displayValue;
|
|
152
178
|
};
|
|
153
179
|
this.getOptionLabel = (item) => {
|
|
154
|
-
|
|
155
|
-
if (!
|
|
180
|
+
var _a;
|
|
181
|
+
if (!item)
|
|
156
182
|
return;
|
|
157
|
-
return
|
|
183
|
+
return (_a = item.innerText.trim()) !== null && _a !== void 0 ? _a : '';
|
|
158
184
|
};
|
|
159
185
|
this.displayValue = undefined;
|
|
160
186
|
this.hasHelperText = false;
|
|
@@ -192,6 +218,7 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
192
218
|
if (this.multiple && isString(this.value)) {
|
|
193
219
|
// NOTE: we ensure that value is an array, changing the value will trigger Watch to execute thus the return
|
|
194
220
|
this.value = Array.from(JSON.parse(String(this.value)));
|
|
221
|
+
this.internals.setFormValue(this.value.join(','));
|
|
195
222
|
return;
|
|
196
223
|
}
|
|
197
224
|
this.syncItemsFromValue();
|
|
@@ -210,6 +237,16 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
210
237
|
}
|
|
211
238
|
this.handleValueChange();
|
|
212
239
|
}
|
|
240
|
+
formAssociatedCallback() {
|
|
241
|
+
this.internals.role = 'combobox';
|
|
242
|
+
this.internals.ariaExpanded = this.open ? 'true' : 'false';
|
|
243
|
+
}
|
|
244
|
+
async formResetCallback() {
|
|
245
|
+
if (isNil(this.value))
|
|
246
|
+
return;
|
|
247
|
+
this.internals.setValidity({});
|
|
248
|
+
this.clear();
|
|
249
|
+
}
|
|
213
250
|
// Listeners
|
|
214
251
|
// ==============
|
|
215
252
|
handleOpenChange(ev) {
|
|
@@ -238,14 +275,19 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
238
275
|
async clear() {
|
|
239
276
|
if (this.disabled)
|
|
240
277
|
return;
|
|
278
|
+
const { multiple, inputElem, bqClear, el } = this;
|
|
279
|
+
// Clear value and selected options
|
|
241
280
|
this.value = undefined;
|
|
242
281
|
this.selectedOptions = [];
|
|
243
|
-
if
|
|
282
|
+
// Clear display value and input element if not multiple
|
|
283
|
+
if (!multiple) {
|
|
244
284
|
this.displayValue = undefined;
|
|
245
|
-
|
|
285
|
+
inputElem.value = undefined;
|
|
246
286
|
}
|
|
287
|
+
// Update form value and reset options visibility
|
|
247
288
|
this.resetOptionsVisibility();
|
|
248
|
-
|
|
289
|
+
// Emit clear event
|
|
290
|
+
bqClear.emit(el);
|
|
249
291
|
}
|
|
250
292
|
get options() {
|
|
251
293
|
return Array.from(this.el.querySelectorAll('bq-option'));
|
|
@@ -285,27 +327,28 @@ const BqSelect$1 = /*@__PURE__*/ proxyCustomElement(class BqSelect extends HTMLE
|
|
|
285
327
|
// ===================================
|
|
286
328
|
render() {
|
|
287
329
|
const labelId = `bq-select__label-${this.name || this.fallbackInputId}`;
|
|
288
|
-
return (h("div", { key: '
|
|
330
|
+
return (h("div", { key: 'b0822a6c3f418c4baadbdd0fffe0678c85d4a858', class: "bq-select", part: "base" }, h("label", { key: '1cdf1bbf83b43cc794b08ba4fe175317cd562930', id: labelId, class: { 'bq-select__label': true, '!hidden': !this.hasLabel }, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '98b253b36c68a4ab56f269959f50f0539ddaf9b3', name: "label", onSlotchange: this.handleLabelSlotChange })), h("bq-dropdown", { key: 'b614f2d5b71c6d1b246c19b716cebca8a5776c63', class: "bq-select__dropdown w-full", disabled: this.disabled, distance: this.distance, keepOpenOnSelect: this.keepOpenOnSelect, open: this.open, panelHeight: this.panelHeight, placement: this.placement, sameWidth: this.sameWidth, skidding: this.skidding, strategy: this.strategy, exportparts: "panel" }, h("div", { key: 'c0f4ea4d05b2411ebe95f32393702e1b566203c4', class: {
|
|
289
331
|
'bq-select__control': true,
|
|
290
332
|
[`validation-${this.validationStatus}`]: true,
|
|
291
333
|
disabled: this.disabled,
|
|
292
|
-
}, part: "control", slot: "trigger" }, h("span", { key: '
|
|
334
|
+
}, part: "control", slot: "trigger" }, h("span", { key: 'e87b700d7682189ae49c28ce5f0341ca32944827', class: { 'bq-select__control--prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: 'b2117317d53f0fd3c62880fb73f47d8a0032bd0e', name: "prefix", onSlotchange: this.handlePrefixSlotChange })), h("div", { key: '22c024d6ab811d60930217b4e0f0397f47f4af4e', class: "flex flex-1 overflow-x-auto", part: "input-outline" }, this.multiple && (h("span", { key: '230c6552acbcb80cd15dc2b712da9b48b4fb0a87', class: "bq-select__tags", part: "tags" }, h("slot", { key: 'd466eb5a20ef181e6c7671a9c4f177d6e2e3bd30', name: "tags" }, this.displayTags))), h("input", { key: 'f7b1dd41dfa8a87cbc5747fd9b3f8d965c1702c9', id: this.name || this.fallbackInputId, class: "bq-select__control--input flex-grow is-full", autoComplete: "off", autoCapitalize: "off", autoFocus: this.autofocus, "aria-disabled": this.disabled ? 'true' : 'false', "aria-controls": `bq-options-${this.name}`, "aria-expanded": this.open ? 'true' : 'false', "aria-haspopup": "listbox", disabled: this.disabled, form: this.form, name: this.name, placeholder: this.displayPlaceholder, ref: (inputElem) => (this.inputElem = inputElem), readOnly: this.readonly, required: this.required, role: "combobox", spellcheck: false, type: "text", value: this.displayValue, part: "input",
|
|
293
335
|
// Events
|
|
294
336
|
onBlur: this.handleBlur, onFocus: this.handleFocus, onInput: this.handleSearchFilter })), this.hasClearIcon && (
|
|
295
337
|
// The clear button will be visible as long as the input has a value
|
|
296
338
|
// and the parent group is hovered or has focus-within
|
|
297
|
-
h("bq-button", { key: '
|
|
339
|
+
h("bq-button", { key: 'a414e48a85ecb319fbd2dfa92303d56139281947', class: "bq-select__control--clear ms-[--bq-select--gap]", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button", tabIndex: -1 }, h("slot", { key: 'adb12a220b55c1b0b772f1309b0dfcf1f3543879', name: "clear-icon" }, h("bq-icon", { key: '9f4c77e3f7547b39f7015a34d99f44acae1ff552', name: "x-circle", class: "flex" })))), h("span", { key: '57f5b28c0cdb54098c683b437a9e9b18df122d99', class: { 'bq-select__control--suffix': true, 'rotate-180': this.open, 'rotate-0': !this.open }, ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: 'a897f738544a13d4283232d7e6601210477884fa', name: "suffix", onSlotchange: this.handleSuffixSlotChange }, h("bq-icon", { key: '4d92c46edda852f4290f4d26294a4d396e3359c8', name: "caret-down", class: "flex" })))), h("bq-option-list", { key: 'e1d33bd852ccddb2b11871a8a589bfd7424659ca', id: `bq-options-${this.name}`, onBqSelect: this.handleSelect, "aria-expanded": this.open ? 'true' : 'false', exportparts: "base:option-list", role: "listbox" }, h("slot", { key: 'efc2746ae6ed636498a93f02852c2b5f9b6810ed' }))), h("div", { key: '7af06c40296fb14b27d53f903a84acb879a0c48c', class: {
|
|
298
340
|
[`bq-select__helper-text validation-${this.validationStatus}`]: true,
|
|
299
341
|
'!hidden': !this.hasHelperText,
|
|
300
|
-
}, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: '
|
|
342
|
+
}, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: '82a339ec99ea0d9fbc991644f609e93fddf0aed1', name: "helper-text", onSlotchange: this.handleHelperTextSlotChange }))));
|
|
301
343
|
}
|
|
302
344
|
static get delegatesFocus() { return true; }
|
|
345
|
+
static get formAssociated() { return true; }
|
|
303
346
|
get el() { return this; }
|
|
304
347
|
static get watchers() { return {
|
|
305
348
|
"value": ["handleValueChange"]
|
|
306
349
|
}; }
|
|
307
350
|
static get style() { return BqSelectStyle0; }
|
|
308
|
-
}, [
|
|
351
|
+
}, [81, "bq-select", {
|
|
309
352
|
"autofocus": [516],
|
|
310
353
|
"clearButtonLabel": [513, "clear-button-label"],
|
|
311
354
|
"debounceTime": [1538, "debounce-time"],
|