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(autocomplete): add autocomplete component #10562

Merged
merged 87 commits into from
Dec 18, 2024
Merged

Conversation

driskull
Copy link
Member

@driskull driskull commented Oct 18, 2024

Related Issue: #10044

Summary

Tokens

Autocomplete

--calcite-autocomplete-background-color: Specifies the background color of the component.
--calcite-autocomplete-corner-radius: Specifies the component's corner radius.
--calcite-autocomplete-text-color: Specifies the text color of the component.

--calcite-autocomplete-input-prefix-size: Specifies the Input's prefix width, when present.
--calcite-autocomplete-input-suffix-size: Specifies the Input's suffix width, when present.

--calcite-autocomplete-input-background-color: Specifies the background color of the Input.
--calcite-autocomplete-input-border-color: Specifies the border color of the Input.
--calcite-autocomplete-input-corner-radius: Specifies the corner radius of the Input.
--calcite-autocomplete-input-shadow: Specifies the shadow of the Input.

--calcite-autocomplete-input-icon-color: Specifies the icon color of the Input.
--calcite-autocomplete-input-text-color: Specifies the text color of the Input.
--calcite-autocomplete-input-placeholder-text-color: Specifies the color of placeholder text in the Input.

--calcite-autocomplete-input-actions-background-color: Specifies the background color of Input's clearable element.
--calcite-autocomplete-input-actions-background-color-hover: Specifies the background color of Input's clearable element when hovered.
--calcite-autocomplete-input-actions-background-color-press: Specifies the background color of Input's clearable element when pressed.
--calcite-autocomplete-input-actions-icon-color: Specifies the icon color of Input's clearable element.
--calcite-autocomplete-input-actions-icon-color-hover: Specifies the icon color of Input's clearable element when hovered.
--calcite-autocomplete-input-actions-icon-color-press: Specifies the icon color of Input's clearable element when pressed.

--calcite-autocomplete-input-loading-background-color: Specifies the background color of the Input's loading element, when present.
--calcite-autocomplete-input-loading-fill-color: Specifies the fill color of the Input's loading element, when present.

--calcite-autocomplete-input-prefix-background-color: Specifies the background color of the Input's prefix, when present.
--calcite-autocomplete-input-prefix-text-color: Specifies the text color of the Input's prefix, when present.

--calcite-autocomplete-input-suffix-background-color: Specifies the background color of the Input's suffix, when present.
--calcite-autocomplete-input-suffix-text-color: Specifies the text color of the Input's suffix, when present.

Autocomplete item

--calcite-autocomplete-background-color: Specifies the background color of the component.
--calcite-autocomplete-description-text-color: Specifies the text color of the component's description.
--calcite-autocomplete-heading-text-color: Specifies the text color of the component's heading.
--calcite-autocomplete-text-color: Specifies the text color of the component.

Autocomplete item group

--calcite-autocomplete-background-color: Specifies the background color of the component.
--calcite-autocomplete-border-color: Specifies the border color of the component.
--calcite-autocomplete-text-color: Specifies the text color of the component.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Oct 18, 2024
Copy link
Contributor

github-actions bot commented Nov 8, 2024

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Nov 8, 2024
# Conflicts:
#	packages/calcite-components/index.html
#	packages/calcite-components/src/components.d.ts
#	packages/calcite-components/stencil.config.ts
@github-actions github-actions bot removed the Stale Issues or pull requests that have not had recent activity. label Nov 16, 2024
@driskull
Copy link
Member Author

@jcfranco @benelan can you review when you get a chance? Thanks!

Copy link
Member

@benelan benelan left a comment

Choose a reason for hiding this comment

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

Code LGTM! Do you need additional manual testing or has that already been taken care of?

heading: "heading",
iconEnd: "icon-end",
iconStart: "icon-start",
scale: (scale: Scale) => `scale--${scale}` as const,
Copy link
Member

Choose a reason for hiding this comment

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

Is this a new pattern we're using to avoid the more costly attribute selector?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its used in combobox-item.

scale: (scale: Scale) => `scale--${scale}` as const,

I copied it from there. Is that ok?

Copy link
Member

@benelan benelan Dec 17, 2024

Choose a reason for hiding this comment

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

Gotcha, yeah this was just a sidebar; I was curious if that's something we should be doing instead of using the attribute selector like this:

:host([scale="s"]) {
inline-size: $icon-size-s;
block-size: $icon-size-s;
min-inline-size: $icon-size-s;
min-block-size: $icon-size-s;
}
:host([scale="m"]) {
inline-size: $icon-size-m;
block-size: $icon-size-m;
min-inline-size: $icon-size-m;
min-block-size: $icon-size-m;
}
:host([scale="l"]) {
inline-size: $icon-size-l;
block-size: $icon-size-l;
min-inline-size: $icon-size-l;
min-block-size: $icon-size-l;
}

I think either are fine, I just hadn't seen the scale--s pattern in our codebase yet. After a quick grep I also found instances of scale-s, e.g.

.scale-s {
--calcite-internal-tab-content-block-padding: var(--calcite-tab-content-block-padding, theme("spacing.1"));
@apply text-n2h;
}
.scale-m {
--calcite-internal-tab-content-block-padding: var(--calcite-tab-content-block-padding, theme("spacing.2"));
@apply text-n1h;
}
.scale-l {
--calcite-internal-tab-content-block-padding: var(--calcite-tab-content-block-padding, theme("spacing.[2.5]"));
@apply text-0h;
}

Do we have any conventions on whether we should be using BEM in our CSS class names @jcfranco? It seems rather inconsistent between components.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree .scale--s would be better than .scale-s to align with a standardized pattern. We don't really need BEM for specificity since our components are shadowed. Probably an issue to cleanup class names.

I do prefer classes over using attribute selectors because it forces those attributes to be reflected and can make some selectors quite complex.

Copy link
Member

Choose a reason for hiding this comment

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

I agree .scale--s would be better than .scale-s to align with a standardized pattern. We don't really need BEM for specificity since our components are shadowed. Probably an issue to cleanup class names.

I also prefer .scale--s since it follows convention. I don't think it's worth an issue because the classes aren't exposed to users. But maybe we can recommend the block--modifier-value naming convention for future PRs so the codebase doesn't diverge any further, cc @jcfranco.

I do prefer classes over using attribute selectors because it forces those attributes to be reflected and can make some selectors quite complex.

Yeah makes sense, thanks!

@driskull
Copy link
Member Author

Code LGTM! Do you need additional manual testing or has that already been taken care of?

@benelan additional manual testing would be great if you have some time.

@benelan
Copy link
Member

benelan commented Dec 17, 2024

Code LGTM! Do you need additional manual testing or has that already been taken care of?

@benelan additional manual testing would be great if you have some time.

I have to run off to an hour appointment but I can do some later today. I'll focus on form validation stuff.

@driskull driskull added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Dec 17, 2024
@driskull driskull added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Dec 17, 2024
@driskull driskull added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Dec 18, 2024
@driskull
Copy link
Member Author

Going to install tonight. If there are follow up issues let me know @benelan @jcfranco

@driskull driskull added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Dec 18, 2024
@driskull driskull added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Dec 18, 2024
@driskull driskull merged commit 0da4cc6 into dev Dec 18, 2024
14 checks passed
@driskull driskull deleted the dris0000/autocomplete branch December 18, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants