native-document 1.0.168 → 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/CHANGELOG.md +38 -4
- package/components.js +3 -1
- package/dist/native-document.components.min.js +197 -171
- package/dist/native-document.dev.js +92 -75
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/components/icons.md +321 -0
- package/package.json +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/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 +20 -21
- 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/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/index.js +5 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Icons
|
|
3
|
+
description: Adapter-based icon system with chainable API and support for Tabler, Phosphor, and Google Material Icons
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Icons
|
|
7
|
+
|
|
8
|
+
NativeDocument provides an adapter-based icon system. Icon names are semantic and stable - switching from one icon library to another requires changing only the adapter and the CSS import.
|
|
9
|
+
|
|
10
|
+
```javascript
|
|
11
|
+
// Usage - always via the Icon namespace
|
|
12
|
+
Icon.search.fill()
|
|
13
|
+
Icon.star.fill().large()
|
|
14
|
+
Icon.arrowRight.bold().color('red')
|
|
15
|
+
Icon.user.fill().size(32)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
### 1. Register the adapter
|
|
23
|
+
|
|
24
|
+
In your app entry point (`main.js`):
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import { Icon } from 'native-document/icons';
|
|
28
|
+
import TablerIconRender from 'native-document/ui/icon/tabler';
|
|
29
|
+
|
|
30
|
+
Icon.use(TablerIconRender, {
|
|
31
|
+
variant: 'outline', // default variant
|
|
32
|
+
size: 'medium', // default size: small | medium | large | extraLarge
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Import the CSS
|
|
37
|
+
|
|
38
|
+
In the same entry point, import the icon font alongside your theme:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
// main.js
|
|
42
|
+
import 'native-document/src/ui/theme.scss';
|
|
43
|
+
import '@tabler/icons-webfont/dist/tabler-icons.css';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Methods
|
|
49
|
+
|
|
50
|
+
### Variants
|
|
51
|
+
|
|
52
|
+
| Method | Sets variant to |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `.thin()` | `'thin'` |
|
|
55
|
+
| `.light()` | `'light'` |
|
|
56
|
+
| `.regular()` | `'regular'` |
|
|
57
|
+
| `.bold()` | `'bold'` |
|
|
58
|
+
| `.fill()` | `'fill'` |
|
|
59
|
+
| `.duotone()` | `'duotone'` |
|
|
60
|
+
| `.variant(name)` | any custom string |
|
|
61
|
+
|
|
62
|
+
### Sizes
|
|
63
|
+
|
|
64
|
+
| Method | Sets size to |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `.small()` | `'small'` - 16px |
|
|
67
|
+
| `.medium()` | `'medium'` - 24px |
|
|
68
|
+
| `.large()` | `'large'` - 32px |
|
|
69
|
+
| `.extraLarge()` | `'extraLarge'` - 48px |
|
|
70
|
+
| `.size(value)` | number in px or named string |
|
|
71
|
+
|
|
72
|
+
### Other
|
|
73
|
+
|
|
74
|
+
| Method | Parameters | Description |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `.color(value)` | `value: string` | CSS color value |
|
|
77
|
+
| `.weight(value)` | `value: string` | Stroke weight (adapter-dependent) |
|
|
78
|
+
|
|
79
|
+
All methods accept `Observable` values - the icon updates automatically when the observable changes:
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
const isDark = Observable(false);
|
|
83
|
+
|
|
84
|
+
Icon.star
|
|
85
|
+
.variant(isDark.transform((d) => d ? 'fill' : 'outline'))
|
|
86
|
+
.color(isDark.transform((d) => d ? 'gold' : 'currentColor'))
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Available icons
|
|
92
|
+
|
|
93
|
+
> The standard set covers the most common use cases. Each adapter maps these names to its own icon names - not every icon exists in every library.
|
|
94
|
+
|
|
95
|
+
### Navigation
|
|
96
|
+
`Icon.arrowLeft`, `Icon.arrowRight`, `Icon.arrowUp`, `Icon.arrowDown`, `Icon.chevronLeft`, `Icon.chevronRight`, `Icon.chevronUp`, `Icon.chevronDown`, `Icon.home`, `Icon.menu`, `Icon.close`, `Icon.back`, `Icon.forward`, `Icon.expand`, `Icon.collapse`, `Icon.fullscreen`, `Icon.fullscreenExit`
|
|
97
|
+
|
|
98
|
+
### Actions
|
|
99
|
+
`Icon.search`, `Icon.filter`, `Icon.sort`, `Icon.edit`, `Icon.delete`, `Icon.add`, `Icon.remove`, `Icon.save`, `Icon.copy`, `Icon.download`, `Icon.upload`, `Icon.share`, `Icon.refresh`, `Icon.more`, `Icon.settings`, `Icon.drag`, `Icon.resize`, `Icon.undo`, `Icon.redo`, `Icon.scan`, `Icon.print`, `Icon.import`, `Icon.export`
|
|
100
|
+
|
|
101
|
+
### Feedback
|
|
102
|
+
`Icon.check`, `Icon.checkCircle`, `Icon.error`, `Icon.warning`, `Icon.info`, `Icon.help`, `Icon.loading`, `Icon.success`
|
|
103
|
+
|
|
104
|
+
### User
|
|
105
|
+
`Icon.user`, `Icon.userCircle`, `Icon.users`, `Icon.lock`, `Icon.unlock`, `Icon.eye`, `Icon.eyeOff`, `Icon.bell`, `Icon.notification`
|
|
106
|
+
|
|
107
|
+
### Files & Media
|
|
108
|
+
`Icon.file`, `Icon.folder`, `Icon.image`, `Icon.document`, `Icon.attachment`, `Icon.link`, `Icon.externalLink`, `Icon.play`, `Icon.pause`, `Icon.stop`, `Icon.mute`, `Icon.sound`, `Icon.video`, `Icon.camera`
|
|
109
|
+
|
|
110
|
+
### Interface
|
|
111
|
+
`Icon.grid`, `Icon.list`, `Icon.calendar`, `Icon.clock`, `Icon.tag`, `Icon.tags`, `Icon.qrCode`, `Icon.barcode`
|
|
112
|
+
|
|
113
|
+
### Text editing
|
|
114
|
+
`Icon.bold`, `Icon.italic`, `Icon.underline`, `Icon.strikethrough`, `Icon.alignLeft`, `Icon.alignCenter`, `Icon.alignRight`, `Icon.alignJustify`, `Icon.orderedList`, `Icon.unorderedList`, `Icon.indent`, `Icon.outdent`, `Icon.scissors`, `Icon.fontColor`, `Icon.highlight`
|
|
115
|
+
|
|
116
|
+
### Data & charts
|
|
117
|
+
`Icon.barChart`, `Icon.lineChart`, `Icon.pieChart`, `Icon.areaChart`, `Icon.table`, `Icon.database`
|
|
118
|
+
|
|
119
|
+
### Commerce & finance
|
|
120
|
+
`Icon.shoppingCart`, `Icon.creditCard`, `Icon.wallet`, `Icon.bank`, `Icon.gift`, `Icon.percentage`, `Icon.dollar`, `Icon.euro`
|
|
121
|
+
|
|
122
|
+
### Communication
|
|
123
|
+
`Icon.mail`, `Icon.message`, `Icon.comment`, `Icon.phone`
|
|
124
|
+
|
|
125
|
+
### System & dev
|
|
126
|
+
`Icon.cloud`, `Icon.cloudUpload`, `Icon.cloudDownload`, `Icon.api`, `Icon.code`, `Icon.bug`, `Icon.tool`, `Icon.robot`
|
|
127
|
+
|
|
128
|
+
### Location
|
|
129
|
+
`Icon.map`, `Icon.compass`, `Icon.global`, `Icon.location`
|
|
130
|
+
|
|
131
|
+
### Shapes & objects
|
|
132
|
+
`Icon.star`, `Icon.heart`, `Icon.flag`, `Icon.trophy`, `Icon.medal`, `Icon.rocket`, `Icon.fire`, `Icon.thunder`, `Icon.smile`, `Icon.frown`, `Icon.like`, `Icon.dislike`, `Icon.safety`, `Icon.key`
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Custom icons
|
|
137
|
+
|
|
138
|
+
Create your own renderer that wraps the base adapter. Use NativeDocument elements for reactive support:
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
import { Img, Span, ShowIf } from 'native-document/elements';
|
|
142
|
+
import TablerIconRender from 'native-document/ui/icon/tabler/TablerIconRender';
|
|
143
|
+
|
|
144
|
+
function MyIconRender($desc) {
|
|
145
|
+
// Handle your custom icons
|
|
146
|
+
if ($desc.name === 'logo' || $desc.name === 'dashboard') {
|
|
147
|
+
const size = $desc.size?.__$Observable
|
|
148
|
+
? $desc.size.transform((s) => typeof s === 'number' ? `${s}px` : `${SIZES[s] ?? 24}px`)
|
|
149
|
+
: `${typeof $desc.size === 'number' ? $desc.size : 24}px`;
|
|
150
|
+
|
|
151
|
+
return Img({
|
|
152
|
+
src: `/icons/${$desc.name}.svg`,
|
|
153
|
+
'aria-hidden': 'true',
|
|
154
|
+
style: {
|
|
155
|
+
width: size,
|
|
156
|
+
height: size,
|
|
157
|
+
color: $desc.color ?? 'currentColor',
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Fall back to Tabler for everything else
|
|
163
|
+
return TablerIconRender($desc);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Icon.use(MyIconRender, { size: 'medium' });
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Adapters
|
|
172
|
+
|
|
173
|
+
### Tabler Icons
|
|
174
|
+
|
|
175
|
+
> Outline and filled variants - the standard set covers the most common icons from Tabler's library.
|
|
176
|
+
|
|
177
|
+
**Install**
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm install @tabler/icons-webfont
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**main.js**
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
import { Icon } from 'native-document/icons';
|
|
187
|
+
import TablerIconRender from 'native-document/ui/icon/tabler';
|
|
188
|
+
import 'native-document/src/ui/theme.scss';
|
|
189
|
+
import '@tabler/icons-webfont/dist/tabler-icons.css';
|
|
190
|
+
|
|
191
|
+
// Uncomment to enable .fill() variant
|
|
192
|
+
// import '@tabler/icons-webfont/dist/tabler-icons-filled.css';
|
|
193
|
+
|
|
194
|
+
Icon.use(TablerIconRender, { variant: 'outline', size: 'medium' });
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Supported variants**
|
|
198
|
+
|
|
199
|
+
| Variant | Description | Required CSS |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `outline` (default) | Stroked icons | `tabler-icons.css` |
|
|
202
|
+
| `fill` | Filled icons | `tabler-icons-filled.css` |
|
|
203
|
+
|
|
204
|
+
**Example**
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
Icon.search // outline, medium
|
|
208
|
+
Icon.search.fill() // filled
|
|
209
|
+
Icon.star.fill().large() // filled, 32px
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Phosphor Icons
|
|
215
|
+
|
|
216
|
+
> 6 weights - the standard set covers the most common icons from Phosphor's library.
|
|
217
|
+
|
|
218
|
+
**Install**
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm install @phosphor-icons/web
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**main.js**
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
import { Icon } from 'native-document/icons';
|
|
228
|
+
import PhosphorIconRender from 'native-document/ui/icon/phosphor';
|
|
229
|
+
import 'native-document/src/ui/theme.scss';
|
|
230
|
+
|
|
231
|
+
// Check the exact path in your node_modules/@phosphor-icons/web/ directory
|
|
232
|
+
import '@phosphor-icons/web/src/regular/style.css';
|
|
233
|
+
|
|
234
|
+
// Import only the weights you need
|
|
235
|
+
// import '@phosphor-icons/web/src/thin/style.css';
|
|
236
|
+
// import '@phosphor-icons/web/src/light/style.css';
|
|
237
|
+
// import '@phosphor-icons/web/src/bold/style.css';
|
|
238
|
+
// import '@phosphor-icons/web/src/fill/style.css';
|
|
239
|
+
// import '@phosphor-icons/web/src/duotone/style.css';
|
|
240
|
+
|
|
241
|
+
Icon.use(PhosphorIconRender, { variant: 'regular', size: 'medium' });
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
> The CSS path may vary depending on the installed version. If you get a resolve error, run `ls node_modules/@phosphor-icons/web/` to find the correct path.
|
|
245
|
+
|
|
246
|
+
**Supported variants**
|
|
247
|
+
|
|
248
|
+
| Variant | Description | Required CSS |
|
|
249
|
+
|---|---|---|
|
|
250
|
+
| `thin` | Thinnest stroke | `thin/style.css` |
|
|
251
|
+
| `light` | Light stroke | `light/style.css` |
|
|
252
|
+
| `regular` (default) | Standard stroke | `regular/style.css` |
|
|
253
|
+
| `bold` | Bold stroke | `bold/style.css` |
|
|
254
|
+
| `fill` | Filled | `fill/style.css` |
|
|
255
|
+
| `duotone` | Two-tone | `duotone/style.css` |
|
|
256
|
+
|
|
257
|
+
**Example**
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
Icon.search // regular, medium
|
|
261
|
+
Icon.search.bold() // bold
|
|
262
|
+
Icon.star.fill().large() // filled, 32px
|
|
263
|
+
Icon.heart.duotone() // duotone
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### Google Material Icons
|
|
269
|
+
|
|
270
|
+
> Filled, outlined, round, sharp, two-tone - the standard set covers the most common icons from Material's library.
|
|
271
|
+
|
|
272
|
+
**Install**
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
npm install material-icons
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**main.js**
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
import { Icon } from 'native-document/icons';
|
|
282
|
+
import MaterialIconRender from 'native-document/ui/icon/material';
|
|
283
|
+
import 'native-document/src/ui/theme.scss';
|
|
284
|
+
import 'material-icons/iconfont/filled.css';
|
|
285
|
+
|
|
286
|
+
// Import only the styles you need
|
|
287
|
+
// import 'material-icons/iconfont/outlined.css';
|
|
288
|
+
// import 'material-icons/iconfont/round.css';
|
|
289
|
+
// import 'material-icons/iconfont/sharp.css';
|
|
290
|
+
// import 'material-icons/iconfont/two-tone.css';
|
|
291
|
+
|
|
292
|
+
Icon.use(MaterialIconRender, { variant: 'fill', size: 'medium' });
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Supported variants**
|
|
296
|
+
|
|
297
|
+
| Variant | Description | Required CSS |
|
|
298
|
+
|---|---|---|
|
|
299
|
+
| `fill` / `regular` (default) | Filled icons | `filled.css` |
|
|
300
|
+
| `outline` | Outlined icons | `outlined.css` |
|
|
301
|
+
| `round` | Rounded icons | `round.css` |
|
|
302
|
+
| `sharp` | Sharp corners | `sharp.css` |
|
|
303
|
+
| `twoTone` | Two-tone icons | `two-tone.css` |
|
|
304
|
+
|
|
305
|
+
> Material Icons uses **ligatures** - the icon name is the text content of the element, converted to an icon by the font. This is handled automatically by the renderer.
|
|
306
|
+
|
|
307
|
+
**Example**
|
|
308
|
+
|
|
309
|
+
```javascript
|
|
310
|
+
Icon.search // filled, medium
|
|
311
|
+
Icon.search.variant('outline') // outlined
|
|
312
|
+
Icon.star.large() // filled, 32px
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Next Steps
|
|
318
|
+
|
|
319
|
+
- **[Components Overview](./index.md)** - BaseComponent and renderer pattern
|
|
320
|
+
- **[Getting Started](./getting-started.md)** - Register default renderers
|
|
321
|
+
- **[Theming](../theming.md)** - CSS tokens reference
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.169",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -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
|
+
};
|