@gridui/citation-popover 1.0.4 → 1.0.6
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 +2 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/styles.css +11 -11
- package/docs/catalog.json +7 -3
- package/docs/reference/README.md +4 -0
- package/docs/reference/citation-popover.md +45 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -6,3 +6,5 @@ Import components from `@gridui/citation-popover` and load `@gridui/citation-pop
|
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
8
|
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-dashboard/citation-popover/.changeset/history).
|
|
9
|
+
|
|
10
|
+
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/citation-popover/style.ts
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
|
-
var citationStyles = cva("gridui-u-w-80 gridui-u-max-w-[calc(100vw-32px)] gridui-u-wrap-anywhere gridui-u-[&_a]:text-link");
|
|
4
|
-
var citationQuoteStyles = cva("gridui-u-mx-0 gridui-u-border-s-2 gridui-u-border-border gridui-u-ps-gridui-16 gridui-u-[&_mark]:bg-accent-background gridui-u-[&_mark]:text-accent-foreground");
|
|
3
|
+
var citationStyles = cva("gridui-u-citation-popover--w-80 gridui-u-citation-popover--max-w-[calc(100vw-32px)] gridui-u-citation-popover--wrap-anywhere gridui-u-citation-popover--[&_a]:text-link");
|
|
4
|
+
var citationQuoteStyles = cva("gridui-u-citation-popover--mx-0 gridui-u-citation-popover--border-s-2 gridui-u-citation-popover--border-border gridui-u-citation-popover--ps-gridui-16 gridui-u-citation-popover--[&_mark]:bg-accent-background gridui-u-citation-popover--[&_mark]:text-accent-foreground");
|
|
5
5
|
|
|
6
6
|
// src/citation-popover/citation-popover.tsx
|
|
7
7
|
import { Popover, PopoverPanel, PopoverTrigger } from "@gridui/popover";
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/citation-popover/style.ts", "../src/citation-popover/citation-popover.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Citation Popover\n * @namespace CitationPopover\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const citationStyles = cva(\"gridui-u-w-80 gridui-u-max-w-[calc(100vw-32px)] gridui-u-wrap-anywhere gridui-u-[&_a]:text-link\");\n\nexport const citationQuoteStyles = cva(\"gridui-u-mx-0 gridui-u-border-s-2 gridui-u-border-border gridui-u-ps-gridui-16 gridui-u-[&_mark]:bg-accent-background gridui-u-[&_mark]:text-accent-foreground\");\n", "/**\n * @author WMXPY\n * @package Citation Popover\n * @namespace CitationPopover\n * @description Citation Popover\n */\n\nimport { citationQuoteStyles, citationStyles } from \"./style\";\nimport { Popover, PopoverPanel, PopoverTrigger } from \"@gridui/popover\";\nimport type { SourceItem } from \"@gridui/source-list\";\nimport { type FC, type ReactNode, useId } from \"react\";\n\nexport type CitationPopoverProps = {\n readonly source: SourceItem;\n readonly marker: ReactNode;\n readonly label: string;\n readonly openLabel: string;\n readonly quote?: string;\n readonly unmatchedLabel: string;\n};\n\nexport const CitationPopover: FC<CitationPopoverProps> = (props: CitationPopoverProps) => {\n const { source, marker, label, openLabel, quote, unmatchedLabel } = props;\n const id = useId();\n const excerpt = source.excerpt ?? \"\";\n const index = quote ? excerpt.indexOf(quote) : -1;\n return (<Popover>\n <PopoverTrigger\n aria-label={label}\n >\n {marker}\n </PopoverTrigger>\n <PopoverPanel\n aria-labelledby={id}\n className={citationStyles()}\n >\n <strong\n id={id}\n >\n {source.title}\n </strong>\n {source.description && (<p>\n {source.description}\n </p>)}\n {excerpt && (<blockquote\n className={citationQuoteStyles()}\n >\n {quote && index >= 0 ? (<>\n {excerpt.slice(0, index)}\n <mark>\n {quote}\n </mark>\n {excerpt.slice(index + quote.length)}\n </>) : excerpt}\n </blockquote>)}\n {quote && index < 0 && (<p\n role=\"status\"\n >\n {unmatchedLabel}\n </p>)}\n <a\n href={source.href}\n >\n {openLabel}\n </a>\n </PopoverPanel>\n </Popover>);\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,WAAW;AAEb,IAAM,iBAAiB,IAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Citation Popover\n * @namespace CitationPopover\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const citationStyles = cva(\"gridui-u-citation-popover--w-80 gridui-u-citation-popover--max-w-[calc(100vw-32px)] gridui-u-citation-popover--wrap-anywhere gridui-u-citation-popover--[&_a]:text-link\");\n\nexport const citationQuoteStyles = cva(\"gridui-u-citation-popover--mx-0 gridui-u-citation-popover--border-s-2 gridui-u-citation-popover--border-border gridui-u-citation-popover--ps-gridui-16 gridui-u-citation-popover--[&_mark]:bg-accent-background gridui-u-citation-popover--[&_mark]:text-accent-foreground\");\n", "/**\n * @author WMXPY\n * @package Citation Popover\n * @namespace CitationPopover\n * @description Citation Popover\n */\n\nimport { citationQuoteStyles, citationStyles } from \"./style\";\nimport { Popover, PopoverPanel, PopoverTrigger } from \"@gridui/popover\";\nimport type { SourceItem } from \"@gridui/source-list\";\nimport { type FC, type ReactNode, useId } from \"react\";\n\nexport type CitationPopoverProps = {\n readonly source: SourceItem;\n readonly marker: ReactNode;\n readonly label: string;\n readonly openLabel: string;\n readonly quote?: string;\n readonly unmatchedLabel: string;\n};\n\nexport const CitationPopover: FC<CitationPopoverProps> = (props: CitationPopoverProps) => {\n const { source, marker, label, openLabel, quote, unmatchedLabel } = props;\n const id = useId();\n const excerpt = source.excerpt ?? \"\";\n const index = quote ? excerpt.indexOf(quote) : -1;\n return (<Popover>\n <PopoverTrigger\n aria-label={label}\n >\n {marker}\n </PopoverTrigger>\n <PopoverPanel\n aria-labelledby={id}\n className={citationStyles()}\n >\n <strong\n id={id}\n >\n {source.title}\n </strong>\n {source.description && (<p>\n {source.description}\n </p>)}\n {excerpt && (<blockquote\n className={citationQuoteStyles()}\n >\n {quote && index >= 0 ? (<>\n {excerpt.slice(0, index)}\n <mark>\n {quote}\n </mark>\n {excerpt.slice(index + quote.length)}\n </>) : excerpt}\n </blockquote>)}\n {quote && index < 0 && (<p\n role=\"status\"\n >\n {unmatchedLabel}\n </p>)}\n <a\n href={source.href}\n >\n {openLabel}\n </a>\n </PopoverPanel>\n </Popover>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,WAAW;AAEb,IAAM,iBAAiB,IAAI,yKAAyK;AAEpM,IAAM,sBAAsB,IAAI,4QAA4Q;;;ACHnT,SAAS,SAAS,cAAc,sBAAsB;AAEtD,SAAkC,aAAa;AAiBvC,SAoBgC,UApBhC,KAoBgC,YApBhC;AAND,IAAM,kBAA4C,CAAC,UAAgC;AACtF,QAAM,EAAE,QAAQ,QAAQ,OAAO,WAAW,OAAO,eAAe,IAAI;AACpE,QAAM,KAAK,MAAM;AACjB,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,QAAQ,QAAQ,QAAQ,QAAQ,KAAK,IAAI;AAC/C,SAAQ,qBAAC,WACL;AAAA;AAAA,MAAC;AAAA;AAAA,QACG,cAAY;AAAA,QAEX;AAAA;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACG,mBAAiB;AAAA,QACjB,WAAW,eAAe;AAAA,QAE1B;AAAA;AAAA,YAAC;AAAA;AAAA,cACG;AAAA,cAEC,iBAAO;AAAA;AAAA,UACZ;AAAA,UACC,OAAO,eAAgB,oBAAC,OACpB,iBAAO,aACZ;AAAA,UACC,WAAY;AAAA,YAAC;AAAA;AAAA,cACV,WAAW,oBAAoB;AAAA,cAE9B,mBAAS,SAAS,IAAK,iCACnB;AAAA,wBAAQ,MAAM,GAAG,KAAK;AAAA,gBACvB,oBAAC,UACI,iBACL;AAAA,gBACC,QAAQ,MAAM,QAAQ,MAAM,MAAM;AAAA,iBACvC,IAAO;AAAA;AAAA,UACX;AAAA,UACC,SAAS,QAAQ,KAAM;AAAA,YAAC;AAAA;AAAA,cACrB,MAAK;AAAA,cAEJ;AAAA;AAAA,UACL;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACG,MAAM,OAAO;AAAA,cAEZ;AAAA;AAAA,UACL;AAAA;AAAA;AAAA,IACJ;AAAA,KACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -7,35 +7,35 @@
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
@layer utilities {
|
|
10
|
-
.gridui-u-mx-0 {
|
|
10
|
+
.gridui-u-citation-popover--mx-0 {
|
|
11
11
|
margin-inline: 0px;
|
|
12
12
|
}
|
|
13
|
-
.gridui-u-w-80 {
|
|
13
|
+
.gridui-u-citation-popover--w-80 {
|
|
14
14
|
width: calc(var(--spacing) * 80);
|
|
15
15
|
}
|
|
16
|
-
.gridui-u-max-w-\[calc\(100vw-32px\)\] {
|
|
16
|
+
.gridui-u-citation-popover--max-w-\[calc\(100vw-32px\)\] {
|
|
17
17
|
max-width: calc(100vw - 32px);
|
|
18
18
|
}
|
|
19
|
-
.gridui-u-border-s-2 {
|
|
19
|
+
.gridui-u-citation-popover--border-s-2 {
|
|
20
20
|
border-inline-start-style: var(--tw-border-style);
|
|
21
21
|
border-inline-start-width: 2px;
|
|
22
22
|
}
|
|
23
|
-
.gridui-u-border-border {
|
|
23
|
+
.gridui-u-citation-popover--border-border {
|
|
24
24
|
border-color: var(--gridui-border);
|
|
25
25
|
}
|
|
26
|
-
.gridui-u-ps-gridui-16 {
|
|
26
|
+
.gridui-u-citation-popover--ps-gridui-16 {
|
|
27
27
|
padding-inline-start: var(--gridui-space-16);
|
|
28
28
|
}
|
|
29
|
-
.gridui-u-wrap-anywhere {
|
|
29
|
+
.gridui-u-citation-popover--wrap-anywhere {
|
|
30
30
|
overflow-wrap: anywhere;
|
|
31
31
|
}
|
|
32
|
-
.gridui-u
|
|
32
|
+
.gridui-u-citation-popover--\[\&_a\]\:text-link a {
|
|
33
33
|
color: var(--gridui-link);
|
|
34
34
|
}
|
|
35
|
-
.gridui-u
|
|
35
|
+
.gridui-u-citation-popover--\[\&_mark\]\:bg-accent-background mark {
|
|
36
36
|
background-color: var(--gridui-accent-background);
|
|
37
37
|
}
|
|
38
|
-
.gridui-u
|
|
38
|
+
.gridui-u-citation-popover--\[\&_mark\]\:text-accent-foreground mark {
|
|
39
39
|
color: var(--gridui-accent-foreground);
|
|
40
40
|
}
|
|
41
41
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/citation-popover",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"category": "dashboard",
|
|
6
6
|
"description": "GridUI React citation popover",
|
|
7
|
-
"usage": "
|
|
7
|
+
"usage": "Component reference contains focused API pages for each public component.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/citation-popover.md"
|
|
10
12
|
],
|
|
11
13
|
"exports": [
|
|
12
14
|
{
|
|
@@ -29,6 +31,8 @@
|
|
|
29
31
|
"@gridui/citation-popover/styles.css"
|
|
30
32
|
],
|
|
31
33
|
"examples": [
|
|
34
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-dashboard/citation-popover/stories/citations.mdx",
|
|
35
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-dashboard/citation-popover/stories/getting-started.mdx",
|
|
32
36
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-dashboard/citation-popover/stories/citation-popover.stories.tsx"
|
|
33
37
|
]
|
|
34
38
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# CitationPopover
|
|
3
|
+
|
|
4
|
+
Shows supporting source details from a citation trigger. Use it to inspect a reference without leaving the surrounding content.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/citation-popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { CitationPopover } from "@gridui/citation-popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/citation-popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-dashboard/citation-popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-dashboard/citation-popover/stories/citation-popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### source
|
|
23
|
+
|
|
24
|
+
``SourceItem`` · Required
|
|
25
|
+
|
|
26
|
+
### marker
|
|
27
|
+
|
|
28
|
+
``ReactNode`` · Required
|
|
29
|
+
|
|
30
|
+
### label
|
|
31
|
+
|
|
32
|
+
``string`` · Required
|
|
33
|
+
|
|
34
|
+
### openLabel
|
|
35
|
+
|
|
36
|
+
``string`` · Required
|
|
37
|
+
|
|
38
|
+
### quote
|
|
39
|
+
|
|
40
|
+
``string | undefined`` · Optional
|
|
41
|
+
|
|
42
|
+
### unmatchedLabel
|
|
43
|
+
|
|
44
|
+
``string`` · Required
|
|
45
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/citation-popover",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "GridUI React citation popover",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/popover": "^1.
|
|
31
|
-
"@gridui/source-list": "^1.0.
|
|
32
|
-
"@gridui/theme": "^
|
|
30
|
+
"@gridui/popover": "^1.2.0",
|
|
31
|
+
"@gridui/source-list": "^1.0.7",
|
|
32
|
+
"@gridui/theme": "^3.0.0",
|
|
33
33
|
"class-variance-authority": "0.7.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
37
37
|
"@jest/globals": "30.5.2",
|
|
38
|
-
"@storybook/react-vite": "10.6.
|
|
38
|
+
"@storybook/react-vite": "10.6.7",
|
|
39
39
|
"@types/jest": "30.0.0",
|
|
40
40
|
"@types/node": "26.6.6",
|
|
41
41
|
"@types/react": "19.3.0",
|