Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Numeric/tel keyboard for ui.textbox on mobile devices #2170 #2194

Merged
merged 8 commits into from
Nov 16, 2023

Conversation

marek-mihok
Copy link
Contributor

@marek-mihok marek-mihok commented Nov 15, 2023

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

Adds an option to specify keyboard type to be shown on mobile devices. One of 'text' | 'number' | 'tel'. Updated API:

export interface Textbox {
  /** An identifying name for this component. */
  name: Id
  /** The text displayed above the field. */
  label?: S
  /** A string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. */
  placeholder?: S
  /** Text to be displayed inside the text box. */
  value?: S
  /** The masking string that defines the mask's behavior. A backslash will escape any character. Special format characters are: '9': [0-9] 'a': [a-zA-Z] '*': [a-zA-Z0-9].*/
  mask?: S
  /** Icon displayed in the far right end of the text field. */
  icon?: S
  /** Text to be displayed before the text box contents. */
  prefix?: S
  /** Text to be displayed after the text box contents. */
  suffix?: S
  /** Text to be displayed as an error below the text box. */
  error?: S
  /** True if the text box is a required field. */
  required?: B
  /** True if the text box is disabled. */
  disabled?: B
  /** True if the text box is a read-only field. */
  readonly?: B
  /** True if the text box should allow multi-line text entry. */
  multiline?: B
  /** True if the text box should hide text content. */
  password?: B
  /** True if the form should be submitted when the text value changes. */
  trigger?: B
  /** The height of the text box, e.g. '100px'. Percentage values not supported. Applicable only if `multiline` is true. */
  height?: S
  /** The width of the text box, e.g. '100px'. Defaults to '100%'. */
  width?: S
  /** True if the component should be visible. Defaults to True. */
  visible?: B
  /** An optional tooltip message displayed when a user clicks the help icon to the right of the component. */
  tooltip?: S
  /** True if the text may be checked for spelling errors. Defaults to True. */
  spellcheck?: B
  /** Keyboard to be shown on mobile devices. Defaults to 'text'. */
  type?: 'text' | 'number' | 'tel'
}
Screen.Recording.2023-11-16.at.12.03.15.mov

Closes #2170

@marek-mihok marek-mihok marked this pull request as ready for review November 15, 2023 16:59
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marek-mihok.

ui/src/textbox.tsx Outdated Show resolved Hide resolved
ui/src/textbox.tsx Outdated Show resolved Hide resolved
ui/src/textbox.tsx Outdated Show resolved Hide resolved
website/widgets/form/textbox.md Outdated Show resolved Hide resolved
@marek-mihok marek-mihok requested a review from mturoci November 16, 2023 11:15
mturoci
mturoci previously approved these changes Nov 16, 2023
@mturoci
Copy link
Collaborator

mturoci commented Nov 16, 2023

LGTM. @marek-mihok please resolve the conflicts so we can merge this in.

@marek-mihok marek-mihok requested a review from mturoci November 16, 2023 12:37
@mturoci mturoci merged commit 9897c98 into main Nov 16, 2023
2 checks passed
@mturoci mturoci deleted the feat/issue-2170 branch November 16, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass a type hint with textboxes to enable keyboard switching to numerical on mobile devices (iPhone)
2 participants