@agility/plenum-ui 2.0.0-rc47 → 2.0.0-rc49
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/.eslintrc.json +6 -6
- package/.prettierrc +13 -13
- package/.storybook/Layout.jsx +12 -12
- package/.storybook/head.tsx +4 -4
- package/.storybook/main.ts +18 -18
- package/.storybook/manager-head.html +1 -1
- package/.storybook/manager.ts +25 -25
- package/.storybook/plenumTheme.ts +8 -8
- package/.storybook/preview-head.html +3 -3
- package/.storybook/preview.tsx +28 -28
- package/.vscode/settings.json +3 -3
- package/README.md +271 -271
- package/app/globals.css +99 -99
- package/app/head.tsx +59 -59
- package/app/layout.tsx +28 -28
- package/app/page.tsx +7 -7
- package/build.js +45 -45
- package/dist/index.d.ts +232 -230
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -0
- package/local.sh +100 -100
- package/next.config.js +8 -8
- package/package.json +82 -82
- package/pages/api/hello.ts +13 -13
- package/postcss.config.js +6 -6
- package/rollup.config.mjs +41 -41
- package/scripts/create-component.js +97 -97
- package/stories/Introduction.mdx +314 -314
- package/stories/assets/stackalt.svg +1 -1
- package/stories/atoms/Avatar/Avatar.stories.tsx +96 -96
- package/stories/atoms/Avatar/Avatar.tsx +123 -123
- package/stories/atoms/Avatar/index.ts +3 -3
- package/stories/atoms/badges/Badge.tsx +127 -127
- package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -75
- package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -75
- package/stories/atoms/badges/index.ts +3 -3
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +86 -86
- package/stories/atoms/buttons/Button/Button.tsx +232 -232
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +90 -90
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +97 -97
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +93 -93
- package/stories/atoms/buttons/Button/defaultArgs.ts +9 -9
- package/stories/atoms/buttons/Button/index.ts +3 -3
- package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Capsule.tsx +88 -88
- package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/index.ts +3 -3
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -15
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -22
- package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -3
- package/stories/atoms/buttons/index.ts +4 -4
- package/stories/atoms/crumb/Crumb.stories.tsx +18 -18
- package/stories/atoms/crumb/Crumb.tsx +22 -22
- package/stories/atoms/crumb/index.tsx +3 -3
- package/stories/atoms/icons/DynamicIcon.stories.ts +43 -43
- package/stories/atoms/icons/DynamicIcon.tsx +90 -90
- package/stories/atoms/icons/IconWithShadow.stories.ts +43 -43
- package/stories/atoms/icons/IconWithShadow.tsx +16 -16
- package/stories/atoms/icons/TablerIcon.tsx +22 -22
- package/stories/atoms/icons/index.tsx +14 -14
- package/stories/atoms/icons/tablerIconNames.ts +4336 -4336
- package/stories/atoms/index.ts +46 -46
- package/stories/atoms/loaders/Loader.stories.ts +15 -15
- package/stories/atoms/loaders/Loader.tsx +21 -21
- package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -19
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +74 -74
- package/stories/atoms/loaders/NProgress/index.ts +3 -3
- package/stories/atoms/loaders/index.ts +4 -4
- package/stories/index.ts +136 -136
- package/stories/molecules/index.ts +51 -51
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -18
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -24
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -3
- package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -29
- package/stories/molecules/inputs/InputField/InputField.tsx +96 -96
- package/stories/molecules/inputs/InputField/index.tsx +3 -3
- package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -19
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -45
- package/stories/molecules/inputs/InputLabel/index.tsx +3 -3
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -52
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -64
- package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -3
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -32
- package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -165
- package/stories/molecules/inputs/TextInput/index.tsx +5 -5
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -23
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +98 -98
- package/stories/molecules/inputs/checkbox/index.ts +3 -3
- package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -41
- package/stories/molecules/inputs/combobox/ComboBox.tsx +185 -185
- package/stories/molecules/inputs/combobox/index.ts +3 -3
- package/stories/molecules/inputs/index.ts +38 -38
- package/stories/molecules/inputs/radio/Radio.stories.ts +27 -27
- package/stories/molecules/inputs/radio/Radio.tsx +92 -92
- package/stories/molecules/inputs/radio/index.ts +3 -3
- package/stories/molecules/inputs/select/Select.stories.ts +23 -23
- package/stories/molecules/inputs/select/Select.tsx +108 -100
- package/stories/molecules/inputs/select/index.ts +3 -3
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +22 -22
- package/stories/molecules/inputs/textArea/TextArea.tsx +158 -158
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +118 -118
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +81 -81
- package/stories/molecules/inputs/toggleSwitch/index.ts +3 -3
- package/stories/molecules/tabs/Tabs.stories.tsx +18 -18
- package/stories/molecules/tabs/Tabs.tsx +22 -22
- package/stories/molecules/tabs/index.tsx +2 -2
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +30 -30
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +66 -66
- package/stories/organisms/AnimatedLabelInput/index.tsx +3 -3
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -26
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -61
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -3
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +125 -125
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +86 -86
- package/stories/organisms/ButtonDropdown/index.tsx +3 -3
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +73 -73
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +346 -346
- package/stories/organisms/DropdownComponent/dropdownItems.ts +122 -122
- package/stories/organisms/DropdownComponent/index.ts +4 -4
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -76
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -52
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +4 -4
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -29
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +145 -145
- package/stories/organisms/FormInputWithAddons/index.tsx +3 -3
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -59
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -33
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -186
- package/stories/organisms/TextInputSelect/index.tsx +3 -3
- package/stories/organisms/index.ts +27 -27
- package/tailwind.config.js +192 -192
- package/tsconfig.json +29 -29
- package/tsconfig.lib.json +25 -25
- package/utils/types.d.ts +2 -2
- package/utils/types.ts +3 -3
- package/utils/useId.d.ts +1 -1
- package/utils/useId.tsx +16 -16
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import ButtonDropdown from "."
|
|
3
|
-
import { IItemProp } from "../DropdownComponent"
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof ButtonDropdown> = {
|
|
6
|
-
title: "Design System/Organisms/Button Dropdown",
|
|
7
|
-
component: ButtonDropdown,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
argTypes: {}
|
|
10
|
-
}
|
|
11
|
-
const dropdownDataWithIcons: IItemProp[][] = [
|
|
12
|
-
[
|
|
13
|
-
{
|
|
14
|
-
icon: {
|
|
15
|
-
icon: "IconCopy"
|
|
16
|
-
|
|
17
|
-
// className: "h-5 w-5",
|
|
18
|
-
// outline: false
|
|
19
|
-
},
|
|
20
|
-
iconPosition: "leading",
|
|
21
|
-
key: "Copy",
|
|
22
|
-
label: "Copy The Thing",
|
|
23
|
-
onClick: () => {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
{
|
|
30
|
-
icon: {
|
|
31
|
-
icon: "IconFolderPlus"
|
|
32
|
-
// name: "IconFolderPlus",
|
|
33
|
-
// className: "h-5 w-5",
|
|
34
|
-
// outline: false
|
|
35
|
-
},
|
|
36
|
-
key: "Add to Batch",
|
|
37
|
-
label: "Add to Batch",
|
|
38
|
-
onClick: () => {
|
|
39
|
-
console.log("Add to Batch action")
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
icon: {
|
|
44
|
-
icon: "IconEye",
|
|
45
|
-
//pos: "leading",
|
|
46
|
-
className: "h-5 w-5",
|
|
47
|
-
outline: false
|
|
48
|
-
},
|
|
49
|
-
iconPosition: "leading",
|
|
50
|
-
key: "View Batch",
|
|
51
|
-
label: "View Batch",
|
|
52
|
-
onClick: () => {
|
|
53
|
-
console.log("View Batch action")
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
icon: {
|
|
60
|
-
icon: "IconTrash"
|
|
61
|
-
|
|
62
|
-
// pos: "leading",
|
|
63
|
-
// className: "h-5 w-5",
|
|
64
|
-
// outline: false
|
|
65
|
-
},
|
|
66
|
-
key: "Delete",
|
|
67
|
-
label: "Delete",
|
|
68
|
-
onClick: () => {
|
|
69
|
-
console.log("Delete action")
|
|
70
|
-
},
|
|
71
|
-
isEmphasized: true
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
export default meta
|
|
77
|
-
type Story = StoryObj<typeof ButtonDropdown>
|
|
78
|
-
|
|
79
|
-
export const Primary: Story = {
|
|
80
|
-
args: {
|
|
81
|
-
button: {
|
|
82
|
-
label: "Primary",
|
|
83
|
-
actionType: "primary"
|
|
84
|
-
},
|
|
85
|
-
dropDown: {
|
|
86
|
-
items: dropdownDataWithIcons,
|
|
87
|
-
label: "Dropdown",
|
|
88
|
-
id: "dropdown-primary"
|
|
89
|
-
},
|
|
90
|
-
offsetOptions: {
|
|
91
|
-
crossAxis: 0,
|
|
92
|
-
mainAxis: 0, //up/down
|
|
93
|
-
alignmentAxis: 0 //left/right
|
|
94
|
-
},
|
|
95
|
-
placement: "bottom-end"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export const Secondary: Story = {
|
|
99
|
-
args: {
|
|
100
|
-
button: {
|
|
101
|
-
label: "Secondary",
|
|
102
|
-
actionType: "secondary"
|
|
103
|
-
},
|
|
104
|
-
dropDown: {
|
|
105
|
-
label: "Dropdown",
|
|
106
|
-
id: "dropdown-secondary",
|
|
107
|
-
items: dropdownDataWithIcons
|
|
108
|
-
},
|
|
109
|
-
placement: "bottom-end"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
export const Alternative: Story = {
|
|
113
|
-
args: {
|
|
114
|
-
button: {
|
|
115
|
-
label: "Alternative",
|
|
116
|
-
actionType: "alternative"
|
|
117
|
-
},
|
|
118
|
-
dropDown: {
|
|
119
|
-
label: "Dropdown",
|
|
120
|
-
id: "dropdown-secondary",
|
|
121
|
-
items: dropdownDataWithIcons
|
|
122
|
-
},
|
|
123
|
-
placement: "bottom-end"
|
|
124
|
-
}
|
|
125
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import ButtonDropdown from "."
|
|
3
|
+
import { IItemProp } from "../DropdownComponent"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ButtonDropdown> = {
|
|
6
|
+
title: "Design System/Organisms/Button Dropdown",
|
|
7
|
+
component: ButtonDropdown,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {}
|
|
10
|
+
}
|
|
11
|
+
const dropdownDataWithIcons: IItemProp[][] = [
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
icon: {
|
|
15
|
+
icon: "IconCopy"
|
|
16
|
+
|
|
17
|
+
// className: "h-5 w-5",
|
|
18
|
+
// outline: false
|
|
19
|
+
},
|
|
20
|
+
iconPosition: "leading",
|
|
21
|
+
key: "Copy",
|
|
22
|
+
label: "Copy The Thing",
|
|
23
|
+
onClick: () => {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
icon: {
|
|
31
|
+
icon: "IconFolderPlus"
|
|
32
|
+
// name: "IconFolderPlus",
|
|
33
|
+
// className: "h-5 w-5",
|
|
34
|
+
// outline: false
|
|
35
|
+
},
|
|
36
|
+
key: "Add to Batch",
|
|
37
|
+
label: "Add to Batch",
|
|
38
|
+
onClick: () => {
|
|
39
|
+
console.log("Add to Batch action")
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
icon: {
|
|
44
|
+
icon: "IconEye",
|
|
45
|
+
//pos: "leading",
|
|
46
|
+
className: "h-5 w-5",
|
|
47
|
+
outline: false
|
|
48
|
+
},
|
|
49
|
+
iconPosition: "leading",
|
|
50
|
+
key: "View Batch",
|
|
51
|
+
label: "View Batch",
|
|
52
|
+
onClick: () => {
|
|
53
|
+
console.log("View Batch action")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
icon: {
|
|
60
|
+
icon: "IconTrash"
|
|
61
|
+
|
|
62
|
+
// pos: "leading",
|
|
63
|
+
// className: "h-5 w-5",
|
|
64
|
+
// outline: false
|
|
65
|
+
},
|
|
66
|
+
key: "Delete",
|
|
67
|
+
label: "Delete",
|
|
68
|
+
onClick: () => {
|
|
69
|
+
console.log("Delete action")
|
|
70
|
+
},
|
|
71
|
+
isEmphasized: true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
export default meta
|
|
77
|
+
type Story = StoryObj<typeof ButtonDropdown>
|
|
78
|
+
|
|
79
|
+
export const Primary: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
button: {
|
|
82
|
+
label: "Primary",
|
|
83
|
+
actionType: "primary"
|
|
84
|
+
},
|
|
85
|
+
dropDown: {
|
|
86
|
+
items: dropdownDataWithIcons,
|
|
87
|
+
label: "Dropdown",
|
|
88
|
+
id: "dropdown-primary"
|
|
89
|
+
},
|
|
90
|
+
offsetOptions: {
|
|
91
|
+
crossAxis: 0,
|
|
92
|
+
mainAxis: 0, //up/down
|
|
93
|
+
alignmentAxis: 0 //left/right
|
|
94
|
+
},
|
|
95
|
+
placement: "bottom-end"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export const Secondary: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
button: {
|
|
101
|
+
label: "Secondary",
|
|
102
|
+
actionType: "secondary"
|
|
103
|
+
},
|
|
104
|
+
dropDown: {
|
|
105
|
+
label: "Dropdown",
|
|
106
|
+
id: "dropdown-secondary",
|
|
107
|
+
items: dropdownDataWithIcons
|
|
108
|
+
},
|
|
109
|
+
placement: "bottom-end"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export const Alternative: Story = {
|
|
113
|
+
args: {
|
|
114
|
+
button: {
|
|
115
|
+
label: "Alternative",
|
|
116
|
+
actionType: "alternative"
|
|
117
|
+
},
|
|
118
|
+
dropDown: {
|
|
119
|
+
label: "Dropdown",
|
|
120
|
+
id: "dropdown-secondary",
|
|
121
|
+
items: dropdownDataWithIcons
|
|
122
|
+
},
|
|
123
|
+
placement: "bottom-end"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import React, { FC } from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
import Button, { IButtonProps } from "@/stories/atoms/buttons/Button"
|
|
4
|
-
|
|
5
|
-
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
6
|
-
import Dropdown, { IDropdownProps, defaultClassNames } from "../DropdownComponent"
|
|
7
|
-
|
|
8
|
-
export interface IButtonDropdownProps {
|
|
9
|
-
button: IButtonProps
|
|
10
|
-
dropDown: IDropdownProps
|
|
11
|
-
placement?: IDropdownProps["placement"]
|
|
12
|
-
offsetOptions?: IDropdownProps["offsetOptions"]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Primary UI component for user interaction
|
|
17
|
-
*/
|
|
18
|
-
const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement = "bottom-end", offsetOptions }) => {
|
|
19
|
-
return (
|
|
20
|
-
<div className="flex items-stretch focus-within:ring-purple-600 focus-within:ring-2 focus-within:ring-offset-white focus-within:ring-offset-2 rounded-[3px]">
|
|
21
|
-
<Button
|
|
22
|
-
{...{
|
|
23
|
-
...button,
|
|
24
|
-
className: cn(
|
|
25
|
-
button.className,
|
|
26
|
-
"!rounded-r-none !border-r-0 hover:!border-r-0 !focus:ring-transparent !focus-visible:ring-transparent !focus-within:ring-transparent !focus:ring-0 !focus-within:ring-0 !focus-visible:ring-0 !focus:ring-offset-0 !focus-visible:ring-offset-0 !focus-within:ring-offset-0 !ring-0 outline-none focus:outline-none focus-visible:outline-none focus-within:outline-none !ring-offset-0"
|
|
27
|
-
)
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
<div
|
|
31
|
-
className={cn(
|
|
32
|
-
"w-[1px] rt",
|
|
33
|
-
button.actionType === "primary" ? "bg-purple-700 " : "",
|
|
34
|
-
button.actionType === "secondary" ? "bg-purple-200" : "",
|
|
35
|
-
button.actionType === "alternative" ? "bg-gray-300" : ""
|
|
36
|
-
)}
|
|
37
|
-
></div>
|
|
38
|
-
<Dropdown
|
|
39
|
-
{...{
|
|
40
|
-
...(dropDown as IDropdownProps),
|
|
41
|
-
CustomDropdownTrigger: (
|
|
42
|
-
<DynamicIcon
|
|
43
|
-
{...{
|
|
44
|
-
icon: "IconChevronDown",
|
|
45
|
-
className: cn("h-5 w-5", {
|
|
46
|
-
"text-white": button.actionType === "primary",
|
|
47
|
-
"text-purple-700": button.actionType === "secondary",
|
|
48
|
-
"text-gray-700": button.actionType === "alternative"
|
|
49
|
-
})
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
),
|
|
53
|
-
buttonClassname: cn(
|
|
54
|
-
"flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
|
|
55
|
-
button.actionType === "primary"
|
|
56
|
-
? cn(
|
|
57
|
-
"border-purple-600 bg-purple-600 !text-white hover:border-purple-700 hover:bg-purple-700 active:!border-purple-800 active:bg-purple-800 fill-white",
|
|
58
|
-
"disabled:bg-purple-400 disabled:text-white disabled:hover:none disabled:active:bg-purple-400 disabled:border-purple-400"
|
|
59
|
-
)
|
|
60
|
-
: "",
|
|
61
|
-
button.actionType === "secondary"
|
|
62
|
-
? cn(
|
|
63
|
-
"border-purple-50 bg-purple-50 text-purple-700 hover:border-purple-100 hover:bg-purple-100 active:border-purple-300 active:bg-purple-300 fill-purple-700",
|
|
64
|
-
"disabled:bg-purple-50 disabled:text-grey-50 disabled:hover:none disabled:active:bg-purple-50 disabled:border-purple-50"
|
|
65
|
-
)
|
|
66
|
-
: "",
|
|
67
|
-
button.actionType === "alternative"
|
|
68
|
-
? cn(
|
|
69
|
-
"border-gray-300 bg-white text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100",
|
|
70
|
-
"disabled:bg-gray-100 disabled:text-gray-500 disabled:hover:none disabled:active:bg-gray-100 disabled:border-gray-300"
|
|
71
|
-
)
|
|
72
|
-
: ""
|
|
73
|
-
),
|
|
74
|
-
offsetOptions: offsetOptions ?? {
|
|
75
|
-
crossAxis: 0,
|
|
76
|
-
mainAxis: -4, //up/down
|
|
77
|
-
alignmentAxis: 0 //left/right
|
|
78
|
-
},
|
|
79
|
-
placement
|
|
80
|
-
}}
|
|
81
|
-
/>
|
|
82
|
-
<div className="hidden !bg-purple-100 !text-purple-600 transition-all hover:bg-purple-200 focus:bg-purple-300" />
|
|
83
|
-
</div>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
export default ButtonDropdown
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import Button, { IButtonProps } from "@/stories/atoms/buttons/Button"
|
|
4
|
+
|
|
5
|
+
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
6
|
+
import Dropdown, { IDropdownProps, defaultClassNames } from "../DropdownComponent"
|
|
7
|
+
|
|
8
|
+
export interface IButtonDropdownProps {
|
|
9
|
+
button: IButtonProps
|
|
10
|
+
dropDown: IDropdownProps
|
|
11
|
+
placement?: IDropdownProps["placement"]
|
|
12
|
+
offsetOptions?: IDropdownProps["offsetOptions"]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Primary UI component for user interaction
|
|
17
|
+
*/
|
|
18
|
+
const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement = "bottom-end", offsetOptions }) => {
|
|
19
|
+
return (
|
|
20
|
+
<div className="flex items-stretch focus-within:ring-purple-600 focus-within:ring-2 focus-within:ring-offset-white focus-within:ring-offset-2 rounded-[3px]">
|
|
21
|
+
<Button
|
|
22
|
+
{...{
|
|
23
|
+
...button,
|
|
24
|
+
className: cn(
|
|
25
|
+
button.className,
|
|
26
|
+
"!rounded-r-none !border-r-0 hover:!border-r-0 !focus:ring-transparent !focus-visible:ring-transparent !focus-within:ring-transparent !focus:ring-0 !focus-within:ring-0 !focus-visible:ring-0 !focus:ring-offset-0 !focus-visible:ring-offset-0 !focus-within:ring-offset-0 !ring-0 outline-none focus:outline-none focus-visible:outline-none focus-within:outline-none !ring-offset-0"
|
|
27
|
+
)
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
<div
|
|
31
|
+
className={cn(
|
|
32
|
+
"w-[1px] rt",
|
|
33
|
+
button.actionType === "primary" ? "bg-purple-700 " : "",
|
|
34
|
+
button.actionType === "secondary" ? "bg-purple-200" : "",
|
|
35
|
+
button.actionType === "alternative" ? "bg-gray-300" : ""
|
|
36
|
+
)}
|
|
37
|
+
></div>
|
|
38
|
+
<Dropdown
|
|
39
|
+
{...{
|
|
40
|
+
...(dropDown as IDropdownProps),
|
|
41
|
+
CustomDropdownTrigger: (
|
|
42
|
+
<DynamicIcon
|
|
43
|
+
{...{
|
|
44
|
+
icon: "IconChevronDown",
|
|
45
|
+
className: cn("h-5 w-5", {
|
|
46
|
+
"text-white": button.actionType === "primary",
|
|
47
|
+
"text-purple-700": button.actionType === "secondary",
|
|
48
|
+
"text-gray-700": button.actionType === "alternative"
|
|
49
|
+
})
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
buttonClassname: cn(
|
|
54
|
+
"flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
|
|
55
|
+
button.actionType === "primary"
|
|
56
|
+
? cn(
|
|
57
|
+
"border-purple-600 bg-purple-600 !text-white hover:border-purple-700 hover:bg-purple-700 active:!border-purple-800 active:bg-purple-800 fill-white",
|
|
58
|
+
"disabled:bg-purple-400 disabled:text-white disabled:hover:none disabled:active:bg-purple-400 disabled:border-purple-400"
|
|
59
|
+
)
|
|
60
|
+
: "",
|
|
61
|
+
button.actionType === "secondary"
|
|
62
|
+
? cn(
|
|
63
|
+
"border-purple-50 bg-purple-50 text-purple-700 hover:border-purple-100 hover:bg-purple-100 active:border-purple-300 active:bg-purple-300 fill-purple-700",
|
|
64
|
+
"disabled:bg-purple-50 disabled:text-grey-50 disabled:hover:none disabled:active:bg-purple-50 disabled:border-purple-50"
|
|
65
|
+
)
|
|
66
|
+
: "",
|
|
67
|
+
button.actionType === "alternative"
|
|
68
|
+
? cn(
|
|
69
|
+
"border-gray-300 bg-white text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100",
|
|
70
|
+
"disabled:bg-gray-100 disabled:text-gray-500 disabled:hover:none disabled:active:bg-gray-100 disabled:border-gray-300"
|
|
71
|
+
)
|
|
72
|
+
: ""
|
|
73
|
+
),
|
|
74
|
+
offsetOptions: offsetOptions ?? {
|
|
75
|
+
crossAxis: 0,
|
|
76
|
+
mainAxis: -4, //up/down
|
|
77
|
+
alignmentAxis: 0 //left/right
|
|
78
|
+
},
|
|
79
|
+
placement
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
<div className="hidden !bg-purple-100 !text-purple-600 transition-all hover:bg-purple-200 focus:bg-purple-300" />
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
export default ButtonDropdown
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown"
|
|
2
|
-
export type { IButtonDropdownProps }
|
|
3
|
-
export default ButtonDropdown
|
|
1
|
+
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown"
|
|
2
|
+
export type { IButtonDropdownProps }
|
|
3
|
+
export default ButtonDropdown
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
|
|
3
|
-
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
4
|
-
import { dropdownDataBase, dropdownDataWithIcons } from "./dropdownItems"
|
|
5
|
-
import Dropdown, { defaultClassNames } from "./DropdownComponent"
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Dropdown> = {
|
|
8
|
-
title: "Design System/Organisms/Dropdown",
|
|
9
|
-
component: Dropdown,
|
|
10
|
-
tags: ["autodocs"],
|
|
11
|
-
argTypes: {}
|
|
12
|
-
}
|
|
13
|
-
type Story = StoryObj<typeof Dropdown>
|
|
14
|
-
|
|
15
|
-
const IconElement = () => (
|
|
16
|
-
<DynamicIcon className="h-5 w-5 text-gray-400 hover:text-gray-600" icon={"IconDotsVertical"} />
|
|
17
|
-
)
|
|
18
|
-
const defaultArgs: Story["args"] = {
|
|
19
|
-
items: [...dropdownDataBase],
|
|
20
|
-
label: "Dropdown",
|
|
21
|
-
|
|
22
|
-
placement: "bottom-end"
|
|
23
|
-
}
|
|
24
|
-
export const WithLabel: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
...defaultArgs
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const CustomTrigger: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
...defaultArgs,
|
|
33
|
-
CustomDropdownTrigger: <IconElement />
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export const WithLabelAndIcons: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
...defaultArgs,
|
|
39
|
-
items: [...dropdownDataWithIcons]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export const WithCustomItemLabelsAndIcons: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
...defaultArgs,
|
|
45
|
-
items: [
|
|
46
|
-
...dropdownDataWithIcons,
|
|
47
|
-
[
|
|
48
|
-
{
|
|
49
|
-
icon: { icon: "Icon123" },
|
|
50
|
-
label: (
|
|
51
|
-
<div className="flex items-baseline gap-x-2">
|
|
52
|
-
sdfsdf{" "}
|
|
53
|
-
<div className="flex space-x-1">
|
|
54
|
-
<div className="h-1 w-1 animate-[bounce_1s_infinite] rounded-full bg-gray-500"></div>
|
|
55
|
-
<div className="h-1 w-1 animate-[bounce_1s_infinite_0.2s] rounded-full bg-gray-500"></div>
|
|
56
|
-
<div className="h-1 w-1 animate-[bounce_1s_infinite_0.4s] rounded-full bg-gray-500"></div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
),
|
|
60
|
-
key: "sdfsdf"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export const WithIcons: Story = {
|
|
67
|
-
args: {
|
|
68
|
-
...defaultArgs,
|
|
69
|
-
items: [...dropdownDataWithIcons],
|
|
70
|
-
CustomDropdownTrigger: <IconElement />
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
export default meta
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
4
|
+
import { dropdownDataBase, dropdownDataWithIcons } from "./dropdownItems"
|
|
5
|
+
import Dropdown, { defaultClassNames } from "./DropdownComponent"
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Dropdown> = {
|
|
8
|
+
title: "Design System/Organisms/Dropdown",
|
|
9
|
+
component: Dropdown,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {}
|
|
12
|
+
}
|
|
13
|
+
type Story = StoryObj<typeof Dropdown>
|
|
14
|
+
|
|
15
|
+
const IconElement = () => (
|
|
16
|
+
<DynamicIcon className="h-5 w-5 text-gray-400 hover:text-gray-600" icon={"IconDotsVertical"} />
|
|
17
|
+
)
|
|
18
|
+
const defaultArgs: Story["args"] = {
|
|
19
|
+
items: [...dropdownDataBase],
|
|
20
|
+
label: "Dropdown",
|
|
21
|
+
|
|
22
|
+
placement: "bottom-end"
|
|
23
|
+
}
|
|
24
|
+
export const WithLabel: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
...defaultArgs
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const CustomTrigger: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
...defaultArgs,
|
|
33
|
+
CustomDropdownTrigger: <IconElement />
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export const WithLabelAndIcons: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
...defaultArgs,
|
|
39
|
+
items: [...dropdownDataWithIcons]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const WithCustomItemLabelsAndIcons: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
...defaultArgs,
|
|
45
|
+
items: [
|
|
46
|
+
...dropdownDataWithIcons,
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
icon: { icon: "Icon123" },
|
|
50
|
+
label: (
|
|
51
|
+
<div className="flex items-baseline gap-x-2">
|
|
52
|
+
sdfsdf{" "}
|
|
53
|
+
<div className="flex space-x-1">
|
|
54
|
+
<div className="h-1 w-1 animate-[bounce_1s_infinite] rounded-full bg-gray-500"></div>
|
|
55
|
+
<div className="h-1 w-1 animate-[bounce_1s_infinite_0.2s] rounded-full bg-gray-500"></div>
|
|
56
|
+
<div className="h-1 w-1 animate-[bounce_1s_infinite_0.4s] rounded-full bg-gray-500"></div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
),
|
|
60
|
+
key: "sdfsdf"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const WithIcons: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
...defaultArgs,
|
|
69
|
+
items: [...dropdownDataWithIcons],
|
|
70
|
+
CustomDropdownTrigger: <IconElement />
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export default meta
|