-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pie-monorepo): DSW-2056 resolve conflicts
- Loading branch information
Showing
11 changed files
with
654 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@justeattakeaway/pie-textarea": minor | ||
"pie-storybook": patch | ||
--- | ||
|
||
[Added] - resize prop for textarea | ||
[Added] - auto and manual sizing functionality | ||
[Added] - styling for different sizes | ||
[Added] - disabled and focus styles | ||
[Added] - visual and component tests | ||
[Changed] - update textarea storybook story |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,89 @@ | ||
@use '@justeattakeaway/pie-css/scss' as p; | ||
|
||
.c-textarea { | ||
--textarea-height: 72px; | ||
// Heights are being defined based on the line height of the text and the padding. | ||
// Changing the `size` property affects the padding and therefore the height of the textarea. | ||
// Default height is two lines of text. | ||
// Minimum height in manual resize mode is one line of text. | ||
// Maximum height in auto resize mode is six lines of text. | ||
.c-textareaWrapper { | ||
--textarea-line-height: #{p.line-height(--dt-font-body-l-line-height)}; | ||
--textarea-border-thickness: 1px; | ||
--textarea-resize: none; | ||
--textarea-padding-inline: var(--dt-spacing-d); | ||
--textarea-padding-block: var(--dt-spacing-c); | ||
--textarea-background-color: var(--dt-color-container-default); | ||
--textarea-border-color: var(--dt-color-interactive-form); | ||
--textarea-content-color: var(--dt-color-content-default); | ||
|
||
height: var(--textarea-height); | ||
// Default height is two lines of text | ||
--textarea-height: calc((var(--textarea-line-height) * 2) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); | ||
|
||
line-height: 0; // Remove once there is text outside the textarea | ||
|
||
textarea { | ||
@include p.font-size(--dt-font-body-l-size); | ||
line-height: var(--textarea-line-height); | ||
font-family: var(--dt-font-body-l-family); | ||
resize: var(--textarea-resize); | ||
border: var(--textarea-border-thickness) solid var(--textarea-border-color); | ||
background-color: var(--textarea-background-color); | ||
color: var(--textarea-content-color); | ||
|
||
border-radius: var(--dt-radius-rounded-c); | ||
block-size: var(--textarea-height); | ||
max-block-size: var(--textarea-max-height); | ||
min-block-size: var(--textarea-min-height); | ||
|
||
padding-block-start: var(--textarea-padding-block); | ||
padding-block-end: var(--textarea-padding-block); | ||
padding-inline-start: var(--textarea-padding-inline); | ||
padding-inline-end: var(--textarea-padding-inline); | ||
|
||
&[disabled] { | ||
--textarea-background-color: var(--dt-color-disabled-01); | ||
--textarea-border-color: var(--dt-color-disabled-01); | ||
--textarea-content-color: var(--dt-color-content-disabled); | ||
} | ||
|
||
@media (hover: hover) { | ||
&:hover:not([disabled]) { | ||
--textarea-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01)))); | ||
} | ||
} | ||
|
||
&:focus-visible { | ||
@include p.focus; | ||
} | ||
} | ||
|
||
&[data-pie-size="large"] { | ||
--textarea-height: 80px; | ||
--textarea-padding-block: var(--dt-spacing-d); | ||
} | ||
|
||
&[data-pie-size="small"] { | ||
--textarea-height: 64px; | ||
--textarea-padding-block: var(--dt-spacing-b); | ||
} | ||
|
||
textarea { | ||
width: 100%; | ||
height: 100%; | ||
&[data-pie-resize="manual"] { | ||
--textarea-resize: vertical; | ||
|
||
// Minimum is one line of text | ||
--textarea-min-height: calc((var(--textarea-line-height) * 1) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); // One line of text | ||
|
||
@media (pointer: coarse) { | ||
// Fixed size for touch devices | ||
--textarea-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); | ||
--textarea-min-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); | ||
--textarea-max-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); | ||
--textarea-resize: none; | ||
} | ||
} | ||
} | ||
|
||
&[data-pie-resize="auto"] { | ||
// Maximum is six lines of text | ||
--textarea-max-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2)); | ||
|
||
// Minimum is two lines of text | ||
--textarea-min-height: var(--textarea-height); | ||
} | ||
} |
Oops, something went wrong.