diff --git a/packages/react/code-connect/Checkbox/Checkbox.figma.tsx b/packages/react/code-connect/Checkbox/Checkbox.figma.tsx index c573e7882942..b21230284423 100644 --- a/packages/react/code-connect/Checkbox/Checkbox.figma.tsx +++ b/packages/react/code-connect/Checkbox/Checkbox.figma.tsx @@ -31,7 +31,9 @@ figma.connect( checked: figma.enum('Selection', { Checked: true, }), - helperText: figma.string('Helper text'), + helperText: figma.boolean('Helper message', { + true: figma.string('Helper text'), + }), invalid: figma.enum('State', { Invalid: true, }), diff --git a/packages/react/code-connect/Checkbox/CheckboxGroup.figma.tsx b/packages/react/code-connect/Checkbox/CheckboxGroup.figma.tsx index 206a005611b6..116a4fb43e9a 100644 --- a/packages/react/code-connect/Checkbox/CheckboxGroup.figma.tsx +++ b/packages/react/code-connect/Checkbox/CheckboxGroup.figma.tsx @@ -16,11 +16,12 @@ figma.connect( { props: { // horizontal: figma.boolean('Horizontal'), // missing in React - //helpermessage: figma.boolean('Helper message'), show/hide helper text in figma, in react if message is there it displays // warnMessage: figma.boolean('Warning message'), // you can have a component in a warn state while hiding warning message in Figma, not supported in code // errorMessage: figma.boolean('Error message'), // you can have a component in a error state while hiding error message in Figma, not supported in code children: figma.children(['Checkbox']), - helperText: figma.string('Helper text'), + helperText: figma.boolean('Helper message', { + true: figma.string('Helper text'), + }), readOnly: figma.enum('State', { 'Read-only': true, }), diff --git a/packages/react/code-connect/Dropdown/Dropdown.figma.tsx b/packages/react/code-connect/Dropdown/Dropdown.figma.tsx index 88fb324b272e..5dcb4e37b653 100644 --- a/packages/react/code-connect/Dropdown/Dropdown.figma.tsx +++ b/packages/react/code-connect/Dropdown/Dropdown.figma.tsx @@ -15,7 +15,9 @@ figma.connect( 'https://www.figma.com/file/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?type=design&node-id=14032-290635&mode=dev', { props: { - helperText: figma.string('Helper text'), + helperText: figma.boolean('Show helper', { + true: figma.string('Helper text'), + }), size: figma.enum('Size', { Large: 'lg', Medium: 'md', @@ -45,7 +47,6 @@ figma.connect( // Fixed: 'fixed', Inline: 'inline', }), - // showhelper: figma.boolean('Show helper'), // this doesn't exist in code, if helperText exists it will display // selectedtext: figma.string('Selected text'), // what is this used for in Figma? // unselectedtext: figma.string('Unselected text'),// what is this used for in Figma? }, diff --git a/packages/react/code-connect/NumberInput/NumberInputDefault.figma.tsx b/packages/react/code-connect/NumberInput/NumberInputDefault.figma.tsx index 66b0fedaf93f..1f0651138fd5 100644 --- a/packages/react/code-connect/NumberInput/NumberInputDefault.figma.tsx +++ b/packages/react/code-connect/NumberInput/NumberInputDefault.figma.tsx @@ -18,7 +18,9 @@ figma.connect( disabled: figma.enum('State', { Disabled: true, }), - helperText: figma.string('Helper text'), + helperText: figma.boolean('Show helper', { + true: figma.string('Helper text'), + }), hideLabel: figma.boolean('Show label', { true: false, false: true, @@ -41,7 +43,6 @@ figma.connect( }), warnText: figma.string('Warning text'), // value, text field in Figma - // showhelper: figma.boolean('Show helper'), // this doesn't exist in code, if helperText exists it will display }, example: ({ disabled, diff --git a/packages/react/code-connect/RadioButton/RadioButton.figma.tsx b/packages/react/code-connect/RadioButton/RadioButton.figma.tsx new file mode 100644 index 000000000000..9a2fabc54df0 --- /dev/null +++ b/packages/react/code-connect/RadioButton/RadioButton.figma.tsx @@ -0,0 +1,75 @@ +/** + * 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 { RadioButton, RadioButtonSkeleton } from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + RadioButton, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2930-23442&t=yFGI7EFVWv0vtqIk-4', + { + props: { + labelText: figma.string('Value text'), + labelPosition: figma.enum('Position', { + Right: 'right', + }), + hideLabel: figma.boolean('Value', { + true: false, + false: true, + }), + disabled: figma.enum('State', { + Disabled: true, + }), + defaultChecked: figma.boolean('Selected'), + // Below props are set on RadioButtonGroup only in code + // + // labeltext: figma.string('Label text'), + // warningtext: figma.string('Warning text'), + // helpermessage: figma.boolean('Helper message'), + // warningmessage: figma.boolean('Warning message'), + // errormessage: figma.boolean('Error message'), + // helpertext: figma.string('Helper text'), + // errortext: figma.string('Error text'), + // label: figma.boolean('Label'), + // state: figma.enum('State', { + // 'Read-only': 'read-only', + // Invalid: 'invalid', + // Warning: 'warning', + // }), + }, + example: ({ + labelText, + labelPosition, + hideLabel, + disabled, + defaultChecked, + }) => ( + + ), + } +); + +figma.connect( + RadioButtonSkeleton, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2930-23442&t=yFGI7EFVWv0vtqIk-4', + { + variant: { State: 'Skeleton' }, + example: () => { + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + ; + }, + } +); diff --git a/packages/react/code-connect/RadioButton/RadioButtonGroup.figma.tsx b/packages/react/code-connect/RadioButton/RadioButtonGroup.figma.tsx new file mode 100644 index 000000000000..7756afd4122f --- /dev/null +++ b/packages/react/code-connect/RadioButton/RadioButtonGroup.figma.tsx @@ -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 { RadioButtonGroup } from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + RadioButtonGroup, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2927-28166&t=yFGI7EFVWv0vtqIk-4', + { + props: { + children: figma.children(['Radio button']), + disabled: figma.enum('State', { + Disabled: true, + }), + helperText: figma.boolean('Helper message', { + true: figma.string('Helper text'), + }), + warnText: figma.string('Warning text'), + warn: figma.enum('State', { + Warning: true, + }), + invalidText: figma.string('Error text'), + invalid: figma.enum('State', { + Invalid: true, + }), + legendText: figma.string('Label text'), + orientation: figma.boolean('Horizontal', { + false: 'vertical', + }), + }, + example: ({ + children, + disabled, + helperText, + warnText, + warn, + invalidText, + invalid, + orientation, + legendText, + }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + {children} + + ), + } +); diff --git a/packages/react/code-connect/Search/FluidSearch.figma.tsx b/packages/react/code-connect/Search/FluidSearch.figma.tsx new file mode 100644 index 000000000000..da576eefb889 --- /dev/null +++ b/packages/react/code-connect/Search/FluidSearch.figma.tsx @@ -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 { + unstable__FluidSearch as FluidSearch, + // unstable__FluidSearchSkeleton as FluidSearchSkeleton, +} from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + FluidSearch, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=15503-270751&t=6KMXKibN414b97hv-4', + { + props: { + placeholder: figma.string('Placeholder text'), + labelText: figma.string('Label text'), + disabled: figma.enum('State', { + Disabled: true, + }), + }, + example: ({ placeholder, labelText, disabled }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + ), + } +); + +// missing from Figma +// figma.connect( +// FluidSearchSkeleton, +// 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=15503-270751&t=6KMXKibN414b97hv-4', +// { +// variant: { State: 'Skeleton' }, +// example: () => ( +// // Disclaimer: Code Connect is currently in beta and integration with Carbon +// // React is in an exploratory phase. Code sample below may be incomplete. +// +// ), +// } +// ); diff --git a/packages/react/code-connect/Search/Search.figma.tsx b/packages/react/code-connect/Search/Search.figma.tsx new file mode 100644 index 000000000000..57ad0cd8f346 --- /dev/null +++ b/packages/react/code-connect/Search/Search.figma.tsx @@ -0,0 +1,75 @@ +/** + * 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 { Search, ExpandableSearch, TextInputSkeleton } from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + Search, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2805-21056&t=6KMXKibN414b97hv-4', + { + props: { + size: figma.enum('Size', { + Large: 'lg', + Medium: 'md', + Small: 'sm', + }), + placeholder: figma.string('Placeholder text'), + disabled: figma.enum('State', { + Disabled: true, + }), + }, + example: ({ size, placeholder, disabled }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + ), + } +); + +figma.connect( + ExpandableSearch, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2805-21056&t=6KMXKibN414b97hv-4', + { + variant: { Expanded: 'True' }, // <--doesn't work + props: { + size: figma.enum('Size', { + Large: 'lg', + Medium: 'md', + Small: 'sm', + }), + placeholder: figma.string('Placeholder text'), + disabled: figma.enum('State', { + Disabled: true, + }), + }, + example: ({ size, placeholder, disabled }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + ), + } +); + +figma.connect( + TextInputSkeleton, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=2805-21056&t=6KMXKibN414b97hv-4', + { + variant: { State: 'Skeleton' }, + example: () => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + ), + } +); diff --git a/packages/react/code-connect/Select/FluidSelect.Figma.tsx b/packages/react/code-connect/Select/FluidSelect.Figma.tsx new file mode 100644 index 000000000000..bff358da5762 --- /dev/null +++ b/packages/react/code-connect/Select/FluidSelect.Figma.tsx @@ -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 { + unstable__FluidSelect as FluidSelect, + SelectItem, +} from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + FluidSelect, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=17650-275243&t=LS77peWFGhwOdxIw-4', + { + props: { + disabled: figma.enum('State', { + Disabled: true, + }), + labelText: figma.string('Label text'), + warn: figma.enum('State', { + Warning: true, + }), + warnText: figma.string('Warning text'), + invalid: figma.enum('State', { + Error: true, + }), + invalidText: figma.string('Error text'), + // showtooltip: figma.boolean('Show tooltip'), // not supported in react + // labelText: figma.boolean('Show tooltip', { + // true: 'add tooltip icon code here ', + // false: figma.string('Label text'), + // }), + }, + example: ({ + labelText, + warnText, + invalidText, + warn, + invalid, + disabled, + }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + + + + + + + ), + } +); diff --git a/packages/react/code-connect/Select/Select.figma.tsx b/packages/react/code-connect/Select/Select.figma.tsx new file mode 100644 index 000000000000..8b83f4f94ba6 --- /dev/null +++ b/packages/react/code-connect/Select/Select.figma.tsx @@ -0,0 +1,109 @@ +/** + * 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 { Select, SelectItem, SelectSkeleton } from '@carbon/react'; +import figma from '@figma/code-connect'; + +figma.connect( + Select, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=17650-274860&t=LS77peWFGhwOdxIw-4', + { + props: { + disabled: figma.enum('State', { + Disabled: true, + }), + hideLabel: figma.boolean('Show label', { + true: false, + false: true, + }), + inline: figma.enum('Style', { + Inline: true, + }), + readOnly: figma.enum('State', { + 'Read-only': true, + }), + invalid: figma.enum('State', { + Error: true, + }), + invalidText: figma.string('Error text'), + warn: figma.enum('State', { + Warning: true, + }), + warnText: figma.string('Warning text'), + // alternate if we want to only show warnText when warning is true + // probably don't want to do this as in code the user will need to + // set all of the warnText/invalidText props regardless + // warnText: figma.enum('State', { Warning: figma.string('Warning text') }), + labelText: figma.string('Label text'), + size: figma.enum('Size', { + Large: 'lg', + Medium: 'md', + Small: 'sm', + }), + helperText: figma.boolean('Show helper', { + true: figma.string('Helper text'), + }), + // readonlyInputtext: figma.string('Read-only Input text'), // doesn't exist in code shows + }, + example: ({ + disabled, + helperText, + hideLabel, + inline, + readOnly, + invalid, + invalidText, + warn, + warnText, + labelText, + size, + }) => ( + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + + ), + } +); + +figma.connect( + SelectSkeleton, + 'https://www.figma.com/design/YAnB1jKx0yCUL29j6uSLpg/(v11)-All-themes---Carbon-Design-System?node-id=17650-274860&t=LS77peWFGhwOdxIw-4', + { + variant: { State: 'Skeleton' }, + props: { + hideLabel: figma.boolean('Show label', { + true: false, + false: true, + }), + }, + example: ({ hideLabel }) => { + return; + // Disclaimer: Code Connect is currently in beta and integration with Carbon + // React is in an exploratory phase. Code sample below may be incomplete. + ; + }, + } +);