@scaleflex/ui-tw 0.0.135 → 0.0.137

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.
@@ -12,8 +12,9 @@ declare function DropdownMenuItem({ className, inset, variant, size, ...props }:
12
12
  variant?: 'default' | 'destructive';
13
13
  size?: DropdownMenuItemSize;
14
14
  }): React.JSX.Element;
15
- declare function DropdownMenuCheckboxItem({ className, children, checked, size, ...props }: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
15
+ declare function DropdownMenuCheckboxItem({ className, children, checked, size, closeOnSelect, onSelect, ...props }: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
16
16
  size?: DropdownMenuItemSize;
17
+ closeOnSelect?: boolean;
17
18
  }): React.JSX.Element;
18
19
  declare function DropdownMenuRadioGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
19
20
  declare function DropdownMenuRadioItem({ className, children, size, ...props }: ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  var _excluded = ["className", "sideOffset", "collisionPadding"],
6
6
  _excluded2 = ["className", "inset", "variant", "size"],
7
- _excluded3 = ["className", "children", "checked", "size"],
7
+ _excluded3 = ["className", "children", "checked", "size", "closeOnSelect", "onSelect"],
8
8
  _excluded4 = ["className", "children", "size"],
9
9
  _excluded5 = ["className", "size"],
10
10
  _excluded6 = ["className"],
@@ -14,7 +14,7 @@ var _excluded = ["className", "sideOffset", "collisionPadding"],
14
14
  _excluded10 = ["className", "collisionPadding"];
15
15
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
16
16
  import { Slot } from '@radix-ui/react-slot';
17
- import { DropdownMenuItemSize, dropdownMenuButtonTriggerOptions, dropdownMenuCheckboxItemSizeOptions, dropdownMenuIconSizeOptions, dropdownMenuItemIconSizeOptions, dropdownMenuItemIndicatorSizeOptions, dropdownMenuItemSizeOptions, dropdownMenuShortcutSizeOptions } from '@scaleflex/ui-tw/dropdown-menu/dropdown-menu.constants';
17
+ import { DropdownMenuItemSize, dropdownMenuButtonTriggerOptions, dropdownMenuCheckboxItemSizeOptions, dropdownMenuIconSizeOptions, dropdownMenuItemIconSizeOptions, dropdownMenuItemIndicatorSizeOptions, dropdownMenuItemSizeOptions, dropdownMenuRadioItemSizeOptions, dropdownMenuShortcutSizeOptions } from '@scaleflex/ui-tw/dropdown-menu/dropdown-menu.constants';
18
18
  import { focusRingClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
19
19
  import { cn } from '@scaleflex/ui-tw/utils/cn';
20
20
  import { cva } from 'class-variance-authority';
@@ -36,6 +36,14 @@ var dropdownMenuCheckboxItemVariants = cva('', {
36
36
  size: DropdownMenuItemSize.Sm
37
37
  }
38
38
  });
39
+ var dropdownMenuRadioItemVariants = cva('', {
40
+ variants: {
41
+ size: dropdownMenuRadioItemSizeOptions
42
+ },
43
+ defaultVariants: {
44
+ size: DropdownMenuItemSize.Sm
45
+ }
46
+ });
39
47
  var dropdownMenuButtonTriggerVariants = cva('', {
40
48
  variants: {
41
49
  size: dropdownMenuButtonTriggerOptions
@@ -147,15 +155,24 @@ function DropdownMenuCheckboxItem(_ref7) {
147
155
  checked = _ref7.checked,
148
156
  _ref7$size = _ref7.size,
149
157
  size = _ref7$size === void 0 ? DropdownMenuItemSize.Sm : _ref7$size,
158
+ _ref7$closeOnSelect = _ref7.closeOnSelect,
159
+ closeOnSelect = _ref7$closeOnSelect === void 0 ? false : _ref7$closeOnSelect,
160
+ _onSelect = _ref7.onSelect,
150
161
  props = _objectWithoutProperties(_ref7, _excluded3);
151
162
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.CheckboxItem, _extends({
152
163
  "data-slot": "dropdown-menu-checkbox-item",
153
- className: cn('relative flex cursor-pointer items-center gap-2 rounded-sm pr-2 pl-2 outline-hidden select-none', dropdownMenuItemVariants({
164
+ className: cn('relative flex cursor-pointer items-center gap-2 rounded-sm outline-hidden select-none', dropdownMenuCheckboxItemVariants({
154
165
  size: size
155
166
  }), 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50', 'data-[state=checked]:bg-accent data-[state=checked]:text-primary focus:bg-secondary', "[&_svg:not([class*='text-'])]:text-muted-foreground data-[state=checked]:[&_svg:not([class*='text-'])]:text-primary [&_svg]:pointer-events-none [&_svg]:shrink-0", dropdownMenuIconVariants({
156
167
  size: size
157
168
  }), className),
158
- checked: checked
169
+ checked: checked,
170
+ onSelect: function onSelect(event) {
171
+ if (!closeOnSelect) {
172
+ event.preventDefault();
173
+ }
174
+ _onSelect === null || _onSelect === void 0 || _onSelect(event);
175
+ }
159
176
  }, props), children, /*#__PURE__*/React.createElement("span", {
160
177
  className: cn('pointer-events-none absolute flex items-center justify-center', dropdownMenuItemIndicatorVariants({
161
178
  size: size
@@ -180,7 +197,7 @@ function DropdownMenuRadioItem(_ref9) {
180
197
  props = _objectWithoutProperties(_ref9, _excluded4);
181
198
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioItem, _extends({
182
199
  "data-slot": "dropdown-menu-radio-item",
183
- className: cn('relative flex cursor-pointer items-center gap-2 rounded-sm outline-hidden select-none', dropdownMenuCheckboxItemVariants({
200
+ className: cn('relative flex cursor-pointer items-center gap-2 rounded-sm outline-hidden select-none', dropdownMenuRadioItemVariants({
184
201
  size: size
185
202
  }), 'focus:bg-secondary data-[state=checked]:bg-accent data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50', "[&_svg:not([class*='text-'])]:text-muted-foreground data-[state=checked]:[&_svg:not([class*='text-'])]:text-primary [&_svg]:pointer-events-none [&_svg]:shrink-0", dropdownMenuIconVariants({
186
203
  size: size
@@ -9,9 +9,14 @@ export declare const dropdownMenuItemSizeOptions: {
9
9
  readonly lg: "px-5 py-2.5 data-[inset]:pl-12 text-lg";
10
10
  };
11
11
  export declare const dropdownMenuCheckboxItemSizeOptions: {
12
- readonly sm: "px-3 py-1.5 pl-8 text-sm";
13
- readonly md: "px-4 py-2 pl-8 text-base";
14
- readonly lg: "px-5 py-2.5 pl-8 text-lg";
12
+ readonly sm: "py-1.5 pl-3 pr-8 text-sm";
13
+ readonly md: "py-2 pl-4 pr-9 text-base";
14
+ readonly lg: "py-2.5 pl-5 pr-10 text-lg";
15
+ };
16
+ export declare const dropdownMenuRadioItemSizeOptions: {
17
+ readonly sm: "py-1.5 pl-8 pr-3 text-sm";
18
+ readonly md: "py-2 pl-9 pr-4 text-base";
19
+ readonly lg: "py-2.5 pl-10 pr-5 text-lg";
15
20
  };
16
21
  export declare const dropdownMenuButtonTriggerOptions: {
17
22
  readonly sm: "px-3 py-1.5 gap-1 text-sm";
@@ -5,7 +5,8 @@ export var DropdownMenuItemSize = {
5
5
  Lg: 'lg'
6
6
  };
7
7
  export var dropdownMenuItemSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'px-3 py-1.5 data-[inset]:pl-8 text-sm'), DropdownMenuItemSize.Md, 'px-4 py-2 data-[inset]:pl-10 text-base'), DropdownMenuItemSize.Lg, 'px-5 py-2.5 data-[inset]:pl-12 text-lg');
8
- export var dropdownMenuCheckboxItemSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'px-3 py-1.5 pl-8 text-sm'), DropdownMenuItemSize.Md, 'px-4 py-2 pl-8 text-base'), DropdownMenuItemSize.Lg, 'px-5 py-2.5 pl-8 text-lg');
8
+ export var dropdownMenuCheckboxItemSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'py-1.5 pl-3 pr-8 text-sm'), DropdownMenuItemSize.Md, 'py-2 pl-4 pr-9 text-base'), DropdownMenuItemSize.Lg, 'py-2.5 pl-5 pr-10 text-lg');
9
+ export var dropdownMenuRadioItemSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'py-1.5 pl-8 pr-3 text-sm'), DropdownMenuItemSize.Md, 'py-2 pl-9 pr-4 text-base'), DropdownMenuItemSize.Lg, 'py-2.5 pl-10 pr-5 text-lg');
9
10
  export var dropdownMenuButtonTriggerOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'px-3 py-1.5 gap-1 text-sm'), DropdownMenuItemSize.Md, 'px-4 py-2 gap-2 text-base'), DropdownMenuItemSize.Lg, 'px-5 py-2.5 gap-2 text-lg');
10
11
  export var dropdownMenuItemIndicatorSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'right-2 size-3.5'), DropdownMenuItemSize.Md, 'right-3 size-4'), DropdownMenuItemSize.Lg, 'right-3 size-5');
11
12
  export var dropdownMenuItemIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'size-3.5'), DropdownMenuItemSize.Md, 'size-4'), DropdownMenuItemSize.Lg, 'size-5');
@@ -3,5 +3,5 @@ import type { InputProps } from './input.types';
3
3
  declare const inputVariants: (props?: ({
4
4
  size?: "sm" | "md" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
- declare function Input({ className, type, size, disabled, readOnly, icon: Icon, suffix, ...props }: InputProps): React.JSX.Element;
6
+ declare function Input({ className, type, size, disabled, readOnly, icon: Icon, suffix, clearable, onClear, value, ...props }: InputProps): React.JSX.Element;
7
7
  export { Input, inputVariants };
@@ -1,13 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "type", "size", "disabled", "readOnly", "icon", "suffix"];
4
+ var _excluded = ["className", "type", "size", "disabled", "readOnly", "icon", "suffix", "clearable", "onClear", "value"];
5
+ import { buttonVariants } from '@scaleflex/ui-tw/button';
6
+ import { ButtonVariant } from '@scaleflex/ui-tw/button/button.constants';
5
7
  import { getBaseInputClasses, readOnlyClassNames, selectionHighlightClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
6
8
  import { FormSize } from '@scaleflex/ui-tw/types/form-size';
7
9
  import { cn } from '@scaleflex/ui-tw/utils/cn';
8
10
  import { cva } from 'class-variance-authority';
11
+ import { XIcon } from 'lucide-react';
9
12
  import React from 'react';
10
- import { InputType, inputIconSizeOptions, inputSizeOptions, inputSuffixSizeOptions, inputWithIconSizeOptions } from './input.constants';
13
+ import { InputType, inputClearButtonSizeOptions, inputClearablePaddingOptions, inputIconSizeOptions, inputSizeOptions, inputSuffixSizeOptions, inputWithIconSizeOptions } from './input.constants';
11
14
  var inputVariants = cva('', {
12
15
  variants: {
13
16
  size: inputSizeOptions
@@ -52,19 +55,25 @@ function Input(_ref) {
52
55
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
53
56
  Icon = _ref.icon,
54
57
  suffix = _ref.suffix,
58
+ _ref$clearable = _ref.clearable,
59
+ clearable = _ref$clearable === void 0 ? false : _ref$clearable,
60
+ onClear = _ref.onClear,
61
+ value = _ref.value,
55
62
  props = _objectWithoutProperties(_ref, _excluded);
56
- var hasAddon = Icon || suffix;
63
+ var showClearButton = clearable && value && !readOnly && !disabled;
64
+ var hasAddon = Icon || suffix || clearable;
57
65
  var inputElement = /*#__PURE__*/React.createElement("input", _extends({
58
66
  type: type,
59
67
  "data-slot": "input",
60
68
  disabled: disabled,
61
69
  readOnly: readOnly,
70
+ value: value,
62
71
  className: cn.apply(void 0, ['flex w-full min-w-0'].concat(_toConsumableArray(getBaseInputClasses()), [readOnlyClassNames, selectionHighlightClassNames, inputVariants({
63
72
  size: size,
64
73
  className: hasAddon ? undefined : className
65
- }), hasAddon && inputWithIconVariants({
74
+ }), (Icon || suffix) && !clearable && inputWithIconVariants({
66
75
  size: size
67
- })]))
76
+ }), clearable && inputClearablePaddingOptions[size]]))
68
77
  }, props));
69
78
  if (!hasAddon) {
70
79
  return inputElement;
@@ -75,10 +84,23 @@ function Input(_ref) {
75
84
  className: cn(inputIconSizeVariants({
76
85
  size: size
77
86
  }), 'text-muted-foreground absolute top-1/2 -translate-y-1/2 transform', disabled && 'opacity-50')
78
- }), suffix && /*#__PURE__*/React.createElement("span", {
87
+ }), suffix && !showClearButton && /*#__PURE__*/React.createElement("span", {
79
88
  className: cn(inputSuffixSizeVariants({
80
89
  size: size
81
90
  }), 'text-muted-foreground absolute top-1/2 -translate-y-1/2 transform', disabled && 'opacity-50')
82
- }, suffix));
91
+ }, suffix), showClearButton && /*#__PURE__*/React.createElement("button", {
92
+ type: "button",
93
+ tabIndex: 0,
94
+ onClick: onClear,
95
+ "data-clear-icon": "true",
96
+ "aria-label": "Clear",
97
+ className: cn(buttonVariants({
98
+ size: inputClearButtonSizeOptions[size],
99
+ variant: ButtonVariant.GhostSecondary
100
+ }), 'absolute top-1/2 right-2 -translate-y-1/2')
101
+ }, /*#__PURE__*/React.createElement(XIcon, {
102
+ "data-clear-icon": true,
103
+ className: "text-muted-foreground/70 hover:text-muted-foreground shrink-0"
104
+ })));
83
105
  }
