@sproutsocial/seeds-react-list 0.3.41 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +25 -0
- package/dist/esm/index.js +223 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +223 -53
- package/dist/index.js.map +1 -1
- package/dist/list.css +112 -0
- package/package.json +11 -11
- package/src/List.tsx +13 -9
- package/src/ListHybrid.tsx +28 -0
- package/src/ListItem.tsx +7 -21
- package/src/ListItemButton.tsx +8 -37
- package/src/ListItemButtonHybrid.tsx +28 -0
- package/src/ListItemButtonStyled.tsx +46 -0
- package/src/ListItemButtonTailwind.tsx +36 -0
- package/src/ListItemContent.tsx +7 -48
- package/src/ListItemContentHybrid.tsx +28 -0
- package/src/ListItemContentStyled.tsx +59 -0
- package/src/ListItemContentTailwind.tsx +56 -0
- package/src/ListItemHybrid.tsx +34 -0
- package/src/ListItemStyled.tsx +41 -0
- package/src/ListItemTailwind.tsx +35 -0
- package/src/ListItemTypes.ts +32 -3
- package/src/ListStyled.tsx +19 -0
- package/src/ListTailwind.tsx +32 -0
- package/src/ListTypes.ts +25 -2
- package/src/__tests__/ListContract.test.tsx +137 -0
- package/src/__tests__/ListItemButton.test.tsx +57 -0
- package/src/__tests__/ListItemContent.test.tsx +92 -0
- package/src/__tests__/ListRouting.test.tsx +102 -0
- package/src/cn.ts +27 -0
- package/src/list.css +112 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/styles.tsx","../src/List.tsx","../src/ListItem.tsx","../src/ListItemContent.tsx","../src/DataList.tsx","../src/DataItemSkeleton.tsx","../src/VirtualizedDataList.tsx","../src/ListTypes.ts","../src/ListItemTypes.ts","../src/DataListTypes.ts"],"sourcesContent":["import List from \"./List\";\nimport ListItem from \"./ListItem\";\nimport ListItemContent from \"./ListItemContent\";\nimport DataList from \"./DataList\";\nimport DataItemSkeleton from \"./DataItemSkeleton\";\nimport Experimental_VirtualizedDataList from \"./VirtualizedDataList\";\n\nexport {\n List,\n ListItem,\n ListItemContent,\n DataList,\n DataItemSkeleton,\n Experimental_VirtualizedDataList,\n};\nexport * from \"./ListTypes\";\nexport * from \"./ListItemTypes\";\nexport * from \"./DataListTypes\";\nexport * from \"./DataItemSkeletonTypes\";\n","import styled from \"styled-components\";\nimport type { TypeListProps } from \"./ListTypes\";\n\nconst Container = styled.ul<TypeListProps>`\n margin: 0;\n padding: 0;\n list-style: none;\n`;\n\nexport default Container;\n","import Container from \"./styles\";\nimport type { TypeListProps } from \"./ListTypes\";\n\nconst List = ({ as = \"ul\", children, ...rest }: TypeListProps) => {\n return (\n <Container as={as} {...rest}>\n {children}\n </Container>\n );\n};\n\nList.displayName = \"List\";\n\nexport default List;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\n\nconst ListItem = React.forwardRef<HTMLLIElement, TypeListItemProps>(\n ({ isBordered, children, ...rest }, ref) => {\n return (\n <Box\n as=\"li\"\n ref={ref}\n borderRadius=\"outer\"\n {...(isBordered\n ? {\n border: 500,\n borderColor: \"container.border.base\",\n p: 300,\n }\n : {})}\n mt={300}\n {...rest}\n >\n {children}\n </Box>\n );\n }\n);\n\nListItem.displayName = \"ListItem\";\n\nexport default ListItem;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeListItemContentProps } from \"./ListItemTypes\";\n\nconst ListItemContent = ({\n text,\n details,\n aside,\n iconName,\n iconLabel,\n actions,\n ...rest\n}: TypeListItemContentProps) => {\n return (\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n borderRadius=\"outer\"\n alignItems=\"baseline\"\n {...rest}\n >\n <Box display=\"flex\" flex=\"1\">\n {iconName && (\n <span>\n <Icon mr={300} name={iconName} size=\"small\" ariaLabel={iconLabel} />\n </span>\n )}\n <Box flex=\"1\">\n <Text.SmallSubHeadline as=\"div\">{text}</Text.SmallSubHeadline>\n {details && (\n <Text.Byline as=\"div\" mt={200}>\n {details}\n </Text.Byline>\n )}\n </Box>\n </Box>\n <Box display=\"flex\" alignItems=\"center\" gap={300} flexShrink={0}>\n {aside && <Text.Byline as=\"div\">{aside}</Text.Byline>}\n {actions && (\n <Box display=\"flex\" alignItems=\"center\">\n {actions}\n </Box>\n )}\n </Box>\n </Box>\n );\n};\n\nListItemContent.displayName = \"ListItemContent\";\n\nexport default ListItemContent;\n","import * as React from \"react\";\nimport { useRef, useState } from \"react\";\nimport List from \"./List\";\nimport DataItemSkeleton from \"./DataItemSkeleton\";\nimport ListItem from \"./ListItem\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Container from \"./styles\";\nimport type { TypeDataListProps } from \"./DataListTypes\";\nimport styled from \"styled-components\";\nimport { Pagination } from \"@sproutsocial/seeds-react-pagination\";\n\nconst HeaderContent = styled(Box)`\n width: 100%;\n transition: transform 0.4s ease-in-out;\n`;\n\nconst DataList = <T,>({\n as = \"ul\",\n data,\n renderItem,\n isLoading,\n LoadingComponent = DataItemSkeleton,\n listItemProps = {},\n estimateItemSize = 50,\n Header,\n paginationConfig,\n currentPageIndex: controlledPageIndex,\n pageSize: controlledPageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n ...rest\n}: TypeDataListProps<T>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const loadingItems = [0, 1, 2, 3, 4];\n\n // Internal state for uncontrolled pagination\n const [internalPageIndex, setInternalPageIndex] = useState(0);\n const [internalPageSize, setInternalPageSize] = useState(\n paginationConfig?.initialPageSize ?? 10\n );\n\n // Use controlled props if provided, otherwise use internal state\n const currentPageIndex = controlledPageIndex ?? internalPageIndex;\n const pageSize = controlledPageSize ?? internalPageSize;\n\n // Use provided callbacks or internal state setters\n const handlePageChange = onPageChange ?? setInternalPageIndex;\n const handlePageSizeChange = onPageSizeChange ?? setInternalPageSize;\n\n // Calculate paginated data if pagination is enabled\n const displayData = React.useMemo(() => {\n if (!paginationConfig) {\n return data;\n }\n const startIndex = currentPageIndex * pageSize;\n const endIndex = startIndex + pageSize;\n return data.slice(startIndex, endIndex);\n }, [data, paginationConfig, currentPageIndex, pageSize]);\n\n const totalRows = totalItems !== undefined ? totalItems : data.length;\n\n // Early return for loading state\n if (isLoading) {\n return (\n <>\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List as={as} {...rest}>\n {loadingItems.map((index) => (\n <ListItem key={index} {...listItemProps}>\n <LoadingComponent />\n </ListItem>\n ))}\n </List>\n </>\n );\n }\n\n return (\n <>\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List as={as} {...rest}>\n {displayData.map((item, index) => (\n <ListItem key={index} {...listItemProps}>\n {renderItem(item, index)}\n </ListItem>\n ))}\n </List>\n {paginationConfig && (\n <Pagination\n paginationConfig={paginationConfig}\n currentPageIndex={currentPageIndex}\n pageSize={pageSize}\n totalRows={totalRows}\n onPageChange={handlePageChange}\n onPageSizeChange={handlePageSizeChange}\n />\n )}\n </>\n );\n};\n\nDataList.displayName = \"DataList\";\n\nexport default DataList;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Skeleton from \"@sproutsocial/seeds-react-skeleton\";\nimport type { TypeDataItemSkeletonProps } from \"./DataItemSkeletonTypes\";\n\nconst DataItemSkeleton = ({\n hasIcon = false,\n hasAside = false,\n hasSubtext = false,\n}: TypeDataItemSkeletonProps) => {\n return (\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n borderRadius=\"outer\"\n alignItems=\"flex-start\"\n mb={100}\n >\n <Box display=\"flex\" flex=\"1\">\n {hasIcon && (\n <Box mr={300} flexShrink={0}>\n <Skeleton width={21} height={21} borderRadius=\"pill\" />\n </Box>\n )}\n <Box flex=\"1\">\n <Skeleton width=\"80%\" height={21} borderRadius=\"inner\" />\n {hasSubtext && (\n <Skeleton width=\"60%\" height={16} mt={300} borderRadius=\"inner\" />\n )}\n </Box>\n </Box>\n {hasAside && (\n <Box display=\"flex\" alignItems=\"center\" gap={300} flexShrink={0}>\n <Skeleton width={60} height={21} borderRadius=\"inner\" />\n </Box>\n )}\n </Box>\n );\n};\n\nDataItemSkeleton.displayName = \"DataItemSkeleton\";\n\nexport default DataItemSkeleton;\n","import * as React from \"react\";\nimport List from \"./List\";\nimport ListItem from \"./ListItem\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Loader from \"@sproutsocial/seeds-react-loader\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport type { TypeDataListProps } from \"./DataListTypes\";\nimport { useInView } from \"react-intersection-observer\";\nimport styled from \"styled-components\";\n\nconst HeaderContent = styled(Box)`\n width: 100%;\n transition: transform 0.4s ease-in-out;\n background-color: red;\n`;\n\nconst Experimental_VirtualizedDataList = <T,>({\n as = \"ul\",\n data,\n renderItem,\n estimateItemSize = 50,\n onEndReached,\n hasNextPage,\n isFetchingNextPage,\n Header,\n removeHeaderDepth = Infinity,\n headerHeight = 60,\n ...rest\n}: TypeDataListProps<T>) => {\n const afterInView = useInView();\n\n const parentRef = React.useRef<HTMLDivElement>(null);\n\n const count = data.length;\n\n const virtualizer = useVirtualizer({\n count,\n getScrollElement: () => parentRef.current,\n estimateSize: () => estimateItemSize,\n overscan: 5,\n });\n\n const items = virtualizer.getVirtualItems();\n const offset = virtualizer.scrollOffset ?? 0;\n\n const prevOffsetRef = React.useRef(offset);\n const [headerVisible, setHeaderVisible] = React.useState(true);\n\n React.useEffect(() => {\n const prev = prevOffsetRef.current;\n const scrollingUp = offset < prev;\n prevOffsetRef.current = offset;\n\n if (offset > removeHeaderDepth) {\n setHeaderVisible(scrollingUp);\n } else {\n setHeaderVisible(true);\n }\n }, [offset, removeHeaderDepth]);\n\n const transform = headerVisible\n ? \"translateY(0px)\"\n : `translateY(-${headerHeight}px)`;\n\n React.useEffect(() => {\n if (afterInView.inView) {\n onEndReached?.();\n }\n }, [onEndReached, afterInView.inView]);\n\n return (\n <div\n ref={parentRef}\n className=\"List\"\n style={{\n width: \"100%\",\n height: \"100%\",\n overflowY: \"auto\",\n contain: \"strict\",\n }}\n >\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n transform,\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List\n as={as}\n style={{\n height: `${virtualizer.getTotalSize()}px`,\n width: \"100%\",\n position: \"relative\",\n }}\n >\n {items.map((virtualRow) => {\n return (\n <ListItem\n key={virtualRow.key}\n data-index={virtualRow.index}\n ref={virtualizer.measureElement}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n transform: `translateY(${\n virtualRow.start - virtualizer.options.scrollMargin\n }px)`,\n }}\n >\n {renderItem(data[virtualRow.index] as T)}\n </ListItem>\n );\n })}\n </List>\n {hasNextPage && !isFetchingNextPage && (\n <div ref={afterInView.ref}>\n <Loader delay={false} />\n </div>\n )}\n </div>\n );\n};\n\nExperimental_VirtualizedDataList.displayName =\n \"Experimental_VirtualizedDataList\";\n\nexport default Experimental_VirtualizedDataList;\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\n\nexport type TypeListElement = \"ul\" | \"ol\";\n\nexport interface TypeListProps extends TypeStyledComponentsCommonProps {\n /** The HTML element to render as - either \"ul\" or \"ol\" */\n as?: TypeListElement;\n /** Array of elements to render as list items */\n children: React.ReactNode;\n /** Inline styles to apply to the list element */\n style?: React.CSSProperties;\n}\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconName } from \"@sproutsocial/seeds-react-icon\";\n\nexport interface TypeListItemProps extends TypeStyledComponentsCommonProps {\n /** If true, adds a border and padding around the list item which looks like a card or button */\n isBordered?: boolean;\n /** Children to display inside the list item */\n children: React.ReactNode;\n /** Inline styles to apply to the list item element */\n style?: React.CSSProperties;\n}\n\nexport interface TypeListItemContentProps\n extends TypeStyledComponentsCommonProps {\n /** Main text displayed as SmallSubheadline */\n text: React.ReactNode;\n /** Details text displayed as Byline below the main text */\n details?: React.ReactNode;\n /** Aside text displayed as Byline on the right side */\n aside?: React.ReactNode;\n /** Optional icon name to display on the left */\n iconName?: TypeIconName;\n /** Label used to describe the icon if not used with an accompanying visual label */\n iconLabel?: string;\n /** Actions to display on the right side (e.g., buttons, menus) */\n actions?: React.ReactNode;\n}\n","import * as React from \"react\";\nimport type { TypeListProps } from \"./ListTypes\";\nimport type { TypeDataItemSkeletonProps } from \"./DataItemSkeletonTypes\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\nimport type { TypePaginationConfig } from \"@sproutsocial/seeds-react-pagination\";\n\nexport interface TypeDataListProps<T> extends Omit<TypeListProps, \"children\"> {\n /** Array of data items to render */\n data: T[];\n /** Function to render each item in the data array */\n renderItem: (item: T, index?: number) => React.ReactNode;\n /** If true, shows loading skeletons instead of data */\n isLoading?: boolean;\n /** Component to render when loading. Receives props for customizing skeleton appearance */\n LoadingComponent?: React.ComponentType<TypeDataItemSkeletonProps>;\n /** Estimated height of each item in pixels for virtualization. Defaults to 60 */\n estimateItemSize?: number;\n /** Props to pass to the list item component */\n listItemProps?: Omit<TypeListItemProps, \"children\">;\n /** Callback function called when the end of the list is reached (for infinite scrolling) */\n onEndReached?: () => void;\n /** Whether there is a next page available (for infinite scrolling) */\n hasNextPage?: boolean;\n /** Whether the next page is currently being fetched */\n isFetchingNextPage?: boolean;\n /** Header component to display at the top of the list */\n Header?: React.ReactNode;\n /** Scroll offset in pixels at which the header should be hidden. Defaults to Infinity (header never hides unless a value is set) */\n removeHeaderDepth?: number;\n /** Height of the header in pixels. Defaults to 60 */\n headerHeight?: number;\n /** Configuration for pagination controls with page navigation and size selection */\n paginationConfig?: TypePaginationConfig;\n /** Current page index (0-based) for pagination */\n currentPageIndex?: number;\n /** Number of items per page */\n pageSize?: number;\n /** Total number of items (for pagination) */\n totalItems?: number;\n /** Callback fired when the page changes */\n onPageChange?: (pageIndex: number) => void;\n /** Callback fired when the page size changes */\n onPageSizeChange?: (pageSize: number) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmB;AAGnB,IAAM,YAAY,yBAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAMzB,IAAO,iBAAQ;;;ACJX;AAFJ,IAAM,OAAO,CAAC,EAAE,KAAK,MAAM,UAAU,GAAG,KAAK,MAAqB;AAChE,SACE,4CAAC,kBAAU,IAAS,GAAG,MACpB,UACH;AAEJ;AAEA,KAAK,cAAc;AAEnB,IAAO,eAAQ;;;ACbf,YAAuB;AACvB,6BAAgB;AAMV,IAAAC,sBAAA;AAHN,IAAM,WAAiB;AAAA,EACrB,CAAC,EAAE,YAAY,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1C,WACE;AAAA,MAAC,uBAAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH;AAAA,QACA,cAAa;AAAA,QACZ,GAAI,aACD;AAAA,UACE,QAAQ;AAAA,UACR,aAAa;AAAA,UACb,GAAG;AAAA,QACL,IACA,CAAC;AAAA,QACL,IAAI;AAAA,QACH,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;AAEvB,IAAO,mBAAQ;;;AC7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C,sBACf,6CAAC,SAAI,KAAK,YAAY,KACpB,uDAAC,0BAAAG,SAAA,EAAO,OAAO,OAAO,GACxB;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,iCAAiC,cAC/B;AAEF,IAAO,8BAAQ;;;ACzIf,IAAAC,SAAuB;;;ACAvB,IAAAC,SAAuB;;;ACAvB,IAAAC,SAAuB;","names":["styled","import_jsx_runtime","Box","React","import_seeds_react_box","import_jsx_runtime","Box","Text","React","React","import_seeds_react_box","import_jsx_runtime","Box","Skeleton","import_seeds_react_box","import_styled_components","import_jsx_runtime","styled","Box","React","import_seeds_react_box","import_styled_components","import_jsx_runtime","HeaderContent","styled","Box","Loader","React","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/ListHybrid.tsx","../src/styles.tsx","../src/ListStyled.tsx","../src/ListTailwind.tsx","../src/cn.ts","../src/List.tsx","../src/ListItem.tsx","../src/ListItemHybrid.tsx","../src/ListItemStyled.tsx","../src/ListItemTailwind.tsx","../src/ListItemContentHybrid.tsx","../src/ListItemContentStyled.tsx","../src/ListItemContentTailwind.tsx","../src/ListItemContent.tsx","../src/DataList.tsx","../src/DataItemSkeleton.tsx","../src/VirtualizedDataList.tsx","../src/ListTypes.ts","../src/ListItemTypes.ts","../src/DataListTypes.ts"],"sourcesContent":["import List from \"./List\";\nimport ListItem from \"./ListItem\";\nimport ListItemContent from \"./ListItemContent\";\nimport DataList from \"./DataList\";\nimport DataItemSkeleton from \"./DataItemSkeleton\";\nimport Experimental_VirtualizedDataList from \"./VirtualizedDataList\";\n\nexport {\n List,\n ListItem,\n ListItemContent,\n DataList,\n DataItemSkeleton,\n Experimental_VirtualizedDataList,\n};\nexport * from \"./ListTypes\";\nexport * from \"./ListItemTypes\";\nexport * from \"./DataListTypes\";\nexport * from \"./DataItemSkeletonTypes\";\n","/**\n * Hybrid List Component\n * Automatically chooses between Tailwind and styled-components based on props.\n *\n * Routes to the styled-components path when a styled-system prop is present\n * (hasStyledProps) or the component was extended with styled()\n * (isStyledExtension). Otherwise renders the Tailwind path (preferred — no\n * runtime CSS-in-JS).\n */\nimport {\n hasStyledProps,\n isStyledExtension,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeListProps } from \"./ListTypes\";\nimport ListStyled from \"./ListStyled\";\nimport ListTailwind from \"./ListTailwind\";\n\nconst ListHybrid = (props: TypeListProps) => {\n if (hasStyledProps(props) || isStyledExtension(props)) {\n return <ListStyled {...props} />;\n }\n\n return <ListTailwind {...props} />;\n};\n\nListHybrid.displayName = \"List\";\n\nexport default ListHybrid;\n","import styled from \"styled-components\";\nimport type { TypeListProps } from \"./ListTypes\";\n\nconst Container = styled.ul<TypeListProps>`\n margin: 0;\n padding: 0;\n list-style: none;\n`;\n\nexport default Container;\n","import Container from \"./styles\";\nimport type { TypeListProps } from \"./ListTypes\";\n\n/**\n * Styled-components implementation of List. Used by ListHybrid whenever a\n * consumer passes a styled-system prop or a styled() extension. This is the\n * unchanged legacy rendering path.\n */\nconst ListStyled = ({ as = \"ul\", children, ...rest }: TypeListProps) => {\n return (\n <Container as={as} {...rest}>\n {children}\n </Container>\n );\n};\n\nListStyled.displayName = \"List\";\n\nexport default ListStyled;\n","import * as React from \"react\";\nimport { cn } from \"./cn\";\nimport type { TypeListProps } from \"./ListTypes\";\n\n/**\n * Tailwind CSS implementation of List. Renders the `as` element (ul/ol) with\n * the semantic `seeds-list` class from list.css — no runtime CSS-in-JS.\n *\n * The semantic class is placed before the consumer `className` so consumer\n * utilities can override the layered base styles.\n */\nconst ListTailwind = ({\n as: Element = \"ul\",\n children,\n className,\n ...rest\n}: TypeListProps) => {\n return (\n <Element\n className={cn(\"seeds-list\", className)}\n // On the Tailwind path system props are absent at runtime (they route to\n // the styled path), so the remaining rest is native attributes only.\n {...(rest as React.HTMLAttributes<HTMLUListElement | HTMLOListElement>)}\n >\n {children}\n </Element>\n );\n};\n\nListTailwind.displayName = \"List\";\n\nexport default ListTailwind;\n","/**\n * Minimal className combiner. Mirrored inline from Card/Avatar —\n * @sproutsocial/seeds-react-utilities does NOT export a `cn` helper.\n *\n * Falsy inputs are dropped; object inputs contribute each truthy key.\n */\nexport function cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n","import ListHybrid from \"./ListHybrid\";\n\n/**\n * List automatically routes between the Tailwind implementation (preferred)\n * and the styled-components implementation (for consumers using system props\n * or a styled() extension).\n *\n * @example\n * <List as=\"ul\">\n * <ListItem>First</ListItem>\n * <ListItem>Second</ListItem>\n * </List>\n */\nconst List = ListHybrid;\n\nList.displayName = \"List\";\n\nexport default List;\n","import * as React from \"react\";\nimport ListItemHybrid from \"./ListItemHybrid\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\n\n/**\n * ListItem automatically routes between the Tailwind implementation (preferred)\n * and the styled-components implementation (for consumers using system props\n * or a styled() extension).\n */\nconst ListItem = React.forwardRef<HTMLLIElement, TypeListItemProps>(\n (props, ref) => <ListItemHybrid {...props} ref={ref} />\n);\n\nListItem.displayName = \"ListItem\";\n\nexport default ListItem;\n","/**\n * Hybrid ListItem Component\n * Automatically chooses between Tailwind and styled-components based on props.\n *\n * Routes to the styled-components path when a styled-system prop is present\n * (hasStyledProps) or the component was extended with styled()\n * (isStyledExtension). Otherwise renders the Tailwind path (preferred — no\n * runtime CSS-in-JS).\n *\n * `isBordered` is a semantic public prop, not a styled-system prop, so it maps\n * to a class on the Tailwind path and does not force styled-components.\n */\nimport * as React from \"react\";\nimport {\n hasStyledProps,\n isStyledExtension,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\nimport ListItemStyled from \"./ListItemStyled\";\nimport ListItemTailwind from \"./ListItemTailwind\";\n\nconst ListItemHybrid = React.forwardRef<HTMLLIElement, TypeListItemProps>(\n (props, ref) => {\n if (hasStyledProps(props) || isStyledExtension(props)) {\n return <ListItemStyled {...props} ref={ref} />;\n }\n\n return <ListItemTailwind {...props} ref={ref} />;\n }\n);\n\nListItemHybrid.displayName = \"ListItem\";\n\nexport default ListItemHybrid;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\n\n/**\n * Styled-components implementation of ListItem. Used by ListItemHybrid whenever\n * a consumer passes a styled-system prop or a styled() extension. This is the\n * unchanged legacy rendering path (a Box rendered as <li>).\n */\nconst ListItemStyled = React.forwardRef<HTMLLIElement, TypeListItemProps>(\n ({ isBordered, children, ...rest }, ref) => {\n return (\n <Box\n as=\"li\"\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore legacy ref type mismatch: Box types its ref as a div, but\n // it renders an <li> here and forwards the ref to that element.\n ref={ref}\n borderRadius=\"outer\"\n {...(isBordered\n ? {\n border: 500,\n borderColor: \"container.border.base\",\n p: 300,\n }\n : {})}\n mt={300}\n // rest carries system props + native <li> attributes. Box is typed to a\n // div, so the li-specific event-handler element types are widened away;\n // the ref (on its own line above) is unaffected by this spread cast.\n {...(rest as Record<string, unknown>)}\n >\n {children}\n </Box>\n );\n }\n);\n\nListItemStyled.displayName = \"ListItem\";\n\nexport default ListItemStyled;\n","import * as React from \"react\";\nimport { cn } from \"./cn\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\n\n/**\n * Tailwind CSS implementation of ListItem. Renders an <li> with the semantic\n * `seeds-list-item` class (plus `seeds-list-item-bordered` when isBordered)\n * from list.css — no runtime CSS-in-JS.\n *\n * The semantic class is placed before the consumer `className` so consumer\n * utilities can override the layered base styles.\n */\nconst ListItemTailwind = React.forwardRef<HTMLLIElement, TypeListItemProps>(\n ({ isBordered, children, className, ...rest }, ref) => {\n const classes = cn(\n \"seeds-list-item\",\n { \"seeds-list-item-bordered\": !!isBordered },\n className\n );\n\n return (\n <li\n ref={ref}\n className={classes}\n {...(rest as React.LiHTMLAttributes<HTMLLIElement>)}\n >\n {children}\n </li>\n );\n }\n);\n\nListItemTailwind.displayName = \"ListItem\";\n\nexport default ListItemTailwind;\n","/**\n * Hybrid ListItemContent Component\n * Automatically chooses between Tailwind and styled-components based on props.\n *\n * Routes to the styled-components path when a styled-system prop is present\n * (hasStyledProps) or the component was extended with styled()\n * (isStyledExtension). Otherwise renders the Tailwind path (preferred — no\n * runtime CSS-in-JS).\n */\nimport {\n hasStyledProps,\n isStyledExtension,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeListItemContentProps } from \"./ListItemTypes\";\nimport ListItemContentStyled from \"./ListItemContentStyled\";\nimport ListItemContentTailwind from \"./ListItemContentTailwind\";\n\nconst ListItemContentHybrid = (props: TypeListItemContentProps) => {\n if (hasStyledProps(props) || isStyledExtension(props)) {\n return <ListItemContentStyled {...props} />;\n }\n\n return <ListItemContentTailwind {...props} />;\n};\n\nListItemContentHybrid.displayName = \"ListItemContent\";\n\nexport default ListItemContentHybrid;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeListItemContentProps } from \"./ListItemTypes\";\n\n/**\n * Styled-components implementation of ListItemContent. Used by\n * ListItemContentHybrid whenever a consumer passes a styled-system prop or a\n * styled() extension. This is the unchanged legacy rendering path (Box/Text/Icon\n * composition).\n */\nconst ListItemContentStyled = ({\n text,\n details,\n aside,\n iconName,\n iconLabel,\n actions,\n ...rest\n}: TypeListItemContentProps) => {\n return (\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n borderRadius=\"outer\"\n alignItems=\"baseline\"\n {...rest}\n >\n <Box display=\"flex\" flex=\"1\">\n {iconName && (\n <span>\n <Icon mr={300} name={iconName} size=\"small\" ariaLabel={iconLabel} />\n </span>\n )}\n <Box flex=\"1\">\n <Text.SmallSubHeadline as=\"div\">{text}</Text.SmallSubHeadline>\n {details && (\n <Text.Byline as=\"div\" mt={200}>\n {details}\n </Text.Byline>\n )}\n </Box>\n </Box>\n <Box display=\"flex\" alignItems=\"center\" gap={300} flexShrink={0}>\n {aside && <Text.Byline as=\"div\">{aside}</Text.Byline>}\n {actions && (\n <Box display=\"flex\" alignItems=\"center\">\n {actions}\n </Box>\n )}\n </Box>\n </Box>\n );\n};\n\nListItemContentStyled.displayName = \"ListItemContent\";\n\nexport default ListItemContentStyled;\n","import * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { cn } from \"./cn\";\nimport type { TypeListItemContentProps } from \"./ListItemTypes\";\n\n/**\n * Tailwind CSS implementation of ListItemContent. The Box layout scaffolding is\n * expressed through semantic `seeds-list-item-content*` classes from list.css\n * (no runtime CSS-in-JS). Text and Icon remain as primitives — the spacing they\n * previously received via system props (Icon mr, Byline mt) is now applied by\n * the parent classes so those primitives stay on their own static paths.\n */\nconst ListItemContentTailwind = ({\n text,\n details,\n aside,\n iconName,\n iconLabel,\n actions,\n className,\n ...rest\n}: TypeListItemContentProps) => {\n return (\n <div\n className={cn(\"seeds-list-item-content\", className)}\n {...(rest as React.HTMLAttributes<HTMLDivElement>)}\n >\n <div className=\"seeds-list-item-content-main\">\n {iconName && (\n <span className=\"seeds-list-item-content-icon\">\n <Icon name={iconName} size=\"small\" ariaLabel={iconLabel} />\n </span>\n )}\n <div className=\"seeds-list-item-content-text\">\n <Text.SmallSubHeadline as=\"div\">{text}</Text.SmallSubHeadline>\n {details && (\n <Text.Byline as=\"div\" className=\"seeds-list-item-content-details\">\n {details}\n </Text.Byline>\n )}\n </div>\n </div>\n <div className=\"seeds-list-item-content-aside\">\n {aside && <Text.Byline as=\"div\">{aside}</Text.Byline>}\n {actions && (\n <div className=\"seeds-list-item-content-actions\">{actions}</div>\n )}\n </div>\n </div>\n );\n};\n\nListItemContentTailwind.displayName = \"ListItemContent\";\n\nexport default ListItemContentTailwind;\n","import ListItemContentHybrid from \"./ListItemContentHybrid\";\n\n/**\n * ListItemContent automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or a styled() extension).\n */\nconst ListItemContent = ListItemContentHybrid;\n\nListItemContent.displayName = \"ListItemContent\";\n\nexport default ListItemContent;\n","import * as React from \"react\";\nimport { useRef, useState } from \"react\";\nimport List from \"./List\";\nimport DataItemSkeleton from \"./DataItemSkeleton\";\nimport ListItem from \"./ListItem\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Container from \"./styles\";\nimport type { TypeDataListProps } from \"./DataListTypes\";\nimport styled from \"styled-components\";\nimport { Pagination } from \"@sproutsocial/seeds-react-pagination\";\n\nconst HeaderContent = styled(Box)`\n width: 100%;\n transition: transform 0.4s ease-in-out;\n`;\n\nconst DataList = <T,>({\n as = \"ul\",\n data,\n renderItem,\n isLoading,\n LoadingComponent = DataItemSkeleton,\n listItemProps = {},\n estimateItemSize = 50,\n Header,\n paginationConfig,\n currentPageIndex: controlledPageIndex,\n pageSize: controlledPageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n ...rest\n}: TypeDataListProps<T>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const loadingItems = [0, 1, 2, 3, 4];\n\n // Internal state for uncontrolled pagination\n const [internalPageIndex, setInternalPageIndex] = useState(0);\n const [internalPageSize, setInternalPageSize] = useState(\n paginationConfig?.initialPageSize ?? 10\n );\n\n // Use controlled props if provided, otherwise use internal state\n const currentPageIndex = controlledPageIndex ?? internalPageIndex;\n const pageSize = controlledPageSize ?? internalPageSize;\n\n // Use provided callbacks or internal state setters\n const handlePageChange = onPageChange ?? setInternalPageIndex;\n const handlePageSizeChange = onPageSizeChange ?? setInternalPageSize;\n\n // Calculate paginated data if pagination is enabled\n const displayData = React.useMemo(() => {\n if (!paginationConfig) {\n return data;\n }\n const startIndex = currentPageIndex * pageSize;\n const endIndex = startIndex + pageSize;\n return data.slice(startIndex, endIndex);\n }, [data, paginationConfig, currentPageIndex, pageSize]);\n\n const totalRows = totalItems !== undefined ? totalItems : data.length;\n\n // Early return for loading state\n if (isLoading) {\n return (\n <>\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List as={as} {...rest}>\n {loadingItems.map((index) => (\n <ListItem key={index} {...listItemProps}>\n <LoadingComponent />\n </ListItem>\n ))}\n </List>\n </>\n );\n }\n\n return (\n <>\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List as={as} {...rest}>\n {displayData.map((item, index) => (\n <ListItem key={index} {...listItemProps}>\n {renderItem(item, index)}\n </ListItem>\n ))}\n </List>\n {paginationConfig && (\n <Pagination\n paginationConfig={paginationConfig}\n currentPageIndex={currentPageIndex}\n pageSize={pageSize}\n totalRows={totalRows}\n onPageChange={handlePageChange}\n onPageSizeChange={handlePageSizeChange}\n />\n )}\n </>\n );\n};\n\nDataList.displayName = \"DataList\";\n\nexport default DataList;\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Skeleton from \"@sproutsocial/seeds-react-skeleton\";\nimport type { TypeDataItemSkeletonProps } from \"./DataItemSkeletonTypes\";\n\nconst DataItemSkeleton = ({\n hasIcon = false,\n hasAside = false,\n hasSubtext = false,\n}: TypeDataItemSkeletonProps) => {\n return (\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n borderRadius=\"outer\"\n alignItems=\"flex-start\"\n mb={100}\n >\n <Box display=\"flex\" flex=\"1\">\n {hasIcon && (\n <Box mr={300} flexShrink={0}>\n <Skeleton width={21} height={21} borderRadius=\"pill\" />\n </Box>\n )}\n <Box flex=\"1\">\n <Skeleton width=\"80%\" height={21} borderRadius=\"inner\" />\n {hasSubtext && (\n <Skeleton width=\"60%\" height={16} mt={300} borderRadius=\"inner\" />\n )}\n </Box>\n </Box>\n {hasAside && (\n <Box display=\"flex\" alignItems=\"center\" gap={300} flexShrink={0}>\n <Skeleton width={60} height={21} borderRadius=\"inner\" />\n </Box>\n )}\n </Box>\n );\n};\n\nDataItemSkeleton.displayName = \"DataItemSkeleton\";\n\nexport default DataItemSkeleton;\n","import * as React from \"react\";\nimport List from \"./List\";\nimport ListItem from \"./ListItem\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Loader from \"@sproutsocial/seeds-react-loader\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport type { TypeDataListProps } from \"./DataListTypes\";\nimport { useInView } from \"react-intersection-observer\";\nimport styled from \"styled-components\";\n\nconst HeaderContent = styled(Box)`\n width: 100%;\n transition: transform 0.4s ease-in-out;\n background-color: red;\n`;\n\nconst Experimental_VirtualizedDataList = <T,>({\n as = \"ul\",\n data,\n renderItem,\n estimateItemSize = 50,\n onEndReached,\n hasNextPage,\n isFetchingNextPage,\n Header,\n removeHeaderDepth = Infinity,\n headerHeight = 60,\n ...rest\n}: TypeDataListProps<T>) => {\n const afterInView = useInView();\n\n const parentRef = React.useRef<HTMLDivElement>(null);\n\n const count = data.length;\n\n const virtualizer = useVirtualizer({\n count,\n getScrollElement: () => parentRef.current,\n estimateSize: () => estimateItemSize,\n overscan: 5,\n });\n\n const items = virtualizer.getVirtualItems();\n const offset = virtualizer.scrollOffset ?? 0;\n\n const prevOffsetRef = React.useRef(offset);\n const [headerVisible, setHeaderVisible] = React.useState(true);\n\n React.useEffect(() => {\n const prev = prevOffsetRef.current;\n const scrollingUp = offset < prev;\n prevOffsetRef.current = offset;\n\n if (offset > removeHeaderDepth) {\n setHeaderVisible(scrollingUp);\n } else {\n setHeaderVisible(true);\n }\n }, [offset, removeHeaderDepth]);\n\n const transform = headerVisible\n ? \"translateY(0px)\"\n : `translateY(-${headerHeight}px)`;\n\n React.useEffect(() => {\n if (afterInView.inView) {\n onEndReached?.();\n }\n }, [onEndReached, afterInView.inView]);\n\n return (\n <div\n ref={parentRef}\n className=\"List\"\n style={{\n width: \"100%\",\n height: \"100%\",\n overflowY: \"auto\",\n contain: \"strict\",\n }}\n >\n {Header && (\n <HeaderContent\n style={{\n position: \"sticky\",\n transform,\n top: 0,\n left: 0,\n width: \"100%\",\n zIndex: 1,\n }}\n id=\"header\"\n >\n {Header}\n </HeaderContent>\n )}\n <List\n as={as}\n style={{\n height: `${virtualizer.getTotalSize()}px`,\n width: \"100%\",\n position: \"relative\",\n }}\n >\n {items.map((virtualRow) => {\n return (\n <ListItem\n key={virtualRow.key}\n data-index={virtualRow.index}\n ref={virtualizer.measureElement}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n transform: `translateY(${\n virtualRow.start - virtualizer.options.scrollMargin\n }px)`,\n }}\n >\n {renderItem(data[virtualRow.index] as T)}\n </ListItem>\n );\n })}\n </List>\n {hasNextPage && !isFetchingNextPage && (\n <div ref={afterInView.ref}>\n <Loader delay={false} />\n </div>\n )}\n </div>\n );\n};\n\nExperimental_VirtualizedDataList.displayName =\n \"Experimental_VirtualizedDataList\";\n\nexport default Experimental_VirtualizedDataList;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeBorderSystemProps,\n TypeColorSystemProps,\n TypeFlexboxSystemProps,\n TypeGridSystemProps,\n TypeLayoutSystemProps,\n TypePositionSystemProps,\n TypeSpaceSystemProps,\n TypeTypographySystemProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport type TypeListElement = \"ul\" | \"ol\";\n\nexport interface TypeListProps\n extends Omit<\n React.HTMLAttributes<HTMLUListElement | HTMLOListElement>,\n \"color\"\n >,\n TypeStyledComponentsCommonProps,\n TypeBorderSystemProps,\n TypeColorSystemProps,\n TypeFlexboxSystemProps,\n TypeGridSystemProps,\n TypeLayoutSystemProps,\n TypePositionSystemProps,\n TypeSpaceSystemProps,\n TypeTypographySystemProps {\n /** The HTML element to render as - either \"ul\" or \"ol\" */\n as?: TypeListElement;\n /** Array of elements to render as list items */\n children: React.ReactNode;\n /** Inline styles to apply to the list element */\n style?: React.CSSProperties;\n}\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeBorderSystemProps,\n TypeColorSystemProps,\n TypeFlexboxSystemProps,\n TypeGridSystemProps,\n TypeLayoutSystemProps,\n TypePositionSystemProps,\n TypeSpaceSystemProps,\n TypeTypographySystemProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconName } from \"@sproutsocial/seeds-react-icon\";\n\nexport interface TypeListItemProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, \"color\">,\n TypeStyledComponentsCommonProps,\n TypeBorderSystemProps,\n TypeColorSystemProps,\n TypeFlexboxSystemProps,\n TypeGridSystemProps,\n TypeLayoutSystemProps,\n TypePositionSystemProps,\n TypeSpaceSystemProps,\n TypeTypographySystemProps {\n /** If true, adds a border and padding around the list item which looks like a card or button */\n isBordered?: boolean;\n /** Children to display inside the list item */\n children: React.ReactNode;\n /** Inline styles to apply to the list item element */\n style?: React.CSSProperties;\n}\n\nexport interface TypeListItemContentProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\">,\n TypeStyledComponentsCommonProps,\n TypeBorderSystemProps,\n TypeColorSystemProps,\n TypeFlexboxSystemProps,\n TypeGridSystemProps,\n TypeLayoutSystemProps,\n TypePositionSystemProps,\n TypeSpaceSystemProps,\n TypeTypographySystemProps {\n /** Main text displayed as SmallSubheadline */\n text: React.ReactNode;\n /** Details text displayed as Byline below the main text */\n details?: React.ReactNode;\n /** Aside text displayed as Byline on the right side */\n aside?: React.ReactNode;\n /** Optional icon name to display on the left */\n iconName?: TypeIconName;\n /** Label used to describe the icon if not used with an accompanying visual label */\n iconLabel?: string;\n /** Actions to display on the right side (e.g., buttons, menus) */\n actions?: React.ReactNode;\n}\n","import * as React from \"react\";\nimport type { TypeListProps } from \"./ListTypes\";\nimport type { TypeDataItemSkeletonProps } from \"./DataItemSkeletonTypes\";\nimport type { TypeListItemProps } from \"./ListItemTypes\";\nimport type { TypePaginationConfig } from \"@sproutsocial/seeds-react-pagination\";\n\nexport interface TypeDataListProps<T> extends Omit<TypeListProps, \"children\"> {\n /** Array of data items to render */\n data: T[];\n /** Function to render each item in the data array */\n renderItem: (item: T, index?: number) => React.ReactNode;\n /** If true, shows loading skeletons instead of data */\n isLoading?: boolean;\n /** Component to render when loading. Receives props for customizing skeleton appearance */\n LoadingComponent?: React.ComponentType<TypeDataItemSkeletonProps>;\n /** Estimated height of each item in pixels for virtualization. Defaults to 60 */\n estimateItemSize?: number;\n /** Props to pass to the list item component */\n listItemProps?: Omit<TypeListItemProps, \"children\">;\n /** Callback function called when the end of the list is reached (for infinite scrolling) */\n onEndReached?: () => void;\n /** Whether there is a next page available (for infinite scrolling) */\n hasNextPage?: boolean;\n /** Whether the next page is currently being fetched */\n isFetchingNextPage?: boolean;\n /** Header component to display at the top of the list */\n Header?: React.ReactNode;\n /** Scroll offset in pixels at which the header should be hidden. Defaults to Infinity (header never hides unless a value is set) */\n removeHeaderDepth?: number;\n /** Height of the header in pixels. Defaults to 60 */\n headerHeight?: number;\n /** Configuration for pagination controls with page navigation and size selection */\n paginationConfig?: TypePaginationConfig;\n /** Current page index (0-based) for pagination */\n currentPageIndex?: number;\n /** Number of items per page */\n pageSize?: number;\n /** Total number of items (for pagination) */\n totalItems?: number;\n /** Callback fired when the page changes */\n onPageChange?: (pageIndex: number) => void;\n /** Callback fired when the page size changes */\n onPageSizeChange?: (pageSize: number) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSA,sCAGO;;;ACZP,+BAAmB;AAGnB,IAAM,YAAY,yBAAAA,QAAO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AK,CAAM;AAAA;AAAA,gBAblC,WAAW;AAAA,cAclB;AAAA,YAEJ,CAAC;AAAA;AAAA,QACH;AAAA,QACC,eAAe,CAAC,sBACf,8CAAC,SAAI,KAAK,YAAY,KACpB,wDAAC,0BAAAG,SAAA,EAAO,OAAO,OAAO,GACxB;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,iCAAiC,cAC/B;AAEF,IAAO,8BAAQ;;;ACzIf,IAAAC,UAAuB;;;ACAvB,IAAAC,UAAuB;;;ACAvB,IAAAC,UAAuB;","names":["styled","import_jsx_runtime","import_jsx_runtime","React","React","import_seeds_react_system_props","React","import_jsx_runtime","Box","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_seeds_react_system_props","React","import_seeds_react_box","import_jsx_runtime","Box","Text","React","import_seeds_react_text","import_seeds_react_icon","import_jsx_runtime","Text","import_jsx_runtime","React","React","import_seeds_react_box","import_jsx_runtime","Box","Skeleton","import_seeds_react_box","import_styled_components","import_jsx_runtime","styled","Box","React","import_seeds_react_box","import_styled_components","import_jsx_runtime","HeaderContent","styled","Box","Loader","React","React","React"]}
|
package/dist/list.css
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds List component classes
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <ul class="seeds-list">
|
|
10
|
+
* <li class="seeds-list-item">…</li>
|
|
11
|
+
* <li class="seeds-list-item seeds-list-item-bordered">…</li>
|
|
12
|
+
* </ul>
|
|
13
|
+
*
|
|
14
|
+
* Rules live in `@layer components` so that consumer Tailwind utilities
|
|
15
|
+
* (e.g. mt-300, p-300) win in the cascade and can override these component
|
|
16
|
+
* styles, rather than tying/beating them on specificity.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
@layer components {
|
|
20
|
+
/* List container: strip the browser's default list chrome. */
|
|
21
|
+
.seeds-list {
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
list-style: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* List item: rounded row that stacks with top spacing. The legacy component
|
|
28
|
+
applies `mt={300}` to every item (including the first), so the class does
|
|
29
|
+
the same rather than collapsing the first item's margin. */
|
|
30
|
+
.seeds-list-item {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
margin-top: var(--space-300);
|
|
33
|
+
border-radius: var(--radius-outer);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Bordered items read as a card/button: 1px container border + padding.
|
|
37
|
+
borderWidths[500] resolves to 1px; no --border-width var is emitted. */
|
|
38
|
+
.seeds-list-item-bordered {
|
|
39
|
+
border: 1px solid var(--color-container-border-base);
|
|
40
|
+
padding: var(--space-300);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ListItemContent ---------------------------------------------------- */
|
|
44
|
+
|
|
45
|
+
/* Outer row: main content left, aside/actions right, baseline-aligned. */
|
|
46
|
+
.seeds-list-item-content {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
align-items: baseline;
|
|
50
|
+
border-radius: var(--radius-outer);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Main content grows to fill; icon sits to the left of the text block. */
|
|
54
|
+
.seeds-list-item-content-main {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Icon spacing previously came from Icon's mr={300} system prop. */
|
|
60
|
+
.seeds-list-item-content-icon {
|
|
61
|
+
margin-right: var(--space-300);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.seeds-list-item-content-text {
|
|
65
|
+
flex: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Details byline spacing previously came from its mt={200} system prop.
|
|
69
|
+
The details node is a Text.Byline, so it also carries `.seeds-text`, whose
|
|
70
|
+
`margin: 0` sits later in the aggregated component layer and would reset a
|
|
71
|
+
single-class rule. Qualify with the parent to raise specificity above
|
|
72
|
+
`.seeds-text` while staying inside the components layer (consumer utilities
|
|
73
|
+
still win). */
|
|
74
|
+
.seeds-list-item-content .seeds-list-item-content-details {
|
|
75
|
+
margin-top: var(--space-200);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Aside/actions cluster on the right; does not shrink. */
|
|
79
|
+
.seeds-list-item-content-aside {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: var(--space-300);
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.seeds-list-item-content-actions {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* ListItemButton ----------------------------------------------------- */
|
|
92
|
+
|
|
93
|
+
/* Container reads as a card. radii[500] resolves to 6px (--radius-inner). */
|
|
94
|
+
.seeds-list-item-button {
|
|
95
|
+
position: relative;
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
border: 1px solid var(--color-container-border-base);
|
|
98
|
+
padding: var(--space-300);
|
|
99
|
+
border-radius: var(--radius-inner);
|
|
100
|
+
background-color: var(--color-container-bg-base);
|
|
101
|
+
color: var(--color-text-body);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Transparent overlay button that captures clicks across the whole card. */
|
|
105
|
+
.seeds-list-item-button-overlay {
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: 0;
|
|
108
|
+
left: 0;
|
|
109
|
+
width: 100%;
|
|
110
|
+
height: 100%;
|
|
111
|
+
}
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-list",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Seeds React List",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsup --dts",
|
|
12
|
-
"build:debug": "tsup --dts --metafile",
|
|
11
|
+
"build": "tsup --dts && cp src/list.css dist/list.css",
|
|
12
|
+
"build:debug": "tsup --dts --metafile && cp src/list.css dist/list.css",
|
|
13
13
|
"dev": "tsup --watch --dts",
|
|
14
14
|
"clean": "rm -rf .turbo dist",
|
|
15
15
|
"clean:modules": "rm -rf node_modules",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"test:watch": "jest --watch --coverage=false"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sproutsocial/seeds-react-theme": "^4.
|
|
21
|
+
"@sproutsocial/seeds-react-theme": "^4.6.0",
|
|
22
22
|
"@sproutsocial/seeds-react-system-props": "^3.2.1",
|
|
23
|
-
"@sproutsocial/seeds-react-box": "^1.1.
|
|
23
|
+
"@sproutsocial/seeds-react-box": "^1.1.33",
|
|
24
24
|
"@sproutsocial/seeds-react-text": "^1.5.5",
|
|
25
|
-
"@sproutsocial/seeds-react-icon": "^2.5.
|
|
26
|
-
"@sproutsocial/seeds-react-button": "^2.3.
|
|
27
|
-
"@sproutsocial/seeds-react-loader": "^1.0.
|
|
28
|
-
"@sproutsocial/seeds-react-pagination": "^0.1.
|
|
29
|
-
"@sproutsocial/seeds-react-skeleton": "^1.1.
|
|
25
|
+
"@sproutsocial/seeds-react-icon": "^2.5.3",
|
|
26
|
+
"@sproutsocial/seeds-react-button": "^2.3.10",
|
|
27
|
+
"@sproutsocial/seeds-react-loader": "^1.0.35",
|
|
28
|
+
"@sproutsocial/seeds-react-pagination": "^0.1.34",
|
|
29
|
+
"@sproutsocial/seeds-react-skeleton": "^1.1.33",
|
|
30
30
|
"@tanstack/react-virtual": "^3.13.12",
|
|
31
31
|
"react-intersection-observer": "^9.16.0"
|
|
32
32
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/react": "^18.0.0",
|
|
35
35
|
"@types/styled-components": "^5.1.26",
|
|
36
36
|
"@sproutsocial/eslint-config-seeds": "*",
|
|
37
|
-
"@faker-js/faker": "^
|
|
37
|
+
"@faker-js/faker": "^10.5.0",
|
|
38
38
|
"react": "^18.0.0",
|
|
39
39
|
"styled-components": "^5.2.3",
|
|
40
40
|
"tsup": "^8.3.4",
|
package/src/List.tsx
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { TypeListProps } from "./ListTypes";
|
|
1
|
+
import ListHybrid from "./ListHybrid";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
/**
|
|
4
|
+
* List automatically routes between the Tailwind implementation (preferred)
|
|
5
|
+
* and the styled-components implementation (for consumers using system props
|
|
6
|
+
* or a styled() extension).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <List as="ul">
|
|
10
|
+
* <ListItem>First</ListItem>
|
|
11
|
+
* <ListItem>Second</ListItem>
|
|
12
|
+
* </List>
|
|
13
|
+
*/
|
|
14
|
+
const List = ListHybrid;
|
|
11
15
|
|
|
12
16
|
List.displayName = "List";
|
|
13
17
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid List Component
|
|
3
|
+
* Automatically chooses between Tailwind and styled-components based on props.
|
|
4
|
+
*
|
|
5
|
+
* Routes to the styled-components path when a styled-system prop is present
|
|
6
|
+
* (hasStyledProps) or the component was extended with styled()
|
|
7
|
+
* (isStyledExtension). Otherwise renders the Tailwind path (preferred — no
|
|
8
|
+
* runtime CSS-in-JS).
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
hasStyledProps,
|
|
12
|
+
isStyledExtension,
|
|
13
|
+
} from "@sproutsocial/seeds-react-system-props";
|
|
14
|
+
import type { TypeListProps } from "./ListTypes";
|
|
15
|
+
import ListStyled from "./ListStyled";
|
|
16
|
+
import ListTailwind from "./ListTailwind";
|
|
17
|
+
|
|
18
|
+
const ListHybrid = (props: TypeListProps) => {
|
|
19
|
+
if (hasStyledProps(props) || isStyledExtension(props)) {
|
|
20
|
+
return <ListStyled {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return <ListTailwind {...props} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
ListHybrid.displayName = "List";
|
|
27
|
+
|
|
28
|
+
export default ListHybrid;
|
package/src/ListItem.tsx
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import ListItemHybrid from "./ListItemHybrid";
|
|
3
3
|
import type { TypeListItemProps } from "./ListItemTypes";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* ListItem automatically routes between the Tailwind implementation (preferred)
|
|
7
|
+
* and the styled-components implementation (for consumers using system props
|
|
8
|
+
* or a styled() extension).
|
|
9
|
+
*/
|
|
5
10
|
const ListItem = React.forwardRef<HTMLLIElement, TypeListItemProps>(
|
|
6
|
-
(
|
|
7
|
-
return (
|
|
8
|
-
<Box
|
|
9
|
-
as="li"
|
|
10
|
-
ref={ref}
|
|
11
|
-
borderRadius="outer"
|
|
12
|
-
{...(isBordered
|
|
13
|
-
? {
|
|
14
|
-
border: 500,
|
|
15
|
-
borderColor: "container.border.base",
|
|
16
|
-
p: 300,
|
|
17
|
-
}
|
|
18
|
-
: {})}
|
|
19
|
-
mt={300}
|
|
20
|
-
{...rest}
|
|
21
|
-
>
|
|
22
|
-
{children}
|
|
23
|
-
</Box>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
11
|
+
(props, ref) => <ListItemHybrid {...props} ref={ref} />
|
|
26
12
|
);
|
|
27
13
|
|
|
28
14
|
ListItem.displayName = "ListItem";
|
package/src/ListItemButton.tsx
CHANGED
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import Button from "@sproutsocial/seeds-react-button";
|
|
4
|
-
import Box from "@sproutsocial/seeds-react-box";
|
|
5
|
-
import Text from "@sproutsocial/seeds-react-text";
|
|
6
|
-
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
7
|
-
import type { TypeListItemButtonProps } from "./ListItemButtonTypes";
|
|
1
|
+
import ListItemButtonHybrid from "./ListItemButtonHybrid";
|
|
8
2
|
|
|
9
|
-
const ButtonContainer = styled(Box)`
|
|
10
|
-
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
11
|
-
position: relative;
|
|
12
|
-
padding: ${(props) => props.theme.space[300]};
|
|
13
|
-
border-radius: ${(props) => props.theme.radii[500]};
|
|
14
|
-
background-color: ${(props) => props.theme.colors.container.background.base};
|
|
15
|
-
color: ${(props) => props.theme.colors.text.body};
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
const StyledButton = styled(Button)`
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
`;
|
|
25
3
|
// This button is not currently used. It is possible to pass interactive elements inside the button which is an accessibility violation.
|
|
26
4
|
// In order to reintroduce it, we will want to mimic confluence's approach of using relative positioning to add a sibling to content which allows clicking
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<ButtonContainer>
|
|
36
|
-
<StyledButton onClick={onClick}> </StyledButton>
|
|
37
|
-
{children}
|
|
38
|
-
</ButtonContainer>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ListItemButton automatically routes between the Tailwind implementation
|
|
8
|
+
* (preferred) and the styled-components implementation (for consumers using
|
|
9
|
+
* system props or a styled() extension).
|
|
10
|
+
*/
|
|
11
|
+
const ListItemButton = ListItemButtonHybrid;
|
|
41
12
|
|
|
42
13
|
ListItemButton.displayName = "ListItemButton";
|
|
43
14
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid ListItemButton Component
|
|
3
|
+
* Automatically chooses between Tailwind and styled-components based on props.
|
|
4
|
+
*
|
|
5
|
+
* Routes to the styled-components path when a styled-system prop is present
|
|
6
|
+
* (hasStyledProps) or the component was extended with styled()
|
|
7
|
+
* (isStyledExtension). Otherwise renders the Tailwind path (preferred — no
|
|
8
|
+
* runtime CSS-in-JS).
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
hasStyledProps,
|
|
12
|
+
isStyledExtension,
|
|
13
|
+
} from "@sproutsocial/seeds-react-system-props";
|
|
14
|
+
import type { TypeListItemButtonProps } from "./ListItemButtonTypes";
|
|
15
|
+
import ListItemButtonStyled from "./ListItemButtonStyled";
|
|
16
|
+
import ListItemButtonTailwind from "./ListItemButtonTailwind";
|
|
17
|
+
|
|
18
|
+
const ListItemButtonHybrid = (props: TypeListItemButtonProps) => {
|
|
19
|
+
if (hasStyledProps(props) || isStyledExtension(props)) {
|
|
20
|
+
return <ListItemButtonStyled {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return <ListItemButtonTailwind {...props} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
ListItemButtonHybrid.displayName = "ListItemButton";
|
|
27
|
+
|
|
28
|
+
export default ListItemButtonHybrid;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Button from "@sproutsocial/seeds-react-button";
|
|
4
|
+
import Box from "@sproutsocial/seeds-react-box";
|
|
5
|
+
import type { TypeListItemButtonProps } from "./ListItemButtonTypes";
|
|
6
|
+
|
|
7
|
+
const ButtonContainer = styled(Box)`
|
|
8
|
+
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
9
|
+
position: relative;
|
|
10
|
+
padding: ${(props) => props.theme.space[300]};
|
|
11
|
+
border-radius: ${(props) => props.theme.radii[500]};
|
|
12
|
+
background-color: ${(props) => props.theme.colors.container.background.base};
|
|
13
|
+
color: ${(props) => props.theme.colors.text.body};
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const StyledButton = styled(Button)`
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Styled-components implementation of ListItemButton. Used by
|
|
26
|
+
* ListItemButtonHybrid whenever a consumer passes a styled-system prop or a
|
|
27
|
+
* styled() extension. This is the unchanged legacy rendering path.
|
|
28
|
+
*/
|
|
29
|
+
const ListItemButtonStyled = ({
|
|
30
|
+
appearance = "unstyled",
|
|
31
|
+
width = "100%",
|
|
32
|
+
children,
|
|
33
|
+
onClick,
|
|
34
|
+
...rest
|
|
35
|
+
}: TypeListItemButtonProps) => {
|
|
36
|
+
return (
|
|
37
|
+
<ButtonContainer>
|
|
38
|
+
<StyledButton onClick={onClick}> </StyledButton>
|
|
39
|
+
{children}
|
|
40
|
+
</ButtonContainer>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
ListItemButtonStyled.displayName = "ListItemButton";
|
|
45
|
+
|
|
46
|
+
export default ListItemButtonStyled;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Button from "@sproutsocial/seeds-react-button";
|
|
3
|
+
import { cn } from "./cn";
|
|
4
|
+
import type { TypeListItemButtonProps } from "./ListItemButtonTypes";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tailwind CSS implementation of ListItemButton. The container styling and the
|
|
8
|
+
* absolute-positioned overlay button are expressed through semantic
|
|
9
|
+
* `seeds-list-item-button*` classes from list.css (no runtime CSS-in-JS). The
|
|
10
|
+
* overlay stays a Button primitive, which handles its own static CSS.
|
|
11
|
+
*/
|
|
12
|
+
const ListItemButtonTailwind = ({
|
|
13
|
+
appearance = "unstyled",
|
|
14
|
+
width = "100%",
|
|
15
|
+
children,
|
|
16
|
+
onClick,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
}: TypeListItemButtonProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<div className={cn("seeds-list-item-button", className)}>
|
|
22
|
+
<Button
|
|
23
|
+
appearance="unstyled"
|
|
24
|
+
onClick={onClick}
|
|
25
|
+
className="seeds-list-item-button-overlay"
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
</Button>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ListItemButtonTailwind.displayName = "ListItemButton";
|
|
35
|
+
|
|
36
|
+
export default ListItemButtonTailwind;
|
package/src/ListItemContent.tsx
CHANGED
|
@@ -1,52 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Box from "@sproutsocial/seeds-react-box";
|
|
3
|
-
import Text from "@sproutsocial/seeds-react-text";
|
|
4
|
-
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
5
|
-
import type { TypeListItemContentProps } from "./ListItemTypes";
|
|
1
|
+
import ListItemContentHybrid from "./ListItemContentHybrid";
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
actions,
|
|
14
|
-
...rest
|
|
15
|
-
}: TypeListItemContentProps) => {
|
|
16
|
-
return (
|
|
17
|
-
<Box
|
|
18
|
-
display="flex"
|
|
19
|
-
justifyContent="space-between"
|
|
20
|
-
borderRadius="outer"
|
|
21
|
-
alignItems="baseline"
|
|
22
|
-
{...rest}
|
|
23
|
-
>
|
|
24
|
-
<Box display="flex" flex="1">
|
|
25
|
-
{iconName && (
|
|
26
|
-
<span>
|
|
27
|
-
<Icon mr={300} name={iconName} size="small" ariaLabel={iconLabel} />
|
|
28
|
-
</span>
|
|
29
|
-
)}
|
|
30
|
-
<Box flex="1">
|
|
31
|
-
<Text.SmallSubHeadline as="div">{text}</Text.SmallSubHeadline>
|
|
32
|
-
{details && (
|
|
33
|
-
<Text.Byline as="div" mt={200}>
|
|
34
|
-
{details}
|
|
35
|
-
</Text.Byline>
|
|
36
|
-
)}
|
|
37
|
-
</Box>
|
|
38
|
-
</Box>
|
|
39
|
-
<Box display="flex" alignItems="center" gap={300} flexShrink={0}>
|
|
40
|
-
{aside && <Text.Byline as="div">{aside}</Text.Byline>}
|
|
41
|
-
{actions && (
|
|
42
|
-
<Box display="flex" alignItems="center">
|
|
43
|
-
{actions}
|
|
44
|
-
</Box>
|
|
45
|
-
)}
|
|
46
|
-
</Box>
|
|
47
|
-
</Box>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
3
|
+
/**
|
|
4
|
+
* ListItemContent automatically routes between the Tailwind implementation
|
|
5
|
+
* (preferred) and the styled-components implementation (for consumers using
|
|
6
|
+
* system props or a styled() extension).
|
|
7
|
+
*/
|
|
8
|
+
const ListItemContent = ListItemContentHybrid;
|
|
50
9
|
|
|
51
10
|
ListItemContent.displayName = "ListItemContent";
|
|
52
11
|
|