@zendeskgarden/react-grid 8.50.1 → 8.51.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 +58 -0
- package/dist/index.cjs.js +578 -30
- package/dist/index.esm.js +579 -34
- package/dist/typings/elements/pane/Pane.d.ts +16 -0
- package/dist/typings/elements/pane/PaneProvider.d.ts +22 -0
- package/dist/typings/elements/pane/components/Content.d.ts +11 -0
- package/dist/typings/elements/pane/components/Splitter.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +3 -0
- package/dist/typings/styled/pane/StyledPane.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneContent.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +16 -0
- package/dist/typings/types/index.d.ts +48 -1
- package/dist/typings/utils/usePaneContext.d.ts +17 -0
- package/dist/typings/utils/useSplitterContext.d.ts +27 -0
- package/package.json +6 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Splitter } from './components/Splitter';
|
|
9
|
+
import { Content } from './components/Content';
|
|
10
|
+
/**
|
|
11
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
12
|
+
*/
|
|
13
|
+
export declare const Pane: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>> & {
|
|
14
|
+
Content: typeof Content;
|
|
15
|
+
Splitter: typeof Splitter;
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { IPaneProviderProps } from '../../types';
|
|
9
|
+
export declare const PaneProvider: {
|
|
10
|
+
({ totalPanesWidth, totalPanesHeight, defaultRowValues, defaultColumnValues, rowValues, columnValues, onChange, children }: IPaneProviderProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
propTypes: {
|
|
13
|
+
totalPanesWidth: PropTypes.Validator<number>;
|
|
14
|
+
totalPanesHeight: PropTypes.Validator<number>;
|
|
15
|
+
defaultRowValues: PropTypes.Requireable<object>;
|
|
16
|
+
defaultColumnValues: PropTypes.Requireable<object>;
|
|
17
|
+
rowValues: PropTypes.Requireable<object>;
|
|
18
|
+
columnValues: PropTypes.Requireable<object>;
|
|
19
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
10
|
+
*/
|
|
11
|
+
export declare const Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { ISplitterProps } from '../../../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const Splitter: React.ForwardRefExoticComponent<ISplitterProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -7,5 +7,7 @@
|
|
|
7
7
|
export { Col } from './elements/Col';
|
|
8
8
|
export { Grid } from './elements/Grid';
|
|
9
9
|
export { Row } from './elements/Row';
|
|
10
|
+
export { PaneProvider } from './elements/pane/PaneProvider';
|
|
11
|
+
export { Pane } from './elements/pane/Pane';
|
|
10
12
|
export { ALIGN_ITEMS as ARRAY_ALIGN_ITEMS, ALIGN_SELF as ARRAY_ALIGN_SELF, DIRECTION as ARRAY_DIRECTION, JUSTIFY_CONTENT as ARRAY_JUSTIFY_CONTENT, TEXT_ALIGN as ARRAY_TEXT_ALIGN, SPACE as ARRAY_SPACE, WRAP as ARRAY_WRAP } from './types';
|
|
11
|
-
export type { IColProps, IGridProps, IRowProps, AlignItems as ALIGN_ITEMS, AlignSelf as ALIGN_SELF, Direction as DIRECTION, JustifyContent as JUSTIFY_CONTENT, TextAlign as TEXT_ALIGN, GridNumber as GRID_NUMBER, Breakpoint as BREAKPOINT, Space as SPACE, Wrap as WRAP } from './types';
|
|
13
|
+
export type { IPaneProviderProps, ISplitterProps, IColProps, IGridProps, IRowProps, AlignItems as ALIGN_ITEMS, AlignSelf as ALIGN_SELF, Direction as DIRECTION, JustifyContent as JUSTIFY_CONTENT, TextAlign as TEXT_ALIGN, GridNumber as GRID_NUMBER, Breakpoint as BREAKPOINT, Space as SPACE, Wrap as WRAP } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StyledPane: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
8
|
+
'data-garden-id': string;
|
|
9
|
+
'data-garden-version': string;
|
|
10
|
+
}, "data-garden-id" | "data-garden-version">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StyledPaneContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
8
|
+
'data-garden-id': string;
|
|
9
|
+
'data-garden-version': string;
|
|
10
|
+
}, "data-garden-id" | "data-garden-version">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
import { Orientation } from '../../types';
|
|
9
|
+
interface IStyledPaneSplitterProps {
|
|
10
|
+
orientation: Orientation;
|
|
11
|
+
}
|
|
12
|
+
export declare const StyledPaneSplitter: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
13
|
+
'data-garden-id': string;
|
|
14
|
+
'data-garden-version': string;
|
|
15
|
+
} & IStyledPaneSplitterProps, "data-garden-id" | "data-garden-version">;
|
|
16
|
+
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import { HTMLAttributes } from 'react';
|
|
7
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
8
8
|
export declare const ALIGN_ITEMS: readonly ["start", "end", "center", "baseline", "stretch"];
|
|
9
9
|
export declare const ALIGN_SELF: readonly ["auto", "start", "end", "center", "baseline", "stretch"];
|
|
10
10
|
export declare const DIRECTION: readonly ["row", "row-reverse", "column", "column-reverse"];
|
|
@@ -152,3 +152,50 @@ export interface IRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
152
152
|
/** Applies the `flex-wrap` container property to the row on extra-large screens */
|
|
153
153
|
wrapXl?: Wrap;
|
|
154
154
|
}
|
|
155
|
+
export declare const ORIENTATION: readonly ["top", "bottom", "start", "end"];
|
|
156
|
+
export declare type Orientation = typeof ORIENTATION[number];
|
|
157
|
+
export interface IPaneProviderProps {
|
|
158
|
+
/** Provides the total width, in `px` units, of all panes in the layout */
|
|
159
|
+
totalPanesWidth: number;
|
|
160
|
+
/** Provides the total height, in `px` units, of all panes in the layout */
|
|
161
|
+
totalPanesHeight: number;
|
|
162
|
+
/** Defines default row values, in `fr` units, for an uncontrolled layout. The values are keyed by splitter. */
|
|
163
|
+
defaultRowValues?: Record<string, number>;
|
|
164
|
+
/** Defines default column values, in `fr` units, for an uncontrolled layout. The values are keyed by splitter. */
|
|
165
|
+
defaultColumnValues?: Record<string, number>;
|
|
166
|
+
/** Defines row values, in `fr` units, for a controlled layout. The values are keyed by splitter. */
|
|
167
|
+
rowValues?: Record<string, number>;
|
|
168
|
+
/** Defines column values, in `fr` units, for a controlled layout. The values are keyed by splitter. */
|
|
169
|
+
columnValues?: Record<string, number>;
|
|
170
|
+
/**
|
|
171
|
+
* Handles splitter position changes
|
|
172
|
+
*
|
|
173
|
+
* @param rowValues The updated row values
|
|
174
|
+
* @param columnValues The updated column values
|
|
175
|
+
*/
|
|
176
|
+
onChange?: (rowValues: Record<string, number>, columnValues: Record<string, number>) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Surfaces render prop functions for applying splitter state to the supporting layout
|
|
179
|
+
*
|
|
180
|
+
* @param getColumnValue Gets column value by key
|
|
181
|
+
* @param getRowValue Gets row value by key
|
|
182
|
+
* @param getGridTemplateRows Gets grid template rows track
|
|
183
|
+
* @param getGridTemplateColumns Gets grid template columns track
|
|
184
|
+
*/
|
|
185
|
+
children?: ({ getColumnValue, getRowValue, getGridTemplateRows, getGridTemplateColumns }: {
|
|
186
|
+
getColumnValue: (splitterKey: string, isPixels?: boolean) => number;
|
|
187
|
+
getRowValue: (splitterKey: string, isPixels?: boolean) => number;
|
|
188
|
+
getGridTemplateRows: (isPixels?: boolean) => string;
|
|
189
|
+
getGridTemplateColumns: (isPixels?: boolean) => string;
|
|
190
|
+
}) => ReactNode;
|
|
191
|
+
}
|
|
192
|
+
export interface ISplitterProps extends HTMLAttributes<HTMLDivElement> {
|
|
193
|
+
/** Specifies the splitter key */
|
|
194
|
+
layoutKey: string;
|
|
195
|
+
/** Sets a minimum, in `fr` units, for splitter position */
|
|
196
|
+
min: number;
|
|
197
|
+
/** Sets a maximum, in `fr` units, for splitter position */
|
|
198
|
+
max: number;
|
|
199
|
+
/** Determines splitter orientation within a pane */
|
|
200
|
+
orientation?: Orientation;
|
|
201
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
interface IPaneContext {
|
|
9
|
+
id?: string;
|
|
10
|
+
setId: (id: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const PaneContext: import("react").Context<IPaneContext>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve Splitter component context
|
|
15
|
+
*/
|
|
16
|
+
declare const usePaneContext: () => IPaneContext;
|
|
17
|
+
export default usePaneContext;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
interface ISplitterContext {
|
|
9
|
+
rowState: Record<string, number>;
|
|
10
|
+
columnState: Record<string, number>;
|
|
11
|
+
setRowValue: (isTop: boolean, id: string, value: number) => void;
|
|
12
|
+
setColumnValue: (isStart: boolean, id: string, value: number) => void;
|
|
13
|
+
getColumnValue: (splitterKey: string, isPixels?: boolean) => number;
|
|
14
|
+
getRowValue: (splitterKey: string, isPixels?: boolean) => number;
|
|
15
|
+
totalPanesHeight: number;
|
|
16
|
+
totalPanesWidth: number;
|
|
17
|
+
pixelsPerFr: {
|
|
18
|
+
rows: number;
|
|
19
|
+
columns: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const SplitterContext: import("react").Context<ISplitterContext>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve Splitter component context
|
|
25
|
+
*/
|
|
26
|
+
declare const useSplitterContext: () => ISplitterContext;
|
|
27
|
+
export default useSplitterContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.51.0",
|
|
4
4
|
"description": "Components relating to layout grids in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@zendeskgarden/container-splitter": "^0.2.3",
|
|
24
25
|
"polished": "^4.0.0",
|
|
25
|
-
"prop-types": "^15.5.7"
|
|
26
|
+
"prop-types": "^15.5.7",
|
|
27
|
+
"react-merge-refs": "^1.1.0"
|
|
26
28
|
},
|
|
27
29
|
"peerDependencies": {
|
|
28
30
|
"@zendeskgarden/react-theming": "^8.1.0",
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@zendeskgarden/react-theming": "^8.
|
|
36
|
+
"@zendeskgarden/react-theming": "^8.51.0"
|
|
35
37
|
},
|
|
36
38
|
"keywords": [
|
|
37
39
|
"components",
|
|
@@ -43,5 +45,5 @@
|
|
|
43
45
|
"access": "public"
|
|
44
46
|
},
|
|
45
47
|
"zendeskgarden:src": "src/index.ts",
|
|
46
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "a932647429f0a79984650d2521f357ed8320d1d0"
|
|
47
49
|
}
|