@gridui/collection 1.1.5 → 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 CHANGED
@@ -30,3 +30,5 @@ Selected items and links with an active `aria-current` use a persistent neutral
30
30
  surface through hover. Disabled buttons retain native disabled behavior.
31
31
  Links keep navigation, download, target, and ref behavior and have no disabled
32
32
  button API. Keep independent trailing actions in `CollectionItem.actions`.
33
+
34
+ [Component reference](docs/reference/README.md) contains focused API pages for each public component.
@@ -7,5 +7,6 @@
7
7
  import type { ComponentPropsWithRef, FC, ReactNode } from "react";
8
8
  export type CollectionItemProps = ComponentPropsWithRef<"li"> & {
9
9
  readonly actions?: ReactNode;
10
+ readonly layout?: "standard" | "cell" | undefined;
10
11
  };
11
12
  export declare const CollectionItem: FC<CollectionItemProps>;
@@ -5,6 +5,6 @@
5
5
  * @description Collection Item Button
6
6
  */
7
7
  import type { CollectionItemActionOptions } from "../shared/item-options";
8
- import type { ComponentPropsWithRef, FC } from "react";
8
+ import { type ComponentPropsWithRef, type FC } from "react";
9
9
  export type CollectionItemButtonProps = Omit<ComponentPropsWithRef<"button">, "title" | "children"> & CollectionItemActionOptions;
10
10
  export declare const CollectionItemButton: FC<CollectionItemButtonProps>;
@@ -5,7 +5,7 @@
5
5
  * @description Collection Item Link
6
6
  */
7
7
  import type { CollectionItemActionOptions } from "../shared/item-options";
8
- import type { ComponentPropsWithRef, FC } from "react";
8
+ import { type ComponentPropsWithRef, type FC } from "react";
9
9
  export type CollectionItemLinkProps = Omit<ComponentPropsWithRef<"a">, "title" | "children"> & CollectionItemActionOptions & {
10
10
  readonly href: string;
11
11
  };
package/dist/index.js CHANGED
@@ -1,29 +1,40 @@
1
+ // src/shared/layout-context.ts
2
+ import { createContext } from "react";
3
+ var CollectionLayoutContext = createContext("standard");
4
+
1
5
  // src/collection-item/collection-item.tsx
2
6
  import { cn } from "@gridui/style-utils";
3
7
  import { jsx, jsxs } from "react/jsx-runtime";
4
8
  var CollectionItem = (props) => {
5
- const { children, actions, className, ...restProps } = props;
6
- return /* @__PURE__ */ jsxs(
7
- "li",
9
+ const { children, actions, layout = "standard", className, ...restProps } = props;
10
+ return /* @__PURE__ */ jsx(
11
+ CollectionLayoutContext,
8
12
  {
9
- ...restProps,
10
- className: cn("gridui-collection-item", className),
11
- children: [
12
- /* @__PURE__ */ jsx(
13
- "div",
14
- {
15
- className: "gridui-collection-primary",
16
- children
17
- }
18
- ),
19
- actions && /* @__PURE__ */ jsx(
20
- "div",
21
- {
22
- className: "gridui-collection-actions",
23
- children: actions
24
- }
25
- )
26
- ]
13
+ value: layout,
14
+ children: /* @__PURE__ */ jsxs(
15
+ "li",
16
+ {
17
+ ...restProps,
18
+ "data-layout": layout,
19
+ className: cn("gridui-collection-item", className),
20
+ children: [
21
+ /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ className: "gridui-collection-primary",
25
+ children
26
+ }
27
+ ),
28
+ actions && /* @__PURE__ */ jsx(
29
+ "div",
30
+ {
31
+ className: "gridui-collection-actions",
32
+ children: actions
33
+ }
34
+ )
35
+ ]
36
+ }
37
+ )
27
38
  }
28
39
  );
29
40
  };
