@agility/plenum-ui 2.2.9 → 2.3.0
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 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +89 -0
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +6 -1
- package/local.sh +1 -1
- package/package.json +1 -1
- package/stories/molecules/inputs/select/Select.stories.tsx +49 -3
- package/stories/molecules/inputs/select/Select.tsx +128 -42
- package/tailwind.config.js +78 -0
package/dist/tailwind.css
CHANGED
|
@@ -1200,6 +1200,10 @@ select {
|
|
|
1200
1200
|
z-index: 99999;
|
|
1201
1201
|
}
|
|
1202
1202
|
|
|
1203
|
+
.z-\[9999\] {
|
|
1204
|
+
z-index: 9999;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1203
1207
|
.-m-10 {
|
|
1204
1208
|
margin: -2.5rem;
|
|
1205
1209
|
}
|
|
@@ -1672,6 +1676,11 @@ select {
|
|
|
1672
1676
|
margin-right: 24rem;
|
|
1673
1677
|
}
|
|
1674
1678
|
|
|
1679
|
+
.mx-xxsm {
|
|
1680
|
+
margin-left: 4px;
|
|
1681
|
+
margin-right: 4px;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1675
1684
|
.my-10 {
|
|
1676
1685
|
margin-top: 2.5rem;
|
|
1677
1686
|
margin-bottom: 2.5rem;
|
|
@@ -1996,6 +2005,14 @@ select {
|
|
|
1996
2005
|
width: 1.5rem;
|
|
1997
2006
|
}
|
|
1998
2007
|
|
|
2008
|
+
.w-60 {
|
|
2009
|
+
width: 15rem;
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
.w-64 {
|
|
2013
|
+
width: 16rem;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1999
2016
|
.w-8 {
|
|
2000
2017
|
width: 2rem;
|
|
2001
2018
|
}
|
|
@@ -2060,6 +2077,11 @@ select {
|
|
|
2060
2077
|
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));
|
|
2061
2078
|
}
|
|
2062
2079
|
|
|
2080
|
+
.rotate-180 {
|
|
2081
|
+
--tw-rotate: 180deg;
|
|
2082
|
+
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));
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2063
2085
|
.transform {
|
|
2064
2086
|
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));
|
|
2065
2087
|
}
|
|
@@ -3110,6 +3132,10 @@ select {
|
|
|
3110
3132
|
gap: 24rem;
|
|
3111
3133
|
}
|
|
3112
3134
|
|
|
3135
|
+
.gap-xsm {
|
|
3136
|
+
gap: 8px;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3113
3139
|
.gap-x-2 {
|
|
3114
3140
|
-moz-column-gap: 0.5rem;
|
|
3115
3141
|
column-gap: 0.5rem;
|
|
@@ -3257,6 +3283,10 @@ select {
|
|
|
3257
3283
|
border-style: dashed;
|
|
3258
3284
|
}
|
|
3259
3285
|
|
|
3286
|
+
.border-none {
|
|
3287
|
+
border-style: none;
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3260
3290
|
.\!border-gray-300 {
|
|
3261
3291
|
--tw-border-opacity: 1 !important;
|
|
3262
3292
|
border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)) !important;
|
|
@@ -65668,6 +65698,10 @@ select {
|
|
|
65668
65698
|
background-color: rgb(19 78 74 / 0.95);
|
|
65669
65699
|
}
|
|
65670
65700
|
|
|
65701
|
+
.bg-transparent {
|
|
65702
|
+
background-color: transparent;
|
|
65703
|
+
}
|
|
65704
|
+
|
|
65671
65705
|
.bg-transparent-black-03 {
|
|
65672
65706
|
background-color: rgba(0, 0, 0, 0.03);
|
|
65673
65707
|
}
|
|
@@ -67736,6 +67770,11 @@ select {
|
|
|
67736
67770
|
padding-right: 6px;
|
|
67737
67771
|
}
|
|
67738
67772
|
|
|
67773
|
+
.px-sm {
|
|
67774
|
+
padding-left: 12px;
|
|
67775
|
+
padding-right: 12px;
|
|
67776
|
+
}
|
|
67777
|
+
|
|
67739
67778
|
.py-1 {
|
|
67740
67779
|
padding-top: 0.25rem;
|
|
67741
67780
|
padding-bottom: 0.25rem;
|
|
@@ -67871,6 +67910,11 @@ select {
|
|
|
67871
67910
|
padding-bottom: 9px;
|
|
67872
67911
|
}
|
|
67873
67912
|
|
|
67913
|
+
.py-xxsm {
|
|
67914
|
+
padding-top: 4px;
|
|
67915
|
+
padding-bottom: 4px;
|
|
67916
|
+
}
|
|
67917
|
+
|
|
67874
67918
|
.pl-1 {
|
|
67875
67919
|
padding-left: 0.25rem;
|
|
67876
67920
|
}
|
|
@@ -67915,6 +67959,10 @@ select {
|
|
|
67915
67959
|
padding-right: 10px;
|
|
67916
67960
|
}
|
|
67917
67961
|
|
|
67962
|
+
.pt-xxsm {
|
|
67963
|
+
padding-top: 4px;
|
|
67964
|
+
}
|
|
67965
|
+
|
|
67918
67966
|
.text-left {
|
|
67919
67967
|
text-align: left;
|
|
67920
67968
|
}
|
|
@@ -71674,6 +71722,11 @@ select {
|
|
|
71674
71722
|
color: rgb(6 78 59 / 0.95);
|
|
71675
71723
|
}
|
|
71676
71724
|
|
|
71725
|
+
.text-neutral-500 {
|
|
71726
|
+
--tw-text-opacity: 1;
|
|
71727
|
+
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
71728
|
+
}
|
|
71729
|
+
|
|
71677
71730
|
.text-orange-100 {
|
|
71678
71731
|
--tw-text-opacity: 1;
|
|
71679
71732
|
color: rgb(255 237 213 / var(--tw-text-opacity, 1));
|
|
@@ -78949,6 +79002,26 @@ select {
|
|
|
78949
79002
|
transition-duration: 150ms;
|
|
78950
79003
|
}
|
|
78951
79004
|
|
|
79005
|
+
.transition-transform {
|
|
79006
|
+
transition-property: transform;
|
|
79007
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
79008
|
+
transition-duration: 150ms;
|
|
79009
|
+
}
|
|
79010
|
+
|
|
79011
|
+
.\[--anchor-gap\:8px\] {
|
|
79012
|
+
--anchor-gap: 8px;
|
|
79013
|
+
}
|
|
79014
|
+
|
|
79015
|
+
.placeholder\:text-gray-400::-moz-placeholder {
|
|
79016
|
+
--tw-text-opacity: 1;
|
|
79017
|
+
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
79018
|
+
}
|
|
79019
|
+
|
|
79020
|
+
.placeholder\:text-gray-400::placeholder {
|
|
79021
|
+
--tw-text-opacity: 1;
|
|
79022
|
+
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
79023
|
+
}
|
|
79024
|
+
|
|
78952
79025
|
.placeholder\:text-gray-500::-moz-placeholder {
|
|
78953
79026
|
--tw-text-opacity: 1;
|
|
78954
79027
|
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
@@ -78972,6 +79045,11 @@ select {
|
|
|
78972
79045
|
border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)) !important;
|
|
78973
79046
|
}
|
|
78974
79047
|
|
|
79048
|
+
.focus-within\:border-primary-800:focus-within {
|
|
79049
|
+
--tw-border-opacity: 1;
|
|
79050
|
+
border-color: rgb(91 33 182 / var(--tw-border-opacity, 1));
|
|
79051
|
+
}
|
|
79052
|
+
|
|
78975
79053
|
.focus-within\:bg-purple-100:focus-within {
|
|
78976
79054
|
--tw-bg-opacity: 1;
|
|
78977
79055
|
background-color: rgb(222 204 246 / var(--tw-bg-opacity, 1));
|
|
@@ -78982,6 +79060,12 @@ select {
|
|
|
78982
79060
|
outline-offset: 2px;
|
|
78983
79061
|
}
|
|
78984
79062
|
|
|
79063
|
+
.focus-within\:ring-1:focus-within {
|
|
79064
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
79065
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
79066
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
79067
|
+
}
|
|
79068
|
+
|
|
78985
79069
|
.focus-within\:ring-2:focus-within {
|
|
78986
79070
|
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
78987
79071
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
@@ -78998,6 +79082,11 @@ select {
|
|
|
78998
79082
|
--tw-ring-color: rgb(255 203 40 / var(--tw-ring-opacity, 1)) !important;
|
|
78999
79083
|
}
|
|
79000
79084
|
|
|
79085
|
+
.focus-within\:ring-primary-800:focus-within {
|
|
79086
|
+
--tw-ring-opacity: 1;
|
|
79087
|
+
--tw-ring-color: rgb(91 33 182 / var(--tw-ring-opacity, 1));
|
|
79088
|
+
}
|
|
79089
|
+
|
|
79001
79090
|
.focus-within\:ring-purple-600:focus-within {
|
|
79002
79091
|
--tw-ring-opacity: 1;
|
|
79003
79092
|
--tw-ring-color: rgb(105 26 216 / var(--tw-ring-opacity, 1));
|
|
@@ -2,6 +2,8 @@ import React from "react";
|
|
|
2
2
|
export interface ISimpleSelectOptions {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
|
+
emoji?: string;
|
|
6
|
+
description?: string;
|
|
5
7
|
}
|
|
6
8
|
export interface ISelectProps {
|
|
7
9
|
/** Label */
|
|
@@ -12,7 +14,7 @@ export interface ISelectProps {
|
|
|
12
14
|
name?: string;
|
|
13
15
|
/** List of options to display in the select menu */
|
|
14
16
|
options: ISimpleSelectOptions[];
|
|
15
|
-
/**
|
|
17
|
+
/** Called with the selected option's value string */
|
|
16
18
|
onChange?(value: string): void;
|
|
17
19
|
/** Select disabled state */
|
|
18
20
|
isDisabled?: boolean;
|
|
@@ -25,6 +27,9 @@ export interface ISelectProps {
|
|
|
25
27
|
onFocus?: () => void;
|
|
26
28
|
onBlur?: () => void;
|
|
27
29
|
message?: string;
|
|
30
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
dropdownMaxHeight?: number;
|
|
28
33
|
}
|
|
29
34
|
declare const Select: React.FC<ISelectProps>;
|
|
30
35
|
export default Select;
|
package/local.sh
CHANGED
package/package.json
CHANGED
|
@@ -10,12 +10,16 @@ const meta: Meta<typeof Select> = {
|
|
|
10
10
|
(Story, context) => {
|
|
11
11
|
if (context.name === "Default Select Dark BG") {
|
|
12
12
|
return (
|
|
13
|
-
<div className="bg-transparent-black-03 rounded p-6">
|
|
13
|
+
<div className="bg-transparent-black-03 rounded p-6 w-60">
|
|
14
14
|
<Story />
|
|
15
15
|
</div>
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
<div className="w-64">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
19
23
|
}
|
|
20
24
|
]
|
|
21
25
|
};
|
|
@@ -23,13 +27,41 @@ const meta: Meta<typeof Select> = {
|
|
|
23
27
|
export default meta;
|
|
24
28
|
type TStory = StoryObj<typeof Select>;
|
|
25
29
|
|
|
30
|
+
const manyCountries = [
|
|
31
|
+
{
|
|
32
|
+
label: "Australia",
|
|
33
|
+
value: "au",
|
|
34
|
+
description: "A country and continent"
|
|
35
|
+
},
|
|
36
|
+
{ label: "Brazil", value: "br" },
|
|
37
|
+
{ label: "Canada", value: "ca" },
|
|
38
|
+
{ label: "China", value: "cn" },
|
|
39
|
+
{ label: "Denmark", value: "dk" },
|
|
40
|
+
{ label: "Egypt", value: "eg" },
|
|
41
|
+
{ label: "France", value: "fr" },
|
|
42
|
+
{ label: "Germany", value: "de" },
|
|
43
|
+
{ label: "India", value: "in" },
|
|
44
|
+
{ label: "Italy", value: "it" },
|
|
45
|
+
{ label: "Japan", value: "jp" },
|
|
46
|
+
{ label: "Mexico", value: "mx" },
|
|
47
|
+
{ label: "Netherlands", value: "nl" },
|
|
48
|
+
{ label: "New Zealand", value: "nz" },
|
|
49
|
+
{ label: "Norway", value: "no" },
|
|
50
|
+
{ label: "Portugal", value: "pt" },
|
|
51
|
+
{ label: "South Korea", value: "kr" },
|
|
52
|
+
{ label: "Spain", value: "es" },
|
|
53
|
+
{ label: "Sweden", value: "se" },
|
|
54
|
+
{ label: "United Kingdom", value: "gb" },
|
|
55
|
+
{ label: "United States", value: "us" }
|
|
56
|
+
];
|
|
57
|
+
|
|
26
58
|
export const DefaultSelect: TStory = {
|
|
27
59
|
args: {
|
|
28
60
|
label: "Label",
|
|
29
61
|
id: "select",
|
|
30
62
|
name: "select",
|
|
31
63
|
options: [
|
|
32
|
-
{ label: "Canada", value: "value1" },
|
|
64
|
+
{ label: "Canada", value: "value1", description: "A description for Canada." },
|
|
33
65
|
{ label: "USA", value: "value2" }
|
|
34
66
|
],
|
|
35
67
|
isDisabled: false,
|
|
@@ -38,6 +70,20 @@ export const DefaultSelect: TStory = {
|
|
|
38
70
|
message: "Message"
|
|
39
71
|
}
|
|
40
72
|
};
|
|
73
|
+
|
|
74
|
+
export const ManyOptions: TStory = {
|
|
75
|
+
args: {
|
|
76
|
+
label: "Country",
|
|
77
|
+
id: "select-many",
|
|
78
|
+
name: "select-many",
|
|
79
|
+
options: manyCountries,
|
|
80
|
+
isDisabled: false,
|
|
81
|
+
isError: false,
|
|
82
|
+
isRequired: false,
|
|
83
|
+
message: "Scroll to see all options"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
41
87
|
export const DefaultSelectDarkBG: TStory = {
|
|
42
88
|
args: {
|
|
43
89
|
label: "Label",
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
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
4
|
import { useId } from "@/utils/useId";
|
|
4
5
|
import { default as cn } from "classnames";
|
|
5
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
Combobox as HeadlessCombobox,
|
|
8
|
+
ComboboxInput,
|
|
9
|
+
ComboboxButton,
|
|
10
|
+
ComboboxOptions,
|
|
11
|
+
ComboboxOption
|
|
12
|
+
} from "@headlessui/react";
|
|
13
|
+
import { Paragraph } from "@/stories/atoms/Typography/Paragraph";
|
|
6
14
|
|
|
7
15
|
export interface ISimpleSelectOptions {
|
|
8
16
|
label: string;
|
|
9
17
|
value: string;
|
|
18
|
+
emoji?: string;
|
|
19
|
+
description?: string;
|
|
10
20
|
}
|
|
21
|
+
|
|
11
22
|
export interface ISelectProps {
|
|
12
23
|
/** Label */
|
|
13
24
|
label?: string;
|
|
@@ -17,7 +28,7 @@ export interface ISelectProps {
|
|
|
17
28
|
name?: string;
|
|
18
29
|
/** List of options to display in the select menu */
|
|
19
30
|
options: ISimpleSelectOptions[];
|
|
20
|
-
/**
|
|
31
|
+
/** Called with the selected option's value string */
|
|
21
32
|
onChange?(value: string): void;
|
|
22
33
|
/** Select disabled state */
|
|
23
34
|
isDisabled?: boolean;
|
|
@@ -30,7 +41,11 @@ export interface ISelectProps {
|
|
|
30
41
|
onFocus?: () => void;
|
|
31
42
|
onBlur?: () => void;
|
|
32
43
|
message?: string;
|
|
44
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
dropdownMaxHeight?: number;
|
|
33
47
|
}
|
|
48
|
+
|
|
34
49
|
const Select: React.FC<ISelectProps> = ({
|
|
35
50
|
label,
|
|
36
51
|
id,
|
|
@@ -44,57 +59,128 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
44
59
|
className,
|
|
45
60
|
onFocus,
|
|
46
61
|
onBlur,
|
|
47
|
-
message
|
|
62
|
+
message,
|
|
63
|
+
inputRef,
|
|
64
|
+
placeholder = "Select",
|
|
65
|
+
dropdownMaxHeight = 240
|
|
48
66
|
}) => {
|
|
49
|
-
const [selectedOption, setSelectedOption] = useState<string>(value || options[0].value);
|
|
50
67
|
const uniqueID = useId();
|
|
51
68
|
if (!id) id = `select-${uniqueID}`;
|
|
52
69
|
if (!name) name = id;
|
|
53
70
|
|
|
71
|
+
const findOption = (val?: string) => options.find((o) => o.value === val) ?? null;
|
|
72
|
+
|
|
73
|
+
const [selectedOption, setSelectedOption] = useState<ISimpleSelectOptions | null>(findOption(value));
|
|
74
|
+
|
|
54
75
|
useEffect(() => {
|
|
55
|
-
|
|
56
|
-
setSelectedOption(value);
|
|
57
|
-
}
|
|
76
|
+
setSelectedOption(findOption(value));
|
|
58
77
|
}, [value]);
|
|
59
78
|
|
|
60
|
-
const handleChange = (
|
|
61
|
-
|
|
62
|
-
typeof onChange
|
|
63
|
-
|
|
79
|
+
const handleChange = (option: ISimpleSelectOptions | null) => {
|
|
80
|
+
setSelectedOption(option);
|
|
81
|
+
if (option && typeof onChange === "function") {
|
|
82
|
+
onChange(option.value);
|
|
83
|
+
}
|
|
64
84
|
};
|
|
65
|
-
|
|
85
|
+
|
|
86
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
87
|
+
const [containerWidth, setContainerWidth] = useState<number | undefined>();
|
|
88
|
+
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
const el = containerRef.current;
|
|
91
|
+
if (!el) return;
|
|
92
|
+
const observer = new ResizeObserver(([entry]) => setContainerWidth(entry.contentRect.width));
|
|
93
|
+
observer.observe(el);
|
|
94
|
+
return () => observer.disconnect();
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const wrapperStyle = cn(className, "w-full", "group", { "opacity-50 pointer-events-none": isDisabled });
|
|
98
|
+
|
|
66
99
|
return (
|
|
67
100
|
<div className={wrapperStyle}>
|
|
68
|
-
{label && <InputLabel
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
101
|
+
{label && <InputLabel id={`${id}-label`} label={label} isRequired={isRequired} />}
|
|
102
|
+
|
|
103
|
+
<HeadlessCombobox value={selectedOption} onChange={handleChange} disabled={isDisabled} immediate by="value">
|
|
104
|
+
<div ref={containerRef} className="relative w-full">
|
|
105
|
+
<div
|
|
106
|
+
className={cn(
|
|
107
|
+
"relative w-full cursor-default overflow-hidden rounded border bg-white text-left shadow-sm",
|
|
108
|
+
"focus-within:border-primary-800 focus-within:ring-1 focus-within:ring-primary-800",
|
|
109
|
+
{ "border-red-500": isError, "border-gray-300": !isError }
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
<ComboboxInput
|
|
113
|
+
id={id}
|
|
114
|
+
name={name}
|
|
115
|
+
ref={inputRef}
|
|
116
|
+
readOnly
|
|
117
|
+
displayValue={(option: ISimpleSelectOptions | null) => (option ? option.label : "")}
|
|
118
|
+
placeholder={placeholder}
|
|
119
|
+
onFocus={onFocus}
|
|
120
|
+
onBlur={onBlur}
|
|
121
|
+
className={cn(
|
|
122
|
+
"w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-700",
|
|
123
|
+
"placeholder:text-gray-400",
|
|
124
|
+
"focus:outline-none focus:ring-0",
|
|
125
|
+
"bg-transparent cursor-default"
|
|
126
|
+
)}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<ComboboxButton className="absolute inset-y-0 right-0 flex items-center pr-3">
|
|
130
|
+
{({ open }) => (
|
|
131
|
+
<DynamicIcon
|
|
132
|
+
icon="IconChevronDown"
|
|
133
|
+
className={cn("h-4 w-4 text-gray-400 transition-transform", { "rotate-180": open })}
|
|
134
|
+
aria-hidden="true"
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
</ComboboxButton>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<ComboboxOptions
|
|
141
|
+
anchor="bottom start"
|
|
142
|
+
style={
|
|
143
|
+
{
|
|
144
|
+
"--anchor-max-height": `${dropdownMaxHeight}px`,
|
|
145
|
+
minWidth: containerWidth
|
|
146
|
+
} as React.CSSProperties
|
|
147
|
+
}
|
|
148
|
+
className={cn(
|
|
149
|
+
"z-[9999] overflow-auto rounded bg-white py-1",
|
|
150
|
+
"text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
151
|
+
"[--anchor-gap:8px]"
|
|
152
|
+
)}
|
|
153
|
+
>
|
|
154
|
+
{options.map((option) => (
|
|
155
|
+
<ComboboxOption
|
|
156
|
+
key={option.value}
|
|
157
|
+
value={option}
|
|
158
|
+
className={({ focus }) =>
|
|
159
|
+
cn(
|
|
160
|
+
"relative cursor-default select-none mx-xxsm rounded",
|
|
161
|
+
focus ? "bg-gray-100 text-gray-900" : "text-gray-700"
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
>
|
|
165
|
+
{({ selected }) => (
|
|
166
|
+
<div className="py-xxsm px-sm flex items-center gap-xsm">
|
|
167
|
+
<Paragraph size="md">{option.label}</Paragraph>
|
|
168
|
+
{option.description ? (
|
|
169
|
+
<Paragraph size="md" className="text-neutral-500">{option.description}</Paragraph>
|
|
170
|
+
) : null}
|
|
171
|
+
</div>
|
|
172
|
+
)}
|
|
173
|
+
</ComboboxOption>
|
|
174
|
+
))}
|
|
175
|
+
</ComboboxOptions>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{message && (
|
|
179
|
+
<Paragraph size="md" className={isError ? "text-red-600" : "text-gray-500 pt-xxsm"}>
|
|
180
|
+
{message}
|
|
181
|
+
</Paragraph>
|
|
78
182
|
)}
|
|
79
|
-
|
|
80
|
-
disabled={isDisabled}
|
|
81
|
-
value={selectedOption}
|
|
82
|
-
onFocus={onFocus}
|
|
83
|
-
onBlur={onBlur}
|
|
84
|
-
>
|
|
85
|
-
{options.map(({ value, label }) => {
|
|
86
|
-
return (
|
|
87
|
-
<option key={value} value={value}>
|
|
88
|
-
{label}
|
|
89
|
-
</option>
|
|
90
|
-
);
|
|
91
|
-
})}
|
|
92
|
-
</select>
|
|
93
|
-
{message && (
|
|
94
|
-
<Paragraph size="md" className={isError ? "text-red-600" : "text-gray-500"}>
|
|
95
|
-
{message}
|
|
96
|
-
</Paragraph>
|
|
97
|
-
)}
|
|
183
|
+
</HeadlessCombobox>
|
|
98
184
|
</div>
|
|
99
185
|
);
|
|
100
186
|
};
|
package/tailwind.config.js
CHANGED
|
@@ -52,6 +52,72 @@ module.exports = {
|
|
|
52
52
|
header: "max-content 1fr 1fr"
|
|
53
53
|
},
|
|
54
54
|
colors: {
|
|
55
|
+
"neutral-50": "#F7F7F7",
|
|
56
|
+
"neutral-100": "#F2F2F2",
|
|
57
|
+
"neutral-200": "#E5E7EB",
|
|
58
|
+
"neutral-300": "#D1D5DB",
|
|
59
|
+
"neutral-400": "#9CA3aF",
|
|
60
|
+
"neutral-500": "#6B7280",
|
|
61
|
+
"neutral-600": "#4B5563",
|
|
62
|
+
"neutral-700": "#374151",
|
|
63
|
+
"neutral-800": "#1F2937",
|
|
64
|
+
"neutral-900": "#111827",
|
|
65
|
+
|
|
66
|
+
"primary-50": "#F7F7F7",
|
|
67
|
+
"primary-100": "#EDE9FE",
|
|
68
|
+
"primary-200": "#DDD6FE",
|
|
69
|
+
"primary-300": "#C4B5FD",
|
|
70
|
+
"primary-400": "#A78BFA",
|
|
71
|
+
"primary-500": "#8B5CF6",
|
|
72
|
+
"primary-600": "#7C3AED",
|
|
73
|
+
"primary-700": "#6D28D9",
|
|
74
|
+
"primary-800": "#5B21B6",
|
|
75
|
+
"primary-900": "#4C1D95",
|
|
76
|
+
|
|
77
|
+
"secondary-50": "#FFFAEA",
|
|
78
|
+
"secondary-100": "#FFF5D4",
|
|
79
|
+
"secondary-200": "#FFEAA9",
|
|
80
|
+
"secondary-300": "#FFE07E",
|
|
81
|
+
"secondary-400": "#FFD553",
|
|
82
|
+
"secondary-500": "#FFCB28",
|
|
83
|
+
"secondary-600": "#F2C126",
|
|
84
|
+
"secondary-700": "#D9AD22",
|
|
85
|
+
"secondary-800": "#BF981E",
|
|
86
|
+
"secondary-900": "#997A18",
|
|
87
|
+
|
|
88
|
+
"success-50": "#ECFDF5",
|
|
89
|
+
"success-100": "#D1FAE5",
|
|
90
|
+
"success-200": "#A7F3D0",
|
|
91
|
+
"success-300": "#6EE7B7",
|
|
92
|
+
"success-400": "#34D399",
|
|
93
|
+
"success-500": "#10B981",
|
|
94
|
+
"success-600": "#059669",
|
|
95
|
+
"success-700": "#047857",
|
|
96
|
+
"success-800": "#065F46",
|
|
97
|
+
"success-900": "#064E3B",
|
|
98
|
+
|
|
99
|
+
"warning-50": "#FFF7ED",
|
|
100
|
+
"warning-100": "#FFEDD5",
|
|
101
|
+
"warning-200": "#FED7AA",
|
|
102
|
+
"warning-300": "#FDBA74",
|
|
103
|
+
"warning-400": "#FB923C",
|
|
104
|
+
"warning-500": "#F97316",
|
|
105
|
+
"warning-600": "#EA580C",
|
|
106
|
+
"warning-700": "#C2410C",
|
|
107
|
+
"warning-800": "#9A3412",
|
|
108
|
+
"warning-900": "#7C2D12",
|
|
109
|
+
|
|
110
|
+
"error-50": "#FEF2F2",
|
|
111
|
+
"error-100": "#FEE2E2",
|
|
112
|
+
"error-200": "#FECACA",
|
|
113
|
+
"error-300": "#FCA5A5",
|
|
114
|
+
"error-400": "#F87171",
|
|
115
|
+
"error-500": "#EF4444",
|
|
116
|
+
"error-600": "#DC2626",
|
|
117
|
+
"error-700": "#B91C1C",
|
|
118
|
+
"error-800": "#991B1B",
|
|
119
|
+
"error-900": "#7F1D1D",
|
|
120
|
+
|
|
55
121
|
"transparent-white-05": "rgba(255, 255, 255, 0.05)",
|
|
56
122
|
"transparent-white-10": "rgba(255, 255, 255, 0.1)",
|
|
57
123
|
"transparent-white-20": "rgba(255, 255, 255, 0.2)",
|
|
@@ -287,6 +353,18 @@ module.exports = {
|
|
|
287
353
|
transitionProperty: {
|
|
288
354
|
left: "left",
|
|
289
355
|
height: "height"
|
|
356
|
+
},
|
|
357
|
+
spacing: {
|
|
358
|
+
xxsm: "4px",
|
|
359
|
+
xsm: "8px",
|
|
360
|
+
sm: "12px",
|
|
361
|
+
md: "16px",
|
|
362
|
+
lg: "20px",
|
|
363
|
+
xlg: "24px",
|
|
364
|
+
xxlg: "28px",
|
|
365
|
+
hg: "32px",
|
|
366
|
+
xhg: "40px",
|
|
367
|
+
xxhg: "80px"
|
|
290
368
|
}
|
|
291
369
|
}
|
|
292
370
|
},
|