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(text-area): add calcite-text-area component #5644

Merged
merged 111 commits into from
Mar 23, 2023

Conversation

anveshmekala
Copy link
Contributor

@anveshmekala anveshmekala commented Oct 25, 2022

Related Issue: #863

Summary

This PR will add new component calcite-text-area which will replace <calcite-input type="textarea" />

calcite-text-area

Usage

Basic

<calcite-text-area placeholder="Add notes"></calcite-text-area>

Properties

Property Attribute Description Type Default
autofocus autofocus When true, the component is focused on page load. boolean false
columns columns Specifies the number or columns allowed. number undefined
disabled disabled When true, interaction is prevented and the component is displayed with lower opacity. boolean false
groupSeparator group-separator When true, number values are displayed with a group separator corresponding to the language and country format. boolean false
label label Accessible name for the component. string undefined
maxLength max-length Specifies the maximum number of characters allowed. number undefined
messageOverrides -- Use this property to override individual strings used by the component. { invalid?: string; overLimit?: string; } undefined
name name Specifies the name of the component string undefined
numberingSystem numbering-system Specifies the Unicode numeral system used by the component for localization. "arab" | "arabext" | "bali" | "beng" | "deva" | "fullwide" | "gujr" | "guru" | "hanidec" | "khmr" | "knda" | "laoo" | "latn" | "limb" | "mlym" | "mong" | "mymr" | "orya" | "tamldec" | "telu" | "thai" | "tibt" undefined
placeholder placeholder Specifies the placeholder text for the component. string undefined
readonly readonly When true, the component's value can be read, but cannot be modified. boolean false
required required When true, the component must have a value in order for the form to submit. boolean false
resize resize When true, disables horizontally and vertically resizing the component. "both" | "horizontal" | "none" | "vertical" "both"
rows rows Specifies the number or rows allowed. number undefined
scale scale Specifies the size of the component. "l" | "m" | "s" "m"
value value The component's value. string undefined
wrap wrap Specifies the wrapping mechanism for the text. "hard" | "soft" "soft"

Events

Event Description Type
calciteTextAreaChange Fires each time a new value is typed and committed. CustomEvent<void>
calciteTextAreaInput Fires each time a new value is typed. CustomEvent<void>

Methods

selectText() => Promise<void>

Selects all text of the component's value.

Returns

Type: Promise<void>

setFocus() => Promise<void>

Sets focus on the component.

Returns

Type: Promise<void>

Slots

Slot Description
A slot for adding text.
"footer-end" A slot for adding a trailing footer.
"footer-start" A slot for adding a leading footer.

Known limitations:

when the calcite-text-area with fixed height and width is wrapped inside a flex container with height and width, resizing behavior doesn't restrict the component from increasing both height and width.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Oct 25, 2022
@anveshmekala anveshmekala changed the title feat(textarea): add textareacomponent feat(textarea): add calcite-textarea component Nov 2, 2022
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 21, 2023
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Awesome work, @anveshmekala!

One the last comments are addressed, this is good to merge! 🎉

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 21, 2023
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 21, 2023
Copy link
Member

@geospatialem geospatialem left a comment

Choose a reason for hiding this comment

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

A few editorial comments below.

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 22, 2023
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 22, 2023
geospatialem added a commit that referenced this pull request Mar 23, 2023
…nts (#6634)

**Related Issue:** n/a

## Summary
Document API consistency across components, in particular while working
through the new component, `textarea`. cc:
#5644

Update includes consistency with `input`, `input-number`, and
`input-text` (in alignment with `textarea`) for the following:

1. `autofocus` prop:
> When `true`, the component is focused on page load. Only one element
can contain `autofocus`. If multiple elements have `autofocus`, the
first element will receive focus.

2. `selectText()` method:
> Selects the text of the component's `value`.
Copy link
Member

@benelan benelan left a comment

Choose a reason for hiding this comment

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

A couple comments but LGTM!

/** Selects the text of the component's `value`. */
@Method()
async selectText(): Promise<void> {
this.textAreaEl.select();
Copy link
Member

Choose a reason for hiding this comment

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

Should selectText await componentLoaded(this) like setFocus does?

Copy link
Contributor Author

@anveshmekala anveshmekala Mar 23, 2023

Choose a reason for hiding this comment

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

i think its better to add it .

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 23, 2023
@anveshmekala anveshmekala merged commit 1a1528b into master Mar 23, 2023
@anveshmekala anveshmekala deleted the anveshmekala/836-add-texarea-component branch March 23, 2023 23:42
benelan added a commit that referenced this pull request Mar 27, 2023
…ocus-revert

* origin/master: (30 commits)
  fix(modal): prevent error when calling setFocus on a recently rendered and opened modal (`dist-custom-elements`) (#6666)
  fix(tile-select): fix click not firing in custom-elements build (#6665)
  fix(card): provide more meaningful screen reader label for selectable cards (deprecates `deselect` message override) (#6657)
  fix(pagination): add current page information for screen readers (#6637)
  chore: update jsbin sample to CC 1.0 breaking changes and latest jsapi version (#6651)
  feat(text-area): add calcite-text-area component (#5644)
  chore(release): 1.1.1-next.2
  fix(tile): adds styling to `tile` where `link` is present for additional distinction (#6628)
  docs(input, input-number, input-text): api consistency across components (#6634)
  docs(accordion-item): add actions-start and actions-end slots (#6631)
  docs(modal): kebab-case slot names and sticky context (#6625)
  chore(release): 1.1.1-next.1
  fix: restore form control validation in Safari (#6623)
  chore(linting): fix linting errors (#6613)
  build(deps): Bump eslint-plugin-react from 7.31.11 to 7.32.2 (#6619)
  build(deps): Bump eslint from 8.35.0 to 8.36.0 (#6620)
  build(deps): Bump @types/lodash-es from 4.17.6 to 4.17.7 (#6621)
  build: fix peer dependency resolution error (#6611)
  ci: update user-defined priority (#6609)
  build: update browserslist db (#6527)
  ...
benelan added a commit that referenced this pull request Mar 28, 2023
**Related Issue:** #5644

## Summary

Component methods need to be private if they are using a 3rd party
package like lodash. Otherwise the package's types are included in dist
and we would need to move the package's types from devDeps to deps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants