Skip to content

Conversation

@jzempel
Copy link
Member

@jzempel jzempel commented Jun 13, 2024

Description

Completed recolor work for Input, Checkbox, Radio, Toggle, Range, Select, FileUpload, File, FileList, FauxInput, MediaInput, and Tiles. Components inheriting this work include Textarea & InputGroup.

Detail

Note that Hint, Label, and Message were completed with #1816

Checklist

  • 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • 🌐 demo is up-to-date (npm start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • 🤘 renders as expected with Bedrock CSS (?bedrock)
  • 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • ♿ tested for WCAG 2.1 AA accessibility compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

@jzempel jzempel requested a review from a team as a code owner June 13, 2024 21:24
@jzempel jzempel marked this pull request as draft June 13, 2024 21:24
...commonArgs
}}
argTypes={{
tabIndex: { control: 'number' },
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed (and has parity with File) to observe focus state.

if (value.transparency !== undefined) {
_transparency = value.transparency;
}
_transparency = _transparency === undefined ? value.transparency : _transparency;
Copy link
Member Author

@jzempel jzempel Jun 13, 2024

Choose a reason for hiding this comment

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

If transparency exists along with a variable parameter, the transparency should override the variable's rgba alpha value. This allows us to one-off tweak

getColor({
  theme,
  variable: 'background.disabled',
  transparency: theme.opacity[300]
});

as seen with StyledRadioInput.

Comment on lines +14 to +16
import { TextEncoder } from 'node:util';

global.TextEncoder = TextEncoder;
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed due to the addition of renderToString in StyledTextInput.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this matches browser behavior. 😰 I always get nervous about using node utils in tests when the component will leverage browser APIs in practice.

Copy link

@steue steue left a comment

Choose a reason for hiding this comment

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

a pass over everything sans Tiles and most looks good to me! 🔥 work! just one thing i noticed that has some implications on our Buttons package.

while reviewing InputGroup, it appears that the hover state of the neutral button is one shade too dark/light (blue-800/500) instead of using the expected blue-700/600 or border/primaryEmphasis.

the initial design intent for the neutral button was to visually align with inputs, including on hover treatment (but not active).

ive included a comparison diagram below. i’ve provided a visual of the intention below. but plz let me know if i might have missed something and this is intentional. sorry we didnt catch this earlier, as i know this affects a package we’ve already marked as done

image

p.s. since the changes would come from buttons, and the rest of the forms look good to me, i'll approve! ty again!

@lucijanblagonic
Copy link

lucijanblagonic commented Jun 14, 2024

File

image
image
Screenshots from deployment

Icon should be fg/error or fg/success depending on the error/success state.

image

We discussed this in Figma already, maybe I configured something wrong 🤔

const height = `${theme.space.base * (isCompact ? 8 : 10)}px`;

return css`
max-height: ${height};
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes a 2px height bump difference between Select and Input due to wrapper border.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we include an annotation? 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. In general, I'm really looking to getting rid of all this faux/wrapper/media/input differentiation in v9 with a new component.next that rolls everything into one.

Comment on lines -19 to -23
interface IStyledTileProps {
isDisabled?: boolean;
isFocused?: boolean;
isSelected?: boolean;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

State info shouldn't be used when CSS can solve using :has()

Comment on lines +13 to +20
top: 0;
left: 0;
opacity: 0;
z-index: 1;
margin: 0;
cursor: ${props => (props.disabled ? 'default' : 'pointer')};
width: 100%;
height: 100%;
Copy link
Member Author

Choose a reason for hiding this comment

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

Now the visibly hidden input is truly interactive – similar to the approach used by ColorSwatch. This will allow us to revisit Tiles and add a isCheckboxGroup feature similar to ColorSwatch so that Tiles isn't constrained to behave as a radio-only group.

Copy link

@lucijanblagonic lucijanblagonic left a comment

Choose a reason for hiding this comment

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

Reviewed Tile (others were reviewed on Friday). Looks good. 🙌

Copy link
Contributor

@geotrev geotrev left a comment

Choose a reason for hiding this comment

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

Couple small comments, but nothing blocking. Thanks for pushing the Select style fixes 🚀

});
const trackDisabledLowerBackgroundColor = hasLowerTrack
? getColor({ theme, variable: 'border.emphasis' })
: '';
Copy link
Contributor

Choose a reason for hiding this comment

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

There's quite a few ternary's in this file (from the original implementation). Curious if we can get away with simplifying:

const trackDisabledLowerBackgroundColor = hasLowerTrack && getColor({ ... });

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was thinking the same but resisted updates due to the focus of this PR. Let's try to revisit down the road.

const height = `${theme.space.base * (isCompact ? 8 : 10)}px`;

return css`
max-height: ${height};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we include an annotation? 👀

color: ${activeColor};
}
${StyledTile}:has(:checked) && {
Copy link
Contributor

Choose a reason for hiding this comment

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

✨ new css features ftw

Comment on lines +14 to +16
import { TextEncoder } from 'node:util';

global.TextEncoder = TextEncoder;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this matches browser behavior. 😰 I always get nervous about using node utils in tests when the component will leverage browser APIs in practice.

Copy link
Contributor

@ze-flo ze-flo left a comment

Choose a reason for hiding this comment

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

Nice work! 💯

const readOnlyBackgroundColor = disabledBackgroundColor;
const calendarPickerColor = getColor({ theme, variable: 'foreground.subtle' });
const calendarPickerIcon = renderToString(<ChevronIcon color={calendarPickerColor} />);
const calendarPickerBackgroundImage = `url("data:image/svg+xml,${encodeURIComponent(calendarPickerIcon)}")`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice hack!

@jzempel jzempel merged commit 4b79afd into next Jun 20, 2024
@jzempel jzempel deleted the jzempel/recolor-forms branch June 20, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

7 participants