@agility/plenum-ui 2.2.4 → 2.2.5
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 +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +1 -0
- package/package.json +1 -1
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +1 -1
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +1 -1
- package/stories/molecules/inputs/TextInput/TextInput.tsx +1 -1
- package/stories/molecules/inputs/select/Select.stories.tsx +13 -11
- package/stories/molecules/inputs/select/Select.tsx +9 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import React, { FC } from "react";
|
|
5
5
|
import { default as cn } from "classnames";
|
|
6
|
-
import Label from "
|
|
6
|
+
import Label from "@/stories/atoms/Typography/Label/Label";
|
|
7
7
|
|
|
8
8
|
export interface IInputLabelProps {
|
|
9
9
|
/** Prop comment */
|
|
@@ -3,7 +3,7 @@ import { default as cn } from "classnames";
|
|
|
3
3
|
import InputLabel from "../InputLabel";
|
|
4
4
|
import InputField, { AcceptedInputTypes } from "../InputField";
|
|
5
5
|
import InputCounter from "../InputCounter";
|
|
6
|
-
import Paragraph from "
|
|
6
|
+
import Paragraph from "@/stories/atoms/Typography/Paragraph/Paragraph";
|
|
7
7
|
|
|
8
8
|
export interface ITextInputProps {
|
|
9
9
|
/** Input type*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import Select from "./Select"
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Select from "./Select";
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Select> = {
|
|
5
5
|
title: "Design System/Molecules/Inputs/Select",
|
|
@@ -13,15 +13,15 @@ const meta: Meta<typeof Select> = {
|
|
|
13
13
|
<div className="bg-transparent-black-03 rounded p-6">
|
|
14
14
|
<Story />
|
|
15
15
|
</div>
|
|
16
|
-
)
|
|
16
|
+
);
|
|
17
17
|
}
|
|
18
|
-
return <Story
|
|
18
|
+
return <Story />;
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
22
|
|
|
23
|
-
export default meta
|
|
24
|
-
type TStory = StoryObj<typeof Select
|
|
23
|
+
export default meta;
|
|
24
|
+
type TStory = StoryObj<typeof Select>;
|
|
25
25
|
|
|
26
26
|
export const DefaultSelect: TStory = {
|
|
27
27
|
args: {
|
|
@@ -34,9 +34,10 @@ export const DefaultSelect: TStory = {
|
|
|
34
34
|
],
|
|
35
35
|
isDisabled: false,
|
|
36
36
|
isError: false,
|
|
37
|
-
isRequired: false
|
|
37
|
+
isRequired: false,
|
|
38
|
+
message: "Message"
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
+
};
|
|
40
41
|
export const DefaultSelectDarkBG: TStory = {
|
|
41
42
|
args: {
|
|
42
43
|
label: "Label",
|
|
@@ -48,6 +49,7 @@ export const DefaultSelectDarkBG: TStory = {
|
|
|
48
49
|
],
|
|
49
50
|
isDisabled: false,
|
|
50
51
|
isError: false,
|
|
51
|
-
isRequired: false
|
|
52
|
+
isRequired: false,
|
|
53
|
+
message: "Message"
|
|
52
54
|
}
|
|
53
|
-
}
|
|
55
|
+
};
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import InputLabel from "@/stories/molecules/inputs/InputLabel";
|
|
3
3
|
import { useId } from "@/utils/useId";
|
|
4
4
|
import { default as cn } from "classnames";
|
|
5
|
+
import Paragraph from "@/stories/atoms/Typography/Paragraph/Paragraph";
|
|
5
6
|
|
|
6
7
|
export interface ISimpleSelectOptions {
|
|
7
8
|
label: string;
|
|
@@ -28,6 +29,7 @@ export interface ISelectProps {
|
|
|
28
29
|
className?: string;
|
|
29
30
|
onFocus?: () => void;
|
|
30
31
|
onBlur?: () => void;
|
|
32
|
+
message?: string;
|
|
31
33
|
}
|
|
32
34
|
const Select: React.FC<ISelectProps> = ({
|
|
33
35
|
label,
|
|
@@ -41,7 +43,8 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
41
43
|
value,
|
|
42
44
|
className,
|
|
43
45
|
onFocus,
|
|
44
|
-
onBlur
|
|
46
|
+
onBlur,
|
|
47
|
+
message
|
|
45
48
|
}) => {
|
|
46
49
|
const [selectedOption, setSelectedOption] = useState<string>(value || options[0].value);
|
|
47
50
|
const uniqueID = useId();
|
|
@@ -87,6 +90,11 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
87
90
|
);
|
|
88
91
|
})}
|
|
89
92
|
</select>
|
|
93
|
+
{message && (
|
|
94
|
+
<Paragraph size="md" className={isError ? "text-red-600" : "text-gray-500"}>
|
|
95
|
+
{message}
|
|
96
|
+
</Paragraph>
|
|
97
|
+
)}
|
|
90
98
|
</div>
|
|
91
99
|
);
|
|
92
100
|
};
|