@agility/plenum-ui 2.1.26 → 2.1.28
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 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +41 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +1 -1
- package/dist/types/stories/atoms/buttons/Button/DangerSecondary/DangerSecondary.stories.d.ts +15 -0
- package/dist/types/stories/molecules/inputs/InputLabel/InputLabel.d.ts +1 -0
- package/package.json +1 -1
- package/stories/atoms/buttons/Button/Button.tsx +39 -38
- package/stories/atoms/buttons/Button/DangerSecondary/DangerSecondary.stories.ts +90 -0
- package/stories/atoms/buttons/Button/tests/Button.test.tsx +0 -37
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +6 -3
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +2 -1
package/dist/tailwind.css
CHANGED
|
@@ -79050,6 +79050,11 @@ select {
|
|
|
79050
79050
|
background-color: rgb(88 0 212 / var(--tw-bg-opacity, 1));
|
|
79051
79051
|
}
|
|
79052
79052
|
|
|
79053
|
+
.hover\:bg-red-50:hover {
|
|
79054
|
+
--tw-bg-opacity: 1;
|
|
79055
|
+
background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1));
|
|
79056
|
+
}
|
|
79057
|
+
|
|
79053
79058
|
.hover\:bg-red-700:hover {
|
|
79054
79059
|
--tw-bg-opacity: 1;
|
|
79055
79060
|
background-color: rgb(185 28 28 / var(--tw-bg-opacity, 1));
|
|
@@ -79216,6 +79221,16 @@ select {
|
|
|
79216
79221
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
79217
79222
|
}
|
|
79218
79223
|
|
|
79224
|
+
.focus-visible\:\!ring-red-500:focus-visible {
|
|
79225
|
+
--tw-ring-opacity: 1 !important;
|
|
79226
|
+
--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1)) !important;
|
|
79227
|
+
}
|
|
79228
|
+
|
|
79229
|
+
.focus-visible\:\!ring-yellow-500:focus-visible {
|
|
79230
|
+
--tw-ring-opacity: 1 !important;
|
|
79231
|
+
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity, 1)) !important;
|
|
79232
|
+
}
|
|
79233
|
+
|
|
79219
79234
|
.focus-visible\:ring-purple-600:focus-visible {
|
|
79220
79235
|
--tw-ring-opacity: 1;
|
|
79221
79236
|
--tw-ring-color: rgb(105 26 216 / var(--tw-ring-opacity, 1));
|
|
@@ -79250,6 +79265,11 @@ select {
|
|
|
79250
79265
|
background-color: rgb(188 153 238 / var(--tw-bg-opacity, 1));
|
|
79251
79266
|
}
|
|
79252
79267
|
|
|
79268
|
+
.active\:bg-red-100:active {
|
|
79269
|
+
--tw-bg-opacity: 1;
|
|
79270
|
+
background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1));
|
|
79271
|
+
}
|
|
79272
|
+
|
|
79253
79273
|
.active\:bg-violet-800:active {
|
|
79254
79274
|
--tw-bg-opacity: 1;
|
|
79255
79275
|
background-color: rgb(91 33 182 / var(--tw-bg-opacity, 1));
|
|
@@ -79276,6 +79296,11 @@ select {
|
|
|
79276
79296
|
--tw-ring-color: rgb(105 26 216 / var(--tw-ring-opacity, 1));
|
|
79277
79297
|
}
|
|
79278
79298
|
|
|
79299
|
+
.active\:ring-red-500:active {
|
|
79300
|
+
--tw-ring-opacity: 1;
|
|
79301
|
+
--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1));
|
|
79302
|
+
}
|
|
79303
|
+
|
|
79279
79304
|
.active\:ring-offset-2:active {
|
|
79280
79305
|
--tw-ring-offset-width: 2px;
|
|
79281
79306
|
}
|
|
@@ -79315,6 +79340,11 @@ select {
|
|
|
79315
79340
|
background-color: rgb(167 139 250 / var(--tw-bg-opacity, 1));
|
|
79316
79341
|
}
|
|
79317
79342
|
|
|
79343
|
+
.disabled\:bg-white:disabled {
|
|
79344
|
+
--tw-bg-opacity: 1;
|
|
79345
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
79346
|
+
}
|
|
79347
|
+
|
|
79318
79348
|
.disabled\:bg-yellow-300:disabled {
|
|
79319
79349
|
--tw-bg-opacity: 1;
|
|
79320
79350
|
background-color: rgb(255 224 126 / var(--tw-bg-opacity, 1));
|
|
@@ -79340,6 +79370,11 @@ select {
|
|
|
79340
79370
|
color: rgb(188 153 238 / var(--tw-text-opacity, 1));
|
|
79341
79371
|
}
|
|
79342
79372
|
|
|
79373
|
+
.disabled\:text-red-300:disabled {
|
|
79374
|
+
--tw-text-opacity: 1;
|
|
79375
|
+
color: rgb(252 165 165 / var(--tw-text-opacity, 1));
|
|
79376
|
+
}
|
|
79377
|
+
|
|
79343
79378
|
.disabled\:text-transparent-black-30:disabled {
|
|
79344
79379
|
color: rgba(0, 0, 0, 0.3);
|
|
79345
79380
|
}
|
|
@@ -79353,6 +79388,12 @@ select {
|
|
|
79353
79388
|
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
|
|
79354
79389
|
}
|
|
79355
79390
|
|
|
79391
|
+
.disabled\:\!ring-0:disabled {
|
|
79392
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;
|
|
79393
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;
|
|
79394
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;
|
|
79395
|
+
}
|
|
79396
|
+
|
|
79356
79397
|
.disabled\:focus-visible\:ring-0:focus-visible:disabled {
|
|
79357
79398
|
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
79358
79399
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
@@ -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" | "warning";
|
|
3
|
+
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger" | "danger-secondary" | "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 DangerSecondary: Story;
|
|
7
|
+
export declare const DangerSecondaryDisabled: Story;
|
|
8
|
+
export declare const DangerSecondaryTrailingIcon: Story;
|
|
9
|
+
export declare const DangerSecondaryLeadingIcon: Story;
|
|
10
|
+
export declare const DangerSecondarySimpleIconName: Story;
|
|
11
|
+
export declare const DangerSecondaryExtraSmall: Story;
|
|
12
|
+
export declare const DangerSecondarySmall: Story;
|
|
13
|
+
export declare const DangerSecondaryMedium: Story;
|
|
14
|
+
export declare const DangerSecondaryLarge: Story;
|
|
15
|
+
export declare const DangerSecondaryExtraLarge: Story;
|
package/package.json
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
|
|
1
|
+
import { default as cn } from "classnames";
|
|
2
|
+
import React, { HTMLAttributeAnchorTarget, forwardRef } from "react";
|
|
3
|
+
import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger" | "warning"
|
|
5
|
+
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger" | "danger-secondary" | "warning";
|
|
9
6
|
|
|
10
7
|
export interface IButtonProps
|
|
11
8
|
extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
12
9
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
13
|
-
actionType?: BTNActionType
|
|
10
|
+
actionType?: BTNActionType;
|
|
14
11
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
15
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl"
|
|
12
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
16
13
|
/** The Button's text content. */
|
|
17
|
-
label: string
|
|
14
|
+
label: string;
|
|
18
15
|
/** The Icon to be displayed inside the button. */
|
|
19
|
-
icon?: IDynamicIconProps | UnifiedIconName
|
|
16
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
20
17
|
/** Does the button width grow to fill it's container? */
|
|
21
|
-
fullWidth?: boolean
|
|
18
|
+
fullWidth?: boolean;
|
|
22
19
|
/** Optionally render as anchor tag */
|
|
23
20
|
asLink?: {
|
|
24
|
-
href: string
|
|
25
|
-
target: HTMLAttributeAnchorTarget
|
|
26
|
-
title?: string
|
|
27
|
-
}
|
|
21
|
+
href: string;
|
|
22
|
+
target: HTMLAttributeAnchorTarget;
|
|
23
|
+
title?: string;
|
|
24
|
+
};
|
|
28
25
|
/** The placement of the icon relative to the text content. */
|
|
29
|
-
iconPosition?: "trailing" | "leading"
|
|
26
|
+
iconPosition?: "trailing" | "leading";
|
|
30
27
|
/** Use an custom svg element */
|
|
31
|
-
CustomSVGIcon?: JSX.Element
|
|
28
|
+
CustomSVGIcon?: JSX.Element;
|
|
32
29
|
/** Is the associated content loading? */
|
|
33
|
-
isLoading?: boolean
|
|
34
|
-
className?: string
|
|
35
|
-
iconObj?: React.ReactNode
|
|
36
|
-
iconClassName?: string
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
iconObj?: React.ReactNode;
|
|
33
|
+
iconClassName?: string;
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* Primary UI component for user interaction
|
|
@@ -61,10 +58,10 @@ const _Button = (
|
|
|
61
58
|
{ "text-purple-700 h-5 w-5 stroke-[1.5]": actionType === "secondary" },
|
|
62
59
|
{ "text-gray-400 h-5 w-5 stroke-[1.5]": actionType === "alternative" },
|
|
63
60
|
{ "text-transparent-black-40 h-5 w-5 stroke-[1.5]": actionType === "warning" }
|
|
64
|
-
)
|
|
61
|
+
);
|
|
65
62
|
|
|
66
63
|
if (iconClassName) {
|
|
67
|
-
iconStyles = cn(iconStyles, iconClassName)
|
|
64
|
+
iconStyles = cn(iconStyles, iconClassName);
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
const loaderColors = cn(
|
|
@@ -73,8 +70,8 @@ const _Button = (
|
|
|
73
70
|
{ "border-gray-200 border-r-gray-700": actionType === "alternative" },
|
|
74
71
|
{ "border-red-800 border-r-white": actionType === "danger" },
|
|
75
72
|
{ "border-yellow-800 border-r-transparent-black-70": actionType === "warning" }
|
|
76
|
-
)
|
|
77
|
-
const loaderSize = cn({ "h-4 w-4": size === "sm" }, { "h-5 w-5": size === "md" }, { "h-6 w-6 ": size === "lg" })
|
|
73
|
+
);
|
|
74
|
+
const loaderSize = cn({ "h-4 w-4": size === "sm" }, { "h-5 w-5": size === "md" }, { "h-6 w-6 ": size === "lg" });
|
|
78
75
|
|
|
79
76
|
return asLink ? (
|
|
80
77
|
//@ts-ignore
|
|
@@ -164,13 +161,13 @@ const _Button = (
|
|
|
164
161
|
<button
|
|
165
162
|
type="button"
|
|
166
163
|
className={cn(
|
|
167
|
-
"inline-flex items-center justify-center gap-x-2 rounded
|
|
164
|
+
" px-4 py-2 inline-flex items-center justify-center gap-x-2 rounded !ring-offset-white outline-none 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 transition-all",
|
|
168
165
|
{ "w-full": fullWidth },
|
|
169
|
-
{ "
|
|
170
|
-
{ "
|
|
171
|
-
{ "
|
|
172
|
-
{ "
|
|
173
|
-
{ "
|
|
166
|
+
{ "text-xs": size === "xs" },
|
|
167
|
+
{ "text-sm": size === "sm" },
|
|
168
|
+
{ "text-sm": size === "md" },
|
|
169
|
+
{ "text-base": size === "lg" },
|
|
170
|
+
{ "text-base": size === "xl" },
|
|
174
171
|
{
|
|
175
172
|
"bg-violet-800 text-white hover:border-violet-700 hover:bg-violet-700 disabled:bg-violet-400 disabled:focus-visible:ring-0":
|
|
176
173
|
actionType === "primary"
|
|
@@ -184,11 +181,15 @@ const _Button = (
|
|
|
184
181
|
actionType === "alternative"
|
|
185
182
|
},
|
|
186
183
|
{
|
|
187
|
-
"
|
|
184
|
+
"bg-red-600 text-white hover:bg-red-700 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":
|
|
188
185
|
actionType === "danger"
|
|
189
186
|
},
|
|
190
187
|
{
|
|
191
|
-
" bg-
|
|
188
|
+
"border-gray-300 border bg-white text-red-600 hover:bg-red-50 focus-visible:!ring-red-500 focus:!ring-red-500 active:bg-red-100 active:ring-red-500 focus-within:!ring-red-500 disabled:bg-white disabled:text-red-300 disabled:!ring-0 disabled:focus-visible:ring-0":
|
|
189
|
+
actionType === "danger-secondary"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"bg-yellow-500 text-transparent-black-70 hover:bg-yellow-700 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":
|
|
192
193
|
actionType === "warning"
|
|
193
194
|
},
|
|
194
195
|
className ? className : ""
|
|
@@ -241,9 +242,9 @@ const _Button = (
|
|
|
241
242
|
<div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
|
|
242
243
|
))}
|
|
243
244
|
</button>
|
|
244
|
-
)
|
|
245
|
-
}
|
|
245
|
+
);
|
|
246
|
+
};
|
|
246
247
|
|
|
247
|
-
const Button = forwardRef<HTMLButtonElement, IButtonProps>(_Button)
|
|
248
|
+
const Button = forwardRef<HTMLButtonElement, IButtonProps>(_Button);
|
|
248
249
|
|
|
249
|
-
export default Button
|
|
250
|
+
export default Button;
|
|
@@ -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/DangerSecondary",
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof Button>;
|
|
15
|
+
// #region Danger Button Stories
|
|
16
|
+
export const DangerSecondary: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
actionType: "danger-secondary",
|
|
19
|
+
label: "Danger Secondary",
|
|
20
|
+
onClick: () => {
|
|
21
|
+
window.alert("Button clicked!");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const DangerSecondaryDisabled: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
actionType: "danger-secondary",
|
|
29
|
+
label: "Danger Secondary",
|
|
30
|
+
disabled: true,
|
|
31
|
+
onClick: () => {
|
|
32
|
+
window.alert("Button clicked!");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DangerSecondaryTrailingIcon: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...DangerSecondary.args,
|
|
40
|
+
icon: {
|
|
41
|
+
...defaultIcon,
|
|
42
|
+
icon: "IconTrash"
|
|
43
|
+
},
|
|
44
|
+
iconPosition: "trailing"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const DangerSecondaryLeadingIcon: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
...DangerSecondaryTrailingIcon.args,
|
|
50
|
+
iconPosition: "leading"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const DangerSecondarySimpleIconName: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
...DangerSecondary.args,
|
|
56
|
+
icon: "IconTrash",
|
|
57
|
+
iconPosition: "leading"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export const DangerSecondaryExtraSmall: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
...DangerSecondary.args,
|
|
63
|
+
size: "sm"
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const DangerSecondarySmall: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
...DangerSecondary.args,
|
|
69
|
+
size: "sm"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export const DangerSecondaryMedium: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
...DangerSecondary.args,
|
|
75
|
+
size: "md"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
export const DangerSecondaryLarge: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
...DangerSecondary.args,
|
|
81
|
+
size: "lg"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export const DangerSecondaryExtraLarge: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
...DangerSecondary.args,
|
|
87
|
+
size: "xl"
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// #endregion
|
|
@@ -51,43 +51,6 @@ describe("<Button>", () => {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
describe("size", () => {
|
|
55
|
-
it("defaults to size sm", () => {
|
|
56
|
-
render(<Button {...defaultProps} />);
|
|
57
|
-
|
|
58
|
-
const buttonElement = screen.getByRole("button");
|
|
59
|
-
expect(buttonElement).toHaveClass("px-[13px]");
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("renders with size xs", () => {
|
|
63
|
-
render(<Button {...defaultProps} size="xs" />);
|
|
64
|
-
|
|
65
|
-
const buttonElement = screen.getByRole("button");
|
|
66
|
-
expect(buttonElement).toHaveClass("px-[11px]");
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("renders with size md", () => {
|
|
70
|
-
render(<Button {...defaultProps} size="md" />);
|
|
71
|
-
|
|
72
|
-
const buttonElement = screen.getByRole("button");
|
|
73
|
-
expect(buttonElement).toHaveClass("px-[17px] text-sm");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("renders with size lg", () => {
|
|
77
|
-
render(<Button {...defaultProps} size="lg" />);
|
|
78
|
-
|
|
79
|
-
const buttonElement = screen.getByRole("button");
|
|
80
|
-
expect(buttonElement).toHaveClass("px-[17px] text-base");
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("renders with size xl", () => {
|
|
84
|
-
render(<Button {...defaultProps} size="xl" />);
|
|
85
|
-
|
|
86
|
-
const buttonElement = screen.getByRole("button");
|
|
87
|
-
expect(buttonElement).toHaveClass("px-[25px]");
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
54
|
describe("asLink", () => {
|
|
92
55
|
it("renders as <a /> when asLink is true", () => {
|
|
93
56
|
render(<Button {...defaultProps} asLink={{ href: "#", target: "_blank" }} />);
|
|
@@ -16,6 +16,7 @@ export interface IInputLabelProps {
|
|
|
16
16
|
label?: string;
|
|
17
17
|
truncateLabel?: boolean;
|
|
18
18
|
fullWidthLabel?: boolean;
|
|
19
|
+
noMarginBottom?: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/** Comment */
|
|
@@ -28,7 +29,8 @@ const InputLabel: FC<IInputLabelProps> = ({
|
|
|
28
29
|
isError,
|
|
29
30
|
label,
|
|
30
31
|
truncateLabel = false,
|
|
31
|
-
fullWidthLabel = false
|
|
32
|
+
fullWidthLabel = false,
|
|
33
|
+
noMarginBottom = false
|
|
32
34
|
}: IInputLabelProps) => {
|
|
33
35
|
const labelStyles = cn(
|
|
34
36
|
"z-[2] inline-flex gap-1",
|
|
@@ -38,8 +40,9 @@ const InputLabel: FC<IInputLabelProps> = ({
|
|
|
38
40
|
{ "text-xs text-red-500 px-1 top-[10px] bg-white": isPlaceholder && isError },
|
|
39
41
|
{ "text-red-500 bg-white": !isPlaceholder && isError },
|
|
40
42
|
{ "text-gray-500/[.5]": isDisabled },
|
|
41
|
-
{ "inline-block transition-all text-sm text-gray-700
|
|
42
|
-
{ "block w-full": fullWidthLabel }
|
|
43
|
+
{ "inline-block transition-all text-sm text-gray-700": !isPlaceholder },
|
|
44
|
+
{ "block w-full": fullWidthLabel },
|
|
45
|
+
{ "mb-1": !noMarginBottom }
|
|
43
46
|
);
|
|
44
47
|
|
|
45
48
|
if (!label) return null;
|
|
@@ -88,7 +88,7 @@ const Checkbox: FC<ICheckboxProps> = ({
|
|
|
88
88
|
{...props}
|
|
89
89
|
/>
|
|
90
90
|
</div>
|
|
91
|
-
<div className="ml-
|
|
91
|
+
<div className="ml-2 text-sm flex items-center w-full">
|
|
92
92
|
<>
|
|
93
93
|
<InputLabel
|
|
94
94
|
label={label}
|
|
@@ -96,6 +96,7 @@ const Checkbox: FC<ICheckboxProps> = ({
|
|
|
96
96
|
id={id}
|
|
97
97
|
truncateLabel={truncateLabel}
|
|
98
98
|
fullWidthLabel={fullWidthLabel}
|
|
99
|
+
noMarginBottom={true}
|
|
99
100
|
/>
|
|
100
101
|
</>
|
|
101
102
|
|