native-document 1.0.138 → 1.0.140

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 (259) hide show
  1. package/components.js +1 -1
  2. package/devtools/ComponentRegistry.js +3 -2
  3. package/dist/native-document.components.min.css +1 -0
  4. package/dist/native-document.components.min.js +11506 -8566
  5. package/dist/native-document.dev.js +2645 -2166
  6. package/dist/native-document.dev.js.map +1 -1
  7. package/dist/native-document.min.js +1 -1
  8. package/index.js +1 -0
  9. package/package.json +5 -2
  10. package/rollup.config.js +5 -2
  11. package/src/components/$traits/has-draggable/HasDraggable.js +69 -0
  12. package/src/components/$traits/has-draggable/has-draggable.css +8 -0
  13. package/src/components/$traits/{HasItems.js → has-items/HasItems.js} +2 -11
  14. package/src/components/$traits/has-position/HasFullPosition.js +51 -0
  15. package/src/components/$traits/has-position/HasPosition.js +23 -0
  16. package/src/components/$traits/has-resizable/HasResizable.js +113 -0
  17. package/src/components/$traits/has-resizable/has-resizable.css +121 -0
  18. package/src/components/$traits/has-validation/HasValidation.js +86 -0
  19. package/src/components/BaseComponent.js +109 -4
  20. package/src/components/accordion/Accordion.js +37 -31
  21. package/src/components/accordion/AccordionItem.js +14 -21
  22. package/src/components/alert/Alert.js +48 -40
  23. package/src/components/avatar/Avatar.js +4 -3
  24. package/src/components/avatar/AvatarGroup.js +8 -2
  25. package/src/components/badge/Badge.js +7 -7
  26. package/src/components/base-component.css +0 -0
  27. package/src/components/breadcrumb/BreadCrumb.js +30 -21
  28. package/src/components/button/Button.js +3 -14
  29. package/src/components/context-menu/ContextMenu.js +49 -26
  30. package/src/components/dropdown/Dropdown.js +172 -34
  31. package/src/components/dropdown/DropdownDivider.js +4 -3
  32. package/src/components/dropdown/DropdownGroup.js +19 -19
  33. package/src/components/dropdown/DropdownItem.js +24 -18
  34. package/src/components/dropdown/helpers.js +52 -0
  35. package/src/components/form/FormControl.js +207 -108
  36. package/src/components/form/field/Field.js +106 -174
  37. package/src/components/form/field/FieldCollection.js +110 -203
  38. package/src/components/form/field/types/AutocompleteField.js +26 -5
  39. package/src/components/form/field/types/CheckboxField.js +4 -4
  40. package/src/components/form/field/types/CheckboxGroupField.js +11 -5
  41. package/src/components/form/field/types/ColorField.js +4 -4
  42. package/src/components/form/field/types/DateField.js +110 -18
  43. package/src/components/form/field/types/EmailField.js +2 -2
  44. package/src/components/form/field/types/FileField.js +87 -21
  45. package/src/components/form/field/types/HiddenField.js +4 -4
  46. package/src/components/form/field/types/ImageField.js +4 -4
  47. package/src/components/form/field/types/NumberField.js +5 -5
  48. package/src/components/form/field/types/PasswordField.js +28 -6
  49. package/src/components/form/field/types/RadioField.js +12 -8
  50. package/src/components/form/field/types/RangeField.js +29 -5
  51. package/src/components/form/field/types/SearchField.js +4 -4
  52. package/src/components/form/field/types/SelectField.js +75 -8
  53. package/src/components/form/field/types/StringField.js +4 -4
  54. package/src/components/form/field/types/TelField.js +4 -4
  55. package/src/components/form/field/types/TextAreaField.js +7 -5
  56. package/src/components/form/field/types/TimeField.js +52 -6
  57. package/src/components/form/field/types/UrlField.js +4 -5
  58. package/src/components/form/field/types/file-field-mode/FileAvatarMode.js +104 -0
  59. package/src/components/form/field/types/file-field-mode/FileDropzoneMode.js +59 -0
  60. package/src/components/form/field/types/file-field-mode/FileItemPreview.js +74 -0
  61. package/src/components/form/field/types/file-field-mode/FileNativeMode.js +21 -0
  62. package/src/components/form/field/types/file-field-mode/FileUploadButtonMode.js +59 -0
  63. package/src/components/form/field/types/file-field-mode/FileWallMode.js +53 -0
  64. package/src/components/form/index.js +14 -2
  65. package/src/components/form/validation/Validation.js +9 -0
  66. package/src/components/list/List.js +1 -1
  67. package/src/components/list/ListGroup.js +1 -1
  68. package/src/components/menu/HasMenuItem.js +133 -0
  69. package/src/components/menu/Menu.js +47 -56
  70. package/src/components/menu/MenuGroup.js +36 -8
  71. package/src/components/menu/MenuItem.js +24 -10
  72. package/src/components/menu/MenuLink.js +2 -0
  73. package/src/components/modal/Modal.js +153 -23
  74. package/src/components/pagination/Pagination.js +55 -21
  75. package/src/components/popover/Popover.js +127 -40
  76. package/src/components/progress/Progress.js +14 -24
  77. package/src/components/skeleton/Skeleton.js +36 -13
  78. package/src/components/slider/Slider.js +96 -70
  79. package/src/components/spinner/Spinner.js +4 -2
  80. package/src/components/splitter/Splitter.js +15 -8
  81. package/src/components/splitter/SplitterGutter.js +28 -7
  82. package/src/components/splitter/SplitterPanel.js +9 -15
  83. package/src/components/splitter/index.js +3 -1
  84. package/src/components/stacks/AbsoluteStack.js +33 -0
  85. package/src/components/stacks/FixedStack.js +33 -0
  86. package/src/components/stacks/PositionStack.js +146 -0
  87. package/src/components/stacks/RelativeStack.js +33 -0
  88. package/src/components/{layouts → stacks}/Stack.js +22 -3
  89. package/src/components/{layouts → stacks}/index.js +6 -4
  90. package/src/components/stepper/Stepper.js +159 -67
  91. package/src/components/stepper/StepperStep.js +49 -12
  92. package/src/components/switch/Switch.js +59 -29
  93. package/src/components/switch/index.js +6 -0
  94. package/src/components/table/Column.js +22 -26
  95. package/src/components/table/ColumnGroup.js +4 -13
  96. package/src/components/table/DataTable.js +388 -103
  97. package/src/components/table/SimpleTable.js +28 -143
  98. package/src/components/tabs/Tabs.js +142 -44
  99. package/src/components/toast/Toast.js +40 -35
  100. package/src/components/tooltip/Tooltip.js +152 -35
  101. package/src/core/data/ObservableArray.js +94 -30
  102. package/src/core/data/ObservableChecker.js +20 -75
  103. package/src/core/data/ObservableItem.js +35 -3
  104. package/src/core/data/observable-helpers/computed.js +2 -1
  105. package/src/core/data/observable-helpers/object.js +13 -8
  106. package/src/core/data/observable-helpers/observable.is-to.js +196 -0
  107. package/src/core/elements/anchor/anchor.js +3 -2
  108. package/src/core/elements/control/for-each-array.js +44 -30
  109. package/src/core/elements/control/for-each.js +6 -3
  110. package/src/core/elements/control/show-if.js +11 -6
  111. package/src/core/elements/control/switch.js +2 -1
  112. package/src/core/elements/index.js +1 -1
  113. package/src/core/elements/svg.js +61 -0
  114. package/src/core/utils/HasEventEmitter.js +6 -0
  115. package/src/core/utils/debug-manager.js +2 -5
  116. package/src/core/utils/filters/standard.js +2 -1
  117. package/src/core/utils/property-accumulator.js +35 -6
  118. package/src/core/utils/shortcut-manager.js +242 -0
  119. package/src/core/utils/validator.js +1 -1
  120. package/src/core/wrappers/AttributesWrapper.js +41 -4
  121. package/src/core/wrappers/DocumentObserver.js +0 -1
  122. package/src/core/wrappers/HtmlElementWrapper.js +1 -1
  123. package/src/core/wrappers/NDElement.js +15 -2
  124. package/src/core/wrappers/SvgElementWrapper.js +15 -0
  125. package/src/core/wrappers/prototypes/attributes-extensions.js +4 -1
  126. package/src/core/wrappers/prototypes/nd-element-extensions.js +8 -1
  127. package/src/router/Router.js +0 -1
  128. package/src/ui/components/accordion/AccordionItemRender.js +63 -0
  129. package/src/ui/components/accordion/AccordionRender.js +34 -0
  130. package/src/ui/components/accordion/accordion.css +121 -0
  131. package/src/ui/components/alert/AlertRender.js +80 -0
  132. package/src/ui/components/alert/alert.css +163 -0
  133. package/src/ui/components/avatar/avata-group/AvatarGroupRender.js +49 -0
  134. package/src/ui/components/avatar/avata-group/avatar-group.css +38 -0
  135. package/src/ui/components/avatar/avatar/AvatarRender.js +87 -0
  136. package/src/ui/components/avatar/avatar/avatar.css +189 -0
  137. package/src/ui/components/badge/BadgeRender.js +24 -0
  138. package/src/ui/components/badge/badge.css +168 -0
  139. package/src/ui/components/breadcrumb/BreadcrumbRender.js +43 -0
  140. package/src/ui/components/breadcrumb/breadcrumb.css +55 -0
  141. package/src/ui/components/button/ButtonRender.js +65 -0
  142. package/src/ui/components/button/button.css +288 -354
  143. package/src/ui/components/contextmenu/ContextmenuRender.js +70 -0
  144. package/src/ui/components/contextmenu/contextmenu.css +36 -0
  145. package/src/ui/components/divider/DividerRender.js +70 -0
  146. package/src/ui/components/divider/divider.css +70 -0
  147. package/src/ui/components/dropdown/DropdownRender.js +92 -0
  148. package/src/ui/components/dropdown/divider/DropdownDividerRender.js +9 -0
  149. package/src/ui/components/dropdown/divider/dropdown-divider.css +0 -0
  150. package/src/ui/components/dropdown/dropdown.css +179 -0
  151. package/src/ui/components/dropdown/group/DropdownGroupRender.js +23 -0
  152. package/src/ui/components/dropdown/group/dropdown-group.css +0 -0
  153. package/src/ui/components/dropdown/item/DropdownItemRender.js +29 -0
  154. package/src/ui/components/dropdown/item/dropdown-item.css +0 -0
  155. package/src/ui/components/form/FieldCollectionRender.js +110 -0
  156. package/src/ui/components/form/FormControlRender.js +84 -0
  157. package/src/ui/components/form/field-collection.css +55 -0
  158. package/src/ui/components/form/fields/AutocompleteFieldRender.js +143 -0
  159. package/src/ui/components/form/fields/CheckboxFieldRender.js +59 -0
  160. package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +92 -0
  161. package/src/ui/components/form/fields/ColorFieldRender.js +30 -0
  162. package/src/ui/components/form/fields/DateFieldRender.js +154 -0
  163. package/src/ui/components/form/fields/EmailFieldRender.js +5 -0
  164. package/src/ui/components/form/fields/FieldRender.js +117 -0
  165. package/src/ui/components/form/fields/FileFieldRender.js +41 -0
  166. package/src/ui/components/form/fields/HiddenFieldRender.js +14 -0
  167. package/src/ui/components/form/fields/ImageFieldRender.js +0 -0
  168. package/src/ui/components/form/fields/NumberFieldRender.js +52 -0
  169. package/src/ui/components/form/fields/PasswordFieldRender.js +65 -0
  170. package/src/ui/components/form/fields/RadioFieldRender.js +77 -0
  171. package/src/ui/components/form/fields/RangeFieldRender.js +121 -0
  172. package/src/ui/components/form/fields/SelectFieldRender.js +248 -0
  173. package/src/ui/components/form/fields/SliderFieldRender.js +359 -0
  174. package/src/ui/components/form/fields/StringFieldRender.js +6 -0
  175. package/src/ui/components/form/fields/TelFieldRender.js +6 -0
  176. package/src/ui/components/form/fields/TextAreaFieldRender.js +96 -0
  177. package/src/ui/components/form/fields/TimeFieldRender.js +141 -0
  178. package/src/ui/components/form/fields/UrlFieldRender.js +6 -0
  179. package/src/ui/components/form/fields/date-field.css +32 -0
  180. package/src/ui/components/form/fields/field.css +402 -0
  181. package/src/ui/components/form/fields/file-field.css +79 -0
  182. package/src/ui/components/form/fields/password-field.css +50 -0
  183. package/src/ui/components/form/fields/range-field.css +120 -0
  184. package/src/ui/components/form/fields/slider.css +195 -0
  185. package/src/ui/components/form/file-upload-mode/FileAvatarModeRender.js +143 -0
  186. package/src/ui/components/form/file-upload-mode/FileDropzoneModeRender.js +108 -0
  187. package/src/ui/components/form/file-upload-mode/FileNativeModeRender.js +22 -0
  188. package/src/ui/components/form/file-upload-mode/FileUploadButtonModeRender.js +89 -0
  189. package/src/ui/components/form/file-upload-mode/FileWallModeRender.js +91 -0
  190. package/src/ui/components/form/file-upload-mode/file-avatar-mode.css +139 -0
  191. package/src/ui/components/form/file-upload-mode/file-dropzone-mode.css +88 -0
  192. package/src/ui/components/form/file-upload-mode/file-upload-button-mode.css +44 -0
  193. package/src/ui/components/form/file-upload-mode/file-wall-mode.css +88 -0
  194. package/src/ui/components/form/form-control.css +40 -0
  195. package/src/ui/components/form/helpers.js +112 -0
  196. package/src/ui/components/form/index.js +61 -0
  197. package/src/ui/components/menu/MenuDividerRender.js +12 -0
  198. package/src/ui/components/menu/MenuGroupRender.js +60 -0
  199. package/src/ui/components/menu/MenuItemRender.js +57 -0
  200. package/src/ui/components/menu/MenuLinkRender.js +55 -0
  201. package/src/ui/components/menu/MenuRender.js +21 -0
  202. package/src/ui/components/menu/helpers.js +121 -0
  203. package/src/ui/components/menu/menu.css +308 -0
  204. package/src/ui/components/modal/ModalRender.js +119 -0
  205. package/src/ui/components/modal/modal.css +156 -0
  206. package/src/ui/components/pagination/PaginationRender.js +112 -0
  207. package/src/ui/components/pagination/pagination.css +63 -0
  208. package/src/ui/components/popover/PopoverRender.js +234 -0
  209. package/src/ui/components/popover/popover.css +139 -0
  210. package/src/ui/components/progress/ProgressRender.js +168 -0
  211. package/src/ui/components/progress/progress.css +197 -0
  212. package/src/ui/components/skeleton/SkeletonRender.js +79 -0
  213. package/src/ui/components/skeleton/skeleton.css +154 -0
  214. package/src/ui/components/spinner/SpinnerRender.js +46 -0
  215. package/src/ui/components/spinner/spinner.css +152 -0
  216. package/src/ui/components/splitter/SplitterGutterRender.js +94 -0
  217. package/src/ui/components/splitter/SplitterPanelRender.js +38 -0
  218. package/src/ui/components/splitter/SplitterRender.js +74 -0
  219. package/src/ui/components/splitter/splitter.css +128 -0
  220. package/src/ui/components/stacks/PositionStackRender.js +38 -0
  221. package/src/ui/components/stacks/StackRender.js +42 -0
  222. package/src/ui/components/stacks/absolute-stack/AbsoluteStackRender.js +5 -0
  223. package/src/ui/components/stacks/fixed-stack/FixedStackRender.js +5 -0
  224. package/src/ui/components/stacks/h-stack/HStackRender.js +7 -0
  225. package/src/ui/components/stacks/h-stack/h-stack.css +4 -0
  226. package/src/ui/components/stacks/index.js +15 -0
  227. package/src/ui/components/stacks/position-stack.css +62 -0
  228. package/src/ui/components/stacks/relative-stack/RelativeStackRender.js +7 -0
  229. package/src/ui/components/stacks/relative-stack/relative-stack.css +3 -0
  230. package/src/ui/components/stacks/stack.css +78 -0
  231. package/src/ui/components/stacks/v-stack/VStackRender.js +5 -0
  232. package/src/ui/components/stacks/v-stack/v-stack.css +4 -0
  233. package/src/ui/components/stepper/StepperRender.js +70 -0
  234. package/src/ui/components/stepper/StepperStepRender.js +67 -0
  235. package/src/ui/components/stepper/stepper.css +359 -0
  236. package/src/ui/components/switch/SwitchRender.js +82 -0
  237. package/src/ui/components/switch/switch.css +143 -0
  238. package/src/ui/components/table/data-table/DataTableRender.js +49 -0
  239. package/src/ui/components/table/data-table/bulk-actions.js +35 -0
  240. package/src/ui/components/table/data-table/data-table.css +246 -0
  241. package/src/ui/components/table/data-table/pagination.js +56 -0
  242. package/src/ui/components/table/data-table/tables.js +363 -0
  243. package/src/ui/components/table/data-table/toolbar.js +67 -0
  244. package/src/ui/components/table/simple-table/SimpleTableRender.js +188 -0
  245. package/src/ui/components/table/simple-table/simple-table.css +50 -0
  246. package/src/ui/components/tabs/TabsRender.js +226 -0
  247. package/src/ui/components/tabs/tabs.css +253 -0
  248. package/src/ui/components/toast/ToastRender.js +98 -0
  249. package/src/ui/components/toast/toast.css +201 -0
  250. package/src/ui/components/tooltip/TooltipRender.js +8 -0
  251. package/src/ui/components/tooltip/tooltip.css +113 -0
  252. package/src/ui/index.js +82 -0
  253. package/src/ui/tokens/colors-dark.scss +2 -1
  254. package/src/ui/tokens/reset.scss +3 -0
  255. package/types/control-flow.d.ts +2 -2
  256. package/src/components/layouts/ZStack.js +0 -41
  257. package/src/ui/components/button/button.render.js +0 -63
  258. /package/src/components/{layouts → stacks}/HStack.js +0 -0
  259. /package/src/components/{layouts → stacks}/VStack.js +0 -0
