@umbraco-ui/uui-card 0.0.2 → 0.1.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/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-card?logoColor=%231B264F)
4
4
 
5
+ ### See it in action
6
+
7
+ Preview the component on [Storybook](https://uui.umbraco.com/?path=/story/uui-card)
8
+
5
9
  ## Installation
6
10
 
7
11
  ### ES imports
@@ -13,7 +17,7 @@ npm i @umbraco-ui/uui-card
13
17
  ## Usage
14
18
 
15
19
  ```javascript
16
- import { UUICardElement } from '@umbraco-ui/uui-card/lib/uui-card.element';
20
+ import { UUICardElement } from '@umbraco-ui/uui-card';
17
21
 
18
22
  class MyCardElement extends UUICardElement {}
19
23
  ```
@@ -77,14 +77,14 @@
77
77
  "events": [
78
78
  {
79
79
  "name": "open",
80
- "description": "fires when the media card title is clicked"
80
+ "description": "fires when the card title is clicked"
81
81
  },
82
82
  {
83
- "name": "select",
83
+ "name": "selected",
84
84
  "description": "fires when the media card is selected"
85
85
  },
86
86
  {
87
- "name": "unselect",
87
+ "name": "unselected",
88
88
  "description": "fires when the media card is unselected"
89
89
  }
90
90
  ]
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './uui-card.element';
2
+ export * from './UUICardEvent';
@@ -1,6 +1,7 @@
1
+ import { SelectOnlyMixin, SelectableMixin } from '@umbraco-ui/uui-base/lib/mixins';
2
+ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
1
3
  import { LitElement, css } from 'lit';
2
4
  import { property } from 'lit/decorators.js';
3
- import { SelectOnlyMixin, SelectableMixin } from '@umbraco-ui/uui-base/lib/mixins';
4
5
  import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
5
6
 
6
7
  class UUICardEvent extends UUIEvent {
@@ -18,7 +19,7 @@ var __decorateClass = (decorators, target, key, kind) => {
18
19
  __defProp(target, key, result);
19
20
  return result;
20
21
  };
21
- class UUICardElement extends SelectOnlyMixin(SelectableMixin(LitElement)) {
22
+ let UUICardElement = class extends SelectOnlyMixin(SelectableMixin(LitElement)) {
22
23
  constructor() {
23
24
  super(...arguments);
24
25
  this.disabled = false;
@@ -39,7 +40,7 @@ class UUICardElement extends SelectOnlyMixin(SelectableMixin(LitElement)) {
39
40
  e.stopPropagation();
40
41
  this.dispatchEvent(new UUICardEvent(UUICardEvent.OPEN));
41
42
  }
42
- }
43
+ };
43
44
  UUICardElement.styles = [
44
45
  css`
45
46
  :host {
@@ -48,8 +49,7 @@ UUICardElement.styles = [
48
49
  width: 100%;
49
50
  justify-content: center;
50
51
  box-sizing: border-box;
51
- /* TODO: fix automatic fallback values for shadows before we use them: var(--uui-shadow-depth-1)*/
52
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
52
+ box-shadow: var(--uui-shadow-depth-1,0 1px 3px rgba(0,0,0,0.12) , 0 1px 2px rgba(0,0,0,0.24));
53
53
  border-radius: var(--uui-border-radius,3px);
54
54
  min-height: var(--uui-layout-medium);
55
55
  background-color: var(--uui-interface-surface,#fefefe);
@@ -109,17 +109,7 @@ UUICardElement.styles = [
109
109
  }
110
110
 
111
111
  :host([selectable]:not([selected]):hover) #select-border::after {
112
- -webkit-animation: not-selected--hover 1.2s infinite;
113
- animation: not-selected--hover 1.2s infinite;
114
- }
115
- @-webkit-keyframes not-selected--hover {
116
- 0%,
117
- 100% {
118
- opacity: 0.66;
119
- }
120
- 50% {
121
- opacity: 1;
122
- }
112
+ animation: not-selected--hover 1.2s infinite;
123
113
  }
124
114
  @keyframes not-selected--hover {
125
115
  0%,
@@ -132,17 +122,7 @@ UUICardElement.styles = [
132
122
  }
133
123
 
134
124
  :host([selectable][selected]:hover) #select-border::after {
135
- -webkit-animation: selected--hover 1.4s infinite;
136
- animation: selected--hover 1.4s infinite;
137
- }
138
- @-webkit-keyframes selected--hover {
139
- 0%,
140
- 100% {
141
- opacity: 1;
142
- }
143
- 50% {
144
- opacity: 0.66;
145
- }
125
+ animation: selected--hover 1.4s infinite;
146
126
  }
147
127
  @keyframes selected--hover {
148
128
  0%,
@@ -154,8 +134,7 @@ UUICardElement.styles = [
154
134
  }
155
135
  }
156
136
  :host([selectable]) #open-part:hover + #select-border::after {
157
- -webkit-animation: none;
158
- animation: none;
137
+ animation: none;
159
138
  }
160
139
  :host([error])::after {
161
140
  inset: calc(var(--uui-card-border-width) * -2);
@@ -175,5 +154,8 @@ __decorateClass([
175
154
  __decorateClass([
176
155
  property({ type: Boolean, reflect: true })
177
156
  ], UUICardElement.prototype, "error", 2);
157
+ UUICardElement = __decorateClass([
158
+ defineElement("uui-card")
159
+ ], UUICardElement);
178
160
 
179
- export { UUICardElement };
161
+ export { UUICardElement, UUICardEvent };
@@ -2,9 +2,7 @@ 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 media card title is clicked
6
- * @fires {UUISelectableEvent} select - fires when the media card is selected
7
- * @fires {UUISelectableEvent} unselect - fires when the media card is unselected
5
+ * @fires {UUICardEvent} open - fires when the card title is clicked
8
6
  * @description - Base card component to be extended by specific cards.
9
7
  */
10
8
  export declare class UUICardElement extends UUICardElement_base {
@@ -27,4 +25,9 @@ export declare class UUICardElement extends UUICardElement_base {
27
25
  protected handleOpenClick(e: Event): void;
28
26
  protected handleOpenKeydown(e: KeyboardEvent): void;
29
27
  }
28
+ declare global {
29
+ interface HTMLElementTagNameMap {
30
+ 'uui-card': UUICardElement;
31
+ }
32
+ }
30
33
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-card",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -19,17 +19,18 @@
19
19
  "bugs": {
20
20
  "url": "https://github.com/umbraco/Umbraco.UI/issues"
21
21
  },
22
- "main": "./dist/index.js",
22
+ "main": "./lib/index.js",
23
23
  "module": "./lib/index.js",
24
+ "types": "./lib/index.d.ts",
25
+ "type": "module",
24
26
  "customElements": "custom-elements.json",
25
27
  "files": [
26
- "dist",
27
28
  "lib/**/*.d.ts",
28
29
  "lib/**/*.js",
29
30
  "custom-elements.json"
30
31
  ],
31
32
  "dependencies": {
32
- "@umbraco-ui/uui-base": "0.0.15"
33
+ "@umbraco-ui/uui-base": "0.1.0"
33
34
  },
34
35
  "scripts": {
35
36
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -40,5 +41,5 @@
40
41
  "access": "public"
41
42
  },
42
43
  "homepage": "https://uui.umbraco.com/?path=/story/uui-card",
43
- "gitHead": "2a640ce4460de94e9c92a97310e27b84bbd6edda"
44
+ "gitHead": "9ed7860ce865d310b85bd1718f37b59db873aefd"
44
45
  }