@basic-ui/core 0.0.45 → 0.0.46
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/build/cjs/index.js +20 -6
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Menu/MenuItem.js +0 -1
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.js +18 -4
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/fixtures/countryList.d.ts +1 -0
- package/build/esm/Menu/fixtures/countryList.js +2 -0
- package/build/esm/Menu/fixtures/countryList.js.map +1 -0
- package/build/esm/hooks/useControlledState.js +3 -1
- package/build/esm/hooks/useControlledState.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Menu/MenuComplex.story.tsx +58 -0
- package/src/Menu/MenuItem.tsx +0 -1
- package/src/Menu/MenuList.tsx +25 -4
- package/src/Menu/fixtures/countryList.ts +198 -0
- package/src/hooks/useControlledState.ts +7 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export const countryList = [
|
|
2
|
+
'Afghanistan',
|
|
3
|
+
'Albania',
|
|
4
|
+
'Algeria',
|
|
5
|
+
'Andorra',
|
|
6
|
+
'Angola',
|
|
7
|
+
'Antigua and Barbuda',
|
|
8
|
+
'Argentina',
|
|
9
|
+
'Armenia',
|
|
10
|
+
'Australia',
|
|
11
|
+
'Austria',
|
|
12
|
+
'Azerbaijan',
|
|
13
|
+
'Bahamas',
|
|
14
|
+
'Bahrain',
|
|
15
|
+
'Bangladesh',
|
|
16
|
+
'Barbados',
|
|
17
|
+
'Belarus',
|
|
18
|
+
'Belgium',
|
|
19
|
+
'Belize',
|
|
20
|
+
'Benin',
|
|
21
|
+
'Bhutan',
|
|
22
|
+
'Bolivia',
|
|
23
|
+
'Bosnia and Herzegovina',
|
|
24
|
+
'Botswana',
|
|
25
|
+
'Brazil',
|
|
26
|
+
'Brunei',
|
|
27
|
+
'Bulgaria',
|
|
28
|
+
'Burkina Faso',
|
|
29
|
+
'Burundi',
|
|
30
|
+
"Côte d'Ivoire",
|
|
31
|
+
'Cabo Verde',
|
|
32
|
+
'Cambodia',
|
|
33
|
+
'Cameroon',
|
|
34
|
+
'Canada',
|
|
35
|
+
'Central African Republic',
|
|
36
|
+
'Central American Republic',
|
|
37
|
+
'Chad',
|
|
38
|
+
'Chile',
|
|
39
|
+
'China',
|
|
40
|
+
'Colombia',
|
|
41
|
+
'Comoros',
|
|
42
|
+
'Congo (Congo-Brazzaville)',
|
|
43
|
+
'Costa Rica',
|
|
44
|
+
'Croatia',
|
|
45
|
+
'Cuba',
|
|
46
|
+
'Cyprus',
|
|
47
|
+
'Czechia (Czech Republic)',
|
|
48
|
+
'Democratic Republic of the Congo',
|
|
49
|
+
'Denmark',
|
|
50
|
+
'Djibouti',
|
|
51
|
+
'Dominica',
|
|
52
|
+
'Dominican Republic',
|
|
53
|
+
'Ecuador',
|
|
54
|
+
'Egypt',
|
|
55
|
+
'El Salvador',
|
|
56
|
+
'Equatorial Guinea',
|
|
57
|
+
'Eritrea',
|
|
58
|
+
'Estonia',
|
|
59
|
+
'Eswatini (fmr. "Swaziland")',
|
|
60
|
+
'Ethiopia',
|
|
61
|
+
'Fiji',
|
|
62
|
+
'Finland',
|
|
63
|
+
'France',
|
|
64
|
+
'Gabon',
|
|
65
|
+
'Gambia',
|
|
66
|
+
'Georgia',
|
|
67
|
+
'Germany',
|
|
68
|
+
'Ghana',
|
|
69
|
+
'Greece',
|
|
70
|
+
'Grenada',
|
|
71
|
+
'Guatemala',
|
|
72
|
+
'Guinea',
|
|
73
|
+
'Guinea-Bissau',
|
|
74
|
+
'Guyana',
|
|
75
|
+
'Haiti',
|
|
76
|
+
'Holy See',
|
|
77
|
+
'Honduras',
|
|
78
|
+
'Hungary',
|
|
79
|
+
'Iceland',
|
|
80
|
+
'India',
|
|
81
|
+
'Indonesia',
|
|
82
|
+
'Iran',
|
|
83
|
+
'Iraq',
|
|
84
|
+
'Ireland',
|
|
85
|
+
'Israel',
|
|
86
|
+
'Italy',
|
|
87
|
+
'Jamaica',
|
|
88
|
+
'Japan',
|
|
89
|
+
'Jordan',
|
|
90
|
+
'Kazakhstan',
|
|
91
|
+
'Kenya',
|
|
92
|
+
'Kiribati',
|
|
93
|
+
'Kuwait',
|
|
94
|
+
'Kyrgyzstan',
|
|
95
|
+
'Laos',
|
|
96
|
+
'Latvia',
|
|
97
|
+
'Lebanon',
|
|
98
|
+
'Lesotho',
|
|
99
|
+
'Liberia',
|
|
100
|
+
'Libya',
|
|
101
|
+
'Liechtenstein',
|
|
102
|
+
'Lithuania',
|
|
103
|
+
'Luxembourg',
|
|
104
|
+
'Madagascar',
|
|
105
|
+
'Malawi',
|
|
106
|
+
'Malaysia',
|
|
107
|
+
'Maldives',
|
|
108
|
+
'Mali',
|
|
109
|
+
'Malta',
|
|
110
|
+
'Marshall Islands',
|
|
111
|
+
'Mauritania',
|
|
112
|
+
'Mauritius',
|
|
113
|
+
'Mexico',
|
|
114
|
+
'Micronesia',
|
|
115
|
+
'Moldova',
|
|
116
|
+
'Monaco',
|
|
117
|
+
'Mongolia',
|
|
118
|
+
'Montenegro',
|
|
119
|
+
'Morocco',
|
|
120
|
+
'Mozambique',
|
|
121
|
+
'Myanmar (formerly Burma)',
|
|
122
|
+
'Namibia',
|
|
123
|
+
'Nauru',
|
|
124
|
+
'Nepal',
|
|
125
|
+
'Netherlands',
|
|
126
|
+
'New Zealand',
|
|
127
|
+
'Nicaragua',
|
|
128
|
+
'Niger',
|
|
129
|
+
'Nigeria',
|
|
130
|
+
'North Korea',
|
|
131
|
+
'North Macedonia',
|
|
132
|
+
'Norway',
|
|
133
|
+
'Oman',
|
|
134
|
+
'Pakistan',
|
|
135
|
+
'Palau',
|
|
136
|
+
'Palestine State',
|
|
137
|
+
'Panama',
|
|
138
|
+
'Papua New Guinea',
|
|
139
|
+
'Paraguay',
|
|
140
|
+
'Peru',
|
|
141
|
+
'Philippines',
|
|
142
|
+
'Poland',
|
|
143
|
+
'Portugal',
|
|
144
|
+
'Qatar',
|
|
145
|
+
'Romania',
|
|
146
|
+
'Russia',
|
|
147
|
+
'Rwanda',
|
|
148
|
+
'Saint Kitts and Nevis',
|
|
149
|
+
'Saint Lucia',
|
|
150
|
+
'Saint Vincent and the Grenadines',
|
|
151
|
+
'Samoa',
|
|
152
|
+
'San Marino',
|
|
153
|
+
'Sao Tome and Principe',
|
|
154
|
+
'Saudi Arabia',
|
|
155
|
+
'Senegal',
|
|
156
|
+
'Serbia',
|
|
157
|
+
'Seychelles',
|
|
158
|
+
'Sierra Leone',
|
|
159
|
+
'Singapore',
|
|
160
|
+
'Slovakia',
|
|
161
|
+
'Slovenia',
|
|
162
|
+
'Solomon Islands',
|
|
163
|
+
'Somalia',
|
|
164
|
+
'South Africa',
|
|
165
|
+
'South Korea',
|
|
166
|
+
'South Sudan',
|
|
167
|
+
'Spain',
|
|
168
|
+
'Sri Lanka',
|
|
169
|
+
'Sudan',
|
|
170
|
+
'Suriname',
|
|
171
|
+
'Sweden',
|
|
172
|
+
'Switzerland',
|
|
173
|
+
'Syria',
|
|
174
|
+
'Tajikistan',
|
|
175
|
+
'Tanzania',
|
|
176
|
+
'Thailand',
|
|
177
|
+
'Timor-Leste',
|
|
178
|
+
'Togo',
|
|
179
|
+
'Tonga',
|
|
180
|
+
'Trinidad and Tobago',
|
|
181
|
+
'Tunisia',
|
|
182
|
+
'Turkey',
|
|
183
|
+
'Turkmenistan',
|
|
184
|
+
'Tuvalu',
|
|
185
|
+
'Uganda',
|
|
186
|
+
'Ukraine',
|
|
187
|
+
'United Arab Emirates',
|
|
188
|
+
'United Kingdom',
|
|
189
|
+
'United States of America',
|
|
190
|
+
'Uruguay',
|
|
191
|
+
'Uzbekistan',
|
|
192
|
+
'Vanuatu',
|
|
193
|
+
'Venezuela',
|
|
194
|
+
'Vietnam',
|
|
195
|
+
'Yemen',
|
|
196
|
+
'Zambia',
|
|
197
|
+
'Zimbabwe',
|
|
198
|
+
];
|
|
@@ -18,11 +18,17 @@ export function useControlledState<
|
|
|
18
18
|
): [V, CustomEventHandler<E, H>] {
|
|
19
19
|
const isControlled = valueProp !== undefined;
|
|
20
20
|
const wasControlled = useRef(isControlled);
|
|
21
|
+
const hasWarned = useRef(false);
|
|
21
22
|
const [valueState, setValueState] = useState<V>(defaultValue);
|
|
22
23
|
|
|
23
24
|
if (isControlled) {
|
|
24
|
-
if (
|
|
25
|
+
if (
|
|
26
|
+
wasControlled.current &&
|
|
27
|
+
process.env.NODE_ENV !== 'production' &&
|
|
28
|
+
!hasWarned.current
|
|
29
|
+
) {
|
|
25
30
|
console.warn('Trying to change from controlled to uncontrolled.');
|
|
31
|
+
hasWarned.current = true;
|
|
26
32
|
}
|
|
27
33
|
return [
|
|
28
34
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|