@plitzi/sdk-elements 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/elements/declarations/index.d.ts +78 -2
- package/dist/elements/declarations/index.mjs +24 -22
- package/dist/elements/form/Form/Form.d.ts +2 -1
- package/dist/elements/form/FormControl/FormControl.d.ts +7 -9
- package/dist/elements/form/FormControl/FormControl.mjs +110 -105
- package/dist/elements/form/FormControl/Settings.d.ts +4 -2
- package/dist/elements/form/FormControl/Settings.mjs +113 -172
- package/dist/elements/form/FormControl/declaration.d.ts +45 -1
- package/dist/elements/form/FormControl/declaration.mjs +7 -20
- package/dist/elements/form/FormControl/hocs/withFieldValue.d.ts +2 -1
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +4 -1
- package/dist/elements/form/FormControl/index.d.ts +45 -1
- package/dist/elements/form/FormControl/inputs/FileInput.d.ts +21 -0
- package/dist/elements/form/FormControl/inputs/FileInput.mjs +29 -0
- package/dist/elements/form/FormControl/subTypes.d.ts +17 -0
- package/dist/elements/form/FormControl/subTypes.mjs +58 -0
- package/dist/elements/index.d.ts +3 -1
- package/dist/elements/index.mjs +12 -10
- package/dist/elements/settings.mjs +20 -18
- package/dist/elements/structure/FocusGroup/FocusGroup.d.ts +24 -0
- package/dist/elements/structure/FocusGroup/FocusGroup.mjs +27 -0
- package/dist/elements/structure/FocusGroup/Settings.d.ts +8 -0
- package/dist/elements/structure/FocusGroup/Settings.mjs +39 -0
- package/dist/elements/structure/FocusGroup/arrowFocus.d.ts +12 -0
- package/dist/elements/structure/FocusGroup/arrowFocus.mjs +30 -0
- package/dist/elements/structure/FocusGroup/declaration.d.ts +36 -0
- package/dist/elements/structure/FocusGroup/declaration.mjs +28 -0
- package/dist/elements/structure/FocusGroup/index.d.ts +37 -0
- package/dist/elements/structure/FocusGroup/index.mjs +6 -0
- package/dist/index.d.ts +81 -1
- package/dist/index.mjs +19 -17
- package/package.json +7 -7
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import e from "../helpers/useBlurValidation.mjs";
|
|
2
|
+
import { useEffect as t, useRef as n } from "react";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
import i from "clsx";
|
|
5
|
+
//#region src/elements/form/FormControl/inputs/FileInput.tsx
|
|
6
|
+
var a = ({ className: a = "", fieldClassName: o, id: s = "", name: c = "", accept: l = "", chosen: u, required: d = !1, disabled: f = !1, previewMode: p = !0, onChange: m, onValidate: h, errorId: g }) => {
|
|
7
|
+
let _ = n(null), v = e(h);
|
|
8
|
+
return t(() => {
|
|
9
|
+
!u && _.current && (_.current.value = "");
|
|
10
|
+
}, [u]), /* @__PURE__ */ r("div", {
|
|
11
|
+
className: i("form-control__input-container", a),
|
|
12
|
+
children: /* @__PURE__ */ r("input", {
|
|
13
|
+
ref: _,
|
|
14
|
+
className: i("input-container__input", o),
|
|
15
|
+
id: s,
|
|
16
|
+
"aria-invalid": g ? !0 : void 0,
|
|
17
|
+
"aria-describedby": g,
|
|
18
|
+
name: c,
|
|
19
|
+
type: "file",
|
|
20
|
+
accept: l || void 0,
|
|
21
|
+
required: d,
|
|
22
|
+
disabled: f || !p,
|
|
23
|
+
onChange: m,
|
|
24
|
+
onBlur: v
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every kind of field a `formControl` is, as its `subType` — the one list: the component's props, the field-value HOC,
|
|
3
|
+
* the builder's settings and the declaration authoring reads all take their type from here.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FORM_CONTROL_SUBTYPES: readonly ["text", "number", "email", "password", "search", "url", "tel", "date", "time", "checkbox", "switch", "select", "textarea", "hidden", "color", "file"];
|
|
6
|
+
export type FormControlSubType = (typeof FORM_CONTROL_SUBTYPES)[number];
|
|
7
|
+
/** The ones drawn as an `<input>` of that type — `Input`; the rest have a component of their own. */
|
|
8
|
+
export declare const INPUT_SUBTYPES: readonly FormControlSubType[];
|
|
9
|
+
/** The ones that hold text somebody types: what a length, a pattern or a confirmation can mean anything for. */
|
|
10
|
+
export declare const TYPED_SUBTYPES: readonly FormControlSubType[];
|
|
11
|
+
/**
|
|
12
|
+
* What the builder's Input Type menu calls each, in the order it lists them — a `Record`, so a subtype added above and
|
|
13
|
+
* not here is a compile error rather than a type nobody can pick.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SUBTYPE_LABELS: Record<FormControlSubType, string>;
|
|
16
|
+
/** A checkbox and a switch: one box that holds `true` or `false`, drawn inside its label. */
|
|
17
|
+
export declare const CHECK_SUBTYPES: readonly FormControlSubType[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/elements/form/FormControl/subTypes.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"text",
|
|
4
|
+
"number",
|
|
5
|
+
"email",
|
|
6
|
+
"password",
|
|
7
|
+
"search",
|
|
8
|
+
"url",
|
|
9
|
+
"tel",
|
|
10
|
+
"date",
|
|
11
|
+
"time",
|
|
12
|
+
"checkbox",
|
|
13
|
+
"switch",
|
|
14
|
+
"select",
|
|
15
|
+
"textarea",
|
|
16
|
+
"hidden",
|
|
17
|
+
"color",
|
|
18
|
+
"file"
|
|
19
|
+
], t = [
|
|
20
|
+
"text",
|
|
21
|
+
"number",
|
|
22
|
+
"email",
|
|
23
|
+
"password",
|
|
24
|
+
"search",
|
|
25
|
+
"url",
|
|
26
|
+
"tel",
|
|
27
|
+
"date",
|
|
28
|
+
"time",
|
|
29
|
+
"color"
|
|
30
|
+
], n = [
|
|
31
|
+
"text",
|
|
32
|
+
"textarea",
|
|
33
|
+
"number",
|
|
34
|
+
"email",
|
|
35
|
+
"password",
|
|
36
|
+
"search",
|
|
37
|
+
"url",
|
|
38
|
+
"tel"
|
|
39
|
+
], r = {
|
|
40
|
+
text: "Text",
|
|
41
|
+
number: "Number",
|
|
42
|
+
date: "Date",
|
|
43
|
+
time: "Time",
|
|
44
|
+
email: "Email",
|
|
45
|
+
search: "Search",
|
|
46
|
+
url: "URL",
|
|
47
|
+
tel: "Phone",
|
|
48
|
+
password: "Password",
|
|
49
|
+
select: "Select",
|
|
50
|
+
checkbox: "Checkbox",
|
|
51
|
+
switch: "Switch",
|
|
52
|
+
textarea: "Long Text",
|
|
53
|
+
hidden: "Hidden",
|
|
54
|
+
color: "Color",
|
|
55
|
+
file: "File"
|
|
56
|
+
}, i = ["checkbox", "switch"];
|
|
57
|
+
//#endregion
|
|
58
|
+
export { i as CHECK_SUBTYPES, e as FORM_CONTROL_SUBTYPES, t as INPUT_SUBTYPES, r as SUBTYPE_LABELS, n as TYPED_SUBTYPES };
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { default as Channel } from './provider/Channel';
|
|
|
29
29
|
import { default as Carousel } from './structure/Carousel';
|
|
30
30
|
import { default as Container } from './structure/Container';
|
|
31
31
|
import { default as DialogContainer } from './structure/DialogContainer';
|
|
32
|
+
import { default as FocusGroup } from './structure/FocusGroup';
|
|
32
33
|
import { default as List } from './structure/List';
|
|
33
34
|
import { default as ModalContainer } from './structure/ModalContainer';
|
|
34
35
|
import { default as Pagination } from './structure/Pagination';
|
|
@@ -62,9 +63,10 @@ export * from './provider/ApiContainer';
|
|
|
62
63
|
export * from './provider/Channel';
|
|
63
64
|
export * from './structure/Container';
|
|
64
65
|
export * from './structure/DialogContainer';
|
|
66
|
+
export * from './structure/FocusGroup';
|
|
65
67
|
export * from './structure/List';
|
|
66
68
|
export * from './structure/ModalContainer';
|
|
67
69
|
export * from './structure/Pagination';
|
|
68
70
|
export * from './structure/Carousel';
|
|
69
71
|
export * from './structure/TabContainer';
|
|
70
|
-
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Carousel, Heading, Image, Video, Embed, Chart, Svg, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|
|
72
|
+
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, FocusGroup, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Carousel, Heading, Image, Video, Embed, Chart, Svg, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|
package/dist/elements/index.mjs
CHANGED
|
@@ -30,12 +30,13 @@ import O from "./provider/Channel/index.mjs";
|
|
|
30
30
|
import k from "./structure/Carousel/index.mjs";
|
|
31
31
|
import A from "./structure/Container/index.mjs";
|
|
32
32
|
import j from "./structure/DialogContainer/index.mjs";
|
|
33
|
-
import M from "./structure/
|
|
34
|
-
import N from "./structure/
|
|
35
|
-
import P from "./structure/
|
|
36
|
-
import F from "./structure/
|
|
33
|
+
import M from "./structure/FocusGroup/index.mjs";
|
|
34
|
+
import N from "./structure/List/index.mjs";
|
|
35
|
+
import P from "./structure/ModalContainer/index.mjs";
|
|
36
|
+
import F from "./structure/Pagination/index.mjs";
|
|
37
|
+
import I from "./structure/TabContainer/index.mjs";
|
|
37
38
|
//#region src/elements/index.ts
|
|
38
|
-
var
|
|
39
|
+
var L = /* @__PURE__ */ e({
|
|
39
40
|
ApiContainer: () => D,
|
|
40
41
|
BlockHtml: () => t,
|
|
41
42
|
BlockJsx: () => n,
|
|
@@ -48,6 +49,7 @@ var I = /* @__PURE__ */ e({
|
|
|
48
49
|
DialogContainer: () => j,
|
|
49
50
|
Dropdown: () => s,
|
|
50
51
|
Embed: () => S,
|
|
52
|
+
FocusGroup: () => M,
|
|
51
53
|
FontAwesome: () => C,
|
|
52
54
|
Form: () => h,
|
|
53
55
|
FormControl: () => g,
|
|
@@ -55,22 +57,22 @@ var I = /* @__PURE__ */ e({
|
|
|
55
57
|
Image: () => w,
|
|
56
58
|
LayoutContainer: () => _,
|
|
57
59
|
Link: () => l,
|
|
58
|
-
List: () =>
|
|
60
|
+
List: () => N,
|
|
59
61
|
Loading: () => v,
|
|
60
62
|
Markdown: () => u,
|
|
61
|
-
ModalContainer: () =>
|
|
63
|
+
ModalContainer: () => P,
|
|
62
64
|
NodeHtml: () => i,
|
|
63
65
|
NotFound: () => y,
|
|
64
66
|
Page: () => b,
|
|
65
|
-
Pagination: () =>
|
|
67
|
+
Pagination: () => F,
|
|
66
68
|
Paragraph: () => d,
|
|
67
69
|
Reference: () => a,
|
|
68
70
|
RichText: () => f,
|
|
69
71
|
Svg: () => T,
|
|
70
|
-
TabContainer: () =>
|
|
72
|
+
TabContainer: () => I,
|
|
71
73
|
Text: () => p,
|
|
72
74
|
ThemeToggle: () => m,
|
|
73
75
|
Video: () => E
|
|
74
76
|
});
|
|
75
77
|
//#endregion
|
|
76
|
-
export { D as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, k as Carousel, O as Channel, x as Chart, A as Container, r as Custom, j as DialogContainer, s as Dropdown, S as Embed, C as FontAwesome, h as Form, g as FormControl, c as Heading, w as Image, _ as LayoutContainer, l as Link,
|
|
78
|
+
export { D as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, k as Carousel, O as Channel, x as Chart, A as Container, r as Custom, j as DialogContainer, s as Dropdown, S as Embed, M as FocusGroup, C as FontAwesome, h as Form, g as FormControl, c as Heading, w as Image, _ as LayoutContainer, l as Link, N as List, v as Loading, u as Markdown, P as ModalContainer, i as NodeHtml, y as NotFound, b as Page, F as Pagination, d as Paragraph, a as Reference, f as RichText, T as Svg, I as TabContainer, p as Text, m as ThemeToggle, E as Video, L as elements_exports };
|
|
@@ -32,16 +32,17 @@ import A from "./structure/Carousel/CarouselTrack/Settings.mjs";
|
|
|
32
32
|
import j from "./structure/Carousel/Settings.mjs";
|
|
33
33
|
import M from "./structure/Container/Settings.mjs";
|
|
34
34
|
import N from "./structure/DialogContainer/Settings.mjs";
|
|
35
|
-
import P from "./structure/
|
|
36
|
-
import F from "./structure/List/Settings.mjs";
|
|
37
|
-
import I from "./structure/
|
|
38
|
-
import L from "./structure/
|
|
39
|
-
import R from "./structure/
|
|
40
|
-
import z from "./structure/TabContainer/
|
|
41
|
-
import B from "./structure/TabContainer/
|
|
42
|
-
import V from "./structure/TabContainer/
|
|
35
|
+
import P from "./structure/FocusGroup/Settings.mjs";
|
|
36
|
+
import F from "./structure/List/ListItem/Settings.mjs";
|
|
37
|
+
import I from "./structure/List/Settings.mjs";
|
|
38
|
+
import L from "./structure/ModalContainer/Settings.mjs";
|
|
39
|
+
import R from "./structure/Pagination/Settings.mjs";
|
|
40
|
+
import z from "./structure/TabContainer/Settings.mjs";
|
|
41
|
+
import B from "./structure/TabContainer/TabContainerBody/Settings.mjs";
|
|
42
|
+
import V from "./structure/TabContainer/TabContainerHeader/Settings.mjs";
|
|
43
|
+
import H from "./structure/TabContainer/TabContainerItem/Settings.mjs";
|
|
43
44
|
//#region src/elements/settings.ts
|
|
44
|
-
var
|
|
45
|
+
var U = {
|
|
45
46
|
dropdown: c,
|
|
46
47
|
dropdownPopup: s,
|
|
47
48
|
plitziSdk: i,
|
|
@@ -53,15 +54,16 @@ var H = {
|
|
|
53
54
|
loading: y,
|
|
54
55
|
notFound: b,
|
|
55
56
|
container: M,
|
|
57
|
+
focusGroup: P,
|
|
56
58
|
layoutContainer: v,
|
|
57
59
|
dialogContainer: N,
|
|
58
|
-
modalContainer:
|
|
60
|
+
modalContainer: L,
|
|
59
61
|
carousel: j,
|
|
60
62
|
carouselTrack: A,
|
|
61
|
-
tabContainer:
|
|
62
|
-
tabContainerBody:
|
|
63
|
-
tabContainerHeader:
|
|
64
|
-
tabContainerItem:
|
|
63
|
+
tabContainer: z,
|
|
64
|
+
tabContainerBody: B,
|
|
65
|
+
tabContainerHeader: V,
|
|
66
|
+
tabContainerItem: H,
|
|
65
67
|
heading: l,
|
|
66
68
|
image: T,
|
|
67
69
|
video: D,
|
|
@@ -75,10 +77,10 @@ var H = {
|
|
|
75
77
|
themeToggle: h,
|
|
76
78
|
markdown: d,
|
|
77
79
|
richText: p,
|
|
78
|
-
pagination:
|
|
80
|
+
pagination: R,
|
|
79
81
|
nodeHtml: r,
|
|
80
|
-
list:
|
|
81
|
-
listItem:
|
|
82
|
+
list: I,
|
|
83
|
+
listItem: F,
|
|
82
84
|
link: u,
|
|
83
85
|
form: g,
|
|
84
86
|
formControl: _,
|
|
@@ -86,4 +88,4 @@ var H = {
|
|
|
86
88
|
channel: k
|
|
87
89
|
};
|
|
88
90
|
//#endregion
|
|
89
|
-
export {
|
|
91
|
+
export { U as defaultElementsSettings };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type FocusGroupProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement>;
|
|
4
|
+
className?: string;
|
|
5
|
+
subType?: 'div' | 'nav' | 'section';
|
|
6
|
+
/**
|
|
7
|
+
* What the controls inside are, for screen readers and browser agents — "Search results", "Filters" — announced as a
|
|
8
|
+
* group (a `nav` or a `section` as that landmark).
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A box whose controls the arrow keys move through — a search palette's results, a menu, a set of options: ↑ and ↓
|
|
15
|
+
* through them, ← and → to the first of the next or the previous list, Home and End to the ends. From a text field
|
|
16
|
+
* inside it, ↓ goes down into them (the other arrows stay the caret's) and ↑ from the first comes back.
|
|
17
|
+
*/
|
|
18
|
+
declare const FocusGroup: ({ ref, className, subType, label, children }: FocusGroupProps) => import('react').JSX.Element;
|
|
19
|
+
declare const _default: {
|
|
20
|
+
(props: import('../../..').WithElementProps<FocusGroupProps>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
export { FocusGroup };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
|
+
import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
3
|
+
import { arrowTarget as n, isArrowKey as r } from "./arrowFocus.mjs";
|
|
4
|
+
import { useCallback as i } from "react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
import o from "clsx";
|
|
7
|
+
//#region src/elements/structure/FocusGroup/FocusGroup.tsx
|
|
8
|
+
var s = ({ ref: e, className: s = "", subType: c = "div", label: l = "", children: u }) => {
|
|
9
|
+
let d = i((e) => {
|
|
10
|
+
if (!r(e.key) || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
11
|
+
let t = n(e.currentTarget, e.target, e.key);
|
|
12
|
+
t && (e.preventDefault(), t.focus());
|
|
13
|
+
}, []), f = l ? {
|
|
14
|
+
"aria-label": l,
|
|
15
|
+
...c === "div" ? { role: "group" } : {}
|
|
16
|
+
} : {};
|
|
17
|
+
return /* @__PURE__ */ a(t, {
|
|
18
|
+
ref: e,
|
|
19
|
+
tag: c,
|
|
20
|
+
className: o("plitzi-component__focus-group", s),
|
|
21
|
+
onKeyDown: d,
|
|
22
|
+
...f,
|
|
23
|
+
children: u
|
|
24
|
+
});
|
|
25
|
+
}, c = e(s);
|
|
26
|
+
//#endregion
|
|
27
|
+
export { s as FocusGroup, c as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FocusGroupProps } from './FocusGroup';
|
|
2
|
+
type SettingsProps = {
|
|
3
|
+
subType?: FocusGroupProps['subType'];
|
|
4
|
+
label?: string;
|
|
5
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const Settings: ({ subType, label, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
8
|
+
export default Settings;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
import i from "@plitzi/plitzi-ui/Select";
|
|
5
|
+
//#region src/elements/structure/FocusGroup/Settings.tsx
|
|
6
|
+
var a = ({ subType: a = "div", label: o = "", onUpdate: s }) => {
|
|
7
|
+
let c = e(s);
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: "flex flex-col gap-4 py-2",
|
|
10
|
+
children: [/* @__PURE__ */ n(i, {
|
|
11
|
+
label: "Tag",
|
|
12
|
+
value: a,
|
|
13
|
+
onChange: c.text("subType"),
|
|
14
|
+
size: "xs",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ t("option", {
|
|
17
|
+
value: "div",
|
|
18
|
+
children: "Div"
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ t("option", {
|
|
21
|
+
value: "nav",
|
|
22
|
+
children: "Nav"
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ t("option", {
|
|
25
|
+
value: "section",
|
|
26
|
+
children: "Section"
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
}), /* @__PURE__ */ t(r, {
|
|
30
|
+
value: o,
|
|
31
|
+
label: "Group Name",
|
|
32
|
+
placeholder: "e.g. Search results, Filters",
|
|
33
|
+
onChange: c.text("label"),
|
|
34
|
+
size: "xs"
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const ARROW_KEYS: readonly ["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End"];
|
|
2
|
+
export type ArrowKey = (typeof ARROW_KEYS)[number];
|
|
3
|
+
export declare const isArrowKey: (key: string) => key is ArrowKey;
|
|
4
|
+
/**
|
|
5
|
+
* Where an arrow key moves the focus inside `container`, from `from` (what holds it), or nothing when it stays.
|
|
6
|
+
*
|
|
7
|
+
* ↑ and ↓ go through the controls in the order they are read; ←/→ to the first control of the next or the previous
|
|
8
|
+
* list; Home and End to the first and the last. From a text field, ↓ goes to the first control and the rest are the
|
|
9
|
+
* field's own (the caret); ↑ from the first control goes back to the field.
|
|
10
|
+
*/
|
|
11
|
+
export declare const arrowTarget: (container: Element, from: Element, key: ArrowKey) => HTMLElement | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/elements/structure/FocusGroup/arrowFocus.ts
|
|
2
|
+
var e = "input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]), textarea", t = [
|
|
3
|
+
"ArrowDown",
|
|
4
|
+
"ArrowUp",
|
|
5
|
+
"ArrowLeft",
|
|
6
|
+
"ArrowRight",
|
|
7
|
+
"Home",
|
|
8
|
+
"End"
|
|
9
|
+
], n = (e) => t.includes(e), r = (e) => e.getClientRects().length > 0, i = (e, t) => {
|
|
10
|
+
let n = e.parentElement?.closest("ul, ol, [role=\"listbox\"], [role=\"group\"]");
|
|
11
|
+
return n && t.contains(n) ? n : e;
|
|
12
|
+
}, a = (t, n, a) => {
|
|
13
|
+
let o = n.matches(e) ? n : void 0, s = [...t.querySelectorAll("a[href], button:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not(input):not(textarea):not(select)")].filter(r);
|
|
14
|
+
if (s.length === 0) return;
|
|
15
|
+
if (o) return a === "ArrowDown" ? s[0] : void 0;
|
|
16
|
+
let c = s.indexOf(n);
|
|
17
|
+
if (c !== -1) switch (a) {
|
|
18
|
+
case "ArrowDown": return s[c + 1];
|
|
19
|
+
case "ArrowUp": return c > 0 ? s[c - 1] : [...t.querySelectorAll(e)].find(r);
|
|
20
|
+
case "Home": return s[0];
|
|
21
|
+
case "End": return s[s.length - 1];
|
|
22
|
+
case "ArrowRight":
|
|
23
|
+
case "ArrowLeft": {
|
|
24
|
+
let e = [...new Set(s.map((e) => i(e, t)))], r = e.indexOf(i(n, t)) + (a === "ArrowRight" ? 1 : -1);
|
|
25
|
+
return r < 0 || r >= e.length ? void 0 : s.find((n) => i(n, t) === e[r]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { a as arrowTarget, n as isArrowKey };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FocusGroupProps } from './FocusGroup';
|
|
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 FocusGroupAttributes = AuthorableAttributes<FocusGroupProps>;
|
|
5
|
+
declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
6
|
+
readonly type: "focusGroup";
|
|
7
|
+
readonly attributeValues: {
|
|
8
|
+
readonly subType: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
readonly content: {
|
|
11
|
+
readonly attributes: {
|
|
12
|
+
readonly subType: "div";
|
|
13
|
+
};
|
|
14
|
+
readonly definition: {
|
|
15
|
+
readonly label: "Focus Group";
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly items: [];
|
|
18
|
+
};
|
|
19
|
+
readonly market: {
|
|
20
|
+
readonly category: "structure";
|
|
21
|
+
readonly icon: "fa-solid fa-arrows-up-down";
|
|
22
|
+
};
|
|
23
|
+
readonly defaultStyle: {
|
|
24
|
+
readonly style: {
|
|
25
|
+
readonly base: {
|
|
26
|
+
readonly default: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly subTypes: {};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}, Partial<{
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
subType?: "div" | "nav" | "section" | undefined;
|
|
35
|
+
}>>;
|
|
36
|
+
export default declaration;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { elementDeclaration as e, valuesOf as t } from "@plitzi/sdk-shared/authoring";
|
|
2
|
+
//#region src/elements/structure/FocusGroup/declaration.ts
|
|
3
|
+
var n = e()({
|
|
4
|
+
type: "focusGroup",
|
|
5
|
+
attributeValues: { subType: t()([
|
|
6
|
+
"div",
|
|
7
|
+
"nav",
|
|
8
|
+
"section"
|
|
9
|
+
]) },
|
|
10
|
+
content: {
|
|
11
|
+
attributes: { subType: "div" },
|
|
12
|
+
definition: {
|
|
13
|
+
label: "Focus Group",
|
|
14
|
+
description: "A box whose controls the arrow keys move through: up and down between them, left and right to the first of the next or previous list, down from a text field inside into them. For a search palette, a menu, a set of options — what someone goes through with the keyboard, which Tab alone took a stop at a time.",
|
|
15
|
+
items: []
|
|
16
|
+
},
|
|
17
|
+
market: {
|
|
18
|
+
category: "structure",
|
|
19
|
+
icon: "fa-solid fa-arrows-up-down"
|
|
20
|
+
},
|
|
21
|
+
defaultStyle: {
|
|
22
|
+
style: { base: { default: {} } },
|
|
23
|
+
subTypes: {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { n as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const FocusGroup: {
|
|
2
|
+
(props: import('../../..').WithElementProps<import('./FocusGroup').FocusGroupProps>): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
3
|
+
displayName: string;
|
|
4
|
+
} & {
|
|
5
|
+
readonly type: "focusGroup";
|
|
6
|
+
readonly attributeValues: {
|
|
7
|
+
readonly subType: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
readonly content: {
|
|
10
|
+
readonly attributes: {
|
|
11
|
+
readonly subType: "div";
|
|
12
|
+
};
|
|
13
|
+
readonly definition: {
|
|
14
|
+
readonly label: "Focus Group";
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly items: [];
|
|
17
|
+
};
|
|
18
|
+
readonly market: {
|
|
19
|
+
readonly category: "structure";
|
|
20
|
+
readonly icon: "fa-solid fa-arrows-up-down";
|
|
21
|
+
};
|
|
22
|
+
readonly defaultStyle: {
|
|
23
|
+
readonly style: {
|
|
24
|
+
readonly base: {
|
|
25
|
+
readonly default: {};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly subTypes: {};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
} & {
|
|
32
|
+
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
33
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
34
|
+
label?: string | undefined;
|
|
35
|
+
subType?: "div" | "nav" | "section" | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
export default FocusGroup;
|
package/dist/index.d.ts
CHANGED
|
@@ -798,6 +798,42 @@ export declare const defaultElements: {
|
|
|
798
798
|
live?: "polite" | "assertive" | "" | undefined;
|
|
799
799
|
decorative?: boolean | undefined;
|
|
800
800
|
}>>;
|
|
801
|
+
focusGroup: {
|
|
802
|
+
(props: import('.').WithElementProps<import('./elements/structure/FocusGroup/FocusGroup').FocusGroupProps>): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
803
|
+
displayName: string;
|
|
804
|
+
} & {
|
|
805
|
+
readonly type: "focusGroup";
|
|
806
|
+
readonly attributeValues: {
|
|
807
|
+
readonly subType: readonly string[];
|
|
808
|
+
};
|
|
809
|
+
readonly content: {
|
|
810
|
+
readonly attributes: {
|
|
811
|
+
readonly subType: "div";
|
|
812
|
+
};
|
|
813
|
+
readonly definition: {
|
|
814
|
+
readonly label: "Focus Group";
|
|
815
|
+
readonly description: string;
|
|
816
|
+
readonly items: [];
|
|
817
|
+
};
|
|
818
|
+
readonly market: {
|
|
819
|
+
readonly category: "structure";
|
|
820
|
+
readonly icon: "fa-solid fa-arrows-up-down";
|
|
821
|
+
};
|
|
822
|
+
readonly defaultStyle: {
|
|
823
|
+
readonly style: {
|
|
824
|
+
readonly base: {
|
|
825
|
+
readonly default: {};
|
|
826
|
+
};
|
|
827
|
+
};
|
|
828
|
+
readonly subTypes: {};
|
|
829
|
+
};
|
|
830
|
+
};
|
|
831
|
+
} & {
|
|
832
|
+
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
833
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
834
|
+
label?: string | undefined;
|
|
835
|
+
subType?: "div" | "nav" | "section" | undefined;
|
|
836
|
+
}>>;
|
|
801
837
|
layoutContainer: {
|
|
802
838
|
(props: import('.').WithElementProps<import('./elements/internal/LayoutContainer/LayoutContainer').LayoutContainerProps>): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
803
839
|
displayName: string;
|
|
@@ -2839,6 +2875,7 @@ export declare const defaultElements: {
|
|
|
2839
2875
|
readonly label: "Label";
|
|
2840
2876
|
readonly hideLabel: false;
|
|
2841
2877
|
readonly placeholder: "";
|
|
2878
|
+
readonly accept: "";
|
|
2842
2879
|
readonly defaultValue: "";
|
|
2843
2880
|
readonly autoComplete: true;
|
|
2844
2881
|
readonly autoFocus: false;
|
|
@@ -3364,6 +3401,49 @@ export declare const defaultElements: {
|
|
|
3364
3401
|
};
|
|
3365
3402
|
};
|
|
3366
3403
|
};
|
|
3404
|
+
readonly file: {
|
|
3405
|
+
name: string;
|
|
3406
|
+
displayMode: "desktop";
|
|
3407
|
+
style: {
|
|
3408
|
+
label: {
|
|
3409
|
+
default: {
|
|
3410
|
+
'margin-bottom': string;
|
|
3411
|
+
display: string;
|
|
3412
|
+
cursor: string;
|
|
3413
|
+
'font-weight': string;
|
|
3414
|
+
'font-size': string;
|
|
3415
|
+
'line-height': string;
|
|
3416
|
+
color: string;
|
|
3417
|
+
'user-select': string;
|
|
3418
|
+
};
|
|
3419
|
+
};
|
|
3420
|
+
requiredMark: {
|
|
3421
|
+
default: {
|
|
3422
|
+
color: string;
|
|
3423
|
+
'margin-left': string;
|
|
3424
|
+
};
|
|
3425
|
+
};
|
|
3426
|
+
error: {
|
|
3427
|
+
default: {
|
|
3428
|
+
display: string;
|
|
3429
|
+
color: string;
|
|
3430
|
+
'margin-top': string;
|
|
3431
|
+
};
|
|
3432
|
+
};
|
|
3433
|
+
icon?: {
|
|
3434
|
+
default: Record<string, string>;
|
|
3435
|
+
} | undefined;
|
|
3436
|
+
field?: {
|
|
3437
|
+
default: Record<string, string>;
|
|
3438
|
+
} | undefined;
|
|
3439
|
+
base: {
|
|
3440
|
+
default: {};
|
|
3441
|
+
};
|
|
3442
|
+
input: {
|
|
3443
|
+
default: Record<string, string>;
|
|
3444
|
+
};
|
|
3445
|
+
};
|
|
3446
|
+
};
|
|
3367
3447
|
readonly textarea: {
|
|
3368
3448
|
name: string;
|
|
3369
3449
|
displayMode: "desktop";
|
|
@@ -3567,7 +3647,7 @@ export declare const defaultElements: {
|
|
|
3567
3647
|
type: "formControl";
|
|
3568
3648
|
contentAttributes: readonly ["label", "placeholder", "options", "requiredMessage", "minLengthMessage", "maxLengthMessage", "minMessage", "maxMessage", "formatMessage", "patternMessage", "matchesMessage"];
|
|
3569
3649
|
attributeValues: {
|
|
3570
|
-
readonly subType: readonly
|
|
3650
|
+
readonly subType: readonly ["text", "number", "email", "password", "search", "url", "tel", "date", "time", "checkbox", "switch", "select", "textarea", "hidden", "color", "file"];
|
|
3571
3651
|
};
|
|
3572
3652
|
triggers: {
|
|
3573
3653
|
readonly onChange: {
|