@panneau/fields 5.0.0-alpha.11 → 5.0.0-alpha.12
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/dist/embed/EmbedField.js +1 -1
- package/dist/file/FileField.js +2 -2
- package/dist/group/GroupField.css +20 -3
- package/dist/group/GroupField.d.ts +2 -2
- package/dist/group/GroupField.d.ts.map +1 -1
- package/dist/group/GroupField.js +49 -36
- package/dist/group/GroupField.js.map +1 -1
- package/dist/group/GroupField.module.js +10 -2
- package/dist/group/GroupField.module.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/json/JsonField.js +1 -1
- package/dist/localized/LocalizedField.css +27 -6
- package/dist/localized/LocalizedField.d.ts +18 -7
- package/dist/localized/LocalizedField.d.ts.map +1 -1
- package/dist/localized/LocalizedField.js +236 -104
- package/dist/localized/LocalizedField.js.map +1 -1
- package/dist/localized/LocalizedField.module.js +10 -4
- package/dist/localized/LocalizedField.module.js.map +1 -1
- package/dist/location/LocationField.js +2 -2
- package/dist/relation/RelationField.js +2 -2
- package/dist/repeater/RepeaterField.js +2 -2
- package/dist/shared/DefinitionField.d.ts +3 -1
- package/dist/shared/DefinitionField.d.ts.map +1 -1
- package/dist/shared/DefinitionField.js +81 -73
- package/dist/shared/DefinitionField.js.map +1 -1
- package/dist/shared/context.d.ts +5 -0
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/entry.d.ts +2 -2
- package/dist/shared/entry.d.ts.map +1 -1
- package/dist/shared/entry.js +4 -3
- package/dist/shared/entry.js.map +1 -1
- package/dist/shared/flow.d.ts +8 -0
- package/dist/shared/flow.d.ts.map +1 -0
- package/dist/shared/flow.js +35 -0
- package/dist/shared/flow.js.map +1 -0
- package/dist/shared/reveal.d.ts +16 -0
- package/dist/shared/reveal.d.ts.map +1 -0
- package/dist/shared/reveal.js +46 -0
- package/dist/shared/reveal.js.map +1 -0
- package/dist/shared/types.d.ts +10 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/slug/SlugField.js +2 -2
- package/dist/text/TextField.js +2 -2
- package/dist/upload/FilePicker.js +1 -1
- package/dist/upload/UploadList.js +1 -1
- package/dist/url/UrlField.js +1 -1
- package/package.json +4 -4
|
@@ -13,8 +13,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
13
13
|
* parent value is false.
|
|
14
14
|
*/
|
|
15
15
|
function NestedField(t0) {
|
|
16
|
-
const $ = c(
|
|
17
|
-
const { field, path, value, onChange, onBlur, errors, parentValue, locale, disabled, readOnly, className } = t0;
|
|
16
|
+
const $ = c(39);
|
|
17
|
+
const { field, path, value, onChange, onBlur, errors, parentValue, locale, hideLabel, disabled, readOnly, className } = t0;
|
|
18
18
|
const { binding: Binding } = useFieldsContext();
|
|
19
19
|
let t1;
|
|
20
20
|
if ($[0] !== locale) {
|
|
@@ -23,108 +23,116 @@ function NestedField(t0) {
|
|
|
23
23
|
$[1] = t1;
|
|
24
24
|
} else t1 = $[1];
|
|
25
25
|
let t2;
|
|
26
|
-
if ($[2] !==
|
|
27
|
-
t2 =
|
|
28
|
-
$[2] =
|
|
26
|
+
if ($[2] !== hideLabel) {
|
|
27
|
+
t2 = hideLabel !== void 0 ? { hideLabel } : {};
|
|
28
|
+
$[2] = hideLabel;
|
|
29
29
|
$[3] = t2;
|
|
30
30
|
} else t2 = $[3];
|
|
31
31
|
let t3;
|
|
32
|
-
if ($[4] !==
|
|
33
|
-
t3 =
|
|
34
|
-
$[4] =
|
|
32
|
+
if ($[4] !== disabled) {
|
|
33
|
+
t3 = disabled !== void 0 ? { disabled } : {};
|
|
34
|
+
$[4] = disabled;
|
|
35
35
|
$[5] = t3;
|
|
36
36
|
} else t3 = $[5];
|
|
37
37
|
let t4;
|
|
38
|
-
if ($[6] !==
|
|
39
|
-
t4 =
|
|
40
|
-
$[6] =
|
|
38
|
+
if ($[6] !== readOnly) {
|
|
39
|
+
t4 = readOnly !== void 0 ? { readOnly } : {};
|
|
40
|
+
$[6] = readOnly;
|
|
41
41
|
$[7] = t4;
|
|
42
42
|
} else t4 = $[7];
|
|
43
43
|
let t5;
|
|
44
|
-
if ($[8] !==
|
|
45
|
-
t5 = {
|
|
44
|
+
if ($[8] !== className) {
|
|
45
|
+
t5 = className !== void 0 ? { className } : {};
|
|
46
|
+
$[8] = className;
|
|
47
|
+
$[9] = t5;
|
|
48
|
+
} else t5 = $[9];
|
|
49
|
+
let t6;
|
|
50
|
+
if ($[10] !== field || $[11] !== parentValue || $[12] !== path || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5) {
|
|
51
|
+
t6 = {
|
|
46
52
|
field,
|
|
47
53
|
path,
|
|
48
54
|
parentValue,
|
|
49
55
|
...t1,
|
|
50
56
|
...t2,
|
|
51
57
|
...t3,
|
|
52
|
-
...t4
|
|
58
|
+
...t4,
|
|
59
|
+
...t5
|
|
53
60
|
};
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
$[10] = field;
|
|
62
|
+
$[11] = parentValue;
|
|
63
|
+
$[12] = path;
|
|
64
|
+
$[13] = t1;
|
|
65
|
+
$[14] = t2;
|
|
66
|
+
$[15] = t3;
|
|
67
|
+
$[16] = t4;
|
|
68
|
+
$[17] = t5;
|
|
69
|
+
$[18] = t6;
|
|
70
|
+
} else t6 = $[18];
|
|
71
|
+
const shared = t6;
|
|
64
72
|
if (Binding !== null) {
|
|
65
|
-
let t6;
|
|
66
|
-
if ($[16] !== path) {
|
|
67
|
-
t6 = getParentPath(path);
|
|
68
|
-
$[16] = path;
|
|
69
|
-
$[17] = t6;
|
|
70
|
-
} else t6 = $[17];
|
|
71
73
|
let t7;
|
|
72
|
-
if ($[
|
|
73
|
-
t7 = (
|
|
74
|
+
if ($[19] !== path) {
|
|
75
|
+
t7 = getParentPath(path);
|
|
76
|
+
$[19] = path;
|
|
77
|
+
$[20] = t7;
|
|
78
|
+
} else t7 = $[20];
|
|
79
|
+
let t8;
|
|
80
|
+
if ($[21] !== shared) {
|
|
81
|
+
t8 = (bound) => /* @__PURE__ */ jsx(DefinitionField, {
|
|
74
82
|
...shared,
|
|
75
83
|
...bound
|
|
76
84
|
});
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
} else
|
|
80
|
-
let
|
|
81
|
-
if ($[
|
|
82
|
-
|
|
85
|
+
$[21] = shared;
|
|
86
|
+
$[22] = t8;
|
|
87
|
+
} else t8 = $[22];
|
|
88
|
+
let t9;
|
|
89
|
+
if ($[23] !== Binding || $[24] !== field || $[25] !== path || $[26] !== t7 || $[27] !== t8) {
|
|
90
|
+
t9 = /* @__PURE__ */ jsx(Binding, {
|
|
83
91
|
field,
|
|
84
92
|
path,
|
|
85
|
-
parentPath:
|
|
86
|
-
render:
|
|
93
|
+
parentPath: t7,
|
|
94
|
+
render: t8
|
|
87
95
|
});
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
} else
|
|
95
|
-
return
|
|
96
|
+
$[23] = Binding;
|
|
97
|
+
$[24] = field;
|
|
98
|
+
$[25] = path;
|
|
99
|
+
$[26] = t7;
|
|
100
|
+
$[27] = t8;
|
|
101
|
+
$[28] = t9;
|
|
102
|
+
} else t9 = $[28];
|
|
103
|
+
return t9;
|
|
96
104
|
}
|
|
97
105
|
if (field.visibleWhen !== void 0 && !evaluateCondition(field.visibleWhen, parentValue)) return null;
|
|
98
|
-
const
|
|
99
|
-
let t7;
|
|
100
|
-
if ($[26] !== onBlur) {
|
|
101
|
-
t7 = onBlur !== void 0 ? { onBlur } : {};
|
|
102
|
-
$[26] = onBlur;
|
|
103
|
-
$[27] = t7;
|
|
104
|
-
} else t7 = $[27];
|
|
106
|
+
const t7 = onChange ?? _temp;
|
|
105
107
|
let t8;
|
|
106
|
-
if ($[
|
|
107
|
-
t8 =
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t8 = $[
|
|
108
|
+
if ($[29] !== onBlur) {
|
|
109
|
+
t8 = onBlur !== void 0 ? { onBlur } : {};
|
|
110
|
+
$[29] = onBlur;
|
|
111
|
+
$[30] = t8;
|
|
112
|
+
} else t8 = $[30];
|
|
111
113
|
let t9;
|
|
112
|
-
if ($[
|
|
113
|
-
t9 =
|
|
114
|
+
if ($[31] !== errors) {
|
|
115
|
+
t9 = errors !== void 0 ? { errors } : {};
|
|
116
|
+
$[31] = errors;
|
|
117
|
+
$[32] = t9;
|
|
118
|
+
} else t9 = $[32];
|
|
119
|
+
let t10;
|
|
120
|
+
if ($[33] !== shared || $[34] !== t7 || $[35] !== t8 || $[36] !== t9 || $[37] !== value) {
|
|
121
|
+
t10 = /* @__PURE__ */ jsx(DefinitionField, {
|
|
114
122
|
...shared,
|
|
115
123
|
value,
|
|
116
|
-
onChange:
|
|
117
|
-
...
|
|
118
|
-
...
|
|
124
|
+
onChange: t7,
|
|
125
|
+
...t8,
|
|
126
|
+
...t9
|
|
119
127
|
});
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
} else
|
|
127
|
-
return
|
|
128
|
+
$[33] = shared;
|
|
129
|
+
$[34] = t7;
|
|
130
|
+
$[35] = t8;
|
|
131
|
+
$[36] = t9;
|
|
132
|
+
$[37] = value;
|
|
133
|
+
$[38] = t10;
|
|
134
|
+
} else t10 = $[38];
|
|
135
|
+
return t10;
|
|
128
136
|
}
|
|
129
137
|
/**
|
|
130
138
|
* Renders a field of the definition with the entry of its type: from the fields context, or a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefinitionField.js","names":["Field","evaluateCondition","LocalizedFieldEntry","MissingFieldEntry","builtInFields","getParentPath","useFieldsContext","FieldEntryProps","NestedFieldProps","field","path","value","onChange","onBlur","errors","parentValue","locale","disabled","readOnly","className","NestedField","t0","$","_c","binding","Binding","t1","undefined","t2","t3","t4","t5","
|
|
1
|
+
{"version":3,"file":"DefinitionField.js","names":["Field","evaluateCondition","LocalizedFieldEntry","MissingFieldEntry","builtInFields","getParentPath","useFieldsContext","FieldEntryProps","NestedFieldProps","field","path","value","onChange","onBlur","errors","parentValue","locale","hideLabel","disabled","readOnly","className","NestedField","t0","$","_c","binding","Binding","t1","undefined","t2","t3","t4","t5","t6","shared","t7","t8","bound","t9","visibleWhen","_temp","t10","DefinitionField","props","components","localized","Entry","type","_c"],"sources":["../../src/shared/DefinitionField.tsx"],"sourcesContent":["import type { Field } from '@panneau/protocol';\nimport { evaluateCondition } from '@panneau/protocol/runtime';\n\n// Groups, repeaters and localized values render nested fields, which render through\n// `DefinitionField`: the modules import each other, which is fine since they only use each other\n// while rendering.\nimport { LocalizedFieldEntry } from '../localized/LocalizedField';\nimport { MissingFieldEntry } from '../missing/MissingField';\nimport { builtInFields } from './builtIn';\nimport { getParentPath, useFieldsContext } from './context';\nimport type { FieldEntryProps } from './types';\n\nexport interface NestedFieldProps {\n field: Field;\n /** Dot path of the field's value. */\n path: string;\n /** The value, without a binding. */\n value?: unknown;\n /** Sets the value, without a binding. */\n onChange?: (value: unknown) => void;\n onBlur?: () => void;\n errors?: readonly string[];\n /** The object the field belongs to, for conditions and generated values. */\n parentValue?: unknown;\n /** The locale of the value, in a localized field. */\n locale?: string;\n /** Renders the field without a visible label, named by its label for assistive technologies. */\n hideLabel?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n className?: string;\n}\n\n/**\n * A field inside another one (a group, a block, a localized value), or at the top of a form.\n * With a binding in context, the binding gives its value and decides whether it shows. Without\n * one, it uses `value` and `onChange`, and hides itself when its `visibleWhen` condition on the\n * parent value is false.\n */\nexport function NestedField({\n field,\n path,\n value,\n onChange,\n onBlur,\n errors,\n parentValue,\n locale,\n hideLabel,\n disabled,\n readOnly,\n className,\n}: NestedFieldProps) {\n const { binding: Binding } = useFieldsContext();\n const shared = {\n field,\n path,\n parentValue,\n ...(locale !== undefined ? { locale } : {}),\n ...(hideLabel !== undefined ? { hideLabel } : {}),\n ...(disabled !== undefined ? { disabled } : {}),\n ...(readOnly !== undefined ? { readOnly } : {}),\n ...(className !== undefined ? { className } : {}),\n };\n if (Binding !== null) {\n return (\n <Binding\n field={field}\n path={path}\n parentPath={getParentPath(path)}\n render={(bound) => <DefinitionField {...shared} {...bound} />}\n />\n );\n }\n if (field.visibleWhen !== undefined && !evaluateCondition(field.visibleWhen, parentValue)) {\n return null;\n }\n return (\n <DefinitionField\n {...shared}\n value={value}\n onChange={onChange ?? (() => undefined)}\n {...(onBlur !== undefined ? { onBlur } : {})}\n {...(errors !== undefined ? { errors } : {})}\n />\n );\n}\n\n/**\n * Renders a field of the definition with the entry of its type: from the fields context, or a\n * built-in one. A localized field renders an input per locale. A type without an entry renders a\n * placeholder that names the missing plugin.\n */\nexport function DefinitionField(props: FieldEntryProps) {\n const { components } = useFieldsContext();\n const { field } = props;\n if (field.localized === true) {\n return <LocalizedFieldEntry {...props} />;\n }\n const Entry = components[field.type] ?? builtInFields[field.type] ?? MissingFieldEntry;\n return <Entry {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAuCA,SAAOqB,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAqB,MAAA,EAAAf,OAAAC,MAAAC,OAAAC,UAAAC,QAAAC,QAAAC,aAAAC,QAAAC,WAAAC,UAAAC,UAAAC,cAAAE;CAcxB,MAAA,EAAAG,SAAAC,YAA6BpB,iBAAiB;CAAE,IAAAqB;CAAA,IAAAJ,EAAA,OAAAP,QAAA;EAKxCW,KAAAX,WAAWY,KAAAA,IAAX,EAAAZ,OAAqC,IAArC,CAAqC;EAACO,EAAA,KAA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,11 @@ export interface BoundFieldProps {
|
|
|
12
12
|
onChange: (value: unknown) => void;
|
|
13
13
|
onBlur?: () => void;
|
|
14
14
|
errors?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Paths inside the field that have errors (`title.en`), for fields that show their nested
|
|
17
|
+
* fields themselves: a localized field marks its locales in error.
|
|
18
|
+
*/
|
|
19
|
+
invalidPaths?: readonly string[];
|
|
15
20
|
}
|
|
16
21
|
/** Props of a binding: it decides whether a field shows, and where its value comes from. */
|
|
17
22
|
export interface FieldBindingProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/shared/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/shared/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aA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
|
|
1
|
-
{"version":3,"file":"context.js","names":["ComponentType","ReactNode","createContext","use","Field","MapsConfig","UploadSource","FieldCheckSource","EmbedSource","RelationSource","FieldEntry","BoundFieldProps","value","onChange","onBlur","errors","FieldBindingProps","field","path","parentPath","render","bound","FieldBinding","FieldsContextValue","components","Readonly","Record","locales","relationSource","uploadSource","checkSource","embedSource","maps","binding","FieldsContext","useFieldsContext","FieldsProviderProps","children","FieldsProvider","t0","$","_c","parent","t1","undefined","t2","t3","t4","t5","t6","t7","t8","t9","t10","getParentPath","index","lastIndexOf","slice","_c"],"sources":["../../src/shared/context.tsx"],"sourcesContent":["import { type ComponentType, type ReactNode, createContext, use } from 'react';\n\nimport type { Field } from '@panneau/protocol';\n\nimport type { MapsConfig } from '../location/types';\nimport type { UploadSource } from '../upload/types';\nimport type { FieldCheckSource } from './check';\nimport type { EmbedSource } from './embed';\nimport type { RelationSource } from './relation';\nimport type { FieldEntry } from './types';\n\n/** What a binding gives a field: its value, handlers and errors at a path. */\nexport interface BoundFieldProps {\n value: unknown;\n onChange: (value: unknown) => void;\n onBlur?: () => void;\n errors?: readonly string[];\n}\n\n/** Props of a binding: it decides whether a field shows, and where its value comes from. */\nexport interface FieldBindingProps {\n field: Field;\n /** Dot path of the field's value. */\n path: string;\n /** Dot path of the object the field belongs to: `''` at the top, `blocks.2` in a block. */\n parentPath: string;\n /** Renders the field with its bound value. */\n render: (bound: BoundFieldProps) => ReactNode;\n}\n\n/**\n * Binds nested fields (in groups, blocks and localized values) to a store by path, instead of the\n * value and `onChange` of their parent. `@panneau/forms` binds them to its form state, so that\n * every value is set, validated and shown in error by its own path.\n */\nexport type FieldBinding = ComponentType<FieldBindingProps>;\n\nexport interface FieldsContextValue {\n /** Registry entries, by field type, over the built-in ones. */\n components: Readonly<Record<string, FieldEntry>>;\n /** Locales of localized values, in order. */\n locales: readonly string[];\n /** Where relation fields search for items. */\n relationSource: RelationSource | null;\n /**\n * Where fields that take files upload them directly to storage. Without one, they give the\n * files themselves.\n */\n uploadSource: UploadSource | null;\n /** Where fields with `check` check their value, such as a slug's availability. */\n checkSource: FieldCheckSource | null;\n /** Where `embed` fields get what a URL embeds. Without one, they keep the URL alone. */\n embedSource: EmbedSource | null;\n /** The tiles and the address search of `location` fields. */\n maps: MapsConfig | null;\n binding: FieldBinding | null;\n}\n\nconst FieldsContext = createContext<FieldsContextValue>({\n components: {},\n locales: [],\n relationSource: null,\n uploadSource: null,\n checkSource: null,\n embedSource: null,\n maps: null,\n binding: null,\n});\n\n/** The fields context of the closest `FieldsProvider`. */\nexport function useFieldsContext(): FieldsContextValue {\n return use(FieldsContext);\n}\n\nexport interface FieldsProviderProps {\n /** Registry entries by type, added over those of a parent provider. */\n components?: Readonly<Record<string, FieldEntry>>;\n locales?: readonly string[];\n relationSource?: RelationSource | null;\n /** Make it once, outside of render: fields make an uploader for each source they get. */\n uploadSource?: UploadSource | null;\n /** `createFieldCheckSource(adapter, resource, id)`, for the form of an item. */\n checkSource?: FieldCheckSource | null;\n /** `createEmbedSource(adapter)`. */\n embedSource?: EmbedSource | null;\n /** The tiles and the address search of `location` fields. */\n maps?: MapsConfig | null;\n binding?: FieldBinding | null;\n children?: ReactNode;\n}\n\n/**\n * Provides what fields rendered from a definition need: the components of each type, the locales\n * of localized values, the sources of relations, uploads, checks and embeds, the maps of\n * locations, and a binding. Values not given come from the parent provider.\n */\nexport function FieldsProvider({\n components,\n locales,\n relationSource,\n uploadSource,\n checkSource,\n embedSource,\n maps,\n binding,\n children,\n}: FieldsProviderProps) {\n const parent = use(FieldsContext);\n const value: FieldsContextValue = {\n components:\n components !== undefined ? { ...parent.components, ...components } : parent.components,\n locales: locales ?? parent.locales,\n relationSource: relationSource === undefined ? parent.relationSource : relationSource,\n uploadSource: uploadSource === undefined ? parent.uploadSource : uploadSource,\n checkSource: checkSource === undefined ? parent.checkSource : checkSource,\n embedSource: embedSource === undefined ? parent.embedSource : embedSource,\n maps: maps === undefined ? parent.maps : maps,\n binding: binding === undefined ? parent.binding : binding,\n };\n return <FieldsContext value={value}>{children}</FieldsContext>;\n}\n\n/** The parent path of a path: `blocks.2` for `blocks.2.title`, `''` for `title`. */\nexport function getParentPath(path: string): string {\n const index = path.lastIndexOf('.');\n return index === -1 ? '' : path.slice(0, index);\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"context.js","names":["ComponentType","ReactNode","createContext","use","Field","MapsConfig","UploadSource","FieldCheckSource","EmbedSource","RelationSource","FieldEntry","BoundFieldProps","value","onChange","onBlur","errors","invalidPaths","FieldBindingProps","field","path","parentPath","render","bound","FieldBinding","FieldsContextValue","components","Readonly","Record","locales","relationSource","uploadSource","checkSource","embedSource","maps","binding","FieldsContext","useFieldsContext","FieldsProviderProps","children","FieldsProvider","t0","$","_c","parent","t1","undefined","t2","t3","t4","t5","t6","t7","t8","t9","t10","getParentPath","index","lastIndexOf","slice","_c"],"sources":["../../src/shared/context.tsx"],"sourcesContent":["import { type ComponentType, type ReactNode, createContext, use } from 'react';\n\nimport type { Field } from '@panneau/protocol';\n\nimport type { MapsConfig } from '../location/types';\nimport type { UploadSource } from '../upload/types';\nimport type { FieldCheckSource } from './check';\nimport type { EmbedSource } from './embed';\nimport type { RelationSource } from './relation';\nimport type { FieldEntry } from './types';\n\n/** What a binding gives a field: its value, handlers and errors at a path. */\nexport interface BoundFieldProps {\n value: unknown;\n onChange: (value: unknown) => void;\n onBlur?: () => void;\n errors?: readonly string[];\n /**\n * Paths inside the field that have errors (`title.en`), for fields that show their nested\n * fields themselves: a localized field marks its locales in error.\n */\n invalidPaths?: readonly string[];\n}\n\n/** Props of a binding: it decides whether a field shows, and where its value comes from. */\nexport interface FieldBindingProps {\n field: Field;\n /** Dot path of the field's value. */\n path: string;\n /** Dot path of the object the field belongs to: `''` at the top, `blocks.2` in a block. */\n parentPath: string;\n /** Renders the field with its bound value. */\n render: (bound: BoundFieldProps) => ReactNode;\n}\n\n/**\n * Binds nested fields (in groups, blocks and localized values) to a store by path, instead of the\n * value and `onChange` of their parent. `@panneau/forms` binds them to its form state, so that\n * every value is set, validated and shown in error by its own path.\n */\nexport type FieldBinding = ComponentType<FieldBindingProps>;\n\nexport interface FieldsContextValue {\n /** Registry entries, by field type, over the built-in ones. */\n components: Readonly<Record<string, FieldEntry>>;\n /** Locales of localized values, in order. */\n locales: readonly string[];\n /** Where relation fields search for items. */\n relationSource: RelationSource | null;\n /**\n * Where fields that take files upload them directly to storage. Without one, they give the\n * files themselves.\n */\n uploadSource: UploadSource | null;\n /** Where fields with `check` check their value, such as a slug's availability. */\n checkSource: FieldCheckSource | null;\n /** Where `embed` fields get what a URL embeds. Without one, they keep the URL alone. */\n embedSource: EmbedSource | null;\n /** The tiles and the address search of `location` fields. */\n maps: MapsConfig | null;\n binding: FieldBinding | null;\n}\n\nconst FieldsContext = createContext<FieldsContextValue>({\n components: {},\n locales: [],\n relationSource: null,\n uploadSource: null,\n checkSource: null,\n embedSource: null,\n maps: null,\n binding: null,\n});\n\n/** The fields context of the closest `FieldsProvider`. */\nexport function useFieldsContext(): FieldsContextValue {\n return use(FieldsContext);\n}\n\nexport interface FieldsProviderProps {\n /** Registry entries by type, added over those of a parent provider. */\n components?: Readonly<Record<string, FieldEntry>>;\n locales?: readonly string[];\n relationSource?: RelationSource | null;\n /** Make it once, outside of render: fields make an uploader for each source they get. */\n uploadSource?: UploadSource | null;\n /** `createFieldCheckSource(adapter, resource, id)`, for the form of an item. */\n checkSource?: FieldCheckSource | null;\n /** `createEmbedSource(adapter)`. */\n embedSource?: EmbedSource | null;\n /** The tiles and the address search of `location` fields. */\n maps?: MapsConfig | null;\n binding?: FieldBinding | null;\n children?: ReactNode;\n}\n\n/**\n * Provides what fields rendered from a definition need: the components of each type, the locales\n * of localized values, the sources of relations, uploads, checks and embeds, the maps of\n * locations, and a binding. Values not given come from the parent provider.\n */\nexport function FieldsProvider({\n components,\n locales,\n relationSource,\n uploadSource,\n checkSource,\n embedSource,\n maps,\n binding,\n children,\n}: FieldsProviderProps) {\n const parent = use(FieldsContext);\n const value: FieldsContextValue = {\n components:\n components !== undefined ? { ...parent.components, ...components } : parent.components,\n locales: locales ?? parent.locales,\n relationSource: relationSource === undefined ? parent.relationSource : relationSource,\n uploadSource: uploadSource === undefined ? parent.uploadSource : uploadSource,\n checkSource: checkSource === undefined ? parent.checkSource : checkSource,\n embedSource: embedSource === undefined ? parent.embedSource : embedSource,\n maps: maps === undefined ? parent.maps : maps,\n binding: binding === undefined ? parent.binding : binding,\n };\n return <FieldsContext value={value}>{children}</FieldsContext>;\n}\n\n/** The parent path of a path: `blocks.2` for `blocks.2.title`, `''` for `title`. */\nexport function getParentPath(path: string): string {\n const index = path.lastIndexOf('.');\n return index === -1 ? '' : path.slice(0, index);\n}\n"],"mappings":";;;;AA+DA,IAAMmC,gBAAgBjC,cAAkC;CACpDuB,YAAY,CAAC;CACbG,SAAS,CAAA;CACTC,gBAAgB;CAChBC,cAAc;CACdC,aAAa;CACbC,aAAa;CACbC,MAAM;CACNC,SAAS;AACb,CAAC;;AAGD,SAAgBE,mBAAuC;CACnD,OAAOjC,IAAIgC,aAAa;AAC5B;;;;;;AAwBA,SAAOI,eAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAwB,MAAA,EAAAjB,YAAAG,SAAAC,gBAAAC,cAAAC,aAAAC,aAAAC,MAAAC,SAAAI,aAAAE;CAW3B,MAAAG,SAAexC,IAAIgC,aAAa;CAAE,IAAAS;CAAA,IAAAH,EAAA,OAAAhB,cAAAgB,EAAA,OAAAE,OAAAlB,YAAA;EAG1BmB,KAAAnB,eAAeoB,KAAAA,IAAf;GAAA,GAAgCF,OAAMlB;GAAW,GAAKA;EAA+B,IAAhBkB,OAAMlB;EAAWgB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAE,OAAAlB;EAAAgB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CACjF,MAAAK,KAAAlB,WAAWe,OAAMf;CACV,MAAAmB,KAAAlB,mBAAmBgB,KAAAA,I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AG;CAClC,OAAOD,UAAU,KAAK,KAAKrC,KAAKuC,MAAM,GAAGF,KAAK;AAClD"}
|
package/dist/shared/entry.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare const isBoolean: (value: unknown) => value is boolean;
|
|
|
17
17
|
export declare const isNumber: (value: unknown) => value is number;
|
|
18
18
|
/**
|
|
19
19
|
* The props that every field takes, from a registry entry's props: label (the field's name
|
|
20
|
-
* without one), help, required mark, read-only, errors and
|
|
21
|
-
* own entries.
|
|
20
|
+
* without one, or `aria-label` with `hideLabel`), help, required mark, read-only, errors and
|
|
21
|
+
* handlers. Plugins use it to write their own entries.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getFieldProps(props: FieldEntryProps): Omit<FieldProps<never>, 'value' | 'onChange'> & {
|
|
24
24
|
placeholder?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/shared/entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAI3E;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAKnF;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEhD;AAED,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAA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,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAqC,CAAC;AAC1F,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACE,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE,eAAe,GACvB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB1E;AAED,wCAAwC;AACxC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,GAAG,IAAI,CAQvD;AAED,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAGtD"}
|
package/dist/shared/entry.js
CHANGED
|
@@ -26,14 +26,15 @@ var isBoolean = (value) => typeof value === "boolean";
|
|
|
26
26
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
27
27
|
/**
|
|
28
28
|
* The props that every field takes, from a registry entry's props: label (the field's name
|
|
29
|
-
* without one), help, required mark, read-only, errors and
|
|
30
|
-
* own entries.
|
|
29
|
+
* without one, or `aria-label` with `hideLabel`), help, required mark, read-only, errors and
|
|
30
|
+
* handlers. Plugins use it to write their own entries.
|
|
31
31
|
*/
|
|
32
32
|
function getFieldProps(props) {
|
|
33
33
|
const { field } = props;
|
|
34
|
+
const label = field.label ?? field.name;
|
|
34
35
|
return {
|
|
35
36
|
name: props.path,
|
|
36
|
-
label:
|
|
37
|
+
...props.hideLabel === true ? { "aria-label": label } : { label },
|
|
37
38
|
description: field.help,
|
|
38
39
|
...field.placeholder !== void 0 ? { placeholder: field.placeholder } : {},
|
|
39
40
|
required: isRequired(field),
|
package/dist/shared/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","names":["Field","Rule","FieldEntryProps","FieldProps","findRule","field","rule","rules","find","candidate","mode","undefined","getRuleNumber","found","value","isRequired","getSetting","name","guard","T","settings","isString","isBoolean","isNumber","Number","isNaN","getFieldProps","props","Omit","placeholder","path","
|
|
1
|
+
{"version":3,"file":"entry.js","names":["Field","Rule","FieldEntryProps","FieldProps","findRule","field","rule","rules","find","candidate","mode","undefined","getRuleNumber","found","value","isRequired","getSetting","name","guard","T","settings","isString","isBoolean","isNumber","Number","isNaN","getFieldProps","props","Omit","placeholder","label","path","hideLabel","description","help","required","readOnly","disabled","errors","onBlur","className","asString","getAccept","accept","length","Array","isArray","filter","getMaxSize"],"sources":["../../src/shared/entry.ts"],"sourcesContent":["import type { Field, Rule } from '@panneau/protocol';\n\nimport type { FieldEntryProps, FieldProps } from './types';\n\n/**\n * The rule of a field with this name, if any. A rule limited to a mode (`\"mode\": \"create\"`)\n * doesn't count: forms keep it, without its `mode`, in that mode only (`resolveFields()` of\n * `@panneau/core`).\n */\nexport function findRule(field: Field, rule: Rule['rule']): Rule | undefined {\n return field.rules?.find(\n (candidate) => candidate.rule === rule && candidate.mode === undefined,\n );\n}\n\n/** The number of a `min` or `max` rule of a field, if any. */\nexport function getRuleNumber(field: Field, rule: 'min' | 'max'): number | undefined {\n const found = findRule(field, rule);\n return found !== undefined && 'value' in found && typeof found.value === 'number'\n ? found.value\n : undefined;\n}\n\n/** Whether a field has the `required` rule. */\nexport function isRequired(field: Field): boolean {\n return findRule(field, 'required') !== undefined;\n}\n\n/** A setting of a field (`settings.<name>`), when it has the expected type. */\nexport function getSetting<T>(field: Field, name: string, guard: (value: unknown) => value is T) {\n const value = field.settings?.[name];\n return guard(value) ? value : undefined;\n}\n\nexport const isString = (value: unknown): value is string => typeof value === 'string';\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value);\n\n/**\n * The props that every field takes, from a registry entry's props: label (the field's name\n * without one, or `aria-label` with `hideLabel`), help, required mark, read-only, errors and\n * handlers. Plugins use it to write their own entries.\n */\nexport function getFieldProps(\n props: FieldEntryProps,\n): Omit<FieldProps<never>, 'value' | 'onChange'> & { placeholder?: string } {\n const { field } = props;\n // A field always has a label: its name when the definition gives none.\n const label = field.label ?? field.name;\n return {\n name: props.path,\n ...(props.hideLabel === true ? { 'aria-label': label } : { label }),\n description: field.help,\n ...(field.placeholder !== undefined ? { placeholder: field.placeholder } : {}),\n required: isRequired(field),\n readOnly: props.readOnly === true || field.readOnly === true,\n disabled: props.disabled === true,\n errors: props.errors ?? [],\n ...(props.onBlur !== undefined ? { onBlur: props.onBlur } : {}),\n ...(props.className !== undefined ? { className: props.className } : {}),\n };\n}\n\n/** The value as a string, or `null`. */\nexport function asString(value: unknown): string | null {\n return typeof value === 'string' ? value : null;\n}\n\n/** The accepted MIME types of a field that takes files: its `accept`, or its `accept` rule. */\nexport function getAccept(field: Field): string[] | null {\n if (field.accept !== undefined && field.accept.length > 0) {\n return field.accept;\n }\n const rule = findRule(field, 'accept');\n return rule !== undefined && 'value' in rule && Array.isArray(rule.value)\n ? rule.value.filter(isString)\n : null;\n}\n\n/** The largest file of a field, in bytes: its `maxSize` rule. */\nexport function getMaxSize(field: Field): number | null {\n const rule = findRule(field, 'maxSize');\n return rule !== undefined && 'value' in rule && isNumber(rule.value) ? rule.value : null;\n}\n"],"mappings":";;;;;;AASA,SAAgBI,SAASC,OAAcC,MAAsC;CACzE,OAAOD,MAAME,OAAOC,MACfC,cAAcA,UAAUH,SAASA,QAAQG,UAAUC,SAASC,KAAAA,CACjE;AACJ;;AAGA,SAAgBC,cAAcP,OAAcC,MAAyC;CACjF,MAAMO,QAAQT,SAASC,OAAOC,IAAI;CAClC,OAAOO,UAAUF,KAAAA,KAAa,WAAWE,SAAS,OAAOA,MAAMC,UAAU,WACnED,MAAMC,QACNH,KAAAA;AACV;;AAGA,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AQuC,MAAMC,QAAQxC,KAAKQ,KAAK,IAClER,KAAKQ,MAAMiC,OAAO1B,QAAQ,IAC1B;AACV;;AAGA,SAAgB2B,WAAW3C,OAA6B;CACpD,MAAMC,OAAOF,SAASC,OAAO,SAAS;CACtC,OAAOC,SAASK,KAAAA,KAAa,WAAWL,QAAQiB,SAASjB,KAAKQ,KAAK,IAAIR,KAAKQ,QAAQ;AACxF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Field } from '@panneau/protocol';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a field takes a whole row where fields flow in columns, such as in a form without a
|
|
4
|
+
* layout or in a group: long inputs (a text area, rich text, blocks), several values, a value per
|
|
5
|
+
* locale, and the types of plugins. Short inputs share a row.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isWideField(field: Field): boolean;
|
|
8
|
+
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/shared/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAuB/C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CASjD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getSetting, isString } from "./entry.js";
|
|
2
|
+
//#region src/shared/flow.ts
|
|
3
|
+
/** Types whose input is short: they share a row with others in a flow of fields. */
|
|
4
|
+
var COMPACT_TYPES = /* @__PURE__ */ new Set([
|
|
5
|
+
"text",
|
|
6
|
+
"email",
|
|
7
|
+
"url",
|
|
8
|
+
"tel",
|
|
9
|
+
"number",
|
|
10
|
+
"date",
|
|
11
|
+
"datetime",
|
|
12
|
+
"time",
|
|
13
|
+
"duration",
|
|
14
|
+
"color",
|
|
15
|
+
"select",
|
|
16
|
+
"boolean",
|
|
17
|
+
"range",
|
|
18
|
+
"slug",
|
|
19
|
+
"relation"
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Whether a field takes a whole row where fields flow in columns, such as in a form without a
|
|
23
|
+
* layout or in a group: long inputs (a text area, rich text, blocks), several values, a value per
|
|
24
|
+
* locale, and the types of plugins. Short inputs share a row.
|
|
25
|
+
*/
|
|
26
|
+
function isWideField(field) {
|
|
27
|
+
if (field.localized === true || field.multiple === true) return true;
|
|
28
|
+
const widget = getSetting(field, "widget", isString);
|
|
29
|
+
if (field.type === "select" && widget !== void 0 && widget !== "dropdown") return true;
|
|
30
|
+
return !COMPACT_TYPES.has(field.type);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { isWideField };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.js","names":["Field","getSetting","isString","COMPACT_TYPES","Set","isWideField","field","localized","multiple","widget","type","undefined","has"],"sources":["../../src/shared/flow.ts"],"sourcesContent":["import type { Field } from '@panneau/protocol';\n\nimport { getSetting, isString } from './entry';\n\n/** Types whose input is short: they share a row with others in a flow of fields. */\nconst COMPACT_TYPES = new Set([\n 'text',\n 'email',\n 'url',\n 'tel',\n 'number',\n 'date',\n 'datetime',\n 'time',\n 'duration',\n 'color',\n 'select',\n 'boolean',\n 'range',\n 'slug',\n 'relation',\n]);\n\n/**\n * Whether a field takes a whole row where fields flow in columns, such as in a form without a\n * layout or in a group: long inputs (a text area, rich text, blocks), several values, a value per\n * locale, and the types of plugins. Short inputs share a row.\n */\nexport function isWideField(field: Field): boolean {\n if (field.localized === true || field.multiple === true) {\n return true;\n }\n const widget = getSetting(field, 'widget', isString);\n if (field.type === 'select' && widget !== undefined && widget !== 'dropdown') {\n return true;\n }\n return !COMPACT_TYPES.has(field.type);\n}\n"],"mappings":";;;AAKA,IAAMG,gCAAgB,IAAIC,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAU,CACb;;;;;;AAOD,SAAgBC,YAAYC,OAAuB;CAC/C,IAAIA,MAAMC,cAAc,QAAQD,MAAME,aAAa,MAC/C,OAAO;CAEX,MAAMC,SAASR,WAAWK,OAAO,UAAUJ,QAAQ;CACnD,IAAII,MAAMI,SAAS,YAAYD,WAAWE,KAAAA,KAAaF,WAAW,YAC9D,OAAO;CAEX,OAAO,CAACN,cAAcS,IAAIN,MAAMI,IAAI;AACxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Shows what holds a path, such as its tab or its locale, so that its field can be reached. */
|
|
2
|
+
export type Revealer = (path: string) => void;
|
|
3
|
+
/** Where a form asks the containers of its fields to show a path, before it focuses its field. */
|
|
4
|
+
export interface RevealRegistry {
|
|
5
|
+
add(revealer: Revealer): () => void;
|
|
6
|
+
reveal(path: string): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createRevealRegistry(): RevealRegistry;
|
|
9
|
+
/**
|
|
10
|
+
* The reveal registry of the closest form. Containers that hide fields (tabs, sections, the
|
|
11
|
+
* locales of a localized field) add a revealer to it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RevealContext: import("react").Context<RevealRegistry>;
|
|
14
|
+
/** Calls the revealer when the form reveals a path, for as long as the component is mounted. */
|
|
15
|
+
export declare function useRevealer(revealer: Revealer): void;
|
|
16
|
+
//# sourceMappingURL=reveal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal.d.ts","sourceRoot":"","sources":["../../src/shared/reveal.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAE9C,kGAAkG;AAClG,MAAM,WAAW,cAAc;IAC3B,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAarD;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,yCAAwD,CAAC;AAEnF,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIpD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { createContext, use, useEffect, useEffectEvent } from "react";
|
|
3
|
+
//#region src/shared/reveal.ts
|
|
4
|
+
function createRevealRegistry() {
|
|
5
|
+
const revealers = /* @__PURE__ */ new Set();
|
|
6
|
+
return {
|
|
7
|
+
add(revealer) {
|
|
8
|
+
revealers.add(revealer);
|
|
9
|
+
return () => {
|
|
10
|
+
revealers.delete(revealer);
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
reveal(path) {
|
|
14
|
+
revealers.forEach((revealer) => revealer(path));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The reveal registry of the closest form. Containers that hide fields (tabs, sections, the
|
|
20
|
+
* locales of a localized field) add a revealer to it.
|
|
21
|
+
*/
|
|
22
|
+
var RevealContext = createContext(createRevealRegistry());
|
|
23
|
+
/** Calls the revealer when the form reveals a path, for as long as the component is mounted. */
|
|
24
|
+
function useRevealer(revealer) {
|
|
25
|
+
const $ = c(5);
|
|
26
|
+
const registry = use(RevealContext);
|
|
27
|
+
const onReveal = useEffectEvent(revealer);
|
|
28
|
+
let t0;
|
|
29
|
+
if ($[0] !== onReveal || $[1] !== registry) {
|
|
30
|
+
t0 = () => registry.add((path) => onReveal(path));
|
|
31
|
+
$[0] = onReveal;
|
|
32
|
+
$[1] = registry;
|
|
33
|
+
$[2] = t0;
|
|
34
|
+
} else t0 = $[2];
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[3] !== registry) {
|
|
37
|
+
t1 = [registry];
|
|
38
|
+
$[3] = registry;
|
|
39
|
+
$[4] = t1;
|
|
40
|
+
} else t1 = $[4];
|
|
41
|
+
useEffect(t0, t1);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { RevealContext, createRevealRegistry, useRevealer };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=reveal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal.js","names":["createContext","use","useEffect","useEffectEvent","Revealer","path","RevealRegistry","add","revealer","reveal","createRevealRegistry","revealers","Set","delete","forEach","RevealContext","useRevealer","$","_c","registry","onReveal","t0","t1","_c"],"sources":["../../src/shared/reveal.ts"],"sourcesContent":["import { createContext, use, useEffect, useEffectEvent } from 'react';\n\n/** Shows what holds a path, such as its tab or its locale, so that its field can be reached. */\nexport type Revealer = (path: string) => void;\n\n/** Where a form asks the containers of its fields to show a path, before it focuses its field. */\nexport interface RevealRegistry {\n add(revealer: Revealer): () => void;\n reveal(path: string): void;\n}\n\nexport function createRevealRegistry(): RevealRegistry {\n const revealers = new Set<Revealer>();\n return {\n add(revealer) {\n revealers.add(revealer);\n return () => {\n revealers.delete(revealer);\n };\n },\n reveal(path) {\n revealers.forEach((revealer) => revealer(path));\n },\n };\n}\n\n/**\n * The reveal registry of the closest form. Containers that hide fields (tabs, sections, the\n * locales of a localized field) add a revealer to it.\n */\nexport const RevealContext = createContext<RevealRegistry>(createRevealRegistry());\n\n/** Calls the revealer when the form reveals a path, for as long as the component is mounted. */\nexport function useRevealer(revealer: Revealer): void {\n const registry = use(RevealContext);\n const onReveal = useEffectEvent(revealer);\n useEffect(() => registry.add((path) => onReveal(path)), [registry]);\n}\n"],"mappings":";;;AAWA,SAAgBU,uBAAuC;CACnD,MAAMC,4BAAY,IAAIC,IAAc;CACpC,OAAO;EACHL,IAAIC,UAAU;GACVG,UAAUJ,IAAIC,QAAQ;GACtB,aAAa;IACTG,UAAUE,OAAOL,QAAQ;GAC7B;EACJ;EACAC,OAAOJ,MAAM;GACTM,UAAUG,SAASN,aAAaA,SAASH,IAAI,CAAC;EAClD;CACJ;AACJ;;;;;AAMA,IAAaU,gBAAgBf,cAA8BU,qBAAqB,CAAC;;AAGjF,SAAOM,YAAAR,UAAA;CAAA,MAAAS,IAAAC,EAAA,CAAA;CACH,MAAAC,WAAiBlB,IAAIc,aAAa;CAClC,MAAAK,WAAiBjB,eAAeK,QAAQ;CAAE,IAAAa;CAAA,IAAAJ,EAAA,OAAAG,YAAAH,EAAA,OAAAE,UAAA;EAChCE,WAAMF,SAAQZ,KAAKF,SAAUe,SAASf,IAAI,CAAC;EAACY,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAE,UAAA;EAAEG,KAAA,CAACH,QAAQ;EAACF,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAlEf,UAAUmB,IAA8CC,EAAU;AAAC"}
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -39,8 +39,18 @@ export interface FieldEntryProps {
|
|
|
39
39
|
onChange: (value: unknown) => void;
|
|
40
40
|
onBlur?: () => void;
|
|
41
41
|
errors?: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Paths inside the field that have errors (`title.en`), given by the form's binding to fields
|
|
44
|
+
* that show their nested fields: a localized field marks its locales in error.
|
|
45
|
+
*/
|
|
46
|
+
invalidPaths?: readonly string[];
|
|
42
47
|
disabled?: boolean;
|
|
43
48
|
readOnly?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Renders the field without a visible label, named by its label for assistive technologies:
|
|
51
|
+
* the input of a locale, under the label of its localized field.
|
|
52
|
+
*/
|
|
53
|
+
hideLabel?: boolean;
|
|
44
54
|
/** The object the field belongs to: the form's values, or a group or a block. */
|
|
45
55
|
parentValue?: unknown;
|
|
46
56
|
/** The locale of the value: the input of a locale of a localized field. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AC;IACpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC5B,iDAAiD;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iFAAiF;IACjF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/slug/SlugField.js
CHANGED
|
@@ -4,10 +4,10 @@ import { messages } from "../shared/messages.js";
|
|
|
4
4
|
import { TextField } from "../text/TextField.js";
|
|
5
5
|
import SlugField_module_default from "./SlugField.module.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
|
-
import {
|
|
7
|
+
import { WandSparkles } from "lucide-react";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
|
+
import { Button, IconButton, usePanneauIntl } from "@panneau/ui";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { WandSparkles } from "lucide-react";
|
|
11
11
|
//#region src/slug/SlugField.tsx
|
|
12
12
|
var suggestionMessage = messages.useSuggestion;
|
|
13
13
|
/**
|
package/dist/text/TextField.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getFieldProps, getRuleNumber, getSetting, isBoolean, isString } from "../shared/entry.js";
|
|
2
2
|
import { messages } from "../shared/messages.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { IconButton, TextInput, usePanneauIntl } from "@panneau/ui";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Eye, EyeOff } from "lucide-react";
|
|
8
8
|
//#region src/text/TextField.tsx
|
|
9
9
|
/** The description of a text field, with its character count. */
|
|
10
10
|
function useCountedDescription(description, value, maxLength) {
|
|
@@ -2,9 +2,9 @@ import { cx } from "../shared/cx.js";
|
|
|
2
2
|
import { messages } from "../shared/messages.js";
|
|
3
3
|
import FilePicker_module_default from "./FilePicker.module.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { Upload } from "lucide-react";
|
|
5
6
|
import { Button, usePanneauIntl } from "@panneau/ui";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Upload } from "lucide-react";
|
|
8
8
|
import { DropZone, FileTrigger } from "react-aria-components";
|
|
9
9
|
//#region src/upload/FilePicker.tsx
|
|
10
10
|
async function readDrop(items) {
|
|
@@ -3,9 +3,9 @@ import { messages } from "../shared/messages.js";
|
|
|
3
3
|
import UploadList_module_default from "./UploadList.module.js";
|
|
4
4
|
import { formatSize } from "./files.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { Pause, Play, RotateCcw, X } from "lucide-react";
|
|
6
7
|
import { IconButton, usePanneauIntl } from "@panneau/ui";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Pause, Play, RotateCcw, X } from "lucide-react";
|
|
9
9
|
import { ProgressBar } from "react-aria-components";
|
|
10
10
|
//#region src/upload/UploadList.tsx
|
|
11
11
|
/**
|
package/dist/url/UrlField.js
CHANGED
|
@@ -3,9 +3,9 @@ import { messages } from "../shared/messages.js";
|
|
|
3
3
|
import { TextField } from "../text/TextField.js";
|
|
4
4
|
import UrlField_module_default from "./UrlField.module.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { ExternalLink } from "lucide-react";
|
|
6
7
|
import { Icon, usePanneauIntl } from "@panneau/ui";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { ExternalLink } from "lucide-react";
|
|
9
9
|
//#region src/url/UrlField.tsx
|
|
10
10
|
var SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
11
11
|
/** Adds a scheme to a URL that has none, and isn't a path or an anchor. */
|