-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AiSkeleton): adds in new AI skeleton states (#15711)
* feat(Skeleton): add new AI skeleton states * chore(AiSkeleton): add generated files, update snaps * fix(AiSkeleton): update dark themes * fix(AiSkeleton): update token values, adjust animation speed * fix(AISkeleton): update animation speed
- Loading branch information
Showing
24 changed files
with
431 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/carbon-components-react/scss/components/skeleton-styles/_ai-skeleton-styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Code generated by carbon-components-react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2023 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/skeleton-styles/ai-skeleton-styles'; |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components/scss/components/skeleton-styles/_ai-skeleton-styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Code generated by carbon-components. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2023 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/skeleton-styles/ai-skeleton-styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/react/scss/components/skeleton-styles/_ai-skeleton-styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Code generated by @carbon/react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2023 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/skeleton-styles/ai-skeleton-styles'; |
38 changes: 38 additions & 0 deletions
38
packages/react/src/components/AiSkeleton/AiSkeletonIcon.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
/* eslint-disable no-console */ | ||
|
||
import React from 'react'; | ||
|
||
import AiSkeletonIcon from './AiSkeletonIcon'; | ||
|
||
export default { | ||
title: 'Experimental/unstable__AiSkeleton/AiSkeletonIcon', | ||
component: AiSkeletonIcon, | ||
}; | ||
|
||
const propsSkeleton = { | ||
style: { | ||
margin: '50px', | ||
}, | ||
}; | ||
|
||
const propsSkeleton2 = { | ||
style: { | ||
margin: '50px', | ||
width: '24px', | ||
height: '24px', | ||
}, | ||
}; | ||
|
||
export const Default = () => ( | ||
<> | ||
<AiSkeletonIcon {...propsSkeleton} /> | ||
<AiSkeletonIcon {...propsSkeleton2} /> | ||
</> | ||
); |
47 changes: 47 additions & 0 deletions
47
packages/react/src/components/AiSkeleton/AiSkeletonIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* 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 PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { usePrefix } from '../../internal/usePrefix'; | ||
import { SkeletonIcon } from '../SkeletonIcon'; | ||
|
||
interface AiSkeletonIconProps { | ||
/** | ||
* Specify an optional className to add. | ||
*/ | ||
className?: string; | ||
|
||
/** | ||
* The CSS styles. | ||
*/ | ||
style?: React.CSSProperties; | ||
} | ||
|
||
const AiSkeletonIcon = ({ className, ...rest }: AiSkeletonIconProps) => { | ||
const prefix = usePrefix(); | ||
const AiSkeletonIconClasses = classNames(className, { | ||
[`${prefix}--skeleton__icon--ai`]: true, | ||
}); | ||
|
||
return <SkeletonIcon className={AiSkeletonIconClasses} {...rest} />; | ||
}; | ||
|
||
AiSkeletonIcon.propTypes = { | ||
/** | ||
* Specify an optional className to add. | ||
*/ | ||
className: PropTypes.string, | ||
|
||
/** | ||
* The CSS styles. | ||
*/ | ||
style: PropTypes.object, | ||
}; | ||
|
||
export default AiSkeletonIcon; |
19 changes: 19 additions & 0 deletions
19
packages/react/src/components/AiSkeleton/AiSkeletonPlaceholder.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
/* eslint-disable no-console */ | ||
|
||
import React from 'react'; | ||
|
||
import AiSkeletonPlaceholder from './AiSkeletonPlaceholder'; | ||
|
||
export default { | ||
title: 'Experimental/unstable__AiSkeleton/AiSkeletonPlaceholder', | ||
component: AiSkeletonPlaceholder, | ||
}; | ||
|
||
export const Default = () => <AiSkeletonPlaceholder className="test" />; |
44 changes: 44 additions & 0 deletions
44
packages/react/src/components/AiSkeleton/AiSkeletonPlaceholder.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { usePrefix } from '../../internal/usePrefix'; | ||
import { SkeletonPlaceholder } from '../SkeletonPlaceholder'; | ||
|
||
export interface AiSkeletonPlaceholderProps { | ||
/** | ||
* Add a custom class to the component to set the height and width | ||
*/ | ||
className?: string; | ||
} | ||
|
||
const AiSkeletonPlaceholder = ({ | ||
className, | ||
...other | ||
}: AiSkeletonPlaceholderProps) => { | ||
const prefix = usePrefix(); | ||
const AiSkeletonPlaceholderClasses = classNames( | ||
{ className, [`${prefix}--skeleton__placeholder--ai`]: true }, | ||
className | ||
); | ||
|
||
return ( | ||
<SkeletonPlaceholder className={AiSkeletonPlaceholderClasses} {...other} /> | ||
); | ||
}; | ||
|
||
AiSkeletonPlaceholder.propTypes = { | ||
/** | ||
* Add a custom class to the component | ||
* to set the height and width | ||
*/ | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default AiSkeletonPlaceholder; |
54 changes: 54 additions & 0 deletions
54
packages/react/src/components/AiSkeleton/AiSkeletonText.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
/* eslint-disable no-console */ | ||
|
||
import React from 'react'; | ||
|
||
import AiSkeletonText from './AiSkeletonText'; | ||
|
||
export default { | ||
title: 'Experimental/unstable__AiSkeleton/AiSkeletonText', | ||
component: AiSkeletonText, | ||
}; | ||
|
||
export const Default = () => <AiSkeletonText />; | ||
|
||
export const Playground = (args) => <AiSkeletonText {...args} />; | ||
|
||
Playground.args = { | ||
heading: false, | ||
paragraph: false, | ||
width: '100%', | ||
lineCount: 3, | ||
}; | ||
|
||
Playground.argTypes = { | ||
className: { | ||
control: false, | ||
}, | ||
heading: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
paragraph: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
width: { | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
lineCount: { | ||
control: { | ||
type: 'number', | ||
}, | ||
}, | ||
}; |
73 changes: 73 additions & 0 deletions
73
packages/react/src/components/AiSkeleton/AiSkeletonText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* 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 PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { usePrefix } from '../../internal/usePrefix'; | ||
import { SkeletonText } from '../SkeletonText'; | ||
|
||
interface AiSkeletonTextProps { | ||
/** | ||
* Specify an optional className to be applied to the container node. | ||
*/ | ||
className?: string; | ||
|
||
/** | ||
* Generates skeleton text at a larger size. | ||
*/ | ||
heading?: boolean; | ||
|
||
/** | ||
* The number of lines shown if paragraph is true. | ||
*/ | ||
lineCount?: number; | ||
|
||
/** | ||
* Set this to true to generate multiple lines of text. | ||
*/ | ||
paragraph?: boolean; | ||
|
||
/** | ||
* Width (in px or %) of single line of text or max-width of paragraph lines. | ||
*/ | ||
width?: string; | ||
} | ||
|
||
const AiSkeletonText = ({ className, ...rest }: AiSkeletonTextProps) => { | ||
const prefix = usePrefix(); | ||
const aiSkeletonTextClasses = classNames(className, { | ||
[`${prefix}--skeleton__text--ai`]: true, | ||
}); | ||
|
||
return <SkeletonText className={aiSkeletonTextClasses} {...rest} />; | ||
}; | ||
|
||
AiSkeletonText.propTypes = { | ||
/** | ||
* Specify an optional className to be applied to the container node | ||
*/ | ||
className: PropTypes.string, | ||
/** | ||
* generates skeleton text at a larger size | ||
*/ | ||
heading: PropTypes.bool, | ||
/** | ||
* the number of lines shown if paragraph is true | ||
*/ | ||
lineCount: PropTypes.number, | ||
/** | ||
* will generate multiple lines of text | ||
*/ | ||
paragraph: PropTypes.bool, | ||
/** | ||
* width (in px or %) of single line of text or max-width of paragraph lines | ||
*/ | ||
width: PropTypes.string, | ||
}; | ||
|
||
export default AiSkeletonText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* 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 AiSkeletonPlaceholder from './AiSkeletonPlaceholder'; | ||
import AiSkeletonIcon from './AiSkeletonIcon'; | ||
import AiSkeletonText from './AiSkeletonText'; | ||
|
||
export { AiSkeletonText, AiSkeletonIcon, AiSkeletonPlaceholder }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.