@carbon/react 1.23.0-rc.0 → 1.23.1
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/es/components/DataTable/tools/sorting.js +3 -0
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +15 -0
- package/es/components/Dropdown/Dropdown.Skeleton.js +1 -2
- package/es/components/Dropdown/index.js +1 -0
- package/es/components/FluidDropdown/FluidDropdown.js +1 -0
- package/es/components/Grid/CSSGrid.d.ts +9 -0
- package/es/components/Grid/CSSGrid.js +8 -5
- package/es/components/Grid/Column.d.ts +73 -0
- package/es/components/Grid/Column.js +40 -34
- package/es/components/Grid/ColumnHang.d.ts +24 -0
- package/es/components/Grid/ColumnHang.js +7 -4
- package/es/components/Grid/FlexGrid.d.ts +9 -0
- package/es/components/Grid/FlexGrid.js +6 -3
- package/es/components/Grid/Grid.d.ts +9 -0
- package/es/components/Grid/Grid.js +6 -5
- package/es/components/Grid/GridContext.d.ts +38 -0
- package/es/components/Grid/GridContext.js +6 -6
- package/es/components/Grid/GridTypes.d.ts +37 -0
- package/es/components/Grid/Row.d.ts +34 -0
- package/es/components/Grid/Row.js +4 -2
- package/es/components/Grid/index.d.ts +11 -0
- package/es/components/Heading/index.js +11 -4
- package/es/components/Menu/Menu.js +164 -216
- package/es/components/Menu/MenuContext.js +44 -0
- package/es/components/Menu/MenuItem.js +401 -23
- package/es/components/MultiSelect/MultiSelect.js +6 -0
- package/es/components/OverflowMenu/OverflowMenu.js +2 -2
- package/es/components/OverflowMenuV2/index.js +4 -14
- package/es/components/Search/Search.js +3 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -11
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/lib/components/DataTable/tools/sorting.js +3 -0
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +15 -0
- package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -2
- package/lib/components/Dropdown/index.js +2 -0
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -0
- package/lib/components/Grid/CSSGrid.d.ts +9 -0
- package/lib/components/Grid/CSSGrid.js +8 -5
- package/lib/components/Grid/Column.d.ts +73 -0
- package/lib/components/Grid/Column.js +36 -30
- package/lib/components/Grid/ColumnHang.d.ts +24 -0
- package/lib/components/Grid/ColumnHang.js +7 -4
- package/lib/components/Grid/FlexGrid.d.ts +9 -0
- package/lib/components/Grid/FlexGrid.js +6 -3
- package/lib/components/Grid/Grid.d.ts +9 -0
- package/lib/components/Grid/Grid.js +2 -1
- package/lib/components/Grid/GridContext.d.ts +38 -0
- package/lib/components/Grid/GridContext.js +6 -6
- package/lib/components/Grid/GridTypes.d.ts +37 -0
- package/lib/components/Grid/Row.d.ts +34 -0
- package/lib/components/Grid/Row.js +4 -2
- package/lib/components/Grid/index.d.ts +11 -0
- package/lib/components/Heading/index.js +11 -4
- package/lib/components/Menu/Menu.js +163 -216
- package/lib/components/Menu/MenuContext.js +53 -0
- package/lib/components/Menu/MenuItem.js +406 -23
- package/lib/components/MultiSelect/MultiSelect.js +6 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
- package/lib/components/OverflowMenuV2/index.js +5 -15
- package/lib/components/Search/Search.js +3 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +17 -21
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/package.json +4 -4
- package/es/components/Menu/MenuDivider.js +0 -19
- package/es/components/Menu/MenuGroup.js +0 -34
- package/es/components/Menu/MenuOption.js +0 -250
- package/es/components/Menu/MenuRadioGroup.js +0 -50
- package/es/components/Menu/MenuRadioGroupOptions.js +0 -64
- package/es/components/Menu/MenuSelectableItem.js +0 -57
- package/es/components/Menu/_utils.js +0 -177
- package/es/components/Menu/index.js +0 -25
- package/lib/components/Menu/MenuDivider.js +0 -27
- package/lib/components/Menu/MenuGroup.js +0 -43
- package/lib/components/Menu/MenuOption.js +0 -260
- package/lib/components/Menu/MenuRadioGroup.js +0 -59
- package/lib/components/Menu/MenuRadioGroupOptions.js +0 -73
- package/lib/components/Menu/MenuSelectableItem.js +0 -66
- package/lib/components/Menu/_utils.js +0 -191
- package/lib/components/Menu/index.js +0 -31
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var Dropdown = require('./Dropdown.js');
|
|
13
|
+
var Dropdown_Skeleton = require('./Dropdown.Skeleton.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
exports.Dropdown = Dropdown["default"];
|
|
17
18
|
exports["default"] = Dropdown["default"];
|
|
19
|
+
exports.DropdownSkeleton = Dropdown_Skeleton["default"];
|
|
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var Dropdown = require('../Dropdown/Dropdown.js');
|
|
17
|
+
require('../Dropdown/Dropdown.Skeleton.js');
|
|
17
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
19
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
20
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { GridComponent } from './GridTypes';
|
|
8
|
+
declare const CSSGridComponent: GridComponent;
|
|
9
|
+
export { CSSGridComponent as CSSGrid };
|
|
@@ -64,11 +64,13 @@ function CSSGrid(_ref) {
|
|
|
64
64
|
}, rest), children));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
var className = cx__default["default"](customClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--condensed"), mode === 'condensed'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--narrow"), mode === 'narrow'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--full-width"), fullWidth), _cx));
|
|
67
|
+
var className = cx__default["default"](customClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--condensed"), mode === 'condensed'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--narrow"), mode === 'narrow'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--css-grid--full-width"), fullWidth), _cx)); // cast as any to let TypeScript allow passing in attributes to base component
|
|
68
|
+
|
|
69
|
+
var BaseComponentAsAny = BaseComponent;
|
|
68
70
|
return /*#__PURE__*/React__default["default"].createElement(GridContext.GridSettings, {
|
|
69
71
|
mode: "css-grid",
|
|
70
72
|
subgrid: true
|
|
71
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
73
|
+
}, /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
72
74
|
className: className
|
|
73
75
|
}, rest), children));
|
|
74
76
|
}
|
|
@@ -107,7 +109,7 @@ CSSGrid.propTypes = {
|
|
|
107
109
|
narrow: PropTypes__default["default"].bool
|
|
108
110
|
};
|
|
109
111
|
|
|
110
|
-
function Subgrid(_ref2) {
|
|
112
|
+
var Subgrid = function Subgrid(_ref2) {
|
|
111
113
|
var _cx2;
|
|
112
114
|
|
|
113
115
|
var _ref2$as = _ref2.as,
|
|
@@ -122,7 +124,7 @@ function Subgrid(_ref2) {
|
|
|
122
124
|
return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
123
125
|
className: className
|
|
124
126
|
}), children);
|
|
125
|
-
}
|
|
127
|
+
};
|
|
126
128
|
|
|
127
129
|
Subgrid.propTypes = {
|
|
128
130
|
/**
|
|
@@ -145,5 +147,6 @@ Subgrid.propTypes = {
|
|
|
145
147
|
*/
|
|
146
148
|
mode: PropTypes__default["default"].oneOf(['wide', 'narrow', 'condensed'])
|
|
147
149
|
};
|
|
150
|
+
var CSSGridComponent = CSSGrid;
|
|
148
151
|
|
|
149
|
-
exports.CSSGrid =
|
|
152
|
+
exports.CSSGrid = CSSGridComponent;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { PolymorphicProps } from '../../types/common';
|
|
9
|
+
type ColumnSpanPercent = '25%' | '50%' | '75%' | '100%';
|
|
10
|
+
type ColumnSpanSimple = boolean | number | ColumnSpanPercent;
|
|
11
|
+
interface ColumnSpanObject {
|
|
12
|
+
span?: ColumnSpanSimple;
|
|
13
|
+
offset?: number;
|
|
14
|
+
start?: number;
|
|
15
|
+
end?: number;
|
|
16
|
+
}
|
|
17
|
+
export type ColumnSpan = ColumnSpanSimple | ColumnSpanObject;
|
|
18
|
+
interface ColumnBaseProps {
|
|
19
|
+
/**
|
|
20
|
+
* Pass in content that will be rendered within the `Column`
|
|
21
|
+
*/
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Specify a custom className to be applied to the `Column`
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Specify column span for the `lg` breakpoint (Default breakpoint up to 1312px)
|
|
29
|
+
* This breakpoint supports 16 columns by default.
|
|
30
|
+
*
|
|
31
|
+
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
32
|
+
*/
|
|
33
|
+
lg?: ColumnSpan;
|
|
34
|
+
/**
|
|
35
|
+
* Specify column span for the `max` breakpoint. This breakpoint supports 16
|
|
36
|
+
* columns by default.
|
|
37
|
+
*
|
|
38
|
+
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
39
|
+
*/
|
|
40
|
+
max?: ColumnSpan;
|
|
41
|
+
/**
|
|
42
|
+
* Specify column span for the `md` breakpoint (Default breakpoint up to 1056px)
|
|
43
|
+
* This breakpoint supports 8 columns by default.
|
|
44
|
+
*
|
|
45
|
+
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
46
|
+
*/
|
|
47
|
+
md?: ColumnSpan;
|
|
48
|
+
/**
|
|
49
|
+
* Specify column span for the `sm` breakpoint (Default breakpoint up to 672px)
|
|
50
|
+
* This breakpoint supports 4 columns by default.
|
|
51
|
+
*
|
|
52
|
+
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
53
|
+
*/
|
|
54
|
+
sm?: ColumnSpan;
|
|
55
|
+
/**
|
|
56
|
+
* Specify column span for the `xlg` breakpoint (Default breakpoint up to
|
|
57
|
+
* 1584px) This breakpoint supports 16 columns by default.
|
|
58
|
+
*
|
|
59
|
+
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
60
|
+
*/
|
|
61
|
+
xlg?: ColumnSpan;
|
|
62
|
+
/**
|
|
63
|
+
* Specify constant column span, start, or end values that will not change
|
|
64
|
+
* based on breakpoint
|
|
65
|
+
*/
|
|
66
|
+
span?: ColumnSpan;
|
|
67
|
+
}
|
|
68
|
+
export type ColumnProps<T extends React.ElementType> = PolymorphicProps<T, ColumnBaseProps>;
|
|
69
|
+
export interface ColumnComponent {
|
|
70
|
+
<T extends React.ElementType>(props: ColumnProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: ColumnComponent;
|
|
73
|
+
export default _default;
|
|
@@ -75,8 +75,10 @@ function Column(_ref) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
var columnClassName = getClassNameForFlexGridBreakpoints([sm, md, lg, xlg, max], prefix);
|
|
78
|
-
var className = cx__default["default"](customClassName, columnClassName, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--col"), columnClassName.length === 0));
|
|
79
|
-
|
|
78
|
+
var className = cx__default["default"](customClassName, columnClassName, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--col"), columnClassName.length === 0)); // cast as any to let TypeScript allow passing in attributes to base component
|
|
79
|
+
|
|
80
|
+
var BaseComponentAsAny = BaseComponent;
|
|
81
|
+
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
80
82
|
className: className
|
|
81
83
|
}, rest), children);
|
|
82
84
|
}
|
|
@@ -281,28 +283,30 @@ function getClassNameForBreakpoints(breakpoints, prefix) {
|
|
|
281
283
|
continue;
|
|
282
284
|
}
|
|
283
285
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
if (_rollupPluginBabelHelpers["typeof"](breakpoint) === 'object') {
|
|
287
|
+
var span = breakpoint.span,
|
|
288
|
+
offset = breakpoint.offset,
|
|
289
|
+
start = breakpoint.start,
|
|
290
|
+
end = breakpoint.end;
|
|
288
291
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
+
if (typeof offset === 'number' && offset > 0) {
|
|
293
|
+
classNames.push("".concat(prefix, "--").concat(name, ":col-start-").concat(offset + 1));
|
|
294
|
+
}
|
|
292
295
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
+
if (typeof start === 'number') {
|
|
297
|
+
classNames.push("".concat(prefix, "--").concat(name, ":col-start-").concat(start));
|
|
298
|
+
}
|
|
296
299
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
if (typeof end === 'number') {
|
|
301
|
+
classNames.push("".concat(prefix, "--").concat(name, ":col-end-").concat(end));
|
|
302
|
+
}
|
|
300
303
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
if (typeof span === 'number') {
|
|
305
|
+
classNames.push("".concat(prefix, "--").concat(name, ":col-span-").concat(span));
|
|
306
|
+
} else if (typeof span === 'string') {
|
|
307
|
+
classNames.push("".concat(prefix, "--").concat(name, ":col-span-").concat(span.slice(0, -1)));
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
306
310
|
}
|
|
307
311
|
}
|
|
308
312
|
|
|
@@ -340,19 +344,21 @@ function getClassNameForFlexGridBreakpoints(breakpoints, prefix) {
|
|
|
340
344
|
continue;
|
|
341
345
|
}
|
|
342
346
|
|
|
343
|
-
|
|
344
|
-
|
|
347
|
+
if (_rollupPluginBabelHelpers["typeof"](breakpoint) === 'object') {
|
|
348
|
+
var span = breakpoint.span,
|
|
349
|
+
offset = breakpoint.offset;
|
|
345
350
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
if (typeof span === 'number') {
|
|
352
|
+
classNames.push("".concat(prefix, "--col-").concat(name, "-").concat(span));
|
|
353
|
+
}
|
|
349
354
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
355
|
+
if (span === true) {
|
|
356
|
+
classNames.push("".concat(prefix, "--col-").concat(name));
|
|
357
|
+
}
|
|
353
358
|
|
|
354
|
-
|
|
355
|
-
|
|
359
|
+
if (typeof offset === 'number') {
|
|
360
|
+
classNames.push("".concat(prefix, "--offset-").concat(name, "-").concat(offset));
|
|
361
|
+
}
|
|
356
362
|
}
|
|
357
363
|
}
|
|
358
364
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { PolymorphicProps } from '../../types/common';
|
|
9
|
+
interface ColumnHangBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Pass in content that will be rendered within the `ColumnHang`
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify a custom className to be applied to the `ColumnHang`
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export type ColumnHangProps<T extends React.ElementType> = PolymorphicProps<T, ColumnHangBaseProps>;
|
|
20
|
+
export interface ColumnHangComponent {
|
|
21
|
+
<T extends React.ElementType>(props: ColumnHangProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
22
|
+
}
|
|
23
|
+
declare const ColumnHangComponent: ColumnHangComponent;
|
|
24
|
+
export { ColumnHangComponent as ColumnHang };
|
|
@@ -22,11 +22,11 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
|
|
24
24
|
var _excluded = ["as", "className", "children"];
|
|
25
|
+
|
|
25
26
|
/**
|
|
26
27
|
* Helper component for rendering content that hangs on the column. Useful when
|
|
27
28
|
* trying to align content across different grid modes
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
30
|
function ColumnHang(_ref) {
|
|
31
31
|
var _ref$as = _ref.as,
|
|
32
32
|
BaseComponent = _ref$as === void 0 ? 'div' : _ref$as,
|
|
@@ -35,8 +35,10 @@ function ColumnHang(_ref) {
|
|
|
35
35
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
36
36
|
|
|
37
37
|
var prefix = usePrefix.usePrefix();
|
|
38
|
-
var className = cx__default["default"](customClassName, "".concat(prefix, "--grid-column-hang"));
|
|
39
|
-
|
|
38
|
+
var className = cx__default["default"](customClassName, "".concat(prefix, "--grid-column-hang")); // cast as any to let TypeScript allow passing in attributes to base component
|
|
39
|
+
|
|
40
|
+
var BaseComponentAsAny = BaseComponent;
|
|
41
|
+
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
40
42
|
className: className
|
|
41
43
|
}), children);
|
|
42
44
|
}
|
|
@@ -57,5 +59,6 @@ ColumnHang.propTypes = {
|
|
|
57
59
|
*/
|
|
58
60
|
className: PropTypes__default["default"].string
|
|
59
61
|
};
|
|
62
|
+
var ColumnHangComponent = ColumnHang;
|
|
60
63
|
|
|
61
|
-
exports.ColumnHang =
|
|
64
|
+
exports.ColumnHang = ColumnHangComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { GridComponent } from './GridTypes';
|
|
8
|
+
declare const FlexGridComponent: GridComponent;
|
|
9
|
+
export { FlexGridComponent as FlexGrid };
|
|
@@ -40,11 +40,13 @@ function FlexGrid(_ref) {
|
|
|
40
40
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
41
41
|
|
|
42
42
|
var prefix = usePrefix.usePrefix();
|
|
43
|
-
var className = cx__default["default"](containerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--condensed"), condensed), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--narrow"), narrow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--full-width"), fullWidth), _cx));
|
|
43
|
+
var className = cx__default["default"](containerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--condensed"), condensed), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--narrow"), narrow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--grid--full-width"), fullWidth), _cx)); // cast as any to let TypeScript allow passing in attributes to base component
|
|
44
|
+
|
|
45
|
+
var BaseComponentAsAny = BaseComponent;
|
|
44
46
|
return /*#__PURE__*/React__default["default"].createElement(GridContext.GridSettings, {
|
|
45
47
|
mode: "flexbox",
|
|
46
48
|
subgrid: false
|
|
47
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
49
|
+
}, /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
48
50
|
className: className
|
|
49
51
|
}, rest), children));
|
|
50
52
|
}
|
|
@@ -82,5 +84,6 @@ FlexGrid.propTypes = {
|
|
|
82
84
|
*/
|
|
83
85
|
narrow: PropTypes__default["default"].bool
|
|
84
86
|
};
|
|
87
|
+
var FlexGridComponent = FlexGrid;
|
|
85
88
|
|
|
86
|
-
exports.FlexGrid =
|
|
89
|
+
exports.FlexGrid = FlexGridComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { GridComponent } from './GridTypes';
|
|
8
|
+
declare const GridAsGridComponent: GridComponent;
|
|
9
|
+
export { GridAsGridComponent as Grid };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
export type GridMode = 'flexbox' | 'css-grid';
|
|
9
|
+
export interface GridSettingContext {
|
|
10
|
+
/**
|
|
11
|
+
* The grid mode for the GridContext
|
|
12
|
+
*/
|
|
13
|
+
mode: GridMode;
|
|
14
|
+
/**
|
|
15
|
+
* Specifies whether subgrid should be enabled
|
|
16
|
+
*/
|
|
17
|
+
subgrid?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface GridSettingsProps {
|
|
20
|
+
/**
|
|
21
|
+
* Pass in components which will be rendered within the `GridSettings`
|
|
22
|
+
* component
|
|
23
|
+
*/
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Specify the grid mode for the GridContext
|
|
27
|
+
*/
|
|
28
|
+
mode: GridMode;
|
|
29
|
+
/**
|
|
30
|
+
* Specify whether subgrid should be enabled
|
|
31
|
+
*/
|
|
32
|
+
subgrid?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const GridSettings: React.FC<GridSettingsProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Helper function for accessing the GridContext value
|
|
37
|
+
*/
|
|
38
|
+
export declare const useGridSettings: () => GridSettingContext;
|
|
@@ -39,12 +39,11 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
39
39
|
* Provides a grid context for communication the grid "mode" (flexbox or
|
|
40
40
|
* css-grid) along with subgrid information.
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
42
|
var GridSettingsContext = /*#__PURE__*/React__namespace.createContext({
|
|
44
43
|
mode: 'flexbox',
|
|
45
44
|
subgrid: false
|
|
46
45
|
});
|
|
47
|
-
function GridSettings(_ref) {
|
|
46
|
+
var GridSettings = function GridSettings(_ref) {
|
|
48
47
|
var children = _ref.children,
|
|
49
48
|
mode = _ref.mode,
|
|
50
49
|
_ref$subgrid = _ref.subgrid,
|
|
@@ -58,7 +57,8 @@ function GridSettings(_ref) {
|
|
|
58
57
|
return /*#__PURE__*/React__namespace.createElement(GridSettingsContext.Provider, {
|
|
59
58
|
value: value
|
|
60
59
|
}, children);
|
|
61
|
-
}
|
|
60
|
+
};
|
|
61
|
+
var gridModes = ['flexbox', 'css-grid'];
|
|
62
62
|
GridSettings.propTypes = {
|
|
63
63
|
/**
|
|
64
64
|
* Pass in components which will be rendered within the `GridSettings`
|
|
@@ -69,7 +69,7 @@ GridSettings.propTypes = {
|
|
|
69
69
|
/**
|
|
70
70
|
* Specify the grid mode for the GridContext
|
|
71
71
|
*/
|
|
72
|
-
mode: PropTypes__default["default"].oneOf(
|
|
72
|
+
mode: PropTypes__default["default"].oneOf(gridModes).isRequired,
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Specify whether subgrid should be enabled
|
|
@@ -80,9 +80,9 @@ GridSettings.propTypes = {
|
|
|
80
80
|
* Helper function for accessing the GridContext value
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
|
-
function useGridSettings() {
|
|
83
|
+
var useGridSettings = function useGridSettings() {
|
|
84
84
|
return React__namespace.useContext(GridSettingsContext);
|
|
85
|
-
}
|
|
85
|
+
};
|
|
86
86
|
|
|
87
87
|
exports.GridSettings = GridSettings;
|
|
88
88
|
exports.useGridSettings = useGridSettings;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
import { PolymorphicProps } from '../../types/common';
|
|
9
|
+
interface GridBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Pass in content that will be rendered within the `Grid`
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify a custom className to be applied to the `Grid`
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Collapse the gutter to 1px. Useful for fluid layouts.
|
|
20
|
+
* Rows have 1px of margin between them to match gutter.
|
|
21
|
+
*/
|
|
22
|
+
condensed?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Remove the default max width that the grid has set
|
|
25
|
+
*/
|
|
26
|
+
fullWidth?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Container hangs 16px into the gutter. Useful for
|
|
29
|
+
* typographic alignment with and without containers.
|
|
30
|
+
*/
|
|
31
|
+
narrow?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type GridProps<T extends React.ElementType> = PolymorphicProps<T, GridBaseProps>;
|
|
34
|
+
export interface GridComponent {
|
|
35
|
+
<T extends React.ElementType>(props: GridProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { PolymorphicProps } from '../../types/common';
|
|
9
|
+
export interface RowBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Pass in content that will be rendered within the `Row`
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify a custom className to be applied to the `Row`
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify a single row as condensed.Rows that are adjacent
|
|
20
|
+
* and are condensed will have 2px of margin between them to match gutter.
|
|
21
|
+
*/
|
|
22
|
+
condensed?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify a single row as narrow. The container will hang
|
|
25
|
+
* 16px into the gutter.
|
|
26
|
+
*/
|
|
27
|
+
narrow?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type RowProps<T extends React.ElementType> = PolymorphicProps<T, RowBaseProps>;
|
|
30
|
+
export interface RowComponent {
|
|
31
|
+
<T extends React.ElementType>(props: RowProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
32
|
+
}
|
|
33
|
+
declare const _default: RowComponent;
|
|
34
|
+
export default _default;
|
|
@@ -37,8 +37,10 @@ function Row(_ref) {
|
|
|
37
37
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
38
38
|
|
|
39
39
|
var prefix = usePrefix.usePrefix();
|
|
40
|
-
var className = cx__default["default"](containerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row--condensed"), condensed), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row--narrow"), narrow), _cx));
|
|
41
|
-
|
|
40
|
+
var className = cx__default["default"](containerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row--condensed"), condensed), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--row--narrow"), narrow), _cx)); // TypeScript type validation reports conflicts on different instances of keyof JSX.IntrinsicElements
|
|
41
|
+
|
|
42
|
+
var BaseComponentAsAny = BaseComponent;
|
|
43
|
+
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
42
44
|
className: className
|
|
43
45
|
}, rest), children);
|
|
44
46
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export { FlexGrid } from './FlexGrid';
|
|
8
|
+
export { Grid } from './Grid';
|
|
9
|
+
export { default as Row } from './Row';
|
|
10
|
+
export { default as Column } from './Column';
|
|
11
|
+
export { ColumnHang } from './ColumnHang';
|
|
@@ -18,18 +18,20 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
18
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
20
|
|
|
21
|
-
var _excluded = ["as", "children"];
|
|
21
|
+
var _excluded = ["as", "level", "children"];
|
|
22
22
|
var HeadingContext = /*#__PURE__*/React__default["default"].createContext(1);
|
|
23
23
|
|
|
24
24
|
function Section(_ref) {
|
|
25
25
|
var _ref$as = _ref.as,
|
|
26
26
|
BaseComponent = _ref$as === void 0 ? 'section' : _ref$as,
|
|
27
|
+
levelOverride = _ref.level,
|
|
27
28
|
children = _ref.children,
|
|
28
29
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
29
30
|
|
|
30
|
-
var
|
|
31
|
+
var parentLevel = React__default["default"].useContext(HeadingContext);
|
|
32
|
+
var level = typeof levelOverride !== 'undefined' ? levelOverride : parentLevel + 1;
|
|
31
33
|
return /*#__PURE__*/React__default["default"].createElement(HeadingContext.Provider, {
|
|
32
|
-
value: Math.min(level
|
|
34
|
+
value: Math.min(level, 6)
|
|
33
35
|
}, /*#__PURE__*/React__default["default"].createElement(BaseComponent, rest, children));
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -48,7 +50,12 @@ Section.propTypes = {
|
|
|
48
50
|
/**
|
|
49
51
|
* Specify a class name for the outermost node of the component
|
|
50
52
|
*/
|
|
51
|
-
className: PropTypes__default["default"].string
|
|
53
|
+
className: PropTypes__default["default"].string,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Overrides the level of the section
|
|
57
|
+
*/
|
|
58
|
+
level: PropTypes__default["default"].number
|
|
52
59
|
};
|
|
53
60
|
|
|
54
61
|
function Heading(props) {
|