The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
adjust styling on parameter placeholders (#71577)
Nick Fitzpatrickb56c33b6be7a
diff --git a/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Default.png b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Default.pngnew file mode 100644index 00000000000..cd59c9bfc4eBinary files /dev/null and b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Default.png differdiff --git a/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Long_Placeholder.png b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Long_Placeholder.pngnew file mode 100644index 00000000000..32eccaa03b6Binary files /dev/null and b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Long_Placeholder.png differdiff --git a/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Short_Placeholder.png b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Short_Placeholder.pngnew file mode 100644index 00000000000..f825695b130Binary files /dev/null and b/.loki/reference/chrome_laptop_Components_Parameters_ParameterValueWidget_Short_Placeholder.png differdiff --git a/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.tsx b/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.tsxindex 767d3c316fb..51135a5b26b 100644--- a/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.tsx+++ b/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.tsx@@ -47,7 +47,9 @@ function FormattedParameterValue({const formattingSettings = useSetting("custom-formatting");if (parameterHasNoDisplayValue(value)) {- return placeholder;+ return (+ <Ellipsified showTooltip={!isPopoverOpen}>{placeholder}</Ellipsified>+ );}const first = getValue(value);diff --git a/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.unit.spec.tsx b/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.unit.spec.tsxindex faee8710d25..a08cbd47b89 100644--- a/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.unit.spec.tsx+++ b/frontend/src/metabase/parameters/components/FormattedParameterValue/FormattedParameterValue.unit.spec.tsx@@ -62,6 +62,19 @@ describe("FormattedParameterValue", () => {expect(screen.getByText("B")).toBeInTheDocument();});+ it("should render the placeholder with truncation when there is no value", () => {+ setup({+ value: null as any,+ parameter: createMockParameter(),+ placeholder: "Filter this long column name",+ });++ const text = screen.getByText("Filter this long column name");+ expect(text).toBeInTheDocument();+ // Ellipsified renders a Mantine Text with truncate, which sets data-truncate+ expect(text).toHaveAttribute("data-truncate", "end");+ });+it("should translate boolean filter value", () => {setLocalization({headers: {diff --git a/frontend/src/metabase/parameters/components/ParameterValueWidget.stories.tsx b/frontend/src/metabase/parameters/components/ParameterValueWidget.stories.tsxindex 7752480f1b8..41235f5274e 100644--- a/frontend/src/metabase/parameters/components/ParameterValueWidget.stories.tsx+++ b/frontend/src/metabase/parameters/components/ParameterValueWidget.stories.tsx@@ -56,3 +56,36 @@ export const Default = {asyncCallback();},};++export const ShortPlaceholder = {+ render: Template,++ args: {+ value: null,+ parameter: createMockParameter({ id: "test-field", type: "string" }),+ placeholder: "String",+ },+};++export const LongPlaceholder = {+ render: Template,++ args: {+ value: null,+ parameter: createMockParameter({ id: "test-field", type: "string" }),+ placeholder: "Longggg String Longggg String Longggg String",+ },++ play: async ({ canvasElement }: { canvasElement: HTMLCanvasElement }) => {+ const asyncCallback = createAsyncCallback();+ const canvas = within(canvasElement);++ // To force the tooltip to show up+ await userEvent.hover(+ (await canvas.findByText("Longggg String Longggg String Longggg String"))+ .parentElement!,+ );++ asyncCallback();+ },+};diff --git a/frontend/src/metabase/parameters/components/ParameterValueWidget.tsx b/frontend/src/metabase/parameters/components/ParameterValueWidget.tsxindex 53695840c20..6fe33491f32 100644--- a/frontend/src/metabase/parameters/components/ParameterValueWidget.tsx+++ b/frontend/src/metabase/parameters/components/ParameterValueWidget.tsx@@ -271,7 +271,7 @@ export const ParameterValueWidget = ({className={CS.mr1}style={isStringParameter(parameter)- ? { maxWidth: "190px" }+ ? { maxWidth: "190px", overflow: "hidden" }: {overflow: "hidden",textOverflow: "ellipsis",diff --git a/loki.config.js b/loki.config.jsindex d64b3d5cb1d..78c8fb5ecd7 100644--- a/loki.config.js+++ b/loki.config.js@@ -19,6 +19,7 @@ module.exports = {"^App/Palette","^EmbeddingSDK/SdkQuestion/ChartTypeDropdownInner","^viz/GridMapPdfExport",+ "ParameterValueWidget",].join("|"),configurations: {"chrome.laptop": {