@grantcodes/ui 2.1.1 → 2.3.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/CHANGELOG.md +29 -0
- package/css-import-attributes.d.ts +13 -0
- package/package.json +29 -4
- package/src/components/accordion/accordion.component.js +3 -2
- package/src/components/accordion/{accordion.styles.js → accordion.css} +0 -7
- package/src/components/accordion/accordion.react.js +9 -0
- package/src/components/app-bar/app-bar.component.js +7 -5
- package/src/components/app-bar/{app-bar.styles.js → app-bar.css} +0 -7
- package/src/components/app-bar/app-bar.react.js +12 -0
- package/src/components/avatar/avatar.component.js +1 -1
- package/src/components/avatar/{avatar.styles.js → avatar.css} +0 -4
- package/src/components/avatar/avatar.react.js +9 -0
- package/src/components/badge/badge.component.js +5 -4
- package/src/components/badge/badge.css +87 -0
- package/src/components/badge/badge.react.js +9 -0
- package/src/components/breadcrumb/breadcrumb.component.js +4 -3
- package/src/components/breadcrumb/{breadcrumb.styles.js → breadcrumb.css} +0 -7
- package/src/components/breadcrumb/breadcrumb.react.js +15 -0
- package/src/components/button/button.component.js +3 -2
- package/src/components/button/button.css +62 -0
- package/src/components/button/button.react.js +9 -0
- package/src/components/button-group/button-group.component.js +1 -1
- package/src/components/button-group/{button-group.styles.js → button-group.css} +0 -4
- package/src/components/button-group/button-group.react.js +9 -0
- package/src/components/card/card.component.js +1 -1
- package/src/components/card/{card.styles.js → card.css} +0 -4
- package/src/components/card/card.react.js +9 -0
- package/src/components/code-preview/code-preview.component.js +1 -1
- package/src/components/code-preview/{code-preview.styles.js → code-preview.css} +0 -4
- package/src/components/code-preview/code-preview.react.js +9 -0
- package/src/components/container/container.component.js +5 -4
- package/src/components/container/{container.styles.js → container.css} +0 -8
- package/src/components/container/container.react.js +9 -0
- package/src/components/cta/cta.component.js +1 -1
- package/src/components/cta/{cta.styles.js → cta.css} +0 -4
- package/src/components/cta/cta.react.js +9 -0
- package/src/components/dialog/dialog.component.js +1 -1
- package/src/components/dialog/{dialog.styles.js → dialog.css} +0 -4
- package/src/components/dialog/dialog.react.js +9 -0
- package/src/components/dropdown/dropdown.component.js +1 -1
- package/src/components/dropdown/{dropdown.styles.js → dropdown.css} +0 -4
- package/src/components/dropdown/dropdown.react.js +21 -0
- package/src/components/dropzone/dropzone.component.js +5 -4
- package/src/components/dropzone/{dropzone.styles.js → dropzone.css} +0 -4
- package/src/components/dropzone/dropzone.react.js +9 -0
- package/src/components/feature-list/feature-list.component.js +1 -1
- package/src/components/feature-list/{feature-list.styles.js → feature-list.css} +0 -4
- package/src/components/feature-list/feature-list.react.js +9 -0
- package/src/components/footer/footer-column.component.js +1 -1
- package/src/components/footer/{footer-column.styles.js → footer-column.css} +0 -4
- package/src/components/footer/footer.component.js +1 -1
- package/src/components/footer/{footer.styles.js → footer.css} +0 -4
- package/src/components/footer/footer.react.js +15 -0
- package/src/components/form-field/form-field.component.js +12 -22
- package/src/components/form-field/{form-field.styles.js → form-field.css} +0 -4
- package/src/components/form-field/form-field.react.js +9 -0
- package/src/components/gallery/gallery-image.component.js +1 -1
- package/src/components/gallery/gallery-image.react.js +9 -0
- package/src/components/gallery/gallery.component.js +1 -1
- package/src/components/gallery/{gallery.styles.js → gallery.css} +0 -4
- package/src/components/gallery/gallery.react.js +9 -0
- package/src/components/hero/hero.component.js +1 -1
- package/src/components/hero/{hero.styles.js → hero.css} +0 -4
- package/src/components/hero/hero.react.js +9 -0
- package/src/components/icon/icon.component.js +1 -1
- package/src/components/icon/{icon.styles.js → icon.css} +0 -4
- package/src/components/icon/icon.react.js +9 -0
- package/src/components/loading/loading.component.js +1 -1
- package/src/components/loading/{loading.styles.js → loading.css} +0 -4
- package/src/components/loading/loading.react.js +9 -0
- package/src/components/logo-cloud/logo-cloud.component.js +1 -1
- package/src/components/logo-cloud/{logo-cloud.styles.js → logo-cloud.css} +0 -4
- package/src/components/logo-cloud/logo-cloud.react.js +9 -0
- package/src/components/media-text/media-text.component.js +1 -1
- package/src/components/media-text/{media-text.styles.js → media-text.css} +0 -4
- package/src/components/media-text/media-text.react.js +9 -0
- package/src/components/newsletter/newsletter.component.js +1 -1
- package/src/components/newsletter/{newsletter.styles.js → newsletter.css} +0 -4
- package/src/components/newsletter/newsletter.react.js +9 -0
- package/src/components/notice/notice.component.js +7 -3
- package/src/components/notice/{notice.styles.js → notice.css} +0 -4
- package/src/components/notice/notice.react.js +9 -0
- package/src/components/pagination/pagination.component.js +1 -1
- package/src/components/pagination/{pagination.styles.js → pagination.css} +0 -4
- package/src/components/pagination/pagination.react.js +9 -0
- package/src/components/pricing/pricing.component.js +1 -1
- package/src/components/pricing/{pricing.styles.js → pricing.css} +0 -4
- package/src/components/pricing/pricing.react.js +9 -0
- package/src/components/sidebar/sidebar.component.js +7 -5
- package/src/components/sidebar/{sidebar.styles.js → sidebar.css} +0 -7
- package/src/components/sidebar/sidebar.react.js +13 -0
- package/src/components/stats/stats.component.js +1 -1
- package/src/components/stats/{stats.styles.js → stats.css} +0 -4
- package/src/components/stats/stats.react.js +9 -0
- package/src/components/tabs/internal/tabs-button.component.js +3 -2
- package/src/components/tabs/internal/tabs-button.react.js +9 -0
- package/src/components/tabs/tab.component.js +3 -2
- package/src/components/tabs/tab.react.js +9 -0
- package/src/components/tabs/tabs.component.js +3 -2
- package/src/components/tabs/{tabs.styles.js → tabs.css} +0 -7
- package/src/components/tabs/tabs.react.js +9 -0
- package/src/components/testimonials/testimonials.component.js +1 -1
- package/src/components/testimonials/{testimonials.styles.js → testimonials.css} +0 -4
- package/src/components/testimonials/testimonials.react.js +9 -0
- package/src/components/toast/toast.component.js +11 -8
- package/src/components/toast/{toast.styles.js → toast.css} +0 -7
- package/src/components/toast/toast.react.js +18 -0
- package/src/components/tooltip/tooltip.component.js +1 -1
- package/src/components/tooltip/{tooltip.styles.js → tooltip.css} +1 -6
- package/src/components/tooltip/tooltip.react.js +9 -0
- package/src/exports.test.js +119 -0
- package/src/lib/styles/focus-ring.css +30 -0
- package/src/react.js +36 -0
- package/src/react.test.js +56 -0
- package/vite-plugin-css-import-attributes.js +96 -0
- package/src/components/badge/badge.styles.js +0 -91
- package/src/components/button/button.styles.js +0 -69
- package/src/lib/classnames.js +0 -61
- package/src/lib/styles/focus-ring.styles.js +0 -34
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
3
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
5
|
+
import noticeStyles from "./notice.css" with { type: "css" };
|
|
6
6
|
import { GrantCodesIcon } from "../icon/icon.component.js";
|
|
7
7
|
import { AlertCircle, Info, CheckCircle2, XCircle, X } from "../../icons.js";
|
|
8
8
|
|
|
@@ -60,9 +60,13 @@ export class GrantCodesNotice extends LitElement {
|
|
|
60
60
|
|
|
61
61
|
render() {
|
|
62
62
|
const icon = ICONS[this.variant];
|
|
63
|
+
const classes = classMap({
|
|
64
|
+
notice: true,
|
|
65
|
+
[`notice--${this.variant}`]: true,
|
|
66
|
+
});
|
|
63
67
|
|
|
64
68
|
return html`
|
|
65
|
-
<aside class
|
|
69
|
+
<aside class=${classes}>
|
|
66
70
|
<grantcodes-icon class="notice__icon">${unsafeHTML(icon)}</grantcodes-icon>
|
|
67
71
|
|
|
68
72
|
<div class="notice__content">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
|
-
import
|
|
3
|
+
import paginationStyles from "./pagination.css" with { type: "css" };
|
|
4
4
|
import { GrantCodesButton } from "../button/button.component.js";
|
|
5
5
|
import "../button/button.js";
|
|
6
6
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createComponent } from "@lit/react"
|
|
3
|
+
import { GrantCodesPagination } from "./pagination.js"
|
|
4
|
+
|
|
5
|
+
export const Pagination = createComponent({
|
|
6
|
+
tagName: "grantcodes-pagination",
|
|
7
|
+
elementClass: GrantCodesPagination,
|
|
8
|
+
react: React,
|
|
9
|
+
})
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import focusRingStyles from "#styles/focus-ring.css" with { type: "css" };
|
|
5
|
+
import sidebarStyles from "./sidebar.css" with { type: "css" };
|
|
5
6
|
|
|
6
7
|
export class GrantCodesSidebar extends LitElement {
|
|
7
|
-
static styles = [sidebarStyles];
|
|
8
|
+
static styles = [focusRingStyles, sidebarStyles];
|
|
8
9
|
|
|
9
10
|
static properties = {
|
|
10
11
|
position: { type: String },
|
|
@@ -104,7 +105,8 @@ export class GrantCodesSidebar extends LitElement {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
render() {
|
|
107
|
-
const
|
|
108
|
+
const sidebarClasses = classMap({
|
|
109
|
+
sidebar: true,
|
|
108
110
|
"sidebar--collapsed": this.collapsed,
|
|
109
111
|
[`sidebar--${this.position}`]: true,
|
|
110
112
|
"sidebar--drawer-open": this._drawerOpen,
|
|
@@ -137,7 +139,7 @@ export class GrantCodesSidebar extends LitElement {
|
|
|
137
139
|
|
|
138
140
|
<!-- Sidebar -->
|
|
139
141
|
<aside
|
|
140
|
-
class
|
|
142
|
+
class=${sidebarClasses}
|
|
141
143
|
style="--sidebar-width: ${this.width}"
|
|
142
144
|
>
|
|
143
145
|
<!-- Collapse Toggle (Desktop) -->
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { focusRingStyles } from "../../lib/styles/focus-ring.styles.js";
|
|
3
|
-
|
|
4
|
-
export const sidebarStyles = css`
|
|
5
|
-
${focusRingStyles}
|
|
6
|
-
|
|
7
1
|
*,
|
|
8
2
|
*::before,
|
|
9
3
|
*::after {
|
|
@@ -184,4 +178,3 @@ export const sidebarStyles = css`
|
|
|
184
178
|
}
|
|
185
179
|
}
|
|
186
180
|
}
|
|
187
|
-
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createComponent } from "@lit/react"
|
|
3
|
+
import { GrantCodesSidebar } from "./sidebar.js"
|
|
4
|
+
|
|
5
|
+
export const Sidebar = createComponent({
|
|
6
|
+
tagName: "grantcodes-sidebar",
|
|
7
|
+
elementClass: GrantCodesSidebar,
|
|
8
|
+
react: React,
|
|
9
|
+
events: {
|
|
10
|
+
onToggle: "toggle",
|
|
11
|
+
onDrawerToggle: "drawer-toggle",
|
|
12
|
+
},
|
|
13
|
+
})
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
|
|
3
|
-
export const statsStyles = css`
|
|
4
1
|
:host {
|
|
5
2
|
display: block;
|
|
6
3
|
}
|
|
@@ -63,4 +60,3 @@ export const statsStyles = css`
|
|
|
63
60
|
font-size: var(--g-theme-typography-body-sm-font-size);
|
|
64
61
|
color: var(--g-theme-color-content-secondary);
|
|
65
62
|
}
|
|
66
|
-
`;
|
|
@@ -2,7 +2,8 @@ import { LitElement } from "lit";
|
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
3
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
4
|
import { GrantCodesTabsItem } from "./tabs-item.component.js";
|
|
5
|
-
import
|
|
5
|
+
import focusRingStyles from "#styles/focus-ring.css" with { type: "css" };
|
|
6
|
+
import tabsStyles from "../tabs.css" with { type: "css" };
|
|
6
7
|
|
|
7
8
|
export class GrantCodesTabsButton extends GrantCodesTabsItem {
|
|
8
9
|
static shadowRootOptions = {
|
|
@@ -10,7 +11,7 @@ export class GrantCodesTabsButton extends GrantCodesTabsItem {
|
|
|
10
11
|
delegatesFocus: true,
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
static styles = [tabsStyles];
|
|
14
|
+
static styles = [focusRingStyles, tabsStyles];
|
|
14
15
|
|
|
15
16
|
render() {
|
|
16
17
|
console.log("GrantCodesTabsButton", this, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createComponent } from "@lit/react"
|
|
3
|
+
import { GrantCodesTabsButton } from "./tabs-button.js"
|
|
4
|
+
|
|
5
|
+
export const TabsButton = createComponent({
|
|
6
|
+
tagName: "grantcodes-tabs-button",
|
|
7
|
+
elementClass: GrantCodesTabsButton,
|
|
8
|
+
react: React,
|
|
9
|
+
})
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { GrantCodesTabsItem } from "./internal/tabs-item.component.js";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
|
-
import
|
|
3
|
+
import focusRingStyles from "#styles/focus-ring.css" with { type: "css" };
|
|
4
|
+
import tabsStyles from "./tabs.css" with { type: "css" };
|
|
4
5
|
|
|
5
6
|
export class GrantCodesTab extends GrantCodesTabsItem {
|
|
6
|
-
static styles = [tabsStyles];
|
|
7
|
+
static styles = [focusRingStyles, tabsStyles];
|
|
7
8
|
|
|
8
9
|
render() {
|
|
9
10
|
return html`
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
3
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
|
-
import
|
|
4
|
+
import focusRingStyles from "#styles/focus-ring.css" with { type: "css" };
|
|
5
|
+
import tabsStyles from "./tabs.css" with { type: "css" };
|
|
5
6
|
import { GrantCodesTab } from "./tab.component.js";
|
|
6
7
|
import { GrantCodesTabsButton } from "./internal/tabs-button.component.js";
|
|
7
8
|
import "./internal/tabs-button.js";
|
|
@@ -11,7 +12,7 @@ export class GrantCodesTabs extends LitElement {
|
|
|
11
12
|
// Styles are scoped to this element: they won't conflict with styles
|
|
12
13
|
// on the main page or in other components. Styling API can be exposed
|
|
13
14
|
// via CSS custom properties.
|
|
14
|
-
static styles = [tabsStyles];
|
|
15
|
+
static styles = [focusRingStyles, tabsStyles];
|
|
15
16
|
|
|
16
17
|
static properties = {
|
|
17
18
|
label: { type: String },
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { focusRingStyles } from "../../lib/styles/focus-ring.styles.js";
|
|
3
|
-
|
|
4
|
-
export const tabsStyles = css`
|
|
5
|
-
${focusRingStyles}
|
|
6
|
-
|
|
7
1
|
*,
|
|
8
2
|
*::before,
|
|
9
3
|
*::after {
|
|
@@ -95,4 +89,3 @@ export const tabsStyles = css`
|
|
|
95
89
|
.tabs__panel.is-active {
|
|
96
90
|
display: block;
|
|
97
91
|
}
|
|
98
|
-
`;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
|
|
3
|
-
export const testimonialsStyles = css`
|
|
4
1
|
:host {
|
|
5
2
|
display: block;
|
|
6
3
|
}
|
|
@@ -79,4 +76,3 @@ export const testimonialsStyles = css`
|
|
|
79
76
|
font-size: var(--g-theme-typography-body-sm-font-size);
|
|
80
77
|
color: var(--g-theme-color-content-secondary);
|
|
81
78
|
}
|
|
82
|
-
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createComponent } from "@lit/react"
|
|
3
|
+
import { GrantCodesTestimonials } from "./testimonials.js"
|
|
4
|
+
|
|
5
|
+
export const Testimonials = createComponent({
|
|
6
|
+
tagName: "grantcodes-testimonials",
|
|
7
|
+
elementClass: GrantCodesTestimonials,
|
|
8
|
+
react: React,
|
|
9
|
+
})
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
3
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
5
|
+
import focusRingStyles from "#styles/focus-ring.css" with { type: "css" };
|
|
6
|
+
import toastStyles from "./toast.css" with { type: "css" };
|
|
6
7
|
import { GrantCodesIcon } from "../icon/icon.component.js";
|
|
7
8
|
import { AlertCircle, Info, CheckCircle2, XCircle, X } from "../../icons.js";
|
|
8
9
|
|
|
@@ -15,7 +16,7 @@ const ICONS = {
|
|
|
15
16
|
|
|
16
17
|
export class GrantCodesToast extends LitElement {
|
|
17
18
|
static dependencies = { "grancodes-icon": GrantCodesIcon };
|
|
18
|
-
static styles = [toastStyles];
|
|
19
|
+
static styles = [focusRingStyles, toastStyles];
|
|
19
20
|
|
|
20
21
|
static properties = {
|
|
21
22
|
variant: { type: String },
|
|
@@ -128,14 +129,15 @@ export class GrantCodesToast extends LitElement {
|
|
|
128
129
|
|
|
129
130
|
render() {
|
|
130
131
|
const icon = ICONS[this.variant];
|
|
131
|
-
const
|
|
132
|
+
const classes = classMap({
|
|
133
|
+
toast: true,
|
|
132
134
|
[`toast--${this.variant}`]: true,
|
|
133
135
|
[`toast--${this.position}`]: true,
|
|
134
136
|
"toast--visible": this._visible,
|
|
135
137
|
});
|
|
136
138
|
|
|
137
139
|
return html`
|
|
138
|
-
<div class
|
|
140
|
+
<div class=${classes} role="status" aria-live="polite">
|
|
139
141
|
<grantcodes-icon class="toast__icon">${unsafeHTML(icon)}</grantcodes-icon>
|
|
140
142
|
|
|
141
143
|
<div class="toast__content">
|
|
@@ -155,7 +157,7 @@ export class GrantCodesToast extends LitElement {
|
|
|
155
157
|
* Toast container for managing multiple toasts
|
|
156
158
|
*/
|
|
157
159
|
export class GrantCodesToastContainer extends LitElement {
|
|
158
|
-
static styles = [toastStyles];
|
|
160
|
+
static styles = [focusRingStyles, toastStyles];
|
|
159
161
|
|
|
160
162
|
static properties = {
|
|
161
163
|
position: { type: String },
|
|
@@ -172,12 +174,13 @@ export class GrantCodesToastContainer extends LitElement {
|
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
render() {
|
|
175
|
-
const
|
|
177
|
+
const classes = classMap({
|
|
178
|
+
"toast-container": true,
|
|
176
179
|
[`toast-container--${this.position}`]: true,
|
|
177
180
|
});
|
|
178
181
|
|
|
179
182
|
return html`
|
|
180
|
-
<div class
|
|
183
|
+
<div class=${classes}>
|
|
181
184
|
<slot></slot>
|
|
182
185
|
</div>
|
|
183
186
|
`;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { focusRingStyles } from "../../lib/styles/focus-ring.styles.js";
|
|
3
|
-
|
|
4
|
-
export const toastStyles = css`
|
|
5
|
-
${focusRingStyles}
|
|
6
|
-
|
|
7
1
|
*,
|
|
8
2
|
*::before,
|
|
9
3
|
*::after {
|
|
@@ -202,4 +196,3 @@ export const toastStyles = css`
|
|
|
202
196
|
}
|
|
203
197
|
}
|
|
204
198
|
}
|
|
205
|
-
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { createComponent } from "@lit/react"
|
|
3
|
+
import { GrantCodesToast, GrantCodesToastContainer } from "./toast.js"
|
|
4
|
+
|
|
5
|
+
export const Toast = createComponent({
|
|
6
|
+
tagName: "grantcodes-toast",
|
|
7
|
+
elementClass: GrantCodesToast,
|
|
8
|
+
react: React,
|
|
9
|
+
events: {
|
|
10
|
+
onDismiss: "dismiss",
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const ToastContainer = createComponent({
|
|
15
|
+
tagName: "grantcodes-toast-container",
|
|
16
|
+
elementClass: GrantCodesToastContainer,
|
|
17
|
+
react: React,
|
|
18
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
|
-
import
|
|
3
|
+
import tooltipStyles from "./tooltip.css" with { type: "css" };
|
|
4
4
|
import { generateId } from "../../lib/generate-id.js";
|
|
5
5
|
|
|
6
6
|
export class GrantCodesTooltip extends LitElement {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
|
|
3
|
-
export const tooltipStyles = css`
|
|
4
1
|
|
|
5
2
|
:host,
|
|
6
3
|
.tooltip,
|
|
@@ -44,12 +41,11 @@ export const tooltipStyles = css`
|
|
|
44
41
|
|
|
45
42
|
/* Try anchor positioning first (modern browsers) */
|
|
46
43
|
position-anchor: var(--tooltip-anchor, none);
|
|
47
|
-
inset-area: block-end;
|
|
48
44
|
position-area: block-end;
|
|
49
45
|
margin-block-start: 0.5rem;
|
|
50
46
|
|
|
51
47
|
/* Fallback for browsers without anchor positioning support */
|
|
52
|
-
@supports not (
|
|
48
|
+
@supports not (position-area: block-end) {
|
|
53
49
|
/* Traditional positioning as fallback */
|
|
54
50
|
position: absolute;
|
|
55
51
|
top: 100%;
|
|
@@ -75,4 +71,3 @@ export const tooltipStyles = css`
|
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
`;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { describe, it } from 'node:test'
|
|
2
|
+
import assert from 'node:assert'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
+
const pkgPath = path.resolve(__dirname, '..', 'package.json')
|
|
9
|
+
const pkgRoot = path.dirname(pkgPath)
|
|
10
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
|
11
|
+
const exports = pkg.exports
|
|
12
|
+
|
|
13
|
+
// All 34 component CSS files expected to exist on disk
|
|
14
|
+
// These are resolved via the ./components/* wildcard export
|
|
15
|
+
const expectedComponentCss = [
|
|
16
|
+
'accordion/accordion.css',
|
|
17
|
+
'app-bar/app-bar.css',
|
|
18
|
+
'avatar/avatar.css',
|
|
19
|
+
'badge/badge.css',
|
|
20
|
+
'breadcrumb/breadcrumb.css',
|
|
21
|
+
'button/button.css',
|
|
22
|
+
'button-group/button-group.css',
|
|
23
|
+
'card/card.css',
|
|
24
|
+
'code-preview/code-preview.css',
|
|
25
|
+
'container/container.css',
|
|
26
|
+
'cta/cta.css',
|
|
27
|
+
'dialog/dialog.css',
|
|
28
|
+
'dropdown/dropdown.css',
|
|
29
|
+
'dropzone/dropzone.css',
|
|
30
|
+
'feature-list/feature-list.css',
|
|
31
|
+
'footer/footer.css',
|
|
32
|
+
'footer/footer-column.css',
|
|
33
|
+
'form-field/form-field.css',
|
|
34
|
+
'gallery/gallery.css',
|
|
35
|
+
'hero/hero.css',
|
|
36
|
+
'icon/icon.css',
|
|
37
|
+
'loading/loading.css',
|
|
38
|
+
'logo-cloud/logo-cloud.css',
|
|
39
|
+
'media-text/media-text.css',
|
|
40
|
+
'newsletter/newsletter.css',
|
|
41
|
+
'notice/notice.css',
|
|
42
|
+
'pagination/pagination.css',
|
|
43
|
+
'pricing/pricing.css',
|
|
44
|
+
'sidebar/sidebar.css',
|
|
45
|
+
'stats/stats.css',
|
|
46
|
+
'tabs/tabs.css',
|
|
47
|
+
'testimonials/testimonials.css',
|
|
48
|
+
'toast/toast.css',
|
|
49
|
+
'tooltip/tooltip.css',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
describe('package.json exports', () => {
|
|
53
|
+
describe('component CSS files exist (resolved via ./components/* wildcard)', () => {
|
|
54
|
+
for (const cssFile of expectedComponentCss) {
|
|
55
|
+
it(`src/components/${cssFile} exists on disk`, () => {
|
|
56
|
+
const fullPath = path.resolve(pkgRoot, 'src', 'components', cssFile)
|
|
57
|
+
assert.ok(
|
|
58
|
+
fs.existsSync(fullPath),
|
|
59
|
+
`CSS file does not exist: ${fullPath}`,
|
|
60
|
+
)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
it('has ./components/* wildcard export that covers CSS files', () => {
|
|
65
|
+
assert.ok(
|
|
66
|
+
exports['./components/*'],
|
|
67
|
+
'Missing ./components/* wildcard export',
|
|
68
|
+
)
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe('focus-ring shared styles export', () => {
|
|
73
|
+
it('has export for ./styles/focus-ring.css', () => {
|
|
74
|
+
assert.ok(
|
|
75
|
+
exports['./styles/focus-ring.css'] !== undefined,
|
|
76
|
+
'Missing export for ./styles/focus-ring.css',
|
|
77
|
+
)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('./styles/focus-ring.css points to an existing file', () => {
|
|
81
|
+
const exportValue = exports['./styles/focus-ring.css']
|
|
82
|
+
const filePath =
|
|
83
|
+
typeof exportValue === 'string' ? exportValue : exportValue?.import
|
|
84
|
+
assert.ok(filePath, 'No file path found for ./styles/focus-ring.css')
|
|
85
|
+
const fullPath = path.resolve(pkgRoot, filePath)
|
|
86
|
+
assert.ok(
|
|
87
|
+
fs.existsSync(fullPath),
|
|
88
|
+
`File does not exist: ${fullPath}`,
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
describe('existing exports preserved', () => {
|
|
94
|
+
it('has root export (.)', () => {
|
|
95
|
+
assert.ok(exports['.'], 'Missing root export')
|
|
96
|
+
assert.ok(exports['.'].import, 'Missing root import')
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('has ./icons export', () => {
|
|
100
|
+
assert.ok(exports['./icons'], 'Missing ./icons export')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('has ./styles/base.css export', () => {
|
|
104
|
+
assert.ok(exports['./styles/base.css'], 'Missing ./styles/base.css export')
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('has ./styles/themes/* export', () => {
|
|
108
|
+
assert.ok(exports['./styles/themes/*'], 'Missing ./styles/themes/* export')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('has ./components/* wildcard export', () => {
|
|
112
|
+
assert.ok(exports['./components/*'], 'Missing ./components/* wildcard export')
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('has ./fonts/* export', () => {
|
|
116
|
+
assert.ok(exports['./fonts/*'], 'Missing ./fonts/* export')
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.focus-ring,
|
|
2
|
+
:host(.focus-ring) {
|
|
3
|
+
outline: 0px solid transparent;
|
|
4
|
+
outline-offset: var(--g-theme-focus-ring-offset-default);
|
|
5
|
+
transition-duration: var(--g-animation-duration-20);
|
|
6
|
+
transition-property: outline-color, width;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.focus-ring:focus-visible,
|
|
10
|
+
:host(.focus-ring):focus-visible {
|
|
11
|
+
outline: var(--g-theme-focus-ring-width-default) solid
|
|
12
|
+
var(--g-theme-focus-ring-color-default);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (prefers-contrast: more) {
|
|
16
|
+
.focus-ring:focus-visible,
|
|
17
|
+
:host(.focus-ring):focus-visible {
|
|
18
|
+
outline: var(--g-theme-focus-ring-width-default) solid
|
|
19
|
+
var(--g-theme-focus-ring-color-contrast);
|
|
20
|
+
box-shadow: 0 0 0
|
|
21
|
+
calc(
|
|
22
|
+
(
|
|
23
|
+
var(--g-theme-focus-ring-width-default) +
|
|
24
|
+
var(--g-theme-focus-ring-offset-default)
|
|
25
|
+
) *
|
|
26
|
+
1.5
|
|
27
|
+
)
|
|
28
|
+
var(--g-theme-focus-ring-color-contrast-shadow);
|
|
29
|
+
}
|
|
30
|
+
}
|