@carbon/react 1.31.2 → 1.32.0-rc.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 +1 -1
- package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/es/components/Accordion/Accordion.Skeleton.js +3 -3
- package/es/components/Accordion/Accordion.d.ts +65 -0
- package/es/components/Accordion/Accordion.js +5 -6
- package/es/components/Accordion/AccordionItem.d.ts +105 -0
- package/es/components/Accordion/AccordionItem.js +12 -9
- package/es/components/Accordion/AccordionProvider.d.ts +20 -0
- package/es/components/Accordion/AccordionProvider.js +25 -0
- package/es/components/Accordion/index.d.ts +11 -0
- package/es/components/Button/Button.Skeleton.d.ts +28 -0
- package/es/components/Button/Button.Skeleton.js +5 -3
- package/es/components/Button/Button.d.ts +72 -0
- package/es/components/Button/Button.js +13 -10
- package/es/components/Button/index.d.ts +11 -0
- package/es/components/Button/index.js +2 -1
- package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/es/components/ButtonSet/ButtonSet.js +1 -2
- package/es/components/ButtonSet/index.d.ts +9 -0
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/es/components/ComposedModal/ComposedModal.js +58 -67
- package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/es/components/ComposedModal/ModalFooter.js +22 -19
- package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/es/components/ComposedModal/ModalHeader.js +8 -25
- package/es/components/ComposedModal/index.d.ts +9 -0
- package/es/components/ContainedList/ContainedList.js +12 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/es/components/DangerButton/DangerButton.d.ts +9 -0
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DangerButton/index.d.ts +9 -0
- package/es/components/DataTable/TableBatchAction.js +1 -0
- package/es/components/DataTable/TableBatchActions.js +1 -0
- package/es/components/DataTable/TableBody.d.ts +29 -0
- package/es/components/DataTable/TableBody.js +2 -3
- package/es/components/DataTable/TableContainer.d.ts +51 -0
- package/es/components/DataTable/TableContainer.js +3 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/es/components/DataTable/TableExpandHeader.js +4 -5
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/es/components/Dropdown/Dropdown.js +1 -0
- package/es/components/FluidTextInput/FluidTextInput.js +1 -0
- package/es/components/FormGroup/FormGroup.d.ts +80 -0
- package/es/components/IconButton/index.js +3 -2
- package/es/components/Layout/index.d.ts +74 -0
- package/es/components/Layout/index.js +14 -5
- package/es/components/Link/Link.d.ts +2 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/MenuButton/index.js +1 -0
- package/es/components/Modal/Modal.js +1 -0
- package/es/components/ModalWrapper/ModalWrapper.js +1 -0
- package/es/components/Notification/Notification.d.ts +531 -0
- package/es/components/Notification/Notification.js +40 -6
- package/es/components/Notification/index.d.ts +7 -0
- package/es/components/PrimaryButton/PrimaryButton.js +1 -0
- package/es/components/SecondaryButton/SecondaryButton.js +1 -0
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/es/components/SkeletonText/SkeletonText.js +15 -17
- package/es/components/SkeletonText/index.d.ts +9 -0
- package/es/components/Switch/Switch.d.ts +56 -0
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/Tab/index.d.ts +9 -0
- package/es/components/TabContent/TabContent.d.ts +40 -0
- package/es/components/TabContent/TabContent.js +6 -12
- package/es/components/TabContent/index.d.ts +10 -0
- package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/es/components/Tabs/Tabs.Skeleton.js +2 -2
- package/es/components/Tabs/Tabs.d.ts +303 -0
- package/es/components/Tabs/Tabs.js +136 -95
- package/es/components/Tabs/index.d.ts +10 -0
- package/es/components/Tabs/usePressable.js +11 -0
- package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/es/components/TextInput/ControlledPasswordInput.js +5 -6
- package/es/components/Tile/Tile.d.ts +153 -0
- package/es/components/Tile/Tile.js +62 -74
- package/es/components/Tile/index.d.ts +7 -0
- package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/es/components/Toggle/Toggle.Skeleton.js +24 -64
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/UIShell/HeaderGlobalAction.js +1 -0
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/index.js +16 -16
- package/es/internal/keyboard/match.js +2 -2
- package/es/internal/useControllableState.js +2 -2
- package/es/internal/wrapFocus.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/es/prop-types/types.js +3 -0
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
- package/lib/components/Accordion/Accordion.d.ts +65 -0
- package/lib/components/Accordion/Accordion.js +5 -6
- package/lib/components/Accordion/AccordionItem.d.ts +105 -0
- package/lib/components/Accordion/AccordionItem.js +11 -8
- package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
- package/lib/components/Accordion/AccordionProvider.js +34 -0
- package/lib/components/Accordion/index.d.ts +11 -0
- package/lib/components/Button/Button.Skeleton.d.ts +28 -0
- package/lib/components/Button/Button.Skeleton.js +5 -3
- package/lib/components/Button/Button.d.ts +72 -0
- package/lib/components/Button/Button.js +18 -11
- package/lib/components/Button/index.d.ts +11 -0
- package/lib/components/Button/index.js +6 -0
- package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/lib/components/ButtonSet/ButtonSet.js +1 -2
- package/lib/components/ButtonSet/index.d.ts +9 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/lib/components/ComposedModal/ComposedModal.js +58 -67
- package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/lib/components/ComposedModal/ModalFooter.js +22 -19
- package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/lib/components/ComposedModal/ModalHeader.js +8 -25
- package/lib/components/ComposedModal/index.d.ts +9 -0
- package/lib/components/ContainedList/ContainedList.js +12 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/lib/components/DangerButton/DangerButton.d.ts +9 -0
- package/lib/components/DangerButton/DangerButton.js +2 -2
- package/lib/components/DangerButton/index.d.ts +9 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -0
- package/lib/components/DataTable/TableBatchActions.js +1 -0
- package/lib/components/DataTable/TableBody.d.ts +29 -0
- package/lib/components/DataTable/TableBody.js +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +51 -0
- package/lib/components/DataTable/TableContainer.js +3 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/lib/components/DataTable/TableExpandHeader.js +4 -5
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
- package/lib/components/FormGroup/FormGroup.d.ts +80 -0
- package/lib/components/IconButton/index.js +3 -2
- package/lib/components/Layout/index.d.ts +74 -0
- package/lib/components/Layout/index.js +14 -5
- package/lib/components/Link/Link.d.ts +2 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/MenuButton/index.js +1 -0
- package/lib/components/Modal/Modal.js +1 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
- package/lib/components/Notification/Notification.d.ts +531 -0
- package/lib/components/Notification/Notification.js +40 -6
- package/lib/components/Notification/index.d.ts +7 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/lib/components/SkeletonText/SkeletonText.js +15 -17
- package/lib/components/SkeletonText/index.d.ts +9 -0
- package/lib/components/Switch/Switch.d.ts +56 -0
- package/lib/components/Switch/Switch.js +4 -4
- package/lib/components/Tab/index.d.ts +9 -0
- package/lib/components/TabContent/TabContent.d.ts +40 -0
- package/lib/components/TabContent/TabContent.js +6 -12
- package/lib/components/TabContent/index.d.ts +10 -0
- package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
- package/lib/components/Tabs/Tabs.d.ts +303 -0
- package/lib/components/Tabs/Tabs.js +135 -94
- package/lib/components/Tabs/index.d.ts +10 -0
- package/lib/components/Tabs/usePressable.js +11 -0
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
- package/lib/components/Tile/Tile.d.ts +153 -0
- package/lib/components/Tile/Tile.js +62 -74
- package/lib/components/Tile/index.d.ts +7 -0
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/index.js +51 -47
- package/lib/internal/keyboard/match.js +2 -2
- package/lib/internal/useControllableState.js +2 -2
- package/lib/internal/wrapFocus.js +6 -6
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/prop-types/types.js +3 -0
- package/package.json +4 -3
- package/scss/components/contained-list/_contained-list.scss +9 -0
- package/scss/components/contained-list/_index.scss +9 -0
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var iconsReact = require('@carbon/icons-react');
|
|
13
14
|
var cx = require('classnames');
|
|
14
15
|
var PropTypes = require('prop-types');
|
|
15
|
-
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
16
|
-
var deprecate = require('../../prop-types/deprecate.js');
|
|
17
16
|
var React = require('react');
|
|
18
|
-
var iconsReact = require('@carbon/icons-react');
|
|
19
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
19
|
+
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -90,6 +90,5 @@ TableExpandHeader.propTypes = {
|
|
|
90
90
|
*/
|
|
91
91
|
onExpand: PropTypes__default["default"].oneOfType([requiredIfGivenPropIsTruthy["default"]('enableExpando', PropTypes__default["default"].func), requiredIfGivenPropIsTruthy["default"]('enableToggle', PropTypes__default["default"].func)])
|
|
92
92
|
};
|
|
93
|
-
var TableExpandHeader$1 = TableExpandHeader;
|
|
94
93
|
|
|
95
|
-
exports["default"] = TableExpandHeader
|
|
94
|
+
exports["default"] = TableExpandHeader;
|
|
@@ -17,14 +17,15 @@ var keys = require('../../../internal/keyboard/keys.js');
|
|
|
17
17
|
* @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
|
|
18
18
|
*/
|
|
19
19
|
var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
20
|
+
const {
|
|
21
|
+
inputFrom,
|
|
22
|
+
inputTo,
|
|
23
|
+
lastStartValue
|
|
24
|
+
} = config;
|
|
20
25
|
/**
|
|
21
26
|
* Handles `keydown` event.
|
|
22
27
|
*/
|
|
23
28
|
const handleKeydown = event => {
|
|
24
|
-
const {
|
|
25
|
-
inputFrom,
|
|
26
|
-
inputTo
|
|
27
|
-
} = config;
|
|
28
29
|
const {
|
|
29
30
|
target
|
|
30
31
|
} = event;
|
|
@@ -45,6 +46,7 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
};
|
|
49
|
+
const parseDateWithFormat = dateStr => fp.parseDate(dateStr, fp.config.dateFormat);
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Handles `blur` event.
|
|
@@ -54,11 +56,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
54
56
|
* set the date again, triggering the calendar to update.
|
|
55
57
|
*/
|
|
56
58
|
const handleBlur = event => {
|
|
57
|
-
const {
|
|
58
|
-
inputFrom,
|
|
59
|
-
inputTo,
|
|
60
|
-
lastStartValue
|
|
61
|
-
} = config;
|
|
62
59
|
const {
|
|
63
60
|
target
|
|
64
61
|
} = event;
|
|
@@ -68,8 +65,9 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
68
65
|
if (inputTo === target && fp.selectedDates[1]) {
|
|
69
66
|
// Using getTime() enables the ability to more readily compare the date currently
|
|
70
67
|
// selected in the calendar and the date currently in the value of the input
|
|
71
|
-
const
|
|
72
|
-
const
|
|
68
|
+
const withoutTime = date => date.setHours(0, 0, 0, 0);
|
|
69
|
+
const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
|
|
70
|
+
const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
|
|
73
71
|
|
|
74
72
|
// The date should only be set if both dates are valid dates, and they don't match.
|
|
75
73
|
// When they don't match, this indiciates that the date selected in the calendar is stale,
|
|
@@ -79,19 +77,17 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
79
77
|
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
|
|
80
|
+
const isValidDate = date => date.toString() !== 'Invalid Date';
|
|
83
81
|
// save end date in calendar inmediately after it's been written down
|
|
84
82
|
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
85
|
-
|
|
86
|
-
if (currentEndDate.toString() !== 'Invalid Date') {
|
|
83
|
+
if (isValidDate(parseDateWithFormat(inputTo.value))) {
|
|
87
84
|
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
// overriding the flatpickr bug where the startDate gets deleted on blur
|
|
92
89
|
if (inputTo === target && !inputFrom.value && lastStartValue.current) {
|
|
93
|
-
|
|
94
|
-
if (currentStartDate.toString() !== 'Invalid Date') {
|
|
90
|
+
if (isValidDate(parseDateWithFormat(lastStartValue.current))) {
|
|
95
91
|
inputFrom.value = lastStartValue.current;
|
|
96
92
|
if (inputTo.value) {
|
|
97
93
|
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
@@ -227,6 +227,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
227
227
|
,
|
|
228
228
|
role: "combobox" // eslint-disable-line jsx-a11y/role-has-required-aria-props
|
|
229
229
|
,
|
|
230
|
+
"aria-owns": getMenuProps().id,
|
|
230
231
|
"aria-controls": getMenuProps().id,
|
|
231
232
|
className: `${prefix}--list-box__field`,
|
|
232
233
|
disabled: disabled,
|
|
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
require('../TextInput/index.js');
|
|
17
|
+
require('../TextInput/ControlledPasswordInput.js');
|
|
17
18
|
var PasswordInput = require('../TextInput/PasswordInput.js');
|
|
18
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
20
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
@@ -0,0 +1,80 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { ReactAttr } from '../../types/common';
|
|
10
|
+
export interface FormGroupProps extends ReactAttr<HTMLFieldSetElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Provide the children form elements to be rendered inside of the <fieldset>
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Provide a custom className to be applied to the containing <fieldset> node
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify whether the <FormGroup> is invalid
|
|
21
|
+
*/
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Provide id for the fieldset <legend> which corresponds to the fieldset
|
|
25
|
+
* `aria-labelledby`
|
|
26
|
+
*/
|
|
27
|
+
legendId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Provide the text to be rendered inside of the fieldset <legend>
|
|
30
|
+
*/
|
|
31
|
+
legendText: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether the message should be displayed in the <FormGroup>
|
|
34
|
+
*/
|
|
35
|
+
message?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Provide the text for the message in the <FormGroup>
|
|
38
|
+
*/
|
|
39
|
+
messageText?: string;
|
|
40
|
+
}
|
|
41
|
+
declare const FormGroup: {
|
|
42
|
+
({ legendId, legendText, invalid, children, className, message, messageText, ...rest }: FormGroupProps): JSX.Element;
|
|
43
|
+
propTypes: {
|
|
44
|
+
/**
|
|
45
|
+
* Provide the children form elements to be rendered inside of the <fieldset>
|
|
46
|
+
*/
|
|
47
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
48
|
+
/**
|
|
49
|
+
* Provide a custom className to be applied to the containing <fieldset> node
|
|
50
|
+
*/
|
|
51
|
+
className: PropTypes.Requireable<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Specify whether the <FormGroup> is invalid
|
|
54
|
+
*/
|
|
55
|
+
invalid: PropTypes.Requireable<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Provide id for the fieldset <legend> which corresponds to the fieldset
|
|
58
|
+
* `aria-labelledby`
|
|
59
|
+
*/
|
|
60
|
+
legendId: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
61
|
+
/**
|
|
62
|
+
* Provide the text to be rendered inside of the fieldset <legend>
|
|
63
|
+
*/
|
|
64
|
+
legendText: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
65
|
+
/**
|
|
66
|
+
* Specify whether the message should be displayed in the <FormGroup>
|
|
67
|
+
*/
|
|
68
|
+
message: PropTypes.Requireable<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Provide the text for the message in the <FormGroup>
|
|
71
|
+
*/
|
|
72
|
+
messageText: PropTypes.Requireable<string>;
|
|
73
|
+
};
|
|
74
|
+
defaultProps: {
|
|
75
|
+
invalid: boolean;
|
|
76
|
+
message: boolean;
|
|
77
|
+
messageText: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export default FormGroup;
|
|
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var Button = require('../Button/Button.js');
|
|
16
|
+
require('../Button/Button.Skeleton.js');
|
|
16
17
|
var cx = require('classnames');
|
|
17
18
|
require('../Tooltip/DefinitionTooltip.js');
|
|
18
19
|
var Tooltip = require('../Tooltip/Tooltip.js');
|
|
@@ -32,10 +33,10 @@ const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function Ic
|
|
|
32
33
|
closeOnActivation = true,
|
|
33
34
|
defaultOpen = false,
|
|
34
35
|
disabled,
|
|
35
|
-
enterDelayMs,
|
|
36
|
+
enterDelayMs = 100,
|
|
36
37
|
kind,
|
|
37
38
|
label,
|
|
38
|
-
leaveDelayMs,
|
|
39
|
+
leaveDelayMs = 100,
|
|
39
40
|
wrapperClasses,
|
|
40
41
|
size,
|
|
41
42
|
...rest
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
import React, { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Density of components within this layout
|
|
10
|
+
*/
|
|
11
|
+
type Density = 'condensed' | 'normal';
|
|
12
|
+
/**
|
|
13
|
+
* Size of components within this layout
|
|
14
|
+
*/
|
|
15
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
16
|
+
export interface LayoutProps extends HTMLAttributes<HTMLElement> {
|
|
17
|
+
/**
|
|
18
|
+
* Specify a custom component or element to be rendered as the top-level
|
|
19
|
+
* element in the component
|
|
20
|
+
*/
|
|
21
|
+
as?: (() => ReactNode) | string | ElementType;
|
|
22
|
+
/**
|
|
23
|
+
* Provide child elements to be rendered inside of `Layout`
|
|
24
|
+
*/
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Provide a custom class name to be used on the outermost element rendered by
|
|
28
|
+
* the component
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Specify the desired density of components within this layout
|
|
33
|
+
*/
|
|
34
|
+
density?: Density;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the desired size of components within this layout
|
|
37
|
+
*/
|
|
38
|
+
size?: Size;
|
|
39
|
+
}
|
|
40
|
+
declare const Layout: React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<React.ReactNode>>;
|
|
41
|
+
export interface LayoutConstraintProps extends HTMLAttributes<HTMLElement> {
|
|
42
|
+
/**
|
|
43
|
+
* Specify a custom component or element to be rendered as the top-level
|
|
44
|
+
* element in the component
|
|
45
|
+
*/
|
|
46
|
+
as?: (() => ReactNode) | string | ElementType;
|
|
47
|
+
/**
|
|
48
|
+
* Provide child elements to be rendered inside of `LayoutConstraint`
|
|
49
|
+
*/
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Provide a custom class name to be used on the outermost element rendered by
|
|
53
|
+
* the component
|
|
54
|
+
*/
|
|
55
|
+
className?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Specify the desired layout density constraints of this element's children
|
|
58
|
+
*/
|
|
59
|
+
density?: {
|
|
60
|
+
min?: Density | null;
|
|
61
|
+
default?: Density | null;
|
|
62
|
+
max?: Density | null;
|
|
63
|
+
} | null;
|
|
64
|
+
/**
|
|
65
|
+
* Specify the desired layout size constraints of this element's children
|
|
66
|
+
*/
|
|
67
|
+
size?: {
|
|
68
|
+
min?: Size | null;
|
|
69
|
+
default?: Size | null;
|
|
70
|
+
max?: Size | null;
|
|
71
|
+
} | null;
|
|
72
|
+
}
|
|
73
|
+
declare const LayoutConstraint: React.ForwardRefExoticComponent<LayoutConstraintProps & React.RefAttributes<React.ReactNode>>;
|
|
74
|
+
export { Layout, LayoutConstraint };
|
|
@@ -23,6 +23,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
|
|
24
24
|
const sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
|
|
25
25
|
const densities = ['condensed', 'normal'];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Density of components within this layout
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Size of components within this layout
|
|
33
|
+
*/
|
|
34
|
+
|
|
26
35
|
const Layout = /*#__PURE__*/React__default["default"].forwardRef(function Layout(_ref, forwardRef) {
|
|
27
36
|
let {
|
|
28
37
|
as: BaseComponent = 'div',
|
|
@@ -34,8 +43,8 @@ const Layout = /*#__PURE__*/React__default["default"].forwardRef(function Layout
|
|
|
34
43
|
} = _ref;
|
|
35
44
|
const prefix = usePrefix.usePrefix();
|
|
36
45
|
const classes = cx__default["default"](className, `${prefix}--layout`, {
|
|
37
|
-
[`${prefix}--layout--size-${size}`]: sizes.includes(size),
|
|
38
|
-
[`${prefix}--layout--density-${density}`]: densities.includes(density)
|
|
46
|
+
[`${prefix}--layout--size-${size}`]: size && sizes.includes(size),
|
|
47
|
+
[`${prefix}--layout--density-${density}`]: density && densities.includes(density)
|
|
39
48
|
});
|
|
40
49
|
return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
41
50
|
ref: forwardRef,
|
|
@@ -82,9 +91,9 @@ const LayoutConstraint = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
|
82
91
|
}).map(_ref3 => {
|
|
83
92
|
let [group, constraints] = _ref3;
|
|
84
93
|
return {
|
|
85
|
-
[`${prefix}--layout-constraint--${group}
|
|
86
|
-
[`${prefix}--layout-constraint--${group}
|
|
87
|
-
[`${prefix}--layout-constraint--${group}
|
|
94
|
+
[`${prefix}--layout-constraint--${group}__default-${constraints?.default}`]: constraints?.default,
|
|
95
|
+
[`${prefix}--layout-constraint--${group}__min-${constraints?.min}`]: constraints?.min,
|
|
96
|
+
[`${prefix}--layout-constraint--${group}__max-${constraints?.max}`]: constraints?.max
|
|
88
97
|
};
|
|
89
98
|
}));
|
|
90
99
|
return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
|
|
8
|
-
interface LinkProps {
|
|
7
|
+
import React, { AnchorHTMLAttributes, AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
|
|
8
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
9
9
|
/**
|
|
10
10
|
* @description Indicates the element that represents the
|
|
11
11
|
* current item within a container or set of related
|
|
@@ -15,6 +15,7 @@ var PropTypes = require('prop-types');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var Button = require('../Button/Button.js');
|
|
18
|
+
require('../Button/Button.Skeleton.js');
|
|
18
19
|
var Menu = require('../Menu/Menu.js');
|
|
19
20
|
var useAttachedMenu = require('../../internal/useAttachedMenu.js');
|
|
20
21
|
var useId = require('../../internal/useId.js');
|
|
@@ -16,6 +16,7 @@ var cx = require('classnames');
|
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var toggleClass = require('../../tools/toggleClass.js');
|
|
18
18
|
var Button = require('../Button/Button.js');
|
|
19
|
+
require('../Button/Button.Skeleton.js');
|
|
19
20
|
var ButtonSet = require('../ButtonSet/ButtonSet.js');
|
|
20
21
|
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
21
22
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var Modal = require('../Modal/Modal.js');
|
|
16
16
|
var Button = require('../Button/Button.js');
|
|
17
|
+
require('../Button/Button.Skeleton.js');
|
|
17
18
|
var types = require('../../prop-types/types.js');
|
|
18
19
|
var warning = require('../../internal/warning.js');
|
|
19
20
|
|