Page MenuHomePhabricator

[WtC-M3] [QB] Port QuantityInput to Query Builder
Open, Needs TriagePublic

Description

Problem

The QuantityInput component was implemented in WiKit to fulfill the Query builder use case. This input type is quite specific to Wikibase, so Codex won't include it as a core element available for all projects.

Solution

In order to unblock the migration to Codex and the deprecation of WiKit, we'll port the WiKit QuantityInput component to the Query Builder repository. We'll apply all necessary changes to make the element compatible with the new version of the tool.

Considerations
  • Styles: In order to unblock WiKit's deprecation, we should also replace all WiKit tokens used currently to style the QuantityInput by Codex's tokens. Find the replaced styles and discrete values below:
<style lang="scss">
.wikit-QuantityInput {
	&__input-wrapper {
		display: flex;
		align-items: baseline;
	}

	&__number-input {
		flex: 1 1 50%;

		&.wikit-Input {
			border-start-end-radius: $border-radius-sharp;
			border-end-end-radius: $border-radius-sharp;
		}
	}

	&__unit-lookup {
		flex: 1 1 50%;

		.wikit-Input {
			border-start-start-radius: $border-radius-sharp;
			border-end-start-radius: $border-radius-sharp;
		}
	}

	&__label-wrapper {
		display: flex;
		gap: $spacing-50;
	}

	&__label {
		@include Label(block);
	}
}
</style>
Acceptance criteria
  • The WiKit QuantityInput is ported to Query builder and made compatible with the migrated version of the tool
  • We apply the necessary visual adjustments to make the component consistent with Codex input fields
  • Any WiKit building blocks, dependencies or styles are replaced

Details

Event Timeline

This task will require design validation.
No visual changes were applied to the Quantity input component itself. Instead, we need to ensure that the ported complex component reflects the changes applied to its building blocks, as specified in every individual subtask:

Change #1098550 had a related patch set uploaded (by Hasan Akgün (WMDE); author: Hasan Akgün (WMDE)):

[wikidata/query-builder@master] Port Wikit Quantity Input component to QB

https://gerrit.wikimedia.org/r/1098550

Change #1098550 merged by jenkins-bot:

[wikidata/query-builder@master] Port Wikit Quantity Input component to QB

https://gerrit.wikimedia.org/r/1098550

Could you please provide me with a netlify link so that i can review the changes?

All looks good except that the date input prompt ("please enter a date") is still showing after having entered a date

image.png (388×716 px, 34 KB)

one other thing i noticed: in the new version malformed values get deleted from the input automatically and sometimes valid input (especially after inputting a malformed value) also gets deleted while the input extender still displays information as if the value were still there. I recorded a little gif of the behavior:

dateinput.gif (226×413 px, 94 KB)

(please click the image to animate the gif)
i am not manually deleting any values in the input field in the gif. this happens automatically