@zendeskgarden/react-grid 8.50.1 → 8.53.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.
@@ -0,0 +1,18 @@
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
+ import { SplitterButton } from './components/SplitterButton';
11
+ /**
12
+ * @extends HTMLAttributes<HTMLDivElement>
13
+ */
14
+ export declare const Pane: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>> & {
15
+ Content: typeof Content;
16
+ Splitter: typeof Splitter;
17
+ SplitterButton: typeof SplitterButton;
18
+ };
@@ -0,0 +1,23 @@
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
+ ({ id, totalPanesWidth, totalPanesHeight, defaultRowValues, defaultColumnValues, rowValues, columnValues, onChange, children }: IPaneProviderProps): JSX.Element;
11
+ displayName: string;
12
+ propTypes: {
13
+ id: PropTypes.Requireable<string>;
14
+ totalPanesWidth: PropTypes.Validator<number>;
15
+ totalPanesHeight: PropTypes.Validator<number>;
16
+ defaultRowValues: PropTypes.Requireable<object>;
17
+ defaultColumnValues: PropTypes.Requireable<object>;
18
+ rowValues: PropTypes.Requireable<object>;
19
+ columnValues: PropTypes.Requireable<object>;
20
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
21
+ children: PropTypes.Requireable<(...args: any[]) => any>;
22
+ };
23
+ };
@@ -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>>;
@@ -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 { ISplitterButtonProps } from '../../../types';
9
+ /**
10
+ * @extends ButtonHTMLAttributes<HTMLButtonElement>
11
+ */
12
+ export declare const SplitterButton: React.ForwardRefExoticComponent<ISplitterButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -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, ISplitterButtonProps, 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';
@@ -7,3 +7,7 @@
7
7
  export * from './StyledCol';
8
8
  export * from './StyledGrid';
9
9
  export * from './StyledRow';
