@agility/plenum-ui 2.0.0-rc2 → 2.0.0-rc3
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 +13 -11
- package/dist/index.js +105 -64
- 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/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/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;
|
|
@@ -824,14 +830,10 @@ declare module '@agility/plenum-ui/stories/organisms/DropdownComponent/DropdownC
|
|
|
824
830
|
import React, { HTMLAttributes } from "react";
|
|
825
831
|
import { Placement } from "@floating-ui/react";
|
|
826
832
|
import { ClassNameWithAutocomplete } from "utils/types";
|
|
827
|
-
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
833
|
+
import { IDynamicIconProps, UnifiedIconName } from "@/stories/atoms/icons";
|
|
828
834
|
export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
829
|
-
icon?:
|
|
830
|
-
|
|
831
|
-
className?: ClassNameWithAutocomplete;
|
|
832
|
-
pos?: "trailing" | "leading";
|
|
833
|
-
outline?: boolean;
|
|
834
|
-
};
|
|
835
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
836
|
+
iconPosition?: "trailing" | "leading";
|
|
835
837
|
label: string;
|
|
836
838
|
onClick?(): void;
|
|
837
839
|
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;
|
|
@@ -5636,66 +5643,100 @@ var Dropdown = (_a) => {
|
|
|
5636
5643
|
"aria-labelledby": label
|
|
5637
5644
|
}), getFloatingProps()),
|
|
5638
5645
|
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
|
-
},
|
|
5646
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: `${idx}-list-${id2}` }, itemStack.map(
|
|
5647
|
+
(_a3) => {
|
|
5648
|
+
var _b3 = _a3, {
|
|
5649
|
+
onClick,
|
|
5650
|
+
label: label2,
|
|
5667
5651
|
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
|
-
|
|
5652
|
+
isEmphasized,
|
|
5653
|
+
icon,
|
|
5654
|
+
iconPosition
|
|
5655
|
+
} = _b3, rest = __objRest(_b3, [
|
|
5656
|
+
"onClick",
|
|
5657
|
+
"label",
|
|
5658
|
+
"key",
|
|
5659
|
+
"isEmphasized",
|
|
5660
|
+
"icon",
|
|
5661
|
+
"iconPosition"
|
|
5662
|
+
]);
|
|
5663
|
+
const active = activeItem && activeItem === key;
|
|
5664
|
+
const itemClass = cn19(
|
|
5665
|
+
itemClassname,
|
|
5666
|
+
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
5667
|
+
{
|
|
5668
|
+
"text-red-500": isEmphasized
|
|
5669
|
+
},
|
|
5670
|
+
{
|
|
5671
|
+
"text-gray-900": !isEmphasized
|
|
5672
|
+
},
|
|
5673
|
+
{
|
|
5674
|
+
"bg-gray-100 text-gray-900": active
|
|
5675
|
+
},
|
|
5676
|
+
active ? activeItemClassname : "",
|
|
5677
|
+
{
|
|
5678
|
+
"bg-gray-100 text-red-500 hover:text-red-500": active && isEmphasized
|
|
5679
|
+
},
|
|
5680
|
+
itemClassname
|
|
5681
|
+
);
|
|
5682
|
+
return /* @__PURE__ */ React17.createElement("li", { key }, /* @__PURE__ */ React17.createElement(
|
|
5683
|
+
"button",
|
|
5684
|
+
__spreadValues({}, __spreadValues({
|
|
5685
|
+
onClick: () => {
|
|
5686
|
+
setActiveItem(key);
|
|
5687
|
+
onClick && onClick();
|
|
5688
|
+
},
|
|
5689
|
+
key,
|
|
5690
|
+
className: cn19(itemClass, "w-full")
|
|
5691
|
+
}, rest)),
|
|
5692
|
+
/* @__PURE__ */ React17.createElement("div", { className: "flex items-center gap-x-4" }, icon && (iconPosition === "leading" || iconPosition === void 0) && (typeof icon === "string" ? /* @__PURE__ */ React17.createElement(
|
|
5693
|
+
DynamicIcon,
|
|
5694
|
+
__spreadValues({}, {
|
|
5695
|
+
icon,
|
|
5696
|
+
className: cn19(
|
|
5697
|
+
{
|
|
5698
|
+
"text-red-500": isEmphasized
|
|
5699
|
+
},
|
|
5700
|
+
"opacity-60 group"
|
|
5701
|
+
)
|
|
5702
|
+
})
|
|
5703
|
+
) : /* @__PURE__ */ React17.createElement(
|
|
5704
|
+
DynamicIcon,
|
|
5705
|
+
__spreadValues({}, __spreadProps(__spreadValues({}, icon), {
|
|
5706
|
+
className: cn19(
|
|
5707
|
+
icon.className,
|
|
5708
|
+
{
|
|
5709
|
+
"text-red-500": isEmphasized
|
|
5710
|
+
},
|
|
5711
|
+
"opacity-60 group"
|
|
5712
|
+
)
|
|
5713
|
+
}))
|
|
5714
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "whitespace-nowrap" }, label2), icon && iconPosition === "trailing" && (typeof icon === "string" ? /* @__PURE__ */ React17.createElement(
|
|
5715
|
+
DynamicIcon,
|
|
5716
|
+
__spreadValues({}, {
|
|
5717
|
+
icon,
|
|
5718
|
+
className: cn19(
|
|
5719
|
+
{
|
|
5720
|
+
"text-red-500": isEmphasized
|
|
5721
|
+
},
|
|
5722
|
+
"opacity-60 group"
|
|
5723
|
+
)
|
|
5724
|
+
})
|
|
5725
|
+
) : /* @__PURE__ */ React17.createElement(
|
|
5726
|
+
DynamicIcon,
|
|
5727
|
+
__spreadValues({}, __spreadProps(__spreadValues({}, icon), {
|
|
5728
|
+
className: cn19(
|
|
5729
|
+
icon.className,
|
|
5730
|
+
{
|
|
5731
|
+
"text-red-500": isEmphasized
|
|
5732
|
+
},
|
|
5733
|
+
"opacity-60 group"
|
|
5734
|
+
)
|
|
5735
|
+
}))
|
|
5736
|
+
)))
|
|
5737
|
+
));
|
|
5738
|
+
}
|
|
5739
|
+
));
|
|
5699
5740
|
})
|
|
5700
5741
|
)
|
|
5701
5742
|
)))
|