@agility/plenum-ui 2.0.0-rc25 → 2.0.0-rc27
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 +6 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +4 -4
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +2 -2
- package/package.json +1 -1
- package/stories/atoms/badges/Badge.tsx +1 -1
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +2 -2
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +2 -2
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +1 -1
- package/stories/atoms/buttons/Button/defaultArgs.ts +1 -1
- package/stories/atoms/icons/DynamicIcon.stories.ts +4 -4
- package/stories/atoms/icons/DynamicIcon.tsx +44 -33
- package/stories/atoms/icons/IconWithShadow.stories.ts +3 -3
- package/stories/molecules/inputs/combobox/ComboBox.tsx +126 -135
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +4 -3
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +1 -2
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +1 -1
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +2 -3
- package/stories/organisms/DropdownComponent/dropdownItems.ts +3 -3
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +3 -3
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +1 -1
|
@@ -6,12 +6,12 @@ import { TablerIconName } from "./tablerIconNames";
|
|
|
6
6
|
import { ClassNameWithAutocomplete } from "@/utils/types";
|
|
7
7
|
export type IconName = keyof typeof SolidIcons | keyof typeof OutlineIcons;
|
|
8
8
|
export type FAIconName = keyof typeof FA;
|
|
9
|
-
export type UnifiedIconName =
|
|
10
|
-
export declare function isHeroIcon(name: UnifiedIconName): name is keyof typeof SolidIcons | keyof typeof OutlineIcons;
|
|
9
|
+
export type UnifiedIconName = TablerIconName;
|
|
11
10
|
export declare function isTablerIcon(name: UnifiedIconName): name is TablerIconName;
|
|
12
|
-
export declare function
|
|
11
|
+
export declare function isHeroIcon(name: UnifiedIconName): boolean;
|
|
12
|
+
export declare function isFAIcon(name: UnifiedIconName): boolean;
|
|
13
13
|
export declare function isUnifiedIconName(name: UnifiedIconName): name is UnifiedIconName;
|
|
14
|
-
export interface IDynamicIconProps {
|
|
14
|
+
export interface IDynamicIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
15
15
|
icon: UnifiedIconName;
|
|
16
16
|
className?: ClassNameWithAutocomplete;
|
|
17
17
|
outline?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
2
|
import { Placement } from "@floating-ui/react";
|
|
3
3
|
import { ClassNameWithAutocomplete } from "utils/types";
|
|
4
4
|
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
@@ -10,7 +10,7 @@ export interface IItemProp {
|
|
|
10
10
|
isEmphasized?: boolean;
|
|
11
11
|
key: React.Key;
|
|
12
12
|
}
|
|
13
|
-
export interface IDropdownProps {
|
|
13
|
+
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
14
|
items: IItemProp[][];
|
|
15
15
|
label: string;
|
|
16
16
|
CustomDropdownTrigger?: React.ReactNode;
|
package/package.json
CHANGED
|
@@ -117,7 +117,7 @@ const Badge: React.FC<IBadgeProps> = ({
|
|
|
117
117
|
className: `${removeButton?.className || ""} group outline-0 `
|
|
118
118
|
}}
|
|
119
119
|
>
|
|
120
|
-
<DynamicIcon {...{ icon: "
|
|
120
|
+
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
121
121
|
</button>
|
|
122
122
|
)}
|
|
123
123
|
</div>
|
|
@@ -27,7 +27,7 @@ export const DangerTrailingIcon: Story = {
|
|
|
27
27
|
...Danger.args,
|
|
28
28
|
icon: {
|
|
29
29
|
...defaultIcon,
|
|
30
|
-
icon: "
|
|
30
|
+
icon: "IconTrash"
|
|
31
31
|
},
|
|
32
32
|
iconPosition: "trailing"
|
|
33
33
|
}
|
|
@@ -41,7 +41,7 @@ export const DangerLeadingIcon: Story = {
|
|
|
41
41
|
export const DangerSimpleIconName: Story = {
|
|
42
42
|
args: {
|
|
43
43
|
...Danger.args,
|
|
44
|
-
icon: "
|
|
44
|
+
icon: "IconTrash",
|
|
45
45
|
iconPosition: "leading"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -33,7 +33,7 @@ export const PrimaryLeadingIcon: Story = {
|
|
|
33
33
|
...Primary.args,
|
|
34
34
|
icon: {
|
|
35
35
|
...defaultIcon,
|
|
36
|
-
icon: "
|
|
36
|
+
icon: "IconCheck",
|
|
37
37
|
outline: false
|
|
38
38
|
},
|
|
39
39
|
iconPosition: "leading"
|
|
@@ -42,7 +42,7 @@ export const PrimaryLeadingIcon: Story = {
|
|
|
42
42
|
export const PrimarySimpleIconName: Story = {
|
|
43
43
|
args: {
|
|
44
44
|
...Primary.args,
|
|
45
|
-
icon: "
|
|
45
|
+
icon: "IconCheck",
|
|
46
46
|
iconPosition: "leading"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -11,13 +11,13 @@ type Story = StoryObj<typeof DynamicIcon>
|
|
|
11
11
|
|
|
12
12
|
export const HeroIconSolid: Story = {
|
|
13
13
|
args: {
|
|
14
|
-
icon: "
|
|
14
|
+
icon: "IconTrash",
|
|
15
15
|
outline: false
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export const HeroIconOutline: Story = {
|
|
19
19
|
args: {
|
|
20
|
-
icon: "
|
|
20
|
+
icon: "IconTrash",
|
|
21
21
|
outline: true
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -29,13 +29,13 @@ export const TablerIconSolid: Story = {
|
|
|
29
29
|
}
|
|
30
30
|
export const TablerIconOutline: Story = {
|
|
31
31
|
args: {
|
|
32
|
-
icon: "
|
|
32
|
+
icon: "IconTrash",
|
|
33
33
|
outline: true
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
export const FAIcon: Story = {
|
|
37
37
|
args: {
|
|
38
|
-
icon: "
|
|
38
|
+
icon: "IconBrandGithub",
|
|
39
39
|
outline: true
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -14,25 +14,33 @@ export type IconName = keyof typeof SolidIcons | keyof typeof OutlineIcons
|
|
|
14
14
|
|
|
15
15
|
export type FAIconName = keyof typeof FA
|
|
16
16
|
|
|
17
|
-
export type UnifiedIconName =
|
|
17
|
+
export type UnifiedIconName = TablerIconName //HACK to eliminate some icons...| IconName | FAIconName
|
|
18
18
|
|
|
19
|
-
export function isHeroIcon(name: UnifiedIconName): name is keyof typeof SolidIcons | keyof typeof OutlineIcons {
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
// export function isHeroIcon(name: UnifiedIconName): name is keyof typeof SolidIcons | keyof typeof OutlineIcons {
|
|
20
|
+
// return name in SolidIcons || name in OutlineIcons
|
|
21
|
+
// }
|
|
22
22
|
|
|
23
23
|
export function isTablerIcon(name: UnifiedIconName): name is TablerIconName {
|
|
24
24
|
return tablerIconNames.includes(name as TablerIconName)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function
|
|
28
|
-
return
|
|
27
|
+
export function isHeroIcon(name: UnifiedIconName) {
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isFAIcon(name: UnifiedIconName) {
|
|
32
|
+
return false
|
|
29
33
|
}
|
|
34
|
+
|
|
35
|
+
// export function isFAIcon(name: UnifiedIconName): name is keyof typeof FA {
|
|
36
|
+
// return name in FA
|
|
37
|
+
// }
|
|
38
|
+
|
|
30
39
|
export function isUnifiedIconName(name: UnifiedIconName): name is UnifiedIconName {
|
|
31
|
-
return isTablerIcon(name) || isFAIcon(name)
|
|
40
|
+
return isTablerIcon(name) // || isHeroIcon(name) || isFAIcon(name)
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
export interface IDynamicIconProps {
|
|
43
|
+
export interface IDynamicIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
36
44
|
icon: UnifiedIconName
|
|
37
45
|
className?: ClassNameWithAutocomplete
|
|
38
46
|
outline?: boolean
|
|
@@ -50,6 +58,8 @@ export const DynamicIcon = ({
|
|
|
50
58
|
return <i {...{ ...props, className: "flex items-center justify-center" }}>{CustomSVG}</i>
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
const iconStr = icon as string
|
|
62
|
+
|
|
53
63
|
if (isTablerIcon(icon)) {
|
|
54
64
|
return (
|
|
55
65
|
<TablerIcon
|
|
@@ -63,29 +73,30 @@ export const DynamicIcon = ({
|
|
|
63
73
|
/>
|
|
64
74
|
)
|
|
65
75
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
//HACK
|
|
77
|
+
// if (isFAIcon(icon)) {
|
|
78
|
+
// const Icon = FA[icon]
|
|
79
|
+
// return (
|
|
80
|
+
// <i {...{ ...props, className: "flex items-center justify-center" }}>
|
|
81
|
+
// <Icon
|
|
82
|
+
// className={cn(className, {
|
|
83
|
+
// "h-5 w-5 text-gray-600": !className
|
|
84
|
+
// })}
|
|
85
|
+
// />
|
|
86
|
+
// </i>
|
|
87
|
+
// )
|
|
88
|
+
// }
|
|
89
|
+
// if (isHeroIcon(icon)) {
|
|
90
|
+
// const Icon = outline ? OutlineIcons[icon] : SolidIcons[icon]
|
|
91
|
+
// return (
|
|
92
|
+
// <i {...{ ...props, className: "flex items-center justify-center" }}>
|
|
93
|
+
// <Icon
|
|
94
|
+
// className={cn(className, {
|
|
95
|
+
// "h-5 w-5 text-gray-600": !className
|
|
96
|
+
// })}
|
|
97
|
+
// />
|
|
98
|
+
// </i>
|
|
99
|
+
// )
|
|
100
|
+
// }
|
|
90
101
|
return <></>
|
|
91
102
|
}
|
|
@@ -11,13 +11,13 @@ type Story = StoryObj<typeof IconWithShadow>
|
|
|
11
11
|
|
|
12
12
|
export const HeroIconSolid: Story = {
|
|
13
13
|
args: {
|
|
14
|
-
icon: "
|
|
14
|
+
icon: "IconCube",
|
|
15
15
|
outline: false
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export const HeroIconOutline: Story = {
|
|
19
19
|
args: {
|
|
20
|
-
icon: "
|
|
20
|
+
icon: "IconCube",
|
|
21
21
|
outline: true
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -35,7 +35,7 @@ export const TablerIconOutline: Story = {
|
|
|
35
35
|
}
|
|
36
36
|
export const FAIcon: Story = {
|
|
37
37
|
args: {
|
|
38
|
-
icon: "
|
|
38
|
+
icon: "IconBrandGithub",
|
|
39
39
|
outline: true
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -44,151 +44,142 @@ function classNames(...classes: string[]) {
|
|
|
44
44
|
return classes.filter(Boolean).join(" ")
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
const Combobox = <T extends Record<string, unknown>>({
|
|
48
|
+
label,
|
|
49
|
+
items,
|
|
50
|
+
displayProperty,
|
|
51
|
+
displayValue,
|
|
52
|
+
keyProperty,
|
|
53
|
+
onChange,
|
|
54
|
+
placeholder,
|
|
55
|
+
message,
|
|
56
|
+
isDisabled,
|
|
57
|
+
isError,
|
|
58
|
+
isRequired,
|
|
59
|
+
id,
|
|
60
|
+
nullable
|
|
61
|
+
}: IComboboxProps<T>) => {
|
|
62
|
+
const [query, setQuery] = useState<string>("")
|
|
63
|
+
const [selectedItem, setSelectedItem] = useState<T | undefined>()
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
65
|
+
const onChangeValue = (value: T | undefined) => {
|
|
66
|
+
if (value && selectedItem && value[keyProperty] === selectedItem[keyProperty]) {
|
|
67
|
+
setSelectedItem(undefined)
|
|
68
|
+
} else {
|
|
69
|
+
setSelectedItem(value)
|
|
71
70
|
}
|
|
71
|
+
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (displayValue) {
|
|
75
|
+
const dv = items.find((i) => i[displayProperty] === displayValue)
|
|
76
|
+
setSelectedItem(dv)
|
|
77
|
+
}
|
|
78
|
+
}, [displayValue])
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
typeof onChange === "function" && onChange(selectedItem)
|
|
82
|
+
}, [selectedItem])
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
84
|
+
const filteredItems =
|
|
85
|
+
query === ""
|
|
86
|
+
? items
|
|
87
|
+
: items.filter((item) => {
|
|
88
|
+
return `${item[displayProperty]}`.toLowerCase().includes(query.toLowerCase())
|
|
89
|
+
})
|
|
90
|
+
const labelStyles = cn("block text-sm font-medium text-gray-700")
|
|
91
|
+
const buttonStyles = cn("absolute inset-y-0 right-0 flex items-center rounded-r px-2 focus:outline-none")
|
|
92
|
+
const optionStyles = cn(
|
|
93
|
+
"absolute z-30 mt-1 max-h-60 w-full overflow-auto rounded bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"
|
|
94
|
+
)
|
|
95
|
+
return (
|
|
96
|
+
<HeadlessUICombobox
|
|
97
|
+
as="div"
|
|
98
|
+
value={selectedItem}
|
|
99
|
+
onChange={(e: T | undefined) => onChangeValue(e)}
|
|
100
|
+
disabled={isDisabled}
|
|
101
|
+
nullable={nullable ? undefined : false}
|
|
102
|
+
>
|
|
103
|
+
{label && (
|
|
104
|
+
<HeadlessUICombobox.Label className={labelStyles}>
|
|
105
|
+
<InputLabel
|
|
106
|
+
isPlaceholder
|
|
107
|
+
isActive
|
|
108
|
+
label={label}
|
|
109
|
+
isRequired={isRequired}
|
|
110
|
+
id={id}
|
|
111
|
+
isError={isError}
|
|
112
|
+
isDisabled={isDisabled}
|
|
113
|
+
/>
|
|
114
|
+
</HeadlessUICombobox.Label>
|
|
115
|
+
)}
|
|
116
|
+
<div className="relative">
|
|
116
117
|
<div className="relative">
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
<HeadlessUICombobox.Input
|
|
119
|
+
className={`w-full rounded border border-gray-300 focus:border-purple-500 focus:outline-none focus:ring-1 focus:ring-purple-500 sm:text-sm ${
|
|
120
|
+
isError ? "border-red-500" : ""
|
|
121
|
+
}`}
|
|
122
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
123
|
+
displayValue={(item: Record<string, unknown>) => `${item ? item[displayProperty] : ""}`}
|
|
124
|
+
placeholder={placeholder}
|
|
125
|
+
/>
|
|
126
|
+
{selectedItem && nullable && (
|
|
127
|
+
<button
|
|
128
|
+
className="absolute right-8 top-[1px] h-9 w-5 text-gray-400 hover:text-gray-500"
|
|
129
|
+
onClick={() => setSelectedItem(undefined)}
|
|
130
|
+
>
|
|
131
|
+
<DynamicIcon icon="IconX" className="h-4 w-4 " aria-hidden="true" />
|
|
132
|
+
</button>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
<HeadlessUICombobox.Button className={buttonStyles}>
|
|
136
|
+
<DynamicIcon icon="IconSelector" className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
|
137
|
+
</HeadlessUICombobox.Button>
|
|
138
|
+
|
|
139
|
+
{filteredItems.length > 0 && (
|
|
140
|
+
<HeadlessUICombobox.Options className={optionStyles}>
|
|
141
|
+
{filteredItems.map((item, index) => (
|
|
142
|
+
<HeadlessUICombobox.Option
|
|
143
|
+
key={`${item[keyProperty]}-${index}`}
|
|
144
|
+
value={item}
|
|
145
|
+
className={({ active }) =>
|
|
146
|
+
classNames(
|
|
147
|
+
"relative cursor-default select-none py-2 pl-3 pr-9",
|
|
148
|
+
active ? "bg-purple-600 text-white" : "text-gray-900"
|
|
149
|
+
)
|
|
150
|
+
}
|
|
130
151
|
>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<DynamicIcon icon="SelectorIcon" className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
|
137
|
-
</HeadlessUICombobox.Button>
|
|
152
|
+
{({ active, selected }) => (
|
|
153
|
+
<>
|
|
154
|
+
<span className={classNames("block truncate", selected ? "font-semibold" : "")}>
|
|
155
|
+
{`${item[displayProperty]}`}
|
|
156
|
+
</span>
|
|
138
157
|
|
|
139
|
-
|
|
140
|
-
<HeadlessUICombobox.Options className={optionStyles}>
|
|
141
|
-
{filteredItems.map((item, index) => (
|
|
142
|
-
<HeadlessUICombobox.Option
|
|
143
|
-
key={`${item[keyProperty]}-${index}`}
|
|
144
|
-
value={item}
|
|
145
|
-
className={({ active }) =>
|
|
146
|
-
classNames(
|
|
147
|
-
"relative cursor-default select-none py-2 pl-3 pr-9",
|
|
148
|
-
active ? "bg-purple-600 text-white" : "text-gray-900"
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
>
|
|
152
|
-
{({ active, selected }) => (
|
|
153
|
-
<>
|
|
158
|
+
{selected && (
|
|
154
159
|
<span
|
|
155
160
|
className={classNames(
|
|
156
|
-
"
|
|
157
|
-
|
|
161
|
+
"absolute inset-y-0 right-0 flex items-center pr-4",
|
|
162
|
+
active ? "text-white" : "text-purple-600"
|
|
158
163
|
)}
|
|
159
164
|
>
|
|
160
|
-
|
|
165
|
+
<DynamicIcon icon="IconCheck" className="h-5 w-5" aria-hidden="true" />
|
|
161
166
|
</span>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
</HeadlessUICombobox.Options>
|
|
182
|
-
)}
|
|
183
|
-
</div>
|
|
184
|
-
<div className="grow">
|
|
185
|
-
{message && (
|
|
186
|
-
<span className={`mt-1 block text-sm ${isError ? `text-red-500` : `text-gray-500`}`}>
|
|
187
|
-
{message}
|
|
188
|
-
</span>
|
|
189
|
-
)}
|
|
190
|
-
</div>
|
|
191
|
-
</HeadlessUICombobox>
|
|
192
|
-
)
|
|
193
|
-
}
|
|
194
|
-
export default Combobox
|
|
167
|
+
)}
|
|
168
|
+
</>
|
|
169
|
+
)}
|
|
170
|
+
</HeadlessUICombobox.Option>
|
|
171
|
+
))}
|
|
172
|
+
</HeadlessUICombobox.Options>
|
|
173
|
+
)}
|
|
174
|
+
</div>
|
|
175
|
+
<div className="grow">
|
|
176
|
+
{message && (
|
|
177
|
+
<span className={`mt-1 block text-sm ${isError ? `text-red-500` : `text-gray-500`}`}>
|
|
178
|
+
{message}
|
|
179
|
+
</span>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
</HeadlessUICombobox>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
export default Combobox
|
|
@@ -12,13 +12,14 @@ const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
12
12
|
[
|
|
13
13
|
{
|
|
14
14
|
icon: {
|
|
15
|
-
icon: "
|
|
15
|
+
icon: "IconCopy"
|
|
16
16
|
|
|
17
17
|
// className: "h-5 w-5",
|
|
18
18
|
// outline: false
|
|
19
19
|
},
|
|
20
|
+
iconPosition: "leading",
|
|
20
21
|
key: "Copy",
|
|
21
|
-
label: "Copy",
|
|
22
|
+
label: "Copy The Thing",
|
|
22
23
|
onClick: () => {
|
|
23
24
|
console.log("Copy action")
|
|
24
25
|
}
|
|
@@ -45,7 +46,7 @@ const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
45
46
|
className: "h-5 w-5",
|
|
46
47
|
outline: false
|
|
47
48
|
},
|
|
48
|
-
iconPosition: "
|
|
49
|
+
iconPosition: "leading",
|
|
49
50
|
key: "View Batch",
|
|
50
51
|
label: "View Batch",
|
|
51
52
|
onClick: () => {
|
|
@@ -16,7 +16,6 @@ export interface IButtonDropdownProps {
|
|
|
16
16
|
* Primary UI component for user interaction
|
|
17
17
|
*/
|
|
18
18
|
const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement, offsetOptions }) => {
|
|
19
|
-
|
|
20
19
|
return (
|
|
21
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]">
|
|
22
21
|
<Button
|
|
@@ -42,7 +41,7 @@ const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement,
|
|
|
42
41
|
CustomDropdownTrigger: (
|
|
43
42
|
<DynamicIcon
|
|
44
43
|
{...{
|
|
45
|
-
icon: "
|
|
44
|
+
icon: "IconChevronDown",
|
|
46
45
|
className: cn("h-5 w-5", {
|
|
47
46
|
"text-white": button.actionType === "primary",
|
|
48
47
|
"text-purple-700": button.actionType === "secondary",
|
|
@@ -13,7 +13,7 @@ const meta: Meta<typeof Dropdown> = {
|
|
|
13
13
|
type Story = StoryObj<typeof Dropdown>
|
|
14
14
|
|
|
15
15
|
const IconElement = () => (
|
|
16
|
-
<DynamicIcon className="h-5 w-5 text-gray-400 hover:text-gray-600" icon={"
|
|
16
|
+
<DynamicIcon className="h-5 w-5 text-gray-400 hover:text-gray-600" icon={"IconDotsVertical"} />
|
|
17
17
|
)
|
|
18
18
|
const defaultArgs: Story["args"] = {
|
|
19
19
|
items: [...dropdownDataBase],
|
|
@@ -29,8 +29,7 @@ export interface IItemProp {
|
|
|
29
29
|
key: React.Key
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export interface IDropdownProps {
|
|
33
|
-
//this doesn't need to extend div... extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
34
33
|
items: IItemProp[][]
|
|
35
34
|
label: string
|
|
36
35
|
CustomDropdownTrigger?: React.ReactNode
|
|
@@ -141,7 +140,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
141
140
|
<>
|
|
142
141
|
<span className="pl-1">{label}</span>
|
|
143
142
|
<DynamicIcon
|
|
144
|
-
icon="
|
|
143
|
+
icon="IconChevronDown"
|
|
145
144
|
className={cn(defaultClassNames.iconClassname, iconClassname)}
|
|
146
145
|
/>
|
|
147
146
|
</>
|
|
@@ -10,7 +10,7 @@ export const dropdownDataBase: IItemProp[][] = [
|
|
|
10
10
|
// outline: false
|
|
11
11
|
},
|
|
12
12
|
key: "Copy",
|
|
13
|
-
label: "Copy",
|
|
13
|
+
label: "Copy to Clipboard",
|
|
14
14
|
onClick: () => {
|
|
15
15
|
console.log("Copy action")
|
|
16
16
|
}
|
|
@@ -66,13 +66,13 @@ export const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
66
66
|
[
|
|
67
67
|
{
|
|
68
68
|
icon: {
|
|
69
|
-
icon: "
|
|
69
|
+
icon: "IconCopy",
|
|
70
70
|
className: "h-5 w-5",
|
|
71
71
|
outline: false
|
|
72
72
|
},
|
|
73
73
|
iconPosition: "leading",
|
|
74
74
|
key: "Copy",
|
|
75
|
-
label: "Copy",
|
|
75
|
+
label: "Copy Item",
|
|
76
76
|
onClick: () => {
|
|
77
77
|
console.log("Copy action")
|
|
78
78
|
}
|