@htmlbricks/hb-shop-item-row 0.71.35 → 0.71.37
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/README.md +117 -28
- package/manifest.json +29 -11
- package/package.json +1 -1
- package/types/webcomponent.type.d.ts +1 -2
package/README.md
CHANGED
|
@@ -1,51 +1,140 @@
|
|
|
1
|
-
|
|
1
|
+
# `hb-shop-item-row` (shop-item-row)
|
|
2
2
|
|
|
3
3
|
**Category:** commerce
|
|
4
|
-
**Tags:** commerce, product
|
|
4
|
+
**Tags:** commerce, product
|
|
5
|
+
**Package:** `@htmlbricks/hb-shop-item-row`
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## Overview
|
|
7
8
|
|
|
8
|
-
Horizontal shop product card:
|
|
9
|
+
Horizontal shop product row built as a Bulma **card** with a two-column layout: a narrow **thumbnail** column (optional image, optional badge tag) and a **main** column (linked title, muted subtitle, body text, star rating with numeric score, linked reviews line, current and compare-at prices, optional **card footer**). Content can come from **attributes** or from **named slots**; when a slot has no light DOM children, the component falls back to the matching string attribute.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Use this element in dense product lists, search results, or comparison tables where a wide, single-row preview reads better than a stacked card. For a vertical card with the same content model, see **`hb-shop-item-cell`**.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
### Layout and behavior
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
- **Thumbnail:** The image and badge render only when `img` is non-empty. The image (and badge overlay) are wrapped in a link that uses `url` when it is set; otherwise the link has no `href`.
|
|
16
|
+
- **Title:** When `title` is set or the `title` slot has content, the title appears as a level-5 heading with a link that uses the same `url` rules as the image.
|
|
17
|
+
- **Rating row:** A rating block appears when `rating` is set, or when the `reviews` slot or `reviews` attribute has content. **Star icons** (Bootstrap Icons–style SVGs) render only when `rating` is truthy (for example, omit or use `"0"` to hide stars). The number of icons equals **`ratingscale`**. Stars support **full** and **half** fills from the numeric `rating` value. The numeric label after the stars uses the **`rating`** slot or attribute. The **reviews** text is shown in parentheses and wrapped in a link that uses `reviewsurl` when set.
|
|
18
|
+
- **Prices:** The current price is bold; **`regularprice`** is shown struck-through beside it when either the attribute or the `regularprice` slot provides content.
|
|
19
|
+
- **Footer:** An optional Bulma **card footer** spans the text column when `footer` or the `footer` slot has content.
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
- `img`, `url`, `badge`, `title`, `subtitle`, `text`, `reviews`, `reviewsurl`, `price`, `regularprice`, `footer` (required in types): strings.
|
|
18
|
-
- `rating`, `ratingscale` (required): numbers as strings.
|
|
21
|
+
## Custom element
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
```html
|
|
24
|
+
<hb-shop-item-row …></hb-shop-item-row>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Attributes
|
|
28
|
+
|
|
29
|
+
Web component **attribute names use snake_case**. In plain HTML, **all attribute values are strings**. Use empty `""` for unused text fields where you still need the attribute present for tooling or consistency.
|
|
30
|
+
|
|
31
|
+
| Attribute | Required | Description |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `id` | No | Optional host id (forwarded to the inner card wrapper). |
|
|
34
|
+
| `style` | No | Optional; present on the `Component` typing for host styling. |
|
|
35
|
+
| `img` | Yes* | Image URL. If empty, the thumbnail column does not show an image or badge wrapper. |
|
|
36
|
+
| `url` | Yes* | Product URL for the image and title links. |
|
|
37
|
+
| `badge` | Yes* | Short label (for example sale text); shown in a **danger** rounded tag over the image when combined with `img`. |
|
|
38
|
+
| `title` | Yes* | Primary product name. |
|
|
39
|
+
| `subtitle` | Yes* | Muted secondary line under the title. |
|
|
40
|
+
| `text` | Yes* | Main descriptive copy. |
|
|
41
|
+
| `rating` | Yes* | Numeric score for stars and the numeric label; pass as a string (for example `"4.5"`). Falsy values hide the star row but reviews-only content can still show. |
|
|
42
|
+
| `ratingscale` | Yes* | Number of star icons; pass as a string (for example `"5"`). |
|
|
43
|
+
| `reviews` | Yes* | Text inside the linked parentheses (for example review count). |
|
|
44
|
+
| `reviewsurl` | Yes* | URL for the reviews parentheses link. |
|
|
45
|
+
| `price` | Yes* | Current or promotional price string. |
|
|
46
|
+
| `regularprice` | Yes* | Compare-at price string (struck through when set). |
|
|
47
|
+
| `footer` | Yes* | Optional footer line. |
|
|
48
|
+
|
|
49
|
+
\*Marked “Yes” because the published **`Component`** interface lists them as required; in markup, supply **`""`** for fields you do not use.
|
|
50
|
+
|
|
51
|
+
## Events
|
|
52
|
+
|
|
53
|
+
No custom events are declared in `types/webcomponent.type.d.ts` (`Events` is `{}`).
|
|
54
|
+
|
|
55
|
+
## Slots
|
|
56
|
+
|
|
57
|
+
Each named slot falls back to the **same-named attribute** when the slot has no content (see `extra/docs.ts`).
|
|
58
|
+
|
|
59
|
+
| Slot | Purpose |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `badge` | Optional label over the row thumbnail inside a rounded tag; defaults to the `badge` attribute when the slot is empty. |
|
|
62
|
+
| `title` | Main product name in the title link beside the image; defaults to the `title` attribute when the slot is empty. |
|
|
63
|
+
| `subtitle` | Secondary line under the title (muted); defaults to the `subtitle` attribute when the slot is empty. |
|
|
64
|
+
| `text` | Product description or pitch in the main column; defaults to the `text` attribute when the slot is empty. |
|
|
65
|
+
| `rating` | Numeric score shown after the star icons when `rating` is set; defaults to the `rating` attribute as plain text. |
|
|
66
|
+
| `reviews` | Review count or label inside the linked parentheses next to the stars; defaults to the `reviews` attribute (the link uses `reviewsurl`). |
|
|
67
|
+
| `price` | Current or sale price (bold, baseline row); defaults to the `price` attribute when the slot is empty. |
|
|
68
|
+
| `footer` | Optional footer strip under the text column (still inside the card); defaults to the `footer` attribute when the slot is empty. |
|
|
69
|
+
| `regularprice` | List or compare-at price shown struck-through beside `price`; defaults to the `regularprice` attribute when the slot is empty. |
|
|
70
|
+
|
|
71
|
+
There are no documented **`::part`** hooks for this package (`styleSetup.parts` is empty).
|
|
21
72
|
|
|
22
|
-
|
|
73
|
+
## Styling (Bulma)
|
|
23
74
|
|
|
24
|
-
|
|
75
|
+
Cherry-picked **Bulma 1.x** Sass (`card`, `columns`, `image`, `content`, `title`, `tag`, helpers) is scoped to **`:host`** via `styles/bulma.scss`. Theme tokens are the public **`--bulma-*`** variables; set them on `body`, `:root`, or any ancestor so they inherit into the shadow tree. See [Bulma CSS variables](https://bulma.io/documentation/features/css-variables/) and `extra/docs.ts` for the full `styleSetup` list.
|
|
25
76
|
|
|
26
|
-
|
|
77
|
+
| Variable | Purpose |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| `--bulma-primary` | Accent and interactive highlights (theme setup). |
|
|
80
|
+
| `--bulma-text` | Body and title text. |
|
|
81
|
+
| `--bulma-card-background-color` | Background for the horizontal card shell (thumbnail column, text column, footer). |
|
|
82
|
+
| `--bulma-border` | Row frame border (component SCSS supplies a fallback if unset). |
|
|
83
|
+
| `--bulma-shadow` | Row frame shadow (fallback in SCSS if unset). |
|
|
84
|
+
| `--bulma-text-weak` | Subtitle, strikethrough context, and secondary lines. |
|
|
85
|
+
| `--bulma-link` | Linked title and reviews URL color. |
|
|
86
|
+
| `--bulma-radius` | Card corners for the horizontal row shell. |
|
|
27
87
|
|
|
28
|
-
|
|
88
|
+
The host also uses **`--bulma-block-spacing`** (with a built-in fallback) for default vertical **margin** between rows when the element is stacked in a list.
|
|
29
89
|
|
|
30
|
-
|
|
31
|
-
- Storybook exposes `action` for demos only; it is not on the `Component` type.
|
|
90
|
+
## Usage notes
|
|
32
91
|
|
|
33
|
-
|
|
92
|
+
- **Slots and attributes** share the same names: each slot’s default content is the corresponding attribute when the slot is empty.
|
|
93
|
+
- **Storybook** exposes an `action` control for demos; it is **not** part of the `Component` props type.
|
|
94
|
+
- **Internationalization:** `extra/docs.ts` does not register `i18n` entries for this package; translate strings in the host app before passing them in.
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
### Full row
|
|
34
99
|
|
|
35
100
|
```html
|
|
36
101
|
<hb-shop-item-row
|
|
37
|
-
img="https://placehold.co/
|
|
38
|
-
url="/
|
|
39
|
-
badge="
|
|
40
|
-
title="
|
|
41
|
-
subtitle="
|
|
42
|
-
text="
|
|
102
|
+
img="https://placehold.co/200x150"
|
|
103
|
+
url="/products/running-shoes"
|
|
104
|
+
badge="-15%"
|
|
105
|
+
title="Running shoes"
|
|
106
|
+
subtitle="Unisex · sizes 36–48"
|
|
107
|
+
text="Lightweight mesh upper and cushioned sole for daily miles."
|
|
43
108
|
rating="5"
|
|
44
109
|
ratingscale="5"
|
|
45
|
-
reviews="
|
|
46
|
-
reviewsurl="/
|
|
47
|
-
price="€
|
|
48
|
-
regularprice="€
|
|
110
|
+
reviews="2.4k reviews"
|
|
111
|
+
reviewsurl="/products/running-shoes#reviews"
|
|
112
|
+
price="€102.00"
|
|
113
|
+
regularprice="€120.00"
|
|
114
|
+
footer="Ships in 24h"
|
|
115
|
+
></hb-shop-item-row>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Title and price only
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<hb-shop-item-row
|
|
122
|
+
img="https://placehold.co/120x90"
|
|
123
|
+
url=""
|
|
124
|
+
badge=""
|
|
125
|
+
title="Gift card €25"
|
|
126
|
+
subtitle=""
|
|
127
|
+
text=""
|
|
128
|
+
rating=""
|
|
129
|
+
ratingscale="5"
|
|
130
|
+
reviews=""
|
|
131
|
+
reviewsurl=""
|
|
132
|
+
price="€25.00"
|
|
133
|
+
regularprice=""
|
|
49
134
|
footer=""
|
|
50
135
|
></hb-shop-item-row>
|
|
51
136
|
```
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
Package metadata references **Apache-2.0** (see `LICENSE.md` in the published package when consuming from npm).
|
package/manifest.json
CHANGED
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"name": "--bulma-card-background-color",
|
|
175
175
|
"valueType": "color",
|
|
176
176
|
"defaultValue": "#ffffff",
|
|
177
|
-
"description": "
|
|
177
|
+
"description": "Background fill for the horizontal card shell (thumbnail column, text column, footer)."
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
"name": "--bulma-border",
|
|
@@ -187,6 +187,24 @@
|
|
|
187
187
|
"valueType": "other",
|
|
188
188
|
"defaultValue": "0 0.125em 0.25em rgba(10, 10, 10, 0.1)",
|
|
189
189
|
"description": "Row frame shadow (falls back in component SCSS if unset)."
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "--bulma-text-weak",
|
|
193
|
+
"valueType": "color",
|
|
194
|
+
"defaultValue": "#7a7a7a",
|
|
195
|
+
"description": "Subtitle, strikethrough context, and secondary lines."
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "--bulma-link",
|
|
199
|
+
"valueType": "color",
|
|
200
|
+
"defaultValue": "#485fc7",
|
|
201
|
+
"description": "Linked title and reviews URL color."
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "--bulma-radius",
|
|
205
|
+
"valueType": "number",
|
|
206
|
+
"defaultValue": "0.375rem",
|
|
207
|
+
"description": "Card corners for the horizontal row shell."
|
|
190
208
|
}
|
|
191
209
|
],
|
|
192
210
|
"parts": []
|
|
@@ -195,39 +213,39 @@
|
|
|
195
213
|
"htmlSlots": [
|
|
196
214
|
{
|
|
197
215
|
"name": "badge",
|
|
198
|
-
"description": "badge"
|
|
216
|
+
"description": "Optional label over the row thumbnail inside a rounded tag; defaults to the `badge` attribute when the slot is empty."
|
|
199
217
|
},
|
|
200
218
|
{
|
|
201
219
|
"name": "title",
|
|
202
|
-
"description": "title"
|
|
220
|
+
"description": "Main product name in the title link beside the image; defaults to the `title` attribute when the slot is empty."
|
|
203
221
|
},
|
|
204
222
|
{
|
|
205
223
|
"name": "subtitle",
|
|
206
|
-
"description": "subtitle"
|
|
224
|
+
"description": "Secondary line under the title (muted); defaults to the `subtitle` attribute when the slot is empty."
|
|
207
225
|
},
|
|
208
226
|
{
|
|
209
227
|
"name": "text",
|
|
210
|
-
"description": "text"
|
|
228
|
+
"description": "Product description or pitch in the main column; defaults to the `text` attribute when the slot is empty."
|
|
211
229
|
},
|
|
212
230
|
{
|
|
213
231
|
"name": "rating",
|
|
214
|
-
"description": "rating"
|
|
232
|
+
"description": "Numeric score shown after the star icons when `rating` is set; defaults to the `rating` attribute as plain text."
|
|
215
233
|
},
|
|
216
234
|
{
|
|
217
235
|
"name": "reviews",
|
|
218
|
-
"description": "reviews"
|
|
236
|
+
"description": "Review count or label inside the linked parentheses next to stars; defaults to the `reviews` attribute (link uses `reviewsurl`)."
|
|
219
237
|
},
|
|
220
238
|
{
|
|
221
239
|
"name": "price",
|
|
222
|
-
"description": "price"
|
|
240
|
+
"description": "Current or sale price (bold, baseline row); defaults to the `price` attribute when the slot is empty."
|
|
223
241
|
},
|
|
224
242
|
{
|
|
225
243
|
"name": "footer",
|
|
226
|
-
"description": "footer"
|
|
244
|
+
"description": "Optional footer strip under the text column (still inside the card); defaults to the `footer` attribute when the slot is empty."
|
|
227
245
|
},
|
|
228
246
|
{
|
|
229
247
|
"name": "regularprice",
|
|
230
|
-
"description": "regularprice"
|
|
248
|
+
"description": "List or compare-at price shown struck-through beside `price`; defaults to the `regularprice` attribute when the slot is empty."
|
|
231
249
|
}
|
|
232
250
|
],
|
|
233
251
|
"i18n": [],
|
|
@@ -329,5 +347,5 @@
|
|
|
329
347
|
"size": {},
|
|
330
348
|
"iifePath": "main.iife.js",
|
|
331
349
|
"repoName": "@htmlbricks/hb-shop-item-row",
|
|
332
|
-
"version": "0.71.
|
|
350
|
+
"version": "0.71.37"
|
|
333
351
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htmlbricks/hb-shop-item-row",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.37",
|
|
4
4
|
"contributors": [],
|
|
5
5
|
"description": "Horizontal shop product card: image with optional badge, linked title and metadata, description, star rating scale with numeric rating and reviews link, current and strikethrough prices, and optional footer—all overridable via named slots.",
|
|
6
6
|
"licenses": [
|