@frollo/frollo-web-ui 0.0.21 → 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.
Files changed (45) hide show
  1. package/cjs/index.js +1141 -476
  2. package/esm/{add-to-unscopables-874257d1.js → add-to-unscopables-81c17489.js} +139 -99
  3. package/esm/{es.array.includes-ef2f18f4.js → es.array.includes-debcb50f.js} +9 -3
  4. package/esm/{es.function.name-43e1ffbd.js → es.function.name-e746680f.js} +1 -1
  5. package/esm/{function-name-a620492a.js → function-name-f0c1223e.js} +52 -61
  6. package/esm/{fw-button-fee2541f.js → fw-button-bba6ac88.js} +14 -6
  7. package/esm/fw-button.js +4 -4
  8. package/esm/fw-card.js +7 -4
  9. package/esm/fw-checkbox.js +11 -6
  10. package/esm/fw-form.js +1 -1
  11. package/esm/fw-input.js +10 -8
  12. package/esm/fw-modal.js +7 -0
  13. package/esm/fw-navigation-menu.js +16 -15
  14. package/esm/fw-tabs.js +3 -3
  15. package/esm/{index-5430e7a3.js → index-0e14da44.js} +18 -22
  16. package/esm/index-1813012f.js +474 -0
  17. package/esm/index.js +185 -26
  18. package/esm/{vee-validate.esm-028c6424.js → vee-validate.esm-b64acab1.js} +62 -9
  19. package/frollo-web-ui.esm.js +1218 -488
  20. package/index.d.ts +217 -27
  21. package/package.json +22 -17
  22. package/styles/tailwind.scss +58 -0
  23. package/styles/transitions.scss +20 -0
  24. package/styles/typography.scss +38 -0
  25. package/tailwind.config.js +10 -10
  26. package/types/components/fw-button/fw-button.vue.d.ts +2 -21
  27. package/types/components/fw-button/index.types.d.ts +29 -0
  28. package/types/components/fw-card/fw-card.vue.d.ts +1 -0
  29. package/types/components/fw-card/index.types.d.ts +6 -0
  30. package/types/components/fw-checkbox/fw-checkbox.vue.d.ts +0 -6
  31. package/types/components/fw-checkbox/index.types.d.ts +6 -0
  32. package/types/components/fw-input/fw-input.vue.d.ts +5 -14
  33. package/types/components/fw-input/index.types.d.ts +14 -0
  34. package/types/components/fw-modal/fw-modal.vue.d.ts +145 -0
  35. package/types/components/fw-modal/index.d.ts +2 -0
  36. package/types/components/fw-modal/index.types.d.ts +12 -0
  37. package/types/components/fw-navigation-menu/fw-navigation-menu.vue.d.ts +2 -5
  38. package/types/components/fw-navigation-menu/index.types.d.ts +5 -0
  39. package/types/components/index.d.ts +1 -0
  40. package/types/components/index.types.d.ts +6 -0
  41. package/types/index-types.esm.d.ts +2 -7
  42. package/types/index.d.ts +1 -0
  43. package/types/index.esm.d.ts +1 -0
  44. package/types/services/index.d.ts +1 -0
  45. package/types/services/modal.d.ts +9 -0
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,13 +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 { F as Form } from './vee-validate.esm-028c6424.js';
16
- export { F as FwForm } from './vee-validate.esm-028c6424.js';
17
- import { s as script$3 } from './fw-button-fee2541f.js';
18
- export { s as FwButton } from './fw-button-fee2541f.js';
19
- import 'vue';
20
- import './es.array.includes-ef2f18f4.js';
21
- 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';
22
24
  import './style-inject.es-1f59c1d0.js';
23
25
 
24
26
  function _arrayWithHoles(arr) {
@@ -105,17 +107,17 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
105
107
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
106
108
  var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
107
109
  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
108
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
110
+ // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
109
111
  } : [].forEach;
110
112
 
111
113
  'use strict';
112
- var $$1 = _export;
114
+ var $$3 = _export;
113
115
  var forEach$1 = arrayForEach;
114
116
 
115
117
  // `Array.prototype.forEach` method
116
118
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
117
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
118
- $$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 }, {
119
121
  forEach: forEach$1
120
122
  });
121
123
 
@@ -132,13 +134,13 @@ var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString()
132
134
  };
133
135
 
134
136
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
135
- var redefine = redefine$1.exports;
137
+ var defineBuiltIn = defineBuiltIn$1;
136
138
  var toString = objectToString;
137
139
 
138
140
  // `Object.prototype.toString` method
139
141
  // https://tc39.es/ecma262/#sec-object.prototype.tostring
140
142
  if (!TO_STRING_TAG_SUPPORT) {
141
- redefine(Object.prototype, 'toString', toString, { unsafe: true });
143
+ defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
142
144
  }
143
145
 
144
146
  var web_domCollections_forEach = {};
@@ -187,7 +189,7 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
187
189
 
188
190
  var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
189
191
 
190
- var global = global$1;
192
+ var global$3 = global$4;
191
193
  var DOMIterables = domIterables;
192
194
  var DOMTokenListPrototype = domTokenListPrototype;
193
195
  var forEach = arrayForEach;
@@ -204,7 +206,7 @@ var handlePrototype = function (CollectionPrototype) {
204
206
 
205
207
  for (var COLLECTION_NAME in DOMIterables) {
206
208
  if (DOMIterables[COLLECTION_NAME]) {
207
- handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
209
+ handlePrototype(global$3[COLLECTION_NAME] && global$3[COLLECTION_NAME].prototype);
208
210
  }
209
211
  }
210
212
 
@@ -213,13 +215,13 @@ handlePrototype(DOMTokenListPrototype);
213
215
  var es_object_entries = {};
214
216
 
215
217
  var DESCRIPTORS = descriptors;
216
- var uncurryThis = functionUncurryThis;
218
+ var uncurryThis$1 = functionUncurryThis;
217
219
  var objectKeys = objectKeys$1;
218
220
  var toIndexedObject = toIndexedObject$1;
219
221
  var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
220
222
 
221
- var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
222
- var push = uncurryThis([].push);
223
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
224
+ var push = uncurryThis$1([].push);
223
225
 
224
226
  // `Object.{ entries, values }` methods implementation
225
227
  var createMethod = function (TO_ENTRIES) {
@@ -249,12 +251,12 @@ var objectToArray = {
249
251
  values: createMethod(false)
250
252
  };
251
253
 
252
- var $ = _export;
254
+ var $$2 = _export;
253
255
  var $entries = objectToArray.entries;
254
256
 
255
257
  // `Object.entries` method
256
258
  // https://tc39.es/ecma262/#sec-object.entries
257
- $({ target: 'Object', stat: true }, {
259
+ $$2({ target: 'Object', stat: true }, {
258
260
  entries: function entries(O) {
259
261
  return $entries(O);
260
262
  }
@@ -271,9 +273,166 @@ var components = /*#__PURE__*/Object.freeze({
271
273
  FwButton: script$3,
272
274
  FwNavigationMenu: script$4,
273
275
  FwTabs: script$5,
274
- FwTab: script$6
276
+ FwTab: script$6,
277
+ FwModal: script$7
275
278
  });
276
279
 
280
+ function _defineProperty(obj, key, value) {
281
+ if (key in obj) {
282
+ Object.defineProperty(obj, key, {
283
+ value: value,
284
+ enumerable: true,
285
+ configurable: true,
286
+ writable: true
287
+ });
288
+ } else {
289
+ obj[key] = value;
290
+ }
291
+
292
+ return obj;
293
+ }
294
+
295
+ function ownKeys(object, enumerableOnly) {
296
+ var keys = Object.keys(object);
297
+
298
+ if (Object.getOwnPropertySymbols) {
299
+ var symbols = Object.getOwnPropertySymbols(object);
300
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
301
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
302
+ })), keys.push.apply(keys, symbols);
303
+ }
304
+
305
+ return keys;
306
+ }
307
+
308
+ function _objectSpread2(target) {
309
+ for (var i = 1; i < arguments.length; i++) {
310
+ var source = null != arguments[i] ? arguments[i] : {};
311
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
312
+ _defineProperty(target, key, source[key]);
313
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
314
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
315
+ });
316
+ }
317
+
318
+ return target;
319
+ }
320
+
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
+ });
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) {
402
+ var elementToMount = document.createElement('div');
403
+ elementToMount.id = uniqueId('fw-modal-app-');
404
+ var elAppend = element || document.body;
405
+ var modalVNode = undefined;
406
+
407
+ var open = function open() {
408
+ var _modalVNode;
409
+
410
+ modalVNode = createApp(script$7, _objectSpread2({}, options));
411
+ elAppend.appendChild(elementToMount);
412
+ (_modalVNode = modalVNode) === null || _modalVNode === void 0 ? void 0 : _modalVNode.mount(elementToMount);
413
+ };
414
+
415
+ var close = function close() {
416
+ if (elementToMount) {
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;
422
+
423
+ (_modalVNode2 = modalVNode) === null || _modalVNode2 === void 0 ? void 0 : _modalVNode2.unmount();
424
+ modalVNode = undefined;
425
+ elementToMount.remove();
426
+ }, 400);
427
+ }
428
+ };
429
+
430
+ return {
431
+ open: open,
432
+ close: close
433
+ };
434
+ };
435
+
277
436
  var install = function install(app) {
278
437
  Object.entries(components).forEach(function (_ref) {
279
438
  var _ref2 = _slicedToArray(_ref, 2),
@@ -284,4 +443,4 @@ var install = function install(app) {
284
443
  });
285
444
  };
286
445
 
287
- export { install as default };
446
+ export { install as default, modalService };
@@ -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) => {