@gridui/collection 1.1.6 → 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.
@@ -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,W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H,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;AAEvB,IAAM,0BAA0B,cAAmC,UAAU;;;ACDpF,SAAS,UAAU;AAaX,SAKI,KALJ;AALD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,UAAU,SAAS,SAAS,YAAY,WAAW,GAAG,UAAU,IAAI;AAC5E,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,OA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AU,WAAW,OAAO,UAAU,GAAG,UAAU,IAAI;AACvH,QAAM,kBAAkB,WAAW,uBAAuB;AAC1D,QAAM,SAAS,cAAc;AAC7B,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;;;ACxBA,SAAS,MAAAC,WAAU;AACnB,SAA8C,cAAAC,mBAAkB;AAgBxD,gBAAAC,YAAA;AAVD,IAAM,qBAAkD,CAAC,UAAmC;AAC/F,QAAM,EAAE,OAAO,aAAa,MAAM,UAAU,QAAQ,YAAY,UAAU,WAAW,GAAG,UAAU,IAAI;AACtG,QAAM,kBAAkBD,YAAW,uBAAuB;AAC1D,QAAM,SAAS,cAAc;AAC7B,SAAQ,gBAAAC;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,eAAa;AAAA,MACb,iBAAe,YAAY;AAAA,MAC3B,WAAWF,IAAG,4BAA4B,SAAS;AAAA,MAEnD,0BAAAE;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", "useContext", "jsx"]
7
7
  }
@@ -0,0 +1,7 @@
1
+ /**
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,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/collection",
4
- "version": "1.1.6",
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.",
@@ -51,6 +51,7 @@
51
51
  ],
52
52
  "examples": [
53
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",
54
55
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/list-actions.mdx",
55
56
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/collection/stories/collection.stories.tsx"
56
57
  ]
@@ -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.
@@ -75,8 +75,6 @@ Default: ``"button"``
75
75
 
76
76
  ``"cell" | "standard" | undefined`` · Optional
77
77
 
78
- Default: ``"standard"``
79
-
80
78
  Layout within the containing region.
81
79
 
82
80
  ### selected
@@ -73,8 +73,6 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
73
73
 
74
74
  ``"cell" | "standard" | undefined`` · Optional
75
75
 
76
- Default: ``"standard"``
77
-
78
76
  Layout within the containing region.
79
77
 
80
78
  ### selected
@@ -59,3 +59,11 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
59
59
 
60
60
  ``ReactNode`` · Optional
61
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.6",
3
+ "version": "1.2.0",
4
4
  "description": "GridUI React collection",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@gridui/style-utils": "^4.0.0",
31
- "@gridui/theme": "^2.5.3"
31
+ "@gridui/theme": "^2.5.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@gridui-internal/configuration": "0.0.0-internal",
35
- "@gridui/button": "4.1.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",