@loomidev/contact-card 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael K. Ocansey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,324 @@
1
+ # @loomidev/contact-card
2
+
3
+ `<loomi-contact-card>` — a ready-made card for displaying a contact, with avatar, name,
4
+ position and contact rows. Saves you from manually building this layout out of
5
+ [`<loomi-card>`](../card) and [`<loomi-avatar>`](../avatar) every time.
6
+
7
+ ```bash
8
+ npm install @loomidev/contact-card lit
9
+ ```
10
+
11
+ ```js
12
+ import "@loomidev/contact-card";
13
+ ```
14
+
15
+ ## Basic Usage
16
+
17
+ A default avatar placeholder is used when `image` isn't set.
18
+
19
+ ```html
20
+ <loomi-contact-card
21
+ name="Alex R. Bennett"
22
+ position="Senior Developer"
23
+ department="Tech"
24
+ email="alex@loomiui.dev"
25
+ mobile="+233 123 456 789"
26
+ birthday="01 May"
27
+ ></loomi-contact-card>
28
+ ```
29
+
30
+ ## Custom Image
31
+
32
+ ```html
33
+ <loomi-contact-card name="Sara Field" image="/sara.jpg" position="Designer"></loomi-contact-card>
34
+ ```
35
+
36
+ When no `image` is set, initials are derived from `name` and shown as a label avatar
37
+ instead — same fallback behavior as [`<loomi-avatar>`](../avatar).
38
+
39
+ ## Centered Layout
40
+
41
+ `centered` reflows the card to stack the avatar above the details, vertically centered
42
+ — handy in a grid of team members.
43
+
44
+ ```html
45
+ <div style="display:grid;grid-template-columns:repeat(3,1fr);gap:1rem">
46
+ <loomi-contact-card name="Alex R. Bennett" position="Senior Developer" centered></loomi-contact-card>
47
+ <loomi-contact-card name="Sara Field" image="/sara.jpg" position="Designer" centered></loomi-contact-card>
48
+ <loomi-contact-card name="Ada Brooks" position="Product" centered></loomi-contact-card>
49
+ </div>
50
+ ```
51
+
52
+ ## Clickable Contact Cards
53
+
54
+ Same `url` semantics as [`<loomi-card>`](../card) — a path, full URL, or JS function
55
+ call.
56
+
57
+ ```html
58
+ <loomi-contact-card name="Alex R. Bennett" position="Senior Developer" has-hover url="/team/alex"></loomi-contact-card>
59
+ ```
60
+
61
+ ## Extra Content
62
+
63
+ The default slot renders below the contact details — useful for tags, a short bio, or
64
+ action buttons.
65
+
66
+ ```html
67
+ <loomi-contact-card name="Alex R. Bennett" position="Senior Developer">
68
+ <loomi-tag label="On leave" color="warning"></loomi-tag>
69
+ </loomi-contact-card>
70
+ ```
71
+
72
+ ## Card Styling
73
+
74
+ `has-shadow` and `has-hover` work exactly like on [`<loomi-card>`](../card).
75
+
76
+ ```html
77
+ <loomi-contact-card name="Alex R. Bennett" has-shadow="false"></loomi-contact-card>
78
+ ```
79
+
80
+ ## Accessibility
81
+
82
+ For the library-wide baseline, see [Foundations — Accessibility](https://loomiui.com/foundations/#accessibility).
83
+
84
+ ## Responsive behavior
85
+
86
+ For the shared container and viewport rules, see [Foundations — Responsive behavior](https://loomiui.com/foundations/#responsive-behavior).
87
+
88
+ ## Dark mode
89
+
90
+ For theme activation, token overrides, and contrast guidance, see [Foundations — Dark mode](https://loomiui.com/foundations/#dark-mode).
91
+
92
+ ## Attributes
93
+
94
+ | Attribute | Default | Description |
95
+ | ------------ | --------- | --------------------------------------------- |
96
+ | `name` | _(blank)_ | Contact name (initials avatar when no image). |
97
+ | `position` | _(blank)_ | Job title, shown under the name. |
98
+ | `department` | _(blank)_ | Department, shown under the name. |
99
+ | `image` | _(blank)_ | Avatar image URL. |
100
+ | `email` | _(blank)_ | Email address row, shown with an icon. |
101
+ | `mobile` | _(blank)_ | Phone number row, shown with an icon. |
102
+ | `birthday` | _(blank)_ | Birthday row, shown with an icon. |
103
+ | `centered` | `false` | Vertically center the layout. _(boolean)_ |
104
+ | `has-shadow` | `true` | Show a drop shadow. _(boolean)_ |
105
+ | `has-hover` | `false` | Lift the card on hover. _(boolean)_ |
106
+ | `url` | _(blank)_ | Navigate on click. |
107
+
108
+ ## Slots
109
+
110
+ | Slot | Description |
111
+ | ----------- | ------------------------------------ |
112
+ | _(default)_ | Content placed inside the component. |
113
+
114
+ ## Full Example
115
+
116
+ ```html
117
+ <loomi-contact-card
118
+ name="Alex R. Bennett"
119
+ position="Senior Copywriter"
120
+ department="Tech"
121
+ email="alex@loomiui.dev"
122
+ mobile="+233.123.456.789"
123
+ birthday="01-May"
124
+ has-hover
125
+ centered
126
+ url="/team/alex"
127
+ >
128
+ <loomi-tag label="Available" color="success"></loomi-tag>
129
+ </loomi-contact-card>
130
+ ```
131
+
132
+ <!-- BEGIN loomi-framework-guide -->
133
+
134
+ ## Framework integration
135
+
136
+ `<loomi-contact-card>` is a standard custom element, so the browser can use it in plain HTML, Blade, React, Vue, Angular, Svelte, Astro, and most other frameworks. The important beginner rule is: install the package, import it once before the tag is rendered, then write the Loomi tag in your template.
137
+
138
+ ### Where to run commands
139
+
140
+ Run install commands from the app where you want to use this component. That means the folder that contains that app's `package.json`. Do not run these install commands from `packages/contact-card` unless you are editing LoomiUI itself.
141
+
142
+ ```bash
143
+ cd /path/to/your-app
144
+ npm install @loomidev/contact-card lit
145
+ ```
146
+
147
+ If you are contributing to LoomiUI itself, first move to the top-level `components` folder. That is where the main `package.json` for all packages lives, and `pnpm --filter ...` commands should be run from there:
148
+
149
+ ```bash
150
+ cd /path/to/your-copy-of-loomiui/components
151
+ pnpm --filter @loomidev/contact-card build
152
+ pnpm --filter @loomidev/contact-card typecheck
153
+ ```
154
+
155
+ ### Choose your framework
156
+
157
+ <loomi-tabs>
158
+ <loomi-tab label="HTML" active>
159
+
160
+ Use the CDN version for prototypes, documentation pages, or a quick reproduction. The import map tells the browser where to find Lit, which Loomi components use internally.
161
+
162
+ ```html
163
+ <script type="importmap">
164
+ { "imports": { "lit": "https://esm.sh/lit@3.3.3", "lit/": "https://esm.sh/lit@3.3.3/" } }
165
+ </script>
166
+ <script type="module" src="https://esm.sh/@loomidev/contact-card"></script>
167
+
168
+ <loomi-contact-card
169
+ name="Emma Miller"
170
+ position="Product Manager"
171
+ department="Growth"
172
+ email="emma@example.com"
173
+ ></loomi-contact-card>
174
+ ```
175
+
176
+ </loomi-tab>
177
+ <loomi-tab label="Bundlers and SPAs">
178
+
179
+ In Vite, Webpack, Parcel, Rollup, or a framework build pipeline, install the package and import it once in your main app JavaScript file. After that, you can use the Loomi tag anywhere in your app.
180
+
181
+ ```js
182
+ import "@loomidev/contact-card";
183
+ ```
184
+
185
+ </loomi-tab>
186
+ <loomi-tab label="Blade">
187
+
188
+ Run the install command from your Laravel project root, then import the component in `resources/js/app.js`. If your project uses Laravel Vite, `npm run dev` and `npm run build` should also be run from the Laravel project root.
189
+
190
+ ```bash
191
+ cd /path/to/your-laravel-app
192
+ npm install @loomidev/contact-card lit
193
+ npm run dev
194
+ ```
195
+
196
+ ```js
197
+ // resources/js/app.js
198
+ import "@loomidev/contact-card";
199
+ ```
200
+
201
+ ```blade
202
+ <loomi-contact-card
203
+ name="Emma Miller"
204
+ position="Product Manager"
205
+ department="Growth"
206
+ email="emma@example.com"
207
+ ></loomi-contact-card>
208
+ ```
209
+
210
+ </loomi-tab>
211
+ <loomi-tab label="React">
212
+
213
+ React can render Loomi tags directly. If you are on React 18, or if you need to pass arrays, objects, or functions, use a ref and assign those values after the component mounts.
214
+
215
+ ```jsx
216
+ import "@loomidev/contact-card";
217
+
218
+ export function LoomiExample() {
219
+ return (
220
+ <loomi-contact-card
221
+ name="Emma Miller"
222
+ position="Product Manager"
223
+ department="Growth"
224
+ email="emma@example.com"
225
+ ></loomi-contact-card>
226
+ );
227
+ }
228
+ ```
229
+
230
+ If TypeScript does not recognize the Loomi tag in JSX, add it to your app's JSX type declarations.
231
+
232
+ </loomi-tab>
233
+ <loomi-tab label="Vue">
234
+
235
+ Import the package in the component that uses it, or once in your main Vue file. Vue templates can use Loomi tags directly. For arrays, objects, or functions, pass the value as a JavaScript property instead of as plain text.
236
+
237
+ ```vue
238
+ <script setup>
239
+ import "@loomidev/contact-card";
240
+ </script>
241
+
242
+ <template>
243
+ <loomi-contact-card
244
+ name="Emma Miller"
245
+ position="Product Manager"
246
+ department="Growth"
247
+ email="emma@example.com"
248
+ ></loomi-contact-card>
249
+ </template>
250
+ ```
251
+
252
+ If Vue warns that the tag is an unknown component, configure `compilerOptions.isCustomElement` for tags that start with `loomi-` in your Vite or Vue config.
253
+
254
+ </loomi-tab>
255
+ <loomi-tab label="Angular">
256
+
257
+ Import the package once and tell Angular to allow custom HTML tags with `CUSTOM_ELEMENTS_SCHEMA`. For NgModule apps, add the schema to the module instead of the standalone component.
258
+
259
+ ```ts
260
+ // app.component.ts
261
+ import { CUSTOM_ELEMENTS_SCHEMA, Component } from "@angular/core";
262
+ import "@loomidev/contact-card";
263
+
264
+ @Component({
265
+ selector: "app-root",
266
+ standalone: true,
267
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
268
+ template: `
269
+ <loomi-contact-card
270
+ name="Emma Miller"
271
+ position="Product Manager"
272
+ department="Growth"
273
+ email="emma@example.com"
274
+ ></loomi-contact-card>
275
+ `,
276
+ })
277
+ export class AppComponent {}
278
+ ```
279
+
280
+ </loomi-tab>
281
+ <loomi-tab label="Svelte / Astro">
282
+
283
+ Svelte can import the package inside a component script. Astro can import it in the frontmatter of the page or layout where the tag appears.
284
+
285
+ ```svelte
286
+ <script>
287
+ import "@loomidev/contact-card";
288
+ </script>
289
+
290
+ <loomi-contact-card
291
+ name="Emma Miller"
292
+ position="Product Manager"
293
+ department="Growth"
294
+ email="emma@example.com"
295
+ ></loomi-contact-card>
296
+ ```
297
+
298
+ ```astro
299
+ ---
300
+ import "@loomidev/contact-card";
301
+ ---
302
+
303
+ <loomi-contact-card
304
+ name="Emma Miller"
305
+ position="Product Manager"
306
+ department="Growth"
307
+ email="emma@example.com"
308
+ ></loomi-contact-card>
309
+ ```
310
+
311
+ </loomi-tab>
312
+ </loomi-tabs>
313
+
314
+ ### Server-side rendering notes
315
+
316
+ Frameworks such as Next.js, Nuxt, SvelteKit, and Astro sometimes render HTML on the server before browser-only code runs. If your framework complains, move the Loomi import to client-side code. In Next.js, that usually means a component with `"use client"`; in Nuxt, it often means a `.client.ts` plugin.
317
+
318
+ <!-- END loomi-framework-guide -->
319
+
320
+ ## Dependencies
321
+
322
+ - `@loomidev/card`
323
+ - `@loomidev/core`
324
+ - `@loomidev/icons`
@@ -0,0 +1,285 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "LoomiContactCard",
13
+ "declaration": {
14
+ "name": "LoomiContactCard",
15
+ "module": "./loomi-contact-card.js"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "kind": "javascript-module",
22
+ "path": "src/loomi-contact-card.ts",
23
+ "declarations": [
24
+ {
25
+ "kind": "class",
26
+ "description": "`<loomi-contact-card>` — a ready-made card for displaying a contact.",
27
+ "name": "LoomiContactCard",
28
+ "slots": [
29
+ {
30
+ "description": "Extra content rendered below the contact details.",
31
+ "name": ""
32
+ }
33
+ ],
34
+ "members": [
35
+ {
36
+ "kind": "field",
37
+ "name": "name",
38
+ "type": {
39
+ "text": "string"
40
+ },
41
+ "default": "\"\"",
42
+ "attribute": "name"
43
+ },
44
+ {
45
+ "kind": "field",
46
+ "name": "position",
47
+ "type": {
48
+ "text": "string"
49
+ },
50
+ "default": "\"\"",
51
+ "attribute": "position"
52
+ },
53
+ {
54
+ "kind": "field",
55
+ "name": "department",
56
+ "type": {
57
+ "text": "string"
58
+ },
59
+ "default": "\"\"",
60
+ "attribute": "department"
61
+ },
62
+ {
63
+ "kind": "field",
64
+ "name": "image",
65
+ "type": {
66
+ "text": "string"
67
+ },
68
+ "default": "\"\"",
69
+ "attribute": "image"
70
+ },
71
+ {
72
+ "kind": "field",
73
+ "name": "email",
74
+ "type": {
75
+ "text": "string"
76
+ },
77
+ "default": "\"\"",
78
+ "attribute": "email"
79
+ },
80
+ {
81
+ "kind": "field",
82
+ "name": "mobile",
83
+ "type": {
84
+ "text": "string"
85
+ },
86
+ "default": "\"\"",
87
+ "attribute": "mobile"
88
+ },
89
+ {
90
+ "kind": "field",
91
+ "name": "birthday",
92
+ "type": {
93
+ "text": "string"
94
+ },
95
+ "default": "\"\"",
96
+ "attribute": "birthday"
97
+ },
98
+ {
99
+ "kind": "field",
100
+ "name": "hasShadow",
101
+ "type": {
102
+ "text": "boolean"
103
+ },
104
+ "default": "true",
105
+ "attribute": "has-shadow"
106
+ },
107
+ {
108
+ "kind": "field",
109
+ "name": "hasHover",
110
+ "type": {
111
+ "text": "boolean"
112
+ },
113
+ "default": "false",
114
+ "attribute": "has-hover"
115
+ },
116
+ {
117
+ "kind": "field",
118
+ "name": "centered",
119
+ "type": {
120
+ "text": "boolean"
121
+ },
122
+ "default": "false",
123
+ "attribute": "centered"
124
+ },
125
+ {
126
+ "kind": "field",
127
+ "name": "noPadding",
128
+ "type": {
129
+ "text": "boolean"
130
+ },
131
+ "default": "false",
132
+ "attribute": "no-padding"
133
+ },
134
+ {
135
+ "kind": "field",
136
+ "name": "url",
137
+ "type": {
138
+ "text": "string"
139
+ },
140
+ "default": "\"\"",
141
+ "attribute": "url"
142
+ },
143
+ {
144
+ "kind": "method",
145
+ "name": "initials",
146
+ "privacy": "private",
147
+ "return": {
148
+ "type": {
149
+ "text": "string"
150
+ }
151
+ }
152
+ },
153
+ {
154
+ "kind": "field",
155
+ "name": "onClick",
156
+ "privacy": "private"
157
+ }
158
+ ],
159
+ "attributes": [
160
+ {
161
+ "name": "name",
162
+ "type": {
163
+ "text": "string"
164
+ },
165
+ "default": "\"\"",
166
+ "fieldName": "name"
167
+ },
168
+ {
169
+ "name": "position",
170
+ "type": {
171
+ "text": "string"
172
+ },
173
+ "default": "\"\"",
174
+ "fieldName": "position"
175
+ },
176
+ {
177
+ "name": "department",
178
+ "type": {
179
+ "text": "string"
180
+ },
181
+ "default": "\"\"",
182
+ "fieldName": "department"
183
+ },
184
+ {
185
+ "name": "image",
186
+ "type": {
187
+ "text": "string"
188
+ },
189
+ "default": "\"\"",
190
+ "fieldName": "image"
191
+ },
192
+ {
193
+ "name": "email",
194
+ "type": {
195
+ "text": "string"
196
+ },
197
+ "default": "\"\"",
198
+ "fieldName": "email"
199
+ },
200
+ {
201
+ "name": "mobile",
202
+ "type": {
203
+ "text": "string"
204
+ },
205
+ "default": "\"\"",
206
+ "fieldName": "mobile"
207
+ },
208
+ {
209
+ "name": "birthday",
210
+ "type": {
211
+ "text": "string"
212
+ },
213
+ "default": "\"\"",
214
+ "fieldName": "birthday"
215
+ },
216
+ {
217
+ "name": "has-shadow",
218
+ "type": {
219
+ "text": "boolean"
220
+ },
221
+ "default": "true",
222
+ "fieldName": "hasShadow"
223
+ },
224
+ {
225
+ "name": "has-hover",
226
+ "type": {
227
+ "text": "boolean"
228
+ },
229
+ "default": "false",
230
+ "fieldName": "hasHover"
231
+ },
232
+ {
233
+ "name": "centered",
234
+ "type": {
235
+ "text": "boolean"
236
+ },
237
+ "default": "false",
238
+ "fieldName": "centered"
239
+ },
240
+ {
241
+ "name": "no-padding",
242
+ "type": {
243
+ "text": "boolean"
244
+ },
245
+ "default": "false",
246
+ "fieldName": "noPadding"
247
+ },
248
+ {
249
+ "name": "url",
250
+ "type": {
251
+ "text": "string"
252
+ },
253
+ "default": "\"\"",
254
+ "fieldName": "url"
255
+ }
256
+ ],
257
+ "superclass": {
258
+ "name": "LoomiElement",
259
+ "package": "@loomidev/core"
260
+ },
261
+ "tagName": "loomi-contact-card",
262
+ "customElement": true
263
+ }
264
+ ],
265
+ "exports": [
266
+ {
267
+ "kind": "js",
268
+ "name": "LoomiContactCard",
269
+ "declaration": {
270
+ "name": "LoomiContactCard",
271
+ "module": "src/loomi-contact-card.ts"
272
+ }
273
+ },
274
+ {
275
+ "kind": "custom-element-definition",
276
+ "name": "loomi-contact-card",
277
+ "declaration": {
278
+ "name": "LoomiContactCard",
279
+ "module": "src/loomi-contact-card.ts"
280
+ }
281
+ }
282
+ ]
283
+ }
284
+ ]
285
+ }
@@ -0,0 +1,3 @@
1
+ /** Compiled, Shadow-DOM-scoped styles. Colors resolve via `var(--loomi-*)`. */
2
+ export declare const componentStyles: import("lit").CSSResult;
3
+ //# sourceMappingURL=styles.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,eAAO,MAAM,eAAe,yBAAwqC,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Generated by @loomidev/contact-card — do not edit by hand. Run `pnpm build` to regenerate.
2
+ import { unsafeCSS } from "lit";
3
+ /** Compiled, Shadow-DOM-scoped styles. Colors resolve via `var(--loomi-*)`. */
4
+ export const componentStyles = unsafeCSS("/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n@layer theme,base,components,utilities;:host{display:block}:host([hidden]){display:none}.loomi-cc{color:var(--loomi-text-secondary);gap:1rem;display:flex}.loomi-cc.clickable{cursor:pointer}.loomi-cc.centered{text-align:center;flex-direction:column;align-items:center}.loomi-cc.flush{margin:calc(-1 * var(--loomi-card-spacing,1rem))}.loomi-avatar{object-fit:cover;background:var(--loomi-surface-hover);width:3.5rem;height:3.5rem;color:var(--loomi-text-muted);text-transform:uppercase;border-radius:9999px;flex:none;justify-content:center;align-items:center;font-weight:600;display:flex}.loomi-body{min-width:0}.loomi-name{color:var(--loomi-text);font-size:1.05rem;font-weight:600}.loomi-position{color:var(--loomi-text-muted);margin-bottom:.4rem;font-size:.875rem}.loomi-row{color:var(--loomi-text-secondary);align-items:center;gap:.45rem;margin-top:.2rem;font-size:.85rem;display:flex}.loomi-cc.centered .loomi-row{justify-content:center}.loomi-row svg{width:1rem;height:1rem;color:var(--loomi-text-faint);flex:none}.loomi-row a{color:inherit;text-decoration:none}.loomi-row a:hover{text-decoration:underline}");
5
+ //# sourceMappingURL=styles.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.css.js","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,0pCAA0pC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LoomiContactCard } from "./loomi-contact-card.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { LoomiContactCard } from "./loomi-contact-card.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type TemplateResult } from "lit";
2
+ import { LoomiElement } from "@loomidev/core";
3
+ import "@loomidev/card/loomi-card.js";
4
+ /**
5
+ * `<loomi-contact-card>` — a ready-made card for displaying a contact.
6
+ * @slot - Extra content rendered below the contact details.
7
+ */
8
+ export declare class LoomiContactCard extends LoomiElement {
9
+ static styles: import("lit").CSSResultGroup[];
10
+ name: string;
11
+ position: string;
12
+ department: string;
13
+ image: string;
14
+ email: string;
15
+ mobile: string;
16
+ birthday: string;
17
+ hasShadow: boolean;
18
+ hasHover: boolean;
19
+ centered: boolean;
20
+ noPadding: boolean;
21
+ url: string;
22
+ private initials;
23
+ private onClick;
24
+ render(): TemplateResult;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ "loomi-contact-card": LoomiContactCard;
29
+ }
30
+ }
31
+ //# sourceMappingURL=loomi-contact-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loomi-contact-card.d.ts","sourceRoot":"","sources":["../src/loomi-contact-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAE3D,OAAO,8BAA8B,CAAC;AAOtC;;;GAGG;AACH,qBACa,gBAAiB,SAAQ,YAAY;IAChD,OAAgB,MAAM,iCAAgC;IAE1C,IAAI,SAAM;IACV,QAAQ,SAAM;IACd,UAAU,SAAM;IAChB,KAAK,SAAM;IACX,KAAK,SAAM;IACX,MAAM,SAAM;IACZ,QAAQ,SAAM;IAC4B,SAAS,UAAQ;IAClB,QAAQ,UAAS;IACzC,QAAQ,UAAS;IACQ,SAAS,UAAS;IAC5D,GAAG,SAAM;IAErB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,OAAO,CAKb;IAEO,MAAM,IAAI,cAAc;CAiClC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
@@ -0,0 +1,124 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, nothing } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { LoomiElement, loomiStyles } from "@loomidev/core";
10
+ import { getLoomiIcon } from "@loomidev/icons";
11
+ import "@loomidev/card/loomi-card.js";
12
+ import { componentStyles } from "./generated/styles.css.js";
13
+ function icon(name) {
14
+ return html `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true">${getLoomiIcon(name)}</svg>`;
15
+ }
16
+ /**
17
+ * `<loomi-contact-card>` — a ready-made card for displaying a contact.
18
+ * @slot - Extra content rendered below the contact details.
19
+ */
20
+ let LoomiContactCard = class LoomiContactCard extends LoomiElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.name = "";
24
+ this.position = "";
25
+ this.department = "";
26
+ this.image = "";
27
+ this.email = "";
28
+ this.mobile = "";
29
+ this.birthday = "";
30
+ this.hasShadow = true;
31
+ this.hasHover = false;
32
+ this.centered = false;
33
+ this.noPadding = false;
34
+ this.url = "";
35
+ this.onClick = () => {
36
+ if (!this.url)
37
+ return;
38
+ if (/^https?:\/\//.test(this.url))
39
+ window.open(this.url, "_blank");
40
+ else if (/\)$/.test(this.url))
41
+ new Function(this.url)();
42
+ else
43
+ location.href = this.url;
44
+ };
45
+ }
46
+ static { this.styles = loomiStyles(componentStyles); }
47
+ initials() {
48
+ return this.name
49
+ .split(/\s+/)
50
+ .map((w) => w[0])
51
+ .slice(0, 2)
52
+ .join("");
53
+ }
54
+ render() {
55
+ const cls = [
56
+ "loomi-cc",
57
+ this.hasShadow ? "shadow" : "",
58
+ this.hasHover ? "hover" : "",
59
+ this.centered ? "centered" : "",
60
+ this.noPadding ? "flush" : "",
61
+ this.url ? "clickable" : "",
62
+ ].join(" ");
63
+ return html `<loomi-card size="sm" .url=${this.url} ?has-hover=${this.hasHover}>
64
+ <loomi-card-content>
65
+ <div class=${cls} @click=${this.url ? this.onClick : nothing}>
66
+ ${this.image
67
+ ? html `<img class="loomi-avatar" src=${this.image} alt=${this.name} />`
68
+ : html `<span class="loomi-avatar">${this.initials()}</span>`}
69
+ <div class="loomi-body">
70
+ <div class="loomi-name">${this.name}</div>
71
+ ${this.position || this.department
72
+ ? html `<div class="loomi-position">${[this.position, this.department].filter(Boolean).join(" · ")}</div>`
73
+ : nothing}
74
+ ${this.email ? html `<div class="loomi-row">${icon("envelope")}<a href="mailto:${this.email}">${this.email}</a></div>` : nothing}
75
+ ${this.mobile ? html `<div class="loomi-row">${icon("phone")}<a href="tel:${this.mobile}">${this.mobile}</a></div>` : nothing}
76
+ ${this.birthday ? html `<div class="loomi-row">${icon("cake")}<span>${this.birthday}</span></div>` : nothing}
77
+ <slot></slot>
78
+ </div>
79
+ </div>
80
+ </loomi-card-content>
81
+ </loomi-card>`;
82
+ }
83
+ };
84
+ __decorate([
85
+ property()
86
+ ], LoomiContactCard.prototype, "name", void 0);
87
+ __decorate([
88
+ property()
89
+ ], LoomiContactCard.prototype, "position", void 0);
90
+ __decorate([
91
+ property()
92
+ ], LoomiContactCard.prototype, "department", void 0);
93
+ __decorate([
94
+ property()
95
+ ], LoomiContactCard.prototype, "image", void 0);
96
+ __decorate([
97
+ property()
98
+ ], LoomiContactCard.prototype, "email", void 0);
99
+ __decorate([
100
+ property()
101
+ ], LoomiContactCard.prototype, "mobile", void 0);
102
+ __decorate([
103
+ property()
104
+ ], LoomiContactCard.prototype, "birthday", void 0);
105
+ __decorate([
106
+ property({ type: Boolean, attribute: "has-shadow" })
107
+ ], LoomiContactCard.prototype, "hasShadow", void 0);
108
+ __decorate([
109
+ property({ type: Boolean, attribute: "has-hover" })
110
+ ], LoomiContactCard.prototype, "hasHover", void 0);
111
+ __decorate([
112
+ property({ type: Boolean })
113
+ ], LoomiContactCard.prototype, "centered", void 0);
114
+ __decorate([
115
+ property({ type: Boolean, attribute: "no-padding" })
116
+ ], LoomiContactCard.prototype, "noPadding", void 0);
117
+ __decorate([
118
+ property()
119
+ ], LoomiContactCard.prototype, "url", void 0);
120
+ LoomiContactCard = __decorate([
121
+ customElement("loomi-contact-card")
122
+ ], LoomiContactCard);
123
+ export { LoomiContactCard };
124
+ //# sourceMappingURL=loomi-contact-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loomi-contact-card.js","sourceRoot":"","sources":["../src/loomi-contact-card.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI,CAAA,oGAAoG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC5I,CAAC;AAED;;;GAGG;AAEI,IAAM,gBAAgB,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,gBAAgB,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC,OAAO;cAC1H,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,0BAA0B,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ,eAAe,CAAC,CAAC,CAAC,OAAO;;;;;kBAKrG,CAAC;IACjB,CAAC;;AA5DW;IAAX,QAAQ,EAAE;8CAAW;AACV;IAAX,QAAQ,EAAE;kDAAe;AACd;IAAX,QAAQ,EAAE;oDAAiB;AAChB;IAAX,QAAQ,EAAE;+CAAY;AACX;IAAX,QAAQ,EAAE;+CAAY;AACX;IAAX,QAAQ,EAAE;gDAAa;AACZ;IAAX,QAAQ,EAAE;kDAAe;AAC4B;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;mDAAkB;AAClB;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;kDAAkB;AACzC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAkB;AACQ;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;mDAAmB;AAC5D;IAAX,QAAQ,EAAE;6CAAU;AAdV,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAgE5B"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@loomidev/contact-card",
3
+ "version": "0.2.0",
4
+ "description": "<loomi-contact-card> — a ready-made contact card.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/loomidev/loomiui.git",
8
+ "directory": "packages/contact-card"
9
+ },
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist",
20
+ "custom-elements.json"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./loomi-contact-card.js": {
28
+ "types": "./dist/loomi-contact-card.d.ts",
29
+ "import": "./dist/loomi-contact-card.js"
30
+ }
31
+ },
32
+ "dependencies": {
33
+ "@loomidev/core": "^0.2.0",
34
+ "@loomidev/card": "^0.2.0",
35
+ "@loomidev/icons": "^0.2.0"
36
+ },
37
+ "peerDependencies": {
38
+ "lit": "^3.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@tailwindcss/cli": "^4.0.0",
42
+ "lit": "^3.3.3",
43
+ "tailwindcss": "^4.0.0",
44
+ "typescript": "^5.6.3",
45
+ "@loomidev/theme": "^0.2.0"
46
+ },
47
+ "keywords": [
48
+ "web-components",
49
+ "lit",
50
+ "loomiui",
51
+ "contact-card"
52
+ ],
53
+ "customElements": "custom-elements.json",
54
+ "scripts": {
55
+ "build": "node scripts/build-styles.mjs && tsc -p tsconfig.json",
56
+ "dev": "node scripts/build-styles.mjs && tsc -p tsconfig.json --watch",
57
+ "typecheck": "tsc -p tsconfig.json --noEmit"
58
+ }
59
+ }