@ttoss/components 1.31.0 → 1.31.2
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/README.md
CHANGED
|
@@ -20,6 +20,31 @@ pnpm add @ttoss/components @ttoss/ui @emotion/react @ttoss/react-hooks
|
|
|
20
20
|
|
|
21
21
|
You can check all the components of the library `@ttoss/ui` on the [Storybook](https://storybook.ttoss.dev/?path=/story/components).
|
|
22
22
|
|
|
23
|
+
### List
|
|
24
|
+
|
|
25
|
+
The `List` component is a React component that renders an unordered list `(<ul>)` and accepts
|
|
26
|
+
`ListItem` as its children. Each ListItem can contain any React content, including other components.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import { List, ListItem } from '@ttoss/components/List';
|
|
31
|
+
|
|
32
|
+
const MyComponent = () => (
|
|
33
|
+
<List>
|
|
34
|
+
<ListItem>Item 1</ListItem>
|
|
35
|
+
<ListItem>Item 2</ListItem>
|
|
36
|
+
<ListItem>Item 3</ListItem>
|
|
37
|
+
<ListItem>
|
|
38
|
+
<CustomComponent />
|
|
39
|
+
</ListItem>
|
|
40
|
+
</List>
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
In this example, `List` is used to render an `<ul>` list with four items. The last item contains a custom React component (CustomComponent), demonstrating that ListItem can receive any React content as its children.
|
|
45
|
+
|
|
46
|
+
This is a basic example of how to use the `List` component with `ListItem`. You can customize the content and styles as needed to fit your project requirements.
|
|
47
|
+
|
|
23
48
|
### Markdown
|
|
24
49
|
|
|
25
50
|
Markdown uses [react-markdown](https://remarkjs.github.io/react-markdown/) under the hood, so the props are the same. You can update the elements as you want. Ex:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ListProps extends React.HTMLProps<HTMLUListElement> {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const List: React.ForwardRefExoticComponent<Omit<ListProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
|
|
7
|
+
|
|
8
|
+
interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const ListItem: React.ForwardRefExoticComponent<Omit<ListItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
12
|
+
|
|
13
|
+
export { List, ListItem, type ListItemProps, type ListProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
|
|
3
|
+
// src/components/List/List.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var List = /*#__PURE__*/React.forwardRef(({
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}, ref) => {
|
|
10
|
+
return /* @__PURE__ */jsx("ul", {
|
|
11
|
+
...props,
|
|
12
|
+
ref,
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
List.displayName = "List";
|
|
17
|
+
|
|
18
|
+
// src/components/List/ListItem.tsx
|
|
19
|
+
import * as React2 from "react";
|
|
20
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
21
|
+
var ListItem = /*#__PURE__*/React2.forwardRef((props, ref) => {
|
|
22
|
+
const {
|
|
23
|
+
children,
|
|
24
|
+
...rest
|
|
25
|
+
} = props;
|
|
26
|
+
return /* @__PURE__ */jsx2("li", {
|
|
27
|
+
...rest,
|
|
28
|
+
ref,
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
ListItem.displayName = "ListItem";
|
|
33
|
+
export { List, ListItem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.2",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"import": "./dist/esm/index.js"
|
|
19
19
|
},
|
|
20
|
+
"./list": {
|
|
21
|
+
"types": "./dist/List.d.ts",
|
|
22
|
+
"import": "./dist/esm/List.js"
|
|
23
|
+
},
|
|
20
24
|
"./table": {
|
|
21
25
|
"types": "./dist/components/Table.d.ts",
|
|
22
26
|
"import": "./dist/esm/components/Table.js"
|
|
@@ -50,19 +54,16 @@
|
|
|
50
54
|
"@types/react": "^18.2.58",
|
|
51
55
|
"jest": "^29.7.0",
|
|
52
56
|
"tsup": "^8.0.2",
|
|
53
|
-
"@ttoss/react-hooks": "^1.25.3",
|
|
54
57
|
"@ttoss/config": "^1.31.5",
|
|
55
58
|
"@ttoss/react-icons": "^0.3.1",
|
|
56
59
|
"@ttoss/test-utils": "^2.1.1",
|
|
60
|
+
"@ttoss/react-hooks": "^1.25.3",
|
|
57
61
|
"@ttoss/ui": "^4.1.4"
|
|
58
62
|
},
|
|
59
63
|
"keywords": [
|
|
60
64
|
"React",
|
|
61
65
|
"components"
|
|
62
66
|
],
|
|
63
|
-
"engines": {
|
|
64
|
-
"node": ">=16"
|
|
65
|
-
},
|
|
66
67
|
"publishConfig": {
|
|
67
68
|
"access": "public",
|
|
68
69
|
"provenance": true
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ListProps extends React.HTMLProps<HTMLUListElement> {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const List = React.forwardRef<HTMLUListElement, ListProps>(
|
|
8
|
+
({ children, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<ul {...props} ref={ref}>
|
|
11
|
+
{children}
|
|
12
|
+
</ul>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
List.displayName = 'List';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
|
|
8
|
+
(props, ref) => {
|
|
9
|
+
const { children, ...rest } = props;
|
|
10
|
+
return (
|
|
11
|
+
<li {...rest} ref={ref}>
|
|
12
|
+
{children}
|
|
13
|
+
</li>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
ListItem.displayName = 'ListItem';
|