native-document 1.0.166 → 1.0.169
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/.vitepress/config.js +166 -0
- package/CHANGELOG.md +187 -0
- package/components.js +4 -1
- package/dist/native-document.components.min.js +593 -300
- package/dist/native-document.dev.js +99 -75
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/advanced-components.md +213 -608
- package/docs/anchor.md +173 -312
- package/docs/cache.md +95 -803
- package/docs/cli.md +179 -0
- package/docs/components/accordion.md +172 -0
- package/docs/components/alert.md +99 -0
- package/docs/components/avatar.md +160 -0
- package/docs/components/badge.md +102 -0
- package/docs/components/breadcrumb.md +89 -0
- package/docs/components/button.md +183 -0
- package/docs/components/card.md +69 -0
- package/docs/components/context-menu.md +118 -0
- package/docs/components/data-table.md +345 -0
- package/docs/components/dropdown.md +214 -0
- package/docs/components/form/autocomplete-field.md +81 -0
- package/docs/components/form/checkbox-field.md +41 -0
- package/docs/components/form/checkbox-group-field.md +54 -0
- package/docs/components/form/color-field.md +64 -0
- package/docs/components/form/date-field.md +92 -0
- package/docs/components/form/field-collection.md +63 -0
- package/docs/components/form/file-field.md +203 -0
- package/docs/components/form/form-control.md +87 -0
- package/docs/components/form/image-field.md +90 -0
- package/docs/components/form/index.md +115 -0
- package/docs/components/form/number-field.md +65 -0
- package/docs/components/form/radio-field.md +51 -0
- package/docs/components/form/select-field.md +123 -0
- package/docs/components/form/slider.md +136 -0
- package/docs/components/form/string-field.md +134 -0
- package/docs/components/form/textarea-field.md +65 -0
- package/docs/components/form-fields.md +372 -0
- package/docs/components/getting-started.md +264 -0
- package/docs/components/icons.md +321 -0
- package/docs/components/index.md +337 -0
- package/docs/components/layout.md +279 -0
- package/docs/components/list.md +73 -0
- package/docs/components/menu.md +215 -0
- package/docs/components/modal.md +156 -0
- package/docs/components/pagination.md +95 -0
- package/docs/components/popover.md +131 -0
- package/docs/components/progress.md +111 -0
- package/docs/components/shortcut-manager.md +221 -0
- package/docs/components/simple-table.md +107 -0
- package/docs/components/skeleton.md +155 -0
- package/docs/components/spinner.md +100 -0
- package/docs/components/splitter.md +133 -0
- package/docs/components/stepper.md +163 -0
- package/docs/components/switch.md +113 -0
- package/docs/components/tabs.md +153 -0
- package/docs/components/toast.md +119 -0
- package/docs/components/tooltip.md +151 -0
- package/docs/components/traits.md +261 -0
- package/docs/conditional-rendering.md +170 -588
- package/docs/contributing.md +300 -25
- package/docs/core-concepts.md +205 -374
- package/docs/elements.md +251 -367
- package/docs/extending-native-document-element.md +192 -207
- package/docs/filters.md +153 -1122
- package/docs/getting-started.md +193 -267
- package/docs/i18n.md +241 -0
- package/docs/index.md +76 -0
- package/docs/lifecycle-events.md +143 -75
- package/docs/list-rendering.md +227 -852
- package/docs/memory-management.md +134 -47
- package/docs/native-document-element.md +337 -186
- package/docs/native-fetch.md +99 -630
- package/docs/observable-resource.md +364 -0
- package/docs/observables.md +592 -526
- package/docs/routing.md +244 -653
- package/docs/state-management.md +134 -241
- package/docs/svg-elements.md +231 -0
- package/docs/theming.md +409 -0
- package/docs/tutorials/.gitkeep +0 -0
- package/docs/validation.md +95 -97
- package/docs/vitepress-conventions.md +219 -0
- package/package.json +34 -13
- package/readme.md +269 -89
- package/src/components/card/Card.js +93 -39
- package/src/components/card/index.js +1 -1
- package/src/components/form/field/types/FileField.js +3 -3
- package/src/components/icon/Icon.js +107 -0
- package/src/components/icon/icon-getters.js +142 -0
- package/src/components/icon/icons.js +171 -0
- package/src/components/icon/index.js +17 -0
- package/src/components/icon/types/Icon.d.ts +191 -0
- package/src/components/index.d.ts +6 -1
- package/src/components/list/HasListItem.js +171 -0
- package/src/components/list/List.js +41 -107
- package/src/components/list/ListDivider.js +39 -0
- package/src/components/list/ListGroup.js +76 -59
- package/src/components/list/ListItem.js +117 -69
- package/src/components/list/index.js +3 -1
- package/src/components/list/types/List.d.ts +45 -32
- package/src/components/list/types/ListDivider.ts +16 -0
- package/src/components/list/types/ListGroup.d.ts +51 -29
- package/src/components/list/types/ListItem.d.ts +40 -30
- package/src/components/spacer/Spacer.js +1 -1
- package/src/core/data/ObservableResource.js +5 -0
- package/src/core/data/observable-helpers/observable.prototypes.js +2 -0
- package/src/core/elements/content-formatter.js +16 -2
- package/src/core/elements/form.js +1 -1
- package/src/core/elements/img.js +1 -1
- package/src/core/elements/medias.js +2 -2
- package/src/core/elements/meta-data.js +1 -1
- package/src/core/wrappers/AttributesWrapper.js +37 -22
- package/src/core/wrappers/ElementCreator.js +9 -16
- package/src/core/wrappers/HtmlElementWrapper.js +26 -7
- package/src/core/wrappers/NDElement.js +12 -1
- package/src/core/wrappers/prototypes/attributes-extensions.js +24 -24
- package/src/core/wrappers/prototypes/nd-element-extensions.js +1 -8
- package/src/ui/components/card/CardRender.js +133 -0
- package/src/ui/components/card/card.css +169 -0
- package/src/ui/components/contextmenu/ContextmenuRender.js +1 -1
- package/src/ui/components/icon/material/MaterialIconRender.js +71 -0
- package/src/ui/components/icon/material/material.css +15 -0
- package/src/ui/components/icon/material/material.map.js +170 -0
- package/src/ui/components/icon/phosphor/PhosphorIconRender.js +71 -0
- package/src/ui/components/icon/phosphor/phosphor.css +17 -0
- package/src/ui/components/icon/phosphor/phosphor.map.js +165 -0
- package/src/ui/components/icon/tabler/TablerIconRender.js +59 -0
- package/src/ui/components/icon/tabler/tabler.css +14 -0
- package/src/ui/components/icon/tabler/tabler.map.js +165 -0
- package/src/ui/components/list/ListRender.js +18 -0
- package/src/ui/components/list/divider/ListDividerRender.js +10 -0
- package/src/ui/components/list/divider/list-divider.css +12 -0
- package/src/ui/components/list/group/ListGroupRender.js +61 -0
- package/src/ui/components/list/group/list-group.css +62 -0
- package/src/ui/components/list/item/ListItemRender.js +238 -0
- package/src/ui/components/list/item/list-item.css +191 -0
- package/src/ui/components/list/list.css +24 -0
- package/src/ui/components/spacer/SpacerRender.js +10 -0
- package/src/ui/index.js +13 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import BaseComponent from '../BaseComponent';
|
|
2
|
+
import HasEventEmitter from '../../core/utils/HasEventEmitter';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Versatile content container with optional image, header, footer, actions. Supports clickable, hoverable, loading, and horizontal layouts.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
7
|
* @example
|
|
8
8
|
* const card = new Card()
|
|
9
9
|
* .title(Span('Card title'))
|
|
@@ -19,43 +19,80 @@ import BaseComponent from '../BaseComponent';
|
|
|
19
19
|
* });
|
|
20
20
|
*
|
|
21
21
|
* @constructor
|
|
22
|
-
* @param {GlobalAttributes} [
|
|
22
|
+
* @param {GlobalAttributes} [props={}]
|
|
23
23
|
*/
|
|
24
|
-
export default function Card(
|
|
25
|
-
if(!(this instanceof Card)) {
|
|
26
|
-
return new Card(
|
|
24
|
+
export default function Card(props = {}) {
|
|
25
|
+
if (!(this instanceof Card)) {
|
|
26
|
+
return new Card(props);
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
this.$description = {
|
|
29
|
-
|
|
30
|
+
title: null,
|
|
31
|
+
subtitle: null,
|
|
32
|
+
image: null,
|
|
33
|
+
imagePosition: 'top',
|
|
34
|
+
content: null,
|
|
35
|
+
variant: null,
|
|
36
|
+
loading: null,
|
|
37
|
+
horizontal: false,
|
|
38
|
+
hoverable: false,
|
|
39
|
+
actions: [],
|
|
40
|
+
renderImage: null,
|
|
41
|
+
renderHeader: null,
|
|
42
|
+
renderContent: null,
|
|
43
|
+
renderFooter: null,
|
|
44
|
+
renderActions: null,
|
|
45
|
+
layout: null,
|
|
46
|
+
props,
|
|
30
47
|
};
|
|
31
|
-
}
|
|
48
|
+
}
|
|
32
49
|
|
|
33
50
|
BaseComponent.extends(Card);
|
|
51
|
+
BaseComponent.use(Card, HasEventEmitter);
|
|
34
52
|
|
|
35
53
|
Card.defaultTemplate = null;
|
|
36
54
|
|
|
37
55
|
/**
|
|
38
56
|
* Registers the render template for Card.
|
|
39
57
|
* @param {(description: {
|
|
40
|
-
*
|
|
58
|
+
* title: NdChild|null,
|
|
59
|
+
* subtitle: NdChild|null,
|
|
60
|
+
* image: string|null,
|
|
61
|
+
* imagePosition: 'top'|'bottom'|'left'|'right',
|
|
62
|
+
* content: NdChild|null,
|
|
63
|
+
* variant: 'elevated'|'outlined'|'flat'|string|null,
|
|
64
|
+
* loading: Observable<boolean>|null,
|
|
65
|
+
* horizontal: boolean,
|
|
66
|
+
* hoverable: boolean,
|
|
67
|
+
* actions: { label: NdChild, callback: () => void }[],
|
|
68
|
+
* renderImage: ((desc: *, instance: Card) => NdChild)|null,
|
|
69
|
+
* renderHeader: ((desc: *, instance: Card) => NdChild)|null,
|
|
70
|
+
* renderContent: ((desc: *, instance: Card) => NdChild)|null,
|
|
71
|
+
* renderFooter: ((desc: *, instance: Card) => NdChild)|null,
|
|
72
|
+
* renderActions: ((desc: *, instance: Card) => NdChild)|null,
|
|
73
|
+
* layout: ((slots: { header: NdChild, content: NdChild, footer: NdChild, image: NdChild, actions: NdChild }, instance: Card) => NdChild)|null,
|
|
41
74
|
* props: GlobalAttributes,
|
|
42
75
|
* }, instance: Card) => NdChild} template
|
|
43
76
|
*/
|
|
44
|
-
Card.use = function(template) {
|
|
77
|
+
Card.use = function(template) {
|
|
78
|
+
Card.defaultTemplate = template;
|
|
79
|
+
};
|
|
45
80
|
|
|
46
81
|
/**
|
|
47
82
|
* @param {NdChild} title
|
|
48
83
|
* @returns {this}
|
|
49
84
|
*/
|
|
50
85
|
Card.prototype.title = function(title) {
|
|
86
|
+
this.$description.title = title;
|
|
51
87
|
return this;
|
|
52
88
|
};
|
|
53
89
|
|
|
54
90
|
/**
|
|
55
|
-
* @param {NdChild}
|
|
91
|
+
* @param {NdChild} subtitle
|
|
56
92
|
* @returns {this}
|
|
57
93
|
*/
|
|
58
|
-
Card.prototype.subtitle = function(
|
|
94
|
+
Card.prototype.subtitle = function(subtitle) {
|
|
95
|
+
this.$description.subtitle = subtitle;
|
|
59
96
|
return this;
|
|
60
97
|
};
|
|
61
98
|
|
|
@@ -65,6 +102,8 @@ Card.prototype.subtitle = function(title) {
|
|
|
65
102
|
* @returns {this}
|
|
66
103
|
*/
|
|
67
104
|
Card.prototype.image = function(src, position = 'top') {
|
|
105
|
+
this.$description.image = src;
|
|
106
|
+
this.$description.imagePosition = position;
|
|
68
107
|
return this;
|
|
69
108
|
};
|
|
70
109
|
|
|
@@ -73,6 +112,7 @@ Card.prototype.image = function(src, position = 'top') {
|
|
|
73
112
|
* @returns {this}
|
|
74
113
|
*/
|
|
75
114
|
Card.prototype.content = function(content) {
|
|
115
|
+
this.$description.content = content;
|
|
76
116
|
return this;
|
|
77
117
|
};
|
|
78
118
|
|
|
@@ -83,51 +123,55 @@ Card.prototype.content = function(content) {
|
|
|
83
123
|
* @returns {this}
|
|
84
124
|
*/
|
|
85
125
|
Card.prototype.variant = function(name) {
|
|
126
|
+
this.$description.variant = name;
|
|
86
127
|
return this;
|
|
87
128
|
};
|
|
88
129
|
|
|
89
130
|
/**
|
|
90
131
|
* @returns {this}
|
|
91
132
|
*/
|
|
92
|
-
Card.prototype.
|
|
93
|
-
return this;
|
|
133
|
+
Card.prototype.elevated = function() {
|
|
134
|
+
return this.variant('elevated');
|
|
94
135
|
};
|
|
95
136
|
|
|
96
137
|
/**
|
|
97
138
|
* @returns {this}
|
|
98
139
|
*/
|
|
99
|
-
Card.prototype.
|
|
100
|
-
return this;
|
|
140
|
+
Card.prototype.outlined = function() {
|
|
141
|
+
return this.variant('outlined');
|
|
101
142
|
};
|
|
102
143
|
|
|
103
144
|
/**
|
|
104
145
|
* @returns {this}
|
|
105
146
|
*/
|
|
106
147
|
Card.prototype.flat = function() {
|
|
107
|
-
return this;
|
|
148
|
+
return this.variant('flat');
|
|
108
149
|
};
|
|
109
150
|
|
|
110
151
|
// Behavior
|
|
152
|
+
|
|
111
153
|
/**
|
|
112
154
|
* @param {Function} handler
|
|
113
155
|
* @returns {this}
|
|
114
156
|
*/
|
|
115
157
|
Card.prototype.clickable = function(handler) {
|
|
116
|
-
return this;
|
|
158
|
+
return this.onClick(handler);
|
|
117
159
|
};
|
|
118
160
|
|
|
119
161
|
/**
|
|
120
162
|
* @returns {this}
|
|
121
163
|
*/
|
|
122
164
|
Card.prototype.hoverable = function() {
|
|
165
|
+
this.$description.hoverable = true;
|
|
123
166
|
return this;
|
|
124
167
|
};
|
|
125
168
|
|
|
126
169
|
/**
|
|
127
|
-
* @param {boolean|Observable<boolean>} [isLoading]
|
|
170
|
+
* @param {boolean|Observable<boolean>} [isLoading=true]
|
|
128
171
|
* @returns {this}
|
|
129
172
|
*/
|
|
130
173
|
Card.prototype.loading = function(isLoading = true) {
|
|
174
|
+
this.$description.loading = BaseComponent.obs(isLoading);
|
|
131
175
|
return this;
|
|
132
176
|
};
|
|
133
177
|
|
|
@@ -137,46 +181,54 @@ Card.prototype.loading = function(isLoading = true) {
|
|
|
137
181
|
* @returns {this}
|
|
138
182
|
*/
|
|
139
183
|
Card.prototype.horizontal = function() {
|
|
184
|
+
this.$description.horizontal = true;
|
|
140
185
|
return this;
|
|
141
186
|
};
|
|
142
187
|
|
|
143
|
-
//
|
|
188
|
+
// Actions
|
|
189
|
+
|
|
144
190
|
/**
|
|
145
|
-
* @param {
|
|
191
|
+
* @param {NdChild} label
|
|
192
|
+
* @param {() => void} callback
|
|
146
193
|
* @returns {this}
|
|
147
194
|
*/
|
|
148
|
-
Card.prototype.
|
|
195
|
+
Card.prototype.action = function(label, callback) {
|
|
196
|
+
this.$description.actions.push({ label, callback });
|
|
149
197
|
return this;
|
|
150
198
|
};
|
|
151
199
|
|
|
152
200
|
/**
|
|
153
|
-
* @param {Function} handler
|
|
154
201
|
* @returns {this}
|
|
155
202
|
*/
|
|
156
|
-
Card.prototype.
|
|
203
|
+
Card.prototype.clearActions = function() {
|
|
204
|
+
this.$description.actions = [];
|
|
157
205
|
return this;
|
|
158
206
|
};
|
|
159
207
|
|
|
208
|
+
// Events
|
|
209
|
+
|
|
160
210
|
/**
|
|
211
|
+
* @param {Function} handler
|
|
161
212
|
* @returns {this}
|
|
162
213
|
*/
|
|
163
|
-
Card.prototype.
|
|
164
|
-
this
|
|
214
|
+
Card.prototype.onClick = function(handler) {
|
|
215
|
+
this.on('click', handler);
|
|
165
216
|
return this;
|
|
166
217
|
};
|
|
167
218
|
|
|
168
219
|
/**
|
|
169
|
-
* @param {
|
|
170
|
-
* @param {() => void} callback
|
|
220
|
+
* @param {Function} handler
|
|
171
221
|
* @returns {this}
|
|
172
222
|
*/
|
|
173
|
-
Card.prototype.
|
|
174
|
-
this
|
|
223
|
+
Card.prototype.onHover = function(handler) {
|
|
224
|
+
this.on('hover', handler);
|
|
175
225
|
return this;
|
|
176
226
|
};
|
|
177
227
|
|
|
228
|
+
// Custom renderers
|
|
229
|
+
|
|
178
230
|
/**
|
|
179
|
-
* @param {(desc: *, instance:
|
|
231
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
180
232
|
* @returns {this}
|
|
181
233
|
*/
|
|
182
234
|
Card.prototype.renderImage = function(renderFn) {
|
|
@@ -185,7 +237,7 @@ Card.prototype.renderImage = function(renderFn) {
|
|
|
185
237
|
};
|
|
186
238
|
|
|
187
239
|
/**
|
|
188
|
-
* @param {(desc: *, instance:
|
|
240
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
189
241
|
* @returns {this}
|
|
190
242
|
*/
|
|
191
243
|
Card.prototype.renderHeader = function(renderFn) {
|
|
@@ -194,7 +246,7 @@ Card.prototype.renderHeader = function(renderFn) {
|
|
|
194
246
|
};
|
|
195
247
|
|
|
196
248
|
/**
|
|
197
|
-
* @param {(desc: *, instance:
|
|
249
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
198
250
|
* @returns {this}
|
|
199
251
|
*/
|
|
200
252
|
Card.prototype.renderContent = function(renderFn) {
|
|
@@ -203,7 +255,7 @@ Card.prototype.renderContent = function(renderFn) {
|
|
|
203
255
|
};
|
|
204
256
|
|
|
205
257
|
/**
|
|
206
|
-
* @param {(desc: *, instance:
|
|
258
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
207
259
|
* @returns {this}
|
|
208
260
|
*/
|
|
209
261
|
Card.prototype.renderFooter = function(renderFn) {
|
|
@@ -212,17 +264,19 @@ Card.prototype.renderFooter = function(renderFn) {
|
|
|
212
264
|
};
|
|
213
265
|
|
|
214
266
|
/**
|
|
215
|
-
* @param {(desc: *, instance:
|
|
267
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
216
268
|
* @returns {this}
|
|
217
269
|
*/
|
|
218
|
-
Card.prototype.
|
|
219
|
-
this.$description.
|
|
270
|
+
Card.prototype.renderActions = function(renderFn) {
|
|
271
|
+
this.$description.renderActions = renderFn;
|
|
220
272
|
return this;
|
|
221
273
|
};
|
|
222
274
|
|
|
223
275
|
/**
|
|
224
|
-
* @
|
|
276
|
+
* @param {(slots: { header: NdChild, content: NdChild, footer: NdChild, image: NdChild, actions: NdChild }, instance: Card) => NdChild} layoutFn
|
|
277
|
+
* @returns {this}
|
|
225
278
|
*/
|
|
226
|
-
Card.prototype.
|
|
279
|
+
Card.prototype.layout = function(layoutFn) {
|
|
280
|
+
this.$description.layout = layoutFn;
|
|
227
281
|
return this;
|
|
228
|
-
};
|
|
282
|
+
};
|
|
@@ -13,7 +13,7 @@ import FileItemPreview from '../../field/types/file-field-mode/FileItemPreview';
|
|
|
13
13
|
* .accept(['application/pdf', 'image/png'])
|
|
14
14
|
* .maxSize(5 * 1024 * 1024, 'Max 5MB per file')
|
|
15
15
|
* .maxFiles(3, 'Max 3 files')
|
|
16
|
-
* .mode(
|
|
16
|
+
* .mode(FileDropzoneMode())
|
|
17
17
|
* .onFileAdd((file) => console.log('added', file.name))
|
|
18
18
|
* .onFileRemove((file) => console.log('removed', file.name));
|
|
19
19
|
*
|
|
@@ -54,7 +54,7 @@ FileField.defaultTemplate = null;
|
|
|
54
54
|
* label: NdChild|null,
|
|
55
55
|
* accept: string|null,
|
|
56
56
|
* multiple: boolean,
|
|
57
|
-
* mode:
|
|
57
|
+
* mode: FileNativeMode|FileAvatarMode|FileDropzoneMode|FileUploadButtonMode|FileWallMode|null,
|
|
58
58
|
* files: Observable<FileItemPreview[]>,
|
|
59
59
|
* fileIcons: Array<(file: File) => NdChild>,
|
|
60
60
|
* disabled: boolean|Observable<boolean>,
|
|
@@ -91,7 +91,7 @@ FileField.prototype.multiple = function(enabled = true) {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {FileNativeMode|FileAvatarMode|FileDropzoneMode|FileUploadButtonMode|FileWallMode|null} mode
|
|
95
95
|
* @returns {this}
|
|
96
96
|
*/
|
|
97
97
|
FileField.prototype.mode = function(mode) {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @constructor
|
|
5
|
+
* @param {string} name
|
|
6
|
+
* @param {object} [props={}]
|
|
7
|
+
*/
|
|
8
|
+
export function Icon(name, props = {}) {
|
|
9
|
+
if(!(this instanceof Icon)) {
|
|
10
|
+
return new Icon(name, props);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
BaseComponent.call(this, {});
|
|
14
|
+
|
|
15
|
+
this.$description = {
|
|
16
|
+
name,
|
|
17
|
+
variant: null,
|
|
18
|
+
color: null,
|
|
19
|
+
weight: null,
|
|
20
|
+
size: null,
|
|
21
|
+
...props,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
BaseComponent.extends(Icon);
|
|
26
|
+
|
|
27
|
+
Icon.defaultTemplate = null;
|
|
28
|
+
Icon.defaultConfigs = null;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {(description, instance: Icon) => NdChild} template
|
|
32
|
+
* @param {{ variant?: string, size?: string, color?: string, weight?: string }} [defaultConfigs={}]
|
|
33
|
+
*/
|
|
34
|
+
Icon.use = function(template, defaultConfigs = {}) {
|
|
35
|
+
Icon.defaultTemplate = template;
|
|
36
|
+
Icon.defaultConfigs = defaultConfigs;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Icon.prototype.variant = function(variant) {
|
|
40
|
+
this.$description.variant = variant;
|
|
41
|
+
return this;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Icon.prototype.thin = function() {
|
|
45
|
+
this.$description.variant = 'thin';
|
|
46
|
+
return this;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Icon.prototype.light = function() {
|
|
50
|
+
this.$description.variant = 'light';
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
Icon.prototype.regular = function() {
|
|
55
|
+
this.$description.variant = 'regular';
|
|
56
|
+
return this;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
Icon.prototype.bold = function() {
|
|
60
|
+
this.$description.variant = 'bold';
|
|
61
|
+
return this;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Icon.prototype.fill = function() {
|
|
65
|
+
this.$description.variant = 'fill';
|
|
66
|
+
return this;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Icon.prototype.duotone = function() {
|
|
70
|
+
this.$description.variant = 'duotone';
|
|
71
|
+
return this;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
Icon.prototype.weight = function(weight) {
|
|
75
|
+
this.$description.weight = weight;
|
|
76
|
+
return this;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
Icon.prototype.size = function(size) {
|
|
80
|
+
this.$description.size = size;
|
|
81
|
+
return this;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
Icon.prototype.small = function() {
|
|
85
|
+
this.$description.size = 'small';
|
|
86
|
+
return this;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Icon.prototype.medium = function() {
|
|
90
|
+
this.$description.size = 'medium';
|
|
91
|
+
return this;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Icon.prototype.large = function() {
|
|
95
|
+
this.$description.size = 'large';
|
|
96
|
+
return this;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Icon.prototype.extraLarge = function() {
|
|
100
|
+
this.$description.size = 'extraLarge';
|
|
101
|
+
return this;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
Icon.prototype.color = function(color) {
|
|
105
|
+
this.$description.color = color;
|
|
106
|
+
return this;
|
|
107
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as ICONS from './icons';
|
|
2
|
+
|
|
3
|
+
export const ICON_GETTERS = {
|
|
4
|
+
arrowLeft: ICONS.ICON_ARROW_LEFT,
|
|
5
|
+
arrowRight: ICONS.ICON_ARROW_RIGHT,
|
|
6
|
+
arrowUp: ICONS.ICON_ARROW_UP,
|
|
7
|
+
arrowDown: ICONS.ICON_ARROW_DOWN,
|
|
8
|
+
chevronLeft: ICONS.ICON_CHEVRON_LEFT,
|
|
9
|
+
chevronRight: ICONS.ICON_CHEVRON_RIGHT,
|
|
10
|
+
chevronUp: ICONS.ICON_CHEVRON_UP,
|
|
11
|
+
chevronDown: ICONS.ICON_CHEVRON_DOWN,
|
|
12
|
+
home: ICONS.ICON_HOME,
|
|
13
|
+
menu: ICONS.ICON_MENU,
|
|
14
|
+
close: ICONS.ICON_CLOSE,
|
|
15
|
+
back: ICONS.ICON_BACK,
|
|
16
|
+
forward: ICONS.ICON_FORWARD,
|
|
17
|
+
expand: ICONS.ICON_EXPAND,
|
|
18
|
+
collapse: ICONS.ICON_COLLAPSE,
|
|
19
|
+
fullscreen: ICONS.ICON_FULLSCREEN,
|
|
20
|
+
fullscreenExit: ICONS.ICON_FULLSCREEN_EXIT,
|
|
21
|
+
search: ICONS.ICON_SEARCH,
|
|
22
|
+
filter: ICONS.ICON_FILTER,
|
|
23
|
+
sort: ICONS.ICON_SORT,
|
|
24
|
+
edit: ICONS.ICON_EDIT,
|
|
25
|
+
delete: ICONS.ICON_DELETE,
|
|
26
|
+
add: ICONS.ICON_ADD,
|
|
27
|
+
remove: ICONS.ICON_REMOVE,
|
|
28
|
+
save: ICONS.ICON_SAVE,
|
|
29
|
+
copy: ICONS.ICON_COPY,
|
|
30
|
+
download: ICONS.ICON_DOWNLOAD,
|
|
31
|
+
upload: ICONS.ICON_UPLOAD,
|
|
32
|
+
share: ICONS.ICON_SHARE,
|
|
33
|
+
refresh: ICONS.ICON_REFRESH,
|
|
34
|
+
more: ICONS.ICON_MORE,
|
|
35
|
+
settings: ICONS.ICON_SETTINGS,
|
|
36
|
+
drag: ICONS.ICON_DRAG,
|
|
37
|
+
resize: ICONS.ICON_RESIZE,
|
|
38
|
+
undo: ICONS.ICON_UNDO,
|
|
39
|
+
redo: ICONS.ICON_REDO,
|
|
40
|
+
scan: ICONS.ICON_SCAN,
|
|
41
|
+
print: ICONS.ICON_PRINT,
|
|
42
|
+
import: ICONS.ICON_IMPORT,
|
|
43
|
+
export: ICONS.ICON_EXPORT,
|
|
44
|
+
check: ICONS.ICON_CHECK,
|
|
45
|
+
checkCircle: ICONS.ICON_CHECK_CIRCLE,
|
|
46
|
+
error: ICONS.ICON_ERROR,
|
|
47
|
+
warning: ICONS.ICON_WARNING,
|
|
48
|
+
info: ICONS.ICON_INFO,
|
|
49
|
+
help: ICONS.ICON_HELP,
|
|
50
|
+
loading: ICONS.ICON_LOADING,
|
|
51
|
+
success: ICONS.ICON_SUCCESS,
|
|
52
|
+
user: ICONS.ICON_USER,
|
|
53
|
+
userCircle: ICONS.ICON_USER_CIRCLE,
|
|
54
|
+
users: ICONS.ICON_USERS,
|
|
55
|
+
lock: ICONS.ICON_LOCK,
|
|
56
|
+
unlock: ICONS.ICON_UNLOCK,
|
|
57
|
+
eye: ICONS.ICON_EYE,
|
|
58
|
+
eyeOff: ICONS.ICON_EYE_OFF,
|
|
59
|
+
bell: ICONS.ICON_BELL,
|
|
60
|
+
notification: ICONS.ICON_NOTIFICATION,
|
|
61
|
+
file: ICONS.ICON_FILE,
|
|
62
|
+
folder: ICONS.ICON_FOLDER,
|
|
63
|
+
image: ICONS.ICON_IMAGE,
|
|
64
|
+
document: ICONS.ICON_DOCUMENT,
|
|
65
|
+
attachment: ICONS.ICON_ATTACHMENT,
|
|
66
|
+
link: ICONS.ICON_LINK,
|
|
67
|
+
externalLink: ICONS.ICON_EXTERNAL_LINK,
|
|
68
|
+
play: ICONS.ICON_PLAY,
|
|
69
|
+
pause: ICONS.ICON_PAUSE,
|
|
70
|
+
stop: ICONS.ICON_STOP,
|
|
71
|
+
mute: ICONS.ICON_MUTE,
|
|
72
|
+
sound: ICONS.ICON_SOUND,
|
|
73
|
+
video: ICONS.ICON_VIDEO,
|
|
74
|
+
camera: ICONS.ICON_CAMERA,
|
|
75
|
+
grid: ICONS.ICON_GRID,
|
|
76
|
+
list: ICONS.ICON_LIST,
|
|
77
|
+
calendar: ICONS.ICON_CALENDAR,
|
|
78
|
+
clock: ICONS.ICON_CLOCK,
|
|
79
|
+
tag: ICONS.ICON_TAG,
|
|
80
|
+
tags: ICONS.ICON_TAGS,
|
|
81
|
+
qrCode: ICONS.ICON_QR_CODE,
|
|
82
|
+
barcode: ICONS.ICON_BARCODE,
|
|
83
|
+
bold: ICONS.ICON_BOLD,
|
|
84
|
+
italic: ICONS.ICON_ITALIC,
|
|
85
|
+
underline: ICONS.ICON_UNDERLINE,
|
|
86
|
+
strikethrough: ICONS.ICON_STRIKETHROUGH,
|
|
87
|
+
alignLeft: ICONS.ICON_ALIGN_LEFT,
|
|
88
|
+
alignCenter: ICONS.ICON_ALIGN_CENTER,
|
|
89
|
+
alignRight: ICONS.ICON_ALIGN_RIGHT,
|
|
90
|
+
alignJustify: ICONS.ICON_ALIGN_JUSTIFY,
|
|
91
|
+
orderedList: ICONS.ICON_ORDERED_LIST,
|
|
92
|
+
unorderedList: ICONS.ICON_UNORDERED_LIST,
|
|
93
|
+
indent: ICONS.ICON_INDENT,
|
|
94
|
+
outdent: ICONS.ICON_OUTDENT,
|
|
95
|
+
scissors: ICONS.ICON_SCISSORS,
|
|
96
|
+
fontColor: ICONS.ICON_FONT_COLOR,
|
|
97
|
+
highlight: ICONS.ICON_HIGHLIGHT,
|
|
98
|
+
barChart: ICONS.ICON_BAR_CHART,
|
|
99
|
+
lineChart: ICONS.ICON_LINE_CHART,
|
|
100
|
+
pieChart: ICONS.ICON_PIE_CHART,
|
|
101
|
+
areaChart: ICONS.ICON_AREA_CHART,
|
|
102
|
+
table: ICONS.ICON_TABLE,
|
|
103
|
+
database: ICONS.ICON_DATABASE,
|
|
104
|
+
shoppingCart: ICONS.ICON_SHOPPING_CART,
|
|
105
|
+
creditCard: ICONS.ICON_CREDIT_CARD,
|
|
106
|
+
wallet: ICONS.ICON_WALLET,
|
|
107
|
+
bank: ICONS.ICON_BANK,
|
|
108
|
+
gift: ICONS.ICON_GIFT,
|
|
109
|
+
percentage: ICONS.ICON_PERCENTAGE,
|
|
110
|
+
dollar: ICONS.ICON_DOLLAR,
|
|
111
|
+
euro: ICONS.ICON_EURO,
|
|
112
|
+
mail: ICONS.ICON_MAIL,
|
|
113
|
+
message: ICONS.ICON_MESSAGE,
|
|
114
|
+
comment: ICONS.ICON_COMMENT,
|
|
115
|
+
phone: ICONS.ICON_PHONE,
|
|
116
|
+
cloud: ICONS.ICON_CLOUD,
|
|
117
|
+
cloudUpload: ICONS.ICON_CLOUD_UPLOAD,
|
|
118
|
+
cloudDownload: ICONS.ICON_CLOUD_DOWNLOAD,
|
|
119
|
+
api: ICONS.ICON_API,
|
|
120
|
+
code: ICONS.ICON_CODE,
|
|
121
|
+
bug: ICONS.ICON_BUG,
|
|
122
|
+
tool: ICONS.ICON_TOOL,
|
|
123
|
+
robot: ICONS.ICON_ROBOT,
|
|
124
|
+
map: ICONS.ICON_MAP,
|
|
125
|
+
compass: ICONS.ICON_COMPASS,
|
|
126
|
+
global: ICONS.ICON_GLOBAL,
|
|
127
|
+
location: ICONS.ICON_LOCATION,
|
|
128
|
+
star: ICONS.ICON_STAR,
|
|
129
|
+
heart: ICONS.ICON_HEART,
|
|
130
|
+
flag: ICONS.ICON_FLAG,
|
|
131
|
+
trophy: ICONS.ICON_TROPHY,
|
|
132
|
+
medal: ICONS.ICON_MEDAL,
|
|
133
|
+
rocket: ICONS.ICON_ROCKET,
|
|
134
|
+
fire: ICONS.ICON_FIRE,
|
|
135
|
+
thunder: ICONS.ICON_THUNDER,
|
|
136
|
+
smile: ICONS.ICON_SMILE,
|
|
137
|
+
frown: ICONS.ICON_FROWN,
|
|
138
|
+
like: ICONS.ICON_LIKE,
|
|
139
|
+
dislike: ICONS.ICON_DISLIKE,
|
|
140
|
+
safety: ICONS.ICON_SAFETY,
|
|
141
|
+
key: ICONS.ICON_KEY,
|
|
142
|
+
};
|