@beydesign/storybook 0.0.88 → 0.0.90

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 TextInput = ({ label, value, onChange, placeholder, hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, required, labelTrailingElement, labelContainerStyle, }) => {
6
+ export const TextInput = ({ label, value, onChange, placeholder, type = 'text', hintText, errorText, disabled, trailingText, style, hintBubbleText, hintBubbleProps, 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 && (_jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)', sx: labelContainerStyle, children: [_jsx(Typography, { size: TypographySize.HeadingXS, weight: TypographyWeight.SemiBold, required: required, children: label }), labelTrailingElement] })), hintBubbleText && (_jsx(HintBubble, { text: hintBubbleText, size: HintBubbleSize.sm, ...hintBubbleProps })), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', bgcolor: 'var(--colors-light-background-bg-component)', border: errorText
9
9
  ? 'none'
@@ -11,7 +11,7 @@ export const TextInput = ({ label, value, onChange, placeholder, hintText, error
11
11
  ? '1px solid var(--colors-light-border-border-error)'
12
12
  : focused
13
13
  ? '1px solid var(--colors-light-border-border-component-active)'
14
- : 'transparent'}`, children: _jsx("input", { type: "text", value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, style: {
14
+ : 'transparent'}`, children: _jsx("input", { type: type, value: value, onChange: (e) => onChange(e.target.value), placeholder: placeholder, disabled: disabled, style: {
15
15
  border: 'none',
16
16
  outline: 'none',
17
17
  width: '100%',
@@ -34,6 +34,16 @@ declare const meta: {
34
34
  };
35
35
  };
36
36
  };
37
+ type: {
38
+ control: "select";
39
+ description: string;
40
+ options: string[];
41
+ table: {
42
+ type: {
43
+ summary: string;
44
+ };
45
+ };
46
+ };
37
47
  hintText: {
38
48
  control: "text";
39
49
  description: string;
@@ -128,3 +138,5 @@ declare const meta: {
128
138
  export default meta;
129
139
  type Story = StoryObj<typeof meta>;
130
140
  export declare const Default: Story;
141
+ export declare const Password: Story;
142
+ export declare const Email: Story;
@@ -28,6 +28,14 @@ const meta = {
28
28
  type: { summary: 'string' },
29
29
  },
30
30
  },
31
+ type: {
32
+ control: 'select',
33
+ description: 'The type of the text input',
34
+ options: ['text', 'password', 'email', 'number', 'tel', 'url'],
35
+ table: {
36
+ type: { summary: 'string' },
37
+ },
38
+ },
31
39
  hintText: {
32
40
  control: 'text',
33
41
  description: 'The hint text of the text input',
@@ -108,3 +116,21 @@ export const Default = {
108
116
  hintBubbleText: 'This is a hint bubble',
109
117
  },
110
118
  };
119
+ export const Password = {
120
+ args: {
121
+ label: 'Password',
122
+ value: 'password',
123
+ type: 'password',
124
+ onChange: () => { },
125
+ hintBubbleText: 'This is a hint bubble',
126
+ },
127
+ };
128
+ export const Email = {
129
+ args: {
130
+ label: 'Email',
131
+ value: 'email',
132
+ type: 'email',
133
+ onChange: () => { },
134
+ hintBubbleText: 'This is a hint bubble',
135
+ },
136
+ };
@@ -1,6 +1,7 @@
1
1
  import { SxProps, Theme } from '@mui/material';
2
2
  import { HintBubbleProps } from '../UI';
3
3
  import { IconName } from '../../utils';
4
+ import React from 'react';
4
5
  /**
5
6
  * Text area component props
6
7
  */
@@ -52,6 +53,8 @@ export type TextInputProps = {
52
53
  onChange: (value: string) => void;
53
54
  /** Text input placeholder */
54
55
  placeholder?: string;
56
+ /** Text input type */
57
+ type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
55
58
  /** Text input hint */
56
59
  hintText?: string;
57
60
  /** Text input error */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.88",
4
+ "version": "0.0.90",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",