@plitzi/sdk-elements 0.39.3 → 0.39.6

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 (58) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/Element/PluginRemote.mjs +7 -3
  3. package/dist/Element/hooks/useElementState.d.ts +1 -1
  4. package/dist/Element/hooks/useRootElementInteractions.mjs +21 -18
  5. package/dist/components/ElementAdvancedEditor.mjs +4 -4
  6. package/dist/components/MarkdownDocument/MarkdownDocument.mjs +37 -36
  7. package/dist/components/MarkdownDocument/helpers/rehypeTableLabels.d.ts +7 -0
  8. package/dist/components/MarkdownDocument/helpers/rehypeTableLabels.mjs +19 -0
  9. package/dist/components/SettingsSection/SettingsSection.d.ts +19 -0
  10. package/dist/components/SettingsSection/SettingsSection.mjs +37 -0
  11. package/dist/components/SettingsSection/index.d.ts +2 -0
  12. package/dist/components/SettingsSection/index.mjs +1 -0
  13. package/dist/elements/advanced/BlockJsx/declaration.d.ts +1 -1
  14. package/dist/elements/advanced/BlockJsx/declaration.mjs +1 -1
  15. package/dist/elements/advanced/BlockJsx/index.d.ts +1 -1
  16. package/dist/elements/basic/Link/Link.mjs +68 -63
  17. package/dist/elements/basic/Link/Settings.mjs +1 -1
  18. package/dist/elements/basic/Link/usePrefetchInView.d.ts +3 -0
  19. package/dist/elements/basic/Link/usePrefetchInView.mjs +29 -0
  20. package/dist/elements/basic/RichText/Settings.mjs +1 -1
  21. package/dist/elements/declarations/index.d.ts +8 -3
  22. package/dist/elements/form/Form/Form.mjs +1 -1
  23. package/dist/elements/form/FormControl/FormControl.d.ts +7 -1
  24. package/dist/elements/form/FormControl/FormControl.mjs +78 -77
  25. package/dist/elements/form/FormControl/Settings.d.ts +2 -1
  26. package/dist/elements/form/FormControl/Settings.mjs +1 -1
  27. package/dist/elements/form/FormControl/declaration.d.ts +1 -0
  28. package/dist/elements/form/FormControl/declaration.mjs +55 -51
  29. package/dist/elements/form/FormControl/helpers/autofill.d.ts +13 -0
  30. package/dist/elements/form/FormControl/helpers/autofill.mjs +18 -0
  31. package/dist/elements/form/FormControl/index.d.ts +2 -0
  32. package/dist/elements/form/FormControl/inputs/Input.d.ts +2 -1
  33. package/dist/elements/form/FormControl/inputs/Input.mjs +2 -2
  34. package/dist/elements/internal/LayoutContainer/Settings.mjs +1 -1
  35. package/dist/elements/internal/Page/Settings.mjs +323 -285
  36. package/dist/elements/internal/Page/settingsSummary.d.ts +26 -0
  37. package/dist/elements/internal/Page/settingsSummary.mjs +22 -0
  38. package/dist/elements/media/Chart/Chart.mjs +1 -1
  39. package/dist/elements/media/Image/Settings.mjs +2 -2
  40. package/dist/elements/media/Video/Settings.mjs +2 -2
  41. package/dist/elements/provider/ApiContainer/Settings.mjs +6 -6
  42. package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.mjs +1 -1
  43. package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +20 -19
  44. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +20 -19
  45. package/dist/elements/structure/Pagination/Settings.mjs +1 -1
  46. package/dist/elements/structure/TabContainer/TabContainer.mjs +15 -11
  47. package/dist/elements/structure/TabContainer/TabContainerItem/Settings.d.ts +6 -1
  48. package/dist/elements/structure/TabContainer/TabContainerItem/Settings.mjs +24 -3
  49. package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.d.ts +7 -1
  50. package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +66 -38
  51. package/dist/elements/structure/TabContainer/TabContainerItem/declaration.d.ts +6 -2
  52. package/dist/elements/structure/TabContainer/TabContainerItem/declaration.mjs +1 -1
  53. package/dist/elements/structure/TabContainer/TabContainerItem/index.d.ts +6 -2
  54. package/dist/elements/structure/TabContainer/TabContainerItem/openTabFromHash.d.ts +10 -0
  55. package/dist/elements/structure/TabContainer/TabContainerItem/openTabFromHash.mjs +18 -0
  56. package/dist/elements/structure/TabContainer/index.d.ts +6 -2
  57. package/dist/index.d.ts +8 -3
  58. package/package.json +12 -12
