@agility/plenum-ui 2.0.0-rc17 → 2.0.0-rc18
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/README.md +32 -10
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +0 -41
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +5 -1
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +2 -0
- package/package.json +1 -1
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -1
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +1 -1
- package/stories/molecules/inputs/textArea/TextArea.tsx +8 -2
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +2 -2
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +1 -1
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +72 -89
package/dist/tailwind.css
CHANGED
|
@@ -2009,18 +2009,6 @@ select {
|
|
|
2009
2009
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2010
2010
|
}
|
|
2011
2011
|
|
|
2012
|
-
.scale-100 {
|
|
2013
|
-
--tw-scale-x: 1;
|
|
2014
|
-
--tw-scale-y: 1;
|
|
2015
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
.scale-95 {
|
|
2019
|
-
--tw-scale-x: .95;
|
|
2020
|
-
--tw-scale-y: .95;
|
|
2021
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
2012
|
.transform {
|
|
2025
2013
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2026
2014
|
}
|
|
@@ -63010,14 +62998,6 @@ select {
|
|
|
63010
62998
|
color: rgb(128 102 20 / 0.95);
|
|
63011
62999
|
}
|
|
63012
63000
|
|
|
63013
|
-
.opacity-0 {
|
|
63014
|
-
opacity: 0;
|
|
63015
|
-
}
|
|
63016
|
-
|
|
63017
|
-
.opacity-100 {
|
|
63018
|
-
opacity: 1;
|
|
63019
|
-
}
|
|
63020
|
-
|
|
63021
63001
|
.opacity-50 {
|
|
63022
63002
|
opacity: 0.5;
|
|
63023
63003
|
}
|
|
@@ -63097,11 +63077,6 @@ select {
|
|
|
63097
63077
|
--tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity));
|
|
63098
63078
|
}
|
|
63099
63079
|
|
|
63100
|
-
.ring-gray-300 {
|
|
63101
|
-
--tw-ring-opacity: 1;
|
|
63102
|
-
--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
|
|
63103
|
-
}
|
|
63104
|
-
|
|
63105
63080
|
.ring-red-500 {
|
|
63106
63081
|
--tw-ring-opacity: 1;
|
|
63107
63082
|
--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity));
|
|
@@ -63156,22 +63131,6 @@ select {
|
|
|
63156
63131
|
transition-duration: 150ms;
|
|
63157
63132
|
}
|
|
63158
63133
|
|
|
63159
|
-
.duration-100 {
|
|
63160
|
-
transition-duration: 100ms;
|
|
63161
|
-
}
|
|
63162
|
-
|
|
63163
|
-
.duration-75 {
|
|
63164
|
-
transition-duration: 75ms;
|
|
63165
|
-
}
|
|
63166
|
-
|
|
63167
|
-
.ease-in {
|
|
63168
|
-
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
|
|
63169
|
-
}
|
|
63170
|
-
|
|
63171
|
-
.ease-out {
|
|
63172
|
-
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
63173
|
-
}
|
|
63174
|
-
|
|
63175
63134
|
.focus-within\:z-10:focus-within {
|
|
63176
63135
|
z-index: 10;
|
|
63177
63136
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
3
|
+
display: string;
|
|
4
|
+
htmlFor?: string;
|
|
5
|
+
}
|
|
2
6
|
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
3
7
|
/** Input ID */
|
|
4
8
|
id?: string;
|
|
5
9
|
/** Input Name */
|
|
6
10
|
name?: string;
|
|
7
11
|
/** Label for the input */
|
|
8
|
-
label?:
|
|
12
|
+
label?: ILabelProps;
|
|
9
13
|
/** Error state */
|
|
10
14
|
isError?: boolean;
|
|
11
15
|
/** If field is required */
|
|
@@ -21,6 +21,7 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
21
21
|
activeItemClassname?: ClassNameWithAutocomplete;
|
|
22
22
|
buttonClassname?: ClassNameWithAutocomplete;
|
|
23
23
|
iconClassname?: ClassNameWithAutocomplete;
|
|
24
|
+
iconSpacingClassname?: ClassNameWithAutocomplete;
|
|
24
25
|
placement?: Placement;
|
|
25
26
|
offsetOptions?: Partial<{
|
|
26
27
|
mainAxis: number;
|
|
@@ -35,6 +36,7 @@ export declare const defaultClassNames: {
|
|
|
35
36
|
activeItemClassname: string;
|
|
36
37
|
buttonClassname: string;
|
|
37
38
|
iconClassname: string;
|
|
39
|
+
iconSpacingClassname: string;
|
|
38
40
|
};
|
|
39
41
|
/** Comment */
|
|
40
42
|
declare const Dropdown: React.FC<IDropdownProps>;
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ const Checkbox: FC<ICheckboxProps> = ({
|
|
|
53
53
|
const wrapperStyles = cn(
|
|
54
54
|
"relative flex items-center min-h-[38px]",
|
|
55
55
|
{ "opacity-50": isDisabled },
|
|
56
|
-
{ "rounded-sm
|
|
56
|
+
{ "rounded-sm border border-1 px-3 border-gray-200": hasBorder },
|
|
57
57
|
{ "py-3": hasBorder && message },
|
|
58
58
|
className
|
|
59
59
|
)
|
|
@@ -2,13 +2,19 @@ import React, { forwardRef, useEffect, useId, useState } from "react"
|
|
|
2
2
|
import { default as cn } from "classnames"
|
|
3
3
|
import InputLabel from "../InputLabel"
|
|
4
4
|
import InputCounter from "../InputCounter"
|
|
5
|
+
|
|
6
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
7
|
+
display: string
|
|
8
|
+
htmlFor?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
6
12
|
/** Input ID */
|
|
7
13
|
id?: string
|
|
8
14
|
/** Input Name */
|
|
9
15
|
name?: string
|
|
10
16
|
/** Label for the input */
|
|
11
|
-
label?:
|
|
17
|
+
label?: ILabelProps
|
|
12
18
|
/** Error state */
|
|
13
19
|
isError?: boolean
|
|
14
20
|
/** If field is required */
|
|
@@ -101,7 +107,7 @@ const Textarea: React.FC<ITextareaProps> = ({
|
|
|
101
107
|
<InputLabel
|
|
102
108
|
isPlaceholder
|
|
103
109
|
isActive
|
|
104
|
-
label={label}
|
|
110
|
+
label={label.display}
|
|
105
111
|
isRequired={isRequired}
|
|
106
112
|
id={id}
|
|
107
113
|
isError={isError}
|
|
@@ -39,9 +39,9 @@ const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps> = (props: IAn
|
|
|
39
39
|
|
|
40
40
|
isError && "!text-red-600"
|
|
41
41
|
)}
|
|
42
|
-
htmlFor={id}
|
|
42
|
+
htmlFor={label?.htmlFor || id}
|
|
43
43
|
>
|
|
44
|
-
{label}
|
|
44
|
+
{label?.display}
|
|
45
45
|
{required && <span className="text-red-600 ml-1">*</span>}
|
|
46
46
|
</label>
|
|
47
47
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Transition } from "@headlessui/react"
|
|
1
|
+
import React, { HTMLAttributes, useState } from "react"
|
|
3
2
|
import { default as cn } from "classnames"
|
|
4
3
|
import {
|
|
5
4
|
useFloating,
|
|
@@ -39,6 +38,7 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
39
38
|
activeItemClassname?: ClassNameWithAutocomplete
|
|
40
39
|
buttonClassname?: ClassNameWithAutocomplete
|
|
41
40
|
iconClassname?: ClassNameWithAutocomplete
|
|
41
|
+
iconSpacingClassname?: ClassNameWithAutocomplete
|
|
42
42
|
placement?: Placement
|
|
43
43
|
offsetOptions?: Partial<{
|
|
44
44
|
mainAxis: number
|
|
@@ -54,8 +54,9 @@ export const defaultClassNames = {
|
|
|
54
54
|
"group flex font-muli cursor-pointer items-center px-4 py-2 text-sm transition-all hover:bg-gray-100 hover:text-gray-900 justify-between gap-4 ",
|
|
55
55
|
activeItemClassname: "block px-4 py-2 text-sm text-gray-700 bg-gray-100 hover:bg-gray-200 hover:text-gray-900",
|
|
56
56
|
buttonClassname:
|
|
57
|
-
"py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all
|
|
58
|
-
iconClassname: "ml-1 h-5 w-6"
|
|
57
|
+
"py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all text-gray-400 hover:text-gray-600 ",
|
|
58
|
+
iconClassname: "ml-1 h-5 w-6",
|
|
59
|
+
iconSpacingClassname: "flex items-center gap-x-4"
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/** Comment */
|
|
@@ -63,12 +64,13 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
63
64
|
items,
|
|
64
65
|
id,
|
|
65
66
|
label,
|
|
66
|
-
groupClassname
|
|
67
|
-
itemsClassname
|
|
68
|
-
itemClassname
|
|
69
|
-
activeItemClassname
|
|
70
|
-
buttonClassname
|
|
71
|
-
iconClassname
|
|
67
|
+
groupClassname,
|
|
68
|
+
itemsClassname,
|
|
69
|
+
itemClassname,
|
|
70
|
+
activeItemClassname,
|
|
71
|
+
buttonClassname,
|
|
72
|
+
iconClassname,
|
|
73
|
+
iconSpacingClassname,
|
|
72
74
|
CustomDropdownTrigger,
|
|
73
75
|
placement = "bottom-start",
|
|
74
76
|
offsetOptions,
|
|
@@ -111,7 +113,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
111
113
|
return (
|
|
112
114
|
<div
|
|
113
115
|
{...{
|
|
114
|
-
className: groupClassname,
|
|
116
|
+
className: cn(defaultClassNames.groupClassname, groupClassname),
|
|
115
117
|
role: "combobox",
|
|
116
118
|
"aria-owns": `${id}-list`,
|
|
117
119
|
"aria-expanded": isOpen,
|
|
@@ -122,7 +124,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
122
124
|
<button
|
|
123
125
|
{...{
|
|
124
126
|
ref: refs.setReference,
|
|
125
|
-
className: buttonClassname,
|
|
127
|
+
className: cn(defaultClassNames.buttonClassname, buttonClassname),
|
|
126
128
|
onClick: () => {
|
|
127
129
|
setIsOpen(!isOpen)
|
|
128
130
|
},
|
|
@@ -134,7 +136,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
134
136
|
) : (
|
|
135
137
|
<>
|
|
136
138
|
<span className="pl-1">{label}</span>
|
|
137
|
-
<DynamicIcon icon="ChevronDownIcon" className={iconClassname} />
|
|
139
|
+
<DynamicIcon icon="ChevronDownIcon" className={cn(defaultClassNames.iconClassname, iconClassname)} />
|
|
138
140
|
</>
|
|
139
141
|
)}
|
|
140
142
|
</button>
|
|
@@ -142,39 +144,22 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
142
144
|
{isMounted && items.length > 0 && isOpen && (
|
|
143
145
|
<FloatingPortal>
|
|
144
146
|
<FloatingFocusManager context={context} modal={true}>
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
<div
|
|
148
|
+
{...getFloatingProps()}
|
|
149
|
+
className={cn(defaultClassNames.itemsClassname, itemsClassname)}
|
|
150
|
+
ref={refs.setFloating}
|
|
151
|
+
aria-labelledby={label}
|
|
152
|
+
style={{
|
|
153
|
+
position: context.strategy,
|
|
154
|
+
top: Math.round(context.y ?? 0),
|
|
155
|
+
left: Math.round(context.x ?? 0),
|
|
156
|
+
width: "max-content",
|
|
157
|
+
maxWidth: "min(calc(100vw - 10px), 25rem)",
|
|
158
|
+
...floatingStyles,
|
|
159
|
+
}}
|
|
154
160
|
>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
...getFloatingProps(),
|
|
158
|
-
className: itemsClassname,
|
|
159
|
-
ref: refs.setFloating,
|
|
160
|
-
// style: floatingStyles,
|
|
161
|
-
"aria-labelledby": label,
|
|
162
|
-
id: `${id}-list`,
|
|
163
|
-
role: "listbox",
|
|
164
|
-
style: {
|
|
165
|
-
position: context.strategy,
|
|
166
|
-
top: Math.round(context.y ?? 0),
|
|
167
|
-
left: Math.round(context.x ?? 0),
|
|
168
|
-
width: "max-content",
|
|
169
|
-
maxWidth: "min(calc(100vw - 10px), 25rem)",
|
|
170
|
-
...floatingStyles
|
|
171
|
-
}
|
|
172
|
-
}}
|
|
173
|
-
className={itemsClassname}
|
|
174
|
-
ref={refs.setFloating}
|
|
175
|
-
aria-labelledby={label}
|
|
176
|
-
{...getFloatingProps()}
|
|
177
|
-
>
|
|
161
|
+
|
|
162
|
+
<ul id={`${id}-list`} role="listbox" style={{...transitionStyles}}>
|
|
178
163
|
{items.map((itemStack, idx) => {
|
|
179
164
|
return (
|
|
180
165
|
<React.Fragment key={`${idx}-list-${id}`}>
|
|
@@ -187,9 +172,10 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
187
172
|
icon,
|
|
188
173
|
iconPosition,
|
|
189
174
|
...rest
|
|
190
|
-
}) => {
|
|
175
|
+
}, idx) => {
|
|
191
176
|
const active = activeItem && activeItem === key
|
|
192
177
|
const itemClass = cn(
|
|
178
|
+
defaultClassNames.itemClassname,
|
|
193
179
|
itemClassname,
|
|
194
180
|
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
195
181
|
{
|
|
@@ -201,16 +187,13 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
201
187
|
{
|
|
202
188
|
"bg-gray-100 text-gray-900": active
|
|
203
189
|
},
|
|
204
|
-
active ? activeItemClassname : "",
|
|
190
|
+
active ? cn(defaultClassNames.activeItemClassname, activeItemClassname) : "",
|
|
205
191
|
{
|
|
206
192
|
"bg-gray-100 text-red-500 hover:text-red-500":
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return (
|
|
213
|
-
<li key={key}>
|
|
193
|
+
active && isEmphasized
|
|
194
|
+
})
|
|
195
|
+
return (
|
|
196
|
+
<li key={`${key}-${idx}`}>
|
|
214
197
|
<button
|
|
215
198
|
{...{
|
|
216
199
|
onClick: () => {
|
|
@@ -222,53 +205,53 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
222
205
|
...rest
|
|
223
206
|
}}
|
|
224
207
|
>
|
|
225
|
-
<div className=
|
|
208
|
+
<div className={cn(defaultClassNames.iconSpacingClassname, iconSpacingClassname)}>
|
|
226
209
|
{icon &&
|
|
227
210
|
(iconPosition === "leading" ||
|
|
228
|
-
|
|
211
|
+
iconPosition === undefined) &&
|
|
229
212
|
(typeof icon === "string" ? (
|
|
230
213
|
<DynamicIcon
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
214
|
+
{...{
|
|
215
|
+
icon: icon,
|
|
216
|
+
className: cn(
|
|
217
|
+
{
|
|
218
|
+
"text-red-500": isEmphasized
|
|
219
|
+
},
|
|
220
|
+
"opacity-60 group"
|
|
238
221
|
)
|
|
239
222
|
}}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
223
|
+
/>
|
|
224
|
+
) : (
|
|
225
|
+
<DynamicIcon
|
|
226
|
+
{...{
|
|
227
|
+
...icon,
|
|
228
|
+
className: cn(
|
|
229
|
+
icon.className,
|
|
247
230
|
{
|
|
248
231
|
"text-red-500": isEmphasized
|
|
249
232
|
},
|
|
250
233
|
"opacity-60 group"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
234
|
+
)
|
|
235
|
+
}}
|
|
236
|
+
/>
|
|
237
|
+
))}
|
|
255
238
|
<div className="whitespace-nowrap">{label}</div>
|
|
256
239
|
{icon &&
|
|
257
240
|
iconPosition === "trailing" &&
|
|
258
241
|
(typeof icon === "string" ? (
|
|
259
242
|
<DynamicIcon
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
243
|
+
{...{
|
|
244
|
+
icon: icon,
|
|
245
|
+
className: cn(
|
|
246
|
+
{
|
|
247
|
+
"text-red-500": isEmphasized
|
|
248
|
+
},
|
|
249
|
+
"opacity-60 group"
|
|
267
250
|
)
|
|
268
251
|
}}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
252
|
+
/>
|
|
253
|
+
) : (
|
|
254
|
+
<DynamicIcon
|
|
272
255
|
{...{
|
|
273
256
|
...icon,
|
|
274
257
|
className: cn(
|
|
@@ -277,10 +260,10 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
277
260
|
"text-red-500": isEmphasized
|
|
278
261
|
},
|
|
279
262
|
"opacity-60 group"
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
263
|
+
)
|
|
264
|
+
}}
|
|
265
|
+
/>
|
|
266
|
+
))}
|
|
284
267
|
</div>
|
|
285
268
|
</button>
|
|
286
269
|
</li>
|
|
@@ -291,7 +274,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
291
274
|
)
|
|
292
275
|
})}
|
|
293
276
|
</ul>
|
|
294
|
-
</
|
|
277
|
+
</div>
|
|
295
278
|
</FloatingFocusManager>
|
|
296
279
|
</FloatingPortal>
|
|
297
280
|
)}
|