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

Expose typings string union type with all the valid icons accepted by <calcite-icon> #8858

Closed
4 of 6 tasks
hcampos-professional opened this issue Mar 1, 2024 · 2 comments
Closed
4 of 6 tasks
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. calcite-components-react Issues specific to the @esri/calcite-components-react package. enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@hcampos-professional
Copy link

Check existing issues

Description

In the Maps SDK we use icons extensively and we are looking into how we can have type safe icon names. For now we've created a script which generates typescript definitions from the currently-installed asset files, but it seems like it would be better if Calcite exposed typings directly.

Acceptance Criteria

  • components.d.ts should expose a CalciteIconName string union with all the valid icon names.
  • (optionally) CalciteIcon.icon should be typed as icon?: CalciteIconName instead of icon?: string. In some cases the icon can be a boolean, in which case it would be type as icon?: CalciteIcon | boolean.

Relevant Info

calcite-ui-icons already exposes some typings: https://github.com/Esri/calcite-ui-icons/blob/master/index.d.ts
They are generated with https://github.com/Esri/calcite-ui-icons/blob/master/bin/path-data.js#L113-L123
For Calcite Components we'd need to convert to kebab case.

Which Component

Example Use Case

We're planning on using it in the Maps SDK for JavaScript to validate the names of all the default icons used in widgets.

Priority impact

p4 - not time sensitive

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

@hcampos-professional hcampos-professional added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Mar 1, 2024
@github-actions github-actions bot added ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive calcite-components-angular calcite-components-react Issues specific to the @esri/calcite-components-react package. labels Mar 1, 2024
@jcfranco jcfranco added estimate - 3 A day or two of work, likely requires updates to tests. p - medium Issue is non core or affecting less that 60% of people using the library needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Jun 25, 2024
@jcfranco jcfranco self-assigned this Jun 25, 2024
@geospatialem geospatialem removed the needs triage Planning workflow - pending design/dev review. label Jun 25, 2024
@geospatialem geospatialem added this to the 2024-07-30 - Jul Release milestone Jun 25, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jun 25, 2024
jcfranco added a commit that referenced this issue Jul 2, 2024
**Related issue:** #8858 

Adds a type for all supported UI icon names and updates types of
component icon props.

### Notes

* Moves `@esri/calcite-ui-icons` as a dependency to ensure types are
available
* Icon name prop includes both kebab-case and camelCase names (supported
icon values)
* Type resides in `icon/interfaces` (maybe it belongs in the shared
interfaces file?)
* Type is computed from `@esri/calcite-ui-icons`' module exports using
`type-fest` + TS utils
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Jul 2, 2024
@github-actions github-actions bot assigned geospatialem and DitwanP and unassigned jcfranco Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Installed and assigned for verification.

@DitwanP
Copy link
Contributor

DitwanP commented Jul 8, 2024

🍭 Verified

@DitwanP DitwanP closed this as completed Jul 8, 2024
@DitwanP DitwanP added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Jul 8, 2024
calcite-admin pushed a commit that referenced this issue Jul 30, 2024
**Related issue:** #8858 

Adds a type for all supported UI icon names and updates types of
component icon props.

### Notes

* Moves `@esri/calcite-ui-icons` as a dependency to ensure types are
available
* Icon name prop includes both kebab-case and camelCase names (supported
icon values)
* Type resides in `icon/interfaces` (maybe it belongs in the shared
interfaces file?)
* Type is computed from `@esri/calcite-ui-icons`' module exports using
`type-fest` + TS utils
jcfranco added a commit that referenced this issue Jul 31, 2024
**Related Issue:** #8858

## Summary

This widens the type used for all icon props to allow string as a
fallback. This prevents breaking changes that would require the new type
to be used.
calcite-admin pushed a commit that referenced this issue Jul 31, 2024
**Related Issue:** #8858

## Summary

This widens the type used for all icon props to allow string as a
fallback. This prevents breaking changes that would require the new type
to be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. calcite-components-react Issues specific to the @esri/calcite-components-react package. enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

4 participants