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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
4693a44
feat(textarea): add textareacomponent
anveshmekala Oct 25, 2022
a66a339
implement label & form components
anveshmekala Oct 27, 2022
fe688cf
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Oct 28, 2022
18a54d6
allow user to type beyond maxlength limit
anveshmekala Oct 28, 2022
03b5287
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Oct 28, 2022
1f07b3a
fix e2e
anveshmekala Oct 31, 2022
a7c4c8d
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Oct 31, 2022
345e57d
add public methods
anveshmekala Nov 1, 2022
0bc2598
add validation
anveshmekala Nov 1, 2022
31d6547
add custom error handling and tests
anveshmekala Nov 2, 2022
d7b1d7b
add more tests
anveshmekala Nov 3, 2022
9af159d
add more tests
anveshmekala Nov 3, 2022
edd920f
add form handling when character length is under limit
anveshmekala Nov 4, 2022
431f2bf
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 7, 2022
5da7a90
prettify
anveshmekala Nov 8, 2022
cbd3e42
add wrapper and include footer on initial tab
anveshmekala Nov 8, 2022
410ecc0
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 8, 2022
b571ee1
more cleanup
anveshmekala Nov 9, 2022
b2cce37
add resize observer
anveshmekala Nov 9, 2022
422d756
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 9, 2022
935c6ba
fix build error
anveshmekala Nov 10, 2022
53db818
change focus order and remove tab index
anveshmekala Nov 11, 2022
80278c7
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 14, 2022
d60cb78
add demos
anveshmekala Nov 14, 2022
52a6170
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 14, 2022
dee0454
fix positioning overlap
anveshmekala Nov 15, 2022
84968b1
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 15, 2022
99b3f80
add read me
anveshmekala Nov 17, 2022
b6f0128
add storybook
anveshmekala Nov 18, 2022
d67b401
remove minlenth and refactor
anveshmekala Nov 18, 2022
3a49121
fix test error
anveshmekala Nov 21, 2022
d3ea364
increase inline-size when slotted
anveshmekala Nov 21, 2022
a0cedc2
add more test
anveshmekala Nov 22, 2022
0b2da56
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Nov 22, 2022
9321d32
add missing jsdoc for events
anveshmekala Nov 22, 2022
e5522a6
more doc updates
anveshmekala Nov 22, 2022
d9ae7ae
feeback changes
anveshmekala Nov 29, 2022
4d39f8d
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 1, 2022
131395e
use slotted content when value is null
anveshmekala Dec 1, 2022
c5978be
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 1, 2022
a501272
restore footer-slotted css class
anveshmekala Dec 2, 2022
f8a010f
add back test
anveshmekala Dec 2, 2022
cbd6c31
make footer conditional
anveshmekala Dec 2, 2022
705084d
revert package-lock changes
anveshmekala Dec 19, 2022
9d3b200
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 19, 2022
a3b6755
fix resize disabled y
anveshmekala Dec 21, 2022
621ed17
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 21, 2022
16e6d94
set height and width to auto on resize
anveshmekala Dec 21, 2022
db7aa4d
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 22, 2022
7fa99cc
disable pointer events
anveshmekala Dec 22, 2022
df3bb75
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 22, 2022
0e23d8b
fix tests
anveshmekala Dec 22, 2022
0e7226d
implement t9ncomponent
anveshmekala Dec 22, 2022
1bf35a1
refactor
anveshmekala Dec 22, 2022
01e761d
restore spacing.11 in tailwind
anveshmekala Dec 22, 2022
60319ef
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 27, 2022
a09790f
fix resizing issue
anveshmekala Dec 27, 2022
6c91c9e
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 27, 2022
1e0e522
remove return on resize
anveshmekala Dec 28, 2022
4594bea
refactor
anveshmekala Dec 28, 2022
820b557
add setTimeout
anveshmekala Dec 29, 2022
b3bf3d0
set timeout to 150ms
anveshmekala Dec 29, 2022
d68983f
set auto height on vertical resize
anveshmekala Dec 29, 2022
9ff4471
fix build errors
anveshmekala Dec 29, 2022
b0cdc21
decrease timeout
anveshmekala Dec 29, 2022
5e27fd6
fix footer enabled dragging issue
anveshmekala Dec 29, 2022
ae2065e
refactor
anveshmekala Dec 29, 2022
f01dff5
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 30, 2022
10cac6d
remove flex and add block containers
anveshmekala Dec 30, 2022
c92f5bc
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Dec 30, 2022
3205cd7
refactor
anveshmekala Dec 30, 2022
b21e10f
feedback changes
anveshmekala Dec 30, 2022
b140bfc
fix textarea shrinking on focus
anveshmekala Jan 3, 2023
df78452
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Jan 3, 2023
6a4d256
move maxlength to the right
anveshmekala Jan 3, 2023
3456770
feedback changes
anveshmekala Jan 6, 2023
99e8f2c
add disabled e2e
anveshmekala Jan 6, 2023
3d1ccff
cleanup
anveshmekala Jan 6, 2023
fdbb886
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Jan 6, 2023
e40a14f
remove irrelavent tests
anveshmekala Jan 7, 2023
6a612a1
fix textarea height issue
anveshmekala Jan 9, 2023
3a9764e
feedback changes
anveshmekala Jan 10, 2023
f853bd9
rename private properties
anveshmekala Jan 10, 2023
b500bad
fix positioning and characterlength issue
anveshmekala Jan 10, 2023
1ffe8d8
refactor
anveshmekala Jan 11, 2023
b457901
rename maxlength to maxLength
anveshmekala Jan 11, 2023
7e1cd51
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Jan 11, 2023
d2ac102
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Jan 20, 2023
34b29d4
add demo for debugging
anveshmekala Jan 23, 2023
81b6f7a
feedback changes
anveshmekala Mar 15, 2023
13a126d
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Mar 15, 2023
4c4f6a3
change textarea to texta-area
anveshmekala Mar 15, 2023
6e423ff
fix tests
anveshmekala Mar 16, 2023
8c491ec
update stories and remove unwanted e2e tests
anveshmekala Mar 16, 2023
0f303d8
rename resize props
anveshmekala Mar 17, 2023
942c502
fix resizing behavior
anveshmekala Mar 17, 2023
7824722
Merge branch 'master' into anveshmekala/836-add-texarea-component
anveshmekala Mar 17, 2023
0093eb7
change events names to camelcase
anveshmekala Mar 17, 2023
526c6a1
update usage files
anveshmekala Mar 17, 2023
3a7c4d8
update demo page and font weight for character limit
anveshmekala Mar 17, 2023
ee48026
fix resizing error
anveshmekala Mar 17, 2023
04ac12c
disable resize on mobile devices
anveshmekala Mar 17, 2023
dfc1ea1
update readme typo
anveshmekala Mar 17, 2023
149157b
fix alignment for footer-end slot only use case & text whitespace for…
anveshmekala Mar 20, 2023
696f6de
fix slottedElementsDarkModeRTL screenshot test
anveshmekala Mar 20, 2023
c7d5644
remove text-area issue demo page
anveshmekala Mar 21, 2023
1782a90
more feedback changes
anveshmekala Mar 21, 2023
0be6dc2
rename overLimit to tooLong
anveshmekala Mar 21, 2023
b2d9e7e
fix displaying form handling error & editorial feedback changes
anveshmekala Mar 22, 2023
6dfbd7f
add jsdoc description to autofocus prop
anveshmekala Mar 22, 2023
f6b9697
selectText method wait for component to load
anveshmekala Mar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/label/label.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export const simple = (): string => html`
<calcite-option>c</calcite-option>
</calcite-select>
</calcite-label>
<calcite-label>
Add Notes
<calcite-text-area></calcite-text-area>
</calcite-label>
</div>
`;

Expand Down Expand Up @@ -139,6 +143,10 @@ export const darkModeRTL_TestOnly = (): string => html`
<calcite-checkbox></calcite-checkbox>
Text trailing inline-space-between
</calcite-label>
<calcite-label>
Add Notes
<calcite-text-area></calcite-text-area>
</calcite-label>
</div>
`;

Expand Down Expand Up @@ -175,4 +183,8 @@ export const spacingWithLabel_TestOnly = (): string => html`
I should not have a bottom margin because I have the CSS variable set.
<calcite-input></calcite-input>
</calcite-label>
<calcite-label>
Add Notes
<calcite-text-area></calcite-text-area>
</calcite-label>
`;
4 changes: 4 additions & 0 deletions src/components/text-area/assets/text-area/t9n/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Invalid",
"tooLong": "Character limit exceeded"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "غير صالح",
"tooLong": "تم تجاوز حد الأحرف"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Невалидно",
"tooLong": "Превишен лимит за символи"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Nevažeće",
"tooLong": "Premašeno je ograničenje znakova"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "No vàlid",
"tooLong": "S'ha excedit el límit de caràcters"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Neplatný",
"tooLong": "Překročen limit počtu znaků"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Ugyldig",
"tooLong": "Grænsen for antallet af tegn er overskredet"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Ungültig",
"tooLong": "Zeichenlimit wurde überschritten"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Μη έγκυρο",
"tooLong": "Υπέρβαση ορίου χαρακτήρων"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Invalid",
"tooLong": "Character limit exceeded"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "No válido",
"tooLong": "Se superó el límite de caracteres"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Sobimatu",
"tooLong": "Tähemärkide piirang on ületatud"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Virheellinen",
"tooLong": "Merkkien määrä ylitetty"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Non valide",
"tooLong": "Limite de caractères dépassée"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "לא תקין",
"tooLong": "חריגה ממגבלת מספר התווים"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Nevažeće",
"tooLong": "Premašeno je ograničenje znakova"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Érvénytelen",
"tooLong": "Karakterkorlát túllépve"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Tidak valid",
"tooLong": "Batas karakter terlampaui"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Non valido",
"tooLong": "Limite di caratteri superato"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "無効",
"tooLong": "文字制限を超えています"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "잘못됨",
"tooLong": "문자 제한을 초과함"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Neteisingas",
"tooLong": "Viršytas simbolių limitas"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Nederīgs",
"tooLong": "Pārsniegts rakstzīmju skaita ierobežojums"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Ongeldig",
"tooLong": "Tekenlimiet overschreden"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Ugyldig",
"tooLong": "Maksimumsgrensen for antall tegn er overskredet"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Niepoprawny",
"tooLong": "Przekroczono limit liczby znaków"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Inválido",
"tooLong": "Limite de caracteres excedido"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Inválido",
"tooLong": "Limite de carateres ultrapassado"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Nevalid",
"tooLong": "Limită de caractere depășită"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Недопустимый",
"tooLong": "Превышен лимит символов"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Neplatné",
"tooLong": "Bol prekročený limit počtu znakov"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Neveljavno",
"tooLong": "Presežena je omejitev znakov"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Nevažeće",
"tooLong": "Prekoračeno ograničenje znakova"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Ogiltig",
"tooLong": "Teckengränsen överskriden"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "ไม่ถูกต้อง",
"tooLong": "เกินขีดจำกัดอักขระ"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Geçersiz",
"tooLong": "Karakter sınırı aşıldı"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Неприпустимий",
"tooLong": "Перевищено обмеження кількості символів"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "Không hợp lệ",
"tooLong": "Đã vượt quá giới hạn ký tự"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "无效",
"tooLong": "超出字符限制"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "無效",
"tooLong": "已超過字元限制"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"invalid": "無效",
"tooLong": "已超過字元限制"
}
78 changes: 78 additions & 0 deletions src/components/text-area/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# calcite-text-area

<!-- Auto Generated Below -->

## Usage

### Basic

```html
<calcite-text-area placeholder="Add Notes"></calcite-text-area>
```

### Exceeding-max-length

Renders text-area with

```html
<calcite-text-area placeholder="Add Notes" value="Rocky Mountains National Park" max-length="20"></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. |

---

_Built with [StencilJS](https://stenciljs.com/)_
24 changes: 24 additions & 0 deletions src/components/text-area/resources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const CSS = {
characterLimit: "character-limit",
content: "content",
container: "container",
footer: "footer",
resizeDisabled: "resize--disabled",
resizeDisabledX: "resize--disabled-x",
resizeDisabledY: "resize--disabled-y",
characterOverLimit: "character--over-limit",
readOnly: "readonly",
textAreaInvalid: "text-area--invalid",
footerSlotted: "footer--slotted",
borderColor: "border--color",
hide: "hide",
blockSizeFull: "block-size--full",
footerEndSlotOnly: "footer--end-only"
};

export const SLOTS = {
footerStart: "footer-start",
footerEnd: "footer-end"
};

export const RESIZE_TIMEOUT = 100;
Loading