@beydesign/storybook 0.0.71 → 0.0.72

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.
@@ -3,7 +3,7 @@ import { useState } from 'react';
3
3
  import { Box } from '@mui/material';
4
4
  import { Typography, TypographySize, TypographyWeight } from '../Typography';
5
5
  import { HintBubble, HintBubbleSize } from '../UI';
6
- export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, labelTrailingElement, labelContainerStyle, }) => {
6
+ export const TextArea = ({ label, value, onChange, placeholder, hintText, errorText, disabled, allowMaxLength = false, maxLength = 256, showMaxLengthIndicator = false, numberOfRows = 5, style, hintBubbleProps, hintBubbleText, required, labelTrailingElement, labelContainerStyle, }) => {
7
7
  const [focused, setFocused] = useState(false);
8
8
  return (_jsx(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: style, children: _jsxs(Box, { display: 'flex', flexDirection: 'column', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-lg)', minWidth: '260px', children: [label && (_jsx(Typography, { text: label, size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, trailingElement: labelTrailingElement, style: labelContainerStyle })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsx(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: `1px solid ${errorText
9
9
  ? 'var(--colors-light-border-border-error)'
@@ -19,5 +19,5 @@ export const TextArea = ({ label, value, onChange, placeholder, hintText, errorT
19
19
  : 'var(--colors-light-text-text-title)',
20
20
  backgroundColor: 'transparent',
21
21
  resize: 'none',
22
- }, maxLength: maxLength, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
22
+ }, maxLength: allowMaxLength ? maxLength : undefined, onFocus: () => setFocused(true), onBlur: () => setFocused(false), required: required }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', children: [errorText ? (_jsx(Typography, { text: errorText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)' })) : hintText ? (_jsx(Typography, { text: hintText, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)' })) : (_jsx(Box, { style: { flex: 1 } })), showMaxLengthIndicator && allowMaxLength && maxLength && (_jsx(Typography, { text: `${maxLength - value.length}`, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-subtle)', style: { alignSelf: 'flex-end' } }))] })] }) }));
23
23
  };
@@ -141,8 +141,21 @@ declare const meta: {
141
141
  };
142
142
  };
143
143
  };
144
+ allowMaxLength: {
145
+ control: "boolean";
146
+ description: string;
147
+ table: {
148
+ type: {
149
+ summary: string;
150
+ };
151
+ defaultValue: {
152
+ summary: string;
153
+ };
154
+ };
155
+ };
144
156
  };
145
157
  };
146
158
  export default meta;
147
159
  type Story = StoryObj<typeof meta>;
148
160
  export declare const Default: Story;
161
+ export declare const WithMaxLength: Story;
@@ -111,6 +111,14 @@ const meta = {
111
111
  type: { summary: 'ReactNode' },
112
112
  },
113
113
  },
114
+ allowMaxLength: {
115
+ control: 'boolean',
116
+ description: 'Whether to apply max length restriction',
117
+ table: {
118
+ type: { summary: 'boolean' },
119
+ defaultValue: { summary: 'false' },
120
+ },
121
+ },
114
122
  },
115
123
  };
116
124
  export default meta;
@@ -118,6 +126,17 @@ export const Default = {
118
126
  args: {
119
127
  label: "Agent's name",
120
128
  value: 'Anna',
121
- onChange: () => { },
129
+ onChange: (_value) => { },
130
+ },
131
+ };
132
+ export const WithMaxLength = {
133
+ args: {
134
+ label: 'Limited Text Area',
135
+ value: '',
136
+ onChange: (_value) => { },
137
+ allowMaxLength: true,
138
+ maxLength: 100,
139
+ showMaxLengthIndicator: true,
140
+ placeholder: 'Enter text (max 100 characters)',
122
141
  },
123
142
  };
@@ -19,6 +19,8 @@ export type TextAreaProps = {
19
19
  errorText?: string;
20
20
  /** Text input disabled */
21
21
  disabled?: boolean;
22
+ /** Whether to apply max length restriction */
23
+ allowMaxLength?: boolean;
22
24
  /** Text input max length */
23
25
  maxLength?: number;
24
26
  /** Text input show max length indicator */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.71",
4
+ "version": "0.0.72",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",