native-document 1.0.76 → 1.0.77

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.
Files changed (184) hide show
  1. package/components.js +26 -1
  2. package/dist/native-document.components.min.js +6360 -1925
  3. package/dist/native-document.dev.js +122 -56
  4. package/dist/native-document.dev.js.map +1 -1
  5. package/dist/native-document.devtools.min.js +1 -1
  6. package/dist/native-document.min.js +1 -1
  7. package/jsconfig.json +15 -0
  8. package/package.json +1 -1
  9. package/rollup.config.js +4 -2
  10. package/src/components/$traits/HasItems.js +38 -0
  11. package/src/components/BaseComponent.js +70 -0
  12. package/src/components/accordion/Accordion.js +133 -0
  13. package/src/components/accordion/AccordionItem.js +119 -0
  14. package/src/components/accordion/index.js +7 -0
  15. package/src/components/alert/Alert.js +155 -0
  16. package/src/components/alert/index.js +6 -0
  17. package/src/components/avatar/Avatar.js +178 -0
  18. package/src/components/avatar/index.js +5 -0
  19. package/src/components/badge/Badge.js +103 -0
  20. package/src/components/badge/index.js +6 -0
  21. package/src/components/breadcrumb/BreadCrumb.js +70 -0
  22. package/src/components/breadcrumb/index.js +5 -0
  23. package/src/components/button/Button.js +174 -0
  24. package/src/components/button/index.js +5 -0
  25. package/src/components/card/Card.js +110 -0
  26. package/src/components/card/index.js +5 -0
  27. package/src/components/context-menu/ContextMenu.js +60 -0
  28. package/src/components/context-menu/ContextMenuGroup.js +16 -0
  29. package/src/components/context-menu/ContextMenuItem.js +16 -0
  30. package/src/components/context-menu/index.js +10 -0
  31. package/src/components/divider/Divider.js +126 -0
  32. package/src/components/divider/index.js +6 -0
  33. package/src/components/dropdown/Dropdown.js +170 -0
  34. package/src/components/dropdown/DropdownDivider.js +24 -0
  35. package/src/components/dropdown/DropdownGroup.js +44 -0
  36. package/src/components/dropdown/DropdownItem.js +71 -0
  37. package/src/components/dropdown/DropdownTrigger.js +64 -0
  38. package/src/components/dropdown/index.js +13 -0
  39. package/src/components/{fom-control → form}/FormControl.js +30 -22
  40. package/src/components/{fom-control → form}/field/DefaultRender.js +2 -16
  41. package/src/components/{fom-control → form}/field/Field.js +67 -140
  42. package/src/components/{fom-control → form}/field/FieldCollection.js +42 -22
  43. package/src/components/{fom-control → form}/field/types/AutocompleteField.js +11 -0
  44. package/src/components/form/field/types/CheckboxField.js +36 -0
  45. package/src/components/{fom-control → form}/field/types/CheckboxGroupField.js +10 -0
  46. package/src/components/{fom-control → form}/field/types/ColorField.js +11 -1
  47. package/src/components/{fom-control → form}/field/types/DateField.js +11 -1
  48. package/src/components/{fom-control → form}/field/types/EmailField.js +11 -1
  49. package/src/components/{fom-control → form}/field/types/FileField.js +11 -1
  50. package/src/components/form/field/types/HiddenField.js +18 -0
  51. package/src/components/{fom-control → form}/field/types/ImageField.js +11 -1
  52. package/src/components/{fom-control → form}/field/types/NumberField.js +11 -1
  53. package/src/components/{fom-control → form}/field/types/PasswordField.js +11 -1
  54. package/src/components/{fom-control → form}/field/types/RadioField.js +28 -2
  55. package/src/components/{fom-control → form}/field/types/RangeField.js +10 -0
  56. package/src/components/{fom-control → form}/field/types/SearchField.js +10 -0
  57. package/src/components/{fom-control → form}/field/types/SelectField.js +10 -0
  58. package/src/components/{fom-control → form}/field/types/StringField.js +11 -1
  59. package/src/components/{fom-control → form}/field/types/TelField.js +11 -2
  60. package/src/components/{fom-control → form}/field/types/TextAreaField.js +10 -0
  61. package/src/components/{fom-control → form}/field/types/TimeField.js +11 -2
  62. package/src/components/{fom-control → form}/field/types/UrlField.js +10 -2
  63. package/src/components/form/index.js +49 -0
  64. package/src/components/{fom-control → form}/validation/Validation.js +1 -1
  65. package/src/components/list/List.js +106 -0
  66. package/src/components/list/ListGroup.js +67 -0
  67. package/src/components/list/ListItem.js +103 -0
  68. package/src/components/list/index.js +10 -0
  69. package/src/components/menu/Menu.js +82 -0
  70. package/src/components/menu/MenuDivider.js +22 -0
  71. package/src/components/menu/MenuGroup.js +42 -0
  72. package/src/components/menu/MenuItem.js +71 -0
  73. package/src/components/menu/index.js +13 -0
  74. package/src/components/modal/Modal.js +153 -0
  75. package/src/components/modal/index.js +5 -0
  76. package/src/components/pagination/Pagination.js +229 -0
  77. package/src/components/pagination/index.js +5 -0
  78. package/src/components/popover/Popover.js +185 -0
  79. package/src/components/popover/PopoverFooter.js +37 -0
  80. package/src/components/popover/PopoverHeader.js +43 -0
  81. package/src/components/popover/index.js +10 -0
  82. package/src/components/progress/Progress.js +220 -0
  83. package/src/components/progress/index.js +6 -0
  84. package/src/components/skeleton/Skeleton.js +98 -0
  85. package/src/components/skeleton/SkeletonCard.js +0 -0
  86. package/src/components/skeleton/SkeletonList.js +0 -0
  87. package/src/components/skeleton/SkeletonParagraph.js +0 -0
  88. package/src/components/skeleton/SkeletonTable.js +0 -0
  89. package/src/components/skeleton/index.js +6 -0
  90. package/src/components/slider/Slider.js +183 -0
  91. package/src/components/slider/index.js +5 -0
  92. package/src/components/spinner/Spinner.js +160 -0
  93. package/src/components/spinner/index.js +5 -0
  94. package/src/components/splitter/Splitter.js +95 -0
  95. package/src/components/splitter/SplitterGutter.js +57 -0
  96. package/src/components/splitter/SplitterPanel.js +82 -0
  97. package/src/components/splitter/index.js +8 -0
  98. package/src/components/stepper/Stepper.js +229 -0
  99. package/src/components/stepper/StepperStep.js +103 -0
  100. package/src/components/stepper/index.js +8 -0
  101. package/src/components/switch/Switch.js +99 -0
  102. package/src/components/switch/index.js +0 -0
  103. package/src/components/table/ColumnGroup.js +1 -1
  104. package/src/components/table/DataTable.js +1 -1
  105. package/src/components/table/SimpleTable.js +36 -32
  106. package/src/components/tabs/Tabs.js +110 -0
  107. package/src/components/tabs/index.js +6 -0
  108. package/src/components/toast/Toast.js +129 -0
  109. package/src/components/toast/ToastError.js +0 -0
  110. package/src/components/toast/ToastInfo.js +0 -0
  111. package/src/components/toast/ToastSuccess.js +0 -0
  112. package/src/components/toast/ToastWarning.js +0 -0
  113. package/src/components/toast/index.js +5 -0
  114. package/src/components/tooltip/Tooltip.js +98 -0
  115. package/src/components/tooltip/index.js +5 -0
  116. package/src/components/tooltip/prototypes.js +6 -0
  117. package/src/core/data/MemoryManager.js +2 -2
  118. package/src/core/data/Observable.js +1 -1
  119. package/src/core/data/ObservableArray.js +14 -8
  120. package/src/core/data/ObservableItem.js +5 -5
  121. package/src/core/data/observable-helpers/array.js +2 -2
  122. package/src/core/data/observable-helpers/batch.js +2 -2
  123. package/src/core/data/observable-helpers/computed.js +6 -6
  124. package/src/core/data/observable-helpers/object.js +2 -2
  125. package/src/core/elements/anchor.js +3 -3
  126. package/src/core/elements/content-formatter.js +1 -1
  127. package/src/core/elements/control/for-each-array.js +42 -68
  128. package/src/core/elements/control/for-each.js +7 -7
  129. package/src/core/elements/control/show-if.js +5 -5
  130. package/src/core/elements/control/show-when.js +2 -2
  131. package/src/core/elements/control/switch.js +4 -4
  132. package/src/core/elements/description-list.js +1 -1
  133. package/src/core/elements/form.js +1 -1
  134. package/src/core/elements/html5-semantics.js +1 -1
  135. package/src/core/elements/img.js +3 -3
  136. package/src/core/elements/index.js +1 -1
  137. package/src/core/elements/interactive.js +1 -1
  138. package/src/core/elements/list.js +1 -1
  139. package/src/core/elements/medias.js +1 -1
  140. package/src/core/elements/meta-data.js +1 -1
  141. package/src/core/elements/table.js +1 -1
  142. package/src/core/utils/EventEmitter.js +1 -1
  143. package/src/core/utils/args-types.js +2 -2
  144. package/src/core/utils/events.js +68 -0
  145. package/src/core/utils/filters/standard.js +1 -1
  146. package/src/core/utils/filters/utils.js +1 -1
  147. package/src/core/utils/helpers.js +10 -7
  148. package/src/core/utils/prototypes.js +2 -2
  149. package/src/core/utils/validator.js +6 -5
  150. package/src/core/wrappers/AttributesWrapper.js +21 -38
  151. package/src/core/wrappers/DocumentObserver.js +1 -1
  152. package/src/core/wrappers/ElementCreator.js +9 -14
  153. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  154. package/src/core/wrappers/NDElement.js +3 -3
  155. package/src/core/wrappers/NdPrototype.js +24 -31
  156. package/src/core/wrappers/SingletonView.js +1 -1
  157. package/src/core/wrappers/TemplateCloner.js +60 -18
  158. package/src/core/wrappers/constants.js +32 -1
  159. package/src/core/wrappers/prototypes/attributes-extensions.js +18 -5
  160. package/src/core/wrappers/prototypes/bind-class-extensions.js +18 -0
  161. package/src/core/wrappers/prototypes/nd-element-extensions.js +6 -6
  162. package/src/devtools/app/App.js +2 -2
  163. package/src/devtools/hrm/ComponentRegistry.js +2 -2
  164. package/src/devtools/plugin.js +1 -1
  165. package/src/devtools/widget/DevToolsWidget.js +2 -2
  166. package/src/router/Route.js +1 -1
  167. package/src/router/RouteGroupHelper.js +1 -1
  168. package/src/router/Router.js +4 -4
  169. package/src/router/RouterComponent.js +1 -1
  170. package/src/router/link.js +3 -3
  171. package/src/router/modes/HistoryRouter.js +1 -2
  172. package/types/filters/dates.d.ts +1 -1
  173. package/types/filters/standard.d.ts +0 -1
  174. package/types/filters/types.d.ts +1 -1
  175. package/utils.js +3 -3
  176. package/src/components/fom-control/default/DefaultLayout.js +0 -8
  177. package/src/components/fom-control/default/collection/DefaultCollectionLayout.js +0 -12
  178. package/src/components/fom-control/default/collection/DefaultCollectionTemplate.js +0 -6
  179. package/src/components/fom-control/field/types/CheckboxField.js +0 -17
  180. package/src/components/fom-control/field/types/HiddenField.js +0 -8
  181. package/src/components/fom-control/index.js +0 -8
  182. /package/src/components/{fom-control → form}/field/FieldFactory.js +0 -0
  183. /package/src/components/{fom-control → form}/merge +0 -0
  184. /package/src/components/{fom-control → form}/utils.js +0 -0
