diff --git a/.gitignore b/.gitignore index 2efa16ac53..3ce48634de 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,6 @@ typings/ .angular -packages/components/src/components.d.ts \ No newline at end of file +packages/components/src/components.d.ts + +.angular \ No newline at end of file diff --git a/examples/wrapper-components/react-javascript/src/App.js b/examples/wrapper-components/react-javascript/src/App.js index 958b9644b2..d818cb50a8 100644 --- a/examples/wrapper-components/react-javascript/src/App.js +++ b/examples/wrapper-components/react-javascript/src/App.js @@ -1,19 +1,45 @@ import './App.css'; + +import Button from './components/Button/button'; + import TextField from './components/TextFIeld/TextField'; import ProgressBar from './components/ProgressBar/ProgressBar'; +import SearchBar from './components/SearchBar/SearchBar'; +import Accordion from './components/Accordion/Accordion'; function App() { + + + return (
- +

Stencil Framework integration - React + JS

+ +

Search Bar

+ +
+ +

Button

+
) } - export default App; diff --git a/examples/wrapper-components/react-javascript/src/components/Accordion/Accordion.js b/examples/wrapper-components/react-javascript/src/components/Accordion/Accordion.js new file mode 100644 index 0000000000..30f7351833 --- /dev/null +++ b/examples/wrapper-components/react-javascript/src/components/Accordion/Accordion.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { IfxAccordion } from '@infineon/infineon-design-system-react'; +import { IfxAccordionItem } from '@infineon/infineon-design-system-react'; + +function Accordion() { + const handleItems = (event) => { + console.log("An accordion item was opened. Event details:", event); + }; + + return ( +
+ + + + + I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. + I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. + I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. + I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. + I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea.I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. I have no idea. + + + I have no idea. + + + I have no idea. + + +
+ ) +} + +export default Accordion; \ No newline at end of file diff --git a/examples/wrapper-components/react-javascript/src/components/Button/button.js b/examples/wrapper-components/react-javascript/src/components/Button/button.js new file mode 100644 index 0000000000..144d5e6b68 --- /dev/null +++ b/examples/wrapper-components/react-javascript/src/components/Button/button.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { IfxButton } from '@infineon/infineon-design-system-react'; + +function Button() { + return ( +
+ Yes + No +
+ ) +} + +export default Button; \ No newline at end of file diff --git a/examples/wrapper-components/react-javascript/src/components/ProgressBar/ProgressBar.js b/examples/wrapper-components/react-javascript/src/components/ProgressBar/ProgressBar.js index a1ec906107..1962484ea3 100644 --- a/examples/wrapper-components/react-javascript/src/components/ProgressBar/ProgressBar.js +++ b/examples/wrapper-components/react-javascript/src/components/ProgressBar/ProgressBar.js @@ -1,12 +1,30 @@ -import React from 'react'; -import { IfxProgressBar } from '@infineon/infineon-design-system-react'; +import React, { useState } from 'react'; +import { IfxProgressBar, IfxButton } from '@infineon/infineon-design-system-react'; function ProgressBar() { + const [progressValue, setProgressValue] = useState(25); + + // Define your methods here + const updateProgressOnClick = () => { + setProgressValue((currentValue) => { + console.log("updating progress-bar value ", progressValue) + if (currentValue < 100) { + return currentValue + 10; + } else { + return 10; + } + }); + }; + return (
- -
+ + + Update Progress + + ); } -export default ProgressBar; \ No newline at end of file +export default ProgressBar; diff --git a/examples/wrapper-components/react-javascript/src/components/SearchBar/SearchBar.js b/examples/wrapper-components/react-javascript/src/components/SearchBar/SearchBar.js new file mode 100644 index 0000000000..306bba2ffc --- /dev/null +++ b/examples/wrapper-components/react-javascript/src/components/SearchBar/SearchBar.js @@ -0,0 +1,18 @@ +import React from 'react'; +import { IfxSearchBar } from '@infineon/infineon-design-system-react'; + +function SearchBar() { + const handleSearch = (event) => { + console.log("handling search: ", event.detail?.detail) + }; + return ( +
+ + +
+ ) +} + +export default SearchBar; + + diff --git a/packages/components/src/components/button/button.scss b/packages/components/src/components/button/button.scss index 5045c3a3d0..c9fb07d170 100644 --- a/packages/components/src/components/button/button.scss +++ b/packages/components/src/components/button/button.scss @@ -91,6 +91,10 @@ .btn { + & ifx-icon:empty { + display: none; + } + &.btn-s { font-size: tokens.$font-size-s; min-width: 71px; @@ -98,29 +102,6 @@ line-height: 16px; } - &.icon-button { - min-width: initial; - min-height: initial; - width: 40px; - height: 40px; - padding: 0; - justify-content: center; - - &.btn-round { - border-radius: 100px; - } - - &.btn-square { - border-radius: 1px; - } - - &.btn-s { - width: 32px; - height: 32px; - } - - } - &.btn-primary, &.btn-outline-primary, &.btn-secondary, diff --git a/packages/components/src/components/button/button.tsx b/packages/components/src/components/button/button.tsx index 802cfbb129..255622a283 100644 --- a/packages/components/src/components/button/button.tsx +++ b/packages/components/src/components/button/button.tsx @@ -1,4 +1,4 @@ -import { Component, Prop, h, Host, Method, Element } from '@stencil/core'; +import { Component, Prop, h, Host, Method, Element, Watch, State } from '@stencil/core'; import classNames from 'classnames'; @Component({ @@ -10,17 +10,25 @@ import classNames from 'classnames'; export class Button { @Prop() variant: 'solid' | 'outline' | 'outline-text' = 'solid'; @Prop() color: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' = 'primary'; - @Prop() size: string = 'm'; + @Prop() size: string; @Prop() disabled: boolean; @Prop() icon: string; - @Prop({ mutable: true }) position: string = 'left' - + @Prop() position: string = 'left' + @State() internalPosition: string; @Prop() href: string; @Prop() target: string = '_self'; @Element() el; private focusableElement: HTMLElement; + @Watch('position') + reassignPosition(newValue: string) { + if (newValue && newValue !== this.internalPosition) { + if(newValue.toUpperCase() === "LEFT" || newValue.toUpperCase() === "RIGHT") + this.internalPosition = newValue; + } + } + @Method() async setFocus() { this.focusableElement.focus(); @@ -28,12 +36,11 @@ export class Button { componentWillLoad() { if (this.position.toUpperCase() !== "LEFT") { - this.position = 'right'; - } + this.internalPosition = 'left'; + } else this.internalPosition = this.position; } - render() { return ( @@ -45,20 +52,19 @@ export class Button { target={this.target} rel={this.target === '_blank' ? 'noopener noreferrer' : undefined} > - {this.icon && this.position.toUpperCase() === "LEFT" && } + {this.icon && this.internalPosition.toUpperCase() === "LEFT" && } - {this.icon && this.position.toUpperCase() === "RIGHT" && } + {this.icon && this.internalPosition.toUpperCase() === "RIGHT" && } ) : ( )} diff --git a/packages/components/src/components/button/readme.md b/packages/components/src/components/button/readme.md index 04aaf5f8ab..a331d09670 100644 --- a/packages/components/src/components/button/readme.md +++ b/packages/components/src/components/button/readme.md @@ -14,7 +14,7 @@ | `href` | `href` | | `string` | `undefined` | | `icon` | `icon` | | `string` | `undefined` | | `position` | `position` | | `string` | `'left'` | -| `size` | `size` | | `string` | `'m'` | +| `size` | `size` | | `string` | `undefined` | | `target` | `target` | | `string` | `'_self'` | | `variant` | `variant` | | `"outline" \| "outline-text" \| "solid"` | `'solid'` |