@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
|
@@ -41,7 +41,7 @@ const chartTokensCss = String.raw`
|
|
|
41
41
|
--bk-chart-hero-size: calc(48px * var(--bk-text-scale));
|
|
42
42
|
--bk-chart-label-size: var(--bk-text-xs);
|
|
43
43
|
}
|
|
44
|
-
:root, [data-theme], [data-bk-scope] {
|
|
44
|
+
:root, [data-theme], [data-bk-scope], :is(:state(bk-scope)) {
|
|
45
45
|
--bk-chart-single: var(--bk-accent-solid);
|
|
46
46
|
${categorical}
|
|
47
47
|
--bk-chart-other: light-dark(oklch(from var(--bk-neutral) 0.72 calc(c * 0.6) h), oklch(from var(--bk-neutral) 0.5 calc(c * 0.6) h));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ChartRow } from "./frame.js";
|
|
2
|
+
/** A field of the row that the tooltip lists without drawing it: `key` is the row field. */
|
|
3
|
+
export interface ChartField {
|
|
4
|
+
key: string;
|
|
5
|
+
/** Name in the tooltip, the table and the accessible name (default: the key). */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Intl.NumberFormat options of this field (default: the plain number format of the locale). */
|
|
8
|
+
format?: Intl.NumberFormatOptions;
|
|
9
|
+
}
|
|
10
|
+
/** The attribute lists the keys, separated by spaces. The property takes keys and `ChartField` objects. */
|
|
11
|
+
export declare const tooltipFieldsConverter: {
|
|
12
|
+
fromAttribute(value: string | null): ChartField[];
|
|
13
|
+
};
|
|
14
|
+
/** The fields in effect: keys become `{ key }`, and entries without a key are dropped. */
|
|
15
|
+
export declare function resolveFields(fields: readonly (string | ChartField)[] | undefined): ChartField[];
|
|
16
|
+
/** The name of a field. */
|
|
17
|
+
export declare const fieldLabel: (f: ChartField) => string;
|
|
18
|
+
/** The value of a field in a row as text: numbers with Intl in `locale`, dates as dates, a missing value as a dash. */
|
|
19
|
+
export declare function fieldValue(locale: string, row: ChartRow | undefined, f: ChartField): string;
|
|
20
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { formatTime, formatValue } from "./format.js";
|
|
2
|
+
import { num } from "./frame.js";
|
|
3
|
+
const tooltipFieldsConverter = {
|
|
4
|
+
fromAttribute(value) {
|
|
5
|
+
return (value ?? "").split(/\s+/).filter(Boolean).map((key) => ({ key }));
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
function resolveFields(fields) {
|
|
9
|
+
return (fields ?? []).map((f) => typeof f === "string" ? { key: f } : f).filter((f) => f && f.key);
|
|
10
|
+
}
|
|
11
|
+
const fieldLabel = (f) => f.label || f.key;
|
|
12
|
+
function fieldValue(locale, row, f) {
|
|
13
|
+
const v = row?.[f.key];
|
|
14
|
+
if (v instanceof Date)
|
|
15
|
+
return formatTime(locale, v.getTime());
|
|
16
|
+
const n = num(v);
|
|
17
|
+
if (n !== null)
|
|
18
|
+
return formatValue(locale, n, f.format);
|
|
19
|
+
return v === void 0 || v === null || v === "" ? "\u2013" : String(v);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
fieldLabel,
|
|
23
|
+
fieldValue,
|
|
24
|
+
resolveFields,
|
|
25
|
+
tooltipFieldsConverter
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=fields.js.map
|
package/dist/charts/frame.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export interface MarkSpecs {
|
|
|
61
61
|
labelSize: number;
|
|
62
62
|
/** Clearance of labels from lines, bars and each other (--bk-space-1). */
|
|
63
63
|
clear: number;
|
|
64
|
+
/** Thickness of the mark of a chosen category (--bk-chart-indicator-width, default --bk-indicator-width). */
|
|
65
|
+
indicator: number;
|
|
64
66
|
font: string;
|
|
65
67
|
}
|
|
66
68
|
/**
|
package/dist/charts/frame.js
CHANGED
|
@@ -3,7 +3,7 @@ import { styleMap } from "../internal/style-map.js";
|
|
|
3
3
|
import { srOnly, interactive, headingType } from "../internal/styles.js";
|
|
4
4
|
import { chartT } from "./i18n.js";
|
|
5
5
|
import { CHART_SLOTS, slotColor } from "./chart-tokens.js";
|
|
6
|
-
const DEFAULT_SPECS = { barMax: 24, radius: 4, gap: 2, lineWidth: 2, marker: 8, ring: 2, hitMin: 24, bubbleMax: 40, labelSize: 12, clear: 4, font: "system-ui, sans-serif" };
|
|
6
|
+
const DEFAULT_SPECS = { barMax: 24, radius: 4, gap: 2, lineWidth: 2, marker: 8, ring: 2, hitMin: 24, bubbleMax: 40, labelSize: 12, clear: 4, indicator: 2, font: "system-ui, sans-serif" };
|
|
7
7
|
function seriesColor(s, i, count = 2) {
|
|
8
8
|
if (s.color)
|
|
9
9
|
return s.color;
|
|
@@ -186,6 +186,7 @@ class ChartController {
|
|
|
186
186
|
bubbleMax: px("--bk-chart-bubble-max", 40),
|
|
187
187
|
labelSize: px("--bk-chart-label-size", 12) || parseFloat(cs.fontSize) * 0.85,
|
|
188
188
|
clear: px("--bk-space-1", 4),
|
|
189
|
+
indicator: Math.max(1, px("--bk-chart-indicator-width", px("--bk-indicator-width", 2))),
|
|
189
190
|
font: cs.fontFamily || DEFAULT_SPECS.font
|
|
190
191
|
};
|
|
191
192
|
probe.remove();
|
|
@@ -243,11 +244,12 @@ class ChartController {
|
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
246
|
function renderTable(model, hidden) {
|
|
246
|
-
|
|
247
|
+
const table = html`<table class=${hidden ? nothing : "data"} part=${hidden ? nothing : "table"}>
|
|
247
248
|
<caption class=${hidden ? nothing : "sr-only"}>${model.caption}</caption>
|
|
248
249
|
<thead><tr>${model.columns.map((c, i) => html`<th scope="col" class=${i ? "num" : ""}>${c}</th>`)}</tr></thead>
|
|
249
250
|
<tbody>${model.rows.map((r) => html`<tr>${r.map((c, i) => i ? html`<td class="num">${c}</td>` : html`<th scope="row">${c}</th>`)}</tr>`)}</tbody>
|
|
250
251
|
</table>`;
|
|
252
|
+
return hidden ? html`<div class="sr-only">${table}</div>` : table;
|
|
251
253
|
}
|
|
252
254
|
function renderEmptyPlot(locale, width, height) {
|
|
253
255
|
return html`<div class="plot" part="plot"><svg width=${width} height=${height} aria-hidden="true">
|
package/dist/clipboard.js
CHANGED
|
@@ -8,6 +8,7 @@ import { StateController } from "../internal/state.js";
|
|
|
8
8
|
import { base, srOnly } from "../internal/styles.js";
|
|
9
9
|
import "./bk-icon.js";
|
|
10
10
|
import "./bk-button.js";
|
|
11
|
+
import { ownText } from "../internal/own-text.js";
|
|
11
12
|
import "../icons/set/close.js";
|
|
12
13
|
const TONE_KEYS = { neutral: "alertInfo", accent: "alertInfo", info: "alertInfo", success: "alertSuccess", warning: "alertWarning", danger: "alertDanger", attention: "alertAttention" };
|
|
13
14
|
class BkAlert extends LitElement {
|
|
@@ -92,7 +93,7 @@ class BkAlert extends LitElement {
|
|
|
92
93
|
return;
|
|
93
94
|
clearTimeout(this.announceTimer);
|
|
94
95
|
this.announceTimer = window.setTimeout(() => {
|
|
95
|
-
const body = (this.querySelector("[slot=heading]")?.textContent ?? "") + " " +
|
|
96
|
+
const body = (this.querySelector("[slot=heading]")?.textContent ?? "") + " " + ownText(this, " ");
|
|
96
97
|
const parts = [this.heading, body.replace(/\s+/g, " ").trim()].filter(Boolean);
|
|
97
98
|
const text = parts.length ? [this.i18n.t(TONE_KEYS[this.tone]), ...parts].join(": ") : "";
|
|
98
99
|
if (!text)
|
|
@@ -3,6 +3,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
3
3
|
import { define } from "../internal/define.js";
|
|
4
4
|
import { LocalizeController } from "../i18n.js";
|
|
5
5
|
import { base } from "../internal/styles.js";
|
|
6
|
+
import { setHostVars } from "../internal/host-vars.js";
|
|
6
7
|
import "./bk-avatar.js";
|
|
7
8
|
import "./bk-item.js";
|
|
8
9
|
import "./bk-item-group.js";
|
|
@@ -63,16 +64,13 @@ class BkAvatarGroup extends LitElement {
|
|
|
63
64
|
layout() {
|
|
64
65
|
const { avatars } = this;
|
|
65
66
|
const max = this.max ?? Infinity;
|
|
66
|
-
avatars.forEach((a, i) => {
|
|
67
|
-
a.hidden = i >= max;
|
|
68
|
-
a.style.zIndex = String(avatars.length - i);
|
|
69
|
-
});
|
|
67
|
+
avatars.forEach((a, i) => a.setGroupPlace?.({ hidden: i >= max, layer: avatars.length - i }));
|
|
70
68
|
this.hiddenCount = Math.max(0, avatars.length - max);
|
|
71
|
-
this
|
|
69
|
+
setHostVars(this, { "--_bk-avatar-group-size": `var(--bk-avatar-size-${avatars[0]?.getAttribute("size") || "md"})` });
|
|
72
70
|
this.requestUpdate();
|
|
73
71
|
}
|
|
74
72
|
render() {
|
|
75
|
-
const hidden = this.avatars.filter((a) => a.
|
|
73
|
+
const hidden = this.avatars.filter((a) => a.groupHidden);
|
|
76
74
|
return html`<slot @slotchange=${this.onSlot}></slot>${this.hiddenCount ? html`<bk-popover label=${this.i18n.t("morePeople")}>
|
|
77
75
|
<button slot="trigger" class="more" part="more" type="button"
|
|
78
76
|
aria-label=${this.i18n.t("moreCount", { count: this.hiddenCount })}>+${this.hiddenCount}</button>
|
|
@@ -88,6 +88,16 @@ export declare class BkAvatar extends LitElement {
|
|
|
88
88
|
constructor();
|
|
89
89
|
static styles: import("lit").CSSResult[];
|
|
90
90
|
private i18n;
|
|
91
|
+
/**
|
|
92
|
+
* `<bk-avatar-group>` calls this method: `hidden` hides an avatar beyond `max`, `layer` puts earlier avatars on top.
|
|
93
|
+
* The avatar shows its place through its own states: the group writes no attributes on the avatars of the app.
|
|
94
|
+
*/
|
|
95
|
+
setGroupPlace(o: {
|
|
96
|
+
hidden: boolean;
|
|
97
|
+
layer: number;
|
|
98
|
+
}): void;
|
|
99
|
+
/** True while a `<bk-avatar-group>` hides the avatar beyond its `max`. */
|
|
100
|
+
get groupHidden(): boolean;
|
|
91
101
|
protected willUpdate(changed: PropertyValues): void;
|
|
92
102
|
/** At xs and sm the dot is too small for a symbol. */
|
|
93
103
|
private get small();
|
|
@@ -82,10 +82,27 @@ class BkAvatar extends LitElement {
|
|
|
82
82
|
box-shadow: var(--_bk-avatar-active-shadow);
|
|
83
83
|
}
|
|
84
84
|
:host { transition: box-shadow var(--bk-duration-fast); }
|
|
85
|
+
/* The place in a <bk-avatar-group> (setGroupPlace): above the next avatar, or hidden beyond max. */
|
|
86
|
+
:host(:state(group-layer)) { z-index: var(--_bk-avatar-layer); }
|
|
87
|
+
:host(:state(group-hidden)) { display: none; }
|
|
85
88
|
@media (prefers-reduced-motion: reduce) { :host { transition: none; } }
|
|
86
89
|
@media (forced-colors: active) { :host { border: var(--bk-border-width) solid CanvasText; } :host([active]) { outline: var(--bk-space-0) solid Highlight; outline-offset: var(--bk-space-0); } }
|
|
87
90
|
`];
|
|
88
91
|
i18n = new LocalizeController(this);
|
|
92
|
+
/**
|
|
93
|
+
* `<bk-avatar-group>` calls this method: `hidden` hides an avatar beyond `max`, `layer` puts earlier avatars on top.
|
|
94
|
+
* The avatar shows its place through its own states: the group writes no attributes on the avatars of the app.
|
|
95
|
+
*/
|
|
96
|
+
setGroupPlace(o) {
|
|
97
|
+
const s = this.internals.states;
|
|
98
|
+
o.hidden ? s.add("group-hidden") : s.delete("group-hidden");
|
|
99
|
+
s.add("group-layer");
|
|
100
|
+
setHostVars(this, { "--_bk-avatar-layer": String(o.layer) });
|
|
101
|
+
}
|
|
102
|
+
/** True while a `<bk-avatar-group>` hides the avatar beyond its `max`. */
|
|
103
|
+
get groupHidden() {
|
|
104
|
+
return this.internals.states.has("group-hidden");
|
|
105
|
+
}
|
|
89
106
|
willUpdate(changed) {
|
|
90
107
|
if (changed.has("src"))
|
|
91
108
|
this.failed = false;
|
|
@@ -67,6 +67,8 @@ class BkBar extends LitElement {
|
|
|
67
67
|
:host {
|
|
68
68
|
display: flex; flex-wrap: wrap; align-items: center; flex: 1 1 auto; min-width: 0;
|
|
69
69
|
gap: var(--bk-bar-gap, var(--bk-space-cluster));
|
|
70
|
+
/* In a row the bar takes the rest of the line. In a column it keeps the height of its content. */
|
|
71
|
+
max-block-size: max-content;
|
|
70
72
|
}
|
|
71
73
|
:host([hidden]) { display: none; }
|
|
72
74
|
.start, .end { display: flex; flex-wrap: wrap; align-items: center; gap: inherit; min-width: 0; }
|
|
@@ -60,7 +60,7 @@ class BkButtonGroup extends FormControl {
|
|
|
60
60
|
::slotted(:not(:first-child)) { margin-inline-start: calc(-1 * var(--_bk-button-group-overlap)); }
|
|
61
61
|
:host([orientation="vertical"]) ::slotted(:not(:first-child)) { margin-inline-start: 0; margin-block-start: calc(-1 * var(--_bk-button-group-overlap)); }
|
|
62
62
|
/* The border of the hovered, focused or pressed button lies over its neighbours. */
|
|
63
|
-
::slotted(:hover), ::slotted(:focus-within), ::slotted([pressed]) { z-index: 1; }
|
|
63
|
+
::slotted(:hover), ::slotted(:focus-within), ::slotted([pressed]:not([pressed="false"])) { z-index: 1; }
|
|
64
64
|
:host([disabled]) .group { opacity: var(--bk-disabled-opacity); }
|
|
65
65
|
`];
|
|
66
66
|
get control() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, css, html } from "lit";
|
|
2
2
|
import { LocalizeController } from "../i18n.js";
|
|
3
3
|
import { define } from "../internal/define.js";
|
|
4
|
+
import { setHostVars } from "../internal/host-vars.js";
|
|
4
5
|
import { base } from "../internal/styles.js";
|
|
5
6
|
import "./bk-button.js";
|
|
6
7
|
import "../icons/set/arrow-up.js";
|
|
@@ -88,7 +89,7 @@ class BkButtonTop extends LitElement {
|
|
|
88
89
|
return;
|
|
89
90
|
this.shown = shown;
|
|
90
91
|
if (shown)
|
|
91
|
-
this
|
|
92
|
+
setHostVars(this, { "--_bk-button-top-bar": `${parseFloat(getComputedStyle(document.documentElement).scrollPaddingBottom) || 0}px` });
|
|
92
93
|
}
|
|
93
94
|
/** Scrolls to the top and moves focus to the start of the page or list. */
|
|
94
95
|
toTop() {
|
|
@@ -3,21 +3,31 @@ import { type AriaForwarding, type TriggerAria } from "../internal/anchor.js";
|
|
|
3
3
|
import "./bk-icon.js";
|
|
4
4
|
import "./bk-spinner.js";
|
|
5
5
|
import "./bk-tooltip.js";
|
|
6
|
+
import { SUBMIT_BUTTON, type CustomSubmitButton } from "../internal/submit.js";
|
|
6
7
|
export type { NavigateDetail } from "../internal/link.js";
|
|
7
8
|
import "../icons/set/label.js";
|
|
8
9
|
export type ButtonVariant = "solid" | "soft" | "outline" | "ghost" | "quiet";
|
|
9
10
|
export type ButtonTone = "neutral" | "accent" | "info" | "success" | "warning" | "danger" | "attention";
|
|
10
11
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
11
12
|
/**
|
|
12
|
-
* A button, or a link styled as one when `href` is set.
|
|
13
|
+
* A button, or a link styled as one when `href` is set. A link with `target="_blank"` has the description "(opens in a
|
|
14
|
+
* new tab)". To show it, give the button `icon-end="external"`.
|
|
13
15
|
*
|
|
14
16
|
* Style and meaning are separate. `variant` is the visual weight (`solid`, `soft`, `outline` (default),
|
|
15
17
|
* `ghost`, `quiet`). `tone` is the colour of meaning (`neutral` (default), `accent`, `info`, `success`,
|
|
16
|
-
* `warning`, `danger`). Every combination works. The main action of a view is
|
|
18
|
+
* `warning`, `danger`, `attention`). Every combination works. The main action of a view is
|
|
17
19
|
* `variant="solid" tone="accent"`. A destructive action is `tone="danger"` (solid to confirm, ghost in rows).
|
|
18
20
|
*
|
|
19
21
|
* Form-associated: `type="submit"` and `type="reset"` act on the surrounding `<form>` like a native
|
|
20
|
-
* button.
|
|
22
|
+
* button. A disabled ancestor `<fieldset>` disables the button, as a native button (a link button stays a link).
|
|
23
|
+
*
|
|
24
|
+
* **Default button**: the first submit button of a form in tree order is its default button, a native one or a
|
|
25
|
+
* `bk-button type="submit"`. Enter in a single-line field of the form (native or of the library) clicks it. A
|
|
26
|
+
* disabled default button (also `loading` or `disabled-reason`) blocks Enter, as natively. The browser does not know
|
|
27
|
+
* a custom default button: a document listener does this for native fields. It writes nothing into the DOM. The
|
|
28
|
+
* native Enter does not fire `change` on the field before the submission then.
|
|
29
|
+
*
|
|
30
|
+
* The default slot contains the content. The `start` and `end` slots contain icons. As a shorthand,
|
|
21
31
|
* use the `icon` and `icon-end` attributes.
|
|
22
32
|
*
|
|
23
33
|
* **Choose files**: `type="file"` opens the file dialog of the system, like a native
|
|
@@ -46,10 +56,13 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
46
56
|
* - `collapse` shows only the icon when the nearest size container is narrow. Set
|
|
47
57
|
* `container-type: inline-size` on a toolbar or header, and the button collapses below 640px of its width
|
|
48
58
|
* (`collapse="sm"`: 480px, `collapse="lg"`: 960px). The label stays the accessible name and
|
|
49
|
-
* becomes the tooltip. The button needs an icon, and `collapse` has no effect without a container ancestor.
|
|
59
|
+
* becomes the tooltip. The button needs an icon, and `collapse` has no effect without a container ancestor. The
|
|
60
|
+
* start icon stays. A button with only an end icon (`icon-end`) keeps the end icon.
|
|
50
61
|
*
|
|
51
62
|
* The element passes `aria-current` on the host (a page in a pager, the current step) to the inner control and
|
|
52
|
-
* sets the `pressed` look on the button.
|
|
63
|
+
* sets the `pressed` look on the button. It also passes `aria-expanded` and `aria-controls` on the host (a
|
|
64
|
+
* disclosure button of the app) to the inner control. `pressed` sets `aria-pressed`. A popover, a menu or a tooltip
|
|
65
|
+
* that controls the button (setTriggerAria) replaces `aria-expanded` and `aria-controls` while it is attached.
|
|
53
66
|
*
|
|
54
67
|
* `disabled-reason` turns the button off and says why ("A group has at most 4 items"). Unlike
|
|
55
68
|
* `disabled`, the button stays focusable (`aria-disabled`), so keyboard and screen reader users can
|
|
@@ -59,9 +72,10 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
59
72
|
* not open from a trigger that is off.
|
|
60
73
|
*
|
|
61
74
|
* An icon-only button shows its name in a built-in tooltip (hover and keyboard focus, not touch; not
|
|
62
|
-
* on an open popup trigger, not inside a dialog, drawer or popover).
|
|
63
|
-
*
|
|
64
|
-
* the `
|
|
75
|
+
* on an open popup trigger, not inside a dialog, drawer, lightbox or popover). The button finds the overlay also through
|
|
76
|
+
* the shadow roots of other elements. An open tooltip takes the first Esc (WCAG 1.4.13), so without the tooltip one Esc
|
|
77
|
+
* closes the overlay. `hide-tooltip` turns the tooltip off, and the native `title` with it, for a button that is in a
|
|
78
|
+
* tooltip of the app. The name stays the `aria-label`.
|
|
65
79
|
*
|
|
66
80
|
* @slot - Label. Or only an icon or a `<bk-avatar>` (an icon-only button).
|
|
67
81
|
* @slot start - Leading content, usually a `<bk-icon>`.
|
|
@@ -95,8 +109,8 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
95
109
|
* @cssprop --bk-button-solid-shadow - Shadow of `solid` (default a glow in the fill colour, scaled by --bk-glow-strength, 0 = none).
|
|
96
110
|
* @cssprop --bk-button-hover - Hover overlay of `outline`, `soft` and `quiet` (default --bk-hover).
|
|
97
111
|
* @cssprop --bk-button-quiet-fg - Text colour of neutral `quiet` at rest (default --bk-text-muted).
|
|
98
|
-
* @cssprop --bk-button-pressed-bg - Background while `pressed` (default --bk-accent-soft).
|
|
99
|
-
* @cssprop --bk-button-pressed-fg - Text colour while `pressed` (default --bk-accent-text).
|
|
112
|
+
* @cssprop --bk-button-pressed-bg - Background while `pressed` or current (default: the soft background of the tone, --bk-button-{tone}-soft; neutral --bk-accent-soft).
|
|
113
|
+
* @cssprop --bk-button-pressed-fg - Text colour while `pressed` or current (default: the text colour of the tone, --bk-button-{tone}-text; neutral --bk-accent-text).
|
|
100
114
|
* @cssprop --bk-button-pressed-border - Border colour while `pressed` (default transparent).
|
|
101
115
|
* @cssprop --bk-button-floating-bg - Background of `floating` (default --bk-layer-overlay-bg).
|
|
102
116
|
* @cssprop --bk-button-floating-fg - Text colour of `floating` (default: the tone's text colour).
|
|
@@ -122,11 +136,11 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
122
136
|
*
|
|
123
137
|
* @keyboard Enter, Space - Activate the button (a link button: Enter follows the link).
|
|
124
138
|
* @keyboard Tab - Move focus to the button, also when it is disabled with a `disabled-reason`.
|
|
125
|
-
* @a11y A native `<button>` (or `<a>` with `href`) inside. An icon-only button uses `label` as its accessible name. A disabled button with `disabled-reason` stays focusable (`aria-disabled`) and has the reason as its description. `aria
|
|
139
|
+
* @a11y A native `<button>` (or `<a>` with `href`) inside. An icon-only button uses `label` as its accessible name. A disabled button with `disabled-reason` stays focusable (`aria-disabled`) and has the reason as its description. The inner control gets `aria-current`, `aria-expanded` and `aria-controls` of the host, and `aria-pressed` from `pressed`.
|
|
126
140
|
* @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.
|
|
127
141
|
* @tag bk-button
|
|
128
142
|
*/
|
|
129
|
-
export declare class BkButton extends LitElement implements AriaForwarding {
|
|
143
|
+
export declare class BkButton extends LitElement implements AriaForwarding, CustomSubmitButton {
|
|
130
144
|
static formAssociated: boolean;
|
|
131
145
|
static shadowRootOptions: ShadowRootInit;
|
|
132
146
|
static properties: {
|
|
@@ -189,8 +203,11 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
189
203
|
reflect: boolean;
|
|
190
204
|
};
|
|
191
205
|
pressed: {
|
|
192
|
-
type: BooleanConstructor;
|
|
193
206
|
reflect: boolean;
|
|
207
|
+
converter: {
|
|
208
|
+
fromAttribute: (value: string | null) => boolean;
|
|
209
|
+
toAttribute: (value: boolean | undefined) => "" | null;
|
|
210
|
+
};
|
|
194
211
|
};
|
|
195
212
|
floating: {
|
|
196
213
|
type: BooleanConstructor;
|
|
@@ -202,6 +219,12 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
202
219
|
current: {
|
|
203
220
|
attribute: string;
|
|
204
221
|
};
|
|
222
|
+
hostExpanded: {
|
|
223
|
+
attribute: string;
|
|
224
|
+
};
|
|
225
|
+
hostControls: {
|
|
226
|
+
attribute: string;
|
|
227
|
+
};
|
|
205
228
|
count: {
|
|
206
229
|
type: NumberConstructor;
|
|
207
230
|
};
|
|
@@ -246,7 +269,7 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
246
269
|
iconEnd: string | undefined;
|
|
247
270
|
/** Accessible name and tooltip; needed when the button shows only an icon. */
|
|
248
271
|
label: string | undefined;
|
|
249
|
-
/** Disables the button: no focus, no clicks, no form submit. */
|
|
272
|
+
/** Disables the button: no focus, no clicks, no form submit. A disabled ancestor `<fieldset>` disables it too (not a link button). */
|
|
250
273
|
disabled: boolean;
|
|
251
274
|
/** Turns the button off and says why: a tooltip and the accessible description. The button stays focusable. */
|
|
252
275
|
disabledReason: string | undefined;
|
|
@@ -259,8 +282,9 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
259
282
|
/** Position of the content of a `block` button: `center` (default), or `start` for a list of answers. A long label of a `block` button wraps, and the button grows with it. */
|
|
260
283
|
align: "center" | "start" | undefined;
|
|
261
284
|
/**
|
|
262
|
-
* Toggle state; sets aria-pressed and the pressed
|
|
263
|
-
*
|
|
285
|
+
* Toggle state; sets `aria-pressed` and the pressed look. When unset (the default), the button is not a toggle.
|
|
286
|
+
* The property `false` makes an unpressed toggle that announces `aria-pressed="false"`. In markup, write
|
|
287
|
+
* `pressed="false"` for it. The attribute `pressed` (or any other value) is a pressed toggle.
|
|
264
288
|
*/
|
|
265
289
|
pressed: boolean | undefined;
|
|
266
290
|
/** Pill on a floating surface with a level-2 shadow, for controls laid over content. */
|
|
@@ -273,6 +297,10 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
273
297
|
* pager or the current step; a toggle uses `pressed`.
|
|
274
298
|
*/
|
|
275
299
|
current: string | undefined;
|
|
300
|
+
/** `aria-expanded` on the host (a disclosure button of the app). A popup that controls the button (setTriggerAria) wins. */
|
|
301
|
+
hostExpanded: string | undefined;
|
|
302
|
+
/** `aria-controls` on the host: the ids of elements in the same document or shadow root as the button. */
|
|
303
|
+
hostControls: string | undefined;
|
|
276
304
|
/** Count badge on an icon-only button (unread items); `99+` above 99, none for 0 or unset. */
|
|
277
305
|
count: number | undefined;
|
|
278
306
|
/** A dot on an icon-only button: something new, without a number. */
|
|
@@ -291,10 +319,19 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
291
319
|
showPicker(): void;
|
|
292
320
|
private onPicked;
|
|
293
321
|
private onPickCancel;
|
|
294
|
-
/**
|
|
322
|
+
/** A disabled ancestor `<fieldset>` disables the button, as a native button. A link button stays a link. */
|
|
323
|
+
private fieldsetDisabled;
|
|
324
|
+
/** The button is disabled: `disabled`, or a disabled ancestor `<fieldset>` (not a link button). */
|
|
325
|
+
private get isDisabled();
|
|
326
|
+
/** Whether the button takes no action: `disabled` (also from a `<fieldset>`), `disabled-reason` or `loading`. */
|
|
295
327
|
get inactive(): boolean;
|
|
328
|
+
formDisabledCallback(disabled: boolean): void;
|
|
329
|
+
/** For the default button of the form (internal/submit.ts): null when not a submit button, else whether it is off. */
|
|
330
|
+
[SUBMIT_BUTTON](): boolean | null;
|
|
296
331
|
/** Trigger ARIA set by popovers, menus and tooltips; rendered onto the inner control. */
|
|
297
332
|
private forwarded;
|
|
333
|
+
/** The elements of the ids in `aria-controls` on the host, in the root of the button (the inner control cannot refer to them by id). */
|
|
334
|
+
private hostControlled;
|
|
298
335
|
/** Used by `<bk-popover>`, `<bk-menu>` and `<bk-tooltip>` (see setTriggerAria). */
|
|
299
336
|
forwardAria(aria: TriggerAria): void;
|
|
300
337
|
static styles: import("lit").CSSResult[];
|
|
@@ -316,6 +353,7 @@ export declare class BkButton extends LitElement implements AriaForwarding {
|
|
|
316
353
|
/** What count and dot announce to assistive technology ("3 new"), for the description. */
|
|
317
354
|
private get badgeDescription();
|
|
318
355
|
protected willUpdate(changed: PropertyValues): void;
|
|
356
|
+
protected updated(changed: PropertyValues): void;
|
|
319
357
|
protected renderContent(): TemplateResult<1>;
|
|
320
358
|
render(): TemplateResult;
|
|
321
359
|
/**
|
|
@@ -12,9 +12,14 @@ import "./bk-icon.js";
|
|
|
12
12
|
import "./bk-spinner.js";
|
|
13
13
|
import "./bk-tooltip.js";
|
|
14
14
|
import { lightDom } from "../internal/server.js";
|
|
15
|
+
import { SUBMIT_BUTTON, listenForImplicitSubmission } from "../internal/submit.js";
|
|
15
16
|
import "../icons/set/label.js";
|
|
16
17
|
const stopClick = (e) => e.stopPropagation();
|
|
17
18
|
const VISUAL = /* @__PURE__ */ new Set(["bk-icon", "svg", "img", "bk-avatar"]);
|
|
19
|
+
const pressedConverter = {
|
|
20
|
+
fromAttribute: (value) => value !== null && value !== "false",
|
|
21
|
+
toAttribute: (value) => value ? "" : null
|
|
22
|
+
};
|
|
18
23
|
class BkButton extends LitElement {
|
|
19
24
|
static formAssociated = true;
|
|
20
25
|
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
@@ -42,10 +47,12 @@ class BkButton extends LitElement {
|
|
|
42
47
|
hideTooltip: { attribute: "hide-tooltip", type: Boolean, reflect: true },
|
|
43
48
|
block: { type: Boolean, reflect: true },
|
|
44
49
|
align: { reflect: true },
|
|
45
|
-
pressed: {
|
|
50
|
+
pressed: { reflect: true, converter: pressedConverter },
|
|
46
51
|
floating: { type: Boolean, reflect: true },
|
|
47
52
|
collapse: { reflect: true },
|
|
48
53
|
current: { attribute: "aria-current" },
|
|
54
|
+
hostExpanded: { attribute: "aria-expanded" },
|
|
55
|
+
hostControls: { attribute: "aria-controls" },
|
|
49
56
|
count: { type: Number },
|
|
50
57
|
dot: { type: Boolean, reflect: true }
|
|
51
58
|
};
|
|
@@ -124,12 +131,34 @@ class BkButton extends LitElement {
|
|
|
124
131
|
e.stopPropagation();
|
|
125
132
|
emitLifecycle(this, "cancel");
|
|
126
133
|
};
|
|
127
|
-
/**
|
|
134
|
+
/** A disabled ancestor `<fieldset>` disables the button, as a native button. A link button stays a link. */
|
|
135
|
+
fieldsetDisabled = false;
|
|
136
|
+
/** The button is disabled: `disabled`, or a disabled ancestor `<fieldset>` (not a link button). */
|
|
137
|
+
get isDisabled() {
|
|
138
|
+
return this.disabled || this.fieldsetDisabled && !this.href;
|
|
139
|
+
}
|
|
140
|
+
/** Whether the button takes no action: `disabled` (also from a `<fieldset>`), `disabled-reason` or `loading`. */
|
|
128
141
|
get inactive() {
|
|
129
|
-
return this.
|
|
142
|
+
return this.isDisabled || this.loading || !!this.disabledReason;
|
|
143
|
+
}
|
|
144
|
+
formDisabledCallback(disabled) {
|
|
145
|
+
this.fieldsetDisabled = disabled;
|
|
146
|
+
this.requestUpdate();
|
|
147
|
+
}
|
|
148
|
+
/** For the default button of the form (internal/submit.ts): null when not a submit button, else whether it is off. */
|
|
149
|
+
[SUBMIT_BUTTON]() {
|
|
150
|
+
return this.type === "submit" && !this.href ? this.inactive : null;
|
|
130
151
|
}
|
|
131
152
|
/** Trigger ARIA set by popovers, menus and tooltips; rendered onto the inner control. */
|
|
132
153
|
forwarded = { haspopup: null, expanded: null, controls: null, description: null, hideTitle: false };
|
|
154
|
+
/** The elements of the ids in `aria-controls` on the host, in the root of the button (the inner control cannot refer to them by id). */
|
|
155
|
+
hostControlled() {
|
|
156
|
+
if (!this.hostControls || !this.isConnected)
|
|
157
|
+
return null;
|
|
158
|
+
const root = this.getRootNode();
|
|
159
|
+
const found = this.hostControls.split(/\s+/).map((id) => root.getElementById?.(id)).filter((el) => !!el);
|
|
160
|
+
return found.length ? found : null;
|
|
161
|
+
}
|
|
133
162
|
/** Used by `<bk-popover>`, `<bk-menu>` and `<bk-tooltip>` (see setTriggerAria). */
|
|
134
163
|
forwardAria(aria) {
|
|
135
164
|
const f = this.forwarded;
|
|
@@ -250,14 +279,14 @@ class BkButton extends LitElement {
|
|
|
250
279
|
--_bk-button-shadow: var(--bk-button-solid-shadow, 0 var(--bk-space-1) var(--bk-space-4) calc(-1 * var(--bk-space-1)) oklch(from var(--_bk-button-solid) l c h / calc(0.5 * var(--bk-glow-strength))));
|
|
251
280
|
}
|
|
252
281
|
@media (hover: hover) {
|
|
253
|
-
:host([variant="solid"]:not([disabled]
|
|
282
|
+
:host([variant="solid"]:not([disabled], :disabled, [pressed]:not([pressed="false"]))) .control:hover:not([aria-disabled="true"]) { background: var(--_bk-button-fill-hover, var(--_bk-button-solid-hover)); }
|
|
254
283
|
}
|
|
255
284
|
:host([variant="soft"]) { --_bk-button-bg: var(--_bk-button-soft); --_bk-button-bd: transparent; --_bk-button-shadow: none; }
|
|
256
285
|
:host([variant="ghost"]) { --_bk-button-bg: var(--bk-button-ghost-bg, transparent); --_bk-button-bd: transparent; --_bk-button-hover: var(--_bk-button-tint); --_bk-button-shadow: none; }
|
|
257
286
|
:host([variant="quiet"]) { --_bk-button-bg: transparent; --_bk-button-bd: transparent; --_bk-button-shadow: none; }
|
|
258
287
|
:host([variant="quiet"]:is([tone="neutral"], :not([tone]))) { --_bk-button-fg: var(--bk-button-quiet-fg, var(--bk-text-muted)); }
|
|
259
288
|
@media (hover: hover) {
|
|
260
|
-
:host([variant="quiet"]:not([disabled])) .control:hover:not([aria-disabled="true"]) { color: var(--_bk-button-text); border-color: var(--_bk-button-frame); }
|
|
289
|
+
:host([variant="quiet"]:not([disabled], :disabled)) .control:hover:not([aria-disabled="true"]) { color: var(--_bk-button-text); border-color: var(--_bk-button-frame); }
|
|
261
290
|
}
|
|
262
291
|
:host([floating]) { --_bk-button-shadow: var(--bk-button-floating-shadow, var(--bk-layer-overlay-shadow)); }
|
|
263
292
|
:host([floating]:not([variant="solid"])) {
|
|
@@ -266,9 +295,12 @@ class BkButton extends LitElement {
|
|
|
266
295
|
--_bk-button-bd: var(--bk-button-floating-border, var(--bk-layer-overlay-border));
|
|
267
296
|
}
|
|
268
297
|
:host([floating]) .control { border-radius: var(--bk-button-floating-radius, var(--bk-radius-full)); }
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
298
|
+
/* The pressed look follows the tone: its soft background and its text. Neutral (the default) uses the accent, the colour of a selection. */
|
|
299
|
+
:host { --_bk-button-pressed-bg: var(--bk-accent-soft); --_bk-button-pressed-fg: var(--bk-accent-text); }
|
|
300
|
+
:host([tone]:not([tone="neutral"])) { --_bk-button-pressed-bg: var(--_bk-button-soft); --_bk-button-pressed-fg: var(--_bk-button-text); }
|
|
301
|
+
:host([pressed]:not([pressed="false"])), :host([aria-current]:not([aria-current="false"])) {
|
|
302
|
+
--_bk-button-bg: var(--bk-button-pressed-bg, var(--_bk-button-pressed-bg));
|
|
303
|
+
--_bk-button-fg: var(--bk-button-pressed-fg, var(--_bk-button-pressed-fg));
|
|
272
304
|
--_bk-button-bd: var(--bk-button-pressed-border, transparent);
|
|
273
305
|
--_bk-button-shadow: none;
|
|
274
306
|
}
|
|
@@ -290,8 +322,9 @@ class BkButton extends LitElement {
|
|
|
290
322
|
.control:focus { outline: none; }
|
|
291
323
|
.control:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-button-focus-offset, var(--bk-focus-offset)); }
|
|
292
324
|
|
|
293
|
-
:
|
|
294
|
-
:host([disabled]) .control
|
|
325
|
+
/* :disabled is also a disabled ancestor fieldset. A link button stays a link there. */
|
|
326
|
+
:host(:is([disabled], :disabled:not([href]))) .control, :host([disabled-reason]:not([disabled-reason=""])) .control { opacity: var(--bk-disabled-opacity); cursor: not-allowed; }
|
|
327
|
+
:host(:is([disabled], :disabled:not([href]))) .control::after, :host([disabled-reason]:not([disabled-reason=""])) .control::after { display: none; }
|
|
295
328
|
/* The tooltip that says why the button is off wraps the control and fills the host like it. */
|
|
296
329
|
.reason { display: flex; flex: 1; min-width: 0; }
|
|
297
330
|
.reason::part(anchor) { flex: 1; min-width: 0; }
|
|
@@ -302,7 +335,7 @@ class BkButton extends LitElement {
|
|
|
302
335
|
/* The content has no box of its own (display: contents), so each part hides. Not visibility: the label stays the accessible name. */
|
|
303
336
|
.spinning .label, .spinning .content bk-icon, .spinning .content ::slotted(*) { opacity: 0; }
|
|
304
337
|
.spinner { position: absolute; inset: 0; display: grid; place-items: center; }
|
|
305
|
-
@media (forced-colors: active) { .control { border-color: ButtonText; } :host([pressed]) .control, :host([aria-current]:not([aria-current="false"])) .control { outline: 2px solid Highlight; } }
|
|
338
|
+
@media (forced-colors: active) { .control { border-color: ButtonText; } :host([pressed]:not([pressed="false"])) .control, :host([aria-current]:not([aria-current="false"])) .control { outline: 2px solid Highlight; } }
|
|
306
339
|
|
|
307
340
|
.content { display: contents; }
|
|
308
341
|
/* An icon's glyph carries its own inner space: the padding on its side gives that back. */
|
|
@@ -332,18 +365,19 @@ class BkButton extends LitElement {
|
|
|
332
365
|
@media (forced-colors: active) { .count, .dot { border: var(--bk-border-width) solid CanvasText; } .dot { background: Highlight; } }
|
|
333
366
|
:host(:state(round)) .control { border-radius: var(--bk-radius-full); }
|
|
334
367
|
|
|
335
|
-
/* collapse: icon only when the nearest size container is narrow (thresholds can't be tokens)
|
|
368
|
+
/* collapse: icon only when the nearest size container is narrow (thresholds can't be tokens). The start icon stays;
|
|
369
|
+
a button with only an end icon keeps the end icon. */
|
|
336
370
|
@container (max-width: 480px) {
|
|
337
371
|
:host([collapse="sm"]) .control { padding: 0; width: var(--_bk-button-h); }
|
|
338
|
-
:host([collapse="sm"]) :is(.label, slot[name="end"]) { display: none; }
|
|
372
|
+
:host([collapse="sm"]) :is(.label, .has-start slot[name="end"]) { display: none; }
|
|
339
373
|
}
|
|
340
374
|
@container (max-width: 640px) {
|
|
341
375
|
:host([collapse=""]) .control, :host([collapse="md"]) .control { padding: 0; width: var(--_bk-button-h); }
|
|
342
|
-
:host([collapse=""]) :is(.label, slot[name="end"]), :host([collapse="md"]) :is(.label, slot[name="end"]) { display: none; }
|
|
376
|
+
:host([collapse=""]) :is(.label, .has-start slot[name="end"]), :host([collapse="md"]) :is(.label, .has-start slot[name="end"]) { display: none; }
|
|
343
377
|
}
|
|
344
378
|
@container (max-width: 960px) {
|
|
345
379
|
:host([collapse="lg"]) .control { padding: 0; width: var(--_bk-button-h); }
|
|
346
|
-
:host([collapse="lg"]) :is(.label, slot[name="end"]) { display: none; }
|
|
380
|
+
:host([collapse="lg"]) :is(.label, .has-start slot[name="end"]) { display: none; }
|
|
347
381
|
}
|
|
348
382
|
`];
|
|
349
383
|
/** Whether `collapse` is set (a container query can hide the text). */
|
|
@@ -354,10 +388,17 @@ class BkButton extends LitElement {
|
|
|
354
388
|
inOverlay = false;
|
|
355
389
|
connectedCallback() {
|
|
356
390
|
super.connectedCallback();
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
391
|
+
this.inOverlay = false;
|
|
392
|
+
for (let node = this; node; ) {
|
|
393
|
+
if (node.closest("dialog, bk-dialog, bk-drawer, bk-lightbox, bk-command-palette, [popover]")) {
|
|
394
|
+
this.inOverlay = true;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
const root = node.getRootNode();
|
|
398
|
+
node = root instanceof ShadowRoot ? root.host : null;
|
|
399
|
+
}
|
|
400
|
+
if (this.collapsible && !this.icon && !this.iconEnd && !this.querySelector(":scope > :is([slot=start], [slot=end])")) {
|
|
401
|
+
console.warn("<bk-button collapse> needs an icon (icon, icon-end, or the start or end slot): it is all that stays visible.", this);
|
|
361
402
|
}
|
|
362
403
|
}
|
|
363
404
|
/**
|
|
@@ -408,6 +449,11 @@ class BkButton extends LitElement {
|
|
|
408
449
|
if (changed.has("loading"))
|
|
409
450
|
this.loader.set(this.loading);
|
|
410
451
|
}
|
|
452
|
+
updated(changed) {
|
|
453
|
+
super.updated(changed);
|
|
454
|
+
if (changed.has("type") && this.type === "submit")
|
|
455
|
+
listenForImplicitSubmission();
|
|
456
|
+
}
|
|
411
457
|
renderContent() {
|
|
412
458
|
return html`
|
|
413
459
|
<slot name="start">${this.icon ? html`<bk-icon name=${this.icon}></bk-icon>` : nothing}</slot>
|
|
@@ -429,10 +475,11 @@ class BkButton extends LitElement {
|
|
|
429
475
|
const labelTip = !reason && !f.hideTitle && !this.hideTooltip && !this.inOverlay && this.iconOnly && name ? name : void 0;
|
|
430
476
|
const title = f.hideTitle || this.hideTooltip || reason || labelTip ? void 0 : name;
|
|
431
477
|
const popup = ifDefined(f.haspopup ?? void 0);
|
|
432
|
-
const expanded = ifDefined(f.expanded === null ? void 0 : String(f.expanded));
|
|
433
|
-
const
|
|
478
|
+
const expanded = ifDefined(f.expanded === null ? this.hostExpanded ?? void 0 : String(f.expanded));
|
|
479
|
+
const newTab = this.href && this.target === "_blank" ? this.i18n.t("opensInNewTab") : void 0;
|
|
480
|
+
const description = ifDefined(reason ? void 0 : [f.description, this.badgeDescription, newTab].filter(Boolean).join(". ") || void 0);
|
|
434
481
|
const current = ifDefined(this.current ?? void 0);
|
|
435
|
-
const controls = controlsList(f.controls);
|
|
482
|
+
const controls = controlsList(f.controls ?? this.hostControlled());
|
|
436
483
|
if (this.href) {
|
|
437
484
|
return this.withReason(reason, name, labelTip, html`<a part="control" class=${cls}
|
|
438
485
|
href=${ifDefined(inactive ? void 0 : this.links.href(this.href))} @click=${this.links.click} target=${ifDefined(this.target)}
|
|
@@ -440,11 +487,11 @@ class BkButton extends LitElement {
|
|
|
440
487
|
download=${ifDefined(this.download)} aria-label=${ifDefined(name)} title=${ifDefined(title)}
|
|
441
488
|
aria-haspopup=${popup} aria-expanded=${expanded} .ariaControlsElements=${controls} aria-description=${description} aria-current=${current}
|
|
442
489
|
aria-disabled=${ifDefined(inactive ? "true" : void 0)} role=${ifDefined(inactive ? "link" : void 0)}
|
|
443
|
-
tabindex=${ifDefined(reason ? "0" : this.
|
|
490
|
+
tabindex=${ifDefined(reason ? "0" : this.isDisabled ? "-1" : void 0)}>${inner}</a>`);
|
|
444
491
|
}
|
|
445
492
|
return this.withReason(reason, name, labelTip, html`<button part="control" class=${cls} type="button"
|
|
446
493
|
command=${ifDefined(this.command)} @click=${this.onControlClick}
|
|
447
|
-
?disabled=${this.
|
|
494
|
+
?disabled=${this.isDisabled && !reason} aria-disabled=${ifDefined(off ? "true" : void 0)}
|
|
448
495
|
aria-busy=${ifDefined(this.loading ? "true" : void 0)}
|
|
449
496
|
aria-pressed=${ifDefined(this.pressed === void 0 ? void 0 : String(this.pressed))}
|
|
450
497
|
aria-label=${ifDefined(name)} title=${ifDefined(title)}
|