@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,22 @@
|
|
|
1
|
+
import "./AddressField.css";
|
|
2
|
+
//#region src/address/AddressField.module.css
|
|
3
|
+
var address = "panneau-address-field-address";
|
|
4
|
+
var parts = "panneau-address-field-parts";
|
|
5
|
+
var part = "panneau-address-field-part";
|
|
6
|
+
var country = "panneau-address-field-country";
|
|
7
|
+
var street = "panneau-address-field-street";
|
|
8
|
+
var map = "panneau-address-field-map";
|
|
9
|
+
var remove = "panneau-address-field-remove";
|
|
10
|
+
var AddressField_module_default = {
|
|
11
|
+
address,
|
|
12
|
+
parts,
|
|
13
|
+
part,
|
|
14
|
+
country,
|
|
15
|
+
street,
|
|
16
|
+
map,
|
|
17
|
+
remove
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { address, country, AddressField_module_default as default, map, part, parts, remove, street };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=AddressField.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressField.module.js","names":[],"sources":["../../src/address/AddressField.module.css"],"sourcesContent":["/* The search, the parts, then the map. */\n.address {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-3);\n}\n\n/* The parts on a grid of six columns: the street and its unit, then the city, the region and the\n postal code in the order of the country. */\n.parts {\n display: grid;\n grid-template-columns: repeat(6, minmax(0, 1fr));\n gap: var(--panneau-space-3);\n}\n\n.part {\n grid-column: span 2;\n min-width: 0;\n}\n\n.country {\n grid-column: 1 / -1;\n}\n\n.street {\n grid-column: span 4;\n}\n\n.map {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-2);\n}\n\n.remove {\n align-self: flex-start;\n}\n\n@media (max-width: 40rem) {\n .part,\n .street {\n grid-column: 1 / -1;\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AddressValue } from '@panneau/protocol';
|
|
2
|
+
export type { AddressValue };
|
|
3
|
+
/** Whether a value is an address: an object, whose parts are checked as they are read. */
|
|
4
|
+
export declare function isAddress(value: unknown): value is AddressValue;
|
|
5
|
+
/**
|
|
6
|
+
* Whether the addresses of a country end with the city, the region and the postal code
|
|
7
|
+
* (`Montréal QC H2X 1Y4`): those of the countries whose regions Panneau knows, and an address
|
|
8
|
+
* without a country. Elsewhere, the postal code comes first (`75001 Paris`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function endsWithRegion(country: string | null | undefined): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* An address without its empty parts, with `country` when it has a part and no country. `null`
|
|
13
|
+
* when nothing but a country is left.
|
|
14
|
+
*/
|
|
15
|
+
export declare function cleanAddress(address: Partial<Record<keyof AddressValue, unknown>>, country?: string | null): AddressValue | null;
|
|
16
|
+
/**
|
|
17
|
+
* An address on one line, in the order of its country, without the country:
|
|
18
|
+
* `1234 Rue Saint-Denis, App. 5, Montréal QC H2X 1Y4`, `12 rue de Rivoli, 75001 Paris`. The
|
|
19
|
+
* region is its code in Canada and the United States, as on envelopes, and its name in the locale
|
|
20
|
+
* for the other countries whose regions Panneau knows.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatAddress(address: AddressValue, locale: string): string;
|
|
23
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE1E;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,YAAY,EAAE,OAAO,CAAC,CAAC,EACrD,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACxB,YAAY,GAAG,IAAI,CA0BrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAkB3E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { REGION_COUNTRIES, getRegionName } from "../region/regions.js";
|
|
2
|
+
import { ADDRESS_PARTS, normalizePostalCode } from "@panneau/protocol/runtime";
|
|
3
|
+
//#region src/address/address.ts
|
|
4
|
+
/** Whether a value is an address: an object, whose parts are checked as they are read. */
|
|
5
|
+
function isAddress(value) {
|
|
6
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether the addresses of a country end with the city, the region and the postal code
|
|
10
|
+
* (`Montréal QC H2X 1Y4`): those of the countries whose regions Panneau knows, and an address
|
|
11
|
+
* without a country. Elsewhere, the postal code comes first (`75001 Paris`).
|
|
12
|
+
*/
|
|
13
|
+
function endsWithRegion(country) {
|
|
14
|
+
return country === null || country === void 0 || REGION_COUNTRIES.includes(country);
|
|
15
|
+
}
|
|
16
|
+
/** The text of a part, trimmed, or `undefined` when it is empty or isn't text. */
|
|
17
|
+
function partText(value) {
|
|
18
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An address without its empty parts, with `country` when it has a part and no country. `null`
|
|
22
|
+
* when nothing but a country is left.
|
|
23
|
+
*/
|
|
24
|
+
function cleanAddress(address, country) {
|
|
25
|
+
const next = {};
|
|
26
|
+
ADDRESS_PARTS.forEach((part) => {
|
|
27
|
+
const text = typeof address[part] === "string" ? address[part] : void 0;
|
|
28
|
+
if (text !== void 0 && text.trim() !== "") next[part] = text;
|
|
29
|
+
});
|
|
30
|
+
const point = address.point;
|
|
31
|
+
if (point !== null && typeof point === "object" && typeof point.lat === "number" && typeof point.lng === "number") next.point = point;
|
|
32
|
+
if (Object.keys(next).every((part) => part === "country")) return null;
|
|
33
|
+
if (next.country === void 0 && country !== null && country !== void 0) next.country = country;
|
|
34
|
+
return next;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* An address on one line, in the order of its country, without the country:
|
|
38
|
+
* `1234 Rue Saint-Denis, App. 5, Montréal QC H2X 1Y4`, `12 rue de Rivoli, 75001 Paris`. The
|
|
39
|
+
* region is its code in Canada and the United States, as on envelopes, and its name in the locale
|
|
40
|
+
* for the other countries whose regions Panneau knows.
|
|
41
|
+
*/
|
|
42
|
+
function formatAddress(address, locale) {
|
|
43
|
+
const country = partText(address.country);
|
|
44
|
+
const regionCode = partText(address.region);
|
|
45
|
+
const region = regionCode !== void 0 && country !== "CA" && country !== "US" ? getRegionName(country, regionCode, locale) ?? regionCode : regionCode;
|
|
46
|
+
const postalCode = partText(address.postalCode) !== void 0 ? normalizePostalCode(address.postalCode ?? "", country) : void 0;
|
|
47
|
+
const city = partText(address.city);
|
|
48
|
+
const locality = endsWithRegion(country) ? [city, [region, postalCode].filter(Boolean).join(" ")] : [[postalCode, city].filter(Boolean).join(" "), region];
|
|
49
|
+
return [
|
|
50
|
+
partText(address.street),
|
|
51
|
+
partText(address.unit),
|
|
52
|
+
...locality
|
|
53
|
+
].filter((part) => part !== void 0 && part !== "").join(", ");
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { cleanAddress, endsWithRegion, formatAddress, isAddress };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","names":["AddressValue","ADDRESS_PARTS","normalizePostalCode","REGION_COUNTRIES","getRegionName","isAddress","value","Array","isArray","endsWithRegion","country","undefined","includes","partText","trim","cleanAddress","address","Partial","Record","next","forEach","part","text","point","lat","lng","NonNullable","Object","keys","every","formatAddress","locale","regionCode","region","postalCode","city","locality","filter","Boolean","join","street","unit"],"sources":["../../src/address/address.ts"],"sourcesContent":["import type { AddressValue } from '@panneau/protocol';\nimport { ADDRESS_PARTS, normalizePostalCode } from '@panneau/protocol/runtime';\n\nimport { REGION_COUNTRIES, getRegionName } from '../region/regions';\n\nexport type { AddressValue };\n\n/** Whether a value is an address: an object, whose parts are checked as they are read. */\nexport function isAddress(value: unknown): value is AddressValue {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Whether the addresses of a country end with the city, the region and the postal code\n * (`Montréal QC H2X 1Y4`): those of the countries whose regions Panneau knows, and an address\n * without a country. Elsewhere, the postal code comes first (`75001 Paris`).\n */\nexport function endsWithRegion(country: string | null | undefined): boolean {\n return country === null || country === undefined || REGION_COUNTRIES.includes(country);\n}\n\n/** The text of a part, trimmed, or `undefined` when it is empty or isn't text. */\nfunction partText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined;\n}\n\n/**\n * An address without its empty parts, with `country` when it has a part and no country. `null`\n * when nothing but a country is left.\n */\nexport function cleanAddress(\n address: Partial<Record<keyof AddressValue, unknown>>,\n country?: string | null,\n): AddressValue | null {\n const next: AddressValue = {};\n ADDRESS_PARTS.forEach((part) => {\n const text = typeof address[part] === 'string' ? (address[part] as string) : undefined;\n // Spaces typed at the end stay while the part is typed\n if (text !== undefined && text.trim() !== '') {\n next[part] = text;\n }\n });\n const point = address.point;\n if (\n point !== null &&\n typeof point === 'object' &&\n typeof (point as { lat?: unknown }).lat === 'number' &&\n typeof (point as { lng?: unknown }).lng === 'number'\n ) {\n next.point = point as NonNullable<AddressValue['point']>;\n }\n // A country alone, picked before the other parts, isn't an address yet\n if (Object.keys(next).every((part) => part === 'country')) {\n return null;\n }\n if (next.country === undefined && country !== null && country !== undefined) {\n next.country = country;\n }\n return next;\n}\n\n/**\n * An address on one line, in the order of its country, without the country:\n * `1234 Rue Saint-Denis, App. 5, Montréal QC H2X 1Y4`, `12 rue de Rivoli, 75001 Paris`. The\n * region is its code in Canada and the United States, as on envelopes, and its name in the locale\n * for the other countries whose regions Panneau knows.\n */\nexport function formatAddress(address: AddressValue, locale: string): string {\n const country = partText(address.country);\n const regionCode = partText(address.region);\n const region =\n regionCode !== undefined && country !== 'CA' && country !== 'US'\n ? (getRegionName(country, regionCode, locale) ?? regionCode)\n : regionCode;\n const postalCode =\n partText(address.postalCode) !== undefined\n ? normalizePostalCode(address.postalCode ?? '', country)\n : undefined;\n const city = partText(address.city);\n const locality = endsWithRegion(country)\n ? [city, [region, postalCode].filter(Boolean).join(' ')]\n : [[postalCode, city].filter(Boolean).join(' '), region];\n return [partText(address.street), partText(address.unit), ...locality]\n .filter((part) => part !== undefined && part !== '')\n .join(', ');\n}\n"],"mappings":";;;;AAQA,SAAgBK,UAAUC,OAAuC;CAC7D,OAAOA,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACC,MAAMC,QAAQF,KAAK;AAC9E;;;;;;AAOA,SAAgBG,eAAeC,SAA6C;CACxE,OAAOA,YAAY,QAAQA,YAAYC,KAAAA,KAAaR,iBAAiBS,SAASF,OAAO;AACzF;;AAGA,SAASG,SAASP,OAAoC;CAClD,OAAO,OAAOA,UAAU,YAAYA,MAAMQ,KAAK,MAAM,KAAKR,MAAMQ,KAAK,IAAIH,KAAAA;AAC7E;;;;;AAMA,SAAgBI,aACZC,SACAN,SACmB;CACnB,MAAMS,OAAqB,CAAC;CAC5BlB,cAAcmB,SAASC,SAAS;EAC5B,MAAMC,OAAO,OAAON,QAAQK,UAAU,WAAYL,QAAQK,QAAmBV,KAAAA;EAE7E,IAAIW,SAASX,KAAAA,KAAaW,KAAKR,KAAK,MAAM,IACtCK,KAAKE,QAAQC;CAErB,CAAC;CACD,MAAMC,QAAQP,QAAQO;CACtB,IACIA,UAAU,QACV,OAAOA,UAAU,YACjB,OAAQA,MAA4BC,QAAQ,YAC5C,OAAQD,MAA4BE,QAAQ,UAE5CN,KAAKI,QAAQA;CAGjB,IAAII,OAAOC,KAAKT,IAAI,CAAC,CAACU,OAAOR,SAASA,SAAS,SAAS,GACpD,OAAO;CAEX,IAAIF,KAAKT,YAAYC,KAAAA,KAAaD,YAAY,QAAQA,YAAYC,KAAAA,GAC9DQ,KAAKT,UAAUA;CAEnB,OAAOS;AACX;;;;;;;AAQA,SAAgBW,cAAcd,SAAuBe,QAAwB;CACzE,MAAMrB,UAAUG,SAASG,QAAQN,OAAO;CACxC,MAAMsB,aAAanB,SAASG,QAAQiB,MAAM;CAC1C,MAAMA,SACFD,eAAerB,KAAAA,KAAaD,YAAY,QAAQA,YAAY,OACrDN,cAAcM,SAASsB,YAAYD,MAAM,KAAKC,aAC/CA;CACV,MAAME,aACFrB,SAASG,QAAQkB,UAAU,MAAMvB,KAAAA,IAC3BT,oBAAoBc,QAAQkB,cAAc,IAAIxB,OAAO,IACrDC,KAAAA;CACV,MAAMwB,OAAOtB,SAASG,QAAQmB,IAAI;CAClC,MAAMC,WAAW3B,eAAeC,OAAO,IACjC,CAACyB,MAAM,CAACF,QAAQC,UAAU,CAAC,CAACG,OAAOC,OAAO,CAAC,CAACC,KAAK,GAAG,CAAC,IACrD,CAAC,CAACL,YAAYC,IAAI,CAAC,CAACE,OAAOC,OAAO,CAAC,CAACC,KAAK,GAAG,GAAGN,MAAM;CAC3D,OAAO;EAACpB,SAASG,QAAQwB,MAAM;EAAG3B,SAASG,QAAQyB,IAAI;EAAG,GAAGL;CAAQ,CAAC,CACjEC,QAAQhB,SAASA,SAASV,KAAAA,KAAaU,SAAS,EAAE,CAAC,CACnDkB,KAAK,IAAI;AAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/address/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EACH,KAAK,YAAY,EACjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,GACZ,MAAM,WAAW,CAAC"}
|
|
@@ -31,3 +31,12 @@
|
|
|
31
31
|
.panneau-color-field-input {
|
|
32
32
|
font-family: var(--panneau-font-family-mono);
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
.panneau-color-field-palette-swatch {
|
|
36
|
+
display: inline-block;
|
|
37
|
+
width: 1rem;
|
|
38
|
+
height: 1rem;
|
|
39
|
+
vertical-align: middle;
|
|
40
|
+
border: var(--panneau-border-width) solid var(--panneau-color-border-control);
|
|
41
|
+
border-radius: var(--panneau-radius-sm);
|
|
42
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { FieldEntryProps } from '../shared/types.js';
|
|
2
2
|
import { type TextFieldProps } from '../text/TextField.js';
|
|
3
|
-
|
|
3
|
+
import { type ColorPaletteEntry } from './palette.js';
|
|
4
|
+
export interface ColorFieldProps extends Omit<TextFieldProps, 'type' | 'prefix' | 'maxLength'> {
|
|
5
|
+
/**
|
|
6
|
+
* The colors to pick from (decision 0058). With a palette, the field only offers its colors,
|
|
7
|
+
* and the value is the `value` of one of them.
|
|
8
|
+
*/
|
|
9
|
+
palette?: readonly ColorPaletteEntry[] | null;
|
|
10
|
+
}
|
|
4
11
|
/**
|
|
5
12
|
* Normalizes a hexadecimal color: `#` prefix, lowercase, and 3 digits expanded to 6. Returns the
|
|
6
13
|
* text as is when it isn't a hexadecimal color.
|
|
@@ -10,7 +17,7 @@ export declare function normalizeColor(value: string): string;
|
|
|
10
17
|
* A color as a hexadecimal value (`#1d4ed8`): typed, or picked with the browser's color picker.
|
|
11
18
|
* The value is normalized on blur.
|
|
12
19
|
*/
|
|
13
|
-
export declare function ColorField({ value, onChange, onBlur, disabled, readOnly, inputClassName, ...props }: ColorFieldProps): import("react").JSX.Element;
|
|
14
|
-
/** The `color` type. */
|
|
20
|
+
export declare function ColorField({ value, onChange, onBlur, disabled, readOnly, inputClassName, palette, ...props }: ColorFieldProps): import("react").JSX.Element;
|
|
21
|
+
/** The `color` type: `settings.palette`, the colors to pick from. */
|
|
15
22
|
export declare function ColorFieldEntry(props: FieldEntryProps): import("react").JSX.Element;
|
|
16
23
|
//# sourceMappingURL=ColorField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorField.d.ts","sourceRoot":"","sources":["../../src/color/ColorField.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorField.d.ts","sourceRoot":"","sources":["../../src/color/ColorField.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,KAAK,iBAAiB,EAAmC,MAAM,WAAW,CAAC;AAEpF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC1F;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUpD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,OAAO,EACP,GAAG,KAAK,EACX,EAAE,eAAe,+BAmDjB;AA4ED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,+BAUrD"}
|