Skip to content

Commit dff635b

Browse files
authored
Merge branch 'main' into ui-shell-screen-reader
2 parents 5ff3bee + 987bf7e commit dff635b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+669
-125
lines changed

.all-contributorsrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,7 @@
18501850
]
18511851
},
18521852
{
1853+
18531854
"login": "murito",
18541855
"name": "Francisco Alcalá",
18551856
"avatar_url": "https://avatars.githubusercontent.com/u/2628140?v=4",
@@ -1858,6 +1859,15 @@
18581859
"code"
18591860
]
18601861
},
1862+
{
1863+
"login": "dkaushik95",
1864+
"name": "Dishant Kaushik",
1865+
"avatar_url": "https://avatars.githubusercontent.com/u/8481567?v=4",
1866+
"profile": "https://github.com/dkaushik95",
1867+
"contributions": [
1868+
"code"
1869+
]
1870+
},
18611871
{
18621872
"login": "Code-Suji",
18631873
"name": "SUJITH C S",
@@ -1875,6 +1885,15 @@
18751885
"contributions": [
18761886
"code"
18771887
]
1888+
},
1889+
{
1890+
"login": "sojinantony01",
1891+
"name": "Sojin antony",
1892+
"avatar_url": "https://avatars.githubusercontent.com/u/29255847?v=4",
1893+
"profile": "https://github.com/sojinantony01",
1894+
"contributions": [
1895+
"code"
1896+
]
18781897
}
18791898
],
18801899
"commitConvention": "none"

.github/workflows/metrics-merge-rate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
echo "- **Merge Rate**: $MERGE_RATE%" >> $GITHUB_STEP_SUMMARY
4747
4848
- name: Send message to Slack
49-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
49+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
5050
with:
5151
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
5252
webhook-type: incoming-webhook

.github/workflows/slack-announcement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
steps:
3838
- name: Send slack announcement
3939
id: slack
40-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
40+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
4141
with:
4242
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
4343
webhook-type: incoming-webhook

.github/workflows/slack-build-notifications.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- name: Send custom JSON data to Slack
2626
id: slack-success
27-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
27+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
2828
with:
2929
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
3030
webhook-type: incoming-webhook
@@ -41,7 +41,7 @@ jobs:
4141
steps:
4242
- name: Send custom JSON data to Slack
4343
id: slack-failure
44-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
44+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
4545
with:
4646
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
4747
webhook-type: incoming-webhook

.github/workflows/slack-office-hours-design.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- name: Send custom JSON data to Slack workflow
1515
id: slack
16-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
16+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
1717
with:
1818
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
1919
webhook-type: incoming-webhook

.github/workflows/slack-office-hours-dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: Send custom JSON data to Slack workflow
1414
id: slack
15-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
15+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
1616
with:
1717
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
1818
webhook-type: incoming-webhook
@@ -104,7 +104,7 @@ jobs:
104104
steps:
105105
- name: Send custom JSON data to Slack workflow
106106
id: slack
107-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
107+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
108108
with:
109109
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
110110
webhook-type: incoming-webhook
@@ -196,7 +196,7 @@ jobs:
196196
steps:
197197
- name: Send custom JSON data to Slack workflow
198198
id: slack
199-
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
199+
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
200200
with:
201201
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
202202
webhook-type: incoming-webhook
Binary file not shown.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,16 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
336336
<td align="center"><a href="https://github.com/maisonsmd"><img src="https://avatars.githubusercontent.com/u/16435155?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Son H. Mai (Mason)</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=maisonsmd" title="Code">💻</a></td>
337337
<td align="center"><a href="https://github.com/warrenmblood"><img src="https://avatars.githubusercontent.com/u/69060697?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Warren Blood</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=warrenmblood" title="Code">💻</a></td>
338338
<td align="center"><a href="https://github.com/vcherneny"><img src="https://avatars.githubusercontent.com/u/11604315?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Cherneny</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=vcherneny" title="Code">💻</a></td>
339+
<td align="center"><a href="https://github.com/dkaushik95"><img src="https://avatars.githubusercontent.com/u/8481567?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dishant Kaushik</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=dkaushik95" title="Code">💻</a></td>
340+
<td align="center"><a href="https://github.com/jose-biescas"><img src="https://avatars.githubusercontent.com/u/188625806?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jose Biescas</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=jose-biescas" title="Code">💻</a></td>
341+
</tr>
342+
<tr>
339343
<td align="center"><a href="https://github.com/murito"><img src="https://avatars.githubusercontent.com/u/2628140?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Francisco Alcalá</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=murito" title="Code">💻</a></td>
340344
<td align="center"><a href="https://www.linkedin.com/in/sujithcs"><img src="https://avatars.githubusercontent.com/u/43125517?v=4?s=100" width="100px;" alt=""/><br /><sub><b>SUJITH C S</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Code-Suji" title="Code">💻</a></td>
345+
</tr>
346+
<tr>
341347
<td align="center"><a href="https://github.com/mariyageorge01"><img src="https://avatars.githubusercontent.com/u/166684108?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mariya George</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=mariyageorge01" title="Code">💻</a></td>
348+
<td align="center"><a href="https://github.com/sojinantony01"><img src="https://avatars.githubusercontent.com/u/29255847?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sojin antony</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=sojinantony01" title="Code">💻</a></td>
342349
</tr>
343350
</table>
344351

e2e/components/Modal/Modal-test.avt.e2e.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ test.describe('@avt Modal', () => {
3434
const button = page.getByRole('button', { name: 'Launch modal' });
3535

3636
// Open the modal via keyboard navigation
37-
await expect(button).toBeFocused();
3837
button.press('Enter');
3938

4039
// The first interactive item in the modal should be focused once the modal is open

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
],
2121
coveragePathIgnorePatterns: ['packages/web-components/*'],
2222
testPathIgnorePatterns: ['packages/web-components/*'],
23-
transformIgnorePatterns: ['<rootDir>/node_modules/(?!lodash-es)'],
23+
transformIgnorePatterns: ['<rootDir>/node_modules/(?!lodash-es|nanoid)'],
2424
moduleNameMapper: {
2525
// This is a temporary workaround from moving to Jest v28. In this update,
2626
// certain dependencies are only providing ESM through exports and so we use

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,6 +2943,9 @@ Map {
29432943
"disabled": Object {
29442944
"type": "bool",
29452945
},
2946+
"dismissTooltipLabel": Object {
2947+
"type": "string",
2948+
},
29462949
"id": Object {
29472950
"type": "string",
29482951
},
@@ -7063,6 +7066,9 @@ Map {
70637066
"className": Object {
70647067
"type": "string",
70657068
},
7069+
"defaultSelected": Object {
7070+
"type": "bool",
7071+
},
70667072
"disabled": Object {
70677073
"type": "bool",
70687074
},

packages/react/src/components/DatePicker/DatePicker-test.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,66 @@ describe('DatePicker', () => {
350350
expect(screen.getByLabelText('Date Picker label')).toHaveValue('');
351351
warn.mockRestore();
352352
});
353+
354+
it('end date in range mode should not retain old value after setting to null', async () => {
355+
const DatePickerExample = () => {
356+
const resetValues = { fromDate: null, toDate: null };
357+
const [dateRange, setDateRange] = useState(resetValues);
358+
const onChange = ({ fromDate, toDate }) => {
359+
setDateRange({ fromDate, toDate });
360+
};
361+
return (
362+
<>
363+
<DatePicker
364+
datePickerType="range"
365+
onChange={(dates) => {
366+
const [start, end] = dates;
367+
onChange({ fromDate: start, toDate: end });
368+
}}
369+
value={
370+
dateRange ? [dateRange.fromDate, dateRange.toDate] : [null, null]
371+
}>
372+
<DatePickerInput
373+
id="fromDate"
374+
placeholder="mm/dd/yyyy"
375+
labelText="FromDate"
376+
/>
377+
<DatePickerInput
378+
id="toDate"
379+
placeholder="mm/dd/yyyy"
380+
labelText="ToDate"
381+
/>
382+
</DatePicker>
383+
<button type="button" onClick={() => setDateRange(resetValues)}>
384+
reset
385+
</button>
386+
</>
387+
);
388+
};
389+
render(<DatePickerExample />);
390+
391+
// populate fromDate and toDate values
392+
await userEvent.type(
393+
screen.getByLabelText('FromDate'),
394+
'01/14/2025{enter}'
395+
);
396+
await userEvent.type(screen.getByLabelText('ToDate'), '02/10/2025{enter}');
397+
398+
// reset both values
399+
await userEvent.click(screen.getByText('reset'));
400+
401+
// assert that toDate is empty
402+
expect(screen.getByLabelText('ToDate')).toHaveValue('');
403+
404+
// populate fromDate
405+
await userEvent.type(
406+
screen.getByLabelText('FromDate'),
407+
'01/14/2025{enter}'
408+
);
409+
410+
// assert that toDate is still empty
411+
expect(screen.getByLabelText('ToDate')).toHaveValue('');
412+
});
353413
});
354414

355415
describe('Simple date picker', () => {

packages/react/src/components/DatePicker/DatePicker.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export type CalRef = {
205205
export interface DatePickerProps {
206206
/**
207207
* Flatpickr prop passthrough enables direct date input, and when set to false,
208-
* we must clear dates manually by resetting the value prop to empty string making it a controlled input.
208+
* we must clear dates manually by resetting the value prop to to a falsy value (such as `""`, `null`, or `undefined`) or an array of all falsy values, making it a controlled input.
209209
*/
210210
allowInput?: boolean;
211211

@@ -853,10 +853,18 @@ const DatePicker = React.forwardRef(function DatePicker(
853853
calendarRef.current.set('inline', inline);
854854
}
855855
}, [inline]);
856+
856857
useEffect(() => {
857-
//when value prop is set to empty, this clears the flatpicker's calendar instance and text input
858-
if (value === '') {
858+
// when value prop is manually reset, this clears the flatpickr calendar instance and text input
859+
// run if both:
860+
// 1. value prop is set to a falsy value (`""`, `undefined`, `null`, etc) OR an array of all falsy values
861+
// 2. flatpickr instance contains values in its `selectedDates` property so it hasn't already been cleared
862+
if (
863+
(!value || (Array.isArray(value) && value.every((date) => !date))) &&
864+
calendarRef.current?.selectedDates.length
865+
) {
859866
calendarRef.current?.clear();
867+
860868
if (startInputField.current) {
861869
startInputField.current.value = '';
862870
}
@@ -974,7 +982,7 @@ const DatePicker = React.forwardRef(function DatePicker(
974982
DatePicker.propTypes = {
975983
/**
976984
* Flatpickr prop passthrough enables direct date input, and when set to false,
977-
* we must clear dates manually by resetting the value prop to empty string making it a controlled input.
985+
* we must clear dates manually by resetting the value prop to a falsy value (such as `""`, `null`, or `undefined`) or an array of all falsy values, making it a controlled input.
978986
*/
979987
allowInput: PropTypes.bool,
980988

0 commit comments

Comments
 (0)