@htmlbricks/hb-site-contacts-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 CHANGED
@@ -1,36 +1,137 @@
1
- ## `hb-site-contacts-row` site-contacts-row
1
+ # `hb-site-contacts-row` (site-contacts-row)
2
2
 
3
3
  **Category:** content
4
- **Tags:** content, contact
4
+ **Tags:** content, contact
5
+ **Package:** `@htmlbricks/hb-site-contacts-row`
5
6
 
6
- ### What it does
7
+ ## Overview
7
8
 
8
- Contact strip for addresses (with optional `latLng`), phones, emails, websites, and `availability` (times, appointment flag). `model` `big` / `small` or omit for auto layouts that adapt to which fields you pass.
9
+ `hb-site-contacts-row` is a contact strip that groups **addresses**, **phones**, **emails**, **websites**, and **availability** (opening hours plus an optional appointment note) into a responsive Bulma layout. Each group can have its own **title**, **Bootstrap Icons** glyph, and list content.
9
10
 
10
- ### Custom element
11
+ The component registers the custom element **`hb-site-contacts-row`**. It runs inside a **shadow root** with Bulma layout and typography, and loads the **Bootstrap Icons** font from jsDelivr in `<svelte:head>`.
11
12
 
12
- `hb-site-contacts-row`
13
+ ## Custom element
13
14
 
14
- ### Attributes (snake_case; use string values in HTML)
15
+ ```html
16
+ <hb-site-contacts-row …></hb-site-contacts-row>
17
+ ```
18
+
19
+ ## Layout: `model`
20
+
21
+ - **`small`** — Compact blocks: addresses use an inline “icon + content” row; phones, emails, websites, and availability use column halves on tablet and full width on mobile.
22
+ - **`big`** — Larger “card-style” columns (`col_big`) with a prominent icon row, title, and list.
23
+
24
+ **Default:** If you omit `model`, the implementation defaults to **`small`**.
25
+
26
+ **Invalid values:** Any `model` other than `small` or `big` renders the fallback text `wrong model provided` plus the value you passed (still inside the shadow tree).
27
+
28
+ ## Attributes (HTML)
29
+
30
+ Use **snake_case** attribute names. From plain HTML, pass **objects as JSON strings** (single-quoted in HTML, escaped quotes inside JSON).
31
+
32
+ | Attribute | Required | Description |
33
+ | --- | --- | --- |
34
+ | `id` | No | Optional host element id (forwarded as a normal attribute / prop). |
35
+ | `style` | No | Present in the TypeScript `Component` shape; **not** wired into the template in the current implementation. |
36
+ | `model` | No | `"small"` \| `"big"`. Defaults to `"small"`. |
37
+ | `addresses` | No | JSON: `{ "icon"?: string, "title"?: string, "addresses": Address[] }`. |
38
+ | `phones` | No | JSON: `{ "icon"?: string, "title"?: string, "phones": Phone[] }`. |
39
+ | `emails` | No | JSON: `{ "icon"?: string, "title"?: string, "emails": Email[] }`. |
40
+ | `websites` | No | JSON: `{ "icon"?: string, "title"?: string, "websites": Website[] }`. |
41
+ | `availability` | No | JSON: `{ "icon"?: string, "title"?: string, "times": string[], "appointment"?: boolean }`. |
42
+
43
+ ### JSON shapes (TypeScript reference)
44
+
45
+ ```ts
46
+ type Address = {
47
+ address: string;
48
+ latLng?: number[]; // [lat, lng] → Google Maps link when no `link`
49
+ link?: string; // external URL; takes precedence over `latLng`
50
+ name?: string; // shown as a prefix in `big` mode only
51
+ };
52
+
53
+ type Phone = {
54
+ number: string;
55
+ name?: string; // prefix in `big` mode only
56
+ };
57
+
58
+ type Email = {
59
+ address: string;
60
+ label?: string; // link text in `small`; in `big`, link text vs address
61
+ name?: string; // prefix in `big` mode only
62
+ };
63
+
64
+ type Website = {
65
+ url: string;
66
+ label?: string;
67
+ name?: string; // prefix in `big` mode only
68
+ };
69
+ ```
70
+
71
+ **Parsing:** When any of `addresses`, `phones`, `emails`, `websites`, or `availability` arrives as a **string**, the component attempts `JSON.parse` inside an effect. Malformed JSON is logged to the console and leaves the previous value behavior up to the runtime.
72
+
73
+ ### Icons
74
+
75
+ Each block accepts an optional `icon` string: the **Bootstrap Icons** short name **without** the `bi-` prefix (the markup adds `class="bi bi-{icon}"`). Defaults if omitted:
76
+
77
+ | Block | Default icon |
78
+ | --- | --- |
79
+ | addresses | `geo-alt` |
80
+ | phones | `telephone` |
81
+ | emails | `envelope` |
82
+ | websites | `globe` |
83
+ | availability | `clock` |
84
+
85
+ ### Addresses: links
86
+
87
+ For each address with non-empty `address`:
15
88
 
16
- - `id` (optional): string.
17
- - `style` (optional): string (inline style).
18
- - `availability` (optional): JSON string — `{ icon?, times: string[], title?, appointment? }`.
19
- - `addresses` (optional): JSON string — `{ icon?, addresses: Address[], title? }` (`Address`: `address`, optional `latLng`, `link`, `name`).
20
- - `phones` (optional): JSON string — `{ icon?, phones: { name?, number }[], title? }`.
21
- - `emails` (optional): JSON string — `{ icon?, emails: { label?, address, name? }[], title? }`.
22
- - `websites` (optional): JSON string — `{ icon?, websites: { label?, url, name? }[], title? }`.
23
- - `model` (optional): `"big"` | `"small"`.
89
+ 1. If `link` is set → `<a href="{link}" target="_blank">`.
90
+ 2. Else if `latLng` has length Google Maps URL `https://www.google.com/maps/@{lat},{lng},15z` in a new tab.
91
+ 3. Else plain text.
24
92
 
25
- ### Events
93
+ ### Emails and websites
26
94
 
27
- - `event`: `{ test: boolean }` (integration hook per typings).
95
+ - **Emails:** `mailto:` links. In **`small`** mode, the list shows `label` as the link text when set, otherwise the address. In **`big`** mode, optional `name:` prefix, then a single mailto link using `label` or the address as visible text.
96
+ - **Websites:** External `<a href="{url}">` with `label` or URL as text, with the same `small` / `big` differences as emails for prefixes.
28
97
 
29
- ### Usage notes
98
+ ### Availability
30
99
 
31
- - No named slots in `extra/docs.ts`. Pass complex blocks as JSON attributes or bind after custom element upgrade.
100
+ - Renders when `availability.times` is a non-empty array; each string is one list item.
101
+ - When `availability.appointment` is truthy, an extra line is shown **in Italian** (implementation detail): `*riceve per appuntamento` in `small` mode and `riceve per appuntamento` in `big` mode.
32
102
 
33
- ### Minimal HTML example
103
+ ## Events
104
+
105
+ `types/webcomponent.type.d.ts` declares **`Events`** as `{}` (no custom events). The current `component.wc.svelte` does not dispatch custom events.
106
+
107
+ ## Styling
108
+
109
+ The component forwards **`styles/bulma.scss`** (Bulma 1.x CSS variables on `:host`) and **`styles/webcomponent.scss`**.
110
+
111
+ ### CSS custom properties (`:host`)
112
+
113
+ | Variable | Role |
114
+ | --- | --- |
115
+ | `--bulma-text` | Body copy in lists and labels. |
116
+ | `--bulma-link` | Linked addresses, phones, emails, and websites. |
117
+ | `--bulma-block-spacing` | Vertical rhythm between stacked blocks and icon sizing. |
118
+ | `--bulma-column-gap` | Inline gaps in rows and list spacing. |
119
+ | `--bulma-size-small` | Appointment line and small meta text. |
120
+ | `--bulma-weight-bold` | Section titles and appointment emphasis. |
121
+
122
+ See Bulma’s [CSS variables](https://bulma.io/documentation/features/css-variables/) documentation for value types and inheritance.
123
+
124
+ ### CSS parts
125
+
126
+ | Part | Description |
127
+ | --- | --- |
128
+ | `container` | Root `columns is-multiline` wrapper (`part="container"`). Use for layout, max-width, or background overrides. |
129
+
130
+ ### Slots
131
+
132
+ None. All content is supplied via JSON attributes.
133
+
134
+ ## Minimal example
34
135
 
35
136
  ```html
36
137
  <hb-site-contacts-row
@@ -38,3 +139,22 @@ Contact strip for addresses (with optional `latLng`), phones, emails, websites,
38
139
  emails='{"emails":[{"label":"Info","address":"info@example.com","name":"main"}]}'
39
140
  ></hb-site-contacts-row>
40
141
  ```
142
+
143
+ ### Example with multiple groups
144
+
145
+ ```html
146
+ <hb-site-contacts-row
147
+ model="big"
148
+ addresses='{"title":"Locations","addresses":[{"address":"1 Example Rd","latLng":[51.5,-0.12],"name":"HQ"}]}'
149
+ phones='{"phones":[{"name":"Desk","number":"+1 555 0100"}]}'
150
+ availability='{"times":["Mon–Fri 9–18"],"appointment":true}'
151
+ ></hb-site-contacts-row>
152
+ ```
153
+
154
+ ## Authoring types
155
+
156
+ For Svelte or TypeScript consumers, see `types/webcomponent.type.d.ts` for the full `Component`, `Address`, `Phone`, `Email`, `Website`, and `Events` definitions.
157
+
158
+ ## License
159
+
160
+ Package metadata references **Apache-2.0** (see `LICENSE.md` in the published package when consuming from npm).
package/manifest.json CHANGED
@@ -6,23 +6,6 @@
6
6
  "definitions": {
7
7
  "Events": {
8
8
  "additionalProperties": false,
9
- "properties": {
10
- "event": {
11
- "additionalProperties": false,
12
- "properties": {
13
- "test": {
14
- "type": "boolean"
15
- }
16
- },
17
- "required": [
18
- "test"
19
- ],
20
- "type": "object"
21
- }
22
- },
23
- "required": [
24
- "event"
25
- ],
26
9
  "type": "object"
27
10
  }
28
11
  }
@@ -236,7 +219,7 @@
236
219
  }
237
220
  }
238
221
  },
239
- "description": "Contact strip for addresses (with optional `latLng`), phones, emails, websites, and `availability` (times, appointment flag). `model` `big` / `small` or omit for auto layouts that adapt to which fields you pass.",
222
+ "description": "Contact strip for addresses (with optional `latLng` or `link`), phones, emails, websites, and `availability` (times, optional appointment flag). Layout `model` is `big` or `small` (implementation defaults to `small` when omitted).",
240
223
  "storybookArgs": {
241
224
  "addresses": {
242
225
  "control": {
@@ -270,8 +253,50 @@
270
253
  }
271
254
  },
272
255
  "styleSetup": {
273
- "vars": [],
274
- "parts": []
256
+ "vars": [
257
+ {
258
+ "name": "--bulma-text",
259
+ "valueType": "color",
260
+ "defaultValue": "",
261
+ "description": "Default body copy in list blocks and labels."
262
+ },
263
+ {
264
+ "name": "--bulma-link",
265
+ "valueType": "color",
266
+ "defaultValue": "",
267
+ "description": "Linked addresses, phones, emails, and websites."
268
+ },
269
+ {
270
+ "name": "--bulma-block-spacing",
271
+ "valueType": "number",
272
+ "defaultValue": "",
273
+ "description": "Vertical rhythm between stacked blocks and icon sizing."
274
+ },
275
+ {
276
+ "name": "--bulma-column-gap",
277
+ "valueType": "number",
278
+ "defaultValue": "",
279
+ "description": "Inline gaps in inline rows and list item spacing."
280
+ },
281
+ {
282
+ "name": "--bulma-size-small",
283
+ "valueType": "number",
284
+ "defaultValue": "",
285
+ "description": "Appointment line and small meta text."
286
+ },
287
+ {
288
+ "name": "--bulma-weight-bold",
289
+ "valueType": "number",
290
+ "defaultValue": "",
291
+ "description": "Section titles and appointment emphasis."
292
+ }
293
+ ],
294
+ "parts": [
295
+ {
296
+ "name": "container",
297
+ "description": "Root `columns is-multiline` wrapper; target for layout, max-width, or background overrides."
298
+ }
299
+ ]
275
300
  },
276
301
  "contributors": [],
277
302
  "htmlSlots": [],
@@ -692,5 +717,5 @@
692
717
  "size": {},
693
718
  "iifePath": "main.iife.js",
694
719
  "repoName": "@htmlbricks/hb-site-contacts-row",
695
- "version": "0.71.35"
720
+ "version": "0.71.37"
696
721
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@htmlbricks/hb-site-contacts-row",
3
- "version": "0.71.35",
3
+ "version": "0.71.37",
4
4
  "contributors": [],
5
- "description": "Contact strip for addresses (with optional `latLng`), phones, emails, websites, and `availability` (times, appointment flag). `model` `big` / `small` or omit for auto layouts that adapt to which fields you pass.",
5
+ "description": "Contact strip for addresses (with optional `latLng` or `link`), phones, emails, websites, and `availability` (times, optional appointment flag). Layout `model` is `big` or `small` (implementation defaults to `small` when omitted).",
6
6
  "licenses": [
7
7
  {
8
8
  "type": "Apache-2.0",
@@ -29,6 +29,4 @@ export type Component = {
29
29
  model?: "big" | "small";
30
30
  };
31
31
 
32
- export type Events = {
33
- event: { test: boolean };
34
- };
32
+ export type Events = {};
@@ -4,23 +4,6 @@
4
4
  "definitions": {
5
5
  "Events": {
6
6
  "additionalProperties": false,
7
- "properties": {
8
- "event": {
9
- "additionalProperties": false,
10
- "properties": {
11
- "test": {
12
- "type": "boolean"
13
- }
14
- },
15
- "required": [
16
- "test"
17
- ],
18
- "type": "object"
19
- }
20
- },
21
- "required": [
22
- "event"
23
- ],
24
7
  "type": "object"
25
8
  }
26
9
  }