@agility/plenum-ui 2.0.0-rc11 → 2.0.0-rc13
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.d.ts +43 -19
- package/dist/index.js +163 -86
- package/dist/index.js.map +4 -4
- package/dist/lib/tailwind.css +44 -22
- package/dist/types/stories/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +5 -3
- package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +9 -7
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +2 -4
- package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
- package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
- package/dist/types/stories/organisms/index.d.ts +3 -2
- package/package.json +1 -1
- package/stories/index.ts +4 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +9 -9
- package/stories/molecules/inputs/textArea/TextArea.tsx +38 -11
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +61 -57
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +23 -19
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
- package/stories/organisms/index.ts +3 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
|
|
4
|
+
import TextArea, { ITextareaProps } from "@/stories/molecules/inputs/textArea"
|
|
5
|
+
|
|
6
|
+
export interface IAnimatedLabelTextAreaProps extends ITextareaProps {
|
|
7
|
+
id: string
|
|
8
|
+
containerStyles?: string
|
|
9
|
+
message?: string
|
|
10
|
+
required?: boolean
|
|
11
|
+
isError?: boolean
|
|
12
|
+
handleChange: (value: string) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps> = (props: IAnimatedLabelTextAreaProps) => {
|
|
16
|
+
const { id, containerStyles, message, required, isError, label, value, handleChange, ...input } = props
|
|
17
|
+
|
|
18
|
+
const [hasValue, setHasValue] = React.useState<boolean>(!!value)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={cn("group relative", containerStyles ? containerStyles : "")}>
|
|
22
|
+
<TextArea
|
|
23
|
+
id={id}
|
|
24
|
+
isError={isError}
|
|
25
|
+
value={value}
|
|
26
|
+
onChange={(v) => {
|
|
27
|
+
setHasValue(!!v)
|
|
28
|
+
if (handleChange) handleChange(v)
|
|
29
|
+
}}
|
|
30
|
+
{...input}
|
|
31
|
+
label={undefined}
|
|
32
|
+
/>
|
|
33
|
+
<label
|
|
34
|
+
className={cn(
|
|
35
|
+
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
36
|
+
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
37
|
+
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
38
|
+
"group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
39
|
+
|
|
40
|
+
isError && "!text-red-600"
|
|
41
|
+
)}
|
|
42
|
+
htmlFor={id}
|
|
43
|
+
>
|
|
44
|
+
{label}
|
|
45
|
+
{required && <span className="text-red-600 ml-1">*</span>}
|
|
46
|
+
</label>
|
|
47
|
+
|
|
48
|
+
<div className="flex flex-row space-x-3">
|
|
49
|
+
<div className="grow transition-all">
|
|
50
|
+
{message && (
|
|
51
|
+
<span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
|
|
52
|
+
{message}
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default AnimatedLabelTextArea
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
2
|
+
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
2
3
|
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown"
|
|
3
4
|
import Dropdown, { IDropdownClassnames, IDropdownProps, IItemProp } from "./DropdownComponent"
|
|
4
5
|
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder"
|
|
@@ -7,6 +8,7 @@ import TextInputSelect, { ITextInputSelectProps } from "./TextInputSelect"
|
|
|
7
8
|
|
|
8
9
|
export type {
|
|
9
10
|
IAnimatedLabelInputProps,
|
|
11
|
+
IAnimatedLabelTextAreaProps,
|
|
10
12
|
IButtonDropdownProps,
|
|
11
13
|
IDropdownClassnames,
|
|
12
14
|
IDropdownProps,
|
|
@@ -15,4 +17,4 @@ export type {
|
|
|
15
17
|
IFormInputWithAddonsProps,
|
|
16
18
|
ITextInputSelectProps
|
|
17
19
|
}
|
|
18
|
-
export { AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect }
|
|
20
|
+
export { AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect }
|