carbon-react 105.1.2 → 106.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/tooltip-provider/index.d.ts +19 -24
- package/esm/__internal__/tooltip-provider/index.js +1 -11
- package/esm/__internal__/utils/helpers/browser/index.d.ts +15 -1
- package/esm/__internal__/utils/helpers/browser/index.js +33 -1
- package/esm/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
- package/esm/__internal__/utils/helpers/browser-type-check/index.js +8 -1
- package/esm/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
- package/esm/__internal__/utils/helpers/events/events.d.ts +132 -31
- package/esm/__internal__/utils/helpers/events/events.js +10 -125
- package/esm/__internal__/utils/helpers/guid/index.d.ts +5 -0
- package/esm/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
- package/esm/__internal__/utils/helpers/tags/tags.d.ts +10 -6
- package/esm/__internal__/utils/helpers/tags/tags.js +2 -6
- package/esm/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
- package/esm/__internal__/utils/helpers/useUniqueId/index.js +7 -0
- package/esm/__internal__/utils/logger/index.d.ts +5 -1
- package/esm/__internal__/utils/logger/index.js +25 -1
- package/esm/components/app-wrapper/app-wrapper.component.d.ts +4 -0
- package/esm/components/app-wrapper/app-wrapper.component.js +5 -3
- package/esm/components/badge/badge.style.d.ts +4 -2
- package/esm/components/button/button-types.style.d.ts +1 -2
- package/esm/components/button/button-types.style.js +3 -1
- package/esm/components/button/button.component.d.ts +67 -36
- package/esm/components/button/button.component.js +3314 -165
- package/esm/components/button/button.config.d.ts +4 -3
- package/esm/components/button/button.style.d.ts +6 -8
- package/esm/components/button/button.style.js +51 -95
- package/esm/components/button/index.d.ts +2 -2
- package/esm/components/confirm/confirm.component.js +1 -1
- package/esm/components/dialog/dialog.component.js +1 -1
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/esm/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
- package/esm/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
- package/esm/components/fieldset/fieldset.component.d.ts +6 -1
- package/esm/components/fieldset/fieldset.component.js +14 -15
- package/esm/components/heading/heading.component.d.ts +5 -0
- package/esm/components/icon/index.d.ts +1 -0
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +3 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +7 -5
- package/esm/components/multi-action-button/multi-action-button.d.ts +4 -2
- package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
- package/esm/components/multi-step-wizard/step/step.d.ts +6 -0
- package/esm/components/multi-step-wizard/step/step.style.d.ts +4 -2
- package/esm/components/portrait/portrait-initials.component.js +1 -1
- package/esm/components/radio-button/radio-button-svg.component.js +29 -16
- package/esm/components/scrollable-list/scrollable-list.component.d.ts +8 -0
- package/esm/components/select/select-list/select-list.component.js +1 -1
- package/esm/components/select/select-textbox/select-textbox.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +2 -6
- package/esm/components/split-button/split-button.component.d.ts +3 -1
- package/esm/components/split-button/split-button.component.js +7 -4
- package/esm/components/split-button/split-button.d.ts +5 -2
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
- package/esm/components/textbox/textbox.component.d.ts +1 -2
- package/esm/components/textbox/textbox.component.js +7 -6
- package/esm/components/tooltip/index.d.ts +2 -1
- package/esm/components/tooltip/tooltip-pointer.style.d.ts +10 -1
- package/esm/components/tooltip/tooltip-pointer.style.js +5 -12
- package/esm/components/tooltip/tooltip.component.d.ts +33 -2
- package/esm/components/tooltip/tooltip.component.js +255 -110
- package/esm/components/tooltip/tooltip.config.d.ts +2 -1
- package/esm/components/tooltip/tooltip.style.d.ts +7 -2
- package/esm/components/tooltip/tooltip.style.js +7 -21
- package/esm/components/typography/typography.component.d.ts +1 -1
- package/esm/locales/en-gb.d.ts +3 -5
- package/esm/locales/en-gb.js +5 -4
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/index.js +2 -0
- package/esm/locales/locale.d.ts +99 -105
- package/esm/locales/locale.js +1 -0
- package/esm/locales/pl-pl.d.ts +3 -5
- package/esm/locales/pl-pl.js +5 -4
- package/esm/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
- package/esm/style/fonts.css +30 -0
- package/esm/style/global-style.js +1 -1
- package/esm/style/themes/base/base-theme.config.d.ts +17 -8
- package/esm/style/themes/sage/index.d.ts +17 -8
- package/lib/__internal__/tooltip-provider/index.d.ts +19 -24
- package/lib/__internal__/tooltip-provider/index.js +2 -13
- package/lib/__internal__/utils/helpers/browser/index.d.ts +15 -1
- package/lib/__internal__/utils/helpers/browser/index.js +33 -8
- package/lib/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
- package/lib/__internal__/utils/helpers/browser-type-check/index.js +10 -21
- package/lib/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
- package/lib/__internal__/utils/helpers/events/events.d.ts +132 -31
- package/lib/__internal__/utils/helpers/events/events.js +10 -125
- package/lib/__internal__/utils/helpers/guid/index.d.ts +5 -0
- package/lib/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
- package/lib/__internal__/utils/helpers/guid/package.json +5 -2
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
- package/lib/__internal__/utils/helpers/tags/tags.d.ts +10 -6
- package/lib/__internal__/utils/helpers/tags/tags.js +2 -6
- package/lib/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
- package/lib/__internal__/utils/helpers/useUniqueId/index.js +20 -0
- package/lib/__internal__/utils/helpers/useUniqueId/package.json +6 -0
- package/lib/__internal__/utils/logger/index.d.ts +5 -1
- package/lib/__internal__/utils/logger/index.js +26 -8
- package/lib/components/app-wrapper/app-wrapper.component.d.ts +4 -0
- package/lib/components/app-wrapper/app-wrapper.component.js +5 -4
- package/lib/components/badge/badge.style.d.ts +4 -2
- package/lib/components/button/button-types.style.d.ts +1 -2
- package/lib/components/button/button-types.style.js +0 -1
- package/lib/components/button/button.component.d.ts +67 -36
- package/lib/components/button/button.component.js +3381 -172
- package/lib/components/button/button.config.d.ts +4 -3
- package/lib/components/button/button.style.d.ts +6 -8
- package/lib/components/button/button.style.js +52 -101
- package/lib/components/button/index.d.ts +2 -2
- package/lib/components/confirm/confirm.component.js +1 -1
- package/lib/components/dialog/dialog.component.js +1 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/lib/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
- package/lib/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
- package/lib/components/fieldset/fieldset.component.d.ts +6 -1
- package/lib/components/fieldset/fieldset.component.js +14 -16
- package/lib/components/heading/heading.component.d.ts +5 -0
- package/lib/components/icon/index.d.ts +1 -0
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +3 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +6 -4
- package/lib/components/multi-action-button/multi-action-button.d.ts +4 -2
- package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
- package/lib/components/multi-step-wizard/step/step.d.ts +6 -0
- package/lib/components/multi-step-wizard/step/step.style.d.ts +4 -2
- package/lib/components/portrait/portrait-initials.component.js +1 -1
- package/lib/components/radio-button/radio-button-svg.component.js +38 -20
- package/lib/components/scrollable-list/scrollable-list.component.d.ts +8 -0
- package/lib/components/select/select-list/select-list.component.js +1 -1
- package/lib/components/select/select-textbox/select-textbox.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +2 -6
- package/lib/components/split-button/split-button.component.d.ts +3 -1
- package/lib/components/split-button/split-button.component.js +6 -3
- package/lib/components/split-button/split-button.d.ts +5 -2
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
- package/lib/components/textbox/textbox.component.d.ts +1 -2
- package/lib/components/textbox/textbox.component.js +7 -8
- package/lib/components/tooltip/index.d.ts +2 -1
- package/lib/components/tooltip/tooltip-pointer.style.d.ts +10 -1
- package/lib/components/tooltip/tooltip-pointer.style.js +7 -15
- package/lib/components/tooltip/tooltip.component.d.ts +33 -2
- package/lib/components/tooltip/tooltip.component.js +221 -130
- package/lib/components/tooltip/tooltip.config.d.ts +2 -1
- package/lib/components/tooltip/tooltip.style.d.ts +7 -2
- package/lib/components/tooltip/tooltip.style.js +7 -22
- package/lib/components/typography/typography.component.d.ts +1 -1
- package/lib/locales/en-gb.d.ts +3 -5
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/locales/index.js +23 -0
- package/lib/locales/locale.d.ts +99 -105
- package/lib/locales/locale.js +5 -0
- package/lib/{__internal__/utils/ether → locales}/package.json +1 -1
- package/lib/locales/pl-pl.d.ts +3 -5
- package/lib/locales/pl-pl.js +2 -1
- package/lib/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
- package/lib/style/fonts.css +30 -0
- package/lib/style/global-style.js +1 -1
- package/lib/style/themes/base/base-theme.config.d.ts +17 -8
- package/lib/style/themes/sage/index.d.ts +17 -8
- package/package.json +10 -5
- package/esm/__internal__/utils/ether/ether.d.ts +0 -19
- package/esm/__internal__/utils/ether/ether.js +0 -29
- package/esm/__internal__/utils/ether/index.d.ts +0 -1
- package/esm/__internal__/utils/ether/index.js +0 -1
- package/esm/__internal__/utils/helpers/browser/browser.d.ts +0 -17
- package/esm/__internal__/utils/helpers/browser/browser.js +0 -198
- package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
- package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -14
- package/esm/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
- package/esm/__internal__/utils/helpers/guid/__spec__.js +0 -10
- package/esm/__internal__/utils/helpers/guid/guid.d.ts +0 -2
- package/esm/__internal__/utils/helpers/guid/package.json +0 -3
- package/esm/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
- package/esm/__internal__/utils/helpers/immutable/__spec__.js +0 -117
- package/esm/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
- package/esm/__internal__/utils/helpers/immutable/immutable.js +0 -36
- package/esm/__internal__/utils/helpers/immutable/package.json +0 -4
- package/esm/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
- package/esm/__internal__/utils/helpers/with-unique-id-props/index.js +0 -1
- package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
- package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -82
- package/esm/__internal__/utils/logger/logger.d.ts +0 -9
- package/esm/__internal__/utils/logger/logger.js +0 -71
- package/esm/components/button/button.d.ts +0 -85
- package/esm/components/tooltip/tooltip.d.ts +0 -40
- package/lib/__internal__/utils/ether/ether.d.ts +0 -19
- package/lib/__internal__/utils/ether/ether.js +0 -33
- package/lib/__internal__/utils/ether/index.d.ts +0 -1
- package/lib/__internal__/utils/ether/index.js +0 -18
- package/lib/__internal__/utils/helpers/browser/browser.d.ts +0 -17
- package/lib/__internal__/utils/helpers/browser/browser.js +0 -213
- package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
- package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -26
- package/lib/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
- package/lib/__internal__/utils/helpers/guid/__spec__.js +0 -15
- package/lib/__internal__/utils/helpers/guid/guid.d.ts +0 -2
- package/lib/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
- package/lib/__internal__/utils/helpers/immutable/__spec__.js +0 -135
- package/lib/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
- package/lib/__internal__/utils/helpers/immutable/immutable.js +0 -46
- package/lib/__internal__/utils/helpers/immutable/package.json +0 -4
- package/lib/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
- package/lib/__internal__/utils/helpers/with-unique-id-props/index.js +0 -15
- package/lib/__internal__/utils/helpers/with-unique-id-props/package.json +0 -6
- package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
- package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -96
- package/lib/__internal__/utils/logger/logger.d.ts +0 -9
- package/lib/__internal__/utils/logger/logger.js +0 -78
- package/lib/components/button/button.d.ts +0 -85
- package/lib/components/tooltip/tooltip.d.ts +0 -40
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { SpaceProps } from "styled-system";
|
|
3
|
-
import { IconType } from "components/icon/icon";
|
|
4
|
-
|
|
5
|
-
export type ButtonTypes =
|
|
6
|
-
| "primary"
|
|
7
|
-
| "secondary"
|
|
8
|
-
| "tertiary"
|
|
9
|
-
| "dashed"
|
|
10
|
-
| "destructive"
|
|
11
|
-
| "darkBackground";
|
|
12
|
-
|
|
13
|
-
export interface ButtonBaseProps extends SpaceProps {
|
|
14
|
-
/** Prop to specify the aria-label text.
|
|
15
|
-
* Only to be used in Button when only an icon is rendered.
|
|
16
|
-
* This is required to comply with WCAG 4.1.2 - Buttons must have discernible text
|
|
17
|
-
*/
|
|
18
|
-
"aria-label"?: string;
|
|
19
|
-
/** [Legacy] Button types for legacy theme: "primary" | "secondary" */
|
|
20
|
-
as?: ButtonTypes;
|
|
21
|
-
/** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "darkBackground" */
|
|
22
|
-
buttonType?: ButtonTypes;
|
|
23
|
-
/** The text the button displays */
|
|
24
|
-
children?: React.ReactNode;
|
|
25
|
-
/** Apply disabled state to the button */
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** Apply destructive style to the button */
|
|
28
|
-
destructive?: boolean;
|
|
29
|
-
/** Ref to be forwarded */
|
|
30
|
-
forwardRef?: React.Ref<HTMLButtonElement>;
|
|
31
|
-
/** Apply fullWidth style to the button */
|
|
32
|
-
fullWidth?: boolean;
|
|
33
|
-
/** Used to transform button into anchor */
|
|
34
|
-
href?: string;
|
|
35
|
-
/** Defines an Icon position related to the children: "before" | "after" */
|
|
36
|
-
iconPosition?: "before" | "after";
|
|
37
|
-
/** Provides a tooltip message when the icon is hovered. */
|
|
38
|
-
iconTooltipMessage?: string;
|
|
39
|
-
/** Provides positioning when the tooltip is displayed. */
|
|
40
|
-
iconTooltipPosition?: string;
|
|
41
|
-
/** Defines an Icon type within the button */
|
|
42
|
-
iconType?: IconType;
|
|
43
|
-
/** If provided, the text inside a button will not wrap */
|
|
44
|
-
noWrap?: boolean;
|
|
45
|
-
/** Specify a callback triggered on blur */
|
|
46
|
-
onBlur?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
47
|
-
/** Specify a callback triggered on change */
|
|
48
|
-
onChange?: (ev: React.ChangeEvent<HTMLButtonElement>) => void;
|
|
49
|
-
/** Specify a callback triggered on focus */
|
|
50
|
-
onFocus?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
51
|
-
/** Specify a callback triggered on keyDown */
|
|
52
|
-
onKeyDown?: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
53
|
-
/** Assigns a size to the button: "small" | "medium" | "large" */
|
|
54
|
-
size?: "small" | "medium" | "large";
|
|
55
|
-
/** Second text child, renders under main text, only when size is "large" */
|
|
56
|
-
subtext?: string;
|
|
57
|
-
/** HTML button type property */
|
|
58
|
-
type?: string;
|
|
59
|
-
/** HTML target attribute */
|
|
60
|
-
target?: string;
|
|
61
|
-
/** HTML rel attribute */
|
|
62
|
-
rel?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface ButtonLinkProps extends ButtonBaseProps {
|
|
66
|
-
/** onClick handler */
|
|
67
|
-
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface ButtonDefaultProps extends ButtonBaseProps {
|
|
71
|
-
/** onClick handler */
|
|
72
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type ButtonProps = ButtonLinkProps | ButtonDefaultProps;
|
|
76
|
-
|
|
77
|
-
declare function Button(props: ButtonProps): JSX.Element;
|
|
78
|
-
declare function ButtonWithForwardRef(
|
|
79
|
-
props: ButtonProps &
|
|
80
|
-
React.RefAttributes<HTMLButtonElement> &
|
|
81
|
-
React.HTMLProps<HTMLButtonElement>
|
|
82
|
-
): JSX.Element;
|
|
83
|
-
|
|
84
|
-
export { ButtonWithForwardRef };
|
|
85
|
-
export default Button;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export interface TooltipProps {
|
|
4
|
-
/** The message to be displayed within the tooltip */
|
|
5
|
-
message: React.ReactNode;
|
|
6
|
-
/** The id attribute to use for the tooltip */
|
|
7
|
-
id?: string;
|
|
8
|
-
/** Whether to to show the Tooltip */
|
|
9
|
-
isVisible?: boolean;
|
|
10
|
-
/** Sets position of the tooltip */
|
|
11
|
-
position?: "top" | "bottom" | "left" | "right";
|
|
12
|
-
/** Defines the message type */
|
|
13
|
-
type?: string;
|
|
14
|
-
/** Children elements */
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
/** Defines the size of the tooltip content */
|
|
17
|
-
size?: "small" | "large";
|
|
18
|
-
/** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
|
|
19
|
-
bgColor?: string;
|
|
20
|
-
/** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
|
|
21
|
-
fontColor?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Overrides the default flip behaviour of the Tooltip,
|
|
24
|
-
* must be an array containing some or all of ["top", "bottom", "left", "right"]
|
|
25
|
-
* (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
|
|
26
|
-
*/
|
|
27
|
-
flipOverrides?: ["top" | "bottom" | "left" | "right"];
|
|
28
|
-
target?: Element;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface TooltipInternalProps extends TooltipProps {
|
|
32
|
-
isPartOfInput?: boolean;
|
|
33
|
-
inputSize?: "small" | "medium" | "large";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare function Tooltip(
|
|
37
|
-
props: TooltipProps & React.RefAttributes<HTMLDivElement>
|
|
38
|
-
): JSX.Element;
|
|
39
|
-
|
|
40
|
-
export default Tooltip;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ether
|
|
3
|
-
*
|
|
4
|
-
* Ether provides functional-like helper methods for Carbon specific tasks.
|
|
5
|
-
* As we are dealing with stateful values (user input, browser state) Ether
|
|
6
|
-
* does not provide pure functions in all cases.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Returns the props that were passed to a component but excludes the props listed in propTypes
|
|
10
|
-
*
|
|
11
|
-
* Optionally includes the safeProps which can be defined as a static property on a Class or passed as the second
|
|
12
|
-
* argument.
|
|
13
|
-
*
|
|
14
|
-
* @method validProps
|
|
15
|
-
* @param {Object} instance
|
|
16
|
-
* @param {Array?} safeProps
|
|
17
|
-
* @return {Object} props
|
|
18
|
-
*/
|
|
19
|
-
export function validProps(instance: Object, safeProps: any[] | null): Object;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validProps = validProps;
|
|
7
|
-
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Ether
|
|
12
|
-
*
|
|
13
|
-
* Ether provides functional-like helper methods for Carbon specific tasks.
|
|
14
|
-
* As we are dealing with stateful values (user input, browser state) Ether
|
|
15
|
-
* does not provide pure functions in all cases.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns the props that were passed to a component but excludes the props listed in propTypes
|
|
20
|
-
*
|
|
21
|
-
* Optionally includes the safeProps which can be defined as a static property on a Class or passed as the second
|
|
22
|
-
* argument.
|
|
23
|
-
*
|
|
24
|
-
* @method validProps
|
|
25
|
-
* @param {Object} instance
|
|
26
|
-
* @param {Array?} safeProps
|
|
27
|
-
* @return {Object} props
|
|
28
|
-
*/
|
|
29
|
-
function validProps(instance, safeProps) {
|
|
30
|
-
const component = instance.isReactComponent ? instance.constructor : instance;
|
|
31
|
-
const unsafeProps = (0, _lodash.difference)(Object.keys(component.propTypes), safeProps || component.safeProps || []);
|
|
32
|
-
return (0, _lodash.omit)(instance.props, unsafeProps);
|
|
33
|
-
} // eslint-disable-next-line import/prefer-default-export
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ether";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _ether = require("./ether");
|
|
8
|
-
|
|
9
|
-
Object.keys(_ether).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _ether[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _ether[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default Browser;
|
|
2
|
-
declare namespace Browser {
|
|
3
|
-
function isDomAvailable(): boolean;
|
|
4
|
-
function getWindow(): any;
|
|
5
|
-
function getDocument(): Document;
|
|
6
|
-
function getActiveElement(): Element | null;
|
|
7
|
-
function redirectTo(url: any): void;
|
|
8
|
-
function redirectAfter(url: any, seconds: any): NodeJS.Timeout;
|
|
9
|
-
function reload(): void;
|
|
10
|
-
function editFocus(ref: any): void;
|
|
11
|
-
function setFocus(reactNode: any): void;
|
|
12
|
-
function setInputFocus(inputComponent: any): void;
|
|
13
|
-
function setCookie(name: any, value: any, options?: Object): void;
|
|
14
|
-
function getCookie(name: string): string | null;
|
|
15
|
-
function postToNewWindow(url: string, data: Object, target?: Object): void;
|
|
16
|
-
function submitForm(form: any): void;
|
|
17
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Browser Helper
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* Provides helper methods for working with Browser behavior.
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const Browser = {
|
|
24
|
-
isDomAvailable: () => {
|
|
25
|
-
const _window = Browser.getWindow();
|
|
26
|
-
|
|
27
|
-
const _document = Browser.getDocument();
|
|
28
|
-
|
|
29
|
-
return !!(typeof _window !== "undefined" && _document && _document.createElement);
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get the current window
|
|
34
|
-
*
|
|
35
|
-
* @return window
|
|
36
|
-
*/
|
|
37
|
-
getWindow: () => {
|
|
38
|
-
return global.window;
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get the current document
|
|
43
|
-
*
|
|
44
|
-
* @return window
|
|
45
|
-
*/
|
|
46
|
-
getDocument: () => {
|
|
47
|
-
return document;
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get the current activeElement
|
|
52
|
-
*
|
|
53
|
-
* @return HTMLElement
|
|
54
|
-
*/
|
|
55
|
-
getActiveElement: () => {
|
|
56
|
-
const doc = Browser.getDocument();
|
|
57
|
-
return doc.activeElement;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Redirect to URL
|
|
62
|
-
*
|
|
63
|
-
* @method redirectTo
|
|
64
|
-
* @param url => URL string format
|
|
65
|
-
*/
|
|
66
|
-
redirectTo: url => {
|
|
67
|
-
Browser.getWindow().location = url;
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Redirects to URL after the given number of seconds have elapsed
|
|
72
|
-
*
|
|
73
|
-
* @method redirectAfter
|
|
74
|
-
* @param url => URL string format
|
|
75
|
-
* @param seconds => the number of seconds to wait before redirecting
|
|
76
|
-
*/
|
|
77
|
-
redirectAfter: (url, seconds) => {
|
|
78
|
-
return setTimeout(() => Browser.redirectTo(url), seconds * 1000);
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Reload the current page
|
|
83
|
-
*
|
|
84
|
-
* @method reload
|
|
85
|
-
*/
|
|
86
|
-
reload: () => {
|
|
87
|
-
Browser.getWindow().location.reload();
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Focuses and sets cursor of input field
|
|
92
|
-
*
|
|
93
|
-
* @method editFocus
|
|
94
|
-
*/
|
|
95
|
-
editFocus: ref => {
|
|
96
|
-
const node = _reactDom.default.findDOMNode(ref._input); // eslint-disable-line react/no-find-dom-node
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
node.focus();
|
|
100
|
-
node.select();
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Focuses and sets cursor of react node
|
|
105
|
-
*
|
|
106
|
-
* @method setFocus
|
|
107
|
-
*/
|
|
108
|
-
setFocus: reactNode => {
|
|
109
|
-
const node = _reactDom.default.findDOMNode(reactNode); // eslint-disable-line react/no-find-dom-node
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
node.focus();
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Focuses and sets cursor of input field but does not select text
|
|
117
|
-
*
|
|
118
|
-
* @method setInputFocus
|
|
119
|
-
*/
|
|
120
|
-
setInputFocus: inputComponent => {
|
|
121
|
-
Browser.setFocus(inputComponent._input);
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Sets a cookie where name=value
|
|
126
|
-
*
|
|
127
|
-
* @param {Object} options includes expires or max-age
|
|
128
|
-
* @method setCookie
|
|
129
|
-
*/
|
|
130
|
-
setCookie: (name, value, options = {}) => {
|
|
131
|
-
let cookie = `${name}=${value}`;
|
|
132
|
-
|
|
133
|
-
if (options.expires) {
|
|
134
|
-
cookie += `; expires=${options.expires}`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (options["max-age"]) {
|
|
138
|
-
cookie += `; max-age=${options["max-age"]}`;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
Browser.getDocument().cookie = cookie;
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Returns a cookies value by passed name
|
|
146
|
-
*
|
|
147
|
-
* @param {String} name cookie name key
|
|
148
|
-
* @method getCookieValueByName
|
|
149
|
-
*/
|
|
150
|
-
getCookie: name => {
|
|
151
|
-
const cookies = Browser.getDocument().cookie.split(";");
|
|
152
|
-
|
|
153
|
-
for (let i = 0; i < cookies.length; i++) {
|
|
154
|
-
const cookie = cookies[i].trim().split("=");
|
|
155
|
-
|
|
156
|
-
if (cookie[0] === name) {
|
|
157
|
-
return cookie[1];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return null;
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Submits POST in new window
|
|
166
|
-
*
|
|
167
|
-
* @method postToNewWindow
|
|
168
|
-
* @param {String} url URL to POST to
|
|
169
|
-
* @param {Object} data Data to POST
|
|
170
|
-
* @param {Object} target Optional target window name
|
|
171
|
-
* @return {Void}
|
|
172
|
-
*/
|
|
173
|
-
postToNewWindow: (url, data, target = "_blank") => {
|
|
174
|
-
const doc = Browser.getDocument(),
|
|
175
|
-
containerId = "carbonPostFormContainer";
|
|
176
|
-
let container = doc.getElementById(containerId);
|
|
177
|
-
|
|
178
|
-
if (!container) {
|
|
179
|
-
container = doc.createElement("div");
|
|
180
|
-
container.setAttribute("id", containerId);
|
|
181
|
-
doc.body.appendChild(container);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement("form", {
|
|
185
|
-
action: url,
|
|
186
|
-
method: "post",
|
|
187
|
-
target: target
|
|
188
|
-
}, (0, _lodash.keys)(data).map(key => {
|
|
189
|
-
return /*#__PURE__*/_react.default.createElement("input", {
|
|
190
|
-
type: "hidden",
|
|
191
|
-
key: key,
|
|
192
|
-
name: key,
|
|
193
|
-
value: data[key]
|
|
194
|
-
});
|
|
195
|
-
})), container, function () {
|
|
196
|
-
Browser.submitForm(this);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
_reactDom.default.unmountComponentAtNode(container);
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Submits a passed Form
|
|
204
|
-
*
|
|
205
|
-
* @method submitForm
|
|
206
|
-
* @param {HTML Form} form to submit
|
|
207
|
-
*/
|
|
208
|
-
submitForm: form => {
|
|
209
|
-
form.submit();
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
var _default = Browser;
|
|
213
|
-
exports.default = _default;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isSafari = isSafari;
|
|
7
|
-
exports.isEdge = isEdge;
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Check for Chrome or Firefox.
|
|
12
|
-
*/
|
|
13
|
-
function browserTypeCheck(_window) {
|
|
14
|
-
return Boolean(_window.chrome || _window.sidebar);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function isSafari(navigator) {
|
|
18
|
-
return navigator.vendor.includes("Apple");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isEdge(navigator) {
|
|
22
|
-
return navigator.userAgent.includes("Edge");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var _default = browserTypeCheck;
|
|
26
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _guid = _interopRequireDefault(require("./guid"));
|
|
4
|
-
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
|
-
describe("guid", () => {
|
|
8
|
-
it("returns a 36 character id", () => {
|
|
9
|
-
expect((0, _guid.default)().length).toEqual(36);
|
|
10
|
-
});
|
|
11
|
-
it("returns a unique id", () => {
|
|
12
|
-
const id = (0, _guid.default)();
|
|
13
|
-
expect((0, _guid.default)()).not.toEqual(id);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _immutable = _interopRequireDefault(require("immutable"));
|
|
4
|
-
|
|
5
|
-
var _immutable2 = _interopRequireDefault(require("./immutable"));
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
|
|
9
|
-
describe("Immutable Helper", () => {
|
|
10
|
-
describe("parseJSON", () => {
|
|
11
|
-
describe("when the passed json is not an object", () => {
|
|
12
|
-
it("returns the json", () => {
|
|
13
|
-
expect(_immutable2.default.parseJSON("a")).toEqual("a");
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
describe("when the passed json is null", () => {
|
|
17
|
-
it("returns null", () => {
|
|
18
|
-
expect(_immutable2.default.parseJSON(null)).toBeNull();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe("when the JSON is a simple array", () => {
|
|
22
|
-
let data, expectedData, result;
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
data = ["a", "b", "c"];
|
|
25
|
-
expectedData = _immutable.default.Seq(data).toList();
|
|
26
|
-
result = _immutable2.default.parseJSON(data);
|
|
27
|
-
});
|
|
28
|
-
it("returns a immutable object of that array", () => {
|
|
29
|
-
expect(result).toEqual(expectedData);
|
|
30
|
-
expect(result.get(0)).toEqual("a");
|
|
31
|
-
expect(result.get(1)).toEqual("b");
|
|
32
|
-
expect(result.get(2)).toEqual("c");
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe("when the JSON object is a array of objects", () => {
|
|
36
|
-
let data, result;
|
|
37
|
-
it("returns a immutable object of that array", () => {
|
|
38
|
-
data = [{
|
|
39
|
-
foo: "a"
|
|
40
|
-
}, {
|
|
41
|
-
bar: "b"
|
|
42
|
-
}, {
|
|
43
|
-
baz: "c"
|
|
44
|
-
}];
|
|
45
|
-
result = _immutable2.default.parseJSON(data);
|
|
46
|
-
expect(result.get(0).get("foo")).toEqual("a");
|
|
47
|
-
expect(result.get(1).get("bar")).toEqual("b");
|
|
48
|
-
expect(result.get(2).get("baz")).toEqual("c");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe("when JSON is a object", () => {
|
|
52
|
-
let data, expectedData;
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
data = {
|
|
55
|
-
foo: "bar",
|
|
56
|
-
baz: "qux"
|
|
57
|
-
};
|
|
58
|
-
expectedData = _immutable.default.Seq(data).toMap();
|
|
59
|
-
});
|
|
60
|
-
it("returns a ordered immutable map", () => {
|
|
61
|
-
const result = _immutable2.default.parseJSON(data);
|
|
62
|
-
|
|
63
|
-
expect(result).toEqual(expectedData);
|
|
64
|
-
expect(result.get("foo")).toEqual("bar");
|
|
65
|
-
expect(result.get("baz")).toEqual("qux");
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
describe("when JSON is a complex value with nest arrays and objects", () => {
|
|
69
|
-
let data, expectedData;
|
|
70
|
-
beforeEach(() => {
|
|
71
|
-
data = [{
|
|
72
|
-
foo: "bar",
|
|
73
|
-
baz: "qux"
|
|
74
|
-
}, {
|
|
75
|
-
a: ["a", "b", "c"],
|
|
76
|
-
b: "b"
|
|
77
|
-
}];
|
|
78
|
-
|
|
79
|
-
const obj1 = _immutable.default.Seq({
|
|
80
|
-
foo: "bar",
|
|
81
|
-
baz: "qux"
|
|
82
|
-
}).toMap();
|
|
83
|
-
|
|
84
|
-
const array1 = _immutable.default.Seq(["a", "b", "c"]).toList();
|
|
85
|
-
|
|
86
|
-
const obj2 = _immutable.default.Seq({
|
|
87
|
-
a: array1,
|
|
88
|
-
b: "b"
|
|
89
|
-
}).toMap();
|
|
90
|
-
|
|
91
|
-
expectedData = _immutable.default.Seq([obj1, obj2]).toList();
|
|
92
|
-
});
|
|
93
|
-
it("creates a immutable object in the same format", () => {
|
|
94
|
-
const result = _immutable2.default.parseJSON(data);
|
|
95
|
-
|
|
96
|
-
expect(result.toJS()).toEqual(expectedData.toJS());
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe("when passed a number", () => {
|
|
100
|
-
it("casts it to a string", () => {
|
|
101
|
-
expect(_immutable2.default.parseJSON(1)).toEqual(_immutable.default.fromJS("1"));
|
|
102
|
-
expect(_immutable2.default.parseJSON(3.142)).toEqual(_immutable.default.fromJS("3.142"));
|
|
103
|
-
});
|
|
104
|
-
describe("as a nested element", () => {
|
|
105
|
-
it("casts all numbers to a string", () => {
|
|
106
|
-
const data = [{
|
|
107
|
-
foo: "bar",
|
|
108
|
-
baz: "qux"
|
|
109
|
-
}, {
|
|
110
|
-
a: [1, 2, "c"],
|
|
111
|
-
b: 2
|
|
112
|
-
}];
|
|
113
|
-
|
|
114
|
-
const obj1 = _immutable.default.Seq({
|
|
115
|
-
foo: "bar",
|
|
116
|
-
baz: "qux"
|
|
117
|
-
}).toMap();
|
|
118
|
-
|
|
119
|
-
const array1 = _immutable.default.Seq(["1", "2", "c"]).toList();
|
|
120
|
-
|
|
121
|
-
const obj2 = _immutable.default.Seq({
|
|
122
|
-
a: array1,
|
|
123
|
-
b: "2"
|
|
124
|
-
}).toMap();
|
|
125
|
-
|
|
126
|
-
const expectedData = _immutable.default.Seq([obj1, obj2]).toList();
|
|
127
|
-
|
|
128
|
-
const result = _immutable2.default.parseJSON(data);
|
|
129
|
-
|
|
130
|
-
expect(result.toJS()).toEqual(expectedData.toJS());
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _immutable = _interopRequireDefault(require("immutable"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Immutable Helper
|
|
14
|
-
*
|
|
15
|
-
* Provides helper methods for working with immutable data.
|
|
16
|
-
*
|
|
17
|
-
* @object ImmutableHelper
|
|
18
|
-
* @param {String} name
|
|
19
|
-
* @param {Object} form
|
|
20
|
-
*/
|
|
21
|
-
const ImmutableHelper = {
|
|
22
|
-
/**
|
|
23
|
-
* Parses a regular JSON object into an Immutable data object, mapping the data
|
|
24
|
-
* correctly and applying custom transforms to make the data easier to work with.
|
|
25
|
-
*
|
|
26
|
-
* @method parseJSON
|
|
27
|
-
* @param {Object} js
|
|
28
|
-
*/
|
|
29
|
-
parseJSON: js => {
|
|
30
|
-
if (typeof js !== "object" || js === null) {
|
|
31
|
-
if (typeof js === "number") {
|
|
32
|
-
return String(js);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return js;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (Array.isArray(js)) {
|
|
39
|
-
return _immutable.default.Seq(js).map(ImmutableHelper.parseJSON).toList();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return _immutable.default.Seq(js).map(ImmutableHelper.parseJSON).toMap();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var _default = ImmutableHelper;
|
|
46
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./with-unique-id-props.hoc";
|