carbon-react 111.4.0 → 111.4.2
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__/radio-button-mapper/radio-button-mapper.component.js +1 -0
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -1
- package/esm/components/date/__internal__/date-formats/index.d.ts +3 -1
- package/esm/components/date/date.d.ts +1 -2
- package/esm/components/decimal/decimal.component.d.ts +44 -0
- package/esm/components/decimal/decimal.component.js +535 -93
- package/esm/components/decimal/index.d.ts +2 -1
- package/esm/components/heading/heading.style.d.ts +9 -2
- package/esm/components/menu/menu.d.ts +4 -1
- package/esm/components/multi-action-button/multi-action-button.style.js +2 -1
- package/esm/components/search/search.d.ts +1 -0
- package/esm/components/select/filterable-select/filterable-select.d.ts +2 -2
- package/esm/components/select/multi-select/multi-select.d.ts +2 -2
- package/esm/components/select/select-textbox/select-textbox.d.ts +1 -1
- package/esm/components/select/simple-select/simple-select.d.ts +1 -1
- package/esm/components/tabs/tabs.d.ts +1 -1
- package/esm/components/typography/index.d.ts +4 -2
- package/esm/components/typography/list.component.d.ts +11 -0
- package/esm/components/typography/list.component.js +915 -4
- package/esm/components/typography/typography.component.d.ts +42 -0
- package/esm/components/typography/typography.component.js +13 -50
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.js +1 -0
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -1
- package/lib/components/date/__internal__/date-formats/index.d.ts +3 -1
- package/lib/components/date/date.d.ts +1 -2
- package/lib/components/decimal/decimal.component.d.ts +44 -0
- package/lib/components/decimal/decimal.component.js +536 -97
- package/lib/components/decimal/index.d.ts +2 -1
- package/lib/components/heading/heading.style.d.ts +9 -2
- package/lib/components/menu/menu.d.ts +4 -1
- package/lib/components/multi-action-button/multi-action-button.style.js +2 -1
- package/lib/components/search/search.d.ts +1 -0
- package/lib/components/select/filterable-select/filterable-select.d.ts +2 -2
- package/lib/components/select/multi-select/multi-select.d.ts +2 -2
- package/lib/components/select/select-textbox/select-textbox.d.ts +1 -1
- package/lib/components/select/simple-select/simple-select.d.ts +1 -1
- package/lib/components/tabs/tabs.d.ts +1 -1
- package/lib/components/typography/index.d.ts +4 -2
- package/lib/components/typography/list.component.d.ts +11 -0
- package/lib/components/typography/list.component.js +914 -3
- package/lib/components/typography/typography.component.d.ts +42 -0
- package/lib/components/typography/typography.component.js +14 -52
- package/package.json +2 -1
- package/esm/components/decimal/decimal.d.ts +0 -37
- package/esm/components/typography/list.d.ts +0 -11
- package/esm/components/typography/typography.d.ts +0 -60
- package/lib/components/decimal/decimal.d.ts +0 -37
- package/lib/components/typography/list.d.ts +0 -11
- package/lib/components/typography/typography.d.ts +0 -60
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorProps, SpaceProps } from "styled-system";
|
|
3
|
+
declare const VARIANT_TYPES: readonly ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
|
|
4
|
+
declare type VariantTypes = typeof VARIANT_TYPES[number];
|
|
5
|
+
export interface TypographyProps extends SpaceProps, ColorProps {
|
|
6
|
+
/** Override the variant component */
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
/** The visual style to apply to the component */
|
|
9
|
+
variant?: VariantTypes;
|
|
10
|
+
/** Override the variant font-size */
|
|
11
|
+
fontSize?: string;
|
|
12
|
+
/** Override the variant font-weight */
|
|
13
|
+
fontWeight?: string;
|
|
14
|
+
/** Override the variant line-height */
|
|
15
|
+
lineHeight?: string;
|
|
16
|
+
/** Override the variant text-transform */
|
|
17
|
+
textTransform?: string;
|
|
18
|
+
/** Override the variant text-decoration */
|
|
19
|
+
textDecoration?: string;
|
|
20
|
+
/** Override the variant display */
|
|
21
|
+
display?: string;
|
|
22
|
+
/** Override the list-style-type */
|
|
23
|
+
listStyleType?: string;
|
|
24
|
+
/** Override the white-space type */
|
|
25
|
+
whiteSpace?: string;
|
|
26
|
+
/** Override the word-wrap type */
|
|
27
|
+
wordWrap?: string;
|
|
28
|
+
/** Override the text-overflow type */
|
|
29
|
+
textOverflow?: string;
|
|
30
|
+
/** Apply truncation */
|
|
31
|
+
truncate?: boolean;
|
|
32
|
+
}
|
|
33
|
+
declare const Typography: import("styled-components").StyledComponent<"span", any, {
|
|
34
|
+
as: import("react").ElementType<any> | undefined;
|
|
35
|
+
size: string;
|
|
36
|
+
weight: string;
|
|
37
|
+
textTransform: string;
|
|
38
|
+
textDecoration: string;
|
|
39
|
+
lineHeight: string;
|
|
40
|
+
defaultMargin: string;
|
|
41
|
+
} & TypographyProps, "as" | "textDecoration" | "size" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
|
|
42
|
+
export default Typography;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import styled, { css } from "styled-components";
|
|
3
2
|
import { space } from "styled-system";
|
|
4
|
-
import
|
|
5
|
-
import color from "../../style/utils/color";
|
|
3
|
+
import styledColor from "../../style/utils/color";
|
|
6
4
|
import baseTheme from "../../style/themes/base";
|
|
5
|
+
const VARIANT_TYPES = ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
|
|
7
6
|
|
|
8
7
|
const getAs = variant => {
|
|
9
8
|
switch (variant) {
|
|
@@ -201,58 +200,22 @@ const Typography = styled.span.attrs(({
|
|
|
201
200
|
${listStyleType && `list-style-type: ${listStyleType};`}; ;
|
|
202
201
|
`}
|
|
203
202
|
${space}
|
|
204
|
-
${
|
|
203
|
+
${({
|
|
204
|
+
color,
|
|
205
|
+
bg,
|
|
206
|
+
backgroundColor,
|
|
207
|
+
...rest
|
|
208
|
+
}) => styledColor({
|
|
209
|
+
color,
|
|
210
|
+
bg,
|
|
211
|
+
backgroundColor,
|
|
212
|
+
...rest
|
|
213
|
+
})}
|
|
205
214
|
`;
|
|
206
215
|
Typography.defaultProps = {
|
|
207
216
|
color: "blackOpacity90",
|
|
208
217
|
variant: "p",
|
|
209
218
|
theme: baseTheme
|
|
210
219
|
};
|
|
211
|
-
Typography.propTypes = {
|
|
212
|
-
/** Styled system spacing props */
|
|
213
|
-
...propTypes.space,
|
|
214
|
-
|
|
215
|
-
/** Styled system color props */
|
|
216
|
-
...propTypes.color,
|
|
217
|
-
|
|
218
|
-
/** The visual style to apply to the component */
|
|
219
|
-
variant: PropTypes.oneOf(["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em"]),
|
|
220
|
-
|
|
221
|
-
/** Override the variant component */
|
|
222
|
-
as: PropTypes.string,
|
|
223
|
-
|
|
224
|
-
/** Override the variant font-size */
|
|
225
|
-
fontSize: PropTypes.string,
|
|
226
|
-
|
|
227
|
-
/** Override the variant font-weight */
|
|
228
|
-
fontWeight: PropTypes.string,
|
|
229
|
-
|
|
230
|
-
/** Override the variant line-height */
|
|
231
|
-
lineHeight: PropTypes.string,
|
|
232
|
-
|
|
233
|
-
/** Override the variant text-transform */
|
|
234
|
-
textTransform: PropTypes.string,
|
|
235
|
-
|
|
236
|
-
/** Override the variant text-decoration */
|
|
237
|
-
textDecoration: PropTypes.string,
|
|
238
|
-
|
|
239
|
-
/** Override the variant display */
|
|
240
|
-
display: PropTypes.string,
|
|
241
|
-
|
|
242
|
-
/** Override the list-style-type */
|
|
243
|
-
listStyleType: PropTypes.string,
|
|
244
|
-
|
|
245
|
-
/** Override the white-space type */
|
|
246
|
-
whiteSpace: PropTypes.string,
|
|
247
|
-
|
|
248
|
-
/** Override the word-wrap type */
|
|
249
|
-
wordWrap: PropTypes.string,
|
|
250
|
-
|
|
251
|
-
/** Override the text-overflow type */
|
|
252
|
-
textOverflow: PropTypes.string,
|
|
253
|
-
|
|
254
|
-
/** Apply truncation */
|
|
255
|
-
truncate: PropTypes.bool
|
|
256
|
-
};
|
|
257
220
|
Typography.displayName = "Typography";
|
|
258
221
|
export default Typography;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Locale as DateFnsLocale } from "date-fns";
|
|
2
|
+
|
|
1
3
|
interface LocaleFormats {
|
|
2
4
|
formats: string[];
|
|
3
5
|
format: string;
|
|
4
6
|
}
|
|
5
7
|
|
|
6
|
-
declare function getFormatData(
|
|
8
|
+
declare function getFormatData(locale: DateFnsLocale): LocaleFormats;
|
|
7
9
|
|
|
8
10
|
export default getFormatData;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonTextboxProps } from "../textbox";
|
|
3
|
+
export interface CustomEvent {
|
|
4
|
+
target: {
|
|
5
|
+
name?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
value: {
|
|
8
|
+
formattedValue: string;
|
|
9
|
+
rawValue: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface DecimalProps extends Omit<CommonTextboxProps, "onChange" | "onBlur"> {
|
|
14
|
+
/** Text alignment of the label */
|
|
15
|
+
align?: "left" | "right";
|
|
16
|
+
/** Allow an empty value instead of defaulting to 0.00 */
|
|
17
|
+
allowEmptyValue?: boolean;
|
|
18
|
+
/** The default value of the input if it's meant to be used as an uncontrolled component */
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
/** The input id */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** The width of the input as a percentage */
|
|
23
|
+
inputWidth?: number;
|
|
24
|
+
/** Handler for change event if input is meant to be used as a controlled component */
|
|
25
|
+
onChange?: (ev: CustomEvent) => void;
|
|
26
|
+
/** Handler for blur event */
|
|
27
|
+
onBlur?: (ev: CustomEvent) => void;
|
|
28
|
+
/** Handler for key press event */
|
|
29
|
+
onKeyPress?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
30
|
+
/** The input name */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** The decimal precision of the value in the input */
|
|
33
|
+
precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
34
|
+
/** If true, the component will be read-only */
|
|
35
|
+
readOnly?: boolean;
|
|
36
|
+
/** Flag to configure component as mandatory */
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/** The value of the input if it's used as a controlled component */
|
|
39
|
+
value?: string;
|
|
40
|
+
/** The locale string - default en */
|
|
41
|
+
locale?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare const Decimal: ({ align, defaultValue, precision, inputWidth, readOnly, onChange, onBlur, onKeyPress, id, name, allowEmptyValue, required, locale, value, ...rest }: DecimalProps) => JSX.Element;
|
|
44
|
+
export default Decimal;
|