@@ -77,9 +88,12 @@ var CollectionItemContent = (props) => {
77
88
 
78
89
  // src/collection-item-button/collection-item-button.tsx
79
90
  import { cn as cn2 } from "@gridui/style-utils";
91
+ import { useContext } from "react";
80
92
  import { jsx as jsx3 } from "react/jsx-runtime";
81
93
  var CollectionItemButton = (props) => {
82
- const { title, description, icon, metadata, layout = "standard", selected, className, type = "button", ...restProps } = props;
94
+ const { title, description, icon, metadata, layout: layoutProp, selected, className, type = "button", ...restProps } = props;
95
+ const inheritedLayout = useContext(CollectionLayoutContext);
96
+ const layout = layoutProp ?? inheritedLayout;
83
97
  return /* @__PURE__ */ jsx3(
84
98
  "button",
85
99
  {
@@ -104,9 +118,12 @@ var CollectionItemButton = (props) => {
104
118
 
105
119
  // src/collection-item-link/collection-item-link.tsx
106
120
  import { cn as cn3 } from "@gridui/style-utils";
121
+ import { useContext as useContext2 } from "react";
107
122
  import { jsx as jsx4 } from "react/jsx-runtime";
108
123
  var CollectionItemLink = (props) => {
109
- const { title, description, icon, metadata, layout = "standard", selected, className, ...restProps } = props;
124
+ const { title, description, icon, metadata, layout: layoutProp, selected, className, ...restProps } = props;
125
+ const inheritedLayout = useContext2(CollectionLayoutContext);
126
+ const layout = layoutProp ?? inheritedLayout;
110
127
  return /* @__PURE__ */ jsx4(
111
128
  "a",
112
129
  {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/collection-item/collection-item.tsx", "../src/shared/item-content.tsx", "../src/collection-item-button/collection-item-button.tsx", "../src/collection-item-link/collection-item-link.tsx"],
4
- "sourcesContent": ["/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItem\n * @description Collection Item\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type CollectionItemProps = ComponentPropsWithRef<\"li\"> & {\n readonly actions?: ReactNode;\n};\n\nexport const CollectionItem: FC<CollectionItemProps> = (props: CollectionItemProps) => {\n const { children, actions, className, ...restProps } = props;\n return (<li\n {...restProps}\n className={cn(\"gridui-collection-item\", className)}\n >\n <div\n className=\"gridui-collection-primary\"\n >\n {children}\n </div>\n {actions && (<div\n className=\"gridui-collection-actions\"\n >\n {actions}\n </div>)}\n </li>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace Shared\n * @description Item Content\n */\n\nimport type { CollectionItemContentOptions } from \"./item-options\";\nimport type { FC } from \"react\";\n\nexport type CollectionItemContentProps = CollectionItemContentOptions;\n\nexport const CollectionItemContent: FC<CollectionItemContentProps> = (props: CollectionItemContentProps) => {\n const { title, description, icon, metadata, layout = \"standard\" } = props;\n const details = metadata !== undefined && metadata !== null ? (<span\n className=\"gridui-collection-metadata\"\n >\n {metadata}\n </span>) : null;\n return (<>\n {icon && (<span\n className=\"gridui-collection-icon\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>)}\n <span\n className=\"gridui-collection-copy\"\n >\n <span\n className=\"gridui-collection-title\"\n >\n {title}\n </span>\n {description !== undefined && description !== null && (<span\n className=\"gridui-collection-description\"\n >\n {description}\n </span>)}\n {layout === \"cell\" && details}\n </span>\n {layout !== \"cell\" && details}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItemButton\n * @description Collection Item Button\n */\n\nimport { CollectionItemContent } from \"../shared/item-content\";\nimport type { CollectionItemActionOptions } from \"../shared/item-options\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type CollectionItemButtonProps = Omit<ComponentPropsWithRef<\"button\">, \"title\" | \"children\"> & CollectionItemActionOptions;\n\nexport const CollectionItemButton: FC<CollectionItemButtonProps> = (props: CollectionItemButtonProps) => {\n const { title, description, icon, metadata, layout = \"standard\", selected, className, type = \"button\", ...restProps } = props;\n return (<button\n {...restProps}\n type={type}\n data-layout={layout}\n data-selected={selected || undefined}\n className={cn(\"gridui-collection-action\", className)}\n >\n <CollectionItemContent\n title={title}\n description={description}\n icon={icon}\n metadata={metadata}\n layout={layout}\n />\n </button>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItemLink\n * @description Collection Item Link\n */\n\nimport { CollectionItemContent } from \"../shared/item-content\";\nimport type { CollectionItemActionOptions } from \"../shared/item-options\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type CollectionItemLinkProps = Omit<ComponentPropsWithRef<\"a\">, \"title\" | \"children\"> & CollectionItemActionOptions & {\n readonly href: string;\n};\n\nexport const CollectionItemLink: FC<CollectionItemLinkProps> = (props: CollectionItemLinkProps) => {\n const { title, description, icon, metadata, layout = \"standard\", selected, className, ...restProps } = props;\n return (<a\n {...restProps}\n data-layout={layout}\n data-selected={selected || undefined}\n className={cn(\"gridui-collection-action\", className)}\n >\n <CollectionItemContent\n title={title}\n description={description}\n icon={icon}\n metadata={metadata}\n layout={layout}\n />\n </a>);\n};\n"],
5
- "mappings": ";AAOA,SAAS,UAAU;AASP,SAIJ,KAJI;AAFL,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,UAAU,SAAS,WAAW,GAAG,UAAU,IAAI;AACvD,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,WAAW,GAAG,0BAA0B,SAAS;AAAA,MAEjD;AAAA;AAAA,UAAC;AAAA;AAAA,YACG,WAAU;AAAA,YAET;AAAA;AAAA,QACL;AAAA,QACC,WAAY;AAAA,UAAC;AAAA;AAAA,YACV,WAAU;AAAA,YAET;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACJ;AACJ;;;ACjBmE,SAKvD,UALuD,OAAAA,MAY3D,QAAAC,aAZ2D;AAF5D,IAAM,wBAAwD,CAAC,UAAsC;AACxG,QAAM,EAAE,OAAO,aAAa,MAAM,UAAU,SAAS,WAAW,IAAI;AACpE,QAAM,UAAU,aAAa,UAAa,aAAa,OAAQ,gBAAAD;AAAA,IAAC;AAAA;AAAA,MAC5D,WAAU;AAAA,MAET;AAAA;AAAA,EACL,IAAW;AACX,SAAQ,gBAAAC,MAAA,YACH;AAAA,YAAS,gBAAAD;AAAA,MAAC;AAAA;AAAA,QACP,WAAU;AAAA,QACV,eAAY;AAAA,QAEX;AAAA;AAAA,IACL;AAAA,IACA,gBAAAC;AAAA,MAAC;AAAA;AAAA,QACG,WAAU;AAAA,QAEV;AAAA,0BAAAD;AAAA,YAAC;AAAA;AAAA,cACG,WAAU;AAAA,cAET;AAAA;AAAA,UACL;AAAA,UACC,gBAAgB,UAAa,gBAAgB,QAAS,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACpD,WAAU;AAAA,cAET;AAAA;AAAA,UACL;AAAA,UACC,WAAW,UAAU;AAAA;AAAA;AAAA,IAC1B;AAAA,IACC,WAAW,UAAU;AAAA,KAC1B;AACJ;;;AClCA,SAAS,MAAAE,WAAU;AAcX,gBAAAC,YAAA;AATD,IAAM,uBAAsD,CAAC,UAAqC;AACrG,QAAM,EAAE,OAAO,aAAa,MAAM,UAAU,SAAS,YAAY,UAAU,WAAW,OAAO,UAAU,GAAG,UAAU,IAAI;AACxH,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA,MACA,eAAa;AAAA,MACb,iBAAe,YAAY;AAAA,MAC3B,WAAWD,IAAG,4BAA4B,SAAS;AAAA,MAEnD,0BAAAC;AAAA,QAAC;AAAA;AAAA,UACG;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACtBA,SAAS,MAAAC,WAAU;AAeX,gBAAAC,YAAA;AARD,IAAM,qBAAkD,CAAC,UAAmC;AAC/F,QAAM,EAAE,OAAO,aAAa,MAAM,UAAU,SAAS,YAAY,UAAU,WAAW,GAAG,UAAU,IAAI;AACvG,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,eAAa;AAAA,MACb,iBAAe,YAAY;AAAA,MAC3B,WAAWD,IAAG,4BAA4B,SAAS;AAAA,MAEnD,0BAAAC;AAAA,QAAC;AAAA;AAAA,UACG;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;",
6
- "names": ["jsx", "jsxs", "cn", "jsx", "cn", "jsx"]
3
+ "sources": ["../src/shared/layout-context.ts", "../src/collection-item/collection-item.tsx", "../src/shared/item-content.tsx", "../src/collection-item-button/collection-item-button.tsx", "../src/collection-item-link/collection-item-link.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Collection\n * @namespace Shared\n * @description Layout Context\n */\n\nimport { createContext } from \"react\";\n\nexport const CollectionLayoutContext = createContext<\"standard\" | \"cell\">(\"standard\");\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItem\n * @description Collection Item\n */\n\nimport { CollectionLayoutContext } from \"../shared/layout-context\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type CollectionItemProps = ComponentPropsWithRef<\"li\"> & {\n readonly actions?: ReactNode;\n readonly layout?: \"standard\" | \"cell\" | undefined;\n};\n\nexport const CollectionItem: FC<CollectionItemProps> = (props: CollectionItemProps) => {\n const { children, actions, layout = \"standard\", className, ...restProps } = props;\n return (<CollectionLayoutContext\n value={layout}\n >\n <li\n {...restProps}\n data-layout={layout}\n className={cn(\"gridui-collection-item\", className)}\n >\n <div\n className=\"gridui-collection-primary\"\n >\n {children}\n </div>\n {actions && (<div\n className=\"gridui-collection-actions\"\n >\n {actions}\n </div>)}\n </li>\n </CollectionLayoutContext>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace Shared\n * @description Item Content\n */\n\nimport type { CollectionItemContentOptions } from \"./item-options\";\nimport type { FC } from \"react\";\n\nexport type CollectionItemContentProps = CollectionItemContentOptions;\n\nexport const CollectionItemContent: FC<CollectionItemContentProps> = (props: CollectionItemContentProps) => {\n const { title, description, icon, metadata, layout = \"standard\" } = props;\n const details = metadata !== undefined && metadata !== null ? (<span\n className=\"gridui-collection-metadata\"\n >\n {metadata}\n </span>) : null;\n return (<>\n {icon && (<span\n className=\"gridui-collection-icon\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>)}\n <span\n className=\"gridui-collection-copy\"\n >\n <span\n className=\"gridui-collection-title\"\n >\n {title}\n </span>\n {description !== undefined && description !== null && (<span\n className=\"gridui-collection-description\"\n >\n {description}\n </span>)}\n {layout === \"cell\" && details}\n </span>\n {layout !== \"cell\" && details}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItemButton\n * @description Collection Item Button\n */\n\nimport { CollectionItemContent } from \"../shared/item-content\";\nimport type { CollectionItemActionOptions } from \"../shared/item-options\";\nimport { CollectionLayoutContext } from \"../shared/layout-context\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type CollectionItemButtonProps = Omit<ComponentPropsWithRef<\"button\">, \"title\" | \"children\"> & CollectionItemActionOptions;\n\nexport const CollectionItemButton: FC<CollectionItemButtonProps> = (props: CollectionItemButtonProps) => {\n const { title, description, icon, metadata, layout: layoutProp, selected, className, type = \"button\", ...restProps } = props;\n const inheritedLayout = useContext(CollectionLayoutContext);\n const layout = layoutProp ?? inheritedLayout;\n return (<button\n {...restProps}\n type={type}\n data-layout={layout}\n data-selected={selected || undefined}\n className={cn(\"gridui-collection-action\", className)}\n >\n <CollectionItemContent\n title={title}\n description={description}\n icon={icon}\n metadata={metadata}\n layout={layout}\n />\n </button>);\n};\n", "/**\n * @author WMXPY\n * @package Collection\n * @namespace CollectionItemLink\n * @description Collection Item Link\n */\n\nimport { CollectionItemContent } from \"../shared/item-content\";\nimport type { CollectionItemActionOptions } from \"../shared/item-options\";\nimport { CollectionLayoutContext } from \"../shared/layout-context\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type CollectionItemLinkProps = Omit<ComponentPropsWithRef<\"a\">, \"title\" | \"children\"> & CollectionItemActionOptions & {\n readonly href: string;\n};\n\nexport const CollectionItemLink: FC<CollectionItemLinkProps> = (props: CollectionItemLinkProps) => {\n const { title, description, icon, metadata, layout: layoutProp, selected, className, ...restProps } = props;\n const inheritedLayout = useContext(CollectionLayoutContext);\n const layout = layoutProp ?? inheritedLayout;\n return (<a\n {...restProps}\n data-layout={layout}\n data-selected={selected || undefined}\n className={cn(\"gridui-collection-action\", className)}\n >\n <CollectionItemContent\n title={title}\n description={description}\n icon={icon}\n metadata={metadata}\n layout={layout}\n />\n </a>);\n};\n"],
5
+ "mappings": ";AAOA,SAAS,qBAAqB;AAE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/**
2
+ * @author WMXPY
3
+ * @package Collection
4
+ * @namespace Shared
5
+ * @description Layout Context
6
+ */
7
+ export declare const CollectionLayoutContext: import("react").Context<"standard" | "cell">;
package/dist/styles.css CHANGED
@@ -3,7 +3,8 @@
3
3
  @layer utilities;
4
4
  @layer components {
5
5
  .gridui-collection-item {
6
- display: flex;
6
+ display: grid;
7
+ grid-template-columns: minmax(0, 1fr) fit-content(40%);
7
8
  align-items: stretch;
8
9
  gap: 0;
9
10
  list-style: none;
@@ -12,7 +13,6 @@
12
13
  }
13
14
  .gridui-collection-primary {
14
15
  display: flex;
15
- flex: 1;
16
16
  min-width: 0;
17
17
  }
18
18
  .gridui-collection-action {
@@ -84,7 +84,20 @@
84
84
  align-items: center;
85
85
  flex-wrap: wrap;
86
86
  gap: var(--gridui-space-4);
87
- flex: none;
88
- max-width: 40%;
87
+ min-width: 0;
88
+ }
89
+ .gridui-collection-item[data-layout="cell"] > .gridui-collection-actions {
90
+ display: grid;
91
+ grid-auto-flow: column;
92
+ grid-auto-columns: minmax(0, 1fr);
93
+ align-items: stretch;
94
+ gap: 0;
95
+ border-inline-start: 1px solid var(--gridui-border);
96
+ }
97
+ .gridui-collection-item[data-layout="cell"] > .gridui-collection-actions > * {
98
+ width: 100%;
99
+ height: auto;
100
+ min-width: 0;
101
+ border-radius: 0;
89
102
  }
90
103
  }
package/docs/catalog.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/collection",
4
- "version": "1.1.5",
4
+ "version": "1.2.0",
5
5
  "category": "core",
6
6
  "description": "GridUI React collection",
7
7
  "usage": "`CollectionItemButton` and `CollectionItemLink` accept `layout=\"cell\"` and `selected`. A cell fills its structural region, uses square corners and 16/24 spacing, and stacks title, description, and metadata with consistent row gaps. Grid or the containing list owns the surrounding seams. The default `standard` layout retains trailing metadata.",
8
8
  "documentation": [
9
9
  "README.md",
10
- "docs/collection.md"
10
+ "docs/collection.md",
11
+ "docs/reference/README.md",
12
+ "docs/reference/collection-item-button.md",
13
+ "docs/reference/collection-item-link.md",
14
+ "docs/reference/collection-item.md"
11
15
  ],
12
16
  "exports": [
13
17
  {
@@ -46,6 +50,9 @@
46
50
  "@gridui/collection/styles.css"
47
51
  ],
48
52
  "examples": [
53
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection-cells.mdx",
54
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/getting-started.mdx",
55
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/list-actions.mdx",
49
56
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection.stories.tsx"
50
57
  ]
51
58
  }
@@ -28,3 +28,27 @@ Use `aria-current="page"` on a current destination when appropriate. No implicit
28
28
  selection model, listbox role, roving focus, router, or virtualization is added.
29
29
  Custom primary content can be passed directly to `CollectionItem`. Consumers own
30
30
  ordering, loading, empty states, data formatting and action labels.
31
+
32
+ ## Row layout
33
+
34
+ `CollectionItem layout="standard"` is the default: the primary area grows with
35
+ its content while trailing controls remain compact and centered.
36
+
37
+ Use `layout="cell"` on the item for a full-row arrangement. Its primary button or
38
+ link inherits the layout unless explicitly overridden. The row uses CSS Grid
39
+ with a flexible primary column and a content-sized action column, capped at 40%
40
+ of the row. Both regions follow the content height. Trailing controls should be
41
+ direct children of `actions`; use `Button layout="cell"` to remove standalone
42
+ button geometry while retaining its semantics.
43
+
44
+ ```tsx
45
+ <CollectionItem layout="cell" actions={<Button layout="cell" onClick={pin}>Pin</Button>}>
46
+ <CollectionItemButton title="Project overview" description="Updated today" onClick={open} />
47
+ </CollectionItem>
48
+ ```
49
+
50
+ The item owns its bottom separator and the divider before actions. Avoid placing
51
+ that bordered row flush inside a Grid that draws the same seams. For a standalone
52
+ primary action in a Grid cell, compose `CollectionItemButton layout="cell"`
53
+ directly in the GridItem instead. A trailing action never invokes the primary
54
+ action; the two controls remain separate siblings with independent keyboard focus.
@@ -0,0 +1,6 @@
1
+ <!-- Generated by pnpm docs:storybook. -->
2
+ # Component reference
3
+
4
+ - [CollectionItem](collection-item.md)
5
+ - [CollectionItemButton](collection-item-button.md)
6
+ - [CollectionItemLink](collection-item-link.md)
@@ -0,0 +1,83 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # CollectionItemButton
3
+
4
+ Compose CollectionItemButton with CollectionItem inside the same @gridui/collection component family.
5
+
6
+ Import from ``@gridui/collection`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { CollectionItemButton } from "@gridui/collection";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/collection/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection.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
+ ### onFocus
23
+
24
+ ``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
25
+
26
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
27
+
28
+ ### onBlur
29
+
30
+ ``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
31
+
32
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
33
+
34
+ ### onChange
35
+
36
+ ``(event: ChangeEvent<HTMLButtonElement, Element>): void`` · Optional
37
+
38
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
39
+
40
+ ### onSubmit
41
+
42
+ ``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
43
+
44
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
45
+
46
+ ### onClick
47
+
48
+ ``(event: MouseEvent<HTMLButtonElement, MouseEvent>): void`` · Optional
49
+
50
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
51
+
52
+ ### type
53
+
54
+ ``"button" | "submit" | "reset" | undefined`` · Optional
55
+
56
+ Default: ``"button"``
57
+
58
+ ### title
59
+
60
+ ``ReactNode`` · Required
61
+
62
+ ### description
63
+
64
+ ``ReactNode`` · Optional
65
+
66
+ ### icon
67
+
68
+ ``ReactNode`` · Optional
69
+
70
+ ### metadata
71
+
72
+ ``ReactNode`` · Optional
73
+
74
+ ### layout
75
+
76
+ ``"cell" | "standard" | undefined`` · Optional
77
+
78
+ Layout within the containing region.
79
+
80
+ ### selected
81
+
82
+ ``boolean | undefined`` · Optional
83
+
@@ -0,0 +1,81 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # CollectionItemLink
3
+
4
+ Compose CollectionItemLink with CollectionItem inside the same @gridui/collection component family.
5
+
6
+ Import from ``@gridui/collection`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { CollectionItemLink } from "@gridui/collection";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/collection/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection.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
+ ### onFocus
23
+
24
+ ``(event: FocusEvent<HTMLAnchorElement, Element>): void`` · Optional
25
+
26
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
27
+
28
+ ### onBlur
29
+
30
+ ``(event: FocusEvent<HTMLAnchorElement, Element>): void`` · Optional
31
+
32
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
33
+
34
+ ### onChange
35
+
36
+ ``(event: ChangeEvent<HTMLAnchorElement, Element>): void`` · Optional
37
+
38
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
39
+
40
+ ### onSubmit
41
+
42
+ ``(event: SubmitEvent<HTMLAnchorElement>): void`` · Optional
43
+
44
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
45
+
46
+ ### onClick
47
+
48
+ ``(event: MouseEvent<HTMLAnchorElement, MouseEvent>): void`` · Optional
49
+
50
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
51
+
52
+ ### href
53
+
54
+ ``string`` · Required
55
+
56
+ ### title
57
+
58
+ ``ReactNode`` · Required
59
+
60
+ ### description
61
+
62
+ ``ReactNode`` · Optional
63
+
64
+ ### icon
65
+
66
+ ``ReactNode`` · Optional
67
+
68
+ ### metadata
69
+
70
+ ``ReactNode`` · Optional
71
+
72
+ ### layout
73
+
74
+ ``"cell" | "standard" | undefined`` · Optional
75
+
76
+ Layout within the containing region.
77
+
78
+ ### selected
79
+
80
+ ``boolean | undefined`` · Optional
81
+
@@ -0,0 +1,69 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # CollectionItem
3
+
4
+ Combines a primary action or link with independent trailing actions in one row. Use it for selectable records that also offer actions such as pinning or removing.
5
+
6
+ Import from ``@gridui/collection`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { CollectionItem } from "@gridui/collection";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/collection/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection.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
+ ### children
23
+
24
+ ``ReactNode`` · Optional
25
+
26
+ Content rendered inside the component.
27
+
28
+ ### onFocus
29
+
30
+ ``(event: FocusEvent<HTMLLIElement, Element>): void`` · Optional
31
+
32
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
33
+
34
+ ### onBlur
35
+
36
+ ``(event: FocusEvent<HTMLLIElement, Element>): void`` · Optional
37
+
38
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
39
+
40
+ ### onChange
41
+
42
+ ``(event: ChangeEvent<HTMLLIElement, Element>): void`` · Optional
43
+
44
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
45
+
46
+ ### onSubmit
47
+
48
+ ``(event: SubmitEvent<HTMLLIElement>): void`` · Optional
49
+
50
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
51
+
52
+ ### onClick
53
+
54
+ ``(event: MouseEvent<HTMLLIElement, MouseEvent>): void`` · Optional
55
+
56
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
57
+
58
+ ### actions
59
+
60
+ ``ReactNode`` · Optional
61
+
62
+ ### layout
63
+
64
+ ``"cell" | "standard" | undefined`` · Optional
65
+
66
+ Default: ``"standard"``
67
+
68
+ Layout within the containing region.
69
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/collection",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "GridUI React collection",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,12 +27,12 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/style-utils": "^3.0.0",
31
- "@gridui/theme": "^2.5.3"
30
+ "@gridui/style-utils": "^4.0.0",
31
+ "@gridui/theme": "^2.5.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@gridui-internal/configuration": "0.0.0-internal",
35
- "@gridui/button": "4.0.0",
35
+ "@gridui/button": "5.0.0",
36
36
  "@jest/globals": "30.5.2",
37
37
  "@storybook/react-vite": "10.6.6",
38
38
  "@types/jest": "30.0.0",