this.gui 1.0.14 → 1.0.16
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/README.md +0 -39
- package/dist/style.css +1 -1
- package/dist/this-gui.es.js +3751 -1882
- package/dist/this-gui.umd.js +34 -22
- package/package.json +14 -12
- package/src/App.jsx +50 -21
- package/src/SiteBuilder.jsx +39 -0
- package/src/index.mdx +10 -0
- package/src/main.jsx +11 -14
- package/src/scripts/postinstall.js +28 -31
- package/src/scripts/verifyLayouts.js +175 -0
- package/src/scripts/verifyTemplates.js +154 -0
- package/src/stories/Atoms/Alert/Alert.css +196 -14
- package/src/stories/Atoms/Alert/Alert.jsx +43 -28
- package/src/stories/Atoms/Alert/Alert.stories.jsx +154 -28
- package/src/stories/Atoms/Audio/Audio.css +246 -16
- package/src/stories/Atoms/Audio/Audio.jsx +204 -29
- package/src/stories/Atoms/Audio/Audio.stories.jsx +178 -28
- package/src/stories/Atoms/Badge/Badge.css +234 -15
- package/src/stories/Atoms/Badge/Badge.jsx +44 -31
- package/src/stories/Atoms/Badge/Badge.stories.jsx +108 -29
- package/src/stories/Atoms/Button/Button.css +106 -45
- package/src/stories/Atoms/Button/Button.jsx +31 -82
- package/src/stories/Atoms/Button/Button.stories.jsx +170 -40
- package/src/stories/Atoms/Caption/Caption.css +156 -16
- package/src/stories/Atoms/Caption/Caption.jsx +62 -31
- package/src/stories/Atoms/Caption/Caption.stories.jsx +194 -28
- package/src/stories/Atoms/Checkbox/Checkbox.css +168 -15
- package/src/stories/Atoms/Checkbox/Checkbox.jsx +73 -31
- package/src/stories/Atoms/Checkbox/Checkbox.stories.jsx +98 -27
- package/src/stories/Atoms/Container/Container.css +75 -15
- package/src/stories/Atoms/Container/Container.jsx +41 -28
- package/src/stories/Atoms/Container/Container.stories.jsx +92 -29
- package/src/stories/Atoms/Divider/Divider.css +131 -13
- package/src/stories/Atoms/Divider/Divider.jsx +54 -33
- package/src/stories/Atoms/Divider/Divider.stories.jsx +93 -29
- package/src/stories/Atoms/Heading/Heading.css +99 -16
- package/src/stories/Atoms/Heading/Heading.jsx +57 -29
- package/src/stories/Atoms/Heading/Heading.stories.jsx +117 -28
- package/src/stories/Atoms/Icon/Icon.css +219 -27
- package/src/stories/Atoms/Icon/Icon.jsx +67 -38
- package/src/stories/Atoms/Icon/Icon.stories.jsx +156 -51
- package/src/stories/Atoms/Image/Image.css +231 -15
- package/src/stories/Atoms/Image/Image.jsx +166 -32
- package/src/stories/Atoms/Image/Image.stories.jsx +319 -28
- package/src/stories/Atoms/Label/Label.css +158 -16
- package/src/stories/Atoms/Label/Label.jsx +61 -31
- package/src/stories/Atoms/Label/Label.stories.jsx +167 -28
- package/src/stories/Atoms/Link/Link.css +58 -16
- package/src/stories/Atoms/Link/Link.jsx +73 -32
- package/src/stories/Atoms/Link/Link.stories.jsx +141 -29
- package/src/stories/Atoms/Loader/Loader.css +93 -16
- package/src/stories/Atoms/Loader/Loader.jsx +47 -30
- package/src/stories/Atoms/Loader/Loader.stories.jsx +86 -28
- package/src/stories/Atoms/Logo/Logo.css +94 -0
- package/src/stories/Atoms/Logo/Logo.jsx +53 -0
- package/src/stories/Atoms/Logo/Logo.stories.jsx +120 -0
- package/src/stories/Atoms/Paragraph/Paragraph.css +167 -16
- package/src/stories/Atoms/Paragraph/Paragraph.jsx +67 -31
- package/src/stories/Atoms/Paragraph/Paragraph.stories.jsx +130 -28
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +115 -17
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +30 -31
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +72 -27
- package/src/stories/Atoms/RadioButton/RadioButton.css +118 -17
- package/src/stories/Atoms/RadioButton/RadioButton.jsx +77 -31
- package/src/stories/Atoms/RadioButton/RadioButton.stories.jsx +99 -27
- package/src/stories/Atoms/Range/Range.css +169 -0
- package/src/stories/Atoms/Range/Range.jsx +87 -0
- package/src/stories/Atoms/Range/Range.stories.jsx +110 -0
- package/src/stories/Atoms/Select/Select.css +74 -16
- package/src/stories/Atoms/Select/Select.jsx +62 -30
- package/src/stories/Atoms/Select/Select.stories.jsx +95 -27
- package/src/stories/Atoms/Slider/Slider.css +77 -16
- package/src/stories/Atoms/Slider/Slider.jsx +119 -31
- package/src/stories/Atoms/Slider/Slider.stories.jsx +77 -28
- package/src/stories/Atoms/Snackbar/Snackbar.css +297 -13
- package/src/stories/Atoms/Snackbar/Snackbar.jsx +62 -31
- package/src/stories/Atoms/Snackbar/Snackbar.stories.jsx +63 -26
- package/src/stories/Atoms/Spacer/Spacer.css +101 -16
- package/src/stories/Atoms/Spacer/Spacer.jsx +26 -32
- package/src/stories/Atoms/Spacer/Spacer.stories.jsx +50 -30
- package/src/stories/Atoms/Spinner/Spinner.css +97 -16
- package/src/stories/Atoms/Spinner/Spinner.jsx +50 -26
- package/src/stories/Atoms/Spinner/Spinner.stories.jsx +47 -30
- package/src/stories/Atoms/Tag/Tag.css +97 -14
- package/src/stories/Atoms/Tag/Tag.jsx +58 -24
- package/src/stories/Atoms/Tag/Tag.stories.jsx +55 -29
- package/src/stories/Atoms/TextArea/TextArea.css +84 -15
- package/src/stories/Atoms/TextArea/TextArea.jsx +107 -31
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +24 -30
- package/src/stories/Atoms/TextInput/TextInput.css +89 -17
- package/src/stories/Atoms/TextInput/TextInput.jsx +118 -27
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +52 -25
- package/src/stories/Atoms/Toggle/Toggle.css +105 -17
- package/src/stories/Atoms/Toggle/Toggle.jsx +55 -28
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +23 -30
- package/src/stories/Atoms/Tooltip/Tooltip.css +367 -14
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +32 -28
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +41 -31
- package/src/stories/Atoms/Video/Video.css +27 -18
- package/src/stories/Atoms/Video/Video.jsx +65 -29
- package/src/stories/Atoms/Video/Video.stories.jsx +29 -30
- package/src/stories/Atoms/index.js +5 -2
- package/src/stories/Atoms/meta_Atoms.js +3 -1
- package/src/stories/Layouts/Accordion/Accordion.css +16 -0
- package/src/stories/Layouts/Accordion/Accordion.jsx +31 -0
- package/src/stories/Layouts/Accordion/Accordion.stories.jsx +28 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.css +16 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.jsx +31 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.stories.jsx +28 -0
- package/src/stories/Layouts/Flexbox/Flexbox.css +16 -0
- package/src/stories/Layouts/Flexbox/Flexbox.jsx +11 -0
- package/src/stories/Layouts/Flexbox/Flexbox.stories.jsx +28 -0
- package/src/stories/Layouts/Footer/Footer.css +16 -0
- package/src/stories/Layouts/Footer/Footer.jsx +31 -0
- package/src/stories/Layouts/Footer/Footer.stories.jsx +28 -0
- package/src/stories/Layouts/Grid/Grid.jsx +2 -4
- package/src/stories/Layouts/Grid/Grid.stories.jsx +20 -18
- package/src/stories/Layouts/Header/Header.css +16 -0
- package/src/stories/Layouts/Header/Header.jsx +31 -0
- package/src/stories/Layouts/Header/Header.stories.jsx +28 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.css +16 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.jsx +31 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.stories.jsx +28 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.css +16 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.jsx +31 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.stories.jsx +28 -0
- package/src/stories/Layouts/Pagination/Pagination.css +16 -0
- package/src/stories/Layouts/Pagination/Pagination.jsx +31 -0
- package/src/stories/Layouts/Pagination/Pagination.stories.jsx +28 -0
- package/src/stories/Layouts/Section/Section.css +16 -0
- package/src/stories/Layouts/Section/Section.jsx +31 -0
- package/src/stories/Layouts/Section/Section.stories.jsx +28 -0
- package/src/stories/Layouts/Sidebar/Sidebar.css +16 -0
- package/src/stories/Layouts/Sidebar/Sidebar.jsx +71 -0
- package/src/stories/Layouts/Sidebar/Sidebar.stories.jsx +28 -0
- package/src/stories/Layouts/Tabs/Tabs.css +16 -0
- package/src/stories/Layouts/Tabs/Tabs.jsx +31 -0
- package/src/stories/Layouts/Tabs/Tabs.stories.jsx +28 -0
- package/src/stories/Layouts/index.js +31 -0
- package/src/stories/Layouts/meta_Layouts.js +31 -0
- package/src/stories/Molecules/Navbar/Navbar.css +63 -59
- package/src/stories/Molecules/Navbar/Navbar.jsx +43 -48
- package/src/stories/Molecules/Navbar/Navbar.stories.jsx +58 -8
- package/src/stories/Molecules/SearchBar/SearchBar.css +66 -1
- package/src/stories/Molecules/SearchBar/SearchBar.jsx +59 -11
- package/src/stories/Molecules/SearchBar/SearchBar.stories.jsx +16 -7
- package/src/stories/Molecules/SelectTheme/SelectTheme.jsx +16 -38
- package/src/stories/Molecules/SelectTheme/SelectTheme.stories.jsx +1 -2
- package/src/stories/Molecules/Sidebar/Sidebar.css +65 -2
- package/src/stories/Molecules/Sidebar/Sidebar.jsx +66 -11
- package/src/stories/Molecules/Sidebar/Sidebar.stories.jsx +20 -5
- package/src/stories/Templates/AdminDashboard/AdminDashboard.css +7 -0
- package/src/stories/Templates/AdminDashboard/AdminDashboard.jsx +24 -0
- package/src/stories/Templates/AdminDashboard/AdminDashboard.stories.jsx +20 -0
- package/src/stories/Templates/CallToAction/CallToAction.css +7 -0
- package/src/stories/Templates/CallToAction/CallToAction.jsx +24 -0
- package/src/stories/Templates/CallToAction/CallToAction.stories.jsx +20 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.css +7 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.jsx +24 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.stories.jsx +20 -0
- package/src/stories/Templates/FormSection/FormSection.css +7 -0
- package/src/stories/Templates/FormSection/FormSection.jsx +24 -0
- package/src/stories/Templates/FormSection/FormSection.stories.jsx +20 -0
- package/src/stories/Templates/HeroSection/HeroSection.css +7 -0
- package/src/stories/Templates/HeroSection/HeroSection.jsx +24 -0
- package/src/stories/Templates/HeroSection/HeroSection.stories.jsx +20 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.css +7 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.jsx +24 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.stories.jsx +20 -0
- package/src/stories/Templates/ProductPage/ProductPage.css +7 -0
- package/src/stories/Templates/ProductPage/ProductPage.jsx +24 -0
- package/src/stories/Templates/ProductPage/ProductPage.stories.jsx +20 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.css +7 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.jsx +24 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.stories.jsx +20 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.css +7 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.jsx +24 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.stories.jsx +20 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.css +7 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.jsx +24 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.stories.jsx +20 -0
- package/src/stories/Templates/SignInPage/SignInPage.css +7 -0
- package/src/stories/Templates/SignInPage/SignInPage.jsx +24 -0
- package/src/stories/Templates/SignInPage/SignInPage.stories.jsx +20 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.css +7 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.jsx +24 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.stories.jsx +20 -0
- package/src/stories/Templates/Testimonials/Testimonials.css +7 -0
- package/src/stories/Templates/Testimonials/Testimonials.jsx +24 -0
- package/src/stories/Templates/Testimonials/Testimonials.stories.jsx +20 -0
- package/src/stories/Templates/index.js +33 -0
- package/src/stories/Templates/{Templates.js → meta_Templates.js} +3 -1
- package/src/stories/assets/logo.png +0 -0
- package/src/stories/assets/logo.svg +106 -0
- package/src/stories/assets/test.svg +3 -0
- package/src/themes/README.md +301 -0
- package/src/themes/ThemeProvider.jsx +47 -22
- package/src/themes/styles/dracula/dark.css +0 -0
- package/src/themes/styles/dracula/light.css +0 -0
- package/src/themes/styles/github/dark.css +0 -0
- package/src/themes/styles/github/light.css +0 -0
- package/src/themes/styles/neurons/dark.css +247 -0
- package/src/themes/styles/neurons/light.css +280 -0
- package/dist/github-3688a83a.js +0 -5
- package/dist/gothic-94a7ecd6.js +0 -5
- package/dist/newsprint-32bf94d9.js +0 -5
- package/dist/night-4a954853.js +0 -5
- package/dist/pixyll-94de4610.js +0 -5
- package/dist/whitey-db68723e.js +0 -5
- package/src/MDXEditor.jsx +0 -32
- package/src/stories/Atoms/RangeInput/RangeInput.css +0 -29
- package/src/stories/Atoms/RangeInput/RangeInput.jsx +0 -41
- package/src/stories/Atoms/RangeInput/RangeInput.stories.jsx +0 -41
- package/src/stories/Components.md +0 -189
- package/src/stories/Layouts/Layout.js +0 -28
- package/src/styles/Header.modules.css +0 -32
- package/src/styles/global.css +0 -59
- package/src/themes/Themes.js +0 -44
- package/src/themes/dark.js +0 -22
- package/src/themes/light.js +0 -22
- package/src/themes/typ/Readme.md +0 -4
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-regular.woff2 +0 -0
- package/src/themes/typ/github.css +0 -416
- package/src/themes/typ/gothic/GUST e-foundry License.txt +0 -29
- package/src/themes/typ/gothic/didact-gothic-c-ext.woff2 +0 -0
- package/src/themes/typ/gothic/didact-gothic-c.woff2 +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bold.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bolditalic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-italic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-regular.woff +0 -0
- package/src/themes/typ/gothic.css +0 -410
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-regular.woff2 +0 -0
- package/src/themes/typ/newsprint.css +0 -622
- package/src/themes/typ/night/codeblock.dark.css +0 -113
- package/src/themes/typ/night/credit.html +0 -1
- package/src/themes/typ/night/cursor.png +0 -0
- package/src/themes/typ/night/cursor@2x.png +0 -0
- package/src/themes/typ/night/mermaid.dark.css +0 -7
- package/src/themes/typ/night/sourcemode.dark.css +0 -38
- package/src/themes/typ/night.css +0 -1032
- package/src/themes/typ/pixyll/lato-v14-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700italic.woff +0 -0
- package/src/themes/typ/pixyll.css +0 -528
- package/src/themes/typ/whitey.css +0 -299
- /package/src/stories/Molecules/{Molecules.js → meta_Molecules.js} +0 -0
- /package/src/stories/Organisms/{Organisms.js → meta_Organisms.js} +0 -0
|
@@ -1,41 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
4
|
import './TextArea.css';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export const TextArea = ({
|
|
7
|
+
value,
|
|
8
|
+
defaultValue,
|
|
9
|
+
placeholder = "Enter text here...",
|
|
10
|
+
rows = 4,
|
|
11
|
+
cols = 50,
|
|
12
|
+
resize = "vertical",
|
|
13
|
+
bold = false,
|
|
14
|
+
italic = false,
|
|
15
|
+
underline = false,
|
|
16
|
+
fontSize = "16px",
|
|
17
|
+
color = "primary",
|
|
18
|
+
backgroundColor = "transparent",
|
|
19
|
+
collapsible = false,
|
|
20
|
+
collapseAt = 100,
|
|
21
|
+
maxLength,
|
|
22
|
+
disabled = false,
|
|
23
|
+
readOnly = false,
|
|
24
|
+
required = false,
|
|
25
|
+
onChange,
|
|
26
|
+
onBlur,
|
|
27
|
+
onFocus,
|
|
28
|
+
autoResize = false,
|
|
29
|
+
error = false,
|
|
30
|
+
errorMessage = "",
|
|
31
|
+
helperText = "",
|
|
32
|
+
className = "",
|
|
33
|
+
style = {},
|
|
34
|
+
...props
|
|
35
|
+
}) => {
|
|
36
|
+
const [collapsed, setCollapsed] = useState(collapsible && value?.length > collapseAt);
|
|
37
|
+
|
|
38
|
+
const handleChange = (e) => {
|
|
39
|
+
if (collapsible && e.target.value.length > collapseAt) {
|
|
40
|
+
setCollapsed(false);
|
|
41
|
+
}
|
|
42
|
+
if (onChange) onChange(e);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const textareaClasses = classNames('textarea', className, {
|
|
46
|
+
[`textarea--${color}`]: color,
|
|
47
|
+
'textarea--bold': bold,
|
|
48
|
+
'textarea--italic': italic,
|
|
49
|
+
'textarea--underline': underline,
|
|
50
|
+
'textarea--disabled': disabled,
|
|
51
|
+
'textarea--error': error,
|
|
52
|
+
'textarea--collapsible': collapsible && collapsed,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const customStyles = {
|
|
56
|
+
...style,
|
|
57
|
+
fontSize,
|
|
58
|
+
backgroundColor,
|
|
59
|
+
resize,
|
|
60
|
+
display: collapsed ? 'none' : 'block',
|
|
61
|
+
};
|
|
62
|
+
|
|
11
63
|
return (
|
|
12
|
-
<div
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
64
|
+
<div className="textarea-wrapper">
|
|
65
|
+
<textarea
|
|
66
|
+
value={value}
|
|
67
|
+
defaultValue={defaultValue}
|
|
68
|
+
placeholder={placeholder}
|
|
69
|
+
rows={rows}
|
|
70
|
+
cols={cols}
|
|
71
|
+
maxLength={maxLength}
|
|
72
|
+
readOnly={readOnly}
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
required={required}
|
|
75
|
+
className={textareaClasses}
|
|
76
|
+
style={customStyles}
|
|
77
|
+
onChange={handleChange}
|
|
78
|
+
onBlur={onBlur}
|
|
79
|
+
onFocus={onFocus}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
{error && errorMessage && <div className="textarea-error">{errorMessage}</div>}
|
|
83
|
+
{helperText && <div className="textarea-helper">{helperText}</div>}
|
|
84
|
+
{collapsed && <button onClick={() => setCollapsed(false)}>Expand</button>}
|
|
17
85
|
</div>
|
|
18
86
|
);
|
|
19
87
|
};
|
|
20
88
|
|
|
21
89
|
TextArea.propTypes = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
value: PropTypes.string,
|
|
91
|
+
defaultValue: PropTypes.string,
|
|
92
|
+
placeholder: PropTypes.string,
|
|
93
|
+
rows: PropTypes.number,
|
|
94
|
+
cols: PropTypes.number,
|
|
95
|
+
resize: PropTypes.oneOf(['none', 'vertical', 'horizontal', 'both']),
|
|
96
|
+
bold: PropTypes.bool,
|
|
97
|
+
italic: PropTypes.bool,
|
|
98
|
+
underline: PropTypes.bool,
|
|
99
|
+
fontSize: PropTypes.string,
|
|
100
|
+
color: PropTypes.oneOf(['primary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark']),
|
|
101
|
+
backgroundColor: PropTypes.string,
|
|
102
|
+
collapsible: PropTypes.bool,
|
|
103
|
+
collapseAt: PropTypes.number,
|
|
104
|
+
maxLength: PropTypes.number,
|
|
105
|
+
disabled: PropTypes.bool,
|
|
106
|
+
readOnly: PropTypes.bool,
|
|
107
|
+
required: PropTypes.bool,
|
|
108
|
+
onChange: PropTypes.func,
|
|
109
|
+
onBlur: PropTypes.func,
|
|
110
|
+
onFocus: PropTypes.func,
|
|
111
|
+
autoResize: PropTypes.bool,
|
|
112
|
+
error: PropTypes.bool,
|
|
113
|
+
errorMessage: PropTypes.string,
|
|
114
|
+
helperText: PropTypes.string,
|
|
115
|
+
className: PropTypes.string,
|
|
116
|
+
style: PropTypes.object,
|
|
39
117
|
};
|
|
40
|
-
|
|
41
|
-
export default TextArea;
|
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TextArea } from './TextArea';
|
|
3
3
|
|
|
4
|
-
// Storybook configuration for TextArea component
|
|
5
4
|
export default {
|
|
6
5
|
title: 'Atoms/Interactive/TextArea',
|
|
7
6
|
component: TextArea,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered',
|
|
10
|
-
},
|
|
11
7
|
argTypes: {
|
|
12
|
-
|
|
8
|
+
bold: { control: 'boolean', description: 'Bold text' },
|
|
9
|
+
italic: { control: 'boolean', description: 'Italic text' },
|
|
10
|
+
underline: { control: 'boolean', description: 'Underlined text' },
|
|
11
|
+
color: {
|
|
12
|
+
control: { type: 'select', options: ['primary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark'] },
|
|
13
|
+
description: 'Text color',
|
|
14
|
+
},
|
|
15
|
+
collapsible: { control: 'boolean', description: 'Enable collapsible text area' },
|
|
16
|
+
collapseAt: { control: 'number', description: 'Collapse after N characters' },
|
|
13
17
|
},
|
|
14
18
|
};
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
primary: true,
|
|
19
|
-
children: 'This is a primary TextArea',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
20
|
+
/** Interactive TextArea */
|
|
21
|
+
const Template = (args) => <TextArea {...args} />;
|
|
22
22
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export const Small = {
|
|
37
|
-
args: {
|
|
38
|
-
size: 'small',
|
|
39
|
-
children: 'This is a small TextArea',
|
|
40
|
-
},
|
|
23
|
+
export const InteractiveTextArea = Template.bind({});
|
|
24
|
+
InteractiveTextArea.args = {
|
|
25
|
+
value: 'Type here...',
|
|
26
|
+
placeholder: 'Enter your text...',
|
|
27
|
+
rows: 4,
|
|
28
|
+
cols: 50,
|
|
29
|
+
bold: false,
|
|
30
|
+
italic: false,
|
|
31
|
+
underline: false,
|
|
32
|
+
color: 'primary',
|
|
33
|
+
collapsible: false,
|
|
34
|
+
collapseAt: 100,
|
|
41
35
|
};
|
|
@@ -1,29 +1,101 @@
|
|
|
1
|
+
.text-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
font-family: var(--font-family);
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: var(--spacing-sm);
|
|
7
|
+
border: var(--border-width) solid var(--border-color);
|
|
8
|
+
border-radius: var(--border-radius);
|
|
9
|
+
background-color: var(--background-color);
|
|
10
|
+
color: var(--text-color);
|
|
11
|
+
font-size: var(--font-size-base);
|
|
12
|
+
transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
|
|
13
|
+
}
|
|
1
14
|
|
|
2
|
-
.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
.text-input__input {
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: var(--spacing-sm);
|
|
18
|
+
border: none;
|
|
19
|
+
background: transparent;
|
|
20
|
+
color: inherit;
|
|
21
|
+
font-size: inherit;
|
|
22
|
+
font-family: inherit;
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.text-input--small .text-input__input {
|
|
27
|
+
font-size: var(--font-size-small);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.text-input--large .text-input__input {
|
|
31
|
+
font-size: var(--font-size-large);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.text-input--disabled {
|
|
35
|
+
background-color: var(--neutral-color-hover);
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.text-input--primary {
|
|
40
|
+
border-color: var(--primary-color);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.text-input--secondary {
|
|
44
|
+
border-color: var(--secondary-color);
|
|
7
45
|
}
|
|
8
46
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
border-color:
|
|
47
|
+
/* Additional Colors */
|
|
48
|
+
.text-input--info {
|
|
49
|
+
border-color: var(--info-color);
|
|
12
50
|
}
|
|
13
51
|
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
border-color: #ccc;
|
|
52
|
+
.text-input--warning {
|
|
53
|
+
border-color: var(--warning-color);
|
|
17
54
|
}
|
|
18
55
|
|
|
19
|
-
.
|
|
20
|
-
|
|
56
|
+
.text-input--alert {
|
|
57
|
+
border-color: var(--alert-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.text-input--success {
|
|
61
|
+
border-color: var(--success-color);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.text-input--neutral {
|
|
65
|
+
border-color: var(--neutral-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.text-input--dark {
|
|
69
|
+
border-color: var(--dark-color);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.text-input__clear-button {
|
|
73
|
+
background: none;
|
|
74
|
+
border: none;
|
|
75
|
+
font-size: inherit;
|
|
76
|
+
color: inherit;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.text-input--loading {
|
|
81
|
+
background-color: #f0f0f0;
|
|
21
82
|
}
|
|
22
83
|
|
|
23
|
-
.
|
|
24
|
-
|
|
84
|
+
.text-input__spinner {
|
|
85
|
+
margin-left: var(--spacing-sm);
|
|
86
|
+
width: 20px;
|
|
87
|
+
height: 20px;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
border: 3px solid rgba(0, 0, 0, 0.1);
|
|
90
|
+
border-top-color: var(--primary-color);
|
|
91
|
+
animation: spin 1s linear infinite;
|
|
25
92
|
}
|
|
26
93
|
|
|
27
|
-
|
|
28
|
-
|
|
94
|
+
@keyframes spin {
|
|
95
|
+
0% {
|
|
96
|
+
transform: rotate(0deg);
|
|
97
|
+
}
|
|
98
|
+
100% {
|
|
99
|
+
transform: rotate(360deg);
|
|
100
|
+
}
|
|
29
101
|
}
|
|
@@ -1,41 +1,132 @@
|
|
|
1
|
-
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import './TextInput.css';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export const TextInput = ({
|
|
6
|
+
value,
|
|
7
|
+
defaultValue,
|
|
8
|
+
onChange,
|
|
9
|
+
placeholder = 'Enter text here...',
|
|
10
|
+
type = 'text',
|
|
11
|
+
size = 'medium',
|
|
12
|
+
color = 'primary',
|
|
13
|
+
fontFamily,
|
|
14
|
+
fontSize,
|
|
15
|
+
backgroundColor,
|
|
16
|
+
borderColor,
|
|
17
|
+
borderRadius,
|
|
18
|
+
disabled = false,
|
|
19
|
+
readOnly = false,
|
|
20
|
+
required = false,
|
|
21
|
+
autoFocus = false,
|
|
22
|
+
maxLength,
|
|
23
|
+
minLength,
|
|
24
|
+
pattern,
|
|
25
|
+
isValid,
|
|
26
|
+
error,
|
|
27
|
+
helperText,
|
|
28
|
+
errorMessage,
|
|
29
|
+
clearable = false,
|
|
30
|
+
onClear,
|
|
31
|
+
loading = false,
|
|
32
|
+
ariaLabel,
|
|
33
|
+
ariaDescribedBy,
|
|
34
|
+
tabIndex,
|
|
35
|
+
spellCheck = true,
|
|
36
|
+
autoComplete = 'on',
|
|
37
|
+
inputMode,
|
|
38
|
+
step,
|
|
39
|
+
className = '',
|
|
40
|
+
style = {},
|
|
41
|
+
...props
|
|
42
|
+
}) => {
|
|
43
|
+
const inputClasses = [
|
|
44
|
+
'text-input',
|
|
45
|
+
`text-input--${size}`,
|
|
46
|
+
`text-input--${color}`,
|
|
47
|
+
error ? 'text-input--error' : '',
|
|
48
|
+
loading ? 'text-input--loading' : '',
|
|
49
|
+
className,
|
|
50
|
+
].join(' ').trim();
|
|
51
|
+
|
|
11
52
|
return (
|
|
12
|
-
<div
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
53
|
+
<div className={inputClasses} style={{ backgroundColor, borderColor, borderRadius, fontFamily, fontSize, ...style }}>
|
|
54
|
+
<input
|
|
55
|
+
type={type}
|
|
56
|
+
value={value}
|
|
57
|
+
defaultValue={defaultValue}
|
|
58
|
+
onChange={onChange}
|
|
59
|
+
placeholder={placeholder}
|
|
60
|
+
disabled={disabled}
|
|
61
|
+
readOnly={readOnly}
|
|
62
|
+
required={required}
|
|
63
|
+
maxLength={maxLength}
|
|
64
|
+
minLength={minLength}
|
|
65
|
+
pattern={pattern}
|
|
66
|
+
aria-label={ariaLabel}
|
|
67
|
+
aria-describedby={ariaDescribedBy}
|
|
68
|
+
tabIndex={tabIndex}
|
|
69
|
+
spellCheck={spellCheck}
|
|
70
|
+
autoComplete={autoComplete}
|
|
71
|
+
inputMode={inputMode}
|
|
72
|
+
step={step}
|
|
73
|
+
className="text-input__input"
|
|
74
|
+
autoFocus={autoFocus}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
{clearable && value && (
|
|
78
|
+
<button className="text-input__clear-button" onClick={onClear} aria-label="Clear input">
|
|
79
|
+
×
|
|
80
|
+
</button>
|
|
81
|
+
)}
|
|
82
|
+
{loading && <div className="text-input__spinner" />}
|
|
83
|
+
{helperText && <div className="text-input__helper-text">{helperText}</div>}
|
|
84
|
+
{error && errorMessage && <div className="text-input__error-message">{errorMessage}</div>}
|
|
17
85
|
</div>
|
|
18
86
|
);
|
|
19
87
|
};
|
|
20
88
|
|
|
21
89
|
TextInput.propTypes = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* Size of the component
|
|
28
|
-
*/
|
|
90
|
+
value: PropTypes.string,
|
|
91
|
+
defaultValue: PropTypes.string,
|
|
92
|
+
onChange: PropTypes.func.isRequired,
|
|
93
|
+
placeholder: PropTypes.string,
|
|
94
|
+
type: PropTypes.string,
|
|
29
95
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
96
|
+
color: PropTypes.oneOf([
|
|
97
|
+
'primary', 'secondary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark',
|
|
98
|
+
'classy-color-1', 'classy-color-2', 'classy-color-3', 'classy-color-4', 'classy-color-5',
|
|
99
|
+
'small-switch-color-1', 'small-switch-color-2', 'natural-color-1', 'natural-color-2', 'natural-color-3',
|
|
100
|
+
'grey-friend-1', 'grey-friend-2', 'shade-1', 'shade-2', 'shade-3', 'shade-4'
|
|
101
|
+
]),
|
|
102
|
+
fontFamily: PropTypes.string,
|
|
103
|
+
fontSize: PropTypes.string,
|
|
104
|
+
backgroundColor: PropTypes.string,
|
|
105
|
+
borderColor: PropTypes.string,
|
|
106
|
+
borderRadius: PropTypes.string,
|
|
107
|
+
disabled: PropTypes.bool,
|
|
108
|
+
readOnly: PropTypes.bool,
|
|
109
|
+
required: PropTypes.bool,
|
|
110
|
+
autoFocus: PropTypes.bool,
|
|
111
|
+
maxLength: PropTypes.number,
|
|
112
|
+
minLength: PropTypes.number,
|
|
113
|
+
pattern: PropTypes.string,
|
|
114
|
+
isValid: PropTypes.bool,
|
|
115
|
+
error: PropTypes.bool,
|
|
116
|
+
helperText: PropTypes.string,
|
|
117
|
+
errorMessage: PropTypes.string,
|
|
118
|
+
clearable: PropTypes.bool,
|
|
119
|
+
onClear: PropTypes.func,
|
|
120
|
+
loading: PropTypes.bool,
|
|
121
|
+
ariaLabel: PropTypes.string,
|
|
122
|
+
ariaDescribedBy: PropTypes.string,
|
|
123
|
+
tabIndex: PropTypes.number,
|
|
124
|
+
spellCheck: PropTypes.bool,
|
|
125
|
+
autoComplete: PropTypes.string,
|
|
126
|
+
inputMode: PropTypes.string,
|
|
127
|
+
step: PropTypes.number,
|
|
128
|
+
className: PropTypes.string,
|
|
129
|
+
style: PropTypes.object,
|
|
39
130
|
};
|
|
40
131
|
|
|
41
132
|
export default TextInput;
|
|
@@ -1,41 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { TextInput } from './TextInput';
|
|
3
3
|
|
|
4
|
-
// Storybook configuration for TextInput component
|
|
5
4
|
export default {
|
|
6
5
|
title: 'Atoms/Interactive/TextInput',
|
|
7
6
|
component: TextInput,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered',
|
|
10
|
-
},
|
|
11
7
|
argTypes: {
|
|
12
|
-
|
|
8
|
+
value: { control: 'text', defaultValue: '' },
|
|
9
|
+
placeholder: { control: 'text', defaultValue: 'Enter text...' },
|
|
10
|
+
size: { control: { type: 'select', options: ['small', 'medium', 'large'] } },
|
|
11
|
+
color: {
|
|
12
|
+
control: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
options: [
|
|
15
|
+
'primary', 'secondary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark',
|
|
16
|
+
'classy-color-1', 'classy-color-2', 'classy-color-3', 'classy-color-4', 'classy-color-5',
|
|
17
|
+
'small-switch-color-1', 'small-switch-color-2', 'natural-color-1', 'natural-color-2', 'natural-color-3',
|
|
18
|
+
'grey-friend-1', 'grey-friend-2', 'shade-1', 'shade-2', 'shade-3', 'shade-4'
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
disabled: { control: 'boolean' },
|
|
23
|
+
readOnly: { control: 'boolean' },
|
|
24
|
+
required: { control: 'boolean' },
|
|
25
|
+
clearable: { control: 'boolean' },
|
|
26
|
+
loading: { control: 'boolean' },
|
|
13
27
|
},
|
|
14
28
|
};
|
|
15
29
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
export const DefaultTextInput = () => {
|
|
31
|
+
const [inputValue, setInputValue] = useState('');
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<TextInput
|
|
35
|
+
value={inputValue}
|
|
36
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
37
|
+
placeholder="Type something..."
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
21
40
|
};
|
|
22
41
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
42
|
+
export const WithClear = () => {
|
|
43
|
+
const [inputValue, setInputValue] = useState('');
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<TextInput
|
|
47
|
+
value={inputValue}
|
|
48
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
49
|
+
placeholder="Enter text..."
|
|
50
|
+
clearable={true}
|
|
51
|
+
onClear={() => setInputValue('')}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
27
54
|
};
|
|
28
55
|
|
|
29
|
-
export const
|
|
30
|
-
args
|
|
31
|
-
size: 'large',
|
|
32
|
-
children: 'This is a large TextInput',
|
|
33
|
-
},
|
|
56
|
+
export const InteractiveTextInput = (args) => {
|
|
57
|
+
return <TextInput {...args} />;
|
|
34
58
|
};
|
|
35
59
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
InteractiveTextInput.args = {
|
|
61
|
+
placeholder: 'Enter text...',
|
|
62
|
+
size: 'medium',
|
|
63
|
+
color: 'primary',
|
|
64
|
+
disabled: false,
|
|
65
|
+
readOnly: false,
|
|
66
|
+
clearable: true,
|
|
67
|
+
loading: false,
|
|
41
68
|
};
|