snice 2.1.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/snice-accordion-item.d.ts +25 -0
- package/dist/components/accordion/snice-accordion-item.js +255 -0
- package/dist/components/accordion/snice-accordion-item.js.map +1 -0
- package/dist/components/accordion/snice-accordion.d.ts +28 -0
- package/dist/components/accordion/snice-accordion.js +206 -0
- package/dist/components/accordion/snice-accordion.js.map +1 -0
- package/dist/components/accordion/snice-accordion.types.d.ts +29 -0
- package/dist/components/alert/snice-alert.d.ts +26 -0
- package/dist/components/alert/snice-alert.js +180 -0
- package/dist/components/alert/snice-alert.js.map +1 -0
- package/{components/alert/snice-alert.types.ts → dist/components/alert/snice-alert.types.d.ts} +8 -9
- package/dist/components/avatar/snice-avatar.d.ts +24 -0
- package/dist/components/avatar/snice-avatar.js +180 -0
- package/dist/components/avatar/snice-avatar.js.map +1 -0
- package/dist/components/avatar/snice-avatar.types.d.ts +12 -0
- package/dist/components/badge/snice-badge.d.ts +25 -0
- package/dist/components/badge/snice-badge.js +169 -0
- package/dist/components/badge/snice-badge.js.map +1 -0
- package/{components/badge/snice-badge.types.ts → dist/components/badge/snice-badge.types.d.ts} +11 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +27 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +214 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.d.ts +23 -0
- package/dist/components/breadcrumbs/snice-crumb.d.ts +9 -0
- package/dist/components/breadcrumbs/snice-crumb.js +63 -0
- package/dist/components/breadcrumbs/snice-crumb.js.map +1 -0
- package/dist/components/button/snice-button.d.ts +32 -0
- package/dist/components/button/snice-button.js +232 -0
- package/dist/components/button/snice-button.js.map +1 -0
- package/dist/components/button/snice-button.types.d.ts +23 -0
- package/dist/components/card/snice-card.d.ts +19 -0
- package/dist/components/card/snice-card.js +136 -0
- package/dist/components/card/snice-card.js.map +1 -0
- package/{components/card/snice-card.types.ts → dist/components/card/snice-card.types.d.ts} +6 -7
- package/dist/components/checkbox/snice-checkbox.d.ts +34 -0
- package/dist/components/checkbox/snice-checkbox.js +286 -0
- package/dist/components/checkbox/snice-checkbox.js.map +1 -0
- package/dist/components/checkbox/snice-checkbox.types.d.ts +20 -0
- package/dist/components/chip/snice-chip.d.ts +28 -0
- package/dist/components/chip/snice-chip.js +199 -0
- package/dist/components/chip/snice-chip.js.map +1 -0
- package/dist/components/chip/snice-chip.types.d.ts +14 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +82 -0
- package/dist/components/date-picker/snice-date-picker.js +847 -0
- package/dist/components/date-picker/snice-date-picker.js.map +1 -0
- package/dist/components/date-picker/snice-date-picker.types.d.ts +71 -0
- package/dist/components/divider/snice-divider.d.ts +17 -0
- package/dist/components/divider/snice-divider.js +122 -0
- package/dist/components/divider/snice-divider.js.map +1 -0
- package/{components/divider/snice-divider.types.ts → dist/components/divider/snice-divider.types.d.ts} +9 -10
- package/dist/components/drawer/snice-drawer.d.ts +37 -0
- package/dist/components/drawer/snice-drawer.js +337 -0
- package/dist/components/drawer/snice-drawer.js.map +1 -0
- package/dist/components/drawer/snice-drawer.types.d.ts +16 -0
- package/dist/components/input/snice-input.d.ts +65 -0
- package/dist/components/input/snice-input.js +567 -0
- package/dist/components/input/snice-input.js.map +1 -0
- package/dist/components/input/snice-input.types.d.ts +53 -0
- package/dist/components/layout/snice-layout-blog.d.ts +4 -0
- package/dist/components/layout/snice-layout-blog.js +67 -0
- package/dist/components/layout/snice-layout-blog.js.map +1 -0
- package/dist/components/layout/snice-layout-card.d.ts +6 -0
- package/dist/components/layout/snice-layout-card.js +64 -0
- package/dist/components/layout/snice-layout-card.js.map +1 -0
- package/dist/components/layout/snice-layout-centered.d.ts +5 -0
- package/dist/components/layout/snice-layout-centered.js +48 -0
- package/dist/components/layout/snice-layout-centered.js.map +1 -0
- package/dist/components/layout/snice-layout-dashboard.d.ts +4 -0
- package/dist/components/layout/snice-layout-dashboard.js +64 -0
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -0
- package/dist/components/layout/snice-layout-fullscreen.d.ts +5 -0
- package/dist/components/layout/snice-layout-fullscreen.js +60 -0
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -0
- package/dist/components/layout/snice-layout-landing.d.ts +4 -0
- package/dist/components/layout/snice-layout-landing.js +66 -0
- package/dist/components/layout/snice-layout-landing.js.map +1 -0
- package/dist/components/layout/snice-layout-minimal.d.ts +4 -0
- package/dist/components/layout/snice-layout-minimal.js +38 -0
- package/dist/components/layout/snice-layout-minimal.js.map +1 -0
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -0
- package/dist/components/layout/snice-layout-sidebar.js +74 -0
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -0
- package/dist/components/layout/snice-layout-split.d.ts +6 -0
- package/dist/components/layout/snice-layout-split.js +58 -0
- package/dist/components/layout/snice-layout-split.js.map +1 -0
- package/dist/components/layout/snice-layout.d.ts +4 -0
- package/dist/components/layout/snice-layout.js +54 -0
- package/dist/components/layout/snice-layout.js.map +1 -0
- package/{components/layout/snice-layout.types.ts → dist/components/layout/snice-layout.types.d.ts} +1 -3
- package/dist/components/login/snice-login.d.ts +44 -0
- package/dist/components/login/snice-login.js +382 -0
- package/dist/components/login/snice-login.js.map +1 -0
- package/dist/components/login/snice-login.types.d.ts +26 -0
- package/dist/components/modal/snice-modal.d.ts +32 -0
- package/dist/components/modal/snice-modal.js +280 -0
- package/dist/components/modal/snice-modal.js.map +1 -0
- package/dist/components/modal/snice-modal.types.d.ts +18 -0
- package/dist/components/pagination/snice-pagination.d.ts +26 -0
- package/dist/components/pagination/snice-pagination.js +373 -0
- package/dist/components/pagination/snice-pagination.js.map +1 -0
- package/dist/components/pagination/snice-pagination.types.d.ts +18 -0
- package/dist/components/progress/snice-progress.d.ts +35 -0
- package/dist/components/progress/snice-progress.js +305 -0
- package/dist/components/progress/snice-progress.js.map +1 -0
- package/dist/components/progress/snice-progress.types.d.ts +18 -0
- package/dist/components/radio/snice-radio.d.ts +33 -0
- package/dist/components/radio/snice-radio.js +279 -0
- package/dist/components/radio/snice-radio.js.map +1 -0
- package/dist/components/radio/snice-radio.types.d.ts +19 -0
- package/dist/components/select/snice-option.d.ts +17 -0
- package/dist/components/select/snice-option.js +88 -0
- package/dist/components/select/snice-option.js.map +1 -0
- package/{components/select/snice-option.types.ts → dist/components/select/snice-option.types.d.ts} +8 -8
- package/dist/components/select/snice-select.d.ts +89 -0
- package/dist/components/select/snice-select.js +864 -0
- package/dist/components/select/snice-select.js.map +1 -0
- package/dist/components/select/snice-select.types.d.ts +49 -0
- package/dist/components/skeleton/snice-skeleton.d.ts +16 -0
- package/dist/components/skeleton/snice-skeleton.js +166 -0
- package/dist/components/skeleton/snice-skeleton.js.map +1 -0
- package/{components/skeleton/snice-skeleton.types.ts → dist/components/skeleton/snice-skeleton.types.d.ts} +7 -8
- package/dist/components/snice-cell-C8aBfN72.js +4 -0
- package/dist/components/snice-cell-C8aBfN72.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +38 -0
- package/dist/components/switch/snice-switch.js +305 -0
- package/dist/components/switch/snice-switch.js.map +1 -0
- package/dist/components/switch/snice-switch.types.d.ts +21 -0
- package/dist/components/symbols.d.ts +1 -0
- package/dist/components/symbols.js +22 -0
- package/dist/components/symbols.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +21 -0
- package/dist/components/table/snice-cell-boolean.js +164 -0
- package/dist/components/table/snice-cell-boolean.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +24 -0
- package/dist/components/table/snice-cell-date.js +253 -0
- package/dist/components/table/snice-cell-date.js.map +1 -0
- package/dist/components/table/snice-cell-duration.d.ts +16 -0
- package/dist/components/table/snice-cell-duration.js +130 -0
- package/dist/components/table/snice-cell-duration.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +16 -0
- package/dist/components/table/snice-cell-filesize.js +126 -0
- package/dist/components/table/snice-cell-filesize.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +23 -0
- package/dist/components/table/snice-cell-number.js +215 -0
- package/dist/components/table/snice-cell-number.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +17 -0
- package/dist/components/table/snice-cell-progress.js +121 -0
- package/dist/components/table/snice-cell-progress.js.map +1 -0
- package/dist/components/table/snice-cell-rating.d.ts +17 -0
- package/dist/components/table/snice-cell-rating.js +120 -0
- package/dist/components/table/snice-cell-rating.js.map +1 -0
- package/dist/components/table/snice-cell-sparkline.d.ts +29 -0
- package/dist/components/table/snice-cell-sparkline.js +306 -0
- package/dist/components/table/snice-cell-sparkline.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +19 -0
- package/dist/components/table/snice-cell-text.js +161 -0
- package/dist/components/table/snice-cell-text.js.map +1 -0
- package/dist/components/table/snice-cell.d.ts +32 -0
- package/dist/components/table/snice-cell.js +458 -0
- package/dist/components/table/snice-cell.js.map +1 -0
- package/dist/components/table/snice-column.d.ts +62 -0
- package/dist/components/table/snice-column.js +506 -0
- package/dist/components/table/snice-column.js.map +1 -0
- package/dist/components/table/snice-header.d.ts +33 -0
- package/dist/components/table/snice-header.js +289 -0
- package/dist/components/table/snice-header.js.map +1 -0
- package/dist/components/table/snice-progress.d.ts +10 -0
- package/dist/components/table/snice-progress.js +105 -0
- package/dist/components/table/snice-progress.js.map +1 -0
- package/dist/components/table/snice-rating.d.ts +9 -0
- package/dist/components/table/snice-rating.js +81 -0
- package/dist/components/table/snice-rating.js.map +1 -0
- package/dist/components/table/snice-row.d.ts +43 -0
- package/dist/components/table/snice-row.js +353 -0
- package/dist/components/table/snice-row.js.map +1 -0
- package/dist/components/table/snice-table.d.ts +69 -0
- package/dist/components/table/snice-table.js +792 -0
- package/dist/components/table/snice-table.js.map +1 -0
- package/dist/components/table/snice-table.types.d.ts +137 -0
- package/dist/components/tabs/snice-tab-panel.d.ts +12 -0
- package/dist/components/tabs/snice-tab-panel.js +87 -0
- package/dist/components/tabs/snice-tab-panel.js.map +1 -0
- package/dist/components/tabs/snice-tab.d.ts +13 -0
- package/dist/components/tabs/snice-tab.js +98 -0
- package/dist/components/tabs/snice-tab.js.map +1 -0
- package/dist/components/tabs/snice-tabs.d.ts +34 -0
- package/dist/components/tabs/snice-tabs.js +375 -0
- package/dist/components/tabs/snice-tabs.js.map +1 -0
- package/dist/components/tabs/snice-tabs.types.d.ts +23 -0
- package/dist/components/toast/snice-toast-container.d.ts +25 -0
- package/dist/components/toast/snice-toast-container.js +252 -0
- package/dist/components/toast/snice-toast-container.js.map +1 -0
- package/dist/components/toast/snice-toast.d.ts +23 -0
- package/dist/components/toast/snice-toast.js +321 -0
- package/dist/components/toast/snice-toast.js.map +1 -0
- package/dist/components/toast/snice-toast.types.d.ts +30 -0
- package/dist/components/tooltip/snice-tooltip.d.ts +50 -0
- package/dist/components/tooltip/snice-tooltip.js +644 -0
- package/dist/components/tooltip/snice-tooltip.js.map +1 -0
- package/dist/components/tooltip/snice-tooltip.types.d.ts +18 -0
- package/dist/components/transitions.d.ts +11 -0
- package/dist/components/transitions.js +72 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +10 -6
- package/components/accordion/demo.html +0 -403
- package/components/accordion/snice-accordion-item.css +0 -85
- package/components/accordion/snice-accordion-item.ts +0 -226
- package/components/accordion/snice-accordion.css +0 -31
- package/components/accordion/snice-accordion.ts +0 -182
- package/components/accordion/snice-accordion.types.ts +0 -32
- package/components/alert/demo.html +0 -445
- package/components/alert/snice-alert.css +0 -195
- package/components/alert/snice-alert.ts +0 -141
- package/components/avatar/demo.html +0 -598
- package/components/avatar/snice-avatar.css +0 -131
- package/components/avatar/snice-avatar.ts +0 -136
- package/components/avatar/snice-avatar.types.ts +0 -13
- package/components/badge/demo.html +0 -523
- package/components/badge/snice-badge.css +0 -161
- package/components/badge/snice-badge.ts +0 -117
- package/components/breadcrumbs/demo.html +0 -404
- package/components/breadcrumbs/snice-breadcrumbs.css +0 -133
- package/components/breadcrumbs/snice-breadcrumbs.ts +0 -191
- package/components/breadcrumbs/snice-breadcrumbs.types.ts +0 -26
- package/components/breadcrumbs/snice-crumb.ts +0 -26
- package/components/button/demo.html +0 -42
- package/components/button/snice-button.css +0 -230
- package/components/button/snice-button.ts +0 -169
- package/components/button/snice-button.types.ts +0 -25
- package/components/card/demo.html +0 -525
- package/components/card/snice-card.css +0 -140
- package/components/card/snice-card.ts +0 -102
- package/components/checkbox/demo.html +0 -253
- package/components/checkbox/snice-checkbox.css +0 -164
- package/components/checkbox/snice-checkbox.ts +0 -223
- package/components/checkbox/snice-checkbox.types.ts +0 -22
- package/components/chip/demo.html +0 -383
- package/components/chip/snice-chip.css +0 -195
- package/components/chip/snice-chip.ts +0 -139
- package/components/chip/snice-chip.types.ts +0 -15
- package/components/date-picker/README.md +0 -233
- package/components/date-picker/demo.html +0 -191
- package/components/date-picker/snice-date-picker.css +0 -330
- package/components/date-picker/snice-date-picker.ts +0 -777
- package/components/date-picker/snice-date-picker.types.ts +0 -83
- package/components/divider/demo.html +0 -233
- package/components/divider/snice-divider.css +0 -155
- package/components/divider/snice-divider.ts +0 -69
- package/components/drawer/demo.html +0 -328
- package/components/drawer/snice-drawer.css +0 -476
- package/components/drawer/snice-drawer.ts +0 -287
- package/components/drawer/snice-drawer.types.ts +0 -17
- package/components/global.d.ts +0 -14
- package/components/input/demo.html +0 -303
- package/components/input/snice-input.css +0 -257
- package/components/input/snice-input.ts +0 -442
- package/components/input/snice-input.types.ts +0 -59
- package/components/input/test.html +0 -77
- package/components/layout/README.md +0 -260
- package/components/layout/demo.html +0 -538
- package/components/layout/snice-layout-blog.css +0 -129
- package/components/layout/snice-layout-blog.ts +0 -48
- package/components/layout/snice-layout-card.css +0 -104
- package/components/layout/snice-layout-card.ts +0 -35
- package/components/layout/snice-layout-centered.css +0 -51
- package/components/layout/snice-layout-centered.ts +0 -22
- package/components/layout/snice-layout-dashboard.css +0 -98
- package/components/layout/snice-layout-dashboard.ts +0 -45
- package/components/layout/snice-layout-fullscreen.css +0 -72
- package/components/layout/snice-layout-fullscreen.ts +0 -34
- package/components/layout/snice-layout-landing.css +0 -92
- package/components/layout/snice-layout-landing.ts +0 -47
- package/components/layout/snice-layout-minimal.css +0 -16
- package/components/layout/snice-layout-minimal.ts +0 -19
- package/components/layout/snice-layout-sidebar.css +0 -117
- package/components/layout/snice-layout-sidebar.ts +0 -48
- package/components/layout/snice-layout-split.css +0 -103
- package/components/layout/snice-layout-split.ts +0 -29
- package/components/layout/snice-layout.css +0 -72
- package/components/layout/snice-layout.ts +0 -35
- package/components/login/demo-auth-controller.ts +0 -185
- package/components/login/demo.html +0 -470
- package/components/login/snice-login.css +0 -204
- package/components/login/snice-login.ts +0 -326
- package/components/login/snice-login.types.ts +0 -29
- package/components/modal/demo.html +0 -291
- package/components/modal/snice-modal.css +0 -203
- package/components/modal/snice-modal.ts +0 -233
- package/components/modal/snice-modal.types.ts +0 -21
- package/components/pagination/demo.html +0 -395
- package/components/pagination/snice-pagination.ts +0 -333
- package/components/pagination/snice-pagination.types.ts +0 -21
- package/components/progress/demo.html +0 -510
- package/components/progress/snice-progress.css +0 -267
- package/components/progress/snice-progress.ts +0 -247
- package/components/progress/snice-progress.types.ts +0 -19
- package/components/radio/demo.html +0 -287
- package/components/radio/snice-radio.css +0 -171
- package/components/radio/snice-radio.ts +0 -218
- package/components/radio/snice-radio.types.ts +0 -21
- package/components/select/demo.html +0 -511
- package/components/select/snice-option.ts +0 -52
- package/components/select/snice-select.css +0 -392
- package/components/select/snice-select.ts +0 -796
- package/components/select/snice-select.types.ts +0 -55
- package/components/skeleton/demo.html +0 -514
- package/components/skeleton/snice-skeleton.css +0 -109
- package/components/skeleton/snice-skeleton.ts +0 -126
- package/components/switch/demo.html +0 -284
- package/components/switch/snice-switch.css +0 -221
- package/components/switch/snice-switch.ts +0 -229
- package/components/switch/snice-switch.types.ts +0 -23
- package/components/symbols.ts +0 -23
- package/components/table/demo-table-controller.ts +0 -100
- package/components/table/demo.html +0 -480
- package/components/table/snice-cell-boolean.ts +0 -112
- package/components/table/snice-cell-date.ts +0 -210
- package/components/table/snice-cell-duration.ts +0 -91
- package/components/table/snice-cell-filesize.ts +0 -90
- package/components/table/snice-cell-number.ts +0 -165
- package/components/table/snice-cell-progress.ts +0 -83
- package/components/table/snice-cell-rating.ts +0 -82
- package/components/table/snice-cell-sparkline.ts +0 -253
- package/components/table/snice-cell-text.ts +0 -125
- package/components/table/snice-cell.css +0 -296
- package/components/table/snice-cell.ts +0 -473
- package/components/table/snice-column.ts +0 -353
- package/components/table/snice-header.css +0 -243
- package/components/table/snice-header.ts +0 -261
- package/components/table/snice-progress.ts +0 -66
- package/components/table/snice-rating.ts +0 -45
- package/components/table/snice-row.css +0 -255
- package/components/table/snice-row.ts +0 -331
- package/components/table/snice-table.css +0 -241
- package/components/table/snice-table.ts +0 -737
- package/components/table/snice-table.types.ts +0 -158
- package/components/tabs/demo.html +0 -487
- package/components/tabs/snice-tab-panel.css +0 -264
- package/components/tabs/snice-tab-panel.ts +0 -47
- package/components/tabs/snice-tab.css +0 -96
- package/components/tabs/snice-tab.ts +0 -65
- package/components/tabs/snice-tabs.css +0 -189
- package/components/tabs/snice-tabs.ts +0 -332
- package/components/tabs/snice-tabs.types.ts +0 -28
- package/components/theme/theme.css +0 -234
- package/components/toast/demo.html +0 -329
- package/components/toast/snice-toast-container.ts +0 -256
- package/components/toast/snice-toast.css +0 -213
- package/components/toast/snice-toast.ts +0 -276
- package/components/toast/snice-toast.types.ts +0 -35
- package/components/tooltip/demo.html +0 -350
- package/components/tooltip/snice-tooltip-portal.css +0 -79
- package/components/tooltip/snice-tooltip.css +0 -117
- package/components/tooltip/snice-tooltip.ts +0 -612
- package/components/tooltip/snice-tooltip.types.ts +0 -32
- package/components/transitions.ts +0 -94
- package/components/tsconfig.json +0 -18
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { __runInitializers, __esDecorate } from 'tslib';
|
|
2
|
+
import { element, property, query, queryAll, ready, dispose, on, watch, dispatch } from 'snice';
|
|
3
|
+
import './snice-option.js';
|
|
4
|
+
|
|
5
|
+
var css = '';
|
|
6
|
+
|
|
7
|
+
let SniceSelect = (() => {
|
|
8
|
+
let _classDecorators = [element('snice-select')];
|
|
9
|
+
let _classDescriptor;
|
|
10
|
+
let _classExtraInitializers = [];
|
|
11
|
+
let _classThis;
|
|
12
|
+
let _classSuper = HTMLElement;
|
|
13
|
+
let _instanceExtraInitializers = [];
|
|
14
|
+
let _disabled_decorators;
|
|
15
|
+
let _disabled_initializers = [];
|
|
16
|
+
let _disabled_extraInitializers = [];
|
|
17
|
+
let _required_decorators;
|
|
18
|
+
let _required_initializers = [];
|
|
19
|
+
let _required_extraInitializers = [];
|
|
20
|
+
let _invalid_decorators;
|
|
21
|
+
let _invalid_initializers = [];
|
|
22
|
+
let _invalid_extraInitializers = [];
|
|
23
|
+
let _readonly_decorators;
|
|
24
|
+
let _readonly_initializers = [];
|
|
25
|
+
let _readonly_extraInitializers = [];
|
|
26
|
+
let _multiple_decorators;
|
|
27
|
+
let _multiple_initializers = [];
|
|
28
|
+
let _multiple_extraInitializers = [];
|
|
29
|
+
let _searchable_decorators;
|
|
30
|
+
let _searchable_initializers = [];
|
|
31
|
+
let _searchable_extraInitializers = [];
|
|
32
|
+
let _clearable_decorators;
|
|
33
|
+
let _clearable_initializers = [];
|
|
34
|
+
let _clearable_extraInitializers = [];
|
|
35
|
+
let _open_decorators;
|
|
36
|
+
let _open_initializers = [];
|
|
37
|
+
let _open_extraInitializers = [];
|
|
38
|
+
let _size_decorators;
|
|
39
|
+
let _size_initializers = [];
|
|
40
|
+
let _size_extraInitializers = [];
|
|
41
|
+
let _name_decorators;
|
|
42
|
+
let _name_initializers = [];
|
|
43
|
+
let _name_extraInitializers = [];
|
|
44
|
+
let _value_decorators;
|
|
45
|
+
let _value_initializers = [];
|
|
46
|
+
let _value_extraInitializers = [];
|
|
47
|
+
let _label_decorators;
|
|
48
|
+
let _label_initializers = [];
|
|
49
|
+
let _label_extraInitializers = [];
|
|
50
|
+
let _placeholder_decorators;
|
|
51
|
+
let _placeholder_initializers = [];
|
|
52
|
+
let _placeholder_extraInitializers = [];
|
|
53
|
+
let _maxHeight_decorators;
|
|
54
|
+
let _maxHeight_initializers = [];
|
|
55
|
+
let _maxHeight_extraInitializers = [];
|
|
56
|
+
let _trigger_decorators;
|
|
57
|
+
let _trigger_initializers = [];
|
|
58
|
+
let _trigger_extraInitializers = [];
|
|
59
|
+
let _dropdown_decorators;
|
|
60
|
+
let _dropdown_initializers = [];
|
|
61
|
+
let _dropdown_extraInitializers = [];
|
|
62
|
+
let _valueDisplay_decorators;
|
|
63
|
+
let _valueDisplay_initializers = [];
|
|
64
|
+
let _valueDisplay_extraInitializers = [];
|
|
65
|
+
let _labelElement_decorators;
|
|
66
|
+
let _labelElement_initializers = [];
|
|
67
|
+
let _labelElement_extraInitializers = [];
|
|
68
|
+
let _searchInput_decorators;
|
|
69
|
+
let _searchInput_initializers = [];
|
|
70
|
+
let _searchInput_extraInitializers = [];
|
|
71
|
+
let _optionsList_decorators;
|
|
72
|
+
let _optionsList_initializers = [];
|
|
73
|
+
let _optionsList_extraInitializers = [];
|
|
74
|
+
let _nativeSelect_decorators;
|
|
75
|
+
let _nativeSelect_initializers = [];
|
|
76
|
+
let _nativeSelect_extraInitializers = [];
|
|
77
|
+
let _clearButton_decorators;
|
|
78
|
+
let _clearButton_initializers = [];
|
|
79
|
+
let _clearButton_extraInitializers = [];
|
|
80
|
+
let _arrow_decorators;
|
|
81
|
+
let _arrow_initializers = [];
|
|
82
|
+
let _arrow_extraInitializers = [];
|
|
83
|
+
let _searchContainer_decorators;
|
|
84
|
+
let _searchContainer_initializers = [];
|
|
85
|
+
let _searchContainer_extraInitializers = [];
|
|
86
|
+
let _optionElements_decorators;
|
|
87
|
+
let _optionElements_initializers = [];
|
|
88
|
+
let _optionElements_extraInitializers = [];
|
|
89
|
+
let _init_decorators;
|
|
90
|
+
let _cleanup_decorators;
|
|
91
|
+
let _handleTriggerOpen_decorators;
|
|
92
|
+
let _handleSearchEscape_decorators;
|
|
93
|
+
let _handleSearchArrowDown_decorators;
|
|
94
|
+
let _handleSearchArrowUp_decorators;
|
|
95
|
+
let _handleSearchEnter_decorators;
|
|
96
|
+
let _handleTriggerClick_decorators;
|
|
97
|
+
let _handleClearClick_decorators;
|
|
98
|
+
let _handleTagRemove_decorators;
|
|
99
|
+
let _handleOptionsClick_decorators;
|
|
100
|
+
let _handleSearchInput_decorators;
|
|
101
|
+
let _handleValueChange_decorators;
|
|
102
|
+
let _handleDisabledChange_decorators;
|
|
103
|
+
let _handleReadonlyChange_decorators;
|
|
104
|
+
let _handleInvalidChange_decorators;
|
|
105
|
+
let _handleOpenChange_decorators;
|
|
106
|
+
let _handleLabelChange_decorators;
|
|
107
|
+
let _handlePlaceholderChange_decorators;
|
|
108
|
+
let _handleRequiredChange_decorators;
|
|
109
|
+
let _handleMultipleChange_decorators;
|
|
110
|
+
let _handleNameChange_decorators;
|
|
111
|
+
let _handleClearableChange_decorators;
|
|
112
|
+
let _handleSearchableChange_decorators;
|
|
113
|
+
let _dispatchChangeEvent_decorators;
|
|
114
|
+
let _dispatchOpenEvent_decorators;
|
|
115
|
+
let _dispatchCloseEvent_decorators;
|
|
116
|
+
(class extends _classSuper {
|
|
117
|
+
static { _classThis = this; }
|
|
118
|
+
constructor() {
|
|
119
|
+
super(...arguments);
|
|
120
|
+
this.disabled = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
121
|
+
this.required = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _required_initializers, false));
|
|
122
|
+
this.invalid = (__runInitializers(this, _required_extraInitializers), __runInitializers(this, _invalid_initializers, false));
|
|
123
|
+
this.readonly = (__runInitializers(this, _invalid_extraInitializers), __runInitializers(this, _readonly_initializers, false));
|
|
124
|
+
this.multiple = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _multiple_initializers, false));
|
|
125
|
+
this.searchable = (__runInitializers(this, _multiple_extraInitializers), __runInitializers(this, _searchable_initializers, false));
|
|
126
|
+
this.clearable = (__runInitializers(this, _searchable_extraInitializers), __runInitializers(this, _clearable_initializers, false));
|
|
127
|
+
this.open = (__runInitializers(this, _clearable_extraInitializers), __runInitializers(this, _open_initializers, false));
|
|
128
|
+
this.size = (__runInitializers(this, _open_extraInitializers), __runInitializers(this, _size_initializers, 'medium'));
|
|
129
|
+
this.name = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _name_initializers, ''));
|
|
130
|
+
this.value = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _value_initializers, ''));
|
|
131
|
+
this.label = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _label_initializers, ''));
|
|
132
|
+
this.placeholder = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _placeholder_initializers, 'Select an option'));
|
|
133
|
+
this.maxHeight = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _maxHeight_initializers, '200px'));
|
|
134
|
+
// Options will be read from child snice-option elements
|
|
135
|
+
this.options = (__runInitializers(this, _maxHeight_extraInitializers), []);
|
|
136
|
+
this.trigger = __runInitializers(this, _trigger_initializers, void 0);
|
|
137
|
+
this.dropdown = (__runInitializers(this, _trigger_extraInitializers), __runInitializers(this, _dropdown_initializers, void 0));
|
|
138
|
+
this.valueDisplay = (__runInitializers(this, _dropdown_extraInitializers), __runInitializers(this, _valueDisplay_initializers, void 0));
|
|
139
|
+
this.labelElement = (__runInitializers(this, _valueDisplay_extraInitializers), __runInitializers(this, _labelElement_initializers, void 0));
|
|
140
|
+
this.searchInput = (__runInitializers(this, _labelElement_extraInitializers), __runInitializers(this, _searchInput_initializers, void 0));
|
|
141
|
+
this.optionsList = (__runInitializers(this, _searchInput_extraInitializers), __runInitializers(this, _optionsList_initializers, void 0));
|
|
142
|
+
this.nativeSelect = (__runInitializers(this, _optionsList_extraInitializers), __runInitializers(this, _nativeSelect_initializers, void 0));
|
|
143
|
+
this.clearButton = (__runInitializers(this, _nativeSelect_extraInitializers), __runInitializers(this, _clearButton_initializers, void 0));
|
|
144
|
+
this.arrow = (__runInitializers(this, _clearButton_extraInitializers), __runInitializers(this, _arrow_initializers, void 0));
|
|
145
|
+
this.searchContainer = (__runInitializers(this, _arrow_extraInitializers), __runInitializers(this, _searchContainer_initializers, void 0));
|
|
146
|
+
this.optionElements = (__runInitializers(this, _searchContainer_extraInitializers), __runInitializers(this, _optionElements_initializers, void 0));
|
|
147
|
+
this.filteredOptions = (__runInitializers(this, _optionElements_extraInitializers), []);
|
|
148
|
+
this.selectedValues = new Set();
|
|
149
|
+
this.focusedIndex = -1;
|
|
150
|
+
}
|
|
151
|
+
static {
|
|
152
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
153
|
+
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
154
|
+
_required_decorators = [property({ type: Boolean, reflect: true })];
|
|
155
|
+
_invalid_decorators = [property({ type: Boolean, reflect: true })];
|
|
156
|
+
_readonly_decorators = [property({ type: Boolean, reflect: true })];
|
|
157
|
+
_multiple_decorators = [property({ type: Boolean, reflect: true })];
|
|
158
|
+
_searchable_decorators = [property({ type: Boolean, reflect: true })];
|
|
159
|
+
_clearable_decorators = [property({ type: Boolean, reflect: true })];
|
|
160
|
+
_open_decorators = [property({ type: Boolean, reflect: true })];
|
|
161
|
+
_size_decorators = [property({ reflect: true })];
|
|
162
|
+
_name_decorators = [property({ reflect: true })];
|
|
163
|
+
_value_decorators = [property({ reflect: true })];
|
|
164
|
+
_label_decorators = [property({ reflect: true })];
|
|
165
|
+
_placeholder_decorators = [property({ reflect: true })];
|
|
166
|
+
_maxHeight_decorators = [property({ reflect: true, attribute: 'max-height' })];
|
|
167
|
+
_trigger_decorators = [query('.select-trigger')];
|
|
168
|
+
_dropdown_decorators = [query('.select-dropdown')];
|
|
169
|
+
_valueDisplay_decorators = [query('.select-value')];
|
|
170
|
+
_labelElement_decorators = [query('.select-label')];
|
|
171
|
+
_searchInput_decorators = [query('.select-search-input')];
|
|
172
|
+
_optionsList_decorators = [query('.select-options')];
|
|
173
|
+
_nativeSelect_decorators = [query('.select-native')];
|
|
174
|
+
_clearButton_decorators = [query('.select-clear')];
|
|
175
|
+
_arrow_decorators = [query('.select-arrow')];
|
|
176
|
+
_searchContainer_decorators = [query('.select-search')];
|
|
177
|
+
_optionElements_decorators = [queryAll('.select-option')];
|
|
178
|
+
_init_decorators = [ready()];
|
|
179
|
+
_cleanup_decorators = [dispose()];
|
|
180
|
+
_handleTriggerOpen_decorators = [on(['keydown:Enter', 'keydown:Space', 'keydown:ArrowDown', 'keydown:ArrowUp'], '.select-trigger')];
|
|
181
|
+
_handleSearchEscape_decorators = [on('keydown:Escape', '.select-search-input')];
|
|
182
|
+
_handleSearchArrowDown_decorators = [on('keydown:ArrowDown', '.select-search-input')];
|
|
183
|
+
_handleSearchArrowUp_decorators = [on('keydown:ArrowUp', '.select-search-input')];
|
|
184
|
+
_handleSearchEnter_decorators = [on('keydown:Enter', '.select-search-input')];
|
|
185
|
+
_handleTriggerClick_decorators = [on('click', '.select-trigger')];
|
|
186
|
+
_handleClearClick_decorators = [on('click', '.select-clear', { preventDefault: true, stopPropagation: true })];
|
|
187
|
+
_handleTagRemove_decorators = [on('click', '.select-tag-remove')];
|
|
188
|
+
_handleOptionsClick_decorators = [on('click', '.select-options')];
|
|
189
|
+
_handleSearchInput_decorators = [on('input', '.select-search-input')];
|
|
190
|
+
_handleValueChange_decorators = [watch('value')];
|
|
191
|
+
_handleDisabledChange_decorators = [watch('disabled')];
|
|
192
|
+
_handleReadonlyChange_decorators = [watch('readonly')];
|
|
193
|
+
_handleInvalidChange_decorators = [watch('invalid')];
|
|
194
|
+
_handleOpenChange_decorators = [watch('open')];
|
|
195
|
+
_handleLabelChange_decorators = [watch('label')];
|
|
196
|
+
_handlePlaceholderChange_decorators = [watch('placeholder')];
|
|
197
|
+
_handleRequiredChange_decorators = [watch('required')];
|
|
198
|
+
_handleMultipleChange_decorators = [watch('multiple')];
|
|
199
|
+
_handleNameChange_decorators = [watch('name')];
|
|
200
|
+
_handleClearableChange_decorators = [watch('clearable')];
|
|
201
|
+
_handleSearchableChange_decorators = [watch('searchable')];
|
|
202
|
+
_dispatchChangeEvent_decorators = [dispatch('@snice/select-change', { bubbles: true, composed: true })];
|
|
203
|
+
_dispatchOpenEvent_decorators = [dispatch('@snice/select-open', { bubbles: true, composed: true })];
|
|
204
|
+
_dispatchCloseEvent_decorators = [dispatch('@snice/select-close', { bubbles: true, composed: true })];
|
|
205
|
+
__esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
206
|
+
__esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
207
|
+
__esDecorate(this, null, _handleTriggerOpen_decorators, { kind: "method", name: "handleTriggerOpen", static: false, private: false, access: { has: obj => "handleTriggerOpen" in obj, get: obj => obj.handleTriggerOpen }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
208
|
+
__esDecorate(this, null, _handleSearchEscape_decorators, { kind: "method", name: "handleSearchEscape", static: false, private: false, access: { has: obj => "handleSearchEscape" in obj, get: obj => obj.handleSearchEscape }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
209
|
+
__esDecorate(this, null, _handleSearchArrowDown_decorators, { kind: "method", name: "handleSearchArrowDown", static: false, private: false, access: { has: obj => "handleSearchArrowDown" in obj, get: obj => obj.handleSearchArrowDown }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
210
|
+
__esDecorate(this, null, _handleSearchArrowUp_decorators, { kind: "method", name: "handleSearchArrowUp", static: false, private: false, access: { has: obj => "handleSearchArrowUp" in obj, get: obj => obj.handleSearchArrowUp }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
211
|
+
__esDecorate(this, null, _handleSearchEnter_decorators, { kind: "method", name: "handleSearchEnter", static: false, private: false, access: { has: obj => "handleSearchEnter" in obj, get: obj => obj.handleSearchEnter }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
212
|
+
__esDecorate(this, null, _handleTriggerClick_decorators, { kind: "method", name: "handleTriggerClick", static: false, private: false, access: { has: obj => "handleTriggerClick" in obj, get: obj => obj.handleTriggerClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
213
|
+
__esDecorate(this, null, _handleClearClick_decorators, { kind: "method", name: "handleClearClick", static: false, private: false, access: { has: obj => "handleClearClick" in obj, get: obj => obj.handleClearClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
214
|
+
__esDecorate(this, null, _handleTagRemove_decorators, { kind: "method", name: "handleTagRemove", static: false, private: false, access: { has: obj => "handleTagRemove" in obj, get: obj => obj.handleTagRemove }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
215
|
+
__esDecorate(this, null, _handleOptionsClick_decorators, { kind: "method", name: "handleOptionsClick", static: false, private: false, access: { has: obj => "handleOptionsClick" in obj, get: obj => obj.handleOptionsClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
216
|
+
__esDecorate(this, null, _handleSearchInput_decorators, { kind: "method", name: "handleSearchInput", static: false, private: false, access: { has: obj => "handleSearchInput" in obj, get: obj => obj.handleSearchInput }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
217
|
+
__esDecorate(this, null, _handleValueChange_decorators, { kind: "method", name: "handleValueChange", static: false, private: false, access: { has: obj => "handleValueChange" in obj, get: obj => obj.handleValueChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
218
|
+
__esDecorate(this, null, _handleDisabledChange_decorators, { kind: "method", name: "handleDisabledChange", static: false, private: false, access: { has: obj => "handleDisabledChange" in obj, get: obj => obj.handleDisabledChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
219
|
+
__esDecorate(this, null, _handleReadonlyChange_decorators, { kind: "method", name: "handleReadonlyChange", static: false, private: false, access: { has: obj => "handleReadonlyChange" in obj, get: obj => obj.handleReadonlyChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
220
|
+
__esDecorate(this, null, _handleInvalidChange_decorators, { kind: "method", name: "handleInvalidChange", static: false, private: false, access: { has: obj => "handleInvalidChange" in obj, get: obj => obj.handleInvalidChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
221
|
+
__esDecorate(this, null, _handleOpenChange_decorators, { kind: "method", name: "handleOpenChange", static: false, private: false, access: { has: obj => "handleOpenChange" in obj, get: obj => obj.handleOpenChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
222
|
+
__esDecorate(this, null, _handleLabelChange_decorators, { kind: "method", name: "handleLabelChange", static: false, private: false, access: { has: obj => "handleLabelChange" in obj, get: obj => obj.handleLabelChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
223
|
+
__esDecorate(this, null, _handlePlaceholderChange_decorators, { kind: "method", name: "handlePlaceholderChange", static: false, private: false, access: { has: obj => "handlePlaceholderChange" in obj, get: obj => obj.handlePlaceholderChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
224
|
+
__esDecorate(this, null, _handleRequiredChange_decorators, { kind: "method", name: "handleRequiredChange", static: false, private: false, access: { has: obj => "handleRequiredChange" in obj, get: obj => obj.handleRequiredChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
225
|
+
__esDecorate(this, null, _handleMultipleChange_decorators, { kind: "method", name: "handleMultipleChange", static: false, private: false, access: { has: obj => "handleMultipleChange" in obj, get: obj => obj.handleMultipleChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
226
|
+
__esDecorate(this, null, _handleNameChange_decorators, { kind: "method", name: "handleNameChange", static: false, private: false, access: { has: obj => "handleNameChange" in obj, get: obj => obj.handleNameChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
227
|
+
__esDecorate(this, null, _handleClearableChange_decorators, { kind: "method", name: "handleClearableChange", static: false, private: false, access: { has: obj => "handleClearableChange" in obj, get: obj => obj.handleClearableChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
228
|
+
__esDecorate(this, null, _handleSearchableChange_decorators, { kind: "method", name: "handleSearchableChange", static: false, private: false, access: { has: obj => "handleSearchableChange" in obj, get: obj => obj.handleSearchableChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
229
|
+
__esDecorate(this, null, _dispatchChangeEvent_decorators, { kind: "method", name: "dispatchChangeEvent", static: false, private: false, access: { has: obj => "dispatchChangeEvent" in obj, get: obj => obj.dispatchChangeEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
230
|
+
__esDecorate(this, null, _dispatchOpenEvent_decorators, { kind: "method", name: "dispatchOpenEvent", static: false, private: false, access: { has: obj => "dispatchOpenEvent" in obj, get: obj => obj.dispatchOpenEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
231
|
+
__esDecorate(this, null, _dispatchCloseEvent_decorators, { kind: "method", name: "dispatchCloseEvent", static: false, private: false, access: { has: obj => "dispatchCloseEvent" in obj, get: obj => obj.dispatchCloseEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
232
|
+
__esDecorate(null, null, _disabled_decorators, { kind: "field", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
|
|
233
|
+
__esDecorate(null, null, _required_decorators, { kind: "field", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
|
|
234
|
+
__esDecorate(null, null, _invalid_decorators, { kind: "field", name: "invalid", static: false, private: false, access: { has: obj => "invalid" in obj, get: obj => obj.invalid, set: (obj, value) => { obj.invalid = value; } }, metadata: _metadata }, _invalid_initializers, _invalid_extraInitializers);
|
|
235
|
+
__esDecorate(null, null, _readonly_decorators, { kind: "field", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
|
|
236
|
+
__esDecorate(null, null, _multiple_decorators, { kind: "field", name: "multiple", static: false, private: false, access: { has: obj => "multiple" in obj, get: obj => obj.multiple, set: (obj, value) => { obj.multiple = value; } }, metadata: _metadata }, _multiple_initializers, _multiple_extraInitializers);
|
|
237
|
+
__esDecorate(null, null, _searchable_decorators, { kind: "field", name: "searchable", static: false, private: false, access: { has: obj => "searchable" in obj, get: obj => obj.searchable, set: (obj, value) => { obj.searchable = value; } }, metadata: _metadata }, _searchable_initializers, _searchable_extraInitializers);
|
|
238
|
+
__esDecorate(null, null, _clearable_decorators, { kind: "field", name: "clearable", static: false, private: false, access: { has: obj => "clearable" in obj, get: obj => obj.clearable, set: (obj, value) => { obj.clearable = value; } }, metadata: _metadata }, _clearable_initializers, _clearable_extraInitializers);
|
|
239
|
+
__esDecorate(null, null, _open_decorators, { kind: "field", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
|
|
240
|
+
__esDecorate(null, null, _size_decorators, { kind: "field", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
|
|
241
|
+
__esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
242
|
+
__esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
243
|
+
__esDecorate(null, null, _label_decorators, { kind: "field", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
244
|
+
__esDecorate(null, null, _placeholder_decorators, { kind: "field", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
245
|
+
__esDecorate(null, null, _maxHeight_decorators, { kind: "field", name: "maxHeight", static: false, private: false, access: { has: obj => "maxHeight" in obj, get: obj => obj.maxHeight, set: (obj, value) => { obj.maxHeight = value; } }, metadata: _metadata }, _maxHeight_initializers, _maxHeight_extraInitializers);
|
|
246
|
+
__esDecorate(null, null, _trigger_decorators, { kind: "field", name: "trigger", static: false, private: false, access: { has: obj => "trigger" in obj, get: obj => obj.trigger, set: (obj, value) => { obj.trigger = value; } }, metadata: _metadata }, _trigger_initializers, _trigger_extraInitializers);
|
|
247
|
+
__esDecorate(null, null, _dropdown_decorators, { kind: "field", name: "dropdown", static: false, private: false, access: { has: obj => "dropdown" in obj, get: obj => obj.dropdown, set: (obj, value) => { obj.dropdown = value; } }, metadata: _metadata }, _dropdown_initializers, _dropdown_extraInitializers);
|
|
248
|
+
__esDecorate(null, null, _valueDisplay_decorators, { kind: "field", name: "valueDisplay", static: false, private: false, access: { has: obj => "valueDisplay" in obj, get: obj => obj.valueDisplay, set: (obj, value) => { obj.valueDisplay = value; } }, metadata: _metadata }, _valueDisplay_initializers, _valueDisplay_extraInitializers);
|
|
249
|
+
__esDecorate(null, null, _labelElement_decorators, { kind: "field", name: "labelElement", static: false, private: false, access: { has: obj => "labelElement" in obj, get: obj => obj.labelElement, set: (obj, value) => { obj.labelElement = value; } }, metadata: _metadata }, _labelElement_initializers, _labelElement_extraInitializers);
|
|
250
|
+
__esDecorate(null, null, _searchInput_decorators, { kind: "field", name: "searchInput", static: false, private: false, access: { has: obj => "searchInput" in obj, get: obj => obj.searchInput, set: (obj, value) => { obj.searchInput = value; } }, metadata: _metadata }, _searchInput_initializers, _searchInput_extraInitializers);
|
|
251
|
+
__esDecorate(null, null, _optionsList_decorators, { kind: "field", name: "optionsList", static: false, private: false, access: { has: obj => "optionsList" in obj, get: obj => obj.optionsList, set: (obj, value) => { obj.optionsList = value; } }, metadata: _metadata }, _optionsList_initializers, _optionsList_extraInitializers);
|
|
252
|
+
__esDecorate(null, null, _nativeSelect_decorators, { kind: "field", name: "nativeSelect", static: false, private: false, access: { has: obj => "nativeSelect" in obj, get: obj => obj.nativeSelect, set: (obj, value) => { obj.nativeSelect = value; } }, metadata: _metadata }, _nativeSelect_initializers, _nativeSelect_extraInitializers);
|
|
253
|
+
__esDecorate(null, null, _clearButton_decorators, { kind: "field", name: "clearButton", static: false, private: false, access: { has: obj => "clearButton" in obj, get: obj => obj.clearButton, set: (obj, value) => { obj.clearButton = value; } }, metadata: _metadata }, _clearButton_initializers, _clearButton_extraInitializers);
|
|
254
|
+
__esDecorate(null, null, _arrow_decorators, { kind: "field", name: "arrow", static: false, private: false, access: { has: obj => "arrow" in obj, get: obj => obj.arrow, set: (obj, value) => { obj.arrow = value; } }, metadata: _metadata }, _arrow_initializers, _arrow_extraInitializers);
|
|
255
|
+
__esDecorate(null, null, _searchContainer_decorators, { kind: "field", name: "searchContainer", static: false, private: false, access: { has: obj => "searchContainer" in obj, get: obj => obj.searchContainer, set: (obj, value) => { obj.searchContainer = value; } }, metadata: _metadata }, _searchContainer_initializers, _searchContainer_extraInitializers);
|
|
256
|
+
__esDecorate(null, null, _optionElements_decorators, { kind: "field", name: "optionElements", static: false, private: false, access: { has: obj => "optionElements" in obj, get: obj => obj.optionElements, set: (obj, value) => { obj.optionElements = value; } }, metadata: _metadata }, _optionElements_initializers, _optionElements_extraInitializers);
|
|
257
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
258
|
+
_classThis = _classDescriptor.value;
|
|
259
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
260
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
261
|
+
}
|
|
262
|
+
html() {
|
|
263
|
+
// Initial render - options will be populated in @ready()
|
|
264
|
+
return /*html*/ `
|
|
265
|
+
<div class="select-wrapper">
|
|
266
|
+
<label class="select-label select-label--${this.size} ${this.required ? 'select-label--required' : ''}" part="label" ${!this.label ? 'hidden' : ''}>
|
|
267
|
+
${this.label}
|
|
268
|
+
</label>
|
|
269
|
+
|
|
270
|
+
<button
|
|
271
|
+
type="button"
|
|
272
|
+
class="select-trigger select-trigger--${this.size}"
|
|
273
|
+
aria-haspopup="listbox"
|
|
274
|
+
aria-expanded="false"
|
|
275
|
+
aria-label="${this.label || 'Select'}"
|
|
276
|
+
part="trigger">
|
|
277
|
+
|
|
278
|
+
<div class="select-value" part="value">
|
|
279
|
+
<span class="select-placeholder">${this.placeholder}</span>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<span class="select-icons">
|
|
283
|
+
<span class="select-clear" aria-label="Clear selection" style="display: none;">
|
|
284
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
|
|
285
|
+
<path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"/>
|
|
286
|
+
</svg>
|
|
287
|
+
</span>
|
|
288
|
+
<span class="select-arrow">
|
|
289
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor">
|
|
290
|
+
<path d="M6 9L1 4h10L6 9z"/>
|
|
291
|
+
</svg>
|
|
292
|
+
</span>
|
|
293
|
+
</span>
|
|
294
|
+
</button>
|
|
295
|
+
|
|
296
|
+
<div class="select-dropdown"
|
|
297
|
+
role="listbox"
|
|
298
|
+
aria-label="${this.label || 'Options'}"
|
|
299
|
+
part="dropdown">
|
|
300
|
+
|
|
301
|
+
<div class="select-search" part="search" ${!this.searchable ? 'hidden' : ''}>
|
|
302
|
+
<input
|
|
303
|
+
type="text"
|
|
304
|
+
class="select-search-input"
|
|
305
|
+
placeholder="Search..."
|
|
306
|
+
aria-label="Search options"
|
|
307
|
+
part="search-input" />
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div class="select-options" part="options">
|
|
311
|
+
<!-- Options will be rendered in @ready() -->
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<!-- Hidden native select for form submission -->
|
|
316
|
+
<select
|
|
317
|
+
class="select-native"
|
|
318
|
+
name="${this.name || ''}"
|
|
319
|
+
tabindex="-1"
|
|
320
|
+
aria-hidden="true">
|
|
321
|
+
<!-- Options will be added in @ready() -->
|
|
322
|
+
</select>
|
|
323
|
+
</div>
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
renderOptions() {
|
|
327
|
+
const options = this.searchable ? this.filteredOptions : this.options;
|
|
328
|
+
if (options.length === 0) {
|
|
329
|
+
return /*html*/ `
|
|
330
|
+
<div class="select-no-options">
|
|
331
|
+
<span class="select-no-options-text" data-search="true" ${!this.searchable || this.filteredOptions.length > 0 ? 'hidden' : ''}>No matches found</span>
|
|
332
|
+
<span class="select-no-options-text" data-search="false" ${this.searchable && this.filteredOptions.length === 0 ? 'hidden' : ''}>No options available</span>
|
|
333
|
+
</div>
|
|
334
|
+
`;
|
|
335
|
+
}
|
|
336
|
+
return options.map((opt, index) => {
|
|
337
|
+
const isSelected = this.multiple ?
|
|
338
|
+
this.selectedValues.has(opt.value) :
|
|
339
|
+
opt.value === this.value;
|
|
340
|
+
return /*html*/ `
|
|
341
|
+
<div class="select-option
|
|
342
|
+
${isSelected ? 'select-option--selected' : ''}
|
|
343
|
+
${opt.disabled ? 'select-option--disabled' : ''}
|
|
344
|
+
${index === this.focusedIndex ? 'select-option--focused' : ''}
|
|
345
|
+
${opt.icon ? 'select-option--has-icon' : ''}"
|
|
346
|
+
data-value="${opt.value}"
|
|
347
|
+
role="option"
|
|
348
|
+
aria-selected="${isSelected}"
|
|
349
|
+
aria-disabled="${opt.disabled}"
|
|
350
|
+
part="option">
|
|
351
|
+
<span class="select-option-check" ${!this.multiple ? 'hidden' : ''}>
|
|
352
|
+
<span class="select-option-check-mark" ${!isSelected ? 'hidden' : ''}>✓</span>
|
|
353
|
+
</span>
|
|
354
|
+
<img class="select-option-icon" src="${opt.icon || ''}" alt="" ${!opt.icon ? 'hidden' : ''} />
|
|
355
|
+
<span class="select-option-label">${opt.label}</span>
|
|
356
|
+
</div>
|
|
357
|
+
`;
|
|
358
|
+
}).join('');
|
|
359
|
+
}
|
|
360
|
+
css() {
|
|
361
|
+
return css;
|
|
362
|
+
}
|
|
363
|
+
init() {
|
|
364
|
+
// Read options from child snice-option elements
|
|
365
|
+
this.readOptionsFromChildren();
|
|
366
|
+
// Initialize selected values
|
|
367
|
+
if (this.multiple && this.value) {
|
|
368
|
+
this.selectedValues = new Set(this.value.split(',').map(v => v.trim()));
|
|
369
|
+
}
|
|
370
|
+
// Initialize filtered options
|
|
371
|
+
this.filteredOptions = [...this.options];
|
|
372
|
+
// Set initial imperative state
|
|
373
|
+
this.updateTriggerState();
|
|
374
|
+
this.updateDropdownState();
|
|
375
|
+
this.updateNativeSelectAttributes();
|
|
376
|
+
// Now that we have options, update everything
|
|
377
|
+
this.updateDropdownContent();
|
|
378
|
+
this.updateNativeSelect();
|
|
379
|
+
this.updateValueDisplay();
|
|
380
|
+
this.updateClearButton();
|
|
381
|
+
// Watch for changes to child options
|
|
382
|
+
this.observeChildren();
|
|
383
|
+
// Setup global event listeners
|
|
384
|
+
this.setupGlobalListeners();
|
|
385
|
+
}
|
|
386
|
+
cleanup() {
|
|
387
|
+
this.removeGlobalListeners();
|
|
388
|
+
this.childObserver?.disconnect();
|
|
389
|
+
}
|
|
390
|
+
setupGlobalListeners() {
|
|
391
|
+
// Create bound handlers
|
|
392
|
+
this.outsideClickHandler = (e) => {
|
|
393
|
+
if (!this.contains(e.target) && this.open) {
|
|
394
|
+
this.closeDropdown();
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
this.globalKeyHandler = (e) => {
|
|
398
|
+
if (!this.open)
|
|
399
|
+
return;
|
|
400
|
+
switch (e.key) {
|
|
401
|
+
case 'Escape':
|
|
402
|
+
this.closeDropdown();
|
|
403
|
+
this.trigger?.focus();
|
|
404
|
+
break;
|
|
405
|
+
case 'ArrowDown':
|
|
406
|
+
e.preventDefault();
|
|
407
|
+
this.focusNextOption();
|
|
408
|
+
break;
|
|
409
|
+
case 'ArrowUp':
|
|
410
|
+
e.preventDefault();
|
|
411
|
+
this.focusPreviousOption();
|
|
412
|
+
break;
|
|
413
|
+
case 'Enter':
|
|
414
|
+
case ' ':
|
|
415
|
+
e.preventDefault();
|
|
416
|
+
if (this.focusedIndex >= 0) {
|
|
417
|
+
const options = this.searchable ? this.filteredOptions : this.options;
|
|
418
|
+
const option = options[this.focusedIndex];
|
|
419
|
+
if (option && !option.disabled) {
|
|
420
|
+
this.handleOptionSelect(option);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
// Add listeners
|
|
427
|
+
document.addEventListener('click', this.outsideClickHandler);
|
|
428
|
+
document.addEventListener('keydown', this.globalKeyHandler);
|
|
429
|
+
}
|
|
430
|
+
removeGlobalListeners() {
|
|
431
|
+
if (this.outsideClickHandler) {
|
|
432
|
+
document.removeEventListener('click', this.outsideClickHandler);
|
|
433
|
+
}
|
|
434
|
+
if (this.globalKeyHandler) {
|
|
435
|
+
document.removeEventListener('keydown', this.globalKeyHandler);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// Manual observation of light DOM children (snice-option elements)
|
|
439
|
+
observeChildren() {
|
|
440
|
+
const observer = new MutationObserver((mutations) => {
|
|
441
|
+
this.handleChildrenChange(mutations);
|
|
442
|
+
});
|
|
443
|
+
// Observe the host element (this) for changes to its light DOM children
|
|
444
|
+
observer.observe(this, {
|
|
445
|
+
childList: true,
|
|
446
|
+
subtree: true,
|
|
447
|
+
attributes: true,
|
|
448
|
+
attributeFilter: ['value', 'label', 'disabled', 'selected']
|
|
449
|
+
});
|
|
450
|
+
// Store for cleanup
|
|
451
|
+
this.childObserver = observer;
|
|
452
|
+
}
|
|
453
|
+
handleChildrenChange(mutations) {
|
|
454
|
+
// Check if any of the mutations are relevant (snice-option elements or their attributes)
|
|
455
|
+
const relevant = mutations.some(m => {
|
|
456
|
+
if (m.type === 'childList')
|
|
457
|
+
return true;
|
|
458
|
+
if (m.type === 'attributes' && ['value', 'label', 'disabled', 'selected'].includes(m.attributeName)) {
|
|
459
|
+
return m.target.nodeName === 'SNICE-OPTION';
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
462
|
+
});
|
|
463
|
+
if (relevant) {
|
|
464
|
+
this.readOptionsFromChildren();
|
|
465
|
+
this.filteredOptions = [...this.options];
|
|
466
|
+
this.updateNativeSelect();
|
|
467
|
+
this.updateValueDisplay();
|
|
468
|
+
this.updateClearButton();
|
|
469
|
+
this.updateDropdownContent();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
readOptionsFromChildren() {
|
|
473
|
+
// Get all snice-option children from light DOM
|
|
474
|
+
const optionElements = Array.from(this.querySelectorAll('snice-option'));
|
|
475
|
+
this.options = optionElements.map(opt => {
|
|
476
|
+
const sniceOption = opt;
|
|
477
|
+
// Use the optionData getter if available, otherwise construct from properties
|
|
478
|
+
if (sniceOption.optionData) {
|
|
479
|
+
return sniceOption.optionData;
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
value: opt.getAttribute('value') || '',
|
|
483
|
+
label: opt.getAttribute('label') || opt.textContent?.trim() || '',
|
|
484
|
+
disabled: opt.hasAttribute('disabled'),
|
|
485
|
+
selected: opt.hasAttribute('selected')
|
|
486
|
+
};
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
handleTriggerOpen(e) {
|
|
490
|
+
e.preventDefault();
|
|
491
|
+
if (!this.open) {
|
|
492
|
+
this.openDropdown();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
handleSearchEscape() {
|
|
496
|
+
this.closeDropdown();
|
|
497
|
+
this.trigger?.focus();
|
|
498
|
+
}
|
|
499
|
+
handleSearchArrowDown(e) {
|
|
500
|
+
e.preventDefault();
|
|
501
|
+
this.focusNextOption();
|
|
502
|
+
}
|
|
503
|
+
handleSearchArrowUp(e) {
|
|
504
|
+
e.preventDefault();
|
|
505
|
+
this.focusPreviousOption();
|
|
506
|
+
}
|
|
507
|
+
handleSearchEnter(e) {
|
|
508
|
+
e.preventDefault();
|
|
509
|
+
if (this.focusedIndex >= 0) {
|
|
510
|
+
const options = this.searchable ? this.filteredOptions : this.options;
|
|
511
|
+
const option = options[this.focusedIndex];
|
|
512
|
+
if (option && !option.disabled) {
|
|
513
|
+
this.handleOptionSelect(option);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
focusNextOption() {
|
|
518
|
+
const options = this.searchable ? this.filteredOptions : this.options;
|
|
519
|
+
const enabledOptions = options.filter(opt => !opt.disabled);
|
|
520
|
+
if (enabledOptions.length === 0)
|
|
521
|
+
return;
|
|
522
|
+
this.focusedIndex++;
|
|
523
|
+
if (this.focusedIndex >= options.length) {
|
|
524
|
+
this.focusedIndex = 0;
|
|
525
|
+
}
|
|
526
|
+
while (options[this.focusedIndex]?.disabled) {
|
|
527
|
+
this.focusedIndex++;
|
|
528
|
+
if (this.focusedIndex >= options.length) {
|
|
529
|
+
this.focusedIndex = 0;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
this.updateOptionFocus();
|
|
533
|
+
}
|
|
534
|
+
focusPreviousOption() {
|
|
535
|
+
const options = this.searchable ? this.filteredOptions : this.options;
|
|
536
|
+
const enabledOptions = options.filter(opt => !opt.disabled);
|
|
537
|
+
if (enabledOptions.length === 0)
|
|
538
|
+
return;
|
|
539
|
+
this.focusedIndex--;
|
|
540
|
+
if (this.focusedIndex < 0) {
|
|
541
|
+
this.focusedIndex = options.length - 1;
|
|
542
|
+
}
|
|
543
|
+
while (options[this.focusedIndex]?.disabled) {
|
|
544
|
+
this.focusedIndex--;
|
|
545
|
+
if (this.focusedIndex < 0) {
|
|
546
|
+
this.focusedIndex = options.length - 1;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
this.updateOptionFocus();
|
|
550
|
+
}
|
|
551
|
+
updateOptionFocus() {
|
|
552
|
+
if (this.optionElements) {
|
|
553
|
+
this.optionElements.forEach((el, index) => {
|
|
554
|
+
el.classList.toggle('select-option--focused', index === this.focusedIndex);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
handleTriggerClick(e) {
|
|
559
|
+
e.stopPropagation();
|
|
560
|
+
// Don't toggle if clicking on the clear button or tag remove buttons
|
|
561
|
+
const target = e.target;
|
|
562
|
+
if (target.closest('.select-clear') || target.closest('.select-tag-remove')) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (!this.disabled && !this.readonly) {
|
|
566
|
+
this.toggleDropdown();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
handleClearClick(_e) {
|
|
570
|
+
this.clear();
|
|
571
|
+
}
|
|
572
|
+
handleTagRemove(e) {
|
|
573
|
+
e.stopPropagation();
|
|
574
|
+
const target = e.target;
|
|
575
|
+
const value = target.getAttribute('data-value');
|
|
576
|
+
if (value && this.multiple) {
|
|
577
|
+
this.selectedValues.delete(value);
|
|
578
|
+
this.value = Array.from(this.selectedValues).join(',');
|
|
579
|
+
this.updateNativeSelect();
|
|
580
|
+
this.updateValueDisplay();
|
|
581
|
+
this.updateClearButton();
|
|
582
|
+
this.dispatchChangeEvent();
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
handleOptionsClick(e) {
|
|
586
|
+
e.stopPropagation();
|
|
587
|
+
const target = e.target;
|
|
588
|
+
const optionEl = target.closest('.select-option');
|
|
589
|
+
if (!optionEl)
|
|
590
|
+
return;
|
|
591
|
+
const value = optionEl.getAttribute('data-value');
|
|
592
|
+
if (!value)
|
|
593
|
+
return;
|
|
594
|
+
const option = this.options.find(opt => opt.value === value);
|
|
595
|
+
if (option && !option.disabled) {
|
|
596
|
+
this.handleOptionSelect(option);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
handleSearchInput(e) {
|
|
600
|
+
const target = e.target;
|
|
601
|
+
const searchTerm = target.value.toLowerCase();
|
|
602
|
+
if (searchTerm) {
|
|
603
|
+
this.filteredOptions = this.options.filter(opt => opt.label.toLowerCase().includes(searchTerm));
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
this.filteredOptions = [...this.options];
|
|
607
|
+
}
|
|
608
|
+
this.focusedIndex = -1;
|
|
609
|
+
this.updateDropdownContent();
|
|
610
|
+
}
|
|
611
|
+
handleOptionSelect(option) {
|
|
612
|
+
if (this.multiple) {
|
|
613
|
+
if (this.selectedValues.has(option.value)) {
|
|
614
|
+
this.selectedValues.delete(option.value);
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
this.selectedValues.add(option.value);
|
|
618
|
+
}
|
|
619
|
+
this.value = Array.from(this.selectedValues).join(',');
|
|
620
|
+
this.updateDropdownContent();
|
|
621
|
+
}
|
|
622
|
+
else {
|
|
623
|
+
this.value = option.value;
|
|
624
|
+
this.closeDropdown();
|
|
625
|
+
}
|
|
626
|
+
this.updateNativeSelect();
|
|
627
|
+
this.updateValueDisplay();
|
|
628
|
+
this.updateClearButton();
|
|
629
|
+
this.dispatchChangeEvent(option);
|
|
630
|
+
}
|
|
631
|
+
handleValueChange() {
|
|
632
|
+
if (this.multiple) {
|
|
633
|
+
this.selectedValues = new Set(this.value ? this.value.split(',').map(v => v.trim()) : []);
|
|
634
|
+
}
|
|
635
|
+
this.updateNativeSelect();
|
|
636
|
+
this.updateValueDisplay();
|
|
637
|
+
this.updateClearButton();
|
|
638
|
+
}
|
|
639
|
+
handleDisabledChange() {
|
|
640
|
+
this.updateTriggerState();
|
|
641
|
+
this.updateNativeSelectAttributes();
|
|
642
|
+
this.updateClearButton();
|
|
643
|
+
if (this.disabled && this.open) {
|
|
644
|
+
this.closeDropdown();
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
handleReadonlyChange() {
|
|
648
|
+
this.updateTriggerState();
|
|
649
|
+
this.updateClearButton();
|
|
650
|
+
}
|
|
651
|
+
handleInvalidChange() {
|
|
652
|
+
this.updateTriggerState();
|
|
653
|
+
}
|
|
654
|
+
// Remove the @watch('options') since options are now read from children
|
|
655
|
+
handleOpenChange() {
|
|
656
|
+
this.updateDropdownState();
|
|
657
|
+
this.updateTriggerState();
|
|
658
|
+
if (this.open && this.searchable && this.searchInput) {
|
|
659
|
+
setTimeout(() => this.searchInput?.focus(), 100);
|
|
660
|
+
}
|
|
661
|
+
if (!this.open) {
|
|
662
|
+
this.focusedIndex = -1;
|
|
663
|
+
if (this.searchInput) {
|
|
664
|
+
this.searchInput.value = '';
|
|
665
|
+
this.filteredOptions = [...this.options];
|
|
666
|
+
this.updateDropdownContent();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
handleLabelChange() {
|
|
671
|
+
if (this.labelElement) {
|
|
672
|
+
this.labelElement.textContent = this.label;
|
|
673
|
+
if (this.label) {
|
|
674
|
+
this.labelElement.removeAttribute('hidden');
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
this.labelElement.setAttribute('hidden', '');
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
handlePlaceholderChange() {
|
|
682
|
+
this.updateValueDisplay();
|
|
683
|
+
}
|
|
684
|
+
handleRequiredChange() {
|
|
685
|
+
if (this.labelElement) {
|
|
686
|
+
this.labelElement.classList.toggle('select-label--required', this.required);
|
|
687
|
+
}
|
|
688
|
+
this.updateNativeSelectAttributes();
|
|
689
|
+
}
|
|
690
|
+
handleMultipleChange() {
|
|
691
|
+
this.updateNativeSelectAttributes();
|
|
692
|
+
}
|
|
693
|
+
handleNameChange() {
|
|
694
|
+
this.updateNativeSelectAttributes();
|
|
695
|
+
}
|
|
696
|
+
handleClearableChange() {
|
|
697
|
+
this.updateClearButton();
|
|
698
|
+
}
|
|
699
|
+
handleSearchableChange() {
|
|
700
|
+
if (this.searchContainer) {
|
|
701
|
+
if (this.searchable) {
|
|
702
|
+
this.searchContainer.removeAttribute('hidden');
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
this.searchContainer.setAttribute('hidden', '');
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
updateValueDisplay() {
|
|
710
|
+
if (!this.valueDisplay)
|
|
711
|
+
return;
|
|
712
|
+
const selectedOptions = this.options.filter(opt => this.multiple ? this.selectedValues.has(opt.value) : opt.value === this.value);
|
|
713
|
+
if (this.multiple && selectedOptions.length > 0) {
|
|
714
|
+
this.valueDisplay.innerHTML = /*html*/ `
|
|
715
|
+
<div class="select-value--multiple">
|
|
716
|
+
${selectedOptions.map(opt => /*html*/ `
|
|
717
|
+
<span class="select-tag">
|
|
718
|
+
<img class="select-tag-icon" src="${opt.icon || ''}" alt="" ${!opt.icon ? 'hidden' : ''} />
|
|
719
|
+
${opt.label}
|
|
720
|
+
<span class="select-tag-remove" data-value="${opt.value}" aria-label="Remove ${opt.label}" ${this.disabled || this.readonly ? 'hidden' : ''}>×</span>
|
|
721
|
+
</span>
|
|
722
|
+
`).join('')}
|
|
723
|
+
</div>
|
|
724
|
+
`;
|
|
725
|
+
}
|
|
726
|
+
else if (selectedOptions.length > 0) {
|
|
727
|
+
const selected = selectedOptions[0];
|
|
728
|
+
this.valueDisplay.innerHTML = /*html*/ `
|
|
729
|
+
<div class="select-value--single">
|
|
730
|
+
<img class="select-value-icon" src="${selected.icon || ''}" alt="" ${!selected.icon ? 'hidden' : ''} />
|
|
731
|
+
<span>${selected.label}</span>
|
|
732
|
+
</div>
|
|
733
|
+
`;
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
this.valueDisplay.innerHTML = /*html*/ `<span class="select-placeholder">${this.placeholder}</span>`;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
updateClearButton() {
|
|
740
|
+
if (!this.clearButton)
|
|
741
|
+
return;
|
|
742
|
+
const selectedOptions = this.options.filter(opt => this.multiple ? this.selectedValues.has(opt.value) : opt.value === this.value);
|
|
743
|
+
const shouldShow = this.clearable && selectedOptions.length > 0 && !this.disabled && !this.readonly;
|
|
744
|
+
this.clearButton.style.display = shouldShow ? '' : 'none';
|
|
745
|
+
}
|
|
746
|
+
updateDropdownContent() {
|
|
747
|
+
if (!this.optionsList)
|
|
748
|
+
return;
|
|
749
|
+
this.optionsList.innerHTML = this.renderOptions();
|
|
750
|
+
}
|
|
751
|
+
updateNativeSelect() {
|
|
752
|
+
if (!this.nativeSelect)
|
|
753
|
+
return;
|
|
754
|
+
// Clear and rebuild options
|
|
755
|
+
this.nativeSelect.innerHTML = '';
|
|
756
|
+
this.options.forEach(opt => {
|
|
757
|
+
const option = document.createElement('option');
|
|
758
|
+
option.value = opt.value;
|
|
759
|
+
option.textContent = opt.label;
|
|
760
|
+
option.selected = this.multiple ?
|
|
761
|
+
this.selectedValues.has(opt.value) :
|
|
762
|
+
opt.value === this.value;
|
|
763
|
+
this.nativeSelect.appendChild(option);
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
dispatchChangeEvent(option) {
|
|
767
|
+
return {
|
|
768
|
+
value: this.multiple ? Array.from(this.selectedValues) : this.value,
|
|
769
|
+
option,
|
|
770
|
+
select: this
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
dispatchOpenEvent() {
|
|
774
|
+
return { select: this };
|
|
775
|
+
}
|
|
776
|
+
dispatchCloseEvent() {
|
|
777
|
+
return { select: this };
|
|
778
|
+
}
|
|
779
|
+
// Public API
|
|
780
|
+
focus() {
|
|
781
|
+
this.trigger?.focus();
|
|
782
|
+
}
|
|
783
|
+
blur() {
|
|
784
|
+
this.trigger?.blur();
|
|
785
|
+
if (this.open) {
|
|
786
|
+
this.closeDropdown();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
clear() {
|
|
790
|
+
if (this.multiple) {
|
|
791
|
+
this.selectedValues.clear();
|
|
792
|
+
this.value = '';
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
this.value = '';
|
|
796
|
+
}
|
|
797
|
+
this.updateNativeSelect();
|
|
798
|
+
this.updateValueDisplay();
|
|
799
|
+
this.updateClearButton();
|
|
800
|
+
this.dispatchChangeEvent();
|
|
801
|
+
}
|
|
802
|
+
openDropdown() {
|
|
803
|
+
if (!this.open && !this.disabled && !this.readonly) {
|
|
804
|
+
this.open = true;
|
|
805
|
+
this.dispatchOpenEvent();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
closeDropdown() {
|
|
809
|
+
if (this.open) {
|
|
810
|
+
this.open = false;
|
|
811
|
+
this.dispatchCloseEvent();
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
toggleDropdown() {
|
|
815
|
+
if (this.open) {
|
|
816
|
+
this.closeDropdown();
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this.openDropdown();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
selectOption(value) {
|
|
823
|
+
const option = this.options.find(opt => opt.value === value);
|
|
824
|
+
if (option && !option.disabled) {
|
|
825
|
+
this.handleOptionSelect(option);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
updateTriggerState() {
|
|
829
|
+
if (!this.trigger)
|
|
830
|
+
return;
|
|
831
|
+
this.trigger.classList.toggle('select-trigger--open', this.open);
|
|
832
|
+
this.trigger.classList.toggle('select-trigger--disabled', this.disabled);
|
|
833
|
+
this.trigger.classList.toggle('select-trigger--readonly', this.readonly);
|
|
834
|
+
this.trigger.classList.toggle('select-trigger--invalid', this.invalid);
|
|
835
|
+
this.trigger.setAttribute('aria-expanded', String(this.open));
|
|
836
|
+
this.trigger.disabled = this.disabled;
|
|
837
|
+
}
|
|
838
|
+
updateDropdownState() {
|
|
839
|
+
if (!this.dropdown)
|
|
840
|
+
return;
|
|
841
|
+
this.dropdown.classList.toggle('select-dropdown--open', this.open);
|
|
842
|
+
if (this.arrow) {
|
|
843
|
+
this.arrow.classList.toggle('select-arrow--open', this.open);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
updateNativeSelectAttributes() {
|
|
847
|
+
if (!this.nativeSelect)
|
|
848
|
+
return;
|
|
849
|
+
this.nativeSelect.disabled = this.disabled;
|
|
850
|
+
this.nativeSelect.required = this.required;
|
|
851
|
+
this.nativeSelect.multiple = this.multiple;
|
|
852
|
+
if (this.name) {
|
|
853
|
+
this.nativeSelect.name = this.name;
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
this.nativeSelect.removeAttribute('name');
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
return _classThis;
|
|
861
|
+
})();
|
|
862
|
+
|
|
863
|
+
export { SniceSelect };
|
|
864
|
+
//# sourceMappingURL=snice-select.js.map
|