@agility/plenum-ui 2.0.1 → 2.0.3
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/.storybook/Layout.jsx +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +21 -20
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +1 -0
- package/dist/types/stories/organisms/DropdownComponent/dropdownItems.d.ts +1 -0
- package/package.json +1 -1
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +6 -6
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +19 -32
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +4 -2
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +7 -2
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +14 -3
- package/stories/organisms/DropdownComponent/dropdownItems.ts +38 -32
- package/tailwind.config.js +2 -2
package/dist/tailwind.css
CHANGED
|
@@ -3093,17 +3093,6 @@ select {
|
|
|
3093
3093
|
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
|
|
3094
3094
|
}
|
|
3095
3095
|
|
|
3096
|
-
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
|
3097
|
-
--tw-divide-y-reverse: 0;
|
|
3098
|
-
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
3099
|
-
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
.divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
|
|
3103
|
-
--tw-divide-opacity: 1;
|
|
3104
|
-
border-color: rgb(243 244 246 / var(--tw-divide-opacity));
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
3096
|
.overflow-auto {
|
|
3108
3097
|
overflow: auto;
|
|
3109
3098
|
}
|
|
@@ -3182,6 +3171,22 @@ select {
|
|
|
3182
3171
|
border-bottom-right-radius: 0.25rem;
|
|
3183
3172
|
}
|
|
3184
3173
|
|
|
3174
|
+
.rounded-bl {
|
|
3175
|
+
border-bottom-left-radius: 0.25rem;
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
.rounded-br {
|
|
3179
|
+
border-bottom-right-radius: 0.25rem;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
.rounded-tl {
|
|
3183
|
+
border-top-left-radius: 0.25rem;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
.rounded-tr {
|
|
3187
|
+
border-top-right-radius: 0.25rem;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3185
3190
|
.border {
|
|
3186
3191
|
border-width: 1px;
|
|
3187
3192
|
}
|
|
@@ -3202,6 +3207,10 @@ select {
|
|
|
3202
3207
|
border-right-width: 0px !important;
|
|
3203
3208
|
}
|
|
3204
3209
|
|
|
3210
|
+
.border-b {
|
|
3211
|
+
border-bottom-width: 1px;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3205
3214
|
.border-dashed {
|
|
3206
3215
|
border-style: dashed;
|
|
3207
3216
|
}
|
|
@@ -50109,10 +50118,6 @@ select {
|
|
|
50109
50118
|
background-color: rgb(128 102 20 / 0.95);
|
|
50110
50119
|
}
|
|
50111
50120
|
|
|
50112
|
-
.bg-label-gradient-idle {
|
|
50113
|
-
background-image: linear-gradient(to top, #FFF 8px, transparent 8px);
|
|
50114
|
-
}
|
|
50115
|
-
|
|
50116
50121
|
.from-0\% {
|
|
50117
50122
|
--tw-gradient-from-position: 0%;
|
|
50118
50123
|
}
|
|
@@ -59089,11 +59094,7 @@ select {
|
|
|
59089
59094
|
}
|
|
59090
59095
|
|
|
59091
59096
|
.group:focus-within .group-focus-within\:\!bg-label-gradient-focus {
|
|
59092
|
-
background-image: linear-gradient(to top, #FFF
|
|
59093
|
-
}
|
|
59094
|
-
|
|
59095
|
-
.group:focus-within .group-focus-within\:bg-label-gradient-focus {
|
|
59096
|
-
background-image: linear-gradient(to top, #FFF 9px, transparent 9px);
|
|
59097
|
+
background-image: linear-gradient(to top, #FFF 10px, transparent 10px) !important;
|
|
59097
59098
|
}
|
|
59098
59099
|
|
|
59099
59100
|
.group:focus-within .group-focus-within\:\!text-xs {
|
|
@@ -13,6 +13,7 @@ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handle
|
|
|
13
13
|
maxLength?: number;
|
|
14
14
|
label: ILabelProps;
|
|
15
15
|
handleChange: (value: string) => void;
|
|
16
|
+
labelClassName?: string;
|
|
16
17
|
}
|
|
17
18
|
declare const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps>;
|
|
18
19
|
export default AnimatedLabelInput;
|
package/package.json
CHANGED
|
@@ -24,14 +24,14 @@ const InputLabel: FC<IInputLabelProps> = ({
|
|
|
24
24
|
label
|
|
25
25
|
}: IInputLabelProps) => {
|
|
26
26
|
const labelStyles = cn(
|
|
27
|
-
"z-[2]
|
|
28
|
-
{ "inline-block font-medium transition-all text-sm text-gray-700 ": !isPlaceholder },
|
|
27
|
+
"z-[2] ",
|
|
29
28
|
{ "inline-block font-medium ml-2 relative transition-all": isPlaceholder },
|
|
30
29
|
{ "text-sm text-gray-400 px-2 top-8": isPlaceholder && !isActive },
|
|
31
|
-
{ "text-xs text-gray-700 px-1 top-[10px] ": isPlaceholder && isActive },
|
|
32
|
-
{ "text-xs text-red-500 px-1 top-[10px] ": isPlaceholder && isError },
|
|
33
|
-
{ "text-red-500 ": !isPlaceholder && isError },
|
|
34
|
-
{ "text-gray-500/[.5]": isDisabled }
|
|
30
|
+
{ "text-xs text-gray-700 px-1 top-[10px] bg-white": isPlaceholder && isActive },
|
|
31
|
+
{ "text-xs text-red-500 px-1 top-[10px] bg-white": isPlaceholder && isError },
|
|
32
|
+
{ "text-red-500 bg-white": !isPlaceholder && isError },
|
|
33
|
+
{ "text-gray-500/[.5]": isDisabled },
|
|
34
|
+
{ "inline-block font-medium transition-all text-sm text-gray-700 mb-1": !isPlaceholder }
|
|
35
35
|
)
|
|
36
36
|
if (!label) return null
|
|
37
37
|
return (
|
|
@@ -5,47 +5,34 @@ const meta: Meta<typeof AnimatedLabelInput> = {
|
|
|
5
5
|
title: "Design System/organisms/Animated Label Input",
|
|
6
6
|
component: AnimatedLabelInput,
|
|
7
7
|
tags: ["autodocs"],
|
|
8
|
-
argTypes: {}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
argTypes: {}
|
|
9
|
+
}
|
|
10
|
+
const DefaultArgs: IAnimatedLabelInputProps = {
|
|
11
|
+
id: "test",
|
|
12
|
+
containerStyles: "w-full",
|
|
13
|
+
label: {
|
|
14
|
+
display: "Label with White BG"
|
|
15
|
+
},
|
|
16
|
+
handleChange: (value: string) => {
|
|
17
|
+
console.log(value)
|
|
18
|
+
},
|
|
19
|
+
type: "text",
|
|
20
|
+
value: ""
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export default meta
|
|
24
24
|
type Story = StoryObj<typeof AnimatedLabelInput>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
id: "test",
|
|
28
|
-
label: {
|
|
29
|
-
display: "Label"
|
|
30
|
-
}
|
|
31
|
-
} as IAnimatedLabelInputProps
|
|
32
|
-
}
|
|
33
|
-
export const DefaultAnimatedLabelInputsDarkBGStory: Story = {
|
|
25
|
+
|
|
26
|
+
export const DefaultStory: Story = {
|
|
34
27
|
args: {
|
|
35
|
-
|
|
36
|
-
label: {
|
|
37
|
-
display: "Label with Dark BG"
|
|
38
|
-
},
|
|
39
|
-
value: "Value"
|
|
28
|
+
...DefaultArgs
|
|
40
29
|
} as IAnimatedLabelInputProps
|
|
41
30
|
}
|
|
42
31
|
|
|
43
|
-
export const
|
|
32
|
+
export const WithPlaceHolderStory: Story = {
|
|
44
33
|
args: {
|
|
45
|
-
|
|
46
|
-
label: {
|
|
47
|
-
display: "Label"
|
|
48
|
-
},
|
|
34
|
+
...DefaultArgs,
|
|
35
|
+
label: { display: "label with placeholder" },
|
|
49
36
|
placeholder: "Placeholder"
|
|
50
37
|
} as IAnimatedLabelInputProps
|
|
51
38
|
}
|
|
@@ -17,6 +17,7 @@ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handle
|
|
|
17
17
|
maxLength?: number
|
|
18
18
|
label: ILabelProps
|
|
19
19
|
handleChange: (value: string) => void
|
|
20
|
+
labelClassName?: string
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
|
|
@@ -31,6 +32,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
|
|
|
31
32
|
isShowCounter,
|
|
32
33
|
maxLength,
|
|
33
34
|
handleChange,
|
|
35
|
+
labelClassName,
|
|
34
36
|
...input
|
|
35
37
|
} = props
|
|
36
38
|
|
|
@@ -53,7 +55,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
|
|
|
53
55
|
/>
|
|
54
56
|
<div
|
|
55
57
|
className={cn(
|
|
56
|
-
"absolute z-10 ml-[3px] inline-block bg-
|
|
58
|
+
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
57
59
|
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
58
60
|
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
59
61
|
"group-focus-within:!-top-[8px] group-focus-within:!bg-label-gradient-focus group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
@@ -61,7 +63,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
|
|
|
61
63
|
isError && "!text-red-600"
|
|
62
64
|
)}
|
|
63
65
|
>
|
|
64
|
-
<label htmlFor={id}>
|
|
66
|
+
<label htmlFor={id} className={labelClassName}>
|
|
65
67
|
{label.display}
|
|
66
68
|
{required && <span className="text-red-600 ml-1">*</span>}
|
|
67
69
|
</label>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
2
|
|
|
3
3
|
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
4
|
-
import { dropdownDataBase, dropdownDataWithIcons } from "./dropdownItems"
|
|
4
|
+
import { dropdownDataBase, dropdownDataWithIcons, multipleGroups } from "./dropdownItems"
|
|
5
5
|
import Dropdown, { defaultClassNames } from "./DropdownComponent"
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof Dropdown> = {
|
|
@@ -18,7 +18,6 @@ const IconElement = () => (
|
|
|
18
18
|
const defaultArgs: Story["args"] = {
|
|
19
19
|
items: [...dropdownDataBase],
|
|
20
20
|
label: "Dropdown",
|
|
21
|
-
|
|
22
21
|
placement: "bottom-end"
|
|
23
22
|
}
|
|
24
23
|
export const WithLabel: Story = {
|
|
@@ -26,6 +25,12 @@ export const WithLabel: Story = {
|
|
|
26
25
|
...defaultArgs
|
|
27
26
|
}
|
|
28
27
|
}
|
|
28
|
+
export const MultipleGroups: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
...defaultArgs,
|
|
31
|
+
items: multipleGroups
|
|
32
|
+
}
|
|
33
|
+
}
|
|
29
34
|
|
|
30
35
|
export const CustomTrigger: Story = {
|
|
31
36
|
args: {
|
|
@@ -57,8 +57,7 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
57
57
|
}
|
|
58
58
|
export const defaultClassNames = {
|
|
59
59
|
groupClassname: "flex inline-block text-left",
|
|
60
|
-
itemsClassname:
|
|
61
|
-
"mt-2 origin-bottom-right rounded bg-white shadow-lg z-[99999] divide-y divide-gray-100 border border-gray-300 ",
|
|
60
|
+
itemsClassname: "mt-2 origin-bottom-right rounded bg-white shadow-lg z-[99999] border border-gray-300 ",
|
|
62
61
|
itemClassname:
|
|
63
62
|
"group flex font-muli cursor-pointer items-center px-4 py-2 text-sm transition-all hover:bg-gray-100 hover:text-gray-900 justify-between gap-4 ",
|
|
64
63
|
activeItemClassname: "block px-4 py-2 text-sm text-gray-700 bg-gray-100 hover:bg-gray-200 hover:text-gray-900",
|
|
@@ -176,7 +175,19 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
176
175
|
{...{
|
|
177
176
|
key: key,
|
|
178
177
|
id: key.toString(),
|
|
179
|
-
className: cn(
|
|
178
|
+
className: cn(
|
|
179
|
+
itemClass,
|
|
180
|
+
//Round the corners of the first item in the first stack and the last item in the last stack
|
|
181
|
+
itemIndex === 0 && stackIndex === 0 && "rounded-tl rounded-tr",
|
|
182
|
+
itemIndex === itemStack.length - 1 &&
|
|
183
|
+
stackIndex === items.length - 1 &&
|
|
184
|
+
"rounded-bl rounded-br",
|
|
185
|
+
//Add dividing line between stacks
|
|
186
|
+
stackIndex !== items.length - 1 &&
|
|
187
|
+
itemIndex === itemStack.length - 1 &&
|
|
188
|
+
"border-b border-b-gray-100",
|
|
189
|
+
"w-full"
|
|
190
|
+
),
|
|
180
191
|
...rest,
|
|
181
192
|
...getItemProps(),
|
|
182
193
|
onClick: () => {
|
|
@@ -3,26 +3,26 @@ import { IItemProp } from "./DropdownComponent"
|
|
|
3
3
|
export const dropdownDataBase: IItemProp[][] = [
|
|
4
4
|
[
|
|
5
5
|
{
|
|
6
|
-
icon: {
|
|
7
|
-
icon: "IconCopy"
|
|
8
|
-
// pos: "leading",
|
|
9
|
-
// className: "h-5 w-5",
|
|
10
|
-
// outline: false
|
|
11
|
-
},
|
|
6
|
+
icon: { icon: "IconCopy" },
|
|
12
7
|
key: "Copy",
|
|
13
8
|
label: "Copy to Clipboard",
|
|
14
9
|
onClick: () => {
|
|
15
10
|
console.log("Copy action")
|
|
16
11
|
}
|
|
17
12
|
},
|
|
18
|
-
|
|
19
13
|
{
|
|
20
|
-
icon: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// outline: false
|
|
14
|
+
icon: { icon: "IconTrash" },
|
|
15
|
+
label: "Delete",
|
|
16
|
+
onClick: () => {
|
|
17
|
+
console.log("Delete action")
|
|
25
18
|
},
|
|
19
|
+
isEmphasized: true,
|
|
20
|
+
key: "Delete"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
icon: { icon: "IconPlus" },
|
|
26
26
|
key: "Add to Batch",
|
|
27
27
|
label: "Add to Batch",
|
|
28
28
|
onClick: () => {
|
|
@@ -30,35 +30,41 @@ export const dropdownDataBase: IItemProp[][] = [
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
icon: {
|
|
34
|
-
icon: "IconEye"
|
|
35
|
-
// pos: "leading",
|
|
36
|
-
// className: "h-5 w-5",
|
|
37
|
-
// outline: false
|
|
38
|
-
},
|
|
33
|
+
icon: { icon: "IconEye" },
|
|
39
34
|
key: "View Batch",
|
|
40
35
|
label: "View Batch",
|
|
41
36
|
onClick: () => {
|
|
42
37
|
console.log("View Batch action")
|
|
43
38
|
}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
icon: {
|
|
47
|
-
icon: "IconTrash"
|
|
48
|
-
// pos: "leading",
|
|
49
|
-
// className: "h-5 w-5",
|
|
50
|
-
// outline: false
|
|
51
|
-
},
|
|
52
|
-
label: "Delete",
|
|
53
|
-
onClick: () => {
|
|
54
|
-
console.log("Delete action")
|
|
55
|
-
},
|
|
56
|
-
isEmphasized: true,
|
|
57
|
-
key: "Delete"
|
|
58
39
|
}
|
|
59
40
|
]
|
|
60
41
|
]
|
|
61
42
|
|
|
43
|
+
export const multipleGroups: IItemProp[][] = [
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
icon: { icon: "IconArrowUp" },
|
|
47
|
+
key: "moveUp",
|
|
48
|
+
label: "Move up",
|
|
49
|
+
onClick: () => {
|
|
50
|
+
window.alert("moved up")
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{ icon: { icon: "IconArrowDown" }, key: "moveDown", label: "Moved down", onClick: () => {} }
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
{ icon: { icon: "IconCheck" }, key: "publish", label: "Publish", onClick: () => {} },
|
|
57
|
+
{ icon: { icon: "IconEyeOff" }, key: "unpublish", label: "Unpublish", onClick: () => {} }
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{ icon: { icon: "IconEyeCheck" }, key: "reqApproval", label: "Request Approval", onClick: () => {} },
|
|
61
|
+
{ icon: { icon: "IconThumbUp" }, key: "approve", label: "Approve", onClick: () => {} },
|
|
62
|
+
{ icon: { icon: "IconBan" }, key: "decline", label: "Decline", onClick: () => {} }
|
|
63
|
+
],
|
|
64
|
+
[{ icon: { icon: "IconCopy" }, key: "Copy", label: "Copy", onClick: () => {} }],
|
|
65
|
+
[{ icon: { icon: "IconTrash" }, key: "delete", label: "Delete", onClick: () => {} }]
|
|
66
|
+
]
|
|
67
|
+
|
|
62
68
|
export const dropdownDataWithIcons: IItemProp[][] = [
|
|
63
69
|
[
|
|
64
70
|
{
|
package/tailwind.config.js
CHANGED
|
@@ -40,8 +40,8 @@ module.exports = {
|
|
|
40
40
|
},
|
|
41
41
|
extend: {
|
|
42
42
|
backgroundImage: (theme) => ({
|
|
43
|
-
"label-gradient-focus": "linear-gradient(to top, #FFF
|
|
44
|
-
"label-gradient-idle": "linear-gradient(to top, #FFF
|
|
43
|
+
"label-gradient-focus": "linear-gradient(to top, #FFF 10px, transparent 10px)",
|
|
44
|
+
"label-gradient-idle": "linear-gradient(to top, #FFF 10px, transparent 10px)"
|
|
45
45
|
}),
|
|
46
46
|
gridTemplateColumns: {
|
|
47
47
|
// Simple 16 column grid
|