@@ -1,90 +1,95 @@
1
1
  import { ariaCurrent as e } from "./ariaCurrent.mjs";
2
- import t from "../../../Element/ElementWords.mjs";
3
- import n from "../../../Element/hocs/withElement.mjs";
4
- import r from "../../../Element/hooks/useElement.mjs";
5
- import { RootElement as i } from "../../../Element/RootElement.mjs";
6
- import { useMemo as a } from "react";
7
- import { usePlitzi as o } from "@plitzi/sdk-shared/hooks";
8
- import { useSdkStore as s } from "@plitzi/sdk-shared/store";
9
- import { processTwig as c } from "@plitzi/sdk-shared/helpers/twigWrapper";
10
- import { jsx as l } from "react/jsx-runtime";
11
- import u from "clsx";
12
- import { getPageFullPath as d } from "@plitzi/sdk-navigation";
2
+ import t from "./usePrefetchInView.mjs";
3
+ import n from "../../../Element/ElementWords.mjs";
4
+ import r from "../../../Element/hocs/withElement.mjs";
5
+ import i from "../../../Element/hooks/useElement.mjs";
6
+ import { RootElement as a } from "../../../Element/RootElement.mjs";
7
+ import { useMemo as o } from "react";
8
+ import { usePlitzi as s } from "@plitzi/sdk-shared/hooks";
9
+ import { useSdkStore as c } from "@plitzi/sdk-shared/store";
10
+ import { processTwig as l } from "@plitzi/sdk-shared/helpers/twigWrapper";
11
+ import { jsx as u } from "react/jsx-runtime";
12
+ import d from "clsx";
13
+ import { getPageFullPath as f } from "@plitzi/sdk-navigation";
13
14
  // src/elements/basic/Link/Link.tsx
14
- var f = /^[a-z][a-z0-9+.-]*:/i, p = ({ ref: n, children: p, className: m = "", href: h = "#", target: g = "self", mode: _ = "page", hash: v = "", label: y = "", content: b = "", contentPlacement: x = "after", icon: S = "", iconPlacement: C = "before", current: w = "page" }) => {
15
- let { style: T, definition: { styleSelectors: E } } = r(), { settings: { previewMode: D } } = o(), [[O, k, A, j, M, N]] = s([
15
+ var p = /^[a-z][a-z0-9+.-]*:/i, m = ({ ref: r, children: m, className: h = "", href: g = "#", target: _ = "self", mode: v = "page", hash: y = "", label: b = "", content: x = "", contentPlacement: S = "after", icon: C = "", iconPlacement: w = "before", current: T = "page" }) => {
16
+ let { style: E, definition: { styleSelectors: D } } = i(), { settings: { previewMode: O } } = s(), [[k, A, j, M, N, P, F]] = c([
16
17
  "pageDefinitions",
17
18
  "schema.pageFolders",
18
19
  "navigation.routeParams",
19
20
  "navigation.queryParams",
20
21
  "navigation.navigate",
21
- "navigation.href"
22
- ]), P = _ === "external" || f.test(h), F = a(() => {
23
- if (P) return h;
24
- if (_ === "internal") {
25
- let e = `/${h}`.replaceAll(/[/]+/gim, "/");
22
+ "navigation.href",
23
+ "navigation.prefetch"
24
+ ]), I = v === "external" || p.test(g), L = !I && g.length > 1 && g.startsWith("#"), R = o(() => {
25
+ if (I || L) return g;
26
+ if (v === "internal") {
27
+ let e = `/${g}`.replaceAll(/[/]+/gim, "/");
26
28
  try {
27
- let t = c(e, {
28
- ...j,
29
- ...A
29
+ let t = l(e, {
30
+ ...M,
31
+ ...j
30
32
  }, !0);
31
33
  return typeof t == "string" ? t : e;
32
34
  } catch {}
33
35
  return e;
34
36
  }
35
- return d(O, k, h, !0);
37
+ return f(k, A, g, !0);
36
38
  }, [
37
- P,
38
- _,
39
- h,
40
- O,
39
+ I,
40
+ L,
41
+ v,
42
+ g,
41
43
  k,
42
- j,
43
- A
44
- ]), I = !P && v ? `${F}#${v}` : F, L = P ? void 0 : e(F, N, w), R = (e) => {
45
- if (!D) return;
44
+ A,
45
+ M,
46
+ j
47
+ ]), z = !I && !L && y ? `${R}#${y}` : R, B = I || L ? void 0 : e(R, P, T);
48
+ t(r, z, F, O === !0 && !I && !L && _ === "self");
49
+ let V = (e) => {
50
+ if (!O) return;
46
51
  e.stopPropagation();
47
- let t = g !== "self" || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
48
- !P && !t && (e.preventDefault(), M(I));
49
- }, z = a(() => {
52
+ let t = _ !== "self" || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
53
+ I || L || t || (e.preventDefault(), N(z));
54
+ }, H = o(() => {
50
55
  let e = {
51
- ref: n,
52
- style: T,
53
- target: `_${g}`,
54
- ...g === "blank" ? { rel: "noopener noreferrer" } : {},
55
- "aria-label": y || void 0,
56
- "aria-current": L,
57
- className: u("plitzi-component__link", m)
56
+ ref: r,
57
+ style: E,
58
+ target: `_${_}`,
59
+ ..._ === "blank" ? { rel: "noopener noreferrer" } : {},
60
+ "aria-label": b || void 0,
61
+ "aria-current": B,
62
+ className: d("plitzi-component__link", h)
58
63
  };
59
- return D ? {
64
+ return O ? {
60
65
  ...e,
61
- href: I
66
+ href: z
62
67
  } : {
63
68
  ...e,
64
- "href-disabled": I
69
+ "href-disabled": z
65
70
  };
66
71
  }, [
67
- n,
68
- T,
69
- g,
70
- y,
71
- L,
72
- m,
73
- D,
74
- I
72
+ r,
73
+ E,
74
+ _,
75
+ b,
76
+ B,
77
+ h,
78
+ O,
79
+ z
75
80
  ]);
76
- return /* @__PURE__ */ l(i, {
81
+ return /* @__PURE__ */ u(a, {
77
82
  tag: "a",
78
- ...z,
79
- onClick: R,
80
- children: /* @__PURE__ */ l(t, {
81
- content: b,
82
- icon: S,
83
- iconPlacement: C,
84
- iconClassName: E.icon,
85
- contentPlacement: x,
86
- children: p
83
+ ...H,
84
+ onClick: V,
85
+ children: /* @__PURE__ */ u(n, {
86
+ content: x,
87
+ icon: C,
88
+ iconPlacement: w,
89
+ iconClassName: D.icon,
90
+ contentPlacement: S,
91
+ children: m
87
92
  })
88
93
  });
89
- }, m = n(p);
90
- export { p as Link, m as default };
94
+ }, h = r(m);
95
+ export { m as Link, h as default };
@@ -140,7 +140,7 @@ var h = ({ mode: h = "page", href: g = "#", hash: _ = "", target: v = "self", la
140
140
  children: e.label
141
141
  }, e.key))]
142
142
  }), /* @__PURE__ */ l("div", {
143
- className: "truncate rounded-b border-r border-b border-l border-gray-200 p-1 text-xs",
143
+ className: "border-ui-line truncate rounded-b border-r border-b border-l p-1 text-xs",
144
144
  children: F
145
145
  })]
146
146
  }),
@@ -0,0 +1,3 @@
1
+ import { RefObject } from 'react';
2
+ declare const usePrefetchInView: (ref: RefObject<HTMLElement | null> | undefined, url: string, prefetch: ((url: string) => void) | undefined, enabled: boolean) => void;
3
+ export default usePrefetchInView;
@@ -0,0 +1,29 @@
1
+ import { useEffect as e } from "react";
2
+ // src/elements/basic/Link/usePrefetchInView.ts
3
+ var t = /* @__PURE__ */ new WeakMap(), n, r = (e) => {
4
+ typeof requestIdleCallback == "function" ? requestIdleCallback(e, { timeout: 2e3 }) : setTimeout(e, 200);
5
+ }, i = () => (n ??= new IntersectionObserver((e) => {
6
+ for (let i of e) {
7
+ let e = t.get(i.target);
8
+ i.isIntersecting && e && (n?.unobserve(i.target), t.delete(i.target), r(() => e.prefetch(e.url)));
9
+ }
10
+ }), n), a = (n, r, a, o) => {
11
+ e(() => {
12
+ let e = n?.current;
13
+ if (!o || !a || !e || typeof IntersectionObserver > "u") return;
14
+ t.set(e, {
15
+ url: r,
16
+ prefetch: a
17
+ });
18
+ let s = i();
19
+ return s.observe(e), () => {
20
+ s.unobserve(e), t.delete(e);
21
+ };
22
+ }, [
23
+ n,
24
+ r,
25
+ a,
26
+ o
27
+ ]);
28
+ };
29
+ export { a as default };
@@ -37,7 +37,7 @@ var a = ({ format: a = "html", mediaBaseUrl: o = "", onUpdate: s }) => {
37
37
  size: "xs"
38
38
  }),
39
39
  /* @__PURE__ */ n("span", {
40
- className: "text-xs text-gray-500",
40
+ className: "text-ui-fg-subtle text-xs",
41
41
  children: [
42
42
  "Bind ",
43
43
  /* @__PURE__ */ t("strong", { children: "content" }),
@@ -248,7 +248,7 @@ export declare const elementDeclarations: {
248
248
  readonly type: "blockJsx";
249
249
  readonly content: {
250
250
  readonly attributes: {
251
- readonly content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n const handleClick = useCallback(() => {\n alert(\"Hello World\");\n }, []);\n\n return (\n <div style={{ display: \"flex\", gap: \"4px\" }}>\n <JsxManager\n as=\"Heading\"\n internalProps={internalProps}\n content={`${content} ${content2}`}\n />\n <button onClick={handleClick} style={{ border: \"1px gray solid\", cursor: \"pointer\" }}>\n Click Me\n </button>\n </div>\n );\n};\n\nexport default BlockJsx;";
251
+ readonly content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n const handleClick = useCallback(() => {\n alert(\"Hello World\");\n }, []);\n\n return (\n <div style={{ display: \"flex\", gap: \"4px\" }}>\n <JsxManager\n as=\"Heading\"\n internalProps={internalProps}\n content={`${content} ${content2}`}\n />\n <button onClick={handleClick} style={{ border: \"1px gray solid\", cursor: \"pointer\" }}>\n Click Me\n </button>\n </div>\n );\n};\n\nexport default BlockJsx;";
252
252
  readonly props: "{\"content\": \"Hello\", \"content2\": \"World\"}";
253
253
  readonly contentCache: "aW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnOwppbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gInJlYWN0IjsKaW1wb3J0IHsgSnN4TWFuYWdlciB9IGZyb20gIkBwbGl0emkvcGxpdHppLXNkayI7CnZhciBCbG9ja0pzeCA9IGZ1bmN0aW9uIEJsb2NrSnN4KF9yZWYpIHsKICB2YXIgaW50ZXJuYWxQcm9wcyA9IF9yZWYuaW50ZXJuYWxQcm9wcywKICAgIGNvbnRlbnQgPSBfcmVmLmNvbnRlbnQsCiAgICBjb250ZW50MiA9IF9yZWYuY29udGVudDI7CiAgdmFyIGhhbmRsZUNsaWNrID0gdXNlQ2FsbGJhY2soZnVuY3Rpb24gKCkgewogICAgYWxlcnQoIkhlbGxvIFdvcmxkIik7CiAgfSwgW10pOwogIHJldHVybiAvKiNfX1BVUkVfXyovUmVhY3QuY3JlYXRlRWxlbWVudCgiZGl2IiwgewogICAgc3R5bGU6IHsKICAgICAgZGlzcGxheTogImZsZXgiLAogICAgICBnYXA6ICI0cHgiCiAgICB9CiAgfSwgLyojX19QVVJFX18qL1JlYWN0LmNyZWF0ZUVsZW1lbnQoSnN4TWFuYWdlciwgewogICAgYXM6ICJIZWFkaW5nIiwKICAgIGludGVybmFsUHJvcHM6IGludGVybmFsUHJvcHMsCiAgICBjb250ZW50OiAiIi5jb25jYXQoY29udGVudCwgIiAiKS5jb25jYXQoY29udGVudDIpCiAgfSksIC8qI19fUFVSRV9fKi9SZWFjdC5jcmVhdGVFbGVtZW50KCJidXR0b24iLCB7CiAgICBvbkNsaWNrOiBoYW5kbGVDbGljaywKICAgIHN0eWxlOiB7CiAgICAgIGJvcmRlcjogIjFweCBncmF5IHNvbGlkIiwKICAgICAgY3Vyc29yOiAncG9pbnRlcicKICAgIH0KICB9LCAiQ2xpY2sgTWUiKSk7Cn07CmV4cG9ydCBkZWZhdWx0IEJsb2NrSnN4Ow==";
254
254
  readonly allowEmptyRender: false;
@@ -1402,6 +1402,7 @@ export declare const elementDeclarations: {
1402
1402
  readonly contentAttributes: readonly ["label", "placeholder", "options", "requiredMessage", "minLengthMessage", "maxLengthMessage", "minMessage", "maxMessage", "formatMessage", "patternMessage", "matchesMessage"];
1403
1403
  readonly attributeValues: {
1404
1404
  readonly subType: readonly ["text", "number", "email", "password", "search", "url", "tel", "date", "time", "checkbox", "switch", "select", "textarea", "hidden", "color", "file"];
1405
+ readonly autoComplete: readonly ["username", "current-password", "new-password", "one-time-code", "email", "name", "given-name", "family-name", "organization", "tel", "street-address", "postal-code", "country", "url"];
1405
1406
  };
1406
1407
  readonly triggers: {
1407
1408
  readonly onChange: {
@@ -3748,7 +3749,9 @@ export declare const elementDeclarations: {
3748
3749
  readonly tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them";
3749
3750
  };
3750
3751
  readonly content: {
3751
- readonly attributes: {};
3752
+ readonly attributes: {
3753
+ readonly hash: "";
3754
+ };
3752
3755
  readonly definition: {
3753
3756
  readonly label: "Tab Container Item";
3754
3757
  readonly description: "One selectable tab (trigger + panel) inside a tabContainer.";
@@ -3770,7 +3773,9 @@ export declare const elementDeclarations: {
3770
3773
  readonly subTypes: {};
3771
3774
  };
3772
3775
  };
3773
- }, unknown>;
3776
+ }, Partial<{
3777
+ hash?: string | undefined;
3778
+ }>>;
3774
3779
  readonly Text: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
3775
3780
  readonly type: "text";
3776
3781
  readonly contentAttributes: readonly ["content"];
@@ -24,7 +24,7 @@ var x = ({ ref: n, className: x = "", children: S, method: C = "get", actionUrl:
24
24
  }), []);
25
25
  let V = o((e) => {
26
26
  N.current || (j((t) => y(t, (t) => {
27
- t[e] && delete t[e];
27
+ t[e] && Reflect.deleteProperty(t, e);
28
28
  })), e && I((t) => ({
29
29
  ...t,
30
30
  values: h(t, `values.${e}`),
@@ -1,3 +1,4 @@
1
+ import { AutofillField } from './helpers/autofill';
1
2
  import { FormControlSubType } from './subTypes';
2
3
  import { ChangeEvent, RefObject } from 'react';
3
4
  export type FormControlProps = {
@@ -15,7 +16,12 @@ export type FormControlProps = {
15
16
  placeholder: string;
16
17
  /** A `file` field's offer, as the browser reads `accept`: `image/png,image/jpeg`, `.pdf`. `''` for any file. */
17
18
  accept: string;
18
- autoComplete: boolean;
19
+ /**
20
+ * What the browser may fill in: `true` lets it decide (on a password field, the account's current password), `false`
21
+ * asks it not to, and a token names what the field holds — `username`, `new-password`, `one-time-code`, `email`…
22
+ * (`AUTOFILL_FIELDS`), which is what a password manager reads to fill a sign-in and to save a new password.
23
+ */
24
+ autoComplete: boolean | AutofillField;
19
25
  /**
20
26
  * Takes the focus as it appears — a search box opened by a shortcut is typed into at once. With the control's
21
27
  * container shown only while wanted (`loadStrategy: 'visible'`), it appears each time it is opened.
@@ -1,165 +1,166 @@
1
1
  import e from "./components/Label.mjs";
2
2
  import { VISUALLY_HIDDEN as t } from "./components/visuallyHidden.mjs";
3
3
  import n from "./declaration.mjs";
4
- import { fieldText as r } from "./helpers/fieldText.mjs";
5
- import { isChecked as i } from "./helpers/isChecked.mjs";
6
- import a from "./hocs/withFieldValue.mjs";
7
- import o from "./inputs/Checkbox.mjs";
8
- import ee from "./inputs/FileInput.mjs";
9
- import s from "./inputs/Hidden.mjs";
4
+ import { autocompleteOf as r } from "./helpers/autofill.mjs";
5
+ import { fieldText as i } from "./helpers/fieldText.mjs";
6
+ import { isChecked as a } from "./helpers/isChecked.mjs";
7
+ import o from "./hocs/withFieldValue.mjs";
8
+ import s from "./inputs/Checkbox.mjs";
9
+ import c from "./inputs/FileInput.mjs";
10
+ import ee from "./inputs/Hidden.mjs";
10
11
  import te from "./inputs/Input.mjs";
11
- import ne from "./inputs/Select.mjs";
12
- import c from "./inputs/Textarea.mjs";
13
- import { CHECK_SUBTYPES as l, INPUT_SUBTYPES as u } from "./subTypes.mjs";
14
- import d from "../../../Element/hocs/withElement.mjs";
15
- import f from "../../../Element/hooks/useElement.mjs";
16
- import { RootElement as p } from "../../../Element/RootElement.mjs";
17
- import { use as m, useCallback as h, useEffect as re } from "react";
18
- import { createStoreHook as ie } from "@plitzi/nexus/react";
19
- import { usePlitzi as ae } from "@plitzi/sdk-shared/hooks";
12
+ import l from "./inputs/Select.mjs";
13
+ import u from "./inputs/Textarea.mjs";
14
+ import { CHECK_SUBTYPES as d, INPUT_SUBTYPES as f } from "./subTypes.mjs";
15
+ import p from "../../../Element/hocs/withElement.mjs";
16
+ import m from "../../../Element/hooks/useElement.mjs";
17
+ import { RootElement as h } from "../../../Element/RootElement.mjs";
18
+ import { use as ne, useCallback as re, useEffect as ie } from "react";
19
+ import { createStoreHook as ae } from "@plitzi/nexus/react";
20
+ import { usePlitzi as oe } from "@plitzi/sdk-shared/hooks";
20
21
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
21
22
  import v from "clsx";
22
- import { InteractionsContext as oe } from "@plitzi/sdk-interactions";
23
+ import { InteractionsContext as y } from "@plitzi/sdk-interactions";
23
24
  // src/elements/form/FormControl/FormControl.tsx
24
- var y = ({ ref: a, className: d = "", subType: y = "text", name: b = "", label: x = "", hideLabel: S = !1, placeholder: C = "", accept: w = "", autoComplete: T = !0, autoFocus: E = !1, disabled: D = !1, options: se = [], required: O = !1, maxLength: k = 0, min: ce = "", max: A = "", step: j = "", readOnly: M = !1, value: N = "", error: P = "", handleChange: F, handleValidate: I }) => {
25
- let { id: L, rootId: R, visible: z, definition: { styleSelectors: B } } = f(), { settings: { previewMode: V } } = ae(), { interactionsManager: H } = m(oe), { useStore: U } = ie(), [W] = U("runtime.sources.form"), G = h((e) => {
25
+ var b = ({ ref: o, className: p = "", subType: b = "text", name: x = "", label: S = "", hideLabel: C = !1, placeholder: w = "", accept: T = "", autoComplete: se = !0, autoFocus: ce = !1, disabled: E = !1, options: le = [], required: D = !1, maxLength: O = 0, min: k = "", max: A = "", step: j = "", readOnly: M = !1, value: N = "", error: P = "", handleChange: F, handleValidate: I }) => {
26
+ let { id: L, rootId: R, visible: z, definition: { styleSelectors: B } } = m(), { settings: { previewMode: V } } = oe(), { interactionsManager: H } = ne(y), { useStore: U } = ae(), [W] = U("runtime.sources.form"), G = re((e) => {
26
27
  if (F?.(e), !V) return;
27
28
  let { target: t } = e, n = t instanceof HTMLInputElement && t.type === "checkbox", r = t instanceof HTMLInputElement && t.type === "file" ? t.files?.[0] ?? null : void 0, i = r === void 0 ? n ? t.checked : t.value : r;
28
29
  H.interactionTrigger(L, "onChange", {
29
30
  value: i,
30
- name: b
31
+ name: x
31
32
  });
32
33
  }, [
33
34
  F,
34
35
  V,
35
36
  H,
36
37
  L,
37
- b
38
- ]), K = W?.registerField, q = W?.unregisterField, J = l.includes(y), le = y === "hidden", Y = E && V && z, X = S && V, Z = P && V ? `${R}_${L}_error` : void 0, Q = r(N), $ = J && /* @__PURE__ */ g(o, {
39
- variant: y === "switch" ? "switch" : "checkbox",
38
+ x
39
+ ]), K = W?.registerField, q = W?.unregisterField, J = d.includes(b), ue = b === "hidden", Y = ce && V && z, X = C && V, Z = P && V ? `${R}_${L}_error` : void 0, Q = i(N), $ = J && /* @__PURE__ */ g(s, {
40
+ variant: b === "switch" ? "switch" : "checkbox",
40
41
  id: `${R}_${L}`,
41
- name: b,
42
- checked: i(N),
42
+ name: x,
43
+ checked: a(N),
43
44
  className: B.input,
44
- required: O,
45
- disabled: D,
45
+ required: D,
46
+ disabled: E,
46
47
  onChange: G,
47
48
  onValidate: I,
48
49
  errorId: Z
49
50
  });
50
- return re(() => {
51
+ return ie(() => {
51
52
  if (K && q) return K({
52
- name: b,
53
- path: b
54
- }), () => q(b);
53
+ name: x,
54
+ path: x
55
+ }), () => q(x);
55
56
  }, [
56
- b,
57
+ x,
57
58
  K,
58
59
  q
59
- ]), /* @__PURE__ */ _(p, {
60
- ref: a,
60
+ ]), /* @__PURE__ */ _(h, {
61
+ ref: o,
61
62
  interactionTriggers: n.triggers,
62
63
  className: v("plitzi-component__form-control", {
63
64
  "form-control--invalid": P && V,
64
- [`plitzi-component__form-control-${y}`]: y
65
- }, d),
65
+ [`plitzi-component__form-control-${b}`]: b
66
+ }, p),
66
67
  children: [
67
- !J && !le && x && /* @__PURE__ */ g(e, {
68
+ !J && !ue && S && /* @__PURE__ */ g(e, {
68
69
  targetInput: `${R}_${L}`,
69
70
  previewMode: V,
70
71
  className: B.label,
71
72
  requiredClassName: B.requiredMark,
72
- type: y,
73
- required: O,
73
+ type: b,
74
+ required: D,
74
75
  hidden: X,
75
- children: x
76
+ children: S
76
77
  }),
77
- J && x && /* @__PURE__ */ _(e, {
78
+ J && S && /* @__PURE__ */ _(e, {
78
79
  targetInput: `${R}_${L}`,
79
80
  previewMode: V,
80
81
  className: B.label,
81
82
  requiredClassName: B.requiredMark,
82
- type: y,
83
- required: O,
83
+ type: b,
84
+ required: D,
84
85
  children: [
85
86
  $,
86
87
  X && /* @__PURE__ */ g("span", {
87
88
  style: t,
88
- children: x
89
+ children: S
89
90
  }),
90
- !X && x
91
+ !X && S
91
92
  ]
92
93
  }),
93
- J && !x && $,
94
- u.includes(y) && /* @__PURE__ */ g(te, {
94
+ J && !S && $,
95
+ f.includes(b) && /* @__PURE__ */ g(te, {
95
96
  id: `${R}_${L}`,
96
- name: b,
97
+ name: x,
97
98
  value: Q,
98
- type: y,
99
+ type: b,
99
100
  className: B.input,
100
101
  fieldClassName: B.field,
101
102
  iconClassName: B.icon,
102
- placeholder: C,
103
- autoComplete: y !== "password" && T,
103
+ placeholder: w,
104
+ autoComplete: r(se, b, V !== !1),
104
105
  autoFocus: Y,
105
- required: O,
106
- maxLength: k,
107
- min: ce,
106
+ required: D,
107
+ maxLength: O,
108
+ min: k,
108
109
  max: A,
109
110
  step: j,
110
- disabled: D,
111
+ disabled: E,
111
112
  readOnly: M || !V,
112
113
  onChange: G,
113
114
  onValidate: I,
114
115
  errorId: Z
115
116
  }),
116
- y === "hidden" && /* @__PURE__ */ g(s, {
117
+ b === "hidden" && /* @__PURE__ */ g(ee, {
117
118
  id: `${R}_${L}`,
118
- name: b,
119
+ name: x,
119
120
  value: Q,
120
- required: O,
121
- disabled: D,
121
+ required: D,
122
+ disabled: E,
122
123
  previewMode: V
123
124
  }),
124
- y === "select" && /* @__PURE__ */ g(ne, {
125
+ b === "select" && /* @__PURE__ */ g(l, {
125
126
  id: `${R}_${L}`,
126
- name: b,
127
+ name: x,
127
128
  onChange: G,
128
129
  onValidate: I,
129
130
  errorId: Z,
130
131
  value: Q,
131
132
  className: B.input,
132
133
  fieldClassName: B.field,
133
- placeholder: C,
134
+ placeholder: w,
134
135
  autoFocus: Y,
135
- required: O,
136
- disabled: D,
137
- options: se
136
+ required: D,
137
+ disabled: E,
138
+ options: le
138
139
  }),
139
- y === "textarea" && /* @__PURE__ */ g(c, {
140
+ b === "textarea" && /* @__PURE__ */ g(u, {
140
141
  id: `${R}_${L}`,
141
- name: b,
142
+ name: x,
142
143
  value: Q,
143
144
  className: B.input,
144
- placeholder: C,
145
+ placeholder: w,
145
146
  autoFocus: Y,
146
- required: O,
147
- maxLength: k,
148
- disabled: D,
147
+ required: D,
148
+ maxLength: O,
149
+ disabled: E,
149
150
  readOnly: M,
150
151
  onChange: G,
151
152
  onValidate: I,
152
153
  errorId: Z
153
154
  }),
154
- y === "file" && /* @__PURE__ */ g(ee, {
155
+ b === "file" && /* @__PURE__ */ g(c, {
155
156
  id: `${R}_${L}`,
156
- name: b,
157
- accept: w,
157
+ name: x,
158
+ accept: T,
158
159
  chosen: N instanceof File ? N : void 0,
159
160
  className: B.input,
160
161
  fieldClassName: B.field,
161
- required: O,
162
- disabled: D,
162
+ required: D,
163
+ disabled: E,
163
164
  previewMode: V,
164
165
  onChange: G,
165
166
  onValidate: I,
@@ -173,5 +174,5 @@ var y = ({ ref: a, className: d = "", subType: y = "text", name: b = "", label:
173
174
  })
174
175
  ]
175
176
  });
176
- }, b = d(a(y));
177
- export { y as FormControl, b as default };
177
+ }, x = p(o(b));
178
+ export { b as FormControl, x as default };
@@ -1,3 +1,4 @@
1
+ import { AutofillField } from './helpers/autofill';
1
2
  import { FormControlSubType } from './subTypes';
2
3
  type SettingsProps = {
3
4
  subType?: FormControlSubType;
@@ -6,7 +7,7 @@ type SettingsProps = {
6
7
  hideLabel?: boolean;
7
8
  placeholder?: string;
8
9
  accept?: string;
9
- autoComplete?: boolean;
10
+ autoComplete?: boolean | AutofillField;
10
11
  autoFocus?: boolean;
11
12
  defaultValue?: string | number;
12
13
  options?: string[];
@@ -68,7 +68,7 @@ var p = (e) => {
68
68
  size: "xs"
69
69
  }),
70
70
  m === "text" && /* @__PURE__ */ s(l, {
71
- checked: ee,
71
+ checked: ee !== !1,
72
72
  label: "Auto Complete",
73
73
  onChange: Z,
74
74
  size: "xs"
@@ -12,6 +12,7 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
12
12
  readonly contentAttributes: readonly ["label", "placeholder", "options", "requiredMessage", "minLengthMessage", "maxLengthMessage", "minMessage", "maxMessage", "formatMessage", "patternMessage", "matchesMessage"];
13
13
  readonly attributeValues: {
14
14
  readonly subType: readonly ["text", "number", "email", "password", "search", "url", "tel", "date", "time", "checkbox", "switch", "select", "textarea", "hidden", "color", "file"];
15
+ readonly autoComplete: readonly ["username", "current-password", "new-password", "one-time-code", "email", "name", "given-name", "family-name", "organization", "tel", "street-address", "postal-code", "country", "url"];
15
16
  };
16
17
  readonly triggers: {
17
18
  readonly onChange: {