@agility/plenum-ui 2.0.0 → 2.0.1

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
@@ -48800,6 +48800,10 @@ select {
48800
48800
  background-color: rgb(19 78 74 / 0.95);
48801
48801
  }
48802
48802
 
48803
+ .bg-transparent-black-03 {
48804
+ background-color: rgba(0, 0, 0, 0.03);
48805
+ }
48806
+
48803
48807
  .bg-violet-100 {
48804
48808
  --tw-bg-opacity: 1;
48805
48809
  background-color: rgb(237 233 254 / var(--tw-bg-opacity));
@@ -50105,6 +50109,10 @@ select {
50105
50109
  background-color: rgb(128 102 20 / 0.95);
50106
50110
  }
50107
50111
 
50112
+ .bg-label-gradient-idle {
50113
+ background-image: linear-gradient(to top, #FFF 8px, transparent 8px);
50114
+ }
50115
+
50108
50116
  .from-0\% {
50109
50117
  --tw-gradient-from-position: 0%;
50110
50118
  }
@@ -50205,6 +50213,10 @@ select {
50205
50213
  padding: 14rem;
50206
50214
  }
50207
50215
 
50216
+ .p-6 {
50217
+ padding: 1.5rem;
50218
+ }
50219
+
50208
50220
  .p-60 {
50209
50221
  padding: 15rem;
50210
50222
  }
@@ -58588,6 +58600,11 @@ select {
58588
58600
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
58589
58601
  }
58590
58602
 
58603
+ .\!ring-gray-300 {
58604
+ --tw-ring-opacity: 1 !important;
58605
+ --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)) !important;
58606
+ }
58607
+
58591
58608
  .\!ring-purple-500 {
58592
58609
  --tw-ring-opacity: 1 !important;
58593
58610
  --tw-ring-color: rgb(121 51 221 / var(--tw-ring-opacity)) !important;
@@ -59071,6 +59088,14 @@ select {
59071
59088
  margin-left: .172rem !important;
59072
59089
  }
59073
59090
 
59091
+ .group:focus-within .group-focus-within\:\!bg-label-gradient-focus {
59092
+ background-image: linear-gradient(to top, #FFF 9px, transparent 9px) !important;
59093
+ }
59094
+
59095
+ .group:focus-within .group-focus-within\:bg-label-gradient-focus {
59096
+ background-image: linear-gradient(to top, #FFF 9px, transparent 9px);
59097
+ }
59098
+
59074
59099
  .group:focus-within .group-focus-within\:\!text-xs {
59075
59100
  font-size: 0.75rem !important;
59076
59101
  line-height: 1rem !important;
@@ -22,6 +22,8 @@ export interface ICheckboxProps {
22
22
  hasBorder?: boolean;
23
23
  /** any arbitrary classNames to add to the wrapper */
24
24
  className?: string;
25
+ /** Label ClassName */
26
+ labelClassName?: string;
25
27
  }
26
28
  /** Comment */
27
29
  declare const Checkbox: FC<ICheckboxProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -80,4 +80,4 @@
80
80
  "react-dom": "18.2.0",
81
81
  "react-icons": "^4.10.1"
82
82
  }
83
- }
83
+ }
@@ -24,13 +24,13 @@ const InputLabel: FC<IInputLabelProps> = ({
24
24
  label
25
25
  }: IInputLabelProps) => {
26
26
  const labelStyles = cn(
27
- "z-[2]",
28
- { "inline-block font-medium transition-all text-sm text-gray-700 mb-1": !isPlaceholder },
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 },
29
29
  { "inline-block font-medium ml-2 relative transition-all": isPlaceholder },
30
30
  { "text-sm text-gray-400 px-2 top-8": isPlaceholder && !isActive },
31
- { "text-xs text-gray-700 px-1 top-[10px] bg-white": isPlaceholder && isActive },
32
- { "text-xs text-red-500 px-1 top-[10px] bg-white": isPlaceholder && isError },
33
- { "text-red-500 bg-white": !isPlaceholder && isError },
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
34
  { "text-gray-500/[.5]": isDisabled }
35
35
  )
36
36
  if (!label) return null
@@ -6,7 +6,19 @@ const meta: Meta<typeof TextInput> = {
6
6
  title: "Design System/molecules/inputs/TextInput",
7
7
  component: TextInput,
8
8
  tags: ["autodocs"],
9
- argTypes: {}
9
+ argTypes: {},
10
+ decorators: [
11
+ (Story, context) => {
12
+ if (context.name === "Default Text Input Story Dark BG") {
13
+ return (
14
+ <div className="bg-transparent-black-03 rounded p-6">
15
+ <Story />
16
+ </div>
17
+ )
18
+ }
19
+ return <Story />
20
+ }
21
+ ]
10
22
  }
11
23
 
12
24
  export default meta
@@ -30,3 +42,21 @@ export const DefaultTextInputStory: Story = {
30
42
  placeholder: "placeholder"
31
43
  }
32
44
  }
