Skip to content

Commit

Permalink
chore(react-input, react-textarea): Deprecating filled with shadow ap…
Browse files Browse the repository at this point in the history
…pearance variants (#24900)

* fix: Deprecate filled with shadow appearance variants.

* change files

* wording
  • Loading branch information
sopranopillow authored Sep 27, 2022
1 parent adea89e commit 316aa1e
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "chore: Deprecating filled with shadow appearance variant.",
"packageName": "@fluentui/react-input",
"email": "esteban.230@hotmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Deprecating filled with shadow appearance variant.",
"packageName": "@fluentui/react-textarea",
"email": "esteban.230@hotmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export type InputProps = Omit<
/**
* Controls the colors and borders of the input.
* @default 'outline'
*
* Note: 'filled-darker-shadow' and 'filled-lighter-shadow' are deprecated and will be removed in the future.
*/
appearance?:
| 'outline'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ import type { InputProps, InputState } from './Input.types';
export const useInput_unstable = (props: InputProps, ref: React.Ref<HTMLInputElement>): InputState => {
const { size = 'medium', appearance = 'outline', onChange } = props;

if (
process.env.NODE_ENV !== 'production' &&
(appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')
) {
// eslint-disable-next-line no-console
console.error(
"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the" +
' future.',
);
}

const [value, setValue] = useControllableState({
state: props.value,
defaultState: props.defaultValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export const Appearance = () => {
const underlineId = useId('input-underline');
const filledLighterId = useId('input-filledLighter');
const filledDarkerId = useId('input-filledDarker');
const filledLighterShadowId = useId('input-filledLighterShadow');
const filledDarkerShadowId = useId('input-filledDarkerShadow');
const styles = useStyles();

return (
Expand All @@ -57,16 +55,6 @@ export const Appearance = () => {
<Label htmlFor={filledDarkerId}>Filled darker appearance</Label>
<Input appearance="filled-darker" id={filledDarkerId} />
</div>

<div className={mergeClasses(styles.field, styles.filledLighter)}>
<Label htmlFor={filledLighterShadowId}>Filled lighter appearance with shadow</Label>
<Input appearance="filled-lighter-shadow" id={filledLighterShadowId} />
</div>

<div className={mergeClasses(styles.field, styles.filledDarker)}>
<Label htmlFor={filledDarkerShadowId}>Filled darker appearance with shadow</Label>
<Input appearance="filled-darker-shadow" id={filledDarkerShadowId} />
</div>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export type TextareaProps = Omit<
* Styling the Textarea should use.
*
* @default outline
*
* Note: 'filled-darker-shadow' and 'filled-lighter-shadow' are deprecated and will be removed in the future.
*/
appearance?: 'outline' | 'filled-darker' | 'filled-lighter' | 'filled-darker-shadow' | 'filled-lighter-shadow';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ import type { TextareaProps, TextareaState } from './Textarea.types';
export const useTextarea_unstable = (props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>): TextareaState => {
const { size = 'medium', appearance = 'outline', resize = 'none', onChange } = props;

if (
process.env.NODE_ENV !== 'production' &&
(appearance === 'filled-darker-shadow' || appearance === 'filled-lighter-shadow')
) {
// eslint-disable-next-line no-console
console.error(
"The 'filled-darker-shadow' and 'filled-lighter-shadow' appearances are deprecated and will be removed in the" +
' future.',
);
}

const [value, setValue] = useControllableState({
state: props.value,
defaultState: props.defaultValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,11 @@ const useRootStyles = makeStyles({
'filled-lighter': {
backgroundColor: tokens.colorNeutralBackground1,
},

'filled-darker-shadow': {
backgroundColor: tokens.colorNeutralBackground3,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStrokeInteractive),
boxShadow: tokens.shadow2,
},

'filled-lighter-shadow': {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStrokeInteractive),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ const useStyles = makeStyles({
export const Appearance = () => {
const outlineId = useId('textarea-outline');
const filledDarkerId = useId('textarea-filleddarker');
const filledDarkerShadowId = useId('textarea-filleddarkershadow');
const filledLighterId = useId('textarea-filledlighter');
const filledLighterShadowId = useId('textarea-filledlightershadow');
const styles = useStyles();

return (
Expand All @@ -56,26 +54,6 @@ export const Appearance = () => {
<Label htmlFor={filledLighterId}>Textarea with Filled Lighter appearance.</Label>
<Textarea id={filledLighterId} appearance="filled-lighter" placeholder="type here..." resize="both" />
</div>

<div className={styles.filledDarker}>
<Label htmlFor={filledDarkerShadowId}>Textarea with Filled Darker with shadow appearance.</Label>
<Textarea
id={filledDarkerShadowId}
appearance="filled-darker-shadow"
placeholder="type here..."
resize="both"
/>
</div>

<div className={styles.filledLighter}>
<Label htmlFor={filledLighterShadowId}>Textarea with Filled Lighter with shadow appearance.</Label>
<Textarea
id={filledLighterShadowId}
appearance="filled-lighter-shadow"
placeholder="type here..."
resize="both"
/>
</div>
</div>
);
};
Expand Down

0 comments on commit 316aa1e

Please sign in to comment.