@bk2k/ui 0.6.7 → 0.7.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/BUILDING.md +88 -2
- package/CHANGELOG.md +193 -0
- package/USAGE.md +102 -33
- package/custom-elements.json +1 -1
- package/dist/charts/chart-tokens.js +1 -1
- package/dist/charts/fields.d.ts +20 -0
- package/dist/charts/fields.js +27 -0
- package/dist/charts/frame.d.ts +2 -0
- package/dist/charts/frame.js +4 -2
- package/dist/clipboard.js +1 -0
- package/dist/components/bk-alert.js +2 -1
- package/dist/components/bk-avatar-group.js +4 -6
- package/dist/components/bk-avatar.d.ts +10 -0
- package/dist/components/bk-avatar.js +17 -0
- package/dist/components/bk-bar.js +2 -0
- package/dist/components/bk-button-group.js +1 -1
- package/dist/components/bk-button-top.js +2 -1
- package/dist/components/bk-button.d.ts +55 -17
- package/dist/components/bk-button.js +71 -24
- package/dist/components/bk-card.d.ts +4 -0
- package/dist/components/bk-card.js +15 -2
- package/dist/components/bk-carousel-controls.d.ts +2 -0
- package/dist/components/bk-carousel-controls.js +4 -2
- package/dist/components/bk-chart-area.d.ts +6 -0
- package/dist/components/bk-chart-bar.d.ts +63 -9
- package/dist/components/bk-chart-bar.js +152 -41
- package/dist/components/bk-chart-line.d.ts +13 -0
- package/dist/components/bk-chart-line.js +11 -1
- package/dist/components/bk-chip-group.d.ts +2 -2
- package/dist/components/bk-chip-group.js +4 -0
- package/dist/components/bk-chip.d.ts +53 -8
- package/dist/components/bk-chip.js +43 -7
- package/dist/components/bk-code.js +6 -2
- package/dist/components/bk-columns.d.ts +11 -0
- package/dist/components/bk-columns.js +8 -1
- package/dist/components/bk-combobox.d.ts +30 -6
- package/dist/components/bk-combobox.js +63 -20
- package/dist/components/bk-delta.d.ts +10 -0
- package/dist/components/bk-delta.js +8 -6
- package/dist/components/bk-dialog.d.ts +16 -6
- package/dist/components/bk-dialog.js +20 -8
- package/dist/components/bk-disclosure.js +4 -2
- package/dist/components/bk-drop-target.d.ts +7 -1
- package/dist/components/bk-drop-target.js +20 -4
- package/dist/components/bk-error-summary.d.ts +5 -0
- package/dist/components/bk-error-summary.js +13 -4
- package/dist/components/bk-facts-item.js +8 -6
- package/dist/components/bk-facts.d.ts +6 -4
- package/dist/components/bk-facts.js +22 -10
- package/dist/components/bk-footnote.d.ts +73 -0
- package/dist/components/bk-footnote.js +97 -0
- package/dist/components/bk-footnotes-item.d.ts +92 -0
- package/dist/components/bk-footnotes-item.js +139 -0
- package/dist/components/bk-footnotes.d.ts +51 -0
- package/dist/components/bk-footnotes.js +43 -0
- package/dist/components/bk-icon.js +2 -2
- package/dist/components/bk-image-compare.d.ts +33 -5
- package/dist/components/bk-image-compare.js +72 -24
- package/dist/components/bk-image-crop.d.ts +3 -3
- package/dist/components/bk-image-editor.d.ts +1 -1
- package/dist/components/bk-image-viewer.d.ts +107 -11
- package/dist/components/bk-image-viewer.js +205 -34
- package/dist/components/bk-input-inline.d.ts +15 -6
- package/dist/components/bk-input-inline.js +22 -6
- package/dist/components/bk-input-number.js +2 -1
- package/dist/components/bk-input-search.d.ts +1 -1
- package/dist/components/bk-input-search.js +2 -1
- package/dist/components/bk-input-text.d.ts +11 -0
- package/dist/components/bk-input-text.js +17 -3
- package/dist/components/bk-input-time-zone.d.ts +3 -0
- package/dist/components/bk-input-time.js +2 -1
- package/dist/components/bk-item.js +2 -1
- package/dist/components/bk-lightbox.d.ts +12 -3
- package/dist/components/bk-lightbox.js +6 -3
- package/dist/components/bk-link.d.ts +9 -1
- package/dist/components/bk-link.js +14 -4
- package/dist/components/bk-menu-item.d.ts +40 -0
- package/dist/components/bk-menu-item.js +57 -9
- package/dist/components/bk-menu-label.js +2 -1
- package/dist/components/bk-menu-list.d.ts +1 -0
- package/dist/components/bk-menu-list.js +10 -0
- package/dist/components/bk-menu.d.ts +8 -1
- package/dist/components/bk-menu.js +16 -5
- package/dist/components/bk-message-feedback.d.ts +4 -3
- package/dist/components/bk-message-feedback.js +7 -5
- package/dist/components/bk-message-list.js +2 -1
- package/dist/components/bk-message-source.d.ts +1 -2
- package/dist/components/bk-message-source.js +3 -11
- package/dist/components/bk-message.js +2 -0
- package/dist/components/bk-model-viewer.d.ts +12 -1
- package/dist/components/bk-model-viewer.js +15 -2
- package/dist/components/bk-nav-group.js +1 -1
- package/dist/components/bk-nav-item.d.ts +18 -0
- package/dist/components/bk-nav-item.js +18 -5
- package/dist/components/bk-nav.d.ts +1 -1
- package/dist/components/bk-page-cta.js +2 -0
- package/dist/components/bk-page-section.d.ts +1 -1
- package/dist/components/bk-page-section.js +3 -9
- package/dist/components/bk-pane.d.ts +1 -0
- package/dist/components/bk-pane.js +7 -5
- package/dist/components/bk-panel.d.ts +1 -1
- package/dist/components/bk-panel.js +6 -5
- package/dist/components/bk-period-nav.d.ts +102 -0
- package/dist/components/bk-period-nav.js +69 -0
- package/dist/components/bk-picture.d.ts +17 -4
- package/dist/components/bk-picture.js +8 -1
- package/dist/components/bk-segmented-item.d.ts +24 -4
- package/dist/components/bk-segmented-item.js +37 -5
- package/dist/components/bk-segmented.js +2 -13
- package/dist/components/bk-select-cascade.d.ts +1 -1
- package/dist/components/bk-select-tree.d.ts +1 -1
- package/dist/components/bk-select.d.ts +1 -1
- package/dist/components/bk-select.js +2 -1
- package/dist/components/bk-shell-app.d.ts +13 -6
- package/dist/components/bk-shell-app.js +47 -11
- package/dist/components/bk-shell-sites.d.ts +2 -1
- package/dist/components/bk-shell-sites.js +3 -5
- package/dist/components/bk-sortable.d.ts +3 -0
- package/dist/components/bk-sortable.js +10 -17
- package/dist/components/bk-split-grid.d.ts +104 -3
- package/dist/components/bk-split-grid.js +425 -2
- package/dist/components/bk-split.d.ts +3 -0
- package/dist/components/bk-split.js +3 -0
- package/dist/components/bk-stat-group.js +2 -1
- package/dist/components/bk-stat.d.ts +17 -0
- package/dist/components/bk-stat.js +7 -3
- package/dist/components/bk-steps.js +2 -1
- package/dist/components/bk-surface.d.ts +2 -0
- package/dist/components/bk-surface.js +6 -3
- package/dist/components/bk-table.d.ts +17 -13
- package/dist/components/bk-table.js +94 -15
- package/dist/components/bk-tabs-item.d.ts +45 -7
- package/dist/components/bk-tabs-item.js +51 -20
- package/dist/components/bk-tabs-panel.d.ts +6 -3
- package/dist/components/bk-tabs-panel.js +6 -0
- package/dist/components/bk-tabs.d.ts +50 -7
- package/dist/components/bk-tabs.js +168 -96
- package/dist/components/bk-text.js +2 -1
- package/dist/components/bk-toast-group.d.ts +3 -1
- package/dist/components/bk-toast-group.js +11 -1
- package/dist/components/bk-tooltip.d.ts +3 -1
- package/dist/components/bk-tooltip.js +2 -1
- package/dist/components/bk-video.js +2 -2
- package/dist/components/bk-zoom.d.ts +3 -1
- package/dist/components/confirm.d.ts +15 -0
- package/dist/components/confirm.js +27 -4
- package/dist/i18n/de.js +19 -1
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n.d.ts +23 -2
- package/dist/i18n.js +35 -4
- package/dist/icons/brands-static.d.ts +3 -0
- package/dist/icons/brands-static.js +5 -0
- package/dist/icons/core.d.ts +1 -0
- package/dist/icons/core.js +2 -0
- package/dist/icons/load-static.d.ts +3 -0
- package/dist/icons/load-static.js +5 -0
- package/dist/icons/load.js +1 -0
- package/dist/icons/registry.js +1 -1
- package/dist/icons/set/save-as.d.ts +3 -0
- package/dist/icons/set/save-as.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/internal/announcer.d.ts +8 -1
- package/dist/internal/announcer.js +26 -10
- package/dist/internal/backdrop.d.ts +19 -0
- package/dist/internal/backdrop.js +29 -0
- package/dist/internal/busy.d.ts +3 -2
- package/dist/internal/busy.js +4 -5
- package/dist/internal/choice-field.js +1 -1
- package/dist/internal/choice-item.d.ts +17 -6
- package/dist/internal/choice-item.js +20 -9
- package/dist/internal/cloak.d.ts +3 -0
- package/dist/internal/cloak.js +7 -0
- package/dist/internal/crop-frame.d.ts +1 -1
- package/dist/internal/crop-frame.js +2 -7
- package/dist/internal/date-field.js +2 -1
- package/dist/internal/drag.d.ts +11 -0
- package/dist/internal/drag.js +23 -0
- package/dist/internal/english-static.d.ts +3 -0
- package/dist/internal/english-static.js +5 -0
- package/dist/internal/english.d.ts +8 -0
- package/dist/internal/english.js +6 -0
- package/dist/internal/footnotes.d.ts +56 -0
- package/dist/internal/footnotes.js +143 -0
- package/dist/internal/handle-menu.d.ts +2 -3
- package/dist/internal/handle-menu.js +11 -3
- package/dist/internal/late/bk-shell-app.d.ts +4 -0
- package/dist/internal/late/bk-shell-app.js +7 -0
- package/dist/internal/late/bk-table.d.ts +4 -0
- package/dist/internal/late/bk-table.js +17 -0
- package/dist/internal/late/handle-menu.d.ts +4 -0
- package/dist/internal/late/handle-menu.js +9 -0
- package/dist/internal/late/static.d.ts +7 -0
- package/dist/internal/late/static.js +5 -0
- package/dist/internal/late.d.ts +20 -0
- package/dist/internal/late.js +45 -0
- package/dist/internal/link.d.ts +2 -0
- package/dist/internal/link.js +11 -1
- package/dist/internal/own-text.d.ts +8 -0
- package/dist/internal/own-text.js +7 -0
- package/dist/internal/scope.js +1 -1
- package/dist/internal/scroll-lock.d.ts +4 -1
- package/dist/internal/scroll-lock.js +17 -4
- package/dist/internal/slider.js +2 -1
- package/dist/internal/styles.js +3 -0
- package/dist/internal/submit.d.ts +23 -0
- package/dist/internal/submit.js +57 -0
- package/dist/jsx.d.ts +176 -56
- package/dist/reset.css +10 -0
- package/dist/standalone/all.js +226 -221
- package/dist/standalone/appearance.js +1 -1
- package/dist/standalone/bk-accordion-item.js +4 -4
- package/dist/standalone/bk-accordion.js +2 -2
- package/dist/standalone/bk-action-bar.js +3 -3
- package/dist/standalone/bk-alert-offline.js +1 -2
- package/dist/standalone/bk-alert.js +13 -12
- package/dist/standalone/bk-app-state.js +1 -1
- package/dist/standalone/bk-attachment.js +4 -4
- package/dist/standalone/bk-avatar-group.js +12 -10
- package/dist/standalone/bk-avatar.js +14 -4
- package/dist/standalone/bk-badge.js +2 -2
- package/dist/standalone/bk-bar.js +3 -1
- package/dist/standalone/bk-brand.js +3 -3
- package/dist/standalone/bk-breadcrumbs.js +5 -5
- package/dist/standalone/bk-button-copy.js +5 -5
- package/dist/standalone/bk-button-group.js +5 -5
- package/dist/standalone/bk-button-share.js +5 -5
- package/dist/standalone/bk-button-top.js +9 -8
- package/dist/standalone/bk-button.js +74 -34
- package/dist/standalone/bk-calendar-event.js +1 -1
- package/dist/standalone/bk-calendar-week.js +3 -3
- package/dist/standalone/bk-calendar.js +4 -4
- package/dist/standalone/bk-card.js +20 -7
- package/dist/standalone/bk-carousel-controls.js +7 -6
- package/dist/standalone/bk-carousel-item.js +2 -2
- package/dist/standalone/bk-carousel.js +1 -1
- package/dist/standalone/bk-chart-area.js +1 -1
- package/dist/standalone/bk-chart-bar-list.js +8 -8
- package/dist/standalone/bk-chart-bar.js +253 -166
- package/dist/standalone/bk-chart-bridge.js +7 -7
- package/dist/standalone/bk-chart-bullet.js +6 -6
- package/dist/standalone/bk-chart-calendar.js +7 -7
- package/dist/standalone/bk-chart-heatmap.js +7 -7
- package/dist/standalone/bk-chart-histogram.js +5 -5
- package/dist/standalone/bk-chart-legend.js +6 -6
- package/dist/standalone/bk-chart-line.js +116 -103
- package/dist/standalone/bk-chart-mark.js +1 -1
- package/dist/standalone/bk-chart-scatter.js +6 -6
- package/dist/standalone/bk-chart-sparkline.js +6 -6
- package/dist/standalone/bk-chart-stacked-bar.js +7 -7
- package/dist/standalone/bk-chart-tracker.js +6 -6
- package/dist/standalone/bk-chart-waterfall.js +6 -6
- package/dist/standalone/bk-checkbox-group.js +4 -4
- package/dist/standalone/bk-checkbox.js +4 -4
- package/dist/standalone/bk-chip-group.js +9 -5
- package/dist/standalone/bk-chip.js +56 -17
- package/dist/standalone/bk-cluster.js +1 -1
- package/dist/standalone/bk-code-diff.js +4 -4
- package/dist/standalone/bk-code-stack.js +4 -4
- package/dist/standalone/bk-code.js +10 -6
- package/dist/standalone/bk-color-panel.js +5 -5
- package/dist/standalone/bk-columns.js +13 -5
- package/dist/standalone/bk-combobox.js +53 -33
- package/dist/standalone/bk-command-menu.js +6 -6
- package/dist/standalone/bk-command-palette.js +6 -5
- package/dist/standalone/bk-composer.js +6 -6
- package/dist/standalone/bk-delta.js +11 -10
- package/dist/standalone/bk-diagram.js +1 -1
- package/dist/standalone/bk-dialog.js +1 -1
- package/dist/standalone/bk-disclosure.js +7 -5
- package/dist/standalone/bk-divider.js +2 -2
- package/dist/standalone/bk-drawer.js +3 -3
- package/dist/standalone/bk-drop-target.js +12 -6
- package/dist/standalone/bk-empty-state.js +3 -3
- package/dist/standalone/bk-error-summary.js +9 -6
- package/dist/standalone/bk-facts-item.js +10 -8
- package/dist/standalone/bk-facts.js +28 -16
- package/dist/standalone/bk-feature.js +3 -3
- package/dist/standalone/bk-fieldset.js +3 -3
- package/dist/standalone/bk-filter-bar.js +4 -4
- package/dist/standalone/bk-folder-browser.js +4 -4
- package/dist/standalone/bk-footnote.js +82 -0
- package/dist/standalone/bk-footnotes-item.js +122 -0
- package/dist/standalone/bk-footnotes.js +37 -0
- package/dist/standalone/bk-form-guard.js +2 -2
- package/dist/standalone/bk-form-steps.js +3 -3
- package/dist/standalone/bk-grid.js +1 -1
- package/dist/standalone/bk-icon-tile.js +3 -3
- package/dist/standalone/bk-icon.js +1 -1
- package/dist/standalone/bk-image-compare.js +88 -47
- package/dist/standalone/bk-image-crop.js +6 -6
- package/dist/standalone/bk-image-editor.js +2 -1
- package/dist/standalone/bk-image-viewer.js +180 -59
- package/dist/standalone/bk-input-code.js +4 -4
- package/dist/standalone/bk-input-color.js +4 -4
- package/dist/standalone/bk-input-date-range.js +2 -2
- package/dist/standalone/bk-input-date.js +2 -2
- package/dist/standalone/bk-input-file.js +5 -5
- package/dist/standalone/bk-input-group.js +4 -4
- package/dist/standalone/bk-input-inline.js +17 -10
- package/dist/standalone/bk-input-number.js +9 -8
- package/dist/standalone/bk-input-rating.js +6 -6
- package/dist/standalone/bk-input-rich.js +1 -1
- package/dist/standalone/bk-input-search.js +23 -22
- package/dist/standalone/bk-input-slider-range.js +5 -5
- package/dist/standalone/bk-input-slider.js +5 -5
- package/dist/standalone/bk-input-text.js +1 -1
- package/dist/standalone/bk-input-time-zone.js +1 -1
- package/dist/standalone/bk-input-time.js +29 -28
- package/dist/standalone/bk-item-group.js +3 -3
- package/dist/standalone/bk-item.js +12 -11
- package/dist/standalone/bk-kbd-shortcuts.js +4 -3
- package/dist/standalone/bk-kbd.js +68 -1
- package/dist/standalone/bk-lightbox.js +11 -7
- package/dist/standalone/bk-lines.js +1 -1
- package/dist/standalone/bk-link.js +33 -19
- package/dist/standalone/bk-listbox-columns.js +6 -6
- package/dist/standalone/bk-listbox-item.js +1 -1
- package/dist/standalone/bk-listbox-search.js +7 -7
- package/dist/standalone/bk-listbox-transfer.js +6 -6
- package/dist/standalone/bk-listbox.js +7 -7
- package/dist/standalone/bk-logo-wall.js +2 -2
- package/dist/standalone/bk-logo.js +3 -3
- package/dist/standalone/bk-menu-bar.js +3 -3
- package/dist/standalone/bk-menu-context.js +1 -1
- package/dist/standalone/bk-menu-divider.js +2 -2
- package/dist/standalone/bk-menu-item.js +73 -29
- package/dist/standalone/bk-menu-label.js +7 -6
- package/dist/standalone/bk-menu-list.js +10 -4
- package/dist/standalone/bk-menu.js +19 -10
- package/dist/standalone/bk-message-approval.js +4 -4
- package/dist/standalone/bk-message-branches.js +3 -3
- package/dist/standalone/bk-message-citation.js +10 -10
- package/dist/standalone/bk-message-feedback.js +10 -6
- package/dist/standalone/bk-message-list.js +6 -5
- package/dist/standalone/bk-message-reasoning.js +5 -5
- package/dist/standalone/bk-message-source.js +13 -21
- package/dist/standalone/bk-message-tool-group.js +5 -5
- package/dist/standalone/bk-message-tool.js +5 -5
- package/dist/standalone/bk-message.js +6 -4
- package/dist/standalone/bk-meter.js +3 -3
- package/dist/standalone/bk-model-viewer.js +1 -1
- package/dist/standalone/bk-nav-divider.js +2 -2
- package/dist/standalone/bk-nav-group.js +6 -6
- package/dist/standalone/bk-nav-item.js +31 -23
- package/dist/standalone/bk-nav-toc.js +3 -3
- package/dist/standalone/bk-nav.js +3 -3
- package/dist/standalone/bk-overflow.js +3 -3
- package/dist/standalone/bk-page-cta.js +5 -3
- package/dist/standalone/bk-page-footer-column.js +2 -2
- package/dist/standalone/bk-page-footer.js +3 -3
- package/dist/standalone/bk-page-header.js +3 -3
- package/dist/standalone/bk-page-hero.js +3 -3
- package/dist/standalone/bk-page-pager.js +5 -5
- package/dist/standalone/bk-page-section.js +6 -6
- package/dist/standalone/bk-pagination.js +6 -6
- package/dist/standalone/bk-pane.js +10 -9
- package/dist/standalone/bk-panel.js +9 -10
- package/dist/standalone/bk-period-nav.js +69 -0
- package/dist/standalone/bk-picture.js +24 -15
- package/dist/standalone/bk-popover-help.js +3 -3
- package/dist/standalone/bk-popover.js +2 -2
- package/dist/standalone/bk-presence-cursor.js +2 -2
- package/dist/standalone/bk-preview.js +4 -4
- package/dist/standalone/bk-progress.js +3 -3
- package/dist/standalone/bk-prose.js +3 -3
- package/dist/standalone/bk-qr-code.js +1 -1
- package/dist/standalone/bk-radio-group.js +4 -4
- package/dist/standalone/bk-radio.js +3 -3
- package/dist/standalone/bk-rating.js +5 -5
- package/dist/standalone/bk-scroll.js +3 -3
- package/dist/standalone/bk-segmented-item.js +40 -16
- package/dist/standalone/bk-segmented.js +15 -13
- package/dist/standalone/bk-select-cascade.js +3 -3
- package/dist/standalone/bk-select-tree.js +4 -4
- package/dist/standalone/bk-select.js +7 -6
- package/dist/standalone/bk-shell-app.js +1 -1217
- package/dist/standalone/bk-shell-centered.js +2 -2
- package/dist/standalone/bk-shell-sites.js +5 -7
- package/dist/standalone/bk-skeleton.js +2 -2
- package/dist/standalone/bk-sortable.js +58 -60
- package/dist/standalone/bk-spinner.js +2 -2
- package/dist/standalone/bk-split-grid.js +318 -41
- package/dist/standalone/bk-split.js +9 -6
- package/dist/standalone/bk-stack.js +1 -1
- package/dist/standalone/bk-stat-group.js +8 -7
- package/dist/standalone/bk-stat.js +11 -8
- package/dist/standalone/bk-status-dot.js +3 -3
- package/dist/standalone/bk-steps-item.js +5 -5
- package/dist/standalone/bk-steps.js +8 -7
- package/dist/standalone/bk-surface.js +1 -1
- package/dist/standalone/bk-swatch-group.js +4 -4
- package/dist/standalone/bk-swatch-palette.js +1 -1
- package/dist/standalone/bk-swatch.js +2 -2
- package/dist/standalone/bk-switch.js +4 -4
- package/dist/standalone/bk-table.js +1 -1887
- package/dist/standalone/bk-tabs-item.js +58 -35
- package/dist/standalone/bk-tabs-panel.js +7 -3
- package/dist/standalone/bk-tabs.js +160 -98
- package/dist/standalone/bk-tasks-item.js +4 -4
- package/dist/standalone/bk-tasks.js +2 -2
- package/dist/standalone/bk-testimonial.js +3 -3
- package/dist/standalone/bk-text.js +19 -18
- package/dist/standalone/bk-time-countdown.js +4 -4
- package/dist/standalone/bk-time-relative.js +3 -3
- package/dist/standalone/bk-timeline-item.js +4 -4
- package/dist/standalone/bk-timeline.js +2 -2
- package/dist/standalone/bk-toast-group.js +1 -1
- package/dist/standalone/bk-toast.js +4 -4
- package/dist/standalone/bk-toolbar.js +2 -2
- package/dist/standalone/bk-tooltip.js +8 -7
- package/dist/standalone/bk-tree-item.js +6 -6
- package/dist/standalone/bk-tree.js +3 -3
- package/dist/standalone/bk-video.js +6 -6
- package/dist/standalone/bk-visually-hidden.js +2 -2
- package/dist/standalone/bk-zoom.js +5 -5
- package/dist/standalone/chunks/announcer-D1zrRWwO.js +36 -0
- package/dist/standalone/chunks/{appearance-waHnV0kk.js → appearance-CBOJXbmC.js} +1 -1
- package/dist/standalone/chunks/{bk-alert-offline-BoMEYxnE.js → bk-alert-offline-Clw0ZSsH.js} +3 -3
- package/dist/standalone/chunks/{bk-carousel-B7-9OanA.js → bk-carousel-Biz7t8sL.js} +4 -4
- package/dist/standalone/chunks/{bk-diagram-CpOpicmo.js → bk-diagram-D_fQf6SF.js} +5 -5
- package/dist/standalone/chunks/{bk-dialog-a2BtUBf2.js → bk-dialog-DwZyUUHh.js} +65 -27
- package/dist/standalone/chunks/{bk-icon-DssFsNuB.js → bk-icon-Bp_flKdv.js} +4 -3
- package/dist/standalone/chunks/{bk-image-editor-z_Uj83fy.js → bk-image-editor-BADsoLRL.js} +5 -5
- package/dist/standalone/chunks/{bk-input-date-range-BQkbPlSJ.js → bk-input-date-range-DHcJ8-5g.js} +2 -2
- package/dist/standalone/chunks/{bk-input-rich-Dte_b4Ev.js → bk-input-rich-CFhW6vRa.js} +6 -6
- package/dist/standalone/chunks/{bk-input-text-CUNQG1ah.js → bk-input-text-DviyLBqj.js} +63 -54
- package/dist/standalone/chunks/{bk-model-viewer-D1XJPgAG.js → bk-model-viewer-w_Ah4Tvs.js} +22 -8
- package/dist/standalone/chunks/{bk-qr-code-CbI9rdOK.js → bk-qr-code-CYMovNVl.js} +3 -3
- package/dist/standalone/chunks/bk-shell-app-B2lxHit8.js +1235 -0
- package/dist/standalone/chunks/{bk-surface-DkIhrWMt.js → bk-surface-D7e0tErs.js} +9 -7
- package/dist/standalone/chunks/{bk-swatch-palette-BNNXTP3w.js → bk-swatch-palette-x13JgJQi.js} +6 -6
- package/dist/standalone/chunks/bk-table-CP8n_jy7.js +1944 -0
- package/dist/standalone/chunks/{bk-toast-group-Cix-Urgi.js → bk-toast-group-CoL6W7uk.js} +27 -24
- package/dist/standalone/chunks/{brush-Bn3lPdHN.js → brush-DALmXSru.js} +18 -2
- package/dist/standalone/chunks/{busy-B7Mxemwm.js → busy-BUB22mGY.js} +5 -4
- package/dist/standalone/chunks/{chart-tokens-D1Exf7BW.js → chart-tokens-DQ4hVSmn.js} +2 -2
- package/dist/standalone/chunks/{choice-field-BnuK9mp_.js → choice-field-poOTerh1.js} +6 -6
- package/dist/standalone/chunks/{choice-item-B6-9ZRlf.js → choice-item-Cx-nm1js.js} +17 -8
- package/dist/standalone/chunks/clipboard-RqIeP9Uz.js +29 -0
- package/dist/standalone/chunks/clipboard-UVLSkL4C.js +34 -0
- package/dist/standalone/chunks/{crop-frame-poLCGrBG.js → crop-frame-Z9N0QML4.js} +1 -11
- package/dist/standalone/chunks/{date-field-BQ5k-DDL.js → date-field-B-fCXa2D.js} +48 -47
- package/dist/standalone/chunks/{define-CzVPD4Zi.js → define-DkVeu7e9.js} +1 -1
- package/dist/standalone/chunks/drag-DT4__0t9.js +12 -0
- package/dist/standalone/chunks/footnotes-BeisMxLk.js +94 -0
- package/dist/standalone/chunks/{form-control-D7dqSP9M.js → form-control-CHpfKAKa.js} +2 -2
- package/dist/standalone/chunks/{frame-BW1nKuoM.js → frame-xIMVEUCi.js} +7 -4
- package/dist/standalone/chunks/handle-menu-BgYUbGO2.js +56 -0
- package/dist/standalone/chunks/{heading-text-CV5gBf7k.js → heading-text-CgnCa_q2.js} +1 -1
- package/dist/standalone/chunks/{i18n-CNsBRNPu.js → i18n-DFfGgd3d.js} +56 -34
- package/dist/standalone/chunks/{i18n-CrZgrRu9.js → i18n-DQAcbHkY.js} +1 -1
- package/dist/standalone/chunks/link--YWr8exL.js +69 -0
- package/dist/standalone/chunks/{marks-CdqbbJpM.js → marks-pOUDNUf1.js} +2 -2
- package/dist/standalone/chunks/{options-DMEc8rQt.js → options-BdC8-KKM.js} +2 -2
- package/dist/standalone/chunks/own-text-mpZVnMyX.js +5 -0
- package/dist/standalone/chunks/{palettes-CKLHSIPx.js → palettes-J4bQ21ks.js} +2 -2
- package/dist/standalone/chunks/{popover-base-oDhxsYMr.js → popover-base-hxo-Vh6E.js} +2 -2
- package/dist/standalone/chunks/{prose-BG4oQH-i.js → prose-BiuJgiah.js} +1 -1
- package/dist/standalone/chunks/{ramp-EclrETaQ.js → ramp-CGDOcqBZ.js} +1 -1
- package/dist/standalone/chunks/save-as-DBGZjczB.js +6 -0
- package/dist/standalone/chunks/shortcuts-DPxCSO4M.js +210 -0
- package/dist/standalone/chunks/{slider-BWT8Fmwz.js → slider-jp3d-Ld-.js} +15 -14
- package/dist/standalone/chunks/{stars-BN9M_9Q1.js → stars-BgKEjDQx.js} +1 -1
- package/dist/standalone/chunks/{styles-DwSR-9a3.js → styles-CaeyhYDA.js} +3 -0
- package/dist/standalone/chunks/submit-BjBGB8OW.js +42 -0
- package/dist/standalone/chunks/{summary-BwL-Gp8w.js → summary-W5s0TFqV.js} +1 -1
- package/dist/standalone/chunks/{text-field-CTp2b-Ai.js → text-field-CqhJSAwZ.js} +4 -4
- package/dist/standalone/chunks/{toggle-control-DXkgmz7R.js → toggle-control-lvZbQtGW.js} +2 -2
- package/dist/standalone/chunks/{tokens-BuahF1lF.js → tokens-C_ul7pL9.js} +4 -3
- package/dist/standalone/chunks/{virtual-B-1oN14Y.js → virtual-C_h6sHnm.js} +1 -1
- package/dist/standalone/confirm.js +27 -14
- package/dist/standalone/i18n-de.js +20 -2
- package/dist/standalone/icons.js +100 -98
- package/dist/standalone/links.js +1 -1
- package/dist/standalone/reset.css +10 -0
- package/dist/standalone/toast.js +1 -1
- package/dist/standalone/tokens.css +9 -5
- package/dist/tokens.css +9 -5
- package/dist/tokens.js +4 -3
- package/package.json +25 -2
- package/dist/standalone/chunks/announcer-haFcvqbe.js +0 -25
- package/dist/standalone/chunks/bk-kbd-B7bz8hmV.js +0 -275
- package/dist/standalone/chunks/clipboard-DBGdJ-1S.js +0 -61
- package/dist/standalone/chunks/handle-menu-DsxWvv4D.js +0 -22
- package/dist/standalone/chunks/link-CWSMsx04.js +0 -60
|
@@ -183,6 +183,7 @@ export declare class BkInputText extends TextField {
|
|
|
183
183
|
enterKeyHint: {
|
|
184
184
|
attribute: string;
|
|
185
185
|
};
|
|
186
|
+
shortcut: {};
|
|
186
187
|
autofocus: {
|
|
187
188
|
type: BooleanConstructor;
|
|
188
189
|
};
|
|
@@ -236,6 +237,13 @@ export declare class BkInputText extends TextField {
|
|
|
236
237
|
* `previous`, `search` or `send`.
|
|
237
238
|
*/
|
|
238
239
|
enterKeyHint: string;
|
|
240
|
+
/**
|
|
241
|
+
* The keyboard shortcut that moves the focus into the field: the id of a shortcut in the registry
|
|
242
|
+
* (`registerShortcuts`) or a key combination (`Mod+K`). The field sets `aria-keyshortcuts` on its native control, so a
|
|
243
|
+
* screen reader says the keys. The field does not bind the keys: bind them with `onShortcut`. Show the keys with
|
|
244
|
+
* `<bk-kbd slot="end" shortcut="…">`.
|
|
245
|
+
*/
|
|
246
|
+
shortcut: string | undefined;
|
|
239
247
|
/** Input mask, see the class description: `9` digit, `a` letter, `*` any character, the rest is fixed text. */
|
|
240
248
|
mask: string | undefined;
|
|
241
249
|
/** Focuses the field when it connects. */
|
|
@@ -253,7 +261,10 @@ export declare class BkInputText extends TextField {
|
|
|
253
261
|
/** Initial value, restored on form reset. Defaults to the `value` attribute. */
|
|
254
262
|
defaultValue: string;
|
|
255
263
|
constructor();
|
|
264
|
+
/** Follows the registry: a shortcut can get other keys, or register after the field. */
|
|
265
|
+
private unsubscribeShortcuts?;
|
|
256
266
|
connectedCallback(): void;
|
|
267
|
+
disconnectedCallback(): void;
|
|
257
268
|
static styles: import("lit").CSSResultGroup[];
|
|
258
269
|
protected get control(): HTMLInputElement | HTMLTextAreaElement | null;
|
|
259
270
|
protected formValue(): string;
|
|
@@ -7,7 +7,9 @@ import { CounterState } from "../internal/counter.js";
|
|
|
7
7
|
import { emit } from "../internal/events.js";
|
|
8
8
|
import { maskCaret, maskFormat, maskIsNumeric, maskLength, maskRaw } from "../internal/mask.js";
|
|
9
9
|
import { TextField } from "../internal/text-field.js";
|
|
10
|
+
import { ariaKeyShortcuts, subscribeShortcuts } from "../shortcuts.js";
|
|
10
11
|
import "./bk-icon.js";
|
|
12
|
+
import { submitImplicitly } from "../internal/submit.js";
|
|
11
13
|
import "../icons/set/search.js";
|
|
12
14
|
import "../icons/set/visibility.js";
|
|
13
15
|
import "../icons/set/visibility-off.js";
|
|
@@ -43,6 +45,7 @@ class BkInputText extends TextField {
|
|
|
43
45
|
pattern: {},
|
|
44
46
|
mask: {},
|
|
45
47
|
enterKeyHint: { attribute: "enterkeyhint" },
|
|
48
|
+
shortcut: {},
|
|
46
49
|
autofocus: { type: Boolean },
|
|
47
50
|
revealLabel: { attribute: "reveal-label" },
|
|
48
51
|
counter: { type: Boolean, reflect: true },
|
|
@@ -69,10 +72,20 @@ class BkInputText extends TextField {
|
|
|
69
72
|
this.autogrow = false;
|
|
70
73
|
this.revealed = false;
|
|
71
74
|
}
|
|
75
|
+
/** Follows the registry: a shortcut can get other keys, or register after the field. */
|
|
76
|
+
unsubscribeShortcuts;
|
|
72
77
|
connectedCallback() {
|
|
73
78
|
super.connectedCallback();
|
|
74
79
|
if (!this.defaultValue)
|
|
75
80
|
this.defaultValue = this.getAttribute("value") ?? "";
|
|
81
|
+
this.unsubscribeShortcuts = subscribeShortcuts(() => {
|
|
82
|
+
if (this.shortcut)
|
|
83
|
+
this.requestUpdate();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
super.disconnectedCallback();
|
|
88
|
+
this.unsubscribeShortcuts?.();
|
|
76
89
|
}
|
|
77
90
|
static styles = [TextField.styles, css`
|
|
78
91
|
:host { --_bk-text-field-font-size: var(--bk-input-font-size); }
|
|
@@ -266,7 +279,7 @@ class BkInputText extends TextField {
|
|
|
266
279
|
const form = this.internals.form;
|
|
267
280
|
if (!form)
|
|
268
281
|
return;
|
|
269
|
-
setTimeout(() => form
|
|
282
|
+
setTimeout(() => submitImplicitly(form));
|
|
270
283
|
}
|
|
271
284
|
onChange() {
|
|
272
285
|
emit(this, "change");
|
|
@@ -280,18 +293,19 @@ class BkInputText extends TextField {
|
|
|
280
293
|
const rows = this.autogrow ? { "--_bk-input-text-rows": String(this.rows ?? 2), "--_bk-input-text-max-rows": this.maxRows ? String(this.maxRows) : "none" } : {};
|
|
281
294
|
const disabled = this.isDisabled;
|
|
282
295
|
const invalid = this.showInvalid ? "true" : "false";
|
|
296
|
+
const keys = this.shortcut ? ariaKeyShortcuts(this.shortcut) || void 0 : void 0;
|
|
283
297
|
const control = this.multiline ? html`<textarea part="input" id="control" .value=${live(this.value)} name=${ifDefined(this.name || void 0)}
|
|
284
298
|
placeholder=${ifDefined(this.placeholder)} rows=${ifDefined(this.rows)} style=${styleMap(rows)} ?disabled=${disabled}
|
|
285
299
|
?readonly=${this.readonly} ?required=${this.required} ?autofocus=${this.autofocus}
|
|
286
300
|
minlength=${ifDefined(this.minlength)} maxlength=${ifDefined(this.maxlength)}
|
|
287
301
|
autocomplete=${ifDefined(this.autocomplete)} aria-invalid=${invalid}
|
|
288
302
|
aria-describedby=${ifDefined(desc)} aria-label=${ifDefined(ariaLabel)} enterkeyhint=${ifDefined(this.enterKeyHint || void 0)}
|
|
289
|
-
@input=${this.onInput} @change=${this.onChange}></textarea>` : html`<input part="input" id="control" .value=${live(this.formattedValue)} type=${type}
|
|
303
|
+
aria-keyshortcuts=${ifDefined(keys)} @input=${this.onInput} @change=${this.onChange}></textarea>` : html`<input part="input" id="control" .value=${live(this.formattedValue)} type=${type}
|
|
290
304
|
placeholder=${ifDefined(this.placeholder)} ?disabled=${disabled} ?readonly=${this.readonly}
|
|
291
305
|
?required=${this.required} ?autofocus=${this.autofocus} minlength=${ifDefined(this.minlength)}
|
|
292
306
|
maxlength=${ifDefined(this.mask ? void 0 : this.maxlength)} pattern=${ifDefined(this.pattern)} autocomplete=${ifDefined(this.autocomplete)}
|
|
293
307
|
inputmode=${ifDefined(this.inputmode ?? this.maskInputmode)} enterkeyhint=${ifDefined(this.enterKeyHint || void 0)} aria-invalid=${invalid}
|
|
294
|
-
aria-describedby=${ifDefined(desc)} aria-label=${ifDefined(ariaLabel)}
|
|
308
|
+
aria-describedby=${ifDefined(desc)} aria-label=${ifDefined(ariaLabel)} aria-keyshortcuts=${ifDefined(keys)}
|
|
295
309
|
@input=${this.onInput} @change=${this.onChange} @keydown=${this.onKeydown} />`;
|
|
296
310
|
return this.renderField(html`<div class=${this.boxClass} part="box">
|
|
297
311
|
${this.renderStart()}
|
|
@@ -162,6 +162,9 @@ export declare class BkInputTimeZone extends BkCombobox {
|
|
|
162
162
|
text: {
|
|
163
163
|
state: boolean;
|
|
164
164
|
};
|
|
165
|
+
searching: {
|
|
166
|
+
state: boolean;
|
|
167
|
+
};
|
|
165
168
|
locale: {};
|
|
166
169
|
};
|
|
167
170
|
/** Language for the offsets, the times and the long names (default: the page language). */
|
|
@@ -7,6 +7,7 @@ import { emit } from "../internal/events.js";
|
|
|
7
7
|
import { asciiDigits } from "../internal/date-field.js";
|
|
8
8
|
import { TextField } from "../internal/text-field.js";
|
|
9
9
|
import "./bk-icon.js";
|
|
10
|
+
import { submitImplicitly } from "../internal/submit.js";
|
|
10
11
|
const cache = /* @__PURE__ */ new Map();
|
|
11
12
|
function timeLocale(locale, seconds, cycle) {
|
|
12
13
|
const key = `${locale}|${seconds}|${cycle ?? ""}`;
|
|
@@ -307,7 +308,7 @@ class BkInputTime extends TextField {
|
|
|
307
308
|
e.preventDefault();
|
|
308
309
|
const form = this.internals.form;
|
|
309
310
|
if (form)
|
|
310
|
-
setTimeout(() => form
|
|
311
|
+
setTimeout(() => submitImplicitly(form));
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
314
|
const editable = !this.readonly && !this.isDisabled;
|
|
@@ -6,6 +6,7 @@ import { LinkController } from "../internal/link.js";
|
|
|
6
6
|
import { SlotController } from "../internal/slots.js";
|
|
7
7
|
import { base, srOnly } from "../internal/styles.js";
|
|
8
8
|
import "./bk-icon.js";
|
|
9
|
+
import { ownText } from "../internal/own-text.js";
|
|
9
10
|
import "../icons/set/check.js";
|
|
10
11
|
import "../icons/set/description.js";
|
|
11
12
|
const SPACED = /* @__PURE__ */ new Set(["bk-stack", "bk-lines"]);
|
|
@@ -62,7 +63,7 @@ class BkItem extends LitElement {
|
|
|
62
63
|
}
|
|
63
64
|
/** The value of the row: `value`, otherwise the title text. */
|
|
64
65
|
get itemValue() {
|
|
65
|
-
return this.value ??
|
|
66
|
+
return this.value ?? ownText(this).trim();
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
69
|
* Makes the item a row of a selectable grid (`state`) or a list item again (null). `<bk-item-group>`
|
|
@@ -49,7 +49,9 @@ export type LightboxChangeDetail = ImageViewerChangeDetail;
|
|
|
49
49
|
* window controls (the header of the app), so the controls are on a bar and not over the image. In a browser tab
|
|
50
50
|
* the title bar area has no height, so there is no band.
|
|
51
51
|
*
|
|
52
|
-
* For the keys and gestures of the viewer, see `<bk-image-viewer>`.
|
|
52
|
+
* For the keys and gestures of the viewer, see `<bk-image-viewer>`. The lightbox sets `immersive` on it: the plain
|
|
53
|
+
* wheel zooms, a click steps the zoom, and the keys work from the close button and the actions too. Previous and
|
|
54
|
+
* next stop at the ends; `loop` lets them wrap around. Esc or a tap beside the image closes the viewer. The
|
|
53
55
|
* `--bk-image-viewer-*` tokens style the viewer (they inherit into it). The close button looks
|
|
54
56
|
* like the controls of the viewer.
|
|
55
57
|
*
|
|
@@ -116,6 +118,10 @@ export declare class BkLightbox extends LitElement {
|
|
|
116
118
|
type: BooleanConstructor;
|
|
117
119
|
reflect: boolean;
|
|
118
120
|
};
|
|
121
|
+
loop: {
|
|
122
|
+
type: BooleanConstructor;
|
|
123
|
+
reflect: boolean;
|
|
124
|
+
};
|
|
119
125
|
variant: {
|
|
120
126
|
reflect: boolean;
|
|
121
127
|
useDefault: boolean;
|
|
@@ -157,6 +163,8 @@ export declare class BkLightbox extends LitElement {
|
|
|
157
163
|
items: LightboxItem[];
|
|
158
164
|
/** Shows a row of thumbnails under the image. */
|
|
159
165
|
filmstrip: boolean;
|
|
166
|
+
/** Previous and next wrap around: after the last image comes the first. Without it, they stop at the ends. */
|
|
167
|
+
loop: boolean;
|
|
160
168
|
/** `grid`: square thumbnails that fill the width. `strip`: a wrapping row of thumbnails at one height. */
|
|
161
169
|
variant: "grid" | "strip";
|
|
162
170
|
/** Accessible name of the viewer (default from i18n). */
|
|
@@ -191,9 +199,9 @@ export declare class BkLightbox extends LitElement {
|
|
|
191
199
|
show(index?: number): void;
|
|
192
200
|
/** Closes the viewer. The focus returns to the element that had it before. */
|
|
193
201
|
close(): void;
|
|
194
|
-
/** Moves to the previous image
|
|
202
|
+
/** Moves to the previous image. It wraps around with `loop`, else it stops at the first image. */
|
|
195
203
|
previous(): void;
|
|
196
|
-
/** Moves to the next image
|
|
204
|
+
/** Moves to the next image. It wraps around with `loop`, else it stops at the last image. */
|
|
197
205
|
next(): void;
|
|
198
206
|
protected getUpdateComplete(): Promise<boolean>;
|
|
199
207
|
/** Direct children that are or contain an image. */
|
|
@@ -227,6 +235,7 @@ declare global {
|
|
|
227
235
|
*/
|
|
228
236
|
export declare function openLightbox(items: LightboxItem[], startIndex?: number, options?: {
|
|
229
237
|
filmstrip?: boolean;
|
|
238
|
+
loop?: boolean;
|
|
230
239
|
actions?: HTMLElement[];
|
|
231
240
|
}): BkLightbox;
|
|
232
241
|
//# sourceMappingURL=bk-lightbox.d.ts.map
|
|
@@ -15,6 +15,7 @@ class BkLightbox extends LitElement {
|
|
|
15
15
|
index: { type: Number },
|
|
16
16
|
items: { attribute: false },
|
|
17
17
|
filmstrip: { type: Boolean, reflect: true },
|
|
18
|
+
loop: { type: Boolean, reflect: true },
|
|
18
19
|
variant: { reflect: true, useDefault: true },
|
|
19
20
|
label: {},
|
|
20
21
|
closeLabel: { attribute: "close-label" },
|
|
@@ -35,6 +36,7 @@ class BkLightbox extends LitElement {
|
|
|
35
36
|
this.index = 0;
|
|
36
37
|
this.items = [];
|
|
37
38
|
this.filmstrip = false;
|
|
39
|
+
this.loop = false;
|
|
38
40
|
this.variant = "grid";
|
|
39
41
|
this.label = "";
|
|
40
42
|
this.closeLabel = "";
|
|
@@ -145,11 +147,11 @@ class BkLightbox extends LitElement {
|
|
|
145
147
|
close() {
|
|
146
148
|
this.open = false;
|
|
147
149
|
}
|
|
148
|
-
/** Moves to the previous image
|
|
150
|
+
/** Moves to the previous image. It wraps around with `loop`, else it stops at the first image. */
|
|
149
151
|
previous() {
|
|
150
152
|
this.viewer?.previous();
|
|
151
153
|
}
|
|
152
|
-
/** Moves to the next image
|
|
154
|
+
/** Moves to the next image. It wraps around with `loop`, else it stops at the last image. */
|
|
153
155
|
next() {
|
|
154
156
|
this.viewer?.next();
|
|
155
157
|
}
|
|
@@ -268,7 +270,7 @@ class BkLightbox extends LitElement {
|
|
|
268
270
|
return html`<div class="gallery" part="gallery"><slot @slotchange=${this.onSlotChange}></slot></div>
|
|
269
271
|
<bk-dialog bare exportparts="dialog" heading=${this.label || this.i18n.t("imageViewer")} .open=${this.open}
|
|
270
272
|
@open=${this.onDialogOpen} @close=${this.onDialogClose}>
|
|
271
|
-
<bk-image-viewer part="viewer" autofocus .items=${this.view} .index=${this.index} ?filmstrip=${this.filmstrip}
|
|
273
|
+
<bk-image-viewer part="viewer" autofocus immersive .items=${this.view} .index=${this.index} ?filmstrip=${this.filmstrip} ?loop=${this.loop}
|
|
272
274
|
label=${this.label || this.i18n.t("imageViewer")} prev-label=${this.prevLabel} next-label=${this.nextLabel}
|
|
273
275
|
zoom-in-label=${this.zoomInLabel} zoom-out-label=${this.zoomOutLabel} fit-label=${this.fitLabel}
|
|
274
276
|
actual-size-label=${this.actualSizeLabel} error-label=${this.errorLabel}
|
|
@@ -286,6 +288,7 @@ function openLightbox(items, startIndex = 0, options = {}) {
|
|
|
286
288
|
const el = document.createElement("bk-lightbox");
|
|
287
289
|
el.items = items;
|
|
288
290
|
el.filmstrip = !!options.filmstrip;
|
|
291
|
+
el.loop = !!options.loop;
|
|
289
292
|
for (const action of options.actions ?? []) {
|
|
290
293
|
action.slot = "actions";
|
|
291
294
|
el.append(action);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { type AriaForwarding, type TriggerAria } from "../internal/anchor.js";
|
|
3
|
+
import "./bk-icon.js";
|
|
4
|
+
import "../icons/set/external.js";
|
|
3
5
|
export type { NavigateDetail } from "../internal/link.js";
|
|
4
6
|
/**
|
|
5
7
|
* A text link: a real `<a>` in the text's size, for a link at the end of a row ("Open in the editor")
|
|
@@ -24,10 +26,13 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
24
26
|
* underline on hover. Put it in the heading: `<bk-text variant="h3" level="3"><bk-link variant="title">`.
|
|
25
27
|
*
|
|
26
28
|
* It uses the font size of the text around it and does not wrap (a `title` link wraps). With `target="_blank"` it
|
|
27
|
-
* sets `rel="noopener noreferrer"` unless `rel` is set.
|
|
29
|
+
* sets `rel="noopener noreferrer"` unless `rel` is set. It also shows the `external` icon after the text, and a screen
|
|
30
|
+
* reader hears "(opens in a new tab)". To hide the icon, set `bk-link::part(new-tab) { display: none }`; the text stays.
|
|
31
|
+
* Keyboard focus shows the focus ring.
|
|
28
32
|
*
|
|
29
33
|
* @slot - The link text.
|
|
30
34
|
* @csspart link - The `<a>`.
|
|
35
|
+
* @csspart new-tab - The icon after the text of a link with `target="_blank"`.
|
|
31
36
|
* @cssprop --bk-link-fg - Colour of a standalone link (default --bk-accent-text).
|
|
32
37
|
* @cssprop --bk-link-hover-fg - Colour of a standalone link on hover (default --bk-link-fg).
|
|
33
38
|
* @cssprop --bk-link-inline-fg - Colour of an inline link (default the colour of the text around it).
|
|
@@ -38,6 +43,8 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
38
43
|
* @cssprop --bk-link-underline - Underline colour of a standalone link at rest (default the link colour at 35 %).
|
|
39
44
|
* @cssprop --bk-link-underline-offset - Space between the text and its underline (default 0.15em).
|
|
40
45
|
* @cssprop --bk-link-radius - Corner radius of the focus ring (default --bk-radius-sm).
|
|
46
|
+
* @cssprop --bk-link-new-tab-gap - Space between the text and the icon of a link with `target="_blank"` (default --bk-space-1).
|
|
47
|
+
* @cssprop --bk-link-new-tab-size - Size of that icon (default --bk-icon-xs).
|
|
41
48
|
*
|
|
42
49
|
* @fires {CustomEvent<NavigateDetail>} navigate - The user makes a plain click on the link (primary button, no modifier key, no other `target`, no `download`). `detail.href` is the resolved address. Bubbles, composed, cancelable: `preventDefault()` stops the browser, and the router of the app handles the navigation.
|
|
43
50
|
* @tag bk-link
|
|
@@ -70,6 +77,7 @@ export declare class BkLink extends LitElement implements AriaForwarding {
|
|
|
70
77
|
download: string | undefined;
|
|
71
78
|
private forwarded;
|
|
72
79
|
private links;
|
|
80
|
+
private i18n;
|
|
73
81
|
constructor();
|
|
74
82
|
/** Trigger ARIA of a popover or tooltip goes on the inner `<a>` (see setTriggerAria). */
|
|
75
83
|
forwardAria(aria: TriggerAria): void;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { LitElement, css, html } from "lit";
|
|
1
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
2
2
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
3
3
|
import { controlsList } from "../internal/anchor.js";
|
|
4
4
|
import { define } from "../internal/define.js";
|
|
5
5
|
import { LinkController } from "../internal/link.js";
|
|
6
|
-
import { base } from "../internal/styles.js";
|
|
6
|
+
import { base, srOnly } from "../internal/styles.js";
|
|
7
|
+
import { LocalizeController } from "../i18n.js";
|
|
8
|
+
import "./bk-icon.js";
|
|
9
|
+
import "../icons/set/external.js";
|
|
7
10
|
class BkLink extends LitElement {
|
|
8
11
|
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
9
12
|
static properties = {
|
|
@@ -15,6 +18,7 @@ class BkLink extends LitElement {
|
|
|
15
18
|
};
|
|
16
19
|
forwarded = { haspopup: null, expanded: null, description: null };
|
|
17
20
|
links = new LinkController(this);
|
|
21
|
+
i18n = new LocalizeController(this);
|
|
18
22
|
constructor() {
|
|
19
23
|
super();
|
|
20
24
|
this.variant = "standalone";
|
|
@@ -30,7 +34,7 @@ class BkLink extends LitElement {
|
|
|
30
34
|
};
|
|
31
35
|
this.requestUpdate();
|
|
32
36
|
}
|
|
33
|
-
static styles = [base, css`
|
|
37
|
+
static styles = [base, srOnly, css`
|
|
34
38
|
:host { display: inline; white-space: nowrap; }
|
|
35
39
|
a {
|
|
36
40
|
color: var(--bk-link-fg, var(--bk-accent-text));
|
|
@@ -57,6 +61,12 @@ class BkLink extends LitElement {
|
|
|
57
61
|
@media (hover: hover) {
|
|
58
62
|
:host([variant="title"]) a:hover { color: var(--bk-link-title-hover-fg, inherit); text-decoration-color: currentColor; }
|
|
59
63
|
}
|
|
64
|
+
/* A link that opens a new tab: the icon after the text, on the baseline side of the line, without an underline. */
|
|
65
|
+
.new-tab {
|
|
66
|
+
display: inline-block; vertical-align: baseline; margin-inline-start: var(--bk-link-new-tab-gap, var(--bk-space-1));
|
|
67
|
+
--bk-icon-size: var(--bk-link-new-tab-size, var(--bk-icon-xs)); color: inherit;
|
|
68
|
+
}
|
|
69
|
+
:host(:dir(rtl)) .new-tab { scale: -1 1; }
|
|
60
70
|
a:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset); }
|
|
61
71
|
@media (forced-colors: active) { a { color: LinkText; } a:focus-visible { outline-color: Highlight; } }
|
|
62
72
|
`];
|
|
@@ -66,7 +76,7 @@ class BkLink extends LitElement {
|
|
|
66
76
|
rel=${ifDefined(this.rel ?? (this.target === "_blank" ? "noopener noreferrer" : void 0))}
|
|
67
77
|
download=${ifDefined(this.download)} aria-haspopup=${ifDefined(f.haspopup ?? void 0)}
|
|
68
78
|
aria-expanded=${ifDefined(f.expanded === null ? void 0 : String(f.expanded))}
|
|
69
|
-
.ariaControlsElements=${controlsList(f.controls)} aria-description=${ifDefined(f.description ?? void 0)}><slot></slot></a>`;
|
|
79
|
+
.ariaControlsElements=${controlsList(f.controls)} aria-description=${ifDefined(f.description ?? void 0)}><slot></slot>${this.target === "_blank" ? html`<bk-icon class="new-tab" part="new-tab" name="external"></bk-icon><span class="sr-only">${this.i18n.t("opensInNewTab")}</span>` : nothing}</a>`;
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
define("bk-link", BkLink);
|
|
@@ -3,10 +3,17 @@ import "./bk-icon.js";
|
|
|
3
3
|
import "./bk-kbd.js";
|
|
4
4
|
import "../icons/set/check.js";
|
|
5
5
|
import "../icons/set/chevron-right.js";
|
|
6
|
+
import "../icons/set/close.js";
|
|
6
7
|
import "../icons/set/description.js";
|
|
8
|
+
import "../icons/set/external.js";
|
|
7
9
|
import "../icons/set/label.js";
|
|
8
10
|
import "../icons/set/menu.js";
|
|
9
11
|
export type { NavigateDetail } from "../internal/link.js";
|
|
12
|
+
export interface MenuItemRemoveDetail {
|
|
13
|
+
/** The `value` of the item (or its label text when it has none). */
|
|
14
|
+
value: string;
|
|
15
|
+
item: BkMenuItem;
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* One entry of a `<bk-menu-list>` (and so of a `<bk-menu>`, which shows the list in a popover).
|
|
12
19
|
*
|
|
@@ -27,6 +34,9 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
27
34
|
* `variant="tiles"`, the item is a tile: its `preview` (a small picture of the choice) is above the label,
|
|
28
35
|
* and the label is the caption.
|
|
29
36
|
*
|
|
37
|
+
* A link with `target="_blank"` shows the `external` icon after the label, and a screen reader hears "(opens in a new
|
|
38
|
+
* tab)" (i18n `opensInNewTab`). To hide the icon, set `bk-menu-item::part(new-tab) { display: none }`; the text stays.
|
|
39
|
+
*
|
|
30
40
|
* **Submenu**: a `<bk-menu-list>` in the `submenu` slot makes the item a submenu parent. It shows a chevron at
|
|
31
41
|
* its end and `aria-haspopup="menu"` + `aria-expanded`. →, Enter and Space open the submenu and focus its first item
|
|
32
42
|
* (← in RTL). ← or Esc inside the submenu close it and return to the parent item. When the user hovers the item, the submenu opens after a short
|
|
@@ -34,6 +44,12 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
34
44
|
* the submenu fires `select` like any item. Choosing the parent only opens the submenu. It works in `<bk-menu>` and in an inline
|
|
35
45
|
* `<bk-menu-list>`. The submenu is an overlay panel beside the item.
|
|
36
46
|
*
|
|
47
|
+
* **Removable**: `removable` adds a remove button at the end of the row, for example for each entry of a history.
|
|
48
|
+
* A click on it, or the Delete key on the focused item, fires `remove` (bubbles, composed). The click does not choose
|
|
49
|
+
* the item. The app removes the item; the list first moves the focus to the next item. The button is a pointer target
|
|
50
|
+
* only (a menu item cannot contain a control): the keyboard uses Delete. The item announces this with
|
|
51
|
+
* `aria-keyshortcuts="Delete"` and the description "Press Delete to remove".
|
|
52
|
+
*
|
|
37
53
|
* @slot - Label.
|
|
38
54
|
* @slot submenu - A `<bk-menu-list>` that opens beside the item.
|
|
39
55
|
* @slot description - Second line under the label instead of `description`.
|
|
@@ -48,6 +64,8 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
48
64
|
* @csspart shortcut - The shortcut hint (a `<bk-kbd>` for keys).
|
|
49
65
|
* @csspart description - The second line.
|
|
50
66
|
* @csspart preview - The box around the preview of a tile.
|
|
67
|
+
* @csspart remove - The remove button of a `removable` item.
|
|
68
|
+
* @csspart new-tab - The icon after the label of a link with `target="_blank"`.
|
|
51
69
|
* @cssprop --bk-menu-item-height - Minimum height (default --bk-row-height).
|
|
52
70
|
* @cssprop --bk-menu-item-start-size - Minimum width of the `start` column (default --bk-icon-sm, the icon size).
|
|
53
71
|
* @cssprop --bk-menu-item-padding - Padding (default the row padding of the menu, --bk-row-pad-inline inline).
|
|
@@ -77,12 +95,18 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
77
95
|
* @cssprop --bk-menu-submenu-max-height - Maximum height before the submenu scrolls (default --bk-popup-height-md).
|
|
78
96
|
* @cssprop --bk-menu-item-chevron-color - Colour of the submenu chevron (default --bk-text-muted).
|
|
79
97
|
* @cssprop --bk-menu-item-danger-hover-bg - Hovered or focused background of `tone="danger"` (default --bk-danger-soft).
|
|
98
|
+
* @cssprop --bk-menu-item-new-tab-size - Size of the icon of a link with `target="_blank"` (default --bk-icon-xs).
|
|
99
|
+
* @cssprop --bk-menu-item-remove-size - Size of the remove button (default --bk-space-6).
|
|
100
|
+
* @cssprop --bk-menu-item-remove-fg - Colour of the remove button (default --bk-text-muted).
|
|
101
|
+
* @cssprop --bk-menu-item-remove-hover-bg - Background of the hovered remove button (default --bk-hover).
|
|
80
102
|
* @fires {MouseEvent} click - Native click. Does not fire while the item is disabled.
|
|
103
|
+
* @fires {CustomEvent<MenuItemRemoveDetail>} remove - The user removes a `removable` item (remove button or Delete). Bubbles, composed; `detail` is `{ value, item }`.
|
|
81
104
|
*
|
|
82
105
|
* @fires {CustomEvent<NavigateDetail>} navigate - The user makes a plain click on the link (primary button, no modifier key, no other `target`, no `download`). `detail.href` is the resolved address. The event bubbles, is composed and is cancelable. `preventDefault()` stops the browser, and the router of the app takes over.
|
|
83
106
|
* @tag bk-menu-item
|
|
84
107
|
* @keyboard → - Open the submenu and move to its first item. The arrow follows the writing direction.
|
|
85
108
|
* @keyboard ←, Escape - In the submenu: close the submenu and return to its item.
|
|
109
|
+
* @keyboard Delete - On a `removable` item: fire `remove`.
|
|
86
110
|
*/
|
|
87
111
|
export declare class BkMenuItem extends LitElement {
|
|
88
112
|
static shadowRootOptions: ShadowRootInit;
|
|
@@ -120,6 +144,13 @@ export declare class BkMenuItem extends LitElement {
|
|
|
120
144
|
type: BooleanConstructor;
|
|
121
145
|
reflect: boolean;
|
|
122
146
|
};
|
|
147
|
+
removable: {
|
|
148
|
+
type: BooleanConstructor;
|
|
149
|
+
reflect: boolean;
|
|
150
|
+
};
|
|
151
|
+
removeLabel: {
|
|
152
|
+
attribute: string;
|
|
153
|
+
};
|
|
123
154
|
tabStop: {
|
|
124
155
|
attribute: boolean;
|
|
125
156
|
};
|
|
@@ -159,6 +190,10 @@ export declare class BkMenuItem extends LitElement {
|
|
|
159
190
|
shortcut: string | undefined;
|
|
160
191
|
/** Second line under the label. */
|
|
161
192
|
description: string | undefined;
|
|
193
|
+
/** Shows a remove button; the item fires `remove` on it and on Delete. */
|
|
194
|
+
removable: boolean;
|
|
195
|
+
/** Name of the remove button (default "Remove {item}"). */
|
|
196
|
+
removeLabel: string | undefined;
|
|
162
197
|
/** Tile look. A `variant="tiles"` list sets it. Do not set it yourself. */
|
|
163
198
|
tile: boolean;
|
|
164
199
|
/** The list that contains the item sets it: this item is the Tab stop of the list (roving tabindex). */
|
|
@@ -175,6 +210,7 @@ export declare class BkMenuItem extends LitElement {
|
|
|
175
210
|
private edge;
|
|
176
211
|
private owner;
|
|
177
212
|
private links;
|
|
213
|
+
private i18n;
|
|
178
214
|
constructor();
|
|
179
215
|
disconnectedCallback(): void;
|
|
180
216
|
/** Whether the item has a submenu. */
|
|
@@ -205,6 +241,10 @@ export declare class BkMenuItem extends LitElement {
|
|
|
205
241
|
get effectiveValue(): string;
|
|
206
242
|
private get control();
|
|
207
243
|
focus(options?: FocusOptions): void;
|
|
244
|
+
/** Asks to remove the item: fires `remove`. Does nothing unless the item is `removable` and enabled. */
|
|
245
|
+
requestRemove(): void;
|
|
246
|
+
/** A click on the remove button removes the item and does not choose it. */
|
|
247
|
+
private onRemoveClick;
|
|
208
248
|
/** Clicks the inner row, so a link item navigates like a real link. */
|
|
209
249
|
click(): void;
|
|
210
250
|
static styles: import("lit").CSSResult[];
|
|
@@ -4,14 +4,19 @@ import { define } from "../internal/define.js";
|
|
|
4
4
|
import { LinkController } from "../internal/link.js";
|
|
5
5
|
import { anchorPopover, popupOffset } from "../internal/anchor.js";
|
|
6
6
|
import { SlotController } from "../internal/slots.js";
|
|
7
|
-
import { base, popupMotion, popupSurface } from "../internal/styles.js";
|
|
7
|
+
import { base, popupMotion, popupSurface, srOnly } from "../internal/styles.js";
|
|
8
8
|
import { ariaKeyShortcuts, isKeys } from "../shortcuts.js";
|
|
9
9
|
import "./bk-icon.js";
|
|
10
10
|
import "./bk-kbd.js";
|
|
11
11
|
import { lightDom } from "../internal/server.js";
|
|
12
|
+
import { ownText } from "../internal/own-text.js";
|
|
13
|
+
import { emitDetail } from "../internal/events.js";
|
|
14
|
+
import { LocalizeController } from "../i18n.js";
|
|
12
15
|
import "../icons/set/check.js";
|
|
13
16
|
import "../icons/set/chevron-right.js";
|
|
17
|
+
import "../icons/set/close.js";
|
|
14
18
|
import "../icons/set/description.js";
|
|
19
|
+
import "../icons/set/external.js";
|
|
15
20
|
import "../icons/set/label.js";
|
|
16
21
|
import "../icons/set/menu.js";
|
|
17
22
|
const openSubmenus = /* @__PURE__ */ new Set();
|
|
@@ -42,6 +47,8 @@ class BkMenuItem extends LitElement {
|
|
|
42
47
|
shortcut: {},
|
|
43
48
|
description: {},
|
|
44
49
|
tile: { type: Boolean, reflect: true },
|
|
50
|
+
removable: { type: Boolean, reflect: true },
|
|
51
|
+
removeLabel: { attribute: "remove-label" },
|
|
45
52
|
tabStop: { attribute: false },
|
|
46
53
|
expanded: { state: true }
|
|
47
54
|
};
|
|
@@ -55,6 +62,7 @@ class BkMenuItem extends LitElement {
|
|
|
55
62
|
edge = null;
|
|
56
63
|
owner = null;
|
|
57
64
|
links = new LinkController(this);
|
|
65
|
+
i18n = new LocalizeController(this);
|
|
58
66
|
constructor() {
|
|
59
67
|
super();
|
|
60
68
|
this.value = "";
|
|
@@ -65,6 +73,7 @@ class BkMenuItem extends LitElement {
|
|
|
65
73
|
this.disabled = false;
|
|
66
74
|
this.name = "";
|
|
67
75
|
this.tile = false;
|
|
76
|
+
this.removable = false;
|
|
68
77
|
this.tabStop = false;
|
|
69
78
|
this.expanded = false;
|
|
70
79
|
this.internals = this.attachInternals();
|
|
@@ -179,6 +188,11 @@ class BkMenuItem extends LitElement {
|
|
|
179
188
|
};
|
|
180
189
|
onRowPointerLeave = () => clearTimeout(this.openTimer);
|
|
181
190
|
onKeydown = (e) => {
|
|
191
|
+
if (e.key === "Delete" && this.removable && !this.disabled && !e.defaultPrevented && this.control && e.composedPath()[0] === this.control) {
|
|
192
|
+
e.preventDefault();
|
|
193
|
+
this.requestRemove();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
182
196
|
if (!this.hasSubmenu || this.disabled || e.defaultPrevented)
|
|
183
197
|
return;
|
|
184
198
|
const rtl = this.matches(":dir(rtl)");
|
|
@@ -210,7 +224,7 @@ class BkMenuItem extends LitElement {
|
|
|
210
224
|
};
|
|
211
225
|
/** The label text for typeahead (without the content of the named slots). */
|
|
212
226
|
get text() {
|
|
213
|
-
return
|
|
227
|
+
return ownText(this).replace(/\s+/g, " ").trim();
|
|
214
228
|
}
|
|
215
229
|
/** The second line as text: `description` or the description slot. */
|
|
216
230
|
get descriptionText() {
|
|
@@ -231,6 +245,18 @@ class BkMenuItem extends LitElement {
|
|
|
231
245
|
else
|
|
232
246
|
super.focus(options);
|
|
233
247
|
}
|
|
248
|
+
/** Asks to remove the item: fires `remove`. Does nothing unless the item is `removable` and enabled. */
|
|
249
|
+
requestRemove() {
|
|
250
|
+
if (!this.removable || this.disabled)
|
|
251
|
+
return;
|
|
252
|
+
emitDetail(this, "remove", { value: this.effectiveValue, item: this });
|
|
253
|
+
}
|
|
254
|
+
/** A click on the remove button removes the item and does not choose it. */
|
|
255
|
+
onRemoveClick = (e) => {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
this.requestRemove();
|
|
259
|
+
};
|
|
234
260
|
/** Clicks the inner row, so a link item navigates like a real link. */
|
|
235
261
|
click() {
|
|
236
262
|
const c = this.control;
|
|
@@ -239,7 +265,7 @@ class BkMenuItem extends LitElement {
|
|
|
239
265
|
else
|
|
240
266
|
super.click();
|
|
241
267
|
}
|
|
242
|
-
static styles = [base, popupSurface, popupMotion, css`
|
|
268
|
+
static styles = [base, srOnly, popupSurface, popupMotion, css`
|
|
243
269
|
:host {
|
|
244
270
|
display: block;
|
|
245
271
|
--_bk-menu-item-fg: var(--bk-menu-item-fg, var(--bk-text));
|
|
@@ -251,8 +277,9 @@ class BkMenuItem extends LitElement {
|
|
|
251
277
|
--_bk-menu-item-icon: var(--bk-menu-item-danger-fg, var(--bk-danger-text));
|
|
252
278
|
--_bk-menu-item-highlight: var(--bk-menu-item-danger-hover-bg, var(--bk-danger-soft));
|
|
253
279
|
}
|
|
280
|
+
/* A containing block: the text for a screen reader (sr-only) does not escape it and scroll the menu. */
|
|
254
281
|
.item {
|
|
255
|
-
display: flex; align-items: center; gap: var(--bk-menu-item-gap, var(--bk-row-gap));
|
|
282
|
+
position: relative; display: flex; align-items: center; gap: var(--bk-menu-item-gap, var(--bk-row-gap));
|
|
256
283
|
min-height: var(--bk-menu-item-height, var(--bk-row-height)); padding: var(--bk-menu-item-padding, var(--_bk-menu-row-pad, var(--bk-row-pad)) var(--bk-row-pad-inline));
|
|
257
284
|
padding-inline-end: var(--bk-menu-item-padding-end, var(--bk-row-pad-inline));
|
|
258
285
|
border-radius: var(--bk-menu-item-radius, var(--bk-row-radius));
|
|
@@ -276,6 +303,8 @@ class BkMenuItem extends LitElement {
|
|
|
276
303
|
font-size: var(--bk-menu-item-description-font-size, var(--bk-text-sm)); color: var(--bk-menu-item-description-color, var(--bk-text-muted));
|
|
277
304
|
}
|
|
278
305
|
.description[hidden], .preview[hidden] { display: none; }
|
|
306
|
+
.new-tab { flex: none; --bk-icon-size: var(--bk-menu-item-new-tab-size, var(--bk-icon-xs)); color: var(--_bk-menu-item-icon); }
|
|
307
|
+
:host(:dir(rtl)) .new-tab { scale: -1 1; }
|
|
279
308
|
/* Tile: the preview above the label as its caption. */
|
|
280
309
|
:host([tile]) .item {
|
|
281
310
|
flex-direction: column; justify-content: start; gap: var(--bk-space-1); padding: var(--bk-menu-item-tile-padding, var(--bk-space-1-5));
|
|
@@ -308,13 +337,25 @@ class BkMenuItem extends LitElement {
|
|
|
308
337
|
bk-kbd.shortcut { --bk-kbd-fg: var(--bk-menu-item-shortcut-color, var(--bk-text-muted)); margin-block: calc(-1 * var(--bk-space-0)); }
|
|
309
338
|
.chevron { flex: none; margin-inline-start: var(--bk-space-2); color: var(--bk-menu-item-chevron-color, var(--bk-text-muted)); --bk-icon-size: var(--bk-icon-sm); }
|
|
310
339
|
:host(:dir(rtl)) .chevron { scale: -1 1; }
|
|
340
|
+
/* The remove button: a pointer target at the end of the row. The row keeps its height. */
|
|
341
|
+
.remove {
|
|
342
|
+
flex: none; display: inline-grid; place-items: center; position: relative;
|
|
343
|
+
inline-size: var(--bk-menu-item-remove-size, var(--bk-space-6)); block-size: var(--bk-menu-item-remove-size, var(--bk-space-6));
|
|
344
|
+
margin-block: calc(-1 * var(--bk-space-1)); border-radius: var(--bk-radius-sm);
|
|
345
|
+
color: var(--bk-menu-item-remove-fg, var(--bk-text-muted)); cursor: pointer;
|
|
346
|
+
transition: background-color var(--bk-duration-fast), color var(--bk-duration-fast);
|
|
347
|
+
}
|
|
348
|
+
.remove bk-icon { color: inherit; --bk-icon-size: var(--bk-icon-xs); }
|
|
349
|
+
.remove::before { content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
|
|
350
|
+
@media (hover: hover) { .remove:hover { background: var(--bk-menu-item-remove-hover-bg, var(--bk-hover)); color: var(--bk-text); } }
|
|
351
|
+
.remove:active { background: var(--bk-menu-item-pressed-bg, var(--bk-pressed)); }
|
|
311
352
|
/* The parent of an open submenu keeps its highlight while focus is in the submenu. */
|
|
312
353
|
.item.open { background: var(--_bk-menu-item-highlight); }
|
|
313
354
|
.submenu {
|
|
314
355
|
--_bk-popup-bg: var(--bk-menu-submenu-bg, var(--bk-menu-bg));
|
|
315
356
|
--_bk-popup-fg: var(--bk-menu-fg);
|
|
316
357
|
--_bk-popup-border: var(--bk-menu-submenu-border, var(--bk-menu-border));
|
|
317
|
-
--_bk-popup-radius: var(--bk-menu-submenu-radius, var(--bk-menu-radius));
|
|
358
|
+
--_bk-popup-radius: var(--bk-menu-submenu-radius, var(--bk-menu-radius, var(--_bk-popup-row-radius)));
|
|
318
359
|
--_bk-popup-shadow: var(--bk-menu-submenu-shadow, var(--bk-menu-shadow));
|
|
319
360
|
--_bk-popup-padding: var(--bk-menu-submenu-padding, var(--bk-menu-padding));
|
|
320
361
|
--_bk-popup-offset: var(--bk-menu-submenu-offset);
|
|
@@ -342,12 +383,18 @@ class BkMenuItem extends LitElement {
|
|
|
342
383
|
const checkable = this.type === "checkbox" || this.type === "radio";
|
|
343
384
|
const role = this.type === "checkbox" ? "menuitemcheckbox" : this.type === "radio" ? "menuitemradio" : "menuitem";
|
|
344
385
|
const combo = isKeys(this.shortcut);
|
|
345
|
-
const
|
|
386
|
+
const removable = this.removable && !this.disabled;
|
|
387
|
+
const keys = [combo ? ariaKeyShortcuts(this.shortcut) : "", removable ? "Delete" : ""].filter(Boolean).join(" ");
|
|
388
|
+
const keyshortcuts = keys || nothing;
|
|
389
|
+
const hint = removable ? this.i18n.t("menuItemRemoveHint") : nothing;
|
|
390
|
+
const remove = removable ? html`<span class="remove" part="remove" aria-hidden="true" title=${this.removeLabel || this.i18n.t("menuItemRemove", { item: this.text })}
|
|
391
|
+
@click=${this.onRemoveClick}><bk-icon name="close"></bk-icon></span>` : nothing;
|
|
346
392
|
const inner = html`
|
|
347
393
|
${checkable ? html`<bk-icon class="check" part="check" name="check"></bk-icon>` : nothing}
|
|
348
394
|
<span class="preview" part="preview" ?hidden=${!this.tile}><slot name="preview"></slot></span>
|
|
349
395
|
<span class="start" ?hidden=${!this.icon && !this.hasStart}><slot name="start" @slotchange=${() => this.requestUpdate()}>${this.icon ? html`<bk-icon name=${this.icon}></bk-icon>` : nothing}</slot></span>
|
|
350
396
|
<span class="text"><span class="label"><slot></slot></span><span class="description" part="description" ?hidden=${!this.hasDescription}><slot name="description" @slotchange=${() => this.requestUpdate()}>${this.description}</slot></span></span>
|
|
397
|
+
${this.href && this.target === "_blank" && !this.disabled ? html`<bk-icon class="new-tab" part="new-tab" name="external"></bk-icon><span class="sr-only">${this.i18n.t("opensInNewTab")}</span>` : nothing}
|
|
351
398
|
<slot name="end">${!this.shortcut ? nothing : combo ? html`<bk-kbd class="shortcut" part="shortcut" size="sm" keys=${this.shortcut} aria-hidden="true"></bk-kbd>` : html`<span class="shortcut" part="shortcut">${this.shortcut}</span>`}</slot>`;
|
|
352
399
|
const tabindex = this.tabStop && !this.disabled ? "0" : "-1";
|
|
353
400
|
const sub = this.hasSubmenu;
|
|
@@ -359,13 +406,14 @@ class BkMenuItem extends LitElement {
|
|
|
359
406
|
if (this.href && !this.disabled) {
|
|
360
407
|
return html`<a class=${cls} part="item" role=${role} tabindex=${tabindex} href=${this.links.href(this.href)} @click=${this.links.click} target=${ifDefined(this.target)}
|
|
361
408
|
rel=${ifDefined(this.rel ?? (this.target === "_blank" ? "noopener noreferrer" : void 0))} download=${ifDefined(this.download)}
|
|
362
|
-
aria-checked=${checkable ? String(this.checked) : nothing} aria-current=${this.current ? "true" : nothing} aria-keyshortcuts=${keyshortcuts}
|
|
409
|
+
aria-checked=${checkable ? String(this.checked) : nothing} aria-current=${this.current ? "true" : nothing} aria-keyshortcuts=${keyshortcuts}
|
|
410
|
+
aria-description=${hint}>${inner}${remove}</a>${panel}`;
|
|
363
411
|
}
|
|
364
412
|
return html`<div class=${cls} part="item" role=${role} tabindex=${tabindex}
|
|
365
413
|
aria-checked=${checkable ? String(this.checked) : nothing} aria-disabled=${this.disabled ? "true" : nothing}
|
|
366
414
|
aria-haspopup=${popup} aria-expanded=${expanded}
|
|
367
|
-
aria-current=${this.current ? "true" : nothing} aria-keyshortcuts=${keyshortcuts}
|
|
368
|
-
@pointerenter=${this.onRowPointerEnter} @pointerleave=${this.onRowPointerLeave}>${inner}${chevron}</div>${panel}`;
|
|
415
|
+
aria-current=${this.current ? "true" : nothing} aria-keyshortcuts=${keyshortcuts} aria-description=${hint}
|
|
416
|
+
@pointerenter=${this.onRowPointerEnter} @pointerleave=${this.onRowPointerLeave}>${inner}${remove}${chevron}</div>${panel}`;
|
|
369
417
|
}
|
|
370
418
|
}
|
|
371
419
|
define("bk-menu-item", BkMenuItem);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, css, html } from "lit";
|
|
2
2
|
import { define } from "../internal/define.js";
|
|
3
3
|
import { base, groupLabel } from "../internal/styles.js";
|
|
4
|
+
import { ownText } from "../internal/own-text.js";
|
|
4
5
|
class BkMenuLabel extends LitElement {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
@@ -9,7 +10,7 @@ class BkMenuLabel extends LitElement {
|
|
|
9
10
|
}
|
|
10
11
|
/** The heading text, without the content of the named slots (what a filtering menu searches). */
|
|
11
12
|
get text() {
|
|
12
|
-
return
|
|
13
|
+
return ownText(this).replace(/\s+/g, " ").trim();
|
|
13
14
|
}
|
|
14
15
|
static styles = [base, groupLabel, css`
|
|
15
16
|
/* In a grid of tiles a heading spans the whole row; in a list it is a row anyway. */
|