@agility/plenum-ui 2.0.6 → 2.0.8
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 +20 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +59 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +1 -1
- package/dist/types/stories/atoms/buttons/Button/Warning/Warning.stories.d.ts +15 -0
- package/dist/types/stories/molecules/inputs/NestedInputButton/NestedInputButton.d.ts +1 -4
- package/package.json +1 -1
- package/stories/atoms/buttons/Button/Button.tsx +15 -5
- package/stories/atoms/buttons/Button/Warning/Warning.stories.ts +90 -0
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +17 -12
- package/stories/organisms/AnimatedFormInputWithAddons/AnimatedFormInputWithAddons.stories.tsx +1 -1
package/dist/tailwind.css
CHANGED
|
@@ -33199,6 +33199,10 @@ select {
|
|
|
33199
33199
|
border-right-color: transparent;
|
|
33200
33200
|
}
|
|
33201
33201
|
|
|
33202
|
+
.border-r-transparent-black-70 {
|
|
33203
|
+
border-right-color: rgba(0, 0, 0, 0.7);
|
|
33204
|
+
}
|
|
33205
|
+
|
|
33202
33206
|
.border-r-violet-100 {
|
|
33203
33207
|
--tw-border-opacity: 1;
|
|
33204
33208
|
border-right-color: rgb(237 233 254 / var(--tw-border-opacity));
|
|
@@ -50150,6 +50154,10 @@ select {
|
|
|
50150
50154
|
stroke-width: 1;
|
|
50151
50155
|
}
|
|
50152
50156
|
|
|
50157
|
+
.stroke-\[1\.5\] {
|
|
50158
|
+
stroke-width: 1.5;
|
|
50159
|
+
}
|
|
50160
|
+
|
|
50153
50161
|
.p-10 {
|
|
50154
50162
|
padding: 2.5rem;
|
|
50155
50163
|
}
|
|
@@ -57227,6 +57235,14 @@ select {
|
|
|
57227
57235
|
color: rgb(19 78 74 / 0.95);
|
|
57228
57236
|
}
|
|
57229
57237
|
|
|
57238
|
+
.text-transparent-black-40 {
|
|
57239
|
+
color: rgba(0, 0, 0, 0.4);
|
|
57240
|
+
}
|
|
57241
|
+
|
|
57242
|
+
.text-transparent-black-70 {
|
|
57243
|
+
color: rgba(0, 0, 0, 0.7);
|
|
57244
|
+
}
|
|
57245
|
+
|
|
57230
57246
|
.text-violet-100 {
|
|
57231
57247
|
--tw-text-opacity: 1;
|
|
57232
57248
|
color: rgb(237 233 254 / var(--tw-text-opacity));
|
|
@@ -58630,6 +58646,11 @@ select {
|
|
|
58630
58646
|
--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));
|
|
58631
58647
|
}
|
|
58632
58648
|
|
|
58649
|
+
.ring-yellow-500 {
|
|
58650
|
+
--tw-ring-opacity: 1;
|
|
58651
|
+
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity));
|
|
58652
|
+
}
|
|
58653
|
+
|
|
58633
58654
|
.ring-opacity-5 {
|
|
58634
58655
|
--tw-ring-opacity: 0.05;
|
|
58635
58656
|
}
|
|
@@ -58718,6 +58739,11 @@ select {
|
|
|
58718
58739
|
--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)) !important;
|
|
58719
58740
|
}
|
|
58720
58741
|
|
|
58742
|
+
.focus-within\:\!ring-yellow-500:focus-within {
|
|
58743
|
+
--tw-ring-opacity: 1 !important;
|
|
58744
|
+
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity)) !important;
|
|
58745
|
+
}
|
|
58746
|
+
|
|
58721
58747
|
.focus-within\:ring-purple-600:focus-within {
|
|
58722
58748
|
--tw-ring-opacity: 1;
|
|
58723
58749
|
--tw-ring-color: rgb(105 26 216 / var(--tw-ring-opacity));
|
|
@@ -58799,6 +58825,11 @@ select {
|
|
|
58799
58825
|
background-color: rgb(109 40 217 / var(--tw-bg-opacity));
|
|
58800
58826
|
}
|
|
58801
58827
|
|
|
58828
|
+
.hover\:bg-yellow-700:hover {
|
|
58829
|
+
--tw-bg-opacity: 1;
|
|
58830
|
+
background-color: rgb(179 142 28 / var(--tw-bg-opacity));
|
|
58831
|
+
}
|
|
58832
|
+
|
|
58802
58833
|
.hover\:text-gray-500:hover {
|
|
58803
58834
|
--tw-text-opacity: 1;
|
|
58804
58835
|
color: rgb(107 114 128 / var(--tw-text-opacity));
|
|
@@ -58895,6 +58926,11 @@ select {
|
|
|
58895
58926
|
--tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity)) !important;
|
|
58896
58927
|
}
|
|
58897
58928
|
|
|
58929
|
+
.focus\:\!ring-yellow-500:focus {
|
|
58930
|
+
--tw-ring-opacity: 1 !important;
|
|
58931
|
+
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity)) !important;
|
|
58932
|
+
}
|
|
58933
|
+
|
|
58898
58934
|
.focus\:ring-purple-500:focus {
|
|
58899
58935
|
--tw-ring-opacity: 1;
|
|
58900
58936
|
--tw-ring-color: rgb(121 51 221 / var(--tw-ring-opacity));
|
|
@@ -58995,6 +59031,11 @@ select {
|
|
|
58995
59031
|
--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)) !important;
|
|
58996
59032
|
}
|
|
58997
59033
|
|
|
59034
|
+
.active\:\!ring-yellow-500:active {
|
|
59035
|
+
--tw-ring-opacity: 1 !important;
|
|
59036
|
+
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity)) !important;
|
|
59037
|
+
}
|
|
59038
|
+
|
|
58998
59039
|
.active\:ring-purple-600:active {
|
|
58999
59040
|
--tw-ring-opacity: 1;
|
|
59000
59041
|
--tw-ring-color: rgb(105 26 216 / var(--tw-ring-opacity));
|
|
@@ -59039,6 +59080,16 @@ select {
|
|
|
59039
59080
|
background-color: rgb(167 139 250 / var(--tw-bg-opacity));
|
|
59040
59081
|
}
|
|
59041
59082
|
|
|
59083
|
+
.disabled\:bg-yellow-300:disabled {
|
|
59084
|
+
--tw-bg-opacity: 1;
|
|
59085
|
+
background-color: rgb(255 224 126 / var(--tw-bg-opacity));
|
|
59086
|
+
}
|
|
59087
|
+
|
|
59088
|
+
.disabled\:bg-yellow-400:disabled {
|
|
59089
|
+
--tw-bg-opacity: 1;
|
|
59090
|
+
background-color: rgb(255 213 83 / var(--tw-bg-opacity));
|
|
59091
|
+
}
|
|
59092
|
+
|
|
59042
59093
|
.disabled\:text-gray-300:disabled {
|
|
59043
59094
|
--tw-text-opacity: 1;
|
|
59044
59095
|
color: rgb(209 213 219 / var(--tw-text-opacity));
|
|
@@ -59059,6 +59110,14 @@ select {
|
|
|
59059
59110
|
color: rgb(188 153 238 / var(--tw-text-opacity));
|
|
59060
59111
|
}
|
|
59061
59112
|
|
|
59113
|
+
.disabled\:text-transparent-black-30:disabled {
|
|
59114
|
+
color: rgba(0, 0, 0, 0.3);
|
|
59115
|
+
}
|
|
59116
|
+
|
|
59117
|
+
.disabled\:text-transparent-black-70:disabled {
|
|
59118
|
+
color: rgba(0, 0, 0, 0.7);
|
|
59119
|
+
}
|
|
59120
|
+
|
|
59062
59121
|
.disabled\:text-white:disabled {
|
|
59063
59122
|
--tw-text-opacity: 1;
|
|
59064
59123
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributeAnchorTarget } from "react";
|
|
2
2
|
import { UnifiedIconName, IDynamicIconProps } from "../../icons";
|
|
3
|
-
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger";
|
|
3
|
+
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger" | "warning";
|
|
4
4
|
export interface IButtonProps extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
5
5
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
6
6
|
actionType?: BTNActionType;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Button from "../Button";
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Button>;
|
|
6
|
+
export declare const Warning: Story;
|
|
7
|
+
export declare const WarningDisabled: Story;
|
|
8
|
+
export declare const WarningTrailingIcon: Story;
|
|
9
|
+
export declare const WarningLeadingIcon: Story;
|
|
10
|
+
export declare const WarningSimpleIconName: Story;
|
|
11
|
+
export declare const WarningExtraSmall: Story;
|
|
12
|
+
export declare const WarningSmall: Story;
|
|
13
|
+
export declare const WarningMedium: Story;
|
|
14
|
+
export declare const WarningLarge: Story;
|
|
15
|
+
export declare const WarningExtraLarge: Story;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
3
|
-
export interface INestedInputButtonProps {
|
|
3
|
+
export interface INestedInputButtonProps extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
4
4
|
/** Icon to be included*/
|
|
5
5
|
icon?: IDynamicIconProps;
|
|
6
6
|
/** CTA label */
|
|
@@ -9,9 +9,6 @@ export interface INestedInputButtonProps {
|
|
|
9
9
|
align: "left" | "right";
|
|
10
10
|
/** Show the CTA without Background color and a border seperator */
|
|
11
11
|
isClear?: boolean;
|
|
12
|
-
/** Onclick callback */
|
|
13
|
-
onClickHandler?(): void;
|
|
14
|
-
buttonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
15
12
|
}
|
|
16
13
|
declare const NestedInputButton: React.FC<INestedInputButtonProps>;
|
|
17
14
|
export default NestedInputButton;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
|
|
|
5
5
|
|
|
6
6
|
// import Loader from "../loaders/loader/Loader"
|
|
7
7
|
|
|
8
|
-
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger"
|
|
8
|
+
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger" | "warning"
|
|
9
9
|
|
|
10
10
|
export interface IButtonProps
|
|
11
11
|
extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
@@ -55,15 +55,17 @@ const _Button = (
|
|
|
55
55
|
ref: React.LegacyRef<HTMLButtonElement>
|
|
56
56
|
) => {
|
|
57
57
|
const iconStyles = cn(
|
|
58
|
-
{ "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
|
|
59
|
-
{ "text-purple-700 h-5 w-5 ": actionType === "secondary" },
|
|
60
|
-
{ "text-gray-400 h-5 w-5": actionType === "alternative" }
|
|
58
|
+
{ "text-white h-5 w-5 stroke-[1.5]": actionType === "primary" || actionType === "danger" },
|
|
59
|
+
{ "text-purple-700 h-5 w-5 stroke-[1.5]": actionType === "secondary" },
|
|
60
|
+
{ "text-gray-400 h-5 w-5 stroke-[1.5]": actionType === "alternative" },
|
|
61
|
+
{ "text-transparent-black-40 h-5 w-5 stroke-[1.5]": actionType === "warning" }
|
|
61
62
|
)
|
|
62
63
|
const loaderColors = cn(
|
|
63
64
|
{ "border-r-white": actionType === "primary" },
|
|
64
65
|
{ "border-purple-200 border-r-purple-700": actionType === "secondary" },
|
|
65
66
|
{ "border-gray-200 border-r-gray-700": actionType === "alternative" },
|
|
66
|
-
{ "border-red-800 border-r-white": actionType === "danger" }
|
|
67
|
+
{ "border-red-800 border-r-white": actionType === "danger" },
|
|
68
|
+
{ "border-yellow-800 border-r-transparent-black-70": actionType === "warning" }
|
|
67
69
|
)
|
|
68
70
|
const loaderSize = cn({ "h-4 w-4": size === "sm" }, { "h-5 w-5": size === "md" }, { "h-6 w-6 ": size === "lg" })
|
|
69
71
|
|
|
@@ -98,6 +100,10 @@ const _Button = (
|
|
|
98
100
|
" bg-red-600 text-white hover:bg-red-700 <focus-visible:!></focus-visible:!>ring-red-500 focus:!ring-red-500 active:!ring-red-500 focus-within:!ring-red-500 disabled:bg-red-400 disabled:text-gray-50 disabled:focus-visible:ring-0":
|
|
99
101
|
actionType === "danger"
|
|
100
102
|
},
|
|
103
|
+
{
|
|
104
|
+
" bg-yellow-500 text-transparent-black-70 hover:bg-yellow-700 <focus-visible:!></focus-visible:!>ring-yellow-500 focus:!ring-yellow-500 active:!ring-yellow-500 focus-within:!ring-yellow-500 disabled:bg-yellow-400 disabled:text-transparent-black-70 disabled:focus-visible:ring-0":
|
|
105
|
+
actionType === "warning"
|
|
106
|
+
},
|
|
101
107
|
className ? className : ""
|
|
102
108
|
),
|
|
103
109
|
onClick: props.onClick
|
|
@@ -174,6 +180,10 @@ const _Button = (
|
|
|
174
180
|
" bg-red-600 text-white hover:bg-red-700 <focus-visible:!></focus-visible:!>ring-red-500 focus:!ring-red-500 active:!ring-red-500 focus-within:!ring-red-500 disabled:bg-red-400 disabled:text-gray-50 disabled:focus-visible:ring-0":
|
|
175
181
|
actionType === "danger"
|
|
176
182
|
},
|
|
183
|
+
{
|
|
184
|
+
" bg-yellow-500 text-transparent-black-70 hover:bg-yellow-700 <focus-visible:!></focus-visible:!>ring-yellow-500 focus:!ring-yellow-500 active:!ring-yellow-500 focus-within:!ring-yellow-500 disabled:bg-yellow-300 disabled:text-transparent-black-30 disabled:focus-visible:ring-0":
|
|
185
|
+
actionType === "warning"
|
|
186
|
+
},
|
|
177
187
|
className ? className : ""
|
|
178
188
|
)}
|
|
179
189
|
ref={ref}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import Button from "../Button"
|
|
3
|
+
import { defaultIcon } from "../defaultArgs"
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
6
|
+
const meta: Meta<typeof Button> = {
|
|
7
|
+
title: "Design System/atoms/Buttons/Button/Warning",
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof Button>
|
|
15
|
+
// #region Warning Button Stories
|
|
16
|
+
export const Warning: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
actionType: "warning",
|
|
19
|
+
label: "Warning Zone!",
|
|
20
|
+
onClick: () => {
|
|
21
|
+
window.alert("Button clicked!")
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const WarningDisabled: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
actionType: "warning",
|
|
29
|
+
label: "Warning Zone!",
|
|
30
|
+
disabled: true,
|
|
31
|
+
onClick: () => {
|
|
32
|
+
window.alert("Button clicked!")
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const WarningTrailingIcon: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...Warning.args,
|
|
40
|
+
icon: {
|
|
41
|
+
...defaultIcon,
|
|
42
|
+
icon: "IconTrash"
|
|
43
|
+
},
|
|
44
|
+
iconPosition: "trailing"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const WarningLeadingIcon: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
...WarningTrailingIcon.args,
|
|
50
|
+
iconPosition: "leading"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const WarningSimpleIconName: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
...Warning.args,
|
|
56
|
+
icon: "IconTrash",
|
|
57
|
+
iconPosition: "leading"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export const WarningExtraSmall: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
...Warning.args,
|
|
63
|
+
size: "sm"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const WarningSmall: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
...Warning.args,
|
|
69
|
+
size: "sm"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export const WarningMedium: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
...Warning.args,
|
|
75
|
+
size: "md"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const WarningLarge: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
...Warning.args,
|
|
81
|
+
size: "lg"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export const WarningExtraLarge: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
...Warning.args,
|
|
87
|
+
size: "xl"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// #endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms/icons"
|
|
3
3
|
import { default as cn } from "classnames"
|
|
4
|
-
export interface INestedInputButtonProps
|
|
4
|
+
export interface INestedInputButtonProps
|
|
5
|
+
extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
5
6
|
/** Icon to be included*/
|
|
6
7
|
icon?: IDynamicIconProps
|
|
7
8
|
/** CTA label */
|
|
@@ -10,9 +11,6 @@ export interface INestedInputButtonProps {
|
|
|
10
11
|
align: "left" | "right"
|
|
11
12
|
/** Show the CTA without Background color and a border seperator */
|
|
12
13
|
isClear?: boolean
|
|
13
|
-
/** Onclick callback */
|
|
14
|
-
onClickHandler?(): void
|
|
15
|
-
buttonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
const NestedInputButton: React.FC<INestedInputButtonProps> = ({
|
|
@@ -20,12 +18,10 @@ const NestedInputButton: React.FC<INestedInputButtonProps> = ({
|
|
|
20
18
|
ctaLabel,
|
|
21
19
|
align = "right",
|
|
22
20
|
isClear = false,
|
|
23
|
-
|
|
24
|
-
buttonProps
|
|
21
|
+
...props
|
|
25
22
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
}
|
|
23
|
+
const { ...buttonProps } = props
|
|
24
|
+
const { onClick } = buttonProps
|
|
29
25
|
const buttonStyle = cn(
|
|
30
26
|
"relative flex items-center space-x-2 px-4 py-2 leading-5 border border-gray-300 text-sm font-medium focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500",
|
|
31
27
|
{
|
|
@@ -35,10 +31,10 @@ const NestedInputButton: React.FC<INestedInputButtonProps> = ({
|
|
|
35
31
|
"rounded-l text-gray-500 -mr-px": align === "left"
|
|
36
32
|
},
|
|
37
33
|
{
|
|
38
|
-
"cursor-default": !
|
|
34
|
+
"cursor-default": !onClick
|
|
39
35
|
},
|
|
40
36
|
{
|
|
41
|
-
"hover:bg-gray-100":
|
|
37
|
+
"hover:bg-gray-100": onClick && !isClear
|
|
42
38
|
},
|
|
43
39
|
{
|
|
44
40
|
"!border-l-white": isClear && align === "right"
|
|
@@ -54,7 +50,16 @@ const NestedInputButton: React.FC<INestedInputButtonProps> = ({
|
|
|
54
50
|
}
|
|
55
51
|
)
|
|
56
52
|
return (
|
|
57
|
-
<button
|
|
53
|
+
<button
|
|
54
|
+
{...{
|
|
55
|
+
...buttonProps,
|
|
56
|
+
className: buttonStyle,
|
|
57
|
+
onClick: (e) => {
|
|
58
|
+
e.preventDefault()
|
|
59
|
+
onClick && onClick(e)
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
58
63
|
{icon && <DynamicIcon {...{ ...icon, className: "text-gray-400 h-5 w-5" }} />}
|
|
59
64
|
{ctaLabel && <span>{ctaLabel}</span>}
|
|
60
65
|
</button>
|