@agility/plenum-ui 2.0.0-rc2 → 2.0.0-rc21

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.
Files changed (99) hide show
  1. package/README.md +41 -11
  2. package/build.js +30 -25
  3. package/dist/index.d.ts +279 -93
  4. package/dist/index.js +1 -5935
  5. package/dist/index.js.map +4 -4
  6. package/dist/tailwind.css +63516 -0
  7. package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
  8. package/dist/types/stories/atoms/buttons/Button/Button.d.ts +7 -9
  9. package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
  10. package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
  11. package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
  12. package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +1 -1
  13. package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +1 -1
  14. package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
  15. package/dist/types/stories/index.d.ts +4 -4
  16. package/dist/types/stories/molecules/index.d.ts +3 -3
  17. package/dist/types/stories/molecules/inputs/InputCounter/InputCounter.d.ts +10 -0
  18. package/dist/types/stories/molecules/inputs/InputCounter/index.d.ts +2 -0
  19. package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +8 -4
  20. package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +39 -0
  21. package/dist/types/stories/molecules/inputs/TextInput/index.d.ts +4 -0
  22. package/dist/types/stories/molecules/inputs/index.d.ts +5 -4
  23. package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -2
  24. package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +34 -21
  25. package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +4 -4
  26. package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -3
  27. package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +9 -7
  28. package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +3 -5
  29. package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
  30. package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
  31. package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
  32. package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +18 -15
  33. package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
  34. package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
  35. package/dist/types/stories/organisms/TextInputSelect/InputSelect.d.ts +16 -0
  36. package/dist/types/stories/organisms/TextInputSelect/TextInputSelect.d.ts +48 -0
  37. package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
  38. package/dist/types/stories/organisms/index.d.ts +5 -3
  39. package/local.sh +100 -0
  40. package/package.json +35 -18
  41. package/rollup.config.mjs +42 -0
  42. package/stories/Introduction.mdx +1 -1
  43. package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +7 -0
  44. package/stories/atoms/buttons/Button/Button.tsx +45 -17
  45. package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +7 -0
  46. package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +7 -0
  47. package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +7 -0
  48. package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
  49. package/stories/atoms/icons/DynamicIcon.tsx +3 -2
  50. package/stories/atoms/icons/TablerIcon.tsx +1 -1
  51. package/stories/atoms/loaders/Loader.tsx +12 -6
  52. package/stories/index.ts +22 -10
  53. package/stories/molecules/index.ts +22 -6
  54. package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
  55. package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
  56. package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
  57. package/stories/molecules/inputs/InputField/InputField.tsx +13 -7
  58. package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
  59. package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -0
  60. package/stories/molecules/inputs/TextInput/index.tsx +5 -0
  61. package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -1
  62. package/stories/molecules/inputs/index.ts +18 -4
  63. package/stories/molecules/inputs/select/Select.tsx +1 -1
  64. package/stories/molecules/inputs/textArea/TextArea.stories.ts +7 -5
  65. package/stories/molecules/inputs/textArea/TextArea.tsx +139 -48
  66. package/stories/molecules/inputs/textArea/index.ts +3 -3
  67. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +61 -57
  68. package/stories/molecules/tabs/index.tsx +2 -3
  69. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
  70. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +43 -37
  71. package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
  72. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
  73. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
  74. package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
  75. package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +59 -58
  76. package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +13 -16
  77. package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +1 -1
  78. package/stories/organisms/DropdownComponent/DropdownComponent.tsx +155 -131
  79. package/stories/organisms/DropdownComponent/dropdownItems.ts +32 -8
  80. package/stories/organisms/DropdownComponent/index.ts +2 -2
  81. package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
  82. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
  83. package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
  84. package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
  85. package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
  86. package/stories/organisms/TextInputSelect/index.tsx +3 -0
  87. package/stories/organisms/index.ts +15 -4
  88. package/tsconfig.lib.json +13 -6
  89. package/watch.js +50 -0
  90. package/.yarnrc.yml +0 -1
  91. package/dist/types/stories/layouts/index.d.ts +0 -0
  92. package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
  93. package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
  94. package/stories/layouts/CardLayout/index.tsx +0 -3
  95. package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
  96. package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
  97. package/stories/layouts/ModalLayout/index.tsx +0 -3
  98. package/stories/layouts/index.ts +0 -0
  99. package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
@@ -2,74 +2,78 @@ import React, { useEffect, useState } from "react"
2
2
  import { default as cn } from "classnames"
3
3
  import { Switch } from "@headlessui/react"
4
4
  import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms"
5
+
6
+ interface ToggleSwitchLabel {
7
+ text: string | JSX.Element
8
+ className?: string
9
+ xPosition?: "left" | "right"
10
+ }
11
+
5
12
  export interface IToggleSwitchProps {
6
13
  isChecked: boolean
7
14
  onChange: (isChecked: boolean) => void
8
- label?: {
9
- text: string | JSX.Element
10
- className?: string
11
- xPosition?: "left" | "right"
12
- }
13
- screenReaderLabel: string
15
+ label?: ToggleSwitchLabel
16
+ screenReaderLabel?: string
14
17
  name: string
15
18
  id: string
16
- variant: "base" | "short"
19
+ variant?: "base" | "short"
17
20
  withIcon?: IDynamicIconProps
21
+ disabled?: boolean
18
22
  }
19
23
 
20
24
  const ToggleSwitch: React.FC<IToggleSwitchProps> = ({
21
- isChecked,
22
- onChange,
23
- label,
24
- screenReaderLabel,
25
- name,
26
- id,
27
- variant = "base",
28
- withIcon,
25
+ isChecked,
26
+ onChange,
27
+ label,
28
+ screenReaderLabel,
29
+ name,
30
+ id,
31
+ variant = "base",
32
+ withIcon,
33
+ disabled
29
34
  }) => {
30
- const [checked, setChecked] = useState<boolean>(isChecked)
31
- useEffect(() => setChecked(isChecked), [isChecked])
35
+ const [checked, setChecked] = useState<boolean>(isChecked)
36
+ useEffect(() => setChecked(isChecked), [isChecked])
32
37
 
33
- return (
34
- <Switch.Group as={"div"} className={"flex items-center gap-2"}>
35
- {label && label.xPosition === "left" && (
36
- <Switch.Label className={label.className}>{label.text}</Switch.Label>
37
- )}
38
- <Switch
39
- name={name}
40
- id={id}
41
- checked={checked}
42
- onChange={(v: boolean) => {
43
- onChange(v)
44
- setChecked(v)
45
- }}
46
- className={cn(
47
- { "w-9 h-4": variant === "short", " h-6 w-11": variant === "base" },
48
- checked ? "bg-purple-600" : "bg-gray-200",
49
- "relative inline-flex items-center rounded-full focus-visible:ring-2 focus-visible:ring-purple-600 focus-visible:ring-offset-2 focus-within:ring-2 focus-within:ring-purple-600 focus-within:ring-offset-2 focus:ring-2 focus:ring-purple-600 focus:ring-offset-2 active:ring-2 active:ring-purple-600 active:ring-offset-2"
50
- )}
51
- >
52
- <span className="sr-only">{screenReaderLabel}</span>
53
- <span
54
- className={cn(
55
- checked ? "translate-x-[22px]" : "translate-x-[2px]",
56
- {
57
- "border border-gray-200 translate-x-0": variant === "short",
58
- "!translate-x-[22px]": checked && variant === "short",
59
- },
60
- " h-5 w-5 transform rounded-full bg-white transition shadow-sm drop-shadow flex items-center justify-center"
61
- )}
62
- >
63
- {withIcon && (
64
- <DynamicIcon {...withIcon} className={"text-gray-400 m-[2px]"} />
65
- )}
66
- </span>
67
- </Switch>
68
- {label && label.xPosition === "right" && (
69
- <Switch.Label className={label.className}>{label.text}</Switch.Label>
70
- )}
71
- </Switch.Group>
72
- )
38
+ return (
39
+ <Switch.Group as={"div"} className={"flex items-center gap-2"}>
40
+ {label && (label.xPosition === "left" || !label?.xPosition) && (
41
+ <Switch.Label className={label.className}>{label.text}</Switch.Label>
42
+ )}
43
+ <Switch
44
+ name={name}
45
+ id={id}
46
+ checked={checked}
47
+ onChange={(v: boolean) => {
48
+ onChange(v)
49
+ setChecked(v)
50
+ }}
51
+ className={cn(
52
+ { "w-9 h-4 transition-all": variant === "short", " h-6 w-11": variant === "base" },
53
+ checked && disabled ? "bg-purple-200" : checked ? "bg-purple-600" : "bg-gray-200",
54
+ "relative inline-flex items-center rounded-full focus-visible:ring-2 focus-visible:ring-purple-600 focus-visible:ring-offset-2 focus-within:ring-2 focus-within:ring-purple-600 focus-within:ring-offset-2 focus:ring-2 focus:ring-purple-600 focus:ring-offset-2 active:ring-2 active:ring-purple-600 active:ring-offset-2"
55
+ )}
56
+ disabled={disabled}
57
+ >
58
+ {screenReaderLabel && <span className="sr-only">{screenReaderLabel}</span>}
59
+ <span
60
+ className={cn(
61
+ checked ? "translate-x-[22px]" : "translate-x-[2px]",
62
+ {
63
+ "border border-gray-200 translate-x-0": variant === "short",
64
+ "!translate-x-[22px]": checked && variant === "short"
65
+ },
66
+ " h-5 w-5 transform rounded-full bg-white transition shadow-sm drop-shadow flex items-center justify-center"
67
+ )}
68
+ >
69
+ {withIcon && <DynamicIcon {...withIcon} className={"text-gray-400 m-[2px]"} />}
70
+ </span>
71
+ </Switch>
72
+ {label && label.xPosition === "right" && (
73
+ <Switch.Label className={label.className}>{label.text}</Switch.Label>
74
+ )}
75
+ </Switch.Group>
76
+ )
73
77
  }
74
78
 
75
79
  export default ToggleSwitch
@@ -1,3 +1,2 @@
1
-
2
- export { default } from './Tabs';
3
- export * from './Tabs';
1
+ export * from "./Tabs"
2
+ export { default } from "./Tabs"
@@ -11,11 +11,20 @@ const meta: Meta<typeof AnimatedLabelInput> = {
11
11
  export default meta
12
12
  type Story = StoryObj<typeof AnimatedLabelInput>
13
13
  export const DefaultAnimatedLabelInputsStory: Story = {
14
+ args: {
15
+ id: "test",
16
+ label: {
17
+ display: "Label"
18
+ }
19
+ } as IAnimatedLabelInputProps
20
+ }
21
+
22
+ export const DefaultAnimatedLabelInputsStoryWithPlaceHolder: Story = {
14
23
  args: {
15
24
  id: "test",
16
25
  label: {
17
26
  display: "Label"
18
27
  },
19
- input: {}
28
+ placeholder: "Placeholder"
20
29
  } as IAnimatedLabelInputProps
21
30
  }
@@ -1,59 +1,65 @@
1
1
  import React from "react"
2
2
  import { default as cn } from "classnames"
3
3
  import InputField, { IInputFieldProps } from "@/stories/molecules/inputs/InputField"
4
- import TextAreaField, { ITextAreaFieldProps } from "@/stories/molecules/inputs/textArea/TextArea"
5
4
 
6
- interface ILabelProps extends React.ComponentPropsWithoutRef<"label"> {
5
+ interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
7
6
  display: string
8
7
  }
9
8
 
10
- export interface IAnimatedLabelInputProps {
9
+ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handleChange"> {
11
10
  id: string
12
11
  containerStyles?: string
13
12
  message?: string
14
- input?: IInputFieldProps
15
- textarea?: ITextAreaFieldProps
16
13
  required?: boolean
17
14
  isError?: boolean
18
15
  label: ILabelProps
16
+ handleChange: (value: string) => void
19
17
  }
20
18
 
21
- const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = ({
22
- id,
23
- label,
24
- input,
25
- message,
26
- textarea,
27
- required,
28
- isError,
29
- containerStyles
30
- }) => {
19
+ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
20
+ const { id, containerStyles, message, required, isError, label, value, handleChange, ...input } = props
21
+
22
+ const [hasValue, setHasValue] = React.useState<boolean>(!!value)
23
+
31
24
  return (
32
- <div className={cn("group relative", containerStyles ? containerStyles : "")}>
33
- {input && <InputField isError={isError} {...input} />}
34
- {textarea && <TextAreaField isError={isError} {...textarea} />}
35
- <label
36
- className={cn(
37
- "absolute left-1 z-10 ml-[.172rem] inline-block bg-white px-1 text-xs transition-all peer-placeholder-shown:top-2 peer-placeholder-shown:text-sm peer-placeholder-shown:text-gray-600",
38
- "-top-[9px] group-focus-within:!-top-[12px] group-focus-within:!left-1 group-focus-within:!ml-[.172rem] group-focus-within:!text-xs",
39
- isError && "!text-red-600"
40
- )}
41
- htmlFor={id}
42
- >
43
- {label.display}
44
- {required && <span className="text-red-600">*</span>}
45
- </label>
46
-
47
- <div className="flex flex-row space-x-3">
48
- <div className="grow transition-all">
49
- {message && (
50
- <span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
51
- {message}
52
- </span>
25
+ <>
26
+ <div className={cn("group relative", containerStyles ? containerStyles : "")}>
27
+ <InputField
28
+ id={id}
29
+ isError={isError}
30
+ value={value}
31
+ handleChange={(v) => {
32
+ setHasValue(!!v)
33
+ if (handleChange) handleChange(v)
34
+ }}
35
+ {...input}
36
+ />
37
+ <label
38
+ className={cn(
39
+ "absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
40
+ hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
41
+ "peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
42
+ "group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
43
+
44
+ isError && "!text-red-600"
53
45
  )}
46
+ htmlFor={id}
47
+ >
48
+ {label.display}
49
+ {required && <span className="text-red-600 ml-1">*</span>}
50
+ </label>
51
+
52
+ <div className="flex flex-row space-x-3">
53
+ <div className="grow transition-all">
54
+ {message && (
55
+ <span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
56
+ {message}
57
+ </span>
58
+ )}
59
+ </div>
54
60
  </div>
55
61
  </div>
56
- </div>
62
+ </>
57
63
  )
58
64
  }
59
65
 
@@ -1,3 +1,3 @@
1
1
  import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
2
- export default AnimatedLabelInput
3
2
  export type { IAnimatedLabelInputProps }
3
+ export default AnimatedLabelInput
@@ -0,0 +1,26 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
3
+
4
+ const meta: Meta<typeof AnimatedLabelTextArea> = {
5
+ title: "Design System/organisms/Animated Label Text Area",
6
+ component: AnimatedLabelTextArea,
7
+ tags: ["autodocs"],
8
+ argTypes: {}
9
+ }
10
+
11
+ export default meta
12
+ type Story = StoryObj<typeof AnimatedLabelTextArea>
13
+ export const DefaultAnimatedLabelTextAreasStory: Story = {
14
+ args: {
15
+ id: "test",
16
+ label: "Label"
17
+ } as IAnimatedLabelTextAreaProps
18
+ }
19
+
20
+ export const DefaultAnimatedLabelTextAreasStoryWithPlaceholder: Story = {
21
+ args: {
22
+ id: "test",
23
+ label: "Label",
24
+ placeholder: "Placeholder"
25
+ } as IAnimatedLabelTextAreaProps
26
+ }
@@ -0,0 +1,61 @@
1
+ import React from "react"
2
+ import { default as cn } from "classnames"
3
+
4
+ import TextArea, { ITextareaProps } from "@/stories/molecules/inputs/textArea"
5
+
6
+ export interface IAnimatedLabelTextAreaProps extends ITextareaProps {
7
+ id: string
8
+ containerStyles?: string
9
+ message?: string
10
+ required?: boolean
11
+ isError?: boolean
12
+ handleChange: (value: string) => void
13
+ }
14
+
15
+ const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps> = (props: IAnimatedLabelTextAreaProps) => {
16
+ const { id, containerStyles, message, required, isError, label, value, handleChange, onChange, ...input } = props
17
+
18
+ const [hasValue, setHasValue] = React.useState<boolean>(!!value)
19
+
20
+ return (
21
+ <div className={cn("group relative", containerStyles ? containerStyles : "")}>
22
+ <TextArea
23
+ id={id}
24
+ isError={isError}
25
+ value={value}
26
+ {...input}
27
+ onChange={(v) => {
28
+ setHasValue(!!v)
29
+ if (handleChange) handleChange(v)
30
+ }}
31
+ label={undefined}
32
+ />
33
+ <label
34
+ className={cn(
35
+ "absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
36
+ hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
37
+ "peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
38
+ "group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
39
+
40
+ isError && "!text-red-600"
41
+ )}
42
+ htmlFor={label?.htmlFor || id}
43
+ >
44
+ {label?.display}
45
+ {required && <span className="text-red-600 ml-1">*</span>}
46
+ </label>
47
+
48
+ <div className="flex flex-row space-x-3">
49
+ <div className="grow transition-all">
50
+ {message && (
51
+ <span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
52
+ {message}
53
+ </span>
54
+ )}
55
+ </div>
56
+ </div>
57
+ </div>
58
+ )
59
+ }
60
+
61
+ export default AnimatedLabelTextArea
@@ -0,0 +1,3 @@
1
+ import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
2
+ export type { IAnimatedLabelTextAreaProps }
3
+ export default AnimatedLabelTextArea
@@ -2,74 +2,75 @@ import type { Meta, StoryObj } from "@storybook/react"
2
2
  import ButtonDropdown from "."
3
3
  import { IItemProp } from "../DropdownComponent"
4
4
 
5
-
6
5
  const meta: Meta<typeof ButtonDropdown> = {
7
6
  title: "Design System/Organisms/Button Dropdown",
8
7
  component: ButtonDropdown,
9
8
  tags: ["autodocs"],
10
9
  argTypes: {}
11
10
  }
12
- const dropdownDataWithIcons: IItemProp[][] = [
13
- [
14
- {
15
- icon: {
16
- name: "IconClipboardCopy",
17
- pos: "leading",
18
- className: "h-5 w-5",
19
- outline: false
20
- },
21
- key: "Copy",
22
- label: "Copy",
23
- onClick: () => {
24
- console.log("Copy action")
25
- }
11
+ const dropdownDataWithIcons: IItemProp[][] = [
12
+ [
13
+ {
14
+ icon: {
15
+ icon: "IconClipboardCopy"
16
+
17
+ // className: "h-5 w-5",
18
+ // outline: false
19
+ },
20
+ key: "Copy",
21
+ label: "Copy",
22
+ onClick: () => {
23
+ console.log("Copy action")
26
24
  }
27
- ],
28
- [
29
- {
30
- icon: {
31
- name: "IconFolderPlus",
32
- pos: "leading",
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
- }
25
+ }
26
+ ],
27
+ [
28
+ {
29
+ icon: {
30
+ icon: "IconFolderPlus"
31
+ // name: "IconFolderPlus",
32
+ // className: "h-5 w-5",
33
+ // outline: false
41
34
  },
42
- {
43
- icon: {
44
- name: "IconEye",
45
- pos: "leading",
46
- className: "h-5 w-5",
47
- outline: false
48
- },
49
- key: "View Batch",
50
- label: "View Batch",
51
- onClick: () => {
52
- console.log("View Batch action")
53
- }
35
+ key: "Add to Batch",
36
+ label: "Add to Batch",
37
+ onClick: () => {
38
+ console.log("Add to Batch action")
54
39
  }
55
- ],
56
- [
57
- {
58
- icon: {
59
- name: "IconTrash",
60
- pos: "leading",
61
- className: "h-5 w-5",
62
- outline: false
63
- },
64
- key: "Delete",
65
- label: "Delete",
66
- onClick: () => {
67
- console.log("Delete action")
68
- },
69
- isEmphasized: true
40
+ },
41
+ {
42
+ icon: {
43
+ icon: "IconEye",
44
+ //pos: "leading",
45
+ className: "h-5 w-5",
46
+ outline: false
47
+ },
48
+ iconPosition: "trailing",
49
+ key: "View Batch",
50
+ label: "View Batch",
51
+ onClick: () => {
52
+ console.log("View Batch action")
70
53
  }
71
- ]
72
- ]
54
+ }
55
+ ],
56
+ [
57
+ {
58
+ icon: {
59
+ icon: "IconTrash"
60
+
61
+ // pos: "leading",
62
+ // className: "h-5 w-5",
63
+ // outline: false
64
+ },
65
+ key: "Delete",
66
+ label: "Delete",
67
+ onClick: () => {
68
+ console.log("Delete action")
69
+ },
70
+ isEmphasized: true
71
+ }
72
+ ]
73
+ ]
73
74
 
74
75
  export default meta
75
76
  type Story = StoryObj<typeof ButtonDropdown>
@@ -16,21 +16,7 @@ export interface IButtonDropdownProps {
16
16
  * Primary UI component for user interaction
17
17
  */
18
18
  const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement, offsetOptions }) => {
19
- const dropDownClasses: IDropdownProps["classNames"] = {
20
- ...defaultClassNames,
21
- groupClassname: cn(
22
- "flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
23
- button.actionType === "primary"
24
- ? "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"
25
- : "",
26
- button.actionType === "secondary"
27
- ? "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"
28
- : "",
29
- button.actionType === "alternative"
30
- ? "border-gray-300 bg-white !text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100"
31
- : ""
32
- )
33
- }
19
+
34
20
  return (
35
21
  <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]">
36
22
  <Button
@@ -65,7 +51,18 @@ const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement,
65
51
  }}
66
52
  />
67
53
  ),
68
- classNames: dropDownClasses,
54
+ groupClassname: cn(
55
+ "flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
56
+ button.actionType === "primary"
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
+ : "",
59
+ button.actionType === "secondary"
60
+ ? "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"
61
+ : "",
62
+ button.actionType === "alternative"
63
+ ? "border-gray-300 bg-white !text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100"
64
+ : ""
65
+ ),
69
66
  offsetOptions: offsetOptions ?? {
70
67
  crossAxis: 0,
71
68
  mainAxis: 5, //up/down
@@ -18,7 +18,7 @@ const IconElement = () => (
18
18
  const defaultArgs: Story["args"] = {
19
19
  items: [...dropdownDataBase],
20
20
  label: "Dropdown",
21
- classNames: defaultClassNames,
21
+
22
22
  placement: "bottom-end"
23
23
  }
24
24
  export const WithLabel: Story = {