@umbraco-ui/uui-card 1.4.0-rc.1 → 1.4.0-rc.2

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.
@@ -17,6 +17,18 @@
17
17
  "type": "boolean",
18
18
  "default": "\"false\""
19
19
  },
20
+ {
21
+ "name": "href",
22
+ "description": "Set an href, this will turns the name of the card into an anchor tag.",
23
+ "type": "string",
24
+ "default": "\"undefined\""
25
+ },
26
+ {
27
+ "name": "target",
28
+ "description": "Set an anchor tag target, only used when using href.",
29
+ "type": "string",
30
+ "default": "\"undefined\""
31
+ },
20
32
  {
21
33
  "name": "select-only",
22
34
  "description": "Enforce selection interaction and prevent all other interactions, set this when the UI is turned into Selection-Mode.",
@@ -54,6 +66,20 @@
54
66
  "type": "boolean",
55
67
  "default": "\"false\""
56
68
  },
69
+ {
70
+ "name": "href",
71
+ "attribute": "href",
72
+ "description": "Set an href, this will turns the name of the card into an anchor tag.",
73
+ "type": "string",
74
+ "default": "\"undefined\""
75
+ },
76
+ {
77
+ "name": "target",
78
+ "attribute": "target",
79
+ "description": "Set an anchor tag target, only used when using href.",
80
+ "type": "string",
81
+ "default": "\"undefined\""
82
+ },
57
83
  {
58
84
  "name": "selectOnly",
59
85
  "attribute": "select-only",
@@ -77,7 +103,7 @@
77
103
  "events": [
78
104
  {
79
105
  "name": "open",
80
- "description": "fires when the card title is clicked"
106
+ "description": "fires when the card title is clicked."
81
107
  },
82
108
  {
83
109
  "name": "selected",
@@ -87,6 +113,12 @@
87
113
  "name": "deselected",
88
114
  "description": "fires when the media card is deselected"
89
115
  }
116
+ ],
117
+ "slots": [
118
+ {
119
+ "name": "",
120
+ "description": "Default content."
121
+ }
90
122
  ]
91
123
  }
92
124
  ]
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SelectOnlyMixin, SelectableMixin } from '@umbraco-ui/uui-base/lib/mixins';
2
2
  import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
3
- import { LitElement, css } from 'lit';
3
+ import { LitElement, html, css } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
6
6
 
@@ -27,12 +27,14 @@ let UUICardElement = class extends SelectOnlyMixin(
27
27
  this.disabled = false;
28
28
  this.error = false;
29
29
  }
30
+ // This is deprecated - use href instead
30
31
  handleOpenClick(e) {
31
32
  if (this.disabled)
32
33
  return;
33
34
  e.stopPropagation();
34
35
  this.dispatchEvent(new UUICardEvent(UUICardEvent.OPEN));
35
36
  }
37
+ // This is deprecated - use href instead
36
38
  handleOpenKeydown(e) {
37
39
  if (this.disabled)
38
40
  return;
@@ -42,6 +44,9 @@ let UUICardElement = class extends SelectOnlyMixin(
42
44
  e.stopPropagation();
43
45
  this.dispatchEvent(new UUICardEvent(UUICardEvent.OPEN));
44
46
  }
47
+ render() {
48
+ return html`<slot></slot>`;
49
+ }
45
50
  };
46
51
  UUICardElement.styles = [
47
52
  css`
@@ -123,6 +128,11 @@ UUICardElement.styles = [
123
128
  :host([select-only]) ::slotted(*) {
124
129
  pointer-events: none;
125
130
  }
131
+
132
+ a {
133
+ text-decoration: none;
134
+ color: inherit;
135
+ }
126
136
  `
127
137
  ];
128
138
  __decorateClass([
@@ -131,6 +141,12 @@ __decorateClass([
131
141
  __decorateClass([
132
142
  property({ type: Boolean, reflect: true })
133
143
  ], UUICardElement.prototype, "error", 2);
144
+ __decorateClass([
145
+ property({ type: String })
146
+ ], UUICardElement.prototype, "href", 2);
147
+ __decorateClass([
148
+ property({ type: String })
149
+ ], UUICardElement.prototype, "target", 2);
134
150
  UUICardElement = __decorateClass([
135
151
  defineElement("uui-card")
136
152
  ], UUICardElement);
@@ -2,8 +2,9 @@ import { LitElement } from 'lit';
2
2
  declare const UUICardElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").SelectOnlyMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").SelectableMixinInterface) & typeof LitElement;
3
3
  /**
4
4
  * @element uui-card
5
- * @fires {UUICardEvent} open - fires when the card title is clicked
6
- * @description - Base card component to be extended by specific cards.
5
+ * @fires {UUICardEvent} open - fires when the card title is clicked.
6
+ * @description - Base card component to be extended by specific card elements.
7
+ * @slot - Default content.
7
8
  */
8
9
  export declare class UUICardElement extends UUICardElement_base {
9
10
  static styles: import("lit").CSSResult[];
@@ -22,8 +23,23 @@ export declare class UUICardElement extends UUICardElement_base {
22
23
  * @default false
23
24
  */
24
25
  error: boolean;
26
+ /**
27
+ * Set an href, this will turns the name of the card into an anchor tag.
28
+ * @type {string}
29
+ * @attr
30
+ * @default undefined
31
+ */
32
+ href?: string;
33
+ /**
34
+ * Set an anchor tag target, only used when using href.
35
+ * @type {string}
36
+ * @attr
37
+ * @default undefined
38
+ */
39
+ target?: '_blank' | '_parent' | '_self' | '_top';
25
40
  protected handleOpenClick(e: Event): void;
26
41
  protected handleOpenKeydown(e: KeyboardEvent): void;
42
+ protected render(): import("lit-html").TemplateResult<1>;
27
43
  }
28
44
  declare global {
29
45
  interface HTMLElementTagNameMap {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-card",
3
- "version": "1.4.0-rc.1",
3
+ "version": "1.4.0-rc.2",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,7 +30,7 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.4.0-rc.1"
33
+ "@umbraco-ui/uui-base": "1.4.0-rc.2"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -41,5 +41,5 @@
41
41
  "access": "public"
42
42
  },
43
43
  "homepage": "https://uui.umbraco.com/?path=/story/uui-card",
44
- "gitHead": "2ecc805ac912c25d89bc96eaf7f50b97aa85fff0"
44
+ "gitHead": "f2ace7a943c5c18ae7ec5c047588b16327aa6f95"
45
45
  }