diff --git a/.changeset/angry-snails-repeat.md b/.changeset/angry-snails-repeat.md new file mode 100644 index 000000000..a48a0a08b --- /dev/null +++ b/.changeset/angry-snails-repeat.md @@ -0,0 +1,5 @@ +--- +'@lion/select-rich': patch +--- + +add workarround and todo for align select-rich invoker width with options if its inside an overlay diff --git a/.changeset/tiny-eyes-burn.md b/.changeset/tiny-eyes-burn.md new file mode 100644 index 000000000..ccfd10e6e --- /dev/null +++ b/.changeset/tiny-eyes-burn.md @@ -0,0 +1,5 @@ +--- +'@lion/button': patch +--- + +Set user-select to none on button, so that the inner text is not selectable. diff --git a/packages/button/src/LionButton.js b/packages/button/src/LionButton.js index 63804b1cd..326313353 100644 --- a/packages/button/src/LionButton.js +++ b/packages/button/src/LionButton.js @@ -61,6 +61,7 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement)) padding: 8px; /* padding to fix with min-height */ outline: none; /* focus style handled below */ cursor: default; /* /* we should always see the default arrow, never a caret */ + user-select: none; } :host::before { diff --git a/packages/form-integrations/docs/60-dialog-integration.md b/packages/form-integrations/docs/60-dialog-integration.md index 8f3150d86..04b1a5293 100644 --- a/packages/form-integrations/docs/60-dialog-integration.md +++ b/packages/form-integrations/docs/60-dialog-integration.md @@ -5,8 +5,8 @@ ```js script import { html } from '@lion/core'; import '@lion/dialog/lion-dialog.js'; +import '@lion/input-datepicker'; import '@lion/select-rich/lion-select-rich.js'; -import '@lion/listbox/lion-options.js'; import '@lion/listbox/lion-option.js'; export default { @@ -14,19 +14,19 @@ export default { }; ``` +## Select Rich + Opening a Rich Select inside a dialog ```js story -export const main = () => html` +export const selectRich = () => html`
- - Red - Hotpink - Teal - + Red + Hotpink + Teal +
+ + +
+ +`; +``` diff --git a/packages/select-rich/src/LionSelectInvoker.js b/packages/select-rich/src/LionSelectInvoker.js index 43b12a2fb..aa35bfb26 100644 --- a/packages/select-rich/src/LionSelectInvoker.js +++ b/packages/select-rich/src/LionSelectInvoker.js @@ -17,6 +17,7 @@ export class LionSelectInvoker extends LionButton { css` :host { justify-content: space-between; + align-items: center; } #content-wrapper { diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index c6fe48ace..b5bd8a403 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -388,7 +388,14 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L this._overlayCtrl.content.style.minWidth = 'auto'; this._overlayCtrl.content.style.width = 'auto'; const contentWidth = this._overlayCtrl.content.getBoundingClientRect().width; - this._invokerNode.style.width = `${contentWidth + this._arrowWidth}px`; + /** + * TODO when inside an overlay the current solution doesn't work. + * Since that dialog is still hidden, open and close the select-rich + * doesn't have any effect so the contentWidth returns 0 + */ + if (contentWidth > 0) { + this._invokerNode.style.width = `${contentWidth + this._arrowWidth}px`; + } this._overlayCtrl.content.style.display = initContentDisplay; this._overlayCtrl.content.style.minWidth = initContentMinWidth; this._overlayCtrl.content.style.width = initContentWidth;