@panneau/fields 5.0.0-alpha.15 → 5.0.0-alpha.17
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/README.md +53 -3
- package/dist/address/AddressField.css +44 -0
- package/dist/address/AddressField.d.ts +37 -0
- package/dist/address/AddressField.d.ts.map +1 -0
- package/dist/address/AddressField.js +411 -0
- package/dist/address/AddressField.js.map +1 -0
- package/dist/address/AddressField.module.js +22 -0
- package/dist/address/AddressField.module.js.map +1 -0
- package/dist/address/address.d.ts +23 -0
- package/dist/address/address.d.ts.map +1 -0
- package/dist/address/address.js +58 -0
- package/dist/address/address.js.map +1 -0
- package/dist/address/index.d.ts +3 -0
- package/dist/address/index.d.ts.map +1 -0
- package/dist/address/index.js +3 -0
- package/dist/color/ColorField.css +9 -0
- package/dist/color/ColorField.d.ts +10 -3
- package/dist/color/ColorField.d.ts.map +1 -1
- package/dist/color/ColorField.js +341 -81
- package/dist/color/ColorField.js.map +1 -1
- package/dist/color/ColorField.module.js +4 -2
- package/dist/color/ColorField.module.js.map +1 -1
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +3 -1
- package/dist/color/palette.d.ts +23 -0
- package/dist/color/palette.d.ts.map +1 -0
- package/dist/color/palette.js +34 -0
- package/dist/color/palette.js.map +1 -0
- package/dist/country/CountryField.css +42 -0
- package/dist/country/CountryField.d.ts +19 -4
- package/dist/country/CountryField.d.ts.map +1 -1
- package/dist/country/CountryField.js +355 -82
- package/dist/country/CountryField.js.map +1 -1
- package/dist/country/CountryField.module.js +20 -0
- package/dist/country/CountryField.module.js.map +1 -0
- package/dist/country/index.d.ts +1 -1
- package/dist/country/index.d.ts.map +1 -1
- package/dist/daterange/DateRangeField.css +9 -0
- package/dist/daterange/DateRangeField.d.ts +31 -0
- package/dist/daterange/DateRangeField.d.ts.map +1 -0
- package/dist/daterange/DateRangeField.js +372 -0
- package/dist/daterange/DateRangeField.js.map +1 -0
- package/dist/daterange/DateRangeField.module.js +12 -0
- package/dist/daterange/DateRangeField.module.js.map +1 -0
- package/dist/daterange/index.d.ts +3 -0
- package/dist/daterange/index.d.ts.map +1 -0
- package/dist/daterange/index.js +3 -0
- package/dist/daterange/range.d.ts +61 -0
- package/dist/daterange/range.d.ts.map +1 -0
- package/dist/daterange/range.js +119 -0
- package/dist/daterange/range.js.map +1 -0
- package/dist/duration/DurationField.css +1 -1
- package/dist/duration/DurationField.d.ts +54 -13
- package/dist/duration/DurationField.d.ts.map +1 -1
- package/dist/duration/DurationField.js +205 -159
- package/dist/duration/DurationField.js.map +1 -1
- package/dist/duration/DurationField.module.js.map +1 -1
- package/dist/duration/index.d.ts +1 -1
- package/dist/duration/index.d.ts.map +1 -1
- package/dist/duration/index.js +1 -1
- package/dist/embed/EmbedField.d.ts +11 -2
- package/dist/embed/EmbedField.d.ts.map +1 -1
- package/dist/embed/EmbedField.js +179 -116
- package/dist/embed/EmbedField.js.map +1 -1
- package/dist/link/LinkField.css +12 -0
- package/dist/link/LinkField.d.ts +38 -0
- package/dist/link/LinkField.d.ts.map +1 -0
- package/dist/link/LinkField.js +742 -0
- package/dist/link/LinkField.js.map +1 -0
- package/dist/link/LinkField.module.js +8 -0
- package/dist/link/LinkField.module.js.map +1 -0
- package/dist/link/index.d.ts +3 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +3 -0
- package/dist/link/link.d.ts +30 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +63 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/pages.d.ts +17 -0
- package/dist/link/pages.d.ts.map +1 -0
- package/dist/link/pages.js +104 -0
- package/dist/link/pages.js.map +1 -0
- package/dist/location/LocationField.d.ts.map +1 -1
- package/dist/location/LocationField.js +9 -85
- package/dist/location/LocationField.js.map +1 -1
- package/dist/location/nominatim.d.ts +8 -2
- package/dist/location/nominatim.d.ts.map +1 -1
- package/dist/location/nominatim.js +32 -3
- package/dist/location/nominatim.js.map +1 -1
- package/dist/location/search.d.ts +10 -0
- package/dist/location/search.d.ts.map +1 -0
- package/dist/location/search.js +83 -0
- package/dist/location/search.js.map +1 -0
- package/dist/location/types.d.ts +8 -2
- package/dist/location/types.d.ts.map +1 -1
- package/dist/money/MoneyField.d.ts +28 -0
- package/dist/money/MoneyField.d.ts.map +1 -0
- package/dist/money/MoneyField.js +269 -0
- package/dist/money/MoneyField.js.map +1 -0
- package/dist/money/index.d.ts +3 -0
- package/dist/money/index.d.ts.map +1 -0
- package/dist/money/index.js +3 -0
- package/dist/money/money.d.ts +27 -0
- package/dist/money/money.d.ts.map +1 -0
- package/dist/money/money.js +56 -0
- package/dist/money/money.js.map +1 -0
- package/dist/region/RegionField.d.ts +2 -1
- package/dist/region/RegionField.d.ts.map +1 -1
- package/dist/region/RegionField.js +92 -54
- package/dist/region/RegionField.js.map +1 -1
- package/dist/region/RegionFlag.css +9 -0
- package/dist/region/RegionFlag.d.ts +20 -0
- package/dist/region/RegionFlag.d.ts.map +1 -0
- package/dist/region/RegionFlag.js +61 -0
- package/dist/region/RegionFlag.js.map +1 -0
- package/dist/region/RegionFlag.module.js +8 -0
- package/dist/region/RegionFlag.module.js.map +1 -0
- package/dist/region/flags/CA.d.ts +4 -0
- package/dist/region/flags/CA.d.ts.map +1 -0
- package/dist/region/flags/CA.js +21 -0
- package/dist/region/flags/CA.js.map +1 -0
- package/dist/region/flags/US.d.ts +4 -0
- package/dist/region/flags/US.d.ts.map +1 -0
- package/dist/region/flags/US.js +65 -0
- package/dist/region/flags/US.js.map +1 -0
- package/dist/region/flags.d.ts +17 -0
- package/dist/region/flags.d.ts.map +1 -0
- package/dist/region/flags.js +84 -0
- package/dist/region/flags.js.map +1 -0
- package/dist/region/index.d.ts +2 -0
- package/dist/region/index.d.ts.map +1 -1
- package/dist/region/index.js +3 -1
- package/dist/shared/CodeComboBox.d.ts +2 -1
- package/dist/shared/CodeComboBox.d.ts.map +1 -1
- package/dist/shared/CodeComboBox.js.map +1 -1
- package/dist/shared/builtIn.d.ts +3 -1
- package/dist/shared/builtIn.d.ts.map +1 -1
- package/dist/shared/builtIn.js +18 -8
- package/dist/shared/builtIn.js.map +1 -1
- package/dist/shared/dates.js +2 -2
- package/dist/shared/dates.js.map +1 -1
- package/dist/shared/flow.d.ts.map +1 -1
- package/dist/shared/flow.js +1 -0
- package/dist/shared/flow.js.map +1 -1
- package/dist/shared/part.d.ts +26 -0
- package/dist/shared/part.d.ts.map +1 -0
- package/dist/shared/part.js +64 -0
- package/dist/shared/part.js.map +1 -0
- package/dist/tel/TelField.css +25 -0
- package/dist/tel/TelField.d.ts +14 -2
- package/dist/tel/TelField.d.ts.map +1 -1
- package/dist/tel/TelField.js +246 -145
- package/dist/tel/TelField.js.map +1 -1
- package/dist/tel/TelField.module.js +12 -0
- package/dist/tel/TelField.module.js.map +1 -0
- package/dist/tel/index.d.ts +1 -1
- package/dist/tel/index.d.ts.map +1 -1
- package/dist/tel/index.js +2 -2
- package/dist/tel/phone.d.ts +28 -0
- package/dist/tel/phone.d.ts.map +1 -1
- package/dist/tel/phone.js +48 -1
- package/dist/tel/phone.js.map +1 -1
- package/dist/url/UrlField.d.ts.map +1 -1
- package/dist/url/UrlField.js +1 -1
- package/dist/url/UrlField.js.map +1 -1
- package/package.json +24 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/region/flags.ts
|
|
4
|
+
/**
|
|
5
|
+
* The modules of the flags, by country (decision 0059). Each loads the first time a region of its
|
|
6
|
+
* country shows, so that a form without a region doesn't load them.
|
|
7
|
+
*/
|
|
8
|
+
var LOADERS = {
|
|
9
|
+
CA: () => import("./flags/CA.js"),
|
|
10
|
+
US: () => import("./flags/US.js")
|
|
11
|
+
};
|
|
12
|
+
/** The countries whose regions have flags. */
|
|
13
|
+
var REGION_FLAG_COUNTRIES = Object.keys(LOADERS);
|
|
14
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
15
|
+
var loading = /* @__PURE__ */ new Map();
|
|
16
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
17
|
+
/**
|
|
18
|
+
* Loads the flags of the regions of a country, once. `null` for a country without flags, or when
|
|
19
|
+
* they fail to load (they load again next time).
|
|
20
|
+
*/
|
|
21
|
+
function loadRegionFlags(country) {
|
|
22
|
+
const loader = Object.hasOwn(LOADERS, country) ? LOADERS[country] : void 0;
|
|
23
|
+
if (loader === void 0) return Promise.resolve(null);
|
|
24
|
+
let promise = loading.get(country);
|
|
25
|
+
if (promise === void 0) {
|
|
26
|
+
promise = loader().then((module) => {
|
|
27
|
+
loaded.set(country, module.default);
|
|
28
|
+
for (const listener of listeners) listener();
|
|
29
|
+
return module.default;
|
|
30
|
+
}, () => {
|
|
31
|
+
loading.delete(country);
|
|
32
|
+
return null;
|
|
33
|
+
});
|
|
34
|
+
loading.set(country, promise);
|
|
35
|
+
}
|
|
36
|
+
return promise;
|
|
37
|
+
}
|
|
38
|
+
function subscribe(listener) {
|
|
39
|
+
listeners.add(listener);
|
|
40
|
+
return () => {
|
|
41
|
+
listeners.delete(listener);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The flags of the regions of a country: `null` until they load, and for a country without flags.
|
|
46
|
+
* They start loading when a component first asks for them.
|
|
47
|
+
*/
|
|
48
|
+
function useRegionFlags(country) {
|
|
49
|
+
const $ = c(5);
|
|
50
|
+
let t0;
|
|
51
|
+
if ($[0] !== country) {
|
|
52
|
+
t0 = () => country !== null && country !== void 0 ? loaded.get(country) ?? null : null;
|
|
53
|
+
$[0] = country;
|
|
54
|
+
$[1] = t0;
|
|
55
|
+
} else t0 = $[1];
|
|
56
|
+
const flags = useSyncExternalStore(subscribe, t0, _temp);
|
|
57
|
+
let t1;
|
|
58
|
+
let t2;
|
|
59
|
+
if ($[2] !== country) {
|
|
60
|
+
t1 = () => {
|
|
61
|
+
if (country !== null && country !== void 0 && !loaded.has(country)) loadRegionFlags(country);
|
|
62
|
+
};
|
|
63
|
+
t2 = [country];
|
|
64
|
+
$[2] = country;
|
|
65
|
+
$[3] = t1;
|
|
66
|
+
$[4] = t2;
|
|
67
|
+
} else {
|
|
68
|
+
t1 = $[3];
|
|
69
|
+
t2 = $[4];
|
|
70
|
+
}
|
|
71
|
+
useEffect(t1, t2);
|
|
72
|
+
return flags;
|
|
73
|
+
}
|
|
74
|
+
/** The flag of a region among the flags of its country, or `undefined`. */
|
|
75
|
+
function _temp() {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function getRegionFlag(flags, code) {
|
|
79
|
+
return flags !== null && Object.hasOwn(flags, code) ? flags[code] : void 0;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { REGION_FLAG_COUNTRIES, getRegionFlag, loadRegionFlags, useRegionFlags };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","names":["useEffect","useSyncExternalStore","RegionFlags","Readonly","Record","LOADERS","Promise","default","CA","US","REGION_FLAG_COUNTRIES","Object","keys","loaded","Map","loading","listeners","Set","loadRegionFlags","country","loader","hasOwn","undefined","resolve","promise","get","then","module","set","listener","delete","subscribe","add","useRegionFlags","$","_c","t0","flags","_temp","t1","t2","has","getRegionFlag","code","_c"],"sources":["../../src/region/flags.ts"],"sourcesContent":["import { useEffect, useSyncExternalStore } from 'react';\n\n/** The flags of the regions of a country, as data URLs of images, by region code. */\nexport type RegionFlags = Readonly<Record<string, string>>;\n\n/**\n * The modules of the flags, by country (decision 0059). Each loads the first time a region of its\n * country shows, so that a form without a region doesn't load them.\n */\nconst LOADERS: Readonly<Record<string, () => Promise<{ default: RegionFlags }>>> = {\n CA: () => import('./flags/CA'),\n US: () => import('./flags/US'),\n};\n\n/** The countries whose regions have flags. */\nexport const REGION_FLAG_COUNTRIES: readonly string[] = Object.keys(LOADERS);\n\nconst loaded = new Map<string, RegionFlags>();\nconst loading = new Map<string, Promise<RegionFlags | null>>();\nconst listeners = new Set<() => void>();\n\n/**\n * Loads the flags of the regions of a country, once. `null` for a country without flags, or when\n * they fail to load (they load again next time).\n */\nexport function loadRegionFlags(country: string): Promise<RegionFlags | null> {\n const loader = Object.hasOwn(LOADERS, country) ? LOADERS[country] : undefined;\n if (loader === undefined) {\n return Promise.resolve(null);\n }\n let promise = loading.get(country);\n if (promise === undefined) {\n promise = loader().then(\n (module) => {\n loaded.set(country, module.default);\n for (const listener of listeners) {\n listener();\n }\n return module.default;\n },\n () => {\n loading.delete(country);\n return null;\n },\n );\n loading.set(country, promise);\n }\n return promise;\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * The flags of the regions of a country: `null` until they load, and for a country without flags.\n * They start loading when a component first asks for them.\n */\nexport function useRegionFlags(country: string | null | undefined): RegionFlags | null {\n const flags = useSyncExternalStore(\n subscribe,\n () => (country !== null && country !== undefined ? (loaded.get(country) ?? null) : null),\n () => null,\n );\n useEffect(() => {\n if (country !== null && country !== undefined && !loaded.has(country)) {\n void loadRegionFlags(country);\n }\n }, [country]);\n return flags;\n}\n\n/** The flag of a region among the flags of its country, or `undefined`. */\nexport function getRegionFlag(flags: RegionFlags | null, code: string): string | undefined {\n return flags !== null && Object.hasOwn(flags, code) ? flags[code] : undefined;\n}\n"],"mappings":";;;;;;;AASA,IAAMK,UAA6E;CAC/EG,UAAU,OAAO;CACjBC,UAAU,OAAO;AACrB;;AAGA,IAAaC,wBAA2CC,OAAOC,KAAKP,OAAO;AAE3E,IAAMQ,yBAAS,IAAIC,IAAyB;AAC5C,IAAMC,0BAAU,IAAID,IAAyC;AAC7D,IAAME,4BAAY,IAAIC,IAAgB;;;;;AAMtC,SAAgBC,gBAAgBC,SAA8C;CAC1E,MAAMC,SAAST,OAAOU,OAAOhB,SAASc,OAAO,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K;;AAXT,SAAAC,QAAA;CAAA,OAIO;AAAI;AAWlB,SAAgBI,cAAcL,OAA2BM,MAAkC;CACvF,OAAON,UAAU,QAAQ1B,OAAOU,OAAOgB,OAAOM,IAAI,IAAIN,MAAMM,QAAQrB,KAAAA;AACxE"}
|
package/dist/region/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { RegionField, RegionFieldEntry, type RegionFieldProps, getRegionCountry, } from './RegionField.js';
|
|
2
2
|
export { REGION_COUNTRIES, type Region, getRegionName, getRegions } from './regions.js';
|
|
3
|
+
export { RegionFlag, type RegionFlagProps } from './RegionFlag.js';
|
|
4
|
+
export { REGION_FLAG_COUNTRIES, type RegionFlags, getRegionFlag, loadRegionFlags, useRegionFlags, } from './flags.js';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/region/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,gBAAgB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,KAAK,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/region/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,gBAAgB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,KAAK,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACH,qBAAqB,EACrB,KAAK,WAAW,EAChB,aAAa,EACb,eAAe,EACf,cAAc,GACjB,MAAM,SAAS,CAAC"}
|
package/dist/region/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { REGION_FLAG_COUNTRIES, getRegionFlag, loadRegionFlags, useRegionFlags } from "./flags.js";
|
|
2
|
+
import { RegionFlag } from "./RegionFlag.js";
|
|
1
3
|
import { REGION_COUNTRIES, getRegionName, getRegions } from "./regions.js";
|
|
2
4
|
import { RegionField, RegionFieldEntry, getRegionCountry } from "./RegionField.js";
|
|
3
|
-
export { REGION_COUNTRIES, RegionField, RegionFieldEntry, getRegionCountry, getRegionName, getRegions };
|
|
5
|
+
export { REGION_COUNTRIES, REGION_FLAG_COUNTRIES, RegionField, RegionFieldEntry, RegionFlag, getRegionCountry, getRegionFlag, getRegionName, getRegions, loadRegionFlags, useRegionFlags };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { FieldProps } from './types.js';
|
|
2
3
|
/** A choice of a code combo box: a code, its name, and a decorative prefix (a flag). */
|
|
3
4
|
export interface CodeChoice {
|
|
4
5
|
code: string;
|
|
5
6
|
name: string;
|
|
6
|
-
prefix?:
|
|
7
|
+
prefix?: ReactNode;
|
|
7
8
|
}
|
|
8
9
|
export interface CodeComboBoxProps extends Omit<FieldProps<string>, 'onChange'> {
|
|
9
10
|
choices: readonly CodeChoice[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeComboBox.d.ts","sourceRoot":"","sources":["../../src/shared/CodeComboBox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeComboBox.d.ts","sourceRoot":"","sources":["../../src/shared/CodeComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAIjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wFAAwF;AACxF,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC3E,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACxD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAwBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EACzB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,EAAE,EACF,SAAS,EACT,YAAY,EACZ,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,GAAG,KAAK,EACX,EAAE,iBAAiB,+BA0DnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeComboBox.js","names":["ReactNode","useState","ComboBox","FieldProps","CodeChoice","code","name","prefix","CodeComboBoxProps","Omit","choices","onChange","value","placeholder","emptyMessage","controlClassName","normalize","text","replace","toLowerCase","matches","choice","query","trim","split","some","word","startsWith","CodeComboBox","t0","$","_c","autoFocus","className","description","descriptionClassName","disabled","errors","errorsClassName","id","label","labelClassName","onBlur","props","readOnly","required","setQuery","current","undefined","t1","find","selected","t2","filter","choice_0","concat","map","_temp","items","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","choice_1","_c"],"sources":["../../src/shared/CodeComboBox.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\n\nimport { ComboBox } from '@panneau/ui';\n\nimport type { FieldProps } from './types';\n\n/** A choice of a code combo box: a code, its name, and a decorative prefix (a flag). */\nexport interface CodeChoice {\n code: string;\n name: string;\n prefix?: string;\n}\n\nexport interface CodeComboBoxProps extends Omit<FieldProps<string>, 'onChange'> {\n choices: readonly CodeChoice[];\n onChange?: ((value: string | null) => void) | undefined;\n placeholder?: string | undefined;\n emptyMessage: string;\n controlClassName?: string | undefined;\n}\n\n/** Lower case, without accents: `Québec` matches `quebec`. */\nfunction normalize(text: string): string {\n return text\n .normalize('NFD')\n .replace(/\\p{Diacritic}/gu, '')\n .toLowerCase();\n}\n\nfunction matches(choice: CodeChoice, query: string): boolean {\n const text = normalize(query.trim());\n if (text === '') {\n return true;\n }\n return (\n normalize(choice.name)\n .split(/[\\s'’-]+/)\n .some((word) => word.startsWith(text)) ||\n normalize(choice.name).startsWith(text) ||\n choice.code.toLowerCase() === text\n );\n}\n\n/**\n * A combo box of codes shown by their names (countries, regions): typing filters them by the start\n * of a word of their name, or by their code. A value outside the choices shows as it is.\n */\nexport function CodeComboBox({\n choices,\n value,\n onChange,\n onBlur,\n label,\n description,\n errors,\n disabled,\n readOnly,\n required,\n placeholder,\n name,\n id,\n autoFocus,\n emptyMessage,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n ...props\n}: CodeComboBoxProps) {\n // The text being typed, while the user searches; the name of the value otherwise.\n const [query, setQuery] = useState<string | null>(null);\n const current = value !== null && value !== undefined && value !== '' ? value : null;\n const selected = current !== null ? choices.find((choice) => choice.code === current) : null;\n const items = (query !== null ? choices.filter((choice) => matches(choice, query)) : choices)\n .concat(\n // A value outside the choices, kept from before, stays selectable as it is.\n current !== null && selected === undefined && query === null\n ? [{ code: current, name: current }]\n : [],\n )\n .map((choice): { id: string; label: string; prefix?: ReactNode } => ({\n id: choice.code,\n label: choice.name,\n ...(choice.prefix !== undefined ? { prefix: choice.prefix } : {}),\n }));\n return (\n <ComboBox\n label={label}\n description={description}\n errors={errors ?? []}\n isRequired={required}\n isDisabled={disabled}\n isReadOnly={readOnly}\n autoFocus={autoFocus}\n className={className}\n labelClassName={labelClassName}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n {...(props['aria-label'] !== undefined ? { 'aria-label': props['aria-label'] } : {})}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n items={items}\n value={current}\n prefix={query === null ? selected?.prefix : undefined}\n inputValue={query ?? selected?.name ?? current ?? ''}\n onInputChange={(text) => {\n setQuery(text);\n if (text === '' && current !== null) {\n onChange?.(null);\n }\n }}\n onChange={(code) => {\n setQuery(null);\n if (code !== null && code !== current) {\n onChange?.(code);\n }\n }}\n onBlur={() => {\n setQuery(null);\n onBlur?.();\n }}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n />\n );\n}\n"],"mappings":";;;;;;AAsBA,SAASgB,UAAUC,MAAsB;CACrC,OAAOA,KACFD,UAAU,KAAK,CAAC,CAChBE,QAAQ,mBAAmB,EAAE,CAAC,CAC9BC,YAAY;AACrB;AAEA,SAASC,QAAQC,QAAoBC,OAAwB;CACzD,MAAML,OAAOD,UAAUM,MAAMC,KAAK,CAAC;CACnC,IAAIN,SAAS,IACT,OAAO;CAEX,OACID,UAAUK,OAAOf,IAAI,CAAC,CACjBkB,MAAM,UAAU,CAAC,CACjBC,MAAMC,SAASA,KAAKC,WAAWV,IAAI,CAAC,KACzCD,UAAUK,OAAOf,IAAI,CAAC,CAACqB,WAAWV,IAAI,KACtCI,OAAOhB,KAAKc,YAAY,MAAMF;AAEtC;;;;;AAMA,SAAOW,aAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAlB;CAAA,IAAAmB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,I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MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAjB;EAAAiB,EAAA,MAAAc;EAAAd,EAAA,MAAAe;EAAAf,EAAA,MAAAoC;EAAApC,EAAA,MAAAqC;EAAArC,EAAA,MAAAsC;EAAAtC,EAAA,MAAA6B;EAAA7B,EAAA,MAAA8B;EAAA9B,EAAA,MAAA+B;EAAA/B,EAAA,MAAAgC;EAAAhC,EAAA,MAAAiC;EAAAjC,EAAA,MAAAkC;EAAAlC,EAAA,MAAAmC;EAAAnC,EAAA,MAAAuC;CAAA,OAAAA,MAAAvC,EAAA;CAAA,OAtCFuC;AAsCE;AA9EH,SAAAZ,MAAAa,UAAA;CAAA,OAkCsE;EAAA/B,IAC7DlB,SAAMhB;EAAKmC,OACRnB,SAAMf;EAAK,GACde,SAAMd,WAAYyC,KAAAA,IAAlB,EAAAzC,QAAwCc,SAAMd,OAAa,IAA3D,CAA2D;CACnE;AAAC"}
|
|
1
|
+
{"version":3,"file":"CodeComboBox.js","names":["ReactNode","useState","ComboBox","FieldProps","CodeChoice","code","name","prefix","CodeComboBoxProps","Omit","choices","onChange","value","placeholder","emptyMessage","controlClassName","normalize","text","replace","toLowerCase","matches","choice","query","trim","split","some","word","startsWith","CodeComboBox","t0","$","_c","autoFocus","className","description","descriptionClassName","disabled","errors","errorsClassName","id","label","labelClassName","onBlur","props","readOnly","required","setQuery","current","undefined","t1","find","selected","t2","filter","choice_0","concat","map","_temp","items","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","choice_1","_c"],"sources":["../../src/shared/CodeComboBox.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\n\nimport { ComboBox } from '@panneau/ui';\n\nimport type { FieldProps } from './types';\n\n/** A choice of a code combo box: a code, its name, and a decorative prefix (a flag). */\nexport interface CodeChoice {\n code: string;\n name: string;\n prefix?: ReactNode;\n}\n\nexport interface CodeComboBoxProps extends Omit<FieldProps<string>, 'onChange'> {\n choices: readonly CodeChoice[];\n onChange?: ((value: string | null) => void) | undefined;\n placeholder?: string | undefined;\n emptyMessage: string;\n controlClassName?: string | undefined;\n}\n\n/** Lower case, without accents: `Québec` matches `quebec`. */\nfunction normalize(text: string): string {\n return text\n .normalize('NFD')\n .replace(/\\p{Diacritic}/gu, '')\n .toLowerCase();\n}\n\nfunction matches(choice: CodeChoice, query: string): boolean {\n const text = normalize(query.trim());\n if (text === '') {\n return true;\n }\n return (\n normalize(choice.name)\n .split(/[\\s'’-]+/)\n .some((word) => word.startsWith(text)) ||\n normalize(choice.name).startsWith(text) ||\n choice.code.toLowerCase() === text\n );\n}\n\n/**\n * A combo box of codes shown by their names (countries, regions): typing filters them by the start\n * of a word of their name, or by their code. A value outside the choices shows as it is.\n */\nexport function CodeComboBox({\n choices,\n value,\n onChange,\n onBlur,\n label,\n description,\n errors,\n disabled,\n readOnly,\n required,\n placeholder,\n name,\n id,\n autoFocus,\n emptyMessage,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n ...props\n}: CodeComboBoxProps) {\n // The text being typed, while the user searches; the name of the value otherwise.\n const [query, setQuery] = useState<string | null>(null);\n const current = value !== null && value !== undefined && value !== '' ? value : null;\n const selected = current !== null ? choices.find((choice) => choice.code === current) : null;\n const items = (query !== null ? choices.filter((choice) => matches(choice, query)) : choices)\n .concat(\n // A value outside the choices, kept from before, stays selectable as it is.\n current !== null && selected === undefined && query === null\n ? [{ code: current, name: current }]\n : [],\n )\n .map((choice): { id: string; label: string; prefix?: ReactNode } => ({\n id: choice.code,\n label: choice.name,\n ...(choice.prefix !== undefined ? { prefix: choice.prefix } : {}),\n }));\n return (\n <ComboBox\n label={label}\n description={description}\n errors={errors ?? []}\n isRequired={required}\n isDisabled={disabled}\n isReadOnly={readOnly}\n autoFocus={autoFocus}\n className={className}\n labelClassName={labelClassName}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n {...(props['aria-label'] !== undefined ? { 'aria-label': props['aria-label'] } : {})}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n items={items}\n value={current}\n prefix={query === null ? selected?.prefix : undefined}\n inputValue={query ?? selected?.name ?? current ?? ''}\n onInputChange={(text) => {\n setQuery(text);\n if (text === '' && current !== null) {\n onChange?.(null);\n }\n }}\n onChange={(code) => {\n setQuery(null);\n if (code !== null && code !== current) {\n onChange?.(code);\n }\n }}\n onBlur={() => {\n setQuery(null);\n onBlur?.();\n }}\n placeholder={placeholder}\n emptyMessage={emptyMessage}\n />\n );\n}\n"],"mappings":";;;;;;AAsBA,SAASgB,UAAUC,MAAsB;CACrC,OAAOA,KACFD,UAAU,KAAK,CAAC,CAChBE,QAAQ,mBAAmB,EAAE,CAAC,CAC9BC,YAAY;AACrB;AAEA,SAASC,QAAQC,QAAoBC,OAAwB;CACzD,MAAML,OAAOD,UAAUM,MAAMC,KAAK,CAAC;CACnC,IAAIN,SAAS,IACT,OAAO;CAEX,OACID,UAAUK,OAAOf,IAAI,CAAC,CACjBkB,MAAM,UAAU,CAAC,CACjBC,MAAMC,SAASA,KAAKC,WAAWV,IAAI,CAAC,KACzCD,UAAUK,OAAOf,IAAI,CAAC,CAACqB,WAAWV,IAAI,KACtCI,OAAOhB,KAAKc,YAAY,MAAMF;AAEtC;;;;;AAMA,SAAOW,aAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAlB;CAAA,IAAAmB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAnC;CAAA,IAAAoC;CAAA,IAAA/B;CAAA,IAAAE;CAAA,IAAA8B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAjC;CAAA,IAAAkB,EAAA,OAAAD,IAAA;EAAsB,CAAA,CAAAnB,SAAAE,OAAAD,UA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B;EAAA7B,EAAA,MAAA8B;EAAA9B,EAAA,MAAA+B;EAAA/B,EAAA,MAAAgC;EAAAhC,EAAA,MAAAiC;EAAAjC,EAAA,MAAAkC;EAAAlC,EAAA,MAAAmC;EAAAnC,EAAA,MAAAuC;CAAA,OAAAA,MAAAvC,EAAA;CAAA,OAtCFuC;AAsCE;AA9EH,SAAAZ,MAAAa,UAAA;CAAA,OAkCsE;EAAA/B,IAC7DlB,SAAMhB;EAAKmC,OACRnB,SAAMf;EAAK,GACde,SAAMd,WAAYyC,KAAAA,IAAlB,EAAAzC,QAAwCc,SAAMd,OAAa,IAA3D,CAA2D;CACnE;AAAC"}
|
package/dist/shared/builtIn.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { FieldEntry } from './types.js';
|
|
|
3
3
|
* The entries of the built-in field types. `richtext` and `media` come with their plugins
|
|
4
4
|
* (`@panneau/editor` and `@panneau/media`): without them, `DefinitionField` renders a placeholder.
|
|
5
5
|
* `file` uploads through the upload source of the fields context, or gives the files themselves.
|
|
6
|
-
* `embed` and `
|
|
6
|
+
* `embed`, `location` and `address` use its embed source and its maps; `location` loads Leaflet
|
|
7
|
+
* when shown. `link` searches its pages with the relation source, and picks its files with the
|
|
8
|
+
* `media` entry.
|
|
7
9
|
*/
|
|
8
10
|
export declare const builtInFields: Readonly<Record<string, FieldEntry>>;
|
|
9
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtIn.d.ts","sourceRoot":"","sources":["../../src/shared/builtIn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builtIn.d.ts","sourceRoot":"","sources":["../../src/shared/builtIn.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA8B9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC7C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAK7D,CAAC"}
|
package/dist/shared/builtIn.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryFieldEntry } from "../country/CountryField.js";
|
|
2
|
+
import { LocationFieldEntry } from "../location/LocationField.js";
|
|
2
3
|
import { TextFieldEntry } from "../text/TextField.js";
|
|
4
|
+
import { RegionFieldEntry } from "../region/RegionField.js";
|
|
5
|
+
import { AddressFieldEntry } from "../address/AddressField.js";
|
|
6
|
+
import { BooleanFieldEntry } from "../boolean/BooleanField.js";
|
|
3
7
|
import { ColorFieldEntry } from "../color/ColorField.js";
|
|
4
|
-
import { CountryFieldEntry } from "../country/CountryField.js";
|
|
5
8
|
import { DateFieldEntry } from "../date/DateField.js";
|
|
9
|
+
import { DateRangeFieldEntry } from "../daterange/DateRangeField.js";
|
|
6
10
|
import { DateTimeFieldEntry } from "../datetime/DateTimeField.js";
|
|
7
11
|
import { DurationFieldEntry } from "../duration/DurationField.js";
|
|
8
12
|
import { EmailFieldEntry } from "../email/EmailField.js";
|
|
@@ -10,26 +14,28 @@ import { EmbedFieldEntry } from "../embed/EmbedField.js";
|
|
|
10
14
|
import { FileFieldEntry } from "../file/FileField.js";
|
|
11
15
|
import { GroupFieldEntry } from "../group/GroupField.js";
|
|
12
16
|
import { JsonFieldEntry } from "../json/JsonField.js";
|
|
13
|
-
import {
|
|
17
|
+
import { TelFieldEntry } from "../tel/TelField.js";
|
|
18
|
+
import { UrlFieldEntry } from "../url/UrlField.js";
|
|
19
|
+
import { LinkFieldEntry } from "../link/LinkField.js";
|
|
20
|
+
import { MoneyFieldEntry } from "../money/MoneyField.js";
|
|
14
21
|
import { NumberFieldEntry } from "../number/NumberField.js";
|
|
15
22
|
import { RangeFieldEntry } from "../range/RangeField.js";
|
|
16
|
-
import { RegionFieldEntry } from "../region/RegionField.js";
|
|
17
23
|
import { RelationFieldEntry } from "../relation/RelationField.js";
|
|
18
24
|
import { RepeaterFieldEntry } from "../repeater/RepeaterField.js";
|
|
19
25
|
import { SelectFieldEntry } from "../select/SelectField.js";
|
|
20
26
|
import { SlugFieldEntry } from "../slug/SlugField.js";
|
|
21
27
|
import { TagsFieldEntry } from "../tags/TagsField.js";
|
|
22
|
-
import { TelFieldEntry } from "../tel/TelField.js";
|
|
23
28
|
import { TextAreaFieldEntry } from "../textarea/TextAreaField.js";
|
|
24
29
|
import { TimeFieldEntry } from "../time/TimeField.js";
|
|
25
|
-
import { UrlFieldEntry } from "../url/UrlField.js";
|
|
26
30
|
import { fr } from "@panneau/intl";
|
|
27
31
|
//#region src/shared/builtIn.ts
|
|
28
32
|
/**
|
|
29
33
|
* The entries of the built-in field types. `richtext` and `media` come with their plugins
|
|
30
34
|
* (`@panneau/editor` and `@panneau/media`): without them, `DefinitionField` renders a placeholder.
|
|
31
35
|
* `file` uploads through the upload source of the fields context, or gives the files themselves.
|
|
32
|
-
* `embed` and `
|
|
36
|
+
* `embed`, `location` and `address` use its embed source and its maps; `location` loads Leaflet
|
|
37
|
+
* when shown. `link` searches its pages with the relation source, and picks its files with the
|
|
38
|
+
* `media` entry.
|
|
33
39
|
*/
|
|
34
40
|
var builtInFields = {
|
|
35
41
|
text: TextFieldEntry,
|
|
@@ -56,7 +62,11 @@ var builtInFields = {
|
|
|
56
62
|
embed: EmbedFieldEntry,
|
|
57
63
|
location: LocationFieldEntry,
|
|
58
64
|
country: CountryFieldEntry,
|
|
59
|
-
region: RegionFieldEntry
|
|
65
|
+
region: RegionFieldEntry,
|
|
66
|
+
address: AddressFieldEntry,
|
|
67
|
+
link: LinkFieldEntry,
|
|
68
|
+
daterange: DateRangeFieldEntry,
|
|
69
|
+
money: MoneyFieldEntry
|
|
60
70
|
};
|
|
61
71
|
/**
|
|
62
72
|
* The built-in fields as a `@panneau/core` plugin: their entries, and the French messages of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtIn.js","names":["fr","BooleanFieldEntry","ColorFieldEntry","CountryFieldEntry","DateFieldEntry","DateTimeFieldEntry","DurationFieldEntry","EmailFieldEntry","EmbedFieldEntry","FileFieldEntry","GroupFieldEntry","JsonFieldEntry","LocationFieldEntry","NumberFieldEntry","RangeFieldEntry","RegionFieldEntry","RelationFieldEntry","RepeaterFieldEntry","SelectFieldEntry","SlugFieldEntry","TagsFieldEntry","TelFieldEntry","TextFieldEntry","TextAreaFieldEntry","TimeFieldEntry","UrlFieldEntry","FieldEntry","builtInFields","Readonly","Record","text","textarea","number","boolean","date","datetime","time","select","email","url","color","slug","file","relation","group","repeater","tel","range","duration","json","tags","embed","location","country","region","fieldsPlugin","id","fields","locales"],"sources":["../../src/shared/builtIn.ts"],"sourcesContent":["import { fr } from '@panneau/intl';\n\nimport { BooleanFieldEntry } from '../boolean/BooleanField';\nimport { ColorFieldEntry } from '../color/ColorField';\nimport { CountryFieldEntry } from '../country/CountryField';\nimport { DateFieldEntry } from '../date/DateField';\nimport { DateTimeFieldEntry } from '../datetime/DateTimeField';\nimport { DurationFieldEntry } from '../duration/DurationField';\nimport { EmailFieldEntry } from '../email/EmailField';\nimport { EmbedFieldEntry } from '../embed/EmbedField';\nimport { FileFieldEntry } from '../file/FileField';\nimport { GroupFieldEntry } from '../group/GroupField';\nimport { JsonFieldEntry } from '../json/JsonField';\nimport { LocationFieldEntry } from '../location/LocationField';\nimport { NumberFieldEntry } from '../number/NumberField';\nimport { RangeFieldEntry } from '../range/RangeField';\nimport { RegionFieldEntry } from '../region/RegionField';\nimport { RelationFieldEntry } from '../relation/RelationField';\nimport { RepeaterFieldEntry } from '../repeater/RepeaterField';\nimport { SelectFieldEntry } from '../select/SelectField';\nimport { SlugFieldEntry } from '../slug/SlugField';\nimport { TagsFieldEntry } from '../tags/TagsField';\nimport { TelFieldEntry } from '../tel/TelField';\nimport { TextFieldEntry } from '../text/TextField';\nimport { TextAreaFieldEntry } from '../textarea/TextAreaField';\nimport { TimeFieldEntry } from '../time/TimeField';\nimport { UrlFieldEntry } from '../url/UrlField';\nimport type { FieldEntry } from './types';\n\n/**\n * The entries of the built-in field types. `richtext` and `media` come with their plugins\n * (`@panneau/editor` and `@panneau/media`): without them, `DefinitionField` renders a placeholder.\n * `file` uploads through the upload source of the fields context, or gives the files themselves.\n * `embed` and `
|
|
1
|
+
{"version":3,"file":"builtIn.js","names":["fr","AddressFieldEntry","BooleanFieldEntry","ColorFieldEntry","CountryFieldEntry","DateFieldEntry","DateRangeFieldEntry","DateTimeFieldEntry","DurationFieldEntry","EmailFieldEntry","EmbedFieldEntry","FileFieldEntry","GroupFieldEntry","JsonFieldEntry","LinkFieldEntry","LocationFieldEntry","MoneyFieldEntry","NumberFieldEntry","RangeFieldEntry","RegionFieldEntry","RelationFieldEntry","RepeaterFieldEntry","SelectFieldEntry","SlugFieldEntry","TagsFieldEntry","TelFieldEntry","TextFieldEntry","TextAreaFieldEntry","TimeFieldEntry","UrlFieldEntry","FieldEntry","builtInFields","Readonly","Record","text","textarea","number","boolean","date","datetime","time","select","email","url","color","slug","file","relation","group","repeater","tel","range","duration","json","tags","embed","location","country","region","address","link","daterange","money","fieldsPlugin","id","fields","locales"],"sources":["../../src/shared/builtIn.ts"],"sourcesContent":["import { fr } from '@panneau/intl';\n\nimport { AddressFieldEntry } from '../address/AddressField';\nimport { BooleanFieldEntry } from '../boolean/BooleanField';\nimport { ColorFieldEntry } from '../color/ColorField';\nimport { CountryFieldEntry } from '../country/CountryField';\nimport { DateFieldEntry } from '../date/DateField';\nimport { DateRangeFieldEntry } from '../daterange/DateRangeField';\nimport { DateTimeFieldEntry } from '../datetime/DateTimeField';\nimport { DurationFieldEntry } from '../duration/DurationField';\nimport { EmailFieldEntry } from '../email/EmailField';\nimport { EmbedFieldEntry } from '../embed/EmbedField';\nimport { FileFieldEntry } from '../file/FileField';\nimport { GroupFieldEntry } from '../group/GroupField';\nimport { JsonFieldEntry } from '../json/JsonField';\nimport { LinkFieldEntry } from '../link/LinkField';\nimport { LocationFieldEntry } from '../location/LocationField';\nimport { MoneyFieldEntry } from '../money/MoneyField';\nimport { NumberFieldEntry } from '../number/NumberField';\nimport { RangeFieldEntry } from '../range/RangeField';\nimport { RegionFieldEntry } from '../region/RegionField';\nimport { RelationFieldEntry } from '../relation/RelationField';\nimport { RepeaterFieldEntry } from '../repeater/RepeaterField';\nimport { SelectFieldEntry } from '../select/SelectField';\nimport { SlugFieldEntry } from '../slug/SlugField';\nimport { TagsFieldEntry } from '../tags/TagsField';\nimport { TelFieldEntry } from '../tel/TelField';\nimport { TextFieldEntry } from '../text/TextField';\nimport { TextAreaFieldEntry } from '../textarea/TextAreaField';\nimport { TimeFieldEntry } from '../time/TimeField';\nimport { UrlFieldEntry } from '../url/UrlField';\nimport type { FieldEntry } from './types';\n\n/**\n * The entries of the built-in field types. `richtext` and `media` come with their plugins\n * (`@panneau/editor` and `@panneau/media`): without them, `DefinitionField` renders a placeholder.\n * `file` uploads through the upload source of the fields context, or gives the files themselves.\n * `embed`, `location` and `address` use its embed source and its maps; `location` loads Leaflet\n * when shown. `link` searches its pages with the relation source, and picks its files with the\n * `media` entry.\n */\nexport const builtInFields: Readonly<Record<string, FieldEntry>> = {\n text: TextFieldEntry,\n textarea: TextAreaFieldEntry,\n number: NumberFieldEntry,\n boolean: BooleanFieldEntry,\n date: DateFieldEntry,\n datetime: DateTimeFieldEntry,\n time: TimeFieldEntry,\n select: SelectFieldEntry,\n email: EmailFieldEntry,\n url: UrlFieldEntry,\n color: ColorFieldEntry,\n slug: SlugFieldEntry,\n file: FileFieldEntry,\n relation: RelationFieldEntry,\n group: GroupFieldEntry,\n repeater: RepeaterFieldEntry,\n tel: TelFieldEntry,\n range: RangeFieldEntry,\n duration: DurationFieldEntry,\n json: JsonFieldEntry,\n tags: TagsFieldEntry,\n embed: EmbedFieldEntry,\n location: LocationFieldEntry,\n country: CountryFieldEntry,\n region: RegionFieldEntry,\n address: AddressFieldEntry,\n link: LinkFieldEntry,\n daterange: DateRangeFieldEntry,\n money: MoneyFieldEntry,\n};\n\n/**\n * The built-in fields as a `@panneau/core` plugin: their entries, and the French messages of\n * every Panneau package (`@panneau/ui`, `@panneau/fields`, `@panneau/forms`…, from\n * `@panneau/intl`). Pass it before the plugins that override a type.\n */\nexport const fieldsPlugin: {\n id: string;\n fields: Readonly<Record<string, FieldEntry>>;\n locales: Readonly<Record<string, Record<string, string>>>;\n} = {\n id: 'panneau-fields',\n fields: builtInFields,\n locales: { fr },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa+B,gBAAsD;CAC/DG,MAAMR;CACNS,UAAUR;CACVS,QAAQnB;CACRoB,SAASnC;CACToC,MAAMjC;CACNkC,UAAUhC;CACViC,MAAMZ;CACNa,QAAQnB;CACRoB,OAAOjC;CACPkC,KAAKd;CACLe,OAAOzC;CACP0C,MAAMtB;CACNuB,MAAMnC;CACNoC,UAAU3B;CACV4B,OAAOpC;CACPqC,UAAU5B;CACV6B,KAAKzB;CACL0B,OAAOjC;CACPkC,UAAU5C;CACV6C,MAAMxC;CACNyC,MAAM9B;CACN+B,OAAO7C;CACP8C,UAAUzC;CACV0C,SAASrD;CACTsD,QAAQvC;CACRwC,SAAS1D;CACT2D,MAAM9C;CACN+C,WAAWvD;CACXwD,OAAO9C;AACX;;;;;;AAOA,IAAa+C,eAIT;CACAC,IAAI;CACJC,QAAQlC;CACRmC,SAAS,EAAElE,GAAG;AAClB"}
|
package/dist/shared/dates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLocalTimeZone, parseAbsolute, parseDate, parseDateTime, parseTime } from "@internationalized/date";
|
|
2
2
|
//#region src/shared/dates.ts
|
|
3
3
|
/** `2026-10-15`, or the date of a date-time. */
|
|
4
|
-
function toCalendarDate(value) {
|
|
4
|
+
function toCalendarDate$1(value) {
|
|
5
5
|
const match = value?.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
6
6
|
if (match?.[1] === void 0) return null;
|
|
7
7
|
try {
|
|
@@ -44,6 +44,6 @@ function fromTime(value, withSeconds = false) {
|
|
|
44
44
|
return withSeconds ? `${time}:${pad(value.second)}` : time;
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export { fromDateTime, fromTime, toCalendarDate, toDateTime, toTime };
|
|
47
|
+
export { fromDateTime, fromTime, toCalendarDate$1 as toCalendarDate, toDateTime, toTime };
|
|
48
48
|
|
|
49
49
|
//# sourceMappingURL=dates.js.map
|
package/dist/shared/dates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.js","names":["CalendarDate","CalendarDateTime","Time","ZonedDateTime","getLocalTimeZone","parseAbsolute","parseDate","parseDateTime","parseTime","toCalendarDate","value","match","undefined","OFFSET","toDateTime","timeZone","trim","iso","replace","test","fromDateTime","toAbsoluteString","toString","toTime","length","fromTime","Pick","withSeconds","pad","part","String","padStart","time","hour","minute","second"],"sources":["../../src/shared/dates.ts"],"sourcesContent":["import {\n type CalendarDate,\n type CalendarDateTime,\n type Time,\n type ZonedDateTime,\n getLocalTimeZone,\n parseAbsolute,\n parseDate,\n parseDateTime,\n parseTime,\n} from '@internationalized/date';\n\n/** `2026-10-15`, or the date of a date-time. */\nexport function toCalendarDate(value: string | null | undefined): CalendarDate | null {\n const match = value?.match(/^(\\d{4}-\\d{2}-\\d{2})/);\n if (match?.[1] === undefined) {\n return null;\n }\n try {\n return parseDate(match[1]);\n } catch {\n return null;\n }\n}\n\nconst OFFSET = /(?:Z|[+-]\\d{2}:?\\d{2})$/i;\n\n/**\n * A date-time: with an offset or `Z` (`2026-10-15T13:30:00Z`), in the given time zone; without one\n * (`2026-10-15 09:30:00`), as is.\n */\nexport function toDateTime(\n value: string | null | undefined,\n timeZone: string = getLocalTimeZone(),\n): ZonedDateTime | CalendarDateTime | null {\n if (value === null || value === undefined || value.trim() === '') {\n return null;\n }\n const iso = value.trim().replace(' ', 'T');\n try {\n return OFFSET.test(iso) ? parseAbsolute(iso, timeZone) : parseDateTime(iso);\n } catch {\n return null;\n }\n}\n\n/** Writes a date-time: in UTC (`…Z`) when it has a time zone, without an offset otherwise. */\nexport function fromDateTime(value: ZonedDateTime | CalendarDateTime): string {\n return 'timeZone' in value\n ? value.toAbsoluteString().replace(/\\.000Z$/, 'Z')\n : value.toString();\n}\n\n/** `09:30` or `09:30:15`. */\nexport function toTime(value: string | null | undefined): Time | null {\n if (value === null || value === undefined || !/^\\d{1,2}:\\d{2}(:\\d{2})?/.test(value)) {\n return null;\n }\n try {\n return parseTime(value.length < 5 ? `0${value}` : value);\n } catch {\n return null;\n }\n}\n\n/** Writes a time as `HH:mm`, or `HH:mm:ss` with seconds. */\nexport function fromTime(\n value: Pick<Time, 'hour' | 'minute' | 'second'>,\n withSeconds = false,\n): string {\n const pad = (part: number) => String(part).padStart(2, '0');\n const time = `${pad(value.hour)}:${pad(value.minute)}`;\n return withSeconds ? `${time}:${pad(value.second)}` : time;\n}\n"],"mappings":";;;AAaA,SAAgBS,
|
|
1
|
+
{"version":3,"file":"dates.js","names":["CalendarDate","CalendarDateTime","Time","ZonedDateTime","getLocalTimeZone","parseAbsolute","parseDate","parseDateTime","parseTime","toCalendarDate","value","match","undefined","OFFSET","toDateTime","timeZone","trim","iso","replace","test","fromDateTime","toAbsoluteString","toString","toTime","length","fromTime","Pick","withSeconds","pad","part","String","padStart","time","hour","minute","second","toCalendarDate"],"sources":["../../src/shared/dates.ts"],"sourcesContent":["import {\n type CalendarDate,\n type CalendarDateTime,\n type Time,\n type ZonedDateTime,\n getLocalTimeZone,\n parseAbsolute,\n parseDate,\n parseDateTime,\n parseTime,\n} from '@internationalized/date';\n\n/** `2026-10-15`, or the date of a date-time. */\nexport function toCalendarDate(value: string | null | undefined): CalendarDate | null {\n const match = value?.match(/^(\\d{4}-\\d{2}-\\d{2})/);\n if (match?.[1] === undefined) {\n return null;\n }\n try {\n return parseDate(match[1]);\n } catch {\n return null;\n }\n}\n\nconst OFFSET = /(?:Z|[+-]\\d{2}:?\\d{2})$/i;\n\n/**\n * A date-time: with an offset or `Z` (`2026-10-15T13:30:00Z`), in the given time zone; without one\n * (`2026-10-15 09:30:00`), as is.\n */\nexport function toDateTime(\n value: string | null | undefined,\n timeZone: string = getLocalTimeZone(),\n): ZonedDateTime | CalendarDateTime | null {\n if (value === null || value === undefined || value.trim() === '') {\n return null;\n }\n const iso = value.trim().replace(' ', 'T');\n try {\n return OFFSET.test(iso) ? parseAbsolute(iso, timeZone) : parseDateTime(iso);\n } catch {\n return null;\n }\n}\n\n/** Writes a date-time: in UTC (`…Z`) when it has a time zone, without an offset otherwise. */\nexport function fromDateTime(value: ZonedDateTime | CalendarDateTime): string {\n return 'timeZone' in value\n ? value.toAbsoluteString().replace(/\\.000Z$/, 'Z')\n : value.toString();\n}\n\n/** `09:30` or `09:30:15`. */\nexport function toTime(value: string | null | undefined): Time | null {\n if (value === null || value === undefined || !/^\\d{1,2}:\\d{2}(:\\d{2})?/.test(value)) {\n return null;\n }\n try {\n return parseTime(value.length < 5 ? `0${value}` : value);\n } catch {\n return null;\n }\n}\n\n/** Writes a time as `HH:mm`, or `HH:mm:ss` with seconds. */\nexport function fromTime(\n value: Pick<Time, 'hour' | 'minute' | 'second'>,\n withSeconds = false,\n): string {\n const pad = (part: number) => String(part).padStart(2, '0');\n const time = `${pad(value.hour)}:${pad(value.minute)}`;\n return withSeconds ? `${time}:${pad(value.second)}` : time;\n}\n"],"mappings":";;;AAaA,SAAgBS,iBAAeC,OAAuD;CAClF,MAAMC,QAAQD,OAAOC,MAAM,sBAAsB;CACjD,IAAIA,QAAQ,OAAOC,KAAAA,GACf,OAAO;CAEX,IAAI;EACA,OAAON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.ts","sourceRoot":"","sources":["../../src/shared/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA0B/C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CASjD"}
|
package/dist/shared/flow.js
CHANGED
package/dist/shared/flow.js.map
CHANGED
|
@@ -1 +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 'country',\n 'region',\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;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"}
|
|
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 'country',\n 'region',\n 'money',\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;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,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Field } from '@panneau/protocol';
|
|
3
|
+
/** What a part of a value gets from the binding of the fields context: its errors and its blur. */
|
|
4
|
+
export interface BoundPartProps {
|
|
5
|
+
errors?: readonly string[];
|
|
6
|
+
onBlur?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface PartBindingProps {
|
|
9
|
+
/** The part, as a field of the definition: the binding reads its errors by its path. */
|
|
10
|
+
field: Field;
|
|
11
|
+
/** Dot path of the part (`address.postalCode`). */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Errors of the part without a binding. */
|
|
14
|
+
errors?: readonly string[];
|
|
15
|
+
/** Blur of the part without a binding. */
|
|
16
|
+
onBlur?: () => void;
|
|
17
|
+
render: (bound: BoundPartProps) => ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A part of a value that a field edits itself (the postal code of an address, the URL of a link):
|
|
21
|
+
* the field keeps its whole value, and the binding of the fields context gives each part the
|
|
22
|
+
* errors of its own path, and marks it touched when it loses focus. Without a binding, the part
|
|
23
|
+
* gets `errors` and `onBlur`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function BoundPart({ field, path, errors, onBlur, render }: PartBindingProps): 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;
|
|
26
|
+
//# sourceMappingURL=part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../../src/shared/part.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,mGAAmG;AACnG,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,wFAAwF;IACxF,KAAK,EAAE,KAAK,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS,CAAC;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,gBAAgB,+TAqBlF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getParentPath, useFieldsContext } from "./context.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/shared/part.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A part of a value that a field edits itself (the postal code of an address, the URL of a link):
|
|
7
|
+
* the field keeps its whole value, and the binding of the fields context gives each part the
|
|
8
|
+
* errors of its own path, and marks it touched when it loses focus. Without a binding, the part
|
|
9
|
+
* gets `errors` and `onBlur`.
|
|
10
|
+
*/
|
|
11
|
+
function BoundPart(t0) {
|
|
12
|
+
const $ = c(14);
|
|
13
|
+
const { field, path, errors, onBlur, render } = t0;
|
|
14
|
+
const { binding: Binding } = useFieldsContext();
|
|
15
|
+
if (Binding === null) {
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] !== errors || $[1] !== onBlur || $[2] !== render) {
|
|
18
|
+
t1 = render({
|
|
19
|
+
...errors !== void 0 ? { errors } : {},
|
|
20
|
+
...onBlur !== void 0 ? { onBlur } : {}
|
|
21
|
+
});
|
|
22
|
+
$[0] = errors;
|
|
23
|
+
$[1] = onBlur;
|
|
24
|
+
$[2] = render;
|
|
25
|
+
$[3] = t1;
|
|
26
|
+
} else t1 = $[3];
|
|
27
|
+
return t1;
|
|
28
|
+
}
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[4] !== path) {
|
|
31
|
+
t1 = getParentPath(path);
|
|
32
|
+
$[4] = path;
|
|
33
|
+
$[5] = t1;
|
|
34
|
+
} else t1 = $[5];
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[6] !== render) {
|
|
37
|
+
t2 = (bound) => render({
|
|
38
|
+
...bound.errors !== void 0 ? { errors: bound.errors } : {},
|
|
39
|
+
...bound.onBlur !== void 0 ? { onBlur: bound.onBlur } : {}
|
|
40
|
+
});
|
|
41
|
+
$[6] = render;
|
|
42
|
+
$[7] = t2;
|
|
43
|
+
} else t2 = $[7];
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[8] !== Binding || $[9] !== field || $[10] !== path || $[11] !== t1 || $[12] !== t2) {
|
|
46
|
+
t3 = /* @__PURE__ */ jsx(Binding, {
|
|
47
|
+
field,
|
|
48
|
+
path,
|
|
49
|
+
parentPath: t1,
|
|
50
|
+
render: t2
|
|
51
|
+
});
|
|
52
|
+
$[8] = Binding;
|
|
53
|
+
$[9] = field;
|
|
54
|
+
$[10] = path;
|
|
55
|
+
$[11] = t1;
|
|
56
|
+
$[12] = t2;
|
|
57
|
+
$[13] = t3;
|
|
58
|
+
} else t3 = $[13];
|
|
59
|
+
return t3;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { BoundPart };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=part.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part.js","names":["ReactNode","Field","getParentPath","useFieldsContext","BoundPartProps","errors","onBlur","PartBindingProps","field","path","render","bound","BoundPart","t0","$","_c","binding","Binding","t1","undefined","t2","t3","_c"],"sources":["../../src/shared/part.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { Field } from '@panneau/protocol';\n\nimport { getParentPath, useFieldsContext } from './context';\n\n/** What a part of a value gets from the binding of the fields context: its errors and its blur. */\nexport interface BoundPartProps {\n errors?: readonly string[];\n onBlur?: () => void;\n}\n\nexport interface PartBindingProps {\n /** The part, as a field of the definition: the binding reads its errors by its path. */\n field: Field;\n /** Dot path of the part (`address.postalCode`). */\n path: string;\n /** Errors of the part without a binding. */\n errors?: readonly string[];\n /** Blur of the part without a binding. */\n onBlur?: () => void;\n render: (bound: BoundPartProps) => ReactNode;\n}\n\n/**\n * A part of a value that a field edits itself (the postal code of an address, the URL of a link):\n * the field keeps its whole value, and the binding of the fields context gives each part the\n * errors of its own path, and marks it touched when it loses focus. Without a binding, the part\n * gets `errors` and `onBlur`.\n */\nexport function BoundPart({ field, path, errors, onBlur, render }: PartBindingProps) {\n const { binding: Binding } = useFieldsContext();\n if (Binding === null) {\n return render({\n ...(errors !== undefined ? { errors } : {}),\n ...(onBlur !== undefined ? { onBlur } : {}),\n });\n }\n return (\n <Binding\n field={field}\n path={path}\n parentPath={getParentPath(path)}\n render={(bound) =>\n render({\n ...(bound.errors !== undefined ? { errors: bound.errors } : {}),\n ...(bound.onBlur !== undefined ? { onBlur: bound.onBlur } : {}),\n })\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA8BA,SAAOY,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAmB,MAAA,EAAAP,OAAAC,MAAAJ,QAAAC,QAAAI,WAAAG;CACtB,MAAA,EAAAG,SAAAC,YAA6Bd,iBAAiB;CAC9C,IAAIc,YAAY,MAAI;EAAA,IAAAC;EAAA,IAAAJ,EAAA,OAAAT,UAAAS,EAAA,OAAAR,UAAAQ,EAAA,OAAAJ,QAAA;GACTQ,KAAAR,OAAO;IAAA,GACNL,WAAWc,KAAAA,IAAX,EAAAd,OAAqC,IAArC,CAAqC;IAAC,GACtCC,WAAWa,KAAAA,IAAX,EAAAb,OAAqC,IAArC,CAAqC;GAC7C,CAAC;GAACQ,EAAA,KAAAT;GAAAS,EAAA,KAAAR;GAAAQ,EAAA,KAAAJ;GAAAI,EAAA,KAAAI;EAAA,OAAAA,KAAAJ,EAAA;EAAA,OAHKI;CAGL;CACL,IAAAA;CAAA,IAAAJ,EAAA,OAAAL,MAAA;EAKmBS,KAAAhB,cAAcO,IAAI;EAACK,EAAA,KAAAL;EAAAK,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAJ,QAAA;EACvBU,MAAAT,UACJD,OAAO;GAAA,GACCC,MAAKN,WAAYc,KAAAA,IAAjB,EAAAd,QAAuCM,MAAKN,OAAa,IAAzD,CAAyD;GAAC,GAC1DM,MAAKL,WAAYa,KAAAA,IAAjB,EAAAb,QAAuCK,MAAKL,OAAa,IAAzD,CAAyD;EACjE,CAAC;EAACQ,EAAA,KAAAJ;EAAAI,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAG,WAAAH,EAAA,OAAAN,SAAAM,EAAA,QAAAL,QAAAK,EAAA,QAAAI,MAAAJ,EAAA,QAAAM,IAAA;EARVC,KAAA,oBAAC,SAAD;GACWb;GACDC;GACM,YAAAS;GACJ,QAAAE;EAIF,CAAA;EAERN,EAAA,KAAAG;EAAAH,EAAA,KAAAN;EAAAM,EAAA,MAAAL;EAAAK,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAVFO;AAUE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* The extension, after the number, in the same box. */
|
|
2
|
+
.panneau-tel-field-extension {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--panneau-space-1);
|
|
6
|
+
align-self: stretch;
|
|
7
|
+
padding-inline-start: var(--panneau-space-2);
|
|
8
|
+
border-inline-start: var(--panneau-border-width) solid var(--panneau-color-border-control);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.panneau-tel-field-extension-input {
|
|
12
|
+
width: 6ch;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
font: inherit;
|
|
16
|
+
color: var(--panneau-color-text);
|
|
17
|
+
background: transparent;
|
|
18
|
+
border: 0;
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.panneau-tel-field-extension-input:read-only,
|
|
23
|
+
.panneau-tel-field-extension-input:disabled {
|
|
24
|
+
cursor: inherit;
|
|
25
|
+
}
|
package/dist/tel/TelField.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export interface TelFieldProps extends Omit<TextFieldProps, 'type' | 'inputMode'
|
|
|
6
6
|
* gives `CA`).
|
|
7
7
|
*/
|
|
8
8
|
country?: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Adds an input for the extension, after the number. The value is then the number with its
|
|
11
|
+
* extension after `;ext=`, as in a `tel:` URI: `+15145550199;ext=123`.
|
|
12
|
+
*/
|
|
13
|
+
extension?: boolean;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* A phone number, in E.164 (`+15145550199`). The country of the number, its flag and its calling
|
|
@@ -15,8 +20,15 @@ export interface TelFieldProps extends Omit<TextFieldProps, 'type' | 'inputMode'
|
|
|
15
20
|
* Until a number is complete, the value is the text as typed, which the `tel` rule refuses. A value
|
|
16
21
|
* that isn't E.164, kept from before, shows as it is, and becomes E.164 when the field is left, if
|
|
17
22
|
* it reads as a number of the chosen country.
|
|
23
|
+
*
|
|
24
|
+
* With `extension`, an input after the number takes the digits of an extension, kept after `;ext=`
|
|
25
|
+
* (`+15145550199;ext=123`). An extension typed or pasted after the number (`ext. 123`, `x123`,
|
|
26
|
+
* `poste 123`) moves to that input when the field is left.
|
|
27
|
+
*/
|
|
28
|
+
export declare function TelField({ value, onChange, onBlur, country: defaultCountry, extension: allowsExtension, suffix, disabled, readOnly, ...props }: TelFieldProps): import("react").JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* The `tel` type: `settings.country` is the country of a new number, and `settings.extension` adds
|
|
31
|
+
* an input for an extension.
|
|
18
32
|
*/
|
|
19
|
-
export declare function TelField({ value, onChange, onBlur, country: defaultCountry, disabled, readOnly, ...props }: TelFieldProps): import("react").JSX.Element;
|
|
20
|
-
/** The `tel` type: `settings.country` is the country of a new number. */
|
|
21
33
|
export declare function TelFieldEntry(props: FieldEntryProps): import("react").JSX.Element;
|
|
22
34
|
//# sourceMappingURL=TelField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TelField.d.ts","sourceRoot":"","sources":["../../src/tel/TelField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"TelField.d.ts","sourceRoot":"","sources":["../../src/tel/TelField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcnE,MAAM,WAAW,aAAc,SAAQ,IAAI,CACvC,cAAc,EACd,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAC3D;IACG;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAgBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EACrB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,eAAuB,EAClC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,aAAa,+BAgJf;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,+BAYnD"}
|