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(inline-edit): allow to render IconField #993

Merged
merged 8 commits into from
Sep 6, 2023
Merged

Conversation

Niznikr
Copy link
Contributor

@Niznikr Niznikr commented Sep 5, 2023

Summary

Allow InlineEdit to render IconField. Add tooltip and renderIconLast props to IconField.

Screenshots (if appropriate):

Screenshot 2023-09-05 at 4 07 57 PM

@Niznikr Niznikr requested review from a team, stinachen, jennifro and vroske-ld September 5, 2023 20:13
@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2023

🦋 Changeset detected

Latest commit: e51f3bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@launchpad-ui/inline-edit Patch
@launchpad-ui/form Patch
@launchpad-ui/core Patch
@launchpad-ui/card Patch
@launchpad-ui/menu Patch
@launchpad-ui/filter Patch
@launchpad-ui/navigation Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Niznikr Niznikr changed the title feat(inline-edit): allow to render IconField feat(inline-edit): allow to render IconField Sep 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

Size Change: +706 B (0%)

Total Size: 171 kB

Filename Size Change
packages/form/dist/index.es.js 4.23 kB +224 B (+6%) 🔍
packages/form/dist/index.js 4.34 kB +230 B (+6%) 🔍
packages/form/dist/style.css 2.75 kB +72 B (+3%)
packages/inline-edit/dist/index.es.js 1.58 kB +94 B (+6%) 🔍
packages/inline-edit/dist/index.js 1.66 kB +86 B (+5%) 🔍
ℹ️ View Unchanged
Filename Size
packages/alert/dist/index.es.js 1.02 kB
packages/alert/dist/index.js 1.09 kB
packages/alert/dist/style.css 1.03 kB
packages/avatar/dist/index.es.js 1.16 kB
packages/avatar/dist/index.js 1.23 kB
packages/avatar/dist/style.css 466 B
packages/banner/dist/index.es.js 641 B
packages/banner/dist/index.js 711 B
packages/banner/dist/style.css 545 B
packages/button/dist/index.es.js 1.63 kB
packages/button/dist/index.js 1.71 kB
packages/button/dist/style.css 3.71 kB
packages/card/dist/index.es.js 706 B
packages/card/dist/index.js 775 B
packages/card/dist/style.css 754 B
packages/chip/dist/index.es.js 679 B
packages/chip/dist/index.js 749 B
packages/chip/dist/style.css 895 B
packages/clipboard/dist/index.es.js 1.51 kB
packages/clipboard/dist/index.js 1.6 kB
packages/clipboard/dist/style.css 829 B
packages/collapsible/dist/index.es.js 853 B
packages/collapsible/dist/index.js 919 B
packages/collapsible/dist/style.css 94 B
packages/columns/dist/index.es.js 619 B
packages/columns/dist/index.js 692 B
packages/columns/dist/style.css 354 B
packages/core/dist/index.es.js 1.13 kB
packages/core/dist/index.js 1.51 kB
packages/counter/dist/index.es.js 333 B
packages/counter/dist/index.js 396 B
packages/counter/dist/style.css 256 B
packages/data-table/dist/index.es.js 2.47 kB
packages/data-table/dist/index.js 2.53 kB
packages/data-table/dist/style.css 385 B
packages/drawer/dist/index.es.js 1.73 kB
packages/drawer/dist/index.js 2.29 kB
packages/drawer/dist/style.css 570 B
packages/dropdown/dist/index.es.js 1.15 kB
packages/dropdown/dist/index.js 1.21 kB
packages/filter/dist/index.es.js 2.3 kB
packages/filter/dist/index.js 2.37 kB
packages/filter/dist/style.css 1 kB
packages/focus-trap/dist/index.es.js 270 B
packages/focus-trap/dist/index.js 333 B
packages/icons/dist/index.es.js 1.28 kB
packages/icons/dist/index.js 1.35 kB
packages/icons/dist/style.css 615 B
packages/inline-edit/dist/style.css 338 B
packages/inline/dist/index.es.js 565 B
packages/inline/dist/index.js 637 B
packages/inline/dist/style.css 299 B
packages/markdown/dist/index.es.js 960 B
packages/markdown/dist/index.js 1.03 kB
packages/markdown/dist/style.css 234 B
packages/menu/dist/index.es.js 3.55 kB
packages/menu/dist/index.js 3.64 kB
packages/menu/dist/style.css 1.22 kB
packages/modal/dist/index.es.js 3.03 kB
packages/modal/dist/index.js 3.58 kB
packages/modal/dist/style.css 1.03 kB
packages/navigation/dist/index.es.js 2.79 kB
packages/navigation/dist/index.js 2.86 kB
packages/navigation/dist/style.css 1.25 kB
packages/overlay/dist/index.es.js 1 kB
packages/overlay/dist/index.js 1.06 kB
packages/pagination/dist/index.es.js 1.18 kB
packages/pagination/dist/index.js 1.26 kB
packages/pagination/dist/style.css 356 B
packages/popover/dist/index.es.js 3.07 kB
packages/popover/dist/index.js 3.58 kB
packages/popover/dist/style.css 629 B
packages/portal/dist/index.es.js 393 B
packages/portal/dist/index.js 453 B
packages/progress-bubbles/dist/index.es.js 1.76 kB
packages/progress-bubbles/dist/index.js 1.83 kB
packages/progress-bubbles/dist/style.css 961 B
packages/progress/dist/index.es.js 1.02 kB
packages/progress/dist/index.js 1.09 kB
packages/progress/dist/style.css 278 B
packages/select/dist/index.es.js 5.91 kB
packages/select/dist/index.js 5.99 kB
packages/select/dist/style.css 1.34 kB
packages/slider/dist/index.es.js 579 B
packages/slider/dist/index.js 644 B
packages/slider/dist/style.css 672 B
packages/snackbar/dist/index.es.js 1.18 kB
packages/snackbar/dist/index.js 1.73 kB
packages/snackbar/dist/style.css 580 B
packages/split-button/dist/index.es.js 887 B
packages/split-button/dist/index.js 959 B
packages/split-button/dist/style.css 495 B
packages/stack/dist/index.es.js 494 B
packages/stack/dist/index.js 565 B
packages/stack/dist/style.css 226 B
packages/tab-list/dist/index.es.js 737 B
packages/tab-list/dist/index.js 809 B
packages/tab-list/dist/style.css 455 B
packages/table/dist/index.es.js 1.02 kB
packages/table/dist/index.js 1.1 kB
packages/table/dist/style.css 905 B
packages/tag/dist/index.es.js 2.85 kB
packages/tag/dist/index.js 2.92 kB
packages/tag/dist/style.css 945 B
packages/toast/dist/index.es.js 979 B
packages/toast/dist/index.js 1.53 kB
packages/toast/dist/style.css 544 B
packages/toggle/dist/index.es.js 764 B
packages/toggle/dist/index.js 844 B
packages/toggle/dist/style.css 1.52 kB
packages/tokens/dist/index.css 1.48 kB
packages/tokens/dist/index.es.js 2.04 kB
packages/tokens/dist/index.js 7.49 kB
packages/tokens/dist/media-queries.css 112 B
packages/tokens/dist/themes.css 1.29 kB
packages/tooltip/dist/index.es.js 517 B
packages/tooltip/dist/index.js 591 B
packages/tooltip/dist/style.css 366 B
packages/vars/dist/index.es.js 1.63 kB
packages/vars/dist/index.js 1.7 kB

