@agility/plenum-ui 2.0.1 → 2.0.2
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 +2 -2
- package/dist/tailwind.css +20 -11
- package/dist/types/stories/organisms/DropdownComponent/dropdownItems.d.ts +1 -0
- package/package.json +1 -1
- 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/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
|
}
|
package/package.json
CHANGED
|
@@ -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
|
{
|