@northlight/ui 2.25.1 → 2.26.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/es/northlight.d.ts +8 -3
- package/dist/es/northlight.js +10 -6
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +10 -6
- package/dist/umd/northlight.cjs.map +1 -1
- package/dist/umd/northlight.min.cjs +3 -3
- package/dist/umd/northlight.min.cjs.map +1 -1
- package/package.json +2 -2
package/dist/es/northlight.d.ts
CHANGED
|
@@ -4181,7 +4181,11 @@ interface CreatableSelectDropdownProps<T extends string = string> {
|
|
|
4181
4181
|
/**
|
|
4182
4182
|
* Value of the initially selected option.
|
|
4183
4183
|
*/
|
|
4184
|
-
|
|
4184
|
+
defaultValue?: T;
|
|
4185
|
+
/**
|
|
4186
|
+
* Selected value.
|
|
4187
|
+
*/
|
|
4188
|
+
value?: T;
|
|
4185
4189
|
/**
|
|
4186
4190
|
*
|
|
4187
4191
|
Default placement of the menu in relation to the control. 'auto'
|
|
@@ -4220,6 +4224,7 @@ interface CreatableSelectDropdownProps<T extends string = string> {
|
|
|
4220
4224
|
* standardOptions={someOptions}
|
|
4221
4225
|
* onOptionChange={setArtist}
|
|
4222
4226
|
* width="300px"
|
|
4227
|
+
* value={artist ? artist.value : undefined}
|
|
4223
4228
|
* />
|
|
4224
4229
|
* {artist && artist.value !== 'Add option...' && (
|
|
4225
4230
|
* <H3 py={8}>The best artist is: {artist.label}</H3>
|
|
@@ -4232,7 +4237,7 @@ interface CreatableSelectDropdownProps<T extends string = string> {
|
|
|
4232
4237
|
* standardOptions={someOtherOptions}
|
|
4233
4238
|
* onOptionChange={setElement}
|
|
4234
4239
|
* width="300px"
|
|
4235
|
-
*
|
|
4240
|
+
* value={element ? element.value : undefined}
|
|
4236
4241
|
* />
|
|
4237
4242
|
* {element && element.value !== 'Add option...' && (
|
|
4238
4243
|
* <H3 py={8}>
|
|
@@ -4258,7 +4263,7 @@ interface CreatableSelectDropdownProps<T extends string = string> {
|
|
|
4258
4263
|
* }
|
|
4259
4264
|
* ?)
|
|
4260
4265
|
*/
|
|
4261
|
-
declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, width, variant,
|
|
4266
|
+
declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, width, variant, defaultValue, value, menuPlacement, }: CreatableSelectDropdownProps<T>) => JSX.Element;
|
|
4262
4267
|
|
|
4263
4268
|
declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
4264
4269
|
|
package/dist/es/northlight.js
CHANGED
|
@@ -13903,18 +13903,22 @@ const CreatableSelectDropdown = ({
|
|
|
13903
13903
|
onOptionChange,
|
|
13904
13904
|
width = "100%",
|
|
13905
13905
|
variant = "outline",
|
|
13906
|
-
|
|
13906
|
+
defaultValue,
|
|
13907
|
+
value,
|
|
13907
13908
|
menuPlacement = "bottom"
|
|
13908
13909
|
}) => {
|
|
13909
13910
|
const initialSelectedOption = useMemo(
|
|
13910
13911
|
() => {
|
|
13911
|
-
var _a;
|
|
13912
|
-
if (isNil(
|
|
13913
|
-
return null;
|
|
13912
|
+
var _a, _b;
|
|
13913
|
+
if (!isNil(value)) {
|
|
13914
|
+
return (_a = standardOptions.find((option) => option.value === value)) != null ? _a : null;
|
|
13914
13915
|
}
|
|
13915
|
-
|
|
13916
|
+
if (!isNil(defaultValue)) {
|
|
13917
|
+
return (_b = standardOptions.find((option) => option.value === defaultValue)) != null ? _b : null;
|
|
13918
|
+
}
|
|
13919
|
+
return null;
|
|
13916
13920
|
},
|
|
13917
|
-
[]
|
|
13921
|
+
[value]
|
|
13918
13922
|
);
|
|
13919
13923
|
const [selectedOption, setSelectedOption] = useState(initialSelectedOption);
|
|
13920
13924
|
const [newOptionText, setNewOptionText] = useState("");
|