@northlight/ui 2.24.1 → 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 +29 -14
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +28 -13
- 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 +3 -3
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';
|
|
@@ -12236,6 +12236,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
12236
12236
|
"data-testid": testId,
|
|
12237
12237
|
customOption = null,
|
|
12238
12238
|
customTag = null,
|
|
12239
|
+
isClearable = false,
|
|
12239
12240
|
value,
|
|
12240
12241
|
icon
|
|
12241
12242
|
} = _b, rest = __objRest$l(_b, [
|
|
@@ -12249,6 +12250,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
12249
12250
|
"data-testid",
|
|
12250
12251
|
"customOption",
|
|
12251
12252
|
"customTag",
|
|
12253
|
+
"isClearable",
|
|
12252
12254
|
"value",
|
|
12253
12255
|
"icon"
|
|
12254
12256
|
]);
|
|
@@ -12280,7 +12282,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
12280
12282
|
useBasicStyles: true,
|
|
12281
12283
|
closeMenuOnSelect: !isMulti,
|
|
12282
12284
|
hideSelectedOptions: false,
|
|
12283
|
-
isClearable
|
|
12285
|
+
isClearable,
|
|
12284
12286
|
onChange: handleChange,
|
|
12285
12287
|
selectedOptionStyle: "check",
|
|
12286
12288
|
chakraStyles: customSelectStyles,
|
|
@@ -13846,18 +13848,35 @@ const CreatableSelectDropdown = ({
|
|
|
13846
13848
|
onOptionChange,
|
|
13847
13849
|
width = "100%",
|
|
13848
13850
|
variant = "outline",
|
|
13849
|
-
initialValue
|
|
13851
|
+
initialValue
|
|
13850
13852
|
}) => {
|
|
13851
13853
|
const initialSelectedOption = useMemo(
|
|
13852
|
-
() =>
|
|
13853
|
-
|
|
13854
|
-
|
|
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
|
+
},
|
|
13855
13861
|
[]
|
|
13856
13862
|
);
|
|
13857
13863
|
const [selectedOption, setSelectedOption] = useState(initialSelectedOption);
|
|
13858
13864
|
const [newOptionText, setNewOptionText] = useState("");
|
|
13859
13865
|
const [newOptionPlaceholder, setNewOptionPlaceholder] = useState(initialPlaceholder);
|
|
13860
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
|
+
});
|
|
13861
13880
|
const handleInputChange = (newValue) => {
|
|
13862
13881
|
setNewOptionText(newValue);
|
|
13863
13882
|
};
|
|
@@ -13873,9 +13892,6 @@ const CreatableSelectDropdown = ({
|
|
|
13873
13892
|
setNewOptionText("");
|
|
13874
13893
|
setNewOptionPlaceholder(initialPlaceholder);
|
|
13875
13894
|
};
|
|
13876
|
-
function isCreationOption(option) {
|
|
13877
|
-
return option && typeof option.isCreation === "string";
|
|
13878
|
-
}
|
|
13879
13895
|
const handleChange = (newValue, _actionMeta) => {
|
|
13880
13896
|
const option = newValue;
|
|
13881
13897
|
if (option === null) {
|
|
@@ -13883,11 +13899,10 @@ const CreatableSelectDropdown = ({
|
|
|
13883
13899
|
}
|
|
13884
13900
|
if (isCreationOption(option)) {
|
|
13885
13901
|
setNewOptionPlaceholder(addOptionPlaceholder);
|
|
13886
|
-
setSelectedOption(null);
|
|
13887
13902
|
} else {
|
|
13888
13903
|
setNewOptionPlaceholder(initialPlaceholder);
|
|
13889
|
-
setSelectedOption(option);
|
|
13890
13904
|
}
|
|
13905
|
+
setSelectedOption(option);
|
|
13891
13906
|
onOptionChange(option);
|
|
13892
13907
|
};
|
|
13893
13908
|
const handleKeyDown = (event) => {
|
|
@@ -13899,11 +13914,11 @@ const CreatableSelectDropdown = ({
|
|
|
13899
13914
|
const combinedOptions = [...standardOptions, ...createdOptions];
|
|
13900
13915
|
const customOptions = [
|
|
13901
13916
|
__spreadProps(__spreadValues({}, creationOption), {
|
|
13902
|
-
icon: /* @__PURE__ */ React.createElement(Icon$
|
|
13917
|
+
icon: /* @__PURE__ */ React.createElement(Icon$2, { as: PlusSolid, color: "brand" })
|
|
13903
13918
|
}),
|
|
13904
13919
|
...combinedOptions
|
|
13905
13920
|
];
|
|
13906
|
-
return /* @__PURE__ */ React.createElement(
|
|
13921
|
+
return /* @__PURE__ */ React.createElement(Box, { ref }, /* @__PURE__ */ React.createElement(
|
|
13907
13922
|
CreatableSelect,
|
|
13908
13923
|
{
|
|
13909
13924
|
chakraStyles: __spreadProps(__spreadValues({}, customSelectStyles), {
|
|
@@ -13927,7 +13942,7 @@ const CreatableSelectDropdown = ({
|
|
|
13927
13942
|
useBasicStyles: true,
|
|
13928
13943
|
variant
|
|
13929
13944
|
}
|
|
13930
|
-
);
|
|
13945
|
+
));
|
|
13931
13946
|
};
|
|
13932
13947
|
|
|
13933
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 };
|