@northlight/ui 2.24.2 → 2.24.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/es/northlight.d.ts +9 -9
- package/dist/es/northlight.js +26 -13
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +25 -12
- package/dist/umd/northlight.cjs.map +1 -1
- package/dist/umd/northlight.min.cjs +2 -2
- package/dist/umd/northlight.min.cjs.map +1 -1
- package/package.json +2 -2
package/dist/es/northlight.d.ts
CHANGED
|
@@ -118,9 +118,9 @@ interface InputFieldProps {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
type Size$1 = 'sm' | 'md' | 'lg';
|
|
121
|
-
interface Option {
|
|
121
|
+
interface Option<T extends string = string> {
|
|
122
122
|
label: string;
|
|
123
|
-
value:
|
|
123
|
+
value: T;
|
|
124
124
|
}
|
|
125
125
|
interface SelectProps<T, K extends boolean> extends Omit<Props<T, K, GroupBase<T>>, 'onChange' | 'value' | 'isMulti'> {
|
|
126
126
|
/** Whatever is currently selected by the select will be controlled by value prop, if value is
|
|
@@ -275,9 +275,9 @@ render(<CustomSelect />);
|
|
|
275
275
|
* />
|
|
276
276
|
* ?)
|
|
277
277
|
*/
|
|
278
|
-
declare const Select: <T extends Option
|
|
278
|
+
declare const Select: <T extends Option<string>, K extends boolean = false>(props: SelectProps<T, K> & React__default.RefAttributes<SelectInstance<T, K, GroupBase<T>>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
279
279
|
|
|
280
|
-
declare const SelectField: <T extends Option
|
|
280
|
+
declare const SelectField: <T extends Option<string>, K extends boolean = false>(props: SelectProps<T, K> & Omit<InputFieldProps, "isMulti"> & {
|
|
281
281
|
direction?: _chakra_ui_layout_dist_stack_stack_utils.StackDirection | undefined;
|
|
282
282
|
name: string;
|
|
283
283
|
label: string;
|
|
@@ -285,7 +285,7 @@ declare const SelectField: <T extends Option, K extends boolean = false>(props:
|
|
|
285
285
|
isRequired?: boolean | undefined;
|
|
286
286
|
} & React__default.RefAttributes<HTMLDivElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
287
287
|
|
|
288
|
-
declare const getMatchingValue: <T extends Option
|
|
288
|
+
declare const getMatchingValue: <T extends Option<string>, K extends boolean>(value: (K extends true ? string[] | T[] : string | T) | undefined, options: react_select.OptionsOrGroups<T, react_select.GroupBase<T>> | undefined) => T | T[] | undefined;
|
|
289
289
|
|
|
290
290
|
interface TagsInputProps<T> extends Omit<SelectProps<T, true>, 'value' | 'formatCreateLabel' | 'isValidNewOption' | 'onAdd' | 'onRemove' | 'leftIcon' | 'icon' | 'customOption'> {
|
|
291
291
|
value?: MultiValue<T>;
|
|
@@ -4137,12 +4137,12 @@ declare const StepStack: ({ children, spacing, rowHeight, stepCircleAlignment, s
|
|
|
4137
4137
|
interface CreationOption extends Option {
|
|
4138
4138
|
isCreation: boolean;
|
|
4139
4139
|
}
|
|
4140
|
-
interface CreatableSelectDropdownProps {
|
|
4140
|
+
interface CreatableSelectDropdownProps<T extends string = string> {
|
|
4141
4141
|
/**
|
|
4142
4142
|
* An array of "Option" objects that represents the initial options available in the dropdown.
|
|
4143
4143
|
* Each "Option" object must have a "label" and a "value" property (both strings).
|
|
4144
4144
|
*/
|
|
4145
|
-
standardOptions: Option[];
|
|
4145
|
+
standardOptions: Option<T>[];
|
|
4146
4146
|
/**
|
|
4147
4147
|
* A callback function that is called whenever the selected option changes.
|
|
4148
4148
|
* This function receives the newly selected "Option" object as its only argument.
|
|
@@ -4180,7 +4180,7 @@ interface CreatableSelectDropdownProps {
|
|
|
4180
4180
|
/**
|
|
4181
4181
|
* Value of the initially selected option.
|
|
4182
4182
|
*/
|
|
4183
|
-
initialValue?:
|
|
4183
|
+
initialValue?: T;
|
|
4184
4184
|
}
|
|
4185
4185
|
|
|
4186
4186
|
/**
|
|
@@ -4251,7 +4251,7 @@ interface CreatableSelectDropdownProps {
|
|
|
4251
4251
|
* }
|
|
4252
4252
|
* ?)
|
|
4253
4253
|
*/
|
|
4254
|
-
declare const CreatableSelectDropdown: ({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, width, variant, initialValue, }: CreatableSelectDropdownProps) => JSX.Element;
|
|
4254
|
+
declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, width, variant, initialValue, }: CreatableSelectDropdownProps<T>) => JSX.Element;
|
|
4255
4255
|
|
|
4256
4256
|
declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
4257
4257
|
|
package/dist/es/northlight.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useInterval, useMediaQuery, useToken as useToken$1, Box, useMultiStyleConfig, chakra, Alert as Alert$2, AspectRatio as AspectRatio$1, forwardRef, useStyleConfig, Icon as Icon$2, Heading, Text, FormLabel as FormLabel$1, VisuallyHidden, HStack, Badge as Badge$2, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, Flex, IconButton as IconButton$1, Popover as Popover$1, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, keyframes, extendTheme, Table as Table$2, Thead, Tbody, Tr, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Tooltip as Tooltip$2, VStack, Circle, Center, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, Portal, CloseButton as CloseButton$1, Radio as Radio$2, RadioGroup as RadioGroup$1, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, Editable, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalBody as ModalBody$1, ModalHeader, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, Progress, Image as Image$1, ChakraProvider, Menu as Menu$2, NumberInputStepper as NumberInputStepper$1, Divider, NumberIncrementStepper, NumberDecrementStepper, NumberInput as NumberInput$2, NumberInputField as NumberInputField$1, PinInput as PinInput$2, Switch as Switch$2, TabPanel as TabPanel$1, Tabs as Tabs$2, Textarea as Textarea$2, useToast as useToast$1, TagLeftIcon, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Grid, GridItem } from '@chakra-ui/react';
|
|
1
|
+
import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useInterval, useMediaQuery, useToken as useToken$1, Box, useMultiStyleConfig, chakra, Alert as Alert$2, AspectRatio as AspectRatio$1, forwardRef, useStyleConfig, Icon as Icon$2, Heading, Text, FormLabel as FormLabel$1, VisuallyHidden, HStack, Badge as Badge$2, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, Flex, IconButton as IconButton$1, Popover as Popover$1, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, keyframes, extendTheme, Table as Table$2, Thead, Tbody, Tr, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Tooltip as Tooltip$2, VStack, Circle, Center, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, Portal, CloseButton as CloseButton$1, Radio as Radio$2, RadioGroup as RadioGroup$1, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, Editable, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalBody as ModalBody$1, ModalHeader, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, Progress, Image as Image$1, ChakraProvider, Menu as Menu$2, NumberInputStepper as NumberInputStepper$1, Divider, NumberIncrementStepper, NumberDecrementStepper, NumberInput as NumberInput$2, NumberInputField as NumberInputField$1, PinInput as PinInput$2, Switch as Switch$2, TabPanel as TabPanel$1, Tabs as Tabs$2, Textarea as Textarea$2, useToast as useToast$1, TagLeftIcon, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Grid, GridItem, useOutsideClick } from '@chakra-ui/react';
|
|
2
2
|
export { AbsoluteCenter, AccordionIcon, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, Box, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Hide, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkBox, LinkOverlay, List, ListIcon, ListItem, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, Show, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, keyframes, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
|
|
3
3
|
import React, { useState, useEffect, useRef, isValidElement, cloneElement, Children, createContext, useContext, forwardRef as forwardRef$1, useImperativeHandle, memo, useMemo, useCallback } from 'react';
|
|
4
4
|
import { CreatableSelect, chakraComponents, AsyncSelect, Select as Select$3 } from 'chakra-react-select';
|
|
@@ -13848,18 +13848,35 @@ const CreatableSelectDropdown = ({
|
|
|
13848
13848
|
onOptionChange,
|
|
13849
13849
|
width = "100%",
|
|
13850
13850
|
variant = "outline",
|
|
13851
|
-
initialValue
|
|
13851
|
+
initialValue
|
|
13852
13852
|
}) => {
|
|
13853
13853
|
const initialSelectedOption = useMemo(
|
|
13854
|
-
() =>
|
|
13855
|
-
|
|
13856
|
-
|
|
13854
|
+
() => {
|
|
13855
|
+
var _a;
|
|
13856
|
+
if (isNil(initialValue)) {
|
|
13857
|
+
return null;
|
|
13858
|
+
}
|
|
13859
|
+
return (_a = standardOptions.find((option) => option.value === initialValue)) != null ? _a : null;
|
|
13860
|
+
},
|
|
13857
13861
|
[]
|
|
13858
13862
|
);
|
|
13859
13863
|
const [selectedOption, setSelectedOption] = useState(initialSelectedOption);
|
|
13860
13864
|
const [newOptionText, setNewOptionText] = useState("");
|
|
13861
13865
|
const [newOptionPlaceholder, setNewOptionPlaceholder] = useState(initialPlaceholder);
|
|
13862
13866
|
const [createdOptions, setCreatedOptions] = useState([]);
|
|
13867
|
+
function isCreationOption(option) {
|
|
13868
|
+
return option && typeof option.isCreation === "boolean";
|
|
13869
|
+
}
|
|
13870
|
+
const ref = useRef(null);
|
|
13871
|
+
useOutsideClick({
|
|
13872
|
+
ref,
|
|
13873
|
+
handler: () => {
|
|
13874
|
+
if (isCreationOption(selectedOption)) {
|
|
13875
|
+
setSelectedOption(initialSelectedOption);
|
|
13876
|
+
setNewOptionPlaceholder(initialPlaceholder);
|
|
13877
|
+
}
|
|
13878
|
+
}
|
|
13879
|
+
});
|
|
13863
13880
|
const handleInputChange = (newValue) => {
|
|
13864
13881
|
setNewOptionText(newValue);
|
|
13865
13882
|
};
|
|
@@ -13875,9 +13892,6 @@ const CreatableSelectDropdown = ({
|
|
|
13875
13892
|
setNewOptionText("");
|
|
13876
13893
|
setNewOptionPlaceholder(initialPlaceholder);
|
|
13877
13894
|
};
|
|
13878
|
-
function isCreationOption(option) {
|
|
13879
|
-
return option && typeof option.isCreation === "string";
|
|
13880
|
-
}
|
|
13881
13895
|
const handleChange = (newValue, _actionMeta) => {
|
|
13882
13896
|
const option = newValue;
|
|
13883
13897
|
if (option === null) {
|
|
@@ -13885,11 +13899,10 @@ const CreatableSelectDropdown = ({
|
|
|
13885
13899
|
}
|
|
13886
13900
|
if (isCreationOption(option)) {
|
|
13887
13901
|
setNewOptionPlaceholder(addOptionPlaceholder);
|
|
13888
|
-
setSelectedOption(null);
|
|
13889
13902
|
} else {
|
|
13890
13903
|
setNewOptionPlaceholder(initialPlaceholder);
|
|
13891
|
-
setSelectedOption(option);
|
|
13892
13904
|
}
|
|
13905
|
+
setSelectedOption(option);
|
|
13893
13906
|
onOptionChange(option);
|
|
13894
13907
|
};
|
|
13895
13908
|
const handleKeyDown = (event) => {
|
|
@@ -13901,11 +13914,11 @@ const CreatableSelectDropdown = ({
|
|
|
13901
13914
|
const combinedOptions = [...standardOptions, ...createdOptions];
|
|
13902
13915
|
const customOptions = [
|
|
13903
13916
|
__spreadProps(__spreadValues({}, creationOption), {
|
|
13904
|
-
icon: /* @__PURE__ */ React.createElement(Icon$
|
|
13917
|
+
icon: /* @__PURE__ */ React.createElement(Icon$2, { as: PlusSolid, color: "brand" })
|
|
13905
13918
|
}),
|
|
13906
13919
|
...combinedOptions
|
|
13907
13920
|
];
|
|
13908
|
-
return /* @__PURE__ */ React.createElement(
|
|
13921
|
+
return /* @__PURE__ */ React.createElement(Box, { ref }, /* @__PURE__ */ React.createElement(
|
|
13909
13922
|
CreatableSelect,
|
|
13910
13923
|
{
|
|
13911
13924
|
chakraStyles: __spreadProps(__spreadValues({}, customSelectStyles), {
|
|
@@ -13929,7 +13942,7 @@ const CreatableSelectDropdown = ({
|
|
|
13929
13942
|
useBasicStyles: true,
|
|
13930
13943
|
variant
|
|
13931
13944
|
}
|
|
13932
|
-
);
|
|
13945
|
+
));
|
|
13933
13946
|
};
|
|
13934
13947
|
|
|
13935
13948
|
export { Accordion, AccordionButton, AccordionItem, AccordionPanel, Alert$1 as Alert, AspectRatio, AsyncError, Avatar$1 as Avatar, AvatarGroup, Badge$1 as Badge, Blinker$1 as Blinker, Blockquote$1 as Blockquote, Button$1 as Button, Capitalized$1 as Capitalized, Carousel, Checkbox$1 as Checkbox, CheckboxField, Clickable, ClipboardInput, Collapse, ColorPicker$1 as ColorPicker, ColorPickerField, CreatableSelectDropdown, CustomTheme, DatePicker, DatePickerField, DateRangePicker, DateRangePickerField, DragAndDrop, DragHandle, DragItem, Draggable, DropZone, Droppable, EditableText, Fade, FastGrid, FastList, Field, FilePicker, FilePickerField, FlipButton$1 as FlipButton, FlipButtonGroup, FlipButtonGroupField, Form, FormLabel, FormattedNumberInput, FormattedNumberInputField, H1$1 as H1, H2$1 as H2, H3$1 as H3, H4$1 as H4, H5$1 as H5, H6$1 as H6, Icon$1 as Icon, IconButton, IntentButton, Label$1 as Label, Lead$1 as Lead, LoadingBar, MaskedTextInput, MediatoolThemeProvider, Menu, Modal, ModalBase, ModalBody, MultiFileList, MultiFilePicker, MultiFilePickerField, MultiFileUploader, MultiSort, NotificationIconButton, NumVal$1 as NumVal, NumberInput, NumberInputField, OrganizationLogo, OverflowGroup, P$1 as P, PaneDivider, PaneItem, PinInput, Popover, ProgressBar, Radio, RadioGroup, RadioGroupField, ResizeHandle, ScaleFade, SearchBar, SearchBarField, Select, SelectField, Slide, SlideFade, Small$1 as Small, Sortable, SortableContainer, SortableItem, SortableList, Spinner$1 as Spinner, SplitPane, StatusBlock, StatusPin, Step, StepList, StepPanel, StepStack, Steps, Switch, SwitchField, TabPanel, Table, Tabs, Tag, TagGroup, TagsInput, TextField, Textarea, TextareaField, Tiny$1 as Tiny, Toast, Toolbox, ToolboxContent, ToolboxFooter, ToolboxHeader, Tooltip, addAlpha, advancedParseFloat, clamp, createDebounceFunctionInstance, getChildrenWithProps, getContrastColor, getFieldError, getInitials, getMatchingValue, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useDidUpdateEffect, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useResizeWidth, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
|