84
106
  export { Input, inputVariants };
@@ -3,6 +3,11 @@ export declare const inputSizeOptions: {
3
3
  readonly md: "py-3 px-4 h-10 text-base ";
4
4
  readonly lg: "py-3 px-4 h-12 text-lg ";
5
5
  };
6
+ export declare const inputClearButtonSizeOptions: {
7
+ readonly sm: "icon-xs";
8
+ readonly md: "icon-sm";
9
+ readonly lg: "icon-md";
10
+ };
6
11
  export declare const inputItemSizeOptions: {
7
12
  readonly sm: "py-2 px-3 min-h-8 text-sm";
8
13
  readonly md: "py-2 px-4 min-h-10 text-base ";
@@ -28,3 +33,8 @@ export declare const inputWithIconSizeOptions: {
28
33
  md: string;
29
34
  lg: string;
30
35
  };
36
+ export declare const inputClearablePaddingOptions: {
37
+ sm: string;
38
+ md: string;
39
+ lg: string;
40
+ };
@@ -1,6 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { ButtonSize } from '@scaleflex/ui-tw/button';
2
3
  import { FormSize } from '@scaleflex/ui-tw/types/form-size';
3
4
  export var inputSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'py-2 px-3 h-8 text-sm'), FormSize.Md, 'py-3 px-4 h-10 text-base '), FormSize.Lg, 'py-3 px-4 h-12 text-lg ');
