@agility/plenum-ui 2.3.2 → 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/dist/index.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +17 -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/molecules/inputs/select/Select.stories.tsx +8 -2
- package/stories/molecules/inputs/select/Select.tsx +44 -9
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
|
}
|
|
@@ -71735,6 +71743,11 @@ select {
|
|
|
71735
71743
|
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
71736
71744
|
}
|
|
71737
71745
|
|
|
71746
|
+
.text-neutral-700 {
|
|
71747
|
+
--tw-text-opacity: 1;
|
|
71748
|
+
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
71749
|
+
}
|
|
71750
|
+
|
|
71738
71751
|
.text-orange-100 {
|
|
71739
71752
|
--tw-text-opacity: 1;
|
|
71740
71753
|
color: rgb(255 237 213 / var(--tw-text-opacity, 1));
|
|
@@ -79020,6 +79033,10 @@ select {
|
|
|
79020
79033
|
--anchor-gap: 8px;
|
|
79021
79034
|
}
|
|
79022
79035
|
|
|
79036
|
+
.\!\[max-width\:var\(--dropdown-max-width\)\] {
|
|
79037
|
+
max-width: var(--dropdown-max-width) !important;
|
|
79038
|
+
}
|
|
79039
|
+
|
|
79023
79040
|
.placeholder\:text-gray-400::-moz-placeholder {
|
|
79024
79041
|
--tw-text-opacity: 1;
|
|
79025
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
|
}
|
|
@@ -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
|
)}
|