@carbon/ibm-products 2.39.0 → 2.40.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/css/index-full-carbon.css +9 -3
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +5 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +9 -3
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +9 -3
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.d.ts +44 -2
- package/es/components/AddSelect/AddSelect.js +8 -4
- package/es/components/AddSelect/AddSelectBody.d.ts +44 -2
- package/es/components/AddSelect/AddSelectBody.js +10 -12
- package/es/components/AddSelect/AddSelectSort.d.ts +16 -17
- package/es/components/AddSelect/AddSelectSort.js +5 -5
- package/es/components/AddSelect/types/index.d.ts +44 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
- package/es/components/Card/Card.js +1 -1
- package/es/components/CreateInfluencer/CreateInfluencer.js +1 -1
- package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +4 -3
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -0
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
- package/es/components/Guidebanner/Guidebanner.d.ts +62 -2
- package/es/components/Guidebanner/Guidebanner.js +8 -7
- package/es/components/Guidebanner/GuidebannerElement.d.ts +30 -17
- package/es/components/Guidebanner/GuidebannerElement.js +4 -4
- package/es/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
- package/es/components/Guidebanner/GuidebannerElementButton.js +10 -4
- package/es/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
- package/es/components/Guidebanner/GuidebannerElementLink.js +3 -3
- package/es/components/InterstitialScreen/InterstitialScreen.js +3 -1
- package/es/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
- package/es/components/MultiAddSelect/MultiAddSelect.js +2 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +0 -1
- package/es/components/PageHeader/PageHeader.d.ts +298 -5
- package/es/components/PageHeader/PageHeader.js +98 -47
- package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/es/components/PageHeader/PageHeaderUtils.js +4 -1
- package/es/components/SidePanel/SidePanel.d.ts +6 -2
- package/es/components/SidePanel/SidePanel.js +17 -2
- package/es/components/SidePanel/constants.d.ts +1 -0
- package/es/components/SidePanel/constants.js +1 -0
- package/es/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
- package/es/components/SingleAddSelect/SingleAddSelect.js +2 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +132 -6
- package/es/components/Tearsheet/Tearsheet.js +25 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +5 -1
- package/es/components/Tearsheet/TearsheetShell.js +26 -4
- package/es/components/WebTerminal/WebTerminal.d.ts +4 -0
- package/es/components/WebTerminal/WebTerminal.js +11 -3
- package/es/global/js/hooks/useFocus.d.ts +3 -1
- package/es/global/js/hooks/useFocus.js +6 -3
- package/es/global/js/hooks/useRetrieveStepData.d.ts +1 -1
- package/es/global/js/hooks/useRetrieveStepData.js +1 -1
- package/lib/components/AddSelect/AddSelect.d.ts +44 -2
- package/lib/components/AddSelect/AddSelect.js +7 -3
- package/lib/components/AddSelect/AddSelectBody.d.ts +44 -2
- package/lib/components/AddSelect/AddSelectBody.js +10 -12
- package/lib/components/AddSelect/AddSelectSort.d.ts +16 -17
- package/lib/components/AddSelect/AddSelectSort.js +5 -5
- package/lib/components/AddSelect/types/index.d.ts +44 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +5 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +12 -6
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/CreateInfluencer/CreateInfluencer.js +1 -1
- package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +95 -2
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +7 -5
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +4 -3
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -0
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +2 -1
- package/lib/components/Guidebanner/Guidebanner.d.ts +62 -2
- package/lib/components/Guidebanner/Guidebanner.js +8 -7
- package/lib/components/Guidebanner/GuidebannerElement.d.ts +30 -17
- package/lib/components/Guidebanner/GuidebannerElement.js +4 -4
- package/lib/components/Guidebanner/GuidebannerElementButton.d.ts +29 -15
- package/lib/components/Guidebanner/GuidebannerElementButton.js +10 -4
- package/lib/components/Guidebanner/GuidebannerElementLink.d.ts +20 -13
- package/lib/components/Guidebanner/GuidebannerElementLink.js +3 -3
- package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -1
- package/lib/components/MultiAddSelect/MultiAddSelect.d.ts +134 -2
- package/lib/components/MultiAddSelect/MultiAddSelect.js +2 -1
- package/lib/components/NotificationsPanel/NotificationsPanel.js +0 -1
- package/lib/components/PageHeader/PageHeader.d.ts +298 -5
- package/lib/components/PageHeader/PageHeader.js +98 -47
- package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/lib/components/PageHeader/PageHeaderUtils.js +4 -1
- package/lib/components/SidePanel/SidePanel.d.ts +6 -2
- package/lib/components/SidePanel/SidePanel.js +17 -2
- package/lib/components/SidePanel/constants.d.ts +1 -0
- package/lib/components/SidePanel/constants.js +1 -0
- package/lib/components/SingleAddSelect/SingleAddSelect.d.ts +69 -2
- package/lib/components/SingleAddSelect/SingleAddSelect.js +2 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +132 -6
- package/lib/components/Tearsheet/Tearsheet.js +25 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +5 -1
- package/lib/components/Tearsheet/TearsheetShell.js +26 -4
- package/lib/components/WebTerminal/WebTerminal.d.ts +4 -0
- package/lib/components/WebTerminal/WebTerminal.js +11 -3
- package/lib/global/js/hooks/useFocus.d.ts +3 -1
- package/lib/global/js/hooks/useFocus.js +6 -3
- package/lib/global/js/hooks/useRetrieveStepData.d.ts +1 -1
- package/lib/global/js/hooks/useRetrieveStepData.js +1 -1
- package/package.json +3 -3
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +4 -2
- package/scss/components/SidePanel/_side-panel-variables.scss +1 -0
- package/scss/components/StringFormatter/_string-formatter.scss +1 -1
- package/telemetry.yml +2 -0
|
@@ -1,3 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 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 path="../../../src/custom-typings/index.d.ts" />
|
|
8
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { ButtonProps } from '@carbon/react';
|
|
11
|
+
/**
|
|
12
|
+
* The accessibility title for the close icon (if shown).
|
|
13
|
+
*
|
|
14
|
+
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
|
15
|
+
* there are a no navigation actions and/or hasCloseIcon is true.
|
|
16
|
+
*/
|
|
17
|
+
export type CloseIconDescriptionTypes = {
|
|
18
|
+
hasCloseIcon?: false;
|
|
19
|
+
closeIconDescription?: string;
|
|
20
|
+
} | {
|
|
21
|
+
hasCloseIcon: true;
|
|
22
|
+
closeIconDescription: string;
|
|
23
|
+
};
|
|
24
|
+
interface TearsheetProps extends PropsWithChildren {
|
|
25
|
+
/**
|
|
26
|
+
* The navigation actions to be shown as buttons in the action area at the
|
|
27
|
+
* bottom of the tearsheet. Each action is specified as an object with
|
|
28
|
+
* optional fields: 'label' to supply the button label, 'kind' to select the
|
|
29
|
+
* button kind (must be 'primary', 'secondary' or 'ghost'), 'loading' to
|
|
30
|
+
* display a loading indicator, and 'onClick' to receive notifications when
|
|
31
|
+
* the button is clicked. Additional fields in the object will be passed to
|
|
32
|
+
* the Button component, and these can include 'disabled', 'ref', 'className',
|
|
33
|
+
* and any other Button props, except 'size'. Any other fields in the object will
|
|
34
|
+
* be passed through to the button element as HTML attributes.
|
|
35
|
+
*
|
|
36
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
|
37
|
+
*/
|
|
38
|
+
actions: ButtonProps[];
|
|
39
|
+
/**
|
|
40
|
+
* The aria-label for the tearsheet, which is optional.
|
|
41
|
+
* if it is not passed, the title will be used as the aria-label.
|
|
42
|
+
*/
|
|
43
|
+
ariaLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* An optional class or classes to be added to the outermost element.
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
|
50
|
+
*/
|
|
51
|
+
description?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Enable a close icon ('x') in the header area of the tearsheet. By default,
|
|
54
|
+
* (when this prop is omitted, or undefined or null) a tearsheet does not
|
|
55
|
+
* display a close icon if there are navigation actions ("transactional
|
|
56
|
+
* tearsheet") and displays one if there are no navigation actions ("passive
|
|
57
|
+
* tearsheet"), and that behavior can be overridden if required by setting
|
|
58
|
+
* this prop to either true or false.
|
|
59
|
+
*/
|
|
60
|
+
hasCloseIcon?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The content for the influencer section of the tearsheet, displayed
|
|
63
|
+
* alongside the main content. This is typically a menu, or filter, or
|
|
64
|
+
* progress indicator, or similar.
|
|
65
|
+
*/
|
|
66
|
+
influencer?: ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* The position of the influencer section, 'left' or 'right'.
|
|
69
|
+
*/
|
|
70
|
+
influencerPosition?: 'left' | 'right';
|
|
71
|
+
/**
|
|
72
|
+
* The width of the influencer: 'narrow' (the default) is 256px, and 'wide'
|
|
73
|
+
* is 320px.
|
|
74
|
+
*/
|
|
75
|
+
influencerWidth?: 'narrow' | 'wide';
|
|
76
|
+
/**
|
|
77
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
|
78
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
|
79
|
+
* to page of a multi-page task).
|
|
80
|
+
*/
|
|
81
|
+
label?: ReactNode;
|
|
82
|
+
/**
|
|
83
|
+
* Navigation content, such as a set of tabs, to be displayed at the bottom
|
|
84
|
+
* of the header area of the tearsheet.
|
|
85
|
+
*/
|
|
86
|
+
navigation?: ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
|
89
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
|
90
|
+
* Returning `false` here prevents the modal from closing.
|
|
91
|
+
*/
|
|
92
|
+
onClose?: () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Specifies whether the tearsheet is currently open.
|
|
95
|
+
*/
|
|
96
|
+
open?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
|
99
|
+
*/
|
|
100
|
+
portalTarget: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
|
|
103
|
+
*/
|
|
104
|
+
selectorPrimaryFocus?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The main title of the tearsheet, displayed in the header area.
|
|
107
|
+
*/
|
|
108
|
+
title?: ReactNode;
|
|
109
|
+
/** @deprecated */
|
|
110
|
+
/**
|
|
111
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
|
112
|
+
* position is a short distance down from the top of the
|
|
113
|
+
* viewport, leaving room at the top for a global header bar to show through
|
|
114
|
+
* from below. The 'lower' position (the default) provides a little extra room at the top
|
|
115
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
|
116
|
+
*/
|
|
117
|
+
verticalPosition?: 'normal' | 'lower';
|
|
118
|
+
}
|
|
1
119
|
/**
|
|
2
120
|
* A tearsheet is a mostly full-screen type of dialog that keeps users
|
|
3
121
|
* in-context and focused by bringing actionable content front and center while
|
|
@@ -10,9 +128,17 @@
|
|
|
10
128
|
* panel on either the left or right side, the main content area, and a set of
|
|
11
129
|
* action buttons.
|
|
12
130
|
*/
|
|
13
|
-
export let Tearsheet: React.ForwardRefExoticComponent<React.RefAttributes<
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
131
|
+
export declare let Tearsheet: React.ForwardRefExoticComponent<(TearsheetProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
|
|
132
|
+
export declare const deprecatedProps: {
|
|
133
|
+
/**
|
|
134
|
+
* **Deprecated**
|
|
135
|
+
*
|
|
136
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
|
137
|
+
* position is a short distance down from the top of the
|
|
138
|
+
* viewport, leaving room at the top for a global header bar to show through
|
|
139
|
+
* from below. The 'lower' position (the default) provides a little extra room at the top
|
|
140
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
|
141
|
+
*/
|
|
142
|
+
verticalPosition: PropTypes.Requireable<string>;
|
|
143
|
+
};
|
|
144
|
+
export {};
|
|
@@ -15,17 +15,24 @@ import { Button } from '@carbon/react';
|
|
|
15
15
|
import { TearsheetShell, tearsheetHasCloseIcon, portalType } from './TearsheetShell.js';
|
|
16
16
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
|
17
17
|
|
|
18
|
-
var _excluded = ["influencerPosition", "influencerWidth"
|
|
18
|
+
var _excluded = ["influencerPosition", "influencerWidth"];
|
|
19
19
|
var componentName = 'Tearsheet';
|
|
20
20
|
|
|
21
21
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The accessibility title for the close icon (if shown).
|
|
25
|
+
*
|
|
26
|
+
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
|
27
|
+
* there are a no navigation actions and/or hasCloseIcon is true.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// The types and DocGen commentary for the component props,
|
|
31
|
+
// in alphabetical order (for consistency).
|
|
32
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
|
33
|
+
|
|
34
|
+
// Note that the descriptions here should be kept in sync with those for the
|
|
35
|
+
// corresponding props for TearsheetNarrow and TearsheetShell components.
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
38
|
* A tearsheet is a mostly full-screen type of dialog that keeps users
|
|
@@ -41,16 +48,13 @@ var defaults = {
|
|
|
41
48
|
*/
|
|
42
49
|
var Tearsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
43
50
|
var _ref$influencerPositi = _ref.influencerPosition,
|
|
44
|
-
influencerPosition = _ref$influencerPositi === void 0 ?
|
|
51
|
+
influencerPosition = _ref$influencerPositi === void 0 ? 'left' : _ref$influencerPositi,
|
|
45
52
|
_ref$influencerWidth = _ref.influencerWidth,
|
|
46
|
-
influencerWidth = _ref$influencerWidth === void 0 ?
|
|
47
|
-
_ref$verticalPosition = _ref.verticalPosition,
|
|
48
|
-
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
|
53
|
+
influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
|
|
49
54
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
55
|
return /*#__PURE__*/React__default.createElement(TearsheetShell, _objectSpread2(_objectSpread2(_objectSpread2({}, getDevtoolsProps(componentName)), rest), {}, {
|
|
51
56
|
influencerPosition: influencerPosition,
|
|
52
57
|
influencerWidth: influencerWidth,
|
|
53
|
-
verticalPosition: verticalPosition,
|
|
54
58
|
ref: ref,
|
|
55
59
|
size: 'wide'
|
|
56
60
|
}));
|
|
@@ -95,7 +99,8 @@ Tearsheet.propTypes = _objectSpread2({
|
|
|
95
99
|
*
|
|
96
100
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
|
97
101
|
*/
|
|
98
|
-
actions: allPropTypes([
|
|
102
|
+
actions: allPropTypes([/**@ts-ignore */
|
|
103
|
+
ActionSet.validateActions(function () {
|
|
99
104
|
return '2xl';
|
|
100
105
|
}), PropTypes.arrayOf(PropTypes.shape(_objectSpread2(_objectSpread2({}, Button.propTypes), {}, {
|
|
101
106
|
kind: PropTypes.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
|
@@ -119,6 +124,7 @@ Tearsheet.propTypes = _objectSpread2({
|
|
|
119
124
|
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
|
120
125
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
|
121
126
|
*/
|
|
127
|
+
/**@ts-ignore */
|
|
122
128
|
closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
|
|
123
129
|
var actions = _ref2.actions,
|
|
124
130
|
hasCloseIcon = _ref2.hasCloseIcon;
|
|
@@ -136,6 +142,7 @@ Tearsheet.propTypes = _objectSpread2({
|
|
|
136
142
|
* tearsheet"), and that behavior can be overridden if required by setting
|
|
137
143
|
* this prop to either true or false.
|
|
138
144
|
*/
|
|
145
|
+
/**@ts-ignore */
|
|
139
146
|
hasCloseIcon: PropTypes.bool,
|
|
140
147
|
/**
|
|
141
148
|
* The content for the influencer section of the tearsheet, displayed
|
|
@@ -158,6 +165,10 @@ Tearsheet.propTypes = _objectSpread2({
|
|
|
158
165
|
* to page of a multi-page task).
|
|
159
166
|
*/
|
|
160
167
|
label: PropTypes.node,
|
|
168
|
+
/**
|
|
169
|
+
* Provide a ref to return focus to once the tearsheet is closed.
|
|
170
|
+
*/
|
|
171
|
+
launcherButtonRef: PropTypes.any,
|
|
161
172
|
/**
|
|
162
173
|
* Navigation content, such as a set of tabs, to be displayed at the bottom
|
|
163
174
|
* of the header area of the tearsheet.
|
|
@@ -176,6 +187,7 @@ Tearsheet.propTypes = _objectSpread2({
|
|
|
176
187
|
/**
|
|
177
188
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
|
178
189
|
*/
|
|
190
|
+
/**@ts-ignore */
|
|
179
191
|
portalTarget: portalType,
|
|
180
192
|
/**
|
|
181
193
|
* Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
|
8
|
-
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
8
|
+
import React, { PropsWithChildren, ReactNode, RefObject } from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import { type ButtonProps } from '@carbon/react';
|
|
11
11
|
interface TearsheetShellProps extends PropsWithChildren {
|
|
@@ -57,6 +57,10 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
|
57
57
|
* to page of a multi-page task).
|
|
58
58
|
*/
|
|
59
59
|
label?: ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Provide a ref to return focus to once the tearsheet is closed.
|
|
62
|
+
*/
|
|
63
|
+
launcherButtonRef?: RefObject<any>;
|
|
60
64
|
/**
|
|
61
65
|
* Navigation content, such as a set of tabs, to be displayed at the bottom
|
|
62
66
|
* of the header area of the tearsheet. NB the navigation is only applicable
|
|
@@ -17,9 +17,10 @@ import { Button, usePrefix, ComposedModal, ModalHeader, Layer } from '@carbon/re
|
|
|
17
17
|
import { Wrap } from '../../global/js/utils/Wrap.js';
|
|
18
18
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
|
19
19
|
import { useFocus } from '../../global/js/hooks/useFocus.js';
|
|
20
|
+
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
|
20
21
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
|
21
22
|
|
|
22
|
-
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition"];
|
|
23
|
+
var _excluded = ["actions", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
|
23
24
|
|
|
24
25
|
// The block part of our conventional BEM class names (bc__E--M).
|
|
25
26
|
var bc = "".concat(pkg.prefix, "--tearsheet");
|
|
@@ -82,6 +83,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
82
83
|
slug = _ref.slug,
|
|
83
84
|
title = _ref.title,
|
|
84
85
|
verticalPosition = _ref.verticalPosition,
|
|
86
|
+
launcherButtonRef = _ref.launcherButtonRef,
|
|
85
87
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
86
88
|
var carbonPrefix = usePrefix();
|
|
87
89
|
var bcModalHeader = "".concat(carbonPrefix, "--modal-header");
|
|
@@ -92,9 +94,11 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
92
94
|
var modalRef = ref || localRef;
|
|
93
95
|
var _useResizeObserver = useResizeObserver(resizer),
|
|
94
96
|
width = _useResizeObserver.width;
|
|
95
|
-
var
|
|
97
|
+
var prevOpen = usePreviousValue(open);
|
|
98
|
+
var _useFocus = useFocus(modalRef, selectorPrimaryFocus),
|
|
96
99
|
firstElement = _useFocus.firstElement,
|
|
97
|
-
keyDownListener = _useFocus.keyDownListener
|
|
100
|
+
keyDownListener = _useFocus.keyDownListener,
|
|
101
|
+
specifiedElement = _useFocus.specifiedElement;
|
|
98
102
|
var modalRefValue = modalRef.current;
|
|
99
103
|
var wide = size === 'wide';
|
|
100
104
|
|
|
@@ -133,17 +137,30 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
133
137
|
|
|
134
138
|
// Callback to give the tearsheet the opportunity to claim focus
|
|
135
139
|
handleStackChange.claimFocus = function () {
|
|
140
|
+
if (selectorPrimaryFocus) {
|
|
141
|
+
return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
|
|
142
|
+
}
|
|
136
143
|
firstElement === null || firstElement === void 0 || firstElement.focus();
|
|
137
144
|
};
|
|
138
145
|
useEffect(function () {
|
|
139
146
|
if (open) {
|
|
140
|
-
// Focusing the first element
|
|
147
|
+
// Focusing the first element or selectorPrimaryFocus element
|
|
141
148
|
setTimeout(function () {
|
|
149
|
+
if (selectorPrimaryFocus) {
|
|
150
|
+
return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
|
|
151
|
+
}
|
|
142
152
|
firstElement === null || firstElement === void 0 || firstElement.focus();
|
|
143
153
|
}, 0);
|
|
144
154
|
}
|
|
145
155
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
156
|
}, [open]);
|
|
157
|
+
useEffect(function () {
|
|
158
|
+
if (prevOpen && !open && launcherButtonRef) {
|
|
159
|
+
setTimeout(function () {
|
|
160
|
+
launcherButtonRef.current.focus();
|
|
161
|
+
}, 0);
|
|
162
|
+
}
|
|
163
|
+
}, [launcherButtonRef, open, prevOpen]);
|
|
147
164
|
useEffect(function () {
|
|
148
165
|
if (open && position !== depth) {
|
|
149
166
|
setTimeout(function () {
|
|
@@ -402,6 +419,11 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
|
402
419
|
* to page of a multi-page task).
|
|
403
420
|
*/
|
|
404
421
|
label: PropTypes.node,
|
|
422
|
+
/**
|
|
423
|
+
* Provide a ref to return focus to once the tearsheet is closed.
|
|
424
|
+
*/
|
|
425
|
+
/**@ts-ignore */
|
|
426
|
+
launcherButtonRef: PropTypes.any,
|
|
405
427
|
/**
|
|
406
428
|
* Navigation content, such as a set of tabs, to be displayed at the bottom
|
|
407
429
|
* of the header area of the tearsheet. NB the navigation is only applicable
|
|
@@ -41,6 +41,10 @@ interface WebTerminalProps extends PropsWithChildren {
|
|
|
41
41
|
* Optionally pass if the web terminal should be open by default
|
|
42
42
|
*/
|
|
43
43
|
isInitiallyOpen?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies aria label for Web terminal
|
|
46
|
+
*/
|
|
47
|
+
webTerminalAriaLabel?: string;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
|
|
@@ -16,7 +16,7 @@ import { moderate02 } from '@carbon/motion';
|
|
|
16
16
|
import { useWebTerminal } from './hooks/index.js';
|
|
17
17
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
|
18
18
|
|
|
19
|
-
var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen"];
|
|
19
|
+
var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen", "webTerminalAriaLabel"];
|
|
20
20
|
|
|
21
21
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
22
22
|
var componentName = 'WebTerminal';
|
|
@@ -27,7 +27,8 @@ var defaults = {
|
|
|
27
27
|
actions: Object.freeze([]),
|
|
28
28
|
documentationLinks: Object.freeze([]),
|
|
29
29
|
documentationLinksIconDescription: 'Show documentation links',
|
|
30
|
-
isInitiallyOpen: false
|
|
30
|
+
isInitiallyOpen: false,
|
|
31
|
+
webTerminalAriaLabel: 'Web terminal header'
|
|
31
32
|
};
|
|
32
33
|
/**
|
|
33
34
|
* The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
|
|
@@ -44,6 +45,8 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
44
45
|
documentationLinksIconDescription = _ref$documentationLin2 === void 0 ? defaults.documentationLinksIconDescription : _ref$documentationLin2,
|
|
45
46
|
_ref$isInitiallyOpen = _ref.isInitiallyOpen,
|
|
46
47
|
isInitiallyOpen = _ref$isInitiallyOpen === void 0 ? defaults.isInitiallyOpen : _ref$isInitiallyOpen,
|
|
48
|
+
_ref$webTerminalAriaL = _ref.webTerminalAriaLabel,
|
|
49
|
+
webTerminalAriaLabel = _ref$webTerminalAriaL === void 0 ? defaults.webTerminalAriaLabel : _ref$webTerminalAriaL,
|
|
47
50
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
51
|
var _useWebTerminal = useWebTerminal(),
|
|
49
52
|
open = _useWebTerminal.open,
|
|
@@ -102,6 +105,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
102
105
|
},
|
|
103
106
|
onAnimationEnd: onAnimationEnd
|
|
104
107
|
}), /*#__PURE__*/React__default.createElement("header", {
|
|
108
|
+
"aria-label": webTerminalAriaLabel,
|
|
105
109
|
className: "".concat(blockClass, "__bar")
|
|
106
110
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
107
111
|
className: "".concat(blockClass, "__actions")
|
|
@@ -196,7 +200,11 @@ WebTerminal.propTypes = {
|
|
|
196
200
|
/**
|
|
197
201
|
* Optionally pass if the web terminal should be open by default
|
|
198
202
|
*/
|
|
199
|
-
isInitiallyOpen: PropTypes.bool
|
|
203
|
+
isInitiallyOpen: PropTypes.bool,
|
|
204
|
+
/**
|
|
205
|
+
* Specifies aria label for Web terminal
|
|
206
|
+
*/
|
|
207
|
+
webTerminalAriaLabel: PropTypes.string
|
|
200
208
|
};
|
|
201
209
|
|
|
202
210
|
export { WebTerminal };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export function useFocus(modalRef: any): {
|
|
1
|
+
export function useFocus(modalRef: any, selectorPrimaryFocus: any): {
|
|
2
2
|
firstElement: any;
|
|
3
3
|
lastElement: any;
|
|
4
4
|
allElements: any;
|
|
5
|
+
specifiedElement: any;
|
|
5
6
|
keyDownListener: (event: any) => void;
|
|
6
7
|
getFocusable: () => {
|
|
7
8
|
first: any;
|
|
8
9
|
last: any;
|
|
9
10
|
all: any;
|
|
11
|
+
specifiedElement: any;
|
|
10
12
|
};
|
|
11
13
|
};
|
|
@@ -9,7 +9,7 @@ import { usePrefix } from '@carbon/react';
|
|
|
9
9
|
import { pkg } from '../../../settings.js';
|
|
10
10
|
import { useCallback, useEffect } from 'react';
|
|
11
11
|
|
|
12
|
-
var useFocus = function useFocus(modalRef) {
|
|
12
|
+
var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
13
13
|
var carbonPrefix = usePrefix();
|
|
14
14
|
var tearsheetBaseClass = "".concat(pkg.prefix, "--tearsheet");
|
|
15
15
|
// Querying focusable element in the modal
|
|
@@ -39,12 +39,14 @@ var useFocus = function useFocus(modalRef) {
|
|
|
39
39
|
var first = (_focusableElements2 = focusableElements) === null || _focusableElements2 === void 0 ? void 0 : _focusableElements2[0];
|
|
40
40
|
var last = (_focusableElements3 = focusableElements) === null || _focusableElements3 === void 0 ? void 0 : _focusableElements3[((_focusableElements4 = focusableElements) === null || _focusableElements4 === void 0 ? void 0 : _focusableElements4.length) - 1];
|
|
41
41
|
var all = focusableElements;
|
|
42
|
+
var specifiedElement = selectorPrimaryFocus ? modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelector(selectorPrimaryFocus) : null;
|
|
42
43
|
return {
|
|
43
44
|
first: first,
|
|
44
45
|
last: last,
|
|
45
|
-
all: all
|
|
46
|
+
all: all,
|
|
47
|
+
specifiedElement: specifiedElement
|
|
46
48
|
};
|
|
47
|
-
}, [modalEl, query]);
|
|
49
|
+
}, [modalEl, query, selectorPrimaryFocus]);
|
|
48
50
|
useEffect(function () {
|
|
49
51
|
getFocusable();
|
|
50
52
|
}, [getFocusable]);
|
|
@@ -76,6 +78,7 @@ var useFocus = function useFocus(modalRef) {
|
|
|
76
78
|
firstElement: getFocusable().first,
|
|
77
79
|
lastElement: getFocusable().last,
|
|
78
80
|
allElements: getFocusable().all,
|
|
81
|
+
specifiedElement: getFocusable().specified,
|
|
79
82
|
keyDownListener: handleKeyDown,
|
|
80
83
|
getFocusable: getFocusable
|
|
81
84
|
};
|
|
@@ -18,7 +18,7 @@ import { useEffect } from 'react';
|
|
|
18
18
|
* @param {boolean} useResetCreateComponent.invalid
|
|
19
19
|
* @param {boolean} useResetCreateComponent.shouldIncludeStep
|
|
20
20
|
* @param {string} useResetCreateComponent.secondaryLabel
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {React.ReactNode} useResetCreateComponent.title
|
|
22
22
|
*/
|
|
23
23
|
var useRetrieveStepData = function useRetrieveStepData(_ref) {
|
|
24
24
|
var stepsContext = _ref.stepsContext,
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Filter, Item, Theme } from './types';
|
|
3
|
+
export interface AddSelectProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
clearFiltersText?: string;
|
|
6
|
+
closeIconDescription?: string;
|
|
7
|
+
columnInputPlaceholder?: string;
|
|
8
|
+
description: string;
|
|
9
|
+
filterByLabel?: string;
|
|
10
|
+
globalFilters?: Filter[];
|
|
11
|
+
globalFiltersIconDescription?: string;
|
|
12
|
+
globalFiltersLabel?: string;
|
|
13
|
+
globalFiltersPlaceholderText?: string;
|
|
14
|
+
globalFiltersPrimaryButtonText?: string;
|
|
15
|
+
globalFiltersSecondaryButtonText?: string;
|
|
16
|
+
globalSearchLabel: string;
|
|
17
|
+
globalSearchPlaceholder?: string;
|
|
18
|
+
globalSortBy?: Array<any>;
|
|
19
|
+
illustrationTheme?: Theme;
|
|
20
|
+
influencerTitle?: string;
|
|
21
|
+
items: Item;
|
|
22
|
+
itemsLabel: string;
|
|
23
|
+
metaIconDescription?: string;
|
|
24
|
+
metaPanelTitle?: string;
|
|
25
|
+
multi: boolean;
|
|
26
|
+
navIconDescription?: string;
|
|
27
|
+
noResultsDescription: string;
|
|
28
|
+
noResultsTitle: string;
|
|
29
|
+
noSelectionDescription?: string;
|
|
30
|
+
noSelectionTitle?: string;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
onCloseButtonText: string;
|
|
33
|
+
onSubmit: () => void;
|
|
34
|
+
onSubmitButtonText: string;
|
|
35
|
+
open: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* portal target for the all tags modal
|
|
38
|
+
*/
|
|
39
|
+
portalTarget?: ReactNode;
|
|
40
|
+
searchResultsTitle?: string;
|
|
41
|
+
sortByLabel?: string;
|
|
42
|
+
title: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const AddSelect: React.ForwardRefExoticComponent<AddSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -31,10 +31,12 @@ var AddSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
31
31
|
var normalizedItems = useNormalizedItems ? addSelectUtils.normalize(items) : null;
|
|
32
32
|
var globalFilterOpts = props.multi && globalFilters !== null && globalFilters !== void 0 && globalFilters.length ? addSelectUtils.getGlobalFilterValues(globalFilters, normalizedItems) : null;
|
|
33
33
|
var defaultModifiers = props.multi && items.modifiers ? items.entries.map(function (item) {
|
|
34
|
-
var
|
|
35
|
-
|
|
34
|
+
var _items$modifiers;
|
|
35
|
+
var modifierAttribute = items === null || items === void 0 || (_items$modifiers = items.modifiers) === null || _items$modifiers === void 0 ? void 0 : _items$modifiers.id;
|
|
36
|
+
var modifier = {
|
|
36
37
|
id: item.id
|
|
37
|
-
}
|
|
38
|
+
};
|
|
39
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, modifier), modifierAttribute && _rollupPluginBabelHelpers.defineProperty({}, modifierAttribute, item[modifierAttribute]));
|
|
38
40
|
}) : [];
|
|
39
41
|
return /*#__PURE__*/React__default["default"].createElement(AddSelectBody.AddSelectBody, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
40
42
|
ref: ref,
|
|
@@ -52,6 +54,7 @@ AddSelect.propTypes = {
|
|
|
52
54
|
columnInputPlaceholder: index["default"].string,
|
|
53
55
|
description: index["default"].string.isRequired,
|
|
54
56
|
filterByLabel: index["default"].string,
|
|
57
|
+
/**@ts-ignore */
|
|
55
58
|
globalFilters: index["default"].arrayOf(index["default"].shape({
|
|
56
59
|
id: index["default"].string,
|
|
57
60
|
label: index["default"].string
|
|
@@ -66,6 +69,7 @@ AddSelect.propTypes = {
|
|
|
66
69
|
globalSortBy: index["default"].array,
|
|
67
70
|
illustrationTheme: index["default"].oneOf(['light', 'dark']),
|
|
68
71
|
influencerTitle: index["default"].string,
|
|
72
|
+
/**@ts-ignore */
|
|
69
73
|
items: index["default"].shape({
|
|
70
74
|
modifiers: index["default"].shape({
|
|
71
75
|
id: index["default"].string,
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Item, Theme } from './types';
|
|
3
|
+
export interface AddSelectBodyProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
clearFiltersText?: string;
|
|
6
|
+
closeIconDescription?: string;
|
|
7
|
+
columnInputPlaceholder?: string;
|
|
8
|
+
defaultModifiers?: Array<any>;
|
|
9
|
+
description?: string;
|
|
10
|
+
filterByLabel?: string;
|
|
11
|
+
globalFilterOpts?: Array<any>;
|
|
12
|
+
globalFiltersIconDescription?: string;
|
|
13
|
+
globalFiltersLabel?: string;
|
|
14
|
+
globalFiltersPlaceholderText?: string;
|
|
15
|
+
globalFiltersPrimaryButtonText?: string;
|
|
16
|
+
globalFiltersSecondaryButtonText?: string;
|
|
17
|
+
globalSearchLabel: string;
|
|
18
|
+
globalSearchPlaceholder?: string;
|
|
19
|
+
globalSortBy?: Array<any>;
|
|
20
|
+
illustrationTheme?: Theme;
|
|
21
|
+
influencerTitle?: string;
|
|
22
|
+
items?: Item;
|
|
23
|
+
itemsLabel?: string;
|
|
24
|
+
metaIconDescription?: string;
|
|
25
|
+
metaPanelTitle?: string;
|
|
26
|
+
multi?: boolean;
|
|
27
|
+
navIconDescription?: string;
|
|
28
|
+
noResultsDescription?: string;
|
|
29
|
+
noResultsTitle?: string;
|
|
30
|
+
noSelectionDescription?: string;
|
|
31
|
+
noSelectionTitle?: string;
|
|
32
|
+
normalizedItems?: object;
|
|
33
|
+
onClose?: () => void;
|
|
34
|
+
onCloseButtonText?: string;
|
|
35
|
+
onSubmit?: (selection: any) => void;
|
|
36
|
+
onSubmitButtonText?: string;
|
|
37
|
+
open?: boolean;
|
|
38
|
+
portalTarget?: ReactNode;
|
|
39
|
+
searchResultsTitle?: string;
|
|
40
|
+
sortByLabel?: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
useNormalizedItems?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const AddSelectBody: React.ForwardRefExoticComponent<AddSelectBodyProps & React.RefAttributes<HTMLDivElement>>;
|