5
+ export var inputClearButtonSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, ButtonSize.IconXs), FormSize.Md, ButtonSize.IconSm), FormSize.Lg, ButtonSize.IconMd);
4
6
  export var inputItemSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'py-2 px-3 min-h-8 text-sm'), FormSize.Md, 'py-2 px-4 min-h-10 text-base '), FormSize.Lg, 'py-2.5 px-4 min-h-12 text-lg ');
5
7
  export var InputType = {
6
8
  Text: 'text',
@@ -9,4 +11,5 @@ export var InputType = {
9
11
  };
10
12
  export var inputIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'right-2 size-3'), FormSize.Md, 'right-3 size-4'), FormSize.Lg, 'right-4 size-5');
11
13
  export var inputSuffixSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'right-2 text-xs'), FormSize.Md, 'right-3 text-sm'), FormSize.Lg, 'right-4 text-base');
12
- export var inputWithIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pr-6'), FormSize.Md, 'pr-8'), FormSize.Lg, 'pr-10');
14
+ export var inputWithIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pr-6'), FormSize.Md, 'pr-8'), FormSize.Lg, 'pr-10');
15
+ export var inputClearablePaddingOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pr-9'), FormSize.Md, 'pr-11'), FormSize.Lg, 'pr-12');
@@ -6,4 +6,6 @@ export interface InputProps extends Omit<ComponentProps<'input'>, 'size'> {
6
6
  'aria-invalid'?: boolean;
7
7
  icon?: LucideIcon;
8
8
  suffix?: string;
9
+ clearable?: boolean;
10
+ onClear?: () => void;
9
11
  }
