@gridui/source-list 0.0.0-stage → 1.0.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/README.md +7 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +7 -0
- package/dist/source-list/source-list.d.ts +20 -0
- package/dist/source-list/style.d.ts +9 -0
- package/dist/styles.css +65 -0
- package/package.json +49 -3
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/source-list
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core family. Public API: `SourceItem`, `SourceList`, `SourceListProps`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/source-list` and load `@gridui/source-list/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Source List
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { SourceItem } from "./source-list/source-list";
|
|
8
|
+
export type { SourceListProps } from "./source-list/source-list";
|
|
9
|
+
export { SourceList } from "./source-list/source-list";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/source-list/style.ts
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
var sourceListStyles = cva("m-0 min-w-0 list-decimal ps-gridui-32");
|
|
4
|
+
var sourceItemStyles = cva("border-b border-border py-gridui-8 wrap-anywhere [&_a]:text-link [&_blockquote]:mx-0 [&_blockquote]:border-s-2 [&_blockquote]:border-border [&_blockquote]:ps-gridui-16");
|
|
5
|
+
var sourceMetaStyles = cva("text-muted type-caption");
|
|
6
|
+
|
|
7
|
+
// src/source-list/source-list.tsx
|
|
8
|
+
import { cn } from "@gridui/style-utils";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var SourceList = (props) => {
|
|
11
|
+
const { sources, label, emptyLabel, className, ...restProps } = props;
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"ol",
|
|
14
|
+
{
|
|
15
|
+
...restProps,
|
|
16
|
+
"aria-label": label,
|
|
17
|
+
className: cn(sourceListStyles(), className),
|
|
18
|
+
children: [
|
|
19
|
+
sources.length === 0 && /* @__PURE__ */ jsx(
|
|
20
|
+
"li",
|
|
21
|
+
{
|
|
22
|
+
className: sourceMetaStyles(),
|
|
23
|
+
children: emptyLabel
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
sources.map((source) => {
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
"li",
|
|
29
|
+
{
|
|
30
|
+
className: sourceItemStyles(),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"a",
|
|
34
|
+
{
|
|
35
|
+
href: source.href,
|
|
36
|
+
children: source.title
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
source.description && /* @__PURE__ */ jsx(
|
|
40
|
+
"p",
|
|
41
|
+
{
|
|
42
|
+
className: sourceMetaStyles(),
|
|
43
|
+
children: source.description
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
source.excerpt && /* @__PURE__ */ jsx("blockquote", { children: source.excerpt })
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
source.id
|
|
50
|
+
);
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
SourceList
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/source-list/style.ts", "../src/source-list/source-list.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Source List\n * @namespace SourceList\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const sourceListStyles = cva(\"m-0 min-w-0 list-decimal ps-gridui-32\");\n\nexport const sourceItemStyles = cva(\"border-b border-border py-gridui-8 wrap-anywhere [&_a]:text-link [&_blockquote]:mx-0 [&_blockquote]:border-s-2 [&_blockquote]:border-border [&_blockquote]:ps-gridui-16\");\n\nexport const sourceMetaStyles = cva(\"text-muted type-caption\");\n", "/**\n * @author WMXPY\n * @package Source List\n * @namespace SourceList\n * @description Source List\n */\n\nimport { sourceItemStyles, sourceListStyles, sourceMetaStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type SourceItem = {\n readonly id: string;\n readonly title: string;\n readonly href: string;\n readonly description?: string;\n readonly excerpt?: string;\n};\n\nexport type SourceListProps = Omit<ComponentPropsWithRef<\"ol\">, \"children\"> & {\n readonly sources: readonly SourceItem[];\n readonly label: string;\n readonly emptyLabel: string;\n};\n\nexport const SourceList: FC<SourceListProps> = (props: SourceListProps) => {\n const { sources, label, emptyLabel, className, ...restProps } = props;\n return (<ol\n {...restProps}\n aria-label={label}\n className={cn(sourceListStyles(), className)}\n >\n {sources.length === 0 && (<li\n className={sourceMetaStyles()}\n >\n {emptyLabel}\n </li>)}\n {sources.map(source => {\n return (<li\n key={source.id}\n className={sourceItemStyles()}\n >\n <a\n href={source.href}\n >\n {source.title}\n </a>\n {source.description && (<p\n className={sourceMetaStyles()}\n >\n {source.description}\n </p>)}\n {source.excerpt && (<blockquote>\n {source.excerpt}\n </blockquote>)}\n </li>);\n })}\n </ol>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI,uCAAuC;AAEpE,IAAM,mBAAmB,IAAI,yKAAyK;AAEtM,IAAM,mBAAmB,IAAI,yBAAyB;;;ACL7D,SAAS,UAAU;AAwBe,cAMd,YANc;AAP3B,IAAM,aAAkC,CAAC,UAA2B;AACvE,QAAM,EAAE,SAAS,OAAO,YAAY,WAAW,GAAG,UAAU,IAAI;AAChE,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,cAAY;AAAA,MACZ,WAAW,GAAG,iBAAiB,GAAG,SAAS;AAAA,MAE1C;AAAA,gBAAQ,WAAW,KAAM;AAAA,UAAC;AAAA;AAAA,YACvB,WAAW,iBAAiB;AAAA,YAE3B;AAAA;AAAA,QACL;AAAA,QACC,QAAQ,IAAI,YAAU;AACnB,iBAAQ;AAAA,YAAC;AAAA;AAAA,cAEL,WAAW,iBAAiB;AAAA,cAE5B;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACG,MAAM,OAAO;AAAA,oBAEZ,iBAAO;AAAA;AAAA,gBACZ;AAAA,gBACC,OAAO,eAAgB;AAAA,kBAAC;AAAA;AAAA,oBACrB,WAAW,iBAAiB;AAAA,oBAE3B,iBAAO;AAAA;AAAA,gBACZ;AAAA,gBACC,OAAO,WAAY,oBAAC,gBAChB,iBAAO,SACZ;AAAA;AAAA;AAAA,YAfK,OAAO;AAAA,UAgBhB;AAAA,QACJ,CAAC;AAAA;AAAA;AAAA,EACL;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Source List
|
|
4
|
+
* @namespace SourceList
|
|
5
|
+
* @description Source List
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type SourceItem = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly href: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly excerpt?: string;
|
|
14
|
+
};
|
|
15
|
+
export type SourceListProps = Omit<ComponentPropsWithRef<"ol">, "children"> & {
|
|
16
|
+
readonly sources: readonly SourceItem[];
|
|
17
|
+
readonly label: string;
|
|
18
|
+
readonly emptyLabel: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const SourceList: FC<SourceListProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Source List
|
|
4
|
+
* @namespace SourceList
|
|
5
|
+
* @description Style
|
|
6
|
+
*/
|
|
7
|
+
export declare const sourceListStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
export declare const sourceItemStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const sourceMetaStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer utilities {
|
|
5
|
+
.m-0 {
|
|
6
|
+
margin: 0px;
|
|
7
|
+
}
|
|
8
|
+
.min-w-0 {
|
|
9
|
+
min-width: 0px;
|
|
10
|
+
}
|
|
11
|
+
.list-decimal {
|
|
12
|
+
list-style-type: decimal;
|
|
13
|
+
}
|
|
14
|
+
.border-b {
|
|
15
|
+
border-bottom-style: var(--tw-border-style);
|
|
16
|
+
border-bottom-width: 1px;
|
|
17
|
+
}
|
|
18
|
+
.border-border {
|
|
19
|
+
border-color: var(--gridui-border);
|
|
20
|
+
}
|
|
21
|
+
.py-gridui-8 {
|
|
22
|
+
padding-block: var(--gridui-space-8);
|
|
23
|
+
}
|
|
24
|
+
.ps-gridui-32 {
|
|
25
|
+
padding-inline-start: var(--gridui-space-32);
|
|
26
|
+
}
|
|
27
|
+
.type-caption {
|
|
28
|
+
font: var(--gridui-type-caption);
|
|
29
|
+
letter-spacing: normal;
|
|
30
|
+
}
|
|
31
|
+
.wrap-anywhere {
|
|
32
|
+
overflow-wrap: anywhere;
|
|
33
|
+
}
|
|
34
|
+
.text-muted {
|
|
35
|
+
color: var(--gridui-muted);
|
|
36
|
+
}
|
|
37
|
+
.\[\&_a\]\:text-link a {
|
|
38
|
+
color: var(--gridui-link);
|
|
39
|
+
}
|
|
40
|
+
.\[\&_blockquote\]\:mx-0 blockquote {
|
|
41
|
+
margin-inline: 0px;
|
|
42
|
+
}
|
|
43
|
+
.\[\&_blockquote\]\:border-s-2 blockquote {
|
|
44
|
+
border-inline-start-style: var(--tw-border-style);
|
|
45
|
+
border-inline-start-width: 2px;
|
|
46
|
+
}
|
|
47
|
+
.\[\&_blockquote\]\:border-border blockquote {
|
|
48
|
+
border-color: var(--gridui-border);
|
|
49
|
+
}
|
|
50
|
+
.\[\&_blockquote\]\:ps-gridui-16 blockquote {
|
|
51
|
+
padding-inline-start: var(--gridui-space-16);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
@property --tw-border-style {
|
|
55
|
+
syntax: "*";
|
|
56
|
+
inherits: false;
|
|
57
|
+
initial-value: solid;
|
|
58
|
+
}
|
|
59
|
+
@layer properties {
|
|
60
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
61
|
+
*, ::before, ::after, ::backdrop {
|
|
62
|
+
--tw-border-style: solid;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/source-list",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridUI React source list",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/style-utils": "^2.1.2",
|
|
30
|
+
"@gridui/theme": "^2.1.2",
|
|
31
|
+
"class-variance-authority": "0.7.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
35
|
+
"@gridui/code-view": "1.0.0",
|
|
36
|
+
"@jest/globals": "30.5.2",
|
|
37
|
+
"@types/jest": "30.0.0",
|
|
38
|
+
"@types/node": "26.6.5",
|
|
39
|
+
"@types/react": "19.3.0",
|
|
40
|
+
"@types/react-dom": "19.3.0",
|
|
41
|
+
"jest": "30.5.2",
|
|
42
|
+
"react": "19.3.1",
|
|
43
|
+
"react-dom": "19.3.1",
|
|
44
|
+
"typescript": "6.0.3"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
48
|
+
"compile": "tsc --project tsconfig.json",
|
|
49
|
+
"test": "jest",
|
|
50
|
+
"coverage": "jest --coverage"
|
|
51
|
+
}
|
|
6
52
|
}
|