@intlayer/design-system 5.5.9 → 5.5.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 +42 -9
- package/dist/.vite/manifest.json +43 -27
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs +1 -1
- package/dist/components/Auth/useAuth/useCSRF.d.ts +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts +1 -1
- package/dist/components/Command/index.d.ts +83 -0
- package/dist/components/Command/index.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs +1 -13
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +1 -13
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +2 -2
- package/dist/components/Form/FormBase.mjs +2 -2
- package/dist/components/Form/elements/FormElementWrapper.cjs +3 -3
- package/dist/components/Form/elements/FormElementWrapper.mjs +3 -3
- package/dist/components/IDE/FileList.cjs +1 -1
- package/dist/components/IDE/FileList.cjs.map +1 -1
- package/dist/components/IDE/FileList.d.ts +1 -1
- package/dist/components/IDE/FileList.d.ts.map +1 -1
- package/dist/components/IDE/FileList.mjs +1 -1
- package/dist/components/IDE/FileList.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/components/MarkDownRender/index.cjs +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +54 -54
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +65 -65
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/parse-BJVwmz92.cjs +511 -0
- package/dist/parse-BJVwmz92.cjs.map +1 -0
- package/dist/parse-pnJgclyf.js +512 -0
- package/dist/parse-pnJgclyf.js.map +1 -0
- package/dist/{schemas-DJhUvjsx.cjs → schemas-DlCjM5d_.cjs} +260 -726
- package/dist/schemas-DlCjM5d_.cjs.map +1 -0
- package/dist/{schemas-7jC6hy_u.js → schemas-itjzX6bG.js} +21 -487
- package/dist/schemas-itjzX6bG.js.map +1 -0
- package/dist/tailwind.css +2 -2
- package/dist/zod-D4WapgbL.js +92 -0
- package/dist/zod-D4WapgbL.js.map +1 -0
- package/dist/zod-K7y5gPX4.cjs +91 -0
- package/dist/zod-K7y5gPX4.cjs.map +1 -0
- package/package.json +15 -15
- package/dist/schemas-7jC6hy_u.js.map +0 -1
- package/dist/schemas-DJhUvjsx.cjs.map +0 -1
- package/dist/zod-DIGMabE8.js +0 -48
- package/dist/zod-DIGMabE8.js.map +0 -1
- package/dist/zod-DpajDxlG.cjs +0 -47
- package/dist/zod-DpajDxlG.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/StructureView/StructureView.tsx"],"sourcesContent":["'use client';\n\nimport {\n type KeyPath,\n type TypedNode,\n type ContentNode,\n getNodeChildren,\n getNodeType,\n isSameKeyPath,\n NodeType,\n getDefaultNode,\n} from '@intlayer/core';\nimport {\n useConfiguration,\n useEditedContentActions,\n useFocusDictionary,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { Plus, Trash } from 'lucide-react';\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Button } from '../../Button';\nimport { Container } from '../../Container';\nimport { EditableFieldInput } from '../../EditableField';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { structureViewContent } from './structureView.content';\n\ntype NodeTypeViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n onNodeTypeChange: (content?: ContentNode) => void;\n};\n\nconst NodeTypeView: FC<NodeTypeViewProps> = ({\n section,\n dictionaryKey,\n keyPath,\n onNodeTypeChange: onNodeTypeChangeProp,\n}) => {\n const locales = useConfiguration()?.internationalization.locales ?? [];\n const nodeType = getNodeType(section);\n const children = getNodeChildren(section);\n\n const onNodeTypeChange = (content?: ContentNode) => {\n const transformedContent = getDefaultNode(\n nodeType,\n locales,\n content\n ) as ContentNode;\n\n onNodeTypeChangeProp(transformedContent);\n };\n\n if (\n nodeType === NodeType.Translation ||\n nodeType === NodeType.Condition ||\n nodeType === NodeType.Enumeration\n ) {\n const firstKey = Object.keys(\n (section as unknown as TypedNode)[nodeType as keyof typeof section]\n )[0];\n const childrenKeyPath = [\n ...keyPath,\n { type: nodeType, key: firstKey },\n ] as KeyPath[];\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n\n <NodeTypeView\n section={children}\n keyPath={childrenKeyPath}\n dictionaryKey={dictionaryKey}\n onNodeTypeChange={onNodeTypeChange}\n />\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n const childrenKeyPath = [...keyPath, { type: nodeType, key: 0 } as KeyPath];\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n\n <NodeTypeView\n section={children}\n keyPath={childrenKeyPath}\n dictionaryKey={dictionaryKey}\n onNodeTypeChange={onNodeTypeChange}\n />\n </div>\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <>\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n <div className=\"ml-10 mt-6\">\n <StructureView\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </>\n );\n }\n\n return (\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(getDefaultNode(nodeType, locales) as ContentNode)\n }\n />\n );\n};\n\ntype NodeWrapperProps = {\n sectionKey?: string;\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NodeView: FC<NodeWrapperProps> = ({\n sectionKey,\n section,\n keyPath,\n dictionaryKey,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n const { renameEditedContent, addEditedContent } = useEditedContentActions();\n\n const { titleInput, deleteButton } = useDictionary(structureViewContent);\n\n const handleRenameNodeKey = (keyName: string) => {\n renameEditedContent(dictionaryKey, keyName, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: keyName } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <Container\n transparency=\"xl\"\n roundedSize=\"xl\"\n className=\"w-full min-w-80 gap-2 overflow-auto px-5 py-2\"\n border\n borderColor=\"text\"\n background=\"none\"\n aria-selected={isSameKeyPath(keyPath, focusedContent?.keyPath ?? [])}\n onClick={() => setFocusedContentKeyPath(keyPath)}\n >\n <div className=\"flex w-full flex-col items-start justify-between gap-3\">\n {typeof sectionKey === 'string' && (\n <div className=\"w-full\">\n <div className=\"flex w-full items-center justify-between gap-10\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n placeholder={titleInput.placeholder.value}\n defaultValue={sectionKey}\n onSave={(value) => handleRenameNodeKey(value)}\n variant=\"invisible\"\n />\n <Button\n label={deleteButton.label.value}\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"translate-x-2\"\n Icon={Trash}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n />\n </div>\n\n <span className=\"text-neutral ml-3 text-sm\">\n ( {camelCaseToSentence(sectionKey)} )\n </span>\n </div>\n )}\n <NodeTypeView\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n onNodeTypeChange={(content) => {\n addEditedContent(dictionaryKey, content, keyPath);\n }}\n />\n </div>\n </Container>\n );\n};\n\ntype ObjectViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const ObjectView: FC<ObjectViewProps> = ({\n section,\n keyPath,\n dictionaryKey,\n}) => {\n const { addNodeButton } = useDictionary(structureViewContent);\n const { setFocusedContentKeyPath } = useFocusDictionaryActions();\n const { addEditedContent } = useEditedContentActions();\n\n if (!section || typeof section !== 'object') {\n return <div>Not an object</div>;\n }\n\n return (\n <div className=\"flex flex-col gap-2 overflow-y-scroll\">\n <ul className=\"mr-auto flex flex-col gap-4\">\n {Object.keys(section).map((key) => (\n <li key={key} className=\"flex w-full\">\n <NodeView\n sectionKey={key}\n section={section?.[key as keyof typeof section]}\n keyPath={[...keyPath, { type: NodeType.Object, key }]}\n dictionaryKey={dictionaryKey}\n />\n </li>\n ))}\n </ul>\n <Button\n label={addNodeButton.label.value}\n variant=\"hoverable\"\n size=\"md\"\n color=\"text\"\n Icon={Plus}\n className=\"flex-1\"\n onClick={() => {\n const newKey = 'newKey';\n const newKeyPath = [\n ...keyPath,\n { type: NodeType.Object, key: newKey },\n ] as KeyPath[];\n addEditedContent(dictionaryKey, '', newKeyPath);\n setFocusedContentKeyPath(newKeyPath);\n }}\n >\n {addNodeButton.text}\n </Button>\n </div>\n );\n};\n\ntype StructureViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const StructureView: FC<StructureViewProps> = ({\n section,\n keyPath,\n dictionaryKey,\n}) => {\n if (\n !section ||\n typeof section !== 'object' ||\n typeof section.nodeType === 'string'\n ) {\n return (\n <NodeView\n sectionKey={'content'}\n section={section}\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n return (\n <ObjectView\n section={section}\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n />\n );\n};\n"],"names":["nodeType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,eAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AACpB,MAAM;AACJ,QAAM,UAAU,iBAAA,GAAoB,qBAAqB,WAAW,CAAC;AAC/D,QAAA,WAAW,YAAY,OAAO;AAC9B,QAAA,WAAW,gBAAgB,OAAO;AAElC,QAAA,mBAAmB,CAAC,YAA0B;AAClD,UAAM,qBAAqB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,yBAAqB,kBAAkB;AAAA,EACzC;AAGE,MAAA,aAAa,SAAS,eACtB,aAAa,SAAS,aACtB,aAAa,SAAS,aACtB;AACA,UAAM,WAAW,OAAO;AAAA,MACrB,QAAiC,QAAgC;AAAA,MAClE,CAAC;AACH,UAAM,kBAAkB;AAAA,MACtB,GAAG;AAAA,MACH,EAAE,MAAM,UAAU,KAAK,SAAS;AAAA,IAClC;AAGE,WAAA,qBAAC,OAAI,EAAA,WAAU,8BACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,eAAe,CAACA,cACd;AAAA,YACE,eAAeA,WAAU,OAAO;AAAA,UAAA;AAAA,QAClC;AAAA,MAEJ;AAAA,MAEA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAS;AAAA,UACT,SAAS;AAAA,UACT;AAAA,UACA;AAA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f,gBAAM,aAAa;AAAA,YACjB,GAAG;AAAA,YACH,EAAE,MAAM,SAAS,QAAQ,KAAK,OAAO;AAAA,UACvC;AACiB,2BAAA,eAAe,IAAI,UAAU;AAC9C,mCAAyB,UAAU;AAAA,QACrC;AAAA,QAEC,UAAc,cAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACjB,GACF;AAEJ;AAQO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AAEF,MAAA,CAAC,WACD,OAAO,YAAY,YACnB,OAAO,QAAQ,aAAa,UAC5B;AAEE,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAKF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"StructureView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/StructureView/StructureView.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ContentNode,\n getDefaultNode,\n getNodeChildren,\n getNodeType,\n isSameKeyPath,\n type KeyPath,\n NodeType,\n type TypedNode,\n} from '@intlayer/core';\nimport {\n useConfiguration,\n useEditedContentActions,\n useFocusDictionary,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { Plus, Trash } from 'lucide-react';\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Button } from '../../Button';\nimport { Container } from '../../Container';\nimport { EditableFieldInput } from '../../EditableField';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { structureViewContent } from './structureView.content';\n\ntype NodeTypeViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n onNodeTypeChange: (content?: ContentNode) => void;\n};\n\nconst NodeTypeView: FC<NodeTypeViewProps> = ({\n section,\n dictionaryKey,\n keyPath,\n onNodeTypeChange: onNodeTypeChangeProp,\n}) => {\n const locales = useConfiguration()?.internationalization.locales ?? [];\n const nodeType = getNodeType(section);\n const children = getNodeChildren(section);\n\n const onNodeTypeChange = (content?: ContentNode) => {\n const transformedContent = getDefaultNode(\n nodeType,\n locales,\n content\n ) as ContentNode;\n\n onNodeTypeChangeProp(transformedContent);\n };\n\n if (\n nodeType === NodeType.Translation ||\n nodeType === NodeType.Condition ||\n nodeType === NodeType.Enumeration\n ) {\n const firstKey = Object.keys(\n (section as unknown as TypedNode)[nodeType as keyof typeof section]\n )[0];\n const childrenKeyPath = [\n ...keyPath,\n { type: nodeType, key: firstKey },\n ] as KeyPath[];\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n\n <NodeTypeView\n section={children}\n keyPath={childrenKeyPath}\n dictionaryKey={dictionaryKey}\n onNodeTypeChange={onNodeTypeChange}\n />\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n const childrenKeyPath = [...keyPath, { type: nodeType, key: 0 } as KeyPath];\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n\n <NodeTypeView\n section={children}\n keyPath={childrenKeyPath}\n dictionaryKey={dictionaryKey}\n onNodeTypeChange={onNodeTypeChange}\n />\n </div>\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <>\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(\n getDefaultNode(nodeType, locales) as ContentNode\n )\n }\n />\n <div className=\"ml-10 mt-6\">\n <StructureView\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </>\n );\n }\n\n return (\n <NodeTypeSelector\n section={section}\n onValueChange={(nodeType) =>\n onNodeTypeChangeProp(getDefaultNode(nodeType, locales) as ContentNode)\n }\n />\n );\n};\n\ntype NodeWrapperProps = {\n sectionKey?: string;\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NodeView: FC<NodeWrapperProps> = ({\n sectionKey,\n section,\n keyPath,\n dictionaryKey,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n const { renameEditedContent, addEditedContent } = useEditedContentActions();\n\n const { titleInput, deleteButton } = useDictionary(structureViewContent);\n\n const handleRenameNodeKey = (keyName: string) => {\n renameEditedContent(dictionaryKey, keyName, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: keyName } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <Container\n transparency=\"xl\"\n roundedSize=\"xl\"\n className=\"w-full min-w-80 gap-2 overflow-auto px-5 py-2\"\n border\n borderColor=\"text\"\n background=\"none\"\n aria-selected={isSameKeyPath(keyPath, focusedContent?.keyPath ?? [])}\n onClick={() => setFocusedContentKeyPath(keyPath)}\n >\n <div className=\"flex w-full flex-col items-start justify-between gap-3\">\n {typeof sectionKey === 'string' && (\n <div className=\"w-full\">\n <div className=\"flex w-full items-center justify-between gap-10\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n placeholder={titleInput.placeholder.value}\n defaultValue={sectionKey}\n onSave={(value) => handleRenameNodeKey(value)}\n variant=\"invisible\"\n />\n <Button\n label={deleteButton.label.value}\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"translate-x-2\"\n Icon={Trash}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n />\n </div>\n\n <span className=\"text-neutral ml-3 text-sm\">\n ( {camelCaseToSentence(sectionKey)} )\n </span>\n </div>\n )}\n <NodeTypeView\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n onNodeTypeChange={(content) => {\n addEditedContent(dictionaryKey, content, keyPath);\n }}\n />\n </div>\n </Container>\n );\n};\n\ntype ObjectViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const ObjectView: FC<ObjectViewProps> = ({\n section,\n keyPath,\n dictionaryKey,\n}) => {\n const { addNodeButton } = useDictionary(structureViewContent);\n const { setFocusedContentKeyPath } = useFocusDictionaryActions();\n const { addEditedContent } = useEditedContentActions();\n\n if (!section || typeof section !== 'object') {\n return <div>Not an object</div>;\n }\n\n return (\n <div className=\"flex flex-col gap-2 overflow-y-auto\">\n <ul className=\"mr-auto flex flex-col gap-4\">\n {Object.keys(section).map((key) => (\n <li key={key} className=\"flex w-full\">\n <NodeView\n sectionKey={key}\n section={section?.[key as keyof typeof section]}\n keyPath={[...keyPath, { type: NodeType.Object, key }]}\n dictionaryKey={dictionaryKey}\n />\n </li>\n ))}\n </ul>\n <Button\n label={addNodeButton.label.value}\n variant=\"hoverable\"\n size=\"md\"\n color=\"text\"\n Icon={Plus}\n className=\"flex-1\"\n onClick={() => {\n const newKey = 'newKey';\n const newKeyPath = [\n ...keyPath,\n { type: NodeType.Object, key: newKey },\n ] as KeyPath[];\n addEditedContent(dictionaryKey, '', newKeyPath);\n setFocusedContentKeyPath(newKeyPath);\n }}\n >\n {addNodeButton.text}\n </Button>\n </div>\n );\n};\n\ntype StructureViewProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const StructureView: FC<StructureViewProps> = ({\n section,\n keyPath,\n dictionaryKey,\n}) => {\n if (\n !section ||\n typeof section !== 'object' ||\n typeof section.nodeType === 'string'\n ) {\n return (\n <NodeView\n sectionKey={'content'}\n section={section}\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n return (\n <ObjectView\n section={section}\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n />\n );\n};\n"],"names":["nodeType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,eAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AACpB,MAAM;AACJ,QAAM,UAAU,iBAAA,GAAoB,qBAAqB,WAAW,CAAC;AAC/D,QAAA,WAAW,YAAY,OAAO;AAC9B,QAAA,WAAW,gBAAgB,OAAO;AAElC,QAAA,mBAAmB,CAAC,YAA0B;AAClD,UAAM,qBAAqB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,yBAAqB,kBAAkB;AAAA,EACzC;AAGE,MAAA,aAAa,SAAS,eACtB,aAAa,SAAS,aACtB,aAAa,SAAS,aACtB;AACA,UAAM,WAAW,OAAO;AAAA,MACrB,QAAiC,QAAgC;AAAA,MAClE,CAAC;AACH,UAAM,kBAAkB;AAAA,MACtB,GAAG;AAAA,MACH,EAAE,MAAM,UAAU,KAAK,SAAS;AAAA,IAClC;AAGE,WAAA,qBAAC,OAAI,EAAA,WAAU,8BACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,eAAe,CAACA,cACd;AAAA,YACE,eAAeA,WAAU,OAAO;AAAA,UAAA;AAAA,QAClC;AAAA,MAEJ;AAAA,MAEA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAS;AAAA,UACT,SAAS;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,EAAA;AAIA,MAAA,aAAa,SAAS,OAAO;AACzB,UAAA,kBAAkB,CAAC,GAAG,SAAS,EAAE,MAAM,UAAU,KAAK,GAAc;AAExE,WAAA,qBAAC,OAAI,EAAA,WAAU,8BACb,UAAA;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AAA,IAAA;AAAA,EACjB,GACF;AAEJ;AAQO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AAEF,MAAA,CAAC,WACD,OAAO,YAAY,YACnB,OAAO,QAAQ,aAAa,UAC5B;AAEE,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAKF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const hooks_useDevice = require("../../hooks/useDevice.cjs");
|
|
5
|
-
require("react");
|
|
6
|
-
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
7
|
-
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
8
|
-
require("@intlayer/editor-react");
|
|
9
|
-
require("@intlayer/api");
|
|
10
|
-
require("@intlayer/config/built");
|
|
11
|
-
require("../Toaster/Toast.cjs");
|
|
12
|
-
require("deepmerge");
|
|
13
4
|
const utils_cn = require("../../utils/cn.cjs");
|
|
14
5
|
const components_MaxHeightSmoother_index = require("../MaxHeightSmoother/index.cjs");
|
|
15
6
|
const DropDown = ({
|
|
@@ -39,10 +30,7 @@ const Trigger = ({
|
|
|
39
30
|
className: utils_cn.cn("w-full cursor-pointer", className),
|
|
40
31
|
"aria-label": `Open panel ${identifier}`,
|
|
41
32
|
onClick: (e) => {
|
|
42
|
-
|
|
43
|
-
if (isIOS) {
|
|
44
|
-
e.currentTarget.focus({ preventScroll: true });
|
|
45
|
-
}
|
|
33
|
+
e.currentTarget.focus();
|
|
46
34
|
},
|
|
47
35
|
onBlur: (e) => e.currentTarget.blur(),
|
|
48
36
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\n\nexport type DropDownProps = HTMLAttributes<HTMLDivElement> & {\n identifier: string;\n};\n\nexport type DropDownType = FC<DropDownProps> & {\n Trigger: FC<TriggerProps>;\n Panel: FC<PanelProps>;\n};\n\n/**\n * Trigger allowing to open a dropdown menu.\n *\n * Example:\n * ```jsx\n * <DropDown identifier=\"dropdown\">\n * <DropDown.Trigger>\n * Open dropdown\n * </DropDown.Trigger>\n *\n * <DropDown.Panel identifier=\"dropdown\">\n * <div>Content</div>\n * </DropDown.Panel>\n * </DropDown>\n * ```\n *\n * > Note DropDown.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nexport const DropDown: DropDownType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn(`group/dropdown relative flex`, className)}\n aria-label={`DropDown ${identifier}`}\n id={`unrollable-panel-button-${identifier}`}\n aria-haspopup\n {...props}\n >\n {children}\n </div>\n);\n\nexport type TriggerProps = HTMLAttributes<HTMLButtonElement> & {\n identifier: string;\n};\n\n/**\n * Trigger allowing to open a dropdown menu.\n *\n * Example:\n * ```jsx\n * <DropDown.Trigger identifier=\"dropdown\">\n * <div>Open dropdown</div>\n * </DropDown.Trigger>\n * ```\n *\n * > Note DropDown.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nconst Trigger: FC<TriggerProps> = ({\n children,\n identifier,\n className,\n ...props\n}) => (\n <button\n className={cn('w-full cursor-pointer', className)}\n aria-label={`Open panel ${identifier}`}\n onClick={(e) => {\n // Ensure focus behavior is consistent across all mobile browsers\n (e.currentTarget as HTMLButtonElement).focus();\n }}\n onBlur={(e) => (e.currentTarget as HTMLButtonElement).blur()}\n {...props}\n >\n {children}\n </button>\n);\n\nexport type PanelProps = HTMLAttributes<HTMLDivElement> & {\n isFocusable?: boolean;\n isHidden?: boolean;\n isOverable?: boolean;\n identifier: string;\n align?: 'start' | 'end';\n};\n\n/**\n * Component that opens a dropdown menu when the trigger is clicked.\n *\n * Example:\n * ```jsx\n * <DropDown.Panel identifier=\"dropdown\">\n * <div>Content</div>\n * </DropDown.Panel>\n * ```\n */\nconst Panel: FC<PanelProps> = ({\n children,\n isHidden = undefined,\n isOverable = false,\n isFocusable = false,\n align = 'start',\n identifier,\n className,\n ...props\n}) => (\n <div\n className={cn(\n 'absolute top-[calc(100%+0.5rem)] z-[1000] min-w-full',\n align === 'start' && 'left-0',\n align === 'end' && 'right-0',\n className\n )}\n aria-hidden={isHidden}\n role=\"region\"\n aria-labelledby={`unrollable-panel-button-${identifier}`}\n id={`unrollable-panel-${identifier}`}\n >\n <MaxHeightSmoother\n isHidden={isHidden}\n className={cn(\n 'overflow-x-visible',\n isHidden !== false ? 'invisible' : 'visible',\n isOverable &&\n 'group-hover/dropdown:visible group-hover/dropdown:grid-rows-[1fr]',\n isFocusable &&\n 'group-focus-within/dropdown:visible group-focus-within/dropdown:grid-rows-[1fr]'\n )}\n {...props}\n >\n {children}\n </MaxHeightSmoother>\n </div>\n);\n\nDropDown.Trigger = Trigger;\nDropDown.Panel = Panel;\n"],"names":["jsx","cn","MaxHeightSmoother"],"mappings":";;;;;AA+BO,MAAM,WAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACEA,2BAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAG,GAAA,gCAAgC,SAAS;AAAA,IACvD,cAAY,YAAY,UAAU;AAAA,IAClC,IAAI,2BAA2B,UAAU;AAAA,IACzC,iBAAa;AAAA,IACZ,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAmBF,MAAM,UAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACED,2BAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA,GAAG,yBAAyB,SAAS;AAAA,IAChD,cAAY,cAAc,UAAU;AAAA,IACpC,SAAS,CAAC,MAAM;AAEb,QAAE,cAAoC,MAAM;AAAA,IAC/C;AAAA,IACA,QAAQ,CAAC,MAAO,EAAE,cAAoC,KAAK;AAAA,IAC1D,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAqBF,MAAM,QAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACED,2BAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAA;AAAA,MACT;AAAA,MACA,UAAU,WAAW;AAAA,MACrB,UAAU,SAAS;AAAA,MACnB;AAAA,IACF;AAAA,IACA,eAAa;AAAA,IACb,MAAK;AAAA,IACL,mBAAiB,2BAA2B,UAAU;AAAA,IACtD,IAAI,oBAAoB,UAAU;AAAA,IAElC,UAAAD,2BAAA;AAAA,MAACE,mCAAA;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWD,SAAA;AAAA,UACT;AAAA,UACA,aAAa,QAAQ,cAAc;AAAA,UACnC,cACE;AAAA,UACF,eACE;AAAA,QACJ;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;AAGF,SAAS,UAAU;AACnB,SAAS,QAAQ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DropDown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DropDown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIhD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG;IAC7C,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;IAC1B,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,EAAE,YAetB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,iBAAiB,CAAC,GAAG;IAC7D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAkCF,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CACzB,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { checkIsIphoneOrSafariDevice } from "../../hooks/useDevice.mjs";
|
|
3
|
-
import "react";
|
|
4
|
-
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
5
|
-
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
6
|
-
import "@intlayer/editor-react";
|
|
7
|
-
import "@intlayer/api";
|
|
8
|
-
import "@intlayer/config/built";
|
|
9
|
-
import "../Toaster/Toast.mjs";
|
|
10
|
-
import "deepmerge";
|
|
11
2
|
import { cn } from "../../utils/cn.mjs";
|
|
12
3
|
import { MaxHeightSmoother } from "../MaxHeightSmoother/index.mjs";
|
|
13
4
|
const DropDown = ({
|
|
@@ -37,10 +28,7 @@ const Trigger = ({
|
|
|
37
28
|
className: cn("w-full cursor-pointer", className),
|
|
38
29
|
"aria-label": `Open panel ${identifier}`,
|
|
39
30
|
onClick: (e) => {
|
|
40
|
-
|
|
41
|
-
if (isIOS) {
|
|
42
|
-
e.currentTarget.focus({ preventScroll: true });
|
|
43
|
-
}
|
|
31
|
+
e.currentTarget.focus();
|
|
44
32
|
},
|
|
45
33
|
onBlur: (e) => e.currentTarget.blur(),
|
|
46
34
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\n\nexport type DropDownProps = HTMLAttributes<HTMLDivElement> & {\n identifier: string;\n};\n\nexport type DropDownType = FC<DropDownProps> & {\n Trigger: FC<TriggerProps>;\n Panel: FC<PanelProps>;\n};\n\n/**\n * Trigger allowing to open a dropdown menu.\n *\n * Example:\n * ```jsx\n * <DropDown identifier=\"dropdown\">\n * <DropDown.Trigger>\n * Open dropdown\n * </DropDown.Trigger>\n *\n * <DropDown.Panel identifier=\"dropdown\">\n * <div>Content</div>\n * </DropDown.Panel>\n * </DropDown>\n * ```\n *\n * > Note DropDown.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nexport const DropDown: DropDownType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn(`group/dropdown relative flex`, className)}\n aria-label={`DropDown ${identifier}`}\n id={`unrollable-panel-button-${identifier}`}\n aria-haspopup\n {...props}\n >\n {children}\n </div>\n);\n\nexport type TriggerProps = HTMLAttributes<HTMLButtonElement> & {\n identifier: string;\n};\n\n/**\n * Trigger allowing to open a dropdown menu.\n *\n * Example:\n * ```jsx\n * <DropDown.Trigger identifier=\"dropdown\">\n * <div>Open dropdown</div>\n * </DropDown.Trigger>\n * ```\n *\n * > Note DropDown.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nconst Trigger: FC<TriggerProps> = ({\n children,\n identifier,\n className,\n ...props\n}) => (\n <button\n className={cn('w-full cursor-pointer', className)}\n aria-label={`Open panel ${identifier}`}\n onClick={(e) => {\n // Ensure focus behavior is consistent across all mobile browsers\n (e.currentTarget as HTMLButtonElement).focus();\n }}\n onBlur={(e) => (e.currentTarget as HTMLButtonElement).blur()}\n {...props}\n >\n {children}\n </button>\n);\n\nexport type PanelProps = HTMLAttributes<HTMLDivElement> & {\n isFocusable?: boolean;\n isHidden?: boolean;\n isOverable?: boolean;\n identifier: string;\n align?: 'start' | 'end';\n};\n\n/**\n * Component that opens a dropdown menu when the trigger is clicked.\n *\n * Example:\n * ```jsx\n * <DropDown.Panel identifier=\"dropdown\">\n * <div>Content</div>\n * </DropDown.Panel>\n * ```\n */\nconst Panel: FC<PanelProps> = ({\n children,\n isHidden = undefined,\n isOverable = false,\n isFocusable = false,\n align = 'start',\n identifier,\n className,\n ...props\n}) => (\n <div\n className={cn(\n 'absolute top-[calc(100%+0.5rem)] z-[1000] min-w-full',\n align === 'start' && 'left-0',\n align === 'end' && 'right-0',\n className\n )}\n aria-hidden={isHidden}\n role=\"region\"\n aria-labelledby={`unrollable-panel-button-${identifier}`}\n id={`unrollable-panel-${identifier}`}\n >\n <MaxHeightSmoother\n isHidden={isHidden}\n className={cn(\n 'overflow-x-visible',\n isHidden !== false ? 'invisible' : 'visible',\n isOverable &&\n 'group-hover/dropdown:visible group-hover/dropdown:grid-rows-[1fr]',\n isFocusable &&\n 'group-focus-within/dropdown:visible group-focus-within/dropdown:grid-rows-[1fr]'\n )}\n {...props}\n >\n {children}\n </MaxHeightSmoother>\n </div>\n);\n\nDropDown.Trigger = Trigger;\nDropDown.Panel = Panel;\n"],"names":[],"mappings":";;;AA+BO,MAAM,WAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,GAAG,gCAAgC,SAAS;AAAA,IACvD,cAAY,YAAY,UAAU;AAAA,IAClC,IAAI,2BAA2B,UAAU;AAAA,IACzC,iBAAa;AAAA,IACZ,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAmBF,MAAM,UAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,GAAG,yBAAyB,SAAS;AAAA,IAChD,cAAY,cAAc,UAAU;AAAA,IACpC,SAAS,CAAC,MAAM;AAEb,QAAE,cAAoC,MAAM;AAAA,IAC/C;AAAA,IACA,QAAQ,CAAC,MAAO,EAAE,cAAoC,KAAK;AAAA,IAC1D,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAqBF,MAAM,QAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA,UAAU,WAAW;AAAA,MACrB,UAAU,SAAS;AAAA,MACnB;AAAA,IACF;AAAA,IACA,eAAa;AAAA,IACb,MAAK;AAAA,IACL,mBAAiB,2BAA2B,UAAU;AAAA,IACtD,IAAI,oBAAoB,UAAU;AAAA,IAElC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,aAAa,QAAQ,cAAc;AAAA,UACnC,cACE;AAAA,UACF,eACE;AAAA,QACJ;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;AAGF,SAAS,UAAU;AACnB,SAAS,QAAQ;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const zod = require("../../zod-
|
|
5
|
+
const zod = require("../../zod-K7y5gPX4.cjs");
|
|
6
6
|
const reactHookForm = require("react-hook-form");
|
|
7
7
|
const utils_cn = require("../../utils/cn.cjs");
|
|
8
8
|
const awaitFunction = async (fn) => {
|
|
@@ -52,7 +52,7 @@ const Form = ({
|
|
|
52
52
|
};
|
|
53
53
|
const useForm = (schema, props) => {
|
|
54
54
|
const form = reactHookForm.useForm({
|
|
55
|
-
resolver: zod.
|
|
55
|
+
resolver: zod.a(schema),
|
|
56
56
|
...props
|
|
57
57
|
});
|
|
58
58
|
const isSubmitting = form.formState.isSubmitting;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { a } from "../../zod-D4WapgbL.js";
|
|
4
4
|
import { useForm as useForm$1, FormProvider } from "react-hook-form";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
const awaitFunction = async (fn) => {
|
|
@@ -50,7 +50,7 @@ const Form = ({
|
|
|
50
50
|
};
|
|
51
51
|
const useForm = (schema, props) => {
|
|
52
52
|
const form = useForm$1({
|
|
53
|
-
resolver:
|
|
53
|
+
resolver: a(schema),
|
|
54
54
|
...props
|
|
55
55
|
});
|
|
56
56
|
const isSubmitting = form.formState.isSubmitting;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const zod = require("../../../zod-
|
|
5
|
+
const zod = require("../../../zod-K7y5gPX4.cjs");
|
|
6
6
|
const reactHookForm = require("react-hook-form");
|
|
7
|
-
const schemas = require("../../../schemas-
|
|
7
|
+
const schemas = require("../../../schemas-DlCjM5d_.cjs");
|
|
8
8
|
const Schema = schemas.object({
|
|
9
9
|
test: schemas.string().min(3, "test error")
|
|
10
10
|
});
|
|
11
11
|
const FormElementWrapper = (props) => {
|
|
12
12
|
const objectFormSchema = props.schema ?? Schema;
|
|
13
13
|
const form = reactHookForm.useForm({
|
|
14
|
-
resolver: zod.
|
|
14
|
+
resolver: zod.a(objectFormSchema),
|
|
15
15
|
values: props.values
|
|
16
16
|
});
|
|
17
17
|
const { children, onSubmit, ...rest } = props;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { a } from "../../../zod-D4WapgbL.js";
|
|
4
4
|
import { useForm, FormProvider } from "react-hook-form";
|
|
5
|
-
import { o as object, s as string } from "../../../schemas-
|
|
5
|
+
import { o as object, s as string } from "../../../schemas-itjzX6bG.js";
|
|
6
6
|
const Schema = object({
|
|
7
7
|
test: string().min(3, "test error")
|
|
8
8
|
});
|
|
9
9
|
const FormElementWrapper = (props) => {
|
|
10
10
|
const objectFormSchema = props.schema ?? Schema;
|
|
11
11
|
const form = useForm({
|
|
12
|
-
resolver:
|
|
12
|
+
resolver: a(objectFormSchema),
|
|
13
13
|
values: props.values
|
|
14
14
|
});
|
|
15
15
|
const { children, onSubmit, ...rest } = props;
|
|
@@ -6,7 +6,7 @@ const components_IDE_FileTree = require("./FileTree.cjs");
|
|
|
6
6
|
const FileList = ({ filePaths, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7
7
|
components_Container_index.Container,
|
|
8
8
|
{
|
|
9
|
-
className: "flex size-full flex-col justify-start overflow-
|
|
9
|
+
className: "flex size-full flex-col justify-start overflow-auto shadow-lg",
|
|
10
10
|
roundedSize: "3xl",
|
|
11
11
|
transparency: "none",
|
|
12
12
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.cjs","sources":["../../../src/components/IDE/FileList.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"FileList.cjs","sources":["../../../src/components/IDE/FileList.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { Container } from '../Container';\nimport { FileTree } from './FileTree';\n\nexport type FileListProps = {\n filePaths: string[];\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const FileList: FC<FileListProps> = ({ filePaths, ...props }) => (\n <Container\n className=\"flex size-full flex-col justify-start overflow-auto shadow-lg\"\n roundedSize=\"3xl\"\n transparency=\"none\"\n {...props}\n >\n <div className=\"text-neutral flex w-auto flex-row items-center justify-start gap-1 rounded-t-3xl bg-neutral-200 text-xs dark:bg-neutral-950\">\n <div className=\"mx-2 flex items-center justify-start gap-2 p-1\">\n <div className=\"size-3 rounded-full bg-red-500\" />\n <div className=\"size-3 rounded-full bg-yellow-500\" />\n <div className=\"size-3 rounded-full bg-green-500\" />\n </div>\n </div>\n <div className=\"relative flex size-full flex-1 flex-row justify-start shadow-lg\">\n <div className=\"absolute left-0 top-0 size-full\">\n <div className=\"flex size-full\">\n <FileTree filesPaths={filePaths} />\n </div>\n </div>\n </div>\n </Container>\n);\n"],"names":["jsxs","Container","jsx","FileTree"],"mappings":";;;;;AAQO,MAAM,WAA8B,CAAC,EAAE,WAAW,GAAG,MAC1D,MAAAA,2BAAA;AAAA,EAACC,2BAAA;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAY;AAAA,IACZ,cAAa;AAAA,IACZ,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAAA,IAAC,SAAI,WAAU,+HACb,UAACF,2BAAA,KAAA,OAAA,EAAI,WAAU,kDACb,UAAA;AAAA,QAACE,2BAAAA,IAAA,OAAA,EAAI,WAAU,iCAAiC,CAAA;AAAA,QAChDA,2BAAAA,IAAC,OAAI,EAAA,WAAU,oCAAoC,CAAA;AAAA,QACnDA,2BAAAA,IAAC,OAAI,EAAA,WAAU,mCAAmC,CAAA;AAAA,MAAA,EAAA,CACpD,EACF,CAAA;AAAA,qCACC,OAAI,EAAA,WAAU,mEACb,UAACA,2BAAA,IAAA,OAAA,EAAI,WAAU,mCACb,UAAAA,2BAAAA,IAAC,OAAI,EAAA,WAAU,kBACb,UAACA,2BAAAA,IAAAC,wBAAAA,UAAA,EAAS,YAAY,UAAW,CAAA,EACnC,CAAA,EACF,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.d.ts","sourceRoot":"","sources":["../../../src/components/IDE/FileList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"FileList.d.ts","sourceRoot":"","sources":["../../../src/components/IDE/FileList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIhD,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAsBtC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { FileTree } from "./FileTree.mjs";
|
|
|
4
4
|
const FileList = ({ filePaths, ...props }) => /* @__PURE__ */ jsxs(
|
|
5
5
|
Container,
|
|
6
6
|
{
|
|
7
|
-
className: "flex size-full flex-col justify-start overflow-
|
|
7
|
+
className: "flex size-full flex-col justify-start overflow-auto shadow-lg",
|
|
8
8
|
roundedSize: "3xl",
|
|
9
9
|
transparency: "none",
|
|
10
10
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.mjs","sources":["../../../src/components/IDE/FileList.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"FileList.mjs","sources":["../../../src/components/IDE/FileList.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { Container } from '../Container';\nimport { FileTree } from './FileTree';\n\nexport type FileListProps = {\n filePaths: string[];\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const FileList: FC<FileListProps> = ({ filePaths, ...props }) => (\n <Container\n className=\"flex size-full flex-col justify-start overflow-auto shadow-lg\"\n roundedSize=\"3xl\"\n transparency=\"none\"\n {...props}\n >\n <div className=\"text-neutral flex w-auto flex-row items-center justify-start gap-1 rounded-t-3xl bg-neutral-200 text-xs dark:bg-neutral-950\">\n <div className=\"mx-2 flex items-center justify-start gap-2 p-1\">\n <div className=\"size-3 rounded-full bg-red-500\" />\n <div className=\"size-3 rounded-full bg-yellow-500\" />\n <div className=\"size-3 rounded-full bg-green-500\" />\n </div>\n </div>\n <div className=\"relative flex size-full flex-1 flex-row justify-start shadow-lg\">\n <div className=\"absolute left-0 top-0 size-full\">\n <div className=\"flex size-full\">\n <FileTree filesPaths={filePaths} />\n </div>\n </div>\n </div>\n </Container>\n);\n"],"names":[],"mappings":";;;AAQO,MAAM,WAA8B,CAAC,EAAE,WAAW,GAAG,MAC1D,MAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAY;AAAA,IACZ,cAAa;AAAA,IACZ,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA,oBAAC,SAAI,WAAU,+HACb,UAAC,qBAAA,OAAA,EAAI,WAAU,kDACb,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAI,WAAU,iCAAiC,CAAA;AAAA,QAChD,oBAAC,OAAI,EAAA,WAAU,oCAAoC,CAAA;AAAA,QACnD,oBAAC,OAAI,EAAA,WAAU,mCAAmC,CAAA;AAAA,MAAA,EAAA,CACpD,EACF,CAAA;AAAA,0BACC,OAAI,EAAA,WAAU,mEACb,UAAC,oBAAA,OAAA,EAAI,WAAU,mCACb,UAAA,oBAAC,OAAI,EAAA,WAAU,kBACb,UAAC,oBAAA,UAAA,EAAS,YAAY,UAAW,CAAA,EACnC,CAAA,EACF,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA;AACF;"}
|
|
@@ -10,7 +10,7 @@ const KeyboardScreenAdapter = ({ children, className, ...props }) => {
|
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
12
|
className: utils_cn.cn(
|
|
13
|
-
"h-screen w-screen overflow-
|
|
13
|
+
"h-screen w-screen overflow-auto scroll-smooth transition",
|
|
14
14
|
className
|
|
15
15
|
),
|
|
16
16
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/KeyboardScreenAdapter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\nimport { useKeyboardDetector } from '../../hooks/useKeyboardDetector';\nimport { cn } from '../../utils/cn';\n\nexport const KeyboardScreenAdapter: FC<\n PropsWithChildren<HTMLAttributes<HTMLDivElement>>\n> = ({ children, className, ...props }) => {\n const { windowHeight } = useKeyboardDetector();\n\n return (\n <div\n className={cn(\n 'h-screen w-screen overflow-
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/KeyboardScreenAdapter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\nimport { useKeyboardDetector } from '../../hooks/useKeyboardDetector';\nimport { cn } from '../../utils/cn';\n\nexport const KeyboardScreenAdapter: FC<\n PropsWithChildren<HTMLAttributes<HTMLDivElement>>\n> = ({ children, className, ...props }) => {\n const { windowHeight } = useKeyboardDetector();\n\n return (\n <div\n className={cn(\n 'h-screen w-screen overflow-auto scroll-smooth transition',\n className\n )}\n style={{\n maxHeight: windowHeight ? `${windowHeight}px` : undefined,\n }}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["useKeyboardDetector","jsx","cn"],"mappings":";;;;;;AAMO,MAAM,wBAET,CAAC,EAAE,UAAU,WAAW,GAAG,YAAY;AACnC,QAAA,EAAE,aAAa,IAAIA,8CAAoB;AAG3C,SAAAC,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,WAAW,eAAe,GAAG,YAAY,OAAO;AAAA,MAClD;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/KeyboardScreenAdapter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\nimport { useKeyboardDetector } from '../../hooks/useKeyboardDetector';\nimport { cn } from '../../utils/cn';\n\nexport const KeyboardScreenAdapter: FC<\n PropsWithChildren<HTMLAttributes<HTMLDivElement>>\n> = ({ children, className, ...props }) => {\n const { windowHeight } = useKeyboardDetector();\n\n return (\n <div\n className={cn(\n 'h-screen w-screen overflow-
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/KeyboardScreenAdapter/index.tsx"],"sourcesContent":["'use client';\n\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\nimport { useKeyboardDetector } from '../../hooks/useKeyboardDetector';\nimport { cn } from '../../utils/cn';\n\nexport const KeyboardScreenAdapter: FC<\n PropsWithChildren<HTMLAttributes<HTMLDivElement>>\n> = ({ children, className, ...props }) => {\n const { windowHeight } = useKeyboardDetector();\n\n return (\n <div\n className={cn(\n 'h-screen w-screen overflow-auto scroll-smooth transition',\n className\n )}\n style={{\n maxHeight: windowHeight ? `${windowHeight}px` : undefined,\n }}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAMO,MAAM,wBAET,CAAC,EAAE,UAAU,WAAW,GAAG,YAAY;AACnC,QAAA,EAAE,aAAa,IAAI,oBAAoB;AAG3C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,WAAW,eAAe,GAAG,YAAY,OAAO;AAAA,MAClD;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -77,7 +77,7 @@ const MarkdownRenderer = ({
|
|
|
77
77
|
}
|
|
78
78
|
),
|
|
79
79
|
pre: (props) => props.children,
|
|
80
|
-
table: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid w-full max-w-full overflow-
|
|
80
|
+
table: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid w-full max-w-full overflow-auto rounded", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
81
|
"table",
|
|
82
82
|
{
|
|
83
83
|
className: utils_cn.cn(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/MarkDownRender/index.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport Markdown, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport type { FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4 } from '../Headers';\nimport { SectionScroller } from '../Headers/SectionScroller';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: Locales;\n options?: MarkdownToJSX.Options;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n return (\n <CodeProvider>\n <Markdown\n options={{\n overrides: {\n h1: (props) => <H1 isClickable={true} {...props} />,\n h2: (props) => <H2 isClickable={true} {...props} />,\n h3: (props) => <H3 isClickable={true} {...props} />,\n h4: (props) => <H4 isClickable={true} {...props} />,\n\n code: (props) =>\n typeof props.className === 'undefined' ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n isDarkMode={isDarkMode}\n language={props.className?.replace('lang-', '')}\n {...props}\n />\n ),\n\n blockquote: ({ className, ...props }) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }) => (\n <ul\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n ol: ({ className, ...props }) => (\n <ol\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n li: ({ className, ...props }) => (\n <li className={cn('list-disc', className)} {...props} />\n ),\n img: ({ className, ...props }) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn('max-w-full rounded-md', className)}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props) => props.children,\n table: ({ className, ...props }) => (\n <div className=\"grid w-full max-w-full overflow-
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/MarkDownRender/index.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport Markdown, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport type { FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4 } from '../Headers';\nimport { SectionScroller } from '../Headers/SectionScroller';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: Locales;\n options?: MarkdownToJSX.Options;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n return (\n <CodeProvider>\n <Markdown\n options={{\n overrides: {\n h1: (props) => <H1 isClickable={true} {...props} />,\n h2: (props) => <H2 isClickable={true} {...props} />,\n h3: (props) => <H3 isClickable={true} {...props} />,\n h4: (props) => <H4 isClickable={true} {...props} />,\n\n code: (props) =>\n typeof props.className === 'undefined' ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n isDarkMode={isDarkMode}\n language={props.className?.replace('lang-', '')}\n {...props}\n />\n ),\n\n blockquote: ({ className, ...props }) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }) => (\n <ul\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n ol: ({ className, ...props }) => (\n <ol\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n li: ({ className, ...props }) => (\n <li className={cn('list-disc', className)} {...props} />\n ),\n img: ({ className, ...props }) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn('max-w-full rounded-md', className)}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props) => props.children,\n table: ({ className, ...props }) => (\n <div className=\"grid w-full max-w-full overflow-auto rounded\">\n <table\n className={cn(\n 'max-w-full table-auto overflow-hidden text-left',\n className\n )}\n {...props}\n />\n </div>\n ),\n th: ({ className, ...props }) => (\n <th\n className={cn(\n 'border-neutral bg-neutral/10 border-b p-4',\n className\n )}\n {...props}\n />\n ),\n tr: ({ className, ...props }) => (\n <tr\n className={cn('hover:bg-neutral/10 hover:/10', className)}\n {...props}\n />\n ),\n td: ({ className, ...props }) => (\n <td\n className={cn('border-b border-neutral-500/50 p-4', className)}\n {...props}\n />\n ),\n ...overrides,\n },\n wrapper: ({ className, ...props }) => (\n <>\n <SectionScroller />\n <div\n className={cn('flex flex-col gap-8 p-10', className)}\n {...props}\n />\n </>\n ),\n ...restOptions,\n }}\n >\n {children ?? ''}\n </Markdown>\n </CodeProvider>\n );\n};\n"],"names":["CodeProvider","jsx","H1","H2","H3","H4","Code","cn","Link","jsxs","Fragment","SectionScroller"],"mappings":";;;;;;;;;;AAiBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,WAAW,GAAG,YAAY,IAAI,WAAW,CAAC;AAClD,wCACGA,2BAAAA,cACC,EAAA,UAAAC,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACP,WAAW;AAAA,UACT,IAAI,CAAC,UAAUA,+BAACC,yBAAAA,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UACjD,IAAI,CAAC,UAAUD,+BAACE,yBAAAA,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UACjD,IAAI,CAAC,UAAUF,+BAACG,yBAAAA,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UACjD,IAAI,CAAC,UAAUH,+BAACI,yBAAAA,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UAEjD,MAAM,CAAC,UACL,OAAO,MAAM,cAAc,cACzBJ,2BAAA,IAAC,UAAO,EAAA,WAAU,gFACf,UAAA,MAAM,SACT,CAAA,IAEAA,2BAAA;AAAA,YAACK,oBAAA;AAAA,YAAA;AAAA,cACC;AAAA,cACA,UAAU,MAAM,WAAW,QAAQ,SAAS,EAAE;AAAA,cAC7C,GAAG;AA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sx("div", { className: "grid w-full max-w-full overflow-
|
|
78
|
+
table: ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: "grid w-full max-w-full overflow-auto rounded", children: /* @__PURE__ */ jsx(
|
|
79
79
|
"table",
|
|
80
80
|
{
|
|
81
81
|
className: cn(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/MarkDownRender/index.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport Markdown, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport type { FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4 } from '../Headers';\nimport { SectionScroller } from '../Headers/SectionScroller';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: Locales;\n options?: MarkdownToJSX.Options;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n return (\n <CodeProvider>\n <Markdown\n options={{\n overrides: {\n h1: (props) => <H1 isClickable={true} {...props} />,\n h2: (props) => <H2 isClickable={true} {...props} />,\n h3: (props) => <H3 isClickable={true} {...props} />,\n h4: (props) => <H4 isClickable={true} {...props} />,\n\n code: (props) =>\n typeof props.className === 'undefined' ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n isDarkMode={isDarkMode}\n language={props.className?.replace('lang-', '')}\n {...props}\n />\n ),\n\n blockquote: ({ className, ...props }) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }) => (\n <ul\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n ol: ({ className, ...props }) => (\n <ol\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n li: ({ className, ...props }) => (\n <li className={cn('list-disc', className)} {...props} />\n ),\n img: ({ className, ...props }) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn('max-w-full rounded-md', className)}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props) => props.children,\n table: ({ className, ...props }) => (\n <div className=\"grid w-full max-w-full overflow-
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/MarkDownRender/index.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport Markdown, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport type { FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4 } from '../Headers';\nimport { SectionScroller } from '../Headers/SectionScroller';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: Locales;\n options?: MarkdownToJSX.Options;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n return (\n <CodeProvider>\n <Markdown\n options={{\n overrides: {\n h1: (props) => <H1 isClickable={true} {...props} />,\n h2: (props) => <H2 isClickable={true} {...props} />,\n h3: (props) => <H3 isClickable={true} {...props} />,\n h4: (props) => <H4 isClickable={true} {...props} />,\n\n code: (props) =>\n typeof props.className === 'undefined' ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n isDarkMode={isDarkMode}\n language={props.className?.replace('lang-', '')}\n {...props}\n />\n ),\n\n blockquote: ({ className, ...props }) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }) => (\n <ul\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n ol: ({ className, ...props }) => (\n <ol\n className={cn('mt-5 flex flex-col gap-3 pl-5', className)}\n {...props}\n />\n ),\n li: ({ className, ...props }) => (\n <li className={cn('list-disc', className)} {...props} />\n ),\n img: ({ className, ...props }) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn('max-w-full rounded-md', className)}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props) => props.children,\n table: ({ className, ...props }) => (\n <div className=\"grid w-full max-w-full overflow-auto rounded\">\n <table\n className={cn(\n 'max-w-full table-auto overflow-hidden text-left',\n className\n )}\n {...props}\n />\n </div>\n ),\n th: ({ className, ...props }) => (\n <th\n className={cn(\n 'border-neutral bg-neutral/10 border-b p-4',\n className\n )}\n {...props}\n />\n ),\n tr: ({ className, ...props }) => (\n <tr\n className={cn('hover:bg-neutral/10 hover:/10', className)}\n {...props}\n />\n ),\n td: ({ className, ...props }) => (\n <td\n className={cn('border-b border-neutral-500/50 p-4', className)}\n {...props}\n />\n ),\n ...overrides,\n },\n wrapper: ({ className, ...props }) => (\n <>\n <SectionScroller />\n <div\n className={cn('flex flex-col gap-8 p-10', className)}\n {...props}\n />\n </>\n ),\n ...restOptions,\n }}\n >\n {children ?? ''}\n </Markdown>\n </CodeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,WAAW,GAAG,YAAY,IAAI,WAAW,CAA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AA;AAAA,UACjB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,4BAA4B,SAAS;AAAA,cAClD,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,QACN,GACF;AAAA,QAEF,GAAG;AAAA,MACL;AAAA,MAEC,UAAY,YAAA;AAAA,IAAA;AAAA,EAAA,GAEjB;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-
|
|
1
|
+
{"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":["useRef","useImperativeHandle","useEffect","jsx","TextArea","cn"],"mappings":";;;;;;;AAiBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,cAAcA,oBAAmC,IAAI;AAEvCC,eAAAA,oBAAA,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEAC,eAAAA,UAAU,MAAM;AACD,iBAAA;AAAA,EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC,iBAAA;AAAA,EACf;AAEM,QAAA,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACO,mBAAA;AAAA,IAAA;AAAA,EAEjB;AAGE,SAAAC,2BAAA;AAAA,IAACC,6BAAA;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAWC,SAAA;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-
|
|
1
|
+
{"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAiBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,cAAc,OAAmC,IAAI;AAEvC,sBAAA,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEA,YAAU,MAAM;AACD,iBAAA;AAAA,EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC,iBAAA;AAAA,EACf;AAEM,QAAA,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACO,mBAAA;AAAA,IAAA;AAAA,EAEjB;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|