@plitzi/sdk-elements 0.39.12 → 0.39.14
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 +28 -0
- package/dist/Element/PluginManager.mjs +13 -13
- package/dist/Element/hooks/useElementState.d.ts +1 -1
- package/dist/Element/hooks/useFullscreenInteractions.d.ts +11 -0
- package/dist/Element/hooks/useFullscreenInteractions.mjs +14 -0
- package/dist/Element/hooks/useRootElementInteractions.mjs +93 -87
- package/dist/builder/ruleFields.d.ts +1 -1
- package/dist/builder/ruleFields.mjs +5 -0
- package/dist/dataSource/GlobalSources.mjs +121 -104
- package/dist/dataSource/useAudienceScope.mjs +2 -1
- package/dist/dataSource/usePageClock.d.ts +12 -0
- package/dist/dataSource/usePageClock.mjs +19 -0
- package/dist/elements/basic/Countdown/Countdown.d.ts +23 -0
- package/dist/elements/basic/Countdown/Countdown.mjs +58 -0
- package/dist/elements/basic/Countdown/Settings.d.ts +12 -0
- package/dist/elements/basic/Countdown/Settings.mjs +94 -0
- package/dist/elements/basic/Countdown/declaration.d.ts +72 -0
- package/dist/elements/basic/Countdown/declaration.mjs +58 -0
- package/dist/elements/basic/Countdown/index.d.ts +69 -0
- package/dist/elements/basic/Countdown/index.mjs +5 -0
- package/dist/elements/declarations/index.d.ts +508 -7
- package/dist/elements/declarations/index.mjs +84 -72
- package/dist/elements/index.d.ts +13 -3
- package/dist/elements/index.mjs +76 -66
- package/dist/elements/media/Image/Image.d.ts +6 -1
- package/dist/elements/media/Image/Image.mjs +44 -35
- package/dist/elements/media/Image/Settings.d.ts +2 -1
- package/dist/elements/media/Image/Settings.mjs +26 -19
- package/dist/elements/media/Image/declaration.d.ts +2 -0
- package/dist/elements/media/Image/declaration.mjs +2 -1
- package/dist/elements/media/Image/index.d.ts +2 -0
- package/dist/elements/settings.mjs +92 -80
- package/dist/elements/structure/Container/Container.d.ts +2 -4
- package/dist/elements/structure/Container/Container.mjs +5 -6
- package/dist/elements/structure/Container/Settings.d.ts +1 -2
- package/dist/elements/structure/Container/Settings.mjs +5 -19
- package/dist/elements/structure/Container/declaration.d.ts +1 -2
- package/dist/elements/structure/Container/declaration.mjs +1 -3
- package/dist/elements/structure/Container/index.d.ts +1 -2
- package/dist/elements/structure/Disclosure/Disclosure.d.ts +26 -0
- package/dist/elements/structure/Disclosure/Disclosure.mjs +49 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/DisclosureSummary.d.ts +16 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/DisclosureSummary.mjs +19 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/Settings.d.ts +7 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/Settings.mjs +20 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/declaration.d.ts +59 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/declaration.mjs +47 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/index.d.ts +57 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/index.mjs +5 -0
- package/dist/elements/structure/Disclosure/Settings.d.ts +10 -0
- package/dist/elements/structure/Disclosure/Settings.mjs +47 -0
- package/dist/elements/structure/Disclosure/declaration.d.ts +66 -0
- package/dist/elements/structure/Disclosure/declaration.mjs +55 -0
- package/dist/elements/structure/Disclosure/index.d.ts +121 -0
- package/dist/elements/structure/Disclosure/index.mjs +9 -0
- package/dist/elements/structure/Disclosure/useDetails.d.ts +27 -0
- package/dist/elements/structure/Disclosure/useDetails.mjs +49 -0
- package/dist/elements/structure/TimeWindow/TimeWindow.mjs +29 -25
- package/dist/elements/structure/TimeWindow/TimeWindowContext.d.ts +6 -0
- package/dist/elements/structure/TimeWindow/TimeWindowContext.mjs +4 -0
- package/dist/elements/{testing → structure}/Variants/Settings.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/Settings.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/VariantItem.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/declaration.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/declaration.mjs +2 -2
- package/dist/elements/{testing → structure}/Variants/VariantItem/index.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/index.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/Variants.mjs +12 -12
- package/dist/elements/{testing → structure/Variants}/childOfItem.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/declaration.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/declaration.mjs +3 -3
- package/dist/elements/{testing → structure}/Variants/index.d.ts +2 -2
- package/dist/elements/{testing → structure}/Variants/index.mjs +1 -1
- package/dist/elements/user/Account/Account.d.ts +25 -0
- package/dist/elements/user/Account/Account.mjs +104 -0
- package/dist/elements/user/Account/Settings.d.ts +10 -0
- package/dist/elements/user/Account/Settings.mjs +47 -0
- package/dist/elements/user/Account/declaration.d.ts +143 -0
- package/dist/elements/user/Account/declaration.mjs +123 -0
- package/dist/elements/user/Account/index.d.ts +141 -0
- package/dist/elements/user/Account/index.mjs +5 -0
- package/dist/elements/user/Avatar/Avatar.d.ts +19 -0
- package/dist/elements/user/Avatar/Avatar.mjs +26 -0
- package/dist/elements/user/Avatar/AvatarFace.d.ts +15 -0
- package/dist/elements/user/Avatar/AvatarFace.mjs +28 -0
- package/dist/elements/user/Avatar/Settings.d.ts +9 -0
- package/dist/elements/user/Avatar/Settings.mjs +38 -0
- package/dist/elements/user/Avatar/declaration.d.ts +65 -0
- package/dist/elements/user/Avatar/declaration.mjs +53 -0
- package/dist/elements/user/Avatar/faces.d.ts +10 -0
- package/dist/elements/user/Avatar/faces.mjs +10 -0
- package/dist/elements/user/Avatar/index.d.ts +63 -0
- package/dist/elements/user/Avatar/index.mjs +5 -0
- package/dist/elements/user/SignInForm/Settings.d.ts +16 -0
- package/dist/elements/user/SignInForm/Settings.mjs +64 -0
- package/dist/elements/user/SignInForm/SignInForm.d.ts +34 -0
- package/dist/elements/user/SignInForm/SignInForm.mjs +112 -0
- package/dist/elements/user/SignInForm/declaration.d.ts +120 -0
- package/dist/elements/user/SignInForm/declaration.mjs +99 -0
- package/dist/elements/user/SignInForm/index.d.ts +118 -0
- package/dist/elements/user/SignInForm/index.mjs +5 -0
- package/dist/index.d.ts +514 -6
- package/dist/index.mjs +84 -74
- package/package.json +7 -7
- /package/dist/elements/{testing → structure}/Variants/Settings.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/VariantItem/Settings.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/VariantItem/VariantItem.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/Variants.d.ts +0 -0
- /package/dist/elements/{testing → structure/Variants}/childOfItem.d.ts +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
declare const Account: import('react').FC<import('../../..').WithElementProps<import('./Account').AccountProps>> & {
|
|
2
|
+
readonly type: "account";
|
|
3
|
+
readonly contentAttributes: readonly ["signInLabel", "signOutLabel"];
|
|
4
|
+
readonly content: {
|
|
5
|
+
readonly attributes: {
|
|
6
|
+
readonly signInHref: "";
|
|
7
|
+
readonly signInLabel: "Sign in";
|
|
8
|
+
readonly signOutLabel: "Sign out";
|
|
9
|
+
readonly signOutHref: "";
|
|
10
|
+
};
|
|
11
|
+
readonly definition: {
|
|
12
|
+
readonly label: "Account";
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly items: [];
|
|
15
|
+
readonly styleSelectors: {
|
|
16
|
+
readonly signIn: "";
|
|
17
|
+
readonly trigger: "";
|
|
18
|
+
readonly panel: "";
|
|
19
|
+
readonly identity: "";
|
|
20
|
+
readonly signOut: "";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly market: {
|
|
24
|
+
readonly category: "user";
|
|
25
|
+
readonly icon: "fa-solid fa-user-gear";
|
|
26
|
+
};
|
|
27
|
+
readonly defaultStyle: {
|
|
28
|
+
readonly style: {
|
|
29
|
+
readonly base: {
|
|
30
|
+
readonly default: {
|
|
31
|
+
readonly position: "relative";
|
|
32
|
+
readonly display: "inline-flex";
|
|
33
|
+
readonly 'align-items': "center";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly signIn: {
|
|
37
|
+
readonly default: {
|
|
38
|
+
readonly display: "inline-flex";
|
|
39
|
+
readonly 'align-items': "center";
|
|
40
|
+
readonly 'padding-top': "8px";
|
|
41
|
+
readonly 'padding-right': "14px";
|
|
42
|
+
readonly 'padding-bottom': "8px";
|
|
43
|
+
readonly 'padding-left': "14px";
|
|
44
|
+
readonly 'border-top-width': "0px";
|
|
45
|
+
readonly 'border-right-width': "0px";
|
|
46
|
+
readonly 'border-bottom-width': "0px";
|
|
47
|
+
readonly 'border-left-width': "0px";
|
|
48
|
+
readonly 'border-top-left-radius': "8px";
|
|
49
|
+
readonly 'border-top-right-radius': "8px";
|
|
50
|
+
readonly 'border-bottom-left-radius': "8px";
|
|
51
|
+
readonly 'border-bottom-right-radius': "8px";
|
|
52
|
+
readonly 'background-color': "light-dark(oklch(0.21 0.006 285.885), oklch(0.985 0 0))";
|
|
53
|
+
readonly color: "light-dark(oklch(0.985 0 0), oklch(0.21 0.006 285.885))";
|
|
54
|
+
readonly font: "inherit";
|
|
55
|
+
readonly 'font-weight': 600;
|
|
56
|
+
readonly 'text-decoration': "none";
|
|
57
|
+
readonly cursor: "pointer";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly trigger: {
|
|
61
|
+
readonly default: {
|
|
62
|
+
readonly display: "flex";
|
|
63
|
+
readonly 'border-top-left-radius': "50%";
|
|
64
|
+
readonly 'border-top-right-radius': "50%";
|
|
65
|
+
readonly 'border-bottom-left-radius': "50%";
|
|
66
|
+
readonly 'border-bottom-right-radius': "50%";
|
|
67
|
+
readonly cursor: "pointer";
|
|
68
|
+
readonly 'list-style': "none";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly panel: {
|
|
72
|
+
readonly default: {
|
|
73
|
+
readonly position: "absolute";
|
|
74
|
+
readonly top: "calc(100% + 8px)";
|
|
75
|
+
readonly right: "0px";
|
|
76
|
+
readonly 'z-index': 50;
|
|
77
|
+
readonly display: "flex";
|
|
78
|
+
readonly 'flex-direction': "column";
|
|
79
|
+
readonly gap: "2px";
|
|
80
|
+
readonly 'min-width': "220px";
|
|
81
|
+
readonly 'padding-top': "8px";
|
|
82
|
+
readonly 'padding-right': "8px";
|
|
83
|
+
readonly 'padding-bottom': "8px";
|
|
84
|
+
readonly 'padding-left': "8px";
|
|
85
|
+
readonly 'border-top-left-radius': "12px";
|
|
86
|
+
readonly 'border-top-right-radius': "12px";
|
|
87
|
+
readonly 'border-bottom-left-radius': "12px";
|
|
88
|
+
readonly 'border-bottom-right-radius': "12px";
|
|
89
|
+
readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
|
|
90
|
+
readonly 'box-shadow': "rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.12) 0px 8px 24px";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly identity: {
|
|
94
|
+
readonly default: {
|
|
95
|
+
readonly display: "flex";
|
|
96
|
+
readonly 'flex-direction': "column";
|
|
97
|
+
readonly gap: "2px";
|
|
98
|
+
readonly 'padding-top': "8px";
|
|
99
|
+
readonly 'padding-right': "10px";
|
|
100
|
+
readonly 'padding-bottom': "10px";
|
|
101
|
+
readonly 'padding-left': "10px";
|
|
102
|
+
readonly 'margin-bottom': "4px";
|
|
103
|
+
readonly 'border-bottom': "1px solid light-dark(oklch(0.92 0.004 286.32), oklch(0.32 0.006 285.885))";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly signOut: {
|
|
107
|
+
readonly default: {
|
|
108
|
+
readonly display: "flex";
|
|
109
|
+
readonly width: "100%";
|
|
110
|
+
readonly 'padding-top': "8px";
|
|
111
|
+
readonly 'padding-right': "10px";
|
|
112
|
+
readonly 'padding-bottom': "8px";
|
|
113
|
+
readonly 'padding-left': "10px";
|
|
114
|
+
readonly 'border-top-width': "0px";
|
|
115
|
+
readonly 'border-right-width': "0px";
|
|
116
|
+
readonly 'border-bottom-width': "0px";
|
|
117
|
+
readonly 'border-left-width': "0px";
|
|
118
|
+
readonly 'border-top-left-radius': "8px";
|
|
119
|
+
readonly 'border-top-right-radius': "8px";
|
|
120
|
+
readonly 'border-bottom-left-radius': "8px";
|
|
121
|
+
readonly 'border-bottom-right-radius': "8px";
|
|
122
|
+
readonly 'background-color': "transparent";
|
|
123
|
+
readonly color: "inherit";
|
|
124
|
+
readonly font: "inherit";
|
|
125
|
+
readonly 'text-align': "left";
|
|
126
|
+
readonly cursor: "pointer";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
readonly subTypes: {};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
} & {
|
|
134
|
+
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
135
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
136
|
+
signInHref?: string | undefined;
|
|
137
|
+
signInLabel?: string | undefined;
|
|
138
|
+
signOutLabel?: string | undefined;
|
|
139
|
+
signOutHref?: string | undefined;
|
|
140
|
+
}>>;
|
|
141
|
+
export default Account;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type AvatarProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement | null>;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Their picture. Empty, or one that does not load, and their initials are shown — their outline with no name. */
|
|
6
|
+
src?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Who it is: their initials and their colour are drawn from it, and it is what a screen reader says — `{{
|
|
9
|
+
* auth.details.username }}` for the visitor's own, a row's author in a list.
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Beside their name already — a byline, a member row — so a screen reader does not say it twice. */
|
|
13
|
+
decorative?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** A person: their picture, or their initials on a colour of their own, in a round box. */
|
|
16
|
+
declare const Avatar: ({ ref, className, src, name, decorative }: AvatarProps) => import('react').JSX.Element;
|
|
17
|
+
declare const _default: import('react').FC<import('../../..').WithElementProps<AvatarProps>>;
|
|
18
|
+
export default _default;
|
|
19
|
+
export { Avatar };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import e, { avatarHue as t } from "./AvatarFace.mjs";
|
|
2
|
+
import n from "../../../Element/hocs/withElement.mjs";
|
|
3
|
+
import r from "../../../Element/hooks/useElement.mjs";
|
|
4
|
+
import { RootElement as i } from "../../../Element/RootElement.mjs";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
import o from "clsx";
|
|
7
|
+
// src/elements/user/Avatar/Avatar.tsx
|
|
8
|
+
var s = ({ ref: n, className: s = "", src: c = "", name: l = "", decorative: u = !1 }) => {
|
|
9
|
+
let { definition: { styleSelectors: d } } = r(), f = !u && l ? {
|
|
10
|
+
role: "img",
|
|
11
|
+
"aria-label": l
|
|
12
|
+
} : { "aria-hidden": !0 };
|
|
13
|
+
return /* @__PURE__ */ a(i, {
|
|
14
|
+
tag: "span",
|
|
15
|
+
ref: n,
|
|
16
|
+
className: o("plitzi-component__avatar", s),
|
|
17
|
+
style: t(l),
|
|
18
|
+
...f,
|
|
19
|
+
children: /* @__PURE__ */ a(e, {
|
|
20
|
+
src: c,
|
|
21
|
+
name: l,
|
|
22
|
+
imageClassName: d.image
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}, c = n(s);
|
|
26
|
+
export { s as Avatar, c as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export type AvatarFaceProps = {
|
|
3
|
+
src?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
/** The class of its picture — the avatar element's `image` slot. */
|
|
6
|
+
imageClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A person's face inside an avatar's box: their picture, their initials when there is none or it does not load, and a
|
|
10
|
+
* person's outline when there is not even a name. Never read itself: the box around it says who it is.
|
|
11
|
+
*/
|
|
12
|
+
declare const AvatarFace: ({ src, name, imageClassName }: AvatarFaceProps) => import('react').JSX.Element;
|
|
13
|
+
/** The custom property a box carries its name's hue in, which the stylesheet colours it from. */
|
|
14
|
+
export declare const avatarHue: (name: string) => CSSProperties;
|
|
15
|
+
export default AvatarFace;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { hueOf as e, initialsOf as t } from "./faces.mjs";
|
|
2
|
+
import { useCallback as n, useState as r } from "react";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
+
import a from "clsx";
|
|
5
|
+
// src/elements/user/Avatar/AvatarFace.tsx
|
|
6
|
+
var o = ({ src: e = "", name: o = "", imageClassName: s }) => {
|
|
7
|
+
let [c, l] = r(void 0), u = t(o), d = n((t) => {
|
|
8
|
+
t?.complete && t.naturalWidth === 0 && e && l(e);
|
|
9
|
+
}, [e]);
|
|
10
|
+
return e && c !== e ? /* @__PURE__ */ i("img", {
|
|
11
|
+
ref: d,
|
|
12
|
+
className: a("plitzi-component__avatar-image", s),
|
|
13
|
+
src: e,
|
|
14
|
+
alt: "",
|
|
15
|
+
draggable: !1,
|
|
16
|
+
onError: () => l(e)
|
|
17
|
+
}) : u ? /* @__PURE__ */ i("span", {
|
|
18
|
+
className: "plitzi-component__avatar-initials",
|
|
19
|
+
children: u
|
|
20
|
+
}) : /* @__PURE__ */ i("svg", {
|
|
21
|
+
className: "plitzi-component__avatar-outline",
|
|
22
|
+
viewBox: "0 0 24 24",
|
|
23
|
+
fill: "currentColor",
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children: /* @__PURE__ */ i("path", { d: "M12 12a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Zm0 2c-4.4 0-8 2.5-8 5.5V21h16v-1.5c0-3-3.6-5.5-8-5.5Z" })
|
|
26
|
+
});
|
|
27
|
+
}, s = (t) => ({ "--plitzi-avatar-hue": e(t) });
|
|
28
|
+
export { s as avatarHue, o as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
src?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
decorative?: boolean;
|
|
5
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
6
|
+
};
|
|
7
|
+
/** An avatar's settings: whose picture and name it shows, and whether a screen reader says them. */
|
|
8
|
+
declare const Settings: ({ src, name, decorative, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
9
|
+
export default Settings;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import e from "../../useSettingsUpdate.mjs";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "@plitzi/plitzi-ui/Checkbox";
|
|
4
|
+
import i from "@plitzi/plitzi-ui/Input";
|
|
5
|
+
// src/elements/user/Avatar/Settings.tsx
|
|
6
|
+
var a = ({ src: a = "", name: o = "", decorative: s = !1, onUpdate: c }) => {
|
|
7
|
+
let l = e(c);
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: "flex flex-col gap-4 py-2",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ t(i, {
|
|
12
|
+
label: "Picture",
|
|
13
|
+
size: "xs",
|
|
14
|
+
placeholder: "https://…",
|
|
15
|
+
value: a,
|
|
16
|
+
onChange: l.text("src")
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ t(i, {
|
|
19
|
+
label: "Name",
|
|
20
|
+
size: "xs",
|
|
21
|
+
placeholder: "{{ auth.details.username }}",
|
|
22
|
+
value: o,
|
|
23
|
+
onChange: l.text("name")
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ t("span", {
|
|
26
|
+
className: "text-ui-fg-subtle text-xs",
|
|
27
|
+
children: "With no picture, or one that does not load, the initials of the name on a colour of its own."
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ t(r, {
|
|
30
|
+
label: "Decorative (the name is beside it)",
|
|
31
|
+
size: "xs",
|
|
32
|
+
checked: s,
|
|
33
|
+
onChange: l.checked("decorative")
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export { a as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AvatarProps } from './Avatar';
|
|
2
|
+
import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring';
|
|
3
|
+
/** What this element can be authored with — its component's own props, minus what the runtime supplies. */
|
|
4
|
+
export type AvatarAttributes = AuthorableAttributes<AvatarProps>;
|
|
5
|
+
declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
6
|
+
readonly type: "avatar";
|
|
7
|
+
readonly contentAttributes: readonly ["src", "name"];
|
|
8
|
+
readonly content: {
|
|
9
|
+
readonly attributes: {
|
|
10
|
+
readonly src: "";
|
|
11
|
+
readonly name: "";
|
|
12
|
+
readonly decorative: false;
|
|
13
|
+
};
|
|
14
|
+
readonly definition: {
|
|
15
|
+
readonly label: "Avatar";
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly items: [];
|
|
18
|
+
readonly styleSelectors: {
|
|
19
|
+
readonly image: "";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly market: {
|
|
23
|
+
readonly category: "user";
|
|
24
|
+
readonly icon: "fa-solid fa-circle-user";
|
|
25
|
+
};
|
|
26
|
+
readonly defaultStyle: {
|
|
27
|
+
readonly style: {
|
|
28
|
+
readonly base: {
|
|
29
|
+
readonly default: {
|
|
30
|
+
readonly display: "inline-flex";
|
|
31
|
+
readonly 'align-items': "center";
|
|
32
|
+
readonly 'justify-content': "center";
|
|
33
|
+
readonly 'flex-shrink': 0;
|
|
34
|
+
readonly width: "40px";
|
|
35
|
+
readonly height: "40px";
|
|
36
|
+
readonly overflow: "hidden";
|
|
37
|
+
readonly 'border-top-left-radius': "50%";
|
|
38
|
+
readonly 'border-top-right-radius': "50%";
|
|
39
|
+
readonly 'border-bottom-left-radius': "50%";
|
|
40
|
+
readonly 'border-bottom-right-radius': "50%";
|
|
41
|
+
readonly 'font-size': "15px";
|
|
42
|
+
readonly 'font-weight': 600;
|
|
43
|
+
readonly 'line-height': 1;
|
|
44
|
+
readonly 'user-select': "none";
|
|
45
|
+
readonly 'background-color': "light-dark(oklch(0.9 0.06 var(--plitzi-avatar-hue, 260)), oklch(0.38 0.07 var(--plitzi-avatar-hue, 260)))";
|
|
46
|
+
readonly color: "light-dark(oklch(0.36 0.09 var(--plitzi-avatar-hue, 260)), oklch(0.93 0.04 var(--plitzi-avatar-hue, 260)))";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly image: {
|
|
50
|
+
readonly default: {
|
|
51
|
+
readonly width: "100%";
|
|
52
|
+
readonly height: "100%";
|
|
53
|
+
readonly 'object-fit': "cover";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly subTypes: {};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}, Partial<{
|
|
61
|
+
name?: string | undefined;
|
|
62
|
+
src?: string | undefined;
|
|
63
|
+
decorative?: boolean | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
export default declaration;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring";
|
|
2
|
+
// src/elements/user/Avatar/declaration.ts
|
|
3
|
+
var t = e()({
|
|
4
|
+
type: "avatar",
|
|
5
|
+
contentAttributes: ["src", "name"],
|
|
6
|
+
content: {
|
|
7
|
+
attributes: {
|
|
8
|
+
src: "",
|
|
9
|
+
name: "",
|
|
10
|
+
decorative: !1
|
|
11
|
+
},
|
|
12
|
+
definition: {
|
|
13
|
+
label: "Avatar",
|
|
14
|
+
description: "Shows a person by their picture (`src`), or — with none, or one that does not load — by their initials on a colour of their own, both drawn from their `name`; their outline with no name. A screen reader says the name; `decorative` when it is beside it already (a byline, a member row). `{{ auth.details.username }}` is the visitor’s own. 40px and round; its class sizes it, and its `image` slot styles the picture.",
|
|
15
|
+
items: [],
|
|
16
|
+
styleSelectors: { image: "" }
|
|
17
|
+
},
|
|
18
|
+
market: {
|
|
19
|
+
category: "user",
|
|
20
|
+
icon: "fa-solid fa-circle-user"
|
|
21
|
+
},
|
|
22
|
+
defaultStyle: {
|
|
23
|
+
style: {
|
|
24
|
+
base: { default: {
|
|
25
|
+
display: "inline-flex",
|
|
26
|
+
"align-items": "center",
|
|
27
|
+
"justify-content": "center",
|
|
28
|
+
"flex-shrink": 0,
|
|
29
|
+
width: "40px",
|
|
30
|
+
height: "40px",
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
"border-top-left-radius": "50%",
|
|
33
|
+
"border-top-right-radius": "50%",
|
|
34
|
+
"border-bottom-left-radius": "50%",
|
|
35
|
+
"border-bottom-right-radius": "50%",
|
|
36
|
+
"font-size": "15px",
|
|
37
|
+
"font-weight": 600,
|
|
38
|
+
"line-height": 1,
|
|
39
|
+
"user-select": "none",
|
|
40
|
+
"background-color": "light-dark(oklch(0.9 0.06 var(--plitzi-avatar-hue, 260)), oklch(0.38 0.07 var(--plitzi-avatar-hue, 260)))",
|
|
41
|
+
color: "light-dark(oklch(0.36 0.09 var(--plitzi-avatar-hue, 260)), oklch(0.93 0.04 var(--plitzi-avatar-hue, 260)))"
|
|
42
|
+
} },
|
|
43
|
+
image: { default: {
|
|
44
|
+
width: "100%",
|
|
45
|
+
height: "100%",
|
|
46
|
+
"object-fit": "cover"
|
|
47
|
+
} }
|
|
48
|
+
},
|
|
49
|
+
subTypes: {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export { t as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A person's initials from their name: the first letter of the first word and of the last — "Ada Lovelace" is AL, an
|
|
3
|
+
* address its first letter alone ("ada@example.com" is A). Letters, not code units: an accented or a CJK one stays whole.
|
|
4
|
+
*/
|
|
5
|
+
export declare const initialsOf: (name: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* A hue of its own for a name, 0–359: the same name is the same colour on every page and in every list, and two names
|
|
8
|
+
* beside each other are told apart. A hash, not a lookup: there is nothing to keep.
|
|
9
|
+
*/
|
|
10
|
+
export declare const hueOf: (name: string) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/elements/user/Avatar/faces.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
let t = e.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean), n = t.at(0);
|
|
4
|
+
return n === void 0 ? "" : [n, t.length > 1 ? t.at(-1) : void 0].map((e) => e === void 0 ? "" : Array.from(e).at(0) ?? "").join("").toLocaleUpperCase();
|
|
5
|
+
}, t = (e) => {
|
|
6
|
+
let t = 0;
|
|
7
|
+
for (let n of e) t = (t * 31 + (n.codePointAt(0) ?? 0)) % 360;
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
export { t as hueOf, e as initialsOf };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
declare const Avatar: import('react').FC<import('../../..').WithElementProps<import('./Avatar').AvatarProps>> & {
|
|
2
|
+
readonly type: "avatar";
|
|
3
|
+
readonly contentAttributes: readonly ["src", "name"];
|
|
4
|
+
readonly content: {
|
|
5
|
+
readonly attributes: {
|
|
6
|
+
readonly src: "";
|
|
7
|
+
readonly name: "";
|
|
8
|
+
readonly decorative: false;
|
|
9
|
+
};
|
|
10
|
+
readonly definition: {
|
|
11
|
+
readonly label: "Avatar";
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly items: [];
|
|
14
|
+
readonly styleSelectors: {
|
|
15
|
+
readonly image: "";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly market: {
|
|
19
|
+
readonly category: "user";
|
|
20
|
+
readonly icon: "fa-solid fa-circle-user";
|
|
21
|
+
};
|
|
22
|
+
readonly defaultStyle: {
|
|
23
|
+
readonly style: {
|
|
24
|
+
readonly base: {
|
|
25
|
+
readonly default: {
|
|
26
|
+
readonly display: "inline-flex";
|
|
27
|
+
readonly 'align-items': "center";
|
|
28
|
+
readonly 'justify-content': "center";
|
|
29
|
+
readonly 'flex-shrink': 0;
|
|
30
|
+
readonly width: "40px";
|
|
31
|
+
readonly height: "40px";
|
|
32
|
+
readonly overflow: "hidden";
|
|
33
|
+
readonly 'border-top-left-radius': "50%";
|
|
34
|
+
readonly 'border-top-right-radius': "50%";
|
|
35
|
+
readonly 'border-bottom-left-radius': "50%";
|
|
36
|
+
readonly 'border-bottom-right-radius': "50%";
|
|
37
|
+
readonly 'font-size': "15px";
|
|
38
|
+
readonly 'font-weight': 600;
|
|
39
|
+
readonly 'line-height': 1;
|
|
40
|
+
readonly 'user-select': "none";
|
|
41
|
+
readonly 'background-color': "light-dark(oklch(0.9 0.06 var(--plitzi-avatar-hue, 260)), oklch(0.38 0.07 var(--plitzi-avatar-hue, 260)))";
|
|
42
|
+
readonly color: "light-dark(oklch(0.36 0.09 var(--plitzi-avatar-hue, 260)), oklch(0.93 0.04 var(--plitzi-avatar-hue, 260)))";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly image: {
|
|
46
|
+
readonly default: {
|
|
47
|
+
readonly width: "100%";
|
|
48
|
+
readonly height: "100%";
|
|
49
|
+
readonly 'object-fit': "cover";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly subTypes: {};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
} & {
|
|
57
|
+
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
58
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
59
|
+
name?: string | undefined;
|
|
60
|
+
src?: string | undefined;
|
|
61
|
+
decorative?: boolean | undefined;
|
|
62
|
+
}>>;
|
|
63
|
+
export default Avatar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
usernameLabel?: string;
|
|
3
|
+
passwordLabel?: string;
|
|
4
|
+
codeLabel?: string;
|
|
5
|
+
submitLabel?: string;
|
|
6
|
+
redirectTo?: string;
|
|
7
|
+
wrongMessage?: string;
|
|
8
|
+
unverifiedMessage?: string;
|
|
9
|
+
blockedMessage?: string;
|
|
10
|
+
ssoMessage?: string;
|
|
11
|
+
networkMessage?: string;
|
|
12
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
13
|
+
};
|
|
14
|
+
/** A sign-in form's settings: its words, where a visitor goes once signed in, and what each refusal says. */
|
|
15
|
+
declare const Settings: (props: SettingsProps) => import('react').JSX.Element;
|
|
16
|
+
export default Settings;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import e from "../../useSettingsUpdate.mjs";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "@plitzi/plitzi-ui/Input";
|
|
4
|
+
// src/elements/user/SignInForm/Settings.tsx
|
|
5
|
+
var i = [
|
|
6
|
+
["wrongMessage", "Wrong email or password"],
|
|
7
|
+
["unverifiedMessage", "Email not confirmed"],
|
|
8
|
+
["blockedMessage", "Account blocked"],
|
|
9
|
+
["ssoMessage", "Single sign-on required"],
|
|
10
|
+
["networkMessage", "Could not be reached"]
|
|
11
|
+
], a = (a) => {
|
|
12
|
+
let { usernameLabel: o = "Email", passwordLabel: s = "Password", codeLabel: c = "Code", submitLabel: l = "Sign in", redirectTo: u = "", onUpdate: d } = a, f = e(d);
|
|
13
|
+
return /* @__PURE__ */ n("div", {
|
|
14
|
+
className: "flex flex-col gap-4 py-2",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ t(r, {
|
|
17
|
+
label: "Email label",
|
|
18
|
+
size: "xs",
|
|
19
|
+
value: o,
|
|
20
|
+
onChange: f.text("usernameLabel")
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ t(r, {
|
|
23
|
+
label: "Password label",
|
|
24
|
+
size: "xs",
|
|
25
|
+
value: s,
|
|
26
|
+
onChange: f.text("passwordLabel")
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ t(r, {
|
|
29
|
+
label: "Code label",
|
|
30
|
+
size: "xs",
|
|
31
|
+
value: c,
|
|
32
|
+
onChange: f.text("codeLabel")
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ t(r, {
|
|
35
|
+
label: "Button",
|
|
36
|
+
size: "xs",
|
|
37
|
+
value: l,
|
|
38
|
+
onChange: f.text("submitLabel")
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ t(r, {
|
|
41
|
+
label: "Once signed in",
|
|
42
|
+
size: "xs",
|
|
43
|
+
placeholder: "Back where they came from",
|
|
44
|
+
value: u,
|
|
45
|
+
onChange: f.text("redirectTo")
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ t("span", {
|
|
48
|
+
className: "text-ui-fg-subtle text-xs",
|
|
49
|
+
children: "Empty, back to the ?redirect= of this site they were sent with, or they stay on the page."
|
|
50
|
+
}),
|
|
51
|
+
i.map(([e, n]) => /* @__PURE__ */ t(r, {
|
|
52
|
+
label: n,
|
|
53
|
+
size: "xs",
|
|
54
|
+
value: a[e] ?? "",
|
|
55
|
+
onChange: f.text(e)
|
|
56
|
+
}, e)),
|
|
57
|
+
/* @__PURE__ */ t("span", {
|
|
58
|
+
className: "text-ui-fg-subtle text-xs",
|
|
59
|
+
children: "Through a provider that signs in by going out and back — Plitzi’s — it is one button; the fields are for the space’s own sign-in."
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { a as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type SignInFormProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement | null>;
|
|
4
|
+
className?: string;
|
|
5
|
+
usernameLabel?: string;
|
|
6
|
+
passwordLabel?: string;
|
|
7
|
+
/** The second factor's field, asked for once the password was right and the account has one. */
|
|
8
|
+
codeLabel?: string;
|
|
9
|
+
submitLabel?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Where a visitor goes once in. Empty, back to the `?redirect=` they were sent with — a page of this site — or
|
|
12
|
+
* nowhere: the page shows itself to them with their session.
|
|
13
|
+
*/
|
|
14
|
+
redirectTo?: string;
|
|
15
|
+
/** Said when the address or the password is not right. */
|
|
16
|
+
wrongMessage?: string;
|
|
17
|
+
/** Said when the password was right and the address has never been confirmed. */
|
|
18
|
+
unverifiedMessage?: string;
|
|
19
|
+
/** Said when the account is blocked or was closed. */
|
|
20
|
+
blockedMessage?: string;
|
|
21
|
+
/** Said when the account's organization signs it in through its own single sign-on. */
|
|
22
|
+
ssoMessage?: string;
|
|
23
|
+
/** Said when the sign-in could not be reached at all. */
|
|
24
|
+
networkMessage?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The space's sign-in. Through Plitzi — or any provider that signs in by going out and back — one button; against the
|
|
28
|
+
* space's own sign-in (`basic`), its address and password, then the code of a second factor when the account has one.
|
|
29
|
+
* Every refusal is said for what it is, and a visitor signed in goes back to where they were sent from.
|
|
30
|
+
*/
|
|
31
|
+
declare const SignInForm: ({ ref, className, usernameLabel, passwordLabel, codeLabel, submitLabel, redirectTo, wrongMessage, unverifiedMessage, blockedMessage, ssoMessage, networkMessage }: SignInFormProps) => import('react').JSX.Element;
|
|
32
|
+
declare const _default: import('react').FC<import('../../..').WithElementProps<SignInFormProps>>;
|
|
33
|
+
export default _default;
|
|
34
|
+
export { SignInForm };
|