45
+ export const DefaultTextInputStoryDarkBG: Story = {
46
+ args: {
47
+ type: "text",
48
+ label: "Label",
49
+ isFocused: true,
50
+ isError: false,
51
+ id: "id",
52
+ name: "name",
53
+ isRequired: true,
54
+
55
+ isDisabled: false,
56
+ isReadonly: false,
57
+ message: "message",
58
+ isShowCounter: true,
59
+ maxLength: 100,
60
+ placeholder: "placeholder"
61
+ }
62
+ }
@@ -86,6 +86,7 @@ const TextInput = (
86
86
  } else {
87
87
  input.blur()
88
88
  }
89
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
90
  }, [isFocus])
90
91
 
91
92
  // set label as active if default value is set
@@ -103,7 +104,7 @@ const TextInput = (
103
104
  if (!name) name = id
104
105
 
105
106
  return (
106
- <div className="relative">
107
+ <div className="relative group">
107
108
  <InputLabel
108
109
  isPlaceholder={true}
109
110
  label={label}
@@ -128,13 +129,14 @@ const TextInput = (
128
129
  "w-full rounded border py-2 px-3 text-sm font-normal leading-5",
129
130
  { "border-gray-300": !isFocus && !isError && !isDisabled },
130
131
  {
131
- "!border-purple-500 shadow-none outline-purple-500 focus:!ring-purple-500": isFocus && !isError && !isDisabled
132
+ "!border-purple-500 shadow-none outline-purple-500 focus:!ring-purple-500":
133
+ isFocus && !isError && !isDisabled
132
134
  },
133
135
  {
134
136
  "!border-red-500 shadow-none focus:ring-red-500": isError
135
137
  },
136
138
  {
137
- "placeholder:text-gray-300 !border-gray-300 !outline-gray-300 focus:!ring-gray-300" : isDisabled
139
+ "placeholder:text-gray-300 !border-gray-300 !outline-gray-300 focus:!ring-gray-300": isDisabled
138
140
  },
139
141
  className
140
142
  )}
@@ -26,6 +26,8 @@ export interface ICheckboxProps {
26
26
  hasBorder?: boolean
27
27
  /** any arbitrary classNames to add to the wrapper */
28
28
  className?: string
29
+ /** Label ClassName */
30
+ labelClassName?: string
29
31
  }
30
32
 
31
33
  /** Comment */
@@ -41,6 +43,7 @@ const Checkbox: FC<ICheckboxProps> = ({
41
43
  onChange,
42
44
  hasBorder,
43
45
  className,
46
+ labelClassName,
44
47
  ...props
45
48
  }: ICheckboxProps) => {
46
49
  const uniqueID = useId()
@@ -83,9 +86,10 @@ const Checkbox: FC<ICheckboxProps> = ({
83
86
  />
84
87
  </div>
85
88
  <div className="ml-3 text-sm ">
86
- <label htmlFor={id} className="font-medium text-gray-700">
89
+ <>
87
90
  <InputLabel label={label} isRequired={isRequired} id={id} />
88
- </label>
91
+ </>
92
+
89
93
  {message && (
90
94
  <p id={`${id}-description`} className="text-gray-500">
91
95
  {message}
@@ -0,0 +1,53 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import Select from "./Select"
3
+
4
+ const meta: Meta<typeof Select> = {
5
+ title: "Design System/Molecules/Inputs/Select",
6
+ component: Select,
7
+ tags: ["autodocs"],
8
+ argTypes: {},
9
+ decorators: [
10
+ (Story, context) => {
11
+ if (context.name === "Default Select Dark BG") {
12
+ return (
13
+ <div className="bg-transparent-black-03 rounded p-6">
14
+ <Story />
15
+ </div>
16
+ )
17
+ }
18
+ return <Story />
19
+ }
20
+ ]
21
+ }
22
+
23
+ export default meta
24
+ type TStory = StoryObj<typeof Select>
25
+
26
+ export const DefaultSelect: TStory = {
27
+ args: {
28
+ label: "Label",
29
+ id: "select",
30
+ name: "select",
31
+ options: [
32
+ { label: "Canada", value: "value1" },
33
+ { label: "USA", value: "value2" }
34
+ ],
35
+ isDisabled: false,
36
+ isError: false,
37
+ isRequired: false
38
+ }
39
+ }
40
+ export const DefaultSelectDarkBG: TStory = {
41
+ args: {
42
+ label: "Label",
43
+ id: "select",
44
+ name: "select",
45
+ options: [
46
+ { label: "Canada", value: "value1" },
47
+ { label: "USA", value: "value2" }
48
+ ],
49
+ isDisabled: false,
50
+ isError: false,
51
+ isRequired: false
52
+ }
53
+ }
@@ -63,7 +63,7 @@ const Select: React.FC<ISelectProps> = ({
63
63
  typeof onChange == "function" && onChange(targetValue)
64
64
  setSelectedOption(targetValue)
65
65
  }
66
- const wrapperStyle = cn({ "opacity-50": isDisabled })
66
+ const wrapperStyle = cn("group", { "opacity-50": isDisabled })
67
67
  return (
68
68
  <div className={wrapperStyle}>
69
69
  {label && (
@@ -3,7 +3,20 @@ import Textarea from "./TextArea"
3
3
  const meta: Meta<typeof Textarea> = {
4
4
  title: "Design System/Molecules/Inputs/TextArea",
5
5
  component: Textarea,
6
- tags: ["autodocs"]
6
+ tags: ["autodocs"],
7
+ argTypes: {},
8
+ decorators: [
9
+ (Story, context) => {
10
+ if (context.name === "Default Textarea Dark BG") {
11
+ return (
12
+ <div className="bg-transparent-black-03 rounded p-6">
13
+ <Story />
14
+ </div>
15
+ )
16
+ }
17
+ return <Story />
18
+ }
19
+ ]
7
20
  }
8
21
  const dummyText: string = `Checkmate... Life finds a way. Is this my espresso machine? Wh-what is-h-how did you get my espresso machine? You're a very talented young man, with your own clever thoughts and ideas. Do you need a manager? Is this my espresso machine? Wh-what is-h-how did you get my espresso machine?
9
22
 
@@ -19,4 +32,14 @@ export const DefaultTextarea: Story = {
19
32
  placeholder: dummyText
20
33
  }
21
34
  }
35
+ export const DefaultTextareaDarkBG: Story = {
36
+ args: {
37
+ id: "appDescription",
38
+ name: "description",
39
+ rows: 12,
40
+ cols: 18,
41
+ label: { display: "Description" },
42
+ placeholder: dummyText
43
+ }
44
+ }
22
45
  export default meta
@@ -103,7 +103,7 @@ const Textarea: React.FC<ITextareaProps> = ({
103
103
 
104
104
  //with label
105
105
  return (
106
- <div>
106
+ <div className="group">
107
107
  <InputLabel
108
108
  isPlaceholder
109
109
  isActive
@@ -5,7 +5,19 @@ const meta: Meta<typeof AnimatedLabelInput> = {
5
5
  title: "Design System/organisms/Animated Label Input",
6
6
  component: AnimatedLabelInput,
7
7
  tags: ["autodocs"],
8
- argTypes: {}
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
+ ]
9
21
  }
10
22
 
11
23
  export default meta
@@ -18,6 +30,15 @@ export const DefaultAnimatedLabelInputsStory: Story = {
18
30
  }
19
31
  } as IAnimatedLabelInputProps
20
32
  }
33
+ export const DefaultAnimatedLabelInputsDarkBGStory: Story = {
34
+ args: {
35
+ id: "test",
36
+ label: {
37
+ display: "Label with Dark BG"
38
+ },
39
+ value: "Value"
40
+ } as IAnimatedLabelInputProps
41
+ }
21
42
 
22
43
  export const DefaultAnimatedLabelInputsStoryWithPlaceHolder: Story = {
23
44
  args: {
@@ -20,7 +20,19 @@ export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handle
20
20
  }
21
21
 
22
22
  const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
23
- const { id, containerStyles, message, required, isError, label, value, isShowCounter, maxLength, handleChange, ...input } = props
23
+ const {
24
+ id,
25
+ containerStyles,
26
+ message,
27
+ required,
28
+ isError,
29
+ label,
30
+ value,
31
+ isShowCounter,
32
+ maxLength,
33
+ handleChange,
34
+ ...input
35
+ } = props
24
36
 
25
37
  const [hasValue, setHasValue] = React.useState<boolean>(!!value)
26
38
  const [valueLength, setValueLength] = React.useState<number>(0)
@@ -39,20 +51,21 @@ const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimated
39
51
  }}
40
52
  {...input}
41
53
  />
42
- <label
54
+ <div
43
55
  className={cn(
44
- "absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
56
+ "absolute z-10 ml-[3px] inline-block bg-label-gradient-idle text-sm transition-all text-gray-500 left-1 px-1",
45
57
  hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
46
58
  "peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
47
- "group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
59
+ "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",
48
60
 
49
61
  isError && "!text-red-600"
50
62
  )}
51
- htmlFor={id}
52
63
  >
53
- {label.display}
54
- {required && <span className="text-red-600 ml-1">*</span>}
55
- </label>
64
+ <label htmlFor={id}>
65
+ {label.display}
66
+ {required && <span className="text-red-600 ml-1">*</span>}
67
+ </label>
68
+ </div>
56
69
 
57
70
  <div className="flex flex-row space-x-3">
58
71
  <div className="grow">
@@ -39,6 +39,10 @@ module.exports = {
39
39
  mulish: ["Mulish", "sans-serif"]
40
40
  },
41
41
  extend: {
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)"
45
+ }),
42
46
  gridTemplateColumns: {
43
47
  // Simple 16 column grid
44
48
  mainContainer: "max-content 1fr 1fr"
@@ -59,6 +63,7 @@ module.exports = {
59
63
  "transparent-white-80": "rgba(255, 255, 255, 0.8)",
60
64
  "transparent-white-90": "rgba(255, 255, 255, 0.9)",
61
65
 
66
+ "transparent-black-03": "rgba(0, 0, 0, 0.03)",
62
67
  "transparent-black-05": "rgba(0, 0, 0, 0.05)",
63
68
  "transparent-black-10": "rgba(0, 0, 0, 0.1)",
64
69
  "transparent-black-20": "rgba(0, 0, 0, 0.2)",
@@ -229,6 +234,58 @@ module.exports = {
229
234
  "7xl": ["4.5rem", "4.5rem"],
230
235
  "8xl": ["6rem", "6rem"],
231
236
  "9xl": ["8rem", "8rem"]
237
+ },
238
+ animation: {
239
+ enter: "fadeInLeft 300ms ease-out",
240
+ exit: "fadeOutLeft 300ms ease-in forwards",
241
+ quickBounce: "quickBounce 200ms ease-out forwards",
242
+ fadeIn: "fadeIn 400ms ease-in-out forwards"
243
+ },
244
+
245
+ keyframes: {
246
+ fadeIn: {
247
+ "0%": {
248
+ opacity: "0"
249
+ },
250
+ "100%": {
251
+ opacity: "1"
252
+ }
253
+ },
254
+ fadeInLeft: {
255
+ "0%": {
256
+ opacity: "0",
257
+ transform: "translate(-2rem)"
258
+ },
259
+ "100%": {
260
+ opacity: "1",
261
+ transform: "translate(0)"
262
+ }
263
+ },
264
+ quickBounce: {
265
+ "0%": {
266
+ transform: "translateY(0px)"
267
+ },
268
+ "50%": {
269
+ transform: "translateY(-8px)"
270
+ },
271
+ "100%": {
272
+ transform: "translateY(-4px)"
273
+ }
274
+ },
275
+ fadeOutLeft: {
276
+ "0%": {
277
+ opacity: "1",
278
+ transform: "translate(0)"
279
+ },
280
+ "100%": {
281
+ opacity: "0",
282
+ transform: "translate(-2rem)"
283
+ }
284
+ }
285
+ },
286
+ transitionProperty: {
287
+ left: "left",
288
+ height: "height"
232
289
  }
233
290
  }
234
291
  },
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import Select from "./Select";
3
- declare const meta: Meta<typeof Select>;
4
- type Story = StoryObj<typeof Select>;
5
- export declare const DefaultSelect: Story;
6
- export default meta;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import Textarea from "./TextArea";
3
- declare const meta: Meta<typeof Textarea>;
4
- type Story = StoryObj<typeof Textarea>;
5
- export declare const DefaultTextarea: Story;
6
- export default meta;
@@ -1,23 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import Select from "./Select"
3
- const meta: Meta<typeof Select> = {
4
- title: "Design System/Molecules/Inputs/Select",
5
- component: Select,
6
- tags: ["autodocs"]
7
- }
8
- type Story = StoryObj<typeof Select>
9
- export const DefaultSelect: Story = {
10
- args: {
11
- label: "Label",
12
- id: "select",
13
- name: "select",
14
- options: [
15
- { label: "Canada", value: "value1" },
16
- { label: "USA", value: "value2" }
17
- ],
18
- isDisabled: false,
19
- isError: false,
20
- isRequired: false
21
- }
22
- }
23
- export default meta