@agility/plenum-ui 2.3.1 → 2.3.3
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/.claude/settings.local.json +6 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +25 -0
- package/dist/types/stories/atoms/Typography/Paragraph/Paragraph.d.ts +2 -2
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +4 -1
- package/package.json +1 -1
- package/stories/atoms/Typography/Paragraph/Paragraph.tsx +3 -3
- package/stories/atoms/icons/TablerIcon.tsx +3 -2
- package/stories/molecules/inputs/select/Select.stories.tsx +8 -2
- package/stories/molecules/inputs/select/Select.tsx +44 -9
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +15 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +46 -21
package/dist/tailwind.css
CHANGED
|
@@ -2037,10 +2037,18 @@ select {
|
|
|
2037
2037
|
width: 100%;
|
|
2038
2038
|
}
|
|
2039
2039
|
|
|
2040
|
+
.min-w-0 {
|
|
2041
|
+
min-width: 0px;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2040
2044
|
.min-w-\[320px\] {
|
|
2041
2045
|
min-width: 320px;
|
|
2042
2046
|
}
|
|
2043
2047
|
|
|
2048
|
+
.flex-1 {
|
|
2049
|
+
flex: 1 1 0%;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2044
2052
|
.shrink-0 {
|
|
2045
2053
|
flex-shrink: 0;
|
|
2046
2054
|
}
|
|
@@ -3263,6 +3271,10 @@ select {
|
|
|
3263
3271
|
border-width: 1px;
|
|
3264
3272
|
}
|
|
3265
3273
|
|
|
3274
|
+
.border-0 {
|
|
3275
|
+
border-width: 0px;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3266
3278
|
.border-2 {
|
|
3267
3279
|
border-width: 2px;
|
|
3268
3280
|
}
|
|
@@ -67519,6 +67531,10 @@ select {
|
|
|
67519
67531
|
stroke-width: 1.5;
|
|
67520
67532
|
}
|
|
67521
67533
|
|
|
67534
|
+
.p-0 {
|
|
67535
|
+
padding: 0px;
|
|
67536
|
+
}
|
|
67537
|
+
|
|
67522
67538
|
.p-10 {
|
|
67523
67539
|
padding: 2.5rem;
|
|
67524
67540
|
}
|
|
@@ -71727,6 +71743,11 @@ select {
|
|
|
71727
71743
|
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
71728
71744
|
}
|
|
71729
71745
|
|
|
71746
|
+
.text-neutral-700 {
|
|
71747
|
+
--tw-text-opacity: 1;
|
|
71748
|
+
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
71749
|
+
}
|
|
71750
|
+
|
|
71730
71751
|
.text-orange-100 {
|
|
71731
71752
|
--tw-text-opacity: 1;
|
|
71732
71753
|
color: rgb(255 237 213 / var(--tw-text-opacity, 1));
|
|
@@ -79012,6 +79033,10 @@ select {
|
|
|
79012
79033
|
--anchor-gap: 8px;
|
|
79013
79034
|
}
|
|
79014
79035
|
|
|
79036
|
+
.\!\[max-width\:var\(--dropdown-max-width\)\] {
|
|
79037
|
+
max-width: var(--dropdown-max-width) !important;
|
|
79038
|
+
}
|
|
79039
|
+
|
|
79015
79040
|
.placeholder\:text-gray-400::-moz-placeholder {
|
|
79016
79041
|
--tw-text-opacity: 1;
|
|
79017
79042
|
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
type ParagraphAs = "span" | "p" | "label" | "strong" | "em";
|
|
2
2
|
type ParagraphSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
3
|
-
export interface ParagraphProps {
|
|
3
|
+
export interface ParagraphProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
4
|
as?: ParagraphAs;
|
|
5
5
|
size?: ParagraphSize;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export default function Paragraph({ as, size, children, className }: ParagraphProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function Paragraph({ as, size, children, className, ...rest }: ParagraphProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { UnifiedIconName } from "@/stories/atoms/icons/DynamicIcon";
|
|
2
3
|
export interface ISimpleSelectOptions {
|
|
3
4
|
label: string;
|
|
4
5
|
value: string;
|
|
5
|
-
|
|
6
|
+
icon?: UnifiedIconName;
|
|
6
7
|
description?: string;
|
|
8
|
+
caption?: string;
|
|
7
9
|
}
|
|
8
10
|
export interface ISelectProps {
|
|
9
11
|
/** Label */
|
|
@@ -30,6 +32,7 @@ export interface ISelectProps {
|
|
|
30
32
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
31
33
|
placeholder?: string;
|
|
32
34
|
dropdownMaxHeight?: number;
|
|
35
|
+
dropdownMaxWidth?: number;
|
|
33
36
|
}
|
|
34
37
|
declare const Select: React.FC<ISelectProps>;
|
|
35
38
|
export default Select;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { default as cn } from "classnames";
|
|
|
3
3
|
type ParagraphAs = "span" | "p" | "label" | "strong" | "em";
|
|
4
4
|
type ParagraphSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
5
5
|
|
|
6
|
-
export interface ParagraphProps {
|
|
6
|
+
export interface ParagraphProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
7
|
as?: ParagraphAs;
|
|
8
8
|
size?: ParagraphSize;
|
|
9
9
|
children: React.ReactNode;
|
|
@@ -18,8 +18,8 @@ const paragraphStyles: Record<ParagraphSize, string> = {
|
|
|
18
18
|
xs: "text-[10px] leading-[12px]"
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export default function Paragraph({ as = "p", size = "md", children, className }: ParagraphProps) {
|
|
21
|
+
export default function Paragraph({ as = "p", size = "md", children, className, ...rest }: ParagraphProps) {
|
|
22
22
|
const Tag = as;
|
|
23
23
|
|
|
24
|
-
return <Tag className={cn("gray-900 font-normal", paragraphStyles[size], className)}>{children}</Tag>;
|
|
24
|
+
return <Tag className={cn("gray-900 font-normal", paragraphStyles[size], className)} {...rest}>{children}</Tag>;
|
|
25
25
|
}
|
|
@@ -24,7 +24,8 @@ export interface ITablerIconProps extends React.DetailedHTMLProps<React.HTMLAttr
|
|
|
24
24
|
|
|
25
25
|
const TablerIcon: React.FC<ITablerIconProps> = ({
|
|
26
26
|
icon,
|
|
27
|
-
className = "w-6 h-6 text-gray-600"
|
|
27
|
+
className = "w-6 h-6 text-gray-600",
|
|
28
|
+
...rest
|
|
28
29
|
}: ITablerIconProps): JSX.Element | null => {
|
|
29
30
|
const [Icon, setIcon] = useState<ComponentType<any> | null>(
|
|
30
31
|
iconRegistry && icon ? (iconRegistry[icon] ?? null) : null
|
|
@@ -38,7 +39,7 @@ const TablerIcon: React.FC<ITablerIconProps> = ({
|
|
|
38
39
|
|
|
39
40
|
if (!Icon) return null;
|
|
40
41
|
return (
|
|
41
|
-
<i>
|
|
42
|
+
<i {...rest}>
|
|
42
43
|
<Icon className={className} />
|
|
43
44
|
</i>
|
|
44
45
|
);
|
|
@@ -61,8 +61,14 @@ export const DefaultSelect: TStory = {
|
|
|
61
61
|
id: "select",
|
|
62
62
|
name: "select",
|
|
63
63
|
options: [
|
|
64
|
-
{
|
|
65
|
-
|
|
64
|
+
{
|
|
65
|
+
label: "All",
|
|
66
|
+
value: ""
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "Canadian French blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah",
|
|
70
|
+
value: "fr-ca"
|
|
71
|
+
}
|
|
66
72
|
],
|
|
67
73
|
isDisabled: false,
|
|
68
74
|
isError: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import InputLabel from "@/stories/molecules/inputs/InputLabel";
|
|
3
|
-
import { DynamicIcon } from "@/stories/atoms/icons/DynamicIcon";
|
|
3
|
+
import { DynamicIcon, UnifiedIconName } from "@/stories/atoms/icons/DynamicIcon";
|
|
4
4
|
import { useId } from "@/utils/useId";
|
|
5
5
|
import { default as cn } from "classnames";
|
|
6
6
|
import {
|
|
@@ -15,8 +15,9 @@ import { Paragraph } from "@/stories/atoms/Typography/Paragraph";
|
|
|
15
15
|
export interface ISimpleSelectOptions {
|
|
16
16
|
label: string;
|
|
17
17
|
value: string;
|
|
18
|
-
|
|
18
|
+
icon?: UnifiedIconName;
|
|
19
19
|
description?: string;
|
|
20
|
+
caption?: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface ISelectProps {
|
|
@@ -44,6 +45,7 @@ export interface ISelectProps {
|
|
|
44
45
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
45
46
|
placeholder?: string;
|
|
46
47
|
dropdownMaxHeight?: number;
|
|
48
|
+
dropdownMaxWidth?: number;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
const Select: React.FC<ISelectProps> = ({
|
|
@@ -62,7 +64,8 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
62
64
|
message,
|
|
63
65
|
inputRef,
|
|
64
66
|
placeholder = "Select",
|
|
65
|
-
dropdownMaxHeight = 240
|
|
67
|
+
dropdownMaxHeight = 240,
|
|
68
|
+
dropdownMaxWidth = 240
|
|
66
69
|
}) => {
|
|
67
70
|
const uniqueID = useId();
|
|
68
71
|
if (!id) id = `select-${uniqueID}`;
|
|
@@ -142,13 +145,15 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
142
145
|
style={
|
|
143
146
|
{
|
|
144
147
|
"--anchor-max-height": `${dropdownMaxHeight}px`,
|
|
145
|
-
|
|
148
|
+
"--dropdown-max-width": `${dropdownMaxWidth}px`,
|
|
149
|
+
minWidth: Math.max(containerWidth ?? 0, 60)
|
|
146
150
|
} as React.CSSProperties
|
|
147
151
|
}
|
|
148
152
|
className={cn(
|
|
149
153
|
"z-[9999] overflow-auto rounded bg-white py-1",
|
|
150
154
|
"text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
151
|
-
"[--anchor-gap:8px]"
|
|
155
|
+
"[--anchor-gap:8px]",
|
|
156
|
+
"![max-width:var(--dropdown-max-width)]"
|
|
152
157
|
)}
|
|
153
158
|
>
|
|
154
159
|
{options.map((option) => (
|
|
@@ -163,10 +168,40 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
163
168
|
}
|
|
164
169
|
>
|
|
165
170
|
{({ selected }) => (
|
|
166
|
-
<div className="py-xxsm px-sm
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
<div className="flex justify-between items-center py-xxsm px-sm gap-4">
|
|
172
|
+
<div className="flex flex-col flex-1 min-w-0">
|
|
173
|
+
<div className="flex items-center gap-xsm">
|
|
174
|
+
<Paragraph
|
|
175
|
+
size="md"
|
|
176
|
+
className="text-neutral-700 truncate min-w-0"
|
|
177
|
+
title={option.label}
|
|
178
|
+
onMouseEnter={(e) => {
|
|
179
|
+
const el = e.currentTarget;
|
|
180
|
+
if (el.scrollWidth <= el.clientWidth) el.removeAttribute("title");
|
|
181
|
+
}}
|
|
182
|
+
onMouseLeave={(e) => {
|
|
183
|
+
e.currentTarget.setAttribute("title", option.label);
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{option.label}
|
|
187
|
+
</Paragraph>
|
|
188
|
+
{option.description ? (
|
|
189
|
+
<Paragraph size="md" className="text-neutral-500">
|
|
190
|
+
{option.description}
|
|
191
|
+
</Paragraph>
|
|
192
|
+
) : null}
|
|
193
|
+
</div>
|
|
194
|
+
{option.caption ? (
|
|
195
|
+
<Paragraph size="sm" className="text-neutral-500">
|
|
196
|
+
{option.caption}
|
|
197
|
+
</Paragraph>
|
|
198
|
+
) : null}
|
|
199
|
+
</div>
|
|
200
|
+
{option.icon ? (
|
|
201
|
+
<DynamicIcon
|
|
202
|
+
icon={option.icon}
|
|
203
|
+
className="shrink-0 w-5 h-5 text-neutral-500"
|
|
204
|
+
/>
|
|
170
205
|
) : null}
|
|
171
206
|
</div>
|
|
172
207
|
)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import
|
|
2
|
+
import { action } from "@storybook/addon-actions";
|
|
3
|
+
import FormInputWithAddons from "./FormInputWithAddons";
|
|
3
4
|
|
|
4
5
|
const meta: Meta<typeof FormInputWithAddons> = {
|
|
5
6
|
title: "Design System/organisms/Form Input With Addons",
|
|
@@ -27,6 +28,19 @@ export const DefaultFormInputWithAddons: Story = {
|
|
|
27
28
|
trailIcon: { icon: "IconSearch" }
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
export const TrailIconWithOnClick: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
id: "appSearch",
|
|
34
|
+
name: "appSearch",
|
|
35
|
+
type: "text",
|
|
36
|
+
placeholder: "Search...",
|
|
37
|
+
trailIcon: {
|
|
38
|
+
icon: "IconX",
|
|
39
|
+
onClick: action("trailIcon clicked")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
30
44
|
export const FormInputWithAddonBTN: Story = {
|
|
31
45
|
args: {
|
|
32
46
|
id: "appSearch",
|
|
@@ -121,27 +121,52 @@ const FormInputWithAddons: React.FC<IFormInputWithAddonsProps> = ({
|
|
|
121
121
|
}}
|
|
122
122
|
/>
|
|
123
123
|
{(trailLabel || trailIcon) && (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
124
|
+
trailIcon?.onClick ? (
|
|
125
|
+
<button
|
|
126
|
+
ref={trailLabelRef as unknown as React.RefObject<HTMLButtonElement>}
|
|
127
|
+
type="button"
|
|
128
|
+
onClick={(e) => { e.preventDefault(); trailIcon.onClick!(e as unknown as React.MouseEvent<HTMLElement>); }}
|
|
129
|
+
className={cn(
|
|
130
|
+
"right absolute top-0 bottom-0 right-3 flex items-center justify-center text-sm !text-gray-500 bg-transparent border-0 p-0 cursor-pointer",
|
|
131
|
+
labelClass
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
{trailIcon && (
|
|
135
|
+
<span>
|
|
136
|
+
<DynamicIcon
|
|
137
|
+
{...{
|
|
138
|
+
...trailIcon,
|
|
139
|
+
className: cn("h-5 w-5 text-gray-400", customIconClass, trailIcon.className),
|
|
140
|
+
outline: iconOutlined
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
</span>
|
|
144
|
+
)}
|
|
145
|
+
{trailLabel && trailLabel}
|
|
146
|
+
</button>
|
|
147
|
+
) : (
|
|
148
|
+
<label
|
|
149
|
+
ref={trailLabelRef}
|
|
150
|
+
htmlFor={id}
|
|
151
|
+
className={cn(
|
|
152
|
+
"right absolute top-0 bottom-0 right-3 flex items-center justify-center text-sm !text-gray-500 ",
|
|
153
|
+
labelClass
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
{trailIcon && (
|
|
157
|
+
<span>
|
|
158
|
+
<DynamicIcon
|
|
159
|
+
{...{
|
|
160
|
+
...trailIcon,
|
|
161
|
+
className: cn("h-5 w-5 text-gray-400", customIconClass, trailIcon.className),
|
|
162
|
+
outline: iconOutlined
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
</span>
|
|
166
|
+
)}
|
|
167
|
+
{trailLabel && trailLabel}
|
|
168
|
+
</label>
|
|
169
|
+
)
|
|
145
170
|
)}
|
|
146
171
|
{addonBTN && (
|
|
147
172
|
<div className="absolute top-0 bottom-0 right-0 flex items-center ">
|