@algorithm-shift/design-system 1.2.12 → 1.2.13
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/index.css +2314 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/src/components/Basic/Image/Image.stories.tsx +0 -13
- package/src/components/Basic/Image/Image.tsx +0 -52
- package/src/components/Basic/Shape/Shape.tsx +0 -16
- package/src/components/Basic/Typography/Typography.stories.tsx +0 -18
- package/src/components/Basic/Typography/Typography.tsx +0 -31
- package/src/components/DataDisplay/Table/Table.stories.tsx +0 -35
- package/src/components/DataDisplay/Table/Table.tsx +0 -15
- package/src/components/DataDisplay/index.ts +0 -1
- package/src/components/Global/SelectDropdown.tsx +0 -61
- package/src/components/Global/TinyMceEditor.tsx +0 -81
- package/src/components/Inputs/Checkbox/Checkbox.tsx +0 -18
- package/src/components/Inputs/DatePicker/DatePicker.tsx +0 -81
- package/src/components/Inputs/DateRange/DateRange.tsx +0 -64
- package/src/components/Inputs/Dropdown/Dropdown.tsx +0 -62
- package/src/components/Inputs/EmailInput/EmailInput.tsx +0 -64
- package/src/components/Inputs/FileInput/FileInput.tsx +0 -24
- package/src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx +0 -24
- package/src/components/Inputs/NumberInput/NumberInput.tsx +0 -66
- package/src/components/Inputs/PasswordInput/PasswordInput.tsx +0 -66
- package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -58
- package/src/components/Inputs/RadioInput/RadioInput.tsx +0 -24
- package/src/components/Inputs/RichText/RichText.tsx +0 -10
- package/src/components/Inputs/SearchInput/SearchInput.tsx +0 -64
- package/src/components/Inputs/SwitchToggle/SwitchToggle.tsx +0 -22
- package/src/components/Inputs/TextInput/TextInput.tsx +0 -59
- package/src/components/Inputs/Textarea/Textarea.tsx +0 -58
- package/src/components/Inputs/UrlInput/UrlInput.tsx +0 -66
- package/src/components/Layout/Flex.tsx +0 -13
- package/src/components/Layout/Grid.tsx +0 -13
- package/src/components/Navigation/Logo/Logo.stories.tsx +0 -25
- package/src/components/Navigation/Logo/Logo.tsx +0 -33
- package/src/components/Navigation/Notification/Notification.stories.tsx +0 -20
- package/src/components/Navigation/Notification/Notification.tsx +0 -20
- package/src/components/Navigation/Profile/Profile.stories.tsx +0 -20
- package/src/components/Navigation/Profile/Profile.tsx +0 -25
- package/src/components/Navigation/Spacer/Spacer.stories.tsx +0 -18
- package/src/components/Navigation/Spacer/Spacer.tsx +0 -11
- package/src/components/Navigation/Stages/Stages.stories.tsx +0 -24
- package/src/components/Navigation/Stages/Stages.tsx +0 -49
- package/src/components/Navigation/Tabs/Tabs.stories.tsx +0 -38
- package/src/components/Navigation/Tabs/Tabs.tsx +0 -72
- package/src/components/Navigation/index.ts +0 -6
- package/src/components/index.ts +0 -27
- package/src/components/ui/button.stories.tsx +0 -24
- package/src/components/ui/button.tsx +0 -59
- package/src/components/ui/calendar.tsx +0 -211
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/data-table.tsx +0 -138
- package/src/components/ui/dropdown-menu.tsx +0 -258
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/label.tsx +0 -22
- package/src/components/ui/popover.tsx +0 -46
- package/src/components/ui/radio-group.tsx +0 -43
- package/src/components/ui/select.tsx +0 -183
- package/src/components/ui/switch.tsx +0 -29
- package/src/components/ui/table.tsx +0 -121
- package/src/components/ui/textarea.tsx +0 -18
- package/src/global.css +0 -6
- package/src/index.css +0 -119
- package/src/index.ts +0 -4
- package/src/lib/utils.ts +0 -6
- package/src/stories/Button.stories.ts +0 -54
- package/src/stories/Button.tsx +0 -35
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -34
- package/src/stories/Header.tsx +0 -54
- package/src/stories/Page.stories.ts +0 -33
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -68
- package/src/types/global.d.ts +0 -85
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Calculator } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { Input } from '@/components/ui/input';
|
|
6
|
-
import { NumberInputProps } from '@/types/global';
|
|
7
|
-
|
|
8
|
-
const NumberInput = ({ className, style, ...props }: NumberInputProps) => {
|
|
9
|
-
|
|
10
|
-
const placeholder = props.placeholder ?? 'Placeholder text';
|
|
11
|
-
|
|
12
|
-
// Controls
|
|
13
|
-
const regexPattern = props.regexPattern ?? '';
|
|
14
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
15
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
16
|
-
const isRequired = props.isRequired ?? false;
|
|
17
|
-
const isEditable = props.isEditable ?? true;
|
|
18
|
-
const isDisabled = props.isDisabled ?? false;
|
|
19
|
-
const isReadonly = props.isReadonly ?? false;
|
|
20
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
21
|
-
|
|
22
|
-
const [value, setValue] = React.useState('');
|
|
23
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
24
|
-
|
|
25
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
26
|
-
const val = e.target.value;
|
|
27
|
-
if (val.length > noOfCharacters) return;
|
|
28
|
-
setValue(val);
|
|
29
|
-
if (isRequired && val.trim() === '') {
|
|
30
|
-
setError(errorMessage);
|
|
31
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
32
|
-
setError(errorMessage);
|
|
33
|
-
} else {
|
|
34
|
-
setError(null);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<div className="flex justify-start items-center relative">
|
|
41
|
-
<Calculator className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#BDBDBD]" />
|
|
42
|
-
<Input
|
|
43
|
-
type="number"
|
|
44
|
-
id={'number-field'}
|
|
45
|
-
value={value}
|
|
46
|
-
className={className}
|
|
47
|
-
style={style}
|
|
48
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
49
|
-
placeholder={placeholder}
|
|
50
|
-
onChange={handleChange}
|
|
51
|
-
disabled={isDisabled || !isEditable}
|
|
52
|
-
readOnly={isReadonly}
|
|
53
|
-
required={isRequired}
|
|
54
|
-
maxLength={noOfCharacters}
|
|
55
|
-
pattern={regexPattern || undefined}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
{error && (
|
|
60
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
61
|
-
)}
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { NumberInput };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { ScanEye } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { Input } from '@/components/ui/input';
|
|
6
|
-
import { PasswordInputProps } from '@/types/global';
|
|
7
|
-
|
|
8
|
-
const PasswordInput = ({ className, style, ...props }: PasswordInputProps) => {
|
|
9
|
-
|
|
10
|
-
const placeholder = props.placeholder ?? 'Placeholder text';
|
|
11
|
-
|
|
12
|
-
// Controls
|
|
13
|
-
const regexPattern = props.regexPattern ?? '';
|
|
14
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
15
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
16
|
-
const isRequired = props.isRequired ?? false;
|
|
17
|
-
const isEditable = props.isEditable ?? true;
|
|
18
|
-
const isDisabled = props.isDisabled ?? false;
|
|
19
|
-
const isReadonly = props.isReadonly ?? false;
|
|
20
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
21
|
-
|
|
22
|
-
const [value, setValue] = React.useState('');
|
|
23
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
24
|
-
|
|
25
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
26
|
-
const val = e.target.value;
|
|
27
|
-
if (val.length > noOfCharacters) return;
|
|
28
|
-
setValue(val);
|
|
29
|
-
if (isRequired && val.trim() === '') {
|
|
30
|
-
setError(errorMessage);
|
|
31
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
32
|
-
setError(errorMessage);
|
|
33
|
-
} else {
|
|
34
|
-
setError(null);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<div className="flex justify-start items-center relative">
|
|
41
|
-
<ScanEye className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#BDBDBD]" />
|
|
42
|
-
<Input
|
|
43
|
-
type="password"
|
|
44
|
-
id={'password-field'}
|
|
45
|
-
className={className}
|
|
46
|
-
style={style}
|
|
47
|
-
value={value}
|
|
48
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
49
|
-
placeholder={placeholder}
|
|
50
|
-
onChange={handleChange}
|
|
51
|
-
disabled={isDisabled || !isEditable}
|
|
52
|
-
readOnly={isReadonly}
|
|
53
|
-
required={isRequired}
|
|
54
|
-
maxLength={noOfCharacters}
|
|
55
|
-
pattern={regexPattern || undefined}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
{error && (
|
|
60
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
61
|
-
)}
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { PasswordInput };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { PhoneInputProps } from '@/types/global';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
import { PhoneInput as PhoneInputField } from 'react-international-phone';
|
|
5
|
-
import 'react-international-phone/style.css';
|
|
6
|
-
|
|
7
|
-
const PhoneInput = ({ className, style, ...props }: PhoneInputProps) => {
|
|
8
|
-
const placeholder = props.placeholder ?? 'Enter phone number';
|
|
9
|
-
|
|
10
|
-
const [value, setValue] = React.useState('');
|
|
11
|
-
|
|
12
|
-
// Controls
|
|
13
|
-
const regexPattern = props.regexPattern ?? '';
|
|
14
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
15
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
16
|
-
const isRequired = props.isRequired ?? false;
|
|
17
|
-
const isEditable = props.isEditable ?? true;
|
|
18
|
-
const isDisabled = props.isDisabled ?? false;
|
|
19
|
-
|
|
20
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
21
|
-
|
|
22
|
-
const handleChange = (val: any) => {
|
|
23
|
-
if (val.length > noOfCharacters) return;
|
|
24
|
-
setValue(val);
|
|
25
|
-
if (isRequired && val.trim() === '') {
|
|
26
|
-
setError(errorMessage);
|
|
27
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
28
|
-
setError(errorMessage);
|
|
29
|
-
} else {
|
|
30
|
-
setError(null);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<>
|
|
36
|
-
<PhoneInputField
|
|
37
|
-
defaultCountry="in"
|
|
38
|
-
value={value}
|
|
39
|
-
onChange={(phone: string) => handleChange(phone)}
|
|
40
|
-
inputProps={{
|
|
41
|
-
id: 'phone-field',
|
|
42
|
-
required: isRequired,
|
|
43
|
-
}}
|
|
44
|
-
placeholder={placeholder}
|
|
45
|
-
disabled={isDisabled || !isEditable}
|
|
46
|
-
required={isRequired}
|
|
47
|
-
className={className}
|
|
48
|
-
style={style}
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
{error && (
|
|
52
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
53
|
-
)}
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { PhoneInput };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Label } from '@/components/ui/label';
|
|
2
|
-
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
|
3
|
-
import { RadioInputProps } from '@/types/global';
|
|
4
|
-
|
|
5
|
-
const RadioInput = ({ className, style, ...props }: RadioInputProps) => {
|
|
6
|
-
const text = Array.isArray(props.text)
|
|
7
|
-
? props.text
|
|
8
|
-
: [props.text ?? 'Subscribe'];
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className={className} style={style}>
|
|
12
|
-
<RadioGroup defaultValue="option-1">
|
|
13
|
-
{text?.map((item: string, index: number) => (
|
|
14
|
-
<div className="flex items-center space-x-2" key={index}>
|
|
15
|
-
<RadioGroupItem value={item} id={`r${index}`} />
|
|
16
|
-
<Label htmlFor={`r${index}`}>{item}</Label>
|
|
17
|
-
</div>
|
|
18
|
-
))}
|
|
19
|
-
</RadioGroup>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { RadioInput };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import TinyMceEditor from '@/components/Global/TinyMceEditor';
|
|
2
|
-
import { RichTextInputProps } from '@/types/global';
|
|
3
|
-
|
|
4
|
-
export default function RichText({ className, style }: RichTextInputProps) {
|
|
5
|
-
return (
|
|
6
|
-
<div className={className} style={style}>
|
|
7
|
-
<TinyMceEditor isDefault={true} />
|
|
8
|
-
</div>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Search } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import { Input } from '@/components/ui/input';
|
|
6
|
-
import { SearchInputProps } from '@/types/global';
|
|
7
|
-
|
|
8
|
-
const SearchInput = ({ className, style, ...props }: SearchInputProps) => {
|
|
9
|
-
const placeholder = props.placeholder ?? 'Placeholder text';
|
|
10
|
-
// Controls
|
|
11
|
-
const regexPattern = props.regexPattern ?? '';
|
|
12
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
13
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
14
|
-
const isRequired = props.isRequired ?? false;
|
|
15
|
-
const isEditable = props.isEditable ?? true;
|
|
16
|
-
const isDisabled = props.isDisabled ?? false;
|
|
17
|
-
const isReadonly = props.isReadonly ?? false;
|
|
18
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = React.useState('');
|
|
21
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
22
|
-
|
|
23
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
-
const val = e.target.value;
|
|
25
|
-
if (val.length > noOfCharacters) return;
|
|
26
|
-
setValue(val);
|
|
27
|
-
if (isRequired && val.trim() === '') {
|
|
28
|
-
setError(errorMessage);
|
|
29
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
30
|
-
setError(errorMessage);
|
|
31
|
-
} else {
|
|
32
|
-
setError(null);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
<div className="flex justify-start items-center relative">
|
|
39
|
-
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#BDBDBD]" />
|
|
40
|
-
<Input
|
|
41
|
-
type="text"
|
|
42
|
-
id={'text-field'}
|
|
43
|
-
className={className}
|
|
44
|
-
style={style}
|
|
45
|
-
value={value}
|
|
46
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
47
|
-
placeholder={placeholder}
|
|
48
|
-
onChange={handleChange}
|
|
49
|
-
disabled={isDisabled || !isEditable}
|
|
50
|
-
readOnly={isReadonly}
|
|
51
|
-
required={isRequired}
|
|
52
|
-
maxLength={noOfCharacters}
|
|
53
|
-
pattern={regexPattern || undefined}
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
{error && (
|
|
58
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
59
|
-
)}
|
|
60
|
-
</>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { SearchInput };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Label } from '@/components/ui/label';
|
|
2
|
-
import { Switch } from '@/components/ui/switch';
|
|
3
|
-
import { SwitchToggleInputProps } from '@/types/global';
|
|
4
|
-
|
|
5
|
-
const SwitchToggle = ({ className, style, ...props }: SwitchToggleInputProps) => {
|
|
6
|
-
const text = Array.isArray(props.text)
|
|
7
|
-
? props.text
|
|
8
|
-
: [props.text ?? 'Subscribe'];
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className={className} style={style}>
|
|
12
|
-
{text?.map((item: string, index: number) => (
|
|
13
|
-
<div className="flex items-center space-x-2 mb-2" key={index}>
|
|
14
|
-
<Switch id={`switch-${index}`} />
|
|
15
|
-
<Label htmlFor={`switch-${index}`}>{item}</Label>
|
|
16
|
-
</div>
|
|
17
|
-
))}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { SwitchToggle }
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Input } from '@/components/ui/input';
|
|
4
|
-
import { TextInputProps } from '@/types/global';
|
|
5
|
-
|
|
6
|
-
const TextInput = ({ className, style, ...props }: TextInputProps) => {
|
|
7
|
-
|
|
8
|
-
const placeholder = props.placeholder || 'Placeholder text';
|
|
9
|
-
|
|
10
|
-
// Controls
|
|
11
|
-
const regexPattern = props.regexPattern ?? '';
|
|
12
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
13
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
14
|
-
const isRequired = props.isRequired ?? false;
|
|
15
|
-
const isEditable = props.isEditable ?? true;
|
|
16
|
-
const isDisabled = props.isDisabled ?? false;
|
|
17
|
-
const isReadonly = props.isReadonly ?? false;
|
|
18
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = React.useState('');
|
|
21
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
22
|
-
|
|
23
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
-
const val = e.target.value;
|
|
25
|
-
if (val.length > noOfCharacters) return;
|
|
26
|
-
setValue(val);
|
|
27
|
-
if (isRequired && val.trim() === '') {
|
|
28
|
-
setError(errorMessage);
|
|
29
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
30
|
-
setError(errorMessage);
|
|
31
|
-
} else {
|
|
32
|
-
setError(null);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
<Input
|
|
39
|
-
type="text"
|
|
40
|
-
className={className}
|
|
41
|
-
style={style}
|
|
42
|
-
value={value}
|
|
43
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
44
|
-
placeholder={placeholder}
|
|
45
|
-
onChange={handleChange}
|
|
46
|
-
disabled={isDisabled || !isEditable}
|
|
47
|
-
readOnly={isReadonly}
|
|
48
|
-
required={isRequired}
|
|
49
|
-
maxLength={noOfCharacters}
|
|
50
|
-
pattern={regexPattern || undefined}
|
|
51
|
-
/>
|
|
52
|
-
{error && (
|
|
53
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
54
|
-
)}
|
|
55
|
-
</>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { TextInput };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Textarea as TextareaInput } from '@/components/ui/textarea';
|
|
4
|
-
import { TextAreaProps } from '@/types/global';
|
|
5
|
-
|
|
6
|
-
const Textarea = ({ className, style, ...props }: TextAreaProps) => {
|
|
7
|
-
const placeholder = props.placeholder ?? 'Placeholder text';
|
|
8
|
-
|
|
9
|
-
// Controls
|
|
10
|
-
const regexPattern = props.regexPattern ?? '';
|
|
11
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
12
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
13
|
-
const isRequired = props.isRequired ?? false;
|
|
14
|
-
const isEditable = props.isEditable ?? true;
|
|
15
|
-
const isDisabled = props.isDisabled ?? false;
|
|
16
|
-
const isReadonly = props.isReadonly ?? false;
|
|
17
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
18
|
-
|
|
19
|
-
const [value, setValue] = React.useState('');
|
|
20
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
21
|
-
|
|
22
|
-
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
23
|
-
const val = e.target.value;
|
|
24
|
-
if (val.length > noOfCharacters) return;
|
|
25
|
-
setValue(val);
|
|
26
|
-
if (isRequired && val.trim() === '') {
|
|
27
|
-
setError(errorMessage);
|
|
28
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
29
|
-
setError(errorMessage);
|
|
30
|
-
} else {
|
|
31
|
-
setError(null);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<>
|
|
37
|
-
<TextareaInput
|
|
38
|
-
id={'textarea-field'}
|
|
39
|
-
className={className}
|
|
40
|
-
style={style}
|
|
41
|
-
value={value}
|
|
42
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
43
|
-
placeholder={placeholder}
|
|
44
|
-
onChange={handleChange}
|
|
45
|
-
disabled={isDisabled || !isEditable}
|
|
46
|
-
readOnly={isReadonly}
|
|
47
|
-
required={isRequired}
|
|
48
|
-
maxLength={noOfCharacters}
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
{error && (
|
|
52
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
53
|
-
)}
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { Textarea };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
import { Input } from '@/components/ui/input';
|
|
5
|
-
import { UrlInputProps } from '@/types/global';
|
|
6
|
-
|
|
7
|
-
const UrlInput = ({ className, style, ...props }: UrlInputProps) => {
|
|
8
|
-
const placeholder = props.placeholder ?? 'Placeholder text';
|
|
9
|
-
|
|
10
|
-
// Controls
|
|
11
|
-
const regexPattern = props.regexPattern ?? '';
|
|
12
|
-
const errorMessage = props.errorMessage ?? 'Required';
|
|
13
|
-
const noOfCharacters = props.noOfCharacters ?? 100;
|
|
14
|
-
const isRequired = props.isRequired ?? false;
|
|
15
|
-
const isEditable = props.isEditable ?? true;
|
|
16
|
-
const isDisabled = props.isDisabled ?? false;
|
|
17
|
-
const isReadonly = props.isReadonly ?? false;
|
|
18
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
19
|
-
|
|
20
|
-
const [value, setValue] = React.useState('');
|
|
21
|
-
const [error, setError] = React.useState<string | null>(null);
|
|
22
|
-
|
|
23
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
-
const val = e.target.value;
|
|
25
|
-
if (val.length > noOfCharacters) return;
|
|
26
|
-
setValue(val);
|
|
27
|
-
if (isRequired && val.trim() === '') {
|
|
28
|
-
setError(errorMessage);
|
|
29
|
-
} else if (regexPattern && !new RegExp(regexPattern).test(val)) {
|
|
30
|
-
setError(errorMessage);
|
|
31
|
-
} else {
|
|
32
|
-
setError(null);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
<div className="flex justify-start items-center relative">
|
|
39
|
-
<div className="bg-[#E9E9E9] absolute px-10 text-center top-1/2 h-full justify-center items-center flex w-10 -translate-y-1/2 text-[#383838] font-[500] text-[12px]">
|
|
40
|
-
https://
|
|
41
|
-
</div>
|
|
42
|
-
<Input
|
|
43
|
-
type="url"
|
|
44
|
-
className={className}
|
|
45
|
-
style={style}
|
|
46
|
-
id={'url-field'}
|
|
47
|
-
value={value}
|
|
48
|
-
autoComplete={isAutocomplete ? 'on' : 'off'}
|
|
49
|
-
placeholder={placeholder}
|
|
50
|
-
onChange={handleChange}
|
|
51
|
-
disabled={isDisabled || !isEditable}
|
|
52
|
-
readOnly={isReadonly}
|
|
53
|
-
required={isRequired}
|
|
54
|
-
maxLength={noOfCharacters}
|
|
55
|
-
pattern={regexPattern || undefined}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
{error && (
|
|
60
|
-
<p className="mt-1 text-xs text-red-500">{error}</p>
|
|
61
|
-
)}
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { UrlInput };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
|
|
3
|
-
import Logo from './Logo';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
component: Logo,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
} satisfies Meta<typeof Logo>;
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
imageUrl: 'https://placehold.co/200x200',
|
|
17
|
-
className: '',
|
|
18
|
-
style: {
|
|
19
|
-
width: '200PX',
|
|
20
|
-
height: '200PX',
|
|
21
|
-
objectFit: 'contain',
|
|
22
|
-
borderColor: '#E5E7EB',
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { LogoProps } from '@/types/global';
|
|
2
|
-
|
|
3
|
-
const ImageControl = ({
|
|
4
|
-
className,
|
|
5
|
-
style,
|
|
6
|
-
imageUrl
|
|
7
|
-
}: LogoProps) => {
|
|
8
|
-
|
|
9
|
-
let src: string;
|
|
10
|
-
let extraProps: Record<string, any>;
|
|
11
|
-
|
|
12
|
-
if (imageUrl) {
|
|
13
|
-
src = imageUrl;
|
|
14
|
-
extraProps = {
|
|
15
|
-
className: 'w-full h-full',
|
|
16
|
-
};
|
|
17
|
-
} else {
|
|
18
|
-
src = 'https://builder.development.algorithmshift.ai/_next/image?url=%2Fdrag_and_drop.png&w=1920&q=75';
|
|
19
|
-
extraProps = {
|
|
20
|
-
width: 50,
|
|
21
|
-
height: 50,
|
|
22
|
-
className: 'opacity-50',
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className={className} style={style}>
|
|
28
|
-
<img src={src} alt="Preview" sizes="100vw" {...extraProps} />
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default ImageControl;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
|
|
3
|
-
import Notification from './Notification';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
component: Notification,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
} satisfies Meta<typeof Notification>;
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
badgeType: 'number',
|
|
17
|
-
badgeCount: 5,
|
|
18
|
-
hideBadgeWhenZero: true
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { NotificationProps } from "@/types/global";
|
|
4
|
-
|
|
5
|
-
const Notification = ({ className, style, badgeType, badgeCount = 0, hideBadgeWhenZero }: NotificationProps) => {
|
|
6
|
-
return (
|
|
7
|
-
<div className={className} style={style}>
|
|
8
|
-
<div className='w-[34px] h-[34px] bg-[#E9E9E9] rounded-md text-center flex items-center justify-center relative'>
|
|
9
|
-
<img
|
|
10
|
-
src='https://builder.development.algorithmshift.ai/images/toolset/notification.svg' alt="auto" width={18} height={18}
|
|
11
|
-
/>
|
|
12
|
-
{badgeType === 'number' && !(hideBadgeWhenZero && badgeCount === 0) && badgeCount > 0 ? (
|
|
13
|
-
<span className='text-[10px] text-[#fff] bg-[#FF4A4A] w-[20px] h-[20px] rounded-full absolute top-0 right-0 transform translate-x-1/2 -translate-y-1/2 leading-[20px]'>{badgeCount}</span>
|
|
14
|
-
) : <span className='bg-[#FF4A4A] w-[10px] h-[10px] rounded-full absolute top-0 right-0 transform translate-x-1/2 -translate-y-1/2 leading-[20px]'></span>}
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default Notification;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
|
|
3
|
-
import Profile from './Profile';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
component: Profile,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
} satisfies Meta<typeof Profile>;
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
profileType: 'initial',
|
|
17
|
-
showName: true,
|
|
18
|
-
userName: 'Akbar Sheriff'
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { ProfileProps } from "@/types/global";
|
|
4
|
-
|
|
5
|
-
const Profile = ({ profileType, showName, userName, className, style }: ProfileProps) => {
|
|
6
|
-
return (
|
|
7
|
-
<div className={className} style={style}>
|
|
8
|
-
<div className='flex gap-2 items-center justify-between w-30 cursor-pointer'>
|
|
9
|
-
{showName && (
|
|
10
|
-
<h4 className='text-[#000000] dark:text-[#fff] text-[13px] font-[500] mb-0'>{userName}</h4>
|
|
11
|
-
)}
|
|
12
|
-
{profileType === 'avatar' ? (
|
|
13
|
-
<img
|
|
14
|
-
src='https://builder.development.algorithmshift.ai/images/toolset/profile.svg' alt="auto" width={24} height={24}
|
|
15
|
-
/>
|
|
16
|
-
) : (
|
|
17
|
-
<div className='w-6 h-6 bg-[#12715b] rounded-full text-[#fff] text-center text-[11px] flex items-center justify-center'>A</div>
|
|
18
|
-
)}
|
|
19
|
-
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default Profile;
|