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

[Feature Request]: As a Developer, I would like to import types from @carbon/react #16436

Open
1 task done
digiacomo-a opened this issue May 10, 2024 · 5 comments
Open
1 task done
Assignees
Labels
area: typescript component: tags proposal: accepted This request has gone through triaging and we are accepting PR's against it. role: dev 🤖 status: blocked 🙅‍♀️ type: enhancement 💡 type: infrastructure 🤖 Issues relating to devops, tech debt, etc.
Milestone

Comments

@digiacomo-a
Copy link
Contributor

The problem

Users are often using reusable components to render Tags with different colors (type) based on some status.
To achieve this, a TagType enum needs to be defined because we can not import it from carbon/react.

For instance:

enum TagType {
        red = 'red'
        green....
        ... 
}

interface CustomInterface {
  type: TagType,
  title: string,
}

The solution

Could be nice to define and export a TagType containing all supported types and then import it so that we can use it in our interfaces, couple of examples below.

Examples

Example of an interface for Props, with tagType

import {TagType} from '@carbon/react';

interface CustomInterface {
  tagType: TagType,
  title: string,
}

`<MyCustomCardWithTag tagType={TagType.red} title="Example" />`

Application/PAL

No response

Business priority

Low Priority = release date is not dependent on fix or not upcoming

Available extra resources

I'm happy to contribute if this change can be useful.

Code of Conduct

Copy link
Contributor

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

@digiacomo-a digiacomo-a changed the title [Feature Request]: [Feature Request]: As a Developer, I would like to import TagType from carbon May 13, 2024
@tay1orjones
Copy link
Member

Yes this isn't exported from the root, but it's exported from the root source file and so you can import them like this:

import { TYPES } from '@carbon/react/es/components/Tag/Tag';

I'm not opposed to adding these to the root exports, but we won't be able to do that until everything is converted to .ts, #12513, #16360

For now I'll add this as a subitem of #16154

@tay1orjones tay1orjones removed this from Roadmap May 13, 2024
@tay1orjones tay1orjones moved this to ⏱ Backlog in Design System May 13, 2024
@github-project-automation github-project-automation bot moved this to Triage in Roadmap May 13, 2024
@tay1orjones tay1orjones added proposal: accepted This request has gone through triaging and we are accepting PR's against it. component: tags and removed type: enhancement 💡 labels May 13, 2024
@tay1orjones tay1orjones removed this from Roadmap May 13, 2024
@sstrubberg sstrubberg added this to the 2024 Q3 milestone Jul 9, 2024
@sstrubberg sstrubberg added role: dev 🤖 type: infrastructure 🤖 Issues relating to devops, tech debt, etc. labels Jul 9, 2024
@Gururajj77 Gururajj77 changed the title [Feature Request]: As a Developer, I would like to import TagType from carbon [Feature Request]: As a Developer, I would like to import types from @carbon/react Jul 25, 2024
@Gururajj77
Copy link
Contributor

I think we have to have all the export types to be named

microsoft/TypeScript#35200

Copy link
Contributor

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

@tay1orjones
Copy link
Member

If we upgrade to TS v5 we'd be able to just use

export type * from '@carbon/icons-react

in here

export * from '@carbon/icons-react';

microsoft/TypeScript#52217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: typescript component: tags proposal: accepted This request has gone through triaging and we are accepting PR's against it. role: dev 🤖 status: blocked 🙅‍♀️ type: enhancement 💡 type: infrastructure 🤖 Issues relating to devops, tech debt, etc.
Projects
Status: 🏗 In Progress
Status: Todo
Development

No branches or pull requests

5 participants