@melodicdev/components 2.0.3 → 3.1.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/README.md +7 -6
- package/assets/melodic-components.js +5681 -4145
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +6573 -5141
- package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts +15 -14
- package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.component.js +36 -16
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.js +4 -0
- package/lib/components/data-display/activity-feed/activity-feed-item.template.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.template.js +15 -14
- package/lib/components/data-display/avatar/avatar.component.d.ts +9 -4
- package/lib/components/data-display/avatar/avatar.component.d.ts.map +1 -1
- package/lib/components/data-display/avatar/avatar.component.js +12 -3
- package/lib/components/data-display/avatar/avatar.template.js +1 -1
- package/lib/components/data-display/badge/badge.component.d.ts +2 -3
- package/lib/components/data-display/badge/badge.component.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.js +56 -35
- package/lib/components/data-display/badge/badge.types.d.ts +2 -0
- package/lib/components/data-display/badge/badge.types.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +10 -0
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.js +59 -27
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +6 -5
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +49 -110
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +2 -6
- package/lib/components/data-display/list/list-item.component.d.ts +15 -6
- package/lib/components/data-display/list/list-item.component.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.component.js +57 -6
- package/lib/components/data-display/list/list-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.js +5 -0
- package/lib/components/data-display/list/list-item.template.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.template.js +18 -12
- package/lib/components/data-display/profile-card/profile-card.component.d.ts +2 -2
- package/lib/components/data-display/profile-card/profile-card.component.d.ts.map +1 -1
- package/lib/components/data-display/profile-card/profile-card.component.js +17 -15
- package/lib/components/data-display/profile-card/profile-card.template.js +1 -1
- package/lib/components/data-display/stat-card/stat-card.component.d.ts +6 -6
- package/lib/components/data-display/stat-card/stat-card.component.d.ts.map +1 -1
- package/lib/components/data-display/stat-card/stat-card.component.js +14 -6
- package/lib/components/data-display/stat-card/stat-card.template.js +4 -4
- package/lib/components/data-display/table/table.component.d.ts +7 -5
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +40 -117
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +1 -6
- package/lib/components/data-display/table-core/index.d.ts +3 -0
- package/lib/components/data-display/table-core/index.d.ts.map +1 -0
- package/lib/components/data-display/table-core/index.js +2 -0
- package/lib/components/data-display/table-core/table-core.d.ts +137 -0
- package/lib/components/data-display/table-core/table-core.d.ts.map +1 -0
- package/lib/components/data-display/table-core/table-core.js +225 -0
- package/lib/components/data-display/tag/tag.component.d.ts +14 -7
- package/lib/components/data-display/tag/tag.component.d.ts.map +1 -1
- package/lib/components/data-display/tag/tag.component.js +29 -5
- package/lib/components/data-display/tag/tag.template.js +2 -2
- package/lib/components/data-display/tag/tag.types.d.ts +8 -1
- package/lib/components/data-display/tag/tag.types.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.component.d.ts +6 -3
- package/lib/components/feedback/alert/alert.component.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.component.js +13 -4
- package/lib/components/feedback/alert/alert.template.js +1 -1
- package/lib/components/feedback/progress/progress.component.d.ts +4 -0
- package/lib/components/feedback/progress/progress.component.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.component.js +9 -0
- package/lib/components/feedback/progress/progress.template.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.template.js +19 -5
- package/lib/components/feedback/toast/toast.component.d.ts +6 -3
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +13 -4
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +2 -1
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +12 -4
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +39 -30
- package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.template.js +14 -0
- package/lib/components/forms/button/button.component.d.ts +28 -3
- package/lib/components/forms/button/button.component.d.ts.map +1 -1
- package/lib/components/forms/button/button.component.js +81 -6
- package/lib/components/forms/button/button.template.js +1 -1
- package/lib/components/forms/button/button.types.d.ts +8 -1
- package/lib/components/forms/button/button.types.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group-item.component.d.ts +2 -2
- package/lib/components/forms/button-group/button-group-item.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.d.ts +4 -2
- package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.js +3 -1
- package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.styles.js +15 -1
- package/lib/components/forms/button-group/button-group.template.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.template.js +4 -2
- package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -2
- package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.component.js +3 -1
- package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.styles.js +19 -0
- package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.template.js +4 -2
- package/lib/components/forms/date-picker/calendar.component.js +1 -1
- package/lib/components/forms/date-picker/date-picker.component.d.ts +11 -4
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +99 -32
- package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.styles.js +0 -10
- package/lib/components/forms/date-picker/date-picker.template.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.template.js +3 -4
- package/lib/components/forms/file-upload/file-upload-item.component.d.ts +7 -0
- package/lib/components/forms/file-upload/file-upload-item.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload-item.component.js +15 -0
- package/lib/components/forms/file-upload/file-upload.component.d.ts +15 -0
- package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.component.js +56 -0
- package/lib/components/forms/form-field/form-field.component.d.ts +12 -4
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +50 -31
- package/lib/components/forms/form-field/form-field.template.js +1 -1
- package/lib/components/forms/input/input.component.d.ts +2 -2
- package/lib/components/forms/input/input.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio-group.component.d.ts +6 -0
- package/lib/components/forms/radio/radio-group.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio-group.component.js +69 -2
- package/lib/components/forms/radio/radio-group.template.js +1 -1
- package/lib/components/forms/radio/radio.component.d.ts +7 -2
- package/lib/components/forms/radio/radio.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.component.js +5 -0
- package/lib/components/forms/radio/radio.template.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.template.js +1 -0
- package/lib/components/forms/select/select.component.d.ts +21 -6
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +94 -36
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +6 -2
- package/lib/components/forms/slider/slider.component.d.ts +2 -2
- package/lib/components/forms/slider/slider.component.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.component.js +5 -1
- package/lib/components/forms/textarea/textarea.component.d.ts +2 -2
- package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.component.d.ts +4 -2
- package/lib/components/forms/toggle/toggle.component.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.component.js +3 -1
- package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.styles.js +19 -0
- package/lib/components/forms/toggle/toggle.template.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.template.js +11 -3
- package/lib/components/foundation/card/card.component.d.ts +7 -6
- package/lib/components/foundation/card/card.component.d.ts.map +1 -1
- package/lib/components/foundation/card/card.component.js +18 -7
- package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
- package/lib/components/foundation/card/card.styles.js +5 -0
- package/lib/components/foundation/card/card.template.d.ts.map +1 -1
- package/lib/components/foundation/card/card.template.js +16 -11
- package/lib/components/foundation/divider/divider.component.d.ts +5 -4
- package/lib/components/foundation/divider/divider.component.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.component.js +11 -3
- package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.styles.js +6 -0
- package/lib/components/foundation/divider/divider.template.d.ts +5 -0
- package/lib/components/foundation/divider/divider.template.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.template.js +9 -6
- package/lib/components/general/icon/icon.template.d.ts.map +1 -1
- package/lib/components/general/icon/icon.template.js +3 -1
- package/lib/components/navigation/pagination/pagination.component.d.ts +5 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.component.js +22 -10
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +6 -4
- package/lib/components/navigation/sidebar/sidebar-item.component.d.ts +4 -4
- package/lib/components/navigation/sidebar/sidebar-item.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.component.js +11 -4
- package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +7 -0
- package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.component.js +48 -5
- package/lib/components/navigation/steps/step-panel.component.d.ts +7 -0
- package/lib/components/navigation/steps/step-panel.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step-panel.component.js +7 -0
- package/lib/components/navigation/steps/step-panel.template.d.ts +1 -1
- package/lib/components/navigation/steps/step-panel.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/step-panel.template.js +2 -2
- package/lib/components/navigation/steps/step.component.d.ts +2 -2
- package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.component.js +8 -2
- package/lib/components/navigation/steps/step.template.js +1 -1
- package/lib/components/navigation/steps/steps.component.d.ts +3 -1
- package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.component.js +47 -14
- package/lib/components/navigation/steps/steps.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.template.js +5 -1
- package/lib/components/navigation/tabs/tab-panel.component.d.ts +7 -0
- package/lib/components/navigation/tabs/tab-panel.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.component.js +7 -0
- package/lib/components/navigation/tabs/tab-panel.template.d.ts +1 -1
- package/lib/components/navigation/tabs/tab-panel.template.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.template.js +2 -2
- package/lib/components/navigation/tabs/tabs.component.d.ts +5 -3
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +49 -14
- package/lib/components/navigation/tabs/tabs.template.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.template.js +6 -1
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +17 -2
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +52 -6
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +5 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts +2 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +46 -18
- package/lib/components/overlays/drawer/drawer.component.d.ts +9 -2
- package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.js +34 -4
- package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.styles.js +4 -0
- package/lib/components/overlays/dropdown/dropdown-item.component.d.ts +5 -2
- package/lib/components/overlays/dropdown/dropdown-item.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.component.js +18 -0
- package/lib/components/overlays/dropdown/dropdown-item.template.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.template.js +0 -3
- package/lib/components/overlays/dropdown/dropdown.component.d.ts +8 -4
- package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.component.js +61 -60
- package/lib/components/overlays/popover/popover.component.d.ts +6 -4
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +37 -51
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +29 -4
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +73 -31
- package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.styles.js +22 -10
- package/lib/components/overlays/tooltip/tooltip.template.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.template.js +3 -2
- package/lib/components/pages/auth/login-page.component.d.ts +11 -4
- package/lib/components/pages/auth/login-page.component.d.ts.map +1 -1
- package/lib/components/pages/auth/login-page.component.js +18 -5
- package/lib/components/pages/auth/login-page.template.d.ts.map +1 -1
- package/lib/components/pages/auth/login-page.template.js +9 -10
- package/lib/components/pages/auth/signup-page.component.d.ts +11 -4
- package/lib/components/pages/auth/signup-page.component.d.ts.map +1 -1
- package/lib/components/pages/auth/signup-page.component.js +18 -5
- package/lib/components/pages/auth/signup-page.template.d.ts.map +1 -1
- package/lib/components/pages/auth/signup-page.template.js +9 -10
- package/lib/components/pages/dashboard/dashboard-page.component.d.ts +18 -11
- package/lib/components/pages/dashboard/dashboard-page.component.d.ts.map +1 -1
- package/lib/components/pages/dashboard/dashboard-page.component.js +55 -13
- package/lib/components/pages/dashboard/dashboard-page.template.js +1 -1
- package/lib/components/sections/app-shell/app-shell.component.d.ts +6 -6
- package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.component.js +14 -6
- package/lib/components/sections/app-shell/app-shell.template.js +3 -3
- package/lib/components/sections/hero/hero-section.component.d.ts +6 -3
- package/lib/components/sections/hero/hero-section.component.d.ts.map +1 -1
- package/lib/components/sections/hero/hero-section.component.js +13 -4
- package/lib/components/sections/hero/hero-section.template.js +2 -2
- package/lib/components/sections/page-header/page-header.component.d.ts +16 -17
- package/lib/components/sections/page-header/page-header.component.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.component.js +36 -25
- package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.styles.js +9 -0
- package/lib/components/sections/page-header/page-header.template.d.ts +5 -0
- package/lib/components/sections/page-header/page-header.template.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.template.js +42 -31
- package/lib/components/sections/page-section/page-section.component.d.ts +16 -12
- package/lib/components/sections/page-section/page-section.component.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.component.js +34 -12
- package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.styles.js +6 -0
- package/lib/components/sections/page-section/page-section.template.d.ts +6 -0
- package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.template.js +26 -15
- package/lib/components/sections/page-section/sanitize-href.function.d.ts +12 -0
- package/lib/components/sections/page-section/sanitize-href.function.d.ts.map +1 -0
- package/lib/components/sections/page-section/sanitize-href.function.js +15 -0
- package/lib/directives/tooltip.directive.d.ts +8 -2
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +103 -9
- package/lib/functions/deprecation.functions.d.ts +21 -0
- package/lib/functions/deprecation.functions.d.ts.map +1 -0
- package/lib/functions/deprecation.functions.js +44 -0
- package/lib/functions/index.d.ts +2 -0
- package/lib/functions/index.d.ts.map +1 -1
- package/lib/functions/index.js +2 -0
- package/lib/functions/watch-slot-presence.function.d.ts +17 -0
- package/lib/functions/watch-slot-presence.function.d.ts.map +1 -0
- package/lib/functions/watch-slot-presence.function.js +27 -0
- package/lib/theme/functions/create-theme.function.d.ts +15 -1
- package/lib/theme/functions/create-theme.function.d.ts.map +1 -1
- package/lib/theme/functions/create-theme.function.js +57 -11
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/types/index.d.ts +8 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.d.ts +19 -1
- package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.js +77 -8
- package/lib/utils/accessibility/index.d.ts +2 -1
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -1
- package/lib/utils/accessibility/live-region.d.ts +10 -3
- package/lib/utils/accessibility/live-region.d.ts.map +1 -1
- package/lib/utils/accessibility/live-region.js +64 -35
- package/lib/utils/directives/click-outside.directive.d.ts.map +1 -1
- package/lib/utils/directives/click-outside.directive.js +5 -3
- package/lib/utils/overlay/index.d.ts +4 -0
- package/lib/utils/overlay/index.d.ts.map +1 -0
- package/lib/utils/overlay/index.js +2 -0
- package/lib/utils/overlay/overlay-positioner.d.ts +54 -0
- package/lib/utils/overlay/overlay-positioner.d.ts.map +1 -0
- package/lib/utils/overlay/overlay-positioner.js +85 -0
- package/lib/utils/overlay/toggle-dismiss-guard.d.ts +24 -0
- package/lib/utils/overlay/toggle-dismiss-guard.d.ts.map +1 -0
- package/lib/utils/overlay/toggle-dismiss-guard.js +36 -0
- package/lib/utils/positioning/auto-update.d.ts.map +1 -1
- package/lib/utils/positioning/auto-update.js +3 -0
- package/lib/utils/positioning/compute-position.d.ts.map +1 -1
- package/lib/utils/positioning/compute-position.js +8 -4
- package/lib/utils/positioning/middlewares/flip.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/flip.middleware.js +10 -3
- package/lib/utils/positioning/middlewares/offset.middleware.d.ts +15 -0
- package/lib/utils/positioning/middlewares/offset.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/offset.middleware.js +31 -1
- package/lib/utils/positioning/middlewares/shift.middleware.d.ts +13 -3
- package/lib/utils/positioning/middlewares/shift.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/shift.middleware.js +15 -7
- package/package.json +6 -2
|
@@ -5,8 +5,43 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
|
+
import { registerAdapter } from '@melodicdev/core/forms';
|
|
8
9
|
import { fileUploadTemplate } from './file-upload.template.js';
|
|
9
10
|
import { fileUploadStyles } from './file-upload.styles.js';
|
|
11
|
+
// Forms adapter: lets `:formControl` bind to ml-file-upload. The control value
|
|
12
|
+
// is the selected File[] in `multiple` mode, or a single File | null otherwise.
|
|
13
|
+
// Validator messages auto-populate the existing `error` attribute via the
|
|
14
|
+
// directive's standard error sync.
|
|
15
|
+
registerAdapter((el) => el.tagName === 'ML-FILE-UPLOAD', {
|
|
16
|
+
inputEvent: 'ml:change',
|
|
17
|
+
blurEvent: 'focusout',
|
|
18
|
+
getValue: (el) => {
|
|
19
|
+
const e = el;
|
|
20
|
+
return e.multiple ? e.files : (e.files[0] ?? null);
|
|
21
|
+
},
|
|
22
|
+
setValue: (el, value) => {
|
|
23
|
+
const e = el;
|
|
24
|
+
if (value === null || value === undefined) {
|
|
25
|
+
if (e.files.length > 0)
|
|
26
|
+
e.files = [];
|
|
27
|
+
}
|
|
28
|
+
else if (Array.isArray(value)) {
|
|
29
|
+
e.files = value;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
e.files = [value];
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setDisabled: (el, disabled) => {
|
|
36
|
+
el.disabled = disabled;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* ml-file-upload - Drag-and-drop / click-to-browse file selection dropzone
|
|
41
|
+
*
|
|
42
|
+
* @fires ml:change - Emitted when valid files are selected. Detail: { files }
|
|
43
|
+
* @fires ml:error - Emitted when files fail validation. Detail: { errors }
|
|
44
|
+
*/
|
|
10
45
|
let FileUploadComponent = class FileUploadComponent {
|
|
11
46
|
constructor() {
|
|
12
47
|
this.accept = '';
|
|
@@ -21,6 +56,24 @@ let FileUploadComponent = class FileUploadComponent {
|
|
|
21
56
|
this.icon = 'cloud-arrow-up';
|
|
22
57
|
this.dragOver = false;
|
|
23
58
|
this._dragCounter = 0;
|
|
59
|
+
/**
|
|
60
|
+
* The currently selected (valid) files. Accumulates across selections in
|
|
61
|
+
* `multiple` mode and is replaced by the latest selection otherwise. This
|
|
62
|
+
* backs the forms adapter, so a bound FormControl stays in sync; it can
|
|
63
|
+
* also be set programmatically (e.g. control.setValue([]) to reset).
|
|
64
|
+
*/
|
|
65
|
+
this.files = [];
|
|
66
|
+
/** Remove a previously selected file (keeps a bound FormControl in sync). */
|
|
67
|
+
this.removeFile = (file) => {
|
|
68
|
+
if (!this.files.includes(file))
|
|
69
|
+
return;
|
|
70
|
+
this.files = this.files.filter((f) => f !== file);
|
|
71
|
+
this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true,
|
|
74
|
+
detail: { files: this.files }
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
24
77
|
this.handleClick = () => {
|
|
25
78
|
if (this.disabled)
|
|
26
79
|
return;
|
|
@@ -111,6 +164,9 @@ let FileUploadComponent = class FileUploadComponent {
|
|
|
111
164
|
}));
|
|
112
165
|
}
|
|
113
166
|
if (validFiles.length > 0) {
|
|
167
|
+
// Track selection state (backs the forms adapter): accumulate in
|
|
168
|
+
// multiple mode, replace in single mode.
|
|
169
|
+
this.files = this.multiple ? [...this.files, ...validFiles] : validFiles.slice(0, 1);
|
|
114
170
|
this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
|
|
115
171
|
bubbles: true,
|
|
116
172
|
composed: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IElementRef, OnCreate } from '@melodicdev/core';
|
|
2
|
-
import type {
|
|
1
|
+
import type { IElementRef, OnCreate, OnRender } from '@melodicdev/core';
|
|
2
|
+
import type { ControlSize } from '../../../types/index.js';
|
|
3
3
|
import type { FormFieldOrientation } from './form-field.types.js';
|
|
4
4
|
/**
|
|
5
5
|
* ml-form-field - Wrapper component that adds label, hint, and error to any form control
|
|
@@ -21,7 +21,7 @@ import type { FormFieldOrientation } from './form-field.types.js';
|
|
|
21
21
|
*
|
|
22
22
|
* @slot default - The form control element
|
|
23
23
|
*/
|
|
24
|
-
export declare class FormFieldComponent implements IElementRef, OnCreate {
|
|
24
|
+
export declare class FormFieldComponent implements IElementRef, OnCreate, OnRender {
|
|
25
25
|
elementRef: HTMLElement;
|
|
26
26
|
/** Label text */
|
|
27
27
|
label: string;
|
|
@@ -30,7 +30,7 @@ export declare class FormFieldComponent implements IElementRef, OnCreate {
|
|
|
30
30
|
/** Error message (shows error state when set) */
|
|
31
31
|
error: string;
|
|
32
32
|
/** Field size */
|
|
33
|
-
size:
|
|
33
|
+
size: ControlSize;
|
|
34
34
|
/** Layout orientation */
|
|
35
35
|
orientation: FormFieldOrientation;
|
|
36
36
|
/** Disabled state */
|
|
@@ -44,8 +44,16 @@ export declare class FormFieldComponent implements IElementRef, OnCreate {
|
|
|
44
44
|
get errorId(): string;
|
|
45
45
|
get describedBy(): string;
|
|
46
46
|
onCreate(): void;
|
|
47
|
+
onRender(): void;
|
|
47
48
|
handleSlotChange: () => void;
|
|
49
|
+
/** Cached slotted control — connectSlottedControl runs every render, so the
|
|
50
|
+
* slot scan + recursive control search must not. Invalidated on slotchange
|
|
51
|
+
* (and when the cached element leaves the DOM, e.g. a nested swap that
|
|
52
|
+
* doesn't re-assign the slot). */
|
|
53
|
+
private _control;
|
|
54
|
+
private _controlResolved;
|
|
48
55
|
private connectSlottedControl;
|
|
56
|
+
private syncAttribute;
|
|
49
57
|
private findFormControl;
|
|
50
58
|
}
|
|
51
59
|
//# sourceMappingURL=form-field.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAMa,kBAAmB,YAAW,WAAW,EAAE,QAAQ,EAAE,QAAQ;IAClE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,wCAAwC;IACjC,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,yBAAyB;IAClB,WAAW,EAAE,oBAAoB,CAAc;IAEtD,qBAAqB;IACd,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6D;IAEtF,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,WAAW,IAAI,MAAM,CAM/B;IAEM,QAAQ,IAAI,IAAI;IAIhB,QAAQ,IAAI,IAAI;IAOhB,gBAAgB,QAAO,IAAI,CAGhC;IAEF;;;sCAGkC;IAClC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;CAqCvB"}
|
|
@@ -46,8 +46,15 @@ let FormFieldComponent = class FormFieldComponent {
|
|
|
46
46
|
/** Unique ID for connecting label to control */
|
|
47
47
|
this._fieldId = `ml-form-field-${Math.random().toString(36).slice(2, 9)}`;
|
|
48
48
|
this.handleSlotChange = () => {
|
|
49
|
+
this._controlResolved = false;
|
|
49
50
|
this.connectSlottedControl();
|
|
50
51
|
};
|
|
52
|
+
/** Cached slotted control — connectSlottedControl runs every render, so the
|
|
53
|
+
* slot scan + recursive control search must not. Invalidated on slotchange
|
|
54
|
+
* (and when the cached element leaves the DOM, e.g. a nested swap that
|
|
55
|
+
* doesn't re-assign the slot). */
|
|
56
|
+
this._control = null;
|
|
57
|
+
this._controlResolved = false;
|
|
51
58
|
}
|
|
52
59
|
get fieldId() {
|
|
53
60
|
return this._fieldId;
|
|
@@ -59,45 +66,57 @@ let FormFieldComponent = class FormFieldComponent {
|
|
|
59
66
|
return `${this._fieldId}-error`;
|
|
60
67
|
}
|
|
61
68
|
get describedBy() {
|
|
69
|
+
// Both the error and the hint describe the control when both are present.
|
|
70
|
+
const ids = [];
|
|
62
71
|
if (this.error)
|
|
63
|
-
|
|
72
|
+
ids.push(this.errorId);
|
|
64
73
|
if (this.hint)
|
|
65
|
-
|
|
66
|
-
return '';
|
|
74
|
+
ids.push(this.hintId);
|
|
75
|
+
return ids.join(' ');
|
|
67
76
|
}
|
|
68
77
|
onCreate() {
|
|
69
78
|
this.connectSlottedControl();
|
|
70
79
|
}
|
|
80
|
+
onRender() {
|
|
81
|
+
// Re-sync ARIA after every render so reactive changes to error/hint/
|
|
82
|
+
// required (e.g. validation errors set after submit) reach the slotted
|
|
83
|
+
// control — and are removed again when the error clears.
|
|
84
|
+
this.connectSlottedControl();
|
|
85
|
+
}
|
|
71
86
|
connectSlottedControl() {
|
|
72
|
-
|
|
73
|
-
|
|
87
|
+
if (this._control && !this._control.isConnected) {
|
|
88
|
+
this._controlResolved = false;
|
|
89
|
+
}
|
|
90
|
+
if (!this._controlResolved) {
|
|
91
|
+
const slot = this.elementRef.shadowRoot?.querySelector('slot:not([name])');
|
|
92
|
+
if (!slot)
|
|
93
|
+
return;
|
|
94
|
+
this._control = this.findFormControl(slot.assignedElements({ flatten: true }));
|
|
95
|
+
this._controlResolved = true;
|
|
96
|
+
}
|
|
97
|
+
const control = this._control;
|
|
98
|
+
if (!control)
|
|
74
99
|
return;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
control.setAttribute('aria-required', 'true');
|
|
96
|
-
}
|
|
97
|
-
// Set disabled if applicable
|
|
98
|
-
if (this.disabled && 'disabled' in control) {
|
|
99
|
-
control.disabled = true;
|
|
100
|
-
}
|
|
100
|
+
// Set ID if not present
|
|
101
|
+
if (!control.id) {
|
|
102
|
+
control.id = this.fieldId;
|
|
103
|
+
}
|
|
104
|
+
// Connect aria-describedby for hint/error; remove when neither is set.
|
|
105
|
+
// Writes are diffed so a no-change render doesn't touch the DOM.
|
|
106
|
+
this.syncAttribute(control, 'aria-describedby', this.describedBy || null);
|
|
107
|
+
this.syncAttribute(control, 'aria-invalid', this.error ? 'true' : null);
|
|
108
|
+
this.syncAttribute(control, 'aria-required', this.required ? 'true' : null);
|
|
109
|
+
// Set disabled if applicable
|
|
110
|
+
if (this.disabled && 'disabled' in control) {
|
|
111
|
+
control.disabled = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
syncAttribute(el, name, value) {
|
|
115
|
+
if (value === null) {
|
|
116
|
+
el.removeAttribute(name);
|
|
117
|
+
}
|
|
118
|
+
else if (el.getAttribute(name) !== value) {
|
|
119
|
+
el.setAttribute(name, value);
|
|
101
120
|
}
|
|
102
121
|
}
|
|
103
122
|
findFormControl(elements) {
|
|
@@ -22,7 +22,7 @@ export function formFieldTemplate(c) {
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
${when(!!c.error, () => html `<span id=${c.errorId} class="ml-form-field__error">${c.error}</span>`)}
|
|
25
|
-
${when(
|
|
25
|
+
${when(!!c.hint, () => html `<span id=${c.hintId} class="ml-form-field__hint">${c.hint}</span>`)}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElementRef, OnInit } from '@melodicdev/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ControlSize } from '../../../types/index.js';
|
|
3
3
|
import type { InputType } from './input.types.js';
|
|
4
4
|
/**
|
|
5
5
|
* ml-input - Text input component with label, hint, and error states
|
|
@@ -35,7 +35,7 @@ export declare class InputComponent implements IElementRef, OnInit {
|
|
|
35
35
|
/** Error message (shows error state when set) */
|
|
36
36
|
error: string;
|
|
37
37
|
/** Input size */
|
|
38
|
-
size:
|
|
38
|
+
size: ControlSize;
|
|
39
39
|
/** Disable the input */
|
|
40
40
|
disabled: boolean;
|
|
41
41
|
/** Make input readonly */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAYlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAMa,cAAe,YAAW,WAAW,EAAE,MAAM;IAClD,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,IAAI,EAAE,SAAS,CAAU;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,kCAAkC;IAC3B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,wBAAwB;IACjB,QAAQ,UAAS;IAExB,0BAA0B;IACnB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,YAAY,SAAS;IAE5B,2BAA2B;IACpB,OAAO,UAAS;IAEhB,MAAM,IAAI,IAAI;IAOd,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
|
|
@@ -35,6 +35,12 @@ export declare class RadioGroupComponent implements IElementRef, OnInit {
|
|
|
35
35
|
onCreate(): void;
|
|
36
36
|
onRender(): void;
|
|
37
37
|
private handleChildChange;
|
|
38
|
+
/** WAI-ARIA radio group keyboard support: arrows move focus AND selection. */
|
|
39
|
+
private handleKeyDown;
|
|
40
|
+
private selectRadio;
|
|
41
|
+
private focusRadio;
|
|
42
|
+
private getRadioValue;
|
|
43
|
+
private getEnabledRadios;
|
|
38
44
|
private updateChildRadios;
|
|
39
45
|
}
|
|
40
46
|
//# sourceMappingURL=radio-group.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;GAYG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,MAAM;IACvD,UAAU,EAAG,WAAW,CAAC;IAEhC,kBAAkB;IACX,KAAK,SAAM;IAElB,sBAAsB;IACf,IAAI,SAAM;IAEjB,6BAA6B;IACtB,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,oBAAoB;IACb,KAAK,SAAM;IAElB,yBAAyB;IAClB,WAAW,EAAE,WAAW,CAAc;IAE7C,qBAAqB;IACd,QAAQ,UAAS;IAExB,qBAAqB;IACd,QAAQ,UAAS;IAEjB,MAAM,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"radio-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;GAYG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,MAAM;IACvD,UAAU,EAAG,WAAW,CAAC;IAEhC,kBAAkB;IACX,KAAK,SAAM;IAElB,sBAAsB;IACf,IAAI,SAAM;IAEjB,6BAA6B;IACtB,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,oBAAoB;IACb,KAAK,SAAM;IAElB,yBAAyB;IAClB,WAAW,EAAE,WAAW,CAAc;IAE7C,qBAAqB;IACd,QAAQ,UAAS;IAExB,qBAAqB;IACd,QAAQ,UAAS;IAEjB,MAAM,IAAI,IAAI;IAQd,QAAQ,IAAI,IAAI;IAMhB,QAAQ,IAAI,IAAI;IAOvB,OAAO,CAAC,iBAAiB,CAuBvB;IAEF,8EAA8E;IAC9E,OAAO,CAAC,aAAa,CA8BnB;IAEF,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,iBAAiB;CAoCzB"}
|
|
@@ -50,6 +50,9 @@ let RadioGroupComponent = class RadioGroupComponent {
|
|
|
50
50
|
if (event.target === this.elementRef) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
+
// Consume the child radio's event so consumers observe exactly one
|
|
54
|
+
// ml:change per selection (the group's re-emit below).
|
|
55
|
+
event.stopImmediatePropagation();
|
|
53
56
|
const detail = event.detail;
|
|
54
57
|
this.value = detail.value;
|
|
55
58
|
// Update checked state on all child radios
|
|
@@ -61,10 +64,44 @@ let RadioGroupComponent = class RadioGroupComponent {
|
|
|
61
64
|
detail: { value: this.value }
|
|
62
65
|
}));
|
|
63
66
|
};
|
|
67
|
+
/** WAI-ARIA radio group keyboard support: arrows move focus AND selection. */
|
|
68
|
+
this.handleKeyDown = (event) => {
|
|
69
|
+
if (this.disabled)
|
|
70
|
+
return;
|
|
71
|
+
let direction = 0;
|
|
72
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
|
|
73
|
+
direction = 1;
|
|
74
|
+
}
|
|
75
|
+
else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
|
|
76
|
+
direction = -1;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const radios = this.getEnabledRadios();
|
|
82
|
+
if (radios.length === 0)
|
|
83
|
+
return;
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
// Current position: the radio that received the key, falling back to the
|
|
86
|
+
// checked radio, falling back to just before/at the first.
|
|
87
|
+
const originRadio = event.target?.closest?.('ml-radio') ?? null;
|
|
88
|
+
let index = originRadio ? radios.indexOf(originRadio) : -1;
|
|
89
|
+
if (index === -1) {
|
|
90
|
+
index = radios.findIndex((radio) => this.getRadioValue(radio) === this.value && this.value !== '');
|
|
91
|
+
}
|
|
92
|
+
if (index === -1) {
|
|
93
|
+
index = direction === 1 ? -1 : 0;
|
|
94
|
+
}
|
|
95
|
+
const next = radios[(index + direction + radios.length) % radios.length];
|
|
96
|
+
this.selectRadio(next);
|
|
97
|
+
};
|
|
64
98
|
}
|
|
65
99
|
onInit() {
|
|
66
100
|
// Listen for changes from child radios
|
|
67
101
|
this.elementRef.addEventListener('ml:change', this.handleChildChange);
|
|
102
|
+
// Arrow-key navigation (roving tabindex) — radios live in their own
|
|
103
|
+
// shadow roots so native radio grouping does not apply.
|
|
104
|
+
this.elementRef.addEventListener('keydown', this.handleKeyDown);
|
|
68
105
|
}
|
|
69
106
|
onCreate() {
|
|
70
107
|
// Re-sync when slotted radios are added/removed.
|
|
@@ -77,24 +114,54 @@ let RadioGroupComponent = class RadioGroupComponent {
|
|
|
77
114
|
// reset — are reflected on the slotted radios.
|
|
78
115
|
this.updateChildRadios();
|
|
79
116
|
}
|
|
117
|
+
selectRadio(radio) {
|
|
118
|
+
this.value = this.getRadioValue(radio);
|
|
119
|
+
this.updateChildRadios();
|
|
120
|
+
this.focusRadio(radio);
|
|
121
|
+
this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
|
|
122
|
+
bubbles: true,
|
|
123
|
+
composed: true,
|
|
124
|
+
detail: { value: this.value }
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
focusRadio(radio) {
|
|
128
|
+
const input = radio.shadowRoot?.querySelector('.ml-radio__input');
|
|
129
|
+
input?.focus();
|
|
130
|
+
}
|
|
131
|
+
getRadioValue(radio) {
|
|
132
|
+
return radio.value ?? radio.getAttribute('value') ?? '';
|
|
133
|
+
}
|
|
134
|
+
getEnabledRadios() {
|
|
135
|
+
return Array.from(this.elementRef.querySelectorAll('ml-radio')).filter((radio) => radio.disabled !== true && !radio.hasAttribute('disabled'));
|
|
136
|
+
}
|
|
80
137
|
updateChildRadios() {
|
|
81
138
|
const radios = this.elementRef.querySelectorAll('ml-radio');
|
|
82
139
|
if (this.value === '') {
|
|
83
140
|
for (const radio of radios) {
|
|
84
141
|
const isChecked = radio.checked === true || radio.hasAttribute('checked');
|
|
85
142
|
if (isChecked) {
|
|
86
|
-
this.value =
|
|
143
|
+
this.value = this.getRadioValue(radio);
|
|
87
144
|
break;
|
|
88
145
|
}
|
|
89
146
|
}
|
|
90
147
|
}
|
|
148
|
+
// Roving tabindex: the checked radio is the single tab stop; when nothing
|
|
149
|
+
// is checked, the first enabled radio takes it.
|
|
150
|
+
let tabbableRadio = null;
|
|
151
|
+
if (this.value !== '') {
|
|
152
|
+
tabbableRadio = Array.from(radios).find((radio) => this.getRadioValue(radio) === this.value && radio.disabled !== true && !radio.hasAttribute('disabled')) ?? null;
|
|
153
|
+
}
|
|
154
|
+
if (!tabbableRadio) {
|
|
155
|
+
tabbableRadio = this.getEnabledRadios()[0] ?? null;
|
|
156
|
+
}
|
|
91
157
|
radios.forEach((radio) => {
|
|
92
158
|
if (this.name) {
|
|
93
159
|
radio.name = this.name;
|
|
94
160
|
}
|
|
95
161
|
radio.disabled = this.disabled;
|
|
96
|
-
const radioValue =
|
|
162
|
+
const radioValue = this.getRadioValue(radio);
|
|
97
163
|
radio.checked = this.value !== '' && radioValue === this.value;
|
|
164
|
+
radio.tabbable = radio === tabbableRadio;
|
|
98
165
|
});
|
|
99
166
|
}
|
|
100
167
|
};
|
|
@@ -9,7 +9,7 @@ export function radioGroupTemplate(c) {
|
|
|
9
9
|
'ml-radio-group--error': !!c.error
|
|
10
10
|
})}
|
|
11
11
|
role="radiogroup"
|
|
12
|
-
aria-labelledby=${c.label ? 'legend' :
|
|
12
|
+
aria-labelledby=${c.label ? 'legend' : undefined}
|
|
13
13
|
>
|
|
14
14
|
${when(!!c.label, () => html `
|
|
15
15
|
<legend id="legend" class="ml-radio-group__legend">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElementRef } from '@melodicdev/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ControlSize } from '../../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* ml-radio - Radio input component
|
|
5
5
|
*
|
|
@@ -22,11 +22,16 @@ export declare class RadioComponent implements IElementRef {
|
|
|
22
22
|
/** Hint text */
|
|
23
23
|
hint: string;
|
|
24
24
|
/** Radio size */
|
|
25
|
-
size:
|
|
25
|
+
size: ControlSize;
|
|
26
26
|
/** Checked state */
|
|
27
27
|
checked: boolean;
|
|
28
28
|
/** Disabled state */
|
|
29
29
|
disabled: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the radio participates in the tab order (roving tabindex).
|
|
32
|
+
* Managed by ml-radio-group; standalone radios remain tabbable.
|
|
33
|
+
*/
|
|
34
|
+
tabbable: boolean;
|
|
30
35
|
handleChange: () => void;
|
|
31
36
|
}
|
|
32
37
|
//# sourceMappingURL=radio.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;;;;;;;;GAUG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,uBAAuB;IAChB,IAAI,SAAM;IAEjB,kBAAkB;IACX,KAAK,SAAM;IAElB,kBAAkB;IACX,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,oBAAoB;IACb,OAAO,UAAS;IAEvB,qBAAqB;IACd,QAAQ,UAAS;IAExB;;;OAGG;IACI,QAAQ,UAAQ;IAEhB,YAAY,QAAO,IAAI,CAU5B;CACF"}
|
|
@@ -34,6 +34,11 @@ let RadioComponent = class RadioComponent {
|
|
|
34
34
|
this.checked = false;
|
|
35
35
|
/** Disabled state */
|
|
36
36
|
this.disabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the radio participates in the tab order (roving tabindex).
|
|
39
|
+
* Managed by ml-radio-group; standalone radios remain tabbable.
|
|
40
|
+
*/
|
|
41
|
+
this.tabbable = true;
|
|
37
42
|
this.handleChange = () => {
|
|
38
43
|
this.checked = true;
|
|
39
44
|
this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"radio.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,6CA2B9C"}
|
|
@@ -66,9 +66,12 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
|
|
|
66
66
|
/** Bound event handlers for cleanup */
|
|
67
67
|
private readonly _handleKeyDown;
|
|
68
68
|
private readonly _handlePopoverToggle;
|
|
69
|
-
private
|
|
69
|
+
private readonly _uid;
|
|
70
|
+
private readonly _positioner;
|
|
70
71
|
private _lastCloseTime;
|
|
71
72
|
private _syncingValues;
|
|
73
|
+
private _typeaheadBuffer;
|
|
74
|
+
private _typeaheadLastTime;
|
|
72
75
|
onCreate(): void;
|
|
73
76
|
onDestroy(): void;
|
|
74
77
|
onPropertyChange(name: string): void;
|
|
@@ -80,6 +83,14 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
|
|
|
80
83
|
get displayText(): string;
|
|
81
84
|
get filteredOptions(): SelectOption[];
|
|
82
85
|
get hasValue(): boolean;
|
|
86
|
+
/** Unique id of the label element (for aria-labelledby) */
|
|
87
|
+
get labelId(): string;
|
|
88
|
+
/** Unique id of the listbox element (for aria-controls) */
|
|
89
|
+
get listboxId(): string;
|
|
90
|
+
/** Unique id for the option at the given display index */
|
|
91
|
+
optionId: (index: number) => string;
|
|
92
|
+
/** Id of the keyboard-focused option, or undefined when none (omits the attribute) */
|
|
93
|
+
get activeDescendant(): string | undefined;
|
|
83
94
|
/** Toggle dropdown open/close */
|
|
84
95
|
toggle: () => void;
|
|
85
96
|
/** Open the dropdown */
|
|
@@ -97,14 +108,18 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
|
|
|
97
108
|
handleSearchClick: (event: Event) => void;
|
|
98
109
|
/** Handle popover toggle events (open/close via Popover API) */
|
|
99
110
|
private onPopoverToggle;
|
|
100
|
-
/**
|
|
101
|
-
private
|
|
102
|
-
|
|
103
|
-
private addScrollListener;
|
|
104
|
-
private removeScrollListener;
|
|
111
|
+
/** Keep the dropdown positioned while open (repositions on scroll/resize). */
|
|
112
|
+
private startPositioning;
|
|
113
|
+
private stopPositioning;
|
|
105
114
|
private getDropdownEl;
|
|
106
115
|
/** Handle keyboard navigation */
|
|
107
116
|
private onKeyDown;
|
|
117
|
+
/** Native-select-style type-to-jump: accumulate printable characters and jump to the matching option */
|
|
118
|
+
private handleTypeahead;
|
|
119
|
+
/** Find the first enabled option whose label starts with query, searching forward from startIndex + 1 and wrapping */
|
|
120
|
+
private findTypeaheadMatch;
|
|
121
|
+
/** Keep the keyboard-focused option visible within the scrollable dropdown */
|
|
122
|
+
private scrollFocusedOptionIntoView;
|
|
108
123
|
/** Move focus to next enabled option */
|
|
109
124
|
private focusNextOption;
|
|
110
125
|
/** Move focus to previous enabled option */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAwBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAMa,eAAgB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAChE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,yCAAyC;IAClC,WAAW,SAAsB;IAExC,mCAAmC;IAC5B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,kBAAkB;IACX,IAAI,EAAE,IAAI,CAAQ;IAEzB,yBAAyB;IAClB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,+BAA+B;IACxB,KAAK,SAAM;IAElB,+CAA+C;IACxC,MAAM,EAAE,MAAM,EAAE,CAAM;IAE7B,wBAAwB;IACjB,OAAO,EAAE,YAAY,EAAE,CAAM;IAEpC,wCAAwC;IACjC,MAAM,SAAM;IAEnB,+BAA+B;IACxB,MAAM,UAAS;IAEtB,6DAA6D;IACtD,YAAY,SAAM;IAEzB,uCAAuC;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAmC;IACxE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAIxB;IACJ,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,kBAAkB,CAAK;IAExB,QAAQ,IAAI,IAAI;IAKhB,SAAS,IAAI,IAAI;IAMjB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAsD3C,wCAAwC;IACxC,IAAW,cAAc,IAAI,YAAY,GAAG,SAAS,CAEpD;IAED,wDAAwD;IACxD,IAAW,eAAe,IAAI,YAAY,EAAE,CAM3C;IAED,mCAAmC;IACnC,IAAW,WAAW,IAAI,MAAM,CAM/B;IAED,IAAW,eAAe,IAAI,YAAY,EAAE,CAS3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,2DAA2D;IAC3D,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,2DAA2D;IAC3D,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,0DAA0D;IACnD,QAAQ,GAAI,OAAO,MAAM,KAAG,MAAM,CAEvC;IAEF,sFAAsF;IACtF,IAAW,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEhD;IAED,iCAAiC;IAC1B,MAAM,QAAO,IAAI,CAQtB;IAEF,wBAAwB;IACjB,IAAI,QAAO,IAAI,CAGpB;IAEF,yBAAyB;IAClB,KAAK,QAAO,IAAI,CAGrB;IAEF,uBAAuB;IAChB,YAAY,GAAI,QAAQ,YAAY,KAAG,IAAI,CAkBhD;IAEF,0CAA0C;IAC1C,OAAO,CAAC,YAAY;IAapB,6BAA6B;IACtB,iBAAiB,GAAI,OAAO,KAAK,EAAE,QAAQ,YAAY,KAAG,IAAI,CAGnE;IAEK,eAAe,GAAI,OAAO,KAAK,EAAE,OAAO,MAAM,KAAG,IAAI,CAY1D;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAQ7C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAK7C;IAEF,gEAAgE;IAChE,OAAO,CAAC,eAAe;IAuBvB,8EAA8E;IAC9E,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAIrB,iCAAiC;IACjC,OAAO,CAAC,SAAS;IAsEjB,wGAAwG;IACxG,OAAO,CAAC,eAAe;IAoCvB,sHAAsH;IACtH,OAAO,CAAC,kBAAkB;IAa1B,8EAA8E;IAC9E,OAAO,CAAC,2BAA2B;IAMnC,wCAAwC;IACxC,OAAO,CAAC,eAAe;IAevB,4CAA4C;IAC5C,OAAO,CAAC,mBAAmB;IAe3B,sCAAsC;IACtC,OAAO,CAAC,qBAAqB;IAI7B,qCAAqC;IACrC,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;CAOtB"}
|