payload-intl 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/input/MessageInput.d.ts.map +1 -1
- package/dist/components/input/MessageInput.js +0 -1
- package/dist/components/input/MessageInput.js.map +1 -1
- package/dist/components/input/ReferencePopover.d.ts.map +1 -1
- package/dist/components/input/ReferencePopover.js +1 -10
- package/dist/components/input/ReferencePopover.js.map +1 -1
- package/dist/components/input/variables/editors/SelectVariableEditor.d.ts.map +1 -1
- package/dist/components/input/variables/editors/SelectVariableEditor.js +0 -1
- package/dist/components/input/variables/editors/SelectVariableEditor.js.map +1 -1
- package/dist/components/input/variables/editors/TagVariableEditor.d.ts.map +1 -1
- package/dist/components/input/variables/editors/TagVariableEditor.js +0 -1
- package/dist/components/input/variables/editors/TagVariableEditor.js.map +1 -1
- package/dist/components/input/variables/pickers/NumericVariableEditor.d.ts.map +1 -1
- package/dist/components/input/variables/pickers/NumericVariableEditor.js +0 -1
- package/dist/components/input/variables/pickers/NumericVariableEditor.js.map +1 -1
- package/dist/components/input/variables/pickers/TemporalVariablePicker.d.ts.map +1 -1
- package/dist/components/input/variables/pickers/TemporalVariablePicker.js +0 -1
- package/dist/components/input/variables/pickers/TemporalVariablePicker.js.map +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/sanitize.d.ts.map +1 -1
- package/dist/utils/sanitize.js.map +1 -1
- package/package.json +12 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/input/MessageInput.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA2BhD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/input/MessageInput.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA2BhD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,iBAAiB,2CA0EnB"}
|
|
@@ -56,7 +56,6 @@ export function MessageInput({ value, variables, onChange, onBlur, multiline, er
|
|
|
56
56
|
}, [
|
|
57
57
|
variables
|
|
58
58
|
]);
|
|
59
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: LexicalComposer only reads initialConfig on mount
|
|
60
59
|
const initialConfig = useMemo(()=>({
|
|
61
60
|
namespace: 'ICUMessageEditor',
|
|
62
61
|
nodes: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/input/MessageInput.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorState } from '@payloadcms/richtext-lexical/lexical';\nimport { $getRoot } from '@payloadcms/richtext-lexical/lexical';\nimport { LexicalComposer } from '@payloadcms/richtext-lexical/lexical/react/LexicalComposer';\nimport { useLexicalComposerContext } from '@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext';\nimport { ContentEditable } from '@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable';\nimport { LexicalErrorBoundary } from '@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary';\nimport { HistoryPlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin';\nimport { OnChangePlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin';\nimport { PlainTextPlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalPlainTextPlugin';\nimport {\n BeautifulMentionNode,\n BeautifulMentionsPlugin,\n} from 'lexical-beautiful-mentions';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport { formatVariableLabel } from '@/components/input/utils';\nimport {\n isTagElement,\n parseIcuToLexicalState,\n serializeICUMessage,\n} from '@/icu';\nimport type { TemplateVariable } from '@/types';\n\nimport styles from './MessageInput.module.css';\nimport { SingleLinePlugin } from './SingleLinePlugin';\nimport { VariableMentionNode } from './variables/VariableNode';\nimport { MentionMenu, MentionMenuItem } from './variables/VariableSuggestion';\n\nfunction SyncValuePlugin({ value }: { value: string }) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n const currentText = editor\n .getEditorState()\n .read(() => $getRoot().getTextContent());\n if (value !== currentText) {\n queueMicrotask(() => {\n const newState = editor.parseEditorState(\n JSON.stringify(parseIcuToLexicalState(value)),\n );\n editor.setEditorState(newState);\n });\n }\n }, [value, editor]);\n\n return null;\n}\n\nexport interface MessageInputProps {\n value: string;\n variables: TemplateVariable[];\n onChange: (value: string) => void;\n onBlur: () => void;\n readOnly?: boolean;\n multiline?: boolean;\n error?: boolean;\n}\n\nexport function MessageInput({\n value,\n variables,\n onChange,\n onBlur,\n multiline,\n error,\n}: MessageInputProps) {\n const handleChange = useCallback(\n (editorState: EditorState) => {\n editorState.read(() => {\n onChange($getRoot().getTextContent());\n });\n },\n [onChange],\n );\n\n const mentionItems = useMemo(() => {\n const toItem = (v: TemplateVariable) => ({\n value: v.value,\n label: formatVariableLabel(v),\n icu: serializeICUMessage([v]),\n });\n\n return {\n '@': variables.map(toItem),\n '{': variables.filter((v) => !isTagElement(v)).map(toItem),\n '<': variables.filter((v) => isTagElement(v)).map(toItem),\n };\n }, [variables]);\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/input/MessageInput.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorState } from '@payloadcms/richtext-lexical/lexical';\nimport { $getRoot } from '@payloadcms/richtext-lexical/lexical';\nimport { LexicalComposer } from '@payloadcms/richtext-lexical/lexical/react/LexicalComposer';\nimport { useLexicalComposerContext } from '@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext';\nimport { ContentEditable } from '@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable';\nimport { LexicalErrorBoundary } from '@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary';\nimport { HistoryPlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin';\nimport { OnChangePlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin';\nimport { PlainTextPlugin } from '@payloadcms/richtext-lexical/lexical/react/LexicalPlainTextPlugin';\nimport {\n BeautifulMentionNode,\n BeautifulMentionsPlugin,\n} from 'lexical-beautiful-mentions';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport { formatVariableLabel } from '@/components/input/utils';\nimport {\n isTagElement,\n parseIcuToLexicalState,\n serializeICUMessage,\n} from '@/icu';\nimport type { TemplateVariable } from '@/types';\n\nimport styles from './MessageInput.module.css';\nimport { SingleLinePlugin } from './SingleLinePlugin';\nimport { VariableMentionNode } from './variables/VariableNode';\nimport { MentionMenu, MentionMenuItem } from './variables/VariableSuggestion';\n\nfunction SyncValuePlugin({ value }: { value: string }) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n const currentText = editor\n .getEditorState()\n .read(() => $getRoot().getTextContent());\n if (value !== currentText) {\n queueMicrotask(() => {\n const newState = editor.parseEditorState(\n JSON.stringify(parseIcuToLexicalState(value)),\n );\n editor.setEditorState(newState);\n });\n }\n }, [value, editor]);\n\n return null;\n}\n\nexport interface MessageInputProps {\n value: string;\n variables: TemplateVariable[];\n onChange: (value: string) => void;\n onBlur: () => void;\n readOnly?: boolean;\n multiline?: boolean;\n error?: boolean;\n}\n\nexport function MessageInput({\n value,\n variables,\n onChange,\n onBlur,\n multiline,\n error,\n}: MessageInputProps) {\n const handleChange = useCallback(\n (editorState: EditorState) => {\n editorState.read(() => {\n onChange($getRoot().getTextContent());\n });\n },\n [onChange],\n );\n\n const mentionItems = useMemo(() => {\n const toItem = (v: TemplateVariable) => ({\n value: v.value,\n label: formatVariableLabel(v),\n icu: serializeICUMessage([v]),\n });\n\n return {\n '@': variables.map(toItem),\n '{': variables.filter((v) => !isTagElement(v)).map(toItem),\n '<': variables.filter((v) => isTagElement(v)).map(toItem),\n };\n }, [variables]);\n\n const initialConfig = useMemo(\n () => ({\n namespace: 'ICUMessageEditor',\n nodes: [\n VariableMentionNode,\n {\n replace: BeautifulMentionNode,\n with: (node: BeautifulMentionNode) =>\n new VariableMentionNode(\n node.getTrigger(),\n node.getValue(),\n node.getData(),\n ),\n withKlass: VariableMentionNode,\n },\n ],\n editorState: JSON.stringify(parseIcuToLexicalState(value)),\n editable: true,\n onError: console.error,\n }),\n [],\n );\n\n return (\n <LexicalComposer initialConfig={initialConfig}>\n <div className={styles.editor} data-multiline={multiline}>\n <PlainTextPlugin\n contentEditable={\n <ContentEditable\n className={styles.contentEditable}\n data-error={error}\n onBlur={onBlur}\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n {multiline && <SingleLinePlugin />}\n <SyncValuePlugin value={value} />\n <OnChangePlugin onChange={handleChange} />\n <HistoryPlugin />\n\n <BeautifulMentionsPlugin\n items={mentionItems}\n menuAnchorClassName={styles.menuAnchor}\n menuComponent={MentionMenu}\n menuItemComponent={MentionMenuItem}\n />\n </div>\n </LexicalComposer>\n );\n}\n"],"names":["$getRoot","LexicalComposer","useLexicalComposerContext","ContentEditable","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","PlainTextPlugin","BeautifulMentionNode","BeautifulMentionsPlugin","useCallback","useEffect","useMemo","formatVariableLabel","isTagElement","parseIcuToLexicalState","serializeICUMessage","styles","SingleLinePlugin","VariableMentionNode","MentionMenu","MentionMenuItem","SyncValuePlugin","value","editor","currentText","getEditorState","read","getTextContent","queueMicrotask","newState","parseEditorState","JSON","stringify","setEditorState","MessageInput","variables","onChange","onBlur","multiline","error","handleChange","editorState","mentionItems","toItem","v","label","icu","map","filter","initialConfig","namespace","nodes","replace","with","node","getTrigger","getValue","getData","withKlass","editable","onError","console","div","className","data-multiline","contentEditable","data-error","ErrorBoundary","items","menuAnchorClassName","menuAnchor","menuComponent","menuItemComponent"],"mappings":"AAAA;;AAGA,SAASA,QAAQ,QAAQ,uCAAuC;AAChE,SAASC,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,yBAAyB,QAAQ,oEAAoE;AAC9G,SAASC,eAAe,QAAQ,oEAAoE;AACpG,SAASC,oBAAoB,QAAQ,kEAAkE;AACvG,SAASC,aAAa,QAAQ,kEAAkE;AAChG,SAASC,cAAc,QAAQ,mEAAmE;AAClG,SAASC,eAAe,QAAQ,oEAAoE;AACpG,SACEC,oBAAoB,EACpBC,uBAAuB,QAClB,6BAA6B;AACpC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AACxD,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SACEC,YAAY,EACZC,sBAAsB,EACtBC,mBAAmB,QACd,QAAQ;AAGf,OAAOC,YAAY,4BAA4B;AAC/C,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,WAAW,EAAEC,eAAe,QAAQ,iCAAiC;AAE9E,SAASC,gBAAgB,EAAEC,KAAK,EAAqB;IACnD,MAAM,CAACC,OAAO,GAAGtB;IAEjBS,UAAU;QACR,MAAMc,cAAcD,OACjBE,cAAc,GACdC,IAAI,CAAC,IAAM3B,WAAW4B,cAAc;QACvC,IAAIL,UAAUE,aAAa;YACzBI,eAAe;gBACb,MAAMC,WAAWN,OAAOO,gBAAgB,CACtCC,KAAKC,SAAS,CAAClB,uBAAuBQ;gBAExCC,OAAOU,cAAc,CAACJ;YACxB;QACF;IACF,GAAG;QAACP;QAAOC;KAAO;IAElB,OAAO;AACT;AAYA,OAAO,SAASW,aAAa,EAC3BZ,KAAK,EACLa,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,KAAK,EACa;IAClB,MAAMC,eAAe/B,YACnB,CAACgC;QACCA,YAAYf,IAAI,CAAC;YACfU,SAASrC,WAAW4B,cAAc;QACpC;IACF,GACA;QAACS;KAAS;IAGZ,MAAMM,eAAe/B,QAAQ;QAC3B,MAAMgC,SAAS,CAACC,IAAyB,CAAA;gBACvCtB,OAAOsB,EAAEtB,KAAK;gBACduB,OAAOjC,oBAAoBgC;gBAC3BE,KAAK/B,oBAAoB;oBAAC6B;iBAAE;YAC9B,CAAA;QAEA,OAAO;YACL,KAAKT,UAAUY,GAAG,CAACJ;YACnB,KAAKR,UAAUa,MAAM,CAAC,CAACJ,IAAM,CAAC/B,aAAa+B,IAAIG,GAAG,CAACJ;YACnD,KAAKR,UAAUa,MAAM,CAAC,CAACJ,IAAM/B,aAAa+B,IAAIG,GAAG,CAACJ;QACpD;IACF,GAAG;QAACR;KAAU;IAEd,MAAMc,gBAAgBtC,QACpB,IAAO,CAAA;YACLuC,WAAW;YACXC,OAAO;gBACLjC;gBACA;oBACEkC,SAAS7C;oBACT8C,MAAM,CAACC,OACL,IAAIpC,oBACFoC,KAAKC,UAAU,IACfD,KAAKE,QAAQ,IACbF,KAAKG,OAAO;oBAEhBC,WAAWxC;gBACb;aACD;YACDuB,aAAaV,KAAKC,SAAS,CAAClB,uBAAuBQ;YACnDqC,UAAU;YACVC,SAASC,QAAQtB,KAAK;QACxB,CAAA,GACA,EAAE;IAGJ,qBACE,KAACvC;QAAgBiD,eAAeA;kBAC9B,cAAA,MAACa;YAAIC,WAAW/C,OAAOO,MAAM;YAAEyC,kBAAgB1B;;8BAC7C,KAAChC;oBACC2D,+BACE,KAAC/D;wBACC6D,WAAW/C,OAAOiD,eAAe;wBACjCC,cAAY3B;wBACZF,QAAQA;;oBAGZ8B,eAAehE;;gBAEhBmC,2BAAa,KAACrB;8BACf,KAACI;oBAAgBC,OAAOA;;8BACxB,KAACjB;oBAAe+B,UAAUI;;8BAC1B,KAACpC;8BAED,KAACI;oBACC4D,OAAO1B;oBACP2B,qBAAqBrD,OAAOsD,UAAU;oBACtCC,eAAepD;oBACfqD,mBAAmBpD;;;;;AAK7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferencePopover.d.ts","sourceRoot":"","sources":["../../../src/components/input/ReferencePopover.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"ReferencePopover.d.ts","sourceRoot":"","sources":["../../../src/components/input/ReferencePopover.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,OAAO,CAAC;AAIlD,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,QAAQ,GACT,EAAE,qBAAqB,2CAQvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from '@base-ui/react/popover';
|
|
3
3
|
import { IconX } from '@tabler/icons-react';
|
|
4
|
-
import {
|
|
4
|
+
import { useRef } from 'react';
|
|
5
5
|
import styles from './ReferencePopover.module.css';
|
|
6
6
|
export function ReferencePopover({ reference, children }) {
|
|
7
7
|
if (!reference) return children;
|
|
@@ -11,17 +11,8 @@ export function ReferencePopover({ reference, children }) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function ControlledReferencePopover({ reference, children }) {
|
|
14
|
-
const [open, setOpen] = useState(false);
|
|
15
14
|
const anchorRef = useRef(null);
|
|
16
|
-
const handleFocus = useCallback(()=>setOpen(true), []);
|
|
17
|
-
const handleBlur = useCallback((e)=>{
|
|
18
|
-
// Stay open if focus moves within the fieldset or into the popup
|
|
19
|
-
if (anchorRef.current?.contains(e.relatedTarget) || e.relatedTarget?.closest('[data-popup-open]')) return;
|
|
20
|
-
setOpen(false);
|
|
21
|
-
}, []);
|
|
22
15
|
return /*#__PURE__*/ _jsxs(Popover.Root, {
|
|
23
|
-
onOpenChange: setOpen,
|
|
24
|
-
open: open,
|
|
25
16
|
children: [
|
|
26
17
|
/*#__PURE__*/ _jsx(Popover.Portal, {
|
|
27
18
|
children: /*#__PURE__*/ _jsx(Popover.Positioner, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/input/ReferencePopover.tsx"],"sourcesContent":["import { Popover } from '@base-ui/react/popover';\n\nimport { IconX } from '@tabler/icons-react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/input/ReferencePopover.tsx"],"sourcesContent":["import { Popover } from '@base-ui/react/popover';\n\nimport { IconX } from '@tabler/icons-react';\nimport { type ReactElement, useRef } from 'react';\n\nimport styles from './ReferencePopover.module.css';\n\nexport interface ReferencePopoverProps {\n reference?: string;\n children: ReactElement;\n}\n\nexport function ReferencePopover({\n reference,\n children,\n}: ReferencePopoverProps) {\n if (!reference) return children;\n\n return (\n <ControlledReferencePopover reference={reference}>\n {children}\n </ControlledReferencePopover>\n );\n}\n\nfunction ControlledReferencePopover({\n reference,\n children,\n}: {\n reference: string;\n children: ReactElement;\n}) {\n const anchorRef = useRef<HTMLElement>(null);\n\n return (\n <Popover.Root>\n <Popover.Portal>\n <Popover.Positioner\n align=\"start\"\n anchor={anchorRef}\n side=\"top\"\n sideOffset={4}\n >\n <Popover.Popup\n className={styles.popup}\n initialFocus={false}\n onMouseDown={(e) => e.preventDefault()}\n >\n <Popover.Close className={styles.dismiss} type=\"button\">\n <IconX size={14} />\n </Popover.Close>\n <p className={styles.text}>{reference}</p>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n {children}\n </Popover.Root>\n );\n}\n"],"names":["Popover","IconX","useRef","styles","ReferencePopover","reference","children","ControlledReferencePopover","anchorRef","Root","Portal","Positioner","align","anchor","side","sideOffset","Popup","className","popup","initialFocus","onMouseDown","e","preventDefault","Close","dismiss","type","size","p","text"],"mappings":";AAAA,SAASA,OAAO,QAAQ,yBAAyB;AAEjD,SAASC,KAAK,QAAQ,sBAAsB;AAC5C,SAA4BC,MAAM,QAAQ,QAAQ;AAElD,OAAOC,YAAY,gCAAgC;AAOnD,OAAO,SAASC,iBAAiB,EAC/BC,SAAS,EACTC,QAAQ,EACc;IACtB,IAAI,CAACD,WAAW,OAAOC;IAEvB,qBACE,KAACC;QAA2BF,WAAWA;kBACpCC;;AAGP;AAEA,SAASC,2BAA2B,EAClCF,SAAS,EACTC,QAAQ,EAIT;IACC,MAAME,YAAYN,OAAoB;IAEtC,qBACE,MAACF,QAAQS,IAAI;;0BACX,KAACT,QAAQU,MAAM;0BACb,cAAA,KAACV,QAAQW,UAAU;oBACjBC,OAAM;oBACNC,QAAQL;oBACRM,MAAK;oBACLC,YAAY;8BAEZ,cAAA,MAACf,QAAQgB,KAAK;wBACZC,WAAWd,OAAOe,KAAK;wBACvBC,cAAc;wBACdC,aAAa,CAACC,IAAMA,EAAEC,cAAc;;0CAEpC,KAACtB,QAAQuB,KAAK;gCAACN,WAAWd,OAAOqB,OAAO;gCAAEC,MAAK;0CAC7C,cAAA,KAACxB;oCAAMyB,MAAM;;;0CAEf,KAACC;gCAAEV,WAAWd,OAAOyB,IAAI;0CAAGvB;;;;;;YAIjCC;;;AAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/editors/SelectVariableEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"SelectVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/editors/SelectVariableEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,2CAoD3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/input/variables/editors/SelectVariableEditor.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useFieldArray, useForm } from 'react-hook-form';\nimport { parseICUMessage, serializeICUMessage } from '@/icu';\nimport type { SelectElement } from '@/types';\n\nimport styles from './SelectVariableEditor.module.css';\n\nexport interface SelectVariableEditorProps {\n element: SelectElement;\n onUpdate: (value: string) => void;\n}\n\nexport function SelectVariableEditor({\n element,\n onUpdate,\n}: SelectVariableEditorProps) {\n const options = useMemo<{ name: string; content: string }[]>(\n () =>\n Object.entries(element.options).map(([name, option]) => ({\n name,\n content: serializeICUMessage(option.value),\n })),\n [element],\n );\n\n const { control, register, getValues } = useForm<{\n options: { name: string; content: string }[];\n }>({\n defaultValues: { options },\n });\n const { fields } = useFieldArray({\n control,\n name: 'options',\n });\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/input/variables/editors/SelectVariableEditor.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useFieldArray, useForm } from 'react-hook-form';\nimport { parseICUMessage, serializeICUMessage } from '@/icu';\nimport type { SelectElement } from '@/types';\n\nimport styles from './SelectVariableEditor.module.css';\n\nexport interface SelectVariableEditorProps {\n element: SelectElement;\n onUpdate: (value: string) => void;\n}\n\nexport function SelectVariableEditor({\n element,\n onUpdate,\n}: SelectVariableEditorProps) {\n const options = useMemo<{ name: string; content: string }[]>(\n () =>\n Object.entries(element.options).map(([name, option]) => ({\n name,\n content: serializeICUMessage(option.value),\n })),\n [element],\n );\n\n const { control, register, getValues } = useForm<{\n options: { name: string; content: string }[];\n }>({\n defaultValues: { options },\n });\n const { fields } = useFieldArray({\n control,\n name: 'options',\n });\n\n useEffect(() => {\n return () => {\n const values = getValues();\n const updatedElement: SelectElement = {\n ...element,\n options: Object.fromEntries(\n values.options.map(({ name, content }) => [\n name,\n { value: parseICUMessage(content) },\n ]),\n ),\n };\n onUpdate(serializeICUMessage([updatedElement]));\n };\n }, []);\n\n return (\n <div className={styles.root}>\n {fields.map((field, index) => (\n <div className={styles.field} key={field.name}>\n <label className={styles.label} htmlFor={`options.${index}.content`}>\n {field.name}\n </label>\n {/* // TODO add support for variable mentions */}\n <input\n className={styles.input}\n {...register(`options.${index}.content`)}\n />\n </div>\n ))}\n </div>\n );\n}\n"],"names":["useEffect","useMemo","useFieldArray","useForm","parseICUMessage","serializeICUMessage","styles","SelectVariableEditor","element","onUpdate","options","Object","entries","map","name","option","content","value","control","register","getValues","defaultValues","fields","values","updatedElement","fromEntries","div","className","root","field","index","label","htmlFor","input"],"mappings":";AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAC3C,SAASC,aAAa,EAAEC,OAAO,QAAQ,kBAAkB;AACzD,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,QAAQ;AAG7D,OAAOC,YAAY,oCAAoC;AAOvD,OAAO,SAASC,qBAAqB,EACnCC,OAAO,EACPC,QAAQ,EACkB;IAC1B,MAAMC,UAAUT,QACd,IACEU,OAAOC,OAAO,CAACJ,QAAQE,OAAO,EAAEG,GAAG,CAAC,CAAC,CAACC,MAAMC,OAAO,GAAM,CAAA;gBACvDD;gBACAE,SAASX,oBAAoBU,OAAOE,KAAK;YAC3C,CAAA,IACF;QAACT;KAAQ;IAGX,MAAM,EAAEU,OAAO,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGjB,QAEtC;QACDkB,eAAe;YAAEX;QAAQ;IAC3B;IACA,MAAM,EAAEY,MAAM,EAAE,GAAGpB,cAAc;QAC/BgB;QACAJ,MAAM;IACR;IAEAd,UAAU;QACR,OAAO;YACL,MAAMuB,SAASH;YACf,MAAMI,iBAAgC;gBACpC,GAAGhB,OAAO;gBACVE,SAASC,OAAOc,WAAW,CACzBF,OAAOb,OAAO,CAACG,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEE,OAAO,EAAE,GAAK;wBACxCF;wBACA;4BAAEG,OAAOb,gBAAgBY;wBAAS;qBACnC;YAEL;YACAP,SAASJ,oBAAoB;gBAACmB;aAAe;QAC/C;IACF,GAAG,EAAE;IAEL,qBACE,KAACE;QAAIC,WAAWrB,OAAOsB,IAAI;kBACxBN,OAAOT,GAAG,CAAC,CAACgB,OAAOC,sBAClB,MAACJ;gBAAIC,WAAWrB,OAAOuB,KAAK;;kCAC1B,KAACE;wBAAMJ,WAAWrB,OAAOyB,KAAK;wBAAEC,SAAS,CAAC,QAAQ,EAAEF,MAAM,QAAQ,CAAC;kCAChED,MAAMf,IAAI;;kCAGb,KAACmB;wBACCN,WAAWrB,OAAO2B,KAAK;wBACtB,GAAGd,SAAS,CAAC,QAAQ,EAAEW,MAAM,QAAQ,CAAC,CAAC;;;eAPTD,MAAMf,IAAI;;AAarD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/editors/TagVariableEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAQ,GACT,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"TagVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/editors/TagVariableEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAQ,GACT,EAAE,sBAAsB,2CA0BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/input/variables/editors/TagVariableEditor.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { parseICUMessage, serializeICUMessage } from '@/icu';\nimport type { TagElement } from '@/types';\n\nimport styles from './TagVariableEditor.module.css';\n\nexport interface TagVariableEditorProps {\n element: TagElement;\n onUpdate: (value: string) => void;\n}\n\nexport function TagVariableEditor({\n element,\n onUpdate,\n}: TagVariableEditorProps) {\n const content = useMemo<string>(\n () => serializeICUMessage(element.children),\n [element],\n );\n\n const { register, getValues } = useForm<{ content: string }>({\n defaultValues: { content },\n });\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/input/variables/editors/TagVariableEditor.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { parseICUMessage, serializeICUMessage } from '@/icu';\nimport type { TagElement } from '@/types';\n\nimport styles from './TagVariableEditor.module.css';\n\nexport interface TagVariableEditorProps {\n element: TagElement;\n onUpdate: (value: string) => void;\n}\n\nexport function TagVariableEditor({\n element,\n onUpdate,\n}: TagVariableEditorProps) {\n const content = useMemo<string>(\n () => serializeICUMessage(element.children),\n [element],\n );\n\n const { register, getValues } = useForm<{ content: string }>({\n defaultValues: { content },\n });\n\n useEffect(() => {\n return () => {\n const { content } = getValues();\n // TODO find better solution for this\n const updatedElement: TagElement = {\n ...element,\n children: parseICUMessage(content),\n };\n onUpdate(serializeICUMessage([updatedElement]));\n };\n }, []);\n\n // TODO add support for variable mentions\n return (\n <textarea className={styles.textarea} {...register('content')} rows={1} />\n );\n}\n"],"names":["useEffect","useMemo","useForm","parseICUMessage","serializeICUMessage","styles","TagVariableEditor","element","onUpdate","content","children","register","getValues","defaultValues","updatedElement","textarea","className","rows"],"mappings":";AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAC3C,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,QAAQ;AAG7D,OAAOC,YAAY,iCAAiC;AAOpD,OAAO,SAASC,kBAAkB,EAChCC,OAAO,EACPC,QAAQ,EACe;IACvB,MAAMC,UAAUR,QACd,IAAMG,oBAAoBG,QAAQG,QAAQ,GAC1C;QAACH;KAAQ;IAGX,MAAM,EAAEI,QAAQ,EAAEC,SAAS,EAAE,GAAGV,QAA6B;QAC3DW,eAAe;YAAEJ;QAAQ;IAC3B;IAEAT,UAAU;QACR,OAAO;YACL,MAAM,EAAES,OAAO,EAAE,GAAGG;YACpB,qCAAqC;YACrC,MAAME,iBAA6B;gBACjC,GAAGP,OAAO;gBACVG,UAAUP,gBAAgBM;YAC5B;YACAD,SAASJ,oBAAoB;gBAACU;aAAe;QAC/C;IACF,GAAG,EAAE;IAEL,yCAAyC;IACzC,qBACE,KAACC;QAASC,WAAWX,OAAOU,QAAQ;QAAG,GAAGJ,SAAS,UAAU;QAAEM,MAAM;;AAEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/pickers/NumericVariableEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa5D,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"NumericVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/pickers/NumericVariableEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa5D,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,2CA4C5B"}
|
|
@@ -16,7 +16,6 @@ export function NumericVariableEditor({ element, onUpdate }) {
|
|
|
16
16
|
return undefined;
|
|
17
17
|
});
|
|
18
18
|
const getValueRef = useRef(null);
|
|
19
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffectEvent
|
|
20
19
|
useEffect(()=>{
|
|
21
20
|
return ()=>{
|
|
22
21
|
if (!getValueRef.current) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/input/variables/pickers/NumericVariableEditor.tsx"],"sourcesContent":["import { Toggle } from '@base-ui/react/toggle';\nimport { ToggleGroup } from '@base-ui/react/toggle-group';\nimport { useEffect, useRef, useState } from 'react';\nimport { isNumberElement, isPluralElement } from '@/icu';\nimport type { NumberElement, PluralElement } from '@/types';\n\nimport { PluralVariableEditor } from '../editors/PluralVariableEditor';\nimport styles from './NumericVariableEditor.module.css';\n\nconst NUMERIC_TYPES = [\n 'number',\n 'plural',\n // \"selectordinal\"\n] as const;\n\ntype NumericType = (typeof NUMERIC_TYPES)[number];\n\nexport interface NumericVariableEditorProps {\n element: NumberElement | PluralElement;\n onUpdate: (value: string) => void;\n}\n\nexport function NumericVariableEditor({\n element,\n onUpdate,\n}: NumericVariableEditorProps) {\n const [type, setType] = useState<NumericType | undefined>(() => {\n if (isNumberElement(element)) return 'number';\n if (isPluralElement(element)) return 'plural';\n return undefined;\n });\n const getValueRef = useRef<{ getValue: () => string }>(null);\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/input/variables/pickers/NumericVariableEditor.tsx"],"sourcesContent":["import { Toggle } from '@base-ui/react/toggle';\nimport { ToggleGroup } from '@base-ui/react/toggle-group';\nimport { useEffect, useRef, useState } from 'react';\nimport { isNumberElement, isPluralElement } from '@/icu';\nimport type { NumberElement, PluralElement } from '@/types';\n\nimport { PluralVariableEditor } from '../editors/PluralVariableEditor';\nimport styles from './NumericVariableEditor.module.css';\n\nconst NUMERIC_TYPES = [\n 'number',\n 'plural',\n // \"selectordinal\"\n] as const;\n\ntype NumericType = (typeof NUMERIC_TYPES)[number];\n\nexport interface NumericVariableEditorProps {\n element: NumberElement | PluralElement;\n onUpdate: (value: string) => void;\n}\n\nexport function NumericVariableEditor({\n element,\n onUpdate,\n}: NumericVariableEditorProps) {\n const [type, setType] = useState<NumericType | undefined>(() => {\n if (isNumberElement(element)) return 'number';\n if (isPluralElement(element)) return 'plural';\n return undefined;\n });\n const getValueRef = useRef<{ getValue: () => string }>(null);\n\n useEffect(() => {\n return () => {\n if (!getValueRef.current) return;\n onUpdate(getValueRef.current.getValue());\n };\n }, []);\n\n return (\n <div>\n <ToggleGroup\n className={styles.toggleGroup}\n onValueChange={(newValue) => {\n if (newValue.length === 0) return;\n const next = newValue.find((v) => v !== type);\n if (next) setType(next as NumericType);\n }}\n value={type ? [type] : []}\n >\n {NUMERIC_TYPES.map((type) => (\n <Toggle className={styles.toggleItem} key={type} value={type}>\n {type}\n </Toggle>\n ))}\n </ToggleGroup>\n\n <div className={styles.content}>\n {type === 'plural' && (\n <PluralVariableEditor\n element={isPluralElement(element) ? element : undefined}\n ref={getValueRef}\n variableName={element.value}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["Toggle","ToggleGroup","useEffect","useRef","useState","isNumberElement","isPluralElement","PluralVariableEditor","styles","NUMERIC_TYPES","NumericVariableEditor","element","onUpdate","type","setType","undefined","getValueRef","current","getValue","div","className","toggleGroup","onValueChange","newValue","length","next","find","v","value","map","toggleItem","content","ref","variableName"],"mappings":";AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,eAAe,EAAEC,eAAe,QAAQ,QAAQ;AAGzD,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,OAAOC,YAAY,qCAAqC;AAExD,MAAMC,gBAAgB;IACpB;IACA;CAED;AASD,OAAO,SAASC,sBAAsB,EACpCC,OAAO,EACPC,QAAQ,EACmB;IAC3B,MAAM,CAACC,MAAMC,QAAQ,GAAGV,SAAkC;QACxD,IAAIC,gBAAgBM,UAAU,OAAO;QACrC,IAAIL,gBAAgBK,UAAU,OAAO;QACrC,OAAOI;IACT;IACA,MAAMC,cAAcb,OAAmC;IAEvDD,UAAU;QACR,OAAO;YACL,IAAI,CAACc,YAAYC,OAAO,EAAE;YAC1BL,SAASI,YAAYC,OAAO,CAACC,QAAQ;QACvC;IACF,GAAG,EAAE;IAEL,qBACE,MAACC;;0BACC,KAAClB;gBACCmB,WAAWZ,OAAOa,WAAW;gBAC7BC,eAAe,CAACC;oBACd,IAAIA,SAASC,MAAM,KAAK,GAAG;oBAC3B,MAAMC,OAAOF,SAASG,IAAI,CAAC,CAACC,IAAMA,MAAMd;oBACxC,IAAIY,MAAMX,QAAQW;gBACpB;gBACAG,OAAOf,OAAO;oBAACA;iBAAK,GAAG,EAAE;0BAExBJ,cAAcoB,GAAG,CAAC,CAAChB,qBAClB,KAACb;wBAAOoB,WAAWZ,OAAOsB,UAAU;wBAAaF,OAAOf;kCACrDA;uBADwCA;;0BAM/C,KAACM;gBAAIC,WAAWZ,OAAOuB,OAAO;0BAC3BlB,SAAS,0BACR,KAACN;oBACCI,SAASL,gBAAgBK,WAAWA,UAAUI;oBAC9CiB,KAAKhB;oBACLiB,cAActB,QAAQiB,KAAK;;;;;AAMvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemporalVariablePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/pickers/TemporalVariablePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AASxD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,GACT,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"TemporalVariablePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/variables/pickers/TemporalVariablePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AASxD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,GACT,EAAE,2BAA2B,2CAqD7B"}
|
|
@@ -16,7 +16,6 @@ export function TemporalVariablePicker({ element, onUpdate }) {
|
|
|
16
16
|
return undefined;
|
|
17
17
|
});
|
|
18
18
|
const getValueRef = useRef(null);
|
|
19
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffectEvent
|
|
20
19
|
useEffect(()=>{
|
|
21
20
|
return ()=>{
|
|
22
21
|
if (!getValueRef.current) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/input/variables/pickers/TemporalVariablePicker.tsx"],"sourcesContent":["import { Toggle } from '@base-ui/react/toggle';\nimport { ToggleGroup } from '@base-ui/react/toggle-group';\nimport { useEffect, useRef, useState } from 'react';\nimport { isDateElement, isTimeElement } from '@/icu';\nimport type { DateElement, TimeElement } from '@/types';\n\nimport { TemporalVariableEditor } from '../editors/TemporalVariableEditor';\nimport styles from './TemporalVariablePicker.module.css';\n\nconst TEMPORAL_TYPES = ['date', 'time'] as const;\n\ntype TemporalType = (typeof TEMPORAL_TYPES)[number];\n\nexport interface TemporalVariablePickerProps {\n element: DateElement | TimeElement;\n onUpdate: (value: string) => void;\n}\n\nexport function TemporalVariablePicker({\n element,\n onUpdate,\n}: TemporalVariablePickerProps) {\n const [type, setType] = useState<TemporalType | undefined>(() => {\n if (isDateElement(element)) return 'date';\n if (isTimeElement(element)) return 'time';\n return undefined;\n });\n const getValueRef = useRef<{ getValue: () => string }>(null);\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/input/variables/pickers/TemporalVariablePicker.tsx"],"sourcesContent":["import { Toggle } from '@base-ui/react/toggle';\nimport { ToggleGroup } from '@base-ui/react/toggle-group';\nimport { useEffect, useRef, useState } from 'react';\nimport { isDateElement, isTimeElement } from '@/icu';\nimport type { DateElement, TimeElement } from '@/types';\n\nimport { TemporalVariableEditor } from '../editors/TemporalVariableEditor';\nimport styles from './TemporalVariablePicker.module.css';\n\nconst TEMPORAL_TYPES = ['date', 'time'] as const;\n\ntype TemporalType = (typeof TEMPORAL_TYPES)[number];\n\nexport interface TemporalVariablePickerProps {\n element: DateElement | TimeElement;\n onUpdate: (value: string) => void;\n}\n\nexport function TemporalVariablePicker({\n element,\n onUpdate,\n}: TemporalVariablePickerProps) {\n const [type, setType] = useState<TemporalType | undefined>(() => {\n if (isDateElement(element)) return 'date';\n if (isTimeElement(element)) return 'time';\n return undefined;\n });\n const getValueRef = useRef<{ getValue: () => string }>(null);\n\n useEffect(() => {\n return () => {\n if (!getValueRef.current) return;\n onUpdate(getValueRef.current.getValue());\n };\n }, []);\n\n return (\n <div>\n <ToggleGroup\n className={styles.toggleGroup}\n onValueChange={(newValue) => {\n if (newValue.length === 0) return;\n const next = newValue.find((v) => v !== type);\n if (next) setType(next as TemporalType);\n }}\n value={type ? [type] : []}\n >\n {TEMPORAL_TYPES.map((type) => (\n <Toggle className={styles.toggleItem} key={type} value={type}>\n {type}\n </Toggle>\n ))}\n </ToggleGroup>\n\n <div className={styles.content}>\n {type && (\n <TemporalVariableEditor\n element={\n type === 'date'\n ? isDateElement(element)\n ? element\n : undefined\n : isTimeElement(element)\n ? element\n : undefined\n }\n name={element.value}\n ref={getValueRef}\n type={type}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["Toggle","ToggleGroup","useEffect","useRef","useState","isDateElement","isTimeElement","TemporalVariableEditor","styles","TEMPORAL_TYPES","TemporalVariablePicker","element","onUpdate","type","setType","undefined","getValueRef","current","getValue","div","className","toggleGroup","onValueChange","newValue","length","next","find","v","value","map","toggleItem","content","name","ref"],"mappings":";AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,aAAa,EAAEC,aAAa,QAAQ,QAAQ;AAGrD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,OAAOC,YAAY,sCAAsC;AAEzD,MAAMC,iBAAiB;IAAC;IAAQ;CAAO;AASvC,OAAO,SAASC,uBAAuB,EACrCC,OAAO,EACPC,QAAQ,EACoB;IAC5B,MAAM,CAACC,MAAMC,QAAQ,GAAGV,SAAmC;QACzD,IAAIC,cAAcM,UAAU,OAAO;QACnC,IAAIL,cAAcK,UAAU,OAAO;QACnC,OAAOI;IACT;IACA,MAAMC,cAAcb,OAAmC;IAEvDD,UAAU;QACR,OAAO;YACL,IAAI,CAACc,YAAYC,OAAO,EAAE;YAC1BL,SAASI,YAAYC,OAAO,CAACC,QAAQ;QACvC;IACF,GAAG,EAAE;IAEL,qBACE,MAACC;;0BACC,KAAClB;gBACCmB,WAAWZ,OAAOa,WAAW;gBAC7BC,eAAe,CAACC;oBACd,IAAIA,SAASC,MAAM,KAAK,GAAG;oBAC3B,MAAMC,OAAOF,SAASG,IAAI,CAAC,CAACC,IAAMA,MAAMd;oBACxC,IAAIY,MAAMX,QAAQW;gBACpB;gBACAG,OAAOf,OAAO;oBAACA;iBAAK,GAAG,EAAE;0BAExBJ,eAAeoB,GAAG,CAAC,CAAChB,qBACnB,KAACb;wBAAOoB,WAAWZ,OAAOsB,UAAU;wBAAaF,OAAOf;kCACrDA;uBADwCA;;0BAM/C,KAACM;gBAAIC,WAAWZ,OAAOuB,OAAO;0BAC3BlB,sBACC,KAACN;oBACCI,SACEE,SAAS,SACLR,cAAcM,WACZA,UACAI,YACFT,cAAcK,WACZA,UACAI;oBAERiB,MAAMrB,QAAQiB,KAAK;oBACnBK,KAAKjB;oBACLH,MAAMA;;;;;AAMlB"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldHook } from 'payload';
|
|
1
|
+
import type { FieldHook, TypeWithID } from 'payload';
|
|
2
2
|
import type { Messages } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Populates the virtual `_intlMessages` field with scoped
|
|
@@ -7,7 +7,7 @@ import type { Messages } from './types';
|
|
|
7
7
|
export declare const createPopulateScopedMessagesHook: ({ globalSlug, scope, }: {
|
|
8
8
|
globalSlug: "messages";
|
|
9
9
|
scope: string;
|
|
10
|
-
}) => FieldHook<
|
|
10
|
+
}) => FieldHook<TypeWithID, Messages>;
|
|
11
11
|
/**
|
|
12
12
|
* Extracts `_intlMessages` from the incoming data,
|
|
13
13
|
* merges each locale's scoped key back into the messages
|
|
@@ -16,5 +16,5 @@ export declare const createPopulateScopedMessagesHook: ({ globalSlug, scope, }:
|
|
|
16
16
|
export declare const createExtractScopedMessagesHook: ({ globalSlug, scope, }: {
|
|
17
17
|
globalSlug: "messages";
|
|
18
18
|
scope: string;
|
|
19
|
-
}) => FieldHook<
|
|
19
|
+
}) => FieldHook<TypeWithID, Messages>;
|
|
20
20
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,gCAAgC,2BAIxC;IACD,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,SAAS,CAAC,UAAU,EAAE,QAAQ,CAUjC,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,2BAIvC;IACD,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,SAAS,CAAC,UAAU,EAAE,QAAQ,CAwBjC,CAAC"}
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks.ts"],"sourcesContent":["import { isEqual } from 'lodash-es';\nimport type { FieldHook } from 'payload';\nimport type { Messages } from './types';\n\n/**\n * Populates the virtual `_intlMessages` field with scoped\n * translations from the messages collection after read.\n */\nexport const createPopulateScopedMessagesHook =\n ({\n globalSlug,\n scope,\n }: {\n globalSlug: 'messages';\n scope: string;\n }): FieldHook<
|
|
1
|
+
{"version":3,"sources":["../src/hooks.ts"],"sourcesContent":["import { isEqual } from 'lodash-es';\nimport type { FieldHook, TypeWithID } from 'payload';\nimport type { Messages } from './types';\n\n/**\n * Populates the virtual `_intlMessages` field with scoped\n * translations from the messages collection after read.\n */\nexport const createPopulateScopedMessagesHook =\n ({\n globalSlug,\n scope,\n }: {\n globalSlug: 'messages';\n scope: string;\n }): FieldHook<TypeWithID, Messages> =>\n async ({ req: { locale, payload } }) => {\n if (!locale) return {};\n const { data: messages = {} } = await payload.findGlobal({\n slug: globalSlug,\n locale,\n select: { data: true },\n });\n\n return messages[scope] as Messages;\n };\n\n/**\n * Extracts `_intlMessages` from the incoming data,\n * merges each locale's scoped key back into the messages\n * collection, and strips the virtual field before persistence.\n */\nexport const createExtractScopedMessagesHook =\n ({\n globalSlug,\n scope,\n }: {\n globalSlug: 'messages';\n scope: string;\n }): FieldHook<TypeWithID, Messages> =>\n async ({ value, previousValue, req: { payload, locale } }) => {\n if (!value) return {};\n // TODO check if this can be derived from the FieldHook args instead\n if (isEqual(value, previousValue)) return value;\n\n const { data: allMessages = {} } = await payload.findGlobal({\n slug: globalSlug as 'messages',\n locale,\n select: { data: true },\n });\n\n const updatedMessages = {\n ...allMessages,\n [scope]: value,\n };\n\n await payload.updateGlobal({\n slug: globalSlug as 'messages',\n locale,\n data: { data: updatedMessages },\n });\n\n return value;\n };\n"],"names":["isEqual","createPopulateScopedMessagesHook","globalSlug","scope","req","locale","payload","data","messages","findGlobal","slug","select","createExtractScopedMessagesHook","value","previousValue","allMessages","updatedMessages","updateGlobal"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAIpC;;;CAGC,GACD,OAAO,MAAMC,mCACX,CAAC,EACCC,UAAU,EACVC,KAAK,EAIN,GACD,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAE,EAAE;QACjC,IAAI,CAACD,QAAQ,OAAO,CAAC;QACrB,MAAM,EAAEE,MAAMC,WAAW,CAAC,CAAC,EAAE,GAAG,MAAMF,QAAQG,UAAU,CAAC;YACvDC,MAAMR;YACNG;YACAM,QAAQ;gBAAEJ,MAAM;YAAK;QACvB;QAEA,OAAOC,QAAQ,CAACL,MAAM;IACxB,EAAE;AAEJ;;;;CAIC,GACD,OAAO,MAAMS,kCACX,CAAC,EACCV,UAAU,EACVC,KAAK,EAIN,GACD,OAAO,EAAEU,KAAK,EAAEC,aAAa,EAAEV,KAAK,EAAEE,OAAO,EAAED,MAAM,EAAE,EAAE;QACvD,IAAI,CAACQ,OAAO,OAAO,CAAC;QACpB,oEAAoE;QACpE,IAAIb,QAAQa,OAAOC,gBAAgB,OAAOD;QAE1C,MAAM,EAAEN,MAAMQ,cAAc,CAAC,CAAC,EAAE,GAAG,MAAMT,QAAQG,UAAU,CAAC;YAC1DC,MAAMR;YACNG;YACAM,QAAQ;gBAAEJ,MAAM;YAAK;QACvB;QAEA,MAAMS,kBAAkB;YACtB,GAAGD,WAAW;YACd,CAACZ,MAAM,EAAEU;QACX;QAEA,MAAMP,QAAQW,YAAY,CAAC;YACzBP,MAAMR;YACNG;YACAE,MAAM;gBAAEA,MAAMS;YAAgB;QAChC;QAEA,OAAOH;IACT,EAAE"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAC;AAE9C,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SACC,MAAM,oBAAoB,CAAC,cAAc,CAAC,GAAG,MAAM,oBAAoB,CAAC,cAAc,CAAC,IACvF,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1C,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAI9B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC;IAChB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAEpD,MAAM,MAAM,QAAQ,CAAC,MAAM,SAAS,cAAc,IAAI;KACnD,CAAC,IAAI,MAAM,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CACvE,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC;AAE7B,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAC1D,KAAK,EAAE,GACP,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAAC,CAAC;AAE/C,MAAM,MAAM,yBAAyB,CACnC,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC;AAI/E,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAAG;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,oBAAoB,EACpB,cAAc,GAAG,YAAY,CAC9B,CAAC;AAEF,YAAY,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,oCAAoC,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n LiteralElement,\n MessageFormatElement,\n PoundElement,\n} from '@formatjs/icu-messageformat-parser';\nimport type { CollectionConfig, GlobalSlug, PayloadRequest } from 'payload';\nimport type { DeepPartial } from 'react-hook-form';\nimport type { MessagesPluginConfig } from '.';\
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n LiteralElement,\n MessageFormatElement,\n PoundElement,\n} from '@formatjs/icu-messageformat-parser';\nimport type { CollectionConfig, GlobalSlug, PayloadRequest } from 'payload';\nimport type { DeepPartial } from 'react-hook-form';\nimport type { MessagesPluginConfig } from '.';\n\nexport type ResolvedPluginOptions<\n K extends\n keyof MessagesPluginConfig<MessagesSchema> = keyof MessagesPluginConfig<MessagesSchema>,\n> = Pick<Required<MessagesPluginConfig<MessagesSchema>>, K>;\n\nexport type MessagesHooks = {\n afterUpdate?: () => Promise<void> | void;\n} & CollectionConfig['hooks'];\n\n/* MARK: Scope */\n\nexport interface TabScopeConfig {\n position: 'tab';\n existingFieldsTabLabel?: string;\n}\n\nexport interface SidebarScopeConfig {\n position: 'sidebar';\n}\n\nexport type ScopeConfig = TabScopeConfig | SidebarScopeConfig;\n\nexport type ScopePosition = ScopeConfig['position'];\n\nexport type ScopeKey<Schema extends MessagesSchema> = {\n [K in keyof Schema & GlobalSlug]: Schema[K] extends object ? K : never;\n}[keyof Schema & GlobalSlug];\n\nexport type MessagesScopesConfig<Scope extends string = string> =\n | Scope[]\n | Record<Scope, ScopeConfig | ScopePosition>;\n\nexport type TypedMessagesScopesConfig<\n Schema extends MessagesSchema = MessagesSchema,\n> = MessagesScopesConfig<ScopeKey<Schema>>;\n\nexport type EditorAccessGuard = (req: Pick<PayloadRequest, 'user'>) => boolean;\n\n/* MARK: Messages */\n\nexport type Locale = string;\n\nexport type Translations<T> = Record<Locale, T>;\n\nexport type Messages = {\n [key: string]: Messages | string;\n};\n\nexport type MessagesSchema = Messages;\n\nexport type MessageConfig = {\n description: string | undefined;\n variables: TemplateVariable[];\n};\n\nexport interface VariableMentionNodeAttrs {\n name: string;\n label: string;\n icu: string;\n}\n\nexport type { DeepPartial };\n\nexport type TemplateVariable = Exclude<\n MessageFormatElement,\n LiteralElement | PoundElement\n>;\n\nexport type {\n ArgumentElement,\n DateElement,\n LiteralElement,\n NumberElement,\n PluralElement,\n SelectElement,\n TagElement,\n TimeElement,\n} from '@formatjs/icu-messageformat-parser';\n"],"names":[],"mappings":"AA6EA,WAS4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,IAAI,EACJ,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,QAAQ,CA6BX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sanitize.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sanitize.ts"],"sourcesContent":["import type { Messages } from '@/types';\n\n/**\n * Sanitize messages data to match the schema.\n * Stored messages might contain keys that are not in the config.\n * This happens when messages in the config were (re)moved.\n *\n * Keep exactly the keys from `shape`, fill values from `source` when present.\n * When `useSchemaDefaults` is true, missing leaves fall back to the schema value.\n * - Leaf present as string -> included\n * - Leaf missing/non-string + useSchemaDefaults -> schema value used\n * - Leaf missing/non-string + !useSchemaDefaults -> omitted\n * - Empty nested groups -> omitted (unless filled by defaults)\n */\nexport function sanitizeMessages({\n config,\n data,\n useSchemaDefaults = false,\n}: {\n config: Messages;\n data: unknown;\n useSchemaDefaults?: boolean;\n}): Messages {\n const out: Record<string, unknown> = {};\n const src = isObj(data) ? data : {};\n\n for (const key of Object.keys(config)) {\n const shapeVal = (config as Record<string, unknown>)[key];\n const srcVal = src[key];\n\n if (isObj(shapeVal)) {\n const child = sanitizeMessages({\n config: shapeVal as Messages,\n data: srcVal,\n useSchemaDefaults,\n });\n if (isObj(child) && Object.keys(child).length > 0) {\n out[key] = child;\n }\n // else: omit empty group\n } else {\n // Leaf: keep source string, or fall back to schema value\n if (typeof srcVal === 'string') {\n out[key] = srcVal;\n } else if (useSchemaDefaults && typeof shapeVal === 'string') {\n out[key] = shapeVal;\n }\n }\n }\n\n return out as Messages;\n}\n\nfunction isObj(x: unknown): x is Record<string, unknown> {\n return !!x && typeof x === 'object' && !Array.isArray(x);\n}\n"],"names":["sanitizeMessages","config","data","useSchemaDefaults","out","src","isObj","key","Object","keys","shapeVal","srcVal","child","length","x","Array","isArray"],"mappings":"AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASA,iBAAiB,EAC/BC,MAAM,EACNC,IAAI,EACJC,oBAAoB,KAAK,EAK1B;IACC,MAAMC,MAA+B,CAAC;IACtC,MAAMC,MAAMC,MAAMJ,QAAQA,OAAO,CAAC;IAElC,KAAK,MAAMK,OAAOC,OAAOC,IAAI,CAACR,QAAS;QACrC,MAAMS,WAAW,AAACT,MAAkC,CAACM,IAAI;QACzD,MAAMI,SAASN,GAAG,CAACE,IAAI;QAEvB,IAAID,MAAMI,WAAW;YACnB,MAAME,QAAQZ,iBAAiB;gBAC7BC,QAAQS;gBACRR,MAAMS;gBACNR;YACF;YACA,IAAIG,MAAMM,UAAUJ,OAAOC,IAAI,CAACG,OAAOC,MAAM,GAAG,GAAG;gBACjDT,GAAG,CAACG,IAAI,GAAGK;YACb;QACA,yBAAyB;QAC3B,OAAO;YACL,yDAAyD;YACzD,IAAI,OAAOD,WAAW,UAAU;gBAC9BP,GAAG,CAACG,IAAI,GAAGI;YACb,OAAO,IAAIR,qBAAqB,OAAOO,aAAa,UAAU;gBAC5DN,GAAG,CAACG,IAAI,GAAGG;YACb;QACF;IACF;IAEA,OAAON;AACT;AAEA,SAASE,MAAMQ,CAAU;IACvB,OAAO,CAAC,CAACA,KAAK,OAAOA,MAAM,YAAY,CAACC,MAAMC,OAAO,CAACF;AACxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-intl",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Payload Plugin for I18N using ICU Messages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
54
|
"react-hook-form": "^7.58.1",
|
|
55
55
|
"zod": "4.3.5",
|
|
56
|
-
"@davincicoding/payload-plugin-kit": "0.0.
|
|
56
|
+
"@davincicoding/payload-plugin-kit": "0.0.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@payloadcms/richtext-lexical": "3.72.0",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"react-dom": "19.2.1",
|
|
70
70
|
"typescript": "5.7.3",
|
|
71
71
|
"vite": "7.0.6",
|
|
72
|
-
"vitest": "
|
|
72
|
+
"vitest": "3.2.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@payloadcms/next": "
|
|
76
|
-
"@payloadcms/richtext-lexical": "
|
|
75
|
+
"@payloadcms/next": "3.72.0",
|
|
76
|
+
"@payloadcms/richtext-lexical": "3.72.0",
|
|
77
77
|
"@payloadcms/ui": ">=3.72.0",
|
|
78
|
-
"next": "
|
|
79
|
-
"payload": "
|
|
78
|
+
"next": "15.5.9",
|
|
79
|
+
"payload": "3.72.0"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "^18.20.2 || >=20.9.0",
|
|
@@ -86,15 +86,17 @@
|
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
|
-
"prebuild": "pnpm
|
|
89
|
+
"prebuild": "pnpm check:types",
|
|
90
90
|
"build": "plugin-build",
|
|
91
91
|
"check:types": "tsc --noEmit",
|
|
92
|
-
"
|
|
93
|
-
"dev": "plugin-build --watch",
|
|
92
|
+
"dev": "next dev dev",
|
|
93
|
+
"dev:build": "plugin-build --watch",
|
|
94
94
|
"generate:types": "generate-types --opt uploadCollection=uploads",
|
|
95
95
|
"lint": "biome check .",
|
|
96
96
|
"lint:fix": "biome check --write .",
|
|
97
97
|
"test": "vitest run",
|
|
98
|
+
"test:e2e": "playwright test --config dev/playwright.config.ts",
|
|
99
|
+
"test:int": "vitest run --config dev/vitest.config.mts",
|
|
98
100
|
"test:watch": "vitest"
|
|
99
101
|
}
|
|
100
102
|
}
|