@intlayer/design-system 3.5.5 → 3.5.6
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/.vite/manifest.json +241 -17
- package/dist/CodeBlockShiki-BlmZyrr7.cjs +29 -0
- package/dist/CodeBlockShiki-BlmZyrr7.cjs.map +1 -0
- package/dist/CodeBlockShiki-CcpV9SVi.js +29 -0
- package/dist/CodeBlockShiki-CcpV9SVi.js.map +1 -0
- package/dist/Form-BB0kpER9.cjs +301 -0
- package/dist/Form-BB0kpER9.cjs.map +1 -0
- package/dist/Form-BDcoNTLV.cjs.map +1 -1
- package/dist/Form-DGLgTAdY.js +302 -0
- package/dist/Form-DGLgTAdY.js.map +1 -0
- package/dist/Form-DhsgC7kB.js.map +1 -1
- package/dist/components/Auth/SignUpForm/signUpForm.content.d.ts +11 -11
- package/dist/components/Breadcrumb/index.cjs +5 -2
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs +5 -2
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.cjs +26 -0
- package/dist/components/ClickOutsideDiv/index.cjs.map +1 -0
- package/dist/components/ClickOutsideDiv/index.d.ts +6 -0
- package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -0
- package/dist/components/ClickOutsideDiv/index.mjs +26 -0
- package/dist/components/ClickOutsideDiv/index.mjs.map +1 -0
- package/dist/components/ContentEditor/ContentEditorCode.cjs +78 -0
- package/dist/components/ContentEditor/ContentEditorCode.cjs.map +1 -0
- package/dist/components/ContentEditor/ContentEditorCode.d.ts +11 -0
- package/dist/components/ContentEditor/ContentEditorCode.d.ts.map +1 -0
- package/dist/components/ContentEditor/ContentEditorCode.mjs +78 -0
- package/dist/components/ContentEditor/ContentEditorCode.mjs.map +1 -0
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +30 -26
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +2 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +30 -26
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +3 -3
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +3 -3
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +2 -0
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +161 -69
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +163 -71
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +123 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +14 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +123 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +9 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs +15 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +15 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +6 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +9 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +12 -4
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +2 -0
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +12 -4
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +7 -5
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts +2 -0
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +7 -5
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +117 -55
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts +4 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +115 -53
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts +8 -0
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts +13 -0
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts +9 -0
- package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +10 -10
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +10 -10
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +23 -10
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts +2 -0
- package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +23 -10
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -4
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +3 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +13 -13
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +13 -13
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +73 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts +7 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +73 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +37 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +14 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +37 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.cjs +8 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.d.ts +3 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.mjs +8 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.mjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +54 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +10 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +55 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/index.cjs +5 -0
- package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.mjs +6 -1
- package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.cjs +5 -1
- package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.mjs +6 -2
- package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -8
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -8
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/Form/FormLabel.cjs +6 -2
- package/dist/components/Form/FormLabel.cjs.map +1 -1
- package/dist/components/Form/FormLabel.d.ts.map +1 -1
- package/dist/components/Form/FormLabel.mjs +6 -2
- package/dist/components/Form/FormLabel.mjs.map +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
- package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
- package/dist/components/IDE/Code.cjs +77 -0
- package/dist/components/IDE/Code.cjs.map +1 -0
- package/dist/components/IDE/Code.d.ts +18 -0
- package/dist/components/IDE/Code.d.ts.map +1 -0
- package/dist/components/IDE/Code.mjs +77 -0
- package/dist/components/IDE/Code.mjs.map +1 -0
- package/dist/components/IDE/CodeBlock.cjs +54 -0
- package/dist/components/IDE/CodeBlock.cjs.map +1 -0
- package/dist/components/IDE/CodeBlock.d.ts +12 -0
- package/dist/components/IDE/CodeBlock.d.ts.map +1 -0
- package/dist/components/IDE/CodeBlock.mjs +54 -0
- package/dist/components/IDE/CodeBlock.mjs.map +1 -0
- package/dist/components/IDE/CodeBlockClient.cjs +55 -0
- package/dist/components/IDE/CodeBlockClient.cjs.map +1 -0
- package/dist/components/IDE/CodeBlockClient.mjs +55 -0
- package/dist/components/IDE/CodeBlockClient.mjs.map +1 -0
- package/dist/components/IDE/CodeBlockLoader.cjs +28 -0
- package/dist/components/IDE/CodeBlockLoader.cjs.map +1 -0
- package/dist/components/IDE/CodeBlockLoader.d.ts +4 -0
- package/dist/components/IDE/CodeBlockLoader.d.ts.map +1 -0
- package/dist/components/IDE/CodeBlockLoader.mjs +28 -0
- package/dist/components/IDE/CodeBlockLoader.mjs.map +1 -0
- package/dist/components/IDE/CodeBlockServer.cjs +53 -0
- package/dist/components/IDE/CodeBlockServer.cjs.map +1 -0
- package/dist/components/IDE/CodeBlockServer.d.ts +12 -0
- package/dist/components/IDE/CodeBlockServer.d.ts.map +1 -0
- package/dist/components/IDE/CodeBlockServer.mjs +53 -0
- package/dist/components/IDE/CodeBlockServer.mjs.map +1 -0
- package/dist/components/IDE/CodeBlockShiki.d.ts +3 -0
- package/dist/components/IDE/CodeBlockShiki.d.ts.map +1 -0
- package/dist/components/IDE/CodeBlockclient.d.ts +12 -0
- package/dist/components/IDE/CodeBlockclient.d.ts.map +1 -0
- package/dist/components/IDE/CodeConditionalRenderer.cjs +20 -0
- package/dist/components/IDE/CodeConditionalRenderer.cjs.map +1 -0
- package/dist/components/IDE/CodeConditionalRenderer.d.ts +4 -0
- package/dist/components/IDE/CodeConditionalRenderer.d.ts.map +1 -0
- package/dist/components/IDE/CodeConditionalRenderer.mjs +20 -0
- package/dist/components/IDE/CodeConditionalRenderer.mjs.map +1 -0
- package/dist/components/IDE/CodeContext.cjs +57 -0
- package/dist/components/IDE/CodeContext.cjs.map +1 -0
- package/dist/components/IDE/CodeContext.d.ts +26 -0
- package/dist/components/IDE/CodeContext.d.ts.map +1 -0
- package/dist/components/IDE/CodeContext.mjs +57 -0
- package/dist/components/IDE/CodeContext.mjs.map +1 -0
- package/dist/components/IDE/CodeFormatSelector.cjs +30 -0
- package/dist/components/IDE/CodeFormatSelector.cjs.map +1 -0
- package/dist/components/IDE/CodeFormatSelector.d.ts +3 -0
- package/dist/components/IDE/CodeFormatSelector.d.ts.map +1 -0
- package/dist/components/IDE/CodeFormatSelector.mjs +30 -0
- package/dist/components/IDE/CodeFormatSelector.mjs.map +1 -0
- package/dist/components/IDE/CodeRenderer.cjs +27 -0
- package/dist/components/IDE/CodeRenderer.cjs.map +1 -0
- package/dist/components/IDE/CodeRenderer.d.ts +5 -0
- package/dist/components/IDE/CodeRenderer.d.ts.map +1 -0
- package/dist/components/IDE/CodeRenderer.mjs +27 -0
- package/dist/components/IDE/CodeRenderer.mjs.map +1 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.cjs +28 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.cjs.map +1 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.d.ts +3 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.d.ts.map +1 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.mjs +28 -0
- package/dist/components/IDE/ContentDeclarationFormatSelector.mjs.map +1 -0
- package/dist/components/IDE/EditableCodeBlock.d.ts +9 -0
- package/dist/components/IDE/EditableCodeBlock.d.ts.map +1 -0
- package/dist/components/IDE/MarkDownRender.cjs +2 -3
- package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
- package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
- package/dist/components/IDE/MarkDownRender.mjs +1 -2
- package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/components/IDE/PackageManagerSelector.cjs +20 -0
- package/dist/components/IDE/PackageManagerSelector.cjs.map +1 -0
- package/dist/components/IDE/PackageManagerSelector.d.ts +3 -0
- package/dist/components/IDE/PackageManagerSelector.d.ts.map +1 -0
- package/dist/components/IDE/PackageManagerSelector.mjs +20 -0
- package/dist/components/IDE/PackageManagerSelector.mjs.map +1 -0
- package/dist/components/IDE/index.cjs +2 -2
- package/dist/components/IDE/index.d.ts +1 -1
- package/dist/components/IDE/index.d.ts.map +1 -1
- package/dist/components/IDE/index.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts +13 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +218 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts +8 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +218 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +42 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts +15 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +42 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.cjs +8 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.cjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.d.ts +3 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.d.ts.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.mjs +8 -0
- package/dist/components/LocaleSwitcherContentDropDown/index.mjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +118 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +18 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +119 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -0
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +14 -22
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +14 -22
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
- package/dist/components/MarkDownRender/index.cjs +20 -26
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.d.ts +2 -0
- package/dist/components/MarkDownRender/index.d.ts.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +20 -26
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +3 -3
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +3 -3
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +4 -0
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.d.ts.map +1 -1
- package/dist/components/SwitchSelector/index.mjs +5 -1
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/index.cjs +16 -4
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +15 -3
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +8 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +9 -2
- package/dist/hooks/intlayerAPIHooks.cjs +80 -5
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +12 -2
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +80 -5
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +1 -5
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +1 -5
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.cjs +4 -2
- package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.d.ts +4 -1
- package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
- package/dist/hooks/useGetAllDictionaries.mjs +4 -2
- package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +11 -2
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/hooks/usePersistedStore.cjs +17 -5
- package/dist/hooks/usePersistedStore.cjs.map +1 -1
- package/dist/hooks/usePersistedStore.d.ts.map +1 -1
- package/dist/hooks/usePersistedStore.mjs +17 -5
- package/dist/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/libs/intlayer-api/ai.cjs +33 -3
- package/dist/libs/intlayer-api/ai.cjs.map +1 -1
- package/dist/libs/intlayer-api/ai.d.ts +9 -3
- package/dist/libs/intlayer-api/ai.d.ts.map +1 -1
- package/dist/libs/intlayer-api/ai.mjs +33 -3
- package/dist/libs/intlayer-api/ai.mjs.map +1 -1
- package/dist/libs/intlayer-api/dictionary.cjs +2 -2
- package/dist/libs/intlayer-api/dictionary.cjs.map +1 -1
- package/dist/libs/intlayer-api/dictionary.d.ts +3 -3
- package/dist/libs/intlayer-api/dictionary.d.ts.map +1 -1
- package/dist/libs/intlayer-api/dictionary.mjs +2 -2
- package/dist/libs/intlayer-api/dictionary.mjs.map +1 -1
- package/dist/libs/intlayer-api/index.cjs +3 -1
- package/dist/libs/intlayer-api/index.cjs.map +1 -1
- package/dist/libs/intlayer-api/index.d.ts +22 -4
- package/dist/libs/intlayer-api/index.d.ts.map +1 -1
- package/dist/libs/intlayer-api/index.mjs +3 -1
- package/dist/libs/intlayer-api/index.mjs.map +1 -1
- package/dist/libs/intlayer-api/tag.cjs +52 -0
- package/dist/libs/intlayer-api/tag.cjs.map +1 -0
- package/dist/libs/intlayer-api/tag.d.ts +16 -0
- package/dist/libs/intlayer-api/tag.d.ts.map +1 -0
- package/dist/libs/intlayer-api/tag.mjs +52 -0
- package/dist/libs/intlayer-api/tag.mjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/package.json +13 -14
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const jsxRuntime = require("../../jsx-runtime-XHKiWCTo.cjs");
|
|
5
|
+
const client = require("@intlayer/config/client");
|
|
6
|
+
const core = require("@intlayer/core");
|
|
7
|
+
const Fuse = require("fuse.js");
|
|
8
|
+
const lucideReact = require("lucide-react");
|
|
9
|
+
const require$$0 = require("react");
|
|
10
|
+
const reactIntlayer = require("react-intlayer");
|
|
11
|
+
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
12
|
+
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
13
|
+
require("../../libs/intlayer-api/index.cjs");
|
|
14
|
+
require("../Toaster/Toast.cjs");
|
|
15
|
+
require("@intlayer/dictionaries-entry");
|
|
16
|
+
require("deepmerge");
|
|
17
|
+
const hooks_usePersistedStore = require("../../hooks/usePersistedStore.cjs");
|
|
18
|
+
const components_Button_Button = require("../Button/Button.cjs");
|
|
19
|
+
const components_Container_index = require("../Container/index.cjs");
|
|
20
|
+
const components_DropDown_index = require("../DropDown/index.cjs");
|
|
21
|
+
const components_Input_Input = require("../Input/Input.cjs");
|
|
22
|
+
require("../Input/InputPassword.cjs");
|
|
23
|
+
require("../Input/Checkbox.cjs");
|
|
24
|
+
const components_SwitchSelector_index = require("../SwitchSelector/index.cjs");
|
|
25
|
+
const components_LocaleSwitcherContentDropDown_localeSwitcher_content = require("./localeSwitcher.content.cjs");
|
|
26
|
+
const components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext = require("./LocaleSwitcherContentContext.cjs");
|
|
27
|
+
const DROPDOWN_IDENTIFIER = "locale-switcher-content";
|
|
28
|
+
const LocaleSwitcherContent = ({
|
|
29
|
+
panelProps,
|
|
30
|
+
isMultilingual = true
|
|
31
|
+
}) => {
|
|
32
|
+
const {
|
|
33
|
+
switchTo,
|
|
34
|
+
searchInput,
|
|
35
|
+
localeSwitcherLabel,
|
|
36
|
+
languageListLabel,
|
|
37
|
+
seeAllLocalesSwitch
|
|
38
|
+
} = reactIntlayer.useDictionary(components_LocaleSwitcherContentDropDown_localeSwitcher_content);
|
|
39
|
+
const inputRef = require$$0.useRef(null);
|
|
40
|
+
const { locale } = reactIntlayer.useLocale();
|
|
41
|
+
const { availableLocales, selectedLocales, setSelectedLocales } = components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.useLocaleSwitcherContent();
|
|
42
|
+
const multilingualAvailableLocales = require$$0.useMemo(
|
|
43
|
+
() => availableLocales.map((localeEl) => {
|
|
44
|
+
const englishName = core.getLocaleName(localeEl, client.Locales.ENGLISH);
|
|
45
|
+
const currentLocaleName = core.getLocaleName(localeEl, locale);
|
|
46
|
+
const ownLocaleName = core.getLocaleName(localeEl);
|
|
47
|
+
return {
|
|
48
|
+
locale: localeEl,
|
|
49
|
+
englishName,
|
|
50
|
+
currentLocaleName,
|
|
51
|
+
ownLocaleName
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
[availableLocales, locale]
|
|
55
|
+
);
|
|
56
|
+
const [results, setResults] = require$$0.useState(
|
|
57
|
+
multilingualAvailableLocales
|
|
58
|
+
);
|
|
59
|
+
const [seeAllLocales, setSeeAllLocales] = hooks_usePersistedStore.usePersistedStore(
|
|
60
|
+
"locale-content-selector-see-all-locales",
|
|
61
|
+
false
|
|
62
|
+
);
|
|
63
|
+
const fuse = require$$0.useMemo(() => {
|
|
64
|
+
const fuseOptions = {
|
|
65
|
+
keys: [
|
|
66
|
+
{ name: "ownLocaleName", weight: 0.4 },
|
|
67
|
+
{ name: "englishName", weight: 0.2 },
|
|
68
|
+
{ name: "currentLocaleName", weight: 0.2 },
|
|
69
|
+
{ name: "locale", weight: 0.2 }
|
|
70
|
+
],
|
|
71
|
+
threshold: 0.02
|
|
72
|
+
// Defines how fuzzy the matching should be (lower is more strict)
|
|
73
|
+
};
|
|
74
|
+
return new Fuse(multilingualAvailableLocales, fuseOptions);
|
|
75
|
+
}, [multilingualAvailableLocales]);
|
|
76
|
+
const handleSearch = require$$0.useCallback(
|
|
77
|
+
(searchQuery) => {
|
|
78
|
+
if (searchQuery) {
|
|
79
|
+
const searchResults = fuse.search(searchQuery).map((result) => result.item);
|
|
80
|
+
setResults(searchResults);
|
|
81
|
+
} else {
|
|
82
|
+
setResults(multilingualAvailableLocales);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
[fuse, multilingualAvailableLocales]
|
|
86
|
+
);
|
|
87
|
+
const handleClickLocale = (localeItem) => {
|
|
88
|
+
if (isMultilingual) {
|
|
89
|
+
if (selectedLocales.includes(localeItem)) {
|
|
90
|
+
if (selectedLocales.length > 1) {
|
|
91
|
+
setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
setSelectedLocales((prev) => [...prev, localeItem]);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
setSelectedLocales([localeItem]);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handleSeeAllLocales = (value) => {
|
|
101
|
+
setSeeAllLocales(value);
|
|
102
|
+
if (value) {
|
|
103
|
+
setSelectedLocales(availableLocales);
|
|
104
|
+
} else {
|
|
105
|
+
setSelectedLocales([locale]);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
className: "border-text text-text dark:border-text-dark dark:text-text-dark rounded-xl border transition-colors",
|
|
112
|
+
"aria-label": localeSwitcherLabel,
|
|
113
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(components_DropDown_index.DropDown, { identifier: DROPDOWN_IDENTIFIER, children: [
|
|
114
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(components_DropDown_index.DropDown.Trigger, { identifier: DROPDOWN_IDENTIFIER, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Globe, {}) }),
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.MoveVertical, { className: "w-5 self-center" })
|
|
117
|
+
] }) }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
119
|
+
components_DropDown_index.DropDown.Panel,
|
|
120
|
+
{
|
|
121
|
+
identifier: DROPDOWN_IDENTIFIER,
|
|
122
|
+
isOverable: true,
|
|
123
|
+
isFocusable: true,
|
|
124
|
+
className: "left-auto right-0",
|
|
125
|
+
...panelProps,
|
|
126
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
127
|
+
components_Container_index.Container,
|
|
128
|
+
{
|
|
129
|
+
className: "max-h-[80vh] min-w-28",
|
|
130
|
+
separator: "y",
|
|
131
|
+
role: "listbox",
|
|
132
|
+
transparency: "sm",
|
|
133
|
+
border: true,
|
|
134
|
+
roundedSize: "2xl",
|
|
135
|
+
borderColor: "text",
|
|
136
|
+
"aria-label": languageListLabel,
|
|
137
|
+
children: [
|
|
138
|
+
isMultilingual && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "m-auto p-2", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
139
|
+
components_SwitchSelector_index.SwitchSelector,
|
|
140
|
+
{
|
|
141
|
+
defaultValue: false,
|
|
142
|
+
onChange: handleSeeAllLocales,
|
|
143
|
+
color: "text",
|
|
144
|
+
size: "sm",
|
|
145
|
+
className: "!w-60",
|
|
146
|
+
choices: [
|
|
147
|
+
{
|
|
148
|
+
content: seeAllLocalesSwitch.true,
|
|
149
|
+
value: true
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
content: seeAllLocalesSwitch.false,
|
|
153
|
+
value: false
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
) }),
|
|
158
|
+
!(isMultilingual && seeAllLocales) && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
160
|
+
components_Input_Input.Input,
|
|
161
|
+
{
|
|
162
|
+
type: "search",
|
|
163
|
+
placeholder: searchInput.placeholder,
|
|
164
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
165
|
+
ref: inputRef
|
|
166
|
+
}
|
|
167
|
+
) }),
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("ol", { className: "divide-text/20 dark:divide-text-dark/20 divide-y divide-dashed overflow-y-auto p-1", children: results.map(
|
|
169
|
+
({
|
|
170
|
+
locale: localeItem,
|
|
171
|
+
currentLocaleName,
|
|
172
|
+
ownLocaleName
|
|
173
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("li", { className: "px-1.5 py-1", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
174
|
+
components_Button_Button.Button,
|
|
175
|
+
{
|
|
176
|
+
onClick: () => handleClickLocale(localeItem),
|
|
177
|
+
label: `${switchTo} ${currentLocaleName}`,
|
|
178
|
+
disabled: !(availableLocales ?? availableLocales).includes(
|
|
179
|
+
localeItem
|
|
180
|
+
),
|
|
181
|
+
isActive: selectedLocales.includes(localeItem),
|
|
182
|
+
variant: "hoverable",
|
|
183
|
+
color: "text",
|
|
184
|
+
isFullWidth: true,
|
|
185
|
+
textAlign: "left",
|
|
186
|
+
size: "sm",
|
|
187
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-between gap-3 px-2 py-1", children: [
|
|
188
|
+
isMultilingual && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "w-4", children: selectedLocales.includes(localeItem) && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Check, { className: "size-full" }) }),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1", children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-nowrap", children: [
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
192
|
+
"span",
|
|
193
|
+
{
|
|
194
|
+
dir: core.getHTMLTextDir(localeItem),
|
|
195
|
+
lang: localeItem,
|
|
196
|
+
children: ownLocaleName
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-neutral dark:text-neutral-dark text-xs", children: currentLocaleName })
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "text-neutral dark:text-neutral-dark text-sm", children: localeItem.toUpperCase() })
|
|
202
|
+
] })
|
|
203
|
+
] })
|
|
204
|
+
}
|
|
205
|
+
) }, localeItem)
|
|
206
|
+
) })
|
|
207
|
+
] })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] })
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
exports.LocaleSwitcherContent = LocaleSwitcherContent;
|
|
218
|
+
//# sourceMappingURL=LocaleSwitcherContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContent.cjs","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config/client';\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core';\nimport Fuse, { IFuseOptions } from 'fuse.js';\nimport { Check, Globe, MoveVertical } from 'lucide-react';\nimport { useCallback, useMemo, useRef, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { usePersistedStore } from '../../hooks';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\nimport { SwitchSelector } from '../SwitchSelector';\nimport localeSwitcherContent from './localeSwitcher.content';\nimport { useLocaleSwitcherContent } from './LocaleSwitcherContentContext';\n\nexport type LocaleSwitcherContentProps = {\n panelProps?: Omit<PanelProps, 'identifier'>;\n isMultilingual?: boolean;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher-content';\n\ntype MultilingualAvailableLocales = {\n locale: Locales;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcherContent: FC<LocaleSwitcherContentProps> = ({\n panelProps,\n isMultilingual = true,\n}) => {\n const {\n switchTo,\n searchInput,\n localeSwitcherLabel,\n languageListLabel,\n seeAllLocalesSwitch,\n } = useDictionary(localeSwitcherContent);\n const inputRef = useRef<HTMLInputElement>(null);\n const { locale } = useLocale();\n const { availableLocales, selectedLocales, setSelectedLocales } =\n useLocaleSwitcherContent();\n\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n availableLocales.map((localeEl) => {\n const englishName = getLocaleName(localeEl, Locales.ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [availableLocales, locale]\n );\n\n const [results, setResults] = useState<MultilingualAvailableLocales[]>(\n multilingualAvailableLocales\n );\n const [seeAllLocales, setSeeAllLocales] = usePersistedStore(\n 'locale-content-selector-see-all-locales',\n false\n );\n\n // Create a new Fuse instance with the options and documentation data\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02, // Defines how fuzzy the matching should be (lower is more strict)\n };\n\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n const handleSearch = useCallback(\n (searchQuery: string) => {\n if (searchQuery) {\n // Perform search on every input change\n const searchResults = fuse\n .search(searchQuery)\n .map((result) => result.item);\n setResults(searchResults);\n } else {\n setResults(multilingualAvailableLocales);\n }\n },\n [fuse, multilingualAvailableLocales]\n );\n\n const handleClickLocale = (localeItem: Locales) => {\n if (isMultilingual) {\n if (selectedLocales.includes(localeItem)) {\n if (selectedLocales.length > 1) {\n setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));\n }\n } else {\n setSelectedLocales((prev) => [...prev, localeItem]);\n }\n } else {\n setSelectedLocales([localeItem]);\n }\n };\n\n const handleSeeAllLocales = (value: boolean) => {\n setSeeAllLocales(value);\n if (value) {\n setSelectedLocales(availableLocales);\n } else {\n setSelectedLocales([locale]);\n }\n };\n\n return (\n <div\n className=\"border-text text-text dark:border-text-dark dark:text-text-dark rounded-xl border transition-colors\"\n aria-label={localeSwitcherLabel}\n >\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger identifier={DROPDOWN_IDENTIFIER}>\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"px-2 py-1\">\n <Globe />\n </div>\n <MoveVertical className=\"w-5 self-center\" />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n className=\"left-auto right-0\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[80vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"sm\"\n border\n roundedSize=\"2xl\"\n borderColor=\"text\"\n aria-label={languageListLabel}\n >\n {isMultilingual && (\n <div className=\"m-auto p-2\">\n <SwitchSelector\n defaultValue={false}\n onChange={handleSeeAllLocales}\n color=\"text\"\n size=\"sm\"\n className=\"!w-60\"\n choices={[\n {\n content: seeAllLocalesSwitch.true,\n value: true,\n },\n {\n content: seeAllLocalesSwitch.false,\n value: false,\n },\n ]}\n />\n </div>\n )}\n\n {!(isMultilingual && seeAllLocales) && (\n <>\n <div className=\"p-3\">\n <Input\n type=\"search\"\n placeholder={searchInput.placeholder}\n onChange={(e) => handleSearch(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-text/20 dark:divide-text-dark/20 divide-y divide-dashed overflow-y-auto p-1\">\n {results.map(\n ({\n locale: localeItem,\n currentLocaleName,\n ownLocaleName,\n }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => handleClickLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? availableLocales).includes(\n localeItem\n )\n }\n isActive={selectedLocales.includes(localeItem)}\n variant=\"hoverable\"\n color=\"text\"\n isFullWidth\n textAlign=\"left\"\n size=\"sm\"\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n {isMultilingual && (\n <div className=\"w-4\">\n {selectedLocales.includes(localeItem) && (\n <Check className=\"size-full\" />\n )}\n </div>\n )}\n <div className=\"flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n >\n {ownLocaleName}\n </span>\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </>\n )}\n </Container>\n </DropDown.Panel>\n </DropDown>\n </div>\n );\n};\n"],"names":["useDictionary","localeSwitcherContent","useRef","useLocale","useLocaleSwitcherContent","useMemo","getLocaleName","Locales","useState","usePersistedStore","useCallback","jsx","jsxs","DropDown","Globe","MoveVertical","Container","SwitchSelector","Fragment","Input","Button","Check","getHTMLTextDir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,sBAAsB;AASrB,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA,iBAAiB;AACnB,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { PanelProps } from '../DropDown';
|
|
3
|
+
export type LocaleSwitcherContentProps = {
|
|
4
|
+
panelProps?: Omit<PanelProps, 'identifier'>;
|
|
5
|
+
isMultilingual?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const LocaleSwitcherContent: FC<LocaleSwitcherContentProps>;
|
|
8
|
+
//# sourceMappingURL=LocaleSwitcherContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContent.d.ts","sourceRoot":"","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx"],"names":[],"mappings":"AAMA,OAAO,EAA0C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMxE,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAMxD,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAWF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAyNhE,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as jsxRuntimeExports } from "../../jsx-runtime-DaNGiM0W.js";
|
|
3
|
+
import { Locales } from "@intlayer/config/client";
|
|
4
|
+
import { getLocaleName, getHTMLTextDir } from "@intlayer/core";
|
|
5
|
+
import Fuse from "fuse.js";
|
|
6
|
+
import { Globe, MoveVertical, Check } from "lucide-react";
|
|
7
|
+
import { useRef, useMemo, useState, useCallback } from "react";
|
|
8
|
+
import { useDictionary, useLocale } from "react-intlayer";
|
|
9
|
+
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
10
|
+
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
11
|
+
import "../../libs/intlayer-api/index.mjs";
|
|
12
|
+
import "../Toaster/Toast.mjs";
|
|
13
|
+
import "@intlayer/dictionaries-entry";
|
|
14
|
+
import "deepmerge";
|
|
15
|
+
import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
|
|
16
|
+
import { Button } from "../Button/Button.mjs";
|
|
17
|
+
import { Container } from "../Container/index.mjs";
|
|
18
|
+
import { DropDown } from "../DropDown/index.mjs";
|
|
19
|
+
import { Input } from "../Input/Input.mjs";
|
|
20
|
+
import "../Input/InputPassword.mjs";
|
|
21
|
+
import "../Input/Checkbox.mjs";
|
|
22
|
+
import { SwitchSelector } from "../SwitchSelector/index.mjs";
|
|
23
|
+
import localeSwitcherContent from "./localeSwitcher.content.mjs";
|
|
24
|
+
import { useLocaleSwitcherContent } from "./LocaleSwitcherContentContext.mjs";
|
|
25
|
+
const DROPDOWN_IDENTIFIER = "locale-switcher-content";
|
|
26
|
+
const LocaleSwitcherContent = ({
|
|
27
|
+
panelProps,
|
|
28
|
+
isMultilingual = true
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
switchTo,
|
|
32
|
+
searchInput,
|
|
33
|
+
localeSwitcherLabel,
|
|
34
|
+
languageListLabel,
|
|
35
|
+
seeAllLocalesSwitch
|
|
36
|
+
} = useDictionary(localeSwitcherContent);
|
|
37
|
+
const inputRef = useRef(null);
|
|
38
|
+
const { locale } = useLocale();
|
|
39
|
+
const { availableLocales, selectedLocales, setSelectedLocales } = useLocaleSwitcherContent();
|
|
40
|
+
const multilingualAvailableLocales = useMemo(
|
|
41
|
+
() => availableLocales.map((localeEl) => {
|
|
42
|
+
const englishName = getLocaleName(localeEl, Locales.ENGLISH);
|
|
43
|
+
const currentLocaleName = getLocaleName(localeEl, locale);
|
|
44
|
+
const ownLocaleName = getLocaleName(localeEl);
|
|
45
|
+
return {
|
|
46
|
+
locale: localeEl,
|
|
47
|
+
englishName,
|
|
48
|
+
currentLocaleName,
|
|
49
|
+
ownLocaleName
|
|
50
|
+
};
|
|
51
|
+
}),
|
|
52
|
+
[availableLocales, locale]
|
|
53
|
+
);
|
|
54
|
+
const [results, setResults] = useState(
|
|
55
|
+
multilingualAvailableLocales
|
|
56
|
+
);
|
|
57
|
+
const [seeAllLocales, setSeeAllLocales] = usePersistedStore(
|
|
58
|
+
"locale-content-selector-see-all-locales",
|
|
59
|
+
false
|
|
60
|
+
);
|
|
61
|
+
const fuse = useMemo(() => {
|
|
62
|
+
const fuseOptions = {
|
|
63
|
+
keys: [
|
|
64
|
+
{ name: "ownLocaleName", weight: 0.4 },
|
|
65
|
+
{ name: "englishName", weight: 0.2 },
|
|
66
|
+
{ name: "currentLocaleName", weight: 0.2 },
|
|
67
|
+
{ name: "locale", weight: 0.2 }
|
|
68
|
+
],
|
|
69
|
+
threshold: 0.02
|
|
70
|
+
// Defines how fuzzy the matching should be (lower is more strict)
|
|
71
|
+
};
|
|
72
|
+
return new Fuse(multilingualAvailableLocales, fuseOptions);
|
|
73
|
+
}, [multilingualAvailableLocales]);
|
|
74
|
+
const handleSearch = useCallback(
|
|
75
|
+
(searchQuery) => {
|
|
76
|
+
if (searchQuery) {
|
|
77
|
+
const searchResults = fuse.search(searchQuery).map((result) => result.item);
|
|
78
|
+
setResults(searchResults);
|
|
79
|
+
} else {
|
|
80
|
+
setResults(multilingualAvailableLocales);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[fuse, multilingualAvailableLocales]
|
|
84
|
+
);
|
|
85
|
+
const handleClickLocale = (localeItem) => {
|
|
86
|
+
if (isMultilingual) {
|
|
87
|
+
if (selectedLocales.includes(localeItem)) {
|
|
88
|
+
if (selectedLocales.length > 1) {
|
|
89
|
+
setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
setSelectedLocales((prev) => [...prev, localeItem]);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
setSelectedLocales([localeItem]);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const handleSeeAllLocales = (value) => {
|
|
99
|
+
setSeeAllLocales(value);
|
|
100
|
+
if (value) {
|
|
101
|
+
setSelectedLocales(availableLocales);
|
|
102
|
+
} else {
|
|
103
|
+
setSelectedLocales([locale]);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: "border-text text-text dark:border-text-dark dark:text-text-dark rounded-xl border transition-colors",
|
|
110
|
+
"aria-label": localeSwitcherLabel,
|
|
111
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropDown, { identifier: DROPDOWN_IDENTIFIER, children: [
|
|
112
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropDown.Trigger, { identifier: DROPDOWN_IDENTIFIER, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
113
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Globe, {}) }),
|
|
114
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MoveVertical, { className: "w-5 self-center" })
|
|
115
|
+
] }) }),
|
|
116
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
117
|
+
DropDown.Panel,
|
|
118
|
+
{
|
|
119
|
+
identifier: DROPDOWN_IDENTIFIER,
|
|
120
|
+
isOverable: true,
|
|
121
|
+
isFocusable: true,
|
|
122
|
+
className: "left-auto right-0",
|
|
123
|
+
...panelProps,
|
|
124
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
125
|
+
Container,
|
|
126
|
+
{
|
|
127
|
+
className: "max-h-[80vh] min-w-28",
|
|
128
|
+
separator: "y",
|
|
129
|
+
role: "listbox",
|
|
130
|
+
transparency: "sm",
|
|
131
|
+
border: true,
|
|
132
|
+
roundedSize: "2xl",
|
|
133
|
+
borderColor: "text",
|
|
134
|
+
"aria-label": languageListLabel,
|
|
135
|
+
children: [
|
|
136
|
+
isMultilingual && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-auto p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
137
|
+
SwitchSelector,
|
|
138
|
+
{
|
|
139
|
+
defaultValue: false,
|
|
140
|
+
onChange: handleSeeAllLocales,
|
|
141
|
+
color: "text",
|
|
142
|
+
size: "sm",
|
|
143
|
+
className: "!w-60",
|
|
144
|
+
choices: [
|
|
145
|
+
{
|
|
146
|
+
content: seeAllLocalesSwitch.true,
|
|
147
|
+
value: true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
content: seeAllLocalesSwitch.false,
|
|
151
|
+
value: false
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
) }),
|
|
156
|
+
!(isMultilingual && seeAllLocales) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
157
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
158
|
+
Input,
|
|
159
|
+
{
|
|
160
|
+
type: "search",
|
|
161
|
+
placeholder: searchInput.placeholder,
|
|
162
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
163
|
+
ref: inputRef
|
|
164
|
+
}
|
|
165
|
+
) }),
|
|
166
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ol", { className: "divide-text/20 dark:divide-text-dark/20 divide-y divide-dashed overflow-y-auto p-1", children: results.map(
|
|
167
|
+
({
|
|
168
|
+
locale: localeItem,
|
|
169
|
+
currentLocaleName,
|
|
170
|
+
ownLocaleName
|
|
171
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: "px-1.5 py-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
172
|
+
Button,
|
|
173
|
+
{
|
|
174
|
+
onClick: () => handleClickLocale(localeItem),
|
|
175
|
+
label: `${switchTo} ${currentLocaleName}`,
|
|
176
|
+
disabled: !(availableLocales ?? availableLocales).includes(
|
|
177
|
+
localeItem
|
|
178
|
+
),
|
|
179
|
+
isActive: selectedLocales.includes(localeItem),
|
|
180
|
+
variant: "hoverable",
|
|
181
|
+
color: "text",
|
|
182
|
+
isFullWidth: true,
|
|
183
|
+
textAlign: "left",
|
|
184
|
+
size: "sm",
|
|
185
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-between gap-3 px-2 py-1", children: [
|
|
186
|
+
isMultilingual && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-4", children: selectedLocales.includes(localeItem) && /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "size-full" }) }),
|
|
187
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1", children: [
|
|
188
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-nowrap", children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
190
|
+
"span",
|
|
191
|
+
{
|
|
192
|
+
dir: getHTMLTextDir(localeItem),
|
|
193
|
+
lang: localeItem,
|
|
194
|
+
children: ownLocaleName
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-neutral dark:text-neutral-dark text-xs", children: currentLocaleName })
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-neutral dark:text-neutral-dark text-sm", children: localeItem.toUpperCase() })
|
|
200
|
+
] })
|
|
201
|
+
] })
|
|
202
|
+
}
|
|
203
|
+
) }, localeItem)
|
|
204
|
+
) })
|
|
205
|
+
] })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] })
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
export {
|
|
216
|
+
LocaleSwitcherContent
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=LocaleSwitcherContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContent.mjs","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config/client';\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core';\nimport Fuse, { IFuseOptions } from 'fuse.js';\nimport { Check, Globe, MoveVertical } from 'lucide-react';\nimport { useCallback, useMemo, useRef, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { usePersistedStore } from '../../hooks';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\nimport { SwitchSelector } from '../SwitchSelector';\nimport localeSwitcherContent from './localeSwitcher.content';\nimport { useLocaleSwitcherContent } from './LocaleSwitcherContentContext';\n\nexport type LocaleSwitcherContentProps = {\n panelProps?: Omit<PanelProps, 'identifier'>;\n isMultilingual?: boolean;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher-content';\n\ntype MultilingualAvailableLocales = {\n locale: Locales;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcherContent: FC<LocaleSwitcherContentProps> = ({\n panelProps,\n isMultilingual = true,\n}) => {\n const {\n switchTo,\n searchInput,\n localeSwitcherLabel,\n languageListLabel,\n seeAllLocalesSwitch,\n } = useDictionary(localeSwitcherContent);\n const inputRef = useRef<HTMLInputElement>(null);\n const { locale } = useLocale();\n const { availableLocales, selectedLocales, setSelectedLocales } =\n useLocaleSwitcherContent();\n\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n availableLocales.map((localeEl) => {\n const englishName = getLocaleName(localeEl, Locales.ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [availableLocales, locale]\n );\n\n const [results, setResults] = useState<MultilingualAvailableLocales[]>(\n multilingualAvailableLocales\n );\n const [seeAllLocales, setSeeAllLocales] = usePersistedStore(\n 'locale-content-selector-see-all-locales',\n false\n );\n\n // Create a new Fuse instance with the options and documentation data\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02, // Defines how fuzzy the matching should be (lower is more strict)\n };\n\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n const handleSearch = useCallback(\n (searchQuery: string) => {\n if (searchQuery) {\n // Perform search on every input change\n const searchResults = fuse\n .search(searchQuery)\n .map((result) => result.item);\n setResults(searchResults);\n } else {\n setResults(multilingualAvailableLocales);\n }\n },\n [fuse, multilingualAvailableLocales]\n );\n\n const handleClickLocale = (localeItem: Locales) => {\n if (isMultilingual) {\n if (selectedLocales.includes(localeItem)) {\n if (selectedLocales.length > 1) {\n setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));\n }\n } else {\n setSelectedLocales((prev) => [...prev, localeItem]);\n }\n } else {\n setSelectedLocales([localeItem]);\n }\n };\n\n const handleSeeAllLocales = (value: boolean) => {\n setSeeAllLocales(value);\n if (value) {\n setSelectedLocales(availableLocales);\n } else {\n setSelectedLocales([locale]);\n }\n };\n\n return (\n <div\n className=\"border-text text-text dark:border-text-dark dark:text-text-dark rounded-xl border transition-colors\"\n aria-label={localeSwitcherLabel}\n >\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger identifier={DROPDOWN_IDENTIFIER}>\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"px-2 py-1\">\n <Globe />\n </div>\n <MoveVertical className=\"w-5 self-center\" />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n className=\"left-auto right-0\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[80vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"sm\"\n border\n roundedSize=\"2xl\"\n borderColor=\"text\"\n aria-label={languageListLabel}\n >\n {isMultilingual && (\n <div className=\"m-auto p-2\">\n <SwitchSelector\n defaultValue={false}\n onChange={handleSeeAllLocales}\n color=\"text\"\n size=\"sm\"\n className=\"!w-60\"\n choices={[\n {\n content: seeAllLocalesSwitch.true,\n value: true,\n },\n {\n content: seeAllLocalesSwitch.false,\n value: false,\n },\n ]}\n />\n </div>\n )}\n\n {!(isMultilingual && seeAllLocales) && (\n <>\n <div className=\"p-3\">\n <Input\n type=\"search\"\n placeholder={searchInput.placeholder}\n onChange={(e) => handleSearch(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-text/20 dark:divide-text-dark/20 divide-y divide-dashed overflow-y-auto p-1\">\n {results.map(\n ({\n locale: localeItem,\n currentLocaleName,\n ownLocaleName,\n }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => handleClickLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? availableLocales).includes(\n localeItem\n )\n }\n isActive={selectedLocales.includes(localeItem)}\n variant=\"hoverable\"\n color=\"text\"\n isFullWidth\n textAlign=\"left\"\n size=\"sm\"\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n {isMultilingual && (\n <div className=\"w-4\">\n {selectedLocales.includes(localeItem) && (\n <Check className=\"size-full\" />\n )}\n </div>\n )}\n <div className=\"flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n >\n {ownLocaleName}\n </span>\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </>\n )}\n </Container>\n </DropDown.Panel>\n </DropDown>\n </div>\n );\n};\n"],"names":["jsx","jsxs","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,sBAAsB;AASrB,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA,iBAAiB;AACnB,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,qBAAqB;AACjC,QAAA,WAAW,OAAyB,IAAI;AACxC,QAAA,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,kBAAkB,iBAAiB,mBAAA,IACzC,yBAAyB;AAE3B,QAAM,+BAA+D;AAAA,IACnE,MACE,iBAAiB,IAAI,CAAC,aAAa;AACjC,YAAM,cAAc,cAAc,UAAU,QAAQ,OAAO;AACrD,YAAA,oBAAoB,cAAc,UAAU,MAAM;AAClD,YAAA,gBAAgB,cAAc,QAAQ;AACrC,aAAA;AAAA,QACL,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAAA,CACD;AAAA,IACH,CAAC,kBAAkB,MAAM;AAAA,EAC3B;AAEM,QAAA,CAAC,SAAS,UAAU,IAAI;AAAA,IAC5B;AAAA,EACF;AACM,QAAA,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAGM,QAAA,OA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,GACF;AAAA,oEACC,QAAK,EAAA,WAAU,+CACb,UAAA,WAAW,cACd,CAAA;AAAA,4BAAA,EACF,CAAA;AAAA,0BAAA,EACF,CAAA;AAAA,wBAAA;AAAA,2BAxC6B,UA0CjC;AAAA,oBAAA,EAGN,CAAA;AAAA,kBAAA,EACF,CAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA;AAAA,MACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const jsxRuntime = require("../../jsx-runtime-XHKiWCTo.cjs");
|
|
5
|
+
const require$$0 = require("react");
|
|
6
|
+
const reactIntlayer = require("react-intlayer");
|
|
7
|
+
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
8
|
+
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
9
|
+
require("../../libs/intlayer-api/index.cjs");
|
|
10
|
+
require("@intlayer/config/client");
|
|
11
|
+
require("../Toaster/Toast.cjs");
|
|
12
|
+
require("@intlayer/dictionaries-entry");
|
|
13
|
+
require("deepmerge");
|
|
14
|
+
const hooks_usePersistedStore = require("../../hooks/usePersistedStore.cjs");
|
|
15
|
+
const LocaleSwitcherContentContext = require$$0.createContext({
|
|
16
|
+
availableLocales: [],
|
|
17
|
+
selectedLocales: [],
|
|
18
|
+
setSelectedLocales: () => {
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const useLocaleSwitcherContent = () => require$$0.useContext(LocaleSwitcherContentContext);
|
|
22
|
+
const LocaleSwitcherContentProvider = ({ availableLocales, defaultSelectedLocales, children }) => {
|
|
23
|
+
const { locale } = reactIntlayer.useLocale();
|
|
24
|
+
const [selectedLocales, setSelectedLocales] = hooks_usePersistedStore.usePersistedStore(
|
|
25
|
+
"locale-content-selector-selected-locales",
|
|
26
|
+
defaultSelectedLocales ?? [locale]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
29
|
+
LocaleSwitcherContentContext.Provider,
|
|
30
|
+
{
|
|
31
|
+
value: {
|
|
32
|
+
availableLocales,
|
|
33
|
+
selectedLocales,
|
|
34
|
+
setSelectedLocales
|
|
35
|
+
},
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
exports.LocaleSwitcherContentProvider = LocaleSwitcherContentProvider;
|
|
41
|
+
exports.useLocaleSwitcherContent = useLocaleSwitcherContent;
|
|
42
|
+
//# sourceMappingURL=LocaleSwitcherContentContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContentContext.cjs","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from 'intlayer';\nimport {\n createContext,\n useContext,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n type FC,\n} from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useLocale } from 'react-intlayer';\nimport { usePersistedStore } from '../../hooks';\n\ntype LocaleSwitcherContentContextProps = {\n availableLocales: Locales[];\n selectedLocales: Locales[];\n setSelectedLocales: Dispatch<SetStateAction<Locales[]>>;\n};\n\nconst LocaleSwitcherContentContext =\n createContext<LocaleSwitcherContentContextProps>({\n availableLocales: [],\n selectedLocales: [],\n setSelectedLocales: () => {},\n });\n\nexport const useLocaleSwitcherContent = () =>\n useContext(LocaleSwitcherContentContext);\n\ntype LocaleSwitcherContentProviderProps = {\n availableLocales: Locales[];\n defaultSelectedLocales?: Locales[];\n};\n\nexport const LocaleSwitcherContentProvider: FC<\n PropsWithChildren<LocaleSwitcherContentProviderProps>\n> = ({ availableLocales, defaultSelectedLocales, children }) => {\n const { locale } = useLocale();\n\n const [selectedLocales, setSelectedLocales] = usePersistedStore<Locales[]>(\n 'locale-content-selector-selected-locales',\n defaultSelectedLocales ?? [locale]\n );\n\n return (\n <LocaleSwitcherContentContext.Provider\n value={{\n availableLocales,\n selectedLocales,\n setSelectedLocales,\n }}\n >\n {children}\n </LocaleSwitcherContentContext.Provider>\n );\n};\n"],"names":["createContext","useContext","useLocale","usePersistedStore","jsx"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,+BACJA,WAAAA,cAAiD;AAAA,EAC/C,kBAAkB,CAAC;AAAA,EACnB,iBAAiB,CAAC;AAAA,EAClB,oBAAoB,MAAM;AAAA,EAAA;AAC5B,CAAC;AAEU,MAAA,2BAA2B,MACtCC,WAAAA,WAAW,4BAA4B;AAOlC,MAAM,gCAET,CAAC,EAAE,kBAAkB,wBAAwB,eAAe;AACxD,QAAA,EAAE,OAAO,IAAIC,wBAAU;AAEvB,QAAA,CAAC,iBAAiB,kBAAkB,IAAIC,wBAAA;AAAA,IAC5C;AAAA,IACA,0BAA0B,CAAC,MAAM;AAAA,EACnC;AAGE,SAAAC,2BAAA,kBAAA;AAAA,IAAC,6BAA6B;AAAA,IAA7B;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA,IAAA;AAAA,EACH;AAEJ;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Locales } from 'intlayer';
|
|
2
|
+
import { Dispatch, PropsWithChildren, SetStateAction, FC } from 'react';
|
|
3
|
+
type LocaleSwitcherContentContextProps = {
|
|
4
|
+
availableLocales: Locales[];
|
|
5
|
+
selectedLocales: Locales[];
|
|
6
|
+
setSelectedLocales: Dispatch<SetStateAction<Locales[]>>;
|
|
7
|
+
};
|
|
8
|
+
export declare const useLocaleSwitcherContent: () => LocaleSwitcherContentContextProps;
|
|
9
|
+
type LocaleSwitcherContentProviderProps = {
|
|
10
|
+
availableLocales: Locales[];
|
|
11
|
+
defaultSelectedLocales?: Locales[];
|
|
12
|
+
};
|
|
13
|
+
export declare const LocaleSwitcherContentProvider: FC<PropsWithChildren<LocaleSwitcherContentProviderProps>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=LocaleSwitcherContentContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContentContext.d.ts","sourceRoot":"","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAKf,KAAK,iCAAiC,GAAG;IACvC,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,kBAAkB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;CACzD,CAAC;AASF,eAAO,MAAM,wBAAwB,yCACK,CAAC;AAE3C,KAAK,kCAAkC,GAAG;IACxC,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,EAAE,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAC5C,iBAAiB,CAAC,kCAAkC,CAAC,CAoBtD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as jsxRuntimeExports } from "../../jsx-runtime-DaNGiM0W.js";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { useLocale } from "react-intlayer";
|
|
5
|
+
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
6
|
+
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
7
|
+
import "../../libs/intlayer-api/index.mjs";
|
|
8
|
+
import "@intlayer/config/client";
|
|
9
|
+
import "../Toaster/Toast.mjs";
|
|
10
|
+
import "@intlayer/dictionaries-entry";
|
|
11
|
+
import "deepmerge";
|
|
12
|
+
import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
|
|
13
|
+
const LocaleSwitcherContentContext = createContext({
|
|
14
|
+
availableLocales: [],
|
|
15
|
+
selectedLocales: [],
|
|
16
|
+
setSelectedLocales: () => {
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const useLocaleSwitcherContent = () => useContext(LocaleSwitcherContentContext);
|
|
20
|
+
const LocaleSwitcherContentProvider = ({ availableLocales, defaultSelectedLocales, children }) => {
|
|
21
|
+
const { locale } = useLocale();
|
|
22
|
+
const [selectedLocales, setSelectedLocales] = usePersistedStore(
|
|
23
|
+
"locale-content-selector-selected-locales",
|
|
24
|
+
defaultSelectedLocales ?? [locale]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27
|
+
LocaleSwitcherContentContext.Provider,
|
|
28
|
+
{
|
|
29
|
+
value: {
|
|
30
|
+
availableLocales,
|
|
31
|
+
selectedLocales,
|
|
32
|
+
setSelectedLocales
|
|
33
|
+
},
|
|
34
|
+
children
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
LocaleSwitcherContentProvider,
|
|
40
|
+
useLocaleSwitcherContent
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=LocaleSwitcherContentContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleSwitcherContentContext.mjs","sources":["../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from 'intlayer';\nimport {\n createContext,\n useContext,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n type FC,\n} from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useLocale } from 'react-intlayer';\nimport { usePersistedStore } from '../../hooks';\n\ntype LocaleSwitcherContentContextProps = {\n availableLocales: Locales[];\n selectedLocales: Locales[];\n setSelectedLocales: Dispatch<SetStateAction<Locales[]>>;\n};\n\nconst LocaleSwitcherContentContext =\n createContext<LocaleSwitcherContentContextProps>({\n availableLocales: [],\n selectedLocales: [],\n setSelectedLocales: () => {},\n });\n\nexport const useLocaleSwitcherContent = () =>\n useContext(LocaleSwitcherContentContext);\n\ntype LocaleSwitcherContentProviderProps = {\n availableLocales: Locales[];\n defaultSelectedLocales?: Locales[];\n};\n\nexport const LocaleSwitcherContentProvider: FC<\n PropsWithChildren<LocaleSwitcherContentProviderProps>\n> = ({ availableLocales, defaultSelectedLocales, children }) => {\n const { locale } = useLocale();\n\n const [selectedLocales, setSelectedLocales] = usePersistedStore<Locales[]>(\n 'locale-content-selector-selected-locales',\n defaultSelectedLocales ?? [locale]\n );\n\n return (\n <LocaleSwitcherContentContext.Provider\n value={{\n availableLocales,\n selectedLocales,\n setSelectedLocales,\n }}\n >\n {children}\n </LocaleSwitcherContentContext.Provider>\n );\n};\n"],"names":["jsx"],"mappings":";;;;;;;;;;;;AAqBA,MAAM,+BACJ,cAAiD;AAAA,EAC/C,kBAAkB,CAAC;AAAA,EACnB,iBAAiB,CAAC;AAAA,EAClB,oBAAoB,MAAM;AAAA,EAAA;AAC5B,CAAC;AAEU,MAAA,2BAA2B,MACtC,WAAW,4BAA4B;AAOlC,MAAM,gCAET,CAAC,EAAE,kBAAkB,wBAAwB,eAAe;AACxD,QAAA,EAAE,OAAO,IAAI,UAAU;AAEvB,QAAA,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,IAC5C;AAAA,IACA,0BAA0B,CAAC,MAAM;AAAA,EACnC;AAGE,SAAAA,kCAAA;AAAA,IAAC,6BAA6B;AAAA,IAA7B;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|