@@ -0,0 +1,70 @@
1
+
2
+ export default function BaseComponent() {
3
+
4
+ }
5
+
6
+ Object.defineProperty( BaseComponent.prototype, 'nd', {
7
+ get: function() {
8
+ if(this.$element) {
9
+ return this.$element.nd;
10
+ }
11
+ this.$storeElement(this.node());
12
+ return this.$element?.nd;
13
+ }
14
+ });
15
+
16
+
17
+ BaseComponent.extends = function(Component, ...parents) {
18
+ Component.prototype = Object.create(BaseComponent.prototype);
19
+
20
+ if(parents.length > 0) {
21
+ for(const parent of parents) {
22
+ Object.assign(Component.prototype, parent.prototype);
23
+ }
24
+ }
25
+ Component.prototype.constructor = Component;
26
+ };
27
+
28
+ BaseComponent.prototype.$storeElement = function(element) {
29
+ this.$element = element;
30
+ return this;
31
+ };
32
+
33
+ BaseComponent.prototype.refSelf = function(target, name) {
34
+ target[name] = this;
35
+ return this;
36
+ };
37
+
38
+ BaseComponent.prototype.$build = function() {
39
+ const ComponentClass = this.constructor;
40
+ const renderer = this.$description.render || ComponentClass.defaultTemplate;
41
+
42
+ if (!renderer) {
43
+ throw new Error(`No renderer for ${ComponentClass.name}`);
44
+ }
45
+
46
+ return renderer(this.$description, this);
47
+ };
48
+
49
+ BaseComponent.prototype.toNdElement = function() {
50
+ if (this.$element) {
51
+ return this.$element;
52
+ }
53
+ this.$element = this.$build();
54
+ return this.$element;
55
+ };
56
+
57
+ BaseComponent.prototype.toJSON = function() {
58
+ if(!this.$description) {
59
+ return {};
60
+ }
61
+ return { ...this.$description };
62
+ };
63
+
64
+ BaseComponent.prototype.render = function(renderFn) {
65
+ if (typeof renderFn !== 'function') {
66
+ throw new Error('Custom renderer must be a function');
67
+ }
68
+ this.$description.render = renderFn;
69
+ return this;
70
+ };
@@ -0,0 +1,133 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+
4
+ export default function Accordion(config = {}) {
5
+ if (!(this instanceof Accordion)) {
6
+ return new Accordion(config);
7
+ }
8
+
9
+ this.$description = {
10
+ items: [],
11
+ multiple: null,
12
+ variant: null,
13
+ renderContent: null,
14
+ ...config
15
+ };
16
+ }
17
+
18
+ BaseComponent.extends(Accordion, EventEmitter);
19
+
20
+ Accordion.defaultTemplate = null;
21
+
22
+ Accordion.use = function(template) {};
23
+
24
+ Accordion.prototype.item = function(accordionItem) {
25
+ this.$description.items.push(accordionItem);
26
+ return this;
27
+ };
28
+
29
+ Accordion.prototype.items = function(items) {
30
+ this.$description.items = items;
31
+ return this;
32
+ };
33
+
34
+ Accordion.prototype.addItem = Accordion.prototype.item;
35
+
36
+ Accordion.prototype.removeItemById = function(id) {
37
+ if (this.$description.items) {
38
+ this.$description.items = this.$description.items.filter(item => item.id !== id);
39
+ }
40
+ return this;
41
+ };
42
+
43
+ Accordion.prototype.removeItem = function(item) {
44
+ if (this.$description.items) {
45
+ this.$description.items = this.$description.items.filter(item);
46
+ }
47
+ return this;
48
+ };
49
+
50
+
51
+ Accordion.prototype.multiple = function(enabled = true) {
52
+ this.$description.multiple = enabled;
53
+ return this;
54
+ };
55
+
56
+ Accordion.prototype.variant = function(name) {
57
+ this.$description.variant = name;
58
+ return this;
59
+ };
60
+
61
+ Accordion.prototype.bordered = function() {
62
+ return this.variant('bordered');
63
+ };
64
+
65
+ Accordion.prototype.separated = function() {
66
+ return this.variant('separated');
67
+ };
68
+
69
+ Accordion.prototype.flush = function() {
70
+ return this.variant('flush');
71
+ };
72
+
73
+ Accordion.prototype.getByKey = function(key) {
74
+ return this.$description.items.find(item => item.key === key);
75
+ };
76
+
77
+ Accordion.prototype.expanded = function(key, state = true) {
78
+ const item = this.getByKey(key);
79
+ if(item) {
80
+ if (state && !this.$description.multiple) {
81
+ this.collapseAll();
82
+ }
83
+ item.expanded(state);
84
+ this.emit(state ? 'expand' : 'collapse', key, state);
85
+ }
86
+ return this;
87
+ };
88
+
89
+ Accordion.prototype.expandAll = function() {
90
+ this.$description.items.forEach(item => item.expanded(true));
91
+ return this;
92
+ };
93
+
94
+ Accordion.prototype.collapseAll = function() {
95
+ this.$description.items.forEach(item => item.expanded(false));
96
+ return this;
97
+ };
98
+
99
+ Accordion.prototype.isExpanded = function(key) {
100
+ return this.getByKey(key)?.isExpanded?.();
101
+ };
102
+
103
+ Accordion.prototype.onExpand = function(handler) {
104
+ this.on('expand', handler);
105
+ return this;
106
+ };
107
+
108
+ Accordion.prototype.onCollapse = function(handler) {
109
+ this.on('collapse', handler);
110
+ return this;
111
+ };
112
+
113
+ Accordion.prototype.renderContent = function(renderFn) {
114
+ this.$description.renderContent = renderFn;
115
+ return this;
116
+ };
117
+
118
+ Accordion.prototype.$build = function() {
119
+ // TODO: Implementation
120
+ // this.$description.items.forEach(item => {
121
+ // item.onExpand(() => {
122
+ // if (!this.$description.multiple) {
123
+ // this.$description.items
124
+ // .filter(i => i !== item)
125
+ // .forEach(i => i.expanded(false));
126
+ // }
127
+ // });
128
+ // });
129
+ };
130
+
131
+ Accordion.prototype.toNdElement = function() {
132
+ return this.$build();
133
+ };
@@ -0,0 +1,119 @@
1
+ import { $ } from '@core';
2
+ import BaseComponent from "@components/BaseComponent";
3
+
4
+ export default function AccordionItem(config = {}) {
5
+ if(!(this instanceof AccordionItem)){
6
+ return new AccordionItem()
7
+ }
8
+
9
+ this.$description = {
10
+ id: null,
11
+ title: null,
12
+ icon: null,
13
+ collapsible: true,
14
+ content: null,
15
+ renderHeader: null,
16
+ renderContent: null,
17
+ render: null,
18
+ expanded: $(false),
19
+ disabled: false,
20
+ ...config
21
+ };
22
+ }
23
+
24
+ BaseComponent.extends(AccordionItem);
25
+
26
+ Object.defineProperty(AccordionItem.prototype, 'id', {
27
+ get() {
28
+ this.$description.id;
29
+ }
30
+ });
31
+
32
+ AccordionItem.prototype.identifyBy = function(id) {
33
+ this.$description.id = id;
34
+ return this;
35
+ };
36
+
37
+ AccordionItem.prototype.content = function(content) {
38
+ this.$description.content = content;
39
+ return this;
40
+ };
41
+
42
+ AccordionItem.prototype.title = function(title) {
43
+ this.$description.title = title;
44
+ return this;
45
+ };
46
+
47
+ AccordionItem.prototype.icon = function(icon) {
48
+ this.$description.icon = icon;
49
+ return this;
50
+ };
51
+
52
+ AccordionItem.prototype.showIndicator = function(show = true) {
53
+ this.$description.showIndicator = show;
54
+ return this;
55
+ }
56
+
57
+ AccordionItem.prototype.collapsible = function(collapsible = true) {
58
+ this.$description.collapsible = collapsible;
59
+ return this;
60
+ };
61
+
62
+ AccordionItem.prototype.expanded = function(expanded = true) {
63
+ this.$description.expanded.set(expanded);
64
+ if (this.$description.expanded.val()) {
65
+ this.emit('expand');
66
+ } else {
67
+ this.emit('collapse');
68
+ }
69
+ return this;
70
+ };
71
+
72
+ AccordionItem.prototype.toggle = function() {
73
+ return this.expanded(!this.$description.expanded.val());
74
+ };
75
+
76
+ AccordionItem.prototype.disabled = function(disabled = true) {
77
+ this.$description.disabled = disabled;
78
+ return this;
79
+ };
80
+
81
+ AccordionItem.prototype.isExpanded = function() {
82
+ return this.$description.expanded.val();
83
+ };
84
+ AccordionItem.prototype.onExpand = function(handler) {
85
+ this.on('expand', handler );
86
+ return this;
87
+ };
88
+
89
+ AccordionItem.prototype.onCollapse = function(handler) {
90
+ this.on('collapse', handler);
91
+ return this;
92
+ };
93
+
94
+ AccordionItem.prototype.renderHeader = function(renderFn) {
95
+ this.$description.renderHeader = renderFn;
96
+ return this;
97
+ };
98
+
99
+ AccordionItem.prototype.renderContent = function(renderFn) {
100
+ this.$description.renderContent = renderFn;
101
+ };
102
+
103
+ AccordionItem.prototype.renderIndicator = function(renderFn) {
104
+ this.$description.renderIndicator = renderFn;
105
+ return this;
106
+ };
107
+
108
+ AccordionItem.prototype.render = function(renderFn) {
109
+ this.$description.render = renderFn;
110
+ return this;
111
+ }
112
+
113
+ AccordionItem.prototype.$build = function() {
114
+
115
+ };
116
+
117
+ AccordionItem.prototype.toNdElement = function() {
118
+
119
+ }
@@ -0,0 +1,7 @@
1
+ import Accordion from './Accordion';
2
+ import AccordionItem from './AccordionItem';
3
+
4
+ export {
5
+ Accordion,
6
+ AccordionItem
7
+ }
@@ -0,0 +1,155 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+
4
+ export default function Alert(message, config = {}) {
5
+ if(!(this instanceof Alert)) {
6
+ return new Alert(message, config);
7
+ }
8
+ this.$description = {
9
+ title: null,
10
+ content: null,
11
+ outline: null,
12
+ style: null,
13
+ variant: 'info',
14
+ closable: false,
15
+ autoDismiss: null,
16
+ icon: null,
17
+ showIcon: true,
18
+ ...config
19
+ };
20
+ }
21
+
22
+ Alert.defaultTemplate = null;
23
+ Alert.defaultTitleTemplate = null;
24
+ Alert.defaultButtonsTemplate = null;
25
+ Alert.defaultContentTemplate = null;
26
+
27
+ Alert.use = function(template) {};
28
+
29
+ BaseComponent.extends(Alert, EventEmitter);
30
+
31
+ Alert.prototype.variant = function(variant) {
32
+ this.$description.variant = variant;
33
+ return this;
34
+ };
35
+
36
+ Alert.prototype.info = function() {
37
+ return this.variant('info');
38
+ };
39
+ Alert.prototype.success = function() {
40
+ return this.variant('success');
41
+ };
42
+ Alert.prototype.warning = function() {
43
+ return this.variant('warning');
44
+ };
45
+ Alert.prototype.error = function() {
46
+ return this.variant('error');
47
+ };
48
+ Alert.prototype.danger = function() {
49
+ return this.variant('danger');
50
+ };
51
+
52
+ Alert.prototype.style = function(style) {
53
+ this.$description.style = style;
54
+ return this;
55
+ };
56
+ Alert.prototype.filled = function() {
57
+ return this.style('filled');
58
+ };
59
+ Alert.prototype.bordered = function() {
60
+ return this.style('bordered');
61
+ };
62
+ Alert.prototype.outline = function(outline = true) {
63
+ return this.style('outline');
64
+ };
65
+
66
+ Alert.prototype.title = function(title) {
67
+ this.$description.title = title;
68
+ return this;
69
+ };
70
+ Alert.prototype.content = function(content) {
71
+ this.$description.content = content;
72
+ return this;
73
+ };
74
+
75
+ Alert.prototype.renderTitle = function(callback) {
76
+ this.$description.renderTitle = callback;
77
+ return this;
78
+ };
79
+ Alert.prototype.renderContent = function(callback) {
80
+ this.$description.renderContent = callback;
81
+ return this;
82
+ };
83
+ Alert.prototype.renderFooter = function(callback) {
84
+ this.$description.renderFooter = callback;
85
+ return this;
86
+ };
87
+
88
+ Alert.prototype.clearActions = function(label, handler) {
89
+ this.$description.actions = [];
90
+ return this;
91
+ };
92
+
93
+ Alert.prototype.action = function(label, handler) {
94
+ this.$description.actions.push({label, handler});
95
+ return this;
96
+ };
97
+
98
+ Alert.prototype.layout = function(layoutFn) {
99
+ this.$description.layout = layoutFn;
100
+ return this;
101
+ };
102
+
103
+ Alert.prototype.icon = function(icon) {
104
+ this.$description.icon = icon;
105
+ return this;
106
+ };
107
+
108
+ Alert.prototype.showIcon = function(show = true) {
109
+ this.$description.showIcon = show;
110
+ };
111
+
112
+ Alert.prototype.closable = function(closable = true) {
113
+ this.$description.closable = closable;
114
+ return this;
115
+ };
116
+
117
+ Alert.prototype.dismissible = function(dismissible = true) {
118
+ return this.closable(dismissible);
119
+ };
120
+ Alert.prototype.autoDismiss = function(delay) {
121
+ this.$description.autoDismiss = delay;
122
+ return this;
123
+ };
124
+
125
+
126
+
127
+ Alert.prototype.close = function() {
128
+
129
+ };
130
+
131
+ Alert.prototype.show = function() {
132
+
133
+ };
134
+
135
+ Alert.prototype.hide = function() {
136
+
137
+ };
138
+
139
+ Alert.prototype.onClose = function(handler) {
140
+ this.on('close', handler);
141
+ return this;
142
+ };
143
+ Alert.prototype.onShow = function(handler) {
144
+ this.on('show', handler);
145
+ return this;
146
+ };
147
+
148
+ Alert.prototype.render = function(renderFn) {
149
+ this.$description.render = renderFn;
150
+ return this;
151
+ };
152
+ Alert.prototype.$build = function() {
153
+
154
+ };
155
+ Alert.prototype.toNdElement = function() {};
@@ -0,0 +1,6 @@
1
+ import Alert from './Alert';
2
+
3
+
4
+ export {
5
+ Alert
6
+ }
@@ -0,0 +1,178 @@
1
+ import {Validator} from "@core";
2
+ import BaseComponent from "@components/BaseComponent";
3
+
4
+ export default function Avatar(source, config = {}) {
5
+ if (!(this instanceof Avatar)) {
6
+ return new Avatar(config);
7
+ }
8
+
9
+ this.$description = {
10
+ src: Validator.isObservable(source) ? source : $(null),
11
+ alt: null,
12
+ name: null,
13
+ initials: null,
14
+ icon: null,
15
+ size: 'medium',
16
+ shape: 'circle',
17
+ variant: null,
18
+ color: null,
19
+ textColor: null,
20
+ status: null,
21
+ render: null,
22
+ ...config
23
+ };
24
+ }
25
+
26
+ BaseComponent.extends(Avatar);
27
+
28
+ Avatar.defaultTemplate = null;
29
+ Avatar.use = function(template) {};
30
+
31
+ Avatar.prototype.onError = function(handler) {};
32
+
33
+ Avatar.prototype.src = function(src) {
34
+ this.$description.src.set(src);
35
+ return this;
36
+ };
37
+ Avatar.prototype.alt = function(alt) {
38
+ this.$description.alt = alt;
39
+ return this;
40
+ };
41
+ Avatar.prototype.name = function(name) {
42
+ this.$description.name = name;
43
+ return this;
44
+ };
45
+ Avatar.prototype.initials = function(initials) {
46
+ this.$description.initials = initials;
47
+ return this;
48
+ };
49
+ Avatar.prototype.icon = function(icon) {
50
+ this.$description.icon = icon;
51
+ return this;
52
+ };
53
+
54
+ /**
55
+ * @param {string|int} size
56
+ * @returns {Avatar}
57
+ */
58
+ Avatar.prototype.size = function(size) {
59
+ this.$description.size = size;
60
+ return this;
61
+ };
62
+ Avatar.prototype.extraSmall = function() {
63
+ return this.size('extra-small');
64
+ };
65
+ Avatar.prototype.small = function() {
66
+ return this.size('small');
67
+ };
68
+ Avatar.prototype.medium = function() {
69
+ return this.size('medium');
70
+ };
71
+ Avatar.prototype.large = function() {
72
+ return this.size('large');
73
+ };
74
+ Avatar.prototype.extraLarge = function() {
75
+ return this.size('extra-large');
76
+ };
77
+
78
+ Avatar.prototype.shape = function(shape) {
79
+ this.$description.shape = shape;
80
+ return this;
81
+ };
82
+ Avatar.prototype.circle = function() {
83
+ return this.shape('circle');
84
+ };
85
+ Avatar.prototype.square = function() {
86
+ return this.shape('square');
87
+ };
88
+ Avatar.prototype.rounded = function() {
89
+ return this.shape('rounded');
90
+ };
91
+
92
+ Avatar.prototype.variant = function(variant) {
93
+ this.$description.variant = variant;
94
+ }; // 'primary' | 'secondary' | 'success' | etc.
95
+ Avatar.prototype.primary = function() {
96
+ return this.variant('primary');
97
+ };
98
+ Avatar.prototype.secondary = function() {
99
+ return this.variant('secondary');
100
+ };
101
+ Avatar.prototype.success = function() {
102
+ return this.variant('success');
103
+ };
104
+ Avatar.prototype.danger = function() {
105
+ return this.variant('danger');
106
+ };
107
+ Avatar.prototype.warning = function() {
108
+ return this.variant('warning');
109
+ };
110
+ Avatar.prototype.info = function() {
111
+ return this.variant('info');
112
+ }
113
+ Avatar.prototype.color = function(color) {
114
+ this.$description.color = color;
115
+ return this;
116
+ };
117
+ Avatar.prototype.textColor = function(color) {
118
+ this.$description.textColor = color;
119
+ return this;
120
+ };
121
+
122
+ Avatar.prototype.status = function(status) {
123
+ this.$description.status = status;
124
+ return this;
125
+ };
126
+ Avatar.prototype.statusPosition = function(position) {
127
+ this.$description.statusPosition = position;
128
+ }; // 'top-right' | 'bottom-right' | etc.
129
+ Avatar.prototype.statusAtTopEnd = function() {
130
+ return this.statusPosition('top-end');
131
+ };
132
+ Avatar.prototype.statusAtBottomEnd = function() {
133
+ return this.statusPosition('bottom-end');
134
+ };
135
+ Avatar.prototype.statusAtTopStart = function() {
136
+ return this.statusPosition('top-start');
137
+ };
138
+ Avatar.prototype.statusAtBottomStart = function() {
139
+ return this.statusPosition('bottom-start');
140
+ };
141
+
142
+ Avatar.prototype.showStatus = function(show = true) {
143
+ this.$description.showStatus = show;
144
+ return this;
145
+ };
146
+
147
+ // Badge
148
+ Avatar.prototype.badge = function(content) {
149
+ this.$description.badge = content;
150
+ return this;
151
+ };
152
+ Avatar.prototype.badgePosition = function(position) {
153
+ this.$description.badgePosition = position;
154
+ return this;
155
+ };
156
+ Avatar.prototype.badgeAtTopEnd = function() {
157
+ return this.badgePosition('top-end');
158
+ };
159
+ Avatar.prototype.badgeAtBottomEnd = function() {
160
+ return this.badgePosition('bottom-end');
161
+ };
162
+ Avatar.prototype.badgeAtTopStart = function() {
163
+ return this.badgePosition('top-start');
164
+ };
165
+ Avatar.prototype.badgeAtBottomStart = function() {
166
+ return this.badgePosition('bottom-start');
167
+ };
168
+
169
+
170
+ Avatar.prototype.render = function(renderFn) {
171
+ this.$description.render = renderFn;
172
+ return this;
173
+ };
174
+
175
+ Avatar.prototype.$build = function() {
176
+
177
+ };
178
+ Avatar.prototype.toNdElement = function() {};
@@ -0,0 +1,5 @@
1
+ import Avatar from './Avatar';
2
+
3
+ export {
4
+ Avatar
5
+ }