@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
|
@@ -118,7 +118,7 @@ describe('breadcrumbs block', () => {
|
|
|
118
118
|
async (container) => {
|
|
119
119
|
const wrapper = mountBlock({ ...mock, container });
|
|
120
120
|
const wideOrContent =
|
|
121
|
-
container === 'wide' ? 'eldra-container-wide' : 'eldra-container-content';
|
|
121
|
+
container === 'wide' ? 'eldra:eldra-container-wide' : 'eldra:eldra-container-content';
|
|
122
122
|
expect(wrapper.getComponent(Container).classes()).toContain(wideOrContent);
|
|
123
123
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
124
124
|
}
|
|
@@ -189,20 +189,20 @@ describe('breadcrumbs block', () => {
|
|
|
189
189
|
|
|
190
190
|
const hiddenLevels = wrapper
|
|
191
191
|
.findAll('[data-part="item"]')
|
|
192
|
-
.filter((item) => item.classes().includes('
|
|
192
|
+
.filter((item) => item.classes().includes('eldra:@max-tablet:hidden'));
|
|
193
193
|
expect(hiddenLevels.map((item) => item.text())).toEqual(['Kitchen', 'Table & serving']);
|
|
194
194
|
});
|
|
195
195
|
|
|
196
196
|
it('reaches Home, then the "…" button, then the parent, in that order', () => {
|
|
197
|
-
// The collapsed middle levels carry
|
|
198
|
-
// not evaluate — there is no real layout — so "reaches" is asserted the same way
|
|
199
|
-
// package's own Breadcrumb.spec.ts does: by document order over the levels that are
|
|
200
|
-
// collapse-hidden, which below the 48rem collapse threshold is exactly the operable Tab
|
|
201
|
-
// a real browser gives (a `display:none` element is never a Tab stop).
|
|
197
|
+
// The collapsed middle levels carry `eldra:@max-tablet:hidden` (a container-query class
|
|
198
|
+
// jsdom does not evaluate — there is no real layout — so "reaches" is asserted the same way
|
|
199
|
+
// the package's own Breadcrumb.spec.ts does: by document order over the levels that are
|
|
200
|
+
// *not* collapse-hidden, which below the 48rem collapse threshold is exactly the operable Tab
|
|
201
|
+
// path a real browser gives (a `display:none` element is never a Tab stop).
|
|
202
202
|
const wrapper = mountBlock(deepTrailData);
|
|
203
203
|
const visibleFocusable = wrapper
|
|
204
204
|
.findAll('[data-part="item"]')
|
|
205
|
-
.filter((item) => !item.classes().includes('
|
|
205
|
+
.filter((item) => !item.classes().includes('eldra:@max-tablet:hidden'))
|
|
206
206
|
.map((item) => {
|
|
207
207
|
const link = item.find('[data-part="link"]');
|
|
208
208
|
if (link.exists()) return link.text();
|
|
@@ -239,7 +239,7 @@ describe('breadcrumbs block', () => {
|
|
|
239
239
|
|
|
240
240
|
expect(wrapper.find('[data-part="ellipsis"]').exists()).toBe(false);
|
|
241
241
|
for (const item of wrapper.findAll('[data-part="item"]')) {
|
|
242
|
-
expect(item.classes()).not.toContain('
|
|
242
|
+
expect(item.classes()).not.toContain('eldra:@max-tablet:hidden');
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
const links = wrapper.findAll('[data-part="link"]');
|
|
@@ -271,7 +271,7 @@ const DRAWER_CLASSES = {
|
|
|
271
271
|
<span class="text-text text-base font-semibold">{{ t('cart.subtotal') }}</span>
|
|
272
272
|
<Price
|
|
273
273
|
:amount="money.minor(subtotal)"
|
|
274
|
-
|
|
274
|
+
class="text-text text-base font-semibold tabular-nums"
|
|
275
275
|
/>
|
|
276
276
|
</div>
|
|
277
277
|
<p v-if="note" class="text-muted text-body-sm text-center">{{ note }}</p>
|
|
@@ -207,7 +207,8 @@ const STEPPER_CLASSES = {
|
|
|
207
207
|
<Price
|
|
208
208
|
:amount="money.minor(line.unitPrice)"
|
|
209
209
|
size="sm"
|
|
210
|
-
|
|
210
|
+
class="inline"
|
|
211
|
+
:classes="{ current: 'text-muted' }"
|
|
211
212
|
/>
|
|
212
213
|
<span class="text-muted">{{ t('cart.each') }}</span>
|
|
213
214
|
</div>
|
|
@@ -218,7 +219,7 @@ const STEPPER_CLASSES = {
|
|
|
218
219
|
:aria-busy="busy"
|
|
219
220
|
>
|
|
220
221
|
<VisuallyHidden>{{ t('cart.lineTotal') }}</VisuallyHidden>
|
|
221
|
-
<Price :amount="money.minor(line.lineTotal)"
|
|
222
|
+
<Price :amount="money.minor(line.lineTotal)" class="inline" />
|
|
222
223
|
</div>
|
|
223
224
|
|
|
224
225
|
<div
|
|
@@ -90,7 +90,7 @@ const rootClass = computed(() =>
|
|
|
90
90
|
</template>
|
|
91
91
|
<template v-else>
|
|
92
92
|
<span>{{ awayParts.before }}</span>
|
|
93
|
-
<Price :amount="money.minor(remaining)"
|
|
93
|
+
<Price :amount="money.minor(remaining)" class="inline font-semibold" />
|
|
94
94
|
<span>{{ awayParts.after }}</span>
|
|
95
95
|
</template>
|
|
96
96
|
</div>
|
|
@@ -229,7 +229,7 @@ const VALUE_CLASS = 'text-text text-body-sm font-medium tabular-nums';
|
|
|
229
229
|
<div :class="ROW_CLASS">
|
|
230
230
|
<dt :class="LABEL_CLASS">{{ t('cart.subtotal') }}</dt>
|
|
231
231
|
<dd :class="VALUE_CLASS">
|
|
232
|
-
<Price :amount="money.minor(totals.subtotal)" size="sm"
|
|
232
|
+
<Price :amount="money.minor(totals.subtotal)" size="sm" class="inline" />
|
|
233
233
|
</dd>
|
|
234
234
|
</div>
|
|
235
235
|
<div v-if="discount" :class="ROW_CLASS">
|
|
@@ -238,7 +238,8 @@ const VALUE_CLASS = 'text-text text-body-sm font-medium tabular-nums';
|
|
|
238
238
|
<Price
|
|
239
239
|
:amount="money.minor(-discount.amount)"
|
|
240
240
|
size="sm"
|
|
241
|
-
|
|
241
|
+
class="inline"
|
|
242
|
+
:classes="{ current: 'text-success' }"
|
|
242
243
|
/>
|
|
243
244
|
</dd>
|
|
244
245
|
</div>
|
|
@@ -247,18 +248,13 @@ const VALUE_CLASS = 'text-text text-body-sm font-medium tabular-nums';
|
|
|
247
248
|
<dd :class="VALUE_CLASS">
|
|
248
249
|
<span v-if="totals.shipping === null">{{ t('cart.shippingPending') }}</span>
|
|
249
250
|
<span v-else-if="totals.shipping === 0">{{ t('cart.shippingFree') }}</span>
|
|
250
|
-
<Price
|
|
251
|
-
v-else
|
|
252
|
-
:amount="money.minor(totals.shipping)"
|
|
253
|
-
size="sm"
|
|
254
|
-
:classes="{ root: 'inline' }"
|
|
255
|
-
/>
|
|
251
|
+
<Price v-else :amount="money.minor(totals.shipping)" size="sm" class="inline" />
|
|
256
252
|
</dd>
|
|
257
253
|
</div>
|
|
258
254
|
<div class="border-border flex items-baseline justify-between gap-4 border-t pt-3">
|
|
259
255
|
<dt class="text-text text-base font-semibold">{{ t('cart.total') }}</dt>
|
|
260
256
|
<dd class="text-text text-base font-semibold tabular-nums">
|
|
261
|
-
<Price :amount="money.minor(totals.total)"
|
|
257
|
+
<Price :amount="money.minor(totals.total)" class="inline" />
|
|
262
258
|
</dd>
|
|
263
259
|
</div>
|
|
264
260
|
</dl>
|
|
@@ -135,7 +135,7 @@ const SortIcon = iconComponent('arrows-sort');
|
|
|
135
135
|
* the width it is: two tracks of 14rem plus a gap do not fit a phone, and the card's minimum
|
|
136
136
|
* would push the second column off the edge. The track decides the width here, as in the carousel.
|
|
137
137
|
*/
|
|
138
|
-
const
|
|
138
|
+
const CARD_CLASS = 'min-w-0';
|
|
139
139
|
/** The freshly-inserted editor hint's box icon (spec States, "Empty (freshly inserted)"). */
|
|
140
140
|
const BoxIcon = iconComponent('box');
|
|
141
141
|
|
|
@@ -1605,7 +1605,7 @@ function hrefForPage(page: number): string {
|
|
|
1605
1605
|
v-if="hasCollection || showNoCollectionHint || showNoCategoryHint"
|
|
1606
1606
|
spacing="none"
|
|
1607
1607
|
:aria-label="sectionLabel"
|
|
1608
|
-
|
|
1608
|
+
class="pt-6 pb-[var(--eldra-section-md)]"
|
|
1609
1609
|
>
|
|
1610
1610
|
<Container width="wide">
|
|
1611
1611
|
<EditorPlaceholder
|
|
@@ -1662,7 +1662,7 @@ function hrefForPage(page: number): string {
|
|
|
1662
1662
|
v-if="hasFilters"
|
|
1663
1663
|
variant="outline"
|
|
1664
1664
|
:icon-left="AdjustmentsIcon"
|
|
1665
|
-
|
|
1665
|
+
class="min-h-11"
|
|
1666
1666
|
aria-haspopup="dialog"
|
|
1667
1667
|
:aria-expanded="drawerOpen ? 'true' : 'false'"
|
|
1668
1668
|
:aria-controls="drawerId"
|
|
@@ -1673,7 +1673,7 @@ function hrefForPage(page: number): string {
|
|
|
1673
1673
|
v-if="activeCount > 0"
|
|
1674
1674
|
tone="primary"
|
|
1675
1675
|
pill
|
|
1676
|
-
|
|
1676
|
+
class="ms-1"
|
|
1677
1677
|
:hidden-suffix="t('grid.nActive', { count: activeCount })"
|
|
1678
1678
|
>
|
|
1679
1679
|
<span aria-hidden="true">{{ activeCount }}</span>
|
|
@@ -1682,7 +1682,8 @@ function hrefForPage(page: number): string {
|
|
|
1682
1682
|
<FieldWrapper
|
|
1683
1683
|
v-if="hasSort"
|
|
1684
1684
|
:label="t('grid.sortBy')"
|
|
1685
|
-
:
|
|
1685
|
+
:class="TOP_BAR_SORT"
|
|
1686
|
+
:classes="{ label: 'sr-only' }"
|
|
1686
1687
|
>
|
|
1687
1688
|
<Select
|
|
1688
1689
|
:model-value="sort"
|
|
@@ -1710,10 +1711,8 @@ function hrefForPage(page: number): string {
|
|
|
1710
1711
|
<FieldWrapper
|
|
1711
1712
|
v-if="hasSort"
|
|
1712
1713
|
:label="t('grid.sortBy')"
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
label: 'text-body-sm text-muted mb-0 shrink-0 font-medium',
|
|
1716
|
-
}"
|
|
1714
|
+
class="flex items-center gap-2"
|
|
1715
|
+
:classes="{ label: 'text-body-sm text-muted mb-0 shrink-0 font-medium' }"
|
|
1717
1716
|
>
|
|
1718
1717
|
<Select
|
|
1719
1718
|
:model-value="sort"
|
|
@@ -1725,10 +1724,8 @@ function hrefForPage(page: number): string {
|
|
|
1725
1724
|
<FieldWrapper
|
|
1726
1725
|
v-if="showColumnSelect"
|
|
1727
1726
|
:label="t('grid.columns')"
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
label: 'text-body-sm text-muted mb-0 shrink-0 font-medium',
|
|
1731
|
-
}"
|
|
1727
|
+
class="flex items-center gap-2"
|
|
1728
|
+
:classes="{ label: 'text-body-sm text-muted mb-0 shrink-0 font-medium' }"
|
|
1732
1729
|
>
|
|
1733
1730
|
<Select
|
|
1734
1731
|
:model-value="columnsChoice"
|
|
@@ -1780,7 +1777,7 @@ function hrefForPage(page: number): string {
|
|
|
1780
1777
|
:product="entry.product"
|
|
1781
1778
|
ratio="4x5"
|
|
1782
1779
|
:heading-level="3"
|
|
1783
|
-
:
|
|
1780
|
+
:class="CARD_CLASS"
|
|
1784
1781
|
:quick-add="false"
|
|
1785
1782
|
:revalidating="entry.revalidating"
|
|
1786
1783
|
:announce="false"
|
|
@@ -290,7 +290,7 @@ const SEEDED_GROUPS = 5;
|
|
|
290
290
|
/** The grid's single visually hidden live region for the volatile refresh. The count line above
|
|
291
291
|
* and `LoadMore`'s own "Showing N of M" are the block's other `role="status"` elements, and both
|
|
292
292
|
* are visible — this is the only hidden one. */
|
|
293
|
-
const liveRegion = (wrapper: VueWrapper) => wrapper.get('p.sr-only[role="status"]');
|
|
293
|
+
const liveRegion = (wrapper: VueWrapper) => wrapper.get('p.eldra\\:sr-only[role="status"]');
|
|
294
294
|
/** The grid itself: the list of product cards (never the skeleton list, which is aria-hidden). */
|
|
295
295
|
const cards = (wrapper: VueWrapper) =>
|
|
296
296
|
wrapper.findAll('ul[aria-labelledby]:not([aria-hidden]) > li');
|
|
@@ -388,7 +388,7 @@ describe('collection-grid block', () => {
|
|
|
388
388
|
const h2 = wrapper
|
|
389
389
|
.findAll('h2')
|
|
390
390
|
.find((candidate) => candidate.text() === enUS.grid.products)!;
|
|
391
|
-
expect(h2.classes()).toContain('sr-only');
|
|
391
|
+
expect(h2.classes()).toContain('eldra:sr-only');
|
|
392
392
|
|
|
393
393
|
const titles = wrapper.findAll('h3');
|
|
394
394
|
expect(titles.some((title) => title.text() === 'Merino crew sweater')).toBe(true);
|
|
@@ -421,7 +421,7 @@ describe('collection-grid block', () => {
|
|
|
421
421
|
const { trigger, panel } = panelFor(wrapper, legend);
|
|
422
422
|
expect(trigger.attributes('aria-expanded')).toBe('true');
|
|
423
423
|
expect(panel.element.tagName).toBe('FIELDSET');
|
|
424
|
-
expect(panel.get('legend').classes()).toContain('sr-only');
|
|
424
|
+
expect(panel.get('legend').classes()).toContain('eldra:sr-only');
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
427
|
|
|
@@ -488,12 +488,12 @@ describe('collection-grid block', () => {
|
|
|
488
488
|
const dot = row.get('span');
|
|
489
489
|
const name = row.get('[data-part="rowLabel"]');
|
|
490
490
|
|
|
491
|
-
expect(dot.classes()).toContain('border-transparent');
|
|
492
|
-
expect(name.classes()).not.toContain('font-semibold');
|
|
491
|
+
expect(dot.classes()).toContain('eldra:border-transparent');
|
|
492
|
+
expect(name.classes()).not.toContain('eldra:font-semibold');
|
|
493
493
|
await input.setValue(true);
|
|
494
494
|
|
|
495
|
-
expect(dot.classes()).toContain('border-text');
|
|
496
|
-
expect(name.classes()).toContain('font-semibold');
|
|
495
|
+
expect(dot.classes()).toContain('eldra:border-text');
|
|
496
|
+
expect(name.classes()).toContain('eldra:font-semibold');
|
|
497
497
|
});
|
|
498
498
|
|
|
499
499
|
/**
|
|
@@ -1249,7 +1249,7 @@ describe('collection-grid block', () => {
|
|
|
1249
1249
|
await wrapper.vm.$nextTick();
|
|
1250
1250
|
const soldOut = cards(wrapper).find((card) => card.text().includes('Linen tea towels'))!;
|
|
1251
1251
|
expect(soldOut.text()).toContain('Sold out');
|
|
1252
|
-
expect(soldOut.get('img').classes()).toContain('opacity-60');
|
|
1252
|
+
expect(soldOut.get('img').classes()).toContain('eldra:opacity-60');
|
|
1253
1253
|
});
|
|
1254
1254
|
|
|
1255
1255
|
/**
|
|
@@ -1293,7 +1293,7 @@ describe('collection-grid block', () => {
|
|
|
1293
1293
|
const loadMore = wrapper.get('[data-part="button"]');
|
|
1294
1294
|
const bar = wrapper
|
|
1295
1295
|
.findAll('div[aria-hidden="true"]')
|
|
1296
|
-
.find((div) => div.classes().includes('rounded-full'))!;
|
|
1296
|
+
.find((div) => div.classes().includes('eldra:rounded-full'))!;
|
|
1297
1297
|
expect(bar.attributes('aria-hidden')).toBe('true');
|
|
1298
1298
|
|
|
1299
1299
|
loadMore.element.focus();
|
|
@@ -1432,9 +1432,8 @@ describe('collection-grid block', () => {
|
|
|
1432
1432
|
// background fill, supplied by the Drawer's own chrome.
|
|
1433
1433
|
expect(footer.classes()).toContain('grid');
|
|
1434
1434
|
expect(footer.classes()).toContain('grid-cols-[auto_1fr]');
|
|
1435
|
-
expect(footer.classes()).
|
|
1436
|
-
expect(footer.classes()).toContain('
|
|
1437
|
-
expect(footer.classes()).toContain('bg-background');
|
|
1435
|
+
expect(footer.classes()).toContain('eldra:border-t');
|
|
1436
|
+
expect(footer.classes()).toContain('eldra:bg-background');
|
|
1438
1437
|
|
|
1439
1438
|
const footerButtons = footer.findAll('button');
|
|
1440
1439
|
expect(footerButtons.map((button) => button.text())).toEqual([
|
|
@@ -2600,7 +2599,7 @@ describe('collection-grid block', () => {
|
|
|
2600
2599
|
await wrapper.vm.$nextTick();
|
|
2601
2600
|
|
|
2602
2601
|
expect(liveRegion(wrapper).text()).toBe(enUS.storefront.updatingValues);
|
|
2603
|
-
expect(wrapper.findAll('p.sr-only[role="status"]')).toHaveLength(1);
|
|
2602
|
+
expect(wrapper.findAll('p.eldra\\:sr-only[role="status"]')).toHaveLength(1);
|
|
2604
2603
|
// `announce: false` on every card — the per-value regions are gone, not merely empty.
|
|
2605
2604
|
expect(wrapper.findAll('[data-part="srStatus"]')).toHaveLength(0);
|
|
2606
2605
|
expect(
|
|
@@ -3145,7 +3144,6 @@ describe('collection-grid — card width on a phone', () => {
|
|
|
3145
3144
|
// The card's own root is the list item's first element; `cards()` answers the items.
|
|
3146
3145
|
const root = cards(wrapper)[0]!.element.firstElementChild as HTMLElement;
|
|
3147
3146
|
expect(root.className).toContain('min-w-0');
|
|
3148
|
-
expect(root.className).not.toMatch(/\bmin-w-56\b/);
|
|
3149
3147
|
wrapper.unmount();
|
|
3150
3148
|
});
|
|
3151
3149
|
});
|
|
@@ -402,9 +402,9 @@ function pillClass(pill: ResolvedPill): string {
|
|
|
402
402
|
* carry these exact asymmetric steps, so `spacing="none"` on `Section` and the padding is written
|
|
403
403
|
* here — the same pattern `footer`'s own `paddingClass` uses. */
|
|
404
404
|
const PADDING_CLASS = 'pt-6 pb-8 @tablet:pt-8 @tablet:pb-12';
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
const sectionClass = computed(() =>
|
|
406
|
+
isImageVariant.value ? PADDING_CLASS : `${PADDING_CLASS} border-border border-b`
|
|
407
|
+
);
|
|
408
408
|
|
|
409
409
|
const rootClass = computed(() =>
|
|
410
410
|
isImageVariant.value
|
|
@@ -424,7 +424,7 @@ const textColumnClass = computed(() =>
|
|
|
424
424
|
as="header"
|
|
425
425
|
spacing="none"
|
|
426
426
|
:labelled-by="headingId"
|
|
427
|
-
:
|
|
427
|
+
:class="sectionClass"
|
|
428
428
|
>
|
|
429
429
|
<Container width="wide">
|
|
430
430
|
<div :class="rootClass">
|
|
@@ -519,7 +519,7 @@ const textColumnClass = computed(() =>
|
|
|
519
519
|
:as="pill.as"
|
|
520
520
|
:underline="false"
|
|
521
521
|
:aria-current="pill.current ? 'page' : undefined"
|
|
522
|
-
:
|
|
522
|
+
:class="pillClass(pill)"
|
|
523
523
|
>
|
|
524
524
|
{{ pill.label }}
|
|
525
525
|
</Link>
|
|
@@ -632,7 +632,7 @@ const successText = computed(() => data.value.successText || t('contact.successT
|
|
|
632
632
|
variant="standalone"
|
|
633
633
|
arrow
|
|
634
634
|
external
|
|
635
|
-
|
|
635
|
+
class="text-body-sm font-semibold"
|
|
636
636
|
>{{ mapLinkLabel }}</Link
|
|
637
637
|
>
|
|
638
638
|
</div>
|
|
@@ -116,7 +116,7 @@ describe('contact block', () => {
|
|
|
116
116
|
const wrapper = mountContact(merged);
|
|
117
117
|
const section = wrapper.find('section');
|
|
118
118
|
expect(section.exists()).toBe(true);
|
|
119
|
-
expect(section.classes()).toContain('
|
|
119
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
it('form-only with hideHeading keeps the h2 in the outline but hides it visually', () => {
|
|
@@ -124,7 +124,7 @@ describe('contact block', () => {
|
|
|
124
124
|
const heading = wrapper.find('h2');
|
|
125
125
|
expect(heading.exists()).toBe(true);
|
|
126
126
|
expect(heading.text()).toBe(mock.heading);
|
|
127
|
-
expect(heading.classes()).toContain('sr-only');
|
|
127
|
+
expect(heading.classes()).toContain('eldra:sr-only');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
it('every field has a visible, programmatically tied label, and the optional one says "(optional)"', () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* A focused band asking the visitor to do one thing (spec `02-blocks.md` 745–856). `variant`:
|
|
4
4
|
* - `primary`: full-width `primary` band, centred copy — `Section background="primary"` already
|
|
5
|
-
* marks `
|
|
5
|
+
* marks `data-section="primary"` on its own root, which is the package's
|
|
6
6
|
* own signal that inverts `Button` (a `primary-contrast` fill with `primary` text; `outline`
|
|
7
7
|
* becomes a transparent `currentColor` box) with no hand-written colour in this block.
|
|
8
8
|
* - `subtle`: the same centred layout on `Section background="surface"` (no inversion — only
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* inverts, so this panel carries no `data-section` at all. With no image it falls back to the
|
|
14
14
|
* same centred `subtle`-style copy, inside the panel.
|
|
15
15
|
* - `banner`: a compact `accent` panel the block marks **by hand**
|
|
16
|
-
* (`
|
|
16
|
+
* (`data-section="accent"` on the panel `<div>`, not the `Section`, whose
|
|
17
17
|
* own `background` stays `none` here per the design spec's Section table) — that hand-written
|
|
18
18
|
* marker is what inverts the one button the same way `Section`'s own `data-section` does
|
|
19
19
|
* elsewhere. No eyebrow, no secondary action; heading keeps the `h2` tag but is styled at the
|
|
@@ -24,18 +24,16 @@
|
|
|
24
24
|
* switches its own control height with the block's width (spec: "Buttons are 3rem tall (the
|
|
25
25
|
* `banner` button is 2.75rem below 48rem)"): `size="lg"` keeps its `lg` padding/gap/text sizing at
|
|
26
26
|
* every width — the package has no separate size preset for one block's own in-between height, and
|
|
27
|
-
* forking `Button` for it is out of scope (Global Constraints) — while `
|
|
28
|
-
*
|
|
27
|
+
* forking `Button` for it is out of scope (Global Constraints) — while `class="control-h
|
|
28
|
+
* @tablet:control-h-lg"` swaps only the height utility itself: `control-h` (the
|
|
29
29
|
* package's own `md`, 2.5rem — the closest token-backed height to the spec's 2.75rem, since there
|
|
30
30
|
* is no `--eldra-control-height-*` step at exactly 2.75rem either) below `@tablet` (48rem of the
|
|
31
|
-
* block's own width), `control-h-lg` (3rem) from `@tablet` on.
|
|
32
|
-
*
|
|
33
|
-
* (`packages/ui/src/utils/cx.ts`), so the override cleanly replaces `size="lg"`'s own base
|
|
34
|
-
* `control-h-lg` at the unprefixed (mobile) level without touching its `@tablet:`-scoped one.
|
|
31
|
+
* block's own width), `control-h-lg` (3rem) from `@tablet` on. An app utility outranks every
|
|
32
|
+
* `eldra:` class by cascade layer, so it beats `size="lg"`'s own `eldra:control-h-lg` at every width.
|
|
35
33
|
*
|
|
36
34
|
* Full-width-below-`@tablet` buttons elsewhere use the same base/`@tablet:` class pair every other
|
|
37
|
-
* rebuilt block's own container-query classes use (`w-full @tablet:w-auto`
|
|
38
|
-
* `
|
|
35
|
+
* rebuilt block's own container-query classes use (`w-full @tablet:w-auto` as `Button`'s own
|
|
36
|
+
* `class`) rather than the static `block` prop, since the width itself has to flip at the
|
|
39
37
|
* breakpoint, not stay fixed.
|
|
40
38
|
*
|
|
41
39
|
* The three per-field editor hints spec line 815 lists ("Add a heading", "Add supporting text
|
|
@@ -141,7 +139,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
141
139
|
<!-- banner: compact accent row, hand-marked so the package inverts its one button -->
|
|
142
140
|
<div
|
|
143
141
|
v-if="isBanner"
|
|
144
|
-
class="
|
|
142
|
+
class="bg-accent text-accent-contrast @tablet:flex-row @tablet:flex-wrap @tablet:items-center @tablet:justify-between @tablet:gap-x-8 @tablet:gap-y-5 @tablet:px-12 @tablet:py-8 flex flex-col gap-4 rounded-xl p-6"
|
|
145
143
|
data-section="accent"
|
|
146
144
|
>
|
|
147
145
|
<div class="grid max-w-[40rem] gap-2 text-left">
|
|
@@ -168,7 +166,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
168
166
|
size="lg"
|
|
169
167
|
:href="primaryHref!"
|
|
170
168
|
:as="primaryAs"
|
|
171
|
-
|
|
169
|
+
class="control-h @tablet:control-h-lg @tablet:w-auto w-full"
|
|
172
170
|
>
|
|
173
171
|
{{ data.primaryCtaLabel }}
|
|
174
172
|
</Button>
|
|
@@ -224,7 +222,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
224
222
|
size="lg"
|
|
225
223
|
:href="primaryHref!"
|
|
226
224
|
:as="primaryAs"
|
|
227
|
-
|
|
225
|
+
class="@tablet:w-auto w-full"
|
|
228
226
|
>
|
|
229
227
|
{{ data.primaryCtaLabel }}
|
|
230
228
|
</Button>
|
|
@@ -239,7 +237,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
239
237
|
size="lg"
|
|
240
238
|
:href="secondaryHref!"
|
|
241
239
|
:as="secondaryAs"
|
|
242
|
-
|
|
240
|
+
class="@tablet:w-auto w-full"
|
|
243
241
|
>
|
|
244
242
|
{{ data.secondaryCtaLabel }}
|
|
245
243
|
</Button>
|
|
@@ -289,7 +287,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
289
287
|
size="lg"
|
|
290
288
|
:href="primaryHref!"
|
|
291
289
|
:as="primaryAs"
|
|
292
|
-
|
|
290
|
+
class="@tablet:w-auto w-full"
|
|
293
291
|
>
|
|
294
292
|
{{ data.primaryCtaLabel }}
|
|
295
293
|
</Button>
|
|
@@ -304,7 +302,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
304
302
|
size="lg"
|
|
305
303
|
:href="secondaryHref!"
|
|
306
304
|
:as="secondaryAs"
|
|
307
|
-
|
|
305
|
+
class="@tablet:w-auto w-full"
|
|
308
306
|
>
|
|
309
307
|
{{ data.secondaryCtaLabel }}
|
|
310
308
|
</Button>
|
|
@@ -361,7 +359,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
361
359
|
size="lg"
|
|
362
360
|
:href="primaryHref!"
|
|
363
361
|
:as="primaryAs"
|
|
364
|
-
|
|
362
|
+
class="@tablet:w-auto w-full"
|
|
365
363
|
>
|
|
366
364
|
{{ data.primaryCtaLabel }}
|
|
367
365
|
</Button>
|
|
@@ -372,7 +370,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
|
|
|
372
370
|
size="lg"
|
|
373
371
|
:href="secondaryHref!"
|
|
374
372
|
:as="secondaryAs"
|
|
375
|
-
|
|
373
|
+
class="@tablet:w-auto w-full"
|
|
376
374
|
>
|
|
377
375
|
{{ data.secondaryCtaLabel }}
|
|
378
376
|
</Button>
|
|
@@ -37,7 +37,7 @@ describe('cta block', () => {
|
|
|
37
37
|
// `Container` or `div` (a `Container` never sets `@container` on its own).
|
|
38
38
|
for (const variant of ['primary', 'subtle', 'split', 'banner'] as const) {
|
|
39
39
|
const wrapper = mountBlock({ ...withImage, variant });
|
|
40
|
-
expect(wrapper.get('section').classes()).toContain('
|
|
40
|
+
expect(wrapper.get('section').classes()).toContain('eldra:@container');
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -141,26 +141,22 @@ describe('cta block', () => {
|
|
|
141
141
|
const classes = button.classes();
|
|
142
142
|
// `control-h` (the package's regular control height, closest token-backed step to the spec's
|
|
143
143
|
// 2.75rem) below `@tablet` (48rem of the block's own width); `@tablet:control-h-lg` (3rem)
|
|
144
|
-
// from 48rem on — see `Block.vue`'s own doc comment on the banner Button's `
|
|
144
|
+
// from 48rem on — see `Block.vue`'s own doc comment on the banner Button's `class`.
|
|
145
145
|
expect(classes).toContain('control-h');
|
|
146
146
|
expect(classes).toContain('@tablet:control-h-lg');
|
|
147
|
-
// `size="lg"`'s own
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// sizing (`px-6`, `text-button-lg`) stay untouched — a different, non-conflicting class group.
|
|
152
|
-
expect(classes).not.toContain('control-h-lg');
|
|
153
|
-
expect(classes).toContain('px-6');
|
|
154
|
-
expect(classes).toContain('text-button-lg');
|
|
147
|
+
// `size="lg"`'s own `eldra:control-h-lg` stays beside them and loses by cascade layer: an app
|
|
148
|
+
// utility outranks every `eldra:` class. Its `lg` padding/text sizing stay as they are.
|
|
149
|
+
expect(classes).toContain('eldra:px-6');
|
|
150
|
+
expect(classes).toContain('eldra:text-button-lg');
|
|
155
151
|
});
|
|
156
152
|
|
|
157
153
|
it('marks the banner panel data-section="accent" — the attribute that inverts the button, not a colour class', () => {
|
|
158
154
|
const wrapper = mountBlock({ ...mock, variant: 'banner' });
|
|
159
155
|
const panel = wrapper.get('[data-section="accent"]');
|
|
160
|
-
expect(panel.classes()).toContain('
|
|
156
|
+
expect(panel.classes()).toContain('bg-accent');
|
|
161
157
|
// Mutation check (manual): removing `data-section="accent"` from the panel while keeping
|
|
162
158
|
// `bg-accent` leaves the button unstyled by the package's own inversion rules (its classes are
|
|
163
|
-
// `
|
|
159
|
+
// `eldra:section-accent:*`) — confirmed by temporarily dropping the attribute
|
|
164
160
|
// here and observing the assertion above fail (`get()` throws, no such element).
|
|
165
161
|
});
|
|
166
162
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* `rows[].text` for the identical reasoning).
|
|
34
34
|
*
|
|
35
35
|
* Answers cap at 65ch: that comes for free from `AccordionItem`'s own panel class
|
|
36
|
-
* (`max-w-[65ch]`, see that component's source) — nothing here repeats it.
|
|
36
|
+
* (`eldra:max-w-[65ch]`, see that component's source) — nothing here repeats it.
|
|
37
37
|
*
|
|
38
38
|
* `variant`:
|
|
39
39
|
* - `one-column` (default): a centred head (heading, intro) inside a `narrow` (40rem) container —
|
|
@@ -154,12 +154,7 @@ useRichTextScrollRegions(accordionRoot, (caption) => caption ?? t('faq.richTextT
|
|
|
154
154
|
<EditorPlaceholder v-else-if="showIntroHint" inline :label="t('faq.introHintLabel')" />
|
|
155
155
|
<p v-if="hasContactLink" class="text-muted text-base">
|
|
156
156
|
{{ contactText }}
|
|
157
|
-
<Link
|
|
158
|
-
:href="contactHref!"
|
|
159
|
-
:as="contactLinkAs"
|
|
160
|
-
variant="inline"
|
|
161
|
-
:classes="{ root: 'font-semibold' }"
|
|
162
|
-
>
|
|
157
|
+
<Link :href="contactHref!" :as="contactLinkAs" variant="inline" class="font-semibold">
|
|
163
158
|
{{ contactLinkLabel }}
|
|
164
159
|
</Link>
|
|
165
160
|
</p>
|
|
@@ -239,12 +234,7 @@ useRichTextScrollRegions(accordionRoot, (caption) => caption ?? t('faq.richTextT
|
|
|
239
234
|
|
|
240
235
|
<p v-if="hasContactLink" class="text-muted mt-8 text-center text-base">
|
|
241
236
|
{{ contactText }}
|
|
242
|
-
<Link
|
|
243
|
-
:href="contactHref!"
|
|
244
|
-
:as="contactLinkAs"
|
|
245
|
-
variant="inline"
|
|
246
|
-
:classes="{ root: 'font-semibold' }"
|
|
247
|
-
>
|
|
237
|
+
<Link :href="contactHref!" :as="contactLinkAs" variant="inline" class="font-semibold">
|
|
248
238
|
{{ contactLinkLabel }}
|
|
249
239
|
</Link>
|
|
250
240
|
</p>
|
|
@@ -114,14 +114,14 @@ describe('faq block', () => {
|
|
|
114
114
|
it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
|
|
115
115
|
const wrapper = mountBlock(mock);
|
|
116
116
|
const section = wrapper.get('section');
|
|
117
|
-
expect(section.classes()).toContain('
|
|
117
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
118
118
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
it('answers cap at 65ch — the package panel class, not repeated here', () => {
|
|
122
122
|
const wrapper = mountBlock(mock);
|
|
123
123
|
for (const panel of wrapper.findAll('[data-part="panel"]')) {
|
|
124
|
-
expect(panel.classes()).toContain('max-w-[65ch]');
|
|
124
|
+
expect(panel.classes()).toContain('eldra:max-w-[65ch]');
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
|
|
@@ -226,8 +226,8 @@ const items = computed(() =>
|
|
|
226
226
|
:link-as="item.linkAs"
|
|
227
227
|
:variant="featureCardVariant"
|
|
228
228
|
:heading-level="3"
|
|
229
|
+
class="h-full"
|
|
229
230
|
:classes="{
|
|
230
|
-
root: 'h-full',
|
|
231
231
|
iconTile: item.showIconTile ? undefined : 'hidden',
|
|
232
232
|
titleLink: NO_UNDERLINE_UNTIL_HOVER,
|
|
233
233
|
cue: 'mt-auto',
|
|
@@ -101,7 +101,7 @@ describe('feature-grid block', () => {
|
|
|
101
101
|
it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
|
|
102
102
|
const wrapper = mountBlock(mock);
|
|
103
103
|
const section = wrapper.get('section');
|
|
104
|
-
expect(section.classes()).toContain('
|
|
104
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
105
105
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
106
106
|
});
|
|
107
107
|
|