diff --git a/apps/demo/src/Views/Ui/components/DropdownMenuDemo.tsx b/apps/demo/src/Views/Ui/components/DropdownMenuDemo.tsx index 58e23e80f..4586b6091 100644 --- a/apps/demo/src/Views/Ui/components/DropdownMenuDemo.tsx +++ b/apps/demo/src/Views/Ui/components/DropdownMenuDemo.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "@prefabs.tech/react-i18n"; -import { Button, DropdownMenu, Page } from "@prefabs.tech/react-ui"; +import { Button, DropdownMenu, Page, TDataTable } from "@prefabs.tech/react-ui"; import { useNavigate } from "react-router-dom"; import { CodeBlock, Section } from "../../../components/Demo"; @@ -51,6 +51,93 @@ export const DropdownMenuDemo = () => { ); }; + const propertiesData = [ + { + default: '""', + description: t("ui:dropdownMenu.propertiesDescription.className"), + id: 1, + prop: "className", + type: "string", + }, + { + default: "-", + description: t("ui:dropdownMenu.propertiesDescription.close"), + id: 2, + prop: "close", + type: "() => void", + }, + { + default: "false", + description: t("ui:dropdownMenu.propertiesDescription.hideDropdownIcon"), + id: 3, + prop: "hideDropdownIcon", + type: "boolean", + }, + { + default: "false", + description: t("ui:dropdownMenu.propertiesDescription.isControlled"), + id: 4, + prop: "isControlled", + type: "boolean", + }, + { + default: "false", + description: t("ui:dropdownMenu.propertiesDescription.isOpen"), + id: 5, + prop: "isOpen", + type: "boolean", + }, + { + default: "-", + description: t("ui:dropdownMenu.propertiesDescription.label"), + id: 6, + prop: "label", + type: "React.ReactNode", + }, + { + default: "[]", + description: t("ui:dropdownMenu.propertiesDescription.menu"), + id: 7, + prop: "menu", + type: "MenuItem[]", + }, + { + default: "0", + description: t("ui:dropdownMenu.propertiesDescription.offset"), + id: 8, + prop: "offset", + type: "number", + }, + { + default: '"bottom-start"', + description: t("ui:dropdownMenu.propertiesDescription.position"), + id: 9, + prop: "position", + type: "string", + }, + { + default: "-", + description: t("ui:dropdownMenu.propertiesDescription.renderOption"), + id: 10, + prop: "renderOption", + type: "(item: MenuItem) => React.ReactNode", + }, + { + default: "-", + description: t("ui:dropdownMenu.propertiesDescription.toggle"), + id: 11, + prop: "toggle", + type: "() => void", + }, + { + default: "Ellipsis Icon", + description: t("ui:dropdownMenu.propertiesDescription.trigger"), + id: 12, + prop: "trigger", + type: "React.ReactNode", + }, + ]; + return ( + +
+ +
); }; diff --git a/apps/demo/src/locales/en/ui.json b/apps/demo/src/locales/en/ui.json index 1db0a957c..7c94b13d4 100644 --- a/apps/demo/src/locales/en/ui.json +++ b/apps/demo/src/locales/en/ui.json @@ -201,6 +201,27 @@ } }, "dropdownMenu": { + "label": { + "delete": "Delete", + "edit": "Edit", + "setting": "Settings", + "user": "User", + "view": "View" + }, + "propertiesDescription": { + "className": "Style class of the component.", + "close": "Callback to close the menu programmatically.", + "hideDropdownIcon": "If true, hides the default arrow icon next to the label.", + "isControlled": "Determines if the menu state is controlled externally.", + "isOpen": "Specifies whether the menu is currently open.", + "label": "The label text or node to display on the trigger button.", + "menu": "An array of menu items to display.", + "offset": "The offset distance from the trigger element.", + "position": "Position of the menu relative to the trigger (e.g., 'bottom-start').", + "renderOption": "Function to customize the rendering of menu items.", + "toggle": "Callback to toggle the menu visibility.", + "trigger": "Custom element to use as the menu trigger instead of the default button." + }, "subtitle": "The Dropdown component provides an accessible and customizable menu for selecting actions or options. It supports labels, icons, slots for custom triggers and icons, and emits events on selection.", "title": "Dropdown menu", "usage": { @@ -208,13 +229,6 @@ "leftAlign": "Popup align left", "severity": "Severity", "templating": "Menu templating" - }, - "label": { - "delete": "Delete", - "edit": "Edit", - "setting": "Settings", - "user": "User", - "view": "View" } }, "editableTitle": { diff --git a/apps/demo/src/locales/fr/ui.json b/apps/demo/src/locales/fr/ui.json index 8b8a65ba4..4eff6d6c1 100644 --- a/apps/demo/src/locales/fr/ui.json +++ b/apps/demo/src/locales/fr/ui.json @@ -114,7 +114,7 @@ "label": "Label (fr)", "locale": "Locales support (fr)", "notFound": "Missing country code (fr)", - "positions": { + "positions": { "left": "Left (default) (fr)", "right": "Right (fr)", "rightEdge": "Right edge (fr)" @@ -165,7 +165,7 @@ "single": "Select a country... (fr)" }, "propertiesDescription": { - "autoSortOptions":"By default, options are sorted alphabetically. If false, countries are sorted by priority in the order groups → favorites → include → fallback-locale translations, preserving the defined order. (fr)", + "autoSortOptions": "By default, options are sorted alphabetically. If false, countries are sorted by priority in the order groups → favorites → include → fallback-locale translations, preserving the defined order. (fr)", "data": "Custom country data to overwrite existing entries or add new ones. (fr)", "exclude": "An array of country codes to remove from the list. (fr)", "fallbackLocale": "Locale used when active locale translation is missing. (fr)", @@ -201,20 +201,34 @@ } }, "dropdownMenu": { - "subtitle": "The Dropdown component provides an accessible and customizable menu for selecting actions or options. It supports labels, icons, slots for custom triggers and icons, and emits events on selection (fr).", - "title": "Dropdown menu (fr)", - "usage": { - "hiddenDropdownIcon": "Hidden dropdown icon with default label (fr)", - "leftAlign": "Popup align left (fr)", - "severity": "Severity (fr)", - "templating": "Menu templating (fr)" - }, "label": { "delete": "Delete (fr)", "edit": "Edit (fr)", "setting": "Settings (fr)", "user": "User (fr)", "view": "View (fr)" + }, + "propertiesDescription": { + "className": "Style class of the component. (fr)", + "close": "Callback to close the menu programmatically. (fr)", + "hideDropdownIcon": "If true, hides the default arrow icon next to the label. (fr)", + "isControlled": "Determines if the menu state is controlled externally. (fr)", + "isOpen": "Specifies whether the menu is currently open. (fr)", + "label": "The label text or node to display on the trigger button. (fr)", + "menu": "An array of menu items to display. (fr)", + "offset": "The offset distance from the trigger element. (fr)", + "position": "Position of the menu relative to the trigger (e.g., 'bottom-start'). (fr)", + "renderOption": "Function to customize the rendering of menu items. (fr)", + "toggle": "Callback to toggle the menu visibility. (fr)", + "trigger": "Custom element to use as the menu trigger instead of the default button. (fr)" + }, + "subtitle": "The Dropdown component provides an accessible and customizable menu for selecting actions or options. It supports labels, icons, slots for custom triggers and icons, and emits events on selection. (fr)", + "title": "Dropdown menu (fr)", + "usage": { + "hiddenDropdownIcon": "Hidden dropdown icon with default label (fr)", + "leftAlign": "Popup align left (fr)", + "severity": "Severity (fr)", + "templating": "Menu templating (fr)" } }, "editableTitle": {