@sekiui/elements 0.1.3 → 0.1.4
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/cdn/index.js +1 -1
- package/dist/{components/p-Bml9QXVd.js → cdn/p--1ROPZet.js} +22 -12
- package/dist/cdn/p-B4SOpX_A.js +155 -0
- package/dist/cdn/{p-B7jKUvZz.js → p-C3WFySZp.js} +29 -3
- package/dist/cdn/p-COBvV3Rw.js +201 -0
- package/dist/cdn/seki-alert-dialog-content.js +10 -24
- package/dist/cdn/seki-alert-dialog.js +8 -10
- package/dist/cdn/seki-carousel-dots.js +1 -1
- package/dist/cdn/seki-carousel-next.js +1 -1
- package/dist/cdn/seki-carousel-previous.js +1 -1
- package/dist/cdn/seki-collapsible-content.js +23 -40
- package/dist/cdn/seki-collapsible-trigger.js +21 -5
- package/dist/cdn/seki-collapsible.js +18 -11
- package/dist/cdn/seki-combobox-content.js +15 -22
- package/dist/cdn/seki-combobox-input.js +1 -1
- package/dist/cdn/seki-combobox-item.js +1 -1
- package/dist/cdn/seki-combobox.js +1 -1
- package/dist/cdn/seki-command-empty.js +6 -22
- package/dist/cdn/seki-command-group.js +11 -13
- package/dist/cdn/seki-command-input.js +23 -8
- package/dist/cdn/seki-command-item.js +17 -0
- package/dist/cdn/seki-command.js +58 -57
- package/dist/cdn/seki-data-table.js +13 -6
- package/dist/cdn/seki-dialog-content.js +10 -25
- package/dist/cdn/seki-dialog-description.js +13 -7
- package/dist/cdn/seki-dialog-overlay.js +6 -15
- package/dist/cdn/seki-dialog-title.js +13 -7
- package/dist/cdn/seki-dialog.js +1 -1
- package/dist/cdn/seki-drawer-content.js +21 -24
- package/dist/cdn/seki-drawer.js +8 -7
- package/dist/cdn/seki-field-label.js +28 -2
- package/dist/cdn/seki-label.js +1 -1
- package/dist/cdn/seki-navigation-menu-content.js +1 -1
- package/dist/cdn/seki-navigation-menu-item.js +1 -1
- package/dist/cdn/seki-navigation-menu-trigger.js +1 -1
- package/dist/cdn/seki-navigation-menu.js +1 -1
- package/dist/cdn/seki-popover-content.js +14 -20
- package/dist/cdn/seki-popover.js +27 -17
- package/dist/cdn/seki-resizable-handle.js +1 -1
- package/dist/cdn/seki-resizable-panel-group.js +1 -1
- package/dist/cdn/seki-resizable-panel.js +1 -1
- package/dist/cdn/seki-select-content.js +14 -17
- package/dist/cdn/seki-select-option.js +23 -25
- package/dist/cdn/seki-select-trigger.js +32 -38
- package/dist/cdn/seki-select.js +30 -7
- package/dist/cdn/seki-sheet-content.js +24 -24
- package/dist/cdn/seki-sheet.js +8 -7
- package/dist/cdn/seki-toggle-group.js +1 -1
- package/dist/cdn/seki-toggle.js +1 -1
- package/dist/cjs/context-bridge-t3FBhOrW.js +159 -0
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/label-association-sgmb4sai.js +203 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/seki-alert-dialog-content.cjs.entry.js +10 -24
- package/dist/cjs/seki-alert-dialog.cjs.entry.js +7 -9
- package/dist/cjs/seki-carousel-dots.cjs.entry.js +1 -1
- package/dist/cjs/seki-carousel-next.cjs.entry.js +1 -1
- package/dist/cjs/seki-carousel-previous.cjs.entry.js +1 -1
- package/dist/cjs/seki-collapsible-content.cjs.entry.js +20 -39
- package/dist/cjs/seki-collapsible-trigger.cjs.entry.js +19 -4
- package/dist/cjs/seki-collapsible.cjs.entry.js +16 -10
- package/dist/cjs/seki-combobox-content.cjs.entry.js +15 -22
- package/dist/cjs/seki-combobox-input.cjs.entry.js +1 -1
- package/dist/cjs/seki-combobox-item.cjs.entry.js +1 -1
- package/dist/cjs/seki-combobox.cjs.entry.js +1 -1
- package/dist/cjs/seki-command-empty.cjs.entry.js +6 -22
- package/dist/cjs/seki-command-group.cjs.entry.js +11 -13
- package/dist/cjs/seki-command-input.cjs.entry.js +22 -8
- package/dist/cjs/seki-command-item.cjs.entry.js +17 -0
- package/dist/cjs/seki-command.cjs.entry.js +56 -56
- package/dist/cjs/seki-data-table.cjs.entry.js +10 -6
- package/dist/cjs/seki-dialog-content.cjs.entry.js +10 -25
- package/dist/cjs/seki-dialog-description.cjs.entry.js +10 -6
- package/dist/cjs/seki-dialog-overlay.cjs.entry.js +6 -15
- package/dist/cjs/seki-dialog-title.cjs.entry.js +10 -6
- package/dist/cjs/seki-dialog.cjs.entry.js +21 -12
- package/dist/cjs/seki-drawer-content.cjs.entry.js +20 -24
- package/dist/cjs/seki-drawer.cjs.entry.js +8 -7
- package/dist/cjs/seki-field-label.cjs.entry.js +26 -2
- package/dist/cjs/seki-label.cjs.entry.js +27 -3
- package/dist/cjs/seki-navigation-menu-content.cjs.entry.js +1 -1
- package/dist/cjs/seki-navigation-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/seki-navigation-menu-trigger.cjs.entry.js +1 -1
- package/dist/cjs/seki-navigation-menu.cjs.entry.js +1 -1
- package/dist/cjs/seki-popover-content.cjs.entry.js +14 -20
- package/dist/cjs/seki-popover.cjs.entry.js +24 -16
- package/dist/cjs/seki-resizable-handle.cjs.entry.js +1 -1
- package/dist/cjs/seki-resizable-panel-group.cjs.entry.js +1 -1
- package/dist/cjs/seki-resizable-panel.cjs.entry.js +1 -1
- package/dist/cjs/seki-select-content.cjs.entry.js +14 -17
- package/dist/cjs/seki-select-option.cjs.entry.js +23 -25
- package/dist/cjs/seki-select-trigger.cjs.entry.js +32 -38
- package/dist/cjs/seki-select.cjs.entry.js +29 -7
- package/dist/cjs/seki-sheet-content.cjs.entry.js +22 -24
- package/dist/cjs/seki-sheet.cjs.entry.js +8 -7
- package/dist/cjs/seki-toggle-group.cjs.entry.js +1 -1
- package/dist/cjs/seki-toggle.cjs.entry.js +1 -1
- package/dist/cjs/sekiui.cjs.js +1 -1
- package/dist/collection/components/alert-dialog/seki-alert-dialog-content.js +10 -24
- package/dist/collection/components/alert-dialog/seki-alert-dialog.js +21 -9
- package/dist/collection/components/collapsible/seki-collapsible-content.js +23 -40
- package/dist/collection/components/collapsible/seki-collapsible-trigger.js +24 -4
- package/dist/collection/components/collapsible/seki-collapsible.js +31 -9
- package/dist/collection/components/combobox-content/seki-combobox-content.js +15 -22
- package/dist/collection/components/command/seki-command-empty.js +6 -22
- package/dist/collection/components/command/seki-command-group.js +11 -13
- package/dist/collection/components/command/seki-command-input.js +27 -8
- package/dist/collection/components/command/seki-command-item.js +17 -0
- package/dist/collection/components/command/seki-command.js +71 -55
- package/dist/collection/components/data-table/seki-data-table.js +64 -6
- package/dist/collection/components/dialog/seki-dialog-content.js +10 -25
- package/dist/collection/components/dialog/seki-dialog-description.js +17 -6
- package/dist/collection/components/dialog/seki-dialog-overlay.js +6 -15
- package/dist/collection/components/dialog/seki-dialog-title.js +17 -6
- package/dist/collection/components/dialog/seki-dialog.js +37 -12
- package/dist/collection/components/drawer/seki-drawer-content.js +22 -24
- package/dist/collection/components/drawer/seki-drawer.js +22 -7
- package/dist/collection/components/field-label/seki-field-label.js +39 -3
- package/dist/collection/components/label/seki-label.js +40 -4
- package/dist/collection/components/popover/seki-popover-content.js +14 -20
- package/dist/collection/components/popover/seki-popover.js +41 -15
- package/dist/collection/components/select/seki-select.js +30 -6
- package/dist/collection/components/select-content/seki-select-content.js +14 -17
- package/dist/collection/components/select-option/seki-select-option.js +23 -25
- package/dist/collection/components/select-trigger/seki-select-trigger.js +32 -38
- package/dist/collection/components/sheet/seki-sheet-content.js +25 -24
- package/dist/collection/components/sheet/seki-sheet.js +22 -7
- package/dist/collection/utils/context-bridge.js +105 -4
- package/dist/collection/utils/label-association.js +199 -0
- package/dist/components/index.js +1 -1
- package/dist/{cdn/p-Bml9QXVd.js → components/p--1ROPZet.js} +22 -12
- package/dist/components/p-B4SOpX_A.js +155 -0
- package/dist/components/{p-B7jKUvZz.js → p-C3WFySZp.js} +29 -3
- package/dist/components/p-COBvV3Rw.js +201 -0
- package/dist/components/seki-alert-dialog-content.js +10 -24
- package/dist/components/seki-alert-dialog.js +8 -10
- package/dist/components/seki-carousel-dots.js +1 -1
- package/dist/components/seki-carousel-next.js +1 -1
- package/dist/components/seki-carousel-previous.js +1 -1
- package/dist/components/seki-collapsible-content.js +23 -40
- package/dist/components/seki-collapsible-trigger.js +21 -5
- package/dist/components/seki-collapsible.js +18 -11
- package/dist/components/seki-combobox-content.js +15 -22
- package/dist/components/seki-combobox-input.js +1 -1
- package/dist/components/seki-combobox-item.js +1 -1
- package/dist/components/seki-combobox.js +1 -1
- package/dist/components/seki-command-empty.js +6 -22
- package/dist/components/seki-command-group.js +11 -13
- package/dist/components/seki-command-input.js +23 -8
- package/dist/components/seki-command-item.js +17 -0
- package/dist/components/seki-command.js +58 -57
- package/dist/components/seki-data-table.js +13 -6
- package/dist/components/seki-dialog-content.js +10 -25
- package/dist/components/seki-dialog-description.js +13 -7
- package/dist/components/seki-dialog-overlay.js +6 -15
- package/dist/components/seki-dialog-title.js +13 -7
- package/dist/components/seki-dialog.js +1 -1
- package/dist/components/seki-drawer-content.js +21 -24
- package/dist/components/seki-drawer.js +8 -7
- package/dist/components/seki-field-label.js +28 -2
- package/dist/components/seki-label.js +1 -1
- package/dist/components/seki-navigation-menu-content.js +1 -1
- package/dist/components/seki-navigation-menu-item.js +1 -1
- package/dist/components/seki-navigation-menu-trigger.js +1 -1
- package/dist/components/seki-navigation-menu.js +1 -1
- package/dist/components/seki-popover-content.js +14 -20
- package/dist/components/seki-popover.js +27 -17
- package/dist/components/seki-resizable-handle.js +1 -1
- package/dist/components/seki-resizable-panel-group.js +1 -1
- package/dist/components/seki-resizable-panel.js +1 -1
- package/dist/components/seki-select-content.js +14 -17
- package/dist/components/seki-select-option.js +23 -25
- package/dist/components/seki-select-trigger.js +32 -38
- package/dist/components/seki-select.js +30 -7
- package/dist/components/seki-sheet-content.js +24 -24
- package/dist/components/seki-sheet.js +8 -7
- package/dist/components/seki-toggle-group.js +1 -1
- package/dist/components/seki-toggle.js +1 -1
- package/dist/esm/context-bridge-B4SOpX_A.js +155 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/label-association-COBvV3Rw.js +201 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/seki-alert-dialog-content.entry.js +10 -24
- package/dist/esm/seki-alert-dialog.entry.js +7 -9
- package/dist/esm/seki-carousel-dots.entry.js +1 -1
- package/dist/esm/seki-carousel-next.entry.js +1 -1
- package/dist/esm/seki-carousel-previous.entry.js +1 -1
- package/dist/esm/seki-collapsible-content.entry.js +20 -39
- package/dist/esm/seki-collapsible-trigger.entry.js +19 -4
- package/dist/esm/seki-collapsible.entry.js +16 -10
- package/dist/esm/seki-combobox-content.entry.js +15 -22
- package/dist/esm/seki-combobox-input.entry.js +1 -1
- package/dist/esm/seki-combobox-item.entry.js +1 -1
- package/dist/esm/seki-combobox.entry.js +1 -1
- package/dist/esm/seki-command-empty.entry.js +6 -22
- package/dist/esm/seki-command-group.entry.js +11 -13
- package/dist/esm/seki-command-input.entry.js +22 -8
- package/dist/esm/seki-command-item.entry.js +17 -0
- package/dist/esm/seki-command.entry.js +56 -56
- package/dist/esm/seki-data-table.entry.js +10 -6
- package/dist/esm/seki-dialog-content.entry.js +10 -25
- package/dist/esm/seki-dialog-description.entry.js +10 -6
- package/dist/esm/seki-dialog-overlay.entry.js +6 -15
- package/dist/esm/seki-dialog-title.entry.js +10 -6
- package/dist/esm/seki-dialog.entry.js +21 -12
- package/dist/esm/seki-drawer-content.entry.js +20 -24
- package/dist/esm/seki-drawer.entry.js +8 -7
- package/dist/esm/seki-field-label.entry.js +26 -2
- package/dist/esm/seki-label.entry.js +27 -3
- package/dist/esm/seki-navigation-menu-content.entry.js +1 -1
- package/dist/esm/seki-navigation-menu-item.entry.js +1 -1
- package/dist/esm/seki-navigation-menu-trigger.entry.js +1 -1
- package/dist/esm/seki-navigation-menu.entry.js +1 -1
- package/dist/esm/seki-popover-content.entry.js +14 -20
- package/dist/esm/seki-popover.entry.js +24 -16
- package/dist/esm/seki-resizable-handle.entry.js +1 -1
- package/dist/esm/seki-resizable-panel-group.entry.js +1 -1
- package/dist/esm/seki-resizable-panel.entry.js +1 -1
- package/dist/esm/seki-select-content.entry.js +14 -17
- package/dist/esm/seki-select-option.entry.js +23 -25
- package/dist/esm/seki-select-trigger.entry.js +32 -38
- package/dist/esm/seki-select.entry.js +29 -7
- package/dist/esm/seki-sheet-content.entry.js +22 -24
- package/dist/esm/seki-sheet.entry.js +8 -7
- package/dist/esm/seki-toggle-group.entry.js +1 -1
- package/dist/esm/seki-toggle.entry.js +1 -1
- package/dist/esm/sekiui.js +1 -1
- package/dist/sekiui/index.esm.js +1 -1
- package/dist/sekiui/{p-2459de33.entry.js → p-09131578.entry.js} +1 -1
- package/dist/sekiui/p-14ca64d7.entry.js +1 -0
- package/dist/sekiui/p-1564ab34.entry.js +1 -0
- package/dist/sekiui/p-1b7681eb.entry.js +1 -0
- package/dist/sekiui/{p-573fcf7e.entry.js → p-20e5e17a.entry.js} +1 -1
- package/dist/sekiui/p-2bd3c250.entry.js +1 -0
- package/dist/sekiui/p-2d50d0c2.entry.js +1 -0
- package/dist/sekiui/p-31db5c3f.entry.js +1 -0
- package/dist/sekiui/p-33dd3d17.entry.js +1 -0
- package/dist/sekiui/p-360d7dea.entry.js +1 -0
- package/dist/sekiui/p-3c6d6845.entry.js +1 -0
- package/dist/sekiui/{p-731740ec.entry.js → p-3cd3f36e.entry.js} +1 -1
- package/dist/sekiui/{p-1d173026.entry.js → p-3e456430.entry.js} +1 -1
- package/dist/sekiui/{p-e287c9b0.entry.js → p-4191a2cf.entry.js} +1 -1
- package/dist/sekiui/{p-b75f801b.entry.js → p-48fe9b46.entry.js} +1 -1
- package/dist/sekiui/{p-5a60c7f5.entry.js → p-5132d055.entry.js} +1 -1
- package/dist/sekiui/p-5700ac69.entry.js +1 -0
- package/dist/sekiui/{p-d2592287.entry.js → p-57e7170b.entry.js} +1 -1
- package/dist/sekiui/{p-edac50c7.entry.js → p-5dbd46b4.entry.js} +1 -1
- package/dist/sekiui/p-6923d926.entry.js +1 -0
- package/dist/sekiui/{p-22daeb37.entry.js → p-6c2e4ae8.entry.js} +1 -1
- package/dist/sekiui/p-6edbced1.entry.js +1 -0
- package/dist/sekiui/p-7dac94b2.entry.js +1 -0
- package/dist/sekiui/p-80dbf1f5.entry.js +1 -0
- package/dist/sekiui/p-817af69a.entry.js +1 -0
- package/dist/sekiui/{p-ddcdc3da.entry.js → p-8b3bc7c2.entry.js} +1 -1
- package/dist/sekiui/p-8fb55d56.entry.js +1 -0
- package/dist/sekiui/{p-a575f386.entry.js → p-92b800a2.entry.js} +1 -1
- package/dist/sekiui/{p-63e922dc.entry.js → p-938ce866.entry.js} +1 -1
- package/dist/sekiui/{p-d0533172.entry.js → p-95501e60.entry.js} +1 -1
- package/dist/sekiui/p-979708a0.entry.js +1 -0
- package/dist/sekiui/{p-faf09566.entry.js → p-9c921a6c.entry.js} +1 -1
- package/dist/sekiui/p-B4SOpX_A.js +1 -0
- package/dist/sekiui/p-COBvV3Rw.js +1 -0
- package/dist/sekiui/{p-fc6b3691.entry.js → p-a4fc4f1a.entry.js} +1 -1
- package/dist/sekiui/{p-d7bd5d5e.entry.js → p-b94e0f1b.entry.js} +1 -1
- package/dist/sekiui/{p-1c5fe316.entry.js → p-c6efedab.entry.js} +1 -1
- package/dist/sekiui/p-c8da7923.entry.js +1 -0
- package/dist/sekiui/p-c97fbaf2.entry.js +1 -0
- package/dist/sekiui/p-cb28d764.entry.js +1 -0
- package/dist/sekiui/{p-5f52b52d.entry.js → p-cc2ac0f0.entry.js} +1 -1
- package/dist/sekiui/{p-acebf429.entry.js → p-d32614a4.entry.js} +1 -1
- package/dist/sekiui/p-d3449109.entry.js +1 -0
- package/dist/sekiui/p-ddbf98ca.entry.js +1 -0
- package/dist/sekiui/p-eb03eb37.entry.js +1 -0
- package/dist/sekiui/{p-c57bbe35.entry.js → p-fc9e8583.entry.js} +1 -1
- package/dist/sekiui/sekiui.esm.js +1 -1
- package/dist/types/components/alert-dialog/seki-alert-dialog-content.d.ts +6 -3
- package/dist/types/components/alert-dialog/seki-alert-dialog.d.ts +5 -2
- package/dist/types/components/collapsible/seki-collapsible-content.d.ts +4 -5
- package/dist/types/components/collapsible/seki-collapsible-trigger.d.ts +11 -0
- package/dist/types/components/collapsible/seki-collapsible.d.ts +6 -2
- package/dist/types/components/combobox-content/seki-combobox-content.d.ts +3 -4
- package/dist/types/components/command/seki-command-empty.d.ts +2 -4
- package/dist/types/components/command/seki-command-group.d.ts +2 -3
- package/dist/types/components/command/seki-command-input.d.ts +5 -1
- package/dist/types/components/command/seki-command-item.d.ts +3 -0
- package/dist/types/components/command/seki-command.d.ts +19 -1
- package/dist/types/components/command/types.d.ts +9 -1
- package/dist/types/components/data-table/seki-data-table.d.ts +7 -2
- package/dist/types/components/dialog/seki-dialog-content.d.ts +6 -3
- package/dist/types/components/dialog/seki-dialog-description.d.ts +5 -1
- package/dist/types/components/dialog/seki-dialog-overlay.d.ts +2 -3
- package/dist/types/components/dialog/seki-dialog-title.d.ts +5 -1
- package/dist/types/components/dialog/seki-dialog.d.ts +9 -2
- package/dist/types/components/drawer/seki-drawer-content.d.ts +8 -3
- package/dist/types/components/drawer/seki-drawer.d.ts +5 -1
- package/dist/types/components/field-label/seki-field-label.d.ts +9 -1
- package/dist/types/components/label/seki-label.d.ts +11 -2
- package/dist/types/components/popover/seki-popover-content.d.ts +6 -3
- package/dist/types/components/popover/seki-popover.d.ts +7 -1
- package/dist/types/components/select/seki-select.d.ts +8 -0
- package/dist/types/components/select-content/seki-select-content.d.ts +3 -2
- package/dist/types/components/select-option/seki-select-option.d.ts +9 -3
- package/dist/types/components/select-trigger/seki-select-trigger.d.ts +10 -4
- package/dist/types/components/sheet/seki-sheet-content.d.ts +8 -4
- package/dist/types/components/sheet/seki-sheet.d.ts +5 -1
- package/dist/types/components.d.ts +61 -6
- package/dist/types/utils/context-bridge.d.ts +68 -4
- package/dist/types/utils/label-association.d.ts +58 -0
- package/package.json +1 -1
- package/dist/cdn/p-DJMgrCw3.js +0 -54
- package/dist/cjs/context-bridge-CywF7uJm.js +0 -57
- package/dist/components/p-DJMgrCw3.js +0 -54
- package/dist/esm/context-bridge-DJMgrCw3.js +0 -54
- package/dist/sekiui/p-063951fe.entry.js +0 -1
- package/dist/sekiui/p-326909c5.entry.js +0 -1
- package/dist/sekiui/p-3511d6e5.entry.js +0 -1
- package/dist/sekiui/p-4253845a.entry.js +0 -1
- package/dist/sekiui/p-565acaf2.entry.js +0 -1
- package/dist/sekiui/p-5a55a239.entry.js +0 -1
- package/dist/sekiui/p-5fd3b090.entry.js +0 -1
- package/dist/sekiui/p-6466865a.entry.js +0 -1
- package/dist/sekiui/p-9324d212.entry.js +0 -1
- package/dist/sekiui/p-959fef36.entry.js +0 -1
- package/dist/sekiui/p-DJMgrCw3.js +0 -1
- package/dist/sekiui/p-a55bc3d3.entry.js +0 -1
- package/dist/sekiui/p-ab56de7a.entry.js +0 -1
- package/dist/sekiui/p-ad62e316.entry.js +0 -1
- package/dist/sekiui/p-b8d3aa31.entry.js +0 -1
- package/dist/sekiui/p-b99c6433.entry.js +0 -1
- package/dist/sekiui/p-c15c21b4.entry.js +0 -1
- package/dist/sekiui/p-c529a6b8.entry.js +0 -1
- package/dist/sekiui/p-c99961a7.entry.js +0 -1
- package/dist/sekiui/p-d61319d6.entry.js +0 -1
- package/dist/sekiui/p-da9b3eaa.entry.js +0 -1
- package/dist/sekiui/p-eb50f8d5.entry.js +0 -1
- package/dist/sekiui/p-f886fe62.entry.js +0 -1
- package/dist/sekiui/p-fc288df2.entry.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
import { LabelBinding } from "../../utils/label-association";
|
|
2
3
|
/**
|
|
3
4
|
* seki-label: A styled label component for form elements
|
|
4
5
|
*
|
|
@@ -21,12 +22,32 @@ export class SekiLabel {
|
|
|
21
22
|
*/
|
|
22
23
|
this.disabled = false;
|
|
23
24
|
}
|
|
25
|
+
onForChange() {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = this.binding) === null || _a === void 0 ? void 0 : _a.sync();
|
|
28
|
+
}
|
|
29
|
+
/** Forward clicks to the labelled control (see utils/label-association.ts). */
|
|
30
|
+
onClick(event) {
|
|
31
|
+
var _a;
|
|
32
|
+
(_a = this.binding) === null || _a === void 0 ? void 0 : _a.handleClick(event);
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this.binding = new LabelBinding(this.el, () => this.for);
|
|
36
|
+
}
|
|
37
|
+
componentDidLoad() {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
(_a = this.binding) === null || _a === void 0 ? void 0 : _a.sync();
|
|
40
|
+
(_b = this.binding) === null || _b === void 0 ? void 0 : _b.observe();
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = this.binding) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
45
|
+
}
|
|
24
46
|
render() {
|
|
25
|
-
|
|
26
|
-
return (h("label", Object.assign({ key: 'df80b45752def839bec876b26d32861f31404f55', part: "label" }, labelProps, { class: {
|
|
47
|
+
return (h("label", { key: '1aa6ed2ae6c1c16812dd07aa81b88c0df0790b02', part: "label", class: {
|
|
27
48
|
'seki-label': true,
|
|
28
49
|
'seki-label--disabled': !!this.disabled,
|
|
29
|
-
} }
|
|
50
|
+
} }, h("slot", { key: 'a2da93efc7cca1b92d6001b071f5bfa3971f2a8d', onSlotchange: () => { var _a; return (_a = this.binding) === null || _a === void 0 ? void 0 : _a.sync(); } }), this.required && h("span", { key: '81a2056abc5499c86d889ece899797b2fdea437e', class: "seki-label__required" }, " *")));
|
|
30
51
|
}
|
|
31
52
|
static get is() { return "seki-label"; }
|
|
32
53
|
static get encapsulation() { return "shadow"; }
|
|
@@ -54,7 +75,7 @@ export class SekiLabel {
|
|
|
54
75
|
"optional": true,
|
|
55
76
|
"docs": {
|
|
56
77
|
"tags": [],
|
|
57
|
-
"text": "The ID of the form element this label is associated with
|
|
78
|
+
"text": "The ID of the form element this label is associated with. Resolved in the\nlabel's own root node (document or shadow root), not in this component's\nshadow root, so it reaches light-DOM controls. Without it, the first control\nnested inside the label is used."
|
|
58
79
|
},
|
|
59
80
|
"getter": false,
|
|
60
81
|
"setter": false,
|
|
@@ -110,4 +131,19 @@ export class SekiLabel {
|
|
|
110
131
|
};
|
|
111
132
|
}
|
|
112
133
|
static get elementRef() { return "el"; }
|
|
134
|
+
static get watchers() {
|
|
135
|
+
return [{
|
|
136
|
+
"propName": "for",
|
|
137
|
+
"methodName": "onForChange"
|
|
138
|
+
}];
|
|
139
|
+
}
|
|
140
|
+
static get listeners() {
|
|
141
|
+
return [{
|
|
142
|
+
"name": "click",
|
|
143
|
+
"method": "onClick",
|
|
144
|
+
"target": undefined,
|
|
145
|
+
"capture": false,
|
|
146
|
+
"passive": false
|
|
147
|
+
}];
|
|
148
|
+
}
|
|
113
149
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { computeAnchoredPosition } from "../../utils/positioning";
|
|
3
|
+
import { ContextConsumer } from "../../utils/context-bridge";
|
|
3
4
|
/**
|
|
4
5
|
* Popover content panel with positioning
|
|
5
6
|
*
|
|
@@ -9,6 +10,11 @@ import { computeAnchoredPosition } from "../../utils/positioning";
|
|
|
9
10
|
*/
|
|
10
11
|
export class SekiPopoverContent {
|
|
11
12
|
constructor() {
|
|
13
|
+
this.popoverConsumer = new ContextConsumer('seki-popover', '_popoverContext', () => this.onPopoverOpenChange());
|
|
14
|
+
/**
|
|
15
|
+
* Re-read the parent's context. Runs once on connect (picking up a popover
|
|
16
|
+
* that is already open) and on every publish.
|
|
17
|
+
*/
|
|
12
18
|
this.onPopoverOpenChange = () => {
|
|
13
19
|
var _a;
|
|
14
20
|
const context = this.getContext();
|
|
@@ -30,20 +36,10 @@ export class SekiPopoverContent {
|
|
|
30
36
|
this._actualSide = 'bottom';
|
|
31
37
|
}
|
|
32
38
|
getContext() {
|
|
33
|
-
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
-
return popover ? popover._popoverContext : null;
|
|
36
|
-
}
|
|
37
|
-
componentWillRender() {
|
|
38
|
-
var _a;
|
|
39
|
-
const context = this.getContext();
|
|
40
|
-
this._isOpen = (_a = context === null || context === void 0 ? void 0 : context.isOpen) !== null && _a !== void 0 ? _a : false;
|
|
39
|
+
return this.popoverConsumer.context;
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// Listen for open changes
|
|
45
|
-
this.popoverEl = (_a = this.el.closest('seki-popover')) !== null && _a !== void 0 ? _a : undefined;
|
|
46
|
-
(_b = this.popoverEl) === null || _b === void 0 ? void 0 : _b.addEventListener('sekiOpenChange', this.onPopoverOpenChange);
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
this.popoverConsumer.connect(this.el);
|
|
47
43
|
}
|
|
48
44
|
componentDidRender() {
|
|
49
45
|
if (this._isOpen) {
|
|
@@ -51,16 +47,15 @@ export class SekiPopoverContent {
|
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
updatePosition() {
|
|
54
|
-
var _a, _b, _c, _d;
|
|
55
|
-
const
|
|
56
|
-
const trigger = popover === null || popover === void 0 ? void 0 : popover.querySelector('seki-popover-trigger');
|
|
50
|
+
var _a, _b, _c, _d, _e;
|
|
51
|
+
const trigger = (_a = this.popoverConsumer.parent) === null || _a === void 0 ? void 0 : _a.querySelector('seki-popover-trigger');
|
|
57
52
|
if (!trigger || !this.contentRef)
|
|
58
53
|
return;
|
|
59
54
|
const triggerRect = trigger.getBoundingClientRect();
|
|
60
55
|
const contentRect = this.contentRef.getBoundingClientRect();
|
|
61
56
|
const context = this.getContext();
|
|
62
|
-
const side = (
|
|
63
|
-
const align = (
|
|
57
|
+
const side = (_c = (_b = this.side) !== null && _b !== void 0 ? _b : context === null || context === void 0 ? void 0 : context.side) !== null && _c !== void 0 ? _c : 'bottom';
|
|
58
|
+
const align = (_e = (_d = this.align) !== null && _d !== void 0 ? _d : context === null || context === void 0 ? void 0 : context.align) !== null && _e !== void 0 ? _e : 'center';
|
|
64
59
|
const { top, left } = computeAnchoredPosition(triggerRect, contentRect, {
|
|
65
60
|
side,
|
|
66
61
|
align,
|
|
@@ -78,8 +73,7 @@ export class SekiPopoverContent {
|
|
|
78
73
|
this._actualSide = side;
|
|
79
74
|
}
|
|
80
75
|
disconnectedCallback() {
|
|
81
|
-
|
|
82
|
-
(_a = this.popoverEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('sekiOpenChange', this.onPopoverOpenChange);
|
|
76
|
+
this.popoverConsumer.disconnect();
|
|
83
77
|
}
|
|
84
78
|
render() {
|
|
85
79
|
if (!this._isOpen) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { publishContext } from "../../utils/context-bridge";
|
|
2
3
|
/**
|
|
3
4
|
* Popover component - floating content triggered by click
|
|
4
5
|
*
|
|
@@ -43,16 +44,25 @@ export class SekiPopover {
|
|
|
43
44
|
}
|
|
44
45
|
componentWillLoad() {
|
|
45
46
|
this._isOpen = this.open || this.defaultOpen;
|
|
47
|
+
// Publish before the first render so `<seki-popover open>` /
|
|
48
|
+
// `<seki-popover default-open>` show their content at first paint (#323).
|
|
49
|
+
this.publish();
|
|
46
50
|
}
|
|
47
51
|
openChanged(newValue) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
// Route prop assignments through the same path as the methods so the
|
|
53
|
+
// context is refreshed and sekiOpenChange fires (#323). Both methods are
|
|
54
|
+
// no-ops when the state already matches, which also stops the re-entrant
|
|
55
|
+
// Watch call caused by their own `this.open = ...` write.
|
|
56
|
+
if (newValue) {
|
|
57
|
+
this.openPopover();
|
|
51
58
|
}
|
|
52
59
|
else {
|
|
53
|
-
this.
|
|
60
|
+
this.closePopover();
|
|
54
61
|
}
|
|
55
62
|
}
|
|
63
|
+
placementChanged() {
|
|
64
|
+
this.publish();
|
|
65
|
+
}
|
|
56
66
|
/**
|
|
57
67
|
* Open the popover
|
|
58
68
|
*/
|
|
@@ -61,8 +71,7 @@ export class SekiPopover {
|
|
|
61
71
|
return;
|
|
62
72
|
this._isOpen = true;
|
|
63
73
|
this.open = true;
|
|
64
|
-
|
|
65
|
-
this.el._popoverContext = this.getContext();
|
|
74
|
+
this.publish();
|
|
66
75
|
this.sekiOpenChange.emit(true);
|
|
67
76
|
this.setupClickOutside();
|
|
68
77
|
}
|
|
@@ -74,8 +83,7 @@ export class SekiPopover {
|
|
|
74
83
|
return;
|
|
75
84
|
this._isOpen = false;
|
|
76
85
|
this.open = false;
|
|
77
|
-
|
|
78
|
-
this.el._popoverContext = this.getContext();
|
|
86
|
+
this.publish();
|
|
79
87
|
this.sekiOpenChange.emit(false);
|
|
80
88
|
this.removeClickOutside();
|
|
81
89
|
}
|
|
@@ -142,22 +150,19 @@ export class SekiPopover {
|
|
|
142
150
|
toggle: () => this.togglePopover(),
|
|
143
151
|
};
|
|
144
152
|
}
|
|
153
|
+
publish() {
|
|
154
|
+
publishContext(this.el, '_popoverContext', this.getContext(), this.popoverContextChange);
|
|
155
|
+
}
|
|
145
156
|
componentDidLoad() {
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
|
-
this.el._popoverContext = this.getContext();
|
|
148
157
|
if (this._isOpen) {
|
|
149
158
|
this.setupClickOutside();
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
|
-
componentDidUpdate() {
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
-
this.el._popoverContext = this.getContext();
|
|
155
|
-
}
|
|
156
161
|
disconnectedCallback() {
|
|
157
162
|
this.removeClickOutside();
|
|
158
163
|
}
|
|
159
164
|
render() {
|
|
160
|
-
return (h(Host, { key: '
|
|
165
|
+
return (h(Host, { key: '4843a3d2aab19c70804a6fec2059880dbd193456', "data-state": this._isOpen ? 'open' : 'closed' }, h("div", { key: 'dc6dd157034bec1abb59f8289e665a304bb7ca26', part: "popover", class: "popover" }, h("slot", { key: 'c079493c83ccbeaf8fded4777428f720610afaf3' }))));
|
|
161
166
|
}
|
|
162
167
|
static get is() { return "seki-popover"; }
|
|
163
168
|
static get encapsulation() { return "shadow"; }
|
|
@@ -348,6 +353,21 @@ export class SekiPopover {
|
|
|
348
353
|
"resolved": "boolean",
|
|
349
354
|
"references": {}
|
|
350
355
|
}
|
|
356
|
+
}, {
|
|
357
|
+
"method": "popoverContextChange",
|
|
358
|
+
"name": "sekiContextChange",
|
|
359
|
+
"bubbles": true,
|
|
360
|
+
"cancelable": true,
|
|
361
|
+
"composed": true,
|
|
362
|
+
"docs": {
|
|
363
|
+
"tags": [],
|
|
364
|
+
"text": "Internal: notifies popover parts that `_popoverContext` changed. Not part\nof the public API; listen to `sekiOpenChange` instead."
|
|
365
|
+
},
|
|
366
|
+
"complexType": {
|
|
367
|
+
"original": "void",
|
|
368
|
+
"resolved": "void",
|
|
369
|
+
"references": {}
|
|
370
|
+
}
|
|
351
371
|
}];
|
|
352
372
|
}
|
|
353
373
|
static get methods() {
|
|
@@ -410,6 +430,12 @@ export class SekiPopover {
|
|
|
410
430
|
return [{
|
|
411
431
|
"propName": "open",
|
|
412
432
|
"methodName": "openChanged"
|
|
433
|
+
}, {
|
|
434
|
+
"propName": "side",
|
|
435
|
+
"methodName": "placementChanged"
|
|
436
|
+
}, {
|
|
437
|
+
"propName": "align",
|
|
438
|
+
"methodName": "placementChanged"
|
|
413
439
|
}];
|
|
414
440
|
}
|
|
415
441
|
static get listeners() {
|
|
@@ -36,6 +36,7 @@ export class SekiSelect {
|
|
|
36
36
|
this.triggerId = `select-trigger-${Math.random().toString(36).substr(2, 9)}`;
|
|
37
37
|
this.searchTimeoutId = null;
|
|
38
38
|
this.searchDebounce = 500;
|
|
39
|
+
this.registrationPublishQueued = false;
|
|
39
40
|
this.handleClickOutside = (event) => {
|
|
40
41
|
// Only close if dropdown is open
|
|
41
42
|
if (!this.isOpen) {
|
|
@@ -172,8 +173,10 @@ export class SekiSelect {
|
|
|
172
173
|
else if (this.defaultOpen) {
|
|
173
174
|
this.isOpen = this.defaultOpen;
|
|
174
175
|
}
|
|
175
|
-
//
|
|
176
|
-
this
|
|
176
|
+
// Publish (and notify) before the first render: parts that upgraded
|
|
177
|
+
// before this select under one-module-per-tag loading are already
|
|
178
|
+
// listening, and the rest read it when they connect (#323).
|
|
179
|
+
this.updateContextOnElement();
|
|
177
180
|
this.formControl = new FormControl(this.el, this.internals, {
|
|
178
181
|
getFormValue: () => this.getFormValue(),
|
|
179
182
|
isEmpty: () => this.isValueEmpty(),
|
|
@@ -202,14 +205,14 @@ export class SekiSelect {
|
|
|
202
205
|
this.syncFormValue();
|
|
203
206
|
}
|
|
204
207
|
componentDidLoad() {
|
|
205
|
-
// Expose context on the element for child components
|
|
206
|
-
this.el.selectContext = this.buildSelectContext();
|
|
207
208
|
// Add click-outside listener
|
|
208
209
|
this.clickOutsideListener = this.handleClickOutside.bind(this);
|
|
209
210
|
document.addEventListener('click', this.clickOutsideListener, true);
|
|
210
211
|
}
|
|
211
212
|
componentDidRender() {
|
|
212
|
-
//
|
|
213
|
+
// Keep the context reference fresh for props without a dedicated @Watch
|
|
214
|
+
// (aria-*). State that parts render from is republished with a
|
|
215
|
+
// notification by the watchers below.
|
|
213
216
|
this.el.selectContext = this.buildSelectContext();
|
|
214
217
|
}
|
|
215
218
|
disconnectedCallback() {
|
|
@@ -238,8 +241,26 @@ export class SekiSelect {
|
|
|
238
241
|
this.syncFormValue();
|
|
239
242
|
}
|
|
240
243
|
handleDisabledChange() {
|
|
244
|
+
this.updateContextOnElement();
|
|
241
245
|
this.syncFormValue();
|
|
242
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* The trigger's label comes from the registered options, so registering an
|
|
249
|
+
* option must notify the parts. Before #323 this was only a silent property
|
|
250
|
+
* write in componentDidRender, and a trigger that rendered before the
|
|
251
|
+
* selected option registered stayed on the placeholder.
|
|
252
|
+
*/
|
|
253
|
+
handleRegisteredOptionsChange() {
|
|
254
|
+
// Options register one at a time; coalesce a burst into one publish so N
|
|
255
|
+
// options do not cost N notifications to every part.
|
|
256
|
+
if (this.registrationPublishQueued)
|
|
257
|
+
return;
|
|
258
|
+
this.registrationPublishQueued = true;
|
|
259
|
+
Promise.resolve().then(() => {
|
|
260
|
+
this.registrationPublishQueued = false;
|
|
261
|
+
this.updateContextOnElement();
|
|
262
|
+
});
|
|
263
|
+
}
|
|
243
264
|
// Form-associated lifecycle callbacks (all behaviour lives in FormControl)
|
|
244
265
|
formResetCallback() {
|
|
245
266
|
var _a;
|
|
@@ -434,7 +455,7 @@ export class SekiSelect {
|
|
|
434
455
|
// Render
|
|
435
456
|
// ===========================
|
|
436
457
|
render() {
|
|
437
|
-
return (h(Host, { key: '
|
|
458
|
+
return (h(Host, { key: '13a58769075314b9067f60c14e73dfc8f0bb4242' }, h("slot", { key: '28939ca73356763701694d0633b7d9052f702050' })));
|
|
438
459
|
}
|
|
439
460
|
static get is() { return "seki-select"; }
|
|
440
461
|
static get encapsulation() { return "shadow"; }
|
|
@@ -973,6 +994,9 @@ export class SekiSelect {
|
|
|
973
994
|
}, {
|
|
974
995
|
"propName": "name",
|
|
975
996
|
"methodName": "handleDisabledChange"
|
|
997
|
+
}, {
|
|
998
|
+
"propName": "registeredOptions",
|
|
999
|
+
"methodName": "handleRegisteredOptionsChange"
|
|
976
1000
|
}, {
|
|
977
1001
|
"propName": "focusedOptionValue",
|
|
978
1002
|
"methodName": "handleFocusedOptionValueChange"
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { ContextConsumer } from "../../utils/context-bridge";
|
|
2
3
|
/**
|
|
3
4
|
* @slot - Options and groups
|
|
4
5
|
*/
|
|
5
6
|
export class SekiSelectContent {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.forceUpdate = 0; // Used to force re-renders
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
// ===========================
|
|
10
|
+
// Lifecycle
|
|
11
|
+
// ===========================
|
|
12
|
+
this.selectConsumer = new ContextConsumer('seki-select', 'selectContext', () => this.handleParentContextChange());
|
|
13
|
+
this.handleParentContextChange = () => {
|
|
14
|
+
// Force re-render when the parent's context changes
|
|
10
15
|
this.forceUpdate++;
|
|
11
16
|
};
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// Listen for state changes from parent
|
|
18
|
-
const parent = this.el.closest('seki-select');
|
|
19
|
-
if (parent) {
|
|
20
|
-
parent.addEventListener('sekiOpenChange', this.handleParentOpenChange);
|
|
21
|
-
}
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
// Re-render on every context publish (open state, but also the select's
|
|
20
|
+
// first publish when this part upgraded before it) (#323).
|
|
21
|
+
this.selectConsumer.connect(this.el);
|
|
22
22
|
}
|
|
23
23
|
disconnectedCallback() {
|
|
24
|
-
|
|
25
|
-
if (parent) {
|
|
26
|
-
parent.removeEventListener('sekiOpenChange', this.handleParentOpenChange);
|
|
27
|
-
}
|
|
24
|
+
this.selectConsumer.disconnect();
|
|
28
25
|
}
|
|
29
26
|
// ===========================
|
|
30
27
|
// Methods
|
|
@@ -42,8 +39,8 @@ export class SekiSelectContent {
|
|
|
42
39
|
// Helpers
|
|
43
40
|
// ===========================
|
|
44
41
|
getSelectContext() {
|
|
45
|
-
|
|
46
|
-
return
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = this.selectConsumer.context) !== null && _a !== void 0 ? _a : undefined;
|
|
47
44
|
}
|
|
48
45
|
/**
|
|
49
46
|
* Accessible name for the listbox.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { buildOptionId } from "../../utils/select";
|
|
3
|
-
import {
|
|
3
|
+
import { ContextConsumer } from "../../utils/context-bridge";
|
|
4
4
|
/**
|
|
5
5
|
* @slot - Option content
|
|
6
6
|
* @slot selected-indicator - Custom selected indicator
|
|
@@ -9,11 +9,7 @@ export class SekiSelectOption {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
/** Whether the option is disabled */
|
|
11
11
|
this.disabled = false;
|
|
12
|
-
|
|
13
|
-
// Lifecycle
|
|
14
|
-
// ===========================
|
|
15
|
-
this.hasRegistered = false;
|
|
16
|
-
this.contextSubscription = { parent: null, unsubscribe: () => { } };
|
|
12
|
+
this.selectConsumer = new ContextConsumer('seki-select', 'selectContext', () => this.handleParentContextChange());
|
|
17
13
|
/**
|
|
18
14
|
* Refresh aria-selected/data-selected/data-focused directly on the
|
|
19
15
|
* rendered DOM whenever the parent's value/focus state changes post-mount.
|
|
@@ -25,11 +21,14 @@ export class SekiSelectOption {
|
|
|
25
21
|
* DOM directly here side-steps that entirely.
|
|
26
22
|
*/
|
|
27
23
|
this.handleParentContextChange = () => {
|
|
24
|
+
const selectContext = this.getSelectContext();
|
|
25
|
+
if (selectContext && this.registeredVia !== selectContext.registerOption) {
|
|
26
|
+
this.registerWithParent(selectContext);
|
|
27
|
+
}
|
|
28
28
|
const optionEl = this.el.querySelector('.option');
|
|
29
29
|
if (!optionEl)
|
|
30
30
|
return;
|
|
31
31
|
optionEl.id = this.optionId;
|
|
32
|
-
const selectContext = this.getSelectContext();
|
|
33
32
|
const isSelected = (selectContext === null || selectContext === void 0 ? void 0 : selectContext.isValueSelected(this.value)) || false;
|
|
34
33
|
const isFocused = (selectContext === null || selectContext === void 0 ? void 0 : selectContext.focusedOptionValue) === this.value;
|
|
35
34
|
optionEl.setAttribute('aria-selected', isSelected ? 'true' : 'false');
|
|
@@ -88,24 +87,22 @@ export class SekiSelectOption {
|
|
|
88
87
|
const selectContext = this.getSelectContext();
|
|
89
88
|
return buildOptionId((_a = selectContext === null || selectContext === void 0 ? void 0 : selectContext.contentId) !== null && _a !== void 0 ? _a : 'select', this.value);
|
|
90
89
|
}
|
|
90
|
+
connectedCallback() {
|
|
91
|
+
// Runs on first connect and after a DOM move. Registration happens in the
|
|
92
|
+
// context callback, so it also happens when this option upgrades before
|
|
93
|
+
// its seki-select (one-module-per-tag loading): the select's first
|
|
94
|
+
// publish from componentWillLoad triggers it (#323).
|
|
95
|
+
this.selectConsumer.connect(this.el);
|
|
96
|
+
}
|
|
91
97
|
componentDidLoad() {
|
|
92
|
-
this.registerWithParent();
|
|
93
98
|
this.refreshOptionId();
|
|
94
|
-
this.contextSubscription = subscribeToContextChange(this.el, 'seki-select', this.handleParentContextChange);
|
|
95
|
-
}
|
|
96
|
-
connectedCallback() {
|
|
97
|
-
// Re-register on reconnect (after a DOM move). componentDidLoad fires only
|
|
98
|
-
// once, so without this the option would stay unregistered after being moved.
|
|
99
|
-
// Parent registration is idempotent, so this never duplicates.
|
|
100
|
-
if (this.hasRegistered) {
|
|
101
|
-
this.registerWithParent();
|
|
102
|
-
}
|
|
103
99
|
}
|
|
104
100
|
disconnectedCallback() {
|
|
105
101
|
// Unregister this option
|
|
106
102
|
const selectContext = this.getSelectContext();
|
|
107
103
|
selectContext === null || selectContext === void 0 ? void 0 : selectContext.unregisterOption(this.value);
|
|
108
|
-
this.
|
|
104
|
+
this.registeredVia = undefined;
|
|
105
|
+
this.selectConsumer.disconnect();
|
|
109
106
|
}
|
|
110
107
|
// If render() ran before the parent's selectContext was available (see the
|
|
111
108
|
// 'select' fallback in optionId's getter above), the DOM id was baked in as
|
|
@@ -118,23 +115,24 @@ export class SekiSelectOption {
|
|
|
118
115
|
optionEl.id = this.optionId;
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
|
-
registerWithParent() {
|
|
118
|
+
registerWithParent(selectContext) {
|
|
122
119
|
var _a;
|
|
123
|
-
const selectContext = this.getSelectContext();
|
|
124
120
|
const displayLabel = this.label || ((_a = this.el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
125
|
-
|
|
121
|
+
// Record first: registerOption republishes the context synchronously,
|
|
122
|
+
// which re-enters handleParentContextChange.
|
|
123
|
+
this.registeredVia = selectContext.registerOption;
|
|
124
|
+
selectContext.registerOption({
|
|
126
125
|
value: this.value,
|
|
127
126
|
label: displayLabel,
|
|
128
127
|
disabled: this.disabled,
|
|
129
128
|
});
|
|
130
|
-
this.hasRegistered = true;
|
|
131
129
|
}
|
|
132
130
|
// ===========================
|
|
133
131
|
// Helpers
|
|
134
132
|
// ===========================
|
|
135
133
|
getSelectContext() {
|
|
136
|
-
|
|
137
|
-
return
|
|
134
|
+
var _a;
|
|
135
|
+
return (_a = this.selectConsumer.context) !== null && _a !== void 0 ? _a : undefined;
|
|
138
136
|
}
|
|
139
137
|
// ===========================
|
|
140
138
|
// Render
|
|
@@ -143,7 +141,7 @@ export class SekiSelectOption {
|
|
|
143
141
|
const selectContext = this.getSelectContext();
|
|
144
142
|
const isSelected = (selectContext === null || selectContext === void 0 ? void 0 : selectContext.isValueSelected(this.value)) || false;
|
|
145
143
|
const isFocused = (selectContext === null || selectContext === void 0 ? void 0 : selectContext.focusedOptionValue) === this.value;
|
|
146
|
-
return (h(Host, { key: '
|
|
144
|
+
return (h(Host, { key: '0c513bf5a4f3d1b462836bb8abd08017f5b75880' }, h("div", { key: '7a4a9008d7c14d016ee2747e0a18ed6e94d769aa', class: "option", role: "option", id: this.optionId, onClick: this.handleOptionClick, onFocus: this.handleOptionFocus, onKeyDown: this.handleOptionKeyDown, "aria-selected": isSelected ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : undefined, "data-selected": isSelected ? 'true' : undefined, "data-focused": isFocused ? 'true' : undefined, "data-disabled": this.disabled ? 'true' : undefined, tabindex: -1 }, h("span", { key: '6660252c5c42e3e3fe297a734aecacf45bb9afab', class: "option-label" }, h("slot", { key: 'ab3c1a534982cdbe6dc75dc6174ecea320a1f21b' })), h("span", { key: 'a8bf08a92e88a1b3c0f61a2d5ec312f5b9f34b7f', class: "option-indicator", "aria-hidden": "true" }, h("slot", { key: '3e9b9d8ecdb242fdfaf6b0ff5a431f9b8ea6bd67', name: "selected-indicator" }, h("svg", { key: '238a90118e217381e39951d5b92859f759488075', width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '08be34c46c3017035ff9f281f433ffa9f91c7d06', d: "M10 3L4.5 8.5L2 6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })))))));
|
|
147
145
|
}
|
|
148
146
|
static get is() { return "seki-select-option"; }
|
|
149
147
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { buildOptionId } from "../../utils/select";
|
|
3
|
-
import {
|
|
3
|
+
import { ContextConsumer } from "../../utils/context-bridge";
|
|
4
4
|
/**
|
|
5
5
|
* @slot - Custom trigger content
|
|
6
6
|
* @slot pill - Custom pill rendering in multi-select mode
|
|
@@ -11,16 +11,16 @@ export class SekiSelectTrigger {
|
|
|
11
11
|
// ===========================
|
|
12
12
|
// Lifecycle
|
|
13
13
|
// ===========================
|
|
14
|
-
|
|
14
|
+
// One consumer covers value, open, focus, disabled and option registration:
|
|
15
|
+
// seki-select republishes on each of them. connect() reads the context right
|
|
16
|
+
// away, so a trigger that connects after the select already published still
|
|
17
|
+
// starts from the current value.
|
|
18
|
+
this.selectConsumer = new ContextConsumer('seki-select', 'selectContext', () => this.handleParentContextChange());
|
|
15
19
|
// ===========================
|
|
16
20
|
// Parent Event Listeners
|
|
17
21
|
// ===========================
|
|
18
|
-
this.
|
|
19
|
-
// Force re-render when parent's
|
|
20
|
-
this.forceUpdate++;
|
|
21
|
-
};
|
|
22
|
-
this.handleParentValueChange = () => {
|
|
23
|
-
// Force re-render when parent's value changes
|
|
22
|
+
this.handleParentContextChange = () => {
|
|
23
|
+
// Force re-render when the parent's context changes
|
|
24
24
|
this.forceUpdate++;
|
|
25
25
|
};
|
|
26
26
|
// ===========================
|
|
@@ -47,42 +47,36 @@ export class SekiSelectTrigger {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (this.buttonRef) {
|
|
53
|
-
this.buttonRef.addEventListener('click', this.handleButtonClick);
|
|
54
|
-
this.buttonRef.addEventListener('keydown', this.handleButtonKeyDown);
|
|
55
|
-
}
|
|
56
|
-
// Listen for state changes from parent
|
|
57
|
-
const parent = this.el.closest('seki-select');
|
|
58
|
-
if (parent) {
|
|
59
|
-
parent.addEventListener('sekiOpenChange', this.handleParentOpenChange);
|
|
60
|
-
parent.addEventListener('sekiChange', this.handleParentValueChange);
|
|
61
|
-
}
|
|
62
|
-
// sekiChange only fires for user-driven selection; programmatic value/
|
|
63
|
-
// focus/disabled changes (e.g. controlled-mode `select.value = x`) only
|
|
64
|
-
// emit the shared context-change event, so this needs its own subscription too.
|
|
65
|
-
this.contextSubscription = subscribeToContextChange(this.el, 'seki-select', this.handleParentValueChange);
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
this.selectConsumer.connect(this.el);
|
|
66
52
|
}
|
|
67
53
|
disconnectedCallback() {
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
// The button's own listeners need no cleanup: they live and die with it.
|
|
55
|
+
this.selectConsumer.disconnect();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Listeners follow the button element itself: the button only exists once a
|
|
59
|
+
* context is available (the first render may be the "Loading..." fallback
|
|
60
|
+
* when this trigger upgrades before its seki-select), so binding once in
|
|
61
|
+
* componentDidLoad could miss it entirely.
|
|
62
|
+
*/
|
|
63
|
+
setButtonRef(ref) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
const el = ref !== null && ref !== void 0 ? ref : undefined;
|
|
66
|
+
if (el === this.buttonRef)
|
|
67
|
+
return;
|
|
68
|
+
(_a = this.buttonRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleButtonClick);
|
|
69
|
+
(_b = this.buttonRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', this.handleButtonKeyDown);
|
|
70
|
+
this.buttonRef = el;
|
|
71
|
+
el === null || el === void 0 ? void 0 : el.addEventListener('click', this.handleButtonClick);
|
|
72
|
+
el === null || el === void 0 ? void 0 : el.addEventListener('keydown', this.handleButtonKeyDown);
|
|
79
73
|
}
|
|
80
74
|
// ===========================
|
|
81
75
|
// Helpers
|
|
82
76
|
// ===========================
|
|
83
77
|
getSelectContext() {
|
|
84
|
-
|
|
85
|
-
return
|
|
78
|
+
var _a;
|
|
79
|
+
return (_a = this.selectConsumer.context) !== null && _a !== void 0 ? _a : undefined;
|
|
86
80
|
}
|
|
87
81
|
renderPlaceholder() {
|
|
88
82
|
const parent = this.el.closest('seki-select');
|
|
@@ -121,7 +115,7 @@ export class SekiSelectTrigger {
|
|
|
121
115
|
}
|
|
122
116
|
const isOpen = selectContext.open;
|
|
123
117
|
const isDisabled = selectContext.disabled;
|
|
124
|
-
return (h(Host, null, h("button", { ref: (el) =>
|
|
118
|
+
return (h(Host, null, h("button", { ref: (el) => this.setButtonRef(el), type: "button", class: "trigger-button", role: "combobox", "aria-expanded": isOpen ? 'true' : 'false', "aria-controls": selectContext.contentId, "aria-activedescendant": selectContext.focusedOptionValue !== null
|
|
125
119
|
? buildOptionId(selectContext.contentId, selectContext.focusedOptionValue)
|
|
126
120
|
: undefined, "aria-label": selectContext.ariaLabel, "aria-labelledby": selectContext.ariaLabelledby, "aria-disabled": isDisabled ? 'true' : undefined, disabled: isDisabled, "data-disabled": isDisabled ? 'true' : undefined, "data-state": isOpen ? 'open' : 'closed' }, selectContext.multiple
|
|
127
121
|
? this.renderMultiValue(selectContext)
|