@northlight/ui 2.8.0 → 2.9.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.mts +17 -16
- package/dist/es/northlight.mjs +16 -5
- package/dist/es/northlight.mjs.map +1 -1
- package/dist/ts/types.d.ts +17 -16
- package/dist/umd/northlight.js +15 -3
- package/dist/umd/northlight.js.map +1 -1
- package/dist/umd/northlight.min.js +3 -3
- package/dist/umd/northlight.min.js.map +1 -1
- package/package.json +2 -2
package/dist/ts/types.d.ts
CHANGED
|
@@ -994,7 +994,7 @@ interface SearchBarOptionType {
|
|
|
994
994
|
value: any;
|
|
995
995
|
}
|
|
996
996
|
type CustomElementType<T extends SearchBarOptionType> = ((props: T) => JSX.Element) | null;
|
|
997
|
-
interface SearchBarProps<T extends SearchBarOptionType> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
|
|
997
|
+
interface SearchBarProps<T extends SearchBarOptionType, K extends boolean = false> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
|
|
998
998
|
value?: T | T[];
|
|
999
999
|
onChange?: (val: any, event: ActionMeta<T>) => void;
|
|
1000
1000
|
onAdd?: (val: unknown) => void;
|
|
@@ -1006,14 +1006,14 @@ interface SearchBarProps<T extends SearchBarOptionType> extends Omit<Props<T, bo
|
|
|
1006
1006
|
closeMenuonSelect?: boolean;
|
|
1007
1007
|
defaultOptions?: T[];
|
|
1008
1008
|
sx?: ChakraStylesConfig<any>;
|
|
1009
|
-
isMulti?:
|
|
1009
|
+
isMulti?: K;
|
|
1010
1010
|
customOption?: CustomElementType<T>;
|
|
1011
1011
|
customTag?: CustomElementType<T>;
|
|
1012
1012
|
loadOptions?: ((query: string) => Promise<T[]>) | null;
|
|
1013
1013
|
onSearchInputChange?: (input: string) => void;
|
|
1014
1014
|
icon?: ComponentType<any>;
|
|
1015
1015
|
}
|
|
1016
|
-
interface SearchBarFieldProps<T extends SearchBarOptionType> extends Omit<SearchBarProps<T>, 'onChange'>, InputFieldProps {
|
|
1016
|
+
interface SearchBarFieldProps<T extends SearchBarOptionType, K extends boolean = false> extends Omit<SearchBarProps<T, K>, 'onChange'>, InputFieldProps {
|
|
1017
1017
|
onChange?: (val: T | T[], event: ActionMeta<T>) => void;
|
|
1018
1018
|
direction?: StackDirection;
|
|
1019
1019
|
name: string;
|
|
@@ -1022,9 +1022,9 @@ interface SearchBarFieldProps<T extends SearchBarOptionType> extends Omit<Search
|
|
|
1022
1022
|
isRequired?: boolean;
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
-
declare const SearchBar: <T extends SearchBarOptionType>(props: SearchBarProps<T> & React__default.RefAttributes<SelectInstance<T,
|
|
1025
|
+
declare const SearchBar: <T extends SearchBarOptionType, K extends boolean = false>(props: SearchBarProps<T, K> & React__default.RefAttributes<SelectInstance<T, K, GroupBase<T>>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
1026
1026
|
|
|
1027
|
-
declare const SearchBarField: <T extends SearchBarOptionType>({ name, label, direction, isMulti, isRequired, validate, isClearable, onChange: onChangeCallback, inputLeftElement, inputRightElement, ...rest }: SearchBarFieldProps<T>) => JSX.Element;
|
|
1027
|
+
declare const SearchBarField: <T extends SearchBarOptionType, K extends boolean = false>({ name, label, direction, isMulti, isRequired, validate, isClearable, onChange: onChangeCallback, inputLeftElement, inputRightElement, ...rest }: SearchBarFieldProps<T, K>) => JSX.Element;
|
|
1028
1028
|
|
|
1029
1029
|
/**
|
|
1030
1030
|
* Context used for all drag and drop components
|
|
@@ -2439,12 +2439,12 @@ interface Option {
|
|
|
2439
2439
|
label: string;
|
|
2440
2440
|
value: string;
|
|
2441
2441
|
}
|
|
2442
|
-
interface SelectProps<T> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
|
|
2442
|
+
interface SelectProps<T, K> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value' | 'isMulti'> {
|
|
2443
2443
|
/** Whatever is currently selected by the select will be controlled by value prop */
|
|
2444
2444
|
value?: Option | Option[];
|
|
2445
2445
|
/** Take a look at the second argument, the event,
|
|
2446
2446
|
* for info as to which specific element was added */
|
|
2447
|
-
onChange?: (option: MultiValue<T>
|
|
2447
|
+
onChange?: (option: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
|
|
2448
2448
|
onAdd?: (val: unknown) => void;
|
|
2449
2449
|
onRemove?: (val: unknown) => void;
|
|
2450
2450
|
/** Used for accessibility */
|
|
@@ -2457,15 +2457,14 @@ interface SelectProps<T> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange
|
|
|
2457
2457
|
/** Custom icon that will be put to the faremost left of the component */
|
|
2458
2458
|
leftIcon?: ComponentType<any>;
|
|
2459
2459
|
customOption?: ((option: T) => JSX.Element) | null;
|
|
2460
|
+
isMulti?: K;
|
|
2460
2461
|
}
|
|
2461
|
-
type SelectFieldProps<T, K extends boolean = false> =
|
|
2462
|
-
onChange?: (val: K extends true ? T[] : T, event: ActionMeta<T>) => void;
|
|
2462
|
+
type SelectFieldProps<T, K extends boolean = false> = SelectProps<T, K> & Omit<InputFieldProps, 'isMulti'> & {
|
|
2463
2463
|
direction?: StackDirection;
|
|
2464
2464
|
name: string;
|
|
2465
2465
|
label: string;
|
|
2466
2466
|
validate?: RegisterOptions;
|
|
2467
2467
|
isRequired?: boolean;
|
|
2468
|
-
isMulti?: K;
|
|
2469
2468
|
};
|
|
2470
2469
|
|
|
2471
2470
|
/**
|
|
@@ -2591,7 +2590,7 @@ render(<CustomSelect />);
|
|
|
2591
2590
|
* />
|
|
2592
2591
|
* ?)
|
|
2593
2592
|
*/
|
|
2594
|
-
declare function Select<T extends Option>({ options, isMulti, onChange, onAdd, onRemove, isLoading, loadingList, 'data-testid': testId, customOption, customTag, value, icon, ...rest }: SelectProps<T>): JSX.Element;
|
|
2593
|
+
declare function Select<T extends Option, K extends boolean = false>({ options, isMulti, onChange, onAdd, onRemove, isLoading, loadingList, 'data-testid': testId, customOption, customTag, value, icon, ...rest }: SelectProps<T, K>): JSX.Element;
|
|
2595
2594
|
|
|
2596
2595
|
declare function SelectField<T extends Option, K extends boolean = false>({ name, label, options, direction, isMulti, isRequired, validate, isClearable, onChange: onChangeCallback, inputLeftElement, inputRightElement, ...rest }: SelectFieldProps<T, K>): JSX.Element;
|
|
2597
2596
|
|
|
@@ -3538,11 +3537,11 @@ declare const useArrowFocus: (columns: number) => {
|
|
|
3538
3537
|
focusLast: (opts?: _react_aria_focus.FocusManagerOptions | undefined) => _react_types_shared.FocusableElement;
|
|
3539
3538
|
};
|
|
3540
3539
|
|
|
3541
|
-
interface UseSelectCallbacksProps<T> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
|
|
3542
|
-
onChange: (
|
|
3540
|
+
interface UseSelectCallbacksProps<T, K extends boolean = false> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
|
|
3541
|
+
onChange: (option: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
|
|
3543
3542
|
onAdd: (val: unknown) => void;
|
|
3544
3543
|
onRemove: (val: unknown) => void;
|
|
3545
|
-
isMulti
|
|
3544
|
+
isMulti?: boolean;
|
|
3546
3545
|
value: T | T[];
|
|
3547
3546
|
}
|
|
3548
3547
|
interface BasicOption {
|
|
@@ -3551,11 +3550,13 @@ interface BasicOption {
|
|
|
3551
3550
|
}
|
|
3552
3551
|
type SelectActionMeta<T> = ActionMeta<T>;
|
|
3553
3552
|
|
|
3554
|
-
declare const useSelectCallbacks: <T extends BasicOption>({ onChange, onAdd, onRemove, isMulti, value, }: UseSelectCallbacksProps<T>) => (val: MultiValue<T>
|
|
3553
|
+
declare const useSelectCallbacks: <T extends BasicOption, K extends boolean = false>({ onChange, onAdd, onRemove, isMulti, value, }: UseSelectCallbacksProps<T, K>) => (val: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
|
|
3555
3554
|
|
|
3556
3555
|
declare const useOutsideRectClick: (ref: MutableRefObject<HTMLElement | null>, callback: (event: MouseEvent | TouchEvent) => void) => void;
|
|
3557
3556
|
|
|
3557
|
+
declare const useScreenSize: () => "sm" | "md" | "lg";
|
|
3558
|
+
|
|
3558
3559
|
declare const theme: Record<string, any>;
|
|
3559
3560
|
declare const tottTheme: Record<string, any>;
|
|
3560
3561
|
|
|
3561
|
-
export { Accordion, AccordionButton, AccordionItem, AccordionPanel, Alert, AlertProps, AlertVariants, AspectRatio, AsyncError, AsyncErrorProps, Avatar, AvatarBadgeProps, AvatarGroup, AvatarGroupProps, AvatarProps, Badge, BasicOption, Blinker, BlinkerProps, BlockVariant, BlockVariantColorTuple, Blockquote, BodyType, Button, ButtonProps, ButtonVariants, Capitalized, Carousel, Checkbox, CheckboxField, CheckboxFieldProps, CheckboxProps, CheckboxVariants, ChildrenType, Clickable, ClickableProps, ClipboardInput, ClipboardInputProps, Collapse, CollapseProps, Color, ColorButtonProps, ColorGrade, ColorPicker, ColorPickerField, ColorPickerFieldProps, ColorPickerProps, ColorShades, ColorsExpandButtonProps, ConfirmDeleteModalProps, CurrentTheme, CustomContainerPropsType, CustomElementType, CustomFlipButtonProps, CustomFlipButtonPropsType, CustomTheme, DatePicker, DatePickerField, DatePickerFieldProps, DatePickerProps, DateRange, DateRangePicker, DateRangePickerField, DateRangePickerFieldProps, DateRangePickerProps, DragAndDrop, DragHandle, DragHandleProps, DragItem, DragItemProps, Draggable, DraggableProps, DropZone, DropZoneProps, Droppable, DroppableProps, DurationType, EditableControlsProps, EditableProps, EditableSizes, EditableText, Fade, FadeProps, FastGrid, FastGridProps, FastList, FastListProps, Field, FieldErrorType, FieldProps, FileEditorModalProps, FileFormat, FileIconButtonProps, FileItemProps, FilePicker, FilePickerField, FilePickerFieldProps, FilePickerProps, FileWithSizeAndType, FileWithSrcNameType, FileWithType, FlipButton, FlipButtonGroup, FlipButtonGroupField, FlipButtonGroupFieldProps, FlipButtonGroupProps, FlipButtonProps, Form, FormBody, FormLabel, FormLabelProps, FormProps, FormattedNumberInput, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, Label, LabelProps, LabelSizes, LabelType, Lead, ListenersType, MaskedTextInput, MaskedTextInputProps, MediatoolThemeProvider, MediatoolThemeProviderProps, Message, Modal, ModalBase, ModalBooleans, ModalProps, ModalSizes, MultiFileList, MultiFileListProps, MultiFilePicker, MultiFilePickerField, MultiFilePickerFieldProps, MultiFilePickerProps, MultiFileUploader, MultiFileUploaderProps, MultiItemType, MultiSort, MultiSortProps, NotificationIconButton, NotificationIconButtonProps, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, ProgressBar, Radio, RadioFieldGroupProps, RadioFieldProps, RadioGroup, RadioGroupField, RadioGroupProps, RadioProps, ScaleFade, ScaleFadeProps, SearchBar, SearchBarField, SearchBarFieldProps, SearchBarOptionType, SearchBarProps, Select, SelectActionMeta, SelectField, SelectFieldProps, SelectProps, SetValueOptionsType, Slide, SlideFade, SlideFadeProps, SlideProps, Small, Sortable, SortableContainer, SortableContainerProps, SortableItem, SortableItemProps, SortableList, SortableListProps, Spinner, SpinnerProps, SplitPane, SplitPaneProps, StatusBlock, StatusBlockProps, StatusPin, StatusPinProps, Step, StepList, StepListProps, StepPanel, StepPanelProps, StepProps, StepStack, Steps, StepsProps, StylizedType, Switch, SwitchField, SwitchFieldProps, SwitchProps, TabPanel, TabPanelProps, Tabs, TabsProps, Tag, TagGroup, TagGroupProps, TagProps, TextField, TextFieldProps, TextInputFormatter, TextSizeProps, Textarea, TextareaField, TextareaFieldProps, TextareaProps, Tiny, Toast, ToastProps, Toolbox, ToolboxContent, ToolboxContentProps, ToolboxFooter, ToolboxFooterProps, ToolboxHeader, ToolboxHeaderProps, ToolboxProps, TransitionDirection, UseFormReturn, UseSelectCallbacksProps, UseToastOptions, addAlpha, advancedParseFloat, createDebounceFunctionInstance, getChildrenWithProps, getContrastColor, getFieldError, getInitials, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
|
|
3562
|
+
export { Accordion, AccordionButton, AccordionItem, AccordionPanel, Alert, AlertProps, AlertVariants, AspectRatio, AsyncError, AsyncErrorProps, Avatar, AvatarBadgeProps, AvatarGroup, AvatarGroupProps, AvatarProps, Badge, BasicOption, Blinker, BlinkerProps, BlockVariant, BlockVariantColorTuple, Blockquote, BodyType, Button, ButtonProps, ButtonVariants, Capitalized, Carousel, Checkbox, CheckboxField, CheckboxFieldProps, CheckboxProps, CheckboxVariants, ChildrenType, Clickable, ClickableProps, ClipboardInput, ClipboardInputProps, Collapse, CollapseProps, Color, ColorButtonProps, ColorGrade, ColorPicker, ColorPickerField, ColorPickerFieldProps, ColorPickerProps, ColorShades, ColorsExpandButtonProps, ConfirmDeleteModalProps, CurrentTheme, CustomContainerPropsType, CustomElementType, CustomFlipButtonProps, CustomFlipButtonPropsType, CustomTheme, DatePicker, DatePickerField, DatePickerFieldProps, DatePickerProps, DateRange, DateRangePicker, DateRangePickerField, DateRangePickerFieldProps, DateRangePickerProps, DragAndDrop, DragHandle, DragHandleProps, DragItem, DragItemProps, Draggable, DraggableProps, DropZone, DropZoneProps, Droppable, DroppableProps, DurationType, EditableControlsProps, EditableProps, EditableSizes, EditableText, Fade, FadeProps, FastGrid, FastGridProps, FastList, FastListProps, Field, FieldErrorType, FieldProps, FileEditorModalProps, FileFormat, FileIconButtonProps, FileItemProps, FilePicker, FilePickerField, FilePickerFieldProps, FilePickerProps, FileWithSizeAndType, FileWithSrcNameType, FileWithType, FlipButton, FlipButtonGroup, FlipButtonGroupField, FlipButtonGroupFieldProps, FlipButtonGroupProps, FlipButtonProps, Form, FormBody, FormLabel, FormLabelProps, FormProps, FormattedNumberInput, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, Label, LabelProps, LabelSizes, LabelType, Lead, ListenersType, MaskedTextInput, MaskedTextInputProps, MediatoolThemeProvider, MediatoolThemeProviderProps, Message, Modal, ModalBase, ModalBooleans, ModalProps, ModalSizes, MultiFileList, MultiFileListProps, MultiFilePicker, MultiFilePickerField, MultiFilePickerFieldProps, MultiFilePickerProps, MultiFileUploader, MultiFileUploaderProps, MultiItemType, MultiSort, MultiSortProps, NotificationIconButton, NotificationIconButtonProps, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, ProgressBar, Radio, RadioFieldGroupProps, RadioFieldProps, RadioGroup, RadioGroupField, RadioGroupProps, RadioProps, ScaleFade, ScaleFadeProps, SearchBar, SearchBarField, SearchBarFieldProps, SearchBarOptionType, SearchBarProps, Select, SelectActionMeta, SelectField, SelectFieldProps, SelectProps, SetValueOptionsType, Slide, SlideFade, SlideFadeProps, SlideProps, Small, Sortable, SortableContainer, SortableContainerProps, SortableItem, SortableItemProps, SortableList, SortableListProps, Spinner, SpinnerProps, SplitPane, SplitPaneProps, StatusBlock, StatusBlockProps, StatusPin, StatusPinProps, Step, StepList, StepListProps, StepPanel, StepPanelProps, StepProps, StepStack, Steps, StepsProps, StylizedType, Switch, SwitchField, SwitchFieldProps, SwitchProps, TabPanel, TabPanelProps, Tabs, TabsProps, Tag, TagGroup, TagGroupProps, TagProps, TextField, TextFieldProps, TextInputFormatter, TextSizeProps, Textarea, TextareaField, TextareaFieldProps, TextareaProps, Tiny, Toast, ToastProps, Toolbox, ToolboxContent, ToolboxContentProps, ToolboxFooter, ToolboxFooterProps, ToolboxHeader, ToolboxHeaderProps, ToolboxProps, TransitionDirection, UseFormReturn, UseSelectCallbacksProps, UseToastOptions, addAlpha, advancedParseFloat, createDebounceFunctionInstance, getChildrenWithProps, getContrastColor, getFieldError, getInitials, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
|
package/dist/umd/northlight.js
CHANGED
|
@@ -1605,7 +1605,7 @@
|
|
|
1605
1605
|
onChange,
|
|
1606
1606
|
onAdd,
|
|
1607
1607
|
onRemove,
|
|
1608
|
-
isMulti,
|
|
1608
|
+
isMulti = false,
|
|
1609
1609
|
value
|
|
1610
1610
|
}) => {
|
|
1611
1611
|
const items = React.useRef(value);
|
|
@@ -1694,6 +1694,17 @@
|
|
|
1694
1694
|
}, []);
|
|
1695
1695
|
};
|
|
1696
1696
|
|
|
1697
|
+
const useScreenSize = () => {
|
|
1698
|
+
const screenSizes = react.useMediaQuery(["(min-width: 1280px)", "(min-width: 1024px)"]);
|
|
1699
|
+
if (screenSizes[0]) {
|
|
1700
|
+
return "lg";
|
|
1701
|
+
}
|
|
1702
|
+
if (screenSizes[1]) {
|
|
1703
|
+
return "md";
|
|
1704
|
+
}
|
|
1705
|
+
return "sm";
|
|
1706
|
+
};
|
|
1707
|
+
|
|
1697
1708
|
function Field({
|
|
1698
1709
|
name,
|
|
1699
1710
|
label,
|
|
@@ -5331,7 +5342,7 @@
|
|
|
5331
5342
|
(_a, ref) => {
|
|
5332
5343
|
var _b = _a, {
|
|
5333
5344
|
defaultOptions = [],
|
|
5334
|
-
isMulti
|
|
5345
|
+
isMulti,
|
|
5335
5346
|
customOption = null,
|
|
5336
5347
|
customTag = null,
|
|
5337
5348
|
sx = {},
|
|
@@ -10841,7 +10852,7 @@
|
|
|
10841
10852
|
function Select(_a) {
|
|
10842
10853
|
var _b = _a, {
|
|
10843
10854
|
options,
|
|
10844
|
-
isMulti
|
|
10855
|
+
isMulti,
|
|
10845
10856
|
onChange = ramda.identity,
|
|
10846
10857
|
onAdd = ramda.identity,
|
|
10847
10858
|
onRemove = ramda.identity,
|
|
@@ -12993,6 +13004,7 @@
|
|
|
12993
13004
|
exports.useLoadingMessage = useLoadingMessage;
|
|
12994
13005
|
exports.useOutsideRectClick = useOutsideRectClick;
|
|
12995
13006
|
exports.useOverflowGroup = useOverflowGroup;
|
|
13007
|
+
exports.useScreenSize = useScreenSize;
|
|
12996
13008
|
exports.useScrollToBottom = useScrollToBottom;
|
|
12997
13009
|
exports.useSelectCallbacks = useSelectCallbacks;
|
|
12998
13010
|
exports.useSetValueRefreshed = useSetValueRefreshed;
|