@equinor/eds-core-react 2.3.0 → 2.3.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.
Files changed (62) hide show
  1. package/README.md +3 -0
  2. package/build/index.css +1252 -0
  3. package/build/index.min.css +5 -0
  4. package/dist/eds-core-react.cjs +2 -2
  5. package/dist/esm/components/Autocomplete/SingleInput.js +2 -2
  6. package/dist/esm/components/EdsProvider/eds.context.js +3 -31
  7. package/dist/esm/components/next/Button/Button.js +53 -0
  8. package/dist/esm/components/next/Checkbox/Checkbox.js +85 -0
  9. package/dist/esm/components/next/Field/Field.Description.js +25 -0
  10. package/dist/esm/components/next/Field/Field.HelperMessage.js +45 -0
  11. package/dist/esm/components/next/Field/Field.Label.js +31 -0
  12. package/dist/esm/components/next/Field/Field.js +29 -0
  13. package/dist/esm/components/next/Field/useFieldIds.js +57 -0
  14. package/dist/esm/components/next/Icon/Icon.js +0 -1
  15. package/dist/esm/components/next/Input/Input.js +92 -0
  16. package/dist/esm/components/next/Radio/Radio.js +63 -0
  17. package/dist/esm/components/next/Switch/Switch.js +64 -0
  18. package/dist/esm/components/next/TextField/TextField.js +69 -0
  19. package/dist/esm/index.next.js +8 -1
  20. package/dist/index.next.cjs +825 -39
  21. package/dist/types/components/Autocomplete/Autocomplete.d.ts +2 -2
  22. package/dist/types/components/Autocomplete/AutocompleteContext.d.ts +2 -2
  23. package/dist/types/components/Autocomplete/useAutocomplete.d.ts +1 -1
  24. package/dist/types/components/Datepicker/DateRangePicker.d.ts +1 -1
  25. package/dist/types/components/SideBar/SideBarButton/index.d.ts +1 -1
  26. package/dist/types/components/next/Button/Button.d.ts +8 -0
  27. package/dist/types/components/next/Button/Button.figma.d.ts +1 -0
  28. package/dist/types/components/next/Button/Button.types.d.ts +80 -0
  29. package/dist/types/components/next/Button/index.d.ts +2 -0
  30. package/dist/types/components/next/Checkbox/Checkbox.d.ts +7 -0
  31. package/dist/types/components/next/Checkbox/Checkbox.figma.d.ts +1 -0
  32. package/dist/types/components/next/Checkbox/Checkbox.types.d.ts +15 -0
  33. package/dist/types/components/next/Checkbox/index.d.ts +2 -0
  34. package/dist/types/components/next/Field/Field.Description.d.ts +3 -0
  35. package/dist/types/components/next/Field/Field.HelperMessage.d.ts +19 -0
  36. package/dist/types/components/next/Field/Field.HelperMessage.types.d.ts +12 -0
  37. package/dist/types/components/next/Field/Field.Label.d.ts +4 -0
  38. package/dist/types/components/next/Field/Field.d.ts +15 -0
  39. package/dist/types/components/next/Field/Field.types.d.ts +25 -0
  40. package/dist/types/components/next/Field/index.d.ts +5 -0
  41. package/dist/types/components/next/Field/useFieldIds.d.ts +59 -0
  42. package/dist/types/components/next/Input/Input.d.ts +3 -0
  43. package/dist/types/components/next/Input/Input.types.d.ts +17 -0
  44. package/dist/types/components/next/Input/index.d.ts +2 -0
  45. package/dist/types/components/next/Placeholder/Placeholder.d.ts +4 -6
  46. package/dist/types/components/next/Placeholder/index.d.ts +0 -1
  47. package/dist/types/components/next/Radio/Radio.d.ts +3 -0
  48. package/dist/types/components/next/Radio/Radio.figma.d.ts +1 -0
  49. package/dist/types/components/next/Radio/Radio.types.d.ts +5 -0
  50. package/dist/types/components/next/Radio/index.d.ts +2 -0
  51. package/dist/types/components/next/Switch/Switch.d.ts +3 -0
  52. package/dist/types/components/next/Switch/Switch.types.d.ts +7 -0
  53. package/dist/types/components/next/Switch/index.d.ts +2 -0
  54. package/dist/types/components/next/TextField/TextField.d.ts +17 -0
  55. package/dist/types/components/next/TextField/TextField.types.d.ts +16 -0
  56. package/dist/types/components/next/TextField/index.d.ts +2 -0
  57. package/dist/types/components/next/index.d.ts +14 -2
  58. package/dist/types/index.next.d.ts +3 -0
  59. package/package.json +5 -9
  60. package/dist/esm/components/next/Icon/icon.css.js +0 -6
  61. package/dist/esm/components/next/Placeholder/Placeholder.js +0 -17
  62. package/dist/esm/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +0 -26
