@northlight/ui 2.38.1 → 2.38.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 +33 -1
- package/dist/es/northlight.js +177 -176
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +176 -175
- 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 +2 -2
package/dist/es/northlight.d.ts
CHANGED
|
@@ -996,7 +996,14 @@ interface DatePickerSettings {
|
|
|
996
996
|
interface DatePickerProps extends Omit<AriaDatePickerProps<DateValue>, 'firstDayOfWeek'>, DatePickerSettings {
|
|
997
997
|
}
|
|
998
998
|
interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>, 'firstDayOfWeek' | 'onChange' | 'value' | 'minValue' | 'maxValue'>, DatePickerSettings {
|
|
999
|
+
/**
|
|
1000
|
+
* Function to be called when the user changes the date, both in
|
|
1001
|
+
* the modal and the input field.
|
|
1002
|
+
*/
|
|
999
1003
|
onChange?: (date: null | DateRange) => void;
|
|
1004
|
+
/**
|
|
1005
|
+
* Function to be called when the user saves the date change.
|
|
1006
|
+
*/
|
|
1000
1007
|
onSave?: () => void;
|
|
1001
1008
|
value: DateRange | null;
|
|
1002
1009
|
minValue?: string | undefined;
|
|
@@ -1004,13 +1011,38 @@ interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>,
|
|
|
1004
1011
|
fiscalStartMonth?: number;
|
|
1005
1012
|
fiscalStartDay?: number;
|
|
1006
1013
|
renderInPortal?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Label for the save button in the date range picker modal
|
|
1016
|
+
*/
|
|
1007
1017
|
buttonLabel?: string;
|
|
1008
|
-
|
|
1018
|
+
/**
|
|
1019
|
+
* The previously saved date range used for save/cancel functionality.
|
|
1020
|
+
* When provided along with defaultDateRange, enables save and cancel buttons that appear
|
|
1021
|
+
* when the current value differs from the saved value. The component will revert to this
|
|
1022
|
+
* value when the popover is closed without saving or when cancel is clicked.
|
|
1023
|
+
*/
|
|
1009
1024
|
savedDateRange?: DateRange | null;
|
|
1025
|
+
/**
|
|
1026
|
+
* The default date range to set when the input is cleared.
|
|
1027
|
+
* When provided, the clear button will be shown next to the input field when
|
|
1028
|
+
* modal is closed if the current value differs from the default value.
|
|
1029
|
+
* If not provided, the clear button will always be shown when modal is closed.
|
|
1030
|
+
*/
|
|
1010
1031
|
defaultDateRange?: DateRange | null;
|
|
1032
|
+
/**
|
|
1033
|
+
* Custom reset button to be shown next to the input field when modal is closed.
|
|
1034
|
+
* If not provided, the default clear button will be shown.
|
|
1035
|
+
*/
|
|
1011
1036
|
CustomResetButton?: React.ReactNode;
|
|
1037
|
+
/**
|
|
1038
|
+
* Custom label for the clear button in the date range picker modal
|
|
1039
|
+
*/
|
|
1012
1040
|
clearButtonLabel?: string;
|
|
1041
|
+
/**
|
|
1042
|
+
* Function to be called when the user cancels the date change
|
|
1043
|
+
*/
|
|
1013
1044
|
onCancelChanges?: () => void;
|
|
1045
|
+
'data-testid'?: string;
|
|
1014
1046
|
}
|
|
1015
1047
|
interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldProps {
|
|
1016
1048
|
name: string;
|
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, extendTheme, 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, Flex, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, CheckboxGroup, IconButton as IconButton$1, Popover as Popover$2, Portal, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, Table as Table$2, Thead, Tr, Tbody, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Spacer,
|
|
1
|
+
import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useInterval, useMediaQuery, useToken as useToken$1, extendTheme, 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, Flex, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, CheckboxGroup, IconButton as IconButton$1, Popover as Popover$2, Portal, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, Table as Table$2, Thead, Tr, Tbody, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Spacer, Tooltip as Tooltip$2, VStack, useOutsideClick, Circle, Center, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, 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 as Progress$1, 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, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Grid, GridItem, theme as theme$1 } 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, Mark, 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, 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';
|
|
@@ -7765,8 +7765,7 @@ const RangeCalendar = (props) => {
|
|
|
7765
7765
|
firstDayOfWeek,
|
|
7766
7766
|
onSave,
|
|
7767
7767
|
buttonLabel = "Save",
|
|
7768
|
-
clearButtonLabel = "Clear"
|
|
7769
|
-
onCancel
|
|
7768
|
+
clearButtonLabel = "Clear"
|
|
7770
7769
|
} = props;
|
|
7771
7770
|
const { locale } = useLocale();
|
|
7772
7771
|
const ref = useRef(null);
|
|
@@ -7797,14 +7796,6 @@ const RangeCalendar = (props) => {
|
|
|
7797
7796
|
locale,
|
|
7798
7797
|
createCalendar: () => new GregorianCalendar()
|
|
7799
7798
|
});
|
|
7800
|
-
const handleOnReset = () => {
|
|
7801
|
-
if (onCancel) {
|
|
7802
|
-
onCancel();
|
|
7803
|
-
} else {
|
|
7804
|
-
resetDate();
|
|
7805
|
-
}
|
|
7806
|
-
handleClose();
|
|
7807
|
-
};
|
|
7808
7799
|
const focusDateRange = (dateRange) => {
|
|
7809
7800
|
if (dateRange && dateRange.start && dateRange.end) {
|
|
7810
7801
|
calendarOneState.setFocusedDate(dateRange.start);
|
|
@@ -7824,6 +7815,10 @@ const RangeCalendar = (props) => {
|
|
|
7824
7815
|
onSave == null ? void 0 : onSave();
|
|
7825
7816
|
handleClose();
|
|
7826
7817
|
};
|
|
7818
|
+
const handleReset = () => {
|
|
7819
|
+
resetDate();
|
|
7820
|
+
handleClose();
|
|
7821
|
+
};
|
|
7827
7822
|
return /* @__PURE__ */ React.createElement(Box, { ref, __css: rangeCalendarContainer }, /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
|
|
7828
7823
|
QuickSelect,
|
|
7829
7824
|
{
|
|
@@ -7846,14 +7841,23 @@ const RangeCalendar = (props) => {
|
|
|
7846
7841
|
range: value,
|
|
7847
7842
|
firstDayOfWeek
|
|
7848
7843
|
}
|
|
7849
|
-
))), /* @__PURE__ */ React.createElement(HStack, { pt: "2", alignSelf: "end" }, isClearable && /* @__PURE__ */ React.createElement(Button, { onClick:
|
|
7844
|
+
))), /* @__PURE__ */ React.createElement(HStack, { pt: "2", alignSelf: "end" }, isClearable && /* @__PURE__ */ React.createElement(Button, { onClick: handleReset, variant: "ghost", size: "sm" }, clearButtonLabel), /* @__PURE__ */ React.createElement(Button, { variant: "brand", onClick: handleSave, size: "sm" }, buttonLabel))))))));
|
|
7850
7845
|
};
|
|
7851
7846
|
|
|
7852
7847
|
const isValidDateRange = (value) => is(Object, value) && has("startDate", value) && has("endDate", value) && is(String, value.startDate) && is(String, value.endDate);
|
|
7853
7848
|
|
|
7849
|
+
const tooltipIconMap = {
|
|
7850
|
+
success: CheckCircleSolid,
|
|
7851
|
+
warning: AlertTriangleSolid,
|
|
7852
|
+
error: AlertCircleSolid,
|
|
7853
|
+
danger: AlertOctagonSolid,
|
|
7854
|
+
info: InfoSolid,
|
|
7855
|
+
ai: BrightnessSolid,
|
|
7856
|
+
default: HelpCircleSolid,
|
|
7857
|
+
ghost: HelpCircleSolid
|
|
7858
|
+
};
|
|
7859
|
+
|
|
7854
7860
|
var __defProp$1p = Object.defineProperty;
|
|
7855
|
-
var __defProps$e = Object.defineProperties;
|
|
7856
|
-
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
7857
7861
|
var __getOwnPropSymbols$1p = Object.getOwnPropertySymbols;
|
|
7858
7862
|
var __hasOwnProp$1p = Object.prototype.hasOwnProperty;
|
|
7859
7863
|
var __propIsEnum$1p = Object.prototype.propertyIsEnumerable;
|
|
@@ -7869,6 +7873,73 @@ var __spreadValues$1p = (a, b) => {
|
|
|
7869
7873
|
}
|
|
7870
7874
|
return a;
|
|
7871
7875
|
};
|
|
7876
|
+
var __objRest$1b = (source, exclude) => {
|
|
7877
|
+
var target = {};
|
|
7878
|
+
for (var prop in source)
|
|
7879
|
+
if (__hasOwnProp$1p.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
7880
|
+
target[prop] = source[prop];
|
|
7881
|
+
if (source != null && __getOwnPropSymbols$1p)
|
|
7882
|
+
for (var prop of __getOwnPropSymbols$1p(source)) {
|
|
7883
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1p.call(source, prop))
|
|
7884
|
+
target[prop] = source[prop];
|
|
7885
|
+
}
|
|
7886
|
+
return target;
|
|
7887
|
+
};
|
|
7888
|
+
const Tooltip = (_a) => {
|
|
7889
|
+
var _b = _a, {
|
|
7890
|
+
variant = "default",
|
|
7891
|
+
hasArrow = true,
|
|
7892
|
+
title = "",
|
|
7893
|
+
description = "",
|
|
7894
|
+
hasIcon = false
|
|
7895
|
+
} = _b, rest = __objRest$1b(_b, [
|
|
7896
|
+
"variant",
|
|
7897
|
+
"hasArrow",
|
|
7898
|
+
"title",
|
|
7899
|
+
"description",
|
|
7900
|
+
"hasIcon"
|
|
7901
|
+
]);
|
|
7902
|
+
const iconVariant = variant;
|
|
7903
|
+
const icon = tooltipIconMap[iconVariant];
|
|
7904
|
+
const TooltipContent = /* @__PURE__ */ React.createElement(HStack, { alignItems: "flex-start" }, hasIcon && /* @__PURE__ */ React.createElement(Icon, { as: icon, color: `icon.toast.${iconVariant}` }), /* @__PURE__ */ React.createElement(VStack, { spacing: 0, alignItems: "flex-start" }, /* @__PURE__ */ React.createElement(Label, { size: "sm" }, title), /* @__PURE__ */ React.createElement(
|
|
7905
|
+
P,
|
|
7906
|
+
{
|
|
7907
|
+
variant: "14",
|
|
7908
|
+
sx: {
|
|
7909
|
+
color: !variant || variant === "ai" ? "text.inverted" : "text.default"
|
|
7910
|
+
}
|
|
7911
|
+
},
|
|
7912
|
+
description
|
|
7913
|
+
)));
|
|
7914
|
+
return /* @__PURE__ */ React.createElement(
|
|
7915
|
+
Tooltip$2,
|
|
7916
|
+
__spreadValues$1p({
|
|
7917
|
+
hasArrow,
|
|
7918
|
+
hasIcon,
|
|
7919
|
+
label: title || description ? TooltipContent : void 0,
|
|
7920
|
+
variant
|
|
7921
|
+
}, rest)
|
|
7922
|
+
);
|
|
7923
|
+
};
|
|
7924
|
+
|
|
7925
|
+
var __defProp$1o = Object.defineProperty;
|
|
7926
|
+
var __defProps$e = Object.defineProperties;
|
|
7927
|
+
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
7928
|
+
var __getOwnPropSymbols$1o = Object.getOwnPropertySymbols;
|
|
7929
|
+
var __hasOwnProp$1o = Object.prototype.hasOwnProperty;
|
|
7930
|
+
var __propIsEnum$1o = Object.prototype.propertyIsEnumerable;
|
|
7931
|
+
var __defNormalProp$1o = (obj, key, value) => key in obj ? __defProp$1o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7932
|
+
var __spreadValues$1o = (a, b) => {
|
|
7933
|
+
for (var prop in b || (b = {}))
|
|
7934
|
+
if (__hasOwnProp$1o.call(b, prop))
|
|
7935
|
+
__defNormalProp$1o(a, prop, b[prop]);
|
|
7936
|
+
if (__getOwnPropSymbols$1o)
|
|
7937
|
+
for (var prop of __getOwnPropSymbols$1o(b)) {
|
|
7938
|
+
if (__propIsEnum$1o.call(b, prop))
|
|
7939
|
+
__defNormalProp$1o(a, prop, b[prop]);
|
|
7940
|
+
}
|
|
7941
|
+
return a;
|
|
7942
|
+
};
|
|
7872
7943
|
var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
7873
7944
|
const parseValue = (value) => {
|
|
7874
7945
|
if (!isValidDateRange(value))
|
|
@@ -7904,12 +7975,11 @@ const DateRangePicker = (props) => {
|
|
|
7904
7975
|
onSave,
|
|
7905
7976
|
buttonLabel = "Save",
|
|
7906
7977
|
clearButtonLabel = "Clear",
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
savedDateRange = value,
|
|
7910
|
-
defaultDateRange = value,
|
|
7978
|
+
savedDateRange,
|
|
7979
|
+
defaultDateRange,
|
|
7911
7980
|
CustomResetButton,
|
|
7912
|
-
onCancelChanges
|
|
7981
|
+
onCancelChanges,
|
|
7982
|
+
"data-testid": dataTestId
|
|
7913
7983
|
} = props;
|
|
7914
7984
|
const ref = useRef();
|
|
7915
7985
|
const { group } = useMultiStyleConfig("DatePicker");
|
|
@@ -7937,9 +8007,6 @@ const DateRangePicker = (props) => {
|
|
|
7937
8007
|
shouldCloseOnSelect: false,
|
|
7938
8008
|
hideTimeZone: true
|
|
7939
8009
|
});
|
|
7940
|
-
useEffect(() => {
|
|
7941
|
-
setIsOpen(state.isOpen);
|
|
7942
|
-
}, [state.isOpen]);
|
|
7943
8010
|
const {
|
|
7944
8011
|
groupProps,
|
|
7945
8012
|
startFieldProps,
|
|
@@ -7948,7 +8015,7 @@ const DateRangePicker = (props) => {
|
|
|
7948
8015
|
dialogProps,
|
|
7949
8016
|
calendarProps
|
|
7950
8017
|
} = useDateRangePicker(
|
|
7951
|
-
{
|
|
8018
|
+
__spreadValues$1o({
|
|
7952
8019
|
onChange: (date) => {
|
|
7953
8020
|
onChangeCallback({
|
|
7954
8021
|
startDate: date == null ? void 0 : date.start.toString(),
|
|
@@ -7964,14 +8031,14 @@ const DateRangePicker = (props) => {
|
|
|
7964
8031
|
isDisabled,
|
|
7965
8032
|
isInvalid,
|
|
7966
8033
|
startName: props.startName,
|
|
7967
|
-
endName: props.endName
|
|
7968
|
-
|
|
8034
|
+
endName: props.endName,
|
|
8035
|
+
"aria-label": "Date range picker"
|
|
8036
|
+
}, !isNil(dataTestId) && { "data-testid": dataTestId }),
|
|
7969
8037
|
state,
|
|
7970
8038
|
ref
|
|
7971
8039
|
);
|
|
7972
8040
|
const togglePopup = () => state.setOpen(!state.isOpen);
|
|
7973
8041
|
const handleClose = () => {
|
|
7974
|
-
onChangeCallback(savedDateRange);
|
|
7975
8042
|
state.setOpen(false);
|
|
7976
8043
|
};
|
|
7977
8044
|
useOutsideClick({
|
|
@@ -7991,12 +8058,14 @@ const DateRangePicker = (props) => {
|
|
|
7991
8058
|
icon: /* @__PURE__ */ React.createElement(Icon, { as: XCloseSolid })
|
|
7992
8059
|
}
|
|
7993
8060
|
);
|
|
7994
|
-
const
|
|
7995
|
-
const isCurrentDateDefault = isDatesEqual(value, defaultDateRange);
|
|
7996
|
-
const cancelDateChange = () => {
|
|
8061
|
+
const cancelOrResetDateChange = () => {
|
|
7997
8062
|
if (onCancelChanges) {
|
|
8063
|
+
if (!isNil(savedDateRange))
|
|
8064
|
+
onChangeCallback(savedDateRange);
|
|
7998
8065
|
onCancelChanges();
|
|
7999
8066
|
} else {
|
|
8067
|
+
if (!isNil(defaultDateRange))
|
|
8068
|
+
onChangeCallback(defaultDateRange);
|
|
8000
8069
|
resetDate();
|
|
8001
8070
|
}
|
|
8002
8071
|
};
|
|
@@ -8004,41 +8073,49 @@ const DateRangePicker = (props) => {
|
|
|
8004
8073
|
onSave == null ? void 0 : onSave();
|
|
8005
8074
|
handleClose();
|
|
8006
8075
|
};
|
|
8007
|
-
const
|
|
8008
|
-
|
|
8076
|
+
const handleModalClose = () => {
|
|
8077
|
+
if (!isNil(savedDateRange))
|
|
8078
|
+
onChangeCallback(savedDateRange);
|
|
8079
|
+
handleClose();
|
|
8080
|
+
};
|
|
8081
|
+
const isCurrentDateSaved = isNil(savedDateRange) || isDatesEqual(value, savedDateRange);
|
|
8082
|
+
const isDateResettable = isNil(defaultDateRange) || !isDatesEqual(value, defaultDateRange);
|
|
8083
|
+
const canShowSaveAndCancelButtons = !isNil(savedDateRange) && !isNil(defaultDateRange);
|
|
8084
|
+
const shouldShowResetButton = !state.isOpen && isCurrentDateSaved && isDateResettable;
|
|
8085
|
+
const shouldShowSaveAndCancelButtons = canShowSaveAndCancelButtons && !state.isOpen && !isCurrentDateSaved;
|
|
8009
8086
|
return /* @__PURE__ */ React.createElement(
|
|
8010
8087
|
Popover,
|
|
8011
8088
|
{
|
|
8012
8089
|
isOpen: state.isOpen,
|
|
8013
|
-
onClose:
|
|
8090
|
+
onClose: handleModalClose,
|
|
8014
8091
|
placement: "bottom-start"
|
|
8015
8092
|
},
|
|
8016
|
-
/* @__PURE__ */ React.createElement(PopoverAnchor, null, /* @__PURE__ */ React.createElement(HStack, null, /* @__PURE__ */ React.createElement(InputGroup, __spreadProps$e(__spreadValues$
|
|
8093
|
+
/* @__PURE__ */ React.createElement(PopoverAnchor, null, /* @__PURE__ */ React.createElement(HStack, null, /* @__PURE__ */ React.createElement(InputGroup, __spreadProps$e(__spreadValues$1o({}, groupProps), { ref, __css: group }), /* @__PURE__ */ React.createElement(
|
|
8017
8094
|
StyledField,
|
|
8018
8095
|
{
|
|
8019
8096
|
isDisabled,
|
|
8020
8097
|
isInvalid,
|
|
8021
8098
|
variant
|
|
8022
8099
|
},
|
|
8023
|
-
/* @__PURE__ */ React.createElement(HStack, { paddingInlineStart: "1a", paddingInlineEnd: 10 }, /* @__PURE__ */ React.createElement(DateField, __spreadProps$e(__spreadValues$
|
|
8100
|
+
/* @__PURE__ */ React.createElement(HStack, { paddingInlineStart: "1a", paddingInlineEnd: 10 }, /* @__PURE__ */ React.createElement(DateField, __spreadProps$e(__spreadValues$1o({}, startFieldProps), { dateFormat })), /* @__PURE__ */ React.createElement(P, null, "-"), /* @__PURE__ */ React.createElement(DateField, __spreadProps$e(__spreadValues$1o({}, endFieldProps), { dateFormat })))
|
|
8024
8101
|
), /* @__PURE__ */ React.createElement(InputRightElement, { sx: { height: "100%", paddingRight: "1" } }, /* @__PURE__ */ React.createElement(
|
|
8025
8102
|
Trigger,
|
|
8026
|
-
__spreadProps$e(__spreadValues$
|
|
8103
|
+
__spreadProps$e(__spreadValues$1o({}, buttonProps), {
|
|
8027
8104
|
isDisabled,
|
|
8028
8105
|
handleClick: togglePopup
|
|
8029
8106
|
})
|
|
8030
|
-
))), shouldShowResetButton && ResetButton, shouldShowSaveAndCancelButtons && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
8107
|
+
))), shouldShowResetButton && ResetButton, shouldShowSaveAndCancelButtons && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { label: clearButtonLabel }, /* @__PURE__ */ React.createElement(
|
|
8031
8108
|
IconButton,
|
|
8032
8109
|
{
|
|
8033
8110
|
"aria-label": "cancel-date-change",
|
|
8034
8111
|
variant: "ghost",
|
|
8035
8112
|
size: "sm",
|
|
8036
8113
|
fontSize: "xs",
|
|
8037
|
-
onClick:
|
|
8114
|
+
onClick: onCancelChanges,
|
|
8038
8115
|
isDisabled,
|
|
8039
8116
|
icon: /* @__PURE__ */ React.createElement(Icon, { as: XCloseSolid })
|
|
8040
8117
|
}
|
|
8041
|
-
), /* @__PURE__ */ React.createElement(
|
|
8118
|
+
)), /* @__PURE__ */ React.createElement(Tooltip, { label: buttonLabel }, /* @__PURE__ */ React.createElement(
|
|
8042
8119
|
IconButton,
|
|
8043
8120
|
{
|
|
8044
8121
|
"aria-label": "save-date",
|
|
@@ -8046,20 +8123,20 @@ const DateRangePicker = (props) => {
|
|
|
8046
8123
|
size: "sm",
|
|
8047
8124
|
fontSize: "xs",
|
|
8048
8125
|
onClick: handleSave,
|
|
8126
|
+
isDisabled,
|
|
8049
8127
|
icon: /* @__PURE__ */ React.createElement(Icon, { as: CheckSolid })
|
|
8050
8128
|
}
|
|
8051
|
-
)))),
|
|
8052
|
-
/* @__PURE__ */ React.createElement(PortalWrapper, { renderInPortal }, state.isOpen && /* @__PURE__ */ React.createElement(PopoverContent, __spreadProps$e(__spreadValues$
|
|
8129
|
+
))))),
|
|
8130
|
+
/* @__PURE__ */ React.createElement(PortalWrapper, { renderInPortal }, state.isOpen && /* @__PURE__ */ React.createElement(PopoverContent, __spreadProps$e(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(DatePickerLocaleWrapper, { firstDayOfWeek }, /* @__PURE__ */ React.createElement(
|
|
8053
8131
|
RangeCalendar,
|
|
8054
|
-
__spreadProps$e(__spreadValues$
|
|
8055
|
-
resetDate,
|
|
8132
|
+
__spreadProps$e(__spreadValues$1o({}, calendarProps), {
|
|
8133
|
+
resetDate: cancelOrResetDateChange,
|
|
8056
8134
|
handleClose,
|
|
8057
8135
|
fiscalStartMonth: fiscalStartMonth || 0,
|
|
8058
8136
|
fiscalStartDay: fiscalStartDay || 0,
|
|
8059
8137
|
isClearable,
|
|
8060
8138
|
firstDayOfWeek,
|
|
8061
8139
|
onSave,
|
|
8062
|
-
onCancel: onCancelChanges,
|
|
8063
8140
|
clearButtonLabel,
|
|
8064
8141
|
buttonLabel
|
|
8065
8142
|
})
|
|
@@ -8067,30 +8144,30 @@ const DateRangePicker = (props) => {
|
|
|
8067
8144
|
);
|
|
8068
8145
|
};
|
|
8069
8146
|
|
|
8070
|
-
var __defProp$
|
|
8071
|
-
var __getOwnPropSymbols$
|
|
8072
|
-
var __hasOwnProp$
|
|
8073
|
-
var __propIsEnum$
|
|
8074
|
-
var __defNormalProp$
|
|
8075
|
-
var __spreadValues$
|
|
8147
|
+
var __defProp$1n = Object.defineProperty;
|
|
8148
|
+
var __getOwnPropSymbols$1n = Object.getOwnPropertySymbols;
|
|
8149
|
+
var __hasOwnProp$1n = Object.prototype.hasOwnProperty;
|
|
8150
|
+
var __propIsEnum$1n = Object.prototype.propertyIsEnumerable;
|
|
8151
|
+
var __defNormalProp$1n = (obj, key, value) => key in obj ? __defProp$1n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8152
|
+
var __spreadValues$1n = (a, b) => {
|
|
8076
8153
|
for (var prop in b || (b = {}))
|
|
8077
|
-
if (__hasOwnProp$
|
|
8078
|
-
__defNormalProp$
|
|
8079
|
-
if (__getOwnPropSymbols$
|
|
8080
|
-
for (var prop of __getOwnPropSymbols$
|
|
8081
|
-
if (__propIsEnum$
|
|
8082
|
-
__defNormalProp$
|
|
8154
|
+
if (__hasOwnProp$1n.call(b, prop))
|
|
8155
|
+
__defNormalProp$1n(a, prop, b[prop]);
|
|
8156
|
+
if (__getOwnPropSymbols$1n)
|
|
8157
|
+
for (var prop of __getOwnPropSymbols$1n(b)) {
|
|
8158
|
+
if (__propIsEnum$1n.call(b, prop))
|
|
8159
|
+
__defNormalProp$1n(a, prop, b[prop]);
|
|
8083
8160
|
}
|
|
8084
8161
|
return a;
|
|
8085
8162
|
};
|
|
8086
|
-
var __objRest$
|
|
8163
|
+
var __objRest$1a = (source, exclude) => {
|
|
8087
8164
|
var target = {};
|
|
8088
8165
|
for (var prop in source)
|
|
8089
|
-
if (__hasOwnProp$
|
|
8166
|
+
if (__hasOwnProp$1n.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8090
8167
|
target[prop] = source[prop];
|
|
8091
|
-
if (source != null && __getOwnPropSymbols$
|
|
8092
|
-
for (var prop of __getOwnPropSymbols$
|
|
8093
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
8168
|
+
if (source != null && __getOwnPropSymbols$1n)
|
|
8169
|
+
for (var prop of __getOwnPropSymbols$1n(source)) {
|
|
8170
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1n.call(source, prop))
|
|
8094
8171
|
target[prop] = source[prop];
|
|
8095
8172
|
}
|
|
8096
8173
|
return target;
|
|
@@ -8100,39 +8177,39 @@ const InputGroupWrapper = (_a) => {
|
|
|
8100
8177
|
inputLeftElement,
|
|
8101
8178
|
inputRightElement,
|
|
8102
8179
|
children
|
|
8103
|
-
} = _b, rest = __objRest$
|
|
8180
|
+
} = _b, rest = __objRest$1a(_b, [
|
|
8104
8181
|
"inputLeftElement",
|
|
8105
8182
|
"inputRightElement",
|
|
8106
8183
|
"children"
|
|
8107
8184
|
]);
|
|
8108
8185
|
const containsInputGroupElement = not(all(isNil, [inputLeftElement, inputRightElement]));
|
|
8109
|
-
return containsInputGroupElement ? /* @__PURE__ */ React.createElement(InputGroup, __spreadValues$
|
|
8186
|
+
return containsInputGroupElement ? /* @__PURE__ */ React.createElement(InputGroup, __spreadValues$1n({}, rest), inputLeftElement, children, inputRightElement) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
8110
8187
|
};
|
|
8111
8188
|
|
|
8112
|
-
var __defProp$
|
|
8113
|
-
var __getOwnPropSymbols$
|
|
8114
|
-
var __hasOwnProp$
|
|
8115
|
-
var __propIsEnum$
|
|
8116
|
-
var __defNormalProp$
|
|
8117
|
-
var __spreadValues$
|
|
8189
|
+
var __defProp$1m = Object.defineProperty;
|
|
8190
|
+
var __getOwnPropSymbols$1m = Object.getOwnPropertySymbols;
|
|
8191
|
+
var __hasOwnProp$1m = Object.prototype.hasOwnProperty;
|
|
8192
|
+
var __propIsEnum$1m = Object.prototype.propertyIsEnumerable;
|
|
8193
|
+
var __defNormalProp$1m = (obj, key, value) => key in obj ? __defProp$1m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8194
|
+
var __spreadValues$1m = (a, b) => {
|
|
8118
8195
|
for (var prop in b || (b = {}))
|
|
8119
|
-
if (__hasOwnProp$
|
|
8120
|
-
__defNormalProp$
|
|
8121
|
-
if (__getOwnPropSymbols$
|
|
8122
|
-
for (var prop of __getOwnPropSymbols$
|
|
8123
|
-
if (__propIsEnum$
|
|
8124
|
-
__defNormalProp$
|
|
8196
|
+
if (__hasOwnProp$1m.call(b, prop))
|
|
8197
|
+
__defNormalProp$1m(a, prop, b[prop]);
|
|
8198
|
+
if (__getOwnPropSymbols$1m)
|
|
8199
|
+
for (var prop of __getOwnPropSymbols$1m(b)) {
|
|
8200
|
+
if (__propIsEnum$1m.call(b, prop))
|
|
8201
|
+
__defNormalProp$1m(a, prop, b[prop]);
|
|
8125
8202
|
}
|
|
8126
8203
|
return a;
|
|
8127
8204
|
};
|
|
8128
|
-
var __objRest$
|
|
8205
|
+
var __objRest$19 = (source, exclude) => {
|
|
8129
8206
|
var target = {};
|
|
8130
8207
|
for (var prop in source)
|
|
8131
|
-
if (__hasOwnProp$
|
|
8208
|
+
if (__hasOwnProp$1m.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8132
8209
|
target[prop] = source[prop];
|
|
8133
|
-
if (source != null && __getOwnPropSymbols$
|
|
8134
|
-
for (var prop of __getOwnPropSymbols$
|
|
8135
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
8210
|
+
if (source != null && __getOwnPropSymbols$1m)
|
|
8211
|
+
for (var prop of __getOwnPropSymbols$1m(source)) {
|
|
8212
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1m.call(source, prop))
|
|
8136
8213
|
target[prop] = source[prop];
|
|
8137
8214
|
}
|
|
8138
8215
|
return target;
|
|
@@ -8150,7 +8227,7 @@ const DatePickerField = forwardRef$1((_a, ref) => {
|
|
|
8150
8227
|
onChange: onChangeCallback = identity,
|
|
8151
8228
|
inputLeftElement,
|
|
8152
8229
|
inputRightElement
|
|
8153
|
-
} = _b, rest = __objRest$
|
|
8230
|
+
} = _b, rest = __objRest$19(_b, [
|
|
8154
8231
|
"name",
|
|
8155
8232
|
"minValue",
|
|
8156
8233
|
"maxValue",
|
|
@@ -8194,7 +8271,7 @@ const DatePickerField = forwardRef$1((_a, ref) => {
|
|
|
8194
8271
|
},
|
|
8195
8272
|
/* @__PURE__ */ React.createElement(
|
|
8196
8273
|
DatePicker,
|
|
8197
|
-
__spreadValues$
|
|
8274
|
+
__spreadValues$1m({
|
|
8198
8275
|
firstDayOfWeek,
|
|
8199
8276
|
"aria-label": label,
|
|
8200
8277
|
isInvalid: !!errors[name],
|
|
@@ -8210,30 +8287,30 @@ const DatePickerField = forwardRef$1((_a, ref) => {
|
|
|
8210
8287
|
);
|
|
8211
8288
|
});
|
|
8212
8289
|
|
|
8213
|
-
var __defProp$
|
|
8214
|
-
var __getOwnPropSymbols$
|
|
8215
|
-
var __hasOwnProp$
|
|
8216
|
-
var __propIsEnum$
|
|
8217
|
-
var __defNormalProp$
|
|
8218
|
-
var __spreadValues$
|
|
8290
|
+
var __defProp$1l = Object.defineProperty;
|
|
8291
|
+
var __getOwnPropSymbols$1l = Object.getOwnPropertySymbols;
|
|
8292
|
+
var __hasOwnProp$1l = Object.prototype.hasOwnProperty;
|
|
8293
|
+
var __propIsEnum$1l = Object.prototype.propertyIsEnumerable;
|
|
8294
|
+
var __defNormalProp$1l = (obj, key, value) => key in obj ? __defProp$1l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8295
|
+
var __spreadValues$1l = (a, b) => {
|
|
8219
8296
|
for (var prop in b || (b = {}))
|
|
8220
|
-
if (__hasOwnProp$
|
|
8221
|
-
__defNormalProp$
|
|
8222
|
-
if (__getOwnPropSymbols$
|
|
8223
|
-
for (var prop of __getOwnPropSymbols$
|
|
8224
|
-
if (__propIsEnum$
|
|
8225
|
-
__defNormalProp$
|
|
8297
|
+
if (__hasOwnProp$1l.call(b, prop))
|
|
8298
|
+
__defNormalProp$1l(a, prop, b[prop]);
|
|
8299
|
+
if (__getOwnPropSymbols$1l)
|
|
8300
|
+
for (var prop of __getOwnPropSymbols$1l(b)) {
|
|
8301
|
+
if (__propIsEnum$1l.call(b, prop))
|
|
8302
|
+
__defNormalProp$1l(a, prop, b[prop]);
|
|
8226
8303
|
}
|
|
8227
8304
|
return a;
|
|
8228
8305
|
};
|
|
8229
|
-
var __objRest$
|
|
8306
|
+
var __objRest$18 = (source, exclude) => {
|
|
8230
8307
|
var target = {};
|
|
8231
8308
|
for (var prop in source)
|
|
8232
|
-
if (__hasOwnProp$
|
|
8309
|
+
if (__hasOwnProp$1l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8233
8310
|
target[prop] = source[prop];
|
|
8234
|
-
if (source != null && __getOwnPropSymbols$
|
|
8235
|
-
for (var prop of __getOwnPropSymbols$
|
|
8236
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
8311
|
+
if (source != null && __getOwnPropSymbols$1l)
|
|
8312
|
+
for (var prop of __getOwnPropSymbols$1l(source)) {
|
|
8313
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1l.call(source, prop))
|
|
8237
8314
|
target[prop] = source[prop];
|
|
8238
8315
|
}
|
|
8239
8316
|
return target;
|
|
@@ -8252,7 +8329,7 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
|
|
|
8252
8329
|
isClearable = true,
|
|
8253
8330
|
onSave,
|
|
8254
8331
|
buttonLabel = "Save"
|
|
8255
|
-
} = _b, rest = __objRest$
|
|
8332
|
+
} = _b, rest = __objRest$18(_b, [
|
|
8256
8333
|
"name",
|
|
8257
8334
|
"minValue",
|
|
8258
8335
|
"maxValue",
|
|
@@ -8291,7 +8368,7 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
|
|
|
8291
8368
|
},
|
|
8292
8369
|
({ value, onChange }, { formState: { errors } }) => /* @__PURE__ */ React.createElement(
|
|
8293
8370
|
DateRangePicker,
|
|
8294
|
-
__spreadValues$
|
|
8371
|
+
__spreadValues$1l({
|
|
8295
8372
|
firstDayOfWeek,
|
|
8296
8373
|
"aria-label": label,
|
|
8297
8374
|
isInvalid: !!errors[name],
|
|
@@ -8309,82 +8386,6 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
|
|
|
8309
8386
|
);
|
|
8310
8387
|
});
|
|
8311
8388
|
|
|
8312
|
-
const tooltipIconMap = {
|
|
8313
|
-
success: CheckCircleSolid,
|
|
8314
|
-
warning: AlertTriangleSolid,
|
|
8315
|
-
error: AlertCircleSolid,
|
|
8316
|
-
danger: AlertOctagonSolid,
|
|
8317
|
-
info: InfoSolid,
|
|
8318
|
-
ai: BrightnessSolid,
|
|
8319
|
-
default: HelpCircleSolid,
|
|
8320
|
-
ghost: HelpCircleSolid
|
|
8321
|
-
};
|
|
8322
|
-
|
|
8323
|
-
var __defProp$1l = Object.defineProperty;
|
|
8324
|
-
var __getOwnPropSymbols$1l = Object.getOwnPropertySymbols;
|
|
8325
|
-
var __hasOwnProp$1l = Object.prototype.hasOwnProperty;
|
|
8326
|
-
var __propIsEnum$1l = Object.prototype.propertyIsEnumerable;
|
|
8327
|
-
var __defNormalProp$1l = (obj, key, value) => key in obj ? __defProp$1l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8328
|
-
var __spreadValues$1l = (a, b) => {
|
|
8329
|
-
for (var prop in b || (b = {}))
|
|
8330
|
-
if (__hasOwnProp$1l.call(b, prop))
|
|
8331
|
-
__defNormalProp$1l(a, prop, b[prop]);
|
|
8332
|
-
if (__getOwnPropSymbols$1l)
|
|
8333
|
-
for (var prop of __getOwnPropSymbols$1l(b)) {
|
|
8334
|
-
if (__propIsEnum$1l.call(b, prop))
|
|
8335
|
-
__defNormalProp$1l(a, prop, b[prop]);
|
|
8336
|
-
}
|
|
8337
|
-
return a;
|
|
8338
|
-
};
|
|
8339
|
-
var __objRest$18 = (source, exclude) => {
|
|
8340
|
-
var target = {};
|
|
8341
|
-
for (var prop in source)
|
|
8342
|
-
if (__hasOwnProp$1l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8343
|
-
target[prop] = source[prop];
|
|
8344
|
-
if (source != null && __getOwnPropSymbols$1l)
|
|
8345
|
-
for (var prop of __getOwnPropSymbols$1l(source)) {
|
|
8346
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1l.call(source, prop))
|
|
8347
|
-
target[prop] = source[prop];
|
|
8348
|
-
}
|
|
8349
|
-
return target;
|
|
8350
|
-
};
|
|
8351
|
-
const Tooltip = (_a) => {
|
|
8352
|
-
var _b = _a, {
|
|
8353
|
-
variant = "default",
|
|
8354
|
-
hasArrow = true,
|
|
8355
|
-
title = "",
|
|
8356
|
-
description = "",
|
|
8357
|
-
hasIcon = false
|
|
8358
|
-
} = _b, rest = __objRest$18(_b, [
|
|
8359
|
-
"variant",
|
|
8360
|
-
"hasArrow",
|
|
8361
|
-
"title",
|
|
8362
|
-
"description",
|
|
8363
|
-
"hasIcon"
|
|
8364
|
-
]);
|
|
8365
|
-
const iconVariant = variant;
|
|
8366
|
-
const icon = tooltipIconMap[iconVariant];
|
|
8367
|
-
const TooltipContent = /* @__PURE__ */ React.createElement(HStack, { alignItems: "flex-start" }, hasIcon && /* @__PURE__ */ React.createElement(Icon, { as: icon, color: `icon.toast.${iconVariant}` }), /* @__PURE__ */ React.createElement(VStack, { spacing: 0, alignItems: "flex-start" }, /* @__PURE__ */ React.createElement(Label, { size: "sm" }, title), /* @__PURE__ */ React.createElement(
|
|
8368
|
-
P,
|
|
8369
|
-
{
|
|
8370
|
-
variant: "14",
|
|
8371
|
-
sx: {
|
|
8372
|
-
color: !variant || variant === "ai" ? "text.inverted" : "text.default"
|
|
8373
|
-
}
|
|
8374
|
-
},
|
|
8375
|
-
description
|
|
8376
|
-
)));
|
|
8377
|
-
return /* @__PURE__ */ React.createElement(
|
|
8378
|
-
Tooltip$2,
|
|
8379
|
-
__spreadValues$1l({
|
|
8380
|
-
hasArrow,
|
|
8381
|
-
hasIcon,
|
|
8382
|
-
label: title || description ? TooltipContent : void 0,
|
|
8383
|
-
variant
|
|
8384
|
-
}, rest)
|
|
8385
|
-
);
|
|
8386
|
-
};
|
|
8387
|
-
|
|
8388
8389
|
var __defProp$1k = Object.defineProperty;
|
|
8389
8390
|
var __getOwnPropSymbols$1k = Object.getOwnPropertySymbols;
|
|
8390
8391
|
var __hasOwnProp$1k = Object.prototype.hasOwnProperty;
|