10
+ export * from './pane/StyledPane';
11
+ export * from './pane/StyledPaneContent';
12
+ export * from './pane/StyledPaneSplitter';
13
+ export * from './pane/StyledPaneSplitterButton';
@@ -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,20 @@
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
+ /**
13
+ * 1. Elevated initial context to pickup full-width hover
14
+ * 2. Stack below splitter button.
15
+ */
16
+ export declare const StyledPaneSplitter: import("styled-components").StyledComponent<"div", DefaultTheme, {
17
+ 'data-garden-id': string;
18
+ 'data-garden-version': string;
19
+ } & IStyledPaneSplitterProps, "data-garden-id" | "data-garden-version">;
20
+ export {};
@@ -0,0 +1,19 @@
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
+ import { DefaultTheme } from 'styled-components';
9
+ import { ISplitterButtonProps, Orientation, PLACEMENT } from '../../types';
10
+ interface IStyledSplitterButtonProps extends ISplitterButtonProps {
11
+ orientation: Orientation;
12
+ placement: typeof PLACEMENT[number];
13
+ isRotated: boolean;
14
+ }
15
+ /**
16
+ * 1. Opaque "dish" behind transparent button
17
+ */
18
+ export declare const StyledPaneSplitterButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@zendeskgarden/react-buttons").IIconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, DefaultTheme, IStyledSplitterButtonProps, never>;
19
+ 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, ButtonHTMLAttributes } 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"];
@@ -12,6 +12,7 @@ export declare const JUSTIFY_CONTENT: readonly ["start", "end", "center", "betwe
12
12
  export declare const TEXT_ALIGN: readonly ["start", "end", "center", "justify"];
13
13
  export declare const SPACE: readonly [false, "xxs", "xs", "sm", "md", "lg", "xl", "xxl"];
14
14
  export declare const WRAP: readonly ["nowrap", "wrap", "wrap-reverse"];
15
+ export declare const PLACEMENT: readonly ["end", "start", "center"];
15
16
  export declare type AlignItems = typeof ALIGN_ITEMS[number];
16
17
  export declare type AlignSelf = typeof ALIGN_SELF[number];
17
18
  export declare type Direction = typeof DIRECTION[number];
@@ -152,3 +153,62 @@ export interface IRowProps extends HTMLAttributes<HTMLDivElement> {
152
153
  /** Applies the `flex-wrap` container property to the row on extra-large screens */
153
154
  wrapXl?: Wrap;
154
155
  }
156
+ export declare const ORIENTATION: readonly ["top", "bottom", "start", "end"];
157
+ export declare type Orientation = typeof ORIENTATION[number];
158
+ export interface IPaneProviderProps {
159
+ /** Identifies the pane provider */
160
+ id?: string;
161
+ /** Provides the total width, in `px` units, of all panes in the layout */
162
+ totalPanesWidth: number;
163
+ /** Provides the total height, in `px` units, of all panes in the layout */
164
+ totalPanesHeight: number;
165
+ /** Defines default row values, in `fr` units, for an uncontrolled layout. The values are keyed by splitter. */
166
+ defaultRowValues?: Record<string, number>;
167
+ /** Defines default column values, in `fr` units, for an uncontrolled layout. The values are keyed by splitter. */
168
+ defaultColumnValues?: Record<string, number>;
169
+ /** Defines row values, in `fr` units, for a controlled layout. The values are keyed by splitter. */
170
+ rowValues?: Record<string, number>;
171
+ /** Defines column values, in `fr` units, for a controlled layout. The values are keyed by splitter. */
172
+ columnValues?: Record<string, number>;
173
+ /**
174
+ * Handles splitter position changes
175
+ *
176
+ * @param rowValues The updated row values
177
+ * @param columnValues The updated column values
178
+ */
179
+ onChange?: (rowValues: Record<string, number>, columnValues: Record<string, number>) => void;
180
+ /**
181
+ * Surfaces render props for applying splitter state to the supporting layout
182
+ *
183
+ * @param id Provides the `id` prop, if specified; otherwise, a generated ID.
184
+ * @param getColumnValue Gets column value by key
185
+ * @param getRowValue Gets row value by key
186
+ * @param getGridTemplateRows Gets grid template rows track
187
+ * @param getGridTemplateColumns Gets grid template columns track
188
+ */
189
+ children?: ({ id, getColumnValue, getRowValue, getGridTemplateRows, getGridTemplateColumns }: {
190
+ id: string;
191
+ getColumnValue: (splitterKey: string, isPixels?: boolean) => number;
192
+ getRowValue: (splitterKey: string, isPixels?: boolean) => number;
193
+ getGridTemplateRows: (isPixels?: boolean) => string;
194
+ getGridTemplateColumns: (isPixels?: boolean) => string;
195
+ }) => ReactNode;
196
+ }
197
+ export interface ISplitterProps extends HTMLAttributes<HTMLDivElement> {
198
+ /** Identifies the associated `PaneProvider`. Assumes the closest parent provider, by default. */
199
+ providerId?: string;
200
+ /** Specifies the splitter key */
201
+ layoutKey: string;
202
+ /** Sets a minimum, in `fr` units, for splitter position */
203
+ min: number;
204
+ /** Sets a maximum, in `fr` units, for splitter position */
205
+ max: number;
206
+ /** Determines splitter orientation within a pane */
207
+ orientation?: Orientation;
208
+ }
209
+ export interface ISplitterButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
210
+ /** Adjusts the placement of the splitter button. Assumes start when vertical and center when horizontal, by default. */
211
+ placement?: typeof PLACEMENT[number];
212
+ /** Renders the provided label text inside a tooltip */
213
+ label: string;
214
+ }
@@ -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,29 @@
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 IPaneProviderContextData {
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
+ interface IPaneProviderContext {
23
+ providerId?: string;
24
+ contextData?: Record<string, IPaneProviderContextData>;
25
+ }
26
+ export declare const PaneProviderContext: import("react").Context<IPaneProviderContext>;
27
+ export declare const usePaneProviderContextData: (providerId?: string | undefined) => IPaneProviderContextData | undefined;
28
+ declare const usePaneProviderContext: () => IPaneProviderContext;
29
+ export default usePaneProviderContext;
@@ -0,0 +1,23 @@
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
+ import { ISplitterProps, Orientation } from '../types';
9
+ interface IPaneSplitterContext {
10
+ orientation?: Orientation;
11
+ min: ISplitterProps['min'];
12
+ max: ISplitterProps['max'];
13
+ layoutKey: ISplitterProps['layoutKey'];
14
+ valueNow?: number;
15
+ isRow: boolean;
16
+ providerId?: ISplitterProps['providerId'];
17
+ }
18
+ export declare const PaneSplitterContext: import("react").Context<IPaneSplitterContext>;
19
+ /**
20
+ * Retrieve Pane Splitter component context
21
+ */
22
+ declare const usePaneSplitterContext: () => IPaneSplitterContext;
23
+ export default usePaneSplitterContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-grid",
3
- "version": "8.50.1",
3
+ "version": "8.53.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,13 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
+ "@zendeskgarden/container-splitter": "^0.2.3",
25
+ "@zendeskgarden/container-utilities": "^0.7.1",
26
+ "@zendeskgarden/react-buttons": "^8.53.0",
27
+ "@zendeskgarden/react-tooltips": "^8.53.0",
24
28
  "polished": "^4.0.0",
25
- "prop-types": "^15.5.7"
29
+ "prop-types": "^15.5.7",
30
+ "react-merge-refs": "^1.1.0"
26
31
  },
27
32
  "peerDependencies": {
28
33
  "@zendeskgarden/react-theming": "^8.1.0",
@@ -31,7 +36,8 @@
31
36
  "styled-components": "^4.2.0 || ^5.0.0"
32
37
  },
33
38
  "devDependencies": {
34
- "@zendeskgarden/react-theming": "^8.50.1"
39
+ "@zendeskgarden/react-theming": "^8.53.0",
40
+ "use-resize-observer": "9.0.0"
35
41
  },
36
42
  "keywords": [
37
43
  "components",
@@ -43,5 +49,5 @@
43
49
  "access": "public"
44
50
  },
45
51
  "zendeskgarden:src": "src/index.ts",
46
- "gitHead": "29c5137cb492925c71ae2d43dcd2927374b82a54"
52
+ "gitHead": "0fb51e654b241d34d9f933593f8525846112ae15"
47
53
  }