@@ -34,7 +34,7 @@ function Label(_ref) {
34
34
  className: className
35
35
  }))
36
36
  }, props), noTruncate ? children : /*#__PURE__*/React.createElement("span", {
37
- className: cn('truncate')
37
+ className: cn('min-w-0 flex-1 truncate')
38
38
  }, children), (icon || tooltip || disabledTooltip) && /*#__PURE__*/React.createElement(LabelIcon, {
39
39
  size: size,
40
40
  icon: icon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.135",
3
+ "version": "0.0.137",
4
4
  "author": "scaleflex",
5
5
  "repository": "github:scaleflex/ui",
6
6
  "homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
@@ -29,7 +29,7 @@
29
29
  "@radix-ui/react-switch": "^1.0.1",
30
30
  "@radix-ui/react-tabs": "^1.1.13",
31
31
  "@radix-ui/react-tooltip": "^1.2.6",
32
- "@scaleflex/icons-tw": "^0.0.135",
32
+ "@scaleflex/icons-tw": "^0.0.137",
33
33
  "@tanstack/react-table": "^8.21.3",
34
34
  "@types/lodash.merge": "^4.6.9",
35
35
  "class-variance-authority": "^0.7.1",
@@ -3,5 +3,5 @@ import type { TextareaProps } from './textarea.types';
3
3
  declare const textareaVariants: (props?: ({
4
4
  size?: "sm" | "md" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
- declare function Textarea({ className, size, disabled, readOnly, ...props }: TextareaProps): React.JSX.Element;
6
+ declare function Textarea({ className, size, disabled, readOnly, clearable, onClear, value, ...props }: TextareaProps): React.JSX.Element;
7
7
  export { Textarea, textareaVariants };
@@ -1,12 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["className", "size", "disabled", "readOnly"];
3
+ var _excluded = ["className", "size", "disabled", "readOnly", "clearable", "onClear", "value"];
4
+ import { buttonVariants } from '@scaleflex/ui-tw/button';
5
+ import { ButtonVariant } from '@scaleflex/ui-tw/button/button.constants';
4
6
  import { focusRingClassNames, getBaseInputClasses, readOnlyClassNames, selectionHighlightClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
5
7
  import { FormSize } from '@scaleflex/ui-tw/types/form-size';
6
8
  import { cn } from '@scaleflex/ui-tw/utils/cn';
7
9
  import { cva } from 'class-variance-authority';
10
+ import { XIcon } from 'lucide-react';
8
11
  import React from 'react';
9
- import { textareaSizeOptions } from './textarea.constants';
12
+ import { textareaClearButtonSizeOptions, textareaClearablePaddingOptions, textareaSizeOptions } from './textarea.constants';
10
13
  var textareaVariants = cva('', {
11
14
  variants: {
12
15
  size: textareaSizeOptions
@@ -23,14 +26,39 @@ function Textarea(_ref) {
23
26
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
24
27
  _ref$readOnly = _ref.readOnly,
25
28
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
29
+ _ref$clearable = _ref.clearable,
30
+ clearable = _ref$clearable === void 0 ? false : _ref$clearable,
31
+ onClear = _ref.onClear,
32
+ value = _ref.value,
26
33
  props = _objectWithoutProperties(_ref, _excluded);
27
- return /*#__PURE__*/React.createElement("textarea", _extends({
34
+ var showClearButton = clearable && value && !readOnly && !disabled;
35
+ var textareaElement = /*#__PURE__*/React.createElement("textarea", _extends({
28
36
  "data-slot": "textarea",
29
37
  disabled: disabled,
30
38
  readOnly: readOnly,
39
+ value: value,
31
40
  className: cn('flex field-sizing-content w-full resize-y', getBaseInputClasses(), readOnlyClassNames, selectionHighlightClassNames, focusRingClassNames, textareaVariants({
32
41
  size: size
33
- }), className)
42
+ }), clearable && textareaClearablePaddingOptions[size], clearable ? undefined : className)
34
43
  }, props));
44
+ if (!clearable) {
45
+ return textareaElement;
46
+ }
47
+ return /*#__PURE__*/React.createElement("div", {
48
+ className: cn('relative', className)
49
+ }, textareaElement, showClearButton && /*#__PURE__*/React.createElement("button", {
50
+ type: "button",
51
+ tabIndex: 0,
52
+ onClick: onClear,
53
+ "data-clear-icon": "true",
54
+ "aria-label": "Clear",
55
+ className: cn(buttonVariants({
56
+ size: textareaClearButtonSizeOptions[size],
57
+ variant: ButtonVariant.GhostSecondary
58
+ }), 'absolute top-2 right-2')
59
+ }, /*#__PURE__*/React.createElement(XIcon, {
60
+ "data-clear-icon": true,
61
+ className: "text-muted-foreground/70 hover:text-muted-foreground shrink-0"
62
+ })));
35
63
  }
36
64
  export { Textarea, textareaVariants };
@@ -3,6 +3,16 @@ export declare const textareaSizeOptions: {
3
3
  readonly md: "py-3 px-4 text-base min-h-16 max-h-48";
4
4
  readonly lg: "py-3 px-4 text-lg min-h-20 max-h-60";
5
5
  };
6
+ export declare const textareaClearButtonSizeOptions: {
7
+ readonly sm: "icon-xs";
8
+ readonly md: "icon-sm";
9
+ readonly lg: "icon-md";
10
+ };
11
+ export declare const textareaClearablePaddingOptions: {
12
+ readonly sm: "pr-9";
13
+ readonly md: "pr-11";
14
+ readonly lg: "pr-12";
15
+ };
6
16
  export declare const textareaWithActionsSizeOptions: {
7
17
  readonly sm: "pb-10 scroll-pb-10";
8
18
  readonly md: "pb-12 scroll-pb-12";
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { ButtonSize } from '@scaleflex/ui-tw/button';
2
3
  import { FormSize } from '@scaleflex/ui-tw/types/form-size';
3
4
  export var textareaSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'py-2 px-3 text-sm min-h-14 max-h-44'), FormSize.Md, 'py-3 px-4 text-base min-h-16 max-h-48'), FormSize.Lg, 'py-3 px-4 text-lg min-h-20 max-h-60');
5
+ export var textareaClearButtonSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, ButtonSize.IconXs), FormSize.Md, ButtonSize.IconSm), FormSize.Lg, ButtonSize.IconMd);
6
+ export var textareaClearablePaddingOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pr-9'), FormSize.Md, 'pr-11'), FormSize.Lg, 'pr-12');
4
7
  export var textareaWithActionsSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pb-10 scroll-pb-10'), FormSize.Md, 'pb-12 scroll-pb-12'), FormSize.Lg, 'pb-14 scroll-pb-14');
5
8
  export var textareaBottomActionAreaPadding = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'h-8'), FormSize.Md, 'h-10'), FormSize.Lg, 'h-12');
@@ -3,6 +3,8 @@ import type { ComponentProps, ReactElement } from 'react';
3
3
  export interface TextareaProps extends Omit<ComponentProps<'textarea'>, 'size'> {
4
4
  size?: FormSizeType;
5
5
  'aria-invalid'?: boolean;
6
+ clearable?: boolean;
7
+ onClear?: () => void;
6
8
  }
7
9
  export interface TextareaWithActionsProps extends TextareaProps {
8
10
  leftToolbar?: ReactElement;