@nucleux/md3-list 0.3.0
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.cjs +73 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nucleux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @nucleux/md3-list
|
|
2
|
+
|
|
3
|
+
Material 3 list — Nucleux agentic UI for React.
|
|
4
|
+
|
|
5
|
+
Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @nucleux/md3-list @nucleux/tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` / `react-dom` are peer dependencies.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Md3List } from "@nucleux/md3-list";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
|
|
22
|
+
and the Tailwind preset from `@nucleux/tokens/preset`.
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT © Nucleux
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('@nucleux/utils');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
// src/index.tsx
|
|
29
|
+
var Md3List = React__namespace.forwardRef(
|
|
30
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "list", className: utils.cn("bg-md-surface py-2 text-md-on-surface", className), ...props })
|
|
31
|
+
);
|
|
32
|
+
Md3List.displayName = "Md3List";
|
|
33
|
+
var Md3ListItem = React__namespace.forwardRef(
|
|
34
|
+
({ headline, supportingText, leading, trailing, interactive = false, className, onClick, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
ref,
|
|
38
|
+
role: interactive ? "button" : "listitem",
|
|
39
|
+
tabIndex: interactive ? 0 : void 0,
|
|
40
|
+
onClick,
|
|
41
|
+
onKeyDown: interactive ? (e) => {
|
|
42
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
e.currentTarget.click();
|
|
45
|
+
}
|
|
46
|
+
} : void 0,
|
|
47
|
+
className: utils.cn(
|
|
48
|
+
"relative flex items-center gap-4 overflow-hidden px-4 py-3 text-left",
|
|
49
|
+
interactive && [
|
|
50
|
+
"cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-md-primary",
|
|
51
|
+
"before:absolute before:inset-0 before:bg-md-on-surface before:opacity-0 before:transition-opacity before:content-['']",
|
|
52
|
+
"hover:before:opacity-[0.08] active:before:opacity-[0.12]"
|
|
53
|
+
],
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
leading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative shrink-0 text-md-on-surface-variant [&_svg]:size-6", children: leading }),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative min-w-0 flex-1", children: [
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-md-on-surface", children: headline }),
|
|
61
|
+
supportingText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-sm text-md-on-surface-variant", children: supportingText })
|
|
62
|
+
] }),
|
|
63
|
+
trailing && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative shrink-0 text-md-on-surface-variant", children: trailing })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
Md3ListItem.displayName = "Md3ListItem";
|
|
69
|
+
|
|
70
|
+
exports.Md3List = Md3List;
|
|
71
|
+
exports.Md3ListItem = Md3ListItem;
|
|
72
|
+
//# sourceMappingURL=index.cjs.map
|
|
73
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","cn","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,OAAA,GAAgBA,gBAAA,CAAA,UAAA;AAAA,EAC3B,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,wBACxBC,cAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,IAAA,EAAK,QAAO,SAAA,EAAWC,QAAA,CAAG,yCAAyC,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO;AAE7G;AACA,OAAA,CAAQ,WAAA,GAAc,SAAA;AAYf,IAAM,WAAA,GAAoBF,gBAAA,CAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,QAAA,EAAU,cAAA,EAAgB,OAAA,EAAS,QAAA,EAAU,WAAA,GAAc,KAAA,EAAO,SAAA,EAAW,OAAA,EAAS,GAAG,KAAA,IAAS,GAAA,qBACnGG,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAM,cAAc,QAAA,GAAW,UAAA;AAAA,MAC/B,QAAA,EAAU,cAAc,CAAA,GAAI,MAAA;AAAA,MAC5B,OAAA;AAAA,MACA,SAAA,EACE,WAAA,GACI,CAAC,CAAA,KAAM;AACL,QAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,UAAA,CAAA,CAAE,cAAA,EAAe;AACjB,UAAC,CAAA,CAAE,cAAiC,KAAA,EAAM;AAAA,QAC5C;AAAA,MACF,CAAA,GACA,MAAA;AAAA,MAEN,SAAA,EAAWD,QAAA;AAAA,QACT,sEAAA;AAAA,QACA,WAAA,IAAe;AAAA,UACb,yGAAA;AAAA,UACA,uHAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,OAAA,oBAAWD,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,6DAAA,EAA+D,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,wBACnGE,eAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yBAAA,EACd,QAAA,EAAA;AAAA,0BAAAF,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,mCAAA,EAAqC,QAAA,EAAA,QAAA,EAAS,CAAA;AAAA,UAC7D,cAAA,oBACCA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qDAAqD,QAAA,EAAA,cAAA,EAAe;AAAA,SAAA,EAExF,CAAA;AAAA,QACC,QAAA,oBAAYA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,gDAAgD,QAAA,EAAA,QAAA,EAAS;AAAA;AAAA;AAAA;AAG5F;AACA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\n/** A Material Design 3 list container. Compose with Md3ListItem. */\nexport const Md3List = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} role=\"list\" className={cn(\"bg-md-surface py-2 text-md-on-surface\", className)} {...props} />\n ),\n);\nMd3List.displayName = \"Md3List\";\n\nexport interface Md3ListItemProps extends React.HTMLAttributes<HTMLDivElement> {\n headline: React.ReactNode;\n supportingText?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n /** Add a hover/press state layer + role=\"button\" for actionable rows. */\n interactive?: boolean;\n}\n\n/** A row in a {@link Md3List} (one- or two-line, with leading/trailing slots). */\nexport const Md3ListItem = React.forwardRef<HTMLDivElement, Md3ListItemProps>(\n ({ headline, supportingText, leading, trailing, interactive = false, className, onClick, ...props }, ref) => (\n <div\n ref={ref}\n role={interactive ? \"button\" : \"listitem\"}\n tabIndex={interactive ? 0 : undefined}\n onClick={onClick}\n onKeyDown={\n interactive\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n (e.currentTarget as HTMLDivElement).click();\n }\n }\n : undefined\n }\n className={cn(\n \"relative flex items-center gap-4 overflow-hidden px-4 py-3 text-left\",\n interactive && [\n \"cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-md-primary\",\n \"before:absolute before:inset-0 before:bg-md-on-surface before:opacity-0 before:transition-opacity before:content-['']\",\n \"hover:before:opacity-[0.08] active:before:opacity-[0.12]\",\n ],\n className,\n )}\n {...props}\n >\n {leading && <span className=\"relative shrink-0 text-md-on-surface-variant [&_svg]:size-6\">{leading}</span>}\n <span className=\"relative min-w-0 flex-1\">\n <span className=\"block truncate text-md-on-surface\">{headline}</span>\n {supportingText && (\n <span className=\"block truncate text-sm text-md-on-surface-variant\">{supportingText}</span>\n )}\n </span>\n {trailing && <span className=\"relative shrink-0 text-md-on-surface-variant\">{trailing}</span>}\n </div>\n ),\n);\nMd3ListItem.displayName = \"Md3ListItem\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** A Material Design 3 list container. Compose with Md3ListItem. */
|
|
4
|
+
declare const Md3List: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface Md3ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
headline: React.ReactNode;
|
|
7
|
+
supportingText?: React.ReactNode;
|
|
8
|
+
leading?: React.ReactNode;
|
|
9
|
+
trailing?: React.ReactNode;
|
|
10
|
+
/** Add a hover/press state layer + role="button" for actionable rows. */
|
|
11
|
+
interactive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** A row in a {@link Md3List} (one- or two-line, with leading/trailing slots). */
|
|
14
|
+
declare const Md3ListItem: React.ForwardRefExoticComponent<Md3ListItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
|
|
16
|
+
export { Md3List, Md3ListItem, type Md3ListItemProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** A Material Design 3 list container. Compose with Md3ListItem. */
|
|
4
|
+
declare const Md3List: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface Md3ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
headline: React.ReactNode;
|
|
7
|
+
supportingText?: React.ReactNode;
|
|
8
|
+
leading?: React.ReactNode;
|
|
9
|
+
trailing?: React.ReactNode;
|
|
10
|
+
/** Add a hover/press state layer + role="button" for actionable rows. */
|
|
11
|
+
interactive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** A row in a {@link Md3List} (one- or two-line, with leading/trailing slots). */
|
|
14
|
+
declare const Md3ListItem: React.ForwardRefExoticComponent<Md3ListItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
|
|
16
|
+
export { Md3List, Md3ListItem, type Md3ListItemProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '@nucleux/utils';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/index.tsx
|
|
7
|
+
var Md3List = React.forwardRef(
|
|
8
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "list", className: cn("bg-md-surface py-2 text-md-on-surface", className), ...props })
|
|
9
|
+
);
|
|
10
|
+
Md3List.displayName = "Md3List";
|
|
11
|
+
var Md3ListItem = React.forwardRef(
|
|
12
|
+
({ headline, supportingText, leading, trailing, interactive = false, className, onClick, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
role: interactive ? "button" : "listitem",
|
|
17
|
+
tabIndex: interactive ? 0 : void 0,
|
|
18
|
+
onClick,
|
|
19
|
+
onKeyDown: interactive ? (e) => {
|
|
20
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
e.currentTarget.click();
|
|
23
|
+
}
|
|
24
|
+
} : void 0,
|
|
25
|
+
className: cn(
|
|
26
|
+
"relative flex items-center gap-4 overflow-hidden px-4 py-3 text-left",
|
|
27
|
+
interactive && [
|
|
28
|
+
"cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-md-primary",
|
|
29
|
+
"before:absolute before:inset-0 before:bg-md-on-surface before:opacity-0 before:transition-opacity before:content-['']",
|
|
30
|
+
"hover:before:opacity-[0.08] active:before:opacity-[0.12]"
|
|
31
|
+
],
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props,
|
|
35
|
+
children: [
|
|
36
|
+
leading && /* @__PURE__ */ jsx("span", { className: "relative shrink-0 text-md-on-surface-variant [&_svg]:size-6", children: leading }),
|
|
37
|
+
/* @__PURE__ */ jsxs("span", { className: "relative min-w-0 flex-1", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-md-on-surface", children: headline }),
|
|
39
|
+
supportingText && /* @__PURE__ */ jsx("span", { className: "block truncate text-sm text-md-on-surface-variant", children: supportingText })
|
|
40
|
+
] }),
|
|
41
|
+
trailing && /* @__PURE__ */ jsx("span", { className: "relative shrink-0 text-md-on-surface-variant", children: trailing })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
Md3ListItem.displayName = "Md3ListItem";
|
|
47
|
+
|
|
48
|
+
export { Md3List, Md3ListItem };
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;AAIO,IAAM,OAAA,GAAgB,KAAA,CAAA,UAAA;AAAA,EAC3B,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,wBACxB,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,IAAA,EAAK,QAAO,SAAA,EAAW,EAAA,CAAG,yCAAyC,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO;AAE7G;AACA,OAAA,CAAQ,WAAA,GAAc,SAAA;AAYf,IAAM,WAAA,GAAoB,KAAA,CAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,QAAA,EAAU,cAAA,EAAgB,OAAA,EAAS,QAAA,EAAU,WAAA,GAAc,KAAA,EAAO,SAAA,EAAW,OAAA,EAAS,GAAG,KAAA,IAAS,GAAA,qBACnG,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAA,EAAM,cAAc,QAAA,GAAW,UAAA;AAAA,MAC/B,QAAA,EAAU,cAAc,CAAA,GAAI,MAAA;AAAA,MAC5B,OAAA;AAAA,MACA,SAAA,EACE,WAAA,GACI,CAAC,CAAA,KAAM;AACL,QAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,UAAA,CAAA,CAAE,cAAA,EAAe;AACjB,UAAC,CAAA,CAAE,cAAiC,KAAA,EAAM;AAAA,QAC5C;AAAA,MACF,CAAA,GACA,MAAA;AAAA,MAEN,SAAA,EAAW,EAAA;AAAA,QACT,sEAAA;AAAA,QACA,WAAA,IAAe;AAAA,UACb,yGAAA;AAAA,UACA,uHAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,OAAA,oBAAW,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,6DAAA,EAA+D,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,wBACnG,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yBAAA,EACd,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,mCAAA,EAAqC,QAAA,EAAA,QAAA,EAAS,CAAA;AAAA,UAC7D,cAAA,oBACC,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qDAAqD,QAAA,EAAA,cAAA,EAAe;AAAA,SAAA,EAExF,CAAA;AAAA,QACC,QAAA,oBAAY,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,gDAAgD,QAAA,EAAA,QAAA,EAAS;AAAA;AAAA;AAAA;AAG5F;AACA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\n/** A Material Design 3 list container. Compose with Md3ListItem. */\nexport const Md3List = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} role=\"list\" className={cn(\"bg-md-surface py-2 text-md-on-surface\", className)} {...props} />\n ),\n);\nMd3List.displayName = \"Md3List\";\n\nexport interface Md3ListItemProps extends React.HTMLAttributes<HTMLDivElement> {\n headline: React.ReactNode;\n supportingText?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n /** Add a hover/press state layer + role=\"button\" for actionable rows. */\n interactive?: boolean;\n}\n\n/** A row in a {@link Md3List} (one- or two-line, with leading/trailing slots). */\nexport const Md3ListItem = React.forwardRef<HTMLDivElement, Md3ListItemProps>(\n ({ headline, supportingText, leading, trailing, interactive = false, className, onClick, ...props }, ref) => (\n <div\n ref={ref}\n role={interactive ? \"button\" : \"listitem\"}\n tabIndex={interactive ? 0 : undefined}\n onClick={onClick}\n onKeyDown={\n interactive\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n (e.currentTarget as HTMLDivElement).click();\n }\n }\n : undefined\n }\n className={cn(\n \"relative flex items-center gap-4 overflow-hidden px-4 py-3 text-left\",\n interactive && [\n \"cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-md-primary\",\n \"before:absolute before:inset-0 before:bg-md-on-surface before:opacity-0 before:transition-opacity before:content-['']\",\n \"hover:before:opacity-[0.08] active:before:opacity-[0.12]\",\n ],\n className,\n )}\n {...props}\n >\n {leading && <span className=\"relative shrink-0 text-md-on-surface-variant [&_svg]:size-6\">{leading}</span>}\n <span className=\"relative min-w-0 flex-1\">\n <span className=\"block truncate text-md-on-surface\">{headline}</span>\n {supportingText && (\n <span className=\"block truncate text-sm text-md-on-surface-variant\">{supportingText}</span>\n )}\n </span>\n {trailing && <span className=\"relative shrink-0 text-md-on-surface-variant\">{trailing}</span>}\n </div>\n ),\n);\nMd3ListItem.displayName = \"Md3ListItem\";\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nucleux/md3-list",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"description": "Material 3 list — Nucleux agentic UI for React.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"nucleux",
|
|
9
|
+
"react",
|
|
10
|
+
"ui",
|
|
11
|
+
"components",
|
|
12
|
+
"agentic",
|
|
13
|
+
"ai",
|
|
14
|
+
"tailwind",
|
|
15
|
+
"md3-list"
|
|
16
|
+
],
|
|
17
|
+
"main": "./dist/index.cjs",
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": ">=18",
|
|
33
|
+
"react-dom": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nucleux/utils": "0.3.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"tsup": "^8.3.5",
|
|
40
|
+
"typescript": "^5.7.2",
|
|
41
|
+
"@types/react": "^18.3.18",
|
|
42
|
+
"react": "^18.3.1",
|
|
43
|
+
"lucide-react": "^0.469.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
|
|
52
|
+
"directory": "packages/md3-list"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup"
|
|
57
|
+
}
|
|
58
|
+
}
|