compressed-size-action


const renderIcon = tooltip ? (
<Tooltip content={tooltip} targetClassName={styles.iconFieldButton}>
<IconButton
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to make this into a button? Will users interact with it? (It looks like you can't pass onClick to this specific component for example.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah tooltips must have an interactable element as the target/trigger. onClick isn't needed as Tooltip already adds listeners for hover/focus to show the content.

Copy link
Contributor

Choose a reason for hiding this comment

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

i was playing in storybook, and it surprised me that i could click on the icon.

@@ -88,6 +84,28 @@ select.formInput {
border-color: var(--lp-color-border-field-error);
}

.iconField:global(.IconBefore) .formInput {
padding-left: 3rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use the specing tokens here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have one for 3rem 😅

mergeProps(renderInput.props, inputChildren ? {} : inputProps),
inputChildren &&
Children.map(inputChildren, (child) =>
['TextField', 'TextArea'].includes(child.type.displayName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to reach for the display name here? Is reading displayName this way reliable post-bundling, etc…

Copy link
Contributor

Choose a reason for hiding this comment

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

@apucacao, I'm guessing this is to check that, if it's an expected Launchpad-based React element, then we merge its props with the inputProps we need. I don't know anything about bundling effects on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I figured.

I was wondering why child.type === TextField wouldn't work. We'd need to import TextField.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LP component display names aren't minified in the product but just to be safe I can check for the type to match the component itself.

Copy link
Contributor

@pheggeseth pheggeseth left a comment

Choose a reason for hiding this comment

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

Thanks, @Niznikr! This should work for our needs. Feel free to address any other feedback from @apucacao as needed.

@Niznikr Niznikr merged commit a49131f into main Sep 6, 2023
15 checks passed
@Niznikr Niznikr deleted the feat/icon-field-tooltip branch September 6, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants