@bk2k/ui 0.7.0 → 0.7.1
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/CHANGELOG.md +63 -0
- package/USAGE.md +20 -9
- package/custom-elements.json +1 -1
- package/dist/charts/frame.d.ts +2 -0
- package/dist/components/bk-alert.js +1 -1
- package/dist/components/bk-button.d.ts +5 -0
- package/dist/components/bk-button.js +15 -4
- package/dist/components/bk-card.d.ts +6 -3
- package/dist/components/bk-card.js +15 -9
- package/dist/components/bk-chart-area.d.ts +4 -0
- package/dist/components/bk-chart-line.d.ts +15 -0
- package/dist/components/bk-chart-line.js +16 -6
- package/dist/components/bk-chip.d.ts +2 -0
- package/dist/components/bk-chip.js +3 -1
- package/dist/components/bk-combobox.d.ts +2 -2
- package/dist/components/bk-combobox.js +7 -20
- package/dist/components/bk-footnotes-item.d.ts +2 -2
- package/dist/components/bk-image-compare.d.ts +36 -1
- package/dist/components/bk-image-compare.js +47 -11
- package/dist/components/bk-image-viewer.d.ts +74 -3
- package/dist/components/bk-image-viewer.js +115 -28
- package/dist/components/bk-input-color.d.ts +2 -5
- package/dist/components/bk-input-color.js +0 -14
- package/dist/components/bk-input-file.d.ts +17 -0
- package/dist/components/bk-input-file.js +18 -8
- package/dist/components/bk-input-tags.d.ts +219 -0
- package/dist/components/bk-input-tags.js +293 -0
- package/dist/components/bk-input-text.d.ts +9 -0
- package/dist/components/bk-input-text.js +18 -2
- package/dist/components/bk-lightbox.d.ts +25 -1
- package/dist/components/bk-lightbox.js +7 -0
- package/dist/components/bk-page-cta.d.ts +2 -0
- package/dist/components/bk-page-cta.js +8 -1
- package/dist/components/bk-split-grid.js +7 -2
- package/dist/components/bk-stat.d.ts +2 -0
- package/dist/components/bk-stat.js +1 -1
- package/dist/components/bk-table.d.ts +2 -0
- package/dist/components/bk-table.js +1 -1
- package/dist/components/bk-tabs.d.ts +2 -1
- package/dist/components/bk-tabs.js +15 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/announcer.d.ts +6 -0
- package/dist/internal/announcer.js +7 -2
- package/dist/internal/cloak.js +1 -0
- package/dist/internal/define.d.ts +9 -0
- package/dist/internal/define.js +47 -1
- package/dist/internal/elements.d.ts +6 -0
- package/dist/internal/elements.js +5 -0
- package/dist/internal/hue.d.ts +8 -0
- package/dist/internal/hue.js +15 -4
- package/dist/internal/late/bk-tabs.d.ts +4 -0
- package/dist/internal/late/bk-tabs.js +8 -0
- package/dist/internal/late.js +3 -3
- package/dist/internal/tags.d.ts +15 -0
- package/dist/internal/tags.js +44 -0
- package/dist/internal/text-field.d.ts +2 -0
- package/dist/internal/text-field.js +8 -0
- package/dist/internal/toggle-control.js +3 -1
- package/dist/jsx.d.ts +85 -6
- package/dist/kit.d.ts +1 -0
- package/dist/kit.js +3 -0
- package/dist/reset.css +1 -1
- package/dist/standalone/all.js +106 -105
- package/dist/standalone/bk-accordion-item.js +3 -3
- package/dist/standalone/bk-accordion.js +1 -1
- package/dist/standalone/bk-action-bar.js +1 -1
- package/dist/standalone/bk-alert-offline.js +1 -1
- package/dist/standalone/bk-alert.js +7 -4
- package/dist/standalone/bk-app-state.js +1 -1
- package/dist/standalone/bk-attachment.js +2 -2
- package/dist/standalone/bk-avatar-group.js +1 -1
- package/dist/standalone/bk-avatar.js +3 -3
- package/dist/standalone/bk-badge.js +1 -1
- package/dist/standalone/bk-bar.js +1 -1
- package/dist/standalone/bk-brand.js +1 -1
- package/dist/standalone/bk-breadcrumbs.js +2 -2
- package/dist/standalone/bk-button-copy.js +4 -4
- package/dist/standalone/bk-button-group.js +2 -2
- package/dist/standalone/bk-button-share.js +4 -4
- package/dist/standalone/bk-button-top.js +1 -1
- package/dist/standalone/bk-button.js +14 -6
- package/dist/standalone/bk-calendar-event.js +1 -1
- package/dist/standalone/bk-calendar-week.js +1 -1
- package/dist/standalone/bk-calendar.js +2 -2
- package/dist/standalone/bk-card.js +17 -11
- package/dist/standalone/bk-carousel-controls.js +2 -2
- package/dist/standalone/bk-carousel-item.js +1 -1
- 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 +2 -2
- package/dist/standalone/bk-chart-bar.js +1 -1
- package/dist/standalone/bk-chart-bridge.js +1 -1
- package/dist/standalone/bk-chart-bullet.js +1 -1
- package/dist/standalone/bk-chart-calendar.js +1 -1
- package/dist/standalone/bk-chart-heatmap.js +1 -1
- package/dist/standalone/bk-chart-histogram.js +1 -1
- package/dist/standalone/bk-chart-legend.js +1 -1
- package/dist/standalone/bk-chart-line.js +16 -8
- package/dist/standalone/bk-chart-mark.js +1 -1
- package/dist/standalone/bk-chart-scatter.js +1 -1
- package/dist/standalone/bk-chart-sparkline.js +1 -1
- package/dist/standalone/bk-chart-stacked-bar.js +1 -1
- package/dist/standalone/bk-chart-tracker.js +1 -1
- package/dist/standalone/bk-chart-waterfall.js +2 -2
- package/dist/standalone/bk-checkbox-group.js +5 -5
- package/dist/standalone/bk-checkbox.js +3 -3
- package/dist/standalone/bk-chip-group.js +4 -4
- package/dist/standalone/bk-chip.js +5 -3
- package/dist/standalone/bk-cluster.js +1 -1
- package/dist/standalone/bk-code-diff.js +2 -2
- package/dist/standalone/bk-code-stack.js +1 -1
- package/dist/standalone/bk-code.js +1 -1
- package/dist/standalone/bk-color-panel.js +2 -2
- package/dist/standalone/bk-columns.js +1 -1
- package/dist/standalone/bk-combobox.js +21 -30
- package/dist/standalone/bk-command-menu.js +3 -3
- package/dist/standalone/bk-command-palette.js +4 -4
- package/dist/standalone/bk-composer.js +4 -4
- package/dist/standalone/bk-delta.js +1 -1
- package/dist/standalone/bk-diagram.js +1 -1
- package/dist/standalone/bk-dialog.js +1 -1
- package/dist/standalone/bk-disclosure.js +2 -2
- package/dist/standalone/bk-divider.js +4 -4
- package/dist/standalone/bk-drawer.js +2 -2
- package/dist/standalone/bk-drop-target.js +1 -1
- package/dist/standalone/bk-empty-state.js +2 -2
- package/dist/standalone/bk-error-summary.js +1 -1
- package/dist/standalone/bk-facts-item.js +1 -1
- package/dist/standalone/bk-facts.js +1 -1
- package/dist/standalone/bk-feature.js +2 -2
- package/dist/standalone/bk-fieldset.js +1 -1
- package/dist/standalone/bk-filter-bar.js +2 -2
- package/dist/standalone/bk-folder-browser.js +2 -2
- package/dist/standalone/bk-footnote.js +1 -1
- package/dist/standalone/bk-footnotes-item.js +2 -2
- package/dist/standalone/bk-footnotes.js +1 -1
- package/dist/standalone/bk-form-guard.js +1 -1
- package/dist/standalone/bk-form-steps.js +1 -1
- package/dist/standalone/bk-grid.js +1 -1
- package/dist/standalone/bk-icon-tile.js +2 -2
- package/dist/standalone/bk-icon.js +1 -1
- package/dist/standalone/bk-image-compare.js +55 -27
- package/dist/standalone/bk-image-crop.js +3 -3
- package/dist/standalone/bk-image-editor.js +1 -1
- package/dist/standalone/bk-image-viewer.js +127 -57
- package/dist/standalone/bk-input-code.js +2 -2
- package/dist/standalone/bk-input-color.js +3 -13
- 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 +20 -13
- package/dist/standalone/bk-input-group.js +2 -2
- package/dist/standalone/bk-input-inline.js +1 -1
- package/dist/standalone/bk-input-number.js +4 -4
- package/dist/standalone/bk-input-rating.js +4 -4
- package/dist/standalone/bk-input-rich.js +1 -1
- package/dist/standalone/bk-input-search.js +4 -4
- package/dist/standalone/bk-input-slider-range.js +2 -2
- package/dist/standalone/bk-input-slider.js +2 -2
- package/dist/standalone/bk-input-tags.js +224 -0
- 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 +4 -4
- package/dist/standalone/bk-item-group.js +2 -2
- package/dist/standalone/bk-item.js +2 -2
- package/dist/standalone/bk-kbd-shortcuts.js +1 -1
- package/dist/standalone/bk-kbd.js +1 -1
- package/dist/standalone/bk-lightbox.js +16 -3
- package/dist/standalone/bk-lines.js +1 -1
- package/dist/standalone/bk-link.js +2 -2
- 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 +5 -5
- package/dist/standalone/bk-listbox-transfer.js +4 -4
- package/dist/standalone/bk-listbox.js +5 -5
- package/dist/standalone/bk-logo-wall.js +1 -1
- package/dist/standalone/bk-logo.js +2 -2
- package/dist/standalone/bk-menu-bar.js +1 -1
- package/dist/standalone/bk-menu-context.js +1 -1
- package/dist/standalone/bk-menu-divider.js +1 -1
- package/dist/standalone/bk-menu-item.js +2 -2
- package/dist/standalone/bk-menu-label.js +1 -1
- package/dist/standalone/bk-menu-list.js +1 -1
- package/dist/standalone/bk-menu.js +4 -4
- package/dist/standalone/bk-message-approval.js +2 -2
- package/dist/standalone/bk-message-branches.js +1 -1
- package/dist/standalone/bk-message-citation.js +1 -1
- package/dist/standalone/bk-message-feedback.js +2 -2
- package/dist/standalone/bk-message-list.js +2 -2
- package/dist/standalone/bk-message-reasoning.js +3 -3
- package/dist/standalone/bk-message-source.js +1 -1
- package/dist/standalone/bk-message-tool-group.js +3 -3
- package/dist/standalone/bk-message-tool.js +3 -3
- package/dist/standalone/bk-message.js +2 -2
- package/dist/standalone/bk-meter.js +1 -1
- package/dist/standalone/bk-model-viewer.js +1 -1
- package/dist/standalone/bk-nav-divider.js +1 -1
- package/dist/standalone/bk-nav-group.js +5 -5
- package/dist/standalone/bk-nav-item.js +2 -2
- package/dist/standalone/bk-nav-toc.js +1 -1
- package/dist/standalone/bk-nav.js +1 -1
- package/dist/standalone/bk-overflow.js +1 -1
- package/dist/standalone/bk-page-cta.js +10 -3
- package/dist/standalone/bk-page-footer-column.js +1 -1
- package/dist/standalone/bk-page-footer.js +1 -1
- package/dist/standalone/bk-page-header.js +2 -2
- package/dist/standalone/bk-page-hero.js +2 -2
- package/dist/standalone/bk-page-pager.js +2 -2
- package/dist/standalone/bk-page-section.js +2 -2
- package/dist/standalone/bk-pagination.js +3 -3
- package/dist/standalone/bk-pane.js +2 -2
- package/dist/standalone/bk-panel.js +2 -2
- package/dist/standalone/bk-period-nav.js +2 -2
- package/dist/standalone/bk-picture.js +1 -175
- package/dist/standalone/bk-popover-help.js +1 -1
- package/dist/standalone/bk-popover.js +1 -1
- package/dist/standalone/bk-presence-cursor.js +2 -2
- package/dist/standalone/bk-preview.js +2 -2
- package/dist/standalone/bk-progress.js +1 -1
- package/dist/standalone/bk-prose.js +1 -1
- package/dist/standalone/bk-qr-code.js +1 -1
- package/dist/standalone/bk-radio-group.js +5 -5
- package/dist/standalone/bk-radio.js +2 -2
- package/dist/standalone/bk-rating.js +3 -3
- package/dist/standalone/bk-scroll.js +1 -1
- package/dist/standalone/bk-segmented-item.js +2 -2
- package/dist/standalone/bk-segmented.js +4 -4
- package/dist/standalone/bk-select-cascade.js +3 -3
- package/dist/standalone/bk-select-tree.js +4 -4
- package/dist/standalone/bk-select.js +4 -4
- package/dist/standalone/bk-shell-app.js +1 -1
- package/dist/standalone/bk-shell-centered.js +1 -1
- package/dist/standalone/bk-shell-sites.js +1 -1
- package/dist/standalone/bk-skeleton.js +1 -1
- package/dist/standalone/bk-sortable.js +2 -2
- package/dist/standalone/bk-spinner.js +1 -1
- package/dist/standalone/bk-split-grid.js +10 -7
- package/dist/standalone/bk-split.js +6 -6
- package/dist/standalone/bk-stack.js +1 -1
- package/dist/standalone/bk-stat-group.js +1 -1
- package/dist/standalone/bk-stat.js +3 -3
- package/dist/standalone/bk-status-dot.js +2 -2
- package/dist/standalone/bk-steps-item.js +2 -2
- package/dist/standalone/bk-steps.js +1 -1
- package/dist/standalone/bk-surface.js +1 -1
- package/dist/standalone/bk-swatch-group.js +6 -6
- package/dist/standalone/bk-swatch-palette.js +1 -1
- package/dist/standalone/bk-swatch.js +1 -1
- package/dist/standalone/bk-switch.js +2 -2
- package/dist/standalone/bk-table.js +1 -1
- package/dist/standalone/bk-tabs-item.js +2 -2
- package/dist/standalone/bk-tabs-panel.js +1 -1
- package/dist/standalone/bk-tabs.js +3 -414
- package/dist/standalone/bk-tasks-item.js +2 -2
- package/dist/standalone/bk-tasks.js +1 -1
- package/dist/standalone/bk-testimonial.js +2 -2
- package/dist/standalone/bk-text.js +3 -3
- package/dist/standalone/bk-time-countdown.js +2 -2
- package/dist/standalone/bk-time-relative.js +1 -1
- package/dist/standalone/bk-timeline-item.js +2 -2
- package/dist/standalone/bk-timeline.js +1 -1
- package/dist/standalone/bk-toast-group.js +1 -1
- package/dist/standalone/bk-toast.js +2 -2
- package/dist/standalone/bk-toolbar.js +1 -1
- package/dist/standalone/bk-tooltip.js +1 -1
- package/dist/standalone/bk-tree-item.js +3 -3
- package/dist/standalone/bk-tree.js +4 -4
- package/dist/standalone/bk-video.js +2 -2
- package/dist/standalone/bk-visually-hidden.js +1 -1
- package/dist/standalone/bk-zoom.js +3 -3
- package/dist/standalone/chunks/{announcer-D1zrRWwO.js → announcer-6tMlCOq1.js} +9 -4
- package/dist/standalone/chunks/{bk-alert-offline-Clw0ZSsH.js → bk-alert-offline-hCLuG-RM.js} +1 -1
- package/dist/standalone/chunks/{bk-carousel-Biz7t8sL.js → bk-carousel-_dudBMVq.js} +2 -2
- package/dist/standalone/chunks/{bk-diagram-D_fQf6SF.js → bk-diagram-BB2odomE.js} +2 -2
- package/dist/standalone/chunks/{bk-dialog-DwZyUUHh.js → bk-dialog-DcvwnOtN.js} +2 -2
- package/dist/standalone/chunks/{bk-icon-Bp_flKdv.js → bk-icon-D4kI4F18.js} +1 -1
- package/dist/standalone/chunks/{bk-image-editor-BADsoLRL.js → bk-image-editor-SRVkHI-4.js} +2 -2
- package/dist/standalone/chunks/{bk-input-date-range-DHcJ8-5g.js → bk-input-date-range-C0Vd-p0T.js} +2 -2
- package/dist/standalone/chunks/{bk-input-rich-CFhW6vRa.js → bk-input-rich-AmDv87E5.js} +3 -3
- package/dist/standalone/chunks/{bk-input-text-DviyLBqj.js → bk-input-text-2n89GDIT.js} +15 -5
- package/dist/standalone/chunks/{bk-model-viewer-w_Ah4Tvs.js → bk-model-viewer-BoNYBd6W.js} +2 -2
- package/dist/standalone/chunks/bk-picture-CA5gLxgZ.js +186 -0
- package/dist/standalone/chunks/{bk-qr-code-CYMovNVl.js → bk-qr-code-CSFfc8As.js} +1 -1
- package/dist/standalone/chunks/{bk-shell-app-B2lxHit8.js → bk-shell-app-BlCOG25y.js} +31 -30
- package/dist/standalone/chunks/{bk-surface-D7e0tErs.js → bk-surface-BULRdKam.js} +1 -1
- package/dist/standalone/chunks/{bk-swatch-palette-x13JgJQi.js → bk-swatch-palette-Cqj85tSW.js} +1 -1
- package/dist/standalone/chunks/{bk-table-CP8n_jy7.js → bk-table-DWlD7yoM.js} +72 -71
- package/dist/standalone/chunks/bk-tabs-STkr3-E1.js +422 -0
- package/dist/standalone/chunks/{bk-toast-group-CoL6W7uk.js → bk-toast-group-5nZg7BaJ.js} +2 -2
- package/dist/standalone/chunks/{busy-BUB22mGY.js → busy-eG3uHonz.js} +1 -1
- package/dist/standalone/chunks/{choice-field-poOTerh1.js → choice-field-B0oe_9fI.js} +4 -4
- package/dist/standalone/chunks/{date-field-B-fCXa2D.js → date-field-Dy1_qxNv.js} +2 -2
- package/dist/standalone/chunks/define-6OfuRn5c.js +60 -0
- package/dist/standalone/chunks/{form-control-CHpfKAKa.js → form-control-Bmk0SRDX.js} +1 -1
- package/dist/standalone/chunks/{handle-menu-BgYUbGO2.js → handle-menu-BAe9fPYJ.js} +10 -36
- package/dist/standalone/chunks/{heading-text-CgnCa_q2.js → heading-text-B2kF-b8p.js} +1 -1
- package/dist/standalone/chunks/hue-vLbNdAEl.js +20 -0
- package/dist/standalone/chunks/late-CPQ_RbU-.js +30 -0
- package/dist/standalone/chunks/{options-BdC8-KKM.js → options-ySaDL-dW.js} +1 -1
- package/dist/standalone/chunks/{stars-BgKEjDQx.js → stars-BAUc_LqI.js} +1 -1
- package/dist/standalone/chunks/tags-CMLAGsVw.js +37 -0
- package/dist/standalone/chunks/{text-field-CqhJSAwZ.js → text-field-CufOGdfr.js} +16 -10
- package/dist/standalone/chunks/{toggle-control-lvZbQtGW.js → toggle-control-Cgqp1jhf.js} +4 -2
- package/dist/standalone/chunks/{virtual-C_h6sHnm.js → virtual-D-qgACnE.js} +1 -1
- package/dist/standalone/confirm.js +2 -2
- package/dist/standalone/reset.css +1 -1
- package/dist/standalone/toast.js +1 -1
- package/dist/standalone/tokens.css +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +2 -2
- package/dist/standalone/chunks/define-DkVeu7e9.js +0 -30
- package/dist/standalone/chunks/hue-Jvb-141g.js +0 -14
- package/dist/standalone/chunks/keyed-CZ2AaouM.js +0 -16
package/dist/charts/frame.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface ChartSeries {
|
|
|
21
21
|
slot?: number;
|
|
22
22
|
/** In a `toggleable` `bk-chart-line`: the series starts hidden, and the user shows it through the legend. */
|
|
23
23
|
hidden?: boolean;
|
|
24
|
+
/** In a `bk-chart-line`: `break` or `connect` for this series. It overrides the `gaps` attribute of the chart. */
|
|
25
|
+
gaps?: "break" | "connect";
|
|
24
26
|
}
|
|
25
27
|
export type ChartRow = Record<string, unknown>;
|
|
26
28
|
/** Anything coloured like a series: series, stacked-bar parts, legend items. */
|
|
@@ -101,7 +101,7 @@ class BkAlert extends LitElement {
|
|
|
101
101
|
if (text === this.lastText)
|
|
102
102
|
return;
|
|
103
103
|
this.lastText = text;
|
|
104
|
-
announce(text, { assertive: this.tone === "danger" });
|
|
104
|
+
announce(text, { assertive: this.tone === "danger", source: this });
|
|
105
105
|
}, 100);
|
|
106
106
|
}
|
|
107
107
|
firstUpdated() {
|
|
@@ -81,6 +81,8 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
81
81
|
* @slot start - Leading content, usually a `<bk-icon>`.
|
|
82
82
|
* @slot end - Trailing content, for example an icon or a `<bk-chip>` count.
|
|
83
83
|
* @csspart control - The native `<button>` or `<a>`.
|
|
84
|
+
* @csspart icon-start - The icon from `icon`.
|
|
85
|
+
* @csspart icon-end - The icon from `icon-end`. While a popup that the button controls is open the host has `:state(expanded)`: `bk-button:state(expanded)::part(icon-end) { rotate: 180deg; }` turns a chevron.
|
|
84
86
|
* @cssprop --bk-button-radius - Corner radius (default --bk-radius-control, else --bk-radius-md). Inside a `bk-button-group` the group sets the corners.
|
|
85
87
|
* @cssprop --bk-button-font-weight - Label weight (default --bk-weight-medium).
|
|
86
88
|
* @cssprop --bk-button-letter-spacing - Label letter spacing.
|
|
@@ -107,6 +109,9 @@ export type ButtonSize = "sm" | "md" | "lg";
|
|
|
107
109
|
* @cssprop --bk-button-accent-fill-hover - The same on hover.
|
|
108
110
|
* @cssprop --bk-button-gradient - The gradient knob for buttons only (default --bk-gradient).
|
|
109
111
|
* @cssprop --bk-button-solid-shadow - Shadow of `solid` (default a glow in the fill colour, scaled by --bk-glow-strength, 0 = none).
|
|
112
|
+
* @cssprop --bk-button-shadow - Shadow at rest, any `box-shadow` value (default: the shadow of the variant, see `outline-shadow` and `solid-shadow`). `none` removes it.
|
|
113
|
+
* @cssprop --bk-button-shadow-hover - Shadow on hover (default: the value of --bk-button-shadow, so nothing changes).
|
|
114
|
+
* @cssprop --bk-button-lift-hover - How far the button moves up on hover (default 0). Use whole pixels. With reduced motion, and when disabled, it stays in place.
|
|
110
115
|
* @cssprop --bk-button-hover - Hover overlay of `outline`, `soft` and `quiet` (default --bk-hover).
|
|
111
116
|
* @cssprop --bk-button-quiet-fg - Text colour of neutral `quiet` at rest (default --bk-text-muted).
|
|
112
117
|
* @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).
|
|
@@ -312,10 +312,16 @@ class BkButton extends LitElement {
|
|
|
312
312
|
letter-spacing: var(--bk-button-letter-spacing, normal); text-transform: var(--bk-button-text-transform, none);
|
|
313
313
|
line-height: 1; white-space: nowrap;
|
|
314
314
|
color: var(--_bk-button-fg); background: var(--_bk-button-bg); border: var(--bk-button-border-width, var(--bk-border-width)) solid var(--_bk-button-bd);
|
|
315
|
-
border-radius: var(--_bk-button-group-radius, var(--bk-button-radius, var(--bk-radius-control, var(--bk-radius-md)))); box-shadow: var(--_bk-button-shadow);
|
|
315
|
+
border-radius: var(--_bk-button-group-radius, var(--bk-button-radius, var(--bk-radius-control, var(--bk-radius-md)))); box-shadow: var(--bk-button-shadow, var(--_bk-button-shadow));
|
|
316
316
|
text-decoration: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
|
|
317
|
-
transition: background-color var(--bk-duration-fast), border-color var(--bk-duration-fast), color var(--bk-duration-fast);
|
|
317
|
+
transition: background-color var(--bk-duration-fast), border-color var(--bk-duration-fast), color var(--bk-duration-fast), box-shadow var(--bk-duration-fast), translate var(--bk-duration-fast);
|
|
318
318
|
}
|
|
319
|
+
@media (hover: hover) {
|
|
320
|
+
:host(:not(:is([disabled], :disabled:not([href]), [disabled-reason]:not([disabled-reason=""])))) .control:hover:not([aria-disabled="true"]) {
|
|
321
|
+
translate: 0 calc(-1 * var(--bk-button-lift-hover, 0px)); box-shadow: var(--bk-button-shadow-hover, var(--bk-button-shadow, var(--_bk-button-shadow)));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
@media (prefers-reduced-motion: reduce) { .control:hover { translate: none !important; } }
|
|
319
325
|
.control::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: background-color var(--bk-duration-fast); }
|
|
320
326
|
@media (hover: hover) { .control:hover::after { background: var(--_bk-button-hover); } }
|
|
321
327
|
.control:active::after { background: var(--bk-button-active, var(--bk-pressed)); }
|
|
@@ -448,6 +454,11 @@ class BkButton extends LitElement {
|
|
|
448
454
|
super.willUpdate(changed);
|
|
449
455
|
if (changed.has("loading"))
|
|
450
456
|
this.loader.set(this.loading);
|
|
457
|
+
const f = this.forwarded;
|
|
458
|
+
const open = f.expanded === null ? this.hostExpanded === "true" : f.expanded;
|
|
459
|
+
const states = this.internals.states;
|
|
460
|
+
if (states)
|
|
461
|
+
open ? states.add("expanded") : states.delete("expanded");
|
|
451
462
|
}
|
|
452
463
|
updated(changed) {
|
|
453
464
|
super.updated(changed);
|
|
@@ -456,9 +467,9 @@ class BkButton extends LitElement {
|
|
|
456
467
|
}
|
|
457
468
|
renderContent() {
|
|
458
469
|
return html`
|
|
459
|
-
<slot name="start">${this.icon ? html`<bk-icon name=${this.icon}></bk-icon>` : nothing}</slot>
|
|
470
|
+
<slot name="start">${this.icon ? html`<bk-icon part="icon-start" name=${this.icon}></bk-icon>` : nothing}</slot>
|
|
460
471
|
<span class="label"><slot @slotchange=${this.onDefaultSlot}></slot></span>
|
|
461
|
-
<slot name="end">${this.iconEnd ? html`<bk-icon name=${this.iconEnd}></bk-icon>` : nothing}</slot>`;
|
|
472
|
+
<slot name="end">${this.iconEnd ? html`<bk-icon part="icon-end" name=${this.iconEnd}></bk-icon>` : nothing}</slot>`;
|
|
462
473
|
}
|
|
463
474
|
render() {
|
|
464
475
|
const inner = html`<span class="content">${this.renderContent()}</span>
|
|
@@ -89,9 +89,12 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
89
89
|
* @cssprop --bk-card-shadow - Shadow (default --bk-layer-raised-shadow; `elevated`: --bk-layer-overlay-shadow).
|
|
90
90
|
* @cssprop --bk-card-shadow-hover - Shadow of a card with `href` on hover (default --bk-layer-overlay-shadow).
|
|
91
91
|
* @cssprop --bk-card-border-hover - Border colour of a card with `href` on hover (default --bk-line-mid).
|
|
92
|
-
* @cssprop --bk-card-lift-hover - How far a card with `href` moves up on hover (default 0). Use whole pixels.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* @cssprop --bk-card-lift-hover - How far a card with `href` moves up on hover (default --bk-space-0, 2px, in whole pixels). Use whole pixels. `0`
|
|
93
|
+
* switches it off. With reduced motion the card stays in place.
|
|
94
|
+
* @cssprop --bk-card-ring - An image (for example a gradient) that the card shows as its ring at rest, over the border, in its radius
|
|
95
|
+
* (default none). A `selected` card shows its own ring.
|
|
96
|
+
* @cssprop --bk-card-ring-hover - An image that a card with `href` shows as its ring on hover, over the border, in its radius (default a
|
|
97
|
+
* gradient from --bk-accent-solid to --bk-info-solid). `none` switches it off. A `selected` card shows its own ring.
|
|
95
98
|
* @cssprop --bk-card-padding - Inner padding of `padding="md"`, the default (default --bk-space-5).
|
|
96
99
|
* @cssprop --bk-card-padding-sm - Inner padding of `padding="sm"` (default --bk-space-3).
|
|
97
100
|
* @cssprop --bk-card-media-ratio - Aspect ratio of the media region (default auto; `media-ratio` sets it per card).
|
|
@@ -83,15 +83,18 @@ class BkCard extends LitElement {
|
|
|
83
83
|
border-radius: var(--bk-card-radius, var(--bk-radius-container, var(--bk-radius-lg))); box-shadow: var(--bk-card-shadow, var(--bk-layer-raised-shadow));
|
|
84
84
|
text-decoration: none; transition: box-shadow var(--bk-duration), border-color var(--bk-duration), translate var(--bk-duration) var(--bk-ease);
|
|
85
85
|
}
|
|
86
|
-
/* The
|
|
87
|
-
clips its content, so the
|
|
88
|
-
:host
|
|
89
|
-
:host([href])::after {
|
|
86
|
+
/* The rings: an image over the border, cut to a ring in the radius of the card. ::before is the ring at rest,
|
|
87
|
+
::after the ring of a card with href on hover. The card clips its content, so the rings are on the host. */
|
|
88
|
+
:host { position: relative; }
|
|
89
|
+
:host::before, :host([href])::after {
|
|
90
90
|
content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
|
|
91
|
-
padding: var(--bk-card-border-width, var(--bk-border-width));
|
|
91
|
+
padding: var(--bk-card-border-width, var(--bk-border-width));
|
|
92
92
|
mask: linear-gradient(currentColor 0 0) content-box exclude, linear-gradient(currentColor 0 0);
|
|
93
|
-
|
|
93
|
+
transition: opacity var(--bk-duration), translate var(--bk-duration) var(--bk-ease);
|
|
94
94
|
}
|
|
95
|
+
:host::before { background: var(--bk-card-ring, none); }
|
|
96
|
+
:host([selected])::before { display: none; }
|
|
97
|
+
:host([href])::after { background: var(--bk-card-ring-hover, linear-gradient(135deg, var(--bk-accent-solid), var(--bk-info-solid))); opacity: 0; }
|
|
95
98
|
:host([variant="elevated"]) .card { border-color: transparent; box-shadow: var(--bk-card-shadow, var(--bk-layer-overlay-shadow)); }
|
|
96
99
|
:host([variant="flat"]) .card { border-color: transparent; box-shadow: none; background: var(--bk-card-bg, var(--bk-layer-sunken-bg)); --bk-ground: var(--bk-card-bg, var(--bk-layer-sunken-bg)); }
|
|
97
100
|
/* Tone: the tint lies over the layer background, so --bk-card-bg stays the base. */
|
|
@@ -110,10 +113,13 @@ class BkCard extends LitElement {
|
|
|
110
113
|
:host([href]) .overlay { z-index: 2; }
|
|
111
114
|
@media (hover: hover) {
|
|
112
115
|
:host([href]) .card:hover { box-shadow: var(--bk-card-shadow-hover, var(--bk-layer-overlay-shadow)); border-color: var(--bk-card-border-hover, var(--bk-line-mid)); }
|
|
113
|
-
:host([href]:hover)::after { opacity: 1; }
|
|
114
|
-
:host([href]:hover) .card, :host([href]:hover)::
|
|
116
|
+
:host([href]:not([selected]):hover)::after { opacity: 1; }
|
|
117
|
+
:host([href]:not([selected]):hover) .card, :host([href]:not([selected]):hover)::before, :host([href]:not([selected]):hover)::after {
|
|
118
|
+
translate: 0 calc(-1 * var(--bk-card-lift-hover, round(var(--bk-space-0), 1px)));
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
|
-
@media (prefers-reduced-motion: reduce) { :host([href]:hover) .card, :host([href]:hover)::after { translate: none; } }
|
|
121
|
+
@media (prefers-reduced-motion: reduce) { :host([href]:hover) .card, :host([href]:hover)::before, :host([href]:hover)::after { translate: none; } }
|
|
122
|
+
@media (forced-colors: active) { :host::before, :host([href])::after { display: none; } }
|
|
117
123
|
.card:has(> .cover:active) { box-shadow: var(--bk-card-shadow, var(--bk-layer-raised-shadow)); background-image: linear-gradient(var(--bk-pressed), var(--bk-pressed)); }
|
|
118
124
|
:host([tone]) .card:has(> .cover:active) { background-image: linear-gradient(var(--bk-pressed), var(--bk-pressed)), linear-gradient(var(--_bk-card-tint), var(--_bk-card-tint)); }
|
|
119
125
|
/* Selected after hover: the choice stays visible under the pointer. */
|
|
@@ -61,6 +61,12 @@ export interface ChartMarkDetail {
|
|
|
61
61
|
* Whole numbers get whole ticks, and the axis starts at the best value (or at `min`, for example `min="1"`).
|
|
62
62
|
* The summary and the tooltip show a smaller value as better ("2 better").
|
|
63
63
|
*
|
|
64
|
+
* A missing value (null, or no field in the row) breaks the line. `gaps="connect"` bridges the gap: a straight
|
|
65
|
+
* segment goes from the last real point to the next real point of the series. `--bk-chart-line-gap-dash` gives the segment
|
|
66
|
+
* a dash pattern that shows where the data has no value. The chart adds no values: the tooltip says "no value", and the table and the summary list only real values.
|
|
67
|
+
* The chart does not bridge before the first or after the last real point. `gaps` in a series sets the mode of that series.
|
|
68
|
+
* Use it for series that the app measures at different times (one row per time, each series with a value in some rows).
|
|
69
|
+
*
|
|
64
70
|
* With `toggleable`, the legend entries are toggle buttons. The user shows and hides the series, and the
|
|
65
71
|
* value axis fits the visible series. A series with `hidden: true` starts hidden. At least one series stays
|
|
66
72
|
* visible. The chart fires `change` with the visible keys and stores them with `persist-key`. The data table
|
|
@@ -92,6 +98,7 @@ export interface ChartMarkDetail {
|
|
|
92
98
|
* @cssprop --bk-chart-marker-size - Hover marker diameter (default 8px).
|
|
93
99
|
* @cssprop --bk-chart-ring - Surface ring around markers (default 2px).
|
|
94
100
|
* @cssprop --bk-chart-surface - Colour of the marker ring: the surface that the chart is on (default --bk-ground, the background of its card or panel).
|
|
101
|
+
* @cssprop --bk-chart-line-gap-dash - Dash pattern of a bridged gap (`gaps="connect"`). The default is none: the bridge is solid. Set a pattern to show where no value was measured, for example `var(--bk-chart-line-width) calc(var(--bk-chart-line-width) * 3)` (with the round caps, a dotted line).
|
|
95
102
|
* @cssprop --bk-chart-area-opacity - Area wash opacity (default 0.1).
|
|
96
103
|
* @cssprop --bk-chart-band-opacity - Opacity of a shaded `bk-chart-mark` band and of the selection (default 0.12).
|
|
97
104
|
* @cssprop --bk-chart-compare-opacity - Opacity of the dashed comparison line (default 0.6).
|
|
@@ -219,6 +226,10 @@ export declare class BkChartLine extends LitElement {
|
|
|
219
226
|
persistKey: {
|
|
220
227
|
attribute: string;
|
|
221
228
|
};
|
|
229
|
+
gaps: {
|
|
230
|
+
reflect: boolean;
|
|
231
|
+
useDefault: boolean;
|
|
232
|
+
};
|
|
222
233
|
};
|
|
223
234
|
/** Rows, one per x position. */
|
|
224
235
|
data: ChartRow[];
|
|
@@ -278,6 +289,8 @@ export declare class BkChartLine extends LitElement {
|
|
|
278
289
|
toggleable: boolean;
|
|
279
290
|
/** With `toggleable`: stores the visible series in the app state (entry `chart-series:<persist-key>`, see `<bk-app-state>`). */
|
|
280
291
|
persistKey: string | undefined;
|
|
292
|
+
/** `break` (default): a missing value breaks the line. `connect`: a straight segment bridges the gap between two real points. `gaps` in a series overrides it. Lines only: a stacked layer counts a missing value as 0. */
|
|
293
|
+
gaps: "break" | "connect";
|
|
281
294
|
private i18n;
|
|
282
295
|
private chart;
|
|
283
296
|
private hot;
|
|
@@ -326,6 +339,8 @@ export declare class BkChartLine extends LitElement {
|
|
|
326
339
|
private computeSubDay;
|
|
327
340
|
private xText;
|
|
328
341
|
private fmt;
|
|
342
|
+
/** A value for the tooltip and the name of a point: a missing value is "no value", not a dash. */
|
|
343
|
+
private valueText;
|
|
329
344
|
protected willUpdate(changed: PropertyValues): void;
|
|
330
345
|
/** The compared value of series `j` at point `p` of the view. */
|
|
331
346
|
private compareAt;
|
|
@@ -55,7 +55,8 @@ class BkChartLine extends LitElement {
|
|
|
55
55
|
yDirection: { attribute: "y-direction", reflect: true, useDefault: true },
|
|
56
56
|
min: { type: Number },
|
|
57
57
|
toggleable: { type: Boolean, reflect: true },
|
|
58
|
-
persistKey: { attribute: "persist-key" }
|
|
58
|
+
persistKey: { attribute: "persist-key" },
|
|
59
|
+
gaps: { reflect: true, useDefault: true }
|
|
59
60
|
};
|
|
60
61
|
i18n = new LocalizeController(this);
|
|
61
62
|
chart = new ChartController(this);
|
|
@@ -97,6 +98,7 @@ class BkChartLine extends LitElement {
|
|
|
97
98
|
this.range = null;
|
|
98
99
|
this.yDirection = "up";
|
|
99
100
|
this.toggleable = false;
|
|
101
|
+
this.gaps = "break";
|
|
100
102
|
}
|
|
101
103
|
/** The keys that the user chooses to show. Null: the series without `hidden`. */
|
|
102
104
|
shown = null;
|
|
@@ -171,6 +173,7 @@ class BkChartLine extends LitElement {
|
|
|
171
173
|
.area { fill: var(--_bk-chart-c); opacity: var(--bk-chart-area-opacity); stroke: none; }
|
|
172
174
|
.dot { fill: var(--_bk-chart-c); stroke: var(--bk-chart-surface, var(--bk-ground, var(--bk-layer-raised-bg))); stroke-width: var(--bk-chart-ring); }
|
|
173
175
|
.crosshair { stroke: var(--bk-chart-axis); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
|
|
176
|
+
.gap { stroke-dasharray: var(--bk-chart-line-gap-dash, none); }
|
|
174
177
|
.compare { stroke-dasharray: 6 4; opacity: var(--bk-chart-compare-opacity); }
|
|
175
178
|
.layer { fill: var(--_bk-chart-c); stroke: var(--bk-chart-surface, var(--bk-ground, var(--bk-layer-raised-bg))); stroke-width: var(--bk-chart-surface-gap); stroke-linejoin: round; }
|
|
176
179
|
.selection { fill: var(--bk-accent-solid); fill-opacity: var(--bk-chart-band-opacity); stroke: var(--bk-accent-solid); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
|
|
@@ -242,6 +245,10 @@ class BkChartLine extends LitElement {
|
|
|
242
245
|
fmt(v) {
|
|
243
246
|
return formatValue(this.i18n.locale, v, this.valueFormat);
|
|
244
247
|
}
|
|
248
|
+
/** A value for the tooltip and the name of a point: a missing value is "no value", not a dash. */
|
|
249
|
+
valueText(v) {
|
|
250
|
+
return v === null ? chartT(this.i18n.locale, "chartNoValue") : this.fmt(v);
|
|
251
|
+
}
|
|
245
252
|
willUpdate(changed) {
|
|
246
253
|
const dataChanged = changed.has("data") || changed.has("x") || changed.has("xType");
|
|
247
254
|
if (dataChanged) {
|
|
@@ -436,7 +443,7 @@ class BkChartLine extends LitElement {
|
|
|
436
443
|
pointLabel(idx) {
|
|
437
444
|
const row = this.data[this.view[idx]];
|
|
438
445
|
const shown = new Set(this.visibleKeys);
|
|
439
|
-
const parts = this.effectiveSeries.filter((se) => shown.has(se.key)).map((se) => `${se.label} ${this.
|
|
446
|
+
const parts = this.effectiveSeries.filter((se) => shown.has(se.key)).map((se) => `${se.label} ${this.valueText(num(row[se.key]))}`);
|
|
440
447
|
const extra = resolveFields(this.tooltipFields).map((f) => `${fieldLabel(f)} ${fieldValue(this.i18n.locale, row, f)}`);
|
|
441
448
|
return `${this.xText(row)}: ${parts.concat(extra).join(", ")}`;
|
|
442
449
|
}
|
|
@@ -454,11 +461,11 @@ class BkChartLine extends LitElement {
|
|
|
454
461
|
const share = L.stack === "percent" && v !== null && L.totals[idx] ? ` \xB7 ${formatPercent(locale, Math.max(0, v) / L.totals[idx], 1)}` : "";
|
|
455
462
|
const prev = L.down && !L.cmp && idx > 0 ? L.raw[j][idx - 1] : null;
|
|
456
463
|
const step = v !== null && prev !== null ? ` (${delta(v, prev)})` : "";
|
|
457
|
-
rows.push({ label: se.label, value: this.
|
|
464
|
+
rows.push({ label: se.label, value: this.valueText(v) + share + step, color, marker: L.stack === "none" ? "line" : "rect" });
|
|
458
465
|
const before = L.cmp?.[j][idx];
|
|
459
466
|
if (L.cmp && before !== void 0) {
|
|
460
467
|
const change = v !== null && before !== null ? ` (${delta(v, before)})` : "";
|
|
461
|
-
rows.push({ label: `${series.length > 1 ? `${se.label} \xB7 ` : ""}${this.compareLabel || chartT(locale, "chartPrevious")}`, value: this.
|
|
468
|
+
rows.push({ label: `${series.length > 1 ? `${se.label} \xB7 ` : ""}${this.compareLabel || chartT(locale, "chartPrevious")}`, value: this.valueText(before) + change, color, marker: "line" });
|
|
462
469
|
}
|
|
463
470
|
});
|
|
464
471
|
if (L.stack !== "none" && series.length > 1)
|
|
@@ -760,10 +767,13 @@ class BkChartLine extends LitElement {
|
|
|
760
767
|
}
|
|
761
768
|
const segs = segments(L.vals[j]);
|
|
762
769
|
const d = segs.filter((p) => p.length > 1).map((p) => `M${pathD(p)}`).join("");
|
|
763
|
-
const
|
|
770
|
+
const connect = (se.gaps ?? this.gaps) === "connect";
|
|
771
|
+
const gaps = connect ? segs.slice(1).map((p, k) => `M${pathD([segs[k][segs[k].length - 1], p[0]])}`).join("") : "";
|
|
772
|
+
const runs = connect && segs.length > 1 ? [segs.flat()] : segs.filter((p) => p.length > 1);
|
|
773
|
+
const area = this.filled ? runs.map((p) => `M${p[0][0].toFixed(1)},${base0}L${pathD(p)}L${p[p.length - 1][0].toFixed(1)},${base0}Z`).join("") : "";
|
|
764
774
|
const singles = segs.filter((p) => p.length === 1).map(([[x, y]]) => svg`<circle class="dot" cx=${x} cy=${y} r=${s.marker / 2}></circle>`);
|
|
765
775
|
const before = L.cmp ? segments(L.cmp[j]).filter((p) => p.length > 1).map((p) => `M${pathD(p)}`).join("") : "";
|
|
766
|
-
return svg`<g style=${styleMap(style)}>${area ? svg`<path class="area" d=${area}></path>` : nothing}${before ? svg`<path class="line compare" d=${before}></path>` : nothing}<path class="line" data-slot=${slot} d=${d}></path>${singles}</g>`;
|
|
776
|
+
return svg`<g style=${styleMap(style)}>${area ? svg`<path class="area" d=${area}></path>` : nothing}${before ? svg`<path class="line compare" d=${before}></path>` : nothing}<path class="line" data-slot=${slot} d=${d}></path>${gaps ? svg`<path class="line gap" d=${gaps}></path>` : nothing}${singles}</g>`;
|
|
767
777
|
});
|
|
768
778
|
const type = L.type;
|
|
769
779
|
const labels = type === "category" ? this.view.map((i) => this.xText(this.data[i])) : [];
|
|
@@ -75,6 +75,8 @@ export type ChipTone = "neutral" | "accent" | "success" | "warning" | "danger" |
|
|
|
75
75
|
* @cssprop --bk-chip-border - Border colour (default transparent; `outline`: the text colour at 40%).
|
|
76
76
|
* @cssprop --bk-chip-gap - Space between dot, icon, text and remove button (default --bk-space-1).
|
|
77
77
|
* @cssprop --bk-chip-font-size - Text size at every size (default --bk-text-2xs / --bk-text-xs / --bk-text-sm by size).
|
|
78
|
+
* @cssprop --bk-chip-transform - Text transform (default none).
|
|
79
|
+
* @cssprop --bk-chip-tracking - Letter spacing, a length (default 0em; for uppercase use --bk-tracking-label). The chip takes the space after the last letter back, so the text stays centred.
|
|
78
80
|
* @cssprop --bk-chip-font-weight - Text weight (default --bk-weight-medium).
|
|
79
81
|
* @cssprop --bk-chip-dot-size - Diameter of the `dot` (default --bk-space-1-5).
|
|
80
82
|
* @cssprop --bk-chip-remove-size - Visible size of the remove button; its target is at least --bk-target-min (default --bk-icon-sm).
|
|
@@ -99,6 +99,7 @@ class BkChip extends LitElement {
|
|
|
99
99
|
border-radius: var(--bk-chip-radius, var(--bk-radius-chip, var(--bk-radius-sm))); border: var(--bk-border-width) solid var(--bk-chip-border, transparent);
|
|
100
100
|
background: var(--_bk-chip-bg); color: var(--_bk-chip-fg);
|
|
101
101
|
font-size: var(--bk-chip-font-size, var(--_bk-chip-fs)); font-weight: var(--bk-chip-font-weight, var(--bk-control-weight, var(--bk-weight-medium)));
|
|
102
|
+
text-transform: var(--bk-chip-transform, none); letter-spacing: var(--bk-chip-tracking, 0em);
|
|
102
103
|
line-height: 1; white-space: nowrap;
|
|
103
104
|
}
|
|
104
105
|
:host([variant="solid"]) .chip { background: var(--_bk-chip-fill, var(--_bk-chip-solid)); color: var(--_bk-chip-on); }
|
|
@@ -136,7 +137,8 @@ class BkChip extends LitElement {
|
|
|
136
137
|
.remove { z-index: 1; }
|
|
137
138
|
@media (forced-colors: active) { .chip:has(.link:focus-visible) { outline-color: Highlight; } }
|
|
138
139
|
/* The clip of the ellipsis reaches past the line box (line-height 1), so ascenders and descenders (g, y, É) stay whole. */
|
|
139
|
-
|
|
140
|
+
/* Letter spacing also follows the last letter: the label gives it back, so the text stays centred. */
|
|
141
|
+
.label { overflow: hidden; text-overflow: ellipsis; padding-block: 0.25em; margin-block: -0.25em; margin-inline-end: calc(-1 * var(--bk-chip-tracking, 0em)); }
|
|
140
142
|
.dot { width: var(--bk-chip-dot-size, var(--bk-space-1-5)); height: var(--bk-chip-dot-size, var(--bk-space-1-5)); border-radius: 50%; background: currentColor; flex: none; }
|
|
141
143
|
bk-icon, ::slotted(bk-icon) { --bk-icon-size: 1.15em; }
|
|
142
144
|
.remove {
|
|
@@ -115,8 +115,8 @@ type Row = ComboboxOption & {
|
|
|
115
115
|
* @csspart error - Error text.
|
|
116
116
|
* @cssprop --bk-combobox-font-size - Text size in the box (default from `size`: --bk-type-small, --bk-type-body, --bk-type-lead).
|
|
117
117
|
* @cssprop --bk-combobox-tag-gap - Space between the tags and the text (default --bk-space-1).
|
|
118
|
-
* @cssprop --bk-combobox-tags-padding -
|
|
119
|
-
* @cssprop --bk-combobox-input-min-width - Narrowest text field next to the tags before it wraps (default
|
|
118
|
+
* @cssprop --bk-combobox-tags-padding - Padding of the box with tags above, below and before the first chip (default the inset of a button in a field: --bk-field-button-inset, else --bk-space-0 / --bk-space-1 / --bk-space-1-5 by size).
|
|
119
|
+
* @cssprop --bk-combobox-input-min-width - Narrowest text field next to the tags before it wraps (default --bk-target-min).
|
|
120
120
|
* @cssprop --bk-combobox-chevron-color - Chevron colour (default --bk-text-muted).
|
|
121
121
|
* @cssprop --bk-combobox-match-color - Colour of the matched text in the options (default --bk-accent-text).
|
|
122
122
|
* @cssprop --bk-combobox-match-weight - Weight of the matched text (default --bk-weight-semibold).
|
|
@@ -10,6 +10,7 @@ import "./bk-chip.js";
|
|
|
10
10
|
import "./bk-icon.js";
|
|
11
11
|
import "./bk-spinner.js";
|
|
12
12
|
import { submitImplicitly } from "../internal/submit.js";
|
|
13
|
+
import { pastedTags, tagFieldStyles } from "../internal/tags.js";
|
|
13
14
|
import "../icons/set/add.js";
|
|
14
15
|
import "../icons/set/chevron-down.js";
|
|
15
16
|
import "../icons/set/search.js";
|
|
@@ -92,20 +93,8 @@ class BkCombobox extends ChoiceField {
|
|
|
92
93
|
get busy() {
|
|
93
94
|
return this.loading || this.searching;
|
|
94
95
|
}
|
|
95
|
-
static styles = [...choiceFieldStyles("combobox"), css`
|
|
96
|
+
static styles = [...choiceFieldStyles("combobox"), tagFieldStyles("combobox"), css`
|
|
96
97
|
:host { --_bk-text-field-font-size: var(--bk-combobox-font-size); }
|
|
97
|
-
.box { cursor: text; }
|
|
98
|
-
.values { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--bk-combobox-tag-gap, var(--bk-space-1)); }
|
|
99
|
-
.box.has-tags { padding-block: var(--bk-combobox-tags-padding, var(--bk-space-1)); }
|
|
100
|
-
:host([size="sm"]) .box.has-tags { padding-block: var(--bk-combobox-tags-padding, var(--bk-space-0)); }
|
|
101
|
-
.tags { display: contents; }
|
|
102
|
-
bk-chip { max-width: 100%; }
|
|
103
|
-
input { text-overflow: ellipsis; }
|
|
104
|
-
.has-tags input { min-width: var(--bk-combobox-input-min-width, 6ch); width: auto; }
|
|
105
|
-
input:disabled { cursor: not-allowed; }
|
|
106
|
-
/* Disabled with chips: the chips keep their text contrast (a dimmed box fails 4.5:1); the sunken fill and the cursor show the state. */
|
|
107
|
-
:host([disabled]) .box.has-tags { opacity: 1; }
|
|
108
|
-
:host([disabled]) .box.has-tags input { opacity: var(--bk-disabled-opacity); }
|
|
109
98
|
mark {
|
|
110
99
|
background: none; color: var(--bk-combobox-match-color, var(--bk-accent-text));
|
|
111
100
|
font-weight: var(--bk-combobox-match-weight, var(--bk-weight-semibold));
|
|
@@ -329,14 +318,12 @@ class BkCombobox extends ChoiceField {
|
|
|
329
318
|
onPaste(e) {
|
|
330
319
|
if (!this.multiple || this.isDisabled || this.readonly)
|
|
331
320
|
return;
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
321
|
+
const parts = pastedTags(e, this.text);
|
|
322
|
+
if (!parts)
|
|
334
323
|
return;
|
|
335
|
-
e.preventDefault();
|
|
336
324
|
const next = [...this.selection];
|
|
337
|
-
for (const
|
|
338
|
-
|
|
339
|
-
if (!t || this.max !== void 0 && this.max > 0 && next.length >= this.max)
|
|
325
|
+
for (const t of parts) {
|
|
326
|
+
if (this.max !== void 0 && this.max > 0 && next.length >= this.max)
|
|
340
327
|
continue;
|
|
341
328
|
const v = this.tagFor(t);
|
|
342
329
|
if (v !== void 0 && !next.includes(v))
|
|
@@ -561,7 +548,7 @@ class BkCombobox extends ChoiceField {
|
|
|
561
548
|
const empty = this.noResults;
|
|
562
549
|
const more = busy && opts.length > 0;
|
|
563
550
|
return html`<div @focusout=${this.onFocusOut}>
|
|
564
|
-
${this.renderField(html`<div class="${this.boxClass}${tags ? " has-tags" : ""}${expanded ? " open" : ""}" part="box" @click=${this.onBoxClick}>
|
|
551
|
+
${this.renderField(html`<div class="${this.boxClass}${tags ? " has-tags" : ""}${tags && !this.hasLead ? " tags-first" : ""}${expanded ? " open" : ""}" part="box" @click=${this.onBoxClick}>
|
|
565
552
|
${this.renderStart()}
|
|
566
553
|
${this.renderPrefix()}
|
|
567
554
|
<div class="values">
|
|
@@ -13,8 +13,8 @@ export type { NavigateDetail } from "../internal/link.js";
|
|
|
13
13
|
*
|
|
14
14
|
* - The number comes from the first marker of the note on the page. The list shows the notes in the order of their
|
|
15
15
|
* numbers.
|
|
16
|
-
* - After the text, the note shows a back link to each marker:
|
|
17
|
-
*
|
|
16
|
+
* - After the text, the note shows a back link to each marker. One marker: the arrow is the back link. Several
|
|
17
|
+
* markers: an arrow and then the letters a, b, …, and each letter is a back link. A back link moves the focus to its marker.
|
|
18
18
|
* - `href` adds a link to the source. Its text is the host of the address ("example.com"). Write a link with
|
|
19
19
|
* another text in the content.
|
|
20
20
|
* - `date` is the date of the data, as `YYYY`, `YYYY-MM` or `YYYY-MM-DD`. The note shows "As of {date}" (i18n
|
|
@@ -2,6 +2,7 @@ import { LitElement, type PropertyValues } from "lit";
|
|
|
2
2
|
import { type PanZoomView } from "../internal/pan-zoom.js";
|
|
3
3
|
import "./bk-icon.js";
|
|
4
4
|
import "./bk-segmented.js";
|
|
5
|
+
import "./bk-segmented-item.js";
|
|
5
6
|
import "./bk-button.js";
|
|
6
7
|
import "./bk-zoom.js";
|
|
7
8
|
import "../icons/set/chevron-left.js";
|
|
@@ -15,6 +16,12 @@ export type ImageCompareVariant = "slider" | "side" | "toggle";
|
|
|
15
16
|
export type ImageCompareSide = "before" | "after";
|
|
16
17
|
/** The zoom (1 to 8) and the point of the pictures in the centre, as fractions of their width and height. */
|
|
17
18
|
export type ImageCompareView = PanZoomView;
|
|
19
|
+
/** Detail of the `load` event: the side of the picture and its natural size in image pixels. */
|
|
20
|
+
export interface ImageCompareLoadDetail {
|
|
21
|
+
side: ImageCompareSide;
|
|
22
|
+
naturalWidth: number;
|
|
23
|
+
naturalHeight: number;
|
|
24
|
+
}
|
|
18
25
|
/**
|
|
19
26
|
* Two pictures of the same subject, for example a photo and its edit, or an image and
|
|
20
27
|
* its upscale. The pictures must have the same shape.
|
|
@@ -36,7 +43,16 @@ export type ImageCompareView = PanZoomView;
|
|
|
36
43
|
* sets the zoom and the visible part. `resetZoom()` shows the whole picture again.
|
|
37
44
|
*
|
|
38
45
|
* The box uses the shape of the after picture when it loads (4 / 3 before). The pictures are on the
|
|
39
|
-
* dark media backdrop in both themes, as in `<bk-image-viewer>`.
|
|
46
|
+
* dark media backdrop in both themes, as in `<bk-image-viewer>`. `--bk-image-compare-max-height` caps the height
|
|
47
|
+
* of the box. The box then keeps the full width, and the backdrop shows at the sides of the pictures.
|
|
48
|
+
*
|
|
49
|
+
* With `shaped` the box takes the shape of the pictures also under the cap: the width follows the ratio. The box is never
|
|
50
|
+
* wider than its container and a picture never shows larger than its natural size (the after picture gives it). With
|
|
51
|
+
* `side` the two boxes and the gap between them follow the same rules. A 400 × 1200 picture in a 1200 px container
|
|
52
|
+
* with a cap of 600 px gives a box of 200 × 600 px. `shaped` has no effect with content in the slots.
|
|
53
|
+
*
|
|
54
|
+
* The element fires `load` for each picture that loads, with its side and its natural size. Each element that shows the
|
|
55
|
+
* name of a side has the part `label`, in every variant: style the names with `::part(label)`.
|
|
40
56
|
*
|
|
41
57
|
* Content instead of pictures: fill the slot `before` or `after` with any content, for example two cards
|
|
42
58
|
* with the same layout. The slot replaces the picture of its side, and the `*-src` attributes still work
|
|
@@ -59,6 +75,7 @@ export type ImageCompareView = PanZoomView;
|
|
|
59
75
|
* @csspart before - The box of the before side (a picture or the slot), with the corners of the pictures. Style a ring with `outline` and a negative `outline-offset`, or an inset `box-shadow`. With `slider` the divider cuts it.
|
|
60
76
|
* @csspart after - The box of the after side, as `before`.
|
|
61
77
|
* @csspart image - One `<img>`.
|
|
78
|
+
* @csspart label - Each element that shows the name of a side, in every variant: the tags (`slider`), the captions (`side`) and the items of the segmented control (`toggle`).
|
|
62
79
|
* @csspart tag - The label of a picture in a top corner (`slider`).
|
|
63
80
|
* @csspart divider - The area around the line that the user drags (`slider`). It is a `slider` for assistive technology.
|
|
64
81
|
* @csspart line - The divider line. The corners of the pictures cut the line.
|
|
@@ -66,6 +83,7 @@ export type ImageCompareView = PanZoomView;
|
|
|
66
83
|
* @csspart caption - The caption under a picture (`side`).
|
|
67
84
|
* @csspart switch - The segmented control that chooses the picture (`toggle`).
|
|
68
85
|
* @csspart zoom - The zoom control (`zoomable`).
|
|
86
|
+
* @cssprop --bk-image-compare-max-height - Maximum height of the box of the pictures, a length (default none). With `shaped` the width follows the ratio under it.
|
|
69
87
|
* @cssprop --bk-image-compare-ratio - Shape of the pictures, for example `16 / 9` (default: the shape of the after picture, 4 / 3 before it loads).
|
|
70
88
|
* @cssprop --bk-image-compare-color-scheme - Colour scheme of the tags and the zoom control over the pictures (default dark).
|
|
71
89
|
* @cssprop --bk-image-compare-content-bg - Surface of a side with slotted content (default --bk-layer-base-bg).
|
|
@@ -88,8 +106,11 @@ export type ImageCompareView = PanZoomView;
|
|
|
88
106
|
* @cssprop --bk-image-compare-control-bg - Background of the tags and the zoom control (default --bk-media-control-bg).
|
|
89
107
|
* @cssprop --bk-image-compare-control-fg - Text and icon colour of the tags and the zoom control (default --bk-on-media).
|
|
90
108
|
* @cssprop --bk-image-compare-caption-color - Colour of the captions (default --bk-text-muted).
|
|
109
|
+
* @cssprop --bk-image-compare-label-transform - Text transform of the names of the sides (default none).
|
|
110
|
+
* @cssprop --bk-image-compare-label-tracking - Letter spacing of the names of the sides, a length (default 0em; for uppercase use --bk-tracking-label). The element takes the space after the last letter back, so the name stays centred.
|
|
91
111
|
* @fires {Event} input - The element fires this event while the user moves the divider.
|
|
92
112
|
* @fires {Event} change - The element fires this event when the user moves the divider (on release, on a key) or chooses the other picture (`toggle`).
|
|
113
|
+
* @fires {CustomEvent<ImageCompareLoadDetail>} load - A picture has loaded, also from the cache of the browser. `event.detail` is `{ side, naturalWidth, naturalHeight }` with `side` `before` or `after`. The event bubbles and is composed: the native `load` of the inner `<img>` does not leave the shadow root.
|
|
93
114
|
* @fires {CustomEvent<ImageCompareView>} viewchange - The user zoomed or panned (`zoomable`). `event.detail` is the new `view`. Setting `view` and `resetZoom()` fire no event. Use it to show the same part in another `<bk-image-compare>` or `<bk-image-viewer>`. The event bubbles and is composed.
|
|
94
115
|
*
|
|
95
116
|
* @tag bk-image-compare
|
|
@@ -132,9 +153,16 @@ export declare class BkImageCompare extends LitElement {
|
|
|
132
153
|
type: BooleanConstructor;
|
|
133
154
|
reflect: boolean;
|
|
134
155
|
};
|
|
156
|
+
shaped: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
reflect: boolean;
|
|
159
|
+
};
|
|
135
160
|
ratio: {
|
|
136
161
|
state: boolean;
|
|
137
162
|
};
|
|
163
|
+
naturalSize: {
|
|
164
|
+
state: boolean;
|
|
165
|
+
};
|
|
138
166
|
sliding: {
|
|
139
167
|
state: boolean;
|
|
140
168
|
};
|
|
@@ -157,8 +185,15 @@ export declare class BkImageCompare extends LitElement {
|
|
|
157
185
|
show: ImageCompareSide;
|
|
158
186
|
/** The user can zoom and pan. Both pictures show the same part. */
|
|
159
187
|
zoomable: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* The box takes the shape of the pictures: under `--bk-image-compare-max-height` the width follows the ratio. The box
|
|
190
|
+
* is never wider than its container and never larger than the natural size of the pictures.
|
|
191
|
+
*/
|
|
192
|
+
shaped: boolean;
|
|
160
193
|
/** Width / height of the after picture. It is 0 while the size is unknown. */
|
|
161
194
|
private ratio;
|
|
195
|
+
/** Width of the after picture in image pixels. It is 0 while the size is unknown. */
|
|
196
|
+
private naturalSize;
|
|
162
197
|
private sliding;
|
|
163
198
|
private i18n;
|
|
164
199
|
private pz;
|