@@ -1,5 +1,7 @@
1
1
  import BaseComponent from "../BaseComponent";
2
2
  import DebugManager from "../../core/utils/debug-manager";
3
+ import { HStack, VStack } from "../stacks/index";
4
+ import {Div} from "../../core/elements/index";
3
5
 
4
6
  export default function Skeleton(props = {}) {
5
7
  if (!(this instanceof Skeleton)) {
@@ -26,7 +28,7 @@ BaseComponent.extends(Skeleton);
26
28
  Skeleton.defaultTemplate = null;
27
29
 
28
30
  Skeleton.use = function(template) {
29
- Skeleton.defaultTemplate = template.skeleton;
31
+ Skeleton.defaultTemplate = template;
30
32
  };
31
33
 
32
34
  Skeleton.preset = function(name, callback) {
@@ -117,21 +119,42 @@ Skeleton.prototype.repeat = function(times) {
117
119
  };
118
120
 
119
121
 
120
- Skeleton.prototype.render = function(renderFn) {
121
- this.$description.render = renderFn;
122
- return this;
122
+ Skeleton.card = function(type) {
123
+ return VStack([
124
+ Skeleton().type('image').height(200),
125
+ VStack([
126
+ Skeleton().text(1),
127
+ Skeleton().text(2),
128
+ ]).spacing('cozy')
129
+ ], { class: 'skeleton-card '+type }).spacing('cozy');
123
130
  };
124
131
 
132
+ Skeleton.list = function(items = 3) {
133
+ return VStack(
134
+ Array.from({length: items}, () =>
135
+ HStack([
136
+ Div({ class: 'skeleton-list-item-avatar' }, Skeleton().circle().size(40, 40)),
137
+ Div({ class: 'skeleton-list-item-text' }, Skeleton().text(2)),
138
+ ], { class: 'skeleton-list-item' }).spacing('comfortable').alignCenter()
139
+ )
140
+ ).spacing('comfortable');
141
+ };
125
142
 
126
- Skeleton.prototype.$build = function() {
143
+ Skeleton.table = function(rows = 5, cols = 4) {
144
+ const buildRow = () =>
145
+ HStack(
146
+ Array.from({length: cols}, () =>
147
+ Div({ class: 'skeleton-table-col' }, Skeleton().rect().height(16))
148
+ ),
149
+ { class: 'skeleton-table-row' }
150
+ ).spacing('comfortable').alignCenter();
127
151
 
128
- };
129
- Skeleton.prototype.toNdElement = function() {
130
- return this.$build();
152
+ return VStack([
153
+ buildRow(),
154
+ ...Array.from({length: rows}, () => buildRow())
155
+ ]).spacing('cozy');
131
156
  };
132
157
 
133
- // Presets
134
- Skeleton.card = function() {}; // Preset pour card
135
- Skeleton.list = function(items = 3) {}; // Preset pour liste
136
- Skeleton.table = function(rows = 5, cols = 4) {}; // Preset pour tableau
137
- Skeleton.paragraph = function(lines = 3) {}; // Preset pour paragraphe
158
+ Skeleton.paragraph = function(lines = 3) {
159
+ return Skeleton().text(lines);
160
+ };
@@ -1,51 +1,72 @@
1
- import BaseComponent from "../BaseComponent";
2
- import HasEventEmitter from "../../core/utils/HasEventEmitter";
1
+ import Field from "../form/field/Field";
3
2
 
4
- export default function Slider(config = {}) {
5
- if (!(this instanceof Slider)) {
6
- return new Slider(config);
3
+ export default function Slider(name, props = {}) {
4
+ if(!(this instanceof Slider)) {
5
+ return new Slider(props);
7
6
  }
8
7
 
8
+ Field.call(this, props);
9
+
9
10
  this.$description = {
10
- value: null,
11
- defaultValue: null,
12
- range: null,
13
- min: null,
14
- max: null,
15
- step: null,
16
- showValue: null,
17
- showTooltip: null,
11
+ name,
12
+ id: name || null,
13
+ value: null,
14
+ defaultValue: null,
15
+ valueStart: null,
16
+ valueEnd: null,
17
+ range: false,
18
+ min: 0,
19
+ max: 100,
20
+ step: 1,
21
+ showValue: null,
22
+ showTooltip: null,
18
23
  tooltipFormat: null,
19
- marks: null,
20
- showMarks: null,
21
- variant: null,
22
- color: null,
23
- trackColor: null,
24
- vertical: null,
25
- height: null,
26
- disabled: null,
27
- readonly: null,
28
- reverse: null,
29
- snapToMarks: null,
30
- render: null,
31
- renderCursor: null,
32
- ...config
24
+ renderTooltip: null,
25
+ marks: null,
26
+ showMarks: null,
27
+ variant: null,
28
+ color: null,
29
+ trackColor: null,
30
+ fillColor: null,
31
+ vertical: false,
32
+ height: null,
33
+ disabled: null,
34
+ readonly: null,
35
+ reverse: false,
36
+ snapToMarks: false,
37
+ renderCursor: null,
38
+ renderThumb: null,
39
+ props
33
40
  };
34
41
  }
35
42
 
36
- BaseComponent.extends(Slider, HasEventEmitter);
43
+ Slider.prototype = Object.create(Field.prototype);
44
+ Slider.prototype.constructor = Slider;
45
+
37
46
 
38
- Slider.use = function(template) {};
39
47
  Slider.defaultTemplate = null;
48
+ Slider.use = function(template) {
49
+ Slider.defaultTemplate = template;
50
+ };
51
+
52
+ Slider.prototype.model = function(observable) {
53
+ this.$description.value = observable;
54
+ return this;
55
+ };
40
56
 
57
+ Slider.prototype.modelStart = function(observable) {
58
+ this.$description.valueStart = observable;
59
+ return this;
60
+ };
41
61
 
42
- Slider.prototype.value = function(value) {
43
- this.$description.value = value;
62
+ Slider.prototype.modelEnd = function(observable) {
63
+ this.$description.valueEnd = observable;
44
64
  return this;
45
65
  };
46
66
 
47
- Slider.prototype.value = function() {
48
- return this.$description.value?.val();
67
+ Slider.prototype.defaultValue = function(value) {
68
+ this.$description.defaultValue = value;
69
+ return this;
49
70
  };
50
71
 
51
72
  Slider.prototype.setCurrentStep = function(value) {
@@ -54,8 +75,8 @@ Slider.prototype.setCurrentStep = function(value) {
54
75
  return this;
55
76
  };
56
77
 
57
- Slider.prototype.range = function(min, max) {
58
- this.$description.range = {min, max};
78
+ Slider.prototype.range = function(enabled = true) {
79
+ this.$description.range = enabled;
59
80
  return this;
60
81
  };
61
82
 
@@ -89,6 +110,11 @@ Slider.prototype.tooltipFormat = function(formatFn) {
89
110
  return this;
90
111
  };
91
112
 
113
+ Slider.prototype.renderTooltip = function(renderFn) {
114
+ this.$description.renderTooltip = renderFn;
115
+ return this;
116
+ };
117
+
92
118
  Slider.prototype.marks = function(marks) {
93
119
  this.$description.marks = marks;
94
120
  return this;
@@ -99,28 +125,42 @@ Slider.prototype.showMarks = function(enabled = true) {
99
125
  return this;
100
126
  };
101
127
 
128
+ Slider.prototype.snapToMarks = function(enabled = true) {
129
+ this.$description.snapToMarks = enabled;
130
+ return this;
131
+ };
132
+
102
133
  Slider.prototype.variant = function(name) {
103
134
  this.$description.variant = name;
104
135
  return this;
105
136
  };
106
137
 
107
- Slider.prototype.primary = function() {
108
- return this.variant('primary');
109
- };
110
- Slider.prototype.secondary = function() {
111
- return this.variant('secondary');
112
- };
113
- Slider.prototype.success = function() {
114
- return this.variant('success');
138
+ Slider.prototype.primary = function() { return this.variant('primary'); };
139
+ Slider.prototype.secondary = function() { return this.variant('secondary'); };
140
+ Slider.prototype.success = function() { return this.variant('success'); };
141
+ Slider.prototype.warning = function() { return this.variant('warning'); };
142
+ Slider.prototype.danger = function() { return this.variant('danger'); };
143
+ Slider.prototype.info = function() { return this.variant('info'); };
144
+
145
+ Slider.prototype.color = function(color) {
146
+ this.$description.color = color;
147
+ return this;
115
148
  };
116
- Slider.prototype.warning = function() {
117
- return this.variant('warning');
149
+
150
+ Slider.prototype.trackColor = function(color) {
151
+ this.$description.trackColor = color;
152
+ return this;
118
153
  };
119
- Slider.prototype.danger = function() {
120
- return this.variant('danger');
154
+
155
+ Slider.prototype.fillColor = function(color) {
156
+ this.$description.fillColor = color;
157
+ return this;
121
158
  };
122
- Slider.prototype.info = function() {
123
- return this.variant('info');
159
+
160
+
161
+ Slider.prototype.fullColor = function(color) {
162
+ this.color(color).fillColor(color);
163
+ return this;
124
164
  };
125
165
 
126
166
  Slider.prototype.vertical = function(enabled = true) {
@@ -148,8 +188,13 @@ Slider.prototype.reverse = function(enabled = true) {
148
188
  return this;
149
189
  };
150
190
 
151
- Slider.prototype.snapToMarks = function(enabled = true) {
152
- this.$description.snapToMarks = enabled;
191
+ Slider.prototype.renderThumb = function(renderFn) {
192
+ this.$description.renderThumb = renderFn;
193
+ return this;
194
+ };
195
+
196
+ Slider.prototype.renderCursor = function(renderFn) {
197
+ this.$description.renderCursor = renderFn;
153
198
  return this;
154
199
  };
155
200
 
@@ -161,23 +206,4 @@ Slider.prototype.onChange = function(handler) {
161
206
  Slider.prototype.onComplete = function(handler) {
162
207
  this.on('complete', handler);
163
208
  return this;
164
- };
165
-
166
-
167
- Slider.prototype.renderCursor = function(renderFn) {
168
- this.$description.renderCursor = renderFn;
169
- return this;
170
- };
171
-
172
- Slider.prototype.render = function(renderFn) {
173
- this.$description.render = renderFn;
174
- };
175
-
176
-
177
- Slider.prototype.$build = function() {
178
- // TODO: Implementation
179
- };
180
-
181
- Slider.prototype.toNdElement = function() {
182
- return this.$build();
183
209
  };
@@ -16,8 +16,8 @@ export default function Spinner(props = {}) {
16
16
  overlay: null,
17
17
  backdrop: null,
18
18
  render: null,
19
- loading: null,
20
19
  speed: 'normal',
20
+ fullScreenOverlay: null,
21
21
  props
22
22
  };
23
23
  }
@@ -138,9 +138,11 @@ Spinner.prototype.overlay = function(enabled = true) {
138
138
  return this;
139
139
  };
140
140
  Spinner.prototype.fullscreen = function() {
141
+ this.$description.fullScreenOverlay = true;
141
142
  return this.overlay(true);
142
143
  };
143
144
  Spinner.prototype.backdrop = function(enabled = true) {
145
+ this.$description.overlay = true;
144
146
  this.$description.backdrop = enabled;
145
147
  return this;
146
148
  };
@@ -164,7 +166,7 @@ Spinner.prototype.fast = function() {
164
166
  return this.speed('fast');
165
167
  };
166
168
  Spinner.prototype.loading = function(isLoading) {
167
- this.$description.loading = BaseComponent.obs(isLoading);
169
+ this.showIf(isLoading);
168
170
  return this;
169
171
  };
170
172
  Spinner.prototype.bind = Spinner.prototype.loading;
@@ -1,24 +1,28 @@
1
1
  import BaseComponent from "../BaseComponent";
2
2
  import HasEventEmitter from "../../core/utils/HasEventEmitter";
3
3
  import {Validator} from "../../../index";
4
+ import SplitterPanel from "./SplitterPanel";
4
5
 
5
- export default function Splitter(config = {}) {
6
+ export default function Splitter(props = {}) {
6
7
  if(!(this instanceof Splitter)) {
7
- return new Splitter(config);
8
+ return new Splitter(props);
8
9
  }
9
10
 
11
+ BaseComponent.call(this, props);
12
+
10
13
  this.$description = {
11
14
  orientation: 'horizontal',
12
15
  panels: [],
13
16
  gutterSize: 8,
14
17
  render: null,
15
- ...config
18
+ props
16
19
  };
17
20
 
18
21
  this.$element = null;
19
22
  }
20
23
 
21
- BaseComponent.extends(Splitter, HasEventEmitter);
24
+ BaseComponent.extends(Splitter);
25
+ BaseComponent.use(Splitter, HasEventEmitter);
22
26
 
23
27
  Splitter.defaultTemplate = null;
24
28
 
@@ -51,17 +55,20 @@ Splitter.prototype.gutterSize = function(gutterSize) {
51
55
  return this;
52
56
  };
53
57
 
54
- Splitter.prototype.panel = function(panel) {
58
+ Splitter.prototype.panel = function(content, options = {}, props = {}) {
59
+ const panel = content instanceof SplitterPanel
60
+ ? content
61
+ : SplitterPanel(content).setDescription(options);
55
62
  this.$description.panels.push(panel);
56
63
  return this;
57
64
  };
58
65
 
59
66
  Splitter.prototype.panels = function(panels) {
60
67
  if(Validator.isObservable(this.$description.panels)) {
61
- this.$description.panels.set(panels);
62
- return this;
68
+ this.$description.panels.clear();
69
+ } else {
70
+ this.$description.panels = [];
63
71
  }
64
- this.$description.panels = [];
65
72
  panels.forEach(panel => this.panel(panel));
66
73
  return this;
67
74
  };
@@ -1,26 +1,47 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import HasEventEmitter from "../../core/utils/HasEventEmitter";
3
+ import { $ } from '../../../index';
1
4
 
2
5
 
3
- export default function SplitterGutter(leftPanel, rightPanel, config = {}) {
6
+ export default function SplitterGutter(leftPanel, rightPanel, props = {}) {
4
7
  if(!(this instanceof SplitterGutter)) {
5
- return new SplitterGutter(config);
8
+ return new SplitterGutter(leftPanel, rightPanel, props);
6
9
  }
7
10
 
11
+ BaseComponent.call(this, props);
12
+
8
13
  this.$description = {
9
14
  leftPanel: leftPanel || null,
10
15
  rightPanel: rightPanel || null,
11
- orientation: config.orientation || 'horizontal',
12
- cursor: config.orientation === 'vertical' ? 'row-resize' : 'col-resize',
13
- size: 8,
14
- isDragging: $(false)
15
- }
16
+ orientation: 'horizontal',
17
+ cursor: 'col-resize',
18
+ size: 2,
19
+ isDragging: $(false),
20
+ props
21
+ };
16
22
  }
17
23
 
24
+ BaseComponent.extends(SplitterGutter);
25
+ BaseComponent.use(SplitterGutter, HasEventEmitter);
26
+
18
27
  SplitterGutter.defaultTemplate = null;
19
28
 
20
29
  SplitterGutter.use = function(template) {
21
30
  SplitterGutter.defaultTemplate = template;
22
31
  };
23
32
 
33
+ SplitterGutter.prototype.vertical = function() {
34
+ this.$description.orientation = 'vertical';
35
+ this.$description.cursor = 'row-resize';
36
+ return this;
37
+ };
38
+
39
+ SplitterGutter.prototype.horizontal = function() {
40
+ this.$description.orientation = 'horizontal';
41
+ this.$description.cursor = 'col-resize';
42
+ return this;
43
+ }
44
+
24
45
  SplitterGutter.prototype.panels = function(leftPanel, rightPanel) {
25
46
  this.$description.leftPanel = leftPanel;
26
47
  this.$description.rightPanel = rightPanel;
@@ -1,18 +1,17 @@
1
1
  import BaseComponent from "../BaseComponent";
2
+ import { $ } from '../../../index';
2
3
 
3
- export default function SplitterPanel(content, config = {}) {
4
+ export default function SplitterPanel(content, props = {}) {
4
5
  if(!(this instanceof SplitterPanel)) {
5
- return new SplitterPanel(content, config);
6
+ return new SplitterPanel(content, props);
6
7
  }
7
8
 
8
- if (typeof content === 'object' && !content.tagName) {
9
- config = content;
10
- content = config.content || null;
11
- }
9
+ BaseComponent.call(this, props);
12
10
 
13
11
  this.$description = {
12
+ orientation: 'horizontal',
14
13
  content: content || null,
15
- size: null,
14
+ size: $(null),
16
15
  minSize: null,
17
16
  maxSize: null,
18
17
  collapsible: false,
@@ -20,11 +19,11 @@ export default function SplitterPanel(content, config = {}) {
20
19
  resizable: true,
21
20
  data: null,
22
21
  render: null,
23
- ...config
22
+ props
24
23
  };
25
24
  }
26
25
 
27
- BaseComponent.extends(SplitterPanel, BaseComponent);
26
+ BaseComponent.extends(SplitterPanel);
28
27
 
29
28
  SplitterPanel.defaultTemplate = null;
30
29
 
@@ -38,7 +37,7 @@ SplitterPanel.prototype.content = function(content) {
38
37
  };
39
38
 
40
39
  SplitterPanel.prototype.size = function(size) {
41
- this.$description.size = size;
40
+ this.$description.size.set(size);
42
41
  return this;
43
42
  };
44
43
 
@@ -74,9 +73,4 @@ SplitterPanel.prototype.fixed = function() {
74
73
  SplitterPanel.prototype.data = function(data) {
75
74
  this.$description.data = data;
76
75
  return this;
77
- };
78
-
79
- SplitterPanel.prototype.render = function(renderFn) {
80
- this.$description.render = renderFn;
81
- return this;
82
76
  };
@@ -1,8 +1,10 @@
1
1
  import Splitter from "./Splitter";
2
2
  import SplitterPanel from "./SplitterPanel";
3
+ import SplitterGutter from "./SplitterGutter";
3
4
 
4
5
 
5
6
  export {
6
7
  Splitter,
7
- SplitterPanel
8
+ SplitterPanel,
9
+ SplitterGutter
8
10
  }
@@ -0,0 +1,33 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import PositionStack from "./PositionStack";
3
+ import DebugManager from "../../core/utils/debug-manager";
4
+
5
+ export default function AbsoluteStack(content, props = {}) {
6
+ if(!(this instanceof AbsoluteStack)) {
7
+ return new AbsoluteStack(content, props);
8
+ }
9
+ PositionStack.call(this, content, props);
10
+ this.$description.position = 'absolute';
11
+ }
12
+
13
+ BaseComponent.extends(AbsoluteStack, PositionStack);
14
+
15
+ AbsoluteStack.defaultTemplate = null;
16
+
17
+ AbsoluteStack.use = function(template) {
18
+ AbsoluteStack.defaultTemplate = template;
19
+ };
20
+
21
+ AbsoluteStack.preset = function(name, callback) {
22
+ if(AbsoluteStack.prototype[name] || AbsoluteStack[name]) {
23
+ DebugManager.warn(`Warning: the ${name} method already exists in AbsoluteStack.`);
24
+ return;
25
+ }
26
+ AbsoluteStack[name] = (content, props) => callback(new AbsoluteStack(content, props));
27
+ };
28
+
29
+ AbsoluteStack.presets = function(presets) {
30
+ for(const name in presets) {
31
+ AbsoluteStack.preset(name, presets[name]);
32
+ }
33
+ };
@@ -0,0 +1,33 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import PositionStack from "./PositionStack";
3
+ import DebugManager from "../../core/utils/debug-manager";
4
+
5
+ export default function FixedStack(content, props = {}) {
6
+ if(!(this instanceof FixedStack)) {
7
+ return new FixedStack(content, props);
8
+ }
9
+ PositionStack.call(this, content, props);
10
+ this.$description.position = 'fixed';
11
+ }
12
+
13
+ BaseComponent.extends(FixedStack, PositionStack);
14
+
15
+ FixedStack.defaultTemplate = null;
16
+
17
+ FixedStack.use = function(template) {
18
+ FixedStack.defaultTemplate = template;
19
+ };
20
+
21
+ FixedStack.preset = function(name, callback) {
22
+ if(FixedStack.prototype[name] || FixedStack[name]) {
23
+ DebugManager.warn(`Warning: the ${name} method already exists in FixedStack.`);
24
+ return;
25
+ }
26
+ FixedStack[name] = (content, props) => callback(new FixedStack(content, props));
27
+ };
28
+
29
+ FixedStack.presets = function(presets) {
30
+ for(const name in presets) {
31
+ FixedStack.preset(name, presets[name]);
32
+ }
33
+ };