@equinor/eds-core-react 1.0.2 → 2.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.
Files changed (57) hide show
  1. package/README.md +16 -1
  2. package/dist/eds-core-react.cjs +421 -136
  3. package/dist/esm/components/Accordion/Accordion.js +4 -3
  4. package/dist/esm/components/Autocomplete/Autocomplete.js +90 -23
  5. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -1
  6. package/dist/esm/components/Button/tokens/contained.js +1 -1
  7. package/dist/esm/components/Button/tokens/contained_icon.js +1 -1
  8. package/dist/esm/components/Button/tokens/ghost.js +1 -1
  9. package/dist/esm/components/Button/tokens/icon.js +1 -1
  10. package/dist/esm/components/Button/tokens/outlined.js +1 -1
  11. package/dist/esm/components/Datepicker/fields/FieldWrapper.js +8 -2
  12. package/dist/esm/components/Icon/Icon.js +2 -3
  13. package/dist/esm/components/Input/Input.tokens.js +1 -1
  14. package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +1 -1
  15. package/dist/esm/components/InputWrapper/useInputField.js +61 -0
  16. package/dist/esm/components/SideBar/SideBarAccordion/index.js +4 -3
  17. package/dist/esm/components/Slider/Slider.js +8 -5
  18. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +1 -1
  19. package/dist/esm/components/Tabs/Tabs.js +4 -3
  20. package/dist/esm/components/TextField/TextField.js +23 -56
  21. package/dist/esm/components/Textarea/Textarea.js +64 -33
  22. package/dist/esm/components/Typography/Heading.js +51 -0
  23. package/dist/esm/components/Typography/Paragraph.js +28 -0
  24. package/dist/esm/components/Typography/Typography.js +15 -1
  25. package/dist/esm/components/Typography/Typography.new.js +67 -0
  26. package/dist/esm/index.js +5 -0
  27. package/dist/types/components/Button/tokens/contained.d.ts +3 -4
  28. package/dist/types/components/Button/tokens/outlined.d.ts +3 -4
  29. package/dist/types/components/InputWrapper/index.d.ts +3 -0
  30. package/dist/types/components/InputWrapper/types.d.ts +21 -0
  31. package/dist/types/components/InputWrapper/useInputField.d.ts +31 -0
  32. package/dist/types/components/TextField/TextField.d.ts +5 -25
  33. package/dist/types/components/Textarea/Textarea.d.ts +6 -27
  34. package/dist/types/components/Typography/Heading.d.ts +7 -0
  35. package/dist/types/components/Typography/Heading.types.d.ts +6 -0
  36. package/dist/types/components/Typography/Paragraph.d.ts +7 -0
  37. package/dist/types/components/Typography/Paragraph.types.d.ts +7 -0
  38. package/dist/types/components/Typography/Typography.d.ts +13 -0
  39. package/dist/types/components/Typography/Typography.new.d.ts +43 -0
  40. package/dist/types/components/Typography/Typography.new.types.d.ts +28 -0
  41. package/dist/types/components/Typography/Typography.stories.shared.d.ts +79 -0
  42. package/dist/types/components/Typography/index.d.ts +7 -0
  43. package/dist/types/components/Typography/types.d.ts +9 -0
  44. package/dist/types/components/Typography/utils.d.ts +15 -0
  45. package/dist/types/index.d.ts +1 -0
  46. package/package.json +56 -40
  47. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry1.js +0 -0
  48. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry2.js +0 -0
  49. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry3.js +0 -0
  50. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_has.js +0 -0
  51. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_isObject.js +0 -0
  52. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_isPlaceholder.js +0 -0
  53. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeDeepRight.js +0 -0
  54. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeDeepWithKey.js +0 -0
  55. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeWith.js +0 -0
  56. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeWithKey.js +0 -0
  57. /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/pickBy.js +0 -0
@@ -1,22 +1,58 @@
1
- import { forwardRef, useState, useCallback } from 'react';
1
+ import { forwardRef, useMemo } from 'react';
2
2
  import * as Input_tokens from '../Input/Input.tokens.js';
3
3
  import { input as input$1 } from '../Input/Input.tokens.js';
4
4
  import { useAutoResize, mergeRefs } from '@equinor/eds-utils';
5
5
  import { jsx } from 'react/jsx-runtime';
6
- import { Input } from '../Input/Input.js';
6
+ import { useInputField } from '../InputWrapper/useInputField.js';
7
+ import { InputWrapper } from '../InputWrapper/InputWrapper.js';
7
8
  import { useEds } from '../EdsProvider/eds.context.js';
9
+ import { Input } from '../Input/Input.js';
8
10
 
9
11
  const {
10
12
  input
11
13
  } = Input_tokens;
14
+ const leftAdornmentStyles = {
15
+ style: {
16
+ alignItems: 'flex-start'
17
+ }
18
+ };
19
+ const rightAdornmentStyles = {
20
+ style: {
21
+ alignItems: 'flex-start',
22
+ pointerEvents: 'none'
23
+ }
24
+ };
12
25
  const Textarea = /*#__PURE__*/forwardRef(function Textarea({
26
+ id,
27
+ label,
28
+ meta,
29
+ helperText,
30
+ placeholder,
31
+ disabled,
32
+ className,
13
33
  variant,
14
- disabled = false,
15
- type = 'text',
34
+ inputIcon,
35
+ helperIcon,
36
+ style,
16
37
  rowsMax,
17
38
  ...other
18
39
  }, ref) {
19
- const [textareaEl, setTextareaEl] = useState(null);
40
+ const {
41
+ ariaProps,
42
+ containerProps,
43
+ labelProps,
44
+ helperProps
45
+ } = useInputField({
46
+ id,
47
+ label,
48
+ meta,
49
+ helperText,
50
+ helperIcon,
51
+ variant,
52
+ disabled,
53
+ className,
54
+ style
55
+ });
20
56
  const {
21
57
  density
22
58
  } = useEds();
@@ -28,40 +64,35 @@ const Textarea = /*#__PURE__*/forwardRef(function Textarea({
28
64
  top,
29
65
  bottom
30
66
  } = spacings;
31
- let fontSize = 16;
32
- if (textareaEl) {
33
- fontSize = parseInt(window.getComputedStyle(textareaEl).fontSize);
34
- }
35
- const padding = parseInt(top) + parseInt(bottom);
36
- const maxHeight = parseFloat(lineHeight) * fontSize * rowsMax + padding;
37
- useAutoResize(textareaEl, rowsMax ? maxHeight : null);
38
- const combinedRef = useCallback(() => mergeRefs(ref, setTextareaEl), [setTextareaEl, ref])();
39
- const inputProps = {
40
- ref: combinedRef,
41
- type,
67
+
68
+ // Calculate maxHeight if rowsMax is provided
69
+ // Using default fontSize of 16px for initial calculation
70
+ // useAutoResize will handle actual resizing based on element's scrollHeight
71
+ const maxHeight = rowsMax ? parseFloat(lineHeight) * 16 * rowsMax + parseInt(top) + parseInt(bottom) : null;
72
+ const autoResizeRef = useAutoResize(maxHeight);
73
+ const combinedRef = useMemo(() => mergeRefs(ref, autoResizeRef), [ref, autoResizeRef]);
74
+ const fieldProps = {
75
+ ...ariaProps,
42
76
  disabled,
77
+ placeholder,
43
78
  variant,
44
- ...other
45
- };
46
- const leftAdornmentStyles = {
47
- style: {
48
- alignItems: 'flex-start'
49
- }
50
- };
51
- const rigthAdornmentStyles = {
52
- style: {
53
- alignItems: 'flex-start',
54
- pointerEvents: 'none'
55
- }
56
- };
57
- return /*#__PURE__*/jsx(Input, {
58
- as: "textarea",
59
- rightAdornmentsProps: rigthAdornmentStyles,
79
+ rightAdornments: inputIcon,
80
+ rightAdornmentsProps: rightAdornmentStyles,
60
81
  leftAdornmentsProps: leftAdornmentStyles,
82
+ as: 'textarea',
83
+ ref: combinedRef,
61
84
  style: {
62
85
  height: 'auto'
63
86
  },
64
- ...inputProps
87
+ ...other
88
+ };
89
+ return /*#__PURE__*/jsx(InputWrapper, {
90
+ helperProps: helperProps,
91
+ labelProps: labelProps,
92
+ ...containerProps,
93
+ children: /*#__PURE__*/jsx(Input, {
94
+ ...fieldProps
95
+ })
65
96
  });
66
97
  });
67
98
 
@@ -0,0 +1,51 @@
1
+ import { forwardRef } from 'react';
2
+ import { TypographyNext } from './Typography.new.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const getHeadingSize = as => {
6
+ switch (as) {
7
+ case 'h1':
8
+ return '6xl';
9
+ case 'h2':
10
+ return '5xl';
11
+ case 'h3':
12
+ return '4xl';
13
+ case 'h4':
14
+ return '3xl';
15
+ case 'h5':
16
+ return '2xl';
17
+ case 'h6':
18
+ return 'xl';
19
+ default:
20
+ return '6xl';
21
+ }
22
+ };
23
+
24
+ /**
25
+ * Heading component for semantic headings (h1-h6).
26
+ * Uses the design system's typography styles for headings.
27
+ */
28
+ const Heading = /*#__PURE__*/forwardRef(({
29
+ lineHeight = 'squished',
30
+ weight = 'normal',
31
+ tracking = 'normal',
32
+ debug,
33
+ as,
34
+ ...rest
35
+ }, ref) => {
36
+ return /*#__PURE__*/jsx(TypographyNext, {
37
+ ref: ref,
38
+ as: as,
39
+ family: "header",
40
+ baseline: "grid",
41
+ size: getHeadingSize(as),
42
+ lineHeight: lineHeight,
43
+ weight: weight,
44
+ tracking: tracking,
45
+ debug: debug,
46
+ ...rest
47
+ });
48
+ });
49
+ Heading.displayName = 'Heading';
50
+
51
+ export { Heading };
@@ -0,0 +1,28 @@
1
+ import { forwardRef } from 'react';
2
+ import { TypographyNext } from './Typography.new.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const Paragraph = /*#__PURE__*/forwardRef(({
6
+ size = 'lg',
7
+ lineHeight = 'default',
8
+ weight = 'normal',
9
+ tracking = 'normal',
10
+ debug,
11
+ ...rest
12
+ }, ref) => {
13
+ return /*#__PURE__*/jsx(TypographyNext, {
14
+ ref: ref,
15
+ as: "p",
16
+ family: "ui",
17
+ baseline: "grid",
18
+ size: size,
19
+ lineHeight: lineHeight,
20
+ weight: weight,
21
+ tracking: tracking,
22
+ debug: debug,
23
+ ...rest
24
+ });
25
+ });
26
+ Paragraph.displayName = 'Paragraph';
27
+
28
+ export { Paragraph };
@@ -1,6 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
3
+ import { useDeprecationWarning, typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
4
4
  import { quickVariants, typography, colors, link } from './Typography.tokens.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
@@ -53,6 +53,19 @@ const StyledTypography = styled.p.withConfig({
53
53
  }) => $lines && css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
54
54
  $link
55
55
  }) => $link && css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], outlineTemplate(link.states.focus.outline), outlineTemplate(link.states.focus.outline)));
56
+ /**
57
+ * @deprecated Typography component is deprecated and will be removed in a future version.
58
+ * Please use the new Typography, Heading, or Paragraph components instead.
59
+ *
60
+ * Migration guide:
61
+ * - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
62
+ * - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
63
+ * - For inline text: Use `<Typography>` for more flexible text styling
64
+ *
65
+ * @see {@link TypographyNext}
66
+ * @see {@link Heading}
67
+ * @see {@link Paragraph}
68
+ */
56
69
  const Typography = /*#__PURE__*/forwardRef(function Typography({
57
70
  variant = 'body_short',
58
71
  children,
@@ -66,6 +79,7 @@ const Typography = /*#__PURE__*/forwardRef(function Typography({
66
79
  as: providedAs,
67
80
  ...other
68
81
  }, ref) {
82
+ useDeprecationWarning('The Typography component is deprecated and will be removed in a future version. ' + 'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' + 'See the documentation for migration details.', 'Typography');
69
83
  const as = providedAs ? providedAs : getElementType(variant, link);
70
84
  const variantName = toVariantName(variant, bold, italic, link);
71
85
  const typography = findTypography(variantName, group);
@@ -0,0 +1,67 @@
1
+ import { forwardRef } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ /**
5
+ * TypographyNext component for flexible typography with baseline grid support.
6
+ *
7
+ * Provides full control over typography properties including family, size,
8
+ * lineHeight, baseline alignment, weight, and tracking.
9
+ *
10
+ * **Display behavior:** Elements render as `display: block` by default for
11
+ * text-box trimming and baseline grid alignment. Override with CSS if needed.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { TypographyNext as Typography } from '@equinor/eds-core-react'
16
+ *
17
+ * <Typography
18
+ * family="ui"
19
+ * size="md"
20
+ * lineHeight="default"
21
+ * baseline="grid"
22
+ * weight="normal"
23
+ * tracking="normal"
24
+ * >
25
+ * Text content (renders as block-level by default)
26
+ * </Typography>
27
+ *
28
+ * <Typography
29
+ * as="h1"
30
+ * family="header"
31
+ * size="3xl"
32
+ * lineHeight="squished"
33
+ * baseline="grid"
34
+ * weight="bolder"
35
+ * tracking="tight"
36
+ * >
37
+ * Page heading
38
+ * </Typography>
39
+ * ```
40
+ */
41
+ const TypographyNext = /*#__PURE__*/forwardRef(({
42
+ as = 'span',
43
+ family,
44
+ size,
45
+ baseline,
46
+ lineHeight,
47
+ weight,
48
+ tracking,
49
+ debug,
50
+ ...rest
51
+ }, ref) => {
52
+ const Component = as;
53
+ return /*#__PURE__*/jsx(Component, {
54
+ ref: ref,
55
+ "data-font-family": family,
56
+ "data-text-size": size,
57
+ "data-baseline": baseline || undefined,
58
+ "data-line-height": lineHeight || undefined,
59
+ "data-font-weight": weight || undefined,
60
+ "data-tracking": tracking || undefined,
61
+ "data-debug": debug ? '' : undefined,
62
+ ...rest
63
+ });
64
+ });
65
+ TypographyNext.displayName = 'TypographyNext';
66
+
67
+ export { TypographyNext };
package/dist/esm/index.js CHANGED
@@ -18,6 +18,9 @@ export { Menu } from './components/Menu/index.js';
18
18
  export { SideBar } from './components/SideBar/index.js';
19
19
  export { ButtonGroup } from './components/Button/ButtonGroup/ButtonGroup.js';
20
20
  export { ToggleButton } from './components/Button/ToggleButton/ToggleButton.js';
21
+ export { TypographyNext } from './components/Typography/Typography.new.js';
22
+ export { Heading } from './components/Typography/Heading.js';
23
+ export { Paragraph } from './components/Typography/Paragraph.js';
21
24
  export { Typography } from './components/Typography/Typography.js';
22
25
  export { Body as TableBody } from './components/Table/Body.js';
23
26
  export { Cell as TableCell } from './components/Table/Cell.js';
@@ -27,6 +30,7 @@ export { Row as TableRow } from './components/Table/Row/Row.js';
27
30
  export { Caption as TableCaption } from './components/Table/Caption.js';
28
31
  export { Divider } from './components/Divider/Divider.js';
29
32
  export { TextField } from './components/TextField/TextField.js';
33
+ export { Textarea } from './components/Textarea/Textarea.js';
30
34
  export { ListItem } from './components/List/ListItem.js';
31
35
  export { AccordionItem } from './components/Accordion/AccordionItem.js';
32
36
  export { AccordionHeader } from './components/Accordion/AccordionHeader.js';
@@ -83,6 +87,7 @@ export { EdsProvider, useEds } from './components/EdsProvider/eds.context.js';
83
87
  export { Paper } from './components/Paper/Paper.js';
84
88
  export { Autocomplete } from './components/Autocomplete/Autocomplete.js';
85
89
  export { InputWrapper } from './components/InputWrapper/InputWrapper.js';
90
+ export { useInputField } from './components/InputWrapper/useInputField.js';
86
91
  export { useSideBar } from './components/SideBar/SideBar.context.js';
87
92
  export { SidebarLink } from './components/SideBar/SidebarLink/index.js';
88
93
  export { SideBarContent } from './components/SideBar/SideBarContent.js';
@@ -1,4 +1,3 @@
1
- import { ButtonToken } from '../Button.types';
2
- export declare const primary: ButtonToken;
3
- export declare const secondary: ButtonToken;
4
- export declare const danger: ButtonToken;
1
+ export declare const primary: import("../Button.types").ButtonToken;
2
+ export declare const secondary: import("../Button.types").ButtonToken;
3
+ export declare const danger: import("../Button.types").ButtonToken;
@@ -1,4 +1,3 @@
1
- import { ButtonToken } from '../Button.types';
2
- export declare const primary: ButtonToken;
3
- export declare const secondary: ButtonToken;
4
- export declare const danger: ButtonToken;
1
+ export declare const primary: import("../Button.types").ButtonToken;
2
+ export declare const secondary: import("../Button.types").ButtonToken;
3
+ export declare const danger: import("../Button.types").ButtonToken;
@@ -1,2 +1,5 @@
1
1
  export { InputWrapper } from './InputWrapper';
2
2
  export type { InputWrapperProps } from './InputWrapper';
3
+ export { useInputField } from './useInputField';
4
+ export type { InputFieldConfig, UseInputFieldReturn } from './useInputField';
5
+ export type { BaseInputFieldProps } from './types';
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import type { Variants } from '../types';
3
+ /**
4
+ * Base props shared by all input field components (TextField, Textarea, etc.)
5
+ */
6
+ export type BaseInputFieldProps = {
7
+ /** Variants */
8
+ variant?: Variants;
9
+ /** Input unique id. If this is not provided, one will be generated */
10
+ id?: string;
11
+ /** Label text */
12
+ label?: ReactNode;
13
+ /** Meta text */
14
+ meta?: ReactNode;
15
+ /** Helper text */
16
+ helperText?: string;
17
+ /** InputIcon */
18
+ inputIcon?: ReactNode;
19
+ /** HelperIcon */
20
+ helperIcon?: ReactNode;
21
+ };
@@ -0,0 +1,31 @@
1
+ import type { LabelProps } from '../Label/Label';
2
+ import type { HelperTextProps } from './HelperText/HelperText';
3
+ import type { BaseInputFieldProps } from './types';
4
+ import type { Variants } from '../types';
5
+ export type InputFieldConfig = BaseInputFieldProps & {
6
+ disabled?: boolean;
7
+ placeholder?: string;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ };
11
+ export type UseInputFieldReturn = {
12
+ fieldId: string;
13
+ helperTextId: string | null;
14
+ containerProps: {
15
+ className?: string;
16
+ style: React.CSSProperties;
17
+ color?: Variants;
18
+ };
19
+ labelProps: LabelProps;
20
+ helperProps: HelperTextProps;
21
+ ariaProps: {
22
+ id: string;
23
+ 'aria-invalid'?: boolean;
24
+ 'aria-describedby'?: string;
25
+ };
26
+ };
27
+ /**
28
+ * Shared hook for TextField and Textarea that handles common logic
29
+ * for IDs, labels, helper text, and ARIA attributes
30
+ */
31
+ export declare const useInputField: ({ id, label, meta, helperText, helperIcon, variant, disabled, className, style, }: InputFieldConfig) => UseInputFieldReturn;
@@ -1,31 +1,11 @@
1
- import { ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, ForwardedRef } from 'react';
2
- import type { Variants } from '../types';
3
- type SharedTextFieldProps = {
4
- /** Variants */
5
- variant?: Variants;
6
- /** Input unique id. If this is not provided, one will be generated */
7
- id?: string;
8
- /** Label text */
9
- label?: ReactNode;
10
- /** Meta text */
11
- meta?: ReactNode;
1
+ import { InputHTMLAttributes, ForwardedRef } from 'react';
2
+ import { BaseInputFieldProps } from '../InputWrapper';
3
+ type TextFieldSpecificProps = {
12
4
  /** Unit text */
13
5
  unit?: string;
14
- /** Helper text */
15
- helperText?: string;
16
- /** InputIcon */
17
- inputIcon?: ReactNode;
18
- /** HelperIcon */
19
- helperIcon?: ReactNode;
20
- /** Maximum number of rows if `multiline` is set to `true` */
21
- rowsMax?: number;
22
6
  /** Input ref */
23
7
  inputRef?: ForwardedRef<HTMLInputElement>;
24
- /** Textarea ref when multiline is set to `true` */
25
- textareaRef?: ForwardedRef<HTMLTextAreaElement>;
26
- /** If `true` a `textarea` is rendered for multiline support. Make sure to use `textareaRef` if you need to access reference element */
27
- multiline?: boolean;
28
8
  };
29
- export type TextFieldProps = SharedTextFieldProps & (TextareaHTMLAttributes<HTMLTextAreaElement> | InputHTMLAttributes<HTMLInputElement>);
30
- export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
9
+ export type TextFieldProps = BaseInputFieldProps & TextFieldSpecificProps & InputHTMLAttributes<HTMLInputElement>;
10
+ export declare const TextField: import("react").ForwardRefExoticComponent<BaseInputFieldProps & TextFieldSpecificProps & InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
31
11
  export {};
@@ -1,30 +1,9 @@
1
1
  import { TextareaHTMLAttributes } from 'react';
2
- import type { Variants } from '../types';
3
- export type TextareaProps = {
4
- /** Placeholder */
5
- placeholder?: string;
6
- /** Variant */
7
- variant?: Variants;
8
- /** Disabled state */
9
- disabled?: boolean;
10
- /** Type */
11
- type?: string;
12
- /** Read Only */
13
- readOnly?: boolean;
2
+ import { BaseInputFieldProps } from '../InputWrapper';
3
+ type TextareaSpecificProps = {
14
4
  /** Specifies max rows for multiline */
15
5
  rowsMax?: number;
16
- } & TextareaHTMLAttributes<HTMLTextAreaElement>;
17
- export declare const Textarea: import("react").ForwardRefExoticComponent<{
18
- /** Placeholder */
19
- placeholder?: string;
20
- /** Variant */
21
- variant?: Variants;
22
- /** Disabled state */
23
- disabled?: boolean;
24
- /** Type */
25
- type?: string;
26
- /** Read Only */
27
- readOnly?: boolean;
28
- /** Specifies max rows for multiline */
29
- rowsMax?: number;
30
- } & TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
6
+ };
7
+ export type TextareaProps = BaseInputFieldProps & TextareaSpecificProps & TextareaHTMLAttributes<HTMLTextAreaElement>;
8
+ export declare const Textarea: import("react").ForwardRefExoticComponent<BaseInputFieldProps & TextareaSpecificProps & TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Heading component for semantic headings (h1-h6).
3
+ * Uses the design system's typography styles for headings.
4
+ */
5
+ export declare const Heading: import("react").ForwardRefExoticComponent<{
6
+ as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
7
+ } & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLHeadingElement>>;
@@ -0,0 +1,6 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { BaseTypographyProps } from './Typography.new.types';
3
+ export type HeadingProps = {
4
+ /** HTML heading element to render */
5
+ as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
6
+ } & BaseTypographyProps & HTMLAttributes<HTMLHeadingElement>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Paragraph component for rendering text paragraphs.
3
+ * Uses the design system's typography styles for UI text.
4
+ */
5
+ export declare const Paragraph: import("react").ForwardRefExoticComponent<{
6
+ size?: import("./types").FontSize;
7
+ } & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { FontSize } from './types';
3
+ import { BaseTypographyProps } from './Typography.new.types';
4
+ export type ParagraphProps = {
5
+ /** Size of the text */
6
+ size?: FontSize;
7
+ } & BaseTypographyProps & HTMLAttributes<HTMLParagraphElement>;
@@ -20,4 +20,17 @@ export type TypographyProps = {
20
20
  /** Number of lines. */
21
21
  lines?: number;
22
22
  } & (HTMLAttributes<HTMLElement> | AnchorHTMLAttributes<HTMLAnchorElement>);
23
+ /**
24
+ * @deprecated Typography component is deprecated and will be removed in a future version.
25
+ * Please use the new Typography, Heading, or Paragraph components instead.
26
+ *
27
+ * Migration guide:
28
+ * - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
29
+ * - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
30
+ * - For inline text: Use `<Typography>` for more flexible text styling
31
+ *
32
+ * @see {@link TypographyNext}
33
+ * @see {@link Heading}
34
+ * @see {@link Paragraph}
35
+ */
23
36
  export declare const Typography: OverridableComponent<TypographyProps, HTMLElement>;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * TypographyNext component for flexible typography with baseline grid support.
3
+ *
4
+ * Provides full control over typography properties including family, size,
5
+ * lineHeight, baseline alignment, weight, and tracking.
6
+ *
7
+ * **Display behavior:** Elements render as `display: block` by default for
8
+ * text-box trimming and baseline grid alignment. Override with CSS if needed.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { TypographyNext as Typography } from '@equinor/eds-core-react'
13
+ *
14
+ * <Typography
15
+ * family="ui"
16
+ * size="md"
17
+ * lineHeight="default"
18
+ * baseline="grid"
19
+ * weight="normal"
20
+ * tracking="normal"
21
+ * >
22
+ * Text content (renders as block-level by default)
23
+ * </Typography>
24
+ *
25
+ * <Typography
26
+ * as="h1"
27
+ * family="header"
28
+ * size="3xl"
29
+ * lineHeight="squished"
30
+ * baseline="grid"
31
+ * weight="bolder"
32
+ * tracking="tight"
33
+ * >
34
+ * Page heading
35
+ * </Typography>
36
+ * ```
37
+ */
38
+ export declare const TypographyNext: import("react").ForwardRefExoticComponent<{
39
+ family: import("./types").FontFamily;
40
+ size: import("./types").FontSize;
41
+ baseline: import("./types").BaselineAlignment;
42
+ as?: import("react").ElementType;
43
+ } & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,28 @@
1
+ import { HTMLAttributes, ElementType } from 'react';
2
+ import { FontFamily, FontSize, LineHeight, BaselineAlignment, FontWeight, Tracking } from './types';
3
+ /**
4
+ * Base typography props shared across typography components.
5
+ * Can be extended for specific typography component needs.
6
+ */
7
+ export type BaseTypographyProps = {
8
+ /** Line height variant */
9
+ lineHeight?: LineHeight;
10
+ /** Font weight */
11
+ weight?: FontWeight;
12
+ /** Letter spacing (tracking) */
13
+ tracking?: Tracking;
14
+ /** Enable debug mode to visualize text box */
15
+ debug?: boolean;
16
+ /** Children to render */
17
+ children?: React.ReactNode;
18
+ };
19
+ export type TypographyNextProps = {
20
+ /** Font family */
21
+ family: FontFamily;
22
+ /** Size of the text */
23
+ size: FontSize;
24
+ /** Baseline alignment strategy */
25
+ baseline: BaselineAlignment;
26
+ /** Semantic HTML element to render. Defaults to 'span' */
27
+ as?: ElementType;
28
+ } & BaseTypographyProps & HTMLAttributes<HTMLElement>;