@northlight/ui 2.7.1 → 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.
@@ -9,9 +9,9 @@ import { RadioGroupState } from '@react-stately/radio';
9
9
  import { CSSObject } from '@emotion/react';
10
10
  import { DateValue } from '@internationalized/date';
11
11
  import { AriaDatePickerProps, AriaDateRangePickerProps } from '@react-aria/datepicker';
12
- import { Props, GroupBase, ActionMeta, ChakraStylesConfig, SelectInstance, MenuListProps, MultiValue, SingleValue } from 'chakra-react-select';
12
+ import { Props, GroupBase, ActionMeta, ChakraStylesConfig, SelectInstance, MultiValue, SingleValue, MenuListProps } from 'chakra-react-select';
13
13
  export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect } from 'chakra-react-select';
14
- import { DndContextProps, UseDroppableArguments, UseDraggableArguments, UniqueIdentifier, CollisionDetection, SensorDescriptor, SensorOptions } from '@dnd-kit/core';
14
+ import { DndContextProps, UseDroppableArguments, UseDraggableArguments, UniqueIdentifier, CollisionDetection, SensorDescriptor, SensorOptions, Modifiers } from '@dnd-kit/core';
15
15
  export * from '@dnd-kit/core';
16
16
  import { UseSortableArguments, SortingStrategy, SortableContextProps } from '@dnd-kit/sortable';
17
17
  export * from '@dnd-kit/sortable';
@@ -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?: boolean;
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, boolean, GroupBase<T>>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
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
@@ -1078,6 +1078,8 @@ interface SortableListProps<T> {
1078
1078
  disableDrag?: boolean;
1079
1079
  /** callback, passes the dragged item and it's old / new index after a drag, */
1080
1080
  onMovedItem?: ({ item, oldIndex, newIndex }: MovedItemType<T>) => void;
1081
+ /** Read: https://docs.dndkit.com/api-documentation/modifiers#restricting-motion-to-an-axis */
1082
+ modifiers?: Modifiers;
1081
1083
  }
1082
1084
  interface MultiSortProps<itemKeys extends string | number | symbol> {
1083
1085
  children?: ChildrenType$1;
@@ -1387,7 +1389,7 @@ the default behaviour of the rendered component instead of the dragging,
1387
1389
  *
1388
1390
  *
1389
1391
  */
1390
- declare function SortableList<T>({ children, items, collisionDetection, createKey, strategy, onChange, onMovedItem, displayOverlay, sensors, dblClickThreshold, disableDrag, }: SortableListProps<T>): JSX.Element;
1392
+ declare function SortableList<T>({ children, items, collisionDetection, createKey, strategy, onChange, onMovedItem, displayOverlay, sensors, dblClickThreshold, disableDrag, modifiers, }: SortableListProps<T>): JSX.Element;
1391
1393
 
1392
1394
  /**
1393
1395
  * Used with multi sort to render a sortable list inside a droppable
@@ -1779,6 +1781,9 @@ declare const IconButton: (props: IconButtonProps & React__default.RefAttributes
1779
1781
  type ModalSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full' | 'huge';
1780
1782
  interface ModalProps extends ModalProps$1 {
1781
1783
  size?: ModalSizes;
1784
+ /** If true then the modal will never unmount but only hide when closing,
1785
+ * stayMountedOnClose is false by default */
1786
+ stayMountedOnClose?: boolean;
1782
1787
  }
1783
1788
 
1784
1789
  interface CompressionType {
@@ -2434,12 +2439,12 @@ interface Option {
2434
2439
  label: string;
2435
2440
  value: string;
2436
2441
  }
2437
- 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'> {
2438
2443
  /** Whatever is currently selected by the select will be controlled by value prop */
2439
2444
  value?: Option | Option[];
2440
2445
  /** Take a look at the second argument, the event,
2441
- * for info as to which specific elmeent was added */
2442
- onChange?: (val: any, event: ActionMeta<T>) => void;
2446
+ * for info as to which specific element was added */
2447
+ onChange?: (option: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
2443
2448
  onAdd?: (val: unknown) => void;
2444
2449
  onRemove?: (val: unknown) => void;
2445
2450
  /** Used for accessibility */
@@ -2449,16 +2454,17 @@ interface SelectProps<T> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange
2449
2454
  loadingList?: ComponentType<MenuListProps<T, boolean, GroupBase<T>>> | undefined;
2450
2455
  /** Custom icon that will be put to the faremost right of the component */
2451
2456
  icon?: ComponentType<any>;
2457
+ /** Custom icon that will be put to the faremost left of the component */
2458
+ leftIcon?: ComponentType<any>;
2452
2459
  customOption?: ((option: T) => JSX.Element) | null;
2460
+ isMulti?: K;
2453
2461
  }
2454
- type SelectFieldProps<T, K extends boolean = false> = Omit<SelectProps<T>, 'onChange' | 'isMulti'> & Omit<InputFieldProps, 'isMulti'> & {
2455
- 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'> & {
2456
2463
  direction?: StackDirection;
2457
2464
  name: string;
2458
2465
  label: string;
2459
2466
  validate?: RegisterOptions;
2460
2467
  isRequired?: boolean;
2461
- isMulti?: K;
2462
2468
  };
2463
2469
 
2464
2470
  /**
@@ -2584,7 +2590,7 @@ render(<CustomSelect />);
2584
2590
  * />
2585
2591
  * ?)
2586
2592
  */
2587
- 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;
2588
2594
 
2589
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;
2590
2596
 
@@ -3076,7 +3082,8 @@ declare const AsyncError: ({ message, ...rest }: AsyncErrorProps) => JSX.Element
3076
3082
  * @see {@link https://northlight.dev/reference/modal}
3077
3083
  *
3078
3084
  * */
3079
- declare const Modal: ({ isCentered, children, ...rest }: ModalProps) => JSX.Element;
3085
+ declare const ModalBase: ({ isCentered, children, ...rest }: ModalProps) => JSX.Element;
3086
+ declare const Modal: ({ stayMountedOnClose, isOpen, ...rest }: ModalProps) => JSX.Element;
3080
3087
 
3081
3088
  /**
3082
3089
  * The context provider for handling state of components wrapped in field
@@ -3530,11 +3537,11 @@ declare const useArrowFocus: (columns: number) => {
3530
3537
  focusLast: (opts?: _react_aria_focus.FocusManagerOptions | undefined) => _react_types_shared.FocusableElement;
3531
3538
  };
3532
3539
 
3533
- interface UseSelectCallbacksProps<T> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
3534
- onChange: (val: unknown, event: ActionMeta<T>) => void;
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;
3535
3542
  onAdd: (val: unknown) => void;
3536
3543
  onRemove: (val: unknown) => void;
3537
- isMulti: boolean;
3544
+ isMulti?: boolean;
3538
3545
  value: T | T[];
3539
3546
  }
3540
3547
  interface BasicOption {
@@ -3543,11 +3550,13 @@ interface BasicOption {
3543
3550
  }
3544
3551
  type SelectActionMeta<T> = ActionMeta<T>;
3545
3552
 
3546
- declare const useSelectCallbacks: <T extends BasicOption>({ onChange, onAdd, onRemove, isMulti, value, }: UseSelectCallbacksProps<T>) => (val: MultiValue<T> | SingleValue<T>, event: ActionMeta<T>) => void;
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;
3554
+
3555
+ declare const useOutsideRectClick: (ref: MutableRefObject<HTMLElement | null>, callback: (event: MouseEvent | TouchEvent) => void) => void;
3547
3556
 
3548
- declare const useOutsideRectClick: (ref: MutableRefObject<HTMLElement | null>, callback: () => void) => void;
3557
+ declare const useScreenSize: () => "sm" | "md" | "lg";
3549
3558
 
3550
3559
  declare const theme: Record<string, any>;
3551
3560
  declare const tottTheme: Record<string, any>;
3552
3561
 
3553
- 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, 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 };