diff --git a/custom-elements-manifest.config.js b/custom-elements-manifest.config.js index 3e33bc02..a434d675 100644 --- a/custom-elements-manifest.config.js +++ b/custom-elements-manifest.config.js @@ -38,6 +38,7 @@ export default { customElementsManifest.package = { name, description, version, author, homepage, license }; } }, + // Infer tag names because we no longer use @customElement decorators. { name: 'shoelace-infer-tag-names', @@ -66,6 +67,7 @@ export default { } } }, + // Parse custom jsDoc tags { name: 'shoelace-custom-tags', @@ -137,6 +139,7 @@ export default { } } }, + { name: 'shoelace-react-event-names', analyzePhase({ ts, node, moduleDoc }) { @@ -155,6 +158,7 @@ export default { } } }, + { name: 'shoelace-translate-module-paths', packageLinkPhase({ customElementsManifest }) { @@ -191,6 +195,7 @@ export default { }); } }, + // Generate custom VS Code data customElementVsCodePlugin({ outdir, @@ -202,6 +207,7 @@ export default { } ] }), + customElementJetBrainsPlugin({ outdir: './dist', excludeCss: true, diff --git a/docs/_includes/component.njk b/docs/_includes/component.njk index 8b087b89..e377e692 100644 --- a/docs/_includes/component.njk +++ b/docs/_includes/component.njk @@ -160,7 +160,7 @@ {% if prop.type.text %} - {{ prop.type.text | markdownInline | safe }} + {{ prop.type.text | trimPipes | markdownInline | safe }} {% else %} - {% endif %} @@ -211,7 +211,7 @@ {{ event.description | markdownInline | safe }} {% if event.type.text %} - {{ event.type.text }} + {{ event.type.text | trimPipes }} {% else %} - {% endif %} @@ -245,7 +245,7 @@ {% if method.parameters.length %} {% for param in method.parameters %} - {{ param.name }}: {{ param.type.text }}{% if not loop.last %},{% endif %} + {{ param.name }}: {{ param.type.text | trimPipes }}{% if not loop.last %},{% endif %} {% endfor %} {% else %} diff --git a/docs/eleventy.config.cjs b/docs/eleventy.config.cjs index 2377943f..4ca4cbd4 100644 --- a/docs/eleventy.config.cjs +++ b/docs/eleventy.config.cjs @@ -96,6 +96,12 @@ module.exports = function (eleventyConfig) { return shoelaceFlavoredMarkdown.renderInline(content); }); + // Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited. + // With Prettier 3, this means a leading pipe will exist if the line wraps. + eleventyConfig.addFilter('trimPipes', content => { + return typeof content === 'string' ? content.replace(/^(\s|\|)/g, '').replace(/(\s|\|)$/g, '') : content; + }); + eleventyConfig.addFilter('classNameToComponentName', className => { let name = capitalCase(className.replace(/^Sl/, '')); if (name === 'Qr Code') name = 'QR Code'; // manual override diff --git a/docs/pages/components/menu-item.md b/docs/pages/components/menu-item.md index ef80dfbb..b5098843 100644 --- a/docs/pages/components/menu-item.md +++ b/docs/pages/components/menu-item.md @@ -60,35 +60,6 @@ const App = () => ( ## Examples -### Disabled - -Add the `disabled` attribute to disable the menu item so it cannot be selected. - -```html:preview - - Option 1 - Option 2 - Option 3 - -``` - -{% raw %} - -```jsx:react -import SlMenu from '@shoelace-style/shoelace/dist/react/menu'; -import SlMenuItem from '@shoelace-style/shoelace/dist/react/menu-item'; - -const App = () => ( - - Option 1 - Option 2 - Option 3 - -); -``` - -{% endraw %} - ### Prefix & Suffix Add content to the start and end of menu items using the `prefix` and `suffix` slots. @@ -151,6 +122,64 @@ const App = () => ( {% endraw %} +### Disabled + +Add the `disabled` attribute to disable the menu item so it cannot be selected. + +```html:preview + + Option 1 + Option 2 + Option 3 + +``` + +{% raw %} + +```jsx:react +import SlMenu from '@shoelace-style/shoelace/dist/react/menu'; +import SlMenuItem from '@shoelace-style/shoelace/dist/react/menu-item'; + +const App = () => ( + + Option 1 + Option 2 + Option 3 + +); +``` + +{% endraw %} + +### Loading + +Use the `loading` attribute to indicate that a menu item is busy. Like a disabled menu item, clicks will be suppressed until the loading state is removed. + +```html:preview + + Option 1 + Option 2 + Option 3 + +``` + +{% raw %} + +```jsx:react +import SlMenu from '@shoelace-style/shoelace/dist/react/menu'; +import SlMenuItem from '@shoelace-style/shoelace/dist/react/menu-item'; + +const App = () => ( + + Option 1 + Option 2 + Option 3 + +); +``` + +{% endraw %} + ### Checkbox Menu Items Set the `type` attribute to `checkbox` to create a menu item that will toggle on and off when selected. You can use the `checked` attribute to set the initial state. diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index ad6ae558..67b420a0 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -14,10 +14,12 @@ New versions of Shoelace are released as-needed and generally occur when a criti ## Next +- Added the `loading` attribute and the `spinner` and `spinner__base` part to `` [#1700] - Fixed focus trapping not scrolling elements into view. [#1750] - Fixed more performance issues with focus trapping performance. [#1750] - Added the `hover-bridge` feature to `` to support better tooltip accessibility [#1734] - Fixed a bug in `` and `` that made it work differently from `` and `