@hubpav/hwio-ui 0.3.0 → 0.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubpav/hwio-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "HARDWARIO web design system for Astro: DaisyUI 5 themes generated from the brand tokens, the Tailwind entry stylesheet and the HWio* components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"build": "node scripts/build-themes.mjs"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@hubpav/hwio-brand": "0.
|
|
35
|
-
"@hubpav/hwio-web-runtime": "0.
|
|
36
|
-
"@hubpav/hwio-web-worker": "0.
|
|
34
|
+
"@hubpav/hwio-brand": "0.5.0",
|
|
35
|
+
"@hubpav/hwio-web-runtime": "0.5.0",
|
|
36
|
+
"@hubpav/hwio-web-worker": "0.5.0",
|
|
37
37
|
"daisyui": "5.7.28"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
/** Exclusive accordion on native <details name>, optional FAQPage JSON-LD. Answers are text unless `html` is set. */
|
|
3
|
-
|
|
3
|
+
/** An answer is one paragraph, or several as an array. */
|
|
4
|
+
interface Props { items: { q: string; a: string | string[] }[]; name?: string; html?: boolean; jsonLd?: boolean; class?: string }
|
|
4
5
|
const { items, name = 'hwio-faq', html = false, jsonLd = true, class: className = '' } = Astro.props;
|
|
5
|
-
const
|
|
6
|
+
const paragraphs = (a: string | string[]) => (Array.isArray(a) ? a : [a]);
|
|
7
|
+
const ld = { '@context': 'https://schema.org', '@type': 'FAQPage', mainEntity: items.map((i) => ({ '@type': 'Question', name: i.q, acceptedAnswer: { '@type': 'Answer', text: paragraphs(i.a).join(' ') } })) };
|
|
6
8
|
---
|
|
7
9
|
<div class:list={['space-y-3', className]}>
|
|
8
10
|
{items.map((item) => (
|
|
9
11
|
<details class="collapse collapse-arrow border border-base-300 bg-base-100" name={name}>
|
|
10
12
|
<summary class="collapse-title font-semibold">{item.q}</summary>
|
|
11
|
-
<div class="collapse-content opacity-90">{html ? <div set:html={item.a} /> : <p>{
|
|
13
|
+
<div class="collapse-content space-y-3 opacity-90">{html ? <div set:html={paragraphs(item.a).join('')} /> : paragraphs(item.a).map((p) => <p>{p}</p>)}</div>
|
|
12
14
|
</details>
|
|
13
15
|
))}
|
|
14
16
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { HWioCta } from '../types';
|
|
3
3
|
import HWioButton from './HWioButton.astro';
|
|
4
4
|
import HWioIcon from './HWioIcon.astro';
|
|
5
|
-
interface Tier { eyebrow?: string; name: string; price?: string; description?: string; features: string[]; cta?: HWioCta; featured?: boolean; badge?: string }
|
|
5
|
+
interface Tier { eyebrow?: string; name: string; price?: string; pricePrefix?: string; period?: string; description?: string; features: string[]; cta?: HWioCta; featured?: boolean; badge?: string }
|
|
6
6
|
interface Props { tiers: Tier[]; class?: string }
|
|
7
7
|
const { tiers, class: className = '' } = Astro.props;
|
|
8
8
|
const COLS = { 1: 'grid gap-6', 2: 'grid gap-6 md:grid-cols-2', 3: 'grid gap-6 md:grid-cols-3', 4: 'grid gap-6 md:grid-cols-2 lg:grid-cols-4' } as const;
|
|
@@ -15,9 +15,15 @@ const cols = (Math.min(Math.max(tiers.length, 1), 4) as 1 | 2 | 3 | 4);
|
|
|
15
15
|
{tier.eyebrow && <p class="hwio-kicker">{tier.eyebrow}</p>}
|
|
16
16
|
<div class="flex items-start justify-between gap-2">
|
|
17
17
|
<h3 class="card-title text-[1.375rem]">{tier.name}</h3>
|
|
18
|
-
{tier.badge && <span class="badge badge-primary">{tier.badge}</span>}
|
|
18
|
+
{tier.badge && <span class="badge badge-primary shrink-0 whitespace-nowrap">{tier.badge}</span>}
|
|
19
19
|
</div>
|
|
20
|
-
{tier.price &&
|
|
20
|
+
{tier.price && (
|
|
21
|
+
<p class="flex flex-wrap items-baseline gap-x-1.5">
|
|
22
|
+
{tier.pricePrefix && <span class="hwio-muted text-sm">{tier.pricePrefix}</span>}
|
|
23
|
+
<span class="text-3xl font-bold tracking-tight">{tier.price}</span>
|
|
24
|
+
{tier.period && <span class="hwio-muted text-sm">{tier.period}</span>}
|
|
25
|
+
</p>
|
|
26
|
+
)}
|
|
21
27
|
{tier.description && <p class="opacity-80">{tier.description}</p>}
|
|
22
28
|
<ul class="my-4 space-y-2 text-sm">
|
|
23
29
|
{tier.features.map((f) => <li class="flex items-start gap-2"><HWioIcon name="check" size="sm" class="mt-0.5 shrink-0 text-accent" /><span>{f}</span></li>)}
|
|
@@ -11,10 +11,6 @@ const { label, class: className = '' } = Astro.props;
|
|
|
11
11
|
.hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: none; }
|
|
12
12
|
:global([data-theme$='-dark']) .hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: block; }
|
|
13
13
|
:global([data-theme$='-dark']) .hwio-theme-toggle :global(.hwio-theme-toggle__moon) { display: none; }
|
|
14
|
-
@media (prefers-color-scheme: dark) {
|
|
15
|
-
:global(html:not([data-theme])) .hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: block; }
|
|
16
|
-
:global(html:not([data-theme])) .hwio-theme-toggle :global(.hwio-theme-toggle__moon) { display: none; }
|
|
17
|
-
}
|
|
18
14
|
</style>
|
|
19
15
|
<script>
|
|
20
16
|
import { hwioThemeRuntime } from '@hubpav/hwio-web-runtime/theme';
|
package/src/html.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface HWioHtmlOptions {
|
|
|
10
10
|
/** Pin data-theme on <html> (single-theme sites such as enerooo, or a fixed catalog page). */
|
|
11
11
|
pinTheme?: boolean;
|
|
12
12
|
font?: { family: string; sample?: string; sampleExt?: string } | null;
|
|
13
|
+
/** Share the light/dark choice across a domain's sites through a first-party cookie (e.g. '.hardwario.com'). */
|
|
14
|
+
themeCookieDomain?: string;
|
|
13
15
|
class?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -21,6 +23,7 @@ export function hwioHtmlAttrs(o: HWioHtmlOptions): Record<string, string> {
|
|
|
21
23
|
'data-hwio-theme-light': o.themes.light,
|
|
22
24
|
};
|
|
23
25
|
if (o.themes.dark) attrs['data-hwio-theme-dark'] = o.themes.dark;
|
|
26
|
+
if (o.themeCookieDomain) attrs['data-hwio-theme-cookie-domain'] = o.themeCookieDomain;
|
|
24
27
|
if (o.pinTheme || !o.themes.dark) attrs['data-theme'] = o.themes.light;
|
|
25
28
|
if (o.font) {
|
|
26
29
|
attrs['data-hwio-font-family'] = o.font.family;
|
package/src/styles/styles.css
CHANGED
|
@@ -195,10 +195,6 @@
|
|
|
195
195
|
.hwio-logo-grey:hover { filter: none; opacity: 1; }
|
|
196
196
|
[data-theme$='-dark'] .hwio-logo-grey { filter: grayscale(100%) invert(1); }
|
|
197
197
|
[data-theme$='-dark'] .hwio-logo-grey:hover { filter: grayscale(100%) invert(1); opacity: 1; }
|
|
198
|
-
@media (prefers-color-scheme: dark) {
|
|
199
|
-
:root:not([data-theme]) .hwio-logo-grey { filter: grayscale(100%) invert(1); }
|
|
200
|
-
:root:not([data-theme]) .hwio-logo-grey:hover { filter: grayscale(100%) invert(1); opacity: 1; }
|
|
201
|
-
}
|
|
202
198
|
|
|
203
199
|
.hwio-theme-transition,
|
|
204
200
|
.hwio-theme-transition *,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@plugin "daisyui/theme" {
|
|
3
3
|
name: "hwio-dark";
|
|
4
4
|
default: false;
|
|
5
|
-
prefersdark:
|
|
5
|
+
prefersdark: false;
|
|
6
6
|
color-scheme: dark;
|
|
7
7
|
--color-base-100: #0f0f14;
|
|
8
8
|
--color-base-200: #1a1a22;
|
|
@@ -40,10 +40,3 @@
|
|
|
40
40
|
--hwio-container-pad: 27px;
|
|
41
41
|
--hwio-kicker-on-neutral: #f43f5e;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
@media (prefers-color-scheme: dark) {
|
|
45
|
-
:root:not([data-theme]) {
|
|
46
|
-
--hwio-font-sans: 'Inter', 'Inter Fallback', ui-sans-serif, system-ui, sans-serif;
|
|
47
|
-
--hwio-kicker-on-neutral: #f43f5e;
|
|
48
|
-
}
|
|
49
|
-
}
|