/** * Copyright IBM Corp. 2025 * * 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 { StructuredListWrapper, StructuredListHead, StructuredListBody, StructuredListRow, StructuredListCell, StructuredListInput, } from '@carbon/react'; // Case 1: Direct usage with selection export const BasicSelection = () => ( Column A Column B Row 1 Row 1 ); // Case 2: Row generator function const generateRows = (count) => { return Array.from({ length: count }, (_, i) => ( Row {i} Content {i} )); }; export const WithRowGenerator = () => ( Column A Column B {generateRows(3)} ); // Case 3: Nested inside other components export const NestedStructuredList = () => (
Nested Column Nested Content
); // Case 4: Without selection (should not be modified) export const WithoutSelection = () => ( No Selection Should Not Change ); // Case 5: Mixed with and without selection export const MixedSelectionUsage = () => (
With Selection Should Get Selection Without Selection Should Not Get Selection
); // Case 7: Conditional Rendering with Selection export const ConditionalRendering = ({ showSelection = true }) => ( Conditional Conditional Row ); // Case 8: Multiple Nested StructuredLists export const NestedLists = () => ( Parent List Nested List Nested Content ); // Case 10: With Conditional StructuredListInput export const ConditionalInput = ({ isSelectable = true }) => ( Conditional Input Row Content {isSelectable && ( )} ); // Case 11: With Multiple Body Sections export const MultipleBodySections = () => ( Multiple Bodies Section 1 Section 2 );