native-document 1.0.130 → 1.0.132

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.
@@ -6,7 +6,7 @@ var NativeComponents = (function (exports) {
6
6
  * @class
7
7
  */
8
8
  function BaseComponent() {
9
-
9
+ this.$description = {};
10
10
  }
11
11
 
12
12
  Object.defineProperty( BaseComponent.prototype, 'nd', {
@@ -890,7 +890,7 @@ var NativeComponents = (function (exports) {
890
890
  VALID_TYPES[COMMON_NODE_TYPES.DOCUMENT_FRAGMENT] = true;
891
891
  VALID_TYPES[COMMON_NODE_TYPES.COMMENT] = true;
892
892
 
893
- const Validator$1 = {
893
+ const Validator = {
894
894
  isObservable(value) {
895
895
  return value?.__$isObservable;
896
896
  },
@@ -907,7 +907,7 @@ var NativeComponents = (function (exports) {
907
907
  return value?.__isProxy__
908
908
  },
909
909
  isObservableOrProxy(value) {
910
- return Validator$1.isObservable(value) || Validator$1.isProxy(value);
910
+ return Validator.isObservable(value) || Validator.isProxy(value);
911
911
  },
912
912
  isAnchor(value) {
913
913
  return value?.__Anchor__
@@ -990,8 +990,8 @@ var NativeComponents = (function (exports) {
990
990
  if(!data) {
991
991
  return false;
992
992
  }
993
- return Validator$1.isObject(data)
994
- && Object.values(data).some(value => Validator$1.isObservable(value));
993
+ return Validator.isObject(data)
994
+ && Object.values(data).some(value => Validator.isObservable(value));
995
995
  },
996
996
  /**
997
997
  * Check if the data contains an observable reference.
@@ -1219,7 +1219,7 @@ var NativeComponents = (function (exports) {
1219
1219
  }
1220
1220
 
1221
1221
  // Observables - keep the référence
1222
- if (Validator$1.isObservable(value)) {
1222
+ if (Validator.isObservable(value)) {
1223
1223
  onObservableFound && onObservableFound(value);
1224
1224
  return value;
1225
1225
  }
@@ -1388,7 +1388,7 @@ var NativeComponents = (function (exports) {
1388
1388
  * @class ObservableItem
1389
1389
  */
1390
1390
  function ObservableItem(value, configs = null) {
1391
- value = Validator$1.isObservable(value) ? value.val() : value;
1391
+ value = Validator.isObservable(value) ? value.val() : value;
1392
1392
 
1393
1393
  this.$previousValue = null;
1394
1394
  this.$currentValue = value;
@@ -1402,7 +1402,7 @@ var NativeComponents = (function (exports) {
1402
1402
  if(configs) {
1403
1403
  this.configs = configs;
1404
1404
  if(configs.reset) {
1405
- this.$initialValue = Validator$1.isObject(value) ? deepClone(value) : value;
1405
+ this.$initialValue = Validator.isObject(value) ? deepClone(value) : value;
1406
1406
  }
1407
1407
  }
1408
1408
  }
@@ -1611,7 +1611,7 @@ var NativeComponents = (function (exports) {
1611
1611
  if(!watchValueList) {
1612
1612
  watchValueList = callback;
1613
1613
  this.$watchers.set(value, callback);
1614
- } else if(!Validator$1.isArray(watchValueList.list)) {
1614
+ } else if(!Validator.isArray(watchValueList.list)) {
1615
1615
  watchValueList = [watchValueList, callback];
1616
1616
  callback = (value) => {
1617
1617
  for(let i = 0, length = watchValueList.length; i < length; i++) {
@@ -1723,7 +1723,7 @@ var NativeComponents = (function (exports) {
1723
1723
  */
1724
1724
  ObservableItem.prototype.get = function(key) {
1725
1725
  const item = this.$currentValue[key];
1726
- return Validator$1.isObservable(item) ? item.val() : item;
1726
+ return Validator.isObservable(item) ? item.val() : item;
1727
1727
  };
1728
1728
 
1729
1729
  /**
@@ -1755,7 +1755,7 @@ var NativeComponents = (function (exports) {
1755
1755
  * a.equals(10); // false
1756
1756
  */
1757
1757
  ObservableItem.prototype.equals = function(other) {
1758
- if(Validator$1.isObservable(other)) {
1758
+ if(Validator.isObservable(other)) {
1759
1759
  return this.$currentValue === other.$currentValue;
1760
1760
  }
1761
1761
  return this.$currentValue === other;
@@ -1800,7 +1800,7 @@ var NativeComponents = (function (exports) {
1800
1800
  if(!this.configs?.reset) {
1801
1801
  return;
1802
1802
  }
1803
- const resetValue = (Validator$1.isObject(this.$initialValue))
1803
+ const resetValue = (Validator.isObject(this.$initialValue))
1804
1804
  ? deepClone(this.$initialValue, (observable) => {
1805
1805
  observable.reset();
1806
1806
  })
@@ -2023,7 +2023,7 @@ var NativeComponents = (function (exports) {
2023
2023
  const bindBooleanAttribute = (element, attributeName, value) => {
2024
2024
  const isObservable = value.__$isObservable;
2025
2025
  const defaultValue = isObservable? value.val() : value;
2026
- if(Validator$1.isBoolean(defaultValue)) {
2026
+ if(Validator.isBoolean(defaultValue)) {
2027
2027
  element[attributeName] = defaultValue;
2028
2028
  }
2029
2029
  else {
@@ -2334,7 +2334,7 @@ var NativeComponents = (function (exports) {
2334
2334
  if(child.toNdElement) {
2335
2335
  do {
2336
2336
  child = child.toNdElement();
2337
- if(Validator$1.isElement(child)) {
2337
+ if(Validator.isElement(child)) {
2338
2338
  return child;
2339
2339
  }
2340
2340
  } while (child.toNdElement);
@@ -2413,7 +2413,7 @@ var NativeComponents = (function (exports) {
2413
2413
  anchor.getParent = () => parent;
2414
2414
 
2415
2415
  anchor.appendChild = (child) => {
2416
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2416
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2417
2417
  parent.appendChild(child);
2418
2418
  };
2419
2419
 
@@ -2422,7 +2422,7 @@ var NativeComponents = (function (exports) {
2422
2422
  anchor.appendRaw = anchor.appendChildRaw;
2423
2423
 
2424
2424
  anchor.insertAtStart = (child) => {
2425
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2425
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2426
2426
  parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child);
2427
2427
  };
2428
2428
  anchor.insertAtStartRaw = (child) => {
@@ -2436,7 +2436,7 @@ var NativeComponents = (function (exports) {
2436
2436
  };
2437
2437
 
2438
2438
  anchor.replaceContent = function(content) {
2439
- const child = Validator$1.isElement(content) ? content : ElementCreator.getChild(content);
2439
+ const child = Validator.isElement(content) ? content : ElementCreator.getChild(content);
2440
2440
  parent.replaceChildren(child);
2441
2441
  };
2442
2442
 
@@ -2446,7 +2446,7 @@ var NativeComponents = (function (exports) {
2446
2446
  anchor.setContent = anchor.replaceContent;
2447
2447
 
2448
2448
  anchor.insertBefore = (child, anchor) => {
2449
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2449
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2450
2450
  parent.insertBefore(child, anchor);
2451
2451
  };
2452
2452
  anchor.insertBeforeRaw = (child, anchor) => {
@@ -2490,7 +2490,7 @@ var NativeComponents = (function (exports) {
2490
2490
  ? () => true: (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
2491
2491
 
2492
2492
  const insertBefore = function(parent, child, target) {
2493
- const childElement = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2493
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2494
2494
  insertBeforeRaw(parent, childElement, target);
2495
2495
  };
2496
2496
 
@@ -2540,7 +2540,7 @@ var NativeComponents = (function (exports) {
2540
2540
  anchorFragment.appendRaw = anchorFragment.appendChildRaw;
2541
2541
 
2542
2542
  anchorFragment.insertAtStart = function(child) {
2543
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2543
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2544
2544
  anchorFragment.insertAtStartRaw(child);
2545
2545
  };
2546
2546
 
@@ -2596,7 +2596,7 @@ var NativeComponents = (function (exports) {
2596
2596
  };
2597
2597
 
2598
2598
  anchorFragment.replaceContent = function(child) {
2599
- const childElement = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2599
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2600
2600
  anchorFragment.replaceContentRaw(childElement);
2601
2601
  };
2602
2602
 
@@ -3211,7 +3211,7 @@ var NativeComponents = (function (exports) {
3211
3211
  return Observable$1.computed(() => {
3212
3212
  return value.replace(/\$\{(.*?)}/g, (match, key) => {
3213
3213
  const data = args[key];
3214
- if(Validator$1.isObservable(data)) {
3214
+ if(Validator.isObservable(data)) {
3215
3215
  return data.val();
3216
3216
  }
3217
3217
  return data;
@@ -3220,11 +3220,11 @@ var NativeComponents = (function (exports) {
3220
3220
  };
3221
3221
 
3222
3222
  String.prototype.resolveObservableTemplate = function() {
3223
- if(!Validator$1.containsObservableReference(this)) {
3223
+ if(!Validator.containsObservableReference(this)) {
3224
3224
  return this.valueOf();
3225
3225
  }
3226
3226
  return this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map((value) => {
3227
- if(!Validator$1.containsObservableReference(value)) {
3227
+ if(!Validator.containsObservableReference(value)) {
3228
3228
  return value;
3229
3229
  }
3230
3230
  const [_, id] = value.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);
@@ -3233,10 +3233,10 @@ var NativeComponents = (function (exports) {
3233
3233
  };
3234
3234
 
3235
3235
  function createMultiSourceFilter(sources, callbackFn){
3236
- const observables = sources.filter(Validator$1.isObservable);
3236
+ const observables = sources.filter(Validator.isObservable);
3237
3237
 
3238
3238
  const getValues = () => sources.map(src =>
3239
- Validator$1.isObservable(src) ? src.val() : src
3239
+ Validator.isObservable(src) ? src.val() : src
3240
3240
  );
3241
3241
 
3242
3242
  return {
@@ -3486,7 +3486,7 @@ var NativeComponents = (function (exports) {
3486
3486
  const filterCallbacks = {};
3487
3487
 
3488
3488
  for (const [key, rawPredicate] of Object.entries(predicates)) {
3489
- const predicate = Validator$1.isObservable(rawPredicate) ? match(rawPredicate, false) : rawPredicate;
3489
+ const predicate = Validator.isObservable(rawPredicate) ? match(rawPredicate, false) : rawPredicate;
3490
3490
  if (predicate && typeof predicate === 'object' && 'callback' in predicate) {
3491
3491
  filterCallbacks[key] = predicate.callback;
3492
3492
 
@@ -3663,7 +3663,7 @@ var NativeComponents = (function (exports) {
3663
3663
  Observable$1.batch = function(callback) {
3664
3664
  const $observer = Observable$1(0);
3665
3665
  const batch = function() {
3666
- if(Validator$1.isAsyncFunction(callback)) {
3666
+ if(Validator.isAsyncFunction(callback)) {
3667
3667
  return (callback(...arguments)).then(() => {
3668
3668
  $observer.trigger();
3669
3669
  }).catch(error => { throw error; });
@@ -3714,10 +3714,10 @@ var NativeComponents = (function (exports) {
3714
3714
  if(Array.isArray(itemValue)) {
3715
3715
  if(configs?.deep !== false) {
3716
3716
  const mappedItemValue = itemValue.map(item => {
3717
- if(Validator$1.isJson(item)) {
3717
+ if(Validator.isJson(item)) {
3718
3718
  return Observable$1.json(item, configs);
3719
3719
  }
3720
- if(Validator$1.isArray(item)) {
3720
+ if(Validator.isArray(item)) {
3721
3721
  return Observable$1.array(item, configs);
3722
3722
  }
3723
3723
  return Observable$1(item, configs);
@@ -3728,7 +3728,7 @@ var NativeComponents = (function (exports) {
3728
3728
  this.$observables[key] = Observable$1.array(itemValue, configs);
3729
3729
  continue;
3730
3730
  }
3731
- if(Validator$1.isObservable(itemValue) || Validator$1.isProxy(itemValue)) {
3731
+ if(Validator.isObservable(itemValue) || Validator.isProxy(itemValue)) {
3732
3732
  this.$observables[key] = itemValue;
3733
3733
  continue;
3734
3734
  }
@@ -3740,21 +3740,21 @@ var NativeComponents = (function (exports) {
3740
3740
  const result = {};
3741
3741
  for(const key in this.$observables) {
3742
3742
  const dataItem = this.$observables[key];
3743
- if(Validator$1.isObservable(dataItem)) {
3743
+ if(Validator.isObservable(dataItem)) {
3744
3744
  let value = dataItem.val();
3745
3745
  if(Array.isArray(value)) {
3746
3746
  value = value.map(item => {
3747
- if(Validator$1.isObservable(item)) {
3747
+ if(Validator.isObservable(item)) {
3748
3748
  return item.val();
3749
3749
  }
3750
- if(Validator$1.isProxy(item)) {
3750
+ if(Validator.isProxy(item)) {
3751
3751
  return item.$value;
3752
3752
  }
3753
3753
  return item;
3754
3754
  });
3755
3755
  }
3756
3756
  result[key] = value;
3757
- } else if(Validator$1.isProxy(dataItem)) {
3757
+ } else if(Validator.isProxy(dataItem)) {
3758
3758
  result[key] = dataItem.$value;
3759
3759
  } else {
3760
3760
  result[key] = dataItem;
@@ -3766,10 +3766,10 @@ var NativeComponents = (function (exports) {
3766
3766
 
3767
3767
  ObservableObject.prototype.get = function(property) {
3768
3768
  const item = this.$observables[property];
3769
- if(Validator$1.isObservable(item)) {
3769
+ if(Validator.isObservable(item)) {
3770
3770
  return item.val();
3771
3771
  }
3772
- if(Validator$1.isProxy(item)) {
3772
+ if(Validator.isProxy(item)) {
3773
3773
  return item.$value;
3774
3774
  }
3775
3775
  return item;
@@ -3777,7 +3777,7 @@ var NativeComponents = (function (exports) {
3777
3777
  ObservableObject.prototype.$get = ObservableObject.prototype.get;
3778
3778
 
3779
3779
  ObservableObject.prototype.set = function(newData) {
3780
- const data = Validator$1.isProxy(newData) ? newData.$value : newData;
3780
+ const data = Validator.isProxy(newData) ? newData.$value : newData;
3781
3781
  const configs = this.configs;
3782
3782
 
3783
3783
  for(const key in data) {
@@ -3785,15 +3785,15 @@ var NativeComponents = (function (exports) {
3785
3785
  const newValueOrigin = newData[key];
3786
3786
  const newValue = data[key];
3787
3787
 
3788
- if(Validator$1.isObservable(targetItem)) {
3789
- if(!Validator$1.isArray(newValue)) {
3788
+ if(Validator.isObservable(targetItem)) {
3789
+ if(!Validator.isArray(newValue)) {
3790
3790
  targetItem.set(newValue);
3791
3791
  continue;
3792
3792
  }
3793
3793
  const firstElementFromOriginalValue = newValueOrigin.at(0);
3794
- if(Validator$1.isObservable(firstElementFromOriginalValue) || Validator$1.isProxy(firstElementFromOriginalValue)) {
3794
+ if(Validator.isObservable(firstElementFromOriginalValue) || Validator.isProxy(firstElementFromOriginalValue)) {
3795
3795
  const newValues = newValue.map(item => {
3796
- if(Validator$1.isProxy(firstElementFromOriginalValue)) {
3796
+ if(Validator.isProxy(firstElementFromOriginalValue)) {
3797
3797
  return Observable$1.init(item, configs);
3798
3798
  }
3799
3799
  return Observable$1(item, configs);
@@ -3804,7 +3804,7 @@ var NativeComponents = (function (exports) {
3804
3804
  targetItem.set([...newValue]);
3805
3805
  continue;
3806
3806
  }
3807
- if(Validator$1.isProxy(targetItem)) {
3807
+ if(Validator.isProxy(targetItem)) {
3808
3808
  targetItem.update(newValue);
3809
3809
  continue;
3810
3810
  }
@@ -3873,13 +3873,13 @@ var NativeComponents = (function (exports) {
3873
3873
  * @returns {{}|*|null}
3874
3874
  */
3875
3875
  Observable$1.value = function(data) {
3876
- if(Validator$1.isObservable(data)) {
3876
+ if(Validator.isObservable(data)) {
3877
3877
  return data.val();
3878
3878
  }
3879
- if(Validator$1.isProxy(data)) {
3879
+ if(Validator.isProxy(data)) {
3880
3880
  return data.$value;
3881
3881
  }
3882
- if(Validator$1.isArray(data)) {
3882
+ if(Validator.isArray(data)) {
3883
3883
  const result = [];
3884
3884
  for(let i = 0, length = data.length; i < length; i++) {
3885
3885
  const item = data[i];
@@ -3917,8 +3917,8 @@ var NativeComponents = (function (exports) {
3917
3917
  const observable = new ObservableItem(initialValue);
3918
3918
  const updatedValue = nextTick(() => observable.set(callback()));
3919
3919
 
3920
- if(Validator$1.isFunction(dependencies)) {
3921
- if(!Validator$1.isObservable(dependencies.$observer)) {
3920
+ if(Validator.isFunction(dependencies)) {
3921
+ if(!Validator.isObservable(dependencies.$observer)) {
3922
3922
  throw new NativeDocumentError('Observable.computed : dependencies must be valid batch function');
3923
3923
  }
3924
3924
  dependencies.$observer.subscribe(updatedValue);
@@ -3926,7 +3926,7 @@ var NativeComponents = (function (exports) {
3926
3926
  }
3927
3927
 
3928
3928
  dependencies.forEach(dependency => {
3929
- if(Validator$1.isProxy(dependency)) {
3929
+ if(Validator.isProxy(dependency)) {
3930
3930
  dependency.$observables.forEach((observable) => {
3931
3931
  observable.subscribe(updatedValue);
3932
3932
  });
@@ -4338,12 +4338,6 @@ var NativeComponents = (function (exports) {
4338
4338
 
4339
4339
  Store.create('locale', navigator.language.split('-')[0] || 'en');
4340
4340
 
4341
- /**
4342
- * Creates a `<button>` element.
4343
- * @type {function(ButtonAttributes=, NdChild|NdChild[]=): HTMLButtonElement}
4344
- */
4345
- const Button$1 = HtmlElementWrapper('button');
4346
-
4347
4341
  /**
4348
4342
  * Creates a `<table>` element.
4349
4343
  * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableElement}
@@ -4893,19 +4887,196 @@ var NativeComponents = (function (exports) {
4893
4887
 
4894
4888
  Alert.prototype.toNdElement = function() {};
4895
4889
 
4890
+ function Button(label, props = {}) {
4891
+ if(!(this instanceof Button)) {
4892
+ return new Button(label, props);
4893
+ }
4894
+
4895
+ BaseComponent.call(this, props);
4896
+
4897
+ this.$description = {
4898
+ label: label,
4899
+ type: null,
4900
+ variant: null,
4901
+ size: null,
4902
+ icon: null,
4903
+ iconPosition: 'left',
4904
+ loading: null,
4905
+ disabled: null,
4906
+ template: null,
4907
+ block: null,
4908
+ borderRadiusType: null,
4909
+ outline: null,
4910
+ props
4911
+ };
4912
+
4913
+ this.$element = null;
4914
+ }
4915
+
4916
+ Button.defaultTemplate = null;
4917
+ Button.defaultLoaderTemplate = null;
4918
+
4919
+ Button.use = function(template = {}) {
4920
+ Button.defaultTemplate = template.button;
4921
+ Button.defaultLoaderTemplate = template.loader;
4922
+ };
4923
+
4924
+ BaseComponent.extends(Button);
4925
+
4926
+ Button.preset = function(name, callback) {
4927
+ if (Button.prototype[name] || Button[name]) {
4928
+ console.warn(`Warning: the ${name} method already exist in Button.`);
4929
+ return;
4930
+ }
4931
+ Button[name] = (label, props) => callback(new Button(label, props));
4932
+ };
4933
+
4934
+ Button.presets = function(presets) {
4935
+ for (const name in presets) {
4936
+ Button.preset(name, presets[name]);
4937
+ }
4938
+ };
4939
+
4940
+ Button.prototype.type = function(type) {
4941
+ this.$description.type = type;
4942
+ return this;
4943
+ };
4944
+
4945
+ Button.prototype.variant = function(variant) {
4946
+ this.$description.variant = variant;
4947
+ return this;
4948
+ };
4949
+ Button.prototype.primary = function() {
4950
+ return this.variant('primary');
4951
+ };
4952
+ Button.prototype.secondary = function() {
4953
+ return this.variant('secondary');
4954
+ };
4955
+ Button.prototype.danger = function() {
4956
+ return this.variant('danger');
4957
+ };
4958
+ Button.prototype.success = function() {
4959
+ return this.variant('success');
4960
+ };
4961
+ Button.prototype.warning = function() {
4962
+ return this.variant('warning');
4963
+ };
4964
+ Button.prototype.ghost = function() {
4965
+ return this.variant('ghost');
4966
+ };
4967
+ Button.prototype.link = function() {
4968
+ return this.variant('link');
4969
+ };
4970
+ Button.prototype.outline = function() {
4971
+ this.$description.outline = true;
4972
+ return this;
4973
+ };
4974
+
4975
+ Button.prototype.size = function(size) {
4976
+ this.$description.size = size;
4977
+ return this;
4978
+ };
4979
+ Button.prototype.small = function() {
4980
+ return this.size('small');
4981
+ };
4982
+ Button.prototype.large = function() {
4983
+ return this.size('large');
4984
+ };
4985
+ Button.prototype.medium = function() {
4986
+ return this.size('medium');
4987
+ };
4988
+
4989
+ Button.prototype.icon = function(icon, iconPosition = 'leading') {
4990
+ this.$description.icon = icon;
4991
+ this.$description.iconPosition = iconPosition;
4992
+ return this;
4993
+ };
4994
+
4995
+ Button.prototype.iconAtLeading = function() {
4996
+ this.$description.iconPosition = 'leading';
4997
+ return this;
4998
+ };
4999
+
5000
+ Button.prototype.iconAtTrailing = function() {
5001
+ this.$description.iconPosition = 'trailing';
5002
+ return this;
5003
+ };
5004
+ Button.prototype.iconAtTop = function() {
5005
+ this.$description.iconPosition = 'top';
5006
+ return this;
5007
+ };
5008
+
5009
+ Button.prototype.iconAtBottom = function() {
5010
+ this.$description.iconPosition = 'bottom';
5011
+ return this;
5012
+ };
5013
+
5014
+ Button.prototype.iconOnly = function() {
5015
+ this.$description.iconOnly = true;
5016
+ return this;
5017
+ };
5018
+
5019
+ Button.prototype.loading = function(loading = true) {
5020
+ this.$description.loading = BaseComponent.obs(loading);
5021
+ return this;
5022
+ };
5023
+
5024
+ Button.prototype.disable = function(disabled = true) {
5025
+ this.$description.disabled = BaseComponent.obs(disabled);
5026
+ return this;
5027
+ };
5028
+
5029
+ Button.prototype.enable = function() {
5030
+ return this.disable(false);
5031
+ };
5032
+
5033
+ Button.prototype.render = function(renderFunction) {
5034
+ this.$description.render = renderFunction;
5035
+ return this;
5036
+ };
5037
+
5038
+ Button.prototype.rounded = function() {
5039
+ this.$description.borderRadiusType = 'rounded';
5040
+ return this;
5041
+ };
5042
+ Button.prototype.pill = function() {
5043
+ this.$description.borderRadiusType = 'pill';
5044
+ return this;
5045
+ };
5046
+ Button.prototype.circle = function() {
5047
+ this.$description.borderRadiusType = 'circle';
5048
+ return this;
5049
+ };
5050
+ Button.prototype.smooth = function() {
5051
+ this.$description.borderRadiusType = 'smooth';
5052
+ return this;
5053
+ };
5054
+ Button.prototype.block = function() {
5055
+ this.$description.block = true;
5056
+ return this;
5057
+ };
5058
+
5059
+ Button.prototype.node = function() {
5060
+ return this.$build();
5061
+ };
5062
+
5063
+ Button.prototype.toNdElement = function() {
5064
+ return this.$build();
5065
+ };
5066
+
4896
5067
  /**
4897
5068
  * Component for displaying user avatars with images, initials, or icons
4898
5069
  * @param {Observable<string>|string} source - The avatar source (image URL or observable)
4899
- * @param {{ src?: Observable<string>|string, alt?: string, name?: string, initials?: string, icon?: ValidChildren, size?: string|number, shape?: string, variant?: string, color?: string, textColor?: string, status?: string, render?: Function }} config - Configuration object
5070
+ * @param {*} props - Props object
4900
5071
  * @class
4901
5072
  */
4902
- function Avatar(source, config = {}) {
5073
+ function Avatar(source, props = {}) {
4903
5074
  if (!(this instanceof Avatar)) {
4904
- return new Avatar(source, config);
5075
+ return new Avatar(source, props);
4905
5076
  }
4906
5077
 
4907
5078
  this.$description = {
4908
- src: Validator$1.isObservable(source) ? source : $(null),
5079
+ src: BaseComponent.obs(source),
4909
5080
  alt: null,
4910
5081
  name: null,
4911
5082
  initials: null,
@@ -4917,7 +5088,7 @@ var NativeComponents = (function (exports) {
4917
5088
  textColor: null,
4918
5089
  status: null,
4919
5090
  render: null,
4920
- ...config
5091
+ props
4921
5092
  };
4922
5093
  }
4923
5094
 
@@ -4933,6 +5104,21 @@ var NativeComponents = (function (exports) {
4933
5104
  Avatar.defaultTemplate = template.avatar;
4934
5105
  };
4935
5106
 
5107
+ Avatar.preset = function(name, callback) {
5108
+ if (Avatar.prototype[name] || Avatar[name]) {
5109
+ console.warn(`Warning: the ${name} method already exists in Avatar.`);
5110
+ return;
5111
+ }
5112
+ Avatar[name] = (label, props) => callback(new Avatar(label, props));
5113
+ };
5114
+
5115
+ Avatar.presets = function(presets) {
5116
+ for (const name in presets) {
5117
+ Avatar.preset(name, presets[name]);
5118
+ }
5119
+ };
5120
+
5121
+
4936
5122
  /**
4937
5123
  * Registers a handler for the error event
4938
5124
  * @param {(error: Error, avatar: Avatar) => void} handler - The event handler
@@ -4967,6 +5153,9 @@ var NativeComponents = (function (exports) {
4967
5153
  */
4968
5154
  Avatar.prototype.name = function(name) {
4969
5155
  this.$description.name = name;
5156
+ if(!this.$description.initials) {
5157
+ this.$description.initials = name.split(' ').map(n => n[0]).join('');
5158
+ }
4970
5159
  return this;
4971
5160
  };
4972
5161
 
@@ -5081,6 +5270,7 @@ var NativeComponents = (function (exports) {
5081
5270
  */
5082
5271
  Avatar.prototype.variant = function(variant) {
5083
5272
  this.$description.variant = variant;
5273
+ return this;
5084
5274
  }; // 'primary' | 'secondary' | 'success' | etc.
5085
5275
 
5086
5276
  /**
@@ -5163,7 +5353,7 @@ var NativeComponents = (function (exports) {
5163
5353
 
5164
5354
  /**
5165
5355
  * Sets the position of the status indicator
5166
- * @param {string} position - The position (top-right, bottom-right, top-left, bottom-left)
5356
+ * @param {string} position - The position (top-trailing, bottom-trailing, top-leading, bottom-leading)
5167
5357
  * @returns {Avatar}
5168
5358
  */
5169
5359
  Avatar.prototype.statusPosition = function(position) {
@@ -5264,34 +5454,56 @@ var NativeComponents = (function (exports) {
5264
5454
  return this.badgePosition('bottom-trailing');
5265
5455
  };
5266
5456
 
5267
- /**
5268
- * Sets the render function for the entire avatar
5269
- * @param {(avatar: Avatar, sections: {image: ValidChildren, initials: ValidChildren, icon: ValidChildren, status: ValidChildren, badge: ValidChildren}) => ValidChildren} renderFn - Function to render the avatar
5270
- * @returns {Avatar}
5271
- */
5272
- Avatar.prototype.render = function(renderFn) {
5273
- this.$description.render = renderFn;
5457
+ function AvatarGroup(props = {}) {
5458
+ if(!(this instanceof AvatarGroup)) {
5459
+ return new AvatarGroup(props);
5460
+ }
5461
+
5462
+ this.$description = {
5463
+ items: [],
5464
+ overlap: 0,
5465
+ max: 0,
5466
+ props,
5467
+ };
5468
+
5469
+ }
5470
+ BaseComponent.extends(AvatarGroup);
5471
+
5472
+ AvatarGroup.prototype.items = function() {
5473
+ this.$description.items = Array.from(arguments);
5274
5474
  return this;
5275
5475
  };
5276
5476
 
5277
- /**
5278
- * Builds the avatar component
5279
- * @private
5280
- */
5281
- Avatar.prototype.$build = function() {
5477
+ AvatarGroup.prototype.item = function(item) {
5478
+ this.$description.items.push(item);
5479
+ return this;
5480
+ };
5481
+
5482
+ AvatarGroup.prototype.overlap = function(value) {
5483
+ this.$description.overlap = value;
5484
+ return this;
5485
+ };
5282
5486
 
5487
+ AvatarGroup.prototype.max = function(max) {
5488
+ this.$description.max = max;
5489
+ return this;
5283
5490
  };
5284
5491
 
5285
- function Badge(config = {}) {
5492
+ function Badge(content, props = {}) {
5286
5493
  if(!(this instanceof Badge)) {
5287
- return new Badge(config);
5494
+ return new Badge(props);
5288
5495
  }
5289
5496
 
5497
+ BaseComponent.call(this, props);
5498
+
5290
5499
  this.$description = {
5291
- style: null,
5292
- shape: null,
5293
- variant,
5294
- ...config
5500
+ style: 'filled',
5501
+ borderRadiusType: 'pill',
5502
+ variant: 'primary',
5503
+ size: 'medium',
5504
+ onClick: null,
5505
+ content,
5506
+ props
5295
5507
  };
5296
5508
  }
5297
5509
 
@@ -5301,6 +5513,20 @@ var NativeComponents = (function (exports) {
5301
5513
 
5302
5514
  Badge.use = function(template) {};
5303
5515
 
5516
+ Badge.preset = function(name, callback) {
5517
+ if (Badge.prototype[name] || Badge[name]) {
5518
+ DebugManager$1.warn(`Warning: the ${name} method already exists in Badge.`);
5519
+ return;
5520
+ }
5521
+ Badge[name] = (content, props) => callback(new Badge(content, props));
5522
+ };
5523
+
5524
+ Badge.presets = function(presets) {
5525
+ for (const name in presets) {
5526
+ Badge.preset(name, presets[name]);
5527
+ }
5528
+ };
5529
+
5304
5530
  Badge.prototype.variant = function(variant) {
5305
5531
  this.$description.variant = variant;
5306
5532
  return this;
@@ -5339,15 +5565,21 @@ var NativeComponents = (function (exports) {
5339
5565
  };
5340
5566
 
5341
5567
  Badge.prototype.shape = function(shape) {
5342
- this.$description.shape = shape;
5568
+ this.$description.borderRadiusType = shape;
5343
5569
  return this;
5344
5570
  };
5345
5571
 
5346
5572
  Badge.prototype.rounded = function() {
5347
- return this.shape('rounded');
5573
+ this.$description.borderRadiusType = 'rounded';
5574
+ return this;
5348
5575
  };
5349
5576
  Badge.prototype.pill = function() {
5350
- return this.shape('pill');
5577
+ this.$description.borderRadiusType = 'pill';
5578
+ return this;
5579
+ };
5580
+ Badge.prototype.circle = function() {
5581
+ this.$description.borderRadiusType = 'circle';
5582
+ return this;
5351
5583
  };
5352
5584
 
5353
5585
  Badge.prototype.style = function(style) {
@@ -5355,13 +5587,16 @@ var NativeComponents = (function (exports) {
5355
5587
  return this;
5356
5588
  };
5357
5589
  Badge.prototype.outline = function() {
5358
- return this.style('outline');
5590
+ this.$description.style = 'outline';
5591
+ return this;
5359
5592
  };
5360
5593
  Badge.prototype.filled = function() {
5361
- return this.style('filled');
5594
+ this.$description.style = 'filled';
5595
+ return this;
5362
5596
  };
5363
5597
  Badge.prototype.bordered = function() {
5364
- return this.style('bordered');
5598
+ this.$description.style = 'bordered';
5599
+ return this;
5365
5600
  };
5366
5601
 
5367
5602
  Badge.prototype.content = function(content) {
@@ -5369,19 +5604,11 @@ var NativeComponents = (function (exports) {
5369
5604
  return this;
5370
5605
  };
5371
5606
 
5372
- Badge.prototype.clickable = function(handler) {};
5373
-
5374
-
5375
- Badge.prototype.render = function(renderFn) {
5376
- this.$description.render = renderFn;
5607
+ Badge.prototype.onClick = function(handler) {
5608
+ this.$description.onClick = handler;
5377
5609
  return this;
5378
5610
  };
5379
5611
 
5380
- Badge.prototype.$build = function() {
5381
-
5382
- };
5383
- Badge.prototype.toNdElement = function() {};
5384
-
5385
5612
  function Breadcrumb(config = {}) {
5386
5613
  if (!(this instanceof Breadcrumb)) {
5387
5614
  return new Breadcrumb(config);
@@ -5450,183 +5677,6 @@ var NativeComponents = (function (exports) {
5450
5677
  };
5451
5678
  Breadcrumb.prototype.toNdElement = function() {};
5452
5679
 
5453
- function Button(label, config = {}) {
5454
- if(!(this instanceof Button)) {
5455
- return new Button(label, config);
5456
- }
5457
-
5458
- BaseComponent.call(this, config);
5459
-
5460
- this.$description = {
5461
- label: label,
5462
- type: null,
5463
- variant: null,
5464
- size: null,
5465
- icon: null,
5466
- iconPosition: null,
5467
- loading: null,
5468
- disabled: null,
5469
- template: null,
5470
- block: null,
5471
- borderRadiusType: null,
5472
- outline: null,
5473
- };
5474
-
5475
- this.$element = null;
5476
- }
5477
-
5478
- Button.defaultTemplate = null;
5479
- Button.defaultLoaderTemplate = null;
5480
-
5481
- Button.use = function(template = {}) {
5482
- Button.defaultTemplate = template.button;
5483
- Button.defaultLoaderTemplate = template.loader;
5484
- };
5485
-
5486
- BaseComponent.extends(Button);
5487
-
5488
- Button.prototype.type = function(type) {
5489
- this.$description.type = type;
5490
- return this;
5491
- };
5492
-
5493
- Button.prototype.variant = function(variant) {
5494
- this.$description.variant = variant;
5495
- return this;
5496
- };
5497
- Button.prototype.primary = function() {
5498
- return this.variant('primary');
5499
- };
5500
- Button.prototype.secondary = function() {
5501
- return this.variant('secondary');
5502
- };
5503
- Button.prototype.danger = function() {
5504
- return this.variant('danger');
5505
- };
5506
- Button.prototype.success = function() {
5507
- return this.variant('success');
5508
- };
5509
- Button.prototype.warning = function() {
5510
- return this.variant('warning');
5511
- };
5512
- Button.prototype.ghost = function() {
5513
- return this.variant('ghost');
5514
- };
5515
- Button.prototype.link = function() {
5516
- return this.variant('link');
5517
- };
5518
- Button.prototype.outline = function() {
5519
- this.$description.outline = true;
5520
- return this;
5521
- };
5522
-
5523
- Button.prototype.size = function(size) {
5524
- this.$description.size = size;
5525
- return this;
5526
- };
5527
- Button.prototype.small = function() {
5528
- return this.size('small');
5529
- };
5530
- Button.prototype.large = function() {
5531
- return this.size('large');
5532
- };
5533
- Button.prototype.medium = function() {
5534
- return this.size('medium');
5535
- };
5536
-
5537
- Button.prototype.icon = function(icon, iconPosition = 'left') {
5538
- this.$description.icon = icon;
5539
- this.$description.iconPosition = iconPosition;
5540
- return this;
5541
- };
5542
-
5543
- Button.prototype.iconAtLeft = function() {
5544
- this.$description.iconPosition = 'left';
5545
- return this;
5546
- };
5547
- Button.prototype.iconAtRight = function() {
5548
- this.$description.iconPosition = 'right';
5549
- return this;
5550
- };
5551
- Button.prototype.iconAtTop = function() {
5552
- this.$description.iconPosition = 'top';
5553
- return this;
5554
- };
5555
-
5556
- Button.prototype.iconAtBottom = function() {
5557
- this.$description.iconPosition = 'bottom';
5558
- return this;
5559
- };
5560
-
5561
- Button.prototype.iconOnly = function() {
5562
- this.$description.iconOnly = true;
5563
- return this;
5564
- };
5565
-
5566
- Button.prototype.loading = function(loading = true) {
5567
- this.$description.loading = BaseComponent.obs(loading);
5568
- return this;
5569
- };
5570
-
5571
- Button.prototype.disable = function(disabled = true) {
5572
- this.$description.disabled = BaseComponent.obs(disabled);
5573
- return this;
5574
- };
5575
-
5576
- Button.prototype.enable = function() {
5577
- return this.disable(false);
5578
- };
5579
-
5580
- Button.prototype.render = function(renderFunction) {
5581
- this.$description.render = renderFunction;
5582
- return this;
5583
- };
5584
-
5585
- Button.prototype.rounded = function() {
5586
- this.$description.borderRadiusType = 'rounded';
5587
- return this;
5588
- };
5589
- Button.prototype.circle = function() {
5590
- this.$description.borderRadiusType = 'circle';
5591
- return this;
5592
- };
5593
- Button.prototype.pill = function() {
5594
- this.$description.shape = 'circle';
5595
- return this;
5596
- };
5597
- Button.prototype.smooth = function() {
5598
- this.$description.shape = 'smooth';
5599
- return this;
5600
- };
5601
- Button.prototype.block = function() {
5602
- this.$description.block = true;
5603
- return this;
5604
- };
5605
-
5606
- Button.prototype.$build = function() {
5607
- if(this.$element) {
5608
- return this.$element;
5609
- }
5610
- const renderFn = this.$description.render || Button.defaultTemplate;
5611
-
5612
- if(typeof renderFn === 'function') {
5613
- this.$element = renderFn(this);
5614
- }
5615
- else {
5616
- const props = {};
5617
- this.$element = Button$1(props, this.$description.label);
5618
- }
5619
- return this.$element;
5620
- };
5621
-
5622
- Button.prototype.node = function() {
5623
- return this.$build();
5624
- };
5625
-
5626
- Button.prototype.toNdElement = function() {
5627
- return this.$build();
5628
- };
5629
-
5630
5680
  function Card(config = {}) {
5631
5681
  if(!(this instanceof Card)) {
5632
5682
  return new Card(config);
@@ -5741,6 +5791,9 @@ var NativeComponents = (function (exports) {
5741
5791
  */
5742
5792
  function HasItems() {}
5743
5793
 
5794
+
5795
+ HasItems.prototype.trailing = () => {};
5796
+
5744
5797
  /**
5745
5798
  * Sets a dynamic observable array to store items
5746
5799
  * @param {ObservableArray?} [observableArray=null] - Observable array to use, or creates a new one if null
@@ -5761,15 +5814,6 @@ var NativeComponents = (function (exports) {
5761
5814
  return this;
5762
5815
  };
5763
5816
 
5764
- /**
5765
- * Adds an item to the collection
5766
- * @param {*} item - The item to add
5767
- * @returns {HasItems}
5768
- */
5769
- HasItems.prototype.item = function(item) {
5770
- this.$description.items.push(item);
5771
- return this;
5772
- };
5773
5817
 
5774
5818
  /**
5775
5819
  * Clears all items from the collection
@@ -5813,11 +5857,14 @@ var NativeComponents = (function (exports) {
5813
5857
  return this;
5814
5858
  };
5815
5859
 
5816
- function MenuDivider() {
5860
+ function MenuDivider(props = {}) {
5817
5861
  if(!(this instanceof MenuDivider)) {
5818
- return new MenuDivider();
5862
+ return new MenuDivider(props);
5819
5863
  }
5820
5864
 
5865
+ this.$description = {
5866
+ props
5867
+ };
5821
5868
  }
5822
5869
 
5823
5870
  BaseComponent.extends(MenuDivider);
@@ -5826,16 +5873,12 @@ var NativeComponents = (function (exports) {
5826
5873
  MenuDivider.defaultTemplate = null;
5827
5874
 
5828
5875
  MenuDivider.use = function(template) {
5829
- MenuDivider.defaultTemplate = template.divider;
5830
- };
5831
-
5832
- MenuDivider.prototype.$build = function() {
5833
-
5876
+ MenuDivider.defaultTemplate = template.menuDivider;
5834
5877
  };
5835
5878
 
5836
- function MenuGroup(label, config) {
5879
+ function MenuGroup(label, props) {
5837
5880
  if(!(this instanceof MenuGroup)) {
5838
- return new MenuGroup(label, config);
5881
+ return new MenuGroup(label, props);
5839
5882
  }
5840
5883
 
5841
5884
  this.$description = {
@@ -5843,7 +5886,7 @@ var NativeComponents = (function (exports) {
5843
5886
  data: null,
5844
5887
  items: [],
5845
5888
  render: null,
5846
- ...config
5889
+ props
5847
5890
  };
5848
5891
  }
5849
5892
 
@@ -5871,10 +5914,118 @@ var NativeComponents = (function (exports) {
5871
5914
  return this.item(group);
5872
5915
  };
5873
5916
 
5874
- function Menu(config = {}) {
5917
+ function MenuItem(props = {}) {
5918
+ if(!(this instanceof MenuItem)) {
5919
+ return new MenuItem(props);
5920
+ }
5921
+
5922
+ this.$description = {
5923
+ items: [],
5924
+ action: null,
5925
+ label: null,
5926
+ icon: null,
5927
+ shortcut: null,
5928
+ disabled: false,
5929
+ selected: false,
5930
+ value: null,
5931
+ data: null,
5932
+ render: null,
5933
+ trailing: null,
5934
+ props
5935
+ };
5936
+
5937
+ }
5938
+
5939
+ MenuItem.defaultTemplate = null;
5940
+
5941
+ MenuItem.use = function(template) {
5942
+ MenuItem.defaultTemplate = template.menuItem;
5943
+ };
5944
+
5945
+ BaseComponent.extends(MenuItem, HasItems);
5946
+
5947
+
5948
+ MenuItem.prototype.label = function(label) {
5949
+ this.$description.label = label;
5950
+ return this;
5951
+ };
5952
+
5953
+ MenuItem.prototype.icon = function(icon) {
5954
+ this.$description.icon = icon;
5955
+ return this;
5956
+ };
5957
+
5958
+ MenuItem.prototype.trailing = function(trailing) {
5959
+ this.$description.trailing = trailing;
5960
+ return this;
5961
+ };
5962
+
5963
+ MenuItem.prototype.shortcut = function(shortcut) {
5964
+ this.$description.shortcut = shortcut;
5965
+ return this;
5966
+ };
5967
+
5968
+ MenuItem.prototype.disabled = function(disabled = true) {
5969
+ this.$description.disabled = BaseComponent.obs(disabled);
5970
+ return this;
5971
+ };
5972
+
5973
+ MenuItem.prototype.selected = function(selected = true) {
5974
+ this.$description.selected = BaseComponent.obs(selected);
5975
+ return this;
5976
+ };
5977
+
5978
+ MenuItem.prototype.value = function(value) {
5979
+ this.$description.value = value;
5980
+ return this;
5981
+ };
5982
+
5983
+ MenuItem.prototype.action = function(action) {
5984
+ this.$description.action = action;
5985
+ return this;
5986
+ };
5987
+
5988
+ MenuItem.prototype.data = function(data) {
5989
+ this.$description.data = data;
5990
+ return this;
5991
+ };
5992
+
5993
+ MenuItem.prototype.divider = function() {
5994
+ return this.item(new MenuDivider());
5995
+ };
5996
+
5997
+ MenuItem.prototype.group = function(label, builder) {
5998
+ const group = new MenuGroup(label);
5999
+ builder && builder(group);
6000
+ return this.item(group);
6001
+ };
6002
+
6003
+ function MenuLink(props = {}) {
6004
+ if(!(this instanceof MenuLink)) {
6005
+ return new MenuLink(props);
6006
+ }
6007
+ MenuItem.call(this, props);
6008
+ }
6009
+
6010
+ MenuLink.prototype = Object.create(MenuItem.prototype);
6011
+ MenuLink.prototype.constructor = MenuLink;
6012
+
6013
+
6014
+ MenuLink.defaultTemplate = null;
6015
+
6016
+ MenuLink.use = function(template) {
6017
+ MenuLink.defaultTemplate = template.menuLink;
6018
+ };
6019
+
6020
+ MenuLink.prototype.target = function (target) {
6021
+ this.$description.target = target;
6022
+ return this;
6023
+ };
6024
+
6025
+ function Menu(props = {}) {
5875
6026
 
5876
6027
  if(!(this instanceof Menu)) {
5877
- return new Menu(config)
6028
+ return new Menu(props)
5878
6029
  }
5879
6030
 
5880
6031
  this.$description = {
@@ -5883,7 +6034,8 @@ var NativeComponents = (function (exports) {
5883
6034
  orientation: 'horizontal',
5884
6035
  closeOnSelect: true,
5885
6036
  keyboardLoop: true,
5886
- ...config
6037
+ active: null,
6038
+ props
5887
6039
  };
5888
6040
 
5889
6041
  }
@@ -5896,6 +6048,11 @@ var NativeComponents = (function (exports) {
5896
6048
  Menu.defaultTemplate = template.menu;
5897
6049
  };
5898
6050
 
6051
+ Menu.prototype.add = function(item) {
6052
+ this.$description.items.push(item);
6053
+ return this;
6054
+ };
6055
+
5899
6056
  Menu.prototype.title = function(title) {
5900
6057
  this.$description.title = title;
5901
6058
  return this;
@@ -5931,6 +6088,11 @@ var NativeComponents = (function (exports) {
5931
6088
  return this;
5932
6089
  };
5933
6090
 
6091
+ Menu.prototype.active = function(callback) {
6092
+ this.$description.active = callback;
6093
+ return this;
6094
+ };
6095
+
5934
6096
  Menu.prototype.onItemClick = function(handler) {
5935
6097
  this.on('itemClick', handler);
5936
6098
  return this;
@@ -5941,16 +6103,60 @@ var NativeComponents = (function (exports) {
5941
6103
  return this;
5942
6104
  };
5943
6105
 
6106
+ Menu.prototype.separator = function() {
6107
+ return this.add(new MenuDivider());
6108
+ };
5944
6109
 
5945
6110
 
5946
- Menu.prototype.divider = function() {
5947
- return this.item(new MenuDivider());
6111
+ /**
6112
+ * Adds an item to the collection
6113
+ * @param {NdChild} label - The item to add
6114
+ * @param {?NdChild} icon - The item to add
6115
+ * @param {?Function} action - The item to add
6116
+ * @param {?Function} configBuilder - The item to add
6117
+ * @param {?*} props - The item to add
6118
+ * @returns {HasItems}
6119
+ */
6120
+ Menu.prototype.item = function(label, icon, action, configBuilder, props = {}) {
6121
+ const item = MenuItem();
6122
+ item.icon(icon).label(label).onClick(action);
6123
+ if(typeof configBuilder === 'function') {
6124
+ configBuilder.length ? configBuilder(item) : this.trailing(item);
6125
+ } else if(configBuilder) {
6126
+ this.trailing(item);
6127
+ }
6128
+ this.$description.items.push(item);
6129
+ return this;
5948
6130
  };
5949
6131
 
5950
- Menu.prototype.group = function(label, builder) {
5951
- const group = new MenuGroup(label);
6132
+ /**
6133
+ * Adds an item to the collection
6134
+ * @param {NdChild} label - The item to add
6135
+ * @param {?NdChild} icon - The item to add
6136
+ * @param {?string|{to: string, params: ?*}} url - The item to add
6137
+ * @param {?Function} configBuilder - The item to add
6138
+ * @param {?*} props - The item to add
6139
+ * @returns {HasItems}
6140
+ */
6141
+ Menu.prototype.link = function(label, icon, url, configBuilder, props = {}) {
6142
+ const item = MenuLink(props);
6143
+ item.icon(icon).label(label).action(url);
6144
+ if(typeof configBuilder === 'function') {
6145
+ configBuilder.length ? configBuilder(item) : this.trailing(item);
6146
+ } else if(configBuilder) {
6147
+ this.trailing(item);
6148
+ }
6149
+ this.$description.items.push(item);
6150
+ return this;
6151
+ };
6152
+
6153
+ Menu.prototype.divider = Menu.prototype.separator;
6154
+
6155
+ Menu.prototype.group = function(label, icon, builder, props = {}) {
6156
+ const group = new MenuGroup(label, props);
6157
+ group.icon(icon);
5952
6158
  builder && builder(group);
5953
- return this.item(group);
6159
+ return this.add(group);
5954
6160
  };
5955
6161
 
5956
6162
  function ContextMenu(config = {}) {
@@ -6011,92 +6217,6 @@ var NativeComponents = (function (exports) {
6011
6217
  return this;
6012
6218
  };
6013
6219
 
6014
- function MenuItem(config = {}) {
6015
- if(!(this instanceof MenuItem)) {
6016
- return new MenuItem(config);
6017
- }
6018
-
6019
- this.$description = {
6020
- items: [],
6021
- link: null,
6022
- target: null,
6023
- label: null,
6024
- icon: null,
6025
- shortcut: null,
6026
- disabled: false,
6027
- selected: false,
6028
- value: null,
6029
- data: null,
6030
- render: null,
6031
- ...config
6032
- };
6033
-
6034
- }
6035
-
6036
- MenuItem.defaultTemplate = null;
6037
-
6038
- MenuItem.use = function(template) {
6039
- MenuItem.defaultTemplate = template.menuItem;
6040
- };
6041
-
6042
- BaseComponent.extends(MenuItem, HasItems);
6043
-
6044
-
6045
- MenuItem.prototype.label = function(label) {
6046
- this.$description.label = label;
6047
- return this;
6048
- };
6049
-
6050
- MenuItem.prototype.link = function(link) {
6051
- this.$description.link = link;
6052
- return this;
6053
- };
6054
-
6055
- MenuItem.prototype.target = function(target) {
6056
- this.$description.target = target;
6057
- return this;
6058
- };
6059
-
6060
- MenuItem.prototype.icon = function(icon) {
6061
- this.$description.icon = icon;
6062
- return this;
6063
- };
6064
-
6065
- MenuItem.prototype.shortcut = function(shortcut) {
6066
- this.$description.shortcut = shortcut;
6067
- return this;
6068
- };
6069
-
6070
- MenuItem.prototype.disabled = function(disabled = true) {
6071
- this.$description.disabled = disabled;
6072
- return this;
6073
- };
6074
-
6075
- MenuItem.prototype.selected = function(selected = true) {
6076
- this.$description.selected = selected;
6077
- return this;
6078
- };
6079
-
6080
- MenuItem.prototype.value = function(value) {
6081
- this.$description.value = value;
6082
- return this;
6083
- };
6084
-
6085
- MenuItem.prototype.data = function(data) {
6086
- this.$description.data = data;
6087
- return this;
6088
- };
6089
-
6090
- MenuItem.prototype.divider = function() {
6091
- return this.item(new MenuDivider());
6092
- };
6093
-
6094
- MenuItem.prototype.group = function(label, builder) {
6095
- const group = new MenuGroup(label);
6096
- builder && builder(group);
6097
- return this.item(group);
6098
- };
6099
-
6100
6220
  function ContextMenuItem(config) {
6101
6221
  if(!(this instanceof ContextMenuItem)) {
6102
6222
  return new ContextMenuItem(config);
@@ -6127,17 +6247,17 @@ var NativeComponents = (function (exports) {
6127
6247
  ContextMenuGroup.defaultTemplate = template.contextMenuGroup;
6128
6248
  };
6129
6249
 
6130
- function Divider(config = {}) {
6250
+ function Divider(label, props = {}) {
6131
6251
  if(!(this instanceof Divider)) {
6132
- return new Divider(config);
6252
+ return new Divider(label, props);
6133
6253
  }
6134
6254
 
6135
6255
  this.$description = {
6136
6256
  orientation: 'horizontal',
6137
6257
  variant: 'solid',
6138
- thickness: null,
6139
- spacing: null,
6140
- label: null,
6258
+ thickness: 1,
6259
+ spacing: 16,
6260
+ label,
6141
6261
  labelPosition: 'center',
6142
6262
  color: null,
6143
6263
  render: null,
@@ -6145,7 +6265,7 @@ var NativeComponents = (function (exports) {
6145
6265
  indent: null,
6146
6266
  leading: null,
6147
6267
  trailing: null,
6148
- ...config
6268
+ props
6149
6269
  };
6150
6270
  }
6151
6271
 
@@ -6157,6 +6277,20 @@ var NativeComponents = (function (exports) {
6157
6277
  Divider.defaultTemplate = template.divider;
6158
6278
  };
6159
6279
 
6280
+ Divider.preset = function(name, callback) {
6281
+ if (Divider.prototype[name] || Divider[name]) {
6282
+ DebugManager$1.warn(`Warning: the ${name} method already exists in Divider.`);
6283
+ return;
6284
+ }
6285
+ Divider[name] = (label, props) => callback(new Divider(label, props));
6286
+ };
6287
+
6288
+ Divider.presets = function(presets) {
6289
+ for (const name in presets) {
6290
+ Divider.preset(name, presets[name]);
6291
+ }
6292
+ };
6293
+
6160
6294
  Divider.prototype.orientation = function(orientation) {
6161
6295
  this.$description.orientation = orientation;
6162
6296
  return this;
@@ -7151,7 +7285,7 @@ var NativeComponents = (function (exports) {
7151
7285
  }
7152
7286
  else if (typeof condition === 'function') {
7153
7287
  isRequired = condition(allValues);
7154
- } else if (Validator$1.isObservable(condition)) {
7288
+ } else if (Validator.isObservable(condition)) {
7155
7289
  isRequired = condition.val();
7156
7290
  } else {
7157
7291
  isRequired = !!condition;
@@ -7284,7 +7418,7 @@ var NativeComponents = (function (exports) {
7284
7418
  };
7285
7419
 
7286
7420
  Field.prototype.errors = function(errors) {
7287
- if(!Validator$1.isObservable(errors)) {
7421
+ if(!Validator.isObservable(errors)) {
7288
7422
  throw new Error('Errors must be an observable');
7289
7423
  }
7290
7424
  this.$description.errors = errors;
@@ -7388,12 +7522,12 @@ var NativeComponents = (function (exports) {
7388
7522
 
7389
7523
  Field.prototype.value = function() {
7390
7524
  const value = this.$model();
7391
- return Validator$1.isObservable(value) ? value.val() : value;
7525
+ return Validator.isObservable(value) ? value.val() : value;
7392
7526
  };
7393
7527
 
7394
7528
  Field.prototype.setValue = function(newValue) {
7395
7529
  const value = this.$model();
7396
- if(Validator$1.isObservable(value)) {
7530
+ if(Validator.isObservable(value)) {
7397
7531
  value.set(newValue);
7398
7532
  return this;
7399
7533
  }
@@ -7563,7 +7697,7 @@ var NativeComponents = (function (exports) {
7563
7697
  return this;
7564
7698
  }
7565
7699
 
7566
- if(Validator$1.isObservable(dataSource)) {
7700
+ if(Validator.isObservable(dataSource)) {
7567
7701
  field.model(dataSource);
7568
7702
  dataSource.subscribe(() => {
7569
7703
  this.$isDirty.set(true);
@@ -8116,7 +8250,7 @@ var NativeComponents = (function (exports) {
8116
8250
 
8117
8251
  CheckboxField.prototype.checked = function() {
8118
8252
  const checked = this.$description.checked;
8119
- if(Validator$1.isObservable(checked)) {
8253
+ if(Validator.isObservable(checked)) {
8120
8254
  return checked.val();
8121
8255
  }
8122
8256
  return checked;
@@ -8157,7 +8291,7 @@ var NativeComponents = (function (exports) {
8157
8291
 
8158
8292
  CheckboxField.prototype.checked = function() {
8159
8293
  const checked = this.$description.checked;
8160
- if(Validator$1.isObservable(checked)) {
8294
+ if(Validator.isObservable(checked)) {
8161
8295
  return checked.val();
8162
8296
  }
8163
8297
  return checked;
@@ -8837,7 +8971,7 @@ var NativeComponents = (function (exports) {
8837
8971
  this.$description = {
8838
8972
  name: name,
8839
8973
  defaultItem: null,
8840
- value: (config?.data && Validator$1.isObservable(config.data))
8974
+ value: (config?.data && Validator.isObservable(config.data))
8841
8975
  ? config.data
8842
8976
  : Observable$1.array(config?.data || []),
8843
8977
  rules: null,
@@ -8869,7 +9003,7 @@ var NativeComponents = (function (exports) {
8869
9003
  value.set(data);
8870
9004
  return;
8871
9005
  }
8872
- if(Validator$1.isObservable(data)) {
9006
+ if(Validator.isObservable(data)) {
8873
9007
  field.model(data);
8874
9008
  return;
8875
9009
  }
@@ -8933,9 +9067,9 @@ var NativeComponents = (function (exports) {
8933
9067
 
8934
9068
  const defaultItem = this.$description.defaultItem;
8935
9069
  let defaultItemData = (typeof defaultItem === 'function' ? defaultItem(...args) : defaultItem) || '';
8936
- defaultItemData = Validator$1.isObservable(defaultItemData)
9070
+ defaultItemData = Validator.isObservable(defaultItemData)
8937
9071
  ? defaultItemData
8938
- : Validator$1.isObject(defaultItemData)
9072
+ : Validator.isObject(defaultItemData)
8939
9073
  ? Observable$1.init(defaultItemData)
8940
9074
  : Observable$1(defaultItemData);
8941
9075
 
@@ -8981,7 +9115,7 @@ var NativeComponents = (function (exports) {
8981
9115
  };
8982
9116
 
8983
9117
  FieldCollection.prototype.model = function(newValue) {
8984
- if(Validator$1.isObservable(newValue)) {
9118
+ if(Validator.isObservable(newValue)) {
8985
9119
  this.$description.value?.cleanup?.();
8986
9120
  this.$description.value = newValue;
8987
9121
  return this;
@@ -8992,7 +9126,7 @@ var NativeComponents = (function (exports) {
8992
9126
 
8993
9127
  FieldCollection.prototype.value = function() {
8994
9128
  return this.$description.value.map((item) => {
8995
- return Validator$1.isObservable(item) ? item.val() : item;
9129
+ return Validator.isObservable(item) ? item.val() : item;
8996
9130
  });
8997
9131
  };
8998
9132
 
@@ -9355,7 +9489,7 @@ var NativeComponents = (function (exports) {
9355
9489
 
9356
9490
  ListItem.prototype.selectable = function() {
9357
9491
  this.$description.selectable = true;
9358
- if(Validator$1.isObservable(this.$description.selected)) {
9492
+ if(Validator.isObservable(this.$description.selected)) {
9359
9493
  return this;
9360
9494
  }
9361
9495
  this.$description.selected = $(false);
@@ -9363,7 +9497,7 @@ var NativeComponents = (function (exports) {
9363
9497
  };
9364
9498
 
9365
9499
  ListItem.prototype.selected = function(selected = true) {
9366
- if(Validator$1.isObservable(this.$description.selected)) {
9500
+ if(Validator.isObservable(this.$description.selected)) {
9367
9501
  this.$description.selected.set(selected);
9368
9502
  return this;
9369
9503
  }
@@ -10094,11 +10228,13 @@ var NativeComponents = (function (exports) {
10094
10228
  return this;
10095
10229
  };
10096
10230
 
10097
- function Progress(config = {}) {
10231
+ function Progress(props = {}) {
10098
10232
  if (!(this instanceof Progress)) {
10099
- return new Progress(config);
10233
+ return new Progress(props);
10100
10234
  }
10101
10235
 
10236
+ BaseComponent.call(this, props);
10237
+
10102
10238
  this.$description = {
10103
10239
  value: null,
10104
10240
  type: null,
@@ -10114,7 +10250,8 @@ var NativeComponents = (function (exports) {
10114
10250
  striped: null,
10115
10251
  animated: null,
10116
10252
  render: null,
10117
- ...config
10253
+ borderRadiusType: null,
10254
+ props
10118
10255
  };
10119
10256
  }
10120
10257
 
@@ -10122,13 +10259,32 @@ var NativeComponents = (function (exports) {
10122
10259
 
10123
10260
  Progress.defaultTemplate = null;
10124
10261
 
10125
- Progress.use = function(template) {};
10262
+ Progress.use = function(template) {
10263
+ Progress.defaultTemplate = template.progress;
10264
+ };
10265
+
10266
+ Progress.preset = function(name, callback) {
10267
+ if (Progress.prototype[name] || Progress[name]) {
10268
+ DebugManager$1.warn(`Warning: the ${name} method already exists in Progress.`);
10269
+ return;
10270
+ }
10271
+ Progress[name] = (props) => callback(new Progress(props));
10272
+ };
10273
+
10274
+ Progress.presets = function(presets) {
10275
+ for (const name in presets) {
10276
+ Progress.preset(name, presets[name]);
10277
+ }
10278
+ };
10279
+
10126
10280
 
10127
10281
  Progress.prototype.model = function(observable) {
10128
10282
  this.$description.value = observable;
10129
10283
  return this;
10130
10284
  };
10131
10285
 
10286
+ Progress.prototype.bind = Progress.prototype.model;
10287
+
10132
10288
  Progress.prototype.setCurrentStep = function(step) {
10133
10289
  this.$description.value?.set(step);
10134
10290
  this.emit('change', step);
@@ -10136,19 +10292,14 @@ var NativeComponents = (function (exports) {
10136
10292
 
10137
10293
  Progress.prototype.value = function() {
10138
10294
  const value = this.$description.value;
10139
- if(Validator$1.isObservable(value)) {
10295
+ if(Validator.isObservable(value)) {
10140
10296
  return value.val();
10141
10297
  }
10142
10298
  return value;
10143
10299
  };
10144
10300
 
10145
10301
  Progress.prototype.setValue = function(newValue) {
10146
- const value = this.$description.value;
10147
- if(Validator$1.isObservable(value)) {
10148
- value.set(newValue);
10149
- return this;
10150
- }
10151
- this.$description.value = newValue;
10302
+ this.setCurrentStep(newValue);
10152
10303
  return this;
10153
10304
  };
10154
10305
 
@@ -10174,6 +10325,11 @@ var NativeComponents = (function (exports) {
10174
10325
  return this.type('line');
10175
10326
  };
10176
10327
 
10328
+ Progress.prototype.pill = function() {
10329
+ this.$description.borderRadiusType = 'pill';
10330
+ return this;
10331
+ };
10332
+
10177
10333
  // Variant
10178
10334
  Progress.prototype.variant = function(name) {
10179
10335
  this.$description.variant = name;
@@ -10311,24 +10467,47 @@ var NativeComponents = (function (exports) {
10311
10467
  return this.$build();
10312
10468
  };
10313
10469
 
10314
- function Skeleton(type = 'rect', config = {}) {
10470
+ function Skeleton(props = {}) {
10315
10471
  if (!(this instanceof Skeleton)) {
10316
- return new Skeleton(config);
10472
+ return new Skeleton(props);
10317
10473
  }
10474
+
10475
+ BaseComponent.call(this, props);
10476
+
10318
10477
  this.$description = {
10319
- type,
10478
+ type: 'rect',
10479
+ variant: 'pulse',
10480
+ borderRadiusType: 'rounded',
10320
10481
  lines: null,
10321
10482
  width: null,
10322
10483
  height: null,
10323
10484
  loading: null,
10324
10485
  repeat: null,
10325
- ...config
10486
+ props
10326
10487
  };
10327
10488
  }
10328
10489
 
10490
+ BaseComponent.extends(Skeleton);
10491
+
10329
10492
  Skeleton.defaultTemplate = null;
10330
10493
 
10331
- Skeleton.use = function(template) {};
10494
+ Skeleton.use = function(template) {
10495
+ Skeleton.defaultTemplate = template.skeleton;
10496
+ };
10497
+
10498
+ Skeleton.preset = function(name, callback) {
10499
+ if (Skeleton.prototype[name] || Skeleton[name]) {
10500
+ DebugManager$1.warn(`Warning: the ${name} method already exists in Skeleton.`);
10501
+ return;
10502
+ }
10503
+ Skeleton[name] = (props) => callback(new Skeleton(props));
10504
+ };
10505
+
10506
+ Skeleton.presets = function(presets) {
10507
+ for (const name in presets) {
10508
+ Skeleton.preset(name, presets[name]);
10509
+ }
10510
+ };
10332
10511
 
10333
10512
  Skeleton.prototype.type = function(type) {
10334
10513
  this.$description.type = type;
@@ -10351,6 +10530,21 @@ var NativeComponents = (function (exports) {
10351
10530
  return this.type('image');
10352
10531
  };
10353
10532
 
10533
+ Skeleton.prototype.rounded = function() {
10534
+ this.$description.borderRadiusType = 'rounded';
10535
+ return this;
10536
+ };
10537
+
10538
+ Skeleton.prototype.pill = function() {
10539
+ this.$description.borderRadiusType = 'pill';
10540
+ return this;
10541
+ };
10542
+
10543
+ Skeleton.prototype.smooth = function() {
10544
+ this.$description.borderRadiusType = 'smooth';
10545
+ return this;
10546
+ };
10547
+
10354
10548
  Skeleton.prototype.width = function(width) {
10355
10549
  this.$description.width = width;
10356
10550
  return this;
@@ -10375,7 +10569,6 @@ var NativeComponents = (function (exports) {
10375
10569
  Skeleton.prototype.pulse = function() {
10376
10570
  return this.variant('pulse');
10377
10571
  };
10378
- Skeleton.prototype.rounded = function() {};
10379
10572
 
10380
10573
  Skeleton.prototype.loading = function(isLoading) {
10381
10574
  this.$description.loading = isLoading;
@@ -10590,14 +10783,14 @@ var NativeComponents = (function (exports) {
10590
10783
  return this.$build();
10591
10784
  };
10592
10785
 
10593
- function Spinner(config = {}) {
10594
- if (!(this instanceof Spinner)) {
10595
- return new Spinner(config);
10786
+ function Spinner$1(props = {}) {
10787
+ if (!(this instanceof Spinner$1)) {
10788
+ return new Spinner$1(props);
10596
10789
  }
10597
10790
 
10598
10791
  this.$description = {
10599
10792
  type: 'circle',
10600
- variant: null,
10793
+ variant: 'primary',
10601
10794
  color: null,
10602
10795
  size: 'small',
10603
10796
  label: null,
@@ -10606,32 +10799,48 @@ var NativeComponents = (function (exports) {
10606
10799
  backdrop: null,
10607
10800
  render: null,
10608
10801
  loading: null,
10609
- speed: null,
10610
- ...config
10802
+ speed: 'normal',
10803
+ props
10611
10804
  };
10612
10805
  }
10613
10806
 
10614
- Spinner.use = function(template) {};
10615
- Spinner.defaultTemplate = null;
10807
+ Spinner$1.defaultTemplate = null;
10808
+ Spinner$1.use = function(template) {
10809
+ Spinner$1.defaultTemplate = template.spinner;
10810
+ };
10811
+
10812
+ Spinner$1.preset = function(name, callback) {
10813
+ if (Spinner$1.prototype[name] || Spinner$1[name]) {
10814
+ DebugManager$1.warn(`Warning: the ${name} method already exists in Spinner.`);
10815
+ return;
10816
+ }
10817
+ Spinner$1[name] = (props) => callback(new Spinner$1(props));
10818
+ };
10819
+
10820
+ Spinner$1.presets = function(presets) {
10821
+ for (const name in presets) {
10822
+ Spinner$1.preset(name, presets[name]);
10823
+ }
10824
+ };
10616
10825
 
10617
- Spinner.prototype.type = function(type) {
10826
+ Spinner$1.prototype.type = function(type) {
10618
10827
  this.$description.type = type;
10619
10828
  return this;
10620
10829
  };
10621
10830
 
10622
- Spinner.prototype.circle = function() {
10831
+ Spinner$1.prototype.circle = function() {
10623
10832
  return this.type('circle');
10624
10833
  };
10625
- Spinner.prototype.dots = function() {
10834
+ Spinner$1.prototype.dots = function() {
10626
10835
  return this.type('dots');
10627
10836
  };
10628
- Spinner.prototype.bars = function() {
10837
+ Spinner$1.prototype.bars = function() {
10629
10838
  return this.type('bars');
10630
10839
  };
10631
- Spinner.prototype.pulse = function() {
10840
+ Spinner$1.prototype.pulse = function() {
10632
10841
  return this.type('pulse');
10633
10842
  };
10634
- Spinner.prototype.ring = function() {
10843
+ Spinner$1.prototype.ring = function() {
10635
10844
  return this.type('ring');
10636
10845
  };
10637
10846
 
@@ -10639,79 +10848,79 @@ var NativeComponents = (function (exports) {
10639
10848
  * @param {string|int} size
10640
10849
  * @returns {Spinner}
10641
10850
  */
10642
- Spinner.prototype.size = function(size) {
10851
+ Spinner$1.prototype.size = function(size) {
10643
10852
  this.$description.size = size;
10644
10853
  return this;
10645
10854
  };
10646
- Spinner.prototype.extraSmall = function() {
10855
+ Spinner$1.prototype.extraSmall = function() {
10647
10856
  return this.size('extra-small');
10648
10857
  };
10649
- Spinner.prototype.small = function() {
10858
+ Spinner$1.prototype.small = function() {
10650
10859
  return this.size('small');
10651
10860
  };
10652
- Spinner.prototype.medium = function() {
10861
+ Spinner$1.prototype.medium = function() {
10653
10862
  return this.size('medium');
10654
10863
  };
10655
- Spinner.prototype.large = function() {
10864
+ Spinner$1.prototype.large = function() {
10656
10865
  return this.size('large');
10657
10866
  };
10658
- Spinner.prototype.extraLarge = function() {
10867
+ Spinner$1.prototype.extraLarge = function() {
10659
10868
  return this.size('extra-large');
10660
10869
  };
10661
10870
 
10662
- Spinner.prototype.variant = function(name) {
10871
+ Spinner$1.prototype.variant = function(name) {
10663
10872
  this.$description.variant = name;
10664
10873
  return this;
10665
10874
  };
10666
- Spinner.prototype.primary = function() {
10875
+ Spinner$1.prototype.primary = function() {
10667
10876
  return this.variant('primary');
10668
10877
  };
10669
- Spinner.prototype.secondary = function() {
10878
+ Spinner$1.prototype.secondary = function() {
10670
10879
  return this.variant('secondary');
10671
10880
  };
10672
- Spinner.prototype.success = function() {
10881
+ Spinner$1.prototype.success = function() {
10673
10882
  return this.variant('success');
10674
10883
  };
10675
- Spinner.prototype.danger = function() {
10884
+ Spinner$1.prototype.danger = function() {
10676
10885
  return this.variant('danger');
10677
10886
  };
10678
- Spinner.prototype.warning = function() {
10887
+ Spinner$1.prototype.warning = function() {
10679
10888
  return this.variant('warning');
10680
10889
  };
10681
- Spinner.prototype.color = function(color) {
10890
+ Spinner$1.prototype.color = function(color) {
10682
10891
  this.$description.color = color;
10683
10892
  return this;
10684
10893
  };
10685
10894
 
10686
- Spinner.prototype.label = function(label) {
10895
+ Spinner$1.prototype.label = function(label) {
10687
10896
  this.$description.label = label;
10688
10897
  return this;
10689
10898
  };
10690
- Spinner.prototype.labelPosition = function(position) {
10899
+ Spinner$1.prototype.labelPosition = function(position) {
10691
10900
  this.$description.labelPosition = position;
10692
10901
  return this;
10693
10902
  };
10694
- Spinner.prototype.labelAtTop = function() {
10903
+ Spinner$1.prototype.labelAtTop = function() {
10695
10904
  return this.labelPosition('top');
10696
10905
  };
10697
- Spinner.prototype.labelAtBottom = function() {
10906
+ Spinner$1.prototype.labelAtBottom = function() {
10698
10907
  return this.labelPosition('bottom');
10699
10908
  };
10700
- Spinner.prototype.labelAtLeft = function() {
10909
+ Spinner$1.prototype.labelAtLeft = function() {
10701
10910
  return this.labelPosition('left');
10702
10911
  };
10703
- Spinner.prototype.labelAtRight = function() {
10912
+ Spinner$1.prototype.labelAtRight = function() {
10704
10913
  return this.labelPosition('right');
10705
10914
  };
10706
10915
 
10707
- Spinner.prototype.overlay = function(enabled = true) {
10916
+ Spinner$1.prototype.overlay = function(enabled = true) {
10708
10917
  this.$description.overlay = enabled;
10709
10918
  return this;
10710
10919
  };
10711
- Spinner.prototype.fullscreen = function() {
10920
+ Spinner$1.prototype.fullscreen = function() {
10712
10921
  return this.overlay(true);
10713
10922
  };
10714
- Spinner.prototype.backdrop = function(enabled = true) {
10923
+ Spinner$1.prototype.backdrop = function(enabled = true) {
10715
10924
  this.$description.backdrop = enabled;
10716
10925
  return this;
10717
10926
  };
@@ -10721,34 +10930,31 @@ var NativeComponents = (function (exports) {
10721
10930
  * @param {string|int} speed
10722
10931
  * @returns {Spinner}
10723
10932
  */
10724
- Spinner.prototype.speed = function(speed) {
10933
+ Spinner$1.prototype.speed = function(speed) {
10725
10934
  this.$description.speed = speed;
10726
10935
  return this;
10727
10936
  };
10728
- Spinner.prototype.slow = function() {
10937
+ Spinner$1.prototype.slow = function() {
10729
10938
  return this.speed('slow');
10730
10939
  };
10731
- Spinner.prototype.normal = function() {
10940
+ Spinner$1.prototype.normal = function() {
10732
10941
  return this.speed('normal');
10733
10942
  };
10734
- Spinner.prototype.fast = function() {
10943
+ Spinner$1.prototype.fast = function() {
10735
10944
  return this.speed('fast');
10736
10945
  };
10737
- Spinner.prototype.loading = function(isLoading) {
10738
- this.$description.loading = isLoading;
10946
+ Spinner$1.prototype.loading = function(isLoading) {
10947
+ this.$description.loading = BaseComponent.obs(isLoading);
10739
10948
  return this;
10740
10949
  };
10950
+ Spinner$1.prototype.bind = Spinner$1.prototype.loading;
10741
10951
 
10742
- Spinner.prototype.show = function() {};
10743
- Spinner.prototype.hide = function() {};
10744
-
10745
- Spinner.prototype.render = function(renderFn) {
10746
- this.$description.render = renderFn;
10747
- return this;
10952
+ Spinner$1.prototype.show = function() {
10953
+ this.$description.loading?.set(true);
10954
+ };
10955
+ Spinner$1.prototype.hide = function() {
10956
+ this.$description.loading?.set(false);
10748
10957
  };
10749
-
10750
- Spinner.prototype.$build = function() {};
10751
- Spinner.prototype.toNdElement = function() {};
10752
10958
 
10753
10959
  function Splitter(config = {}) {
10754
10960
  if(!(this instanceof Splitter)) {
@@ -10805,7 +11011,7 @@ var NativeComponents = (function (exports) {
10805
11011
  };
10806
11012
 
10807
11013
  Splitter.prototype.panels = function(panels) {
10808
- if(Validator$1.isObservable(this.$description.panels)) {
11014
+ if(Validator.isObservable(this.$description.panels)) {
10809
11015
  this.$description.panels.set(panels);
10810
11016
  return this;
10811
11017
  }
@@ -10967,7 +11173,7 @@ var NativeComponents = (function (exports) {
10967
11173
  };
10968
11174
 
10969
11175
  Stepper.prototype.steps = function(steps) {
10970
- if(Validator$1.isObservable(steps)) {
11176
+ if(Validator.isObservable(steps)) {
10971
11177
  this.$description.steps = steps;
10972
11178
  return this;
10973
11179
  }
@@ -12111,16 +12317,176 @@ var NativeComponents = (function (exports) {
12111
12317
  Tooltip.prototype.$build = function() {};
12112
12318
  Tooltip.prototype.toNdElement = function() {};
12113
12319
 
12320
+ function Stack(content, props = {}) {
12321
+ if (!(this instanceof Stack)) {
12322
+ return new Stack(content, props);
12323
+ }
12324
+
12325
+ BaseComponent.call(this, props);
12326
+
12327
+ this.$description = {
12328
+ orientation: 'horizontal',
12329
+ content: content,
12330
+ spacing: 0,
12331
+ alignment: 'center',
12332
+ justifyContent: 'start',
12333
+ props
12334
+ };
12335
+ }
12336
+
12337
+ BaseComponent.extends(Stack);
12338
+
12339
+ Stack.prototype.wrap = function(enabled = true) {
12340
+ this.$description.wrap = enabled;
12341
+ return this;
12342
+ };
12343
+
12344
+ Stack.prototype.spacing = function(value) {
12345
+ this.$description.spacing = value;
12346
+ return this;
12347
+ };
12348
+
12349
+ Stack.prototype.alignLeading = function() {
12350
+ this.$description.alignment = 'leading';
12351
+ return this;
12352
+ };
12353
+ Stack.prototype.alignCenter = function() {
12354
+ this.$description.alignment = 'center';
12355
+ return this;
12356
+ };
12357
+ Stack.prototype.alignTrailing = function() {
12358
+ this.$description.alignment = 'trailing';
12359
+ return this;
12360
+ };
12361
+ Stack.prototype.alignStretch = function() {
12362
+ this.$description.alignment = 'stretch';
12363
+ return this;
12364
+ };
12365
+
12366
+ Stack.prototype.justifyStart = function() {
12367
+ this.$description.justifyContent = 'start';
12368
+ return this;
12369
+ };
12370
+ Stack.prototype.justifyCenter = function() {
12371
+ this.$description.justifyContent = 'center';
12372
+ return this;
12373
+ };
12374
+ Stack.prototype.justifyEnd = function() {
12375
+ this.$description.justifyContent = 'end';
12376
+ return this;
12377
+ };
12378
+ Stack.prototype.justifyBetween = function() {
12379
+ this.$description.justifyContent = 'between';
12380
+ return this;
12381
+ };
12382
+ Stack.prototype.justifyAround = function() {
12383
+ this.$description.justifyContent = 'around';
12384
+ return this;
12385
+ };
12386
+
12387
+ Stack.prototype.center = function() {
12388
+ this.alignCenter().justifyCenter();
12389
+ return this;
12390
+ };
12391
+
12392
+ function VStack(content, props = {}) {
12393
+ if (!(this instanceof VStack)) return new VStack(content, props);
12394
+
12395
+ Stack.call(this, content, props);
12396
+ this.$description.orientation = 'vertical';
12397
+ this.$description.alignment = 'leading';
12398
+ }
12399
+ Stack.extends(VStack);
12400
+
12401
+ VStack.preset = function(name, callback) {
12402
+ if (VStack.prototype[name] || VStack[name]) {
12403
+ DebugManager$1.warn(`Warning: the ${name} method already exists in VStack.`);
12404
+ return;
12405
+ }
12406
+ VStack[name] = (content, props) => callback(new VStack(content, props));
12407
+ };
12408
+
12409
+ VStack.presets = function(presets) {
12410
+ for (const name in presets) {
12411
+ VStack.preset(name, presets[name]);
12412
+ }
12413
+ };
12414
+
12415
+ function ZStack(content, props = {}) {
12416
+ if (!(this instanceof ZStack)) {
12417
+ return new ZStack(content, props);
12418
+ }
12419
+ BaseComponent.call(this, props);
12420
+
12421
+ this.$description = {
12422
+ content: content,
12423
+ alignment: 'center',
12424
+ props
12425
+ };
12426
+ }
12427
+
12428
+ BaseComponent.extends(ZStack);
12429
+
12430
+ ZStack.preset = function(name, callback) {
12431
+ if (ZStack.prototype[name] || ZStack[name]) {
12432
+ DebugManager$1.warn(`Warning: the ${name} method already exists in ZStack.`);
12433
+ return;
12434
+ }
12435
+ ZStack[name] = (content, props) => callback(new ZStack(content, props));
12436
+ };
12437
+
12438
+ ZStack.presets = function(presets) {
12439
+ for (const name in presets) {
12440
+ ZStack.preset(name, presets[name]);
12441
+ }
12442
+ };
12443
+
12444
+ ZStack.prototype.alignment = function(align) {
12445
+ this.$description.alignment = align;
12446
+ return this;
12447
+ };
12448
+
12449
+ function HStack(content, props = {}) {
12450
+ if (!(this instanceof HStack)) {
12451
+ return new HStack(content, props);
12452
+ }
12453
+
12454
+ Stack.call(this, content, props);
12455
+ this.$description.orientation = 'horizontal';
12456
+ }
12457
+
12458
+ Stack.extends(HStack);
12459
+
12460
+ HStack.preset = function(name, callback) {
12461
+ if (HStack.prototype[name] || HStack[name]) {
12462
+ DebugManager$1.warn(`Warning: the ${name} method already exists in HStack.`);
12463
+ return;
12464
+ }
12465
+ HStack[name] = (content, props) => callback(new HStack(content, props));
12466
+ };
12467
+
12468
+ HStack.presets = function(presets) {
12469
+ for (const name in presets) {
12470
+ HStack.preset(name, presets[name]);
12471
+ }
12472
+ };
12473
+
12474
+ const Row = HStack;
12475
+ const Col = VStack;
12476
+ const Overlay = ZStack;
12477
+
12114
12478
  exports.Accordion = Accordion;
12115
12479
  exports.AccordionItem = AccordionItem;
12116
12480
  exports.Alert = Alert;
12117
12481
  exports.AutocompleteField = AutocompleteField;
12118
12482
  exports.Avatar = Avatar;
12483
+ exports.AvatarGroup = AvatarGroup;
12119
12484
  exports.Badge = Badge;
12120
12485
  exports.Breadcrumb = Breadcrumb;
12121
12486
  exports.Button = Button;
12122
12487
  exports.CheckboxField = CheckboxField;
12123
12488
  exports.CheckboxGroupField = CheckboxGroupField;
12489
+ exports.Col = Col;
12124
12490
  exports.ColorField = ColorField;
12125
12491
  exports.ContextMenu = ContextMenu;
12126
12492
  exports.ContextMenuGroup = ContextMenuGroup;
@@ -12138,14 +12504,17 @@ var NativeComponents = (function (exports) {
12138
12504
  exports.FieldCollection = FieldCollection;
12139
12505
  exports.FileField = FileField;
12140
12506
  exports.FormControl = FormControl;
12507
+ exports.HStack = HStack;
12141
12508
  exports.HiddenField = HiddenField;
12142
12509
  exports.ImageField = ImageField;
12143
12510
  exports.Menu = Menu;
12144
12511
  exports.MenuDivider = MenuDivider;
12145
12512
  exports.MenuGroup = MenuGroup;
12146
12513
  exports.MenuItem = MenuItem;
12514
+ exports.MenuLink = MenuLink;
12147
12515
  exports.Modal = Modal;
12148
12516
  exports.NumberField = NumberField;
12517
+ exports.Overlay = Overlay;
12149
12518
  exports.Pagination = Pagination;
12150
12519
  exports.PasswordField = PasswordField;
12151
12520
  exports.Popover = Popover;
@@ -12154,13 +12523,15 @@ var NativeComponents = (function (exports) {
12154
12523
  exports.Progress = Progress;
12155
12524
  exports.RadioField = RadioField;
12156
12525
  exports.RangeField = RangeField;
12526
+ exports.Row = Row;
12157
12527
  exports.SelectField = SelectField;
12158
12528
  exports.SimpleTable = SimpleTable;
12159
12529
  exports.Skeleton = Skeleton;
12160
12530
  exports.Slider = Slider;
12161
- exports.Spinner = Spinner;
12531
+ exports.Spinner = Spinner$1;
12162
12532
  exports.Splitter = Splitter;
12163
12533
  exports.SplitterPanel = SplitterPanel;
12534
+ exports.Stack = Stack;
12164
12535
  exports.Stepper = Stepper;
12165
12536
  exports.StepperStep = StepperStep;
12166
12537
  exports.StringField = StringField;
@@ -12171,6 +12542,8 @@ var NativeComponents = (function (exports) {
12171
12542
  exports.Toast = Toast;
12172
12543
  exports.Tooltip = Tooltip;
12173
12544
  exports.UrlField = UrlField;
12545
+ exports.VStack = VStack;
12546
+ exports.ZStack = ZStack;
12174
12547
 
12175
12548
  return exports;
12176
12549