carbon-react 153.0.0-beta.1 → 153.0.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/esm/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
- package/esm/__internal__/ai-icon/ai-icon.component.js +28 -0
- package/esm/__internal__/ai-icon/index.d.ts +1 -0
- package/esm/__internal__/ai-icon/index.js +1 -0
- package/esm/__internal__/dom/globals.js +1 -1
- package/esm/__internal__/input/input.component.d.ts +6 -1
- package/esm/__internal__/input/input.component.js +3 -2
- package/esm/components/accordion/accordion-group/accordion-group.component.js +6 -0
- package/esm/components/button/button-types.style.js +11 -1
- package/esm/components/button/button.component.js +1 -1
- package/esm/components/dialog/dialog.component.d.ts +1 -0
- package/esm/components/dialog/dialog.component.js +2 -0
- package/esm/components/dialog/dialog.style.d.ts +1 -0
- package/esm/components/dialog/dialog.style.js +14 -0
- package/esm/components/hr/hr.style.js +1 -1
- package/esm/components/link/link.component.js +8 -1
- package/esm/components/menu/menu-item/menu-item.component.js +13 -7
- package/esm/components/message/message.component.d.ts +5 -1
- package/esm/components/message/message.component.js +38 -24
- package/esm/components/message/message.style.d.ts +4 -1
- package/esm/components/message/message.style.js +39 -13
- package/esm/components/portrait/portrait.style.js +0 -1
- package/esm/components/preview/preview.style.js +1 -1
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
- package/esm/components/select/simple-select/simple-select.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +1 -0
- package/esm/components/split-button/split-button-toggle.style.js +30 -2
- package/esm/components/split-button/split-button.component.d.ts +2 -0
- package/esm/components/split-button/split-button.component.js +4 -0
- package/esm/components/textarea/textarea.component.js +10 -3
- package/esm/components/textbox/textbox.component.js +10 -3
- package/esm/components/tile/tile.style.d.ts +1 -1
- package/esm/components/time/index.d.ts +1 -1
- package/esm/components/time/time.component.js +16 -1
- package/esm/components/toast/toast.component.js +2 -1
- package/esm/components/toast/toast.style.d.ts +2 -3
- package/esm/components/toast/toast.style.js +1 -2
- package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.d.ts +1 -1
- package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +5 -6
- package/esm/components/vertical-menu/vertical-menu.style.d.ts +5 -1
- package/esm/components/vertical-menu/vertical-menu.style.js +20 -1
- package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.js +3 -3
- package/esm/locales/en-gb.js +2 -1
- package/esm/locales/locale.d.ts +1 -0
- package/lib/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
- package/lib/__internal__/ai-icon/ai-icon.component.js +36 -0
- package/lib/__internal__/ai-icon/index.d.ts +1 -0
- package/lib/__internal__/ai-icon/index.js +13 -0
- package/lib/__internal__/ai-icon/package.json +6 -0
- package/lib/__internal__/dom/globals.js +1 -1
- package/lib/__internal__/input/input.component.d.ts +6 -1
- package/lib/__internal__/input/input.component.js +3 -2
- package/lib/components/accordion/accordion-group/accordion-group.component.js +6 -0
- package/lib/components/button/button-types.style.js +11 -1
- package/lib/components/button/button.component.js +1 -1
- package/lib/components/dialog/dialog.component.d.ts +1 -0
- package/lib/components/dialog/dialog.component.js +2 -0
- package/lib/components/dialog/dialog.style.d.ts +1 -0
- package/lib/components/dialog/dialog.style.js +14 -0
- package/lib/components/hr/hr.style.js +1 -1
- package/lib/components/link/link.component.js +8 -1
- package/lib/components/menu/menu-item/menu-item.component.js +12 -6
- package/lib/components/message/message.component.d.ts +5 -1
- package/lib/components/message/message.component.js +38 -24
- package/lib/components/message/message.style.d.ts +4 -1
- package/lib/components/message/message.style.js +38 -13
- package/lib/components/portrait/portrait.style.js +0 -1
- package/lib/components/preview/preview.style.js +1 -1
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
- package/lib/components/select/simple-select/simple-select.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +1 -0
- package/lib/components/split-button/split-button-toggle.style.js +30 -2
- package/lib/components/split-button/split-button.component.d.ts +2 -0
- package/lib/components/split-button/split-button.component.js +4 -0
- package/lib/components/textarea/textarea.component.js +10 -3
- package/lib/components/textbox/textbox.component.js +10 -3
- package/lib/components/tile/tile.style.d.ts +1 -1
- package/lib/components/time/index.d.ts +1 -1
- package/lib/components/time/time.component.js +15 -0
- package/lib/components/toast/toast.component.js +2 -1
- package/lib/components/toast/toast.style.d.ts +2 -3
- package/lib/components/toast/toast.style.js +0 -7
- package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.d.ts +1 -1
- package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +5 -6
- package/lib/components/vertical-menu/vertical-menu.style.d.ts +5 -1
- package/lib/components/vertical-menu/vertical-menu.style.js +20 -1
- package/lib/hooks/useCharacterCount/package.json +6 -0
- package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.js +3 -3
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/locale.d.ts +1 -0
- package/package.json +15 -15
- package/esm/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/esm/components/message/__internal__/message-content/message-content.component.js +0 -19
- package/esm/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/esm/components/message/__internal__/message-content/message-content.style.js +0 -12
- package/esm/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/esm/components/message/__internal__/type-icon/type-icon.component.js +0 -20
- package/esm/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/esm/components/message/__internal__/type-icon/type-icon.style.js +0 -38
- package/lib/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/lib/components/message/__internal__/message-content/message-content.component.js +0 -26
- package/lib/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/lib/components/message/__internal__/message-content/message-content.style.js +0 -19
- package/lib/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/lib/components/message/__internal__/type-icon/type-icon.component.js +0 -27
- package/lib/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/lib/components/message/__internal__/type-icon/type-icon.style.js +0 -46
- package/lib/hooks/__internal__/useCharacterCount/package.json +0 -6
- /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.d.ts +0 -0
- /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.js +0 -0
- /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.d.ts +0 -0
- /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.d.ts +0 -0
- /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.js +0 -0
- /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.d.ts +0 -0
|
@@ -3,7 +3,7 @@ import React, { useRef, useEffect, useContext, useCallback, useState } from "rea
|
|
|
3
3
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { InputPresentation } from "../../__internal__/input";
|
|
5
5
|
import FormField from "../../__internal__/form-field";
|
|
6
|
-
import useCharacterCount from "../../hooks/
|
|
6
|
+
import useCharacterCount from "../../hooks/useCharacterCount";
|
|
7
7
|
import Input from "../../__internal__/input/input.component";
|
|
8
8
|
import { InputBehaviour } from "../../__internal__/input-behaviour";
|
|
9
9
|
import InputIconToggle from "../../__internal__/input-icon-toggle";
|
|
@@ -19,9 +19,12 @@ import Logger from "../../__internal__/utils/logger";
|
|
|
19
19
|
import HintText from "../../__internal__/hint-text";
|
|
20
20
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
21
21
|
let deprecateUncontrolledWarnTriggered = false;
|
|
22
|
+
let deprecatedAriaDescribedByWarnTriggered = false;
|
|
22
23
|
let warnBorderRadiusArrayTooLarge = false;
|
|
23
24
|
export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
24
25
|
"aria-labelledby": ariaLabelledBy,
|
|
26
|
+
"aria-describedby": ariaDescribedByProp,
|
|
27
|
+
ariaDescribedBy: ariaDescribedByPropDeprecated,
|
|
25
28
|
autoFocus,
|
|
26
29
|
inputHint,
|
|
27
30
|
fieldHelp,
|
|
@@ -103,6 +106,10 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
103
106
|
deprecateUncontrolledWarnTriggered = true;
|
|
104
107
|
Logger.deprecate("Uncontrolled behaviour in `Textarea` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
105
108
|
}
|
|
109
|
+
if (!deprecatedAriaDescribedByWarnTriggered && ariaDescribedByPropDeprecated) {
|
|
110
|
+
deprecatedAriaDescribedByWarnTriggered = true;
|
|
111
|
+
Logger.deprecate("The `ariaDescribedBy` prop in `Textarea` is deprecated and will soon be removed, please use `aria-describedby` instead.");
|
|
112
|
+
}
|
|
106
113
|
if (Array.isArray(borderRadius) && borderRadius.length > 4 && !warnBorderRadiusArrayTooLarge) {
|
|
107
114
|
// eslint-disable-next-line no-console
|
|
108
115
|
console.warn("The `borderRadius` prop in `Textarea` component only supports up to 4 values.");
|
|
@@ -172,7 +179,7 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
172
179
|
const hasIconInside = !!(inputIcon || validationId && !validationOnLabel);
|
|
173
180
|
const hintId = useRef(guid());
|
|
174
181
|
const inputHintId = inputHint ? hintId.current : undefined;
|
|
175
|
-
const combinedAriaDescribedBy = [ariaDescribedBy, inputHintId, visuallyHiddenHintId].filter(Boolean).join(" ");
|
|
182
|
+
const combinedAriaDescribedBy = [ariaDescribedBy, inputHintId, visuallyHiddenHintId, ariaDescribedByProp || ariaDescribedByPropDeprecated].filter(Boolean).join(" ");
|
|
176
183
|
const input = /*#__PURE__*/React.createElement(InputPresentation, {
|
|
177
184
|
disabled: disabled,
|
|
178
185
|
readOnly: readOnly,
|
|
@@ -186,7 +193,7 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
186
193
|
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
187
194
|
"aria-invalid": !!error,
|
|
188
195
|
"aria-labelledby": ariaLabelledBy,
|
|
189
|
-
|
|
196
|
+
"aria-describedby": combinedAriaDescribedBy,
|
|
190
197
|
autoFocus: autoFocus,
|
|
191
198
|
name: name,
|
|
192
199
|
value: value,
|
|
@@ -12,7 +12,7 @@ import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
|
12
12
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
13
13
|
import NumeralDateContext from "../numeral-date/__internal__/numeral-date.context";
|
|
14
14
|
import Logger from "../../__internal__/utils/logger";
|
|
15
|
-
import useCharacterCount from "../../hooks/
|
|
15
|
+
import useCharacterCount from "../../hooks/useCharacterCount";
|
|
16
16
|
import useUniqueId from "../../hooks/__internal__/useUniqueId";
|
|
17
17
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
18
18
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
@@ -23,8 +23,11 @@ export const SIZE_DEFAULT = "medium";
|
|
|
23
23
|
export const LABEL_WIDTH_DEFAULT = 30;
|
|
24
24
|
export const LABEL_VALIDATION_DEFAULT = false;
|
|
25
25
|
let deprecateUncontrolledWarnTriggered = false;
|
|
26
|
+
let deprecatedAriaDescribedByWarnTriggered = false;
|
|
26
27
|
export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
27
28
|
"aria-labelledby": ariaLabelledBy,
|
|
29
|
+
"aria-describedby": ariaDescribedByProp,
|
|
30
|
+
ariaDescribedBy: ariaDescribedByDeprecated,
|
|
28
31
|
align = ALIGN_DEFAULT,
|
|
29
32
|
autoFocus,
|
|
30
33
|
children,
|
|
@@ -106,6 +109,10 @@ export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
106
109
|
deprecateUncontrolledWarnTriggered = true;
|
|
107
110
|
Logger.deprecate("Uncontrolled behaviour in `Textbox` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
108
111
|
}
|
|
112
|
+
if (!deprecatedAriaDescribedByWarnTriggered && ariaDescribedByDeprecated) {
|
|
113
|
+
deprecatedAriaDescribedByWarnTriggered = true;
|
|
114
|
+
Logger.deprecate("The `ariaDescribedBy` prop in `Textbox` is deprecated and will soon be removed, please use `aria-describedby` instead.");
|
|
115
|
+
}
|
|
109
116
|
const {
|
|
110
117
|
labelId,
|
|
111
118
|
validationId,
|
|
@@ -122,7 +129,7 @@ export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
122
129
|
});
|
|
123
130
|
const hintId = useRef(guid());
|
|
124
131
|
const inputHintId = inputHint ? hintId.current : undefined;
|
|
125
|
-
const combinedAriaDescribedBy = [ariaDescribedBy, inputHintId, visuallyHiddenHintId].filter(Boolean).join(" ");
|
|
132
|
+
const combinedAriaDescribedBy = [ariaDescribedBy, inputHintId, visuallyHiddenHintId, ariaDescribedByProp || ariaDescribedByDeprecated].filter(Boolean).join(" ");
|
|
126
133
|
const hasIconInside = !!(inputIcon || validationId && !validationOnLabel);
|
|
127
134
|
const input = /*#__PURE__*/React.createElement(InputPresentation, {
|
|
128
135
|
align: align,
|
|
@@ -146,7 +153,7 @@ export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
146
153
|
align: align,
|
|
147
154
|
"aria-invalid": !!error,
|
|
148
155
|
"aria-labelledby": ariaLabelledBy,
|
|
149
|
-
|
|
156
|
+
"aria-describedby": combinedAriaDescribedBy,
|
|
150
157
|
autoFocus: autoFocus,
|
|
151
158
|
deferTimeout: deferTimeout,
|
|
152
159
|
disabled: disabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { TileProps } from "./tile.component";
|
|
3
|
-
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "
|
|
3
|
+
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "highlightVariant" | "roundness" | "borderWidth" | "borderVariant"> & {
|
|
4
4
|
isHorizontal?: boolean | undefined;
|
|
5
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
6
6
|
export default StyledTile;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Time } from "./time.component";
|
|
2
|
-
export type { TimeValue, TimeProps, TimeHandle, ToggleValue, } from "./time.component";
|
|
2
|
+
export type { TimeValue, TimeProps, TimeHandle, ToggleValue, TimeInputEvent, } from "./time.component";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useImperativeHandle, useRef, useState, useEffect } from "react";
|
|
3
3
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
4
4
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
@@ -69,6 +69,21 @@ const Time = /*#__PURE__*/React.forwardRef(({
|
|
|
69
69
|
const minsAriaLabel = minutesAriaLabel || locale.time.minutesAriaLabelText();
|
|
70
70
|
const hoursRef = useRef(null);
|
|
71
71
|
const minsRef = useRef(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const updates = [...inputValues];
|
|
74
|
+
if (inputValues[0] !== hourValue) {
|
|
75
|
+
updates[0] = hourValue;
|
|
76
|
+
}
|
|
77
|
+
if (inputValues[1] !== minuteValue) {
|
|
78
|
+
updates[1] = minuteValue;
|
|
79
|
+
}
|
|
80
|
+
if (inputValues[0] !== hourValue || inputValues[1] !== minuteValue) {
|
|
81
|
+
setInputValues(updates);
|
|
82
|
+
const formattedHours = hourValue.length ? hourValue.padStart(2, "0") : hourValue;
|
|
83
|
+
const formattedMinutes = minuteValue.length ? minuteValue.padStart(2, "0") : minuteValue;
|
|
84
|
+
setFormattedInputValues([formattedHours, formattedMinutes]);
|
|
85
|
+
}
|
|
86
|
+
}, [hourValue, minuteValue, inputValues]);
|
|
72
87
|
const computedValidations = (hrs, mins) => {
|
|
73
88
|
const hoursIsString = typeof hrs === "string";
|
|
74
89
|
const minutesIsString = typeof mins === "string";
|
|
@@ -3,7 +3,8 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
4
4
|
import Icon from "../icon";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
6
|
-
import { StyledToast,
|
|
6
|
+
import { StyledToast, StyledToastContent, ToastWrapper, StyledPortal } from "./toast.style";
|
|
7
|
+
import { TypeIconStyle as TypeIcon } from "../message/message.style";
|
|
7
8
|
import IconButton from "../icon-button";
|
|
8
9
|
import Events from "../../__internal__/utils/helpers/events";
|
|
9
10
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
2
|
import { MessageVariant } from "../message/message.component";
|
|
4
3
|
declare const StyledPortal: import("styled-components").StyledComponent<({ children, className, id, onReposition, inertOptOut, }: import("../portal/portal").PortalProps) => import("react").JSX.Element, any, {
|
|
5
4
|
align?: "center" | "left" | "right" | undefined;
|
|
6
5
|
alignY?: "center" | "top" | "bottom" | undefined;
|
|
7
6
|
isNotice?: boolean | undefined;
|
|
8
7
|
}, never>;
|
|
9
|
-
type ToastVariants = MessageVariant
|
|
8
|
+
type ToastVariants = Exclude<MessageVariant, "ai">;
|
|
10
9
|
type ToastStyleProps = {
|
|
11
10
|
align?: "left" | "center" | "right";
|
|
12
11
|
alignY?: "top" | "center" | "bottom";
|
|
@@ -24,4 +23,4 @@ declare const ToastWrapper: import("styled-components").StyledComponent<"div", a
|
|
|
24
23
|
align?: "center" | "left" | "right" | undefined;
|
|
25
24
|
isNotice?: boolean | undefined;
|
|
26
25
|
}, never>;
|
|
27
|
-
export { StyledPortal, StyledToast,
|
|
26
|
+
export { StyledPortal, StyledToast, StyledToastContent, ToastWrapper };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
2
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
4
3
|
import Portal from "../portal/portal";
|
|
5
4
|
import baseTheme from "../../style/themes/base";
|
|
@@ -224,4 +223,4 @@ const ToastWrapper = styled.div`
|
|
|
224
223
|
display: block;
|
|
225
224
|
`}
|
|
226
225
|
`;
|
|
227
|
-
export { StyledPortal, StyledToast,
|
|
226
|
+
export { StyledPortal, StyledToast, StyledToastContent, ToastWrapper };
|
|
@@ -12,5 +12,5 @@ export interface VerticalMenuFullScreenProps extends TagProps {
|
|
|
12
12
|
/** A callback to be called when the close icon is clicked or enter is pressed when focused */
|
|
13
13
|
onClose: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement> | KeyboardEvent) => void;
|
|
14
14
|
}
|
|
15
|
-
export declare const VerticalMenuFullScreen: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, isOpen, onClose, ...rest }: VerticalMenuFullScreenProps) => React.JSX.Element
|
|
15
|
+
export declare const VerticalMenuFullScreen: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, isOpen, onClose, ...rest }: VerticalMenuFullScreenProps) => React.JSX.Element;
|
|
16
16
|
export default VerticalMenuFullScreen;
|
|
@@ -12,6 +12,7 @@ import VerticalMenuFullScreenContext from "./__internal__/vertical-menu-full-scr
|
|
|
12
12
|
import { getDocument } from "../../../__internal__/dom/globals";
|
|
13
13
|
import Events from "../../../__internal__/utils/helpers/events/events";
|
|
14
14
|
import useModalManager from "../../../hooks/__internal__/useModalManager";
|
|
15
|
+
import useMediaQuery from "../../../hooks/useMediaQuery";
|
|
15
16
|
export const VerticalMenuFullScreen = ({
|
|
16
17
|
"aria-label": ariaLabel,
|
|
17
18
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -22,6 +23,7 @@ export const VerticalMenuFullScreen = ({
|
|
|
22
23
|
}) => {
|
|
23
24
|
const l = useLocale();
|
|
24
25
|
const menuWrapperRef = useRef(null);
|
|
26
|
+
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
25
27
|
const handleKeyDown = useCallback(ev => {
|
|
26
28
|
// istanbul ignore else
|
|
27
29
|
if (Events.isEscKey(ev)) {
|
|
@@ -36,14 +38,13 @@ export const VerticalMenuFullScreen = ({
|
|
|
36
38
|
topModalOverride: true,
|
|
37
39
|
focusCallToActionElement: safeDocument?.activeElement
|
|
38
40
|
});
|
|
39
|
-
|
|
40
|
-
// TODO remove this as part of FE-5650
|
|
41
|
-
if (!isOpen) return null;
|
|
42
41
|
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(FocusTrap, {
|
|
43
42
|
isOpen: isOpen,
|
|
44
43
|
wrapperRef: menuWrapperRef
|
|
45
44
|
}, /*#__PURE__*/React.createElement(StyledVerticalMenuFullScreen, _extends({
|
|
46
45
|
ref: menuWrapperRef,
|
|
46
|
+
isOpen: isOpen,
|
|
47
|
+
prefersReducedMotion: reduceMotion,
|
|
47
48
|
scrollVariant: "light",
|
|
48
49
|
as: "nav",
|
|
49
50
|
"aria-label": ariaLabel,
|
|
@@ -62,9 +63,7 @@ export const VerticalMenuFullScreen = ({
|
|
|
62
63
|
"data-element": "close"
|
|
63
64
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
64
65
|
type: "close",
|
|
65
|
-
color: "var(--colorsComponentsLeftnavWinterStandardContent)"
|
|
66
|
-
bgSize: "small",
|
|
67
|
-
fontSize: "medium"
|
|
66
|
+
color: "var(--colorsComponentsLeftnavWinterStandardContent)"
|
|
68
67
|
}))), /*#__PURE__*/React.createElement(VerticalMenuFullScreenContext.Provider, {
|
|
69
68
|
value: {
|
|
70
69
|
isFullScreen: true
|
|
@@ -18,6 +18,10 @@ export declare const StyledVerticalMenu: import("styled-components").StyledCompo
|
|
|
18
18
|
width?: string | undefined;
|
|
19
19
|
} | undefined;
|
|
20
20
|
}, never>;
|
|
21
|
+
interface FullScreenProps {
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
prefersReducedMotion?: boolean;
|
|
24
|
+
}
|
|
21
25
|
export declare const StyledVerticalMenuFullScreen: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
22
26
|
cssProps?: {
|
|
23
27
|
color?: string | undefined;
|
|
@@ -25,5 +29,5 @@ export declare const StyledVerticalMenuFullScreen: import("styled-components").S
|
|
|
25
29
|
height?: string | undefined;
|
|
26
30
|
width?: string | undefined;
|
|
27
31
|
} | undefined;
|
|
28
|
-
}, never>;
|
|
32
|
+
} & FullScreenProps, never>;
|
|
29
33
|
export {};
|
|
@@ -114,11 +114,30 @@ export const StyledVerticalMenuFullScreen = styled(StyledBox)`
|
|
|
114
114
|
overflow: auto;
|
|
115
115
|
background-color: var(--colorsComponentsLeftnavWinterStandardBackground);
|
|
116
116
|
box-sizing: border-box;
|
|
117
|
-
transition: all 0.3s ease;
|
|
118
117
|
z-index: ${({
|
|
119
118
|
theme
|
|
120
119
|
}) => theme.zIndex.fullScreenModal};
|
|
121
120
|
|
|
121
|
+
${({
|
|
122
|
+
prefersReducedMotion
|
|
123
|
+
}) => !prefersReducedMotion && css`
|
|
124
|
+
transition: all 0.3s ease;
|
|
125
|
+
`}
|
|
126
|
+
|
|
127
|
+
${({
|
|
128
|
+
isOpen
|
|
129
|
+
}) => isOpen && css`
|
|
130
|
+
visibility: visible;
|
|
131
|
+
transform: translateX(0);
|
|
132
|
+
`}
|
|
133
|
+
|
|
134
|
+
${({
|
|
135
|
+
isOpen
|
|
136
|
+
}) => !isOpen && css`
|
|
137
|
+
transform: translateX(-100%);
|
|
138
|
+
visibility: hidden;
|
|
139
|
+
`}
|
|
140
|
+
|
|
122
141
|
// TODO remove hardcoded values when DS have had chance to review which token to use
|
|
123
142
|
&::-webkit-scrollbar-track {
|
|
124
143
|
background-color: #cccccc;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useEffect, useState } from "react";
|
|
2
|
-
import CharacterCount from "
|
|
3
|
-
import guid from "
|
|
4
|
-
import useDebounce from "../useDebounce";
|
|
2
|
+
import CharacterCount from "../../__internal__/character-count";
|
|
3
|
+
import guid from "../../__internal__/utils/helpers/guid";
|
|
4
|
+
import useDebounce from "../__internal__/useDebounce";
|
|
5
5
|
const useCharacterCount = (value = "", characterLimit, characterCountAriaLive) => {
|
|
6
6
|
const isCharacterLimitValid = typeof characterLimit === "number" && !Number.isNaN(characterLimit);
|
|
7
7
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.AiIcon = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
const AiIcon = ({
|
|
12
|
+
...rest
|
|
13
|
+
}) => /*#__PURE__*/_react.default.createElement("svg", _extends({}, (0, _tags.default)("ai-icon", rest), {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
width: "20",
|
|
16
|
+
height: "20",
|
|
17
|
+
fill: "none",
|
|
18
|
+
viewBox: "0 0 20 20"
|
|
19
|
+
}), /*#__PURE__*/_react.default.createElement("g", {
|
|
20
|
+
clipPath: "url(#a)"
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
22
|
+
"data-role": "white-star",
|
|
23
|
+
fill: "#fff",
|
|
24
|
+
d: "m16.378 9.799-3.776-1.49a1.615 1.615 0 0 1-.91-.91l-1.49-3.775c-.537-1.364-2.466-1.364-3.004 0L5.708 7.4a1.615 1.615 0 0 1-.91.91L1.022 9.799c-1.363.537-1.363 2.466 0 3.004l3.776 1.49c.417.163.746.493.91.91l1.49 3.775c.538 1.363 2.467 1.363 3.005 0l1.489-3.776c.164-.416.494-.745.91-.91l3.776-1.489c1.364-.538 1.364-2.467 0-3.004Z"
|
|
25
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
26
|
+
"data-role": "green-circle",
|
|
27
|
+
fill: "#00D639",
|
|
28
|
+
d: "M17.172 5.655a2.827 2.827 0 1 0 0-5.655 2.827 2.827 0 0 0 0 5.655Z"
|
|
29
|
+
})), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
|
|
30
|
+
id: "a"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
32
|
+
fill: "#fff",
|
|
33
|
+
d: "M0 0h20v20H0z"
|
|
34
|
+
}))));
|
|
35
|
+
exports.AiIcon = AiIcon;
|
|
36
|
+
var _default = exports.default = AiIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _aiIcon.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _aiIcon = _interopRequireDefault(require("./ai-icon.component"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -63,5 +63,5 @@ function getDocument() {
|
|
|
63
63
|
* @returns The global `navigator` object, if it exists.
|
|
64
64
|
*/
|
|
65
65
|
function getNavigator() {
|
|
66
|
-
return typeof navigator !== "undefined" ? navigator : undefined;
|
|
66
|
+
return typeof navigator !== "undefined" ? navigator : /* istanbul ignore next: node versions >=21 have a partial implementation of navigatior */undefined;
|
|
67
67
|
}
|
|
@@ -3,8 +3,13 @@ import { BorderRadiusType } from "../../components/box/box.component";
|
|
|
3
3
|
export type EnterKeyHintTypes = "enter" | "done" | "go" | "next" | "previous" | "search" | "send";
|
|
4
4
|
export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
5
5
|
align?: "right" | "left";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Set the ID of the input's description.
|
|
8
|
+
* @deprecated Please use `aria-describedby` instead.
|
|
9
|
+
*/
|
|
7
10
|
ariaDescribedBy?: string;
|
|
11
|
+
/** The ID of the input's description, is set along with hint text and error message. */
|
|
12
|
+
"aria-describedby"?: string;
|
|
8
13
|
/** Override the variant component */
|
|
9
14
|
as?: React.ElementType;
|
|
10
15
|
/** If true the Component will be focused when rendered */
|
|
@@ -36,7 +36,8 @@ function selectTextOnFocus(input) {
|
|
|
36
36
|
const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
37
37
|
align,
|
|
38
38
|
"aria-labelledby": ariaLabelledBy,
|
|
39
|
-
ariaDescribedBy,
|
|
39
|
+
"aria-describedby": ariaDescribedBy,
|
|
40
|
+
ariaDescribedBy: ariaDescribedByDeprecated,
|
|
40
41
|
placeholder,
|
|
41
42
|
disabled,
|
|
42
43
|
readOnly,
|
|
@@ -135,7 +136,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
135
136
|
handleDeferred(ev);
|
|
136
137
|
};
|
|
137
138
|
const hasValidationPart = (context.hasFocus || groupContext.hasFocus || context.hasMouseOver || groupContext.hasMouseOver) && validationIconId;
|
|
138
|
-
const descriptionList = ariaDescribedBy ? [ariaDescribedBy] : [];
|
|
139
|
+
const descriptionList = ariaDescribedBy || ariaDescribedByDeprecated ? [ariaDescribedBy || ariaDescribedByDeprecated] : [];
|
|
139
140
|
if (hasValidationPart) {
|
|
140
141
|
descriptionList.push(validationIconId);
|
|
141
142
|
}
|
|
@@ -10,6 +10,7 @@ var _events = _interopRequireDefault(require("../../../__internal__/utils/helper
|
|
|
10
10
|
var _accordion = _interopRequireDefault(require("../accordion.component"));
|
|
11
11
|
var _accordion2 = require("../accordion.style");
|
|
12
12
|
var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags"));
|
|
13
|
+
var _logger = _interopRequireDefault(require("../../../__internal__/utils/logger"));
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -17,10 +18,15 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
17
18
|
// typescript-to-proptypes breaks on recursive type references so it has to be an interface
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
19
20
|
|
|
21
|
+
let deprecatedWarnTriggered = false;
|
|
20
22
|
const AccordionGroup = ({
|
|
21
23
|
children,
|
|
22
24
|
...rest
|
|
23
25
|
}) => {
|
|
26
|
+
if (!deprecatedWarnTriggered) {
|
|
27
|
+
deprecatedWarnTriggered = true;
|
|
28
|
+
_logger.default.deprecate("`AccordionGroup` is deprecated and will soon be removed.");
|
|
29
|
+
}
|
|
24
30
|
const hasProperChildren = (0, _react.useMemo)(() => {
|
|
25
31
|
let hasAccordionChildren = true;
|
|
26
32
|
_react.default.Children.toArray(children).forEach(child => {
|
|
@@ -83,6 +83,16 @@ var _default = (isDisabled, destructive, isWhite) => ({
|
|
|
83
83
|
${makeColors("var(--colorsActionMajorYang100)")};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
${isWhite && (!isDisabled || !destructive) ? `
|
|
87
|
+
border-color: var(--colorsActionMajorYang100);
|
|
88
|
+
${makeColors("var(--colorsActionMajorYang100)")};
|
|
89
|
+
&:hover {
|
|
90
|
+
background: var(--colorsActionMajorYang100);
|
|
91
|
+
border-color: var(--colorsActionMajorYang100);
|
|
92
|
+
${makeColors("var(--colorsYin100)")};
|
|
93
|
+
}
|
|
94
|
+
` : ""}
|
|
95
|
+
|
|
86
96
|
${destructive ? `
|
|
87
97
|
border-color: var(--colorsSemanticNegative500);
|
|
88
98
|
${makeColors("var(--colorsSemanticNegative500)")}
|
|
@@ -93,7 +103,7 @@ var _default = (isDisabled, destructive, isWhite) => ({
|
|
|
93
103
|
}
|
|
94
104
|
` : ""}
|
|
95
105
|
|
|
96
|
-
${isDisabled ? `
|
|
106
|
+
${isDisabled && !isWhite ? `
|
|
97
107
|
border-color: var(--colorsActionDisabled500);
|
|
98
108
|
${makeColors("var(--colorsActionMajorYin030)")};
|
|
99
109
|
&:hover {
|
|
@@ -73,13 +73,13 @@ const Button = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
73
73
|
children,
|
|
74
74
|
destructive = false,
|
|
75
75
|
disabled = false,
|
|
76
|
+
isWhite = false,
|
|
76
77
|
fullWidth: fullWidthProp = false,
|
|
77
78
|
href,
|
|
78
79
|
iconPosition: iconPositionProp = "before",
|
|
79
80
|
iconTooltipMessage,
|
|
80
81
|
iconTooltipPosition,
|
|
81
82
|
iconType,
|
|
82
|
-
isWhite = false,
|
|
83
83
|
m = 0,
|
|
84
84
|
noWrap,
|
|
85
85
|
onClick,
|
|
@@ -46,6 +46,7 @@ export interface DialogProps extends ModalProps, TagProps {
|
|
|
46
46
|
height?: string;
|
|
47
47
|
/** Adds Help tooltip to Header */
|
|
48
48
|
help?: string;
|
|
49
|
+
highlightVariant?: string;
|
|
49
50
|
/** A custom close event handler */
|
|
50
51
|
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent | React.MouseEvent<HTMLButtonElement>) => void;
|
|
51
52
|
/** Determines if the close icon is shown */
|
|
@@ -40,6 +40,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
40
40
|
bespokeFocusTrap,
|
|
41
41
|
disableClose,
|
|
42
42
|
help,
|
|
43
|
+
highlightVariant = "default",
|
|
43
44
|
role = "dialog",
|
|
44
45
|
contentPadding = {},
|
|
45
46
|
greyBackground = false,
|
|
@@ -124,6 +125,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
124
125
|
"aria-modal": isTopModal ? true : undefined,
|
|
125
126
|
ref: containerRef
|
|
126
127
|
}, dialogProps, {
|
|
128
|
+
highlightVariant: highlightVariant,
|
|
127
129
|
role: role,
|
|
128
130
|
tabIndex: -1
|
|
129
131
|
}, contentPadding, {
|
|
@@ -3,6 +3,7 @@ declare const DialogPositioner: import("styled-components").StyledComponent<"div
|
|
|
3
3
|
declare const StyledDialog: import("styled-components").StyledComponent<"div", any, Required<Pick<DialogProps, "size">> & {
|
|
4
4
|
dialogHeight?: string | undefined;
|
|
5
5
|
backgroundColor: string;
|
|
6
|
+
highlightVariant?: string | undefined;
|
|
6
7
|
} & ContentPaddingInterface, never>;
|
|
7
8
|
type StyledDialogTitleProps = {
|
|
8
9
|
showCloseIcon?: boolean;
|
|
@@ -60,6 +60,20 @@ const StyledDialog = exports.StyledDialog = _styledComponents.default.div`
|
|
|
60
60
|
outline: none;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
${({
|
|
64
|
+
highlightVariant
|
|
65
|
+
}) => highlightVariant === "ai" && `
|
|
66
|
+
&::before {
|
|
67
|
+
content: "";
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: -8px;
|
|
70
|
+
height: 100px;
|
|
71
|
+
width: 100%;
|
|
72
|
+
z-index: -1;
|
|
73
|
+
background: linear-gradient(90deg, #00D639 0%, #00D6DE 40%, #9D60FF 90%);
|
|
74
|
+
border-radius: var(--borderRadius200) var(--borderRadius200) 0 0;
|
|
75
|
+
}`}
|
|
76
|
+
|
|
63
77
|
${({
|
|
64
78
|
backgroundColor
|
|
65
79
|
}) => (0, _styledComponents.css)`
|
|
@@ -45,6 +45,13 @@ const Link = exports.Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
45
45
|
batchSelectionDisabled
|
|
46
46
|
} = (0, _react.useContext)(_batchSelection.default);
|
|
47
47
|
const isDisabled = disabled || batchSelectionDisabled;
|
|
48
|
+
const setRefs = _react.default.useCallback(reference => {
|
|
49
|
+
if (!ref) return;
|
|
50
|
+
if (typeof ref === "object") ref.current = reference;
|
|
51
|
+
if (typeof ref === "function") {
|
|
52
|
+
ref(reference);
|
|
53
|
+
}
|
|
54
|
+
}, [ref]);
|
|
48
55
|
const renderLinkIcon = (currentAlignment = "left") => {
|
|
49
56
|
const hasProperAlignment = icon && iconAlign === currentAlignment;
|
|
50
57
|
return hasProperAlignment ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
@@ -68,7 +75,7 @@ const Link = exports.Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
68
75
|
onClick,
|
|
69
76
|
disabled: isDisabled,
|
|
70
77
|
target,
|
|
71
|
-
ref,
|
|
78
|
+
ref: setRefs,
|
|
72
79
|
href,
|
|
73
80
|
rel,
|
|
74
81
|
"aria-label": ariaLabel,
|