@eldrajs/theme-cli 0.2.4 → 0.2.5
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 +4 -0
- package/README.md +6 -0
- package/dist/cli.js +8 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/{validate-FjQ-5_ne.js → validate-CC6Mp5i_.js} +2 -1
- package/package.json +3 -3
- package/template/.eldra/previews.json +35 -35
- package/template/README.md +3 -1
- package/template/app/app.vue +1 -3
- package/template/app/assets/main.css +13 -15
- package/template/app/components/ui/UiImage.vue +29 -17
- package/template/app/components/ui/__tests__/UiImage.spec.ts +24 -15
- package/template/app/pages/[...slug].vue +1 -1
- package/template/blocks/announcement-bar/Block.vue +3 -2
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
- package/template/blocks/article/Block.vue +3 -4
- package/template/blocks/article-list/Block.vue +18 -9
- package/template/blocks/breadcrumbs/Block.vue +1 -1
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
- package/template/blocks/cart/Block.vue +1 -1
- package/template/blocks/cart/parts/CartLines.vue +3 -2
- package/template/blocks/cart/parts/ShippingBar.vue +1 -1
- package/template/blocks/cart/parts/Summary.vue +5 -9
- package/template/blocks/collection-grid/Block.vue +11 -14
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +12 -14
- package/template/blocks/collection-header/Block.vue +5 -5
- package/template/blocks/contact/Block.vue +1 -1
- package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
- package/template/blocks/cta/Block.vue +16 -18
- package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
- package/template/blocks/faq/Block.vue +3 -13
- package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
- package/template/blocks/feature-grid/Block.vue +1 -1
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
- package/template/blocks/footer/Block.vue +14 -11
- package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
- package/template/blocks/form/Block.vue +1 -1
- package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
- package/template/blocks/hero/Block.vue +8 -11
- package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
- package/template/blocks/image/Block.vue +4 -4
- package/template/blocks/image/__tests__/Block.spec.ts +5 -6
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
- package/template/blocks/navigation/Block.vue +16 -26
- package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
- package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
- package/template/blocks/order-status/Block.vue +8 -9
- package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
- package/template/blocks/product-carousel/Block.vue +6 -6
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
- package/template/blocks/product-detail/Block.vue +8 -8
- package/template/blocks/product-detail/__tests__/Block.spec.ts +1 -1
- package/template/blocks/product-detail/parts/Gallery.vue +1 -1
- package/template/blocks/quote/Block.vue +1 -1
- package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
- package/template/blocks/search/Block.vue +2 -2
- package/template/blocks/search/PopularChips.vue +1 -1
- package/template/blocks/split-content/Block.vue +2 -3
- package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
- package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
- package/template/blocks/tabs/Block.vue +4 -5
- package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
- package/template/blocks/testimonials/Block.vue +10 -9
- package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
- package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
- package/template/blocks/trust-strip/Block.vue +1 -1
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
- package/template/blocks/video-embed/Block.vue +3 -3
- package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
- package/template/blocks/wishlist/Block.vue +1 -1
- package/template/nuxt.config.ts +5 -4
- package/template/package.json +1 -0
- package/template/stories/pages/article.stories.ts +2 -3
- package/template/stories/pages/cart.stories.ts +2 -3
- package/template/stories/pages/category.stories.ts +2 -3
- package/template/stories/pages/collection.stories.ts +2 -3
- package/template/stories/pages/home.stories.ts +2 -3
- package/template/stories/pages/product.stories.ts +3 -4
- package/template/stories/pages/products.stories.ts +2 -3
- package/template/stories/pages/search.stories.ts +2 -3
- package/template/stories/pages/wishlist.stories.ts +2 -3
- package/template/test/carouselKeyboard.spec.ts +2 -2
- package/template/test/carouselRing.browser.spec.ts +2 -2
- package/template/test/carouselSlideWidth.browser.spec.ts +9 -9
- package/template/test/eldraIcon.spec.ts +1 -1
- package/template/test/mainCss.spec.ts +7 -0
- package/template/test/pages/article.spec.ts +5 -5
- package/template/test/pages/collection.spec.ts +5 -5
- package/template/test/pages/hydration.spec.ts +10 -10
- package/template/test/prerenderRefresh.browser.spec.ts +1 -1
- package/template/test/support/mountPage.ts +2 -3
|
@@ -417,7 +417,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
417
417
|
spacing="none"
|
|
418
418
|
:labelled-by="variant === 'default' ? headingId : undefined"
|
|
419
419
|
:aria-label="variant === 'minimal' ? t('footer.title') : undefined"
|
|
420
|
-
:
|
|
420
|
+
:class="paddingClass"
|
|
421
421
|
>
|
|
422
422
|
<Container width="wide">
|
|
423
423
|
<VisuallyHidden v-if="variant === 'default'" :id="headingId" as="h2">{{
|
|
@@ -435,8 +435,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
435
435
|
:as="EldraRouterLink"
|
|
436
436
|
variant="standalone"
|
|
437
437
|
:underline="false"
|
|
438
|
+
class="inline-flex items-center hover:no-underline active:no-underline"
|
|
438
439
|
:classes="{
|
|
439
|
-
root: 'inline-flex items-center hover:no-underline active:no-underline',
|
|
440
440
|
label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
|
|
441
441
|
}"
|
|
442
442
|
>
|
|
@@ -470,7 +470,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
470
470
|
target="_blank"
|
|
471
471
|
rel="noopener"
|
|
472
472
|
:label="socialLinkName(social.network)"
|
|
473
|
-
|
|
473
|
+
class="size-11"
|
|
474
474
|
>
|
|
475
475
|
<template #leadingIcon>
|
|
476
476
|
<EldraIcon :name="social.icon" size="md" />
|
|
@@ -502,7 +502,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
502
502
|
:as="link.as"
|
|
503
503
|
tone="muted"
|
|
504
504
|
:underline="false"
|
|
505
|
-
|
|
505
|
+
class="inline-flex min-h-9 items-center text-base"
|
|
506
506
|
>{{ link.label }}</Link
|
|
507
507
|
>
|
|
508
508
|
<span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
|
|
@@ -541,7 +541,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
541
541
|
<FieldWrapper
|
|
542
542
|
:label="emailLabel"
|
|
543
543
|
:error="emailError ?? undefined"
|
|
544
|
-
|
|
544
|
+
class="block w-full"
|
|
545
545
|
>
|
|
546
546
|
<Input
|
|
547
547
|
v-model="email"
|
|
@@ -559,6 +559,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
559
559
|
<Button
|
|
560
560
|
type="submit"
|
|
561
561
|
variant="primary"
|
|
562
|
+
block
|
|
562
563
|
:label="t('footer.subscribing')"
|
|
563
564
|
:aria-describedby="consentSentence ? consentSentenceId : undefined"
|
|
564
565
|
>{{ t('footer.subscribe') }}</Button
|
|
@@ -589,8 +590,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
589
590
|
:as="EldraRouterLink"
|
|
590
591
|
variant="standalone"
|
|
591
592
|
:underline="false"
|
|
593
|
+
class="inline-flex items-center hover:no-underline active:no-underline"
|
|
592
594
|
:classes="{
|
|
593
|
-
root: 'inline-flex items-center hover:no-underline active:no-underline',
|
|
594
595
|
label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
|
|
595
596
|
}"
|
|
596
597
|
>
|
|
@@ -614,7 +615,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
614
615
|
:as="link.as"
|
|
615
616
|
tone="muted"
|
|
616
617
|
:underline="false"
|
|
617
|
-
|
|
618
|
+
class="inline-flex min-h-9 items-center text-base"
|
|
618
619
|
>{{ link.label }}</Link
|
|
619
620
|
>
|
|
620
621
|
<span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
|
|
@@ -634,7 +635,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
634
635
|
target="_blank"
|
|
635
636
|
rel="noopener"
|
|
636
637
|
:label="socialLinkName(social.network)"
|
|
637
|
-
|
|
638
|
+
class="size-11"
|
|
638
639
|
>
|
|
639
640
|
<template #leadingIcon>
|
|
640
641
|
<EldraIcon :name="social.icon" size="md" />
|
|
@@ -658,7 +659,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
658
659
|
:href="link.href"
|
|
659
660
|
:as="link.as"
|
|
660
661
|
tone="muted"
|
|
661
|
-
|
|
662
|
+
class="inline-flex min-h-6 items-center"
|
|
662
663
|
>{{ link.label }}</Link
|
|
663
664
|
>
|
|
664
665
|
<span v-else class="inline-flex min-h-6 items-center">{{ link.label }}</span>
|
|
@@ -670,7 +671,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
670
671
|
<FieldWrapper
|
|
671
672
|
v-if="showLocale"
|
|
672
673
|
:label="t('footer.localeLabel')"
|
|
673
|
-
|
|
674
|
+
class="@tablet:w-auto w-full"
|
|
675
|
+
:classes="{ label: 'sr-only' }"
|
|
674
676
|
>
|
|
675
677
|
<!-- Not `searchable`: a store has a handful of content locales, and a search field
|
|
676
678
|
over three options is one more thing between a visitor and their language. -->
|
|
@@ -693,7 +695,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
|
|
|
693
695
|
<FieldWrapper
|
|
694
696
|
v-else-if="showCurrencySelector"
|
|
695
697
|
:label="t('footer.currencyLabel')"
|
|
696
|
-
|
|
698
|
+
class="@tablet:w-auto w-full"
|
|
699
|
+
:classes="{ label: 'sr-only' }"
|
|
697
700
|
>
|
|
698
701
|
<Select
|
|
699
702
|
v-model="currency"
|
|
@@ -279,7 +279,7 @@ describe('footer block', () => {
|
|
|
279
279
|
const heading = wrapper.find(`#${labelledBy}`);
|
|
280
280
|
expect(heading.element.tagName).toBe('H2');
|
|
281
281
|
expect(heading.text()).toBe(enUS.footer.title);
|
|
282
|
-
expect(heading.classes()).toContain('sr-only');
|
|
282
|
+
expect(heading.classes()).toContain('eldra:sr-only');
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
it('names the <footer> landmark with aria-label directly in the minimal variant (no hidden <h2>)', () => {
|
|
@@ -301,7 +301,7 @@ describe('footer block', () => {
|
|
|
301
301
|
const wrapper = mountFooter(mock);
|
|
302
302
|
const footer = wrapper.find('footer');
|
|
303
303
|
expect(footer.exists()).toBe(true);
|
|
304
|
-
expect(footer.classes()).toContain('
|
|
304
|
+
expect(footer.classes()).toContain('eldra:@container');
|
|
305
305
|
});
|
|
306
306
|
|
|
307
307
|
it('labels the link-groups nav', () => {
|
|
@@ -367,7 +367,7 @@ describe('footer block', () => {
|
|
|
367
367
|
await flushPromises();
|
|
368
368
|
// The field wrapper is `display: contents` by default, which turns its error into a flex item of
|
|
369
369
|
// its own that lands after the button row; a real block keeps the two together.
|
|
370
|
-
const cell = wrapper.get('input[type="email"]').element.closest('.content-start');
|
|
370
|
+
const cell = wrapper.get('input[type="email"]').element.closest('.eldra\\:content-start');
|
|
371
371
|
expect(cell?.parentElement?.classList.contains('block')).toBe(true);
|
|
372
372
|
});
|
|
373
373
|
|
|
@@ -655,7 +655,7 @@ describe('footer block', () => {
|
|
|
655
655
|
|
|
656
656
|
// The content locale is Icelandic here (`locale: 'is-IS'`), so the visually hidden label
|
|
657
657
|
// is `isIS`'s, not `enUS`'s.
|
|
658
|
-
const hiddenLabels = wrapper.findAll('.sr-only').map((el) => el.text());
|
|
658
|
+
const hiddenLabels = wrapper.findAll('.eldra\\:sr-only').map((el) => el.text());
|
|
659
659
|
expect(hiddenLabels).toContain(isIS.footer.currencyLabel);
|
|
660
660
|
|
|
661
661
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
@@ -666,7 +666,7 @@ describe('footer block', () => {
|
|
|
666
666
|
|
|
667
667
|
// No currency text and no combobox of either kind.
|
|
668
668
|
expect(selectTriggers(wrapper)).toHaveLength(0);
|
|
669
|
-
const hiddenLabels = wrapper.findAll('.sr-only').map((el) => el.text());
|
|
669
|
+
const hiddenLabels = wrapper.findAll('.eldra\\:sr-only').map((el) => el.text());
|
|
670
670
|
expect(hiddenLabels).not.toContain(enUS.footer.currencyLabel);
|
|
671
671
|
|
|
672
672
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
@@ -552,7 +552,7 @@ const successTitle = computed(
|
|
|
552
552
|
type="submit"
|
|
553
553
|
variant="primary"
|
|
554
554
|
size="lg"
|
|
555
|
-
class="@two-col:justify-self-end"
|
|
555
|
+
class="@two-col:w-fit @two-col:justify-self-end w-full"
|
|
556
556
|
:label="t('form.submitting')"
|
|
557
557
|
:aria-describedby="consentSentenceId"
|
|
558
558
|
>
|
|
@@ -81,7 +81,7 @@ describe('gallery block', () => {
|
|
|
81
81
|
await flushPromises();
|
|
82
82
|
const frames = wrapper.findAll('[data-part="frame"]');
|
|
83
83
|
expect(frames.length).toBe(withImages.items.length);
|
|
84
|
-
for (const frame of frames) expect(frame.classes()).toContain('rounded-lg');
|
|
84
|
+
for (const frame of frames) expect(frame.classes()).toContain('eldra:rounded-lg');
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* with the image first below that.
|
|
8
8
|
* - `image-background`: a full-bleed image behind a full `overlay` scrim, copy bottom-left. The
|
|
9
9
|
* `Section` itself takes `background="primary"` once there is an image — `@eldrajs/ui`'s own
|
|
10
|
-
* `
|
|
10
|
+
* `data-section="primary"` inversion is what inverts `Button` (and, via
|
|
11
11
|
* `Section`'s base `text-primary-contrast`, the plain copy text) onto the scrim, so nothing
|
|
12
12
|
* here hand-rolls the inversion. With no image yet (`mock.json` never seeds media — see
|
|
13
13
|
* `docs/starter-kit.md`) there is nothing to scrim, so the ground falls back to
|
|
@@ -198,7 +198,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
|
|
|
198
198
|
:background="sectionBackground"
|
|
199
199
|
:spacing="sectionSpacing"
|
|
200
200
|
:labelled-by="sectionLabelledBy"
|
|
201
|
-
:
|
|
201
|
+
:class="sectionRootClass"
|
|
202
202
|
>
|
|
203
203
|
<UiImage
|
|
204
204
|
v-if="hasScrimImage"
|
|
@@ -293,10 +293,10 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
|
|
|
293
293
|
v-else-if="editing"
|
|
294
294
|
inline
|
|
295
295
|
:label="t('hero.imageHintLabel')"
|
|
296
|
-
:
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
:class="[
|
|
297
|
+
'@tablet:aspect-[3/2] @content:aspect-[1/1] bg-surface-strong aspect-[4/3] w-full rounded-xl',
|
|
298
|
+
imageOrderClass,
|
|
299
|
+
]"
|
|
300
300
|
/>
|
|
301
301
|
</template>
|
|
302
302
|
|
|
@@ -317,10 +317,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
|
|
|
317
317
|
v-else-if="editing"
|
|
318
318
|
inline
|
|
319
319
|
:label="t('hero.imageHintLabel')"
|
|
320
|
-
|
|
321
|
-
root: 'aspect-[4/3] @tablet:aspect-[21/9] @content:aspect-[3/1] w-full rounded-xl bg-surface-strong',
|
|
322
|
-
}"
|
|
323
|
-
class="@content:mt-12 mt-8"
|
|
320
|
+
class="@content:mt-12 @tablet:aspect-[21/9] @content:aspect-[3/1] bg-surface-strong mt-8 aspect-[4/3] w-full rounded-xl"
|
|
324
321
|
/>
|
|
325
322
|
</template>
|
|
326
323
|
|
|
@@ -369,7 +366,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
|
|
|
369
366
|
v-else-if="editing"
|
|
370
367
|
inline
|
|
371
368
|
:label="t('hero.imageHintLabel')"
|
|
372
|
-
|
|
369
|
+
class="bg-surface-strong aspect-[4/5] w-full rounded-xl"
|
|
373
370
|
/>
|
|
374
371
|
</template>
|
|
375
372
|
</div>
|
|
@@ -33,12 +33,12 @@ describe('hero block', () => {
|
|
|
33
33
|
* ancestor — `Container` (the block's other wrapper) declares none of its own, so the block's
|
|
34
34
|
* `@content:grid-cols-2`/`@tablet:flex-row`/etc. only ever take effect because `Section`'s own
|
|
35
35
|
* root already carries `@container` (see `Section.vue`). Asserted directly so a future change
|
|
36
|
-
* that swaps the root away from `Section` (or a
|
|
36
|
+
* that swaps the root away from `Section` (or a root `class` that drops it)
|
|
37
37
|
* fails loudly instead of silently keeping every block at its mobile layout at every width.
|
|
38
38
|
*/
|
|
39
39
|
it('the block root carries @container, so its @tablet:/@content: classes have something to measure against', () => {
|
|
40
40
|
const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: mock } }));
|
|
41
|
-
expect(wrapper.get('section').classes()).toContain('
|
|
41
|
+
expect(wrapper.get('section').classes()).toContain('eldra:@container');
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it.each(VARIANTS)(
|
|
@@ -60,8 +60,8 @@ describe('hero block', () => {
|
|
|
60
60
|
mountOptions({ entry: { id: 'e1', data: { ...mock, variant: 'image-background' } } })
|
|
61
61
|
);
|
|
62
62
|
const section = wrapper.get('section');
|
|
63
|
-
expect(section.classes()).toContain('bg-surface-strong');
|
|
64
|
-
expect(section.classes()).not.toContain('text-primary-contrast');
|
|
63
|
+
expect(section.classes()).toContain('eldra:bg-surface-strong');
|
|
64
|
+
expect(section.classes()).not.toContain('eldra:text-primary-contrast');
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
it.each(VARIANTS)(
|
|
@@ -104,7 +104,7 @@ describe('hero block', () => {
|
|
|
104
104
|
Block,
|
|
105
105
|
mountOptions({ entry: { id: 'e1', data: { ...withImage, variant: 'image-right' } } })
|
|
106
106
|
);
|
|
107
|
-
expect(wrapper.get('[data-part="frame"]').classes()).toContain('rounded-xl');
|
|
107
|
+
expect(wrapper.get('[data-part="frame"]').classes()).toContain('eldra:rounded-xl');
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -130,7 +130,9 @@ describe('hero block', () => {
|
|
|
130
130
|
expect(frame.classes()).toEqual(expect.arrayContaining(['h-full', 'w-full']));
|
|
131
131
|
expect(frame.attributes('style')).toContain('aspect-ratio: auto');
|
|
132
132
|
const media = wrapper.get('[data-part="media"]');
|
|
133
|
-
expect(media.classes()).toEqual(
|
|
133
|
+
expect(media.classes()).toEqual(
|
|
134
|
+
expect.arrayContaining(['eldra:object-cover', 'eldra:h-full', 'eldra:w-full'])
|
|
135
|
+
);
|
|
134
136
|
});
|
|
135
137
|
|
|
136
138
|
it('renders no built-in CTAs — the seeded state carries no destination for either', () => {
|
|
@@ -206,7 +208,7 @@ describe('hero block', () => {
|
|
|
206
208
|
expect(figure.attributes('aria-roledescription')).toBe('slide');
|
|
207
209
|
expect(figure.attributes('aria-label')).toBe(`${index + 1} of ${withImage.slides.length}`);
|
|
208
210
|
});
|
|
209
|
-
expect(wrapper.findAll('[data-part="frame"]')[0]?.classes()).toContain('rounded-xl');
|
|
211
|
+
expect(wrapper.findAll('[data-part="frame"]')[0]?.classes()).toContain('eldra:rounded-xl');
|
|
210
212
|
});
|
|
211
213
|
|
|
212
214
|
it('wraps a slide with a same-site link in the router, and leaves an unlinked slide plain', () => {
|
|
@@ -139,7 +139,7 @@ const linkRootClass = computed(() =>
|
|
|
139
139
|
:as="linkAs"
|
|
140
140
|
:underline="false"
|
|
141
141
|
:aria-label="linkAriaLabel"
|
|
142
|
-
:
|
|
142
|
+
:class="linkRootClass"
|
|
143
143
|
>
|
|
144
144
|
<UiImage
|
|
145
145
|
:src="data.image!.url"
|
|
@@ -172,7 +172,7 @@ const linkRootClass = computed(() =>
|
|
|
172
172
|
:icon="PhotoIcon"
|
|
173
173
|
:label="t('imageBlock.hintLabel')"
|
|
174
174
|
:help="t('imageBlock.hintHelp')"
|
|
175
|
-
|
|
175
|
+
class="aspect-[3/2] w-full rounded-none"
|
|
176
176
|
/>
|
|
177
177
|
<Container width="content" class="mt-3">
|
|
178
178
|
<p class="text-muted text-body-sm">{{ t('imageBlock.captionHintLabel') }}</p>
|
|
@@ -188,7 +188,7 @@ const linkRootClass = computed(() =>
|
|
|
188
188
|
:as="linkAs"
|
|
189
189
|
:underline="false"
|
|
190
190
|
:aria-label="linkAriaLabel"
|
|
191
|
-
:
|
|
191
|
+
:class="linkRootClass"
|
|
192
192
|
>
|
|
193
193
|
<UiImage
|
|
194
194
|
:src="data.image!.url"
|
|
@@ -223,7 +223,7 @@ const linkRootClass = computed(() =>
|
|
|
223
223
|
:icon="PhotoIcon"
|
|
224
224
|
:label="t('imageBlock.hintLabel')"
|
|
225
225
|
:help="t('imageBlock.hintHelp')"
|
|
226
|
-
|
|
226
|
+
class="aspect-[3/2] w-full"
|
|
227
227
|
/>
|
|
228
228
|
<p class="text-muted text-body-sm mt-3">{{ t('imageBlock.captionHintLabel') }}</p>
|
|
229
229
|
</template>
|
|
@@ -144,7 +144,6 @@ describe('image block', () => {
|
|
|
144
144
|
it('gives the inset ring class at width: full, and the outer ring elsewhere', () => {
|
|
145
145
|
const full = mountImage({ ...linked, width: 'full' });
|
|
146
146
|
expect(full.get('a').classes()).toContain('eldra-focus-inset');
|
|
147
|
-
expect(full.get('a').classes()).not.toContain('eldra-focus');
|
|
148
147
|
|
|
149
148
|
const content = mountImage({ ...linked, width: 'content' });
|
|
150
149
|
expect(content.get('a').classes()).not.toContain('eldra-focus-inset');
|
|
@@ -159,26 +158,26 @@ describe('image block', () => {
|
|
|
159
158
|
describe('width: full', () => {
|
|
160
159
|
it('renders no Container around the image (edge to edge, no radius)', () => {
|
|
161
160
|
const wrapper = mountImage({ ...withImage, width: 'full' });
|
|
162
|
-
expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('rounded-lg');
|
|
163
|
-
expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('rounded-xl');
|
|
161
|
+
expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('eldra:rounded-lg');
|
|
162
|
+
expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('eldra:rounded-xl');
|
|
164
163
|
});
|
|
165
164
|
|
|
166
165
|
it('sits the caption inside a content-width grid, not against the screen edge', () => {
|
|
167
166
|
const wrapper = mountImage({ ...withImage, width: 'full' });
|
|
168
|
-
expect(wrapper.get('figcaption').classes()).toContain('eldra-container-content');
|
|
167
|
+
expect(wrapper.get('figcaption').classes()).toContain('eldra:eldra-container-content');
|
|
169
168
|
});
|
|
170
169
|
});
|
|
171
170
|
|
|
172
171
|
it('applies the lg radius at every width for narrow', () => {
|
|
173
172
|
const wrapper = mountImage({ ...withImage, width: 'narrow' });
|
|
174
|
-
expect(wrapper.get('[data-part="frame"]').classes()).toContain('rounded-lg');
|
|
173
|
+
expect(wrapper.get('[data-part="frame"]').classes()).toContain('eldra:rounded-lg');
|
|
175
174
|
});
|
|
176
175
|
|
|
177
176
|
it('switches content/wide to the xl radius from 48rem', () => {
|
|
178
177
|
for (const width of ['content', 'wide'] as const) {
|
|
179
178
|
const wrapper = mountImage({ ...withImage, width });
|
|
180
179
|
const frame = wrapper.get('[data-part="frame"]').classes();
|
|
181
|
-
expect(frame).toContain('rounded-lg');
|
|
180
|
+
expect(frame).toContain('eldra:rounded-lg');
|
|
182
181
|
expect(frame).toContain('@tablet:rounded-xl');
|
|
183
182
|
}
|
|
184
183
|
});
|
|
@@ -120,7 +120,7 @@ describe('logo-cloud block', () => {
|
|
|
120
120
|
for (const link of grid.findAll('a')) expect(link.classes()).toContain('h-full');
|
|
121
121
|
|
|
122
122
|
const row = mountBlock({ ...mock, logos, variant: 'row' });
|
|
123
|
-
for (const link of row.findAll('a')) expect(link.classes()).toContain('min-h-16');
|
|
123
|
+
for (const link of row.findAll('a')) expect(link.classes()).toContain('eldra:min-h-16');
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('renders a real <a> for every href — hover is never the only cue that a logo is a link', () => {
|
|
@@ -231,10 +231,8 @@ function openSearch(): void {
|
|
|
231
231
|
* rather than two copies that could drift.
|
|
232
232
|
*
|
|
233
233
|
* `Badge`'s own root carries `min-h-6` and `text-badge` (1.5rem min height, the package's own
|
|
234
|
-
* type-style utility);
|
|
235
|
-
*
|
|
236
|
-
* outright — the later class in the merged string always wins a group, with no `!important` and
|
|
237
|
-
* no need for a `size` prop (`Badge` has none).
|
|
234
|
+
* type-style utility); passed as the Badge's `class`, these app utilities outrank its `eldra:`
|
|
235
|
+
* classes by cascade layer, with no `!important` and no need for a `size` prop (`Badge` has none).
|
|
238
236
|
*/
|
|
239
237
|
const COUNT_PILL_CLASSES =
|
|
240
238
|
'pointer-events-none absolute -top-0.5 -right-0.5 min-h-3.5 min-w-3.5 h-3.5 justify-center ' +
|
|
@@ -549,13 +547,8 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
|
|
|
549
547
|
|
|
550
548
|
/**
|
|
551
549
|
* `@eldrajs/ui`'s `classes` prop takes a plain string per part (`Partial<Record<Part, string>>`),
|
|
552
|
-
* never an array
|
|
553
|
-
*
|
|
554
|
-
* numeric indices as "class names" and their truthy values as "on": an empty-string entry at index
|
|
555
|
-
* 3 (falsy) got dropped and the three truthy entries before it came back out as the class string
|
|
556
|
-
* `"0 1 2"` — every real utility class silently lost. Every conditional class list handed to a
|
|
557
|
-
* `classes` prop in this file is therefore joined into one string with `[...].filter(Boolean).join(' ')`,
|
|
558
|
-
* never left as an array.
|
|
550
|
+
* never an array, so every conditional class list handed to a `classes` prop in this file is
|
|
551
|
+
* joined into one string with `[...].filter(Boolean).join(' ')`.
|
|
559
552
|
*/
|
|
560
553
|
/**
|
|
561
554
|
* Spec "Header" → Container/Section line: "Section background default `background` … Section
|
|
@@ -565,7 +558,7 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
|
|
|
565
558
|
* top padding, and the header must never trigger that rule against the block that follows it (a
|
|
566
559
|
* Hero, most often) — the header is fixed chrome that always sits at the page's own ground, not a
|
|
567
560
|
* coloured band the padding-collapse rule is meant to read as one continuous band with its
|
|
568
|
-
* neighbour. It also never needs `Section`'s `
|
|
561
|
+
* neighbour. It also never needs `Section`'s `data-section` colour-inversion machinery: `background`
|
|
569
562
|
* is always `none` here, and transparent-over-hero mode is handled entirely by `barRootClasses`
|
|
570
563
|
* above, not by `Section`'s `primary`/`accent` invert. `@container` is kept directly on this root so
|
|
571
564
|
* `Container` and every `@content:`/`@tablet:` variant below still measure the header's own width.
|
|
@@ -652,8 +645,6 @@ const actionsPositionClass = computed(() =>
|
|
|
652
645
|
|
|
653
646
|
/** What this header draws differently from `NavMenu`'s own look, part by part. */
|
|
654
647
|
const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
655
|
-
// `contents`: the bar and the Menu button become cells of the grid, which then positions panels.
|
|
656
|
-
root: 'static contents',
|
|
657
648
|
nav: `self-stretch ${linksPositionClass.value}`,
|
|
658
649
|
list: variant.value === 'centered' ? 'h-full flex-nowrap justify-center' : 'h-full flex-nowrap',
|
|
659
650
|
link: 'text-sm',
|
|
@@ -698,9 +689,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
698
689
|
variant="standalone"
|
|
699
690
|
:underline="false"
|
|
700
691
|
data-eldra-header-focus
|
|
701
|
-
:
|
|
702
|
-
root: `flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1 font-heading text-lg font-bold tracking-tight ${brandPositionClass}`,
|
|
703
|
-
}"
|
|
692
|
+
:class="`font-heading flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1 text-lg font-bold tracking-tight ${brandPositionClass}`"
|
|
704
693
|
>
|
|
705
694
|
<img
|
|
706
695
|
v-if="brandLogoUrl"
|
|
@@ -730,6 +719,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
730
719
|
open-on-hover
|
|
731
720
|
:link-as="MenuLink"
|
|
732
721
|
:messages="navMenuMessages"
|
|
722
|
+
class="static contents"
|
|
733
723
|
:classes="navMenuClasses"
|
|
734
724
|
>
|
|
735
725
|
<template #toggle>
|
|
@@ -745,7 +735,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
745
735
|
arrow
|
|
746
736
|
data-eldra-mega-view-all
|
|
747
737
|
:aria-label="t('header.viewAllOf', { label: item.label ?? '' })"
|
|
748
|
-
|
|
738
|
+
class="text-sm"
|
|
749
739
|
>
|
|
750
740
|
{{ t('header.viewAll') }}
|
|
751
741
|
</Link>
|
|
@@ -760,7 +750,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
760
750
|
v-if="showLinksPlaceholder"
|
|
761
751
|
inline
|
|
762
752
|
:label="t('editor.addLink')"
|
|
763
|
-
:
|
|
753
|
+
:class="`@content:flex hidden ${linksPositionClass}`"
|
|
764
754
|
/>
|
|
765
755
|
|
|
766
756
|
<!-- `justify-end` matters in exactly one case and is inert in every other: with no Menu
|
|
@@ -788,7 +778,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
788
778
|
variant="outline"
|
|
789
779
|
size="sm"
|
|
790
780
|
aria-haspopup="dialog"
|
|
791
|
-
|
|
781
|
+
class="@content:inline-flex hidden rounded-full"
|
|
792
782
|
@click="openSearch"
|
|
793
783
|
>
|
|
794
784
|
{{ t('header.searchField') }}
|
|
@@ -800,7 +790,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
800
790
|
icon-only
|
|
801
791
|
:label="t('header.search')"
|
|
802
792
|
aria-haspopup="dialog"
|
|
803
|
-
|
|
793
|
+
class="@content:hidden"
|
|
804
794
|
@click="openSearch"
|
|
805
795
|
>
|
|
806
796
|
<template #leadingIcon>
|
|
@@ -817,7 +807,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
817
807
|
:label="t('header.searchField')"
|
|
818
808
|
:results="searchResults"
|
|
819
809
|
:loading="searchLoading"
|
|
820
|
-
|
|
810
|
+
class="@content:block hidden w-64"
|
|
821
811
|
/>
|
|
822
812
|
<Button
|
|
823
813
|
variant="ghost"
|
|
@@ -825,7 +815,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
825
815
|
icon-only
|
|
826
816
|
:label="t('header.search')"
|
|
827
817
|
aria-haspopup="dialog"
|
|
828
|
-
|
|
818
|
+
class="@content:hidden"
|
|
829
819
|
@click="openSearch"
|
|
830
820
|
>
|
|
831
821
|
<template #leadingIcon>
|
|
@@ -862,7 +852,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
862
852
|
tone="primary"
|
|
863
853
|
pill
|
|
864
854
|
:label="wishlistBadgeLabel"
|
|
865
|
-
:
|
|
855
|
+
:class="COUNT_PILL_CLASSES"
|
|
866
856
|
/>
|
|
867
857
|
</span>
|
|
868
858
|
|
|
@@ -887,7 +877,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
887
877
|
tone="primary"
|
|
888
878
|
pill
|
|
889
879
|
:label="cartBadgeLabel"
|
|
890
|
-
:
|
|
880
|
+
:class="COUNT_PILL_CLASSES"
|
|
891
881
|
/>
|
|
892
882
|
</span>
|
|
893
883
|
|
|
@@ -900,7 +890,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
|
|
|
900
890
|
size="sm"
|
|
901
891
|
:href="ctaHref"
|
|
902
892
|
:as="ctaLinkAs"
|
|
903
|
-
|
|
893
|
+
class="@content:inline-flex @content:ml-2 hidden"
|
|
904
894
|
>
|
|
905
895
|
{{ ctaLabel }}
|
|
906
896
|
</Button>
|
|
@@ -1412,12 +1412,14 @@ describe('header block (navigation apiId)', () => {
|
|
|
1412
1412
|
});
|
|
1413
1413
|
const trigger = wrapper.findAll('button').find((b) => b.text().includes('Workshop'))!;
|
|
1414
1414
|
// Ungrouped children still make a sheet across the header, not a dropdown under the trigger.
|
|
1415
|
-
expect(wrapper.get(`#${trigger.attributes('aria-controls')}`).classes()).toContain(
|
|
1415
|
+
expect(wrapper.get(`#${trigger.attributes('aria-controls')}`).classes()).toContain(
|
|
1416
|
+
'eldra:inset-x-0'
|
|
1417
|
+
);
|
|
1416
1418
|
const footer = wrapper.get(`#${trigger.attributes('aria-controls')} [data-part="footer"]`);
|
|
1417
1419
|
// `:empty` as a browser reads it (jsdom counts Vue's empty anchors; `@eldrajs/ui`'s browser spec proves it).
|
|
1418
1420
|
expect(footer.element.children).toHaveLength(0);
|
|
1419
1421
|
expect(footer.element.textContent).toBe('');
|
|
1420
|
-
expect(footer.classes()).toContain('empty:hidden');
|
|
1422
|
+
expect(footer.classes()).toContain('eldra:empty:hidden');
|
|
1421
1423
|
});
|
|
1422
1424
|
|
|
1423
1425
|
it('is axe-clean in every variant with the drawer open, and with a mega-menu open where the bar has one', async () => {
|
|
@@ -1447,7 +1449,7 @@ describe('header block (navigation apiId)', () => {
|
|
|
1447
1449
|
expect(toggle.classes().some((token) => token.endsWith(':hidden'))).toBe(false);
|
|
1448
1450
|
// The default variant hides it once the bar has room for its links.
|
|
1449
1451
|
const bar = mountBlock(resolved.data).get('[data-part="toggle"]');
|
|
1450
|
-
expect(bar.classes()).toContain('
|
|
1452
|
+
expect(bar.classes()).toContain('eldra:@content:hidden');
|
|
1451
1453
|
});
|
|
1452
1454
|
|
|
1453
1455
|
it('renders 8 links with no overflow markup errors', async () => {
|
|
@@ -1486,33 +1488,34 @@ describe('header block (navigation apiId)', () => {
|
|
|
1486
1488
|
// The bar's grid is the panel's positioning box; the menu's own root takes no box at all.
|
|
1487
1489
|
expect(wrapper.get('[data-eldra-header-bar]').classes()).toContain('relative');
|
|
1488
1490
|
const root = [...menuRoot(wrapper).classList];
|
|
1491
|
+
expect(root).toContain('static');
|
|
1489
1492
|
expect(root).toContain('contents');
|
|
1490
|
-
expect(root).not.toContain('relative');
|
|
1491
1493
|
// …and no row of the bar may reclaim it, or the panel would hang under its own item again.
|
|
1492
1494
|
for (const row of wrapper.findAll('[data-part="item"]')) {
|
|
1493
|
-
expect(row.classes()).not.toContain('relative');
|
|
1495
|
+
expect(row.classes()).not.toContain('eldra:relative');
|
|
1494
1496
|
}
|
|
1495
1497
|
|
|
1496
1498
|
const knitwear = wrapper.findAll('button').find((b) => b.text().includes('Knitwear'))!;
|
|
1497
1499
|
await knitwear.trigger('click');
|
|
1498
1500
|
const panel = wrapper.get(`#${knitwear.attributes('aria-controls')}`);
|
|
1499
1501
|
// Flush under the bar: no offset of its own.
|
|
1500
|
-
for (const token of ['absolute', 'top-full', 'inset-x-0', 'pt-0']) {
|
|
1502
|
+
for (const token of ['eldra:absolute', 'eldra:top-full', 'eldra:inset-x-0', 'pt-0']) {
|
|
1501
1503
|
expect(panel.classes()).toContain(token);
|
|
1502
1504
|
}
|
|
1503
1505
|
// A width of its own is exactly what the old panel had, and what made it feel arbitrary.
|
|
1504
|
-
|
|
1505
|
-
expect(
|
|
1506
|
+
const panelTokens = panel.classes().map((token) => token.replace(/^eldra:/, ''));
|
|
1507
|
+
expect(panelTokens).not.toContain('w-screen');
|
|
1508
|
+
expect(panelTokens.some((token) => token.startsWith('max-w-'))).toBe(false);
|
|
1506
1509
|
// The bar's own bottom border is the sheet's top edge, so only the other three sides and corners are drawn.
|
|
1507
1510
|
const sheet = panel.get('[data-part="content"]').classes();
|
|
1508
1511
|
for (const token of [
|
|
1509
|
-
'border',
|
|
1512
|
+
'eldra:border',
|
|
1510
1513
|
'border-t-0',
|
|
1511
|
-
'border-border',
|
|
1514
|
+
'eldra:border-border',
|
|
1512
1515
|
'rounded-none',
|
|
1513
1516
|
'rounded-b-lg',
|
|
1514
1517
|
'shadow-(--eldra-shadow-float)',
|
|
1515
|
-
'p-6',
|
|
1518
|
+
'eldra:p-6',
|
|
1516
1519
|
'@wide:p-8',
|
|
1517
1520
|
]) {
|
|
1518
1521
|
expect(sheet).toContain(token);
|
|
@@ -1522,9 +1525,10 @@ describe('header block (navigation apiId)', () => {
|
|
|
1522
1525
|
// the panel's own edges — 24px, 32px once the container passes `wide`. The browser case
|
|
1523
1526
|
// measures what this produces; here it is only the arrangement.
|
|
1524
1527
|
const columns = panel.get('[data-part="columns"]').classes();
|
|
1525
|
-
for (const token of ['grid', 'grid-cols-12', 'gap-6']) {
|
|
1528
|
+
for (const token of ['eldra:grid', 'grid-cols-12', 'gap-6']) {
|
|
1526
1529
|
expect(columns).toContain(token);
|
|
1527
1530
|
}
|
|
1531
|
+
expect(sheet).not.toContain('eldra:py-8');
|
|
1528
1532
|
expect(sheet).not.toContain('py-8');
|
|
1529
1533
|
wrapper.unmount();
|
|
1530
1534
|
});
|
|
@@ -1557,7 +1561,7 @@ describe('header block (navigation apiId)', () => {
|
|
|
1557
1561
|
expect(viewAll.attributes('aria-label')).toBe('View all Knitwear');
|
|
1558
1562
|
// Right-aligned under a rule across the content width: it follows the columns, outside their grid.
|
|
1559
1563
|
const row = viewAll.element.parentElement!;
|
|
1560
|
-
for (const token of ['justify-end', 'border-t', 'border-border', 'pt-4']) {
|
|
1564
|
+
for (const token of ['justify-end', 'eldra:border-t', 'eldra:border-border', 'eldra:pt-4']) {
|
|
1561
1565
|
expect([...row.classList]).toContain(token);
|
|
1562
1566
|
}
|
|
1563
1567
|
expect(row.previousElementSibling?.getAttribute('data-part')).toBe('columns');
|
|
@@ -1583,8 +1587,6 @@ describe('header block (navigation apiId)', () => {
|
|
|
1583
1587
|
await knitwear.trigger('click');
|
|
1584
1588
|
const sheet = wrapper.get(`#${knitwear.attributes('aria-controls')} [data-part="content"]`);
|
|
1585
1589
|
expect(sheet.classes()).toContain('bg-(--eldra-header-surface)');
|
|
1586
|
-
// And no ground token of its own left behind to drift away from the bar's.
|
|
1587
|
-
expect(sheet.classes()).not.toContain('bg-background');
|
|
1588
1590
|
wrapper.unmount();
|
|
1589
1591
|
});
|
|
1590
1592
|
|
|
@@ -1611,7 +1613,7 @@ describe('header block (navigation apiId)', () => {
|
|
|
1611
1613
|
await knitwear.trigger('click');
|
|
1612
1614
|
expect(knitwear.attributes('aria-expanded')).toBe('true');
|
|
1613
1615
|
expect(panel().get('[data-part="content"]').classes(), 'enter').toContain(
|
|
1614
|
-
'animate-eldra-popover-in'
|
|
1616
|
+
'eldra:animate-eldra-popover-in'
|
|
1615
1617
|
);
|
|
1616
1618
|
|
|
1617
1619
|
await knitwear.trigger('click');
|
|
@@ -1619,10 +1621,10 @@ describe('header block (navigation apiId)', () => {
|
|
|
1619
1621
|
// of a `<Transition>` over a bare `v-show` — but a click on the fading sheet goes through it.
|
|
1620
1622
|
expect(knitwear.attributes('aria-expanded')).toBe('false');
|
|
1621
1623
|
for (const token of [
|
|
1622
|
-
'pointer-events-none',
|
|
1623
|
-
'transition-opacity',
|
|
1624
|
-
'duration-fast',
|
|
1625
|
-
'ease-in',
|
|
1624
|
+
'eldra:pointer-events-none',
|
|
1625
|
+
'eldra:transition-opacity',
|
|
1626
|
+
'eldra:duration-fast',
|
|
1627
|
+
'eldra:ease-in',
|
|
1626
1628
|
]) {
|
|
1627
1629
|
expect(panel().classes(), 'leave').toContain(token);
|
|
1628
1630
|
}
|