@telia/teddy 0.7.34 → 0.7.36
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/dist/components/avatar/avatar-root.d.ts +1 -1
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs-link.d.ts +1 -1
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- package/dist/components/card/card-link.d.ts +1 -1
- package/dist/components/channel-button/channel-button-root.d.ts +4 -4
- package/dist/components/channel-button/index.d.ts +4 -4
- package/dist/components/checkbox/checkbox-group.d.ts +1 -1
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox-card-group/checkbox-card-group-content.cjs +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-content.js +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-indicator.cjs +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-indicator.js +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-item-title.cjs +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-item-title.js +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-item.cjs +2 -0
- package/dist/components/checkbox-card-group/checkbox-card-group-item.js +2 -0
- package/dist/components/chip/chip-indicator.d.ts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/dashboard-card/dashboard-card-avatar.d.ts +1 -1
- package/dist/components/dashed-button/dashed-button-root.cjs +45 -0
- package/dist/components/dashed-button/dashed-button-root.d.ts +62 -0
- package/dist/components/dashed-button/dashed-button-root.js +45 -0
- package/dist/components/dashed-button/index.cjs +4 -0
- package/dist/components/dashed-button/index.d.ts +2 -0
- package/dist/components/dashed-button/index.js +4 -0
- package/dist/components/expandable-card/expandable-card-button.d.ts +2 -2
- package/dist/components/expandable-card/index.d.ts +3 -3
- package/dist/components/flip-card/flip-card-trigger.d.ts +2 -2
- package/dist/components/icon/utils.d.ts +1 -1
- package/dist/components/index.cjs +8 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +8 -0
- package/dist/components/modal/modal-close.cjs +2 -0
- package/dist/components/modal/modal-close.js +2 -0
- package/dist/components/navigation-menu/navigation-menu.cjs +2 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +1 -1
- package/dist/components/navigation-menu/navigation-menu.js +2 -0
- package/dist/components/notabene/notabene-icon.d.ts +2 -2
- package/dist/components/notification/index.d.ts +2 -2
- package/dist/components/notification/notification-icon.d.ts +2 -2
- package/dist/components/notification/notification-root.d.ts +2 -2
- package/dist/components/radio-card-group/radio-card-group-content.cjs +2 -0
- package/dist/components/radio-card-group/radio-card-group-content.js +2 -0
- package/dist/components/radio-card-group/radio-card-group-item-title.cjs +2 -0
- package/dist/components/radio-card-group/radio-card-group-item-title.js +2 -0
- package/dist/components/radio-card-group/radio-card-group-item.cjs +2 -0
- package/dist/components/radio-card-group/radio-card-group-item.js +2 -0
- package/dist/components/scroll-area/index.d.ts +2 -2
- package/dist/components/scroll-area/scroll-area-button.d.ts +2 -2
- package/dist/components/tabs/index.d.ts +1 -1
- package/dist/components/tabs/tabs-root.d.ts +1 -1
- package/dist/components/tabs/tabs-scroll-button.d.ts +2 -2
- package/dist/components/text-field/index.cjs +2 -0
- package/dist/components/text-field/index.d.ts +5 -2
- package/dist/components/text-field/index.js +2 -0
- package/dist/components/text-field/text-field-button.d.ts +2 -2
- package/dist/components/text-field/text-field-textarea.cjs +27 -0
- package/dist/components/text-field/text-field-textarea.d.ts +5 -0
- package/dist/components/text-field/text-field-textarea.js +27 -0
- package/dist/components/textarea/index.cjs +11 -0
- package/dist/components/textarea/index.d.ts +30 -0
- package/dist/components/textarea/index.js +11 -0
- package/dist/components/textarea/textarea-clear-button.cjs +39 -0
- package/dist/components/textarea/textarea-clear-button.d.ts +5 -0
- package/dist/components/textarea/textarea-clear-button.js +39 -0
- package/dist/components/textarea/textarea-group.cjs +168 -0
- package/dist/components/textarea/textarea-group.d.ts +17 -0
- package/dist/components/textarea/textarea-group.js +168 -0
- package/dist/components/textarea/textarea-indicator.cjs +10 -0
- package/dist/components/textarea/textarea-indicator.d.ts +23 -0
- package/dist/components/textarea/textarea-indicator.js +10 -0
- package/dist/components/textarea/textarea.cjs +9 -0
- package/dist/components/textarea/textarea.d.ts +20 -0
- package/dist/components/textarea/textarea.js +9 -0
- package/dist/components/toggle/toggle.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/main.cjs +8 -0
- package/dist/main.js +8 -0
- package/dist/style.css +629 -435
- package/dist/utils/generate-styling/grid.d.ts +24 -24
- package/dist/utils/generate-styling/index.d.ts +16 -16
- package/dist/utils/generate-styling/util.d.ts +2 -2
- package/package.json +1 -1
|
@@ -34,7 +34,7 @@ type RootContextType = {
|
|
|
34
34
|
value: string | undefined;
|
|
35
35
|
};
|
|
36
36
|
export declare const RootContext: React.Context<RootContextType | undefined>;
|
|
37
|
-
export declare const Root: React.ForwardRefExoticComponent<Omit<Omit<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>, "ref">, "
|
|
37
|
+
export declare const Root: React.ForwardRefExoticComponent<Omit<Omit<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>, "ref">, "value" | "defaultValue" | "onValueChange" | "activationMode"> & {
|
|
38
38
|
/** The controlled value of the tab to activate. Should be used in conjunction with onValueChange. */
|
|
39
39
|
value?: TabsPrimitive.TabsProps['value'];
|
|
40
40
|
/** Event handler called when the value changes. */
|
|
@@ -10,7 +10,7 @@ export declare const ScrollButton: React.ForwardRefExoticComponent<Omit<Omit<Omi
|
|
|
10
10
|
loading?: boolean | undefined;
|
|
11
11
|
fullWidth?: boolean | undefined;
|
|
12
12
|
size?: "sm" | "md" | "lg" | undefined;
|
|
13
|
-
variant?: "
|
|
13
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
14
14
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
iconOnly: true;
|
|
@@ -22,7 +22,7 @@ export declare const ScrollButton: React.ForwardRefExoticComponent<Omit<Omit<Omi
|
|
|
22
22
|
loading?: boolean | undefined;
|
|
23
23
|
fullWidth?: boolean | undefined;
|
|
24
24
|
size?: "sm" | "md" | "lg" | undefined;
|
|
25
|
-
variant?: "
|
|
25
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
26
26
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
27
27
|
} & {
|
|
28
28
|
iconOnly?: false | undefined;
|
|
@@ -9,6 +9,7 @@ const components_textField_textFieldErrorList = require("./text-field-error-list
|
|
|
9
9
|
const components_textField_textFieldIndicator = require("./text-field-indicator.cjs");
|
|
10
10
|
const components_textField_textFieldButton = require("./text-field-button.cjs");
|
|
11
11
|
const components_textField_textFieldClearButton = require("./text-field-clear-button.cjs");
|
|
12
|
+
const components_textField_textFieldTextarea = require("./text-field-textarea.cjs");
|
|
12
13
|
components_textField_textField.Root.displayName = "TextField";
|
|
13
14
|
components_textField_textFieldInput.Input.displayName = "TextField.Input";
|
|
14
15
|
components_textField_textFieldLabel.Label.displayName = "TextField.Label";
|
|
@@ -20,6 +21,7 @@ components_textField_textFieldButton.Button.displayName = "TextField.Button";
|
|
|
20
21
|
components_textField_textFieldClearButton.ClearButton.displayName = "TextField.ClearButton";
|
|
21
22
|
const TextField = Object.assign(components_textField_textField.Root, {
|
|
22
23
|
Input: components_textField_textFieldInput.Input,
|
|
24
|
+
Textarea: components_textField_textFieldTextarea.Textarea,
|
|
23
25
|
Label: components_textField_textFieldLabel.Label,
|
|
24
26
|
InputGroup: components_textField_textFieldInputGroup.InputGroup,
|
|
25
27
|
HelperText: components_textField_textFieldHelperText.HelperText,
|
|
@@ -7,6 +7,7 @@ import { TextFieldErrorListProps } from './text-field-error-list';
|
|
|
7
7
|
import { TextFieldIndicatorProps } from './text-field-indicator';
|
|
8
8
|
import { TextFieldButtonProps } from './text-field-button';
|
|
9
9
|
import { TextFieldClearButtonProps } from './text-field-clear-button';
|
|
10
|
+
import { TextFieldTextareaProps } from './text-field-textarea';
|
|
10
11
|
|
|
11
12
|
export declare const TextField: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & Pick<import('../input/input-indicator').InputIndicatorProps, "isLoading" | "isValid"> & {
|
|
12
13
|
disabled?: boolean | undefined;
|
|
@@ -15,6 +16,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
15
16
|
isRequired?: boolean | undefined;
|
|
16
17
|
} & import('react').RefAttributes<HTMLDivElement>> & {
|
|
17
18
|
Input: import('react').ForwardRefExoticComponent<TextFieldInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
19
|
+
Textarea: import('react').ForwardRefExoticComponent<TextFieldTextareaProps & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
18
20
|
Label: import('react').ForwardRefExoticComponent<Omit<import('@radix-ui/react-label').LabelProps & import('react').RefAttributes<HTMLLabelElement>, "ref"> & {
|
|
19
21
|
disabled?: boolean | undefined;
|
|
20
22
|
isRequired?: boolean | undefined;
|
|
@@ -35,7 +37,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
35
37
|
loading?: boolean | undefined;
|
|
36
38
|
fullWidth?: boolean | undefined;
|
|
37
39
|
size?: "sm" | "md" | "lg" | undefined;
|
|
38
|
-
variant?: "
|
|
40
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
39
41
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
40
42
|
} & {
|
|
41
43
|
iconOnly: true;
|
|
@@ -47,7 +49,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
47
49
|
loading?: boolean | undefined;
|
|
48
50
|
fullWidth?: boolean | undefined;
|
|
49
51
|
size?: "sm" | "md" | "lg" | undefined;
|
|
50
|
-
variant?: "
|
|
52
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
51
53
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
52
54
|
} & {
|
|
53
55
|
iconOnly?: false | undefined;
|
|
@@ -60,6 +62,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
|
|
|
60
62
|
export type TextFieldProps = {
|
|
61
63
|
Root: TextFieldRootProps;
|
|
62
64
|
Input: TextFieldInputProps;
|
|
65
|
+
Textarea: TextFieldTextareaProps;
|
|
63
66
|
Label: TextFieldLabelProps;
|
|
64
67
|
Group: TextFieldInputGroupProps;
|
|
65
68
|
HelperText: TextFieldHelperTextProps;
|
|
@@ -7,6 +7,7 @@ import { ErrorList } from "./text-field-error-list.js";
|
|
|
7
7
|
import { Indicator } from "./text-field-indicator.js";
|
|
8
8
|
import { Button } from "./text-field-button.js";
|
|
9
9
|
import { ClearButton } from "./text-field-clear-button.js";
|
|
10
|
+
import { Textarea } from "./text-field-textarea.js";
|
|
10
11
|
Root.displayName = "TextField";
|
|
11
12
|
Input.displayName = "TextField.Input";
|
|
12
13
|
Label.displayName = "TextField.Label";
|
|
@@ -18,6 +19,7 @@ Button.displayName = "TextField.Button";
|
|
|
18
19
|
ClearButton.displayName = "TextField.ClearButton";
|
|
19
20
|
const TextField = Object.assign(Root, {
|
|
20
21
|
Input,
|
|
22
|
+
Textarea,
|
|
21
23
|
Label,
|
|
22
24
|
InputGroup,
|
|
23
25
|
HelperText,
|
|
@@ -11,7 +11,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
|
|
|
11
11
|
loading?: boolean | undefined;
|
|
12
12
|
fullWidth?: boolean | undefined;
|
|
13
13
|
size?: "sm" | "md" | "lg" | undefined;
|
|
14
|
-
variant?: "
|
|
14
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
15
15
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
iconOnly: true;
|
|
@@ -23,7 +23,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
|
|
|
23
23
|
loading?: boolean | undefined;
|
|
24
24
|
fullWidth?: boolean | undefined;
|
|
25
25
|
size?: "sm" | "md" | "lg" | undefined;
|
|
26
|
-
variant?: "
|
|
26
|
+
variant?: "primary" | "text" | "list-item" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
27
27
|
borderStyle?: ("dashed" | "default") | undefined;
|
|
28
28
|
} & {
|
|
29
29
|
iconOnly?: false | undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const components_textField_textField = require("./text-field.cjs");
|
|
6
|
+
const components_textarea_index = require("../textarea/index.cjs");
|
|
7
|
+
const Textarea = React.forwardRef((props, forwardRef) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const context = React.useContext(components_textField_textField.TextFieldContext);
|
|
10
|
+
const id = context == null ? void 0 : context.id;
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
+
components_textarea_index.TextareaGroup.Textarea,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
"aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
|
|
16
|
+
disabled: context == null ? void 0 : context.disabled,
|
|
17
|
+
readOnly: context == null ? void 0 : context.readOnly,
|
|
18
|
+
required: context == null ? void 0 : context.isRequired,
|
|
19
|
+
isLoading: context == null ? void 0 : context.isLoading,
|
|
20
|
+
validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
|
|
21
|
+
id,
|
|
22
|
+
ref: forwardRef
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
Textarea.displayName = "Textarea";
|
|
27
|
+
exports.Textarea = Textarea;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextareaGroupProps } from '../textarea';
|
|
3
|
+
|
|
4
|
+
export type TextFieldTextareaProps = Omit<TextareaGroupProps['Textarea'], 'id' | 'disabled' | 'readOnly' | 'required'>;
|
|
5
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextFieldTextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import { TextFieldContext } from "./text-field.js";
|
|
4
|
+
import { TextareaGroup } from "../textarea/index.js";
|
|
5
|
+
const Textarea = React__default.forwardRef((props, forwardRef) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const context = React__default.useContext(TextFieldContext);
|
|
8
|
+
const id = context == null ? void 0 : context.id;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
TextareaGroup.Textarea,
|
|
11
|
+
{
|
|
12
|
+
...props,
|
|
13
|
+
"aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
|
|
14
|
+
disabled: context == null ? void 0 : context.disabled,
|
|
15
|
+
readOnly: context == null ? void 0 : context.readOnly,
|
|
16
|
+
required: context == null ? void 0 : context.isRequired,
|
|
17
|
+
isLoading: context == null ? void 0 : context.isLoading,
|
|
18
|
+
validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
|
|
19
|
+
id,
|
|
20
|
+
ref: forwardRef
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
Textarea.displayName = "Textarea";
|
|
25
|
+
export {
|
|
26
|
+
Textarea
|
|
27
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const components_textarea_textareaGroup = require("./textarea-group.cjs");
|
|
4
|
+
const components_textarea_textareaClearButton = require("./textarea-clear-button.cjs");
|
|
5
|
+
const TextareaGroup = Object.assign(components_textarea_textareaGroup.Root, {
|
|
6
|
+
Textarea: components_textarea_textareaGroup.Textarea$1,
|
|
7
|
+
TextareaIndicator: components_textarea_textareaGroup.TextareaIndicator$1,
|
|
8
|
+
TextareaClearButton: components_textarea_textareaClearButton.TextareaClearButton
|
|
9
|
+
});
|
|
10
|
+
exports.Textarea = components_textarea_textareaGroup.Textarea$1;
|
|
11
|
+
exports.TextareaGroup = TextareaGroup;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Textarea, TextareaProps } from './textarea';
|
|
2
|
+
import { TextareaIndicatorProps } from './textarea-indicator';
|
|
3
|
+
import { TextareaGroupRootProps } from './textarea-group';
|
|
4
|
+
import { TextareaClearButtonProps } from './textarea-clear-button';
|
|
5
|
+
|
|
6
|
+
declare const TextareaGroup: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
|
+
frameClassName?: string | undefined;
|
|
8
|
+
preventGroupClickSelect?: boolean | undefined;
|
|
9
|
+
} & import('react').RefAttributes<HTMLDivElement>> & {
|
|
10
|
+
Textarea: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "children"> & {
|
|
11
|
+
validationState?: ("valid" | "invalid") | undefined;
|
|
12
|
+
isLoading?: boolean | undefined;
|
|
13
|
+
autosize?: boolean | undefined;
|
|
14
|
+
charactersLimit?: number | undefined;
|
|
15
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
16
|
+
} & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
17
|
+
TextareaIndicator: import('react').ForwardRefExoticComponent<Omit<import('react').SVGProps<SVGSVGElement>, "ref"> & {
|
|
18
|
+
isValid?: boolean | undefined;
|
|
19
|
+
isLoading?: boolean | undefined;
|
|
20
|
+
} & import('react').RefAttributes<SVGSVGElement>>;
|
|
21
|
+
TextareaClearButton: import('react').ForwardRefExoticComponent<TextareaClearButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
};
|
|
23
|
+
type TextareaGroupProps = {
|
|
24
|
+
Root: TextareaGroupRootProps;
|
|
25
|
+
Textarea: TextareaProps;
|
|
26
|
+
Indicator: TextareaIndicatorProps;
|
|
27
|
+
ClearButton: TextareaClearButtonProps;
|
|
28
|
+
};
|
|
29
|
+
export { Textarea, TextareaGroup };
|
|
30
|
+
export type { TextareaGroupProps, TextareaProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Root, a as TextareaIndicator, T as Textarea } from "./textarea-group.js";
|
|
2
|
+
import { TextareaClearButton } from "./textarea-clear-button.js";
|
|
3
|
+
const TextareaGroup = Object.assign(Root, {
|
|
4
|
+
Textarea,
|
|
5
|
+
TextareaIndicator,
|
|
6
|
+
TextareaClearButton
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
Textarea,
|
|
10
|
+
TextareaGroup
|
|
11
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
require("../../assets/sprite.6511e521-teddy.svg");
|
|
6
|
+
const components_icon_icon = require("../icon/icon.cjs");
|
|
7
|
+
const components_button_button = require("../button/button.cjs");
|
|
8
|
+
const clsx = require("clsx");
|
|
9
|
+
const components_textarea_textareaGroup = require("./textarea-group.cjs");
|
|
10
|
+
const TextareaClearButton = React.forwardRef(
|
|
11
|
+
({ className, children, ...props }, ref) => {
|
|
12
|
+
const groupContext = React.useContext(components_textarea_textareaGroup.TextareaGroupContext);
|
|
13
|
+
if (!(groupContext == null ? void 0 : groupContext.isDirty)) return null;
|
|
14
|
+
const classes = clsx([components_textarea_textareaGroup.styles[`${components_textarea_textareaGroup.rootClassName$1}__clear-button`]], className);
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16
|
+
components_button_button.Button,
|
|
17
|
+
{
|
|
18
|
+
size: "sm",
|
|
19
|
+
variant: "tertiary-purple",
|
|
20
|
+
iconOnly: true,
|
|
21
|
+
"aria-label": "Slett",
|
|
22
|
+
type: "button",
|
|
23
|
+
ref,
|
|
24
|
+
onClick: (e) => {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
if (!groupContext.textareaRef.current) return;
|
|
27
|
+
groupContext.textareaRef.current.value = "";
|
|
28
|
+
groupContext.textareaRef.current.focus();
|
|
29
|
+
groupContext.setIsDirty(false);
|
|
30
|
+
},
|
|
31
|
+
...props,
|
|
32
|
+
className: classes,
|
|
33
|
+
children: children || /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "close" })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
TextareaClearButton.displayName = "TextareaClearButton";
|
|
39
|
+
exports.TextareaClearButton = TextareaClearButton;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Button } from '../button';
|
|
3
|
+
|
|
4
|
+
export type TextareaClearButtonProps = React.ComponentPropsWithoutRef<typeof Button>;
|
|
5
|
+
export declare const TextareaClearButton: React.ForwardRefExoticComponent<TextareaClearButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import "../../assets/sprite.6511e521-teddy.svg";
|
|
4
|
+
import { Icon } from "../icon/icon.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { TextareaGroupContext, s as styles, r as rootClassName } from "./textarea-group.js";
|
|
8
|
+
const TextareaClearButton = React__default.forwardRef(
|
|
9
|
+
({ className, children, ...props }, ref) => {
|
|
10
|
+
const groupContext = React__default.useContext(TextareaGroupContext);
|
|
11
|
+
if (!(groupContext == null ? void 0 : groupContext.isDirty)) return null;
|
|
12
|
+
const classes = clsx([styles[`${rootClassName}__clear-button`]], className);
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Button,
|
|
15
|
+
{
|
|
16
|
+
size: "sm",
|
|
17
|
+
variant: "tertiary-purple",
|
|
18
|
+
iconOnly: true,
|
|
19
|
+
"aria-label": "Slett",
|
|
20
|
+
type: "button",
|
|
21
|
+
ref,
|
|
22
|
+
onClick: (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
if (!groupContext.textareaRef.current) return;
|
|
25
|
+
groupContext.textareaRef.current.value = "";
|
|
26
|
+
groupContext.textareaRef.current.focus();
|
|
27
|
+
groupContext.setIsDirty(false);
|
|
28
|
+
},
|
|
29
|
+
...props,
|
|
30
|
+
className: classes,
|
|
31
|
+
children: children || /* @__PURE__ */ jsx(Icon, { name: "close" })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
TextareaClearButton.displayName = "TextareaClearButton";
|
|
37
|
+
export {
|
|
38
|
+
TextareaClearButton
|
|
39
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const clsx = require("clsx");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
require("../../assets/sprite.6511e521-teddy.svg");
|
|
7
|
+
const components_icon_icon = require("../icon/icon.cjs");
|
|
8
|
+
const components_spinner_spinner = require("../spinner/spinner.cjs");
|
|
9
|
+
const utils_composeRefs = require("../../utils/composeRefs.cjs");
|
|
10
|
+
const fadeInAnimation = "_fadeInAnimation_15psx_1";
|
|
11
|
+
const scaleInAnimation = "_scaleInAnimation_15psx_1";
|
|
12
|
+
const styles = {
|
|
13
|
+
"teddy-textarea__textarea": "_teddy-textarea__textarea_15psx_17",
|
|
14
|
+
"teddy-textarea": "_teddy-textarea_15psx_17",
|
|
15
|
+
"teddy-textarea__wrapper": "_teddy-textarea__wrapper_15psx_29",
|
|
16
|
+
"teddy-textarea__textarea--valid": "_teddy-textarea__textarea--valid_15psx_84",
|
|
17
|
+
"teddy-textarea__indicator": "_teddy-textarea__indicator_15psx_90",
|
|
18
|
+
"teddy-textarea__textarea--error": "_teddy-textarea__textarea--error_15psx_93",
|
|
19
|
+
"teddy-textarea__icon": "_teddy-textarea__icon_15psx_99",
|
|
20
|
+
fadeInAnimation,
|
|
21
|
+
scaleInAnimation,
|
|
22
|
+
"teddy-textarea__clear-button": "_teddy-textarea__clear-button_15psx_119"
|
|
23
|
+
};
|
|
24
|
+
const TextareaGroupContext = React.createContext(void 0);
|
|
25
|
+
function setCursorOnTextarea(e) {
|
|
26
|
+
if (e.defaultPrevented) return;
|
|
27
|
+
const target = e.target;
|
|
28
|
+
if (target.closest("textarea, button, a")) return;
|
|
29
|
+
const textarea = [...e.currentTarget.getElementsByTagName("textarea")].find((t) => t);
|
|
30
|
+
if (!textarea) return;
|
|
31
|
+
const position = textarea.compareDocumentPosition(target);
|
|
32
|
+
const targetIsBeforeTextarea = (position & Node.DOCUMENT_POSITION_PRECEDING) !== 0;
|
|
33
|
+
const cursorPosition = targetIsBeforeTextarea ? 0 : textarea.value.length;
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
try {
|
|
36
|
+
textarea.setSelectionRange(cursorPosition, cursorPosition);
|
|
37
|
+
} finally {
|
|
38
|
+
textarea.focus();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const Root = React.forwardRef(
|
|
43
|
+
({ className, preventGroupClickSelect, children, frameClassName, ...props }, forwardRef) => {
|
|
44
|
+
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
45
|
+
const textareaRef = React.useRef(null);
|
|
46
|
+
const [isDirty, setIsDirty] = React.useState(false);
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
...props,
|
|
51
|
+
onPointerDown: (e) => {
|
|
52
|
+
var _a;
|
|
53
|
+
(_a = props.onPointerDown) == null ? void 0 : _a.call(props, e);
|
|
54
|
+
if (preventGroupClickSelect) return;
|
|
55
|
+
setCursorOnTextarea(e);
|
|
56
|
+
},
|
|
57
|
+
ref: forwardRef,
|
|
58
|
+
className: classes,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(TextareaGroupContext.Provider, { value: { isDirty, setIsDirty, textareaRef }, children }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
Root.displayName = "TextareaGroup";
|
|
68
|
+
const TextareaIndicator = React.forwardRef(
|
|
69
|
+
({ className, isLoading, isValid, ...props }, forwardRef) => {
|
|
70
|
+
if (!isValid && !isLoading) return null;
|
|
71
|
+
if (!isValid && isLoading) {
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_spinner_spinner.Spinner, { className, size: "xs", ...props, ref: forwardRef });
|
|
73
|
+
}
|
|
74
|
+
const classes = clsx([styles[`${rootClassName}__indicator`]], className);
|
|
75
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { ...props, size: "md", name: "check-circle-filled", className: classes, ref: forwardRef });
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
TextareaIndicator.displayName = "TextareaIndicator";
|
|
79
|
+
const rootClassName = "teddy-textarea";
|
|
80
|
+
const Textarea = React.forwardRef(
|
|
81
|
+
({ className, onValueChange, isLoading, validationState, autosize, charactersLimit, ...props }, forwardRef) => {
|
|
82
|
+
const groupContext = React.useContext(TextareaGroupContext);
|
|
83
|
+
const composedRef = utils_composeRefs.useComposedRefs(forwardRef, groupContext == null ? void 0 : groupContext.textareaRef);
|
|
84
|
+
const classes = clsx(
|
|
85
|
+
[styles[`${rootClassName}__textarea`]],
|
|
86
|
+
{
|
|
87
|
+
[styles[`${rootClassName}__textarea--valid`]]: validationState === "valid",
|
|
88
|
+
[styles[`${rootClassName}__textarea--error`]]: validationState === "invalid"
|
|
89
|
+
},
|
|
90
|
+
className
|
|
91
|
+
);
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (!groupContext) return;
|
|
95
|
+
if ((_b = (_a = groupContext == null ? void 0 : groupContext.textareaRef) == null ? void 0 : _a.current) == null ? void 0 : _b.value.length) {
|
|
96
|
+
groupContext.setIsDirty(true);
|
|
97
|
+
} else {
|
|
98
|
+
groupContext.setIsDirty(false);
|
|
99
|
+
}
|
|
100
|
+
}, [groupContext]);
|
|
101
|
+
function onChange(e) {
|
|
102
|
+
var _a;
|
|
103
|
+
onValueChange == null ? void 0 : onValueChange(e.target.value);
|
|
104
|
+
groupContext == null ? void 0 : groupContext.setIsDirty(((_a = e.target) == null ? void 0 : _a.value.length) > 0);
|
|
105
|
+
if (autosize) {
|
|
106
|
+
e.target.style.height = "auto";
|
|
107
|
+
e.target.style.height = e.target.scrollHeight + "px";
|
|
108
|
+
}
|
|
109
|
+
if (props.onChange) props.onChange(e);
|
|
110
|
+
}
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (!autosize || !composedRef || !("current" in composedRef)) return;
|
|
113
|
+
const textarea = composedRef.current;
|
|
114
|
+
if (!textarea) return;
|
|
115
|
+
textarea.style.height = "auto";
|
|
116
|
+
textarea.style.height = textarea.scrollHeight + "px";
|
|
117
|
+
}, [props.value, autosize, composedRef]);
|
|
118
|
+
const isSingleLine = !autosize && props.rows === 1;
|
|
119
|
+
const hasTextareaGroup = groupContext !== void 0;
|
|
120
|
+
if (hasTextareaGroup) {
|
|
121
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
122
|
+
"textarea",
|
|
123
|
+
{
|
|
124
|
+
maxLength: charactersLimit,
|
|
125
|
+
className: classes,
|
|
126
|
+
"aria-invalid": validationState === "invalid",
|
|
127
|
+
...props,
|
|
128
|
+
onChange,
|
|
129
|
+
ref: composedRef
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: clsx(
|
|
137
|
+
rootClassName,
|
|
138
|
+
{ [`${rootClassName}--single-line`]: isSingleLine },
|
|
139
|
+
styles[`${rootClassName}__wrapper`]
|
|
140
|
+
),
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
"textarea",
|
|
144
|
+
{
|
|
145
|
+
...props,
|
|
146
|
+
maxLength: charactersLimit,
|
|
147
|
+
className: classes,
|
|
148
|
+
ref: composedRef,
|
|
149
|
+
"aria-invalid": validationState === "invalid",
|
|
150
|
+
onChange
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx(TextareaIndicator, { isValid: validationState === "valid", isLoading })
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
Textarea.displayName = "Textarea";
|
|
160
|
+
exports.Root = Root;
|
|
161
|
+
exports.Textarea = Textarea;
|
|
162
|
+
exports.Textarea$1 = Textarea;
|
|
163
|
+
exports.TextareaGroupContext = TextareaGroupContext;
|
|
164
|
+
exports.TextareaIndicator = TextareaIndicator;
|
|
165
|
+
exports.TextareaIndicator$1 = TextareaIndicator;
|
|
166
|
+
exports.rootClassName = rootClassName;
|
|
167
|
+
exports.rootClassName$1 = rootClassName;
|
|
168
|
+
exports.styles = styles;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type TextareaGroupRootProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
4
|
+
frameClassName?: string;
|
|
5
|
+
preventGroupClickSelect?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type TextareaGroupContextValue = {
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
setIsDirty: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
+
textareaRef: React.RefObject<HTMLTextAreaElement>;
|
|
11
|
+
};
|
|
12
|
+
export declare const TextareaGroupContext: React.Context<TextareaGroupContextValue | undefined>;
|
|
13
|
+
export declare const Root: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
|
+
frameClassName?: string | undefined;
|
|
15
|
+
preventGroupClickSelect?: boolean | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export {};
|