@sfxcode/formkit-primevue 0.5.3 → 0.7.0

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.
@@ -1,34 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
1
  import { defineComponent, getCurrentInstance, watch, watchEffect, reactive, h, ref, inject, computed, provide, toRef, onUnmounted, isRef, isReactive, toRaw, markRaw, createTextVNode, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, createCommentVNode, createVNode, createBlock, Fragment, toDisplayString } from "vue";
33
2
  function token() {
34
3
  return Math.random().toString(36).substring(2, 15);
@@ -154,7 +123,7 @@ function rmEscapes(str) {
154
123
  }
155
124
  function nodeProps(...sets) {
156
125
  return sets.reduce((valid, props2) => {
157
- const _a = props2, { value, name, modelValue, config, plugins } = _a, validProps = __objRest(_a, ["value", "name", "modelValue", "config", "plugins"]);
126
+ const { value, name, modelValue, config, plugins, ...validProps } = props2;
158
127
  return Object.assign(valid, validProps);
159
128
  }, {});
160
129
  }
@@ -312,9 +281,9 @@ function createEmitter() {
312
281
  return;
313
282
  }
314
283
  if (listeners.has(event.name)) {
315
- listeners.get(event.name).forEach((wrapper) => {
316
- if (event.origin === node || wrapper.modifiers.includes("deep")) {
317
- wrapper.listener(event);
284
+ listeners.get(event.name).forEach((wrapper2) => {
285
+ if (event.origin === node || wrapper2.modifiers.includes("deep")) {
286
+ wrapper2.listener(event);
318
287
  }
319
288
  });
320
289
  }
@@ -325,13 +294,13 @@ function createEmitter() {
325
294
  emitter.on = (eventName, listener) => {
326
295
  const [event, ...modifiers] = eventName.split(".");
327
296
  const receipt = listener.receipt || token();
328
- const wrapper = {
297
+ const wrapper2 = {
329
298
  modifiers,
330
299
  event,
331
300
  listener,
332
301
  receipt
333
302
  };
334
- listeners.has(event) ? listeners.get(event).push(wrapper) : listeners.set(event, [wrapper]);
303
+ listeners.has(event) ? listeners.get(event).push(wrapper2) : listeners.set(event, [wrapper2]);
335
304
  receipts2.has(receipt) ? receipts2.get(receipt).push(event) : receipts2.set(receipt, [event]);
336
305
  return receipt;
337
306
  };
@@ -341,7 +310,7 @@ function createEmitter() {
341
310
  (_a = receipts2.get(receipt)) === null || _a === void 0 ? void 0 : _a.forEach((event) => {
342
311
  const eventListeners = listeners.get(event);
343
312
  if (Array.isArray(eventListeners)) {
344
- listeners.set(event, eventListeners.filter((wrapper) => wrapper.receipt !== receipt));
313
+ listeners.set(event, eventListeners.filter((wrapper2) => wrapper2.receipt !== receipt));
345
314
  }
346
315
  });
347
316
  receipts2.delete(receipt);
@@ -410,13 +379,14 @@ function error(code, data = {}) {
410
379
  throw Error(errorHandler.dispatch({ code, data }).message);
411
380
  }
412
381
  function createMessage(conf, node) {
413
- const m = __spreadValues({
382
+ const m = {
414
383
  blocking: false,
415
384
  key: token(),
416
385
  meta: {},
417
386
  type: "state",
418
- visible: true
419
- }, conf);
387
+ visible: true,
388
+ ...conf
389
+ };
420
390
  if (node && m.value && m.meta.localize !== false) {
421
391
  m.value = node.t(m);
422
392
  m.meta.locale = node.config.locale;
@@ -498,7 +468,7 @@ function setMessage(messageStore, store, node, message2) {
498
468
  }
499
469
  function touchMessages(messageStore, store) {
500
470
  for (const key in messageStore) {
501
- const message2 = __spreadValues({}, messageStore[key]);
471
+ const message2 = { ...messageStore[key] };
502
472
  store.set(message2);
503
473
  }
504
474
  }
@@ -758,7 +728,7 @@ function clearState(node) {
758
728
  if (message2.type === "error" || message2.type === "ui" && key === "incomplete") {
759
729
  n.store.remove(key);
760
730
  } else if (message2.type === "state") {
761
- n.store.set(__spreadProps(__spreadValues({}, message2), { value: false }));
731
+ n.store.set({ ...message2, value: false });
762
732
  }
763
733
  }
764
734
  };
@@ -994,6 +964,14 @@ function define(node, context, definition) {
994
964
  type: node.type,
995
965
  value: context.value
996
966
  });
967
+ if (definition.forceTypeProp) {
968
+ if (node.props.type)
969
+ node.props.originalType = node.props.type;
970
+ context.props.type = definition.forceTypeProp;
971
+ }
972
+ if (definition.family) {
973
+ context.props.family = definition.family;
974
+ }
997
975
  if (definition.features) {
998
976
  definition.features.forEach((feature) => feature(node));
999
977
  }
@@ -1005,7 +983,7 @@ function define(node, context, definition) {
1005
983
  function addProps(node, context, props2) {
1006
984
  var _a;
1007
985
  if (node.props.attrs) {
1008
- const attrs = __spreadValues({}, node.props.attrs);
986
+ const attrs = { ...node.props.attrs };
1009
987
  node.props._emit = false;
1010
988
  for (const attr in attrs) {
1011
989
  const camelName = camel(attr);
@@ -1314,15 +1292,16 @@ function resetValue(node, _context, value) {
1314
1292
  }
1315
1293
  function setErrors$1(node, _context, localErrors, childErrors) {
1316
1294
  const sourceKey = `${node.name}-set`;
1317
- createMessages(node, localErrors, childErrors).forEach((errors2) => {
1318
- node.store.apply(errors2, (message2) => message2.meta.source === sourceKey);
1295
+ const errors2 = node.hook.setErrors.dispatch({ localErrors, childErrors });
1296
+ createMessages(node, errors2.localErrors, errors2.childErrors).forEach((errors3) => {
1297
+ node.store.apply(errors3, (message2) => message2.meta.source === sourceKey);
1319
1298
  });
1320
1299
  return node;
1321
1300
  }
1322
- function clearErrors$1(node, context, clearChildErrors = true) {
1301
+ function clearErrors$1(node, context, clearChildErrors = true, sourceKey) {
1323
1302
  setErrors$1(node, context, []);
1324
1303
  if (clearChildErrors) {
1325
- const sourceKey = `${node.name}-set`;
1304
+ sourceKey = sourceKey || `${node.name}-set`;
1326
1305
  node.walk((child) => {
1327
1306
  child.store.filter((message2) => {
1328
1307
  return !(message2.type === "error" && message2.meta && message2.meta.source === sourceKey);
@@ -1489,11 +1468,11 @@ function sugar(node) {
1489
1468
  };
1490
1469
  }
1491
1470
  if (isSugar(node)) {
1492
- const _a = node, { $formkit: type, for: iterator, if: condition, children, key, bind } = _a, props2 = __objRest(_a, ["$formkit", "for", "if", "children", "key", "bind"]);
1471
+ const { $formkit: type, for: iterator, if: condition, children, bind, ...props2 } = node;
1493
1472
  return Object.assign({
1494
1473
  $cmp: "FormKit",
1495
- props: __spreadProps(__spreadValues({}, props2), { type })
1496
- }, condition ? { if: condition } : {}, iterator ? { for: iterator } : {}, children ? { children } : {}, key ? { key } : {}, bind ? { bind } : {});
1474
+ props: { ...props2, type }
1475
+ }, condition ? { if: condition } : {}, iterator ? { for: iterator } : {}, children ? { children } : {}, bind ? { bind } : {});
1497
1476
  }
1498
1477
  return node;
1499
1478
  }
@@ -1768,64 +1747,56 @@ function compile(expr) {
1768
1747
  provide: provide2
1769
1748
  });
1770
1749
  }
1771
- const outer = composable("outer", () => ({
1750
+ const FORMKIT_VERSION = "1.0.0-beta.10";
1751
+ const outer = createSection("outer", () => ({
1772
1752
  $el: "div",
1773
1753
  attrs: {
1774
- class: "$classes.outer",
1754
+ key: "$id",
1755
+ "data-family": "$family || undefined",
1775
1756
  "data-type": "$type",
1776
- "data-multiple": "$attrs.multiple",
1757
+ "data-multiple": '$attrs.multiple || ($type != "select" && $options != undefined) || undefined',
1777
1758
  "data-disabled": "$disabled || undefined",
1778
1759
  "data-complete": "$state.complete || undefined",
1779
1760
  "data-invalid": "$state.valid === false && $state.validationVisible || undefined",
1780
1761
  "data-errors": "$state.errors || undefined",
1781
- "data-submitted": "$state.submitted || undefined"
1782
- }
1783
- }));
1784
- const wrapper$2 = composable("wrapper", () => ({
1785
- $el: "div",
1786
- attrs: {
1787
- class: "$classes.wrapper"
1788
- }
1789
- }));
1790
- const inner = composable("inner", () => ({
1791
- $el: "div",
1762
+ "data-submitted": "$state.submitted || undefined",
1763
+ "data-prefix-icon": "$_rawPrefixIcon !== undefined || undefined",
1764
+ "data-suffix-icon": "$_rawSuffixIcon !== undefined || undefined",
1765
+ "data-prefix-icon-click": "$onPrefixIconClick !== undefined || undefined",
1766
+ "data-suffix-icon-click": "$onSuffixIconClick !== undefined || undefined"
1767
+ }
1768
+ }), true);
1769
+ const inner = createSection("inner", "div");
1770
+ const wrapper = createSection("wrapper", "div");
1771
+ const label = createSection("label", () => ({
1772
+ $el: "label",
1773
+ if: "$label",
1792
1774
  attrs: {
1793
- class: "$classes.inner"
1775
+ for: "$id"
1794
1776
  }
1795
1777
  }));
1796
- const help = (schema = {}, children = [], target = "help", cond = "$help") => ({
1797
- if: `$slots.${target}`,
1798
- then: `$slots.${target}`,
1799
- else: extend({
1800
- $el: "div",
1801
- attrs: {
1802
- id: `$: "help-" + ${target == "optionHelp" ? "$option.attrs.id" : "$id"}`,
1803
- class: `$classes.${target}`
1804
- },
1805
- if: cond,
1806
- children
1807
- }, schema)
1808
- });
1809
- const messages = composable("messages", () => ({
1778
+ const messages = createSection("messages", () => ({
1810
1779
  $el: "ul",
1811
- if: "$fns.length($messages)",
1812
- attrs: {
1813
- class: "$classes.messages",
1814
- "aria-live": '$type === "form" && "assertive" || "polite"'
1815
- }
1780
+ if: "$fns.length($messages)"
1816
1781
  }));
1817
- const message = composable("message", () => ({
1782
+ const message = createSection("message", () => ({
1818
1783
  $el: "li",
1819
1784
  for: ["message", "$messages"],
1820
1785
  attrs: {
1821
1786
  key: "$message.key",
1822
- class: "$classes.message",
1823
1787
  id: `$id + '-' + $message.key`,
1824
1788
  "data-message-type": "$message.type"
1825
1789
  }
1826
1790
  }));
1827
- const prefix = composable("prefix", () => ({ $el: null }));
1828
- const suffix = composable("suffix", () => ({ $el: null }));
1791
+ const prefix = createSection("prefix", null);
1792
+ const suffix = createSection("suffix", null);
1793
+ const help = createSection("help", () => ({
1794
+ $el: "div",
1795
+ if: "$help",
1796
+ attrs: {
1797
+ id: '$: "help-" + $id'
1798
+ }
1799
+ }));
1829
1800
  function isSchemaObject(schema) {
1830
1801
  return typeof schema === "object" && ("$el" in schema || "$cmp" in schema || "$formkit" in schema);
1831
1802
  }
@@ -1837,56 +1808,43 @@ function extendSchema(schema, extension = {}) {
1837
1808
  }
1838
1809
  return extend(schema, extension);
1839
1810
  }
1840
- function composable(key, schema) {
1841
- return (extendWith = {}, children = void 0) => {
1842
- const root = typeof schema === "function" ? schema(children) : typeof schema === "object" ? clone(schema) : schema;
1843
- const isObj = isSchemaObject(root);
1844
- if (isObj && !("children" in root) && children) {
1845
- if (Array.isArray(children)) {
1846
- if (children.length) {
1847
- root.children = children;
1811
+ function useSchema(inputSection) {
1812
+ return outer(wrapper(label("$label"), inner(prefix(), inputSection(), suffix())), help("$help"), messages(message("$message.value")));
1813
+ }
1814
+ function createSection(section, el, root = false) {
1815
+ return (...children) => {
1816
+ const extendable = (extensions) => {
1817
+ const node = !el || typeof el === "string" ? { $el: el } : el();
1818
+ if (isDOM(node) || isComponent$1(node)) {
1819
+ if (!node.meta) {
1820
+ node.meta = { section };
1821
+ }
1822
+ if (children.length && !node.children) {
1823
+ node.children = [
1824
+ ...children.map((child) => typeof child === "string" ? child : child(extensions))
1825
+ ];
1826
+ }
1827
+ if (isDOM(node)) {
1828
+ node.attrs = {
1829
+ class: `$classes.${section}`,
1830
+ ...node.attrs || {}
1831
+ };
1848
1832
  }
1849
- } else {
1850
- root.children = [children];
1851
1833
  }
1852
- }
1853
- const extended = extendSchema(root, extendWith);
1854
- return {
1855
- if: `$slots.${key}`,
1856
- then: `$slots.${key}`,
1857
- else: Array.isArray(extended) ? extended : [extended]
1834
+ return {
1835
+ if: `$slots.${section}`,
1836
+ then: `$slots.${section}`,
1837
+ else: section in extensions ? extendSchema(node, extensions[section]) : node
1838
+ };
1858
1839
  };
1840
+ return root ? createRoot(extendable) : extendable;
1859
1841
  };
1860
1842
  }
1861
- function useSchema(inputSchema) {
1862
- return (extensions = {}) => {
1863
- const input2 = composable("input", inputSchema)(extensions.input);
1864
- return [
1865
- outer(extensions.outer, [
1866
- wrapper$2(extensions.wrapper, [
1867
- label(extensions.label, "$label"),
1868
- inner(extensions.inner, [
1869
- prefix(extensions.prefix),
1870
- ...Array.isArray(input2) ? input2 : [input2],
1871
- suffix(extensions.suffix)
1872
- ])
1873
- ]),
1874
- help(extensions.help, "$help"),
1875
- messages(extensions.messages, [
1876
- message(extensions.message, "$message.value")
1877
- ])
1878
- ])
1879
- ];
1843
+ function createRoot(rootSection) {
1844
+ return (extensions) => {
1845
+ return [rootSection(extensions)];
1880
1846
  };
1881
1847
  }
1882
- const label = composable("label", () => ({
1883
- $el: "label",
1884
- if: "$label",
1885
- attrs: {
1886
- for: "$id",
1887
- class: "$classes.label"
1888
- }
1889
- }));
1890
1848
  createMessage({
1891
1849
  type: "state",
1892
1850
  blocking: true,
@@ -1894,6 +1852,88 @@ createMessage({
1894
1852
  value: true,
1895
1853
  key: "validating"
1896
1854
  });
1855
+ let documentStyles = void 0;
1856
+ const themeLoaded = new Promise((res) => {
1857
+ });
1858
+ const isClient = typeof window !== "undefined" && typeof fetch !== "undefined";
1859
+ documentStyles = isClient ? getComputedStyle(document.documentElement) : void 0;
1860
+ const iconRegistry = {};
1861
+ const iconRequests = {};
1862
+ function createIconHandler(iconLoader, iconLoaderUrl) {
1863
+ return (iconName) => {
1864
+ if (typeof iconName === "boolean") {
1865
+ return;
1866
+ }
1867
+ if (iconName.startsWith("<svg")) {
1868
+ return iconName;
1869
+ }
1870
+ if (typeof iconName !== "string")
1871
+ return;
1872
+ const icon = iconRegistry[iconName];
1873
+ const isDefault = iconName.startsWith("default:");
1874
+ iconName = isDefault ? iconName.split(":")[1] : iconName;
1875
+ let loadedIcon = void 0;
1876
+ if (icon || iconName in iconRegistry) {
1877
+ return icon;
1878
+ } else if (!iconRequests[iconName]) {
1879
+ loadedIcon = getIconFromStylesheet(iconName);
1880
+ loadedIcon = isClient && typeof loadedIcon === "undefined" ? Promise.resolve(loadedIcon) : loadedIcon;
1881
+ if (loadedIcon instanceof Promise) {
1882
+ iconRequests[iconName] = loadedIcon.then((iconValue) => {
1883
+ if (!iconValue && typeof iconName === "string" && !isDefault) {
1884
+ return loadedIcon = typeof iconLoader === "function" ? iconLoader(iconName) : getRemoteIcon(iconName, iconLoaderUrl);
1885
+ }
1886
+ return iconValue;
1887
+ }).then((finalIcon) => {
1888
+ if (typeof iconName === "string") {
1889
+ iconRegistry[isDefault ? `default:${iconName}` : iconName] = finalIcon;
1890
+ }
1891
+ return finalIcon;
1892
+ });
1893
+ } else if (typeof loadedIcon === "string") {
1894
+ iconRegistry[isDefault ? `default:${iconName}` : iconName] = loadedIcon;
1895
+ return loadedIcon;
1896
+ }
1897
+ }
1898
+ return iconRequests[iconName];
1899
+ };
1900
+ }
1901
+ function getIconFromStylesheet(iconName) {
1902
+ if (!isClient)
1903
+ return;
1904
+ {
1905
+ return themeLoaded.then(() => {
1906
+ return loadStylesheetIcon(iconName);
1907
+ });
1908
+ }
1909
+ }
1910
+ function loadStylesheetIcon(iconName) {
1911
+ const cssVarIcon = documentStyles === null || documentStyles === void 0 ? void 0 : documentStyles.getPropertyValue(`--fk-icon-${iconName}`);
1912
+ if (cssVarIcon) {
1913
+ const icon = atob(cssVarIcon);
1914
+ if (icon.startsWith("<svg")) {
1915
+ iconRegistry[iconName] = icon;
1916
+ return icon;
1917
+ }
1918
+ }
1919
+ return void 0;
1920
+ }
1921
+ function getRemoteIcon(iconName, iconLoaderUrl) {
1922
+ const formkitVersion = FORMKIT_VERSION.startsWith("__") ? "latest" : FORMKIT_VERSION;
1923
+ const fetchUrl = typeof iconLoaderUrl === "function" ? iconLoaderUrl(iconName) : `https://cdn.jsdelivr.net/npm/@formkit/icons@${formkitVersion}/dist/icons/${iconName}.svg`;
1924
+ if (!isClient)
1925
+ return void 0;
1926
+ return fetch(`${fetchUrl}`).then(async (r) => {
1927
+ const icon = await r.text();
1928
+ if (icon.startsWith("<svg")) {
1929
+ return icon;
1930
+ }
1931
+ return void 0;
1932
+ }).catch((e) => {
1933
+ console.error(e);
1934
+ return void 0;
1935
+ });
1936
+ }
1897
1937
  let registered = false;
1898
1938
  const errors = {
1899
1939
  100: ({ data: node }) => `Only groups, lists, and forms can have children (${node.name}).`,
@@ -1915,7 +1955,8 @@ const warnings = {
1915
1955
  350: ({ data: node }) => `Invalid options prop for radio input (${node.name}). See https://formkit.com/inputs/radio`,
1916
1956
  650: 'Schema "$get()" must use the id of an input to access.',
1917
1957
  651: ({ data: id }) => `Cannot setErrors() on "${id}" because no such id exists.`,
1918
- 652: ({ data: id }) => `Cannot clearErrors() on "${id}" because no such id exists.`
1958
+ 652: ({ data: id }) => `Cannot clearErrors() on "${id}" because no such id exists.`,
1959
+ 800: ({ data: name }) => `${name} is deprecated.`
1919
1960
  };
1920
1961
  const decodeErrors = (error2, next) => {
1921
1962
  if (error2.code in errors) {
@@ -2061,7 +2102,7 @@ function parseSchema(library, schema) {
2061
2102
  }
2062
2103
  }
2063
2104
  return () => {
2064
- const attrs = {};
2105
+ const attrs = Array.isArray(unparsedAttrs) ? [] : {};
2065
2106
  setters.forEach((setter) => setter(attrs));
2066
2107
  return attrs;
2067
2108
  };
@@ -2196,14 +2237,18 @@ function parseSchema(library, schema) {
2196
2237
  return null;
2197
2238
  const instanceScope = instanceScopes.get(instanceKey) || [];
2198
2239
  for (const key in values) {
2199
- const iterationData = Object.defineProperty(__spreadValues(__spreadProps(__spreadValues({}, instanceScope.reduce((previousIterationData, scopedData) => {
2200
- if (previousIterationData.__idata) {
2201
- return __spreadValues(__spreadValues({}, previousIterationData), scopedData);
2202
- }
2203
- return scopedData;
2204
- }, {})), {
2205
- [valueName]: values[key]
2206
- }), keyName !== null ? { [keyName]: key } : {}), "__idata", { enumerable: false, value: true });
2240
+ if (Array.isArray(values) && key === "length")
2241
+ continue;
2242
+ const iterationData = Object.defineProperty({
2243
+ ...instanceScope.reduce((previousIterationData, scopedData) => {
2244
+ if (previousIterationData.__idata) {
2245
+ return { ...previousIterationData, ...scopedData };
2246
+ }
2247
+ return scopedData;
2248
+ }, {}),
2249
+ [valueName]: values[key],
2250
+ ...keyName !== null ? { [keyName]: key } : {}
2251
+ }, "__idata", { enumerable: false, value: true });
2207
2252
  instanceScope.unshift(iterationData);
2208
2253
  fragment.push(repeatedNode.bind(null, iterationData)());
2209
2254
  instanceScope.shift();
@@ -2406,7 +2451,8 @@ defineComponent({
2406
2451
  "update:modelValue": (_value) => true,
2407
2452
  node: (node) => !!node,
2408
2453
  submit: (_data, _node) => true,
2409
- submitRaw: (_event, _node) => true
2454
+ submitRaw: (_event, _node) => true,
2455
+ submitInvalid: (_node) => true
2410
2456
  },
2411
2457
  inheritAttrs: false,
2412
2458
  setup(props2, context) {
@@ -2418,7 +2464,7 @@ defineComponent({
2418
2464
  var _a;
2419
2465
  return h((_a = node.props.definition) === null || _a === void 0 ? void 0 : _a.component, {
2420
2466
  context: node.context
2421
- }, __spreadValues({}, context.slots));
2467
+ }, { ...context.slots });
2422
2468
  };
2423
2469
  }
2424
2470
  const schema = ref([]);
@@ -2427,14 +2473,14 @@ defineComponent({
2427
2473
  const schemaDefinition = (_b = (_a = node.props) === null || _a === void 0 ? void 0 : _a.definition) === null || _b === void 0 ? void 0 : _b.schema;
2428
2474
  if (!schemaDefinition)
2429
2475
  error(601, node);
2430
- schema.value = typeof schemaDefinition === "function" ? schemaDefinition(__spreadValues({}, props2.sectionsSchema)) : schemaDefinition;
2476
+ schema.value = typeof schemaDefinition === "function" ? schemaDefinition({ ...props2.sectionsSchema }) : schemaDefinition;
2431
2477
  };
2432
2478
  generateSchema();
2433
2479
  node.on("schema", generateSchema);
2434
2480
  context.emit("node", node);
2435
2481
  const library = node.props.definition.library;
2436
2482
  context.expose({ node });
2437
- return () => h(FormKitSchema, { schema: schema.value, data: node.context, library }, __spreadValues({}, context.slots));
2483
+ return () => h(FormKitSchema, { schema: schema.value, data: node.context, library }, { ...context.slots });
2438
2484
  }
2439
2485
  });
2440
2486
  const optionsSymbol = Symbol.for("FormKitOptions");
@@ -2540,7 +2586,10 @@ const pseudoProps = [
2540
2586
  "preserve",
2541
2587
  /^preserve(-e|E)rrors/,
2542
2588
  /^[a-z]+(?:-visibility|Visibility)$/,
2543
- /^[a-zA-Z-]+(?:-class|Class)$/
2589
+ /^[a-zA-Z-]+(?:-class|Class)$/,
2590
+ "prefixIcon",
2591
+ "suffixIcon",
2592
+ /^[a-zA-Z-]+(?:-icon|Icon)$/
2544
2593
  ];
2545
2594
  function classesToNodeProps(node, props2) {
2546
2595
  if (props2.classes) {
@@ -2556,7 +2605,7 @@ function classesToNodeProps(node, props2) {
2556
2605
  function onlyListeners(props2) {
2557
2606
  if (!props2)
2558
2607
  return {};
2559
- const knownListeners = ["Submit", "SubmitRaw"].reduce((listeners, listener) => {
2608
+ const knownListeners = ["Submit", "SubmitRaw", "SubmitInvalid"].reduce((listeners, listener) => {
2560
2609
  const name = `on${listener}`;
2561
2610
  if (name in props2) {
2562
2611
  if (typeof props2[name] === "function") {
@@ -2574,7 +2623,10 @@ function useInput(props2, context, options = {}) {
2574
2623
  const isVModeled = props2.modelValue !== void 0;
2575
2624
  const value = props2.modelValue !== void 0 ? props2.modelValue : cloneAny(context.attrs.value);
2576
2625
  function createInitialProps() {
2577
- const initialProps2 = __spreadValues(__spreadValues({}, nodeProps(props2)), listeners);
2626
+ const initialProps2 = {
2627
+ ...nodeProps(props2),
2628
+ ...listeners
2629
+ };
2578
2630
  const attrs = except(nodeProps(context.attrs), pseudoProps);
2579
2631
  initialProps2.attrs = attrs;
2580
2632
  const propValues = only(nodeProps(context.attrs), pseudoProps);
@@ -2660,6 +2712,8 @@ function useInput(props2, context, options = {}) {
2660
2712
  const sourceKey = `${node.name}-prop`;
2661
2713
  watchEffect(() => {
2662
2714
  const keys = Object.keys(props2.inputErrors);
2715
+ if (!keys.length)
2716
+ node.clearErrors(true, sourceKey);
2663
2717
  const messages2 = keys.reduce((messages3, key) => {
2664
2718
  let value2 = props2.inputErrors[key];
2665
2719
  if (typeof value2 === "string")
@@ -2717,27 +2771,87 @@ function isComponent(obj) {
2717
2771
  return typeof obj === "function" && obj.length === 2 || typeof obj === "object" && !Array.isArray(obj) && !("$el" in obj) && !("$cmp" in obj) && !("if" in obj);
2718
2772
  }
2719
2773
  function createInput(schemaOrComponent, definitionOptions = {}) {
2720
- const definition = __spreadValues({
2721
- type: "input"
2722
- }, definitionOptions);
2723
- let schema = void 0;
2774
+ const definition = {
2775
+ type: "input",
2776
+ ...definitionOptions
2777
+ };
2778
+ let schema;
2724
2779
  if (isComponent(schemaOrComponent)) {
2725
2780
  const cmpName = `SchemaComponent${totalCreated++}`;
2726
- schema = () => ({
2781
+ schema = createSection("input", () => ({
2727
2782
  $cmp: cmpName,
2728
2783
  props: {
2729
2784
  context: "$node.context"
2730
2785
  }
2731
- });
2786
+ }));
2732
2787
  definition.library = { [cmpName]: markRaw(schemaOrComponent) };
2733
- } else {
2788
+ } else if (typeof schemaOrComponent === "function") {
2734
2789
  schema = schemaOrComponent;
2790
+ } else {
2791
+ schema = createSection("input", () => cloneAny(schemaOrComponent));
2735
2792
  }
2736
2793
  definition.schema = useSchema(schema || "Schema undefined");
2737
2794
  return definition;
2738
2795
  }
2739
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
2740
- name: "PrimeInputText",
2796
+ defineComponent({
2797
+ name: "FormKitIcon",
2798
+ props: {
2799
+ icon: {
2800
+ type: String,
2801
+ default: ""
2802
+ },
2803
+ iconLoader: {
2804
+ type: Function,
2805
+ default: null
2806
+ },
2807
+ iconLoaderUrl: {
2808
+ type: Function,
2809
+ default: null
2810
+ }
2811
+ },
2812
+ setup(props2) {
2813
+ var _a, _b;
2814
+ const icon = ref(void 0);
2815
+ const config = inject(optionsSymbol, {});
2816
+ const parent = inject(parentSymbol, null);
2817
+ let iconHandler = void 0;
2818
+ if (props2.iconLoader && typeof props2.iconLoader === "function") {
2819
+ iconHandler = createIconHandler(props2.iconLoader);
2820
+ } else if (parent && ((_a = parent.props) === null || _a === void 0 ? void 0 : _a.iconLoader)) {
2821
+ iconHandler = createIconHandler(parent.props.iconLoader);
2822
+ } else if (props2.iconLoaderUrl && typeof props2.iconLoaderUrl === "function") {
2823
+ iconHandler = createIconHandler(iconHandler, props2.iconLoaderUrl);
2824
+ } else {
2825
+ const iconPlugin = (_b = config === null || config === void 0 ? void 0 : config.plugins) === null || _b === void 0 ? void 0 : _b.find((plugin) => {
2826
+ return typeof plugin.iconHandler === "function";
2827
+ });
2828
+ if (iconPlugin) {
2829
+ iconHandler = iconPlugin.iconHandler;
2830
+ }
2831
+ }
2832
+ if (iconHandler && typeof iconHandler === "function") {
2833
+ const iconOrPromise = iconHandler(props2.icon);
2834
+ if (iconOrPromise instanceof Promise) {
2835
+ iconOrPromise.then((iconValue) => {
2836
+ icon.value = iconValue;
2837
+ });
2838
+ } else {
2839
+ icon.value = iconOrPromise;
2840
+ }
2841
+ }
2842
+ return () => {
2843
+ if (icon.value) {
2844
+ return h("span", {
2845
+ class: "formkit-icon",
2846
+ innerHTML: icon.value
2847
+ });
2848
+ }
2849
+ return null;
2850
+ };
2851
+ }
2852
+ });
2853
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2854
+ __name: "PrimeInputText",
2741
2855
  props: {
2742
2856
  context: Object
2743
2857
  },
@@ -3031,8 +3145,8 @@ var consola_browser = { exports: {} };
3031
3145
  });
3032
3146
  })(consola_browser);
3033
3147
  var consola = consola_browser.exports;
3034
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
3035
- name: "PrimeInputNumber",
3148
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3149
+ __name: "PrimeInputNumber",
3036
3150
  props: {
3037
3151
  context: Object
3038
3152
  },
@@ -3068,8 +3182,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3068
3182
  };
3069
3183
  }
3070
3184
  });
3071
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
3072
- name: "PrimeInputMask",
3185
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3186
+ __name: "PrimeInputMask",
3073
3187
  props: {
3074
3188
  context: Object
3075
3189
  },
@@ -3098,8 +3212,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3098
3212
  };
3099
3213
  }
3100
3214
  });
3101
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3102
- name: "PrimePassword",
3215
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3216
+ __name: "PrimePassword",
3103
3217
  props: {
3104
3218
  context: Object
3105
3219
  },
@@ -3125,8 +3239,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3125
3239
  };
3126
3240
  }
3127
3241
  });
3128
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3129
- name: "PrimeInputTextArea",
3242
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3243
+ __name: "PrimeInputTextArea",
3130
3244
  props: {
3131
3245
  context: Object
3132
3246
  },
@@ -3159,8 +3273,8 @@ const _hoisted_2$1 = {
3159
3273
  key: 1,
3160
3274
  class: "formkit-prime-right"
3161
3275
  };
3162
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3163
- name: "PrimeCheckBox",
3276
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3277
+ __name: "PrimeCheckBox",
3164
3278
  props: {
3165
3279
  context: Object
3166
3280
  },
@@ -3196,8 +3310,8 @@ const _hoisted_2 = {
3196
3310
  key: 1,
3197
3311
  class: "formkit-prime-right"
3198
3312
  };
3199
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3200
- name: "PrimeInputSwitch",
3313
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3314
+ __name: "PrimeInputSwitch",
3201
3315
  props: {
3202
3316
  context: Object
3203
3317
  },
@@ -3227,8 +3341,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3227
3341
  };
3228
3342
  }
3229
3343
  });
3230
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3231
- name: "PrimeEditor",
3344
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3345
+ __name: "PrimeEditor",
3232
3346
  props: {
3233
3347
  context: Object
3234
3348
  },
@@ -3250,8 +3364,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3250
3364
  };
3251
3365
  }
3252
3366
  });
3253
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3254
- name: "PrimeDropdown",
3367
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3368
+ __name: "PrimeDropdown",
3255
3369
  props: {
3256
3370
  context: Object
3257
3371
  },
@@ -3280,8 +3394,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3280
3394
  };
3281
3395
  }
3282
3396
  });
3283
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3284
- name: "PrimeMultiSelect",
3397
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3398
+ __name: "PrimeMultiSelect",
3285
3399
  props: {
3286
3400
  context: Object
3287
3401
  },
@@ -3310,8 +3424,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3310
3424
  };
3311
3425
  }
3312
3426
  });
3313
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3314
- name: "PrimeCalendar",
3427
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3428
+ __name: "PrimeCalendar",
3315
3429
  props: {
3316
3430
  context: Object
3317
3431
  },
@@ -3340,8 +3454,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3340
3454
  };
3341
3455
  }
3342
3456
  });
3343
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3344
- name: "PrimeSlider",
3457
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3458
+ __name: "PrimeSlider",
3345
3459
  props: {
3346
3460
  context: Object
3347
3461
  },
@@ -3368,8 +3482,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3368
3482
  };
3369
3483
  }
3370
3484
  });
3371
- const _sfc_main = /* @__PURE__ */ defineComponent({
3372
- name: "PrimeRating",
3485
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3486
+ __name: "PrimeRating",
3373
3487
  props: {
3374
3488
  context: Object
3375
3489
  },
@@ -3396,43 +3510,112 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3396
3510
  };
3397
3511
  }
3398
3512
  });
3399
- const primeInputTextDefinition = createInput(_sfc_main$c, {
3513
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3514
+ __name: "PrimeChips",
3515
+ props: {
3516
+ context: Object
3517
+ },
3518
+ setup(__props) {
3519
+ const props2 = __props;
3520
+ const context = props2.context;
3521
+ function handleInput(e) {
3522
+ var _a;
3523
+ context == null ? void 0 : context.node.input((_a = props2.context) == null ? void 0 : _a._value);
3524
+ }
3525
+ return (_ctx, _cache) => {
3526
+ var _a, _b, _c;
3527
+ const _component_Chips = resolveComponent("Chips");
3528
+ return openBlock(), createBlock(_component_Chips, {
3529
+ id: unref(context).id,
3530
+ modelValue: unref(context)._value,
3531
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
3532
+ class: normalizeClass(unref(context).attrs.class),
3533
+ "allow-duplicate": (_a = unref(context).attrs.allowDuplicate) != null ? _a : true,
3534
+ "add-on-blur": (_b = unref(context).attrs.addOnBlur) != null ? _b : false,
3535
+ max: (_c = unref(context).attrs.max) != null ? _c : void 0,
3536
+ onAdd: handleInput,
3537
+ onRemove: handleInput
3538
+ }, null, 8, ["id", "modelValue", "class", "allow-duplicate", "add-on-blur", "max"]);
3539
+ };
3540
+ }
3541
+ });
3542
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3543
+ __name: "PrimeKnob",
3544
+ props: {
3545
+ context: Object
3546
+ },
3547
+ setup(__props) {
3548
+ const props2 = __props;
3549
+ const context = props2.context;
3550
+ function handleInput(e) {
3551
+ var _a;
3552
+ context == null ? void 0 : context.node.input((_a = props2.context) == null ? void 0 : _a._value);
3553
+ }
3554
+ return (_ctx, _cache) => {
3555
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
3556
+ const _component_Knob = resolveComponent("Knob");
3557
+ return openBlock(), createBlock(_component_Knob, {
3558
+ id: unref(context).id,
3559
+ modelValue: unref(context)._value,
3560
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
3561
+ min: (_a = unref(context).attrs.min) != null ? _a : 0,
3562
+ max: (_b = unref(context).attrs.max) != null ? _b : 100,
3563
+ step: (_c = unref(context).attrs.step) != null ? _c : void 0,
3564
+ size: (_d = unref(context).attrs.max) != null ? _d : 100,
3565
+ "stroke-width": (_e = unref(context).attrs.strokeWidth) != null ? _e : 14,
3566
+ "show-value": (_f = unref(context).attrs.showValue) != null ? _f : true,
3567
+ "value-color": (_g = unref(context).attrs.valueColor) != null ? _g : void 0,
3568
+ "range-color": (_h = unref(context).attrs.rangeColor) != null ? _h : void 0,
3569
+ "text-color": (_i = unref(context).attrs.textColor) != null ? _i : void 0,
3570
+ "value-template": (_j = unref(context).attrs.valueTemplate) != null ? _j : void 0,
3571
+ onChange: handleInput
3572
+ }, null, 8, ["id", "modelValue", "min", "max", "step", "size", "stroke-width", "show-value", "value-color", "range-color", "text-color", "value-template"]);
3573
+ };
3574
+ }
3575
+ });
3576
+ const primeInputTextDefinition = createInput(_sfc_main$e, {
3400
3577
  props: ["iconRight", "iconLeft"]
3401
3578
  });
3402
- const primeInputNumberDefinition = createInput(_sfc_main$b, {
3579
+ const primeInputNumberDefinition = createInput(_sfc_main$d, {
3403
3580
  props: ["iconRight", "iconLeft"]
3404
3581
  });
3405
- const primeInputMaskDefinition = createInput(_sfc_main$a, {
3582
+ const primeInputMaskDefinition = createInput(_sfc_main$c, {
3406
3583
  props: []
3407
3584
  });
3408
- const primePasswordDefinition = createInput(_sfc_main$9, {
3585
+ const primePasswordDefinition = createInput(_sfc_main$b, {
3409
3586
  props: ["feedback", "toggleMask"]
3410
3587
  });
3411
- const primeInputTextAreaDefinition = createInput(_sfc_main$8, {
3588
+ const primeInputTextAreaDefinition = createInput(_sfc_main$a, {
3412
3589
  props: ["rows"]
3413
3590
  });
3414
- const primeCheckBoxDefinition = createInput(_sfc_main$7, {
3591
+ const primeCheckBoxDefinition = createInput(_sfc_main$9, {
3592
+ props: []
3593
+ });
3594
+ const primeInputSwitchDefinition = createInput(_sfc_main$8, {
3595
+ props: []
3596
+ });
3597
+ const primeEditorDefinition = createInput(_sfc_main$7, {
3415
3598
  props: []
3416
3599
  });
3417
- const primeInputSwitchDefinition = createInput(_sfc_main$6, {
3600
+ const primeDropdownDefinition = createInput(_sfc_main$6, {
3418
3601
  props: []
3419
3602
  });
3420
- const primeEditorDefinition = createInput(_sfc_main$5, {
3603
+ const primeMultiSelectDefinition = createInput(_sfc_main$5, {
3421
3604
  props: []
3422
3605
  });
3423
- const primeDropdownDefinition = createInput(_sfc_main$4, {
3606
+ const primeCalendarDefinition = createInput(_sfc_main$4, {
3424
3607
  props: []
3425
3608
  });
3426
- const primeMultiSelectDefinition = createInput(_sfc_main$3, {
3609
+ const primeSliderDefinition = createInput(_sfc_main$3, {
3427
3610
  props: []
3428
3611
  });
3429
- const primeCalendarDefinition = createInput(_sfc_main$2, {
3612
+ const primeRatingDefinition = createInput(_sfc_main$2, {
3430
3613
  props: []
3431
3614
  });
3432
- const primeSliderDefinition = createInput(_sfc_main$1, {
3615
+ const primeChipsDefinition = createInput(_sfc_main$1, {
3433
3616
  props: []
3434
3617
  });
3435
- const primeRatingDefinition = createInput(_sfc_main, {
3618
+ const primeKnobDefinition = createInput(_sfc_main, {
3436
3619
  props: []
3437
3620
  });
3438
3621
  const primeInputs = {
@@ -3447,6 +3630,8 @@ const primeInputs = {
3447
3630
  primeDropdown: primeDropdownDefinition,
3448
3631
  primeMultiSelect: primeMultiSelectDefinition,
3449
3632
  primeCalendar: primeCalendarDefinition,
3450
- primeSlider: primeSliderDefinition
3633
+ primeSlider: primeSliderDefinition,
3634
+ primeChips: primeChipsDefinition,
3635
+ primeKnob: primeKnobDefinition
3451
3636
  };
3452
- export { primeCalendarDefinition, primeCheckBoxDefinition, primeDropdownDefinition, primeEditorDefinition, primeInputMaskDefinition, primeInputNumberDefinition, primeInputSwitchDefinition, primeInputTextAreaDefinition, primeInputTextDefinition, primeInputs, primeMultiSelectDefinition, primePasswordDefinition, primeRatingDefinition, primeSliderDefinition };
3637
+ export { primeCalendarDefinition, primeCheckBoxDefinition, primeChipsDefinition, primeDropdownDefinition, primeEditorDefinition, primeInputMaskDefinition, primeInputNumberDefinition, primeInputSwitchDefinition, primeInputTextAreaDefinition, primeInputTextDefinition, primeInputs, primeKnobDefinition, primeMultiSelectDefinition, primePasswordDefinition, primeRatingDefinition, primeSliderDefinition };