Skip to content

Commit

Permalink
Merge branch 'main' into add_typescript_types_to_fluidSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
Gururajj77 authored Sep 10, 2024
2 parents 179cb57 + 0dc9eb3 commit 7919e82
Show file tree
Hide file tree
Showing 194 changed files with 779 additions and 1,112 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ packages/**/examples/**

# Upgrade
packages/upgrade/cli.js
packages/upgrade/**/*.output.js

# Accessibility Verification Testing
**/.avt/**
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/arg-npm-5.0.2-2f5805a547-92fe7de222.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ip-npm-1.1.5-af36318aa6-40a00572cf.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ret-npm-0.1.15-0d3c19de76-07c9e7619b.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/urix-npm-0.1.0-bd5e55a13a-ebf5df5491.zip
Binary file not shown.
Binary file removed .yarn/cache/use-npm-3.1.1-7ba643714c-08a130289f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,9 @@ Map {
"type": "string",
},
"ariaLabel": [Function],
"autoAlign": Object {
"type": "bool",
},
"children": Object {
"type": "node",
},
Expand Down Expand Up @@ -1799,6 +1802,9 @@ Map {
],
"type": "oneOf",
},
"autoAlign": Object {
"type": "bool",
},
"children": Object {
"type": "node",
},
Expand Down Expand Up @@ -1836,6 +1842,9 @@ Map {
],
"type": "oneOf",
},
"autoAlign": Object {
"type": "bool",
},
"className": Object {
"type": "string",
},
Expand Down Expand Up @@ -4227,6 +4236,9 @@ Map {
],
"type": "oneOf",
},
"autoAlign": Object {
"type": "bool",
},
"children": Object {
"type": "node",
},
Expand Down
51 changes: 51 additions & 0 deletions packages/react/code-connect/AILabel/AILabel.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* 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.
*/

// @ts-nocheck
import React from 'react';
import { AILabel } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabel,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=51447-1916&t=9XaizJDx8eI6KgQz-4',
{
props: {
aiText: figma.string('Text translation'),
size: figma.enum('Size', {
'16px': 'mini',
'20px': '2xs',
'24px': 'xs',
'32px': 'sm',
'40px': 'md',
'48px': 'lg',
'64px': 'xl',
}),
},
example: ({ ...props }) => <AILabel autoAlign {...props} />,
}
);

// inline
figma.connect(
AILabel,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=51447-2035&t=9XaizJDx8eI6KgQz-4',
{
props: {
aiText: figma.string('Text translation'),
textLabel: figma.enum('Type', {
'Text + Icon': figma.string('Slug text'),
}),
size: figma.enum('Size', {
'12px': 'sm',
'14px': 'md',
'16px': 'lg',
}),
},
example: ({ ...props }) => <AILabel autoAlign kind="inline" {...props} />,
}
);
22 changes: 22 additions & 0 deletions packages/react/code-connect/AILabel/AILabelActions.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* 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.
*/

// @ts-nocheck
import React from 'react';
import { AILabelActions } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabelActions,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=57561-3559&t=SB9qULZbn3FRopvU-4',
{
props: {
children: figma.children('*'),
},
example: ({ children }) => <AILabelActions>{children}</AILabelActions>,
}
);
64 changes: 64 additions & 0 deletions packages/react/code-connect/AILabel/AILabelContent.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* 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.
*/

// @ts-nocheck
import React from 'react';
import { AILabelContent } from '@carbon/react';
import figma from '@figma/code-connect';

figma.connect(
AILabelContent,
'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=57561-3508&t=SB9qULZbn3FRopvU-4',
{
props: {
title: figma.string('AI title'),
description: figma.string('AI description'),
slotOne: figma.boolean('Slot 1', {
true: figma.instance('Swap slot 1'),
false: '',
}),
slotTwo: figma.boolean('Slot 2', {
true: figma.instance('Swap slot 2'),
}),
slotThree: figma.boolean('Slot 3', {
true: figma.instance('Swap slot 3'),
}),
slotFour: figma.boolean('Slot 4', {
true: figma.instance('Swap slot 4'),
}),
actions: figma.children(['Actions footer']),
},
example: ({
title,
description,
slotOne,
slotTwo,
slotThree,
slotFour,
actions,
}) => (
<AILabelContent>
{slotOne}
<div>
<p>AI Explained</p>
<h1>{title}</h1>
<p>{description}</p>
{slotOne}
<hr />
{slotTwo}
<p>
This is sample placeholder content, replace with your own content
and custom styles.
</p>
{slotThree}
{slotFour}
</div>
{actions}
</AILabelContent>
),
}
);
9 changes: 5 additions & 4 deletions packages/react/code-connect/Tabs/Tabs.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable react/jsx-no-duplicate-props */
// @ts-nocheck
import React from 'react';
import {
Expand Down Expand Up @@ -34,12 +33,14 @@ figma.connect(
size: figma.enum('Size', {
Large: 'lg',
}),
dismissable: figma.boolean('Dismissible'),
dismissablePlusIcon: figma.boolean('Dismissible + Icon'),
dismissable: figma.boolean('Dismissible', {
true: true,
false: figma.boolean('Dismissible + Icon'),
}),
}),
},
example: ({ children, contained, fullWidth, tab }) => (
<Tabs dismissable={tab.dismissable} dismissable={tab.dismissablePlusIcon}>
<Tabs dismissable={tab.dismissable}>
<TabList
aria-label="List of tabs"
contained={contained}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/code-connect/Tooltip/Tooltip.figma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ figma.connect(
openOnHover
definition={tooltip.definition}
align={align}>
{tooltip.children}
{item.children}
</DefinitionTooltip>
),
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@babel/preset-typescript": "^7.24.7",
"@carbon/test-utils": "^10.32.0-rc.0",
"@carbon/themes": "^11.40.0-rc.0",
"@figma/code-connect": "^1.0.4",
"@figma/code-connect": "^1.0.6",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-commonjs": "^26.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
Expand Down Expand Up @@ -131,7 +131,7 @@
"style-loader": "^4.0.0",
"typescript-config-carbon": "^0.3.0",
"webpack": "^5.65.0",
"webpack-dev-server": "^4.7.4"
"webpack-dev-server": "^5.0.0"
},
"sideEffects": [
"es/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps> =
return (
<li className={className} ref={ref} {...rest}>
{href ? (
<Link href={href} aria-current={ariaCurrent}>
<Link href={href} aria-current={ariaCurrent || isCurrentPage}>
{children}
</Link>
) : (
Expand Down
13 changes: 13 additions & 0 deletions packages/react/src/components/CodeSnippet/CodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export interface CodeSnippetProps {
| 'left'
| 'right';

/**
* **Experimental**: Will attempt to automatically align the tooltip
*/
autoAlign?: boolean;

/**
* Specify a label to be read by screen readers on the containing textbox
* node
Expand Down Expand Up @@ -150,6 +155,7 @@ export interface CodeSnippetProps {

function CodeSnippet({
align = 'bottom',
autoAlign = false,
className,
type = 'single',
children,
Expand Down Expand Up @@ -304,6 +310,7 @@ function CodeSnippet({
<Copy
{...rest}
align={align}
autoAlign={autoAlign}
onClick={handleCopyClick}
aria-label={deprecatedAriaLabel || ariaLabel}
aria-describedby={uid}
Expand Down Expand Up @@ -377,6 +384,7 @@ function CodeSnippet({
{!hideCopyButton && (
<CopyButton
align={align}
autoAlign={autoAlign}
size={type === 'multi' ? 'sm' : 'md'}
disabled={disabled}
onClick={handleCopyClick}
Expand Down Expand Up @@ -437,6 +445,11 @@ CodeSnippet.propTypes = {
'This prop syntax has been deprecated. Please use the new `aria-label`.'
),

/**
* **Experimental**: Will attempt to automatically align the tooltip
*/
autoAlign: PropTypes.bool,

/**
* Provide the content of your CodeSnippet as a node or string
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/components/ComboBox/ComboBox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ describe('ComboBox', () => {
expect(findInputNode()).toHaveDisplayValue('Apple');
});

it('should handle InputBlur with allowCustomValue', async () => {
render(<ComboBox {...mockProps} allowCustomValue />);
await userEvent.type(findInputNode(), 'Apple');
fireEvent.blur(findInputNode());
expect(findInputNode()).toHaveDisplayValue('Apple');
});

it('should apply onChange value if custom value is entered and `allowCustomValue` is set', async () => {
render(<ComboBox {...mockProps} allowCustomValue />);

Expand Down
17 changes: 13 additions & 4 deletions packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,15 @@ const ComboBox = forwardRef(
const { highlightedIndex } = changes;

switch (type) {
case InputBlur:
case InputBlur: {
if (allowCustomValue && highlightedIndex == '-1') {
const customValue = inputValue as ItemType;
changes.selectedItem = customValue;
if (onChange) {
onChange({ selectedItem: inputValue as ItemType, inputValue });
}
return changes;
}
if (
state.inputValue &&
highlightedIndex == '-1' &&
Expand All @@ -502,16 +510,17 @@ const ComboBox = forwardRef(
...changes,
inputValue: itemToString(changes.selectedItem),
};
} else if (
}
if (
state.inputValue &&
highlightedIndex == '-1' &&
!allowCustomValue &&
!changes.selectedItem
) {
return { ...changes, inputValue: '' };
} else {
return changes;
}
return changes;
}
case InputKeyDownEnter:
if (allowCustomValue) {
setInputValue(inputValue);
Expand Down
12 changes: 12 additions & 0 deletions packages/react/src/components/Copy/Copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
| 'left'
| 'right';

/**
* **Experimental**: Will attempt to automatically align the tooltip
*/
autoAlign?: boolean;

/**
* Specify an optional className to be applied to the underlying `<button>`
*/
Expand Down Expand Up @@ -66,6 +71,7 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {

export default function Copy({
align = 'bottom',
autoAlign = false,
children,
className,
feedback = 'Copied!',
Expand Down Expand Up @@ -112,6 +118,7 @@ export default function Copy({
<IconButton
closeOnActivation={false}
align={align}
autoAlign={autoAlign}
className={classNames}
label={animation ? feedback : initialLabel}
onClick={composeEventHandlers([onClick, handleClick])}
Expand Down Expand Up @@ -143,6 +150,11 @@ Copy.propTypes = {
'right',
]),

/**
* **Experimental**: Will attempt to automatically align the tooltip
*/
autoAlign: PropTypes.bool,

/**
* Pass in content to be rendered in the underlying `<button>`
*/
Expand Down
Loading

0 comments on commit 7919e82

Please sign in to comment.