@panneau/fields 5.0.0-alpha.2 → 5.0.0-alpha.20
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 +186 -20
- 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/boolean/BooleanField.d.ts +1 -1
- package/dist/boolean/BooleanField.js +78 -17
- package/dist/boolean/BooleanField.js.map +1 -1
- package/dist/boolean/index.d.ts +1 -1
- package/dist/color/ColorField.css +9 -0
- package/dist/color/ColorField.d.ts +12 -5
- 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 +2 -1
- 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/compound/Compound.css +26 -0
- package/dist/compound/Compound.module.js +16 -0
- package/dist/compound/Compound.module.js.map +1 -0
- package/dist/compound/compound.d.ts +56 -0
- package/dist/compound/compound.d.ts.map +1 -0
- package/dist/compound/compound.js +186 -0
- package/dist/compound/compound.js.map +1 -0
- package/dist/country/CountryField.css +42 -0
- package/dist/country/CountryField.d.ts +32 -0
- package/dist/country/CountryField.d.ts.map +1 -0
- package/dist/country/CountryField.js +424 -0
- package/dist/country/CountryField.js.map +1 -0
- package/dist/country/CountryField.module.js +20 -0
- package/dist/country/CountryField.module.js.map +1 -0
- package/dist/country/codes.d.ts +6 -0
- package/dist/country/codes.d.ts.map +1 -0
- package/dist/country/codes.js +261 -0
- package/dist/country/codes.js.map +1 -0
- package/dist/country/countries.d.ts +32 -0
- package/dist/country/countries.d.ts.map +1 -0
- package/dist/country/countries.js +60 -0
- package/dist/country/countries.js.map +1 -0
- package/dist/country/index.d.ts +3 -0
- package/dist/country/index.d.ts.map +1 -0
- package/dist/country/index.js +4 -0
- package/dist/credits/CreditsField.d.ts +15 -0
- package/dist/credits/CreditsField.d.ts.map +1 -0
- package/dist/credits/CreditsField.js +58 -0
- package/dist/credits/CreditsField.js.map +1 -0
- package/dist/credits/credits.d.ts +18 -0
- package/dist/credits/credits.d.ts.map +1 -0
- package/dist/credits/credits.js +33 -0
- package/dist/credits/credits.js.map +1 -0
- package/dist/credits/index.d.ts +5 -0
- package/dist/credits/index.d.ts.map +1 -0
- package/dist/credits/index.js +3 -0
- package/dist/date/DateField.d.ts +1 -1
- package/dist/date/DateField.js.map +1 -1
- package/dist/date/index.d.ts +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/datetime/DateTimeField.d.ts +1 -1
- package/dist/datetime/DateTimeField.js +107 -20
- package/dist/datetime/DateTimeField.js.map +1 -1
- package/dist/datetime/index.d.ts +1 -1
- package/dist/duration/DurationField.css +11 -0
- package/dist/duration/DurationField.d.ts +67 -0
- package/dist/duration/DurationField.d.ts.map +1 -0
- package/dist/duration/DurationField.js +260 -0
- package/dist/duration/DurationField.js.map +1 -0
- package/dist/duration/DurationField.module.js +12 -0
- package/dist/duration/DurationField.module.js.map +1 -0
- package/dist/duration/index.d.ts +2 -0
- package/dist/duration/index.d.ts.map +1 -0
- package/dist/duration/index.js +1 -0
- package/dist/email/EmailField.d.ts +2 -2
- package/dist/email/EmailField.js.map +1 -1
- package/dist/email/index.d.ts +1 -1
- package/dist/embed/EmbedField.css +60 -0
- package/dist/embed/EmbedField.d.ts +29 -0
- package/dist/embed/EmbedField.d.ts.map +1 -0
- package/dist/embed/EmbedField.js +309 -0
- package/dist/embed/EmbedField.js.map +1 -0
- package/dist/embed/EmbedField.module.js +22 -0
- package/dist/embed/EmbedField.module.js.map +1 -0
- package/dist/embed/index.d.ts +3 -0
- package/dist/embed/index.d.ts.map +1 -0
- package/dist/embed/index.js +3 -0
- package/dist/file/FileField.css +54 -0
- package/dist/file/FileField.d.ts +50 -0
- package/dist/file/FileField.d.ts.map +1 -0
- package/dist/file/FileField.js +288 -0
- package/dist/file/FileField.js.map +1 -0
- package/dist/file/FileField.module.js +22 -0
- package/dist/file/FileField.module.js.map +1 -0
- package/dist/file/index.d.ts +3 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +1 -0
- package/dist/group/GroupField.css +20 -3
- package/dist/group/GroupField.d.ts +10 -4
- package/dist/group/GroupField.d.ts.map +1 -1
- package/dist/group/GroupField.js +71 -66
- 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/group/index.d.ts +1 -1
- package/dist/index.d.ts +21 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/json/JsonField.css +7 -0
- package/dist/json/JsonField.d.ts +22 -0
- package/dist/json/JsonField.d.ts.map +1 -0
- package/dist/json/JsonField.js +207 -0
- package/dist/json/JsonField.js.map +1 -0
- package/dist/json/JsonField.module.js +8 -0
- package/dist/json/JsonField.module.js.map +1 -0
- package/dist/json/index.d.ts +2 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +1 -0
- 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/locales/index.js.map +1 -1
- package/dist/localized/LocalizedField.css +27 -6
- package/dist/localized/LocalizedField.d.ts +19 -8
- package/dist/localized/LocalizedField.d.ts.map +1 -1
- package/dist/localized/LocalizedField.js +238 -105
- 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/localized/index.d.ts +1 -1
- package/dist/location/LocationField.css +54 -0
- package/dist/location/LocationField.d.ts +31 -0
- package/dist/location/LocationField.d.ts.map +1 -0
- package/dist/location/LocationField.js +487 -0
- package/dist/location/LocationField.js.map +1 -0
- package/dist/location/LocationField.module.js +22 -0
- package/dist/location/LocationField.module.js.map +1 -0
- package/dist/location/LocationMap.d.ts +25 -0
- package/dist/location/LocationMap.d.ts.map +1 -0
- package/dist/location/LocationMap.js +205 -0
- package/dist/location/LocationMap.js.map +1 -0
- package/dist/location/index.d.ts +5 -0
- package/dist/location/index.d.ts.map +1 -0
- package/dist/location/index.js +4 -0
- package/dist/location/leafletCss.d.ts +2 -0
- package/dist/location/leafletCss.d.ts.map +1 -0
- package/dist/location/leafletCss.js +6 -0
- package/dist/location/leafletCss.js.map +1 -0
- package/dist/location/nominatim.d.ts +23 -0
- package/dist/location/nominatim.d.ts.map +1 -0
- package/dist/location/nominatim.js +79 -0
- package/dist/location/nominatim.js.map +1 -0
- 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 +46 -0
- package/dist/location/types.d.ts.map +1 -0
- package/dist/missing/MissingField.d.ts +4 -3
- package/dist/missing/MissingField.d.ts.map +1 -1
- package/dist/missing/MissingField.js +3 -2
- package/dist/missing/MissingField.js.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/number/NumberField.d.ts +1 -1
- package/dist/number/NumberField.js.map +1 -1
- package/dist/number/index.d.ts +1 -1
- package/dist/range/RangeField.d.ts +22 -0
- package/dist/range/RangeField.d.ts.map +1 -0
- package/dist/range/RangeField.js +203 -0
- package/dist/range/RangeField.js.map +1 -0
- package/dist/range/index.d.ts +2 -0
- package/dist/range/index.d.ts.map +1 -0
- package/dist/range/index.js +1 -0
- package/dist/region/RegionField.d.ts +23 -0
- package/dist/region/RegionField.d.ts.map +1 -0
- package/dist/region/RegionField.js +174 -0
- package/dist/region/RegionField.js.map +1 -0
- 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/data.d.ts +5 -0
- package/dist/region/data.d.ts.map +1 -0
- package/dist/region/data.js +513 -0
- package/dist/region/data.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 +5 -0
- package/dist/region/index.d.ts.map +1 -0
- package/dist/region/index.js +5 -0
- package/dist/region/regions.d.ts +15 -0
- package/dist/region/regions.d.ts.map +1 -0
- package/dist/region/regions.js +29 -0
- package/dist/region/regions.js.map +1 -0
- package/dist/relation/RelationField.d.ts +2 -2
- package/dist/relation/RelationField.d.ts.map +1 -1
- package/dist/relation/RelationField.js +511 -171
- package/dist/relation/RelationField.js.map +1 -1
- package/dist/relation/index.d.ts +2 -2
- package/dist/repeater/RepeaterField.d.ts +13 -2
- package/dist/repeater/RepeaterField.d.ts.map +1 -1
- package/dist/repeater/RepeaterField.js +138 -50
- package/dist/repeater/RepeaterField.js.map +1 -1
- package/dist/repeater/index.d.ts +1 -1
- package/dist/select/SelectField.d.ts +1 -1
- package/dist/select/SelectField.js.map +1 -1
- package/dist/select/index.d.ts +1 -1
- package/dist/sessions/SessionsField.d.ts +15 -0
- package/dist/sessions/SessionsField.d.ts.map +1 -0
- package/dist/sessions/SessionsField.js +49 -0
- package/dist/sessions/SessionsField.js.map +1 -0
- package/dist/sessions/index.d.ts +4 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/sessions/index.js +1 -0
- package/dist/shared/CodeComboBox.d.ts +21 -0
- package/dist/shared/CodeComboBox.d.ts.map +1 -0
- package/dist/shared/CodeComboBox.js +238 -0
- package/dist/shared/CodeComboBox.js.map +1 -0
- package/dist/shared/DefinitionField.d.ts +9 -4
- package/dist/shared/DefinitionField.d.ts.map +1 -1
- package/dist/shared/DefinitionField.js +98 -78
- package/dist/shared/DefinitionField.js.map +1 -1
- package/dist/shared/builtIn.d.ts +7 -3
- package/dist/shared/builtIn.d.ts.map +1 -1
- package/dist/shared/builtIn.js +39 -7
- package/dist/shared/builtIn.js.map +1 -1
- package/dist/shared/check.d.ts +27 -0
- package/dist/shared/check.d.ts.map +1 -0
- package/dist/shared/check.js +18 -0
- package/dist/shared/check.js.map +1 -0
- package/dist/shared/context.d.ts +33 -5
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js +36 -20
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/cx.js.map +1 -1
- package/dist/shared/dates.js +2 -2
- package/dist/shared/dates.js.map +1 -1
- package/dist/shared/embed.d.ts +19 -0
- package/dist/shared/embed.d.ts.map +1 -0
- package/dist/shared/embed.js +14 -0
- package/dist/shared/embed.js.map +1 -0
- package/dist/shared/entry.d.ts +13 -4
- package/dist/shared/entry.d.ts.map +1 -1
- package/dist/shared/entry.js +24 -7
- 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 +38 -0
- package/dist/shared/flow.js.map +1 -0
- 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/shared/relation.js.map +1 -1
- 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 +12 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/slug/SlugField.css +18 -0
- package/dist/slug/SlugField.d.ts +33 -5
- package/dist/slug/SlugField.d.ts.map +1 -1
- package/dist/slug/SlugField.js +346 -126
- package/dist/slug/SlugField.js.map +1 -1
- package/dist/slug/SlugField.module.js +14 -0
- package/dist/slug/SlugField.module.js.map +1 -0
- package/dist/slug/index.d.ts +1 -1
- package/dist/slug/index.d.ts.map +1 -1
- package/dist/slug/index.js +1 -1
- package/dist/tags/TagsField.d.ts +17 -0
- package/dist/tags/TagsField.d.ts.map +1 -0
- package/dist/tags/TagsField.js +120 -0
- package/dist/tags/TagsField.js.map +1 -0
- package/dist/tags/index.d.ts +2 -0
- package/dist/tags/index.d.ts.map +1 -0
- package/dist/tags/index.js +1 -0
- package/dist/tel/TelField.css +25 -0
- package/dist/tel/TelField.d.ts +34 -0
- package/dist/tel/TelField.d.ts.map +1 -0
- package/dist/tel/TelField.js +390 -0
- package/dist/tel/TelField.js.map +1 -0
- package/dist/tel/TelField.module.js +12 -0
- package/dist/tel/TelField.module.js.map +1 -0
- package/dist/tel/index.d.ts +3 -0
- package/dist/tel/index.d.ts.map +1 -0
- package/dist/tel/index.js +3 -0
- package/dist/tel/phone.d.ts +59 -0
- package/dist/tel/phone.d.ts.map +1 -0
- package/dist/tel/phone.js +107 -0
- package/dist/tel/phone.js.map +1 -0
- package/dist/text/TextField.d.ts +12 -4
- package/dist/text/TextField.d.ts.map +1 -1
- package/dist/text/TextField.js +104 -60
- package/dist/text/TextField.js.map +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/textarea/TextAreaField.d.ts +1 -1
- package/dist/textarea/TextAreaField.js.map +1 -1
- package/dist/textarea/index.d.ts +1 -1
- package/dist/time/TimeField.d.ts +1 -1
- package/dist/time/TimeField.js +64 -10
- package/dist/time/TimeField.js.map +1 -1
- package/dist/time/index.d.ts +1 -1
- package/dist/upload/FilePicker.css +24 -0
- package/dist/upload/FilePicker.d.ts +14 -0
- package/dist/upload/FilePicker.d.ts.map +1 -0
- package/dist/upload/FilePicker.js +130 -0
- package/dist/upload/FilePicker.js.map +1 -0
- package/dist/upload/FilePicker.module.js +12 -0
- package/dist/upload/FilePicker.module.js.map +1 -0
- package/dist/upload/UploadList.css +93 -0
- package/dist/upload/UploadList.d.ts +18 -0
- package/dist/upload/UploadList.d.ts.map +1 -0
- package/dist/upload/UploadList.js +144 -0
- package/dist/upload/UploadList.js.map +1 -0
- package/dist/upload/UploadList.module.js +32 -0
- package/dist/upload/UploadList.module.js.map +1 -0
- package/dist/upload/files.d.ts +5 -0
- package/dist/upload/files.d.ts.map +1 -0
- package/dist/upload/files.js +26 -0
- package/dist/upload/files.js.map +1 -0
- package/dist/upload/types.d.ts +58 -0
- package/dist/upload/types.d.ts.map +1 -0
- package/dist/upload/useRejectionMessage.d.ts +4 -0
- package/dist/upload/useRejectionMessage.d.ts.map +1 -0
- package/dist/upload/useRejectionMessage.js +25 -0
- package/dist/upload/useRejectionMessage.js.map +1 -0
- package/dist/upload/useUploads.d.ts +30 -0
- package/dist/upload/useUploads.d.ts.map +1 -0
- package/dist/upload/useUploads.js +115 -0
- package/dist/upload/useUploads.js.map +1 -0
- package/dist/uppy/index.d.ts +3 -0
- package/dist/uppy/index.d.ts.map +1 -0
- package/dist/uppy/index.js +1 -0
- package/dist/uppy/uploader.d.ts +44 -0
- package/dist/uppy/uploader.d.ts.map +1 -0
- package/dist/uppy/uploader.js +139 -0
- package/dist/uppy/uploader.js.map +1 -0
- package/dist/url/UrlField.d.ts +2 -2
- package/dist/url/UrlField.d.ts.map +1 -1
- package/dist/url/UrlField.js +69 -14
- package/dist/url/UrlField.js.map +1 -1
- package/dist/url/index.d.ts +1 -1
- package/package.json +110 -7
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
//#region src/country/codes.ts
|
|
2
|
+
/**
|
|
3
|
+
* The ISO 3166-1 alpha-2 codes of the countries and territories, and `XK` (Kosovo), which is
|
|
4
|
+
* widely used for it though not assigned.
|
|
5
|
+
*/
|
|
6
|
+
var COUNTRY_CODES = [
|
|
7
|
+
"AD",
|
|
8
|
+
"AE",
|
|
9
|
+
"AF",
|
|
10
|
+
"AG",
|
|
11
|
+
"AI",
|
|
12
|
+
"AL",
|
|
13
|
+
"AM",
|
|
14
|
+
"AO",
|
|
15
|
+
"AQ",
|
|
16
|
+
"AR",
|
|
17
|
+
"AS",
|
|
18
|
+
"AT",
|
|
19
|
+
"AU",
|
|
20
|
+
"AW",
|
|
21
|
+
"AX",
|
|
22
|
+
"AZ",
|
|
23
|
+
"BA",
|
|
24
|
+
"BB",
|
|
25
|
+
"BD",
|
|
26
|
+
"BE",
|
|
27
|
+
"BF",
|
|
28
|
+
"BG",
|
|
29
|
+
"BH",
|
|
30
|
+
"BI",
|
|
31
|
+
"BJ",
|
|
32
|
+
"BL",
|
|
33
|
+
"BM",
|
|
34
|
+
"BN",
|
|
35
|
+
"BO",
|
|
36
|
+
"BQ",
|
|
37
|
+
"BR",
|
|
38
|
+
"BS",
|
|
39
|
+
"BT",
|
|
40
|
+
"BV",
|
|
41
|
+
"BW",
|
|
42
|
+
"BY",
|
|
43
|
+
"BZ",
|
|
44
|
+
"CA",
|
|
45
|
+
"CC",
|
|
46
|
+
"CD",
|
|
47
|
+
"CF",
|
|
48
|
+
"CG",
|
|
49
|
+
"CH",
|
|
50
|
+
"CI",
|
|
51
|
+
"CK",
|
|
52
|
+
"CL",
|
|
53
|
+
"CM",
|
|
54
|
+
"CN",
|
|
55
|
+
"CO",
|
|
56
|
+
"CR",
|
|
57
|
+
"CU",
|
|
58
|
+
"CV",
|
|
59
|
+
"CW",
|
|
60
|
+
"CX",
|
|
61
|
+
"CY",
|
|
62
|
+
"CZ",
|
|
63
|
+
"DE",
|
|
64
|
+
"DJ",
|
|
65
|
+
"DK",
|
|
66
|
+
"DM",
|
|
67
|
+
"DO",
|
|
68
|
+
"DZ",
|
|
69
|
+
"EC",
|
|
70
|
+
"EE",
|
|
71
|
+
"EG",
|
|
72
|
+
"EH",
|
|
73
|
+
"ER",
|
|
74
|
+
"ES",
|
|
75
|
+
"ET",
|
|
76
|
+
"FI",
|
|
77
|
+
"FJ",
|
|
78
|
+
"FK",
|
|
79
|
+
"FM",
|
|
80
|
+
"FO",
|
|
81
|
+
"FR",
|
|
82
|
+
"GA",
|
|
83
|
+
"GB",
|
|
84
|
+
"GD",
|
|
85
|
+
"GE",
|
|
86
|
+
"GF",
|
|
87
|
+
"GG",
|
|
88
|
+
"GH",
|
|
89
|
+
"GI",
|
|
90
|
+
"GL",
|
|
91
|
+
"GM",
|
|
92
|
+
"GN",
|
|
93
|
+
"GP",
|
|
94
|
+
"GQ",
|
|
95
|
+
"GR",
|
|
96
|
+
"GS",
|
|
97
|
+
"GT",
|
|
98
|
+
"GU",
|
|
99
|
+
"GW",
|
|
100
|
+
"GY",
|
|
101
|
+
"HK",
|
|
102
|
+
"HM",
|
|
103
|
+
"HN",
|
|
104
|
+
"HR",
|
|
105
|
+
"HT",
|
|
106
|
+
"HU",
|
|
107
|
+
"ID",
|
|
108
|
+
"IE",
|
|
109
|
+
"IL",
|
|
110
|
+
"IM",
|
|
111
|
+
"IN",
|
|
112
|
+
"IO",
|
|
113
|
+
"IQ",
|
|
114
|
+
"IR",
|
|
115
|
+
"IS",
|
|
116
|
+
"IT",
|
|
117
|
+
"JE",
|
|
118
|
+
"JM",
|
|
119
|
+
"JO",
|
|
120
|
+
"JP",
|
|
121
|
+
"KE",
|
|
122
|
+
"KG",
|
|
123
|
+
"KH",
|
|
124
|
+
"KI",
|
|
125
|
+
"KM",
|
|
126
|
+
"KN",
|
|
127
|
+
"KP",
|
|
128
|
+
"KR",
|
|
129
|
+
"KW",
|
|
130
|
+
"KY",
|
|
131
|
+
"KZ",
|
|
132
|
+
"LA",
|
|
133
|
+
"LB",
|
|
134
|
+
"LC",
|
|
135
|
+
"LI",
|
|
136
|
+
"LK",
|
|
137
|
+
"LR",
|
|
138
|
+
"LS",
|
|
139
|
+
"LT",
|
|
140
|
+
"LU",
|
|
141
|
+
"LV",
|
|
142
|
+
"LY",
|
|
143
|
+
"MA",
|
|
144
|
+
"MC",
|
|
145
|
+
"MD",
|
|
146
|
+
"ME",
|
|
147
|
+
"MF",
|
|
148
|
+
"MG",
|
|
149
|
+
"MH",
|
|
150
|
+
"MK",
|
|
151
|
+
"ML",
|
|
152
|
+
"MM",
|
|
153
|
+
"MN",
|
|
154
|
+
"MO",
|
|
155
|
+
"MP",
|
|
156
|
+
"MQ",
|
|
157
|
+
"MR",
|
|
158
|
+
"MS",
|
|
159
|
+
"MT",
|
|
160
|
+
"MU",
|
|
161
|
+
"MV",
|
|
162
|
+
"MW",
|
|
163
|
+
"MX",
|
|
164
|
+
"MY",
|
|
165
|
+
"MZ",
|
|
166
|
+
"NA",
|
|
167
|
+
"NC",
|
|
168
|
+
"NE",
|
|
169
|
+
"NF",
|
|
170
|
+
"NG",
|
|
171
|
+
"NI",
|
|
172
|
+
"NL",
|
|
173
|
+
"NO",
|
|
174
|
+
"NP",
|
|
175
|
+
"NR",
|
|
176
|
+
"NU",
|
|
177
|
+
"NZ",
|
|
178
|
+
"OM",
|
|
179
|
+
"PA",
|
|
180
|
+
"PE",
|
|
181
|
+
"PF",
|
|
182
|
+
"PG",
|
|
183
|
+
"PH",
|
|
184
|
+
"PK",
|
|
185
|
+
"PL",
|
|
186
|
+
"PM",
|
|
187
|
+
"PN",
|
|
188
|
+
"PR",
|
|
189
|
+
"PS",
|
|
190
|
+
"PT",
|
|
191
|
+
"PW",
|
|
192
|
+
"PY",
|
|
193
|
+
"QA",
|
|
194
|
+
"RE",
|
|
195
|
+
"RO",
|
|
196
|
+
"RS",
|
|
197
|
+
"RU",
|
|
198
|
+
"RW",
|
|
199
|
+
"SA",
|
|
200
|
+
"SB",
|
|
201
|
+
"SC",
|
|
202
|
+
"SD",
|
|
203
|
+
"SE",
|
|
204
|
+
"SG",
|
|
205
|
+
"SH",
|
|
206
|
+
"SI",
|
|
207
|
+
"SJ",
|
|
208
|
+
"SK",
|
|
209
|
+
"SL",
|
|
210
|
+
"SM",
|
|
211
|
+
"SN",
|
|
212
|
+
"SO",
|
|
213
|
+
"SR",
|
|
214
|
+
"SS",
|
|
215
|
+
"ST",
|
|
216
|
+
"SV",
|
|
217
|
+
"SX",
|
|
218
|
+
"SY",
|
|
219
|
+
"SZ",
|
|
220
|
+
"TC",
|
|
221
|
+
"TD",
|
|
222
|
+
"TF",
|
|
223
|
+
"TG",
|
|
224
|
+
"TH",
|
|
225
|
+
"TJ",
|
|
226
|
+
"TK",
|
|
227
|
+
"TL",
|
|
228
|
+
"TM",
|
|
229
|
+
"TN",
|
|
230
|
+
"TO",
|
|
231
|
+
"TR",
|
|
232
|
+
"TT",
|
|
233
|
+
"TV",
|
|
234
|
+
"TW",
|
|
235
|
+
"TZ",
|
|
236
|
+
"UA",
|
|
237
|
+
"UG",
|
|
238
|
+
"UM",
|
|
239
|
+
"US",
|
|
240
|
+
"UY",
|
|
241
|
+
"UZ",
|
|
242
|
+
"VA",
|
|
243
|
+
"VC",
|
|
244
|
+
"VE",
|
|
245
|
+
"VG",
|
|
246
|
+
"VI",
|
|
247
|
+
"VN",
|
|
248
|
+
"VU",
|
|
249
|
+
"WF",
|
|
250
|
+
"WS",
|
|
251
|
+
"XK",
|
|
252
|
+
"YE",
|
|
253
|
+
"YT",
|
|
254
|
+
"ZA",
|
|
255
|
+
"ZM",
|
|
256
|
+
"ZW"
|
|
257
|
+
];
|
|
258
|
+
//#endregion
|
|
259
|
+
export { COUNTRY_CODES };
|
|
260
|
+
|
|
261
|
+
//# sourceMappingURL=codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.js","names":["COUNTRY_CODES"],"sources":["../../src/country/codes.ts"],"sourcesContent":["/**\n * The ISO 3166-1 alpha-2 codes of the countries and territories, and `XK` (Kosovo), which is\n * widely used for it though not assigned.\n */\nexport const COUNTRY_CODES: readonly string[] = [\n 'AD',\n 'AE',\n 'AF',\n 'AG',\n 'AI',\n 'AL',\n 'AM',\n 'AO',\n 'AQ',\n 'AR',\n 'AS',\n 'AT',\n 'AU',\n 'AW',\n 'AX',\n 'AZ',\n 'BA',\n 'BB',\n 'BD',\n 'BE',\n 'BF',\n 'BG',\n 'BH',\n 'BI',\n 'BJ',\n 'BL',\n 'BM',\n 'BN',\n 'BO',\n 'BQ',\n 'BR',\n 'BS',\n 'BT',\n 'BV',\n 'BW',\n 'BY',\n 'BZ',\n 'CA',\n 'CC',\n 'CD',\n 'CF',\n 'CG',\n 'CH',\n 'CI',\n 'CK',\n 'CL',\n 'CM',\n 'CN',\n 'CO',\n 'CR',\n 'CU',\n 'CV',\n 'CW',\n 'CX',\n 'CY',\n 'CZ',\n 'DE',\n 'DJ',\n 'DK',\n 'DM',\n 'DO',\n 'DZ',\n 'EC',\n 'EE',\n 'EG',\n 'EH',\n 'ER',\n 'ES',\n 'ET',\n 'FI',\n 'FJ',\n 'FK',\n 'FM',\n 'FO',\n 'FR',\n 'GA',\n 'GB',\n 'GD',\n 'GE',\n 'GF',\n 'GG',\n 'GH',\n 'GI',\n 'GL',\n 'GM',\n 'GN',\n 'GP',\n 'GQ',\n 'GR',\n 'GS',\n 'GT',\n 'GU',\n 'GW',\n 'GY',\n 'HK',\n 'HM',\n 'HN',\n 'HR',\n 'HT',\n 'HU',\n 'ID',\n 'IE',\n 'IL',\n 'IM',\n 'IN',\n 'IO',\n 'IQ',\n 'IR',\n 'IS',\n 'IT',\n 'JE',\n 'JM',\n 'JO',\n 'JP',\n 'KE',\n 'KG',\n 'KH',\n 'KI',\n 'KM',\n 'KN',\n 'KP',\n 'KR',\n 'KW',\n 'KY',\n 'KZ',\n 'LA',\n 'LB',\n 'LC',\n 'LI',\n 'LK',\n 'LR',\n 'LS',\n 'LT',\n 'LU',\n 'LV',\n 'LY',\n 'MA',\n 'MC',\n 'MD',\n 'ME',\n 'MF',\n 'MG',\n 'MH',\n 'MK',\n 'ML',\n 'MM',\n 'MN',\n 'MO',\n 'MP',\n 'MQ',\n 'MR',\n 'MS',\n 'MT',\n 'MU',\n 'MV',\n 'MW',\n 'MX',\n 'MY',\n 'MZ',\n 'NA',\n 'NC',\n 'NE',\n 'NF',\n 'NG',\n 'NI',\n 'NL',\n 'NO',\n 'NP',\n 'NR',\n 'NU',\n 'NZ',\n 'OM',\n 'PA',\n 'PE',\n 'PF',\n 'PG',\n 'PH',\n 'PK',\n 'PL',\n 'PM',\n 'PN',\n 'PR',\n 'PS',\n 'PT',\n 'PW',\n 'PY',\n 'QA',\n 'RE',\n 'RO',\n 'RS',\n 'RU',\n 'RW',\n 'SA',\n 'SB',\n 'SC',\n 'SD',\n 'SE',\n 'SG',\n 'SH',\n 'SI',\n 'SJ',\n 'SK',\n 'SL',\n 'SM',\n 'SN',\n 'SO',\n 'SR',\n 'SS',\n 'ST',\n 'SV',\n 'SX',\n 'SY',\n 'SZ',\n 'TC',\n 'TD',\n 'TF',\n 'TG',\n 'TH',\n 'TJ',\n 'TK',\n 'TL',\n 'TM',\n 'TN',\n 'TO',\n 'TR',\n 'TT',\n 'TV',\n 'TW',\n 'TZ',\n 'UA',\n 'UG',\n 'UM',\n 'US',\n 'UY',\n 'UZ',\n 'VA',\n 'VC',\n 'VE',\n 'VG',\n 'VI',\n 'VN',\n 'VU',\n 'WF',\n 'WS',\n 'XK',\n 'YE',\n 'YT',\n 'ZA',\n 'ZM',\n 'ZW',\n];\n"],"mappings":";;;;;AAIA,IAAaA,gBAAmC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAI"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { COUNTRY_CODES } from './codes.js';
|
|
2
|
+
export { COUNTRY_CODES };
|
|
3
|
+
/** A country to choose: its code, its name in a locale, and its flag. */
|
|
4
|
+
export interface CountryChoice {
|
|
5
|
+
/** ISO 3166-1 alpha-2 code, in capitals: `CA`. */
|
|
6
|
+
code: string;
|
|
7
|
+
name: string;
|
|
8
|
+
flag: string;
|
|
9
|
+
}
|
|
10
|
+
/** Whether a value is a code of `COUNTRY_CODES`. */
|
|
11
|
+
export declare function isCountryCode(value: unknown): value is string;
|
|
12
|
+
/** The flag of a country, as an emoji: two regional indicator symbols. */
|
|
13
|
+
export declare function getCountryFlag(code: string): string;
|
|
14
|
+
/** The name of a country in a locale (`Canada`, `Allemagne`), or its code when unknown. */
|
|
15
|
+
export declare function getCountryName(code: string, locale: string): string;
|
|
16
|
+
export interface CountryChoicesOptions {
|
|
17
|
+
/** The codes to offer. All countries without it. */
|
|
18
|
+
countries?: readonly string[] | undefined;
|
|
19
|
+
/** Codes shown first, in their order, above the others. */
|
|
20
|
+
preferred?: readonly string[] | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The countries to choose from, with their names in the locale: the preferred ones first, in
|
|
24
|
+
* their order, then the others, sorted by name in the locale.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCountryChoices(locale: string, { countries, preferred }?: CountryChoicesOptions): {
|
|
27
|
+
preferred: CountryChoice[];
|
|
28
|
+
others: CountryChoice[];
|
|
29
|
+
};
|
|
30
|
+
/** The region of a locale (`fr-CA` gives `CA`), or `null`. */
|
|
31
|
+
export declare function getLocaleCountry(locale: string): string | null;
|
|
32
|
+
//# sourceMappingURL=countries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../src/country/countries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC1B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAID,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD;AAID,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAWnE;AAED,MAAM,WAAW,qBAAqB;IAClC,oDAAoD;IACpD,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,2DAA2D;IAC3D,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,MAAM,EACd,EAAE,SAAS,EAAE,SAAc,EAAE,GAAE,qBAA0B,GAC1D;IAAE,SAAS,EAAE,aAAa,EAAE,CAAC;IAAC,MAAM,EAAE,aAAa,EAAE,CAAA;CAAE,CAgBzD;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO9D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { COUNTRY_CODES } from "./codes.js";
|
|
2
|
+
//#region src/country/countries.ts
|
|
3
|
+
var CODE = /^[A-Z]{2}$/;
|
|
4
|
+
/** Whether a value is a code of `COUNTRY_CODES`. */
|
|
5
|
+
function isCountryCode(value) {
|
|
6
|
+
return typeof value === "string" && COUNTRY_CODES.includes(value);
|
|
7
|
+
}
|
|
8
|
+
/** The flag of a country, as an emoji: two regional indicator symbols. */
|
|
9
|
+
function getCountryFlag(code) {
|
|
10
|
+
if (!CODE.test(code)) return "";
|
|
11
|
+
return String.fromCodePoint(...[...code].map((letter) => 127397 + letter.charCodeAt(0)));
|
|
12
|
+
}
|
|
13
|
+
var displayNames = /* @__PURE__ */ new Map();
|
|
14
|
+
/** The name of a country in a locale (`Canada`, `Allemagne`), or its code when unknown. */
|
|
15
|
+
function getCountryName(code, locale) {
|
|
16
|
+
let names = displayNames.get(locale);
|
|
17
|
+
if (names === void 0) {
|
|
18
|
+
names = new Intl.DisplayNames([locale, "en"], {
|
|
19
|
+
type: "region",
|
|
20
|
+
fallback: "code"
|
|
21
|
+
});
|
|
22
|
+
displayNames.set(locale, names);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return names.of(code) ?? code;
|
|
26
|
+
} catch {
|
|
27
|
+
return code;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The countries to choose from, with their names in the locale: the preferred ones first, in
|
|
32
|
+
* their order, then the others, sorted by name in the locale.
|
|
33
|
+
*/
|
|
34
|
+
function getCountryChoices(locale, { countries, preferred = [] } = {}) {
|
|
35
|
+
const codes = (countries ?? COUNTRY_CODES).filter(isCountryCode);
|
|
36
|
+
const choice = (code) => ({
|
|
37
|
+
code,
|
|
38
|
+
name: getCountryName(code, locale),
|
|
39
|
+
flag: getCountryFlag(code)
|
|
40
|
+
});
|
|
41
|
+
const first = preferred.filter((code) => codes.includes(code));
|
|
42
|
+
const collator = new Intl.Collator(locale);
|
|
43
|
+
return {
|
|
44
|
+
preferred: first.map(choice),
|
|
45
|
+
others: codes.filter((code) => !first.includes(code)).map(choice).sort((a, b) => collator.compare(a.name, b.name))
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The region of a locale (`fr-CA` gives `CA`), or `null`. */
|
|
49
|
+
function getLocaleCountry(locale) {
|
|
50
|
+
try {
|
|
51
|
+
const region = new Intl.Locale(locale).maximize().region;
|
|
52
|
+
return region !== void 0 && isCountryCode(region) ? region : null;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { COUNTRY_CODES, getCountryChoices, getCountryFlag, getCountryName, getLocaleCountry, isCountryCode };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=countries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countries.js","names":["COUNTRY_CODES","CountryChoice","code","name","flag","CODE","isCountryCode","value","includes","getCountryFlag","test","String","fromCodePoint","map","letter","charCodeAt","displayNames","Map","Intl","DisplayNames","getCountryName","locale","names","get","undefined","type","fallback","set","of","CountryChoicesOptions","countries","preferred","getCountryChoices","others","codes","filter","choice","first","collator","Collator","sort","a","b","compare","getLocaleCountry","region","Locale","maximize"],"sources":["../../src/country/countries.ts"],"sourcesContent":["import { COUNTRY_CODES } from './codes';\n\nexport { COUNTRY_CODES };\n\n/** A country to choose: its code, its name in a locale, and its flag. */\nexport interface CountryChoice {\n /** ISO 3166-1 alpha-2 code, in capitals: `CA`. */\n code: string;\n name: string;\n flag: string;\n}\n\nconst CODE = /^[A-Z]{2}$/;\n\n/** Whether a value is a code of `COUNTRY_CODES`. */\nexport function isCountryCode(value: unknown): value is string {\n return typeof value === 'string' && COUNTRY_CODES.includes(value);\n}\n\n/** The flag of a country, as an emoji: two regional indicator symbols. */\nexport function getCountryFlag(code: string): string {\n if (!CODE.test(code)) {\n return '';\n }\n return String.fromCodePoint(...[...code].map((letter) => 0x1f1a5 + letter.charCodeAt(0)));\n}\n\nconst displayNames = new Map<string, Intl.DisplayNames>();\n\n/** The name of a country in a locale (`Canada`, `Allemagne`), or its code when unknown. */\nexport function getCountryName(code: string, locale: string): string {\n let names = displayNames.get(locale);\n if (names === undefined) {\n names = new Intl.DisplayNames([locale, 'en'], { type: 'region', fallback: 'code' });\n displayNames.set(locale, names);\n }\n try {\n return names.of(code) ?? code;\n } catch {\n return code;\n }\n}\n\nexport interface CountryChoicesOptions {\n /** The codes to offer. All countries without it. */\n countries?: readonly string[] | undefined;\n /** Codes shown first, in their order, above the others. */\n preferred?: readonly string[] | undefined;\n}\n\n/**\n * The countries to choose from, with their names in the locale: the preferred ones first, in\n * their order, then the others, sorted by name in the locale.\n */\nexport function getCountryChoices(\n locale: string,\n { countries, preferred = [] }: CountryChoicesOptions = {},\n): { preferred: CountryChoice[]; others: CountryChoice[] } {\n const codes = (countries ?? COUNTRY_CODES).filter(isCountryCode);\n const choice = (code: string): CountryChoice => ({\n code,\n name: getCountryName(code, locale),\n flag: getCountryFlag(code),\n });\n const first = preferred.filter((code) => codes.includes(code));\n const collator = new Intl.Collator(locale);\n return {\n preferred: first.map(choice),\n others: codes\n .filter((code) => !first.includes(code))\n .map(choice)\n .sort((a, b) => collator.compare(a.name, b.name)),\n };\n}\n\n/** The region of a locale (`fr-CA` gives `CA`), or `null`. */\nexport function getLocaleCountry(locale: string): string | null {\n try {\n const region = new Intl.Locale(locale).maximize().region;\n return region !== undefined && isCountryCode(region) ? region : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;AAYA,IAAMK,OAAO;;AAGb,SAAgBC,cAAcC,OAAiC;CAC3D,OAAO,OAAOA,UAAU,YAAYP,cAAcQ,SAASD,KAAK;AACpE;;AAGA,SAAgBE,eAAeP,MAAsB;CACjD,IAAI,CAACG,KAAKK,KAAKR,IAAI,GACf,OAAO;CAEX,OAAOS,OAAOC,cAAc,GAAG,CAAC,GAAGV,IAAI,CAAC,CAACW,KAAKC,WAAW,SAAUA,OAAOC,WAAW,CAAC,CAAC,CAAC;AAC5F;AAEA,IAAMC,+BAAe,IAAIC,IAA+B;;AAGxD,SAAgBG,eAAelB,MAAcmB,QAAwB;CACjE,IAAIC,QAAQN,aAAaO,IAAIF,MAAM;CACnC,IAAIC,UAAUE,KAAAA,GAAW;EACrBF,QAAQ,IAAIJ,KAAKC,aAAa,CAACE,QAAQ,IAAI,GAAG;GAAEI,MAAM;GAAUC,UAAU;EAAO,CAAC;EAClFV,aAAaW,IAAIN,QAAQC,KAAK;CAClC;CACA,IAAI;EACA,OAAOA,MAAMM,GAAG1B,IAAI,KAAKA;CAC7B,QAAQ;EACJ,OAAOA;CACX;AACJ;;;;;AAaA,SAAgB8B,kBACZX,QACA,EAAES,WAAWC,YAAY,CAAA,MAA8B,CAAC,GACD;CACvD,MAAMG,SAASJ,aAAa9B,cAAAA,CAAemC,OAAO7B,aAAa;CAC/D,MAAM8B,UAAUlC,UAAiC;EAC7CA;EACAC,MAAMiB,eAAelB,MAAMmB,MAAM;EACjCjB,MAAMK,eAAeP,IAAI;CAC7B;CACA,MAAMmC,QAAQN,UAAUI,QAAQjC,SAASgC,MAAM1B,SAASN,IAAI,CAAC;CAC7D,MAAMoC,WAAW,IAAIpB,KAAKqB,SAASlB,MAAM;CACzC,OAAO;EACHU,WAAWM,MAAMxB,IAAIuB,MAAM;EAC3BH,QAAQC,MACHC,QAAQjC,SAAS,CAACmC,MAAM7B,SAASN,IAAI,CAAC,CAAC,CACvCW,IAAIuB,MAAM,CAAC,CACXI,MAAMC,GAAGC,MAAMJ,SAASK,QAAQF,EAAEtC,MAAMuC,EAAEvC,IAAI,CAAC;CACxD;AACJ;;AAGA,SAAgByC,iBAAiBvB,QAA+B;CAC5D,IAAI;EACA,MAAMwB,SAAS,IAAI3B,KAAK4B,OAAOzB,MAAM,CAAC,CAAC0B,SAAS,CAAC,CAACF;EAClD,OAAOA,WAAWrB,KAAAA,KAAalB,cAAcuC,MAAM,IAAIA,SAAS;CACpE,QAAQ;EACJ,OAAO;CACX;AACJ"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CountryField, type CountryFieldBaseProps, CountryFieldEntry, type CountryFieldProps, type MultipleCountryFieldProps, type SingleCountryFieldProps, } from './CountryField.js';
|
|
2
|
+
export { COUNTRY_CODES, type CountryChoice, type CountryChoicesOptions, getCountryChoices, getCountryFlag, getCountryName, getLocaleCountry, isCountryCode, } from './countries.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/country/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,GAChB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { COUNTRY_CODES } from "./codes.js";
|
|
2
|
+
import { getCountryChoices, getCountryFlag, getCountryName, getLocaleCountry, isCountryCode } from "./countries.js";
|
|
3
|
+
import { CountryField, CountryFieldEntry } from "./CountryField.js";
|
|
4
|
+
export { COUNTRY_CODES, CountryField, CountryFieldEntry, getCountryChoices, getCountryFlag, getCountryName, getLocaleCountry, isCountryCode };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CompoundFieldEntry } from '../compound/compound.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `credits` type (decision 0065): a compound field whose items are a person (`person`, a
|
|
4
|
+
* relation) or a free name (`name`), their `roles`, and whether the credit is `featured`. The
|
|
5
|
+
* definition gives the sub-fields: those of a site come after these.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CreditsFieldEntry: CompoundFieldEntry;
|
|
8
|
+
/** The `credits` type, as a `@panneau/core` plugin. */
|
|
9
|
+
export declare const creditsPlugin: {
|
|
10
|
+
id: string;
|
|
11
|
+
fields: {
|
|
12
|
+
credits: CompoundFieldEntry;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=CreditsField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreditsField.d.ts","sourceRoot":"","sources":["../../src/credits/CreditsField.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAkC,MAAM,sBAAsB,CAAC;AAK/F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAmB9B,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,aAAa;;;;;CAGzB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineCompoundField, restParts } from "../compound/compound.js";
|
|
2
|
+
import Compound_module_default from "../compound/Compound.module.js";
|
|
3
|
+
import { formatCredit } from "./credits.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/credits/CreditsField.tsx
|
|
6
|
+
var PLACED = [
|
|
7
|
+
"person",
|
|
8
|
+
"name",
|
|
9
|
+
"roles",
|
|
10
|
+
"featured"
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* The `credits` type (decision 0065): a compound field whose items are a person (`person`, a
|
|
14
|
+
* relation) or a free name (`name`), their `roles`, and whether the credit is `featured`. The
|
|
15
|
+
* definition gives the sub-fields: those of a site come after these.
|
|
16
|
+
*/
|
|
17
|
+
var CreditsFieldEntry = defineCompoundField({
|
|
18
|
+
layout: ({ parts }) => /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: Compound_module_default.stack,
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: Compound_module_default.row,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: Compound_module_default.part,
|
|
26
|
+
children: parts.person
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: Compound_module_default.part,
|
|
30
|
+
children: parts.name
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: Compound_module_default.part,
|
|
34
|
+
children: parts.roles
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
parts.featured !== void 0 ? /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: Compound_module_default.part,
|
|
40
|
+
children: parts.featured
|
|
41
|
+
}) : null,
|
|
42
|
+
restParts(parts, PLACED).map((part, index) => /* @__PURE__ */ jsx("div", {
|
|
43
|
+
className: Compound_module_default.part,
|
|
44
|
+
children: part
|
|
45
|
+
}, index))
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
summarize: (credit, { locale }) => formatCredit(credit, locale)
|
|
49
|
+
});
|
|
50
|
+
/** The `credits` type, as a `@panneau/core` plugin. */
|
|
51
|
+
var creditsPlugin = {
|
|
52
|
+
id: "panneau.credits",
|
|
53
|
+
fields: { credits: CreditsFieldEntry }
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { CreditsFieldEntry, creditsPlugin };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=CreditsField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreditsField.js","names":["styles","CompoundFieldEntry","defineCompoundField","restParts","formatCredit","PLACED","CreditsFieldEntry","layout","parts","stack","row","part","person","name","roles","featured","undefined","map","index","summarize","credit","locale","creditsPlugin","id","fields","credits","styles"],"sources":["../../src/credits/CreditsField.tsx"],"sourcesContent":["import styles from '../compound/Compound.module.css';\nimport { type CompoundFieldEntry, defineCompoundField, restParts } from '../compound/compound';\nimport { formatCredit } from './credits';\n\nconst PLACED = ['person', 'name', 'roles', 'featured'];\n\n/**\n * The `credits` type (decision 0065): a compound field whose items are a person (`person`, a\n * relation) or a free name (`name`), their `roles`, and whether the credit is `featured`. The\n * definition gives the sub-fields: those of a site come after these.\n */\nexport const CreditsFieldEntry: CompoundFieldEntry = defineCompoundField({\n layout: ({ parts }) => (\n <div className={styles.stack}>\n <div className={styles.row}>\n <div className={styles.part}>{parts.person}</div>\n <div className={styles.part}>{parts.name}</div>\n <div className={styles.part}>{parts.roles}</div>\n </div>\n {parts.featured !== undefined ? (\n <div className={styles.part}>{parts.featured}</div>\n ) : null}\n {restParts(parts, PLACED).map((part, index) => (\n <div key={index} className={styles.part}>\n {part}\n </div>\n ))}\n </div>\n ),\n summarize: (credit, { locale }) => formatCredit(credit, locale),\n});\n\n/** The `credits` type, as a `@panneau/core` plugin. */\nexport const creditsPlugin = {\n id: 'panneau.credits',\n fields: { credits: CreditsFieldEntry },\n};\n"],"mappings":";;;;;AAIA,IAAMK,SAAS;CAAC;CAAU;CAAQ;CAAS;AAAU;;;;;;AAOrD,IAAaC,oBAAwCJ,oBAAoB;CACrEK,SAAS,EAAEC,YACP,qBAAC,OAAD;EAAK,WAAWR,wBAAOS;EAAvB,UAAA;GACI,qBAAC,OAAD;IAAK,WAAWT,wBAAOU;IAAvB,UAAA;KACI,oBAAC,OAAD;MAAK,WAAWV,wBAAOW;MAAOH,UAAAA,MAAMI;KAAY,CAAA;KAChD,oBAAC,OAAD;MAAK,WAAWZ,wBAAOW;MAAOH,UAAAA,MAAMK;KAAU,CAAA;KAC9C,oBAAC,OAAD;MAAK,WAAWb,wBAAOW;MAAOH,UAAAA,MAAMM;KAAW,CAAA;IAC9C;;GACJN,MAAMO,aAAaC,KAAAA,IAChB,oBAAC,OAAD;IAAK,WAAWhB,wBAAOW;IAAOH,UAAAA,MAAMO;GAAc,CAAA,IAClD;GACHZ,UAAUK,OAAOH,MAAM,CAAC,CAACY,KAAKN,MAAMO,UACjC,oBAAC,OAAD;IAAiB,WAAWlB,wBAAOW;IAC9BA,UAAAA;GACA,GAFKO,KAEL,CACR;EACA;;CAETC,YAAYC,QAAQ,EAAEC,aAAajB,aAAagB,QAAQC,MAAM;AAClE,CAAC;;AAGD,IAAaC,gBAAgB;CACzBC,IAAI;CACJC,QAAQ,EAAEC,SAASnB,kBAAkB;AACzC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A credit, as the sub-fields of a `credits` field give it. */
|
|
2
|
+
export interface Credit {
|
|
3
|
+
/** A reference to a person, `{ id, label }`, or `null`. */
|
|
4
|
+
person?: unknown;
|
|
5
|
+
/** The name of a person who isn't in the database. */
|
|
6
|
+
name?: unknown;
|
|
7
|
+
/** References to roles, or a role as text, localized or not. */
|
|
8
|
+
roles?: unknown;
|
|
9
|
+
/** Whether the credit is featured, `true` or left out. */
|
|
10
|
+
featured?: unknown;
|
|
11
|
+
}
|
|
12
|
+
/** The name of the credited person: the label of the person, or the free name. */
|
|
13
|
+
export declare function getCreditName(credit: Credit, locale: string): string | null;
|
|
14
|
+
/** The roles of a credit: the labels of its references, or its text in the locale. */
|
|
15
|
+
export declare function getCreditRoles(credit: Credit, locale: string): string[];
|
|
16
|
+
/** A credit as text: `Ada Lovelace (Director, Writer)`, or `null` without a name nor a role. */
|
|
17
|
+
export declare function formatCredit(credit: Credit, locale: string): string | null;
|
|
18
|
+
//# sourceMappingURL=credits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../../src/credits/credits.ts"],"names":[],"mappings":"AAGA,gEAAgE;AAChE,MAAM,WAAW,MAAM;IACnB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAeD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3E;AAED,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAOvE;AAED,gGAAgG;AAChG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO1E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { toReferences } from "../shared/relation.js";
|
|
2
|
+
//#region src/credits/credits.ts
|
|
3
|
+
function localizedText(value, locale) {
|
|
4
|
+
if (typeof value === "string") return value.trim() !== "" ? value.trim() : null;
|
|
5
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
6
|
+
const texts = value;
|
|
7
|
+
const text = texts[locale] ?? Object.values(texts).find((entry) => typeof entry === "string");
|
|
8
|
+
return typeof text === "string" && text.trim() !== "" ? text.trim() : null;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
/** The name of the credited person: the label of the person, or the free name. */
|
|
13
|
+
function getCreditName(credit, locale) {
|
|
14
|
+
return toReferences(credit.person)[0]?.label ?? localizedText(credit.name, locale);
|
|
15
|
+
}
|
|
16
|
+
/** The roles of a credit: the labels of its references, or its text in the locale. */
|
|
17
|
+
function getCreditRoles(credit, locale) {
|
|
18
|
+
const { roles } = credit;
|
|
19
|
+
if (Array.isArray(roles) || roles !== null && typeof roles === "object" && "id" in roles) return toReferences(roles).map((reference) => reference.label);
|
|
20
|
+
const text = localizedText(roles, locale);
|
|
21
|
+
return text !== null ? [text] : [];
|
|
22
|
+
}
|
|
23
|
+
/** A credit as text: `Ada Lovelace (Director, Writer)`, or `null` without a name nor a role. */
|
|
24
|
+
function formatCredit(credit, locale) {
|
|
25
|
+
const name = getCreditName(credit, locale);
|
|
26
|
+
const roles = getCreditRoles(credit, locale);
|
|
27
|
+
if (name === null) return roles.length > 0 ? roles.join(", ") : null;
|
|
28
|
+
return roles.length > 0 ? `${name} (${roles.join(", ")})` : name;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { formatCredit, getCreditName, getCreditRoles };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=credits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.js","names":["toReferences","Credit","person","name","roles","featured","localizedText","value","locale","trim","Array","isArray","texts","Record","text","Object","values","find","entry","getCreditName","credit","label","getCreditRoles","map","reference","formatCredit","length","join"],"sources":["../../src/credits/credits.ts"],"sourcesContent":["// The `credits` compound field (decision 0065): people, or free names, and their roles.\nimport { toReferences } from '../shared/relation';\n\n/** A credit, as the sub-fields of a `credits` field give it. */\nexport interface Credit {\n /** A reference to a person, `{ id, label }`, or `null`. */\n person?: unknown;\n /** The name of a person who isn't in the database. */\n name?: unknown;\n /** References to roles, or a role as text, localized or not. */\n roles?: unknown;\n /** Whether the credit is featured, `true` or left out. */\n featured?: unknown;\n}\n\nfunction localizedText(value: unknown, locale: string): string | null {\n if (typeof value === 'string') {\n return value.trim() !== '' ? value.trim() : null;\n }\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n const texts = value as Record<string, unknown>;\n const text =\n texts[locale] ?? Object.values(texts).find((entry) => typeof entry === 'string');\n return typeof text === 'string' && text.trim() !== '' ? text.trim() : null;\n }\n return null;\n}\n\n/** The name of the credited person: the label of the person, or the free name. */\nexport function getCreditName(credit: Credit, locale: string): string | null {\n return toReferences(credit.person)[0]?.label ?? localizedText(credit.name, locale);\n}\n\n/** The roles of a credit: the labels of its references, or its text in the locale. */\nexport function getCreditRoles(credit: Credit, locale: string): string[] {\n const { roles } = credit;\n if (Array.isArray(roles) || (roles !== null && typeof roles === 'object' && 'id' in roles)) {\n return toReferences(roles).map((reference) => reference.label);\n }\n const text = localizedText(roles, locale);\n return text !== null ? [text] : [];\n}\n\n/** A credit as text: `Ada Lovelace (Director, Writer)`, or `null` without a name nor a role. */\nexport function formatCredit(credit: Credit, locale: string): string | null {\n const name = getCreditName(credit, locale);\n const roles = getCreditRoles(credit, locale);\n if (name === null) {\n return roles.length > 0 ? roles.join(', ') : null;\n }\n return roles.length > 0 ? `${name} (${roles.join(', ')})` : name;\n}\n"],"mappings":";;AAeA,SAASM,cAAcC,OAAgBC,QAA+B;CAClE,IAAI,OAAOD,UAAU,UACjB,OAAOA,MAAME,KAAK,MAAM,KAAKF,MAAME,KAAK,IAAI;CAEhD,IAAIF,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACG,MAAMC,QAAQJ,KAAK,GAAG;EACtE,MAAMK,QAAQL;EACd,MAAMO,OACFF,MAAMJ,WAAWO,OAAOC,OAAOJ,KAAK,CAAC,CAACK,MAAMC,UAAU,OAAOA,UAAU,QAAQ;EACnF,OAAO,OAAOJ,SAAS,YAAYA,KAAKL,KAAK,MAAM,KAAKK,KAAKL,KAAK,IAAI;CAC1E;CACA,OAAO;AACX;;AAGA,SAAgBU,cAAcC,QAAgBZ,QAA+B;CACzE,OAAOR,aAAaoB,OAAOlB,MAAM,CAAC,CAAC,EAAE,EAAEmB,SAASf,cAAcc,OAAOjB,MAAMK,MAAM;AACrF;;AAGA,SAAgBc,eAAeF,QAAgBZ,QAA0B;CACrE,MAAM,EAAEJ,UAAUgB;CAClB,IAAIV,MAAMC,QAAQP,KAAK,KAAMA,UAAU,QAAQ,OAAOA,UAAU,YAAY,QAAQA,OAChF,OAAOJ,aAAaI,KAAK,CAAC,CAACmB,KAAKC,cAAcA,UAAUH,KAAK;CAEjE,MAAMP,OAAOR,cAAcF,OAAOI,MAAM;CACxC,OAAOM,SAAS,OAAO,CAACA,IAAI,IAAI,CAAA;AACpC;;AAGA,SAAgBW,aAAaL,QAAgBZ,QAA+B;CACxE,MAAML,OAAOgB,cAAcC,QAAQZ,MAAM;CACzC,MAAMJ,QAAQkB,eAAeF,QAAQZ,MAAM;CAC3C,IAAIL,SAAS,MACT,OAAOC,MAAMsB,SAAS,IAAItB,MAAMuB,KAAK,IAAI,IAAI;CAEjD,OAAOvB,MAAMsB,SAAS,IAAI,GAAGvB,KAAI,IAAKC,MAAMuB,KAAK,IAAI,EAAC,KAAMxB;AAChE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CreditsFieldEntry, creditsPlugin } from './CreditsField.js';
|
|
2
|
+
export { type Credit, formatCredit, getCreditName, getCreditRoles } from './credits.js';
|
|
3
|
+
export type { CompoundFieldEntry, CompoundSummary, CompoundSummaryContext, } from '../compound/compound.js';
|
|
4
|
+
export type { FieldEntry, FieldEntryProps } from '../shared/types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACrF,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/date/DateField.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateField.js","names":["disabled","readOnly","required","_c"],"sources":["../../src/date/DateField.tsx"],"sourcesContent":["import { DatePicker } from '@panneau/ui';\n\nimport { toCalendarDate } from '../shared/dates';\nimport { getFieldProps, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface DateFieldProps extends FieldProps<string> {\n /** Earliest date (`2026-01-01`). */\n min?: string;\n /** Latest date. */\n max?: string;\n controlClassName?: string;\n}\n\n/**\n * A date as an ISO string (`2026-10-15`), typed in the order of the locale or picked in a\n * calendar.\n */\nexport function DateField({\n value,\n onChange,\n min,\n max,\n disabled,\n readOnly,\n required,\n ...props\n}: DateFieldProps) {\n const minValue = toCalendarDate(min);\n const maxValue = toCalendarDate(max);\n return (\n <DatePicker\n {...props}\n granularity=\"day\"\n value={toCalendarDate(value)}\n onChange={(date) => onChange?.(date === null ? null : date.toString().slice(0, 10))}\n {...(minValue !== null ? { minValue } : {})}\n {...(maxValue !== null ? { maxValue } : {})}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/** The `date` type. */\nexport function DateFieldEntry(props: FieldEntryProps) {\n return (\n <DateField\n {...getFieldProps(props)}\n value={isString(props.value) ? props.value : null}\n onChange={props.onChange}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"DateField.js","names":["DatePicker","toCalendarDate","getFieldProps","isString","FieldEntryProps","FieldProps","DateFieldProps","min","max","controlClassName","DateField","t0","$","_c","disabled","onChange","props","readOnly","required","value","t1","minValue","t2","maxValue","t3","t4","date","toString","slice","t5","t6","t7","DateFieldEntry","_c"],"sources":["../../src/date/DateField.tsx"],"sourcesContent":["import { DatePicker } from '@panneau/ui';\n\nimport { toCalendarDate } from '../shared/dates';\nimport { getFieldProps, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface DateFieldProps extends FieldProps<string> {\n /** Earliest date (`2026-01-01`). */\n min?: string;\n /** Latest date. */\n max?: string;\n controlClassName?: string;\n}\n\n/**\n * A date as an ISO string (`2026-10-15`), typed in the order of the locale or picked in a\n * calendar.\n */\nexport function DateField({\n value,\n onChange,\n min,\n max,\n disabled,\n readOnly,\n required,\n ...props\n}: DateFieldProps) {\n const minValue = toCalendarDate(min);\n const maxValue = toCalendarDate(max);\n return (\n <DatePicker\n {...props}\n granularity=\"day\"\n value={toCalendarDate(value)}\n onChange={(date) => onChange?.(date === null ? null : date.toString().slice(0, 10))}\n {...(minValue !== null ? { minValue } : {})}\n {...(maxValue !== null ? { maxValue } : {})}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/** The `date` type. */\nexport function DateFieldEntry(props: FieldEntryProps) {\n return (\n <DateField\n {...getFieldProps(props)}\n value={isString(props.value) ? props.value : null}\n onChange={props.onChange}\n />\n );\n}\n"],"mappings":"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"}
|
package/dist/date/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DateField, DateFieldEntry, type DateFieldProps } from './DateField';
|
|
1
|
+
export { DateField, DateFieldEntry, type DateFieldProps } from './DateField.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|