@panneau/fields 5.0.0-alpha.1 → 5.0.0-alpha.10
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 +101 -20
- 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 +5 -5
- package/dist/color/ColorField.d.ts +2 -2
- package/dist/color/ColorField.js.map +1 -1
- package/dist/color/ColorField.module.js +3 -3
- package/dist/color/index.d.ts +1 -1
- 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/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 +26 -0
- package/dist/duration/DurationField.d.ts.map +1 -0
- package/dist/duration/DurationField.js +214 -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 +20 -0
- package/dist/embed/EmbedField.d.ts.map +1 -0
- package/dist/embed/EmbedField.js +246 -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 +2 -2
- package/dist/group/GroupField.d.ts +1 -1
- package/dist/group/GroupField.js.map +1 -1
- package/dist/group/GroupField.module.js +1 -1
- package/dist/group/index.d.ts +1 -1
- package/dist/index.d.ts +18 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -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/locales/index.js.map +1 -1
- package/dist/localized/LocalizedField.css +2 -2
- package/dist/localized/LocalizedField.d.ts +1 -1
- package/dist/localized/LocalizedField.d.ts.map +1 -1
- package/dist/localized/LocalizedField.js +1 -0
- package/dist/localized/LocalizedField.js.map +1 -1
- package/dist/localized/LocalizedField.module.js +2 -2
- 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 +563 -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 +17 -0
- package/dist/location/nominatim.d.ts.map +1 -0
- package/dist/location/nominatim.js +50 -0
- package/dist/location/nominatim.js.map +1 -0
- package/dist/location/types.d.ts +40 -0
- package/dist/location/types.d.ts.map +1 -0
- package/dist/missing/MissingField.css +4 -3
- 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/missing/MissingField.module.js +3 -3
- package/dist/missing/MissingField.module.js.map +1 -1
- 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/relation/RelationField.css +7 -7
- package/dist/relation/RelationField.d.ts +2 -2
- package/dist/relation/RelationField.d.ts.map +1 -1
- package/dist/relation/RelationField.js +509 -169
- package/dist/relation/RelationField.js.map +1 -1
- package/dist/relation/RelationField.module.js +6 -6
- package/dist/relation/index.d.ts +2 -2
- package/dist/repeater/RepeaterField.css +12 -11
- package/dist/repeater/RepeaterField.d.ts +1 -1
- package/dist/repeater/RepeaterField.js +118 -34
- package/dist/repeater/RepeaterField.js.map +1 -1
- package/dist/repeater/RepeaterField.module.js +9 -9
- package/dist/repeater/RepeaterField.module.js.map +1 -1
- package/dist/repeater/index.d.ts +1 -1
- package/dist/select/SelectField.css +1 -1
- package/dist/select/SelectField.d.ts +1 -1
- package/dist/select/SelectField.js.map +1 -1
- package/dist/select/SelectField.module.js +1 -1
- package/dist/select/index.d.ts +1 -1
- package/dist/shared/DefinitionField.d.ts +4 -2
- package/dist/shared/DefinitionField.d.ts.map +1 -1
- package/dist/shared/DefinitionField.js +80 -72
- package/dist/shared/DefinitionField.js.map +1 -1
- package/dist/shared/builtIn.d.ts +5 -3
- package/dist/shared/builtIn.d.ts.map +1 -1
- package/dist/shared/builtIn.js +21 -3
- 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 +28 -5
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js +35 -19
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/cx.js.map +1 -1
- 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 +11 -2
- package/dist/shared/entry.d.ts.map +1 -1
- package/dist/shared/entry.js +19 -3
- package/dist/shared/entry.js.map +1 -1
- package/dist/shared/relation.js.map +1 -1
- package/dist/shared/types.d.ts +2 -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.d.ts +11 -0
- package/dist/tel/TelField.d.ts.map +1 -0
- package/dist/tel/TelField.js +87 -0
- package/dist/tel/TelField.js.map +1 -0
- package/dist/tel/index.d.ts +2 -0
- package/dist/tel/index.d.ts.map +1 -0
- package/dist/tel/index.js +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.css +2 -2
- package/dist/url/UrlField.d.ts +2 -2
- package/dist/url/UrlField.js +69 -14
- package/dist/url/UrlField.js.map +1 -1
- package/dist/url/UrlField.module.js +1 -1
- package/dist/url/index.d.ts +1 -1
- package/package.json +69 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeField.js","names":["_c"],"sources":["../../src/datetime/DateTimeField.tsx"],"sourcesContent":["import { getLocalTimeZone, now } from '@internationalized/date';\n\nimport { DatePicker } from '@panneau/ui';\n\nimport { fromDateTime, toDateTime } from '../shared/dates';\nimport { getFieldProps, getSetting, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface DateTimeFieldProps extends FieldProps<string> {\n /**\n * Time zone the date and time are shown and typed in, for values with an offset. Defaults to\n * the browser's.\n */\n timeZone?: string;\n /** Shows seconds. */\n withSeconds?: boolean;\n /** Defaults to the locale's. */\n hourCycle?: 12 | 24;\n controlClassName?: string;\n}\n\n/**\n * A date and a time as an ISO string. Values with an offset (`2026-10-15T13:30:00Z`) are shown in\n * the time zone of the browser and written back in UTC. Values without one\n * (`2026-10-15T09:30:00`) are kept without one.\n */\nexport function DateTimeField({\n value,\n onChange,\n timeZone = getLocalTimeZone(),\n withSeconds = false,\n disabled,\n readOnly,\n required,\n ...props\n}: DateTimeFieldProps) {\n const current = toDateTime(value, timeZone);\n return (\n <DatePicker\n {...props}\n granularity={withSeconds ? 'second' : 'minute'}\n hideTimeZone\n value={current}\n onChange={(next) => {\n if (next === null) {\n onChange?.(null);\n return;\n }\n if ('hour' in next) {\n onChange?.(fromDateTime(next));\n }\n }}\n // Typed from empty, a value is in the field's time zone, and written in UTC.\n placeholderValue={current ?? now(timeZone).set({ second: 0, millisecond: 0 })}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/** The `datetime` type: setting `timeZone`. */\nexport function DateTimeFieldEntry(props: FieldEntryProps) {\n const timeZone = getSetting(props.field, 'timeZone', isString);\n return (\n <DateTimeField\n {...getFieldProps(props)}\n value={isString(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(timeZone !== undefined ? { timeZone } : {})}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,
|
|
1
|
+
{"version":3,"file":"DateTimeField.js","names":["getLocalTimeZone","now","DatePicker","fromDateTime","toDateTime","getFieldProps","getSetting","isString","FieldEntryProps","FieldProps","DateTimeFieldProps","timeZone","withSeconds","hourCycle","controlClassName","DateTimeField","t0","$","_c","disabled","onChange","props","readOnly","required","t1","t2","value","T0","t3","t4","t5","t6","t7","t8","undefined","current","next","set","second","millisecond","t9","DateTimeFieldEntry","field","_c"],"sources":["../../src/datetime/DateTimeField.tsx"],"sourcesContent":["import { getLocalTimeZone, now } from '@internationalized/date';\n\nimport { DatePicker } from '@panneau/ui';\n\nimport { fromDateTime, toDateTime } from '../shared/dates';\nimport { getFieldProps, getSetting, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface DateTimeFieldProps extends FieldProps<string> {\n /**\n * Time zone the date and time are shown and typed in, for values with an offset. Defaults to\n * the browser's.\n */\n timeZone?: string;\n /** Shows seconds. */\n withSeconds?: boolean;\n /** Defaults to the locale's. */\n hourCycle?: 12 | 24;\n controlClassName?: string;\n}\n\n/**\n * A date and a time as an ISO string. Values with an offset (`2026-10-15T13:30:00Z`) are shown in\n * the time zone of the browser and written back in UTC. Values without one\n * (`2026-10-15T09:30:00`) are kept without one.\n */\nexport function DateTimeField({\n value,\n onChange,\n timeZone = getLocalTimeZone(),\n withSeconds = false,\n disabled,\n readOnly,\n required,\n ...props\n}: DateTimeFieldProps) {\n const current = toDateTime(value, timeZone);\n return (\n <DatePicker\n {...props}\n granularity={withSeconds ? 'second' : 'minute'}\n hideTimeZone\n value={current}\n onChange={(next) => {\n if (next === null) {\n onChange?.(null);\n return;\n }\n if ('hour' in next) {\n onChange?.(fromDateTime(next));\n }\n }}\n // Typed from empty, a value is in the field's time zone, and written in UTC.\n placeholderValue={current ?? now(timeZone).set({ second: 0, millisecond: 0 })}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/** The `datetime` type: setting `timeZone`. */\nexport function DateTimeFieldEntry(props: FieldEntryProps) {\n const timeZone = getSetting(props.field, 'timeZone', isString);\n return (\n <DateTimeField\n {...getFieldProps(props)}\n value={isString(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(timeZone !== undefined ? { timeZone } : {})}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAOe,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAT,EAAA,OAAAD,IAAA;EAAuB,CAAA,CAAAU,OAAAN,UAAAT,UAAAa,IAAAZ,aAAAa,IAAAN,UAAAG,UAAAC,UAAA,GAAAF,SAAAL;EASTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAA;EAAAP,WAAAF,EAAA;EAAAG,WAAAH,EAAA;EAAAI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AAjBL,MAAKK,QAA7B;CAA0C,IAAAE;CAAA,IAAAX,EAAA,OAAAN,UAAA;EAE5CiB,KAAAjB,aAAauB,KAAAA,IAAb,EAAAvB,SAAyC,IAAzC,CAAyC;EAACM,EAAA,KAAAN;EAAAM,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAI,MAAAD,YAAAH,EAAA,OAAAO,MAAAP,EAAA,OAAAQ,MAAAR,EAAA,OAAAW,IAAA;EAJnDC,KAAA,oBAAC,eAAD;GAAc,GACNL;GACG,OAAAC;GACG,UAAAJ,MAAKD;GAAS,GACnBQ;EAA0C,CAAA;EACjDX,EAAA,KAAAI,MAAAD;EAAAH,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAW;EAAAX,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OALFY;AAKE"}
|
package/dist/datetime/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DateTimeField, DateTimeFieldEntry, type DateTimeFieldProps } from './DateTimeField';
|
|
1
|
+
export { DateTimeField, DateTimeFieldEntry, type DateTimeFieldProps } from './DateTimeField.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FieldEntryProps, FieldProps } from '../shared/types.js';
|
|
2
|
+
export interface DurationFieldProps extends FieldProps<number> {
|
|
3
|
+
/** `seconds` (the default) shows hours, minutes and seconds; `minutes` hides the seconds. */
|
|
4
|
+
precision?: 'seconds' | 'minutes';
|
|
5
|
+
}
|
|
6
|
+
/** Hours, minutes and seconds of a number of seconds. */
|
|
7
|
+
export declare function splitDuration(seconds: number): {
|
|
8
|
+
hours: number;
|
|
9
|
+
minutes: number;
|
|
10
|
+
seconds: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A duration with its units, without the empty ones: `1 h 5 min 30 s`, `3 min`. With a precision
|
|
14
|
+
* of minutes, the seconds are rounded away.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatDuration(seconds: number, { precision }?: {
|
|
17
|
+
precision?: 'seconds' | 'minutes';
|
|
18
|
+
}): string;
|
|
19
|
+
/**
|
|
20
|
+
* A duration, in seconds, typed in hours, minutes and seconds. It is `null` while every part is
|
|
21
|
+
* empty.
|
|
22
|
+
*/
|
|
23
|
+
export declare function DurationField({ value, onChange, onBlur, precision, label, description, errors, disabled, readOnly, required, name, className, }: DurationFieldProps): import("react").JSX.Element;
|
|
24
|
+
/** The `duration` type: a number of seconds, with setting `precision` (`seconds` or `minutes`). */
|
|
25
|
+
export declare function DurationFieldEntry(props: FieldEntryProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=DurationField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationField.d.ts","sourceRoot":"","sources":["../../src/duration/DurationField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGnE,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC1D,6FAA6F;IAC7F,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACrC;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB,CAOA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC1B,OAAO,EAAE,MAAM,EACf,EAAE,SAAqB,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAAO,GACtE,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAqB,EACrB,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,SAAS,GACZ,EAAE,kBAAkB,+BAyCpB;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,+BAWxD"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { getFieldProps, getSetting, isNumber, isString } from "../shared/entry.js";
|
|
2
|
+
import { messages } from "../shared/messages.js";
|
|
3
|
+
import DurationField_module_default from "./DurationField.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { Fieldset, NumberInput, usePanneauIntl } from "@panneau/ui";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/duration/DurationField.tsx
|
|
8
|
+
/** Hours, minutes and seconds of a number of seconds. */
|
|
9
|
+
function splitDuration(seconds) {
|
|
10
|
+
const total = Math.max(0, Math.round(seconds));
|
|
11
|
+
return {
|
|
12
|
+
hours: Math.floor(total / 3600),
|
|
13
|
+
minutes: Math.floor(total % 3600 / 60),
|
|
14
|
+
seconds: total % 60
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A duration with its units, without the empty ones: `1 h 5 min 30 s`, `3 min`. With a precision
|
|
19
|
+
* of minutes, the seconds are rounded away.
|
|
20
|
+
*/
|
|
21
|
+
function formatDuration(seconds, { precision = "seconds" } = {}) {
|
|
22
|
+
const parts = splitDuration(precision === "minutes" ? Math.round(seconds / 60) * 60 : seconds);
|
|
23
|
+
const shown = [
|
|
24
|
+
parts.hours > 0 ? `${parts.hours} h` : null,
|
|
25
|
+
parts.minutes > 0 ? `${parts.minutes} min` : null,
|
|
26
|
+
precision === "seconds" && parts.seconds > 0 ? `${parts.seconds} s` : null
|
|
27
|
+
].filter((part) => part !== null);
|
|
28
|
+
return shown.length > 0 ? shown.join(" ") : precision === "minutes" ? "0 min" : "0 s";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A duration, in seconds, typed in hours, minutes and seconds. It is `null` while every part is
|
|
32
|
+
* empty.
|
|
33
|
+
*/
|
|
34
|
+
function DurationField(t0) {
|
|
35
|
+
const $ = c(38);
|
|
36
|
+
const { value, onChange, onBlur, precision: t1, label, description, errors, disabled, readOnly, required, name, className } = t0;
|
|
37
|
+
const precision = t1 === void 0 ? "seconds" : t1;
|
|
38
|
+
const intl = usePanneauIntl();
|
|
39
|
+
let T0;
|
|
40
|
+
let t10;
|
|
41
|
+
let t11;
|
|
42
|
+
let t2;
|
|
43
|
+
let t3;
|
|
44
|
+
let t4;
|
|
45
|
+
let t5;
|
|
46
|
+
let t6;
|
|
47
|
+
let t7;
|
|
48
|
+
let t8;
|
|
49
|
+
let t9;
|
|
50
|
+
if ($[0] !== className || $[1] !== description || $[2] !== disabled || $[3] !== errors || $[4] !== intl || $[5] !== label || $[6] !== name || $[7] !== onBlur || $[8] !== onChange || $[9] !== precision || $[10] !== readOnly || $[11] !== required || $[12] !== value) {
|
|
51
|
+
const parts = value !== null && value !== void 0 ? splitDuration(value) : null;
|
|
52
|
+
const change = (part, next) => {
|
|
53
|
+
const updated = {
|
|
54
|
+
...parts ?? {
|
|
55
|
+
hours: 0,
|
|
56
|
+
minutes: 0,
|
|
57
|
+
seconds: 0
|
|
58
|
+
},
|
|
59
|
+
[part]: next ?? 0
|
|
60
|
+
};
|
|
61
|
+
const total = updated.hours * 3600 + updated.minutes * 60 + updated.seconds;
|
|
62
|
+
onChange?.(total === 0 && next === null ? null : total);
|
|
63
|
+
};
|
|
64
|
+
const input = (part_0) => /* @__PURE__ */ jsx(NumberInput, {
|
|
65
|
+
"aria-label": intl.formatMessage(messages[part_0]),
|
|
66
|
+
value: parts?.[part_0] ?? null,
|
|
67
|
+
onChange: (next_0) => change(part_0, next_0),
|
|
68
|
+
onBlur: () => onBlur?.(),
|
|
69
|
+
minValue: 0,
|
|
70
|
+
...part_0 !== "hours" ? { maxValue: 59 } : {},
|
|
71
|
+
formatOptions: { maximumFractionDigits: 0 },
|
|
72
|
+
suffix: intl.formatMessage(messages[`${part_0}Unit`]),
|
|
73
|
+
isDisabled: disabled,
|
|
74
|
+
isReadOnly: readOnly,
|
|
75
|
+
...name !== void 0 ? { name: `${name}[${part_0}]` } : {},
|
|
76
|
+
className: DurationField_module_default.part
|
|
77
|
+
});
|
|
78
|
+
T0 = Fieldset;
|
|
79
|
+
t6 = label;
|
|
80
|
+
t7 = description;
|
|
81
|
+
t8 = errors;
|
|
82
|
+
t9 = required;
|
|
83
|
+
t10 = disabled;
|
|
84
|
+
t11 = className;
|
|
85
|
+
t2 = DurationField_module_default.parts;
|
|
86
|
+
t3 = input("hours");
|
|
87
|
+
t4 = input("minutes");
|
|
88
|
+
t5 = precision === "seconds" ? input("seconds") : null;
|
|
89
|
+
$[0] = className;
|
|
90
|
+
$[1] = description;
|
|
91
|
+
$[2] = disabled;
|
|
92
|
+
$[3] = errors;
|
|
93
|
+
$[4] = intl;
|
|
94
|
+
$[5] = label;
|
|
95
|
+
$[6] = name;
|
|
96
|
+
$[7] = onBlur;
|
|
97
|
+
$[8] = onChange;
|
|
98
|
+
$[9] = precision;
|
|
99
|
+
$[10] = readOnly;
|
|
100
|
+
$[11] = required;
|
|
101
|
+
$[12] = value;
|
|
102
|
+
$[13] = T0;
|
|
103
|
+
$[14] = t10;
|
|
104
|
+
$[15] = t11;
|
|
105
|
+
$[16] = t2;
|
|
106
|
+
$[17] = t3;
|
|
107
|
+
$[18] = t4;
|
|
108
|
+
$[19] = t5;
|
|
109
|
+
$[20] = t6;
|
|
110
|
+
$[21] = t7;
|
|
111
|
+
$[22] = t8;
|
|
112
|
+
$[23] = t9;
|
|
113
|
+
} else {
|
|
114
|
+
T0 = $[13];
|
|
115
|
+
t10 = $[14];
|
|
116
|
+
t11 = $[15];
|
|
117
|
+
t2 = $[16];
|
|
118
|
+
t3 = $[17];
|
|
119
|
+
t4 = $[18];
|
|
120
|
+
t5 = $[19];
|
|
121
|
+
t6 = $[20];
|
|
122
|
+
t7 = $[21];
|
|
123
|
+
t8 = $[22];
|
|
124
|
+
t9 = $[23];
|
|
125
|
+
}
|
|
126
|
+
let t12;
|
|
127
|
+
if ($[24] !== t2 || $[25] !== t3 || $[26] !== t4 || $[27] !== t5) {
|
|
128
|
+
t12 = /* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: t2,
|
|
130
|
+
children: [
|
|
131
|
+
t3,
|
|
132
|
+
t4,
|
|
133
|
+
t5
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
$[24] = t2;
|
|
137
|
+
$[25] = t3;
|
|
138
|
+
$[26] = t4;
|
|
139
|
+
$[27] = t5;
|
|
140
|
+
$[28] = t12;
|
|
141
|
+
} else t12 = $[28];
|
|
142
|
+
let t13;
|
|
143
|
+
if ($[29] !== T0 || $[30] !== t10 || $[31] !== t11 || $[32] !== t12 || $[33] !== t6 || $[34] !== t7 || $[35] !== t8 || $[36] !== t9) {
|
|
144
|
+
t13 = /* @__PURE__ */ jsx(T0, {
|
|
145
|
+
legend: t6,
|
|
146
|
+
description: t7,
|
|
147
|
+
errors: t8,
|
|
148
|
+
isRequired: t9,
|
|
149
|
+
isDisabled: t10,
|
|
150
|
+
className: t11,
|
|
151
|
+
children: t12
|
|
152
|
+
});
|
|
153
|
+
$[29] = T0;
|
|
154
|
+
$[30] = t10;
|
|
155
|
+
$[31] = t11;
|
|
156
|
+
$[32] = t12;
|
|
157
|
+
$[33] = t6;
|
|
158
|
+
$[34] = t7;
|
|
159
|
+
$[35] = t8;
|
|
160
|
+
$[36] = t9;
|
|
161
|
+
$[37] = t13;
|
|
162
|
+
} else t13 = $[37];
|
|
163
|
+
return t13;
|
|
164
|
+
}
|
|
165
|
+
/** The `duration` type: a number of seconds, with setting `precision` (`seconds` or `minutes`). */
|
|
166
|
+
function DurationFieldEntry(props) {
|
|
167
|
+
const $ = c(13);
|
|
168
|
+
let t0;
|
|
169
|
+
if ($[0] !== props.field) {
|
|
170
|
+
t0 = getSetting(props.field, "precision", isString);
|
|
171
|
+
$[0] = props.field;
|
|
172
|
+
$[1] = t0;
|
|
173
|
+
} else t0 = $[1];
|
|
174
|
+
const precision = t0;
|
|
175
|
+
let t1;
|
|
176
|
+
if ($[2] !== props) {
|
|
177
|
+
t1 = getFieldProps(props);
|
|
178
|
+
$[2] = props;
|
|
179
|
+
$[3] = t1;
|
|
180
|
+
} else t1 = $[3];
|
|
181
|
+
let fieldProps;
|
|
182
|
+
if ($[4] !== t1) {
|
|
183
|
+
const { placeholder: _placeholder, ...t2 } = t1;
|
|
184
|
+
fieldProps = t2;
|
|
185
|
+
$[4] = t1;
|
|
186
|
+
$[5] = fieldProps;
|
|
187
|
+
} else fieldProps = $[5];
|
|
188
|
+
const t2 = isNumber(props.value) ? props.value : null;
|
|
189
|
+
let t3;
|
|
190
|
+
if ($[6] !== precision) {
|
|
191
|
+
t3 = precision === "minutes" || precision === "seconds" ? { precision } : {};
|
|
192
|
+
$[6] = precision;
|
|
193
|
+
$[7] = t3;
|
|
194
|
+
} else t3 = $[7];
|
|
195
|
+
let t4;
|
|
196
|
+
if ($[8] !== fieldProps || $[9] !== props.onChange || $[10] !== t2 || $[11] !== t3) {
|
|
197
|
+
t4 = /* @__PURE__ */ jsx(DurationField, {
|
|
198
|
+
...fieldProps,
|
|
199
|
+
value: t2,
|
|
200
|
+
onChange: props.onChange,
|
|
201
|
+
...t3
|
|
202
|
+
});
|
|
203
|
+
$[8] = fieldProps;
|
|
204
|
+
$[9] = props.onChange;
|
|
205
|
+
$[10] = t2;
|
|
206
|
+
$[11] = t3;
|
|
207
|
+
$[12] = t4;
|
|
208
|
+
} else t4 = $[12];
|
|
209
|
+
return t4;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { DurationField, DurationFieldEntry, formatDuration, splitDuration };
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=DurationField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationField.js","names":["Fieldset","NumberInput","usePanneauIntl","getFieldProps","getSetting","isNumber","isString","messages","FieldEntryProps","FieldProps","styles","DurationFieldProps","precision","splitDuration","seconds","hours","minutes","total","Math","max","round","floor","formatDuration","parts","shown","filter","part","length","join","DurationField","t0","$","_c","value","onChange","onBlur","t1","label","description","errors","disabled","readOnly","required","name","className","undefined","intl","T0","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","change","next","updated","input","part_0","formatMessage","next_0","maxValue","maximumFractionDigits","t12","t13","DurationFieldEntry","props","field","fieldProps","placeholder","_placeholder","_c","styles"],"sources":["../../src/duration/DurationField.tsx"],"sourcesContent":["import { Fieldset, NumberInput, usePanneauIntl } from '@panneau/ui';\n\nimport { getFieldProps, getSetting, isNumber, isString } from '../shared/entry';\nimport { messages } from '../shared/messages';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\nimport styles from './DurationField.module.css';\n\nexport interface DurationFieldProps extends FieldProps<number> {\n /** `seconds` (the default) shows hours, minutes and seconds; `minutes` hides the seconds. */\n precision?: 'seconds' | 'minutes';\n}\n\n/** Hours, minutes and seconds of a number of seconds. */\nexport function splitDuration(seconds: number): {\n hours: number;\n minutes: number;\n seconds: number;\n} {\n const total = Math.max(0, Math.round(seconds));\n return {\n hours: Math.floor(total / 3600),\n minutes: Math.floor((total % 3600) / 60),\n seconds: total % 60,\n };\n}\n\n/**\n * A duration with its units, without the empty ones: `1 h 5 min 30 s`, `3 min`. With a precision\n * of minutes, the seconds are rounded away.\n */\nexport function formatDuration(\n seconds: number,\n { precision = 'seconds' }: { precision?: 'seconds' | 'minutes' } = {},\n): string {\n const parts = splitDuration(precision === 'minutes' ? Math.round(seconds / 60) * 60 : seconds);\n const shown = [\n parts.hours > 0 ? `${parts.hours} h` : null,\n parts.minutes > 0 ? `${parts.minutes} min` : null,\n precision === 'seconds' && parts.seconds > 0 ? `${parts.seconds} s` : null,\n ].filter((part) => part !== null);\n return shown.length > 0 ? shown.join(' ') : precision === 'minutes' ? '0 min' : '0 s';\n}\n\n/**\n * A duration, in seconds, typed in hours, minutes and seconds. It is `null` while every part is\n * empty.\n */\nexport function DurationField({\n value,\n onChange,\n onBlur,\n precision = 'seconds',\n label,\n description,\n errors,\n disabled,\n readOnly,\n required,\n name,\n className,\n}: DurationFieldProps) {\n const intl = usePanneauIntl();\n const parts = value !== null && value !== undefined ? splitDuration(value) : null;\n const change = (part: 'hours' | 'minutes' | 'seconds', next: number | null) => {\n const updated = { ...(parts ?? { hours: 0, minutes: 0, seconds: 0 }), [part]: next ?? 0 };\n const total = updated.hours * 3600 + updated.minutes * 60 + updated.seconds;\n // Clearing the last part that had a value empties the field\n onChange?.(total === 0 && next === null ? null : total);\n };\n const input = (part: 'hours' | 'minutes' | 'seconds') => (\n <NumberInput\n aria-label={intl.formatMessage(messages[part])}\n value={parts?.[part] ?? null}\n onChange={(next) => change(part, next)}\n onBlur={() => onBlur?.()}\n minValue={0}\n {...(part !== 'hours' ? { maxValue: 59 } : {})}\n formatOptions={{ maximumFractionDigits: 0 }}\n suffix={intl.formatMessage(messages[`${part}Unit`])}\n isDisabled={disabled}\n isReadOnly={readOnly}\n {...(name !== undefined ? { name: `${name}[${part}]` } : {})}\n className={styles.part}\n />\n );\n return (\n <Fieldset\n legend={label}\n description={description}\n errors={errors}\n isRequired={required}\n isDisabled={disabled}\n className={className}\n >\n <div className={styles.parts}>\n {input('hours')}\n {input('minutes')}\n {precision === 'seconds' ? input('seconds') : null}\n </div>\n </Fieldset>\n );\n}\n\n/** The `duration` type: a number of seconds, with setting `precision` (`seconds` or `minutes`). */\nexport function DurationFieldEntry(props: FieldEntryProps) {\n const precision = getSetting(props.field, 'precision', isString);\n const { placeholder: _placeholder, ...fieldProps } = getFieldProps(props);\n return (\n <DurationField\n {...fieldProps}\n value={isNumber(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(precision === 'minutes' || precision === 'seconds' ? { precision } : {})}\n />\n );\n}\n"],"mappings":";;;;;;;;AAaA,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WAAA;EAE5CuC,KAAAvC,cAAc,aAAaA,cAAc,YAAzC,EAAAA,UAAsE,IAAtE,CAAsE;EAACmB,EAAA,KAAAnB;EAAAmB,EAAA,KAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,IAAAqB;CAAA,IAAArB,EAAA,OAAAyC,cAAAzC,EAAA,OAAAuC,MAAApC,YAAAH,EAAA,QAAAmB,MAAAnB,EAAA,QAAAoB,IAAA;EAJhFC,KAAA,oBAAC,eAAD;GAAc,GACNoB;GACG,OAAAtB;GACG,UAAAoB,MAAKpC;GAAS,GACnBiB;EAAuE,CAAA;EAC9EpB,EAAA,KAAAyC;EAAAzC,EAAA,KAAAuC,MAAApC;EAAAH,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;EAAApB,EAAA,MAAAqB;CAAA,OAAAA,KAAArB,EAAA;CAAA,OALFqB;AAKE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./DurationField.css";
|
|
2
|
+
//#region src/duration/DurationField.module.css
|
|
3
|
+
var parts = "panneau-duration-field-parts";
|
|
4
|
+
var part = "panneau-duration-field-part";
|
|
5
|
+
var DurationField_module_default = {
|
|
6
|
+
parts,
|
|
7
|
+
part
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DurationField_module_default as default, part, parts };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=DurationField.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationField.module.js","names":[],"sources":["../../src/duration/DurationField.module.css"],"sourcesContent":["/* Hours, minutes and seconds side by side. */\n.parts {\n display: flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-2);\n}\n\n.part {\n flex: 0 1 7rem;\n min-width: 5rem;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/duration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,cAAc,EACd,aAAa,GAChB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DurationField, DurationFieldEntry, formatDuration, splitDuration } from "./DurationField.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldEntryProps } from '../shared/types';
|
|
2
|
-
import { type TextFieldProps } from '../text/TextField';
|
|
1
|
+
import type { FieldEntryProps } from '../shared/types.js';
|
|
2
|
+
import { type TextFieldProps } from '../text/TextField.js';
|
|
3
3
|
export type EmailFieldProps = Omit<TextFieldProps, 'type' | 'inputMode'>;
|
|
4
4
|
/** An email address, with the email keyboard on phones. Spaces around it are removed on blur. */
|
|
5
5
|
export declare function EmailField({ value, onChange, onBlur, ...props }: EmailFieldProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailField.js","names":["
|
|
1
|
+
{"version":3,"file":"EmailField.js","names":["getFieldProps","isString","FieldEntryProps","TextField","TextFieldProps","EmailFieldProps","Omit","EmailField","t0","$","_c","onBlur","onChange","props","value","t1","trimmed","trim","t2","EmailFieldEntry","_c"],"sources":["../../src/email/EmailField.tsx"],"sourcesContent":["import { getFieldProps, isString } from '../shared/entry';\nimport type { FieldEntryProps } from '../shared/types';\nimport { TextField, type TextFieldProps } from '../text/TextField';\n\nexport type EmailFieldProps = Omit<TextFieldProps, 'type' | 'inputMode'>;\n\n/** An email address, with the email keyboard on phones. Spaces around it are removed on blur. */\nexport function EmailField({ value, onChange, onBlur, ...props }: EmailFieldProps) {\n return (\n <TextField\n autoComplete=\"off\"\n {...props}\n type=\"email\"\n inputMode=\"email\"\n value={value}\n onChange={onChange}\n onBlur={() => {\n const trimmed = value?.trim() ?? null;\n if (trimmed !== value) {\n onChange?.(trimmed === '' ? null : trimmed);\n }\n onBlur?.();\n }}\n />\n );\n}\n\n/** The `email` type. */\nexport function EmailFieldEntry(props: FieldEntryProps) {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AAAJ,IAAAC,EAAA,CAAA;CAAA,IAAAF;CAAA,IAAAC,EAAA,OAAAI,OAAA;EAGSL,KAAAR,cAAca,KAAK;EAACJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CACjB,MAAAM,KAAAd,SAASY,MAAKC,KAA2B,IAAjBD,MAAKC,QAA7B;CAA0C,IAAAI;CAAA,IAAAT,EAAA,OAAAI,MAAAD,YAAAH,EAAA,OAAAD,MAAAC,EAAA,OAAAM,IAAA;EAFrDG,KAAA,oBAAC,YAAD;GAAW,GACHV;GACG,OAAAO;GACG,UAAAF,MAAKD;EAAS,CAAA;EAC1BH,EAAA,KAAAI,MAAAD;EAAAH,EAAA,KAAAD;EAAAC,EAAA,KAAAM;EAAAN,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAJFS;AAIE"}
|
package/dist/email/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { EmailField, EmailFieldEntry, type EmailFieldProps } from './EmailField';
|
|
1
|
+
export { EmailField, EmailFieldEntry, type EmailFieldProps } from './EmailField.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* The URL, then the preview of what it embeds. */
|
|
2
|
+
.panneau-embed-field-embed {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--panneau-space-2);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.panneau-embed-field-status {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--panneau-space-2);
|
|
12
|
+
font-size: var(--panneau-font-size-sm);
|
|
13
|
+
color: var(--panneau-color-text-muted);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.panneau-embed-field-preview {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: var(--panneau-space-3);
|
|
20
|
+
padding: var(--panneau-space-2);
|
|
21
|
+
color: var(--panneau-color-text);
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
background-color: var(--panneau-color-surface-sunken);
|
|
24
|
+
border: var(--panneau-border-width) solid var(--panneau-color-border);
|
|
25
|
+
border-radius: var(--panneau-radius-md);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.panneau-embed-field-preview:hover {
|
|
29
|
+
border-color: var(--panneau-color-border-control);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.panneau-embed-field-preview:focus-visible {
|
|
33
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
34
|
+
outline-offset: 1px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.panneau-embed-field-thumbnail {
|
|
38
|
+
flex: none;
|
|
39
|
+
width: 7rem;
|
|
40
|
+
aspect-ratio: 16 / 9;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
border-radius: var(--panneau-radius-sm);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.panneau-embed-field-text {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 0.125rem;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.panneau-embed-field-title {
|
|
53
|
+
font-weight: var(--panneau-font-weight-medium);
|
|
54
|
+
overflow-wrap: anywhere;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.panneau-embed-field-provider {
|
|
58
|
+
font-size: var(--panneau-font-size-sm);
|
|
59
|
+
color: var(--panneau-color-text-muted);
|
|
60
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EmbedValue } from '@panneau/protocol';
|
|
2
|
+
import type { EmbedSource } from '../shared/embed.js';
|
|
3
|
+
import type { FieldEntryProps, FieldProps } from '../shared/types.js';
|
|
4
|
+
export type { EmbedValue };
|
|
5
|
+
export interface EmbedFieldProps extends FieldProps<EmbedValue> {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
/** Where the preview comes from. Defaults to that of the `FieldsProvider`. */
|
|
8
|
+
embedSource?: EmbedSource | null;
|
|
9
|
+
}
|
|
10
|
+
/** Whether a value is an embed: an object with a `url`. */
|
|
11
|
+
export declare function isEmbed(value: unknown): value is EmbedValue;
|
|
12
|
+
/**
|
|
13
|
+
* A URL of a video, a sound or a post, with the preview the backend gets from its provider's
|
|
14
|
+
* oEmbed: its thumbnail, title and provider. The URL is kept as soon as it is typed, and its
|
|
15
|
+
* preview follows. Without an embed source, the value is the URL alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare function EmbedField({ value, onChange, onBlur, embedSource: embedSourceProp, errors, disabled, readOnly, required, ...props }: EmbedFieldProps): import("react").JSX.Element;
|
|
18
|
+
/** The `embed` type: its preview comes from the embed source of the `FieldsProvider`. */
|
|
19
|
+
export declare function EmbedFieldEntry(props: FieldEntryProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=EmbedField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedField.d.ts","sourceRoot":"","sources":["../../src/embed/EmbedField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGnE,YAAY,EAAE,UAAU,EAAE,CAAC;AAI3B,MAAM,WAAW,eAAgB,SAAQ,UAAU,CAAC,UAAU,CAAC;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACpC;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAM3D;AAOD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,WAAW,EAAE,eAAe,EAC5B,MAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,eAAe,+BA6EjB;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,+BAQrD"}
|