@plitzi/sdk-elements 0.37.2 → 0.37.4
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/CHANGELOG.md +1180 -0
- package/dist/Component/ComponentProvider.mjs +10 -5
- package/dist/Element/JsxManager.mjs +1 -0
- package/dist/Element/PluginRemote.d.ts +3 -1
- package/dist/Element/PluginRemote.mjs +9 -9
- package/dist/Element/helpers/elementConstants.mjs +28 -0
- package/dist/Element/helpers/elementUtils.mjs +1 -1
- package/dist/Element/helpers/loadComponent.d.ts +6 -1
- package/dist/Element/helpers/loadComponent.mjs +7 -7
- package/dist/Element/helpers/pluginSelector.mjs +1 -0
- package/dist/Element/hooks/useElementDataSource.mjs +23 -16
- package/dist/Element/hooks/useElementInternal.mjs +60 -52
- package/dist/Element/hooks/useInternalClassName.mjs +19 -18
- package/dist/Element/hooks/useKeyTriggers.d.ts +18 -0
- package/dist/Element/hooks/useKeyTriggers.mjs +36 -0
- package/dist/Element/hooks/useRootElementInteractions.mjs +65 -56
- package/dist/Element/hooks/useRscData.mjs +20 -15
- package/dist/dataSource/GlobalSources.mjs +114 -80
- package/dist/dataSource/getSourcesByElementId.mjs +2 -2
- package/dist/elements/advanced/BlockJsx/BlockJsx.mjs +1 -1
- package/dist/elements/advanced/NodeHtml/declaration.d.ts +1 -1
- package/dist/elements/advanced/NodeHtml/index.d.ts +1 -1
- package/dist/elements/basic/Button/Button.d.ts +10 -3
- package/dist/elements/basic/Button/Button.mjs +5 -5
- package/dist/elements/basic/Button/Settings.d.ts +2 -1
- package/dist/elements/basic/Button/Settings.mjs +14 -7
- package/dist/elements/basic/Button/declaration.d.ts +8 -3
- package/dist/elements/basic/Button/declaration.mjs +14 -6
- package/dist/elements/basic/Button/index.d.ts +8 -3
- package/dist/elements/basic/Dropdown/Dropdown.mjs +48 -39
- package/dist/elements/basic/Dropdown/declaration.d.ts +3 -0
- package/dist/elements/basic/Dropdown/declaration.mjs +9 -3
- package/dist/elements/basic/Dropdown/index.d.ts +3 -0
- package/dist/elements/basic/Dropdown/useDropdown.d.ts +6 -1
- package/dist/elements/basic/Dropdown/useDropdown.mjs +58 -41
- package/dist/elements/basic/Dropdown/useDropdownTrigger.d.ts +26 -0
- package/dist/elements/basic/Dropdown/useDropdownTrigger.mjs +30 -0
- package/dist/elements/basic/Heading/declaration.d.ts +9 -6
- package/dist/elements/basic/Heading/declaration.mjs +17 -9
- package/dist/elements/basic/Heading/index.d.ts +9 -6
- package/dist/elements/basic/Link/Link.mjs +4 -1
- package/dist/elements/basic/Link/Settings.d.ts +2 -1
- package/dist/elements/basic/Link/Settings.mjs +31 -24
- package/dist/elements/basic/Link/declaration.d.ts +5 -1
- package/dist/elements/basic/Link/declaration.mjs +16 -3
- package/dist/elements/basic/Link/index.d.ts +5 -1
- package/dist/elements/basic/Markdown/declaration.d.ts +1 -1
- package/dist/elements/basic/Markdown/declaration.mjs +1 -1
- package/dist/elements/basic/Markdown/index.d.ts +1 -1
- package/dist/elements/basic/RichText/declaration.d.ts +3 -0
- package/dist/elements/basic/RichText/declaration.mjs +8 -3
- package/dist/elements/basic/RichText/index.d.ts +3 -0
- package/dist/elements/basic/Text/declaration.d.ts +1 -1
- package/dist/elements/basic/Text/declaration.mjs +1 -1
- package/dist/elements/basic/Text/index.d.ts +1 -1
- package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +3 -0
- package/dist/elements/basic/ThemeToggle/declaration.d.ts +3 -0
- package/dist/elements/basic/ThemeToggle/declaration.mjs +4 -3
- package/dist/elements/basic/ThemeToggle/index.d.ts +3 -0
- package/dist/elements/declarations/index.d.ts +217 -17
- package/dist/elements/declarations/index.mjs +24 -22
- package/dist/elements/form/Form/declaration.d.ts +3 -0
- package/dist/elements/form/Form/declaration.mjs +4 -3
- package/dist/elements/form/Form/index.d.ts +3 -0
- package/dist/elements/form/FormControl/FormControl.d.ts +18 -6
- package/dist/elements/form/FormControl/FormControl.mjs +135 -127
- package/dist/elements/form/FormControl/Settings.d.ts +3 -1
- package/dist/elements/form/FormControl/Settings.mjs +73 -57
- package/dist/elements/form/FormControl/components/Label.d.ts +3 -1
- package/dist/elements/form/FormControl/components/Label.mjs +20 -18
- package/dist/elements/form/FormControl/components/visuallyHidden.d.ts +6 -0
- package/dist/elements/form/FormControl/components/visuallyHidden.mjs +14 -0
- package/dist/elements/form/FormControl/declaration.d.ts +5 -0
- package/dist/elements/form/FormControl/declaration.mjs +46 -30
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +68 -61
- package/dist/elements/form/FormControl/index.d.ts +5 -0
- package/dist/elements/form/FormControl/inputs/Checkbox.d.ts +6 -1
- package/dist/elements/form/FormControl/inputs/Checkbox.mjs +5 -3
- package/dist/elements/form/FormControl/inputs/Input.d.ts +8 -1
- package/dist/elements/form/FormControl/inputs/Input.mjs +44 -38
- package/dist/elements/form/FormControl/inputs/Select.d.ts +6 -1
- package/dist/elements/form/FormControl/inputs/Select.mjs +12 -10
- package/dist/elements/form/FormControl/inputs/Textarea.d.ts +8 -1
- package/dist/elements/form/FormControl/inputs/Textarea.mjs +26 -21
- package/dist/elements/form/FormControl/inputs/useFocusWhenShown.d.ts +7 -0
- package/dist/elements/form/FormControl/inputs/useFocusWhenShown.mjs +9 -0
- package/dist/elements/index.d.ts +3 -1
- package/dist/elements/index.mjs +16 -14
- package/dist/elements/internal/LayoutContainer/declaration.d.ts +3 -0
- package/dist/elements/internal/LayoutContainer/declaration.mjs +15 -3
- package/dist/elements/internal/LayoutContainer/index.d.ts +3 -0
- package/dist/elements/media/FontAwesome/FontAwesome.d.ts +8 -1
- package/dist/elements/media/FontAwesome/FontAwesome.mjs +12 -5
- package/dist/elements/media/FontAwesome/Settings.d.ts +2 -1
- package/dist/elements/media/FontAwesome/Settings.mjs +29 -22
- package/dist/elements/media/FontAwesome/declaration.d.ts +1 -0
- package/dist/elements/media/FontAwesome/index.d.ts +1 -0
- package/dist/elements/media/Image/Image.d.ts +13 -2
- package/dist/elements/media/Image/Image.mjs +25 -25
- package/dist/elements/media/Image/Settings.d.ts +3 -1
- package/dist/elements/media/Image/Settings.mjs +29 -15
- package/dist/elements/media/Image/declaration.d.ts +7 -1
- package/dist/elements/media/Image/declaration.mjs +16 -3
- package/dist/elements/media/Image/index.d.ts +7 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +145 -137
- package/dist/elements/provider/ApiContainer/declaration.d.ts +14 -1
- package/dist/elements/provider/ApiContainer/declaration.mjs +41 -4
- package/dist/elements/provider/ApiContainer/helpers/isEmptyAnswer.d.ts +16 -0
- package/dist/elements/provider/ApiContainer/helpers/isEmptyAnswer.mjs +4 -0
- package/dist/elements/provider/ApiContainer/helpers/queryInput.d.ts +5 -0
- package/dist/elements/provider/ApiContainer/helpers/queryInput.mjs +12 -0
- package/dist/elements/provider/ApiContainer/index.d.ts +14 -1
- package/dist/elements/provider/Channel/Channel.d.ts +26 -0
- package/dist/elements/provider/Channel/Channel.mjs +92 -0
- package/dist/elements/provider/Channel/Settings.d.ts +9 -0
- package/dist/elements/provider/Channel/Settings.mjs +38 -0
- package/dist/elements/provider/Channel/declaration.d.ts +138 -0
- package/dist/elements/provider/Channel/declaration.mjs +125 -0
- package/dist/elements/provider/Channel/index.d.ts +137 -0
- package/dist/elements/provider/Channel/index.mjs +6 -0
- package/dist/elements/settings.mjs +25 -23
- package/dist/elements/structure/Container/Container.d.ts +16 -2
- package/dist/elements/structure/Container/Container.mjs +18 -9
- package/dist/elements/structure/Container/Settings.d.ts +4 -2
- package/dist/elements/structure/Container/Settings.mjs +110 -69
- package/dist/elements/structure/Container/declaration.d.ts +12 -1
- package/dist/elements/structure/Container/declaration.mjs +35 -3
- package/dist/elements/structure/Container/index.d.ts +6 -1
- package/dist/elements/structure/Container/index.mjs +3 -3
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +123 -100
- package/dist/elements/structure/List/declaration.d.ts +4 -0
- package/dist/elements/structure/List/declaration.mjs +7 -3
- package/dist/elements/structure/List/index.d.ts +4 -0
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +92 -80
- package/dist/elements/structure/ModalContainer/metadataFromText.d.ts +1 -0
- package/dist/elements/structure/ModalContainer/metadataFromText.mjs +10 -0
- package/dist/elements/structure/ModalContainer/useModalDialog.d.ts +20 -0
- package/dist/elements/structure/ModalContainer/useModalDialog.mjs +31 -0
- package/dist/elements/structure/Pagination/Pagination.d.ts +6 -1
- package/dist/elements/structure/Pagination/Pagination.mjs +23 -21
- package/dist/elements/structure/Pagination/Settings.d.ts +2 -1
- package/dist/elements/structure/Pagination/Settings.mjs +16 -9
- package/dist/elements/structure/Pagination/declaration.d.ts +5 -0
- package/dist/elements/structure/Pagination/declaration.mjs +7 -3
- package/dist/elements/structure/Pagination/index.d.ts +5 -0
- package/dist/elements/structure/TabContainer/TabContainer.mjs +19 -17
- package/dist/elements/structure/TabContainer/TabContainerBody/TabContainerBody.mjs +8 -6
- package/dist/elements/structure/TabContainer/TabContainerContext.d.ts +2 -0
- package/dist/elements/structure/TabContainer/TabContainerHeader/TabContainerHeader.mjs +18 -14
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.d.ts +5 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +48 -13
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.d.ts +1 -1
- package/dist/index.d.ts +220 -16
- package/dist/index.mjs +20 -17
- package/dist/realtime/useChannel.d.ts +35 -0
- package/dist/realtime/useChannel.mjs +57 -0
- package/package.json +67 -11
- package/dist/elements/media/FontAwesome/FontAwesome.stories-paused.d.ts +0 -1
package/dist/elements/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { default as FontAwesome } from './media/FontAwesome';
|
|
|
22
22
|
import { default as Image } from './media/Image';
|
|
23
23
|
import { default as Video } from './media/Video';
|
|
24
24
|
import { default as ApiContainer } from './provider/ApiContainer';
|
|
25
|
+
import { default as Channel } from './provider/Channel';
|
|
25
26
|
import { default as Container } from './structure/Container';
|
|
26
27
|
import { default as DialogContainer } from './structure/DialogContainer';
|
|
27
28
|
import { default as List } from './structure/List';
|
|
@@ -51,10 +52,11 @@ export * from './media/FontAwesome';
|
|
|
51
52
|
export * from './media/Image';
|
|
52
53
|
export * from './media/Video';
|
|
53
54
|
export * from './provider/ApiContainer';
|
|
55
|
+
export * from './provider/Channel';
|
|
54
56
|
export * from './structure/Container';
|
|
55
57
|
export * from './structure/DialogContainer';
|
|
56
58
|
export * from './structure/List';
|
|
57
59
|
export * from './structure/ModalContainer';
|
|
58
60
|
export * from './structure/Pagination';
|
|
59
61
|
export * from './structure/TabContainer';
|
|
60
|
-
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer };
|
|
62
|
+
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|
package/dist/elements/index.mjs
CHANGED
|
@@ -23,21 +23,23 @@ import x from "./media/FontAwesome/index.mjs";
|
|
|
23
23
|
import S from "./media/Image/index.mjs";
|
|
24
24
|
import C from "./media/Video/index.mjs";
|
|
25
25
|
import w from "./provider/ApiContainer/index.mjs";
|
|
26
|
-
import T from "./
|
|
27
|
-
import E from "./structure/
|
|
28
|
-
import D from "./structure/
|
|
29
|
-
import O from "./structure/
|
|
30
|
-
import k from "./structure/
|
|
31
|
-
import A from "./structure/
|
|
26
|
+
import T from "./provider/Channel/index.mjs";
|
|
27
|
+
import E from "./structure/Container/index.mjs";
|
|
28
|
+
import D from "./structure/DialogContainer/index.mjs";
|
|
29
|
+
import O from "./structure/List/index.mjs";
|
|
30
|
+
import k from "./structure/ModalContainer/index.mjs";
|
|
31
|
+
import A from "./structure/Pagination/index.mjs";
|
|
32
|
+
import j from "./structure/TabContainer/index.mjs";
|
|
32
33
|
//#region src/elements/index.ts
|
|
33
|
-
var
|
|
34
|
+
var M = /* @__PURE__ */ e({
|
|
34
35
|
ApiContainer: () => w,
|
|
35
36
|
BlockHtml: () => t,
|
|
36
37
|
BlockJsx: () => n,
|
|
37
38
|
Button: () => o,
|
|
38
|
-
|
|
39
|
+
Channel: () => T,
|
|
40
|
+
Container: () => E,
|
|
39
41
|
Custom: () => r,
|
|
40
|
-
DialogContainer: () =>
|
|
42
|
+
DialogContainer: () => D,
|
|
41
43
|
Dropdown: () => s,
|
|
42
44
|
FontAwesome: () => x,
|
|
43
45
|
Form: () => h,
|
|
@@ -46,21 +48,21 @@ var j = /* @__PURE__ */ e({
|
|
|
46
48
|
Image: () => S,
|
|
47
49
|
LayoutContainer: () => _,
|
|
48
50
|
Link: () => l,
|
|
49
|
-
List: () =>
|
|
51
|
+
List: () => O,
|
|
50
52
|
Loading: () => v,
|
|
51
53
|
Markdown: () => u,
|
|
52
|
-
ModalContainer: () =>
|
|
54
|
+
ModalContainer: () => k,
|
|
53
55
|
NodeHtml: () => i,
|
|
54
56
|
NotFound: () => y,
|
|
55
57
|
Page: () => b,
|
|
56
|
-
Pagination: () =>
|
|
58
|
+
Pagination: () => A,
|
|
57
59
|
Paragraph: () => d,
|
|
58
60
|
Reference: () => a,
|
|
59
61
|
RichText: () => f,
|
|
60
|
-
TabContainer: () =>
|
|
62
|
+
TabContainer: () => j,
|
|
61
63
|
Text: () => p,
|
|
62
64
|
ThemeToggle: () => m,
|
|
63
65
|
Video: () => C
|
|
64
66
|
});
|
|
65
67
|
//#endregion
|
|
66
|
-
export { w as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, T as Container, r as Custom,
|
|
68
|
+
export { w as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, T as Channel, E as Container, r as Custom, D as DialogContainer, s as Dropdown, x as FontAwesome, h as Form, g as FormControl, c as Heading, S as Image, _ as LayoutContainer, l as Link, O as List, v as Loading, u as Markdown, k as ModalContainer, i as NodeHtml, y as NotFound, b as Page, A as Pagination, d as Paragraph, a as Reference, f as RichText, j as TabContainer, p as Text, m as ThemeToggle, C as Video, M as elements_exports };
|
|
@@ -4,6 +4,9 @@ import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring/declare';
|
|
|
4
4
|
export type LayoutContainerAttributes = AuthorableAttributes<LayoutContainerProps>;
|
|
5
5
|
declare const declaration: {
|
|
6
6
|
readonly type: "layoutContainer";
|
|
7
|
+
readonly attributeValues: {
|
|
8
|
+
readonly subType: readonly string[];
|
|
9
|
+
};
|
|
7
10
|
readonly content: {
|
|
8
11
|
readonly attributes: {
|
|
9
12
|
readonly subType: "div";
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring/declare";
|
|
1
|
+
import { elementDeclaration as e, valuesOf as t } from "@plitzi/sdk-shared/authoring/declare";
|
|
2
2
|
//#region src/elements/internal/LayoutContainer/declaration.ts
|
|
3
|
-
var
|
|
3
|
+
var n = e()({
|
|
4
4
|
type: "layoutContainer",
|
|
5
|
+
attributeValues: { subType: t()([
|
|
6
|
+
"div",
|
|
7
|
+
"header",
|
|
8
|
+
"footer",
|
|
9
|
+
"nav",
|
|
10
|
+
"main",
|
|
11
|
+
"section",
|
|
12
|
+
"article",
|
|
13
|
+
"aside",
|
|
14
|
+
"address",
|
|
15
|
+
"figure"
|
|
16
|
+
]) },
|
|
5
17
|
content: {
|
|
6
18
|
attributes: { subType: "div" },
|
|
7
19
|
definition: {
|
|
@@ -41,4 +53,4 @@ var t = e()({
|
|
|
41
53
|
}
|
|
42
54
|
});
|
|
43
55
|
//#endregion
|
|
44
|
-
export {
|
|
56
|
+
export { n as default };
|
|
@@ -5,8 +5,15 @@ export type FontAwesomeProps = {
|
|
|
5
5
|
icon?: string;
|
|
6
6
|
size?: string;
|
|
7
7
|
iconAnimation?: string;
|
|
8
|
+
/**
|
|
9
|
+
* What the icon means, for an icon that says something on its own — a status, a rating, a warning with no words
|
|
10
|
+
* beside it. Left empty, the icon is decoration and is hidden from screen readers and browser agents: a glyph from
|
|
11
|
+
* an icon font reads as a private-use character, which is noise at best. An icon inside a button or a link is named
|
|
12
|
+
* by that button or link (its text or its `title`), never here.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
8
15
|
};
|
|
9
|
-
declare const FontAwesome: ({ ref, className, icon, size, iconAnimation }: FontAwesomeProps) => import('react').JSX.Element;
|
|
16
|
+
declare const FontAwesome: ({ ref, className, icon, size, iconAnimation, label }: FontAwesomeProps) => import('react').JSX.Element;
|
|
10
17
|
declare const _default: {
|
|
11
18
|
(props: import('../../../Element/hocs/withElement').WithElementProps<FontAwesomeProps>): import('react').JSX.Element;
|
|
12
19
|
displayName: string;
|
|
@@ -3,10 +3,17 @@ import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
import r from "clsx";
|
|
5
5
|
//#region src/elements/media/FontAwesome/FontAwesome.tsx
|
|
6
|
-
var i = ({ ref: e, className: i = "", icon: a = "fas fa-flag", size: o = "fa-1x", iconAnimation: s = ""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
var i = ({ ref: e, className: i = "", icon: a = "fas fa-flag", size: o = "fa-1x", iconAnimation: s = "", label: c = "" }) => {
|
|
7
|
+
let l = c ? {
|
|
8
|
+
role: "img",
|
|
9
|
+
"aria-label": c
|
|
10
|
+
} : { "aria-hidden": !0 };
|
|
11
|
+
return /* @__PURE__ */ n(t, {
|
|
12
|
+
ref: e,
|
|
13
|
+
tag: "i",
|
|
14
|
+
className: r("plitzi-component__fontawesome", i, a, o, s),
|
|
15
|
+
...l
|
|
16
|
+
});
|
|
17
|
+
}, a = e(i);
|
|
11
18
|
//#endregion
|
|
12
19
|
export { i as FontAwesome, a as default };
|
|
@@ -2,7 +2,8 @@ type SettingsProps = {
|
|
|
2
2
|
icon?: string;
|
|
3
3
|
size?: 'fa-1x' | 'fa-2x' | 'fa-3x' | 'fa-4x';
|
|
4
4
|
iconAnimation?: string;
|
|
5
|
+
label?: string;
|
|
5
6
|
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
6
7
|
};
|
|
7
|
-
declare const Settings: ({ icon, size, iconAnimation, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
8
|
+
declare const Settings: ({ icon, size, iconAnimation, label, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
8
9
|
export default Settings;
|
|
@@ -4,13 +4,13 @@ import o from "clsx";
|
|
|
4
4
|
import s from "@plitzi/plitzi-ui/Input";
|
|
5
5
|
import c from "@plitzi/plitzi-ui/Select";
|
|
6
6
|
//#region src/elements/media/FontAwesome/Settings.tsx
|
|
7
|
-
var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "",
|
|
8
|
-
let [
|
|
9
|
-
let { styles: t, label: n } =
|
|
10
|
-
if (!n.toLowerCase().includes(
|
|
7
|
+
var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "", label: f = "", onUpdate: p }) => {
|
|
8
|
+
let [m, h] = r({}), [g, _] = r(""), [v, y] = r(!1), [b, x] = r(""), S = e((e) => () => p?.("icon", e), [p]), C = n(() => Object.keys(m).map((e) => {
|
|
9
|
+
let { styles: t, label: n } = m[e];
|
|
10
|
+
if (!n.toLowerCase().includes(b.toLowerCase())) return [];
|
|
11
11
|
let r = [];
|
|
12
12
|
return t.forEach((t) => {
|
|
13
|
-
if (
|
|
13
|
+
if (g !== "" && t !== g) return;
|
|
14
14
|
let a = "fa";
|
|
15
15
|
switch (t) {
|
|
16
16
|
case "brands":
|
|
@@ -24,34 +24,41 @@ var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "", onUpdate: f }
|
|
|
24
24
|
let s = `${a} fa-${e}`;
|
|
25
25
|
r.push(/* @__PURE__ */ i("div", {
|
|
26
26
|
className: o("flex h-6 w-6 cursor-pointer items-center justify-center rounded-md p-1 hover:bg-blue-200 hover:text-white", { "bg-[#339af0] text-white": s === l }),
|
|
27
|
-
onClick:
|
|
27
|
+
onClick: S(s),
|
|
28
28
|
title: `${n} - [${e}]`,
|
|
29
29
|
children: /* @__PURE__ */ i("i", { className: s }, `${e}_${a}`)
|
|
30
30
|
}, s));
|
|
31
31
|
}), r;
|
|
32
32
|
}), [
|
|
33
33
|
l,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
]),
|
|
39
|
-
|
|
34
|
+
m,
|
|
35
|
+
b,
|
|
36
|
+
g,
|
|
37
|
+
S
|
|
38
|
+
]), w = async () => {
|
|
39
|
+
y(!0);
|
|
40
40
|
let e = await fetch("https://raw.githubusercontent.com/FortAwesome/Font-Awesome/6.x/metadata/icons.json");
|
|
41
|
-
|
|
41
|
+
h(await e.json()), y(!1);
|
|
42
42
|
};
|
|
43
43
|
t(() => {
|
|
44
|
-
|
|
44
|
+
w();
|
|
45
45
|
}, []);
|
|
46
|
-
let
|
|
46
|
+
let T = e((e) => x(e), []), E = e((e) => (t) => p?.(e, t), [p]), D = e((e) => _(e), []);
|
|
47
47
|
return /* @__PURE__ */ a("div", {
|
|
48
48
|
className: "flex grow basis-0 flex-col gap-4 py-2",
|
|
49
49
|
children: [
|
|
50
|
+
/* @__PURE__ */ i(s, {
|
|
51
|
+
value: f,
|
|
52
|
+
label: "Meaning",
|
|
53
|
+
placeholder: "Only for an icon that says something alone",
|
|
54
|
+
onChange: E("label"),
|
|
55
|
+
size: "xs"
|
|
56
|
+
}),
|
|
50
57
|
/* @__PURE__ */ a(c, {
|
|
51
|
-
value:
|
|
58
|
+
value: g,
|
|
52
59
|
placeholder: "All",
|
|
53
60
|
label: "Icon Type",
|
|
54
|
-
onChange:
|
|
61
|
+
onChange: D,
|
|
55
62
|
size: "xs",
|
|
56
63
|
children: [
|
|
57
64
|
/* @__PURE__ */ i("option", {
|
|
@@ -72,7 +79,7 @@ var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "", onUpdate: f }
|
|
|
72
79
|
label: "Icon Animation",
|
|
73
80
|
value: d,
|
|
74
81
|
placeholder: "None",
|
|
75
|
-
onChange:
|
|
82
|
+
onChange: E("iconAnimation"),
|
|
76
83
|
size: "xs",
|
|
77
84
|
children: [
|
|
78
85
|
/* @__PURE__ */ i("option", {
|
|
@@ -108,7 +115,7 @@ var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "", onUpdate: f }
|
|
|
108
115
|
/* @__PURE__ */ a(c, {
|
|
109
116
|
value: u,
|
|
110
117
|
label: "Icon Size",
|
|
111
|
-
onChange:
|
|
118
|
+
onChange: E("size"),
|
|
112
119
|
size: "xs",
|
|
113
120
|
children: [
|
|
114
121
|
/* @__PURE__ */ i("option", {
|
|
@@ -130,16 +137,16 @@ var l = ({ icon: l = "", size: u = "fa-1x", iconAnimation: d = "", onUpdate: f }
|
|
|
130
137
|
]
|
|
131
138
|
}),
|
|
132
139
|
/* @__PURE__ */ i(s, {
|
|
133
|
-
value:
|
|
140
|
+
value: b,
|
|
134
141
|
placeholder: "Search Icon...",
|
|
135
|
-
onChange:
|
|
142
|
+
onChange: T,
|
|
136
143
|
size: "xs"
|
|
137
144
|
}),
|
|
138
145
|
/* @__PURE__ */ i("div", {
|
|
139
146
|
className: "flex grow basis-0 flex-col overflow-auto py-2",
|
|
140
147
|
children: /* @__PURE__ */ a("div", {
|
|
141
148
|
className: "flex flex-wrap items-center justify-center gap-1",
|
|
142
|
-
children: [
|
|
149
|
+
children: [v && /* @__PURE__ */ i("i", { className: "fa-solid fa-sync fa-spin fa-3x" }), !v && C]
|
|
143
150
|
})
|
|
144
151
|
})
|
|
145
152
|
]
|
|
@@ -3,11 +3,22 @@ export type ImageProps = {
|
|
|
3
3
|
ref?: RefObject<HTMLElement>;
|
|
4
4
|
className?: string;
|
|
5
5
|
src?: string;
|
|
6
|
+
/**
|
|
7
|
+
* What the picture shows, in words — read by screen readers and browser agents in its place, and shown when it
|
|
8
|
+
* cannot load. Say what it is for on this page, not what file it is: "Maya presenting the roadmap", not "photo".
|
|
9
|
+
*/
|
|
6
10
|
alt?: string;
|
|
11
|
+
/**
|
|
12
|
+
* A picture that adds nothing the words around it do not already say — a texture, an ornament, a photo beside a
|
|
13
|
+
* caption that describes it. It is left out of what assistive technology reads (`alt=""`), whatever `alt` says,
|
|
14
|
+
* and the linter stops asking for a description.
|
|
15
|
+
*/
|
|
16
|
+
decorative?: boolean;
|
|
7
17
|
fetchPriority?: 'high' | 'low' | 'auto';
|
|
8
|
-
|
|
18
|
+
/** `auto` leaves the choice to the browser — what the builder offers first. */
|
|
19
|
+
loadMode?: 'auto' | 'eager' | 'lazy';
|
|
9
20
|
};
|
|
10
|
-
declare const Image: ({ ref, className, src: srcProp, alt, fetchPriority, loadMode }: ImageProps) => import('react').JSX.Element;
|
|
21
|
+
declare const Image: ({ ref, className, src: srcProp, alt: altProp, decorative, fetchPriority, loadMode }: ImageProps) => import('react').JSX.Element;
|
|
11
22
|
declare const _default: {
|
|
12
23
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ImageProps>): import('react').JSX.Element;
|
|
13
24
|
displayName: string;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
2
|
import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
3
3
|
import { getFallbackSVGBase64 as n } from "./ImageHelper.mjs";
|
|
4
|
-
import { useCallback as r } from "react";
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
import
|
|
4
|
+
import { useCallback as r, useState as i } from "react";
|
|
5
|
+
import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
6
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
7
|
+
import s from "clsx";
|
|
8
8
|
//#region src/elements/media/Image/Image.tsx
|
|
9
|
-
var
|
|
10
|
-
let { settings: { previewMode:
|
|
11
|
-
|
|
12
|
-
}, []);
|
|
13
|
-
return p ? /* @__PURE__ */ a(t, {
|
|
9
|
+
var c = n(), l = "https://cdn.plitzi.com/resources/img/placeholder-img.svg", u = ({ ref: e, className: n = "", src: u, alt: d = "", decorative: f = !1, fetchPriority: p = "auto", loadMode: m }) => {
|
|
10
|
+
let { settings: { previewMode: h } } = a(), g = u || l, _ = f ? "" : d, [v, y] = i(void 0), b = v === g, x = r(() => y(g), [g]), S = b ? c : g, C = b ? { "data-plitzi-failed": g } : {}, w = m === "auto" ? void 0 : m;
|
|
11
|
+
return h ? /* @__PURE__ */ o(t, {
|
|
14
12
|
tag: "img",
|
|
15
13
|
draggable: !1,
|
|
16
14
|
ref: e,
|
|
17
|
-
className:
|
|
18
|
-
src:
|
|
19
|
-
alt:
|
|
20
|
-
loading:
|
|
21
|
-
fetchPriority:
|
|
22
|
-
onError:
|
|
23
|
-
|
|
15
|
+
className: s("plitzi-component__image", n),
|
|
16
|
+
src: S,
|
|
17
|
+
alt: _,
|
|
18
|
+
loading: w,
|
|
19
|
+
fetchPriority: p,
|
|
20
|
+
onError: b ? void 0 : x,
|
|
21
|
+
...C
|
|
22
|
+
}) : /* @__PURE__ */ o(t, {
|
|
24
23
|
ref: e,
|
|
25
|
-
className:
|
|
26
|
-
children: /* @__PURE__ */
|
|
24
|
+
className: s("plitzi-component__image image--edit-mode", n),
|
|
25
|
+
children: /* @__PURE__ */ o("img", {
|
|
27
26
|
draggable: !1,
|
|
28
|
-
src:
|
|
29
|
-
alt:
|
|
30
|
-
loading:
|
|
31
|
-
fetchPriority:
|
|
32
|
-
onError:
|
|
27
|
+
src: S,
|
|
28
|
+
alt: _,
|
|
29
|
+
loading: w,
|
|
30
|
+
fetchPriority: p,
|
|
31
|
+
onError: b ? void 0 : x,
|
|
32
|
+
...C
|
|
33
33
|
})
|
|
34
34
|
});
|
|
35
|
-
},
|
|
35
|
+
}, d = e(u);
|
|
36
36
|
//#endregion
|
|
37
|
-
export {
|
|
37
|
+
export { u as Image, d as default };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
type SettingsProps = {
|
|
2
2
|
src?: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
decorative?: boolean;
|
|
3
5
|
fetchPriority?: 'high' | 'low' | 'auto';
|
|
4
6
|
loadMode?: 'auto' | 'lazy' | 'eager';
|
|
5
7
|
variables?: Record<string, string>;
|
|
6
8
|
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
7
9
|
};
|
|
8
|
-
declare const Settings: ({ src, variables, fetchPriority, loadMode, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
10
|
+
declare const Settings: ({ src, alt, decorative, variables, fetchPriority, loadMode, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
9
11
|
export default Settings;
|
|
@@ -1,37 +1,51 @@
|
|
|
1
1
|
import { useCallback as e, useMemo as t } from "react";
|
|
2
2
|
import { processTwig as n } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
3
3
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
-
import a from "@plitzi/plitzi-ui/
|
|
5
|
-
import o from "@plitzi/plitzi-ui/
|
|
4
|
+
import a from "@plitzi/plitzi-ui/Checkbox";
|
|
5
|
+
import o from "@plitzi/plitzi-ui/Input";
|
|
6
|
+
import s from "@plitzi/plitzi-ui/Select";
|
|
6
7
|
//#region src/elements/media/Image/Settings.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
8
|
+
var c = ({ src: c = "", alt: l = "", decorative: u = !1, variables: d, fetchPriority: f = "auto", loadMode: p = "auto", onUpdate: m }) => {
|
|
9
|
+
let h = t(() => n(c, d, !0), [d, c]), g = e((e) => (t) => m?.(e, t), [m]), _ = e((e) => m?.("decorative", e.target.checked), [m]);
|
|
9
10
|
return /* @__PURE__ */ i("div", {
|
|
10
11
|
className: "flex h-full flex-col gap-4 py-2",
|
|
11
12
|
children: [
|
|
12
13
|
/* @__PURE__ */ i("div", {
|
|
13
14
|
className: "flex flex-col",
|
|
14
|
-
children: [/* @__PURE__ */ r(
|
|
15
|
-
value:
|
|
15
|
+
children: [/* @__PURE__ */ r(o, {
|
|
16
|
+
value: c,
|
|
16
17
|
label: "Url",
|
|
17
|
-
onChange:
|
|
18
|
+
onChange: g("src"),
|
|
18
19
|
size: "xs"
|
|
19
|
-
}),
|
|
20
|
+
}), h && /* @__PURE__ */ i("div", {
|
|
20
21
|
className: "relative mt-2 flex items-center justify-center rounded-sm border border-gray-300 p-2",
|
|
21
22
|
children: [/* @__PURE__ */ r("div", {
|
|
22
23
|
className: "absolute top-2 left-2 rounded-tl rounded-br border border-gray-300 bg-white p-1 text-xs",
|
|
23
24
|
children: "Preview"
|
|
24
25
|
}), /* @__PURE__ */ r("img", {
|
|
25
|
-
src:
|
|
26
|
+
src: h,
|
|
26
27
|
alt: "",
|
|
27
28
|
className: "h-full w-full rounded-sm"
|
|
28
29
|
})]
|
|
29
30
|
})]
|
|
30
31
|
}),
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
+
!u && /* @__PURE__ */ r(o, {
|
|
32
33
|
value: l,
|
|
34
|
+
label: "Alt Text",
|
|
35
|
+
placeholder: "What the picture shows, for who cannot see it",
|
|
36
|
+
onChange: g("alt"),
|
|
37
|
+
size: "xs"
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ r(a, {
|
|
40
|
+
checked: u,
|
|
41
|
+
label: "Decorative (nothing to describe)",
|
|
42
|
+
onChange: _,
|
|
43
|
+
size: "xs"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ i(s, {
|
|
46
|
+
value: f,
|
|
33
47
|
label: "Fetch Priority",
|
|
34
|
-
onChange:
|
|
48
|
+
onChange: g("fetchPriority"),
|
|
35
49
|
size: "xs",
|
|
36
50
|
children: [
|
|
37
51
|
/* @__PURE__ */ r("option", {
|
|
@@ -48,10 +62,10 @@ var s = ({ src: s = "", variables: c, fetchPriority: l = "auto", loadMode: u = "
|
|
|
48
62
|
})
|
|
49
63
|
]
|
|
50
64
|
}),
|
|
51
|
-
/* @__PURE__ */ i(
|
|
52
|
-
value:
|
|
65
|
+
/* @__PURE__ */ i(s, {
|
|
66
|
+
value: p,
|
|
53
67
|
label: "Load Mode",
|
|
54
|
-
onChange:
|
|
68
|
+
onChange: g("loadMode"),
|
|
55
69
|
size: "xs",
|
|
56
70
|
children: [
|
|
57
71
|
/* @__PURE__ */ r("option", {
|
|
@@ -72,4 +86,4 @@ var s = ({ src: s = "", variables: c, fetchPriority: l = "auto", loadMode: u = "
|
|
|
72
86
|
});
|
|
73
87
|
};
|
|
74
88
|
//#endregion
|
|
75
|
-
export {
|
|
89
|
+
export { c as default };
|
|
@@ -4,10 +4,15 @@ import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring/declare';
|
|
|
4
4
|
export type ImageAttributes = AuthorableAttributes<ImageProps>;
|
|
5
5
|
declare const declaration: {
|
|
6
6
|
readonly type: "image";
|
|
7
|
+
readonly attributeValues: {
|
|
8
|
+
readonly fetchPriority: readonly string[];
|
|
9
|
+
readonly loadMode: readonly string[];
|
|
10
|
+
};
|
|
7
11
|
readonly content: {
|
|
8
12
|
readonly attributes: {
|
|
9
13
|
readonly src: "https://cdn.plitzi.com/resources/img/placeholder-img.svg";
|
|
10
14
|
readonly alt: "";
|
|
15
|
+
readonly decorative: false;
|
|
11
16
|
readonly fetchPriority: "auto";
|
|
12
17
|
readonly loadMode: "auto";
|
|
13
18
|
};
|
|
@@ -60,6 +65,7 @@ declare const declaration: {
|
|
|
60
65
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
61
66
|
src?: string | undefined;
|
|
62
67
|
alt?: string | undefined;
|
|
63
|
-
|
|
68
|
+
decorative?: boolean | undefined;
|
|
69
|
+
loadMode?: "auto" | "eager" | "lazy" | undefined;
|
|
64
70
|
}>>;
|
|
65
71
|
export default declaration;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring/declare";
|
|
1
|
+
import { elementDeclaration as e, valuesOf as t } from "@plitzi/sdk-shared/authoring/declare";
|
|
2
2
|
//#region src/elements/media/Image/declaration.ts
|
|
3
|
-
var
|
|
3
|
+
var n = e()({
|
|
4
4
|
type: "image",
|
|
5
|
+
attributeValues: {
|
|
6
|
+
fetchPriority: t()([
|
|
7
|
+
"high",
|
|
8
|
+
"low",
|
|
9
|
+
"auto"
|
|
10
|
+
]),
|
|
11
|
+
loadMode: t()([
|
|
12
|
+
"auto",
|
|
13
|
+
"eager",
|
|
14
|
+
"lazy"
|
|
15
|
+
])
|
|
16
|
+
},
|
|
5
17
|
content: {
|
|
6
18
|
attributes: {
|
|
7
19
|
src: "https://cdn.plitzi.com/resources/img/placeholder-img.svg",
|
|
8
20
|
alt: "",
|
|
21
|
+
decorative: !1,
|
|
9
22
|
fetchPriority: "auto",
|
|
10
23
|
loadMode: "auto"
|
|
11
24
|
},
|
|
@@ -48,4 +61,4 @@ var t = e()({
|
|
|
48
61
|
}
|
|
49
62
|
});
|
|
50
63
|
//#endregion
|
|
51
|
-
export {
|
|
64
|
+
export { n as default };
|
|
@@ -3,10 +3,15 @@ declare const Image: {
|
|
|
3
3
|
displayName: string;
|
|
4
4
|
} & {
|
|
5
5
|
readonly type: "image";
|
|
6
|
+
readonly attributeValues: {
|
|
7
|
+
readonly fetchPriority: readonly string[];
|
|
8
|
+
readonly loadMode: readonly string[];
|
|
9
|
+
};
|
|
6
10
|
readonly content: {
|
|
7
11
|
readonly attributes: {
|
|
8
12
|
readonly src: "https://cdn.plitzi.com/resources/img/placeholder-img.svg";
|
|
9
13
|
readonly alt: "";
|
|
14
|
+
readonly decorative: false;
|
|
10
15
|
readonly fetchPriority: "auto";
|
|
11
16
|
readonly loadMode: "auto";
|
|
12
17
|
};
|
|
@@ -59,6 +64,7 @@ declare const Image: {
|
|
|
59
64
|
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
60
65
|
src?: string | undefined;
|
|
61
66
|
alt?: string | undefined;
|
|
62
|
-
|
|
67
|
+
decorative?: boolean | undefined;
|
|
68
|
+
loadMode?: "auto" | "eager" | "lazy" | undefined;
|
|
63
69
|
}>>;
|
|
64
70
|
export default Image;
|