@agility/plenum-ui 2.0.2 → 2.0.4

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/tailwind.css CHANGED
@@ -50118,10 +50118,6 @@ select {
50118
50118
  background-color: rgb(128 102 20 / 0.95);
50119
50119
  }
50120
50120
 
50121
- .bg-label-gradient-idle {
50122
- background-image: linear-gradient(to top, #FFF 8px, transparent 8px);
50123
- }
50124
-
50125
50121
  .from-0\% {
50126
50122
  --tw-gradient-from-position: 0%;
50127
50123
  }
@@ -59098,11 +59094,7 @@ select {
59098
59094
  }
59099
59095
 
59100
59096
  .group:focus-within .group-focus-within\:\!bg-label-gradient-focus {
59101
- background-image: linear-gradient(to top, #FFF 9px, transparent 9px) !important;
59102
- }
59103
-
59104
- .group:focus-within .group-focus-within\:bg-label-gradient-focus {
59105
- background-image: linear-gradient(to top, #FFF 9px, transparent 9px);
59097
+ background-image: linear-gradient(to top, #FFF 10px, transparent 10px) !important;
59106
59098
  }
59107
59099
 
59108
59100
  .group:focus-within .group-focus-within\:\!text-xs {
@@ -13,6 +13,7 @@ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handle
13
13
  maxLength?: number;
14
14
  label: ILabelProps;
15
15
  handleChange: (value: string) => void;
16
+ labelClassName?: string;
16
17
  }
17
18
  declare const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps>;
18
19
  export default AnimatedLabelInput;
@@ -1,6 +1,7 @@
1
1
  import { IDynamicIconProps } from "@/stories/atoms/icons";
2
2
  import React from "react";
3
3
  import { IInputFieldProps, AcceptedInputTypes } from "@/stories/molecules/inputs/InputField";
4
+ import { INestedInputButtonProps } from "@/stories/molecules/inputs/NestedInputButton";
4
5
  export interface IFormInputWithAddonsProps extends Omit<IInputFieldProps, "type"> {
5
6
  leadIcon?: IDynamicIconProps;
6
7
  leadLabel?: string;
@@ -16,6 +17,7 @@ export interface IFormInputWithAddonsProps extends Omit<IInputFieldProps, "type"
16
17
  leadIconClassNames?: string;
17
18
  customIconClass?: string;
18
19
  type: AcceptedInputTypes;
20
+ addonBTN?: INestedInputButtonProps;
19
21
  }
20
22
  declare const FormInputWithAddons: React.FC<IFormInputWithAddonsProps>;
21
23
  export default FormInputWithAddons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -24,14 +24,14 @@ const InputLabel: FC<IInputLabelProps> = ({
24
24
  label
25
25
  }: IInputLabelProps) => {
26
26
  const labelStyles = cn(
27
- "z-[2] bg-label-gradient-idle group-focus-within:bg-label-gradient-focus",
28
- { "inline-block font-medium transition-all text-sm text-gray-700 ": !isPlaceholder },
27
+ "z-[2] ",
29
28
  { "inline-block font-medium ml-2 relative transition-all": isPlaceholder },
30
29
  { "text-sm text-gray-400 px-2 top-8": isPlaceholder && !isActive },
31
- { "text-xs text-gray-700 px-1 top-[10px] ": isPlaceholder && isActive },
32
- { "text-xs text-red-500 px-1 top-[10px] ": isPlaceholder && isError },
33
- { "text-red-500 ": !isPlaceholder && isError },
34
- { "text-gray-500/[.5]": isDisabled }
30
+ { "text-xs text-gray-700 px-1 top-[10px] bg-white": isPlaceholder && isActive },
31
+ { "text-xs text-red-500 px-1 top-[10px] bg-white": isPlaceholder && isError },
32
+ { "text-red-500 bg-white": !isPlaceholder && isError },
33
+ { "text-gray-500/[.5]": isDisabled },
34
+ { "inline-block font-medium transition-all text-sm text-gray-700 mb-1": !isPlaceholder }
35
35
  )
36
36
  if (!label) return null
37
37
  return (
@@ -27,7 +27,7 @@ const NestedInputButton: React.FC<INestedInputButtonProps> = ({
27
27
  onClickHandler && onClickHandler()
28
28
  }
29
29
  const buttonStyle = cn(
30
- "relative inline-flex items-center space-x-2 px-4 py-2 border border-gray-300 text-sm font-medium focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500",
30
+ "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
31
  {
32
32
  "rounded-r text-gray-500 -ml-px": align === "right"
33
33
  },
@@ -55,7 +55,7 @@ const NestedInputButton: React.FC<INestedInputButtonProps> = ({
55
55
  )
56
56
  return (
57
57
  <button {...{ ...buttonProps, className: buttonStyle, onClick: handleClick }}>
58
- {icon && <DynamicIcon {...{ ...icon, className: "text-gray-400" }} />}
58
+ {icon && <DynamicIcon {...{ ...icon, className: "text-gray-400 h-5 w-5" }} />}
59
59
  {ctaLabel && <span>{ctaLabel}</span>}
60
60
  </button>
61
61
  )
@@ -5,47 +5,34 @@ const meta: Meta<typeof AnimatedLabelInput> = {
5
5
  title: "Design System/organisms/Animated Label Input",
6
6
  component: AnimatedLabelInput,
7
7
  tags: ["autodocs"],
8
- argTypes: {},
9
- decorators: [
10
- (Story, context) => {
11
- if (context.name === "Default Animated Label Inputs Dark BG Story") {
12
- return (
13
- <div className="bg-transparent-black-03 p-6">
14
- <Story />
15
- </div>
16
- )
17
- }
18
- return <Story />
19
- }
20
- ]
8
+ argTypes: {}
9
+ }
10
+ const DefaultArgs: IAnimatedLabelInputProps = {
11
+ id: "test",
12
+ containerStyles: "w-full",
13
+ label: {
14
+ display: "Label with White BG"
15
+ },
16
+ handleChange: (value: string) => {
17
+ console.log(value)
18
+ },
19
+ type: "text",
20
+ value: ""
21
21
  }
22
22
 
23
23
  export default meta
24
24
  type Story = StoryObj<typeof AnimatedLabelInput>
25
- export const DefaultAnimatedLabelInputsStory: Story = {
26
- args: {
27
- id: "test",
28
- label: {
29
- display: "Label"
30
- }
31
- } as IAnimatedLabelInputProps
32
- }
33
- export const DefaultAnimatedLabelInputsDarkBGStory: Story = {
25
+
26
+ export const DefaultStory: Story = {
34
27
  args: {
35
- id: "test",
36
- label: {
37
- display: "Label with Dark BG"
38
- },
39
- value: "Value"
28
+ ...DefaultArgs
40
29
  } as IAnimatedLabelInputProps
41
30
  }
42
31
 
43
- export const DefaultAnimatedLabelInputsStoryWithPlaceHolder: Story = {
32
+ export const WithPlaceHolderStory: Story = {
44
33
  args: {
45
- id: "test",
46
- label: {
47
- display: "Label"
48
- },
34
+ ...DefaultArgs,
35
+ label: { display: "label with placeholder" },
49
36
  placeholder: "Placeholder"
50
37
  } as IAnimatedLabelInputProps
51
38
  }
@@ -17,6 +17,7 @@ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handle
17
17
  maxLength?: number
18
18
  label: ILabelProps
19
19
  handleChange: (value: string) => void
20
+ labelClassName?: string
20
21
  }
21
22
 
22
23
  const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
@@ -31,6 +32,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
31
32
  isShowCounter,
32
33
  maxLength,
33
34
  handleChange,
35
+ labelClassName,
34
36
  ...input
35
37
  } = props
36
38
 
@@ -53,7 +55,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
53
55
  />
54
56
  <div
55
57
  className={cn(
56
- "absolute z-10 ml-[3px] inline-block bg-label-gradient-idle text-sm transition-all text-gray-500 left-1 px-1",
58
+ "absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
57
59
  hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
58
60
  "peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
59
61
  "group-focus-within:!-top-[8px] group-focus-within:!bg-label-gradient-focus group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
@@ -61,7 +63,7 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
61
63
  isError && "!text-red-600"
62
64
  )}
63
65
  >
64
- <label htmlFor={id}>
66
+ <label htmlFor={id} className={labelClassName}>
65
67
  {label.display}
66
68
  {required && <span className="text-red-600 ml-1">*</span>}
67
69
  </label>
@@ -27,3 +27,22 @@ export const DefaultFormInputWithAddons: Story = {
27
27
  trailIcon: { icon: "IconSearch" }
28
28
  }
29
29
  }
30
+ export const FormInputWithAddonBTN: Story = {
31
+ args: {
32
+ id: "appSearch",
33
+ name: "appSearch",
34
+ addonOffset: 60,
35
+ labelClass: "text-gray-900",
36
+ addonBTN: {
37
+ icon: {
38
+ icon: "IconPencil",
39
+ className: "h-5 w-5 text-gray-400"
40
+ },
41
+ ctaLabel: "Edit",
42
+ align: "right",
43
+ onClickHandler: () => {
44
+ alert("Button Clicked")
45
+ }
46
+ }
47
+ }
48
+ }
@@ -2,6 +2,7 @@ import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms/icons"
2
2
  import React, { useLayoutEffect, useRef, useState } from "react"
3
3
  import { default as cn } from "classnames"
4
4
  import InputField, { IInputFieldProps, AcceptedInputTypes } from "@/stories/molecules/inputs/InputField"
5
+ import NestedInputButton, { INestedInputButtonProps } from "@/stories/molecules/inputs/NestedInputButton"
5
6
 
6
7
  export interface IFormInputWithAddonsProps extends Omit<IInputFieldProps, "type"> {
7
8
  leadIcon?: IDynamicIconProps
@@ -18,6 +19,7 @@ export interface IFormInputWithAddonsProps extends Omit<IInputFieldProps, "type"
18
19
  leadIconClassNames?: string
19
20
  customIconClass?: string
20
21
  type: AcceptedInputTypes
22
+ addonBTN?: INestedInputButtonProps
21
23
  }
22
24
 
23
25
  const FormInputWithAddons: React.FC<IFormInputWithAddonsProps> = ({
@@ -43,6 +45,7 @@ const FormInputWithAddons: React.FC<IFormInputWithAddonsProps> = ({
43
45
  leadIconClassNames,
44
46
  customIconClass,
45
47
  type,
48
+ addonBTN,
46
49
  ...rest
47
50
  }) => {
48
51
  // #region logic to determine the width of the lead and or trailing labels in order to offset the input padding by the appropriate amount.
@@ -137,6 +140,11 @@ const FormInputWithAddons: React.FC<IFormInputWithAddonsProps> = ({
137
140
  {trailLabel && trailLabel}
138
141
  </label>
139
142
  )}
143
+ {addonBTN && (
144
+ <div className="absolute top-0 bottom-0 right-0 flex items-center ">
145
+ <NestedInputButton {...addonBTN} />
146
+ </div>
147
+ )}
140
148
  </div>
141
149
  </div>
142
150
  )
@@ -40,8 +40,8 @@ module.exports = {
40
40
  },
41
41
  extend: {
42
42
  backgroundImage: (theme) => ({
43
- "label-gradient-focus": "linear-gradient(to top, #FFF 9px, transparent 9px)",
44
- "label-gradient-idle": "linear-gradient(to top, #FFF 8px, transparent 8px)"
43
+ "label-gradient-focus": "linear-gradient(to top, #FFF 10px, transparent 10px)",
44
+ "label-gradient-idle": "linear-gradient(to top, #FFF 10px, transparent 10px)"
45
45
  }),
46
46
  gridTemplateColumns: {
47
47
  // Simple 16 column grid