@c2n/card 0.0.6 → 0.0.7
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/dist/card.js +14 -6
- package/package.json +18 -6
- package/react.d.ts +24 -0
- package/react.js +3 -0
- package/types/src/card.d.ts +3 -0
- package/types/src/card.d.ts.map +1 -1
- package/vue.d.ts +29 -0
- package/vue.js +3 -0
package/dist/card.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, nothing, unsafeCSS } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { property, state } from "lit/decorators.js";
|
|
3
|
+
import { customElement } from "@c2n/core/element-helper.js";
|
|
3
4
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
5
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
5
6
|
//#region src/card.scss?inline
|
|
@@ -15,8 +16,11 @@ function __decorate(decorators, target, key, desc) {
|
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region src/card.ts
|
|
17
18
|
var Card = class Card extends LitElement {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
static {
|
|
20
|
+
this.styles = unsafeCSS(card_default);
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
20
24
|
this.disabled = false;
|
|
21
25
|
this.interactive = false;
|
|
22
26
|
this.href = void 0;
|
|
@@ -26,9 +30,12 @@ var Card = class Card extends LitElement {
|
|
|
26
30
|
this.hasHeader = false;
|
|
27
31
|
this.hasContent = false;
|
|
28
32
|
this.hasFooter = false;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
this.addEventListener("click", (event) => {
|
|
34
|
+
if (this.disabled && (this.interactive || this.href)) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
event.stopImmediatePropagation();
|
|
37
|
+
}
|
|
38
|
+
}, true);
|
|
32
39
|
}
|
|
33
40
|
handleSlotChange(event) {
|
|
34
41
|
this.updateSection(event.target);
|
|
@@ -53,6 +60,7 @@ var Card = class Card extends LitElement {
|
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
handleKeydown(event) {
|
|
63
|
+
if (event.target !== event.currentTarget) return;
|
|
56
64
|
if (event.key === "Enter" || event.key === " ") {
|
|
57
65
|
event.preventDefault();
|
|
58
66
|
this.click();
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/card",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/card.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"types": "./types/src/card.d.ts",
|
|
9
|
+
"default": "./dist/card.js"
|
|
10
|
+
},
|
|
11
|
+
"./react": {
|
|
12
|
+
"types": "./react.d.ts",
|
|
13
|
+
"default": "./react.js"
|
|
14
|
+
},
|
|
15
|
+
"./vue": {
|
|
16
|
+
"types": "./vue.d.ts",
|
|
17
|
+
"default": "./vue.js"
|
|
10
18
|
},
|
|
11
19
|
"./custom-elements.json": "./custom-elements.json"
|
|
12
20
|
},
|
|
13
21
|
"files": [
|
|
14
22
|
"dist",
|
|
15
|
-
"types"
|
|
23
|
+
"types",
|
|
24
|
+
"react.d.ts",
|
|
25
|
+
"react.js",
|
|
26
|
+
"vue.d.ts",
|
|
27
|
+
"vue.js"
|
|
16
28
|
],
|
|
17
29
|
"keywords": [
|
|
18
30
|
"card",
|
|
@@ -48,12 +60,12 @@
|
|
|
48
60
|
}
|
|
49
61
|
},
|
|
50
62
|
"dependencies": {
|
|
51
|
-
"@c2n/core": "0.0.
|
|
63
|
+
"@c2n/core": "0.0.7",
|
|
52
64
|
"lit": "3.3.3"
|
|
53
65
|
},
|
|
54
66
|
"devDependencies": {
|
|
55
67
|
"@c2n/config": "*"
|
|
56
68
|
},
|
|
57
69
|
"customElements": "custom-elements.json",
|
|
58
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c8db398a27f7cd417d665fdf5da455fee2d4e910"
|
|
59
71
|
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// GENERATED by @c2n/framework-types. Do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// JSX types for the custom elements of @c2n/card. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/card/react'
|
|
6
|
+
//
|
|
7
|
+
// Register the elements at module scope before React renders, or React writes an object prop as an
|
|
8
|
+
// attribute and it stringifies.
|
|
9
|
+
|
|
10
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
11
|
+
import type { Card } from '@c2n/card'
|
|
12
|
+
|
|
13
|
+
/** Standard React host-element attributes plus the element's own public properties. */
|
|
14
|
+
type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
|
|
15
|
+
|
|
16
|
+
declare module 'react' {
|
|
17
|
+
namespace JSX {
|
|
18
|
+
interface IntrinsicElements {
|
|
19
|
+
'c2-card': C2Props<Card>
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {}
|
package/react.js
ADDED
package/types/src/card.d.ts
CHANGED
|
@@ -66,13 +66,16 @@ import { LitElement } from 'lit';
|
|
|
66
66
|
*/
|
|
67
67
|
export declare class Card extends LitElement {
|
|
68
68
|
static styles: import("lit").CSSResult;
|
|
69
|
+
constructor();
|
|
69
70
|
/** Dims the card and ignores pointer and keyboard interaction. A link card renders without its anchor. */
|
|
70
71
|
disabled: boolean;
|
|
71
72
|
/** Button-like card: focusable, `role="button"`, Enter and Space dispatch `click`, pointer cursor. Implied by `href`. */
|
|
72
73
|
interactive: boolean;
|
|
73
74
|
/** Makes the whole card a link. */
|
|
74
75
|
href: string | undefined;
|
|
76
|
+
/** Browsing context used when `href` is set, such as `_blank`. */
|
|
75
77
|
target: string | undefined;
|
|
78
|
+
/** Link relationship forwarded to the anchor when `href` is set. */
|
|
76
79
|
rel: string | undefined;
|
|
77
80
|
private hasMedia;
|
|
78
81
|
private hasHeader;
|
package/types/src/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,KAAK,CAAA;AAO1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,qBACa,IAAK,SAAQ,UAAU;IAClC,OAAgB,MAAM,0BAAoB;;IAgB1C,0GAA0G;IAC9D,QAAQ,UAAQ;IAE5D,yHAAyH;IAC7E,WAAW,UAAQ;IAE/D,mCAAmC;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAY;IAEhD,kEAAkE;IACtD,MAAM,EAAE,MAAM,GAAG,SAAS,CAAY;IAElD,oEAAoE;IACxD,GAAG,EAAE,MAAM,GAAG,SAAS,CAAY;IAEtC,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,SAAS,CAAQ;IAElC,OAAO,CAAC,gBAAgB;IAIxB,wHAAwH;IAC/G,YAAY;IAIrB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,cAAc;IASb,MAAM;CAoBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAA;KAChB;CACF"}
|
package/vue.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// GENERATED by @c2n/framework-types. Do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// Vue template types for the custom elements of @c2n/card. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/card/vue'
|
|
6
|
+
//
|
|
7
|
+
// Tell the compiler about the tags as well, or every c2-* tag is resolved as a Vue component and renders
|
|
8
|
+
// nothing: template.compilerOptions.isCustomElement = (tag) => tag.startsWith('c2-') in vite.config.ts.
|
|
9
|
+
|
|
10
|
+
import type { DefineComponent, HTMLAttributes } from 'vue'
|
|
11
|
+
import type { Card } from '@c2n/card'
|
|
12
|
+
|
|
13
|
+
/** The element's own public properties, plus every attribute Vue understands on a host element. */
|
|
14
|
+
type C2Props<T> = Partial<Omit<T, keyof HTMLElement>> & HTMLAttributes
|
|
15
|
+
|
|
16
|
+
declare module 'vue' {
|
|
17
|
+
interface GlobalComponents {
|
|
18
|
+
'c2-card': DefineComponent<C2Props<Card>>
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module '@vue/runtime-dom' {
|
|
23
|
+
interface HTMLAttributes {
|
|
24
|
+
/** Vue's own definition omits it, and slotting a plain element into a component needs it. */
|
|
25
|
+
slot?: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {}
|
package/vue.js
ADDED