Skip to content

Commit

Permalink
Merge branch 'main' into renovate/webpack-dev-server-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ariellalgilmore authored Sep 9, 2024
2 parents af10fae + 71c9596 commit 86827ef
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 121 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0
uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7.0.1
with:
branch: 'release/update-carbon-deps'
commit-message: 'chore(release): update carbon deps'
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0
uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7.0.1
with:
branch: 'release/update-carbon-deps'
commit-message: 'chore(release): update carbon deps'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0
uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7.0.1
with:
branch: 'release/${{ github.event.inputs.tag }}'
commit-message: 'chore(release): ${{ github.event.inputs.tag }}'
Expand Down
Binary file modified packages/react/examples/react-router/.yarn/install-state.gz
Binary file not shown.
29 changes: 9 additions & 20 deletions packages/react/examples/react-router/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2891,17 +2891,7 @@ __metadata:
languageName: node
linkType: hard

"@types/eslint-scope@npm:^3.7.3":
version: 3.7.7
resolution: "@types/eslint-scope@npm:3.7.7"
dependencies:
"@types/eslint": "npm:*"
"@types/estree": "npm:*"
checksum: 10/e2889a124aaab0b89af1bab5959847c5bec09809209255de0e63b9f54c629a94781daa04adb66bffcdd742f5e25a17614fb933965093c0eea64aacda4309380e
languageName: node
linkType: hard

"@types/eslint@npm:*, @types/eslint@npm:^7.29.0 || ^8.4.1":
"@types/eslint@npm:^7.29.0 || ^8.4.1":
version: 8.56.10
resolution: "@types/eslint@npm:8.56.10"
dependencies:
Expand Down Expand Up @@ -5659,13 +5649,13 @@ __metadata:
languageName: node
linkType: hard

"enhanced-resolve@npm:^5.17.0":
version: 5.17.0
resolution: "enhanced-resolve@npm:5.17.0"
"enhanced-resolve@npm:^5.17.1":
version: 5.17.1
resolution: "enhanced-resolve@npm:5.17.1"
dependencies:
graceful-fs: "npm:^4.2.4"
tapable: "npm:^2.2.0"
checksum: 10/8f7bf71537d78e7d20a27363793f2c9e13ec44800c7c7830364a448f80a44994aa19d64beecefa1ab49e4de6f7fbe18cc0931dc449c115f02918ff5fcbe7705f
checksum: 10/e8e03cb7a4bf3c0250a89afbd29e5ec20e90ba5fcd026066232a0754864d7d0a393fa6fc0e5379314a6529165a1834b36731147080714459d98924520410d8f5
languageName: node
linkType: hard

Expand Down Expand Up @@ -13249,10 +13239,9 @@ __metadata:
linkType: hard

"webpack@npm:^5.64.4":
version: 5.92.0
resolution: "webpack@npm:5.92.0"
version: 5.94.0
resolution: "webpack@npm:5.94.0"
dependencies:
"@types/eslint-scope": "npm:^3.7.3"
"@types/estree": "npm:^1.0.5"
"@webassemblyjs/ast": "npm:^1.12.1"
"@webassemblyjs/wasm-edit": "npm:^1.12.1"
Expand All @@ -13261,7 +13250,7 @@ __metadata:
acorn-import-attributes: "npm:^1.9.5"
browserslist: "npm:^4.21.10"
chrome-trace-event: "npm:^1.0.2"
enhanced-resolve: "npm:^5.17.0"
enhanced-resolve: "npm:^5.17.1"
es-module-lexer: "npm:^1.2.1"
eslint-scope: "npm:5.1.1"
events: "npm:^3.2.0"
Expand All @@ -13281,7 +13270,7 @@ __metadata:
optional: true
bin:
webpack: bin/webpack.js
checksum: 10/1d5e7e881615df05af7e58bd7ce872495cf6361f345f2b2a7dcbd8febd8761b68b7567e14f9ebbf1d666b6c78cc90c3f304fb10b8a457ab71aa7015116a7d6d9
checksum: 10/648449c5fbbb0839814116e3b2b044ac6c75a7ba272435155ddeb1e64dfaa2f8079be3adfbb691f648b69900756ce0f6fb73beab0ced3cf5e0fd46868b4593a6
languageName: node
linkType: hard

Expand Down
1 change: 0 additions & 1 deletion packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ const ComboBox = forwardRef(
)}
<ListBoxTrigger
{...buttonProps}
// @ts-expect-error
isOpen={isOpen}
translateWithId={translateWithId}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2023
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -20,14 +20,66 @@ import { usePrefix } from '../../../internal/usePrefix';
export const translationIds = {
'clear.all': 'clear.all',
'clear.selection': 'clear.selection',
};
} as const;

export type TranslationKey = keyof typeof translationIds;

const defaultTranslations = {
[translationIds['clear.all']]: 'Clear all selected items',
[translationIds['clear.selection']]: 'Clear selected item',
const defaultTranslations: Record<TranslationKey, string> = {
'clear.all': 'Clear all selected items',
'clear.selection': 'Clear selected item',
};

const defaultTranslateWithId = (id) => defaultTranslations[id];
function defaultTranslateWithId(id: TranslationKey): string {
return defaultTranslations[id];
}
export interface ListBoxSelectionProps {
/**
* Specify a function to be invoked when a user interacts with the clear
* selection element.
*/
clearSelection: (
event:
| React.MouseEvent<HTMLButtonElement>
| React.KeyboardEvent<HTMLButtonElement>
) => void;
/**
* Specify an optional `selectionCount` value that will be used to determine
* whether the selection should display a badge or a single clear icon.
*/
selectionCount?: number;
/**
* i18n hook used to provide the appropriate description for the given menu
* icon. This function takes in an id defined in `translationIds` and should
* return a string message for that given message id.
*/
translateWithId?: (id: TranslationKey) => string;
/**
* Specify whether or not the clear selection element should be disabled
*/
disabled?: boolean;
/**
* Specify an optional `onClearSelection` handler that is called when the underlying
* element is cleared
*/
onClearSelection?: (event: React.MouseEvent<HTMLButtonElement>) => void;
/**
* Specify an optional `onClick` handler that is called when the underlying
* clear selection element is clicked
*/
onClick?: React.MouseEventHandler<HTMLButtonElement>;

/**
* Specify an optional `onKeyDown` handler that is called when the underlying
* clear selection element fires a keydown event
*/
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;

/**
* Specify an optional `onMouseUp` handler that is called when the underlying
* clear selection element fires a mouseup event
*/
onMouseUp?: React.MouseEventHandler<HTMLButtonElement>;
}

function ListBoxSelection({
clearSelection,
Expand All @@ -36,7 +88,7 @@ function ListBoxSelection({
disabled,
onClearSelection,
...rest
}) {
}: ListBoxSelectionProps) {
const prefix = usePrefix();
const className = cx(`${prefix}--list-box__selection`, {
[`${prefix}--tag--filter`]: selectionCount,
Expand All @@ -52,7 +104,7 @@ function ListBoxSelection({
}
);

function onClick(event) {
function onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
event.stopPropagation();
if (disabled) {
return;
Expand All @@ -66,7 +118,9 @@ function ListBoxSelection({
if (selectionCount) {
return (
<div className={tagClasses}>
<span className={`${prefix}--tag__label`} title={selectionCount}>
<span
className={`${prefix}--tag__label`}
title={selectionCount?.toString()}>
{selectionCount}
</span>
<button
Expand Down Expand Up @@ -122,6 +176,12 @@ ListBoxSelection.propTypes = {
*/
onClick: PropTypes.func,

/**
* Specify an optional `onClick` handler that is called when the underlying
* clear selection element is clicked
*/
onMouseUp: PropTypes.func,

/**
* Specify an optional `onKeyDown` handler that is called when the underlying
* clear selection element fires a keydown event
Expand Down
70 changes: 0 additions & 70 deletions packages/react/src/components/ListBox/next/ListBoxTrigger.js

This file was deleted.

90 changes: 90 additions & 0 deletions packages/react/src/components/ListBox/next/ListBoxTrigger.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/**
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { ChevronDown } from '@carbon/icons-react';
import { usePrefix } from '../../../internal/usePrefix';

export const translationIds = {
'close.menu': 'close.menu',
'open.menu': 'open.menu',
} as const;

export type TranslationKey = keyof typeof translationIds;

const defaultTranslations: Record<TranslationKey, string> = {
[translationIds['close.menu']]: 'Close',
[translationIds['open.menu']]: 'Open',
};

const defaultTranslateWithId = (id: TranslationKey): string =>
defaultTranslations[id];

export interface ListBoxTriggerProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
/**
* Specify whether the menu is currently open, which will influence the
* direction of the menu icon
*/
isOpen: boolean;
/**
* i18n hook used to provide the appropriate description for the given menu
* icon. This function takes in an id defined in `translationIds` and should
* return a string message for that given message id.
*/
translateWithId?: (id: TranslationKey) => string;
}

/**
* `ListBoxTrigger` is used to orient the icon up or down depending on the
* state of the menu for a given `ListBox`
*/

const ListBoxTrigger = React.forwardRef<HTMLButtonElement, ListBoxTriggerProps>(
function ListBoxTrigger(
{ isOpen, translateWithId: t = defaultTranslateWithId, ...rest },
ref
) {
const prefix = usePrefix();
const className = cx({
[`${prefix}--list-box__menu-icon`]: true,
[`${prefix}--list-box__menu-icon--open`]: isOpen,
});
const description = isOpen ? t('close.menu') : t('open.menu');
return (
<button
{...rest}
aria-label={description}
title={description}
className={className}
type="button"
tabIndex={-1}
ref={ref}>
<ChevronDown />
</button>
);
}
);

ListBoxTrigger.propTypes = {
/**
* Specify whether the menu is currently open, which will influence the
* direction of the menu icon
*/
isOpen: PropTypes.bool.isRequired,

/**
* i18n hook used to provide the appropriate description for the given menu
* icon. This function takes in an id defined in `translationIds` and should
* return a string message for that given message id.
*/
translateWithId: PropTypes.func,
};

export default ListBoxTrigger;
9 changes: 0 additions & 9 deletions packages/react/src/components/ListBox/next/index.js

This file was deleted.

Loading

0 comments on commit 86827ef

Please sign in to comment.