@agility/plenum-ui 2.0.0-rc2 → 2.0.0-rc4
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 +15 -11
- package/dist/index.js +111 -66
- package/dist/index.js.map +2 -2
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +6 -4
- package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +2 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +3 -7
- package/package.json +2 -2
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Button.tsx +25 -2
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +7 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +6 -1
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
- package/stories/molecules/inputs/TextInput/TextInput.tsx +162 -0
- package/stories/molecules/inputs/TextInput/index.tsx +3 -0
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +111 -80
- package/stories/organisms/DropdownComponent/dropdownItems.ts +8 -8
|
@@ -18,15 +18,11 @@ import {
|
|
|
18
18
|
} from "@floating-ui/react"
|
|
19
19
|
|
|
20
20
|
import { ClassNameWithAutocomplete } from "utils/types"
|
|
21
|
-
import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms/icons"
|
|
21
|
+
import { DynamicIcon, IDynamicIconProps, UnifiedIconName } from "@/stories/atoms/icons"
|
|
22
22
|
|
|
23
23
|
export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
24
|
-
icon?:
|
|
25
|
-
|
|
26
|
-
className?: ClassNameWithAutocomplete
|
|
27
|
-
pos?: "trailing" | "leading"
|
|
28
|
-
outline?: boolean
|
|
29
|
-
}
|
|
24
|
+
icon?: IDynamicIconProps | UnifiedIconName
|
|
25
|
+
iconPosition?: "trailing" | "leading"
|
|
30
26
|
label: string
|
|
31
27
|
onClick?(): void
|
|
32
28
|
isEmphasized?: boolean
|
|
@@ -180,80 +176,115 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
180
176
|
{items.map((itemStack, idx) => {
|
|
181
177
|
return (
|
|
182
178
|
<React.Fragment key={`${idx}-list-${id}`}>
|
|
183
|
-
{itemStack.map(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
179
|
+
{itemStack.map(
|
|
180
|
+
({
|
|
181
|
+
onClick,
|
|
182
|
+
label,
|
|
183
|
+
key,
|
|
184
|
+
isEmphasized,
|
|
185
|
+
icon,
|
|
186
|
+
iconPosition,
|
|
187
|
+
...rest
|
|
188
|
+
}) => {
|
|
189
|
+
const active = activeItem && activeItem === key
|
|
190
|
+
const itemClass = cn(
|
|
191
|
+
itemClassname,
|
|
192
|
+
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
193
|
+
{
|
|
194
|
+
"text-red-500": isEmphasized
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"text-gray-900": !isEmphasized
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"bg-gray-100 text-gray-900": active
|
|
201
|
+
},
|
|
202
|
+
active ? activeItemClassname : "",
|
|
203
|
+
{
|
|
204
|
+
"bg-gray-100 text-red-500 hover:text-red-500":
|
|
205
|
+
active && isEmphasized
|
|
206
|
+
},
|
|
207
|
+
itemClassname
|
|
208
|
+
)
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
210
|
+
return (
|
|
211
|
+
<li key={key}>
|
|
212
|
+
<button
|
|
213
|
+
{...{
|
|
214
|
+
onClick: () => {
|
|
215
|
+
setActiveItem(key)
|
|
216
|
+
onClick && onClick()
|
|
217
|
+
},
|
|
218
|
+
key,
|
|
219
|
+
className: cn(itemClass, "w-full"),
|
|
220
|
+
...rest
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<div className="flex items-center gap-x-4">
|
|
224
|
+
{icon &&
|
|
225
|
+
(iconPosition === "leading" ||
|
|
226
|
+
iconPosition === undefined) &&
|
|
227
|
+
(typeof icon === "string" ? (
|
|
228
|
+
<DynamicIcon
|
|
229
|
+
{...{
|
|
230
|
+
icon: icon,
|
|
231
|
+
className: cn(
|
|
232
|
+
{
|
|
233
|
+
"text-red-500": isEmphasized
|
|
234
|
+
},
|
|
235
|
+
"opacity-60 group"
|
|
236
|
+
)
|
|
237
|
+
}}
|
|
238
|
+
/>
|
|
239
|
+
) : (
|
|
240
|
+
<DynamicIcon
|
|
241
|
+
{...{
|
|
242
|
+
...icon,
|
|
243
|
+
className: cn(
|
|
244
|
+
icon.className,
|
|
245
|
+
{
|
|
246
|
+
"text-red-500": isEmphasized
|
|
247
|
+
},
|
|
248
|
+
"opacity-60 group"
|
|
249
|
+
)
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
))}
|
|
253
|
+
<div className="whitespace-nowrap">{label}</div>
|
|
254
|
+
{icon &&
|
|
255
|
+
iconPosition === "trailing" &&
|
|
256
|
+
(typeof icon === "string" ? (
|
|
257
|
+
<DynamicIcon
|
|
258
|
+
{...{
|
|
259
|
+
icon: icon,
|
|
260
|
+
className: cn(
|
|
261
|
+
{
|
|
262
|
+
"text-red-500": isEmphasized
|
|
263
|
+
},
|
|
264
|
+
"opacity-60 group"
|
|
265
|
+
)
|
|
266
|
+
}}
|
|
267
|
+
/>
|
|
268
|
+
) : (
|
|
269
|
+
<DynamicIcon
|
|
270
|
+
{...{
|
|
271
|
+
...icon,
|
|
272
|
+
className: cn(
|
|
273
|
+
icon.className,
|
|
274
|
+
{
|
|
275
|
+
"text-red-500": isEmphasized
|
|
276
|
+
},
|
|
277
|
+
"opacity-60 group"
|
|
278
|
+
)
|
|
279
|
+
}}
|
|
280
|
+
/>
|
|
281
|
+
))}
|
|
282
|
+
</div>
|
|
283
|
+
</button>
|
|
284
|
+
</li>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
)}
|
|
257
288
|
</React.Fragment>
|
|
258
289
|
)
|
|
259
290
|
})}
|
|
@@ -42,11 +42,11 @@ export const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
42
42
|
[
|
|
43
43
|
{
|
|
44
44
|
icon: {
|
|
45
|
-
|
|
46
|
-
pos: "leading",
|
|
45
|
+
icon: "IconClipboardCopy",
|
|
47
46
|
className: "h-5 w-5",
|
|
48
47
|
outline: false
|
|
49
48
|
},
|
|
49
|
+
iconPosition: "leading",
|
|
50
50
|
key: "Copy",
|
|
51
51
|
label: "Copy",
|
|
52
52
|
onClick: () => {
|
|
@@ -57,11 +57,11 @@ export const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
57
57
|
[
|
|
58
58
|
{
|
|
59
59
|
icon: {
|
|
60
|
-
|
|
61
|
-
pos: "leading",
|
|
60
|
+
icon: "IconFolderPlus",
|
|
62
61
|
className: "h-5 w-5",
|
|
63
62
|
outline: false
|
|
64
63
|
},
|
|
64
|
+
iconPosition: "leading",
|
|
65
65
|
key: "Add to Batch",
|
|
66
66
|
label: "Add to Batch",
|
|
67
67
|
onClick: () => {
|
|
@@ -70,11 +70,11 @@ export const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
icon: {
|
|
73
|
-
|
|
74
|
-
pos: "leading",
|
|
73
|
+
icon: "IconEye",
|
|
75
74
|
className: "h-5 w-5",
|
|
76
75
|
outline: false
|
|
77
76
|
},
|
|
77
|
+
iconPosition: "leading",
|
|
78
78
|
key: "View Batch",
|
|
79
79
|
label: "View Batch",
|
|
80
80
|
onClick: () => {
|
|
@@ -85,11 +85,11 @@ export const dropdownDataWithIcons: IItemProp[][] = [
|
|
|
85
85
|
[
|
|
86
86
|
{
|
|
87
87
|
icon: {
|
|
88
|
-
|
|
89
|
-
pos: "leading",
|
|
88
|
+
icon: "IconTrash",
|
|
90
89
|
className: "h-5 w-5",
|
|
91
90
|
outline: false
|
|
92
91
|
},
|
|
92
|
+
iconPosition: "leading",
|
|
93
93
|
key: "Delete",
|
|
94
94
|
label: "Delete",
|
|
95
95
|
onClick: () => {
|