@@ -6,12 +6,12 @@ export declare const StyledButton: import("styled-components/dist/types").IStyle
6
6
  as?: import("react").ElementType;
7
7
  } & {
8
8
  color?: "primary" | "secondary" | "danger";
9
- variant?: "contained" | "contained_icon" | "outlined" | "ghost" | "ghost_icon";
9
+ variant?: "ghost" | "contained" | "contained_icon" | "outlined" | "ghost_icon";
10
10
  href?: string;
11
11
  disabled?: boolean;
12
12
  type?: string;
13
13
  fullWidth?: boolean;
14
- } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, "href" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "variant" | "fullWidth">, never>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("../Button").ButtonProps, HTMLButtonElement> & {
14
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, "variant" | "href" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "fullWidth">, never>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("../Button").ButtonProps, HTMLButtonElement> & {
15
15
  Group: typeof import("../Button").ButtonGroup;
16
16
  Toggle: typeof import("../Button").ToggleButton;
17
17
  }, keyof import("react").Component<any, {}, any>>;
@@ -94,7 +94,7 @@ export declare const AutocompleteContext: import("react").Context<{
94
94
  optionLabel?: (option: unknown) => string;
95
95
  } & {
96
96
  ref?: React.Ref<HTMLInputElement>;
97
- }, "ref" | "className" | "style" | "disabled" | "label" | "meta" | "multiple" | "variant" | "options" | "placeholder" | "readOnly" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
97
+ }, "meta" | "label" | "disabled" | "style" | "ref" | "className" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
98
98
  highlightedIndex: number;
99
99
  selectedItem: unknown;
100
100
  isOpen: boolean;
@@ -208,7 +208,7 @@ export declare const useAutocompleteContext: () => {
208
208
  optionLabel?: (option: unknown) => string;
209
209
  } & {
210
210
  ref?: React.Ref<HTMLInputElement>;
211
- }, "ref" | "className" | "style" | "disabled" | "label" | "meta" | "multiple" | "variant" | "options" | "placeholder" | "readOnly" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
211
+ }, "meta" | "label" | "disabled" | "style" | "ref" | "className" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
212
212
  highlightedIndex: number;
213
213
  selectedItem: unknown;
214
214
  isOpen: boolean;
@@ -102,7 +102,7 @@ export declare const useAutocomplete: <T>({ options, totalOptions, label, meta,
102
102
  optionLabel?: (option: T) => string;
103
103
  }) & {
104
104
  ref?: React.Ref<HTMLInputElement>;
105
- }, "ref" | "className" | "style" | "disabled" | "label" | "meta" | "multiple" | "variant" | "options" | "placeholder" | "readOnly" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
105
+ }, "meta" | "label" | "disabled" | "style" | "ref" | "className" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
106
106
  highlightedIndex: number;
107
107
  selectedItem: T;
108
108
  isOpen: boolean;
@@ -2,7 +2,7 @@
2
2
  * DateRangePicker component encapsulates the logic for selecting a range of dates
3
3
  * Either by accessible input fields or by a calendar.
4
4
  */
5
- export declare const DateRangePicker: import("react").ForwardRefExoticComponent<Omit<import("./props").DatePickerProps, "onChange" | "defaultValue" | "value" | "multiple" | "showTimeInput" | "stateRef"> & Partial<{
5
+ export declare const DateRangePicker: import("react").ForwardRefExoticComponent<Omit<import("./props").DatePickerProps, "defaultValue" | "onChange" | "multiple" | "value" | "showTimeInput" | "stateRef"> & Partial<{
6
6
  onChange: (range: {
7
7
  from: Date | null;
8
8
  to: Date | null;
@@ -7,4 +7,4 @@ export type SideBarButtonProps = {
7
7
  export declare const SideBarButton: import("react").ForwardRefExoticComponent<{
8
8
  label: string;
9
9
  icon: IconData;
10
- } & Omit<ButtonProps, "type" | "href" | "variant" | "fullWidth"> & import("react").RefAttributes<HTMLButtonElement>>;
10
+ } & Omit<ButtonProps, "variant" | "href" | "type" | "fullWidth"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ export declare const Button: import("react").ForwardRefExoticComponent<{
2
+ variant?: import("./Button.types").ButtonVariant;
3
+ size?: import("./Button.types").ButtonSize;
4
+ tone?: import("./Button.types").ButtonTone;
5
+ icon?: boolean;
6
+ round?: boolean;
7
+ children?: import("react").ReactNode;
8
+ } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "children"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,80 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Button visual style variants
4
+ * - `primary`: Solid filled button for primary actions
5
+ * - `secondary`: Bordered button for secondary actions
6
+ * - `ghost`: Minimal button for tertiary actions
7
+ */
8
+ export type ButtonVariant = 'primary' | 'secondary' | 'ghost';
9
+ /**
10
+ * Button size options
11
+ * - `small`: Compact size (24px height)
12
+ * - `default`: Standard size (36px height)
13
+ * - `large`: Generous size (44px height)
14
+ */
15
+ export type ButtonSize = 'small' | 'default' | 'large';
16
+ /**
17
+ * Color tone for theming
18
+ * - `accent`: Brand/action color (default)
19
+ * - `neutral`: Neutral gray tones
20
+ * - `danger`: Destructive/warning actions
21
+ */
22
+ export type ButtonTone = 'accent' | 'neutral' | 'danger';
23
+ export type ButtonProps = {
24
+ /**
25
+ * Button variant - controls visual style
26
+ * @default 'primary'
27
+ */
28
+ variant?: ButtonVariant;
29
+ /**
30
+ * Button size
31
+ * @default 'default'
32
+ */
33
+ size?: ButtonSize;
34
+ /**
35
+ * Color tone for theming
36
+ * @default 'accent'
37
+ */
38
+ tone?: ButtonTone;
39
+ /**
40
+ * Icon-only mode. Creates a square button optimized for a single icon.
41
+ * Always provide `aria-label` for accessibility when using icon-only buttons.
42
+ *
43
+ * @default false
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * import { save } from '@equinor/eds-icons'
48
+ * <Button icon aria-label="Save">
49
+ * <Icon data={save} />
50
+ * </Button>
51
+ * ```
52
+ */
53
+ icon?: boolean;
54
+ /**
55
+ * Makes icon-only buttons circular instead of square.
56
+ * Only applies when `icon` prop is true.
57
+ * @default false
58
+ */
59
+ round?: boolean;
60
+ /**
61
+ * Button content. Can include text, icons, or both.
62
+ * Layout is handled automatically with CSS flexbox.
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * // Text only
67
+ * <Button>Save</Button>
68
+ *
69
+ * // Icon before text
70
+ * <Button><Icon data={save} /> Save</Button>
71
+ *
72
+ * // Icon after text
73
+ * <Button>Next <Icon data={chevron_right} /></Button>
74
+ *
75
+ * // Icon only (requires aria-label)
76
+ * <Button icon aria-label="Save"><Icon data={save} /></Button>
77
+ * ```
78
+ */
79
+ children?: ReactNode;
80
+ } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
@@ -0,0 +1,2 @@
1
+ export { Button } from './Button';
2
+ export type { ButtonProps, ButtonVariant, ButtonSize, ButtonTone, } from './Button.types';
@@ -0,0 +1,7 @@
1
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<{
2
+ label?: import("react").ReactNode;
3
+ disabled?: boolean;
4
+ indeterminate?: boolean;
5
+ indicator?: string;
6
+ helperMessage?: import("react").ReactNode;
7
+ } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "type"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,15 @@
1
+ import type { InputHTMLAttributes, ReactNode } from 'react';
2
+ export type CheckboxProps = {
3
+ /** Label for the checkbox */
4
+ label?: ReactNode;
5
+ /** If true, the checkbox will be disabled */
6
+ disabled?: boolean;
7
+ /** If true, the checkbox appears indeterminate. Note: You must also set
8
+ * the native element's indeterminate property via ref if needed.
9
+ */
10
+ indeterminate?: boolean;
11
+ /** Indicator text shown after the label, e.g. "(Required)" or "(Optional)" */
12
+ indicator?: string;
13
+ /** Helper message shown below the checkbox, useful for additional context */
14
+ helperMessage?: ReactNode;
15
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from './Checkbox';
2
+ export type { CheckboxProps } from './Checkbox.types';
@@ -0,0 +1,3 @@
1
+ export declare const FieldDescription: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLParagraphElement> & {
2
+ children: import("react").ReactNode;
3
+ } & import("react").RefAttributes<HTMLParagraphElement>>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Field.HelperMessage provides contextual help or validation feedback for form fields.
3
+ *
4
+ * Use with `useFieldIds` hook to connect to form controls via `aria-describedby`.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * const { inputId, helperMessageId, getDescribedBy } = useFieldIds()
9
+ *
10
+ * <Field>
11
+ * <Field.Label htmlFor={inputId}>Email</Field.Label>
12
+ * <input id={inputId} aria-describedby={getDescribedBy()} />
13
+ * <Field.HelperMessage id={helperMessageId}>We'll never share your email</Field.HelperMessage>
14
+ * </Field>
15
+ * ```
16
+ */
17
+ export declare const HelperMessage: import("react").ForwardRefExoticComponent<{
18
+ children: import("react").ReactNode;
19
+ } & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
@@ -0,0 +1,12 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Props for the Field.HelperMessage component.
4
+ *
5
+ * **Note:** Only one HelperMessage should be used per Field.
6
+ * Using multiple instances within the same Field context is not supported
7
+ * and may cause unexpected behavior with accessibility attributes.
8
+ */
9
+ export type HelperMessageProps = {
10
+ /** Helper message content */
11
+ children: ReactNode;
12
+ } & HTMLAttributes<HTMLParagraphElement>;
@@ -0,0 +1,4 @@
1
+ export declare const FieldLabel: import("react").ForwardRefExoticComponent<import("react").LabelHTMLAttributes<HTMLLabelElement> & {
2
+ children: import("react").ReactNode;
3
+ indicator?: string;
4
+ } & import("react").RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,15 @@
1
+ import { FieldDescription } from './Field.Description';
2
+ import { HelperMessage } from './Field.HelperMessage';
3
+ import { FieldLabel } from './Field.Label';
4
+ declare const FieldComponent: import("react").ForwardRefExoticComponent<{
5
+ disabled?: boolean;
6
+ position?: "start" | "end";
7
+ children: import("react").ReactNode;
8
+ } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
+ type CompoundField = typeof FieldComponent & {
10
+ Label: typeof FieldLabel;
11
+ Description: typeof FieldDescription;
12
+ HelperMessage: typeof HelperMessage;
13
+ };
14
+ export declare const Field: CompoundField;
15
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { HTMLAttributes, LabelHTMLAttributes, ReactNode } from 'react';
2
+ export type FieldProps = {
3
+ /**
4
+ * Applies disabled styling to the field and all sub-components.
5
+ * Sets `data-disabled` attribute for CSS styling.
6
+ */
7
+ disabled?: boolean;
8
+ /**
9
+ * Enables horizontal layout for toggle inputs (checkbox, radio, switch).
10
+ * When omitted (default), uses vertical layout for standard text inputs.
11
+ * - `start`: Control on the left, label on the right
12
+ * - `end`: Label on the left, control on the right
13
+ */
14
+ position?: 'start' | 'end';
15
+ /** Field content composed of label, description, control, and helper message */
16
+ children: ReactNode;
17
+ } & HTMLAttributes<HTMLDivElement>;
18
+ export type FieldLabelProps = LabelHTMLAttributes<HTMLLabelElement> & {
19
+ children: ReactNode;
20
+ /** Indicator text shown after the label, e.g. "(Required)" or "(Optional)" */
21
+ indicator?: string;
22
+ };
23
+ export type FieldDescriptionProps = HTMLAttributes<HTMLParagraphElement> & {
24
+ children: ReactNode;
25
+ };
@@ -0,0 +1,5 @@
1
+ export { Field } from './Field';
2
+ export type { FieldProps, FieldLabelProps, FieldDescriptionProps, } from './Field.types';
3
+ export type { HelperMessageProps } from './Field.HelperMessage.types';
4
+ export { useFieldIds } from './useFieldIds';
5
+ export type { FieldIds } from './useFieldIds';
@@ -0,0 +1,59 @@
1
+ export interface FieldIds {
2
+ /** ID for the input/checkbox/radio/switch element */
3
+ inputId: string;
4
+ /**
5
+ * ID for the label element.
6
+ * Use with aria-labelledby for components without native label support.
7
+ * @example
8
+ * ```tsx
9
+ * <Field.Label id={labelId}>Name</Field.Label>
10
+ * <CustomInput aria-labelledby={labelId} />
11
+ * ```
12
+ */
13
+ labelId: string;
14
+ /** ID for the description element */
15
+ descriptionId: string;
16
+ /** ID for the helper message element */
17
+ helperMessageId: string;
18
+ /**
19
+ * Generate aria-describedby string from relevant IDs.
20
+ * @param options - Which elements are present in the field
21
+ * @returns Space-separated string of IDs, or undefined if none
22
+ */
23
+ getDescribedBy: (options?: {
24
+ hasDescription?: boolean;
25
+ hasHelperMessage?: boolean;
26
+ }) => string | undefined;
27
+ }
28
+ /**
29
+ * Hook for generating consistent, accessible IDs for form field elements.
30
+ *
31
+ * @param providedId - Optional custom ID. If not provided, a unique ID will be generated.
32
+ * @returns Object containing IDs for input, label, description, and helper message,
33
+ * plus a helper function to generate aria-describedby.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const ids = useFieldIds()
38
+ *
39
+ * <Field>
40
+ * <Field.Label htmlFor={ids.inputId}>Username</Field.Label>
41
+ * <Field.Description id={ids.descriptionId}>
42
+ * Choose a unique username
43
+ * </Field.Description>
44
+ * <input
45
+ * id={ids.inputId}
46
+ * aria-describedby={ids.getDescribedBy({
47
+ * hasDescription: true,
48
+ * hasHelperMessage: hasError,
49
+ * })}
50
+ * />
51
+ * {hasError && (
52
+ * <HelperMessage id={ids.helperMessageId}>
53
+ * Username is already taken
54
+ * </HelperMessage>
55
+ * )}
56
+ * </Field>
57
+ * ```
58
+ */
59
+ export declare function useFieldIds(providedId?: string): FieldIds;
@@ -0,0 +1,3 @@
1
+ import { OverridableComponent } from '@equinor/eds-utils';
2
+ import type { InputProps } from './Input.types';
3
+ export declare const Input: OverridableComponent<InputProps, HTMLInputElement>;
@@ -0,0 +1,17 @@
1
+ import { InputHTMLAttributes, ReactNode } from 'react';
2
+ export type InputProps = {
3
+ /** Invalid state - shows error styling */
4
+ invalid?: boolean;
5
+ /** Text at the start (e.g., "$", "USD") - always neutral color */
6
+ startText?: string;
7
+ /** Adornment at the start (icons, buttons, etc.) - inherits state color (red when invalid) */
8
+ startAdornment?: ReactNode;
9
+ /** Text at the end (e.g., "km", "%") - always neutral color */
10
+ endText?: string;
11
+ /** Adornment at the end (icons, buttons, etc.) - inherits state color (red when invalid) */
12
+ endAdornment?: ReactNode;
13
+ /** Render as input or textarea */
14
+ as?: 'input' | 'textarea';
15
+ /** Class name applied to the container element */
16
+ containerClassName?: string;
17
+ } & InputHTMLAttributes<HTMLInputElement>;
@@ -0,0 +1,2 @@
1
+ export { Input } from './Input';
2
+ export type { InputProps } from './Input.types';
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Placeholder component for testing the /next entry point.
3
- * This component should be removed once real EDS 2.0 components are added.
2
+ * Placeholder component for Code Connect example.
3
+ * This is a minimal component used to demonstrate Figma Code Connect setup.
4
4
  */
5
- export type PlaceholderProps = {
6
- /** Text to display */
5
+ export declare const Placeholder: ({ text }: {
7
6
  text?: string;
8
- };
9
- export declare const Placeholder: ({ text, }: PlaceholderProps) => import("react/jsx-runtime").JSX.Element;
7
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1 @@
1
1
  export { Placeholder } from './Placeholder';
2
- export type { PlaceholderProps } from './Placeholder';
@@ -0,0 +1,3 @@
1
+ export declare const Radio: import("react").ForwardRefExoticComponent<{
2
+ label?: import("react").ReactNode;
3
+ } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "type"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { InputHTMLAttributes, ReactNode } from 'react';
2
+ export type RadioProps = {
3
+ /** Label for the radio button */
4
+ label?: ReactNode;
5
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
@@ -0,0 +1,2 @@
1
+ export { Radio } from './Radio';
2
+ export type { RadioProps } from './Radio.types';
@@ -0,0 +1,3 @@
1
+ export declare const Switch: import("react").ForwardRefExoticComponent<{
2
+ label: import("react").ReactNode;
3
+ } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "type"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,7 @@
1
+ import type { InputHTMLAttributes, ReactNode } from 'react';
2
+ export type SwitchProps = {
3
+ /**
4
+ * Visible label for the switch (required).
5
+ */
6
+ label: ReactNode;
7
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
@@ -0,0 +1,2 @@
1
+ export { Switch } from './Switch';
2
+ export type { SwitchProps } from './Switch.types';
@@ -0,0 +1,17 @@
1
+ import './text-field.css';
2
+ export declare const TextField: import("react").ForwardRefExoticComponent<{
3
+ label?: import("react").ReactNode;
4
+ labelInfo?: import("react").ReactNode;
5
+ indicator?: string;
6
+ description?: import("react").ReactNode;
7
+ helperMessage?: import("react").ReactNode;
8
+ id?: string;
9
+ } & {
10
+ invalid?: boolean;
11
+ startText?: string;
12
+ startAdornment?: import("react").ReactNode;
13
+ endText?: string;
14
+ endAdornment?: import("react").ReactNode;
15
+ as?: "input" | "textarea";
16
+ containerClassName?: string;
17
+ } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import type { InputProps } from '../Input/Input.types';
3
+ export type TextFieldProps = {
4
+ /** Label for the field */
5
+ label?: ReactNode;
6
+ /** Info tooltip content shown next to the label */
7
+ labelInfo?: ReactNode;
8
+ /** Indicator text shown after label, e.g. "(Required)" or "(Optional)" */
9
+ indicator?: string;
10
+ /** Descriptive text that provides additional context for the field */
11
+ description?: ReactNode;
12
+ /** Helper or validation message shown below the input */
13
+ helperMessage?: ReactNode;
14
+ /** Unique identifier for the field */
15
+ id?: string;
16
+ } & InputProps;
@@ -0,0 +1,2 @@
1
+ export { TextField } from './TextField';
2
+ export type { TextFieldProps } from './TextField.types';
@@ -1,4 +1,16 @@
1
- export { Placeholder } from './Placeholder';
2
- export type { PlaceholderProps } from './Placeholder';
1
+ export { Button } from './Button';
3
2
  export { Icon } from './Icon';
3
+ export { Field, useFieldIds } from './Field';
4
+ export { Checkbox } from './Checkbox';
5
+ export { Radio } from './Radio';
6
+ export { Switch } from './Switch';
7
+ export type { ButtonProps, ButtonVariant, ButtonSize, ButtonTone, } from './Button';
4
8
  export type { IconProps, IconSize, IconData, IconName } from './Icon';
9
+ export type { CheckboxProps } from './Checkbox';
10
+ export type { RadioProps } from './Radio';
11
+ export type { SwitchProps } from './Switch';
12
+ export type { FieldProps, FieldLabelProps, FieldDescriptionProps, FieldIds, HelperMessageProps, } from './Field';
13
+ export { Input } from './Input';
14
+ export type { InputProps } from './Input';
15
+ export { TextField } from './TextField';
16
+ export type { TextFieldProps } from './TextField';
@@ -6,6 +6,9 @@
6
6
  *
7
7
  * Install: npm install @equinor/eds-core-react@beta
8
8
  *
9
+ * CSS must be imported separately for SSR compatibility:
10
+ * import '@equinor/eds-core-react/next/index.css'
11
+ *
9
12
  * @packageDocumentation
10
13
  */
11
14
  export * from './components/next';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -23,18 +23,14 @@
23
23
  "url": "https://github.com/equinor/design-system/issues"
24
24
  },
25
25
  "files": [
26
- "dist/*"
26
+ "dist/*",
27
+ "build/*"
27
28
  ],
28
29
  "exports": {
29
30
  ".": {
30
31
  "types": "./dist/types/index.d.ts",
31
32
  "import": "./dist/esm/index.js",
32
33
  "require": "./dist/eds-core-react.cjs"
33
- },
34
- "./next": {
35
- "types": "./dist/types/index.next.d.ts",
36
- "import": "./dist/esm/index.next.js",
37
- "require": "./dist/index.next.cjs"
38
34
  }
39
35
  },
40
36
  "keywords": [
@@ -102,8 +98,8 @@
102
98
  "downshift": "9.0.10",
103
99
  "react-aria": "^3.44.0",
104
100
  "@equinor/eds-icons": "^1.2.0",
105
- "@equinor/eds-tokens": "^2.1.1",
106
- "@equinor/eds-utils": "^2.0.0"
101
+ "@equinor/eds-utils": "^2.0.0",
102
+ "@equinor/eds-tokens": "^2.1.1"
107
103
  },
108
104
  "scripts": {
109
105
  "build": "rollup -c && tsc -p tsconfig.build.json",
@@ -1,6 +0,0 @@
1
- import styleInject from '../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
2
-
3
- var css_248z = "/* Inline with text: uses token from parent's data-font-size, or 1.5em fallback */\n.icon {\n /*\n * Set font-size first to establish the icon's size context.\n * Then use 1em for width/height (relative to computed font-size).\n * This avoids compound scaling (1.5em × 1.5em = 2.25em would be wrong).\n */\n font-size: var(--eds-typography-icon-size, 1.5em);\n width: 1em;\n height: 1em;\n\n /* Negative margins for optical alignment with text baseline */\n margin-block: -0.25em;\n margin-inline: -0.1em;\n\n flex-shrink: 0;\n}\n\n/* Explicit size: fixed size from design tokens, no margins */\n.icon[data-icon-size] {\n --_explicit-size: var(--eds-sizing-icon-md); /* fallback */\n\n width: var(--_explicit-size);\n height: var(--_explicit-size);\n margin: 0;\n font-size: inherit;\n}\n\n.icon[data-icon-size='xs'] {\n --_explicit-size: var(--eds-sizing-icon-xs);\n}\n.icon[data-icon-size='sm'] {\n --_explicit-size: var(--eds-sizing-icon-sm);\n}\n.icon[data-icon-size='md'] {\n --_explicit-size: var(--eds-sizing-icon-md);\n}\n.icon[data-icon-size='lg'] {\n --_explicit-size: var(--eds-sizing-icon-lg);\n}\n.icon[data-icon-size='xl'] {\n --_explicit-size: var(--eds-sizing-icon-xl);\n}\n.icon[data-icon-size='2xl'] {\n --_explicit-size: var(--eds-sizing-icon-2xl);\n}\n.icon[data-icon-size='3xl'] {\n --_explicit-size: var(--eds-sizing-icon-3xl);\n}\n.icon[data-icon-size='4xl'] {\n --_explicit-size: var(--eds-sizing-icon-4xl);\n}\n.icon[data-icon-size='5xl'] {\n --_explicit-size: var(--eds-sizing-icon-5xl);\n}\n.icon[data-icon-size='6xl'] {\n --_explicit-size: var(--eds-sizing-icon-6xl);\n}\n";
4
- styleInject(css_248z);
5
-
6
- export { css_248z as default };
@@ -1,17 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
-
3
- /**
4
- * Placeholder component for testing the /next entry point.
5
- * This component should be removed once real EDS 2.0 components are added.
6
- */
7
-
8
- const Placeholder = ({
9
- text = 'EDS 2.0 Placeholder'
10
- }) => {
11
- return /*#__PURE__*/jsx("div", {
12
- "data-testid": "eds-placeholder",
13
- children: text
14
- });
15
- };
16
-
17
- export { Placeholder };
@@ -1,26 +0,0 @@
1
- function styleInject(css, ref) {
2
- if (ref === void 0) ref = {};
3
- var insertAt = ref.insertAt;
4
- if (typeof document === 'undefined') {
5
- return;
6
- }
7
- var head = document.head || document.getElementsByTagName('head')[0];
8
- var style = document.createElement('style');
9
- style.type = 'text/css';
10
- if (insertAt === 'top') {
11
- if (head.firstChild) {
12
- head.insertBefore(style, head.firstChild);
13
- } else {
14
- head.appendChild(style);
15
- }
16
- } else {
17
- head.appendChild(style);
18
- }
19
- if (style.styleSheet) {
20
- style.styleSheet.cssText = css;
21
- } else {
22
- style.appendChild(document.createTextNode(css));
23
- }
24
- }
25
-
26
- export { styleInject as default };