@agility/plenum-ui 2.0.0-rc2 → 2.0.0-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -11
- package/dist/index.js +111 -66
- package/dist/index.js.map +2 -2
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +6 -4
- package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +2 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +3 -7
- package/package.json +2 -2
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Button.tsx +25 -2
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +7 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +6 -1
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
- package/stories/molecules/inputs/TextInput/TextInput.tsx +162 -0
- package/stories/molecules/inputs/TextInput/index.tsx +3 -0
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +111 -80
- package/stories/organisms/DropdownComponent/dropdownItems.ts +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Alternative/Alte
|
|
|
75
75
|
export const AlternativeTrailingIcon: Story;
|
|
76
76
|
export const AlternativeLeadingIcon: Story;
|
|
77
77
|
export const AlternativeExtraSmall: Story;
|
|
78
|
+
export const AlternativeSimpleIconName: Story;
|
|
78
79
|
export const AlternativeSmall: Story;
|
|
79
80
|
export const AlternativeMedium: Story;
|
|
80
81
|
export const AlternativeLarge: Story;
|
|
@@ -83,17 +84,17 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Alternative/Alte
|
|
|
83
84
|
}
|
|
84
85
|
declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Button' {
|
|
85
86
|
import { HTMLAttributeAnchorTarget } from "react";
|
|
86
|
-
import { IDynamicIconProps } from "@agility/plenum-ui/stories/atoms/icons/index";
|
|
87
|
+
import { UnifiedIconName, IDynamicIconProps } from "@agility/plenum-ui/stories/atoms/icons/index";
|
|
87
88
|
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger";
|
|
88
89
|
export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
89
90
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
90
|
-
actionType
|
|
91
|
+
actionType?: BTNActionType;
|
|
91
92
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
92
93
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
93
94
|
/** The Button's text content. */
|
|
94
95
|
label: string;
|
|
95
96
|
/** The Icon to be displayed inside the button. */
|
|
96
|
-
icon?: IDynamicIconProps;
|
|
97
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
97
98
|
/** Does the button width grow to fill it's container? */
|
|
98
99
|
fullWidth?: boolean;
|
|
99
100
|
/** Optionally render as anchor tag */
|
|
@@ -109,11 +110,13 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Button' {
|
|
|
109
110
|
/** Is the associated content loading? */
|
|
110
111
|
isLoading?: boolean;
|
|
111
112
|
className?: string;
|
|
113
|
+
iconObj?: React.ReactNode;
|
|
114
|
+
ref?: React.LegacyRef<HTMLButtonElement>;
|
|
112
115
|
}
|
|
113
116
|
/**
|
|
114
117
|
* Primary UI component for user interaction
|
|
115
118
|
*/
|
|
116
|
-
const Button: ({ actionType, size, label, icon, CustomSVGIcon, fullWidth, iconPosition, asLink, isLoading, className, ...props }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
const Button: ({ actionType, size, label, icon, iconObj, CustomSVGIcon, fullWidth, iconPosition, asLink, isLoading, className, ref, ...props }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
117
120
|
export default Button;
|
|
118
121
|
|
|
119
122
|
}
|
|
@@ -126,6 +129,7 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Danger/Danger.st
|
|
|
126
129
|
export const Danger: Story;
|
|
127
130
|
export const DangerTrailingIcon: Story;
|
|
128
131
|
export const DangerLeadingIcon: Story;
|
|
132
|
+
export const DangerSimpleIconName: Story;
|
|
129
133
|
export const DangerExtraSmall: Story;
|
|
130
134
|
export const DangerSmall: Story;
|
|
131
135
|
export const DangerMedium: Story;
|
|
@@ -141,6 +145,7 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Primary/Primary.
|
|
|
141
145
|
type Story = StoryObj<typeof Button>;
|
|
142
146
|
export const Primary: Story;
|
|
143
147
|
export const PrimaryLeadingIcon: Story;
|
|
148
|
+
export const PrimarySimpleIconName: Story;
|
|
144
149
|
export const PrimaryTrailingIcon: Story;
|
|
145
150
|
export const PrimaryExtraSmall: Story;
|
|
146
151
|
export const PrimarySmall: Story;
|
|
@@ -158,6 +163,7 @@ declare module '@agility/plenum-ui/stories/atoms/buttons/Button/Secondary/Second
|
|
|
158
163
|
export const Secondary: Story;
|
|
159
164
|
export const SecondaryTrailingIcon: Story;
|
|
160
165
|
export const SecondaryLeadingIcon: Story;
|
|
166
|
+
export const SecondarySimpleIconName: Story;
|
|
161
167
|
export const SecondaryExtraSmall: Story;
|
|
162
168
|
export const SecondarySmall: Story;
|
|
163
169
|
export const SecondaryMedium: Story;
|
|
@@ -436,6 +442,8 @@ declare module '@agility/plenum-ui/stories/molecules/inputs/InputField/InputFiel
|
|
|
436
442
|
required?: boolean;
|
|
437
443
|
/** use input psuedo classes for :valid and :invalid styles. on by default */
|
|
438
444
|
clientSideCheck?: boolean;
|
|
445
|
+
/**ref for input */
|
|
446
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
439
447
|
}
|
|
440
448
|
const InputField: React.FC<IInputFieldProps>;
|
|
441
449
|
export default InputField;
|
|
@@ -824,14 +832,10 @@ declare module '@agility/plenum-ui/stories/organisms/DropdownComponent/DropdownC
|
|
|
824
832
|
import React, { HTMLAttributes } from "react";
|
|
825
833
|
import { Placement } from "@floating-ui/react";
|
|
826
834
|
import { ClassNameWithAutocomplete } from "utils/types";
|
|
827
|
-
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
835
|
+
import { IDynamicIconProps, UnifiedIconName } from "@/stories/atoms/icons";
|
|
828
836
|
export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
829
|
-
icon?:
|
|
830
|
-
|
|
831
|
-
className?: ClassNameWithAutocomplete;
|
|
832
|
-
pos?: "trailing" | "leading";
|
|
833
|
-
outline?: boolean;
|
|
834
|
-
};
|
|
837
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
838
|
+
iconPosition?: "trailing" | "leading";
|
|
835
839
|
label: string;
|
|
836
840
|
onClick?(): void;
|
|
837
841
|
isEmphasized?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -4643,23 +4643,27 @@ var Button = (_a) => {
|
|
|
4643
4643
|
size = "sm",
|
|
4644
4644
|
label,
|
|
4645
4645
|
icon,
|
|
4646
|
+
iconObj,
|
|
4646
4647
|
CustomSVGIcon,
|
|
4647
4648
|
fullWidth = false,
|
|
4648
4649
|
iconPosition = "trailing",
|
|
4649
4650
|
asLink,
|
|
4650
4651
|
isLoading = false,
|
|
4651
|
-
className
|
|
4652
|
+
className,
|
|
4653
|
+
ref
|
|
4652
4654
|
} = _b, props = __objRest(_b, [
|
|
4653
4655
|
"actionType",
|
|
4654
4656
|
"size",
|
|
4655
4657
|
"label",
|
|
4656
4658
|
"icon",
|
|
4659
|
+
"iconObj",
|
|
4657
4660
|
"CustomSVGIcon",
|
|
4658
4661
|
"fullWidth",
|
|
4659
4662
|
"iconPosition",
|
|
4660
4663
|
"asLink",
|
|
4661
4664
|
"isLoading",
|
|
4662
|
-
"className"
|
|
4665
|
+
"className",
|
|
4666
|
+
"ref"
|
|
4663
4667
|
]);
|
|
4664
4668
|
const iconStyles = cn5(
|
|
4665
4669
|
{ "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
|
|
@@ -4698,13 +4702,16 @@ var Button = (_a) => {
|
|
|
4698
4702
|
" 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 ": actionType === "danger"
|
|
4699
4703
|
},
|
|
4700
4704
|
className ? className : ""
|
|
4701
|
-
)
|
|
4705
|
+
),
|
|
4706
|
+
ref
|
|
4702
4707
|
}, props),
|
|
4703
4708
|
CustomSVGIcon && (isLoading ? /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }) : /* @__PURE__ */ React.createElement("i", null, CustomSVGIcon)),
|
|
4704
|
-
|
|
4709
|
+
iconObj && iconPosition === "leading" && (!isLoading ? /* @__PURE__ */ React.createElement(React.Fragment, null, iconObj) : /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) })),
|
|
4710
|
+
icon && iconPosition === "leading" && (isLoading ? /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }) : typeof icon === "string" ? /* @__PURE__ */ React.createElement(DynamicIcon, __spreadValues({}, { icon, className: iconStyles })) : /* @__PURE__ */ React.createElement(DynamicIcon, __spreadValues({}, __spreadProps(__spreadValues({}, icon), { className: iconStyles })))),
|
|
4705
4711
|
!icon && !CustomSVGIcon && isLoading && /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }),
|
|
4706
4712
|
label,
|
|
4707
|
-
icon && iconPosition === "trailing" && (isLoading ? /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }) : /* @__PURE__ */ React.createElement(DynamicIcon, __spreadValues({}, __spreadProps(__spreadValues({}, icon), { className: iconStyles }))))
|
|
4713
|
+
icon && iconPosition === "trailing" && (isLoading ? /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }) : typeof icon === "string" ? /* @__PURE__ */ React.createElement(DynamicIcon, __spreadValues({}, { icon, className: iconStyles })) : /* @__PURE__ */ React.createElement(DynamicIcon, __spreadValues({}, __spreadProps(__spreadValues({}, icon), { className: iconStyles })))),
|
|
4714
|
+
iconObj && iconPosition === "trailing" && (!isLoading ? /* @__PURE__ */ React.createElement(React.Fragment, null, iconObj) : /* @__PURE__ */ React.createElement("div", { className: cn5("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize) }))
|
|
4708
4715
|
);
|
|
4709
4716
|
};
|
|
4710
4717
|
var Button_default = Button;
|
|
@@ -5135,7 +5142,8 @@ var InputField = (_a) => {
|
|
|
5135
5142
|
required,
|
|
5136
5143
|
clientSideCheck = true,
|
|
5137
5144
|
placeholder,
|
|
5138
|
-
className
|
|
5145
|
+
className,
|
|
5146
|
+
ref
|
|
5139
5147
|
} = _b, rest = __objRest(_b, [
|
|
5140
5148
|
"type",
|
|
5141
5149
|
"id",
|
|
@@ -5149,16 +5157,19 @@ var InputField = (_a) => {
|
|
|
5149
5157
|
"required",
|
|
5150
5158
|
"clientSideCheck",
|
|
5151
5159
|
"placeholder",
|
|
5152
|
-
"className"
|
|
5160
|
+
"className",
|
|
5161
|
+
"ref"
|
|
5153
5162
|
]);
|
|
5154
5163
|
return /* @__PURE__ */ React11.createElement(
|
|
5155
5164
|
"input",
|
|
5156
5165
|
__spreadValues({}, __spreadValues({
|
|
5157
5166
|
type,
|
|
5158
5167
|
id: id2,
|
|
5168
|
+
ref,
|
|
5159
5169
|
name,
|
|
5160
5170
|
value,
|
|
5161
5171
|
onChange: (e) => {
|
|
5172
|
+
console.log(e);
|
|
5162
5173
|
handleChange(e.target.value);
|
|
5163
5174
|
},
|
|
5164
5175
|
autoFocus: isFocused,
|
|
@@ -5636,66 +5647,100 @@ var Dropdown = (_a) => {
|
|
|
5636
5647
|
"aria-labelledby": label
|
|
5637
5648
|
}), getFloatingProps()),
|
|
5638
5649
|
items.map((itemStack, idx) => {
|
|
5639
|
-
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: `${idx}-list-${id2}` }, itemStack.map(
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
5645
|
-
{
|
|
5646
|
-
"text-red-500": isEmphasized
|
|
5647
|
-
},
|
|
5648
|
-
{
|
|
5649
|
-
"text-gray-900": !isEmphasized
|
|
5650
|
-
},
|
|
5651
|
-
{
|
|
5652
|
-
"bg-gray-100 text-gray-900": active
|
|
5653
|
-
},
|
|
5654
|
-
active ? activeItemClassname : "",
|
|
5655
|
-
{
|
|
5656
|
-
"bg-gray-100 text-red-500 hover:text-red-500": active && isEmphasized
|
|
5657
|
-
},
|
|
5658
|
-
itemClassname
|
|
5659
|
-
);
|
|
5660
|
-
return /* @__PURE__ */ React17.createElement("li", { key }, /* @__PURE__ */ React17.createElement(
|
|
5661
|
-
"button",
|
|
5662
|
-
__spreadValues({}, __spreadValues({
|
|
5663
|
-
onClick: () => {
|
|
5664
|
-
setActiveItem(key);
|
|
5665
|
-
onClick && onClick();
|
|
5666
|
-
},
|
|
5650
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: `${idx}-list-${id2}` }, itemStack.map(
|
|
5651
|
+
(_a3) => {
|
|
5652
|
+
var _b3 = _a3, {
|
|
5653
|
+
onClick,
|
|
5654
|
+
label: label2,
|
|
5667
5655
|
key,
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
}
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5656
|
+
isEmphasized,
|
|
5657
|
+
icon,
|
|
5658
|
+
iconPosition
|
|
5659
|
+
} = _b3, rest = __objRest(_b3, [
|
|
5660
|
+
"onClick",
|
|
5661
|
+
"label",
|
|
5662
|
+
"key",
|
|
5663
|
+
"isEmphasized",
|
|
5664
|
+
"icon",
|
|
5665
|
+
"iconPosition"
|
|
5666
|
+
]);
|
|
5667
|
+
const active = activeItem && activeItem === key;
|
|
5668
|
+
const itemClass = cn19(
|
|
5669
|
+
itemClassname,
|
|
5670
|
+
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
5671
|
+
{
|
|
5672
|
+
"text-red-500": isEmphasized
|
|
5673
|
+
},
|
|
5674
|
+
{
|
|
5675
|
+
"text-gray-900": !isEmphasized
|
|
5676
|
+
},
|
|
5677
|
+
{
|
|
5678
|
+
"bg-gray-100 text-gray-900": active
|
|
5679
|
+
},
|
|
5680
|
+
active ? activeItemClassname : "",
|
|
5681
|
+
{
|
|
5682
|
+
"bg-gray-100 text-red-500 hover:text-red-500": active && isEmphasized
|
|
5683
|
+
},
|
|
5684
|
+
itemClassname
|
|
5685
|
+
);
|
|
5686
|
+
return /* @__PURE__ */ React17.createElement("li", { key }, /* @__PURE__ */ React17.createElement(
|
|
5687
|
+
"button",
|
|
5688
|
+
__spreadValues({}, __spreadValues({
|
|
5689
|
+
onClick: () => {
|
|
5690
|
+
setActiveItem(key);
|
|
5691
|
+
onClick && onClick();
|
|
5692
|
+
},
|
|
5693
|
+
key,
|
|
5694
|
+
className: cn19(itemClass, "w-full")
|
|
5695
|
+
}, rest)),
|
|
5696
|
+
/* @__PURE__ */ React17.createElement("div", { className: "flex items-center gap-x-4" }, icon && (iconPosition === "leading" || iconPosition === void 0) && (typeof icon === "string" ? /* @__PURE__ */ React17.createElement(
|
|
5697
|
+
DynamicIcon,
|
|
5698
|
+
__spreadValues({}, {
|
|
5699
|
+
icon,
|
|
5700
|
+
className: cn19(
|
|
5701
|
+
{
|
|
5702
|
+
"text-red-500": isEmphasized
|
|
5703
|
+
},
|
|
5704
|
+
"opacity-60 group"
|
|
5705
|
+
)
|
|
5706
|
+
})
|
|
5707
|
+
) : /* @__PURE__ */ React17.createElement(
|
|
5708
|
+
DynamicIcon,
|
|
5709
|
+
__spreadValues({}, __spreadProps(__spreadValues({}, icon), {
|
|
5710
|
+
className: cn19(
|
|
5711
|
+
icon.className,
|
|
5712
|
+
{
|
|
5713
|
+
"text-red-500": isEmphasized
|
|
5714
|
+
},
|
|
5715
|
+
"opacity-60 group"
|
|
5716
|
+
)
|
|
5717
|
+
}))
|
|
5718
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "whitespace-nowrap" }, label2), icon && iconPosition === "trailing" && (typeof icon === "string" ? /* @__PURE__ */ React17.createElement(
|
|
5719
|
+
DynamicIcon,
|
|
5720
|
+
__spreadValues({}, {
|
|
5721
|
+
icon,
|
|
5722
|
+
className: cn19(
|
|
5723
|
+
{
|
|
5724
|
+
"text-red-500": isEmphasized
|
|
5725
|
+
},
|
|
5726
|
+
"opacity-60 group"
|
|
5727
|
+
)
|
|
5728
|
+
})
|
|
5729
|
+
) : /* @__PURE__ */ React17.createElement(
|
|
5730
|
+
DynamicIcon,
|
|
5731
|
+
__spreadValues({}, __spreadProps(__spreadValues({}, icon), {
|
|
5732
|
+
className: cn19(
|
|
5733
|
+
icon.className,
|
|
5734
|
+
{
|
|
5735
|
+
"text-red-500": isEmphasized
|
|
5736
|
+
},
|
|
5737
|
+
"opacity-60 group"
|
|
5738
|
+
)
|
|
5739
|
+
}))
|
|
5740
|
+
)))
|
|
5741
|
+
));
|
|
5742
|
+
}
|
|
5743
|
+
));
|
|
5699
5744
|
})
|
|
5700
5745
|
)
|
|
5701
5746
|
)))
|