Skip to content

Commit

Permalink
Merge branch 'main' into typescript-iconskeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
andreancardona authored Sep 12, 2023
2 parents dc82efa + 149fc26 commit a6f5916
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 111 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/contribution-approved.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning
name: Add comment on enhancement issue
name: Contribution triage - proposal accepted and community contribution
on:
issues:
types: [labeled, opened]

permissions:
issues: write
issues: write

jobs:
add-comment:
name: Add comment to with proposal accepted and community contribution
runs-on: ubuntu-latest
if:
${{ (
contains(github.event.label.name, format('proposal{0} accepted', ':')) &&
contains(github.event.issue.labels.*.name, format('community contribution'))
) || (
contains(github.event.label.name, format('community contribution')) &&
contains(github.event.issue.labels.*.name, format('proposal{0} accepted', ':'))
)}}
if:
${{ ( contains(github.event.label.name, format('proposal{0} accepted',
':')) && contains(github.event.issue.labels.*.name, format('community
contribution')) ) || ( contains(github.event.label.name, format('community
contribution')) && contains(github.event.issue.labels.*.name,
format('proposal{0} accepted', ':')) )}}

steps:
- name: Log github event
env:
$GITHUB_CONTEXT_LABELS:
${{ toJson(github.event.label) }}
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }}
run: echo "$GITHUB_CONTEXT_LABELS"
- name: Add comment
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning
name: Add comment on enhancement issue
name: Contribution triage - proposal not pursuing
on:
issues:
types: [labeled, opened]

permissions:
issues: write
issues: write

jobs:
add-comment:
name: If new enhancement issue is submitted, then post the following comment.
name:
If proposal is marked as not pursuing, then post the following comment.
runs-on: ubuntu-latest
if:
${{ contains(github.event.label.name, format('proposal{0} not pursuing',
':')) }}
steps:
- name: Add comment
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
if:
github.event.label.name == 'proposal\uFE55 not pursuing'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thank you for submitting your proposal. Unfortunately, it doesn't align with our roadmap or philosophy at this time. We value your contribution and encourage you to keep engaging with the community. For more information about our triage workflow and philosophy, please visit [here](https://github.com/carbon-design-system/carbon/blob/main/docs/guides/support.md#type-enhancement-).'
})
})
20 changes: 7 additions & 13 deletions .github/workflows/contribution-proposal.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning
name: Add comment on enhancement issue
name: Contribution triage - enhancement created
on:
issues:
types: [labeled, opened]

permissions:
issues: write
issues: write

jobs:
add-comment:
name: If new enhancement issue is submitted, then post the following comment.
name:
If new enhancement issue is submitted, then post the following comment.
runs-on: ubuntu-latest
if:
${{ contains(github.event.label.name, format('type{0} enhancement 💡', ':')) }}
steps:
- name: Add comment
if: github.event.label.name == format('type{0} enhancement', ':')
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
with:
script: |
Expand All @@ -32,4 +26,4 @@ jobs:
Your proposal is open and is now being [triaged](https://github.com/orgs/carbon-design-system/projects/51/views/1) by the Carbon team.
If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request volunteers from the community.
Read the full triaging workflow [here](https://github.com/carbon-design-system/carbon/blob/main/docs/guides/support.md#type-enhancement-).'
})
})
37 changes: 37 additions & 0 deletions .github/workflows/contribution-ready-to-be-worked.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Contribution triage - Ready to be worked
on:
issues:
types: [unlabeled]

permissions:
issues: write

jobs:
add-comment:
name: Add comment to with proposal accepted and community contribution
runs-on: ubuntu-latest
if:
${{ (
contains(github.event.label.name, 'design contribution needed') &&
(!contains(github.event.issue.labels.*.name, 'development contribution
needed'))
) || (
contains(github.event.label.name, 'development
contribution needed') && (!contains(github.event.issue.labels.*.name,
'design contribution needed'))
)}}
steps:
- name: Log github event
env:
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }}
run: echo "$GITHUB_CONTEXT_LABELS"
- name: Add comment
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This issue is ready to be worked on. Volunteers, please feel free to join any of the [relevant meetups](https://carbondesignsystem.com/whats-happening/meetups/) to get guidance and feedback. We encourage you to bring any work in progress, no matter its state of completion. You can also ask any questions on slack. For design questions, the best channels are: [#carbon-design-system](https://ibm-studios.slack.com/archives/C0M053VPT) and [#figma-guild](https://ibm-studios.slack.com/archives/C023WKW6J5U). For developer questions, the best channels are: [#carbon-react](https://ibm-studios.slack.com/archives/C2K6RFJ1G), [#carbon-web-components](https://ibm-studios.slack.com/archives/CL83LMKSA).'
})
43 changes: 43 additions & 0 deletions e2e/components/TextInput/TextInput-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,47 @@ test.describe('TextInput @avt', () => {
await expect(page.getByRole('textbox')).toBeDisabled();
await expect(page).toHaveNoACViolations('TextInput-Disabled');
});

test('accessibility-checker keyboard nav', async ({ page }) => {
await visitStory(page, {
component: 'TextInput',
id: 'components-textinput--default',
globals: {
theme: 'white',
},
});
const input = page.getByRole('textbox');

// Check the focus
await expect(input).toBeVisible();
await page.keyboard.press('Tab');
await expect(input).toBeFocused();

// Check input interaction
await input.fill('Text');
await expect(input).toHaveValue('Text');
await page.keyboard.press('Backspace');
await expect(input).toHaveValue('Tex');
});

test('accessibility-checker keyboard nav for password', async ({ page }) => {
await visitStory(page, {
component: 'TextInput',
id: 'components-textinput--toggle-password-visibility',
globals: {
theme: 'white',
},
});
const input = page.getByRole('textbox');
const span = page.locator('span.cds--assistive-text');

await page.keyboard.press('Tab');
await input.fill('Text');

// Checking toggle interaction
await page.keyboard.press('Tab');
await expect(span).toHaveText('Show password');
await page.keyboard.press('Enter');
await expect(span).toHaveText('Hide password');
});
});
8 changes: 8 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3866,6 +3866,7 @@ Map {
},
},
"GlobalTheme" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"children": Object {
"type": "node",
Expand All @@ -3882,6 +3883,7 @@ Map {
"type": "oneOf",
},
},
"render": [Function],
},
"Grid" => Object {
"propTypes": Object {
Expand Down Expand Up @@ -4104,6 +4106,7 @@ Map {
},
},
"Heading" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"children": Object {
"type": "node",
Expand All @@ -4112,6 +4115,7 @@ Map {
"type": "string",
},
},
"render": [Function],
},
"IconButton" => Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -4393,6 +4397,7 @@ Map {
},
},
"Layer" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"as": Object {
"args": Array [
Expand Down Expand Up @@ -4427,6 +4432,7 @@ Map {
"type": "oneOf",
},
},
"render": [Function],
},
"Link" => Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -6640,6 +6646,7 @@ Map {
},
"SecondaryButton" => Object {},
"Section" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"as": Object {
"type": "elementType",
Expand All @@ -6654,6 +6661,7 @@ Map {
"type": "number",
},
},
"render": [Function],
},
"Select" => Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down
28 changes: 18 additions & 10 deletions packages/react/src/components/Heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ type SectionProps<E extends ElementType> = PolymorphicProps<
SectionBaseProps
>;

export function Section<E extends ElementType = 'section'>({
as: BaseComponent = 'section' as E,
level: levelOverride,
...rest
}: SectionProps<E>) {
export const Section = React.forwardRef(function Section<
E extends ElementType = 'section'
>(
{
as: BaseComponent = 'section' as E,
level: levelOverride,
...rest
}: SectionProps<E>,
ref: React.Ref<unknown>
) {
const parentLevel = React.useContext(HeadingContext);
const level = levelOverride ?? parentLevel + 1;
const BaseComponentAsAny = BaseComponent as any;

return (
<HeadingContext.Provider value={Math.min(level, 6) as HeadingLevel}>
<BaseComponentAsAny {...rest} />
<BaseComponentAsAny ref={ref} {...rest} />
</HeadingContext.Provider>
);
}
});

Section.propTypes = {
/**
Expand All @@ -63,10 +68,13 @@ Section.propTypes = {

type HeadingProps = JSX.IntrinsicElements[`h${HeadingLevel}`];

export function Heading(props: HeadingProps) {
export const Heading = React.forwardRef(function Heading(
props: HeadingProps,
ref: React.Ref<HTMLHeadingElement>
) {
const HeadingIntrinsic = `h${React.useContext(HeadingContext)}` as const;
return <HeadingIntrinsic {...props} />;
}
return <HeadingIntrinsic ref={ref} {...props} />;
});

Heading.propTypes = {
/**
Expand Down
21 changes: 12 additions & 9 deletions packages/react/src/components/Layer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ export function useLayer() {
};
}

export function Layer({
as: BaseComponent = 'div',
className: customClassName,
children,
level: overrideLevel,
...rest
}) {
export const Layer = React.forwardRef(function Layer(
{
as: BaseComponent = 'div',
className: customClassName,
children,
level: overrideLevel,
...rest
},
ref
) {
const contextLevel = React.useContext(LayerContext);
const level = overrideLevel ?? contextLevel;
const prefix = usePrefix();
Expand All @@ -42,12 +45,12 @@ export function Layer({

return (
<LayerContext.Provider value={value}>
<BaseComponent {...rest} className={className}>
<BaseComponent ref={ref} {...rest} className={className}>
{children}
</BaseComponent>
</LayerContext.Provider>
);
}
});

Layer.propTypes = {
/**
Expand Down
Loading

0 comments on commit a6f5916

Please sign in to comment.