@gridui/source-list 1.1.0 → 1.2.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 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +2 -2
- package/dist/source-list/source-list.d.ts +2 -0
- package/dist/styles.css +10 -2
- package/dist/styles.local.css +10 -2
- package/docs/catalog.json +1 -1
- package/docs/reference/source-list.md +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,3 +18,10 @@ for static HTML loading, SSR limits, and avoiding duplicate CSS.
|
|
|
18
18
|
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-data/source-list/.changeset/history).
|
|
19
19
|
|
|
20
20
|
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
21
|
+
|
|
22
|
+
## Sizing and density
|
|
23
|
+
|
|
24
|
+
density compact/comfortable changes source-item block spacing; comfortable is the default. Titles, descriptions and quotations preserve their typography, native links and intrinsic content height.
|
|
25
|
+
|
|
26
|
+
See the [shared sizing contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/sizing.md)
|
|
27
|
+
for native attributes, scope precedence, tokens and target behavior.
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// src/source-list/style.ts
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
|
-
var sourceListStyles = cva("gridui-u-source-list--m-0 gridui-u-source-list--min-w-0 gridui-u-source-list--list-decimal gridui-u-source-list--ps-gridui-32");
|
|
4
|
-
var sourceItemStyles = cva("gridui-u-source-list--border-b gridui-u-source-list--border-border gridui-u-source-list--py-gridui-
|
|
3
|
+
var sourceListStyles = cva("gridui-source-list gridui-u-source-list--m-0 gridui-u-source-list--min-w-0 gridui-u-source-list--list-decimal gridui-u-source-list--ps-gridui-32");
|
|
4
|
+
var sourceItemStyles = cva("gridui-u-source-list--border-b gridui-u-source-list--border-border gridui-u-source-list--py-(--gridui-source-block) gridui-u-source-list--wrap-anywhere gridui-u-source-list--[&_a]:text-link gridui-u-source-list--[&_blockquote]:mx-0 gridui-u-source-list--[&_blockquote]:border-s-2 gridui-u-source-list--[&_blockquote]:border-border gridui-u-source-list--[&_blockquote]:ps-gridui-16");
|
|
5
5
|
var sourceMetaStyles = cva("gridui-u-source-list--text-muted gridui-u-source-list--type-caption");
|
|
6
6
|
|
|
7
7
|
// src/source-list/source-list.tsx
|
|
8
8
|
import { cn } from "@gridui/style-utils";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
var SourceList = (props) => {
|
|
11
|
-
const { sources, label, emptyLabel, className, ...restProps } = props;
|
|
11
|
+
const { sources, label, density = "comfortable", emptyLabel, className, ...restProps } = props;
|
|
12
12
|
return /* @__PURE__ */ jsxs(
|
|
13
13
|
"ol",
|
|
14
14
|
{
|
|
15
15
|
...restProps,
|
|
16
16
|
"aria-label": label,
|
|
17
|
+
"data-density": density,
|
|
17
18
|
className: cn(sourceListStyles(), className),
|
|
18
19
|
children: [
|
|
19
20
|
sources.length === 0 && /* @__PURE__ */ jsx(
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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(\"gridui-u-source-list--m-0 gridui-u-source-list--min-w-0 gridui-u-source-list--list-decimal gridui-u-source-list--ps-gridui-32\");\n\nexport const sourceItemStyles = cva(\"gridui-u-source-list--border-b gridui-u-source-list--border-border gridui-u-source-list--py-gridui-
|
|
5
|
-
"mappings": ";AAOA,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI
|
|
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(\"gridui-source-list gridui-u-source-list--m-0 gridui-u-source-list--min-w-0 gridui-u-source-list--list-decimal gridui-u-source-list--ps-gridui-32\");\n\nexport const sourceItemStyles = cva(\"gridui-u-source-list--border-b gridui-u-source-list--border-border gridui-u-source-list--py-(--gridui-source-block) gridui-u-source-list--wrap-anywhere gridui-u-source-list--[&_a]:text-link gridui-u-source-list--[&_blockquote]:mx-0 gridui-u-source-list--[&_blockquote]:border-s-2 gridui-u-source-list--[&_blockquote]:border-border gridui-u-source-list--[&_blockquote]:ps-gridui-16\");\n\nexport const sourceMetaStyles = cva(\"gridui-u-source-list--text-muted gridui-u-source-list--type-caption\");\n", "/**\n * @author WMXPY\n * @package Source List\n * @namespace SourceList\n * @description Source List\n */\n\nimport type { Density } from \"@gridui/theme\";\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 density?: Density;\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, density = \"comfortable\", emptyLabel, className, ...restProps } = props;\n return (<ol\n {...restProps}\n aria-label={label}\n data-density={density}\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,kJAAkJ;AAE/K,IAAM,mBAAmB,IAAI,8XAA8X;AAE3Z,IAAM,mBAAmB,IAAI,qEAAqE;;;ACJzG,SAAS,UAAU;AA0Be,cAMd,YANc;AAR3B,IAAM,aAAkC,CAAC,UAA2B;AACvE,QAAM,EAAE,SAAS,OAAO,UAAU,eAAe,YAAY,WAAW,GAAG,UAAU,IAAI;AACzF,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,cAAY;AAAA,MACZ,gBAAc;AAAA,MACd,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @namespace SourceList
|
|
5
5
|
* @description Source List
|
|
6
6
|
*/
|
|
7
|
+
import type { Density } from "@gridui/theme";
|
|
7
8
|
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
9
|
export type SourceItem = {
|
|
9
10
|
readonly id: string;
|
|
@@ -13,6 +14,7 @@ export type SourceItem = {
|
|
|
13
14
|
readonly excerpt?: string;
|
|
14
15
|
};
|
|
15
16
|
export type SourceListProps = Omit<ComponentPropsWithRef<"ol">, "children"> & {
|
|
17
|
+
readonly density?: Density;
|
|
16
18
|
readonly sources: readonly SourceItem[];
|
|
17
19
|
readonly label: string;
|
|
18
20
|
readonly emptyLabel: string;
|
package/dist/styles.css
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
.gridui-u-source-list--border-border {
|
|
19
19
|
border-color: var(--gridui-border);
|
|
20
20
|
}
|
|
21
|
-
.gridui-u-source-list--py
|
|
22
|
-
padding-block: var(--gridui-
|
|
21
|
+
.gridui-u-source-list--py-\(--gridui-source-block\) {
|
|
22
|
+
padding-block: var(--gridui-source-block);
|
|
23
23
|
}
|
|
24
24
|
.gridui-u-source-list--ps-gridui-32 {
|
|
25
25
|
padding-inline-start: var(--gridui-space-32);
|
|
@@ -52,6 +52,14 @@
|
|
|
52
52
|
padding-inline-start: var(--gridui-space-16);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
@layer components {
|
|
56
|
+
.gridui-source-list {
|
|
57
|
+
--gridui-source-block: var(--gridui-space-8);
|
|
58
|
+
}
|
|
59
|
+
.gridui-source-list[data-density="compact"] {
|
|
60
|
+
--gridui-source-block: var(--gridui-space-4);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
55
63
|
@property --tw-border-style {
|
|
56
64
|
syntax: "*";
|
|
57
65
|
inherits: false;
|
package/dist/styles.local.css
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
.gridui-u-source-list--border-border {
|
|
19
19
|
border-color: var(--gridui-border);
|
|
20
20
|
}
|
|
21
|
-
.gridui-u-source-list--py
|
|
22
|
-
padding-block: var(--gridui-
|
|
21
|
+
.gridui-u-source-list--py-\(--gridui-source-block\) {
|
|
22
|
+
padding-block: var(--gridui-source-block);
|
|
23
23
|
}
|
|
24
24
|
.gridui-u-source-list--ps-gridui-32 {
|
|
25
25
|
padding-inline-start: var(--gridui-space-32);
|
|
@@ -52,6 +52,14 @@
|
|
|
52
52
|
padding-inline-start: var(--gridui-space-16);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
@layer components {
|
|
56
|
+
.gridui-source-list {
|
|
57
|
+
--gridui-source-block: var(--gridui-space-8);
|
|
58
|
+
}
|
|
59
|
+
.gridui-source-list[data-density="compact"] {
|
|
60
|
+
--gridui-source-block: var(--gridui-space-4);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
55
63
|
@property --tw-border-style {
|
|
56
64
|
syntax: "*";
|
|
57
65
|
inherits: false;
|
package/docs/catalog.json
CHANGED
|
@@ -49,6 +49,12 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
49
49
|
|
|
50
50
|
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
51
|
|
|
52
|
+
### density
|
|
53
|
+
|
|
54
|
+
``Density | undefined`` · Optional
|
|
55
|
+
|
|
56
|
+
Default: ``"comfortable"``
|
|
57
|
+
|
|
52
58
|
### sources
|
|
53
59
|
|
|
54
60
|
``readonly SourceItem[]`` · Required
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/source-list",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "GridUI React source list",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"react-dom": "^19.2.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@gridui/style-utils": "^4.
|
|
36
|
-
"@gridui/theme": "^
|
|
35
|
+
"@gridui/style-utils": "^4.1.0",
|
|
36
|
+
"@gridui/theme": "^5.0.0",
|
|
37
37
|
"class-variance-authority": "0.7.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|