@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,127 +1,127 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
import { ClassNameWithAutocomplete } from "@/utils/types"
|
|
4
|
-
import { DynamicIcon } from "../icons"
|
|
5
|
-
export interface IBadgeProps {
|
|
6
|
-
/** The content scheme of the badge */
|
|
7
|
-
color: "primary" | "secondary" | "danger" | "warning" | "success" | "info" | "basic" | "pink"
|
|
8
|
-
/** Render with slightly rounded corners or as a pill shape */
|
|
9
|
-
variant: "rounded" | "pill"
|
|
10
|
-
/** The text content of the badge */
|
|
11
|
-
label: string
|
|
12
|
-
/** The size of the badge */
|
|
13
|
-
size?: "sm" | "lg"
|
|
14
|
-
/** Render a loader inside the badge */
|
|
15
|
-
loading?: boolean
|
|
16
|
-
/** Render with a small circle in a darker shade of the color chosen*/
|
|
17
|
-
statusDot?: boolean
|
|
18
|
-
/** Render with a button to remove the badge */
|
|
19
|
-
removeButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
20
|
-
/** Render the badge as a clickable button */
|
|
21
|
-
actionButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
22
|
-
}
|
|
23
|
-
const Badge: React.FC<IBadgeProps> = ({
|
|
24
|
-
color,
|
|
25
|
-
variant,
|
|
26
|
-
label,
|
|
27
|
-
size = "sm",
|
|
28
|
-
loading,
|
|
29
|
-
statusDot,
|
|
30
|
-
removeButton,
|
|
31
|
-
actionButton
|
|
32
|
-
}) => {
|
|
33
|
-
const badgeStyles = cn(
|
|
34
|
-
"text-sm flex items-center font-medium py-[2px] focus:ring-1 focus:ring-purple-600 focus:ring-offset-2 focus:ring-offset-white outline-0",
|
|
35
|
-
{
|
|
36
|
-
"rounded-[3px]": variant === "rounded",
|
|
37
|
-
"rounded-full px-[6px]": variant === "pill",
|
|
38
|
-
"rounded-full": variant === "pill" && size === "lg",
|
|
39
|
-
"px-[6px] text-xs": size === "sm",
|
|
40
|
-
"px-[10px]": size === "lg",
|
|
41
|
-
"pl-[10px]": !statusDot && size === "lg",
|
|
42
|
-
"pl-2": !statusDot && size === "sm",
|
|
43
|
-
"pr-3": !removeButton && size === "lg",
|
|
44
|
-
"pr-[10px]": !removeButton && size === "sm",
|
|
45
|
-
"gap-x-[6px]": statusDot || removeButton || loading,
|
|
46
|
-
"bg-purple-100 text-purple-800 ": color === "primary",
|
|
47
|
-
"bg-violet-100 text-violet-800": color === "secondary",
|
|
48
|
-
"bg-pink-100 text-pink-800": color === "pink",
|
|
49
|
-
"bg-red-100 text-red-800": color === "danger",
|
|
50
|
-
"bg-blue-100 text-blue-800": color === "info",
|
|
51
|
-
"bg-green-100 text-green-800": color === "success",
|
|
52
|
-
"bg-yellow-100 text-yellow-800": color === "warning",
|
|
53
|
-
"bg-gray-100 text-gray-800": color === "basic"
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
const statusDotStyles = cn("rounded-full h-[6px] p-[1px] w-[6px]", {
|
|
57
|
-
"bg-purple-400 text-purple-400": color === "primary",
|
|
58
|
-
"bg-violet-400 text-violet-400": color === "secondary",
|
|
59
|
-
"bg-pink-400 text-pink-400": color === "pink",
|
|
60
|
-
"bg-red-400 text-red-400": color === "danger",
|
|
61
|
-
"bg-blue-400 text-blue-400": color === "info",
|
|
62
|
-
"bg-green-400 text-green-400": color === "success",
|
|
63
|
-
"bg-yellow-400 text-yellow-400": color === "warning",
|
|
64
|
-
"bg-gray-400 text-gray-400": color === "basic"
|
|
65
|
-
})
|
|
66
|
-
const removeButtonStyles: ClassNameWithAutocomplete = cn(
|
|
67
|
-
"h-4 w-4 group-focus-within:ring-1 group-focus-within:ring-purple-600 rounded-full group-focus-within:ring-offset-[1px] group-focus-within:ring-offset-white outline-0",
|
|
68
|
-
{
|
|
69
|
-
"text-purple-400": color === "primary",
|
|
70
|
-
"text-violet-400": color === "secondary",
|
|
71
|
-
"text-pink-400": color === "pink",
|
|
72
|
-
"text-red-400": color === "danger",
|
|
73
|
-
"text-blue-400": color === "info",
|
|
74
|
-
"text-green-400": color === "success",
|
|
75
|
-
"text-yellow-400": color === "warning",
|
|
76
|
-
"text-gray-400": color === "basic"
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
const loaderStyles = cn("h-4 w-4 rounded-full border-2 animate-spin", {
|
|
81
|
-
"border-purple-400 !border-r-purple-200": color === "primary",
|
|
82
|
-
"border-violet-400 !border-r-violet-200": color === "secondary",
|
|
83
|
-
"border-pink-400 !border-r-pink-200": color === "pink",
|
|
84
|
-
"border-red-400 !border-r-red-200": color === "danger",
|
|
85
|
-
"border-blue-400 !border-r-blue-200": color === "info",
|
|
86
|
-
"border-green-400 !border-r-green-200": color === "success",
|
|
87
|
-
"border-yellow-400 !border-r-yellow-200": color === "warning",
|
|
88
|
-
"border-gray-400 !border-r-gray-200": color === "basic"
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
return actionButton ? (
|
|
92
|
-
<button {...{ ...actionButton, className: badgeStyles }}>
|
|
93
|
-
{statusDot && <div className={statusDotStyles} role="status" />}
|
|
94
|
-
{label}
|
|
95
|
-
{removeButton && (
|
|
96
|
-
<button
|
|
97
|
-
{...{
|
|
98
|
-
removeButton,
|
|
99
|
-
"aria-label": `Remove ${label}`,
|
|
100
|
-
className: `${removeButton?.className || ""} group outline-0 `
|
|
101
|
-
}}
|
|
102
|
-
>
|
|
103
|
-
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
104
|
-
</button>
|
|
105
|
-
)}
|
|
106
|
-
</button>
|
|
107
|
-
) : (
|
|
108
|
-
<div className={badgeStyles}>
|
|
109
|
-
{loading && <div className={loaderStyles} role="status" />}
|
|
110
|
-
{!loading && statusDot && <div className={statusDotStyles} role="status" />}
|
|
111
|
-
{label}
|
|
112
|
-
{!loading && removeButton && (
|
|
113
|
-
<button
|
|
114
|
-
{...{
|
|
115
|
-
...removeButton,
|
|
116
|
-
"aria-label": `Remove ${label}`,
|
|
117
|
-
className: `${removeButton?.className || ""} group outline-0 `
|
|
118
|
-
}}
|
|
119
|
-
>
|
|
120
|
-
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
121
|
-
</button>
|
|
122
|
-
)}
|
|
123
|
-
</div>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export default Badge
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import { ClassNameWithAutocomplete } from "@/utils/types"
|
|
4
|
+
import { DynamicIcon } from "../icons"
|
|
5
|
+
export interface IBadgeProps {
|
|
6
|
+
/** The content scheme of the badge */
|
|
7
|
+
color: "primary" | "secondary" | "danger" | "warning" | "success" | "info" | "basic" | "pink"
|
|
8
|
+
/** Render with slightly rounded corners or as a pill shape */
|
|
9
|
+
variant: "rounded" | "pill"
|
|
10
|
+
/** The text content of the badge */
|
|
11
|
+
label: string
|
|
12
|
+
/** The size of the badge */
|
|
13
|
+
size?: "sm" | "lg"
|
|
14
|
+
/** Render a loader inside the badge */
|
|
15
|
+
loading?: boolean
|
|
16
|
+
/** Render with a small circle in a darker shade of the color chosen*/
|
|
17
|
+
statusDot?: boolean
|
|
18
|
+
/** Render with a button to remove the badge */
|
|
19
|
+
removeButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
20
|
+
/** Render the badge as a clickable button */
|
|
21
|
+
actionButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
22
|
+
}
|
|
23
|
+
const Badge: React.FC<IBadgeProps> = ({
|
|
24
|
+
color,
|
|
25
|
+
variant,
|
|
26
|
+
label,
|
|
27
|
+
size = "sm",
|
|
28
|
+
loading,
|
|
29
|
+
statusDot,
|
|
30
|
+
removeButton,
|
|
31
|
+
actionButton
|
|
32
|
+
}) => {
|
|
33
|
+
const badgeStyles = cn(
|
|
34
|
+
"text-sm flex items-center font-medium py-[2px] focus:ring-1 focus:ring-purple-600 focus:ring-offset-2 focus:ring-offset-white outline-0",
|
|
35
|
+
{
|
|
36
|
+
"rounded-[3px]": variant === "rounded",
|
|
37
|
+
"rounded-full px-[6px]": variant === "pill",
|
|
38
|
+
"rounded-full": variant === "pill" && size === "lg",
|
|
39
|
+
"px-[6px] text-xs": size === "sm",
|
|
40
|
+
"px-[10px]": size === "lg",
|
|
41
|
+
"pl-[10px]": !statusDot && size === "lg",
|
|
42
|
+
"pl-2": !statusDot && size === "sm",
|
|
43
|
+
"pr-3": !removeButton && size === "lg",
|
|
44
|
+
"pr-[10px]": !removeButton && size === "sm",
|
|
45
|
+
"gap-x-[6px]": statusDot || removeButton || loading,
|
|
46
|
+
"bg-purple-100 text-purple-800 ": color === "primary",
|
|
47
|
+
"bg-violet-100 text-violet-800": color === "secondary",
|
|
48
|
+
"bg-pink-100 text-pink-800": color === "pink",
|
|
49
|
+
"bg-red-100 text-red-800": color === "danger",
|
|
50
|
+
"bg-blue-100 text-blue-800": color === "info",
|
|
51
|
+
"bg-green-100 text-green-800": color === "success",
|
|
52
|
+
"bg-yellow-100 text-yellow-800": color === "warning",
|
|
53
|
+
"bg-gray-100 text-gray-800": color === "basic"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
const statusDotStyles = cn("rounded-full h-[6px] p-[1px] w-[6px]", {
|
|
57
|
+
"bg-purple-400 text-purple-400": color === "primary",
|
|
58
|
+
"bg-violet-400 text-violet-400": color === "secondary",
|
|
59
|
+
"bg-pink-400 text-pink-400": color === "pink",
|
|
60
|
+
"bg-red-400 text-red-400": color === "danger",
|
|
61
|
+
"bg-blue-400 text-blue-400": color === "info",
|
|
62
|
+
"bg-green-400 text-green-400": color === "success",
|
|
63
|
+
"bg-yellow-400 text-yellow-400": color === "warning",
|
|
64
|
+
"bg-gray-400 text-gray-400": color === "basic"
|
|
65
|
+
})
|
|
66
|
+
const removeButtonStyles: ClassNameWithAutocomplete = cn(
|
|
67
|
+
"h-4 w-4 group-focus-within:ring-1 group-focus-within:ring-purple-600 rounded-full group-focus-within:ring-offset-[1px] group-focus-within:ring-offset-white outline-0",
|
|
68
|
+
{
|
|
69
|
+
"text-purple-400": color === "primary",
|
|
70
|
+
"text-violet-400": color === "secondary",
|
|
71
|
+
"text-pink-400": color === "pink",
|
|
72
|
+
"text-red-400": color === "danger",
|
|
73
|
+
"text-blue-400": color === "info",
|
|
74
|
+
"text-green-400": color === "success",
|
|
75
|
+
"text-yellow-400": color === "warning",
|
|
76
|
+
"text-gray-400": color === "basic"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const loaderStyles = cn("h-4 w-4 rounded-full border-2 animate-spin", {
|
|
81
|
+
"border-purple-400 !border-r-purple-200": color === "primary",
|
|
82
|
+
"border-violet-400 !border-r-violet-200": color === "secondary",
|
|
83
|
+
"border-pink-400 !border-r-pink-200": color === "pink",
|
|
84
|
+
"border-red-400 !border-r-red-200": color === "danger",
|
|
85
|
+
"border-blue-400 !border-r-blue-200": color === "info",
|
|
86
|
+
"border-green-400 !border-r-green-200": color === "success",
|
|
87
|
+
"border-yellow-400 !border-r-yellow-200": color === "warning",
|
|
88
|
+
"border-gray-400 !border-r-gray-200": color === "basic"
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
return actionButton ? (
|
|
92
|
+
<button {...{ ...actionButton, className: badgeStyles }}>
|
|
93
|
+
{statusDot && <div className={statusDotStyles} role="status" />}
|
|
94
|
+
{label}
|
|
95
|
+
{removeButton && (
|
|
96
|
+
<button
|
|
97
|
+
{...{
|
|
98
|
+
removeButton,
|
|
99
|
+
"aria-label": `Remove ${label}`,
|
|
100
|
+
className: `${removeButton?.className || ""} group outline-0 `
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
104
|
+
</button>
|
|
105
|
+
)}
|
|
106
|
+
</button>
|
|
107
|
+
) : (
|
|
108
|
+
<div className={badgeStyles}>
|
|
109
|
+
{loading && <div className={loaderStyles} role="status" />}
|
|
110
|
+
{!loading && statusDot && <div className={statusDotStyles} role="status" />}
|
|
111
|
+
{label}
|
|
112
|
+
{!loading && removeButton && (
|
|
113
|
+
<button
|
|
114
|
+
{...{
|
|
115
|
+
...removeButton,
|
|
116
|
+
"aria-label": `Remove ${label}`,
|
|
117
|
+
className: `${removeButton?.className || ""} group outline-0 `
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
121
|
+
</button>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default Badge
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import Badge from "../Badge"
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Badge> = {
|
|
5
|
-
title: "Design System/atoms/Badges/Pill",
|
|
6
|
-
component: Badge,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
parameters: {
|
|
9
|
-
design: {
|
|
10
|
-
type: "figma",
|
|
11
|
-
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
type Story = StoryObj<typeof Badge>
|
|
16
|
-
export const SmallPrimaryPill: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
variant: "pill",
|
|
19
|
-
label: "Badge",
|
|
20
|
-
color: "primary"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export const PillAsButton: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
variant: "pill",
|
|
26
|
-
label: "Badge",
|
|
27
|
-
color: "primary",
|
|
28
|
-
actionButton: { onClick: () => window.alert("action button clicked") }
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export const SmallPrimaryPillWithRemoveButton: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
...SmallPrimaryPill.args,
|
|
34
|
-
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export const SmallPrimaryPillWithStatusDot: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
...SmallPrimaryPill.args,
|
|
40
|
-
statusDot: true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export const SmallPrimaryPillWithStatusDotAndRemoveButton: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
...SmallPrimaryPillWithRemoveButton.args,
|
|
46
|
-
...SmallPrimaryPillWithStatusDot.args
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export const LargePrimaryPill: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
variant: "pill",
|
|
52
|
-
label: "Badge",
|
|
53
|
-
color: "primary",
|
|
54
|
-
size: "lg"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export const LargePrimaryPillWithRemoveButton: Story = {
|
|
58
|
-
args: {
|
|
59
|
-
...LargePrimaryPill.args,
|
|
60
|
-
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export const LargePrimaryPillWithStatusDot: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
...LargePrimaryPill.args,
|
|
66
|
-
statusDot: true
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const LargePrimaryPillWithStatusDotAndRemoveButton: Story = {
|
|
70
|
-
args: {
|
|
71
|
-
...LargePrimaryPillWithRemoveButton.args,
|
|
72
|
-
...LargePrimaryPillWithStatusDot.args
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export default meta
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import Badge from "../Badge"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Badge> = {
|
|
5
|
+
title: "Design System/atoms/Badges/Pill",
|
|
6
|
+
component: Badge,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: {
|
|
9
|
+
design: {
|
|
10
|
+
type: "figma",
|
|
11
|
+
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
type Story = StoryObj<typeof Badge>
|
|
16
|
+
export const SmallPrimaryPill: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
variant: "pill",
|
|
19
|
+
label: "Badge",
|
|
20
|
+
color: "primary"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const PillAsButton: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
variant: "pill",
|
|
26
|
+
label: "Badge",
|
|
27
|
+
color: "primary",
|
|
28
|
+
actionButton: { onClick: () => window.alert("action button clicked") }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const SmallPrimaryPillWithRemoveButton: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
...SmallPrimaryPill.args,
|
|
34
|
+
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export const SmallPrimaryPillWithStatusDot: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...SmallPrimaryPill.args,
|
|
40
|
+
statusDot: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export const SmallPrimaryPillWithStatusDotAndRemoveButton: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
...SmallPrimaryPillWithRemoveButton.args,
|
|
46
|
+
...SmallPrimaryPillWithStatusDot.args
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export const LargePrimaryPill: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
variant: "pill",
|
|
52
|
+
label: "Badge",
|
|
53
|
+
color: "primary",
|
|
54
|
+
size: "lg"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export const LargePrimaryPillWithRemoveButton: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
...LargePrimaryPill.args,
|
|
60
|
+
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const LargePrimaryPillWithStatusDot: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
...LargePrimaryPill.args,
|
|
66
|
+
statusDot: true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const LargePrimaryPillWithStatusDotAndRemoveButton: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
...LargePrimaryPillWithRemoveButton.args,
|
|
72
|
+
...LargePrimaryPillWithStatusDot.args
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export default meta
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import Badge from "../Badge"
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Badge> = {
|
|
5
|
-
title: "Design System/atoms/Badges/Rounded",
|
|
6
|
-
component: Badge,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
parameters: {
|
|
9
|
-
design: {
|
|
10
|
-
type: "figma",
|
|
11
|
-
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
type Story = StoryObj<typeof Badge>
|
|
16
|
-
export const SmallPrimaryRounded: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
variant: "rounded",
|
|
19
|
-
label: "Badge",
|
|
20
|
-
color: "primary"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export const RoundedAsButton: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
variant: "rounded",
|
|
26
|
-
label: "Badge",
|
|
27
|
-
color: "primary",
|
|
28
|
-
actionButton: { onClick: () => window.alert("action button clicked") }
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export const SmallPrimaryRoundedWithRemoveButton: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
...SmallPrimaryRounded.args,
|
|
34
|
-
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export const SmallPrimaryRoundedWithStatusDot: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
...SmallPrimaryRounded.args,
|
|
40
|
-
statusDot: true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export const SmallPrimaryRoundedWithStatusDotAndRemoveButton: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
...SmallPrimaryRoundedWithRemoveButton.args,
|
|
46
|
-
...SmallPrimaryRoundedWithStatusDot.args
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export const LargePrimaryRounded: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
variant: "rounded",
|
|
52
|
-
label: "Badge",
|
|
53
|
-
color: "primary",
|
|
54
|
-
size: "lg"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export const LargePrimaryRoundedWithRemoveButton: Story = {
|
|
58
|
-
args: {
|
|
59
|
-
...LargePrimaryRounded.args,
|
|
60
|
-
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export const LargePrimaryRoundedWithStatusDot: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
...LargePrimaryRounded.args,
|
|
66
|
-
statusDot: true
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const LargePrimaryRoundedWithStatusDotAndRemoveButton: Story = {
|
|
70
|
-
args: {
|
|
71
|
-
...LargePrimaryRoundedWithRemoveButton.args,
|
|
72
|
-
...LargePrimaryRoundedWithStatusDot.args
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export default meta
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import Badge from "../Badge"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Badge> = {
|
|
5
|
+
title: "Design System/atoms/Badges/Rounded",
|
|
6
|
+
component: Badge,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: {
|
|
9
|
+
design: {
|
|
10
|
+
type: "figma",
|
|
11
|
+
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
type Story = StoryObj<typeof Badge>
|
|
16
|
+
export const SmallPrimaryRounded: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
variant: "rounded",
|
|
19
|
+
label: "Badge",
|
|
20
|
+
color: "primary"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const RoundedAsButton: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
variant: "rounded",
|
|
26
|
+
label: "Badge",
|
|
27
|
+
color: "primary",
|
|
28
|
+
actionButton: { onClick: () => window.alert("action button clicked") }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const SmallPrimaryRoundedWithRemoveButton: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
...SmallPrimaryRounded.args,
|
|
34
|
+
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export const SmallPrimaryRoundedWithStatusDot: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...SmallPrimaryRounded.args,
|
|
40
|
+
statusDot: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export const SmallPrimaryRoundedWithStatusDotAndRemoveButton: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
...SmallPrimaryRoundedWithRemoveButton.args,
|
|
46
|
+
...SmallPrimaryRoundedWithStatusDot.args
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export const LargePrimaryRounded: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
variant: "rounded",
|
|
52
|
+
label: "Badge",
|
|
53
|
+
color: "primary",
|
|
54
|
+
size: "lg"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export const LargePrimaryRoundedWithRemoveButton: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
...LargePrimaryRounded.args,
|
|
60
|
+
removeButton: { onClick: () => window.alert("remove button clicked") }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const LargePrimaryRoundedWithStatusDot: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
...LargePrimaryRounded.args,
|
|
66
|
+
statusDot: true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const LargePrimaryRoundedWithStatusDotAndRemoveButton: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
...LargePrimaryRoundedWithRemoveButton.args,
|
|
72
|
+
...LargePrimaryRoundedWithStatusDot.args
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export default meta
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Badge, { IBadgeProps } from "./Badge"
|
|
2
|
-
export default Badge
|
|
3
|
-
export type { IBadgeProps }
|
|
1
|
+
import Badge, { IBadgeProps } from "./Badge"
|
|
2
|
+
export default Badge
|
|
3
|
+
export type { IBadgeProps }
|