@frollo/frollo-web-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { f as fails$1, d as documentCreateElement$1, g as global$1, a as descriptors, b as functionUncurryThis } from './function-name-a620492a.js';
2
- import { _ as _export, r as redefine$1, c as createNonEnumerableProperty$1, o as objectKeys$1, t as toIndexedObject$1, a as objectPropertyIsEnumerable } from './add-to-unscopables-874257d1.js';
3
- import { a as arrayIteration, t as toStringTagSupport, c as classof$1, s as script$5, b as script$6 } from './index-5430e7a3.js';
4
- export { b as FwTab, s as FwTabs } from './index-5430e7a3.js';
1
+ import { f as fails$1, d as documentCreateElement$1, g as global$4, a as descriptors, b as functionUncurryThis, c as functionBindNative, i as isCallable$1, e as engineUserAgent } from './function-name-f0c1223e.js';
2
+ import { _ as _export, d as defineBuiltIn$1, c as createNonEnumerableProperty$1, o as objectKeys$1, t as toIndexedObject$1, a as objectPropertyIsEnumerable } from './add-to-unscopables-81c17489.js';
3
+ import { a as arrayIteration, t as toStringTagSupport, c as classof$1, s as script$5, b as script$6 } from './index-0e14da44.js';
4
+ export { b as FwTab, s as FwTabs } from './index-0e14da44.js';
5
5
  import './fw-form.js';
6
6
  import { FwInput as script } from './fw-input.js';
7
7
  export { FwInput } from './fw-input.js';
@@ -12,15 +12,15 @@ export { FwCard } from './fw-card.js';
12
12
  import './fw-button.js';
13
13
  import { FwNavigationMenu as script$4 } from './fw-navigation-menu.js';
14
14
  export { FwNavigationMenu } from './fw-navigation-menu.js';
15
- import { FwModal as script$7 } from './fw-modal.js';
16
- export { FwModal } from './fw-modal.js';
17
- import { F as Form } from './vee-validate.esm-028c6424.js';
18
- export { F as FwForm } from './vee-validate.esm-028c6424.js';
19
- import { s as script$3 } from './fw-button-93be6218.js';
20
- export { s as FwButton } from './fw-button-93be6218.js';
21
- import { getCurrentInstance, createVNode, render, onUnmounted } from 'vue';
22
- import './es.array.includes-ef2f18f4.js';
23
- import './es.function.name-43e1ffbd.js';
15
+ import { s as script$7, u as uniqueId } from './index-1813012f.js';
16
+ export { s as FwModal } from './index-1813012f.js';
17
+ import { F as Form } from './vee-validate.esm-b64acab1.js';
18
+ export { F as FwForm } from './vee-validate.esm-b64acab1.js';
19
+ import { s as script$3 } from './fw-button-bba6ac88.js';
20
+ export { s as FwButton } from './fw-button-bba6ac88.js';
21
+ import { createApp } from 'vue';
22
+ import './es.array.includes-debcb50f.js';
23
+ import './es.function.name-e746680f.js';
24
24
  import './style-inject.es-1f59c1d0.js';
25
25
 
26
26
  function _arrayWithHoles(arr) {
@@ -107,17 +107,17 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
107
107
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
108
108
  var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
109
109
  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
110
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
110
+ // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
111
111
  } : [].forEach;
112
112
 
113
113
  'use strict';
114
- var $$1 = _export;
114
+ var $$3 = _export;
115
115
  var forEach$1 = arrayForEach;
116
116
 
117
117
  // `Array.prototype.forEach` method
118
118
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
119
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
120
- $$1({ target: 'Array', proto: true, forced: [].forEach != forEach$1 }, {
119
+ // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
120
+ $$3({ target: 'Array', proto: true, forced: [].forEach != forEach$1 }, {
121
121
  forEach: forEach$1
122
122
  });
123
123
 
@@ -134,13 +134,13 @@ var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString()
134
134
  };
135
135
 
136
136
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
137
- var redefine = redefine$1.exports;
137
+ var defineBuiltIn = defineBuiltIn$1;
138
138
  var toString = objectToString;
139
139
 
140
140
  // `Object.prototype.toString` method
141
141
  // https://tc39.es/ecma262/#sec-object.prototype.tostring
142
142
  if (!TO_STRING_TAG_SUPPORT) {
143
- redefine(Object.prototype, 'toString', toString, { unsafe: true });
143
+ defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
144
144
  }
145
145
 
146
146
  var web_domCollections_forEach = {};
@@ -189,7 +189,7 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
189
189
 
190
190
  var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
191
191
 
192
- var global = global$1;
192
+ var global$3 = global$4;
193
193
  var DOMIterables = domIterables;
194
194
  var DOMTokenListPrototype = domTokenListPrototype;
195
195
  var forEach = arrayForEach;
@@ -206,7 +206,7 @@ var handlePrototype = function (CollectionPrototype) {
206
206
 
207
207
  for (var COLLECTION_NAME in DOMIterables) {
208
208
  if (DOMIterables[COLLECTION_NAME]) {
209
- handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
209
+ handlePrototype(global$3[COLLECTION_NAME] && global$3[COLLECTION_NAME].prototype);
210
210
  }
211
211
  }
212
212
 
@@ -215,13 +215,13 @@ handlePrototype(DOMTokenListPrototype);
215
215
  var es_object_entries = {};
216
216
 
217
217
  var DESCRIPTORS = descriptors;
218
- var uncurryThis = functionUncurryThis;
218
+ var uncurryThis$1 = functionUncurryThis;
219
219
  var objectKeys = objectKeys$1;
220
220
  var toIndexedObject = toIndexedObject$1;
221
221
  var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
222
222
 
223
- var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
224
- var push = uncurryThis([].push);
223
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
224
+ var push = uncurryThis$1([].push);
225
225
 
226
226
  // `Object.{ entries, values }` methods implementation
227
227
  var createMethod = function (TO_ENTRIES) {
@@ -251,12 +251,12 @@ var objectToArray = {
251
251
  values: createMethod(false)
252
252
  };
253
253
 
254
- var $ = _export;
254
+ var $$2 = _export;
255
255
  var $entries = objectToArray.entries;
256
256
 
257
257
  // `Object.entries` method
258
258
  // https://tc39.es/ecma262/#sec-object.entries
259
- $({ target: 'Object', stat: true }, {
259
+ $$2({ target: 'Object', stat: true }, {
260
260
  entries: function entries(O) {
261
261
  return $entries(O);
262
262
  }
@@ -318,36 +318,115 @@ function _objectSpread2(target) {
318
318
  return target;
319
319
  }
320
320
 
321
- var modalService = function modalService(options, element) {
322
- var _getCurrentInstance;
321
+ var web_timers = {};
322
+
323
+ var web_setInterval = {};
324
+
325
+ var NATIVE_BIND = functionBindNative;
326
+
327
+ var FunctionPrototype = Function.prototype;
328
+ var apply$1 = FunctionPrototype.apply;
329
+ var call = FunctionPrototype.call;
330
+
331
+ // eslint-disable-next-line es-x/no-reflect -- safe
332
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply$1) : function () {
333
+ return call.apply(apply$1, arguments);
334
+ });
323
335
 
336
+ var uncurryThis = functionUncurryThis;
337
+
338
+ var arraySlice$1 = uncurryThis([].slice);
339
+
340
+ var $TypeError = TypeError;
341
+
342
+ var validateArgumentsLength$1 = function (passed, required) {
343
+ if (passed < required) throw $TypeError('Not enough arguments');
344
+ return passed;
345
+ };
346
+
347
+ var global$2 = global$4;
348
+ var apply = functionApply;
349
+ var isCallable = isCallable$1;
350
+ var userAgent = engineUserAgent;
351
+ var arraySlice = arraySlice$1;
352
+ var validateArgumentsLength = validateArgumentsLength$1;
353
+
354
+ var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
355
+ var Function$1 = global$2.Function;
356
+
357
+ var wrap = function (scheduler) {
358
+ return MSIE ? function (handler, timeout /* , ...arguments */) {
359
+ var boundArgs = validateArgumentsLength(arguments.length, 1) > 2;
360
+ var fn = isCallable(handler) ? handler : Function$1(handler);
361
+ var args = boundArgs ? arraySlice(arguments, 2) : undefined;
362
+ return scheduler(boundArgs ? function () {
363
+ apply(fn, this, args);
364
+ } : fn, timeout);
365
+ } : scheduler;
366
+ };
367
+
368
+ // ie9- setTimeout & setInterval additional parameters fix
369
+ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
370
+ var schedulersFix = {
371
+ // `setTimeout` method
372
+ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
373
+ setTimeout: wrap(global$2.setTimeout),
374
+ // `setInterval` method
375
+ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
376
+ setInterval: wrap(global$2.setInterval)
377
+ };
378
+
379
+ var $$1 = _export;
380
+ var global$1 = global$4;
381
+ var setInterval = schedulersFix.setInterval;
382
+
383
+ // ie9- setInterval additional parameters fix
384
+ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
385
+ $$1({ global: true, bind: true, forced: global$1.setInterval !== setInterval }, {
386
+ setInterval: setInterval
387
+ });
388
+
389
+ var web_setTimeout = {};
390
+
391
+ var $ = _export;
392
+ var global = global$4;
393
+ var setTimeout$1 = schedulersFix.setTimeout;
394
+
395
+ // ie9- setTimeout additional parameters fix
396
+ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
397
+ $({ global: true, bind: true, forced: global.setTimeout !== setTimeout$1 }, {
398
+ setTimeout: setTimeout$1
399
+ });
400
+
401
+ var modalService = function modalService(options, element) {
324
402
  var elementToMount = document.createElement('div');
325
- var modalVNode = null;
326
- var appContext = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.appContext;
403
+ elementToMount.id = uniqueId('fw-modal-app-');
327
404
  var elAppend = element || document.body;
405
+ var modalVNode = undefined;
328
406
 
329
407
  var open = function open() {
330
- modalVNode = createVNode(script$7, _objectSpread2(_objectSpread2({}, options), {}, {
331
- "class": 'modalFadeIn-enter-active'
332
- }));
333
- modalVNode.appContext = appContext ? appContext : null;
334
- render(modalVNode, elementToMount);
408
+ var _modalVNode;
409
+
410
+ modalVNode = createApp(script$7, _objectSpread2({}, options));
335
411
  elAppend.appendChild(elementToMount);
412
+ (_modalVNode = modalVNode) === null || _modalVNode === void 0 ? void 0 : _modalVNode.mount(elementToMount);
336
413
  };
337
414
 
338
415
  var close = function close() {
339
- render(null, elementToMount);
340
-
341
416
  if (elementToMount) {
342
- elementToMount.remove();
343
- }
417
+ var _elementToMount$query;
418
+
419
+ (_elementToMount$query = elementToMount.querySelector('.fw-modal')) === null || _elementToMount$query === void 0 ? void 0 : _elementToMount$query.classList.add('modalFadeIn-leave-active');
420
+ setTimeout(function () {
421
+ var _modalVNode2;
344
422
 
345
- modalVNode = null;
423
+ (_modalVNode2 = modalVNode) === null || _modalVNode2 === void 0 ? void 0 : _modalVNode2.unmount();
424
+ modalVNode = undefined;
425
+ elementToMount.remove();
426
+ }, 400);
427
+ }
346
428
  };
347
429
 
348
- onUnmounted(function () {
349
- close();
350
- });
351
430
  return {
352
431
  open: open,
353
432
  close: close
@@ -16,6 +16,30 @@ const isProxyAvailable = typeof Proxy === 'function';
16
16
  const HOOK_SETUP = 'devtools-plugin:setup';
17
17
  const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';
18
18
 
19
+ let supported;
20
+ let perf;
21
+ function isPerformanceSupported() {
22
+ var _a;
23
+ if (supported !== undefined) {
24
+ return supported;
25
+ }
26
+ if (typeof window !== 'undefined' && window.performance) {
27
+ supported = true;
28
+ perf = window.performance;
29
+ }
30
+ else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
31
+ supported = true;
32
+ perf = global.perf_hooks.performance;
33
+ }
34
+ else {
35
+ supported = false;
36
+ }
37
+ return supported;
38
+ }
39
+ function now() {
40
+ return isPerformanceSupported() ? perf.now() : Date.now();
41
+ }
42
+
19
43
  class ApiProxy {
20
44
  constructor(plugin, hook) {
21
45
  this.target = null;
@@ -53,6 +77,9 @@ class ApiProxy {
53
77
  }
54
78
  currentSettings = value;
55
79
  },
80
+ now() {
81
+ return now();
82
+ },
56
83
  };
57
84
  if (hook) {
58
85
  hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
@@ -141,7 +168,7 @@ function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
141
168
  }
142
169
 
143
170
  /**
144
- * vee-validate v4.5.9
171
+ * vee-validate v4.5.11
145
172
  * (c) 2022 Abdelrahman Awad
146
173
  * @license MIT
147
174
  */
@@ -643,18 +670,34 @@ async function _validate(field, value) {
643
670
  if (isYupValidator(field.rules)) {
644
671
  return validateFieldWithYup(value, field.rules, { bails: field.bails });
645
672
  }
646
- // if a generic function, use it as the pipeline.
647
- if (isCallable(field.rules)) {
673
+ // if a generic function or chain of generic functions
674
+ if (isCallable(field.rules) || Array.isArray(field.rules)) {
648
675
  const ctx = {
649
676
  field: field.name,
650
677
  form: field.formData,
651
678
  value: value,
652
679
  };
653
- const result = await field.rules(value, ctx);
654
- const isValid = typeof result !== 'string' && result;
655
- const message = typeof result === 'string' ? result : _generateFieldError(ctx);
680
+ // Normalize the pipeline
681
+ const pipeline = Array.isArray(field.rules) ? field.rules : [field.rules];
682
+ const length = pipeline.length;
683
+ const errors = [];
684
+ for (let i = 0; i < length; i++) {
685
+ const rule = pipeline[i];
686
+ const result = await rule(value, ctx);
687
+ const isValid = typeof result !== 'string' && result;
688
+ if (isValid) {
689
+ continue;
690
+ }
691
+ const message = typeof result === 'string' ? result : _generateFieldError(ctx);
692
+ errors.push(message);
693
+ if (field.bails) {
694
+ return {
695
+ errors,
696
+ };
697
+ }
698
+ }
656
699
  return {
657
- errors: !isValid ? [message] : [],
700
+ errors,
658
701
  };
659
702
  }
660
703
  const normalizedContext = Object.assign(Object.assign({}, field), { rules: normalizeRules(field.rules) });
@@ -1439,6 +1482,8 @@ function useField(name, rules, opts) {
1439
1482
  function _useField(name, rules, opts) {
1440
1483
  const { initialValue: modelValue, validateOnMount, bails, type, checkedValue, label, validateOnValueUpdate, uncheckedValue, standalone, } = normalizeOptions(unref(name), opts);
1441
1484
  const form = !standalone ? injectWithSelf(FormContextKey) : undefined;
1485
+ // a flag indicating if the field is about to be removed/unmounted.
1486
+ let markedForRemoval = false;
1442
1487
  const { id, value, initialValue, meta, setState, errors, errorMessage } = useFieldState(name, {
1443
1488
  modelValue,
1444
1489
  standalone,
@@ -1455,7 +1500,7 @@ function _useField(name, rules, opts) {
1455
1500
  if (schema && !isYupValidator(schema)) {
1456
1501
  rulesValue = extractRuleFromSchema(schema, unref(name)) || rulesValue;
1457
1502
  }
1458
- if (isYupValidator(rulesValue) || isCallable(rulesValue)) {
1503
+ if (isYupValidator(rulesValue) || isCallable(rulesValue) || Array.isArray(rulesValue)) {
1459
1504
  return rulesValue;
1460
1505
  }
1461
1506
  return normalizeRules(rulesValue);
@@ -1475,12 +1520,19 @@ function _useField(name, rules, opts) {
1475
1520
  meta.pending = true;
1476
1521
  meta.validated = true;
1477
1522
  const result = await validateCurrentValue('validated-only');
1523
+ if (markedForRemoval) {
1524
+ result.valid = true;
1525
+ result.errors = [];
1526
+ }
1478
1527
  setState({ errors: result.errors });
1479
1528
  meta.pending = false;
1480
1529
  return result;
1481
1530
  }
1482
1531
  async function validateValidStateOnly() {
1483
1532
  const result = await validateCurrentValue('silent');
1533
+ if (markedForRemoval) {
1534
+ result.valid = true;
1535
+ }
1484
1536
  meta.valid = result.valid;
1485
1537
  return result;
1486
1538
  }
@@ -1595,13 +1647,14 @@ function _useField(name, rules, opts) {
1595
1647
  // associate the field with the given form
1596
1648
  form.register(field);
1597
1649
  onBeforeUnmount(() => {
1650
+ markedForRemoval = true;
1598
1651
  form.unregister(field);
1599
1652
  });
1600
1653
  // extract cross-field dependencies in a computed prop
1601
1654
  const dependencies = computed(() => {
1602
1655
  const rulesVal = normalizedRules.value;
1603
1656
  // is falsy, a function schema or a yup schema
1604
- if (!rulesVal || isCallable(rulesVal) || isYupValidator(rulesVal)) {
1657
+ if (!rulesVal || isCallable(rulesVal) || isYupValidator(rulesVal) || Array.isArray(rulesVal)) {
1605
1658
  return {};
1606
1659
  }
1607
1660
  return Object.keys(rulesVal).reduce((acc, rule) => {