@momentum-design/components 0.62.3 → 0.62.4
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/browser/index.js +813 -545
- package/dist/browser/index.js.map +4 -4
- package/dist/components/card/card.component.d.ts +100 -0
- package/dist/components/card/card.component.js +197 -0
- package/dist/components/card/card.constants.d.ts +22 -0
- package/dist/components/card/card.constants.js +26 -0
- package/dist/components/card/card.styles.d.ts +2 -0
- package/dist/components/card/card.styles.js +79 -0
- package/dist/components/card/card.types.d.ts +5 -0
- package/dist/components/card/card.types.js +1 -0
- package/dist/components/card/index.d.ts +9 -0
- package/dist/components/card/index.js +6 -0
- package/dist/components/cardbutton/cardbutton.component.d.ts +37 -0
- package/dist/components/cardbutton/cardbutton.component.js +61 -0
- package/dist/components/cardbutton/cardbutton.constants.d.ts +2 -0
- package/dist/components/cardbutton/cardbutton.constants.js +3 -0
- package/dist/components/cardbutton/cardbutton.styles.d.ts +2 -0
- package/dist/components/cardbutton/cardbutton.styles.js +26 -0
- package/dist/components/cardbutton/cardbutton.types.d.ts +7 -0
- package/dist/components/cardbutton/cardbutton.types.js +1 -0
- package/dist/components/cardbutton/index.d.ts +9 -0
- package/dist/components/cardbutton/index.js +6 -0
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +76 -0
- package/dist/components/cardcheckbox/cardcheckbox.component.js +159 -0
- package/dist/components/cardcheckbox/cardcheckbox.constants.d.ts +15 -0
- package/dist/components/cardcheckbox/cardcheckbox.constants.js +16 -0
- package/dist/components/cardcheckbox/cardcheckbox.styles.d.ts +2 -0
- package/dist/components/cardcheckbox/cardcheckbox.styles.js +57 -0
- package/dist/components/cardcheckbox/cardcheckbox.types.d.ts +11 -0
- package/dist/components/cardcheckbox/cardcheckbox.types.js +1 -0
- package/dist/components/cardcheckbox/index.d.ts +10 -0
- package/dist/components/cardcheckbox/index.js +7 -0
- package/dist/components/cardradio/cardradio.component.d.ts +76 -0
- package/dist/components/cardradio/cardradio.component.js +155 -0
- package/dist/components/cardradio/cardradio.constants.d.ts +2 -0
- package/dist/components/cardradio/cardradio.constants.js +3 -0
- package/dist/components/cardradio/cardradio.styles.d.ts +2 -0
- package/dist/components/cardradio/cardradio.styles.js +53 -0
- package/dist/components/cardradio/cardradio.types.d.ts +8 -0
- package/dist/components/cardradio/cardradio.types.js +1 -0
- package/dist/components/cardradio/index.d.ts +10 -0
- package/dist/components/cardradio/index.js +7 -0
- package/dist/components/radiogroup/radiogroup.component.js +2 -1
- package/dist/custom-elements.json +2751 -273
- package/dist/index.d.ts +11 -7
- package/dist/index.js +11 -7
- package/dist/react/card/index.d.ts +47 -0
- package/dist/react/card/index.js +56 -0
- package/dist/react/cardbutton/index.d.ts +32 -0
- package/dist/react/cardbutton/index.js +40 -0
- package/dist/react/cardcheckbox/index.d.ts +40 -0
- package/dist/react/cardcheckbox/index.js +48 -0
- package/dist/react/cardradio/index.d.ts +40 -0
- package/dist/react/cardradio/index.js +48 -0
- package/dist/react/index.d.ts +5 -1
- package/dist/react/index.js +5 -1
- package/dist/utils/mixins/CardComponentMixin.d.ts +20 -0
- package/dist/utils/mixins/CardComponentMixin.js +130 -0
- package/package.json +1 -1
@@ -0,0 +1,130 @@
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html, nothing } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import { DEFAULTS } from '../../components/card/card.constants';
|
13
|
+
export const CardComponentMixin = (superClass) => {
|
14
|
+
class InnerMixinClass extends superClass {
|
15
|
+
constructor() {
|
16
|
+
super(...arguments);
|
17
|
+
/**
|
18
|
+
* The title of the card - part of header section
|
19
|
+
* @default ''
|
20
|
+
*/
|
21
|
+
this.cardTitle = '';
|
22
|
+
/**
|
23
|
+
* The subtitle of the card - part of header section
|
24
|
+
* @default ''
|
25
|
+
*/
|
26
|
+
this.subtitle = '';
|
27
|
+
/**
|
28
|
+
* The image source URL to render on the card
|
29
|
+
* @default ''
|
30
|
+
*/
|
31
|
+
this.imageSrc = '';
|
32
|
+
/**
|
33
|
+
* The image alt for accessibility support
|
34
|
+
* @default ''
|
35
|
+
*/
|
36
|
+
this.imageAlt = '';
|
37
|
+
/**
|
38
|
+
* The variant of the card. It can either be set to 'border' or 'ghost'
|
39
|
+
* @default 'border'
|
40
|
+
*/
|
41
|
+
this.variant = DEFAULTS.VARIANT;
|
42
|
+
/**
|
43
|
+
* The orientation of the card. It can either be set to 'vertical' or 'horizontal'
|
44
|
+
* @default 'vertical'
|
45
|
+
*/
|
46
|
+
this.orientation = DEFAULTS.ORIENTATION;
|
47
|
+
/**
|
48
|
+
* The tag name for the card title. It supports all the types that `msc-text` supports
|
49
|
+
* @default 'span'
|
50
|
+
*/
|
51
|
+
this.titleTagName = DEFAULTS.TAGNAME;
|
52
|
+
/**
|
53
|
+
* The tag name for the subtitle. It supports all the types that `msc-text` supports
|
54
|
+
* @default 'span'
|
55
|
+
*/
|
56
|
+
this.subtitleTagName = DEFAULTS.TAGNAME;
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Renders the image on the card if image source is provided
|
60
|
+
* @returns The image element
|
61
|
+
*/
|
62
|
+
renderImage() {
|
63
|
+
if (!this.imageSrc) {
|
64
|
+
return nothing;
|
65
|
+
}
|
66
|
+
return html `<img part="image" src="${this.imageSrc}" alt="${this.imageAlt}"/>`;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Renders the icon on the card if icon name is provided
|
70
|
+
* @returns The icon element
|
71
|
+
*/
|
72
|
+
renderIcon() {
|
73
|
+
return this.iconName ? html `<mdc-icon part="icon"
|
74
|
+
size="${DEFAULTS.ICON_SIZE}"
|
75
|
+
length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
|
76
|
+
name="${this.iconName}"></mdc-icon>`
|
77
|
+
: nothing;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Renders the title and subtitle on the card
|
81
|
+
* @returns The title and subtitle elements
|
82
|
+
*/
|
83
|
+
renderTitle() {
|
84
|
+
return html `<div part="title-container">
|
85
|
+
<mdc-text part="title" type="${DEFAULTS.TITLE_TYPE}" tagname="${this.titleTagName}">${this.cardTitle}</mdc-text>
|
86
|
+
${this.subtitle ? html `<mdc-text part="subtitle"
|
87
|
+
type="${DEFAULTS.SUBTITLE_TYPE}"
|
88
|
+
tagname="${this.subtitleTagName}">${this.subtitle}</mdc-text>` : nothing}
|
89
|
+
</div>`;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
__decorate([
|
93
|
+
property({ type: String, attribute: 'card-title' }),
|
94
|
+
__metadata("design:type", Object)
|
95
|
+
], InnerMixinClass.prototype, "cardTitle", void 0);
|
96
|
+
__decorate([
|
97
|
+
property({ type: String }),
|
98
|
+
__metadata("design:type", Object)
|
99
|
+
], InnerMixinClass.prototype, "subtitle", void 0);
|
100
|
+
__decorate([
|
101
|
+
property({ type: String, attribute: 'image-src' }),
|
102
|
+
__metadata("design:type", Object)
|
103
|
+
], InnerMixinClass.prototype, "imageSrc", void 0);
|
104
|
+
__decorate([
|
105
|
+
property({ type: String, attribute: 'image-alt' }),
|
106
|
+
__metadata("design:type", Object)
|
107
|
+
], InnerMixinClass.prototype, "imageAlt", void 0);
|
108
|
+
__decorate([
|
109
|
+
property({ type: String }),
|
110
|
+
__metadata("design:type", String)
|
111
|
+
], InnerMixinClass.prototype, "variant", void 0);
|
112
|
+
__decorate([
|
113
|
+
property({ type: String, reflect: true }),
|
114
|
+
__metadata("design:type", String)
|
115
|
+
], InnerMixinClass.prototype, "orientation", void 0);
|
116
|
+
__decorate([
|
117
|
+
property({ type: String, attribute: 'title-tag-name' }),
|
118
|
+
__metadata("design:type", String)
|
119
|
+
], InnerMixinClass.prototype, "titleTagName", void 0);
|
120
|
+
__decorate([
|
121
|
+
property({ type: String, attribute: 'subtitle-tag-name' }),
|
122
|
+
__metadata("design:type", String)
|
123
|
+
], InnerMixinClass.prototype, "subtitleTagName", void 0);
|
124
|
+
__decorate([
|
125
|
+
property({ type: String, attribute: 'icon-name' }),
|
126
|
+
__metadata("design:type", String)
|
127
|
+
], InnerMixinClass.prototype, "iconName", void 0);
|
128
|
+
// Cast return type to your mixin's interface intersected with the superClass type
|
129
|
+
return InnerMixinClass;
|
130
|
+
};
|
package/package.json
CHANGED