@northlight/ui 2.15.3 → 2.15.4
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 +2 -15
- package/dist/es/northlight.js +3 -62
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +3 -62
- 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 +4 -4
package/dist/es/northlight.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { AbsoluteCenter, AccordionButtonProps, AccordionIcon, AccordionIconProps
|
|
|
3
3
|
import { Props, GroupBase, MultiValue, SingleValue, ActionMeta, MenuListProps, SelectInstance, ChakraStylesConfig } from 'chakra-react-select';
|
|
4
4
|
export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect, MultiValue, SingleValue } from 'chakra-react-select';
|
|
5
5
|
import * as React$1 from 'react';
|
|
6
|
-
import React__default, { ComponentType, Ref,
|
|
6
|
+
import React__default, { ComponentType, Ref, ChangeEvent, InputHTMLAttributes, ReactNode, ReactElement, RefObject, MutableRefObject, EffectCallback, DependencyList } from 'react';
|
|
7
7
|
import * as react_hook_form from 'react-hook-form';
|
|
8
8
|
import { RegisterOptions, FieldValues, UseFormReturn as UseFormReturn$1, SetValueConfig, FieldPath, Control, ControllerRenderProps, UseFormProps, FieldError, Merge, FieldErrorsImpl } from 'react-hook-form';
|
|
9
9
|
export { useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
|
|
@@ -143,15 +143,6 @@ interface SelectProps<T, K extends boolean> extends Omit<Props<T, K, GroupBase<T
|
|
|
143
143
|
customOption?: ((option: T) => JSX.Element) | null;
|
|
144
144
|
isMulti?: K;
|
|
145
145
|
ref?: Ref<SelectInstance<T, K, GroupBase<T>>>;
|
|
146
|
-
/** Points to the container that the select refers to when deciding where to fit menu.
|
|
147
|
-
* E.g if you render the select in a modal you may want to sent
|
|
148
|
-
* containerRef equal to a ref pointing to that modal,
|
|
149
|
-
* because in that case the select dropdown change placement to try and stay within the modal */
|
|
150
|
-
containerRef?: UseAdaptiveMenuPlacementProps['containerRef'];
|
|
151
|
-
/** The min height that will be reserveed for the select dropdown, used to determine wheter to put
|
|
152
|
-
* dropdown on top of or bottom of select
|
|
153
|
-
*/
|
|
154
|
-
dropdownMinHeightPx?: number;
|
|
155
146
|
}
|
|
156
147
|
type SelectFieldProps<T, K extends boolean = false> = SelectProps<T, K> & Omit<InputFieldProps, 'isMulti'> & {
|
|
157
148
|
direction?: StackDirection;
|
|
@@ -160,10 +151,6 @@ type SelectFieldProps<T, K extends boolean = false> = SelectProps<T, K> & Omit<I
|
|
|
160
151
|
validate?: RegisterOptions;
|
|
161
152
|
isRequired?: boolean;
|
|
162
153
|
};
|
|
163
|
-
interface UseAdaptiveMenuPlacementProps {
|
|
164
|
-
dropdownHeightPx: number;
|
|
165
|
-
containerRef?: RefObject<HTMLDivElement>;
|
|
166
|
-
}
|
|
167
154
|
|
|
168
155
|
/**
|
|
169
156
|
* Select component that provides a customizable and accessible select input.
|
|
@@ -3829,4 +3816,4 @@ declare const useDidUpdateEffect: (effect: EffectCallback, dependencies: Depende
|
|
|
3829
3816
|
declare const theme: Record<string, any>;
|
|
3830
3817
|
declare const tottTheme: Record<string, any>;
|
|
3831
3818
|
|
|
3832
|
-
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, FormattedNumberInputField, FormattedNumberInputFieldProps, FormattedNumberInputPreset, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, IntentButton, 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, NumVal, NumValType, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, PresetOptions, 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, Table, TableProps, Tabs, TabsProps, Tag, TagGroup, TagGroupProps, TagProps, TagsInput, TagsInputProps, TextField, TextFieldProps, TextInputFormatter, TextSizeProps, Textarea, TextareaField, TextareaFieldProps, TextareaProps, Tiny, Toast, ToastProps, Toolbox, ToolboxContent, ToolboxContentProps, ToolboxFooter, ToolboxFooterProps, ToolboxHeader, ToolboxHeaderProps, ToolboxProps, TransitionDirection,
|
|
3819
|
+
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, FormattedNumberInputField, FormattedNumberInputFieldProps, FormattedNumberInputPreset, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, IntentButton, 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, NumVal, NumValType, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, PresetOptions, 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, Table, TableProps, Tabs, TabsProps, Tag, TagGroup, TagGroupProps, TagProps, TagsInput, TagsInputProps, 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, getMatchingValue, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useDidUpdateEffect, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
|
package/dist/es/northlight.js
CHANGED
|
@@ -11597,49 +11597,6 @@ const getMatchingValue = (value, options) => {
|
|
|
11597
11597
|
return value;
|
|
11598
11598
|
};
|
|
11599
11599
|
|
|
11600
|
-
const useAdaptiveMenuPlacement = ({
|
|
11601
|
-
dropdownHeightPx,
|
|
11602
|
-
containerRef
|
|
11603
|
-
}) => {
|
|
11604
|
-
const [menuPlacement, setMenuPlacement] = useState("bottom");
|
|
11605
|
-
const selectContainerRef = useRef(null);
|
|
11606
|
-
const adjustMenuPlacement = () => {
|
|
11607
|
-
if (isNil(selectContainerRef.current))
|
|
11608
|
-
return;
|
|
11609
|
-
let node = selectContainerRef.current.parentNode;
|
|
11610
|
-
while (node.parentNode) {
|
|
11611
|
-
const { overflowY, maxHeight, height } = getComputedStyle(node);
|
|
11612
|
-
if (overflowY !== "visible" || maxHeight || height)
|
|
11613
|
-
break;
|
|
11614
|
-
node = node.parentNode;
|
|
11615
|
-
}
|
|
11616
|
-
const selectRect = selectContainerRef.current.getBoundingClientRect();
|
|
11617
|
-
const containerRect = containerRef && containerRef.current ? containerRef.current.getBoundingClientRect() : node.getBoundingClientRect();
|
|
11618
|
-
const pxToContainerBottom = Math.abs(
|
|
11619
|
-
selectRect.bottom - containerRect.bottom
|
|
11620
|
-
);
|
|
11621
|
-
const pxToContainerTop = Math.abs(selectRect.top - containerRect.top);
|
|
11622
|
-
const pxToWindowBottom = Math.abs(selectRect.bottom - window.innerHeight);
|
|
11623
|
-
const shouldBeAtTop = dropdownHeightPx > pxToContainerBottom && pxToContainerTop > pxToContainerBottom || dropdownHeightPx > pxToWindowBottom && selectRect.top > pxToWindowBottom;
|
|
11624
|
-
setMenuPlacement(shouldBeAtTop ? "top" : "bottom");
|
|
11625
|
-
};
|
|
11626
|
-
useEffect(() => {
|
|
11627
|
-
adjustMenuPlacement();
|
|
11628
|
-
window.addEventListener("resize", adjustMenuPlacement);
|
|
11629
|
-
window.addEventListener("scroll", adjustMenuPlacement);
|
|
11630
|
-
return () => {
|
|
11631
|
-
window.removeEventListener("resize", adjustMenuPlacement);
|
|
11632
|
-
window.addEventListener("scroll", adjustMenuPlacement);
|
|
11633
|
-
};
|
|
11634
|
-
}, []);
|
|
11635
|
-
return { selectContainerRef, menuPlacement };
|
|
11636
|
-
};
|
|
11637
|
-
|
|
11638
|
-
const DROPDOWN_MAX_HEIGHT = 300;
|
|
11639
|
-
const DROPDOWN_MIN_HEIGHT = 55;
|
|
11640
|
-
const DROPDOWN_OPTION_HEIGHT = 37;
|
|
11641
|
-
const DROPDOWN_PADDING = 30;
|
|
11642
|
-
|
|
11643
11600
|
var __defProp$m = Object.defineProperty;
|
|
11644
11601
|
var __defProps$2 = Object.defineProperties;
|
|
11645
11602
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -11684,9 +11641,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
11684
11641
|
customOption = null,
|
|
11685
11642
|
customTag = null,
|
|
11686
11643
|
value,
|
|
11687
|
-
icon
|
|
11688
|
-
containerRef,
|
|
11689
|
-
dropdownMinHeightPx = DROPDOWN_MIN_HEIGHT
|
|
11644
|
+
icon
|
|
11690
11645
|
} = _b, rest = __objRest$h(_b, [
|
|
11691
11646
|
"options",
|
|
11692
11647
|
"isMulti",
|
|
@@ -11699,9 +11654,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
11699
11654
|
"customOption",
|
|
11700
11655
|
"customTag",
|
|
11701
11656
|
"value",
|
|
11702
|
-
"icon"
|
|
11703
|
-
"containerRef",
|
|
11704
|
-
"dropdownMinHeightPx"
|
|
11657
|
+
"icon"
|
|
11705
11658
|
]);
|
|
11706
11659
|
const handleChange = useSelectCallbacks({
|
|
11707
11660
|
onChange,
|
|
@@ -11723,18 +11676,7 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
11723
11676
|
}
|
|
11724
11677
|
return prevOptions.current;
|
|
11725
11678
|
}, [options]);
|
|
11726
|
-
|
|
11727
|
-
Math.min(
|
|
11728
|
-
length(options || []) * DROPDOWN_OPTION_HEIGHT + DROPDOWN_PADDING,
|
|
11729
|
-
DROPDOWN_MAX_HEIGHT
|
|
11730
|
-
),
|
|
11731
|
-
dropdownMinHeightPx
|
|
11732
|
-
);
|
|
11733
|
-
const { selectContainerRef, menuPlacement } = useAdaptiveMenuPlacement({
|
|
11734
|
-
dropdownHeightPx,
|
|
11735
|
-
containerRef
|
|
11736
|
-
});
|
|
11737
|
-
return /* @__PURE__ */ React.createElement(Box, { w: "full", "data-testid": testId, "data-role": "select-container", ref: selectContainerRef }, /* @__PURE__ */ React.createElement(
|
|
11679
|
+
return /* @__PURE__ */ React.createElement(Box, { w: "full", "data-testid": testId }, /* @__PURE__ */ React.createElement(
|
|
11738
11680
|
Select$3,
|
|
11739
11681
|
__spreadValues$m(__spreadProps$2(__spreadValues$m({
|
|
11740
11682
|
isMulti,
|
|
@@ -11752,7 +11694,6 @@ const Select = forwardRef$1((_a, ref) => {
|
|
|
11752
11694
|
customOption,
|
|
11753
11695
|
customTag,
|
|
11754
11696
|
icon,
|
|
11755
|
-
menuPlacement,
|
|
11756
11697
|
components: customComponents,
|
|
11757
11698
|
ref
|
|
11758
11699
|
}), rest)
|