@recursica/adapter-mui-v7 1.0.0
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/.storybook/commonArgTypes.ts +148 -0
- package/ARCHITECTURE.md +18 -0
- package/CHANGELOG.md +582 -0
- package/LICENSE +21 -0
- package/OVERSTYLING.md +59 -0
- package/README.md +70 -0
- package/SETUP.md +92 -0
- package/USAGE.md +57 -0
- package/dist/adapter-mui-v7.cjs +292 -0
- package/dist/adapter-mui-v7.cjs.map +1 -0
- package/dist/adapter-mui-v7.css +1 -0
- package/dist/adapter-mui-v7.js +40757 -0
- package/dist/adapter-mui-v7.js.map +1 -0
- package/dist/index.d.ts +2350 -0
- package/dist/vite.svg +1 -0
- package/docs/PHILOSOPHY.md +39 -0
- package/llms.txt +76 -0
- package/package.json +151 -0
- package/recursica_brand.json +2677 -0
- package/recursica_tokens.json +799 -0
- package/recursica_ui-kit.json +14981 -0
- package/recursica_variables_scoped.css +30489 -0
- package/src/GlobalExemptions.modules.css +7 -0
- package/src/Introduction.stories.tsx +184 -0
- package/src/OverStyling.tsx +87 -0
- package/src/Version.tsx +37 -0
- package/src/components/Accordion/ACCORDION_IMPLEMENTATION_NOTES.md +107 -0
- package/src/components/Accordion/Accordion.module.css +362 -0
- package/src/components/Accordion/Accordion.stories.tsx +198 -0
- package/src/components/Accordion/Accordion.test.tsx +1 -0
- package/src/components/Accordion/Accordion.tsx +285 -0
- package/src/components/Accordion/USAGE.md +43 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/AssistiveElement/ASSISTIVEELEMENT_IMPLEMENTATION_NOTES.md +59 -0
- package/src/components/AssistiveElement/AssistiveElement.module.css +121 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +68 -0
- package/src/components/AssistiveElement/AssistiveElement.test.tsx +1 -0
- package/src/components/AssistiveElement/AssistiveElement.tsx +94 -0
- package/src/components/AssistiveElement/USAGE.md +36 -0
- package/src/components/AssistiveElement/index.ts +1 -0
- package/src/components/AutoComplete/AutoComplete.module.css +456 -0
- package/src/components/AutoComplete/AutoComplete.stories.tsx +336 -0
- package/src/components/AutoComplete/AutoComplete.test.tsx +1 -0
- package/src/components/AutoComplete/AutoComplete.tsx +266 -0
- package/src/components/AutoComplete/IMPLEMENTATION_NOTES.md +37 -0
- package/src/components/AutoComplete/USAGE.md +68 -0
- package/src/components/AutoComplete/index.ts +1 -0
- package/src/components/Avatar/AVATAR_IMPLEMENTATION_NOTES.md +36 -0
- package/src/components/Avatar/Avatar.module.css +336 -0
- package/src/components/Avatar/Avatar.stories.tsx +92 -0
- package/src/components/Avatar/Avatar.test.tsx +1 -0
- package/src/components/Avatar/Avatar.tsx +88 -0
- package/src/components/Avatar/USAGE.md +38 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/Badge.module.css +115 -0
- package/src/components/Badge/Badge.stories.tsx +78 -0
- package/src/components/Badge/Badge.test.tsx +1 -0
- package/src/components/Badge/Badge.tsx +61 -0
- package/src/components/Badge/USAGE.md +40 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Breadcrumb/BREADCRUMB_IMPLEMENTATION_NOTES.md +51 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +51 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +114 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +1 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +70 -0
- package/src/components/Breadcrumb/USAGE.md +42 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Button/BUTTON_IMPLEMENTATION_NOTES.md +123 -0
- package/src/components/Button/Button.module.css +413 -0
- package/src/components/Button/Button.stories.tsx +196 -0
- package/src/components/Button/Button.styleIsolation.dom.test.tsx +98 -0
- package/src/components/Button/Button.tsx +156 -0
- package/src/components/Button/USAGE.md +46 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/CARD_IMPLEMENTATION_NOTES.md +15 -0
- package/src/components/Card/Card.module.css +155 -0
- package/src/components/Card/Card.stories.tsx +131 -0
- package/src/components/Card/Card.test.tsx +1 -0
- package/src/components/Card/Card.tsx +202 -0
- package/src/components/Card/USAGE.md +57 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Checkbox/CHECKBOX_IMPLEMENTATION_NOTES.md +14 -0
- package/src/components/Checkbox/Checkbox.module.css +286 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +97 -0
- package/src/components/Checkbox/Checkbox.test.tsx +1 -0
- package/src/components/Checkbox/Checkbox.tsx +259 -0
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +148 -0
- package/src/components/Checkbox/USAGE.md +36 -0
- package/src/components/Checkbox/index.ts +6 -0
- package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +102 -0
- package/src/components/Chip/Chip.module.css +283 -0
- package/src/components/Chip/Chip.stories.tsx +154 -0
- package/src/components/Chip/Chip.test.tsx +1 -0
- package/src/components/Chip/Chip.tsx +168 -0
- package/src/components/Chip/USAGE.md +55 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Container/Container.stories.tsx +118 -0
- package/src/components/Container/Container.test.tsx +1 -0
- package/src/components/Container/Container.tsx +51 -0
- package/src/components/Container/IMPLEMENTATION_NOTES.md +5 -0
- package/src/components/Container/USAGE.md +48 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/DatePicker/DATEPICKER_IMPLEMENTATION_NOTES.md +29 -0
- package/src/components/DatePicker/DatePicker.icons.tsx +35 -0
- package/src/components/DatePicker/DatePicker.module.css +464 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +163 -0
- package/src/components/DatePicker/DatePicker.test.tsx +1 -0
- package/src/components/DatePicker/DatePicker.tsx +229 -0
- package/src/components/DatePicker/USAGE.md +49 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/Dropdown/BareDropdown.tsx +168 -0
- package/src/components/Dropdown/DROPDOWN_IMPLEMENTATION_NOTES.md +45 -0
- package/src/components/Dropdown/Dropdown.icons.tsx +33 -0
- package/src/components/Dropdown/Dropdown.module.css +535 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +252 -0
- package/src/components/Dropdown/Dropdown.test.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +319 -0
- package/src/components/Dropdown/USAGE.md +68 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/FileInput/FILEINPUT_IMPLEMENTATION_NOTES.md +153 -0
- package/src/components/FileInput/FileInput.module.css +268 -0
- package/src/components/FileInput/FileInput.stories.tsx +313 -0
- package/src/components/FileInput/FileInput.test.tsx +1 -0
- package/src/components/FileInput/FileInput.tsx +415 -0
- package/src/components/FileInput/USAGE.md +145 -0
- package/src/components/FileInput/index.ts +1 -0
- package/src/components/FileUpload/FILEUPLOAD_IMPLEMENTATION_NOTES.md +249 -0
- package/src/components/FileUpload/FileUpload.module.css +200 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +362 -0
- package/src/components/FileUpload/FileUpload.test.tsx +1 -0
- package/src/components/FileUpload/FileUpload.tsx +352 -0
- package/src/components/FileUpload/USAGE.md +199 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/Flex/Flex.stories.tsx +128 -0
- package/src/components/Flex/Flex.test.tsx +1 -0
- package/src/components/Flex/Flex.tsx +89 -0
- package/src/components/Flex/USAGE.md +41 -0
- package/src/components/Flex/index.ts +1 -0
- package/src/components/FormControlLayout/FormControlLayout.module.css +92 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +118 -0
- package/src/components/FormControlLayout/FormControlLayout.test.tsx +1 -0
- package/src/components/FormControlLayout/FormControlLayout.tsx +72 -0
- package/src/components/FormControlLayout/USAGE.md +40 -0
- package/src/components/FormControlLayout/index.ts +1 -0
- package/src/components/FormControlWrapper/FORMCONTROLWRAPPER_IMPLEMENTATION_NOTES.md +35 -0
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +87 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +129 -0
- package/src/components/FormControlWrapper/FormControlWrapper.test.tsx +1 -0
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +149 -0
- package/src/components/FormControlWrapper/USAGE.md +40 -0
- package/src/components/FormControlWrapper/index.ts +1 -0
- package/src/components/Grid/Grid.module.css +72 -0
- package/src/components/Grid/Grid.stories.tsx +161 -0
- package/src/components/Grid/Grid.test.tsx +1 -0
- package/src/components/Grid/Grid.tsx +155 -0
- package/src/components/Grid/IMPLEMENTATION_NOTES.md +24 -0
- package/src/components/Grid/USAGE.md +53 -0
- package/src/components/Grid/index.ts +1 -0
- package/src/components/Group/Group.stories.tsx +120 -0
- package/src/components/Group/Group.test.tsx +1 -0
- package/src/components/Group/Group.tsx +116 -0
- package/src/components/Group/USAGE.md +41 -0
- package/src/components/Group/index.ts +1 -0
- package/src/components/Heading/Heading.stories.tsx +50 -0
- package/src/components/Heading/Heading.test.tsx +1 -0
- package/src/components/Heading/Heading.tsx +28 -0
- package/src/components/Heading/USAGE.md +36 -0
- package/src/components/Heading/index.ts +1 -0
- package/src/components/HoverCard/HoverCard.module.css +107 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +172 -0
- package/src/components/HoverCard/HoverCard.test.tsx +1 -0
- package/src/components/HoverCard/HoverCard.tsx +145 -0
- package/src/components/HoverCard/USAGE.md +45 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Label/LABEL_IMPLEMENTATION_NOTES.md +27 -0
- package/src/components/Label/Label.module.css +169 -0
- package/src/components/Label/Label.stories.tsx +131 -0
- package/src/components/Label/Label.test.tsx +1 -0
- package/src/components/Label/Label.tsx +96 -0
- package/src/components/Label/USAGE.md +36 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Layer/USAGE.md +50 -0
- package/src/components/Link/LINK_IMPLEMENTATION_NOTES.md +9 -0
- package/src/components/Link/Link.module.css +105 -0
- package/src/components/Link/Link.stories.tsx +58 -0
- package/src/components/Link/Link.test.tsx +1 -0
- package/src/components/Link/Link.tsx +45 -0
- package/src/components/Link/USAGE.md +40 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/Loader/LOADER_IMPLEMENTATION_NOTES.md +25 -0
- package/src/components/Loader/Loader.animate.dom.test.tsx +72 -0
- package/src/components/Loader/Loader.module.css +175 -0
- package/src/components/Loader/Loader.stories.tsx +123 -0
- package/src/components/Loader/Loader.test.tsx +1 -0
- package/src/components/Loader/Loader.tsx +72 -0
- package/src/components/Loader/USAGE.md +42 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/Menu/IMPLEMENTATION_NOTES.md +5 -0
- package/src/components/Menu/Menu.module.css +283 -0
- package/src/components/Menu/Menu.stories.tsx +405 -0
- package/src/components/Menu/Menu.test.tsx +1 -0
- package/src/components/Menu/Menu.tsx +103 -0
- package/src/components/Menu/USAGE.md +53 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Modal/MODAL_IMPLEMENTATION_NOTES.md +31 -0
- package/src/components/Modal/Modal.module.css +302 -0
- package/src/components/Modal/Modal.stories.tsx +105 -0
- package/src/components/Modal/Modal.test.tsx +1 -0
- package/src/components/Modal/Modal.tsx +231 -0
- package/src/components/Modal/USAGE.md +40 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/NumberInput/NUMBER_INPUT_IMPLEMENTATION_NOTES.md +93 -0
- package/src/components/NumberInput/NumberInput.module.css +303 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +96 -0
- package/src/components/NumberInput/NumberInput.test.tsx +1 -0
- package/src/components/NumberInput/NumberInput.tsx +273 -0
- package/src/components/NumberInput/USAGE.md +36 -0
- package/src/components/NumberInput/index.ts +1 -0
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +40 -0
- package/src/components/Pagination/Pagination.icons.tsx +66 -0
- package/src/components/Pagination/Pagination.module.css +197 -0
- package/src/components/Pagination/Pagination.stories.tsx +48 -0
- package/src/components/Pagination/Pagination.test.tsx +1 -0
- package/src/components/Pagination/Pagination.tsx +123 -0
- package/src/components/Pagination/USAGE.md +36 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/Panel/PANEL_IMPLEMENTATION_NOTES.md +133 -0
- package/src/components/Panel/Panel.module.css +231 -0
- package/src/components/Panel/Panel.stories.tsx +227 -0
- package/src/components/Panel/Panel.test.tsx +1 -0
- package/src/components/Panel/Panel.tsx +186 -0
- package/src/components/Panel/USAGE.md +46 -0
- package/src/components/Panel/index.ts +1 -0
- package/src/components/Popover/IMPLEMENTATION_NOTES.md +22 -0
- package/src/components/Popover/Popover.module.css +118 -0
- package/src/components/Popover/Popover.stories.tsx +133 -0
- package/src/components/Popover/Popover.test.tsx +1 -0
- package/src/components/Popover/Popover.tsx +267 -0
- package/src/components/Popover/USAGE.md +69 -0
- package/src/components/Popover/index.ts +1 -0
- package/src/components/Radio/RADIO_IMPLEMENTATION_NOTES.md +12 -0
- package/src/components/Radio/Radio.module.css +247 -0
- package/src/components/Radio/Radio.stories.tsx +93 -0
- package/src/components/Radio/Radio.test.tsx +1 -0
- package/src/components/Radio/Radio.tsx +223 -0
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +122 -0
- package/src/components/Radio/USAGE.md +36 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +54 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +163 -0
- package/src/components/ReadOnlyField/ReadOnlyField.test.tsx +1 -0
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +108 -0
- package/src/components/ReadOnlyField/ReadOnlySwitchField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +48 -0
- package/src/components/ReadOnlyField/USAGE.md +36 -0
- package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +93 -0
- package/src/components/ReadOnlyField/index.ts +2 -0
- package/src/components/RecursicaThemeProvider/USAGE.md +60 -0
- package/src/components/SegmentedControl/IMPLEMENTATION_NOTES.md +14 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +201 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +106 -0
- package/src/components/SegmentedControl/SegmentedControl.test.tsx +1 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +149 -0
- package/src/components/SegmentedControl/USAGE.md +49 -0
- package/src/components/SegmentedControl/index.ts +1 -0
- package/src/components/Slider/IMPLEMENTATION_NOTES.md +55 -0
- package/src/components/Slider/Slider.module.css +635 -0
- package/src/components/Slider/Slider.stories.tsx +282 -0
- package/src/components/Slider/Slider.test.tsx +1 -0
- package/src/components/Slider/Slider.tsx +435 -0
- package/src/components/Slider/USAGE.md +56 -0
- package/src/components/Slider/index.ts +1 -0
- package/src/components/Stack/Stack.stories.tsx +108 -0
- package/src/components/Stack/Stack.test.tsx +1 -0
- package/src/components/Stack/Stack.tsx +43 -0
- package/src/components/Stack/USAGE.md +41 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Stepper/IMPLEMENTATION_NOTES.md +120 -0
- package/src/components/Stepper/Stepper.module.css +474 -0
- package/src/components/Stepper/Stepper.stories.tsx +157 -0
- package/src/components/Stepper/Stepper.test.tsx +1 -0
- package/src/components/Stepper/Stepper.tsx +240 -0
- package/src/components/Stepper/USAGE.md +45 -0
- package/src/components/Stepper/index.ts +1 -0
- package/src/components/Switch/SWITCH_IMPLEMENTATION_NOTES.md +147 -0
- package/src/components/Switch/Switch.module.css +346 -0
- package/src/components/Switch/Switch.stories.tsx +114 -0
- package/src/components/Switch/Switch.test.tsx +1 -0
- package/src/components/Switch/Switch.tsx +294 -0
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +156 -0
- package/src/components/Switch/USAGE.md +36 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Table/TABLE_IMPLEMENTATION_NOTES.md +75 -0
- package/src/components/Table/Table.module.css +462 -0
- package/src/components/Table/Table.stories.tsx +154 -0
- package/src/components/Table/Table.test.tsx +1 -0
- package/src/components/Table/Table.tsx +250 -0
- package/src/components/Table/USAGE.md +90 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Tabs/IMPLEMENTATION_NOTES.md +76 -0
- package/src/components/Tabs/Tabs.module.css +801 -0
- package/src/components/Tabs/Tabs.stories.tsx +174 -0
- package/src/components/Tabs/Tabs.test.tsx +1 -0
- package/src/components/Tabs/Tabs.tsx +103 -0
- package/src/components/Tabs/USAGE.md +61 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Text/TEXT_IMPLEMENTATION_NOTES.md +10 -0
- package/src/components/Text/Text.stories.tsx +75 -0
- package/src/components/Text/Text.test.tsx +1 -0
- package/src/components/Text/Text.tsx +19 -0
- package/src/components/Text/USAGE.md +40 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/TextArea/TEXTAREA_IMPLEMENTATION_NOTES.md +42 -0
- package/src/components/TextArea/TextArea.module.css +203 -0
- package/src/components/TextArea/TextArea.stories.tsx +94 -0
- package/src/components/TextArea/TextArea.test.tsx +1 -0
- package/src/components/TextArea/TextArea.tsx +162 -0
- package/src/components/TextArea/USAGE.md +38 -0
- package/src/components/TextArea/index.ts +1 -0
- package/src/components/TextField/TextField.module.css +271 -0
- package/src/components/TextField/TextField.stories.tsx +162 -0
- package/src/components/TextField/TextField.test.tsx +1 -0
- package/src/components/TextField/TextField.tsx +182 -0
- package/src/components/TextField/USAGE.md +38 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TimePicker/TIMEPICKER_IMPLEMENTATION_NOTES.md +89 -0
- package/src/components/TimePicker/TimePicker.module.css +262 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +155 -0
- package/src/components/TimePicker/TimePicker.test.tsx +1 -0
- package/src/components/TimePicker/TimePicker.tsx +277 -0
- package/src/components/TimePicker/USAGE.md +61 -0
- package/src/components/TimePicker/index.ts +1 -0
- package/src/components/Timeline/IMPLEMENTATION_NOTES.md +42 -0
- package/src/components/Timeline/Timeline.module.css +363 -0
- package/src/components/Timeline/Timeline.stories.tsx +128 -0
- package/src/components/Timeline/Timeline.test.tsx +1 -0
- package/src/components/Timeline/Timeline.tsx +90 -0
- package/src/components/Timeline/TimelineItem.tsx +95 -0
- package/src/components/Timeline/USAGE.md +41 -0
- package/src/components/Timeline/index.ts +2 -0
- package/src/components/Toast/TOAST_IMPLEMENTATION_NOTES.md +37 -0
- package/src/components/Toast/Toast.module.css +193 -0
- package/src/components/Toast/Toast.stories.tsx +67 -0
- package/src/components/Toast/Toast.test.tsx +1 -0
- package/src/components/Toast/Toast.tsx +121 -0
- package/src/components/Toast/USAGE.md +42 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.module.css +83 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +165 -0
- package/src/components/Tooltip/Tooltip.test.tsx +1 -0
- package/src/components/Tooltip/Tooltip.tsx +78 -0
- package/src/components/Tooltip/USAGE.md +40 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/TransferList/TRANSFERLIST_IMPLEMENTATION_NOTES.md +140 -0
- package/src/components/TransferList/TransferList.module.css +174 -0
- package/src/components/TransferList/TransferList.stories.tsx +121 -0
- package/src/components/TransferList/TransferList.test.tsx +1 -0
- package/src/components/TransferList/TransferList.tsx +419 -0
- package/src/components/TransferList/USAGE.md +77 -0
- package/src/components/TransferList/index.ts +1 -0
- package/src/components/Tree/IMPLEMENTATION_NOTES.md +53 -0
- package/src/components/Tree/Tree.module.css +272 -0
- package/src/components/Tree/Tree.stories.tsx +104 -0
- package/src/components/Tree/Tree.test.tsx +1 -0
- package/src/components/Tree/Tree.tsx +298 -0
- package/src/components/Tree/USAGE.md +99 -0
- package/src/components/Tree/index.ts +1 -0
- package/src/components/Typography/TYPOGRAPHY_IMPLEMENTATION_NOTES.md +17 -0
- package/src/components/Typography/Typography.module.css +13 -0
- package/src/components/Typography/Typography.test.tsx +1 -0
- package/src/components/Typography/Typography.tsx +43 -0
- package/src/components/Typography/USAGE.md +40 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/index.ts +50 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +194 -0
- package/src/types/index.ts +9 -0
- package/src/types/scss-modules.d.ts +9 -0
- package/src/utils/ColorSchemeWrapper.tsx +23 -0
- package/src/utils/RequireAccessibleLabel.ts +1 -0
- package/src/utils/copyToClipboard.ts +36 -0
- package/src/utils/filterStylingProps.test.ts +85 -0
- package/src/utils/filterStylingProps.ts +143 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/renderRichOption.tsx +51 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/* Brand-layer exemptions (recursica-allow-brand) — see recursica-token-analyzer README.md.
|
|
2
|
+
* Global hover/focus/disabled state tokens (recursica_variables_scoped.css header, 'Hover & Focus states' / 'Disabled state' — implicit rule for every interactive element; components must not define their own per-component treatment).
|
|
3
|
+
* recursica-allow-brand: --recursica_brand_states_hover_color
|
|
4
|
+
* recursica-allow-brand: --recursica_brand_states_hover_opacity
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* HARDCODED VALUES:
|
|
8
|
+
- border-style: solid. Structural rendering rule for the dropdown border (Mantine uses Paper which may not set border natively).
|
|
9
|
+
- NOTE: overflow is intentionally NOT set on .dropdown. Mantine renders sub-menu dropdowns
|
|
10
|
+
inside the parent dropdown DOM tree using Floating UI absolute positioning. Setting
|
|
11
|
+
overflow: hidden clips sub-menus; overflow-y: auto causes unwanted scrollbars.
|
|
12
|
+
- All structural layout (flex, cursor, pointer-events on disabled) is deferred to Mantine's
|
|
13
|
+
native behavior. We only override visual design tokens (colors, typography, spacing, borders).
|
|
14
|
+
- Hover overlay: the schema no longer provides per-item hover-color/hover-opacity tokens; the
|
|
15
|
+
overlay now uses the generic --recursica_brand_states_hover_* tokens shared across components.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/* ======================================
|
|
19
|
+
DROPDOWN CONTAINER
|
|
20
|
+
====================================== */
|
|
21
|
+
|
|
22
|
+
.dropdown {
|
|
23
|
+
background-color: var(
|
|
24
|
+
--recursica_ui-kit_components_menu_properties_colors_background-color
|
|
25
|
+
);
|
|
26
|
+
border-style: solid; /* HARDCODE: Mantine Paper does not set border-style natively */
|
|
27
|
+
border-width: var(--recursica_ui-kit_components_menu_properties_border-size);
|
|
28
|
+
border-color: var(
|
|
29
|
+
--recursica_ui-kit_components_menu_properties_colors_border-color
|
|
30
|
+
);
|
|
31
|
+
border-radius: var(
|
|
32
|
+
--recursica_ui-kit_components_menu_properties_border-radius
|
|
33
|
+
);
|
|
34
|
+
box-shadow: var(--recursica_ui-kit_components_menu_properties_elevation);
|
|
35
|
+
|
|
36
|
+
min-width: var(--recursica_ui-kit_components_menu_properties_min-width);
|
|
37
|
+
max-height: var(--recursica_ui-kit_components_menu_properties_max-height);
|
|
38
|
+
max-width: var(--recursica_ui-kit_components_menu_properties_max-width);
|
|
39
|
+
padding: var(--recursica_ui-kit_components_menu_properties_padding);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* ======================================
|
|
43
|
+
MENU ITEM
|
|
44
|
+
====================================== */
|
|
45
|
+
|
|
46
|
+
.item {
|
|
47
|
+
position: relative;
|
|
48
|
+
|
|
49
|
+
/* Geometry */
|
|
50
|
+
padding: var(
|
|
51
|
+
--recursica_ui-kit_components_menu-item_properties_vertical-padding
|
|
52
|
+
)
|
|
53
|
+
var(--recursica_ui-kit_components_menu-item_properties_horizontal-padding);
|
|
54
|
+
border-radius: var(
|
|
55
|
+
--recursica_ui-kit_components_menu-item_properties_border-radius
|
|
56
|
+
);
|
|
57
|
+
margin-bottom: var(--recursica_ui-kit_components_menu_properties_item-gap);
|
|
58
|
+
|
|
59
|
+
/* Typography */
|
|
60
|
+
font-family: var(
|
|
61
|
+
--recursica_ui-kit_components_menu-item_properties_text_font-family
|
|
62
|
+
);
|
|
63
|
+
font-size: var(
|
|
64
|
+
--recursica_ui-kit_components_menu-item_properties_text_font-size
|
|
65
|
+
);
|
|
66
|
+
font-style: var(
|
|
67
|
+
--recursica_ui-kit_components_menu-item_properties_text_font-style
|
|
68
|
+
);
|
|
69
|
+
font-weight: var(
|
|
70
|
+
--recursica_ui-kit_components_menu-item_properties_text_font-weight
|
|
71
|
+
);
|
|
72
|
+
letter-spacing: var(
|
|
73
|
+
--recursica_ui-kit_components_menu-item_properties_text_letter-spacing
|
|
74
|
+
);
|
|
75
|
+
line-height: var(
|
|
76
|
+
--recursica_ui-kit_components_menu-item_properties_text_line-height
|
|
77
|
+
);
|
|
78
|
+
text-decoration: var(
|
|
79
|
+
--recursica_ui-kit_components_menu-item_properties_text_text-decoration
|
|
80
|
+
);
|
|
81
|
+
text-transform: var(
|
|
82
|
+
--recursica_ui-kit_components_menu-item_properties_text_text-transform
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
/* Default State: Unselected */
|
|
86
|
+
background-color: var(
|
|
87
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_background-color
|
|
88
|
+
);
|
|
89
|
+
color: var(
|
|
90
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_text-color
|
|
91
|
+
);
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
.item:last-of-type {
|
|
95
|
+
margin-bottom: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Override Mantine's native hover background to use our overlay technique */
|
|
99
|
+
.item:hover {
|
|
100
|
+
background-color: var(
|
|
101
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_background-color
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Hover overlay using ::after pseudo-element (same technique as Accordion); no per-item
|
|
106
|
+
hover-color/hover-opacity tokens exist anymore, so this uses the generic overlay tokens
|
|
107
|
+
uniformly regardless of selection state. */
|
|
108
|
+
.item::after {
|
|
109
|
+
content: "";
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset: 0;
|
|
112
|
+
border-radius: inherit;
|
|
113
|
+
z-index: 0;
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
background-color: var(--recursica_brand_states_hover_color);
|
|
116
|
+
opacity: 0;
|
|
117
|
+
transition: opacity 150ms ease;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.item:hover:not([data-disabled])::after {
|
|
121
|
+
opacity: var(--recursica_brand_states_hover_opacity);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Selected item state */
|
|
125
|
+
.item[data-selected] {
|
|
126
|
+
background-color: var(
|
|
127
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_selected_properties_colors_background-color
|
|
128
|
+
);
|
|
129
|
+
color: var(
|
|
130
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_selected_properties_colors_text-color
|
|
131
|
+
);
|
|
132
|
+
opacity: 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Hovered item state (keyboard navigation) */
|
|
136
|
+
.item[data-hovered] {
|
|
137
|
+
background-color: var(
|
|
138
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_background-color
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
.item[data-hovered]::after {
|
|
142
|
+
opacity: var(--recursica_brand_states_hover_opacity);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Disabled item (opacity differs depending on selection state) */
|
|
146
|
+
.item[data-disabled]:not([data-selected]) {
|
|
147
|
+
opacity: var(
|
|
148
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_variants_states_disabled_properties_opacity
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.item[data-disabled][data-selected] {
|
|
153
|
+
opacity: var(
|
|
154
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_selected_variants_states_disabled_properties_opacity
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* ======================================
|
|
159
|
+
ITEM LABEL
|
|
160
|
+
====================================== */
|
|
161
|
+
|
|
162
|
+
.itemLabel {
|
|
163
|
+
position: relative;
|
|
164
|
+
z-index: 1;
|
|
165
|
+
color: inherit;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* ======================================
|
|
169
|
+
ITEM SECTION (LEFT / RIGHT ICONS)
|
|
170
|
+
====================================== */
|
|
171
|
+
|
|
172
|
+
.itemSection {
|
|
173
|
+
position: relative;
|
|
174
|
+
z-index: 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.itemSection[data-position="left"] {
|
|
178
|
+
width: var(
|
|
179
|
+
--recursica_ui-kit_components_menu-item_properties_icon-leading-size
|
|
180
|
+
);
|
|
181
|
+
height: var(
|
|
182
|
+
--recursica_ui-kit_components_menu-item_properties_icon-leading-size
|
|
183
|
+
);
|
|
184
|
+
margin-right: var(
|
|
185
|
+
--recursica_ui-kit_components_menu-item_properties_icon-text-gap
|
|
186
|
+
);
|
|
187
|
+
color: var(
|
|
188
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_leading-icon-color
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.itemSection[data-position="right"] {
|
|
193
|
+
width: var(
|
|
194
|
+
--recursica_ui-kit_components_menu-item_properties_icon-trailing-size
|
|
195
|
+
);
|
|
196
|
+
height: var(
|
|
197
|
+
--recursica_ui-kit_components_menu-item_properties_icon-trailing-size
|
|
198
|
+
);
|
|
199
|
+
margin-left: var(--recursica_ui-kit_components_menu-item_properties_text-gap);
|
|
200
|
+
color: var(
|
|
201
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_trailing-icon-color
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.item[data-selected] .itemSection[data-position="left"] {
|
|
206
|
+
color: var(
|
|
207
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_selected_properties_colors_leading-icon-color
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.item[data-selected] .itemSection[data-position="right"] {
|
|
212
|
+
color: var(
|
|
213
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_selected_properties_colors_trailing-icon-color
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* ======================================
|
|
218
|
+
DIVIDER
|
|
219
|
+
====================================== */
|
|
220
|
+
|
|
221
|
+
.divider {
|
|
222
|
+
height: var(--recursica_ui-kit_components_menu_properties_divider-height);
|
|
223
|
+
background-color: var(
|
|
224
|
+
--recursica_ui-kit_components_menu_properties_colors_divider-color
|
|
225
|
+
);
|
|
226
|
+
opacity: var(--recursica_ui-kit_components_menu_properties_divider-opacity);
|
|
227
|
+
margin: 8px 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* ======================================
|
|
231
|
+
SECTION LABEL
|
|
232
|
+
====================================== */
|
|
233
|
+
|
|
234
|
+
.label {
|
|
235
|
+
padding: var(
|
|
236
|
+
--recursica_ui-kit_components_menu-item_properties_vertical-padding
|
|
237
|
+
)
|
|
238
|
+
var(--recursica_ui-kit_components_menu-item_properties_horizontal-padding);
|
|
239
|
+
|
|
240
|
+
/* Supporting Text Typography */
|
|
241
|
+
font-family: var(
|
|
242
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_font-family
|
|
243
|
+
);
|
|
244
|
+
font-size: var(
|
|
245
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_font-size
|
|
246
|
+
);
|
|
247
|
+
font-style: var(
|
|
248
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_font-style
|
|
249
|
+
);
|
|
250
|
+
font-weight: var(
|
|
251
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_font-weight
|
|
252
|
+
);
|
|
253
|
+
letter-spacing: var(
|
|
254
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_letter-spacing
|
|
255
|
+
);
|
|
256
|
+
line-height: var(
|
|
257
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_line-height
|
|
258
|
+
);
|
|
259
|
+
text-decoration: var(
|
|
260
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_text-decoration
|
|
261
|
+
);
|
|
262
|
+
text-transform: var(
|
|
263
|
+
--recursica_ui-kit_components_menu-item_properties_supporting-text_text-transform
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
color: var(
|
|
267
|
+
--recursica_ui-kit_components_menu-item_variants_selection-states_unselected_properties_colors_supporting-text-color
|
|
268
|
+
);
|
|
269
|
+
opacity: 0.7;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* ======================================
|
|
273
|
+
SUB-MENU CHEVRON
|
|
274
|
+
====================================== */
|
|
275
|
+
|
|
276
|
+
.chevron {
|
|
277
|
+
position: relative;
|
|
278
|
+
z-index: 1;
|
|
279
|
+
color: inherit;
|
|
280
|
+
/* HARDCODE: prevent the flex row from shrinking the chevron below its intrinsic 14px size
|
|
281
|
+
when the row is tight, which otherwise reads as the submenu indicator being clipped. */
|
|
282
|
+
flex-shrink: 0;
|
|
283
|
+
}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu story axes:
|
|
3
|
+
* - trigger: click (default) vs hover behavior
|
|
4
|
+
* - position: dropdown alignment relative to target
|
|
5
|
+
* - withArrow: arrow indicator on the dropdown
|
|
6
|
+
* - content variations: icons, dividers, labels, disabled items, submenus
|
|
7
|
+
* - layer: tested via the global Layer decorator (withLayer/layer args)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
11
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
12
|
+
import { Menu, MenuItem, MenuDivider } from "./Menu";
|
|
13
|
+
import { Button } from "../Button";
|
|
14
|
+
import { ListSubheader } from "@mui/material";
|
|
15
|
+
import styles from "./Menu.module.css";
|
|
16
|
+
|
|
17
|
+
const SettingsIcon = (props: React.ComponentProps<"svg">) => (
|
|
18
|
+
<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
width="14"
|
|
21
|
+
height="14"
|
|
22
|
+
viewBox="0 0 24 24"
|
|
23
|
+
fill="none"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
strokeWidth="2"
|
|
26
|
+
strokeLinecap="round"
|
|
27
|
+
strokeLinejoin="round"
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<circle cx="12" cy="12" r="3" />
|
|
31
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const SearchIcon = (props: React.ComponentProps<"svg">) => (
|
|
36
|
+
<svg
|
|
37
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
38
|
+
width="14"
|
|
39
|
+
height="14"
|
|
40
|
+
viewBox="0 0 24 24"
|
|
41
|
+
fill="none"
|
|
42
|
+
stroke="currentColor"
|
|
43
|
+
strokeWidth="2"
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<circle cx="11" cy="11" r="8" />
|
|
49
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const MessageIcon = (props: React.ComponentProps<"svg">) => (
|
|
54
|
+
<svg
|
|
55
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
56
|
+
width="14"
|
|
57
|
+
height="14"
|
|
58
|
+
viewBox="0 0 24 24"
|
|
59
|
+
fill="none"
|
|
60
|
+
stroke="currentColor"
|
|
61
|
+
strokeWidth="2"
|
|
62
|
+
strokeLinecap="round"
|
|
63
|
+
strokeLinejoin="round"
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
67
|
+
</svg>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const ImageIcon = (props: React.ComponentProps<"svg">) => (
|
|
71
|
+
<svg
|
|
72
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
73
|
+
width="14"
|
|
74
|
+
height="14"
|
|
75
|
+
viewBox="0 0 24 24"
|
|
76
|
+
fill="none"
|
|
77
|
+
stroke="currentColor"
|
|
78
|
+
strokeWidth="2"
|
|
79
|
+
strokeLinecap="round"
|
|
80
|
+
strokeLinejoin="round"
|
|
81
|
+
{...props}
|
|
82
|
+
>
|
|
83
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
|
84
|
+
<circle cx="8.5" cy="8.5" r="1.5" />
|
|
85
|
+
<polyline points="21 15 16 10 5 21" />
|
|
86
|
+
</svg>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const TrashIcon = (props: React.ComponentProps<"svg">) => (
|
|
90
|
+
<svg
|
|
91
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
92
|
+
width="14"
|
|
93
|
+
height="14"
|
|
94
|
+
viewBox="0 0 24 24"
|
|
95
|
+
fill="none"
|
|
96
|
+
stroke="currentColor"
|
|
97
|
+
strokeWidth="2"
|
|
98
|
+
strokeLinecap="round"
|
|
99
|
+
strokeLinejoin="round"
|
|
100
|
+
{...props}
|
|
101
|
+
>
|
|
102
|
+
<polyline points="3 6 5 6 21 6" />
|
|
103
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
104
|
+
</svg>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const ArrowsIcon = (props: React.ComponentProps<"svg">) => (
|
|
108
|
+
<svg
|
|
109
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
110
|
+
width="14"
|
|
111
|
+
height="14"
|
|
112
|
+
viewBox="0 0 24 24"
|
|
113
|
+
fill="none"
|
|
114
|
+
stroke="currentColor"
|
|
115
|
+
strokeWidth="2"
|
|
116
|
+
strokeLinecap="round"
|
|
117
|
+
strokeLinejoin="round"
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<polyline points="17 1 21 5 17 9" />
|
|
121
|
+
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
|
|
122
|
+
<polyline points="7 23 3 19 7 15" />
|
|
123
|
+
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
|
|
124
|
+
</svg>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const ChevronRightIcon = (props: React.ComponentProps<"svg">) => (
|
|
128
|
+
<svg
|
|
129
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
130
|
+
width="14"
|
|
131
|
+
height="14"
|
|
132
|
+
viewBox="0 0 24 24"
|
|
133
|
+
fill="none"
|
|
134
|
+
stroke="currentColor"
|
|
135
|
+
strokeWidth="2"
|
|
136
|
+
strokeLinecap="round"
|
|
137
|
+
strokeLinejoin="round"
|
|
138
|
+
{...props}
|
|
139
|
+
>
|
|
140
|
+
<polyline points="9 18 15 12 9 6" />
|
|
141
|
+
</svg>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// adapter-mui-v7's Menu is monolithic (see IMPLEMENTATION_NOTES.md) — there is no
|
|
145
|
+
// Menu.Sub composable, so a submenu is just a MenuItem that anchors its own
|
|
146
|
+
// nested Menu, mirroring how the top-level trigger manages its own anchorEl.
|
|
147
|
+
interface SubMenuTriggerProps {
|
|
148
|
+
label: string;
|
|
149
|
+
children: React.ReactNode;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const SubMenuTrigger = ({ label, children }: SubMenuTriggerProps) => {
|
|
153
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<>
|
|
157
|
+
<MenuItem onClick={(event) => setAnchorEl(event.currentTarget)}>
|
|
158
|
+
{label}
|
|
159
|
+
<ChevronRightIcon
|
|
160
|
+
className={styles.chevron}
|
|
161
|
+
style={{ marginLeft: "auto", paddingLeft: 8 }}
|
|
162
|
+
/>
|
|
163
|
+
</MenuItem>
|
|
164
|
+
<Menu
|
|
165
|
+
anchorEl={anchorEl}
|
|
166
|
+
open={Boolean(anchorEl)}
|
|
167
|
+
onClose={() => setAnchorEl(null)}
|
|
168
|
+
anchorOrigin={{ vertical: "top", horizontal: "right" }}
|
|
169
|
+
transformOrigin={{ vertical: "top", horizontal: "left" }}
|
|
170
|
+
>
|
|
171
|
+
{children}
|
|
172
|
+
</Menu>
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type MenuStoryArgs = Record<string, unknown>;
|
|
178
|
+
|
|
179
|
+
const meta: Meta = {
|
|
180
|
+
title: "UI-Kit/Menu",
|
|
181
|
+
component: Menu,
|
|
182
|
+
tags: ["autodocs"],
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default meta;
|
|
186
|
+
|
|
187
|
+
type Story = StoryObj<MenuStoryArgs>;
|
|
188
|
+
|
|
189
|
+
interface InteractiveMenuProps {
|
|
190
|
+
children?: React.ReactNode;
|
|
191
|
+
opened?: boolean;
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const InteractiveMenu = ({ children, ...args }: InteractiveMenuProps) => {
|
|
196
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
197
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
198
|
+
|
|
199
|
+
const open = Boolean(anchorEl) || Boolean(args.opened);
|
|
200
|
+
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (args.opened && buttonRef.current) {
|
|
203
|
+
setAnchorEl(buttonRef.current);
|
|
204
|
+
}
|
|
205
|
+
}, [args.opened]);
|
|
206
|
+
|
|
207
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
208
|
+
setAnchorEl(event.currentTarget);
|
|
209
|
+
};
|
|
210
|
+
const handleClose = () => {
|
|
211
|
+
setAnchorEl(null);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<div>
|
|
216
|
+
<Button ref={buttonRef} variant="solid" onClick={handleClick}>
|
|
217
|
+
Toggle Menu
|
|
218
|
+
</Button>
|
|
219
|
+
<Menu anchorEl={anchorEl} open={open} onClose={handleClose} {...args}>
|
|
220
|
+
{children}
|
|
221
|
+
</Menu>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const Default: Story = {
|
|
227
|
+
render: (args) => (
|
|
228
|
+
<InteractiveMenu {...args}>
|
|
229
|
+
<ListSubheader>Application</ListSubheader>
|
|
230
|
+
<MenuItem>
|
|
231
|
+
<SettingsIcon style={{ marginRight: 8 }} /> Settings
|
|
232
|
+
</MenuItem>
|
|
233
|
+
<MenuItem>
|
|
234
|
+
<MessageIcon style={{ marginRight: 8 }} /> Messages
|
|
235
|
+
</MenuItem>
|
|
236
|
+
<MenuItem>
|
|
237
|
+
<ImageIcon style={{ marginRight: 8 }} /> Gallery
|
|
238
|
+
</MenuItem>
|
|
239
|
+
<MenuItem>
|
|
240
|
+
<SearchIcon style={{ marginRight: 8 }} /> Search
|
|
241
|
+
</MenuItem>
|
|
242
|
+
<MenuDivider />
|
|
243
|
+
<ListSubheader>Danger zone</ListSubheader>
|
|
244
|
+
<MenuItem>
|
|
245
|
+
<ArrowsIcon style={{ marginRight: 8 }} /> Transfer my data
|
|
246
|
+
</MenuItem>
|
|
247
|
+
<MenuItem>
|
|
248
|
+
<TrashIcon style={{ marginRight: 8 }} /> Delete my account
|
|
249
|
+
</MenuItem>
|
|
250
|
+
</InteractiveMenu>
|
|
251
|
+
),
|
|
252
|
+
args: {
|
|
253
|
+
opened: true,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const WithDisabledItems: Story = {
|
|
258
|
+
render: (args) => (
|
|
259
|
+
<InteractiveMenu {...args}>
|
|
260
|
+
<MenuItem>
|
|
261
|
+
<SettingsIcon style={{ marginRight: 8 }} /> Settings
|
|
262
|
+
</MenuItem>
|
|
263
|
+
<MenuItem disabled>
|
|
264
|
+
<SearchIcon style={{ marginRight: 8 }} /> Search (disabled)
|
|
265
|
+
</MenuItem>
|
|
266
|
+
<MenuItem>
|
|
267
|
+
<MessageIcon style={{ marginRight: 8 }} /> Messages
|
|
268
|
+
</MenuItem>
|
|
269
|
+
<MenuItem disabled>
|
|
270
|
+
<TrashIcon style={{ marginRight: 8 }} /> Delete (disabled)
|
|
271
|
+
</MenuItem>
|
|
272
|
+
</InteractiveMenu>
|
|
273
|
+
),
|
|
274
|
+
args: {
|
|
275
|
+
opened: true,
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const WithSubmenus: Story = {
|
|
280
|
+
render: (args) => (
|
|
281
|
+
<InteractiveMenu {...args}>
|
|
282
|
+
<MenuItem>Dashboard</MenuItem>
|
|
283
|
+
<SubMenuTrigger label="Products">
|
|
284
|
+
<MenuItem>All products</MenuItem>
|
|
285
|
+
<MenuItem>Categories</MenuItem>
|
|
286
|
+
<MenuItem>Tags</MenuItem>
|
|
287
|
+
</SubMenuTrigger>
|
|
288
|
+
<SubMenuTrigger label="Orders">
|
|
289
|
+
<MenuItem>Open</MenuItem>
|
|
290
|
+
<MenuItem>Completed</MenuItem>
|
|
291
|
+
<MenuItem>Cancelled</MenuItem>
|
|
292
|
+
</SubMenuTrigger>
|
|
293
|
+
</InteractiveMenu>
|
|
294
|
+
),
|
|
295
|
+
args: {
|
|
296
|
+
opened: true,
|
|
297
|
+
// Match mantine's explicit `width: 200` for this story so the row has room for the
|
|
298
|
+
// "Products"/"Orders" label plus the submenu chevron without clipping it.
|
|
299
|
+
slotProps: { paper: { style: { minWidth: 200 } } },
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export const WithMaxHeight: Story = {
|
|
304
|
+
render: (args) => (
|
|
305
|
+
<InteractiveMenu {...args}>
|
|
306
|
+
<MenuItem>
|
|
307
|
+
<SettingsIcon style={{ marginRight: 8 }} /> Settings
|
|
308
|
+
</MenuItem>
|
|
309
|
+
<MenuItem>
|
|
310
|
+
<MessageIcon style={{ marginRight: 8 }} /> Messages
|
|
311
|
+
</MenuItem>
|
|
312
|
+
<MenuItem>
|
|
313
|
+
<ImageIcon style={{ marginRight: 8 }} /> Gallery
|
|
314
|
+
</MenuItem>
|
|
315
|
+
<MenuItem>
|
|
316
|
+
<SearchIcon style={{ marginRight: 8 }} /> Search
|
|
317
|
+
</MenuItem>
|
|
318
|
+
<MenuItem>
|
|
319
|
+
<ArrowsIcon style={{ marginRight: 8 }} /> Transfer my data
|
|
320
|
+
</MenuItem>
|
|
321
|
+
<MenuItem>
|
|
322
|
+
<TrashIcon style={{ marginRight: 8 }} /> Delete my account
|
|
323
|
+
</MenuItem>
|
|
324
|
+
</InteractiveMenu>
|
|
325
|
+
),
|
|
326
|
+
args: {
|
|
327
|
+
opened: true,
|
|
328
|
+
maxHeight: 160,
|
|
329
|
+
},
|
|
330
|
+
parameters: {
|
|
331
|
+
docs: {
|
|
332
|
+
description: {
|
|
333
|
+
story:
|
|
334
|
+
"`maxHeight` overrides the token-driven dropdown max-height with an explicit pixel value, scrolling the item list once it's exceeded.",
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// adapter-mui-v7's Menu has no native hover-trigger support (unlike Mantine's `trigger` prop),
|
|
341
|
+
// so this story implements open-on-hover itself: hovering the target opens the menu, and a
|
|
342
|
+
// short close delay (mirroring Mantine's `closeDelay`) keeps it open while the pointer moves
|
|
343
|
+
// from the target into the dropdown, since MUI's Menu renders in a portal outside the
|
|
344
|
+
// wrapper's DOM subtree.
|
|
345
|
+
const HoverMenu = ({ children, ...args }: InteractiveMenuProps) => {
|
|
346
|
+
const [open, setOpen] = useState(false);
|
|
347
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
348
|
+
const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
349
|
+
undefined,
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
const cancelClose = () => {
|
|
353
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
354
|
+
};
|
|
355
|
+
const scheduleClose = () => {
|
|
356
|
+
closeTimer.current = setTimeout(() => setOpen(false), 300);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<div>
|
|
361
|
+
<Button
|
|
362
|
+
ref={buttonRef}
|
|
363
|
+
variant="solid"
|
|
364
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
365
|
+
onMouseEnter={() => {
|
|
366
|
+
cancelClose();
|
|
367
|
+
setOpen(true);
|
|
368
|
+
}}
|
|
369
|
+
onMouseLeave={scheduleClose}
|
|
370
|
+
>
|
|
371
|
+
Hover or Click
|
|
372
|
+
</Button>
|
|
373
|
+
<Menu
|
|
374
|
+
{...args}
|
|
375
|
+
anchorEl={buttonRef.current}
|
|
376
|
+
open={open}
|
|
377
|
+
onClose={() => setOpen(false)}
|
|
378
|
+
slotProps={{
|
|
379
|
+
paper: {
|
|
380
|
+
onMouseEnter: cancelClose,
|
|
381
|
+
onMouseLeave: scheduleClose,
|
|
382
|
+
},
|
|
383
|
+
}}
|
|
384
|
+
>
|
|
385
|
+
{children}
|
|
386
|
+
</Menu>
|
|
387
|
+
</div>
|
|
388
|
+
);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const HoverTrigger: Story = {
|
|
392
|
+
render: (args) => (
|
|
393
|
+
<HoverMenu {...args}>
|
|
394
|
+
<MenuItem>
|
|
395
|
+
<SettingsIcon style={{ marginRight: 8 }} /> Settings
|
|
396
|
+
</MenuItem>
|
|
397
|
+
<MenuItem>
|
|
398
|
+
<MessageIcon style={{ marginRight: 8 }} /> Messages
|
|
399
|
+
</MenuItem>
|
|
400
|
+
<MenuItem>
|
|
401
|
+
<ImageIcon style={{ marginRight: 8 }} /> Gallery
|
|
402
|
+
</MenuItem>
|
|
403
|
+
</HoverMenu>
|
|
404
|
+
),
|
|
405
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Menu component tests. Add tests here if/when needed.
|