@boostdev/design-system-components 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +50 -50
- package/dist/client.css +456 -456
- package/dist/client.js +50 -50
- package/dist/index.cjs +50 -50
- package/dist/index.css +456 -456
- package/dist/index.js +50 -50
- package/dist/web-components/chunk-2QA62WCQ.js +48 -0
- package/dist/web-components/chunk-4BX6AWXX.js +146 -0
- package/dist/web-components/chunk-57TRNCWQ.js +93 -0
- package/dist/web-components/chunk-5IPHEONG.js +139 -0
- package/dist/web-components/chunk-5R6IFELV.js +63 -0
- package/dist/web-components/chunk-5TFWOPLH.js +49 -0
- package/dist/web-components/chunk-6I3CFC26.js +89 -0
- package/dist/web-components/chunk-6T3RKUKG.js +65 -0
- package/dist/web-components/chunk-7FMR53BW.js +127 -0
- package/dist/web-components/chunk-A67LCT7C.js +134 -0
- package/dist/web-components/chunk-AGKJTMJI.js +56 -0
- package/dist/web-components/chunk-BQLZ7I4G.js +56 -0
- package/dist/web-components/chunk-CAPI25CU.js +53 -0
- package/dist/web-components/chunk-CJ5ZOO42.js +229 -0
- package/dist/web-components/chunk-CR5PGUHV.js +109 -0
- package/dist/web-components/chunk-ECW3HHWA.js +185 -0
- package/dist/web-components/chunk-HGBNDR22.js +98 -0
- package/dist/web-components/chunk-IK3PTFZ4.js +133 -0
- package/dist/web-components/chunk-IQGLIQSO.js +188 -0
- package/dist/web-components/chunk-ITHLKR7Q.js +105 -0
- package/dist/web-components/chunk-K5CE6HSB.js +169 -0
- package/dist/web-components/chunk-L3XHOMN6.js +111 -0
- package/dist/{web-components.js → web-components/chunk-LGEZYFUU.js} +62 -844
- package/dist/web-components/chunk-LSC4N56Q.js +168 -0
- package/dist/web-components/chunk-LY62SAVN.js +64 -0
- package/dist/web-components/chunk-O4UFI2RX.js +244 -0
- package/dist/web-components/chunk-O7I63SQX.js +124 -0
- package/dist/web-components/chunk-OHUTLSIQ.js +69 -0
- package/dist/web-components/chunk-OQTRTMAB.js +27 -0
- package/dist/web-components/chunk-OTX4COSV.js +187 -0
- package/dist/web-components/chunk-PY62FTRW.js +179 -0
- package/dist/web-components/chunk-Q4T5BJT6.js +94 -0
- package/dist/web-components/chunk-QDRH46TF.js +281 -0
- package/dist/web-components/chunk-QDST57JC.js +119 -0
- package/dist/web-components/chunk-QPOKHLMQ.js +45 -0
- package/dist/web-components/chunk-SOQQ7RVJ.js +88 -0
- package/dist/web-components/chunk-UFFCKVZE.js +149 -0
- package/dist/web-components/chunk-VM3YHGQ2.js +152 -0
- package/dist/web-components/chunk-VMMVWLXL.js +53 -0
- package/dist/web-components/chunk-VSS5ITNE.js +109 -0
- package/dist/web-components/chunk-XIENXR7H.js +118 -0
- package/dist/web-components/chunk-Y4MAXTMA.js +80 -0
- package/dist/web-components/chunk-YLVTEY23.js +165 -0
- package/dist/web-components/globals.d.ts +2 -0
- package/dist/web-components/globals.js +1 -0
- package/dist/web-components/index.d.ts +41 -0
- package/dist/web-components/index.js +165 -0
- package/dist/web-components/interaction/bds-accordion-item.d.ts +54 -0
- package/dist/web-components/interaction/bds-accordion-item.js +7 -0
- package/dist/web-components/interaction/bds-accordion.d.ts +50 -0
- package/dist/web-components/interaction/bds-accordion.js +7 -0
- package/dist/web-components/interaction/bds-button.d.ts +100 -0
- package/dist/web-components/interaction/bds-button.js +7 -0
- package/dist/web-components/interaction/bds-collapsible.d.ts +52 -0
- package/dist/web-components/interaction/bds-collapsible.js +7 -0
- package/dist/web-components/interaction/bds-dialog.d.ts +56 -0
- package/dist/web-components/interaction/bds-dialog.js +7 -0
- package/dist/web-components/interaction/bds-drawer.d.ts +64 -0
- package/dist/web-components/interaction/bds-drawer.js +7 -0
- package/dist/web-components/interaction/bds-popover.d.ts +62 -0
- package/dist/web-components/interaction/bds-popover.js +7 -0
- package/dist/web-components/interaction/bds-skip-link.d.ts +36 -0
- package/dist/web-components/interaction/bds-skip-link.js +7 -0
- package/dist/web-components/interaction/bds-tab-panel.d.ts +26 -0
- package/dist/web-components/interaction/bds-tab-panel.js +7 -0
- package/dist/web-components/interaction/bds-tab.d.ts +45 -0
- package/dist/web-components/interaction/bds-tab.js +7 -0
- package/dist/web-components/interaction/bds-tabs.d.ts +46 -0
- package/dist/web-components/interaction/bds-tabs.js +7 -0
- package/dist/web-components/interaction/bds-toast-provider.d.ts +57 -0
- package/dist/web-components/interaction/bds-toast-provider.js +7 -0
- package/dist/web-components/interaction/bds-tooltip.d.ts +50 -0
- package/dist/web-components/interaction/bds-tooltip.js +7 -0
- package/dist/web-components/interaction/form/bds-checkbox.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-checkbox.js +7 -0
- package/dist/web-components/interaction/form/bds-combobox.d.ts +84 -0
- package/dist/web-components/interaction/form/bds-combobox.js +7 -0
- package/dist/web-components/interaction/form/bds-file-input.d.ts +62 -0
- package/dist/web-components/interaction/form/bds-file-input.js +7 -0
- package/dist/web-components/interaction/form/bds-number-input.d.ts +68 -0
- package/dist/web-components/interaction/form/bds-number-input.js +7 -0
- package/dist/web-components/interaction/form/bds-radio.d.ts +68 -0
- package/dist/web-components/interaction/form/bds-radio.js +7 -0
- package/dist/web-components/interaction/form/bds-segmented-control.d.ts +71 -0
- package/dist/web-components/interaction/form/bds-segmented-control.js +7 -0
- package/dist/web-components/interaction/form/bds-select.d.ts +79 -0
- package/dist/web-components/interaction/form/bds-select.js +7 -0
- package/dist/web-components/interaction/form/bds-slider.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-slider.js +7 -0
- package/dist/web-components/interaction/form/bds-switch.d.ts +67 -0
- package/dist/web-components/interaction/form/bds-switch.js +7 -0
- package/dist/web-components/interaction/form/bds-textarea.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-textarea.js +7 -0
- package/dist/web-components/ui/bds-alert.d.ts +66 -0
- package/dist/web-components/ui/bds-alert.js +7 -0
- package/dist/web-components/ui/bds-avatar.d.ts +50 -0
- package/dist/web-components/ui/bds-avatar.js +7 -0
- package/dist/web-components/ui/bds-badge.d.ts +35 -0
- package/dist/web-components/ui/bds-badge.js +7 -0
- package/dist/web-components/ui/bds-breadcrumb.d.ts +35 -0
- package/dist/web-components/ui/bds-breadcrumb.js +7 -0
- package/dist/web-components/ui/bds-card.d.ts +72 -0
- package/dist/web-components/ui/bds-card.js +7 -0
- package/dist/web-components/ui/bds-description-list.d.ts +42 -0
- package/dist/web-components/ui/bds-description-list.js +7 -0
- package/dist/web-components/ui/bds-icon-wrapper.d.ts +39 -0
- package/dist/web-components/ui/bds-icon-wrapper.js +7 -0
- package/dist/web-components/ui/bds-link.d.ts +59 -0
- package/dist/web-components/ui/bds-link.js +7 -0
- package/dist/web-components/ui/bds-loading.d.ts +32 -0
- package/dist/web-components/ui/bds-loading.js +7 -0
- package/dist/web-components/ui/bds-notification-banner.d.ts +61 -0
- package/dist/web-components/ui/bds-notification-banner.js +7 -0
- package/dist/web-components/ui/bds-progress-circle.d.ts +53 -0
- package/dist/web-components/ui/bds-progress-circle.js +7 -0
- package/dist/web-components/ui/bds-progress.d.ts +54 -0
- package/dist/web-components/ui/bds-progress.js +7 -0
- package/dist/web-components/ui/bds-rating.d.ts +36 -0
- package/dist/web-components/ui/bds-rating.js +7 -0
- package/dist/web-components/ui/bds-section-header.d.ts +53 -0
- package/dist/web-components/ui/bds-section-header.js +8 -0
- package/dist/web-components/ui/bds-separator.d.ts +32 -0
- package/dist/web-components/ui/bds-separator.js +7 -0
- package/dist/web-components/ui/bds-skeleton.d.ts +22 -0
- package/dist/web-components/ui/bds-skeleton.js +7 -0
- package/dist/web-components/ui/bds-typography.d.ts +44 -0
- package/dist/web-components/ui/bds-typography.js +8 -0
- package/package.json +169 -4
- package/src/web-components/index.ts +47 -0
- package/src/web-components/interaction/bds-accordion-item.spec.ts +75 -0
- package/src/web-components/interaction/bds-accordion-item.ts +181 -0
- package/src/web-components/interaction/bds-accordion.spec.ts +73 -0
- package/src/web-components/interaction/bds-accordion.ts +99 -0
- package/src/web-components/interaction/bds-collapsible.spec.ts +56 -0
- package/src/web-components/interaction/bds-collapsible.ts +170 -0
- package/src/web-components/interaction/bds-dialog.spec.ts +119 -0
- package/src/web-components/interaction/bds-dialog.ts +224 -0
- package/src/web-components/interaction/bds-drawer.spec.ts +113 -0
- package/src/web-components/interaction/bds-drawer.ts +266 -0
- package/src/web-components/interaction/bds-skip-link.spec.ts +42 -0
- package/src/web-components/interaction/bds-skip-link.ts +74 -0
- package/src/web-components/interaction/bds-tab-panel.spec.ts +32 -0
- package/src/web-components/interaction/bds-tab-panel.ts +38 -0
- package/src/web-components/interaction/bds-tab.spec.ts +71 -0
- package/src/web-components/interaction/bds-tab.ts +110 -0
- package/src/web-components/interaction/bds-tabs.spec.ts +120 -0
- package/src/web-components/interaction/bds-tabs.ts +152 -0
- package/src/web-components/interaction/bds-tooltip.spec.ts +49 -0
- package/src/web-components/interaction/bds-tooltip.ts +127 -0
- package/src/web-components/interaction/form/bds-checkbox.spec.ts +63 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +168 -0
- package/src/web-components/interaction/form/bds-combobox.spec.ts +117 -0
- package/src/web-components/interaction/form/bds-combobox.ts +336 -0
- package/src/web-components/interaction/form/bds-file-input.spec.ts +58 -0
- package/src/web-components/interaction/form/bds-file-input.ts +209 -0
- package/src/web-components/interaction/form/bds-number-input.spec.ts +87 -0
- package/src/web-components/interaction/form/bds-number-input.ts +221 -0
- package/src/web-components/interaction/form/bds-radio.spec.ts +70 -0
- package/src/web-components/interaction/form/bds-radio.ts +157 -0
- package/src/web-components/interaction/form/bds-segmented-control.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-segmented-control.ts +211 -0
- package/src/web-components/interaction/form/bds-select.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-select.ts +190 -0
- package/src/web-components/interaction/form/bds-slider.spec.ts +41 -0
- package/src/web-components/interaction/form/bds-slider.ts +162 -0
- package/src/web-components/interaction/form/bds-switch.spec.ts +62 -0
- package/src/web-components/interaction/form/bds-switch.ts +166 -0
- package/src/web-components/interaction/form/bds-textarea.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-textarea.ts +143 -0
- package/src/web-components/ui/bds-avatar.spec.ts +75 -0
- package/src/web-components/ui/bds-avatar.ts +122 -0
- package/src/web-components/ui/bds-breadcrumb.spec.ts +55 -0
- package/src/web-components/ui/bds-breadcrumb.ts +114 -0
- package/src/web-components/ui/bds-card.spec.ts +70 -0
- package/src/web-components/ui/bds-card.ts +156 -0
- package/src/web-components/ui/bds-description-list.spec.ts +36 -0
- package/src/web-components/ui/bds-description-list.ts +79 -0
- package/src/web-components/ui/bds-icon-wrapper.spec.ts +21 -0
- package/src/web-components/ui/bds-icon-wrapper.ts +68 -0
- package/src/web-components/ui/bds-link.spec.ts +72 -0
- package/src/web-components/ui/bds-link.ts +138 -0
- package/src/web-components/ui/bds-loading.spec.ts +38 -0
- package/src/web-components/ui/bds-loading.ts +76 -0
- package/src/web-components/ui/bds-notification-banner.spec.ts +82 -0
- package/src/web-components/ui/bds-notification-banner.ts +185 -0
- package/src/web-components/ui/bds-progress-circle.spec.ts +58 -0
- package/src/web-components/ui/bds-progress-circle.ts +142 -0
- package/src/web-components/ui/bds-progress.spec.ts +66 -0
- package/src/web-components/ui/bds-progress.ts +127 -0
- package/src/web-components/ui/bds-rating.spec.ts +70 -0
- package/src/web-components/ui/bds-rating.ts +80 -0
- package/src/web-components/ui/bds-section-header.spec.ts +57 -0
- package/src/web-components/ui/bds-section-header.ts +96 -0
- package/src/web-components/ui/bds-separator.spec.ts +50 -0
- package/src/web-components/ui/bds-separator.ts +66 -0
- package/src/web-components/ui/bds-skeleton.spec.ts +22 -0
- package/src/web-components/ui/bds-skeleton.ts +55 -0
- package/src/web-components/ui/bds-typography.spec.ts +76 -0
- package/src/web-components/ui/bds-typography.ts +112 -0
- package/dist/web-components.d.ts +0 -304
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<bds-separator>` — framework-agnostic Separator custom element.
|
|
5
|
+
*
|
|
6
|
+
* Attributes:
|
|
7
|
+
* orientation — "horizontal" (default) | "vertical"
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <bds-separator></bds-separator>
|
|
11
|
+
* <bds-separator orientation="vertical"></bds-separator>
|
|
12
|
+
*/
|
|
13
|
+
export class BdsSeparator extends LitElement {
|
|
14
|
+
static styles = css`
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([orientation='vertical']) {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
align-self: stretch;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.separator {
|
|
25
|
+
border: none;
|
|
26
|
+
background-color: var(--separator_color, var(--bds-color_on-bg));
|
|
27
|
+
display: block;
|
|
28
|
+
inline-size: 100%;
|
|
29
|
+
block-size: var(--separator_thickness, 1px);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([orientation='vertical']) .separator {
|
|
33
|
+
inline-size: var(--separator_thickness, 1px);
|
|
34
|
+
block-size: 100%;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
static properties = {
|
|
39
|
+
orientation: { type: String, reflect: true },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
declare orientation: 'horizontal' | 'vertical';
|
|
43
|
+
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this.orientation = 'horizontal';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return html`
|
|
51
|
+
<div
|
|
52
|
+
class="separator"
|
|
53
|
+
role="separator"
|
|
54
|
+
aria-orientation=${this.orientation}
|
|
55
|
+
></div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
customElements.define('bds-separator', BdsSeparator);
|
|
61
|
+
|
|
62
|
+
declare global {
|
|
63
|
+
interface HTMLElementTagNameMap {
|
|
64
|
+
'bds-separator': BdsSeparator;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { fixture, cleanup } from '../test/helpers';
|
|
2
|
+
import { BdsSkeleton } from './bds-skeleton';
|
|
3
|
+
|
|
4
|
+
describe('bds-skeleton', () => {
|
|
5
|
+
it('is registered as a custom element', () => {
|
|
6
|
+
expect(customElements.get('bds-skeleton')).toBe(BdsSkeleton);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('renders a skeleton element in shadow DOM', async () => {
|
|
10
|
+
const el = await fixture('<bds-skeleton></bds-skeleton>');
|
|
11
|
+
const skeleton = el.shadowRoot!.querySelector('.skeleton');
|
|
12
|
+
expect(skeleton).not.toBeNull();
|
|
13
|
+
cleanup(el);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('has aria-hidden="true" on the skeleton element', async () => {
|
|
17
|
+
const el = await fixture('<bds-skeleton></bds-skeleton>');
|
|
18
|
+
const skeleton = el.shadowRoot!.querySelector('.skeleton');
|
|
19
|
+
expect(skeleton!.getAttribute('aria-hidden')).toBe('true');
|
|
20
|
+
cleanup(el);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<bds-skeleton>` — framework-agnostic Skeleton loading placeholder custom element.
|
|
5
|
+
*
|
|
6
|
+
* No attributes. The host inherits width/height from its container or inline styles.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <bds-skeleton style="width: 200px; height: 1rem;"></bds-skeleton>
|
|
10
|
+
*/
|
|
11
|
+
export class BdsSkeleton extends LitElement {
|
|
12
|
+
static styles = css`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.skeleton {
|
|
18
|
+
display: block;
|
|
19
|
+
background: linear-gradient(
|
|
20
|
+
90deg,
|
|
21
|
+
var(--bds-color_grey--subtle) 25%,
|
|
22
|
+
var(--bds-color_bg) 50%,
|
|
23
|
+
var(--bds-color_grey--subtle) 75%
|
|
24
|
+
);
|
|
25
|
+
background-size: 200% 100%;
|
|
26
|
+
animation: shimmer 1.5s infinite;
|
|
27
|
+
border-radius: var(--bds-border_radius--xs);
|
|
28
|
+
min-block-size: var(--bds-space_m);
|
|
29
|
+
inline-size: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@keyframes shimmer {
|
|
33
|
+
0% { background-position: 200% 0; }
|
|
34
|
+
100% { background-position: -200% 0; }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (prefers-reduced-motion: reduce) {
|
|
38
|
+
.skeleton {
|
|
39
|
+
animation: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
return html`<span class="skeleton" aria-hidden="true"></span>`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
customElements.define('bds-skeleton', BdsSkeleton);
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
interface HTMLElementTagNameMap {
|
|
53
|
+
'bds-skeleton': BdsSkeleton;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { fixture, cleanup } from '../test/helpers';
|
|
2
|
+
import { BdsTypography } from './bds-typography';
|
|
3
|
+
|
|
4
|
+
describe('bds-typography', () => {
|
|
5
|
+
it('is registered as a custom element', () => {
|
|
6
|
+
expect(customElements.get('bds-typography')).toBe(BdsTypography);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('defaults to variant="body"', async () => {
|
|
10
|
+
const el = await fixture('<bds-typography>Text</bds-typography>');
|
|
11
|
+
expect(el.getAttribute('variant')).toBe('body');
|
|
12
|
+
cleanup(el);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders a <p> element for body variant', async () => {
|
|
16
|
+
const el = await fixture('<bds-typography variant="body">Text</bds-typography>');
|
|
17
|
+
const p = el.shadowRoot!.querySelector('p');
|
|
18
|
+
expect(p).not.toBeNull();
|
|
19
|
+
cleanup(el);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders a <p> element for body_s variant', async () => {
|
|
23
|
+
const el = await fixture('<bds-typography variant="body_s">Text</bds-typography>');
|
|
24
|
+
const p = el.shadowRoot!.querySelector('p');
|
|
25
|
+
expect(p).not.toBeNull();
|
|
26
|
+
cleanup(el);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders an <h1> element for h1 variant', async () => {
|
|
30
|
+
const el = await fixture('<bds-typography variant="h1">Heading</bds-typography>');
|
|
31
|
+
const h1 = el.shadowRoot!.querySelector('h1');
|
|
32
|
+
expect(h1).not.toBeNull();
|
|
33
|
+
cleanup(el);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('renders an <h2> element for h2 variant', async () => {
|
|
37
|
+
const el = await fixture('<bds-typography variant="h2">Heading</bds-typography>');
|
|
38
|
+
expect(el.shadowRoot!.querySelector('h2')).not.toBeNull();
|
|
39
|
+
cleanup(el);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('renders an <h3> element for h3 variant', async () => {
|
|
43
|
+
const el = await fixture('<bds-typography variant="h3">Heading</bds-typography>');
|
|
44
|
+
expect(el.shadowRoot!.querySelector('h3')).not.toBeNull();
|
|
45
|
+
cleanup(el);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('renders the element with typography and variant classes', async () => {
|
|
49
|
+
const el = await fixture('<bds-typography variant="h1">Heading</bds-typography>');
|
|
50
|
+
const h1 = el.shadowRoot!.querySelector('h1');
|
|
51
|
+
expect(h1!.classList.contains('typography')).toBe(true);
|
|
52
|
+
expect(h1!.classList.contains('--h1')).toBe(true);
|
|
53
|
+
cleanup(el);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('uses the component attribute to override the tag', async () => {
|
|
57
|
+
const el = await fixture('<bds-typography component="span">Text</bds-typography>');
|
|
58
|
+
expect(el.shadowRoot!.querySelector('span')).not.toBeNull();
|
|
59
|
+
cleanup(el);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('renders slotted content', async () => {
|
|
63
|
+
const el = await fixture('<bds-typography>Hello world</bds-typography>');
|
|
64
|
+
expect(el.textContent?.trim()).toBe('Hello world');
|
|
65
|
+
cleanup(el);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('reflects variant property to attribute', async () => {
|
|
69
|
+
const el = await fixture('<bds-typography>Text</bds-typography>') as BdsTypography;
|
|
70
|
+
el.variant = 'h2';
|
|
71
|
+
await el.updateComplete;
|
|
72
|
+
expect(el.getAttribute('variant')).toBe('h2');
|
|
73
|
+
expect(el.shadowRoot!.querySelector('h2')).not.toBeNull();
|
|
74
|
+
cleanup(el);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { LitElement, css } from 'lit';
|
|
2
|
+
import { html, unsafeStatic } from 'lit/static-html.js';
|
|
3
|
+
|
|
4
|
+
export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'body' | 'body_s';
|
|
5
|
+
|
|
6
|
+
const VARIANT_TAG: Record<TypographyVariant, string> = {
|
|
7
|
+
h1: 'h1',
|
|
8
|
+
h2: 'h2',
|
|
9
|
+
h3: 'h3',
|
|
10
|
+
body: 'p',
|
|
11
|
+
body_s: 'p',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `<bds-typography>` — framework-agnostic Typography custom element.
|
|
16
|
+
*
|
|
17
|
+
* Renders slotted content inside the appropriate semantic HTML element.
|
|
18
|
+
*
|
|
19
|
+
* Attributes:
|
|
20
|
+
* variant — "h1" | "h2" | "h3" | "body" (default) | "body_s"
|
|
21
|
+
* component — override the rendered tag name (e.g. "span", "label")
|
|
22
|
+
*
|
|
23
|
+
* Slots:
|
|
24
|
+
* (default) — text content
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <bds-typography variant="h1">Page title</bds-typography>
|
|
28
|
+
* <bds-typography variant="body_s" component="span">Small text</bds-typography>
|
|
29
|
+
*/
|
|
30
|
+
export class BdsTypography extends LitElement {
|
|
31
|
+
static styles = css`
|
|
32
|
+
:host {
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.typography {
|
|
37
|
+
margin: 0;
|
|
38
|
+
font-family: var(--bds-font_family--body);
|
|
39
|
+
color: var(--typography_color, var(--bds-color_on-bg));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.typography.--h1 {
|
|
43
|
+
font-family: var(--bds-font_family--heading);
|
|
44
|
+
font-size: var(--bds-font_size--heading-1);
|
|
45
|
+
font-weight: var(--bds-font_weight--bold);
|
|
46
|
+
line-height: var(--bds-font_line-height--heading);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.typography.--h2 {
|
|
50
|
+
font-family: var(--bds-font_family--heading);
|
|
51
|
+
font-size: var(--bds-font_size--heading-2);
|
|
52
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
53
|
+
line-height: var(--bds-font_line-height--heading);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.typography.--h3 {
|
|
57
|
+
font-family: var(--bds-font_family--heading);
|
|
58
|
+
font-size: var(--bds-font_size--heading-3);
|
|
59
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
60
|
+
line-height: var(--bds-font_line-height--heading);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.typography.--body {
|
|
64
|
+
font-size: var(--bds-font_size--body);
|
|
65
|
+
line-height: var(--bds-font_line-height--body);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.typography.--body_s {
|
|
69
|
+
font-size: var(--bds-font_size--body--s);
|
|
70
|
+
line-height: var(--bds-font_line-height--body);
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
static properties = {
|
|
75
|
+
variant: { type: String, reflect: true },
|
|
76
|
+
component: { type: String },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
declare variant: TypographyVariant;
|
|
80
|
+
declare component: string;
|
|
81
|
+
|
|
82
|
+
constructor() {
|
|
83
|
+
super();
|
|
84
|
+
this.variant = 'body';
|
|
85
|
+
this.component = '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private get _tag(): string {
|
|
89
|
+
if (this.component) return this.component;
|
|
90
|
+
return VARIANT_TAG[this.variant] ?? 'p';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
render() {
|
|
94
|
+
// unsafeStatic is safe here — tag values are derived from a known allowlist
|
|
95
|
+
// (VARIANT_TAG map + the `component` property which is developer-controlled).
|
|
96
|
+
const tag = unsafeStatic(this._tag);
|
|
97
|
+
const variant = unsafeStatic(this.variant);
|
|
98
|
+
return html`
|
|
99
|
+
<${tag} class="typography --${variant}">
|
|
100
|
+
<slot></slot>
|
|
101
|
+
</${tag}>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
customElements.define('bds-typography', BdsTypography);
|
|
107
|
+
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
'bds-typography': BdsTypography;
|
|
111
|
+
}
|
|
112
|
+
}
|
package/dist/web-components.d.ts
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import * as lit from 'lit';
|
|
2
|
-
import { LitElement } from 'lit';
|
|
3
|
-
|
|
4
|
-
type BadgeVariant = 'primary' | 'secondary' | 'success' | 'error' | 'warning';
|
|
5
|
-
/**
|
|
6
|
-
* `<bds-badge>` — framework-agnostic Badge custom element.
|
|
7
|
-
*
|
|
8
|
-
* Attributes:
|
|
9
|
-
* variant — "primary" (default) | "secondary" | "success" | "error" | "warning"
|
|
10
|
-
*
|
|
11
|
-
* Slots:
|
|
12
|
-
* (default) — badge label text / content
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* <bds-badge variant="success">New</bds-badge>
|
|
16
|
-
*/
|
|
17
|
-
declare class BdsBadge extends LitElement {
|
|
18
|
-
static styles: lit.CSSResult;
|
|
19
|
-
static properties: {
|
|
20
|
-
variant: {
|
|
21
|
-
type: StringConstructor;
|
|
22
|
-
reflect: boolean;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
variant: BadgeVariant;
|
|
26
|
-
constructor();
|
|
27
|
-
render(): lit.TemplateResult<1>;
|
|
28
|
-
}
|
|
29
|
-
declare global {
|
|
30
|
-
interface HTMLElementTagNameMap {
|
|
31
|
-
'bds-badge': BdsBadge;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type ButtonVariant = 'default' | 'ghost';
|
|
36
|
-
type ButtonSize = 'small' | 'medium' | 'large';
|
|
37
|
-
/**
|
|
38
|
-
* `<bds-button>` — framework-agnostic Button custom element.
|
|
39
|
-
*
|
|
40
|
-
* Attributes:
|
|
41
|
-
* variant — "default" (filled, default) | "ghost" (transparent + outlined)
|
|
42
|
-
* size — "small" | "medium" (default) | "large"
|
|
43
|
-
* disabled — boolean
|
|
44
|
-
* href — renders an <a> tag instead of <button>
|
|
45
|
-
* target — forwarded to <a> when href is set
|
|
46
|
-
* rel — forwarded to <a> when href is set
|
|
47
|
-
* has-pulse — boolean, enables the pulse ring animation
|
|
48
|
-
* type — "button" (default) | "submit" | "reset"
|
|
49
|
-
*
|
|
50
|
-
* Slots:
|
|
51
|
-
* (default) — button label
|
|
52
|
-
* icon-start — icon placed before the label
|
|
53
|
-
* icon-end — icon placed after the label
|
|
54
|
-
*
|
|
55
|
-
* Events:
|
|
56
|
-
* click — standard DOM click (disabled buttons suppress it and set aria-disabled)
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* <bds-button variant="ghost" size="small">
|
|
60
|
-
* <svg slot="icon-start">…</svg>
|
|
61
|
-
* Save
|
|
62
|
-
* </bds-button>
|
|
63
|
-
*/
|
|
64
|
-
declare class BdsButton extends LitElement {
|
|
65
|
-
static styles: lit.CSSResult;
|
|
66
|
-
static properties: {
|
|
67
|
-
variant: {
|
|
68
|
-
type: StringConstructor;
|
|
69
|
-
reflect: boolean;
|
|
70
|
-
};
|
|
71
|
-
size: {
|
|
72
|
-
type: StringConstructor;
|
|
73
|
-
reflect: boolean;
|
|
74
|
-
};
|
|
75
|
-
disabled: {
|
|
76
|
-
type: BooleanConstructor;
|
|
77
|
-
reflect: boolean;
|
|
78
|
-
};
|
|
79
|
-
href: {
|
|
80
|
-
type: StringConstructor;
|
|
81
|
-
};
|
|
82
|
-
target: {
|
|
83
|
-
type: StringConstructor;
|
|
84
|
-
};
|
|
85
|
-
rel: {
|
|
86
|
-
type: StringConstructor;
|
|
87
|
-
};
|
|
88
|
-
hasPulse: {
|
|
89
|
-
type: BooleanConstructor;
|
|
90
|
-
attribute: string;
|
|
91
|
-
reflect: boolean;
|
|
92
|
-
};
|
|
93
|
-
type: {
|
|
94
|
-
type: StringConstructor;
|
|
95
|
-
};
|
|
96
|
-
ariaLabel: {
|
|
97
|
-
type: StringConstructor;
|
|
98
|
-
attribute: string;
|
|
99
|
-
};
|
|
100
|
-
_iconStartFilled: {
|
|
101
|
-
state: boolean;
|
|
102
|
-
};
|
|
103
|
-
_iconEndFilled: {
|
|
104
|
-
state: boolean;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
variant: ButtonVariant;
|
|
108
|
-
size: ButtonSize;
|
|
109
|
-
disabled: boolean;
|
|
110
|
-
href: string | undefined;
|
|
111
|
-
target: string | undefined;
|
|
112
|
-
rel: string | undefined;
|
|
113
|
-
hasPulse: boolean;
|
|
114
|
-
type: 'button' | 'submit' | 'reset';
|
|
115
|
-
ariaLabel: string | null;
|
|
116
|
-
private _iconStartFilled;
|
|
117
|
-
private _iconEndFilled;
|
|
118
|
-
constructor();
|
|
119
|
-
private _onIconSlotChange;
|
|
120
|
-
private get _classes();
|
|
121
|
-
private _handleAnchorClick;
|
|
122
|
-
private _iconSlot;
|
|
123
|
-
render(): lit.TemplateResult<1>;
|
|
124
|
-
}
|
|
125
|
-
declare global {
|
|
126
|
-
interface HTMLElementTagNameMap {
|
|
127
|
-
'bds-button': BdsButton;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
type AlertVariant = 'info' | 'success' | 'warning' | 'error';
|
|
132
|
-
/**
|
|
133
|
-
* `<bds-alert>` — framework-agnostic Alert custom element.
|
|
134
|
-
*
|
|
135
|
-
* Attributes:
|
|
136
|
-
* variant — "info" (default) | "success" | "warning" | "error"
|
|
137
|
-
* title — optional heading above the body text
|
|
138
|
-
* dismissible — boolean; shows a dismiss button when present
|
|
139
|
-
*
|
|
140
|
-
* Slots:
|
|
141
|
-
* (default) — alert body content
|
|
142
|
-
* icon — optional icon displayed to the left of the content
|
|
143
|
-
*
|
|
144
|
-
* Events:
|
|
145
|
-
* bds-dismiss — fired (bubbles, composed) when the dismiss button is clicked
|
|
146
|
-
*
|
|
147
|
-
* Accessibility:
|
|
148
|
-
* role="alert" + aria-live="assertive" for error/warning variants,
|
|
149
|
-
* role="status" + aria-live="polite" for info/success variants.
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* <bds-alert variant="success" title="Saved!">Your changes have been saved.</bds-alert>
|
|
153
|
-
*
|
|
154
|
-
* <bds-alert variant="error" dismissible>
|
|
155
|
-
* <svg slot="icon">…</svg>
|
|
156
|
-
* Something went wrong.
|
|
157
|
-
* </bds-alert>
|
|
158
|
-
*/
|
|
159
|
-
declare class BdsAlert extends LitElement {
|
|
160
|
-
static styles: lit.CSSResult;
|
|
161
|
-
static properties: {
|
|
162
|
-
variant: {
|
|
163
|
-
type: StringConstructor;
|
|
164
|
-
reflect: boolean;
|
|
165
|
-
};
|
|
166
|
-
title: {
|
|
167
|
-
type: StringConstructor;
|
|
168
|
-
};
|
|
169
|
-
dismissible: {
|
|
170
|
-
type: BooleanConstructor;
|
|
171
|
-
reflect: boolean;
|
|
172
|
-
};
|
|
173
|
-
_iconFilled: {
|
|
174
|
-
state: boolean;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
variant: AlertVariant;
|
|
178
|
-
title: string;
|
|
179
|
-
dismissible: boolean;
|
|
180
|
-
private _iconFilled;
|
|
181
|
-
constructor();
|
|
182
|
-
private _onIconSlotChange;
|
|
183
|
-
private get _isUrgent();
|
|
184
|
-
private _handleDismiss;
|
|
185
|
-
render(): lit.TemplateResult<1>;
|
|
186
|
-
}
|
|
187
|
-
declare global {
|
|
188
|
-
interface HTMLElementTagNameMap {
|
|
189
|
-
'bds-alert': BdsAlert;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
type PopoverPlacement = 'bottom' | 'top' | 'left' | 'right';
|
|
194
|
-
/**
|
|
195
|
-
* `<bds-popover>` — framework-agnostic Popover custom element.
|
|
196
|
-
*
|
|
197
|
-
* Uses CSS Anchor Positioning within the shadow DOM so the panel stays
|
|
198
|
-
* anchored to the trigger and automatically repositions when it would
|
|
199
|
-
* overflow the viewport (`@position-try` fallbacks).
|
|
200
|
-
*
|
|
201
|
-
* Attributes:
|
|
202
|
-
* placement — "bottom" (default) | "top" | "left" | "right"
|
|
203
|
-
* open — boolean; reflects whether the panel is visible
|
|
204
|
-
*
|
|
205
|
-
* Slots:
|
|
206
|
-
* trigger — the element that opens/closes the panel on click
|
|
207
|
-
* (default) — panel content
|
|
208
|
-
*
|
|
209
|
-
* Events:
|
|
210
|
-
* bds-open — fired (bubbles, composed) when the panel opens
|
|
211
|
-
* bds-close — fired (bubbles, composed) when the panel closes
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* <bds-popover placement="bottom">
|
|
215
|
-
* <button slot="trigger">Open</button>
|
|
216
|
-
* <p>Panel content here</p>
|
|
217
|
-
* </bds-popover>
|
|
218
|
-
*/
|
|
219
|
-
declare class BdsPopover extends LitElement {
|
|
220
|
-
static styles: lit.CSSResult;
|
|
221
|
-
static properties: {
|
|
222
|
-
placement: {
|
|
223
|
-
type: StringConstructor;
|
|
224
|
-
reflect: boolean;
|
|
225
|
-
};
|
|
226
|
-
open: {
|
|
227
|
-
type: BooleanConstructor;
|
|
228
|
-
reflect: boolean;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
placement: PopoverPlacement;
|
|
232
|
-
open: boolean;
|
|
233
|
-
private _anchorName;
|
|
234
|
-
constructor();
|
|
235
|
-
connectedCallback(): void;
|
|
236
|
-
disconnectedCallback(): void;
|
|
237
|
-
private _onKeydown;
|
|
238
|
-
private _onCommand;
|
|
239
|
-
private _onOutsideClick;
|
|
240
|
-
private _toggle;
|
|
241
|
-
private _open;
|
|
242
|
-
private _close;
|
|
243
|
-
render(): lit.TemplateResult<1>;
|
|
244
|
-
}
|
|
245
|
-
declare global {
|
|
246
|
-
interface HTMLElementTagNameMap {
|
|
247
|
-
'bds-popover': BdsPopover;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
type ToastVariant = 'success' | 'error' | 'info' | 'warning';
|
|
252
|
-
/**
|
|
253
|
-
* `<bds-toast-provider>` — framework-agnostic Toast provider custom element.
|
|
254
|
-
*
|
|
255
|
-
* Wraps page content and manages a `popover="manual"` toast container that
|
|
256
|
-
* renders in the browser top layer — above all fixed/sticky elements without
|
|
257
|
-
* needing a z-index.
|
|
258
|
-
*
|
|
259
|
-
* Usage:
|
|
260
|
-
* // Instance method (direct reference)
|
|
261
|
-
* provider.showToast('Saved!', 'success');
|
|
262
|
-
*
|
|
263
|
-
* // Static convenience (finds the first provider in the DOM)
|
|
264
|
-
* BdsToastProvider.show('Something went wrong', 'error');
|
|
265
|
-
*
|
|
266
|
-
* // Event-driven (no import required)
|
|
267
|
-
* document.dispatchEvent(new CustomEvent('bds-show-toast', {
|
|
268
|
-
* detail: { message: 'Hello', variant: 'info' }
|
|
269
|
-
* }));
|
|
270
|
-
*
|
|
271
|
-
* Slots:
|
|
272
|
-
* (default) — page content; the host uses display:contents so layout
|
|
273
|
-
* is unaffected
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* <bds-toast-provider>
|
|
277
|
-
* <main>…</main>
|
|
278
|
-
* </bds-toast-provider>
|
|
279
|
-
*/
|
|
280
|
-
declare class BdsToastProvider extends LitElement {
|
|
281
|
-
static styles: lit.CSSResult;
|
|
282
|
-
static properties: {
|
|
283
|
-
_toasts: {
|
|
284
|
-
state: boolean;
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
private _toasts;
|
|
288
|
-
constructor();
|
|
289
|
-
connectedCallback(): void;
|
|
290
|
-
disconnectedCallback(): void;
|
|
291
|
-
updated(): void;
|
|
292
|
-
showToast(message: string, variant?: ToastVariant): void;
|
|
293
|
-
private _removeToast;
|
|
294
|
-
private _onShowToastEvent;
|
|
295
|
-
static show(message: string, variant?: ToastVariant): void;
|
|
296
|
-
render(): lit.TemplateResult<1>;
|
|
297
|
-
}
|
|
298
|
-
declare global {
|
|
299
|
-
interface HTMLElementTagNameMap {
|
|
300
|
-
'bds-toast-provider': BdsToastProvider;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
export { BdsAlert, BdsBadge, BdsButton, BdsPopover, BdsToastProvider };
|