@northlight/ui 2.28.17 → 2.29.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Mediatool
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,4 +1,4 @@
1
- import { AccordionProps, AccordionButtonProps, AccordionPanelProps, AccordionItemProps, Icon as Icon$1, StackDirection, AvatarProps as AvatarProps$1, AlertProps as AlertProps$1, AspectRatioProps, StackProps, BadgeProps, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, IconButtonProps as IconButtonProps$1, PopoverProps, BoxProps, InputProps, CenterProps, FlexProps, TagProps as TagProps$1, IconProps as IconProps$1, SystemStyleObject, HeadingProps as HeadingProps$1, TextProps, FormLabelProps as FormLabelProps$1, Heading, Text, ModalProps as ModalProps$1, ResponsiveValue, MenuProps as MenuProps$1, NumberInputProps as NumberInputProps$1, PinInputProps as PinInputProps$1, ProgressProps, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SpinnerProps as SpinnerProps$1, SwitchProps as SwitchProps$1, TableProps as TableProps$1, TabsProps as TabsProps$1, TabPanelProps as TabPanelProps$1, TextareaProps as TextareaProps$1, UseToastOptions as UseToastOptions$1, TooltipProps, FadeProps as FadeProps$1, ScaleFadeProps as ScaleFadeProps$1, SlideProps as SlideProps$1, SlideFadeProps as SlideFadeProps$1, CollapseProps as CollapseProps$1, ModalBodyProps, TabListProps, TabProps, LinkProps, GridProps, GridItemProps, EditableProps as EditableProps$1 } from '@chakra-ui/react';
1
+ import { AccordionProps, AccordionButtonProps, AccordionPanelProps, AccordionItemProps, Icon as Icon$1, StackDirection, AvatarProps as AvatarProps$1, AlertProps as AlertProps$1, AspectRatioProps, StackProps, BadgeProps as BadgeProps$1, ThemingProps, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, IconButtonProps as IconButtonProps$1, PopoverProps, BoxProps, InputProps, CenterProps, FlexProps, TagProps as TagProps$1, IconProps as IconProps$1, SystemStyleObject, HeadingProps as HeadingProps$1, TextProps, FormLabelProps as FormLabelProps$1, Heading, Text, ModalProps as ModalProps$1, ResponsiveValue, MenuProps as MenuProps$1, NumberInputProps as NumberInputProps$1, PinInputProps as PinInputProps$1, ProgressProps, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SpinnerProps as SpinnerProps$1, SwitchProps as SwitchProps$1, TableProps as TableProps$1, TabsProps as TabsProps$1, TabPanelProps as TabPanelProps$1, TextareaProps as TextareaProps$1, UseToastOptions as UseToastOptions$1, TooltipProps, FadeProps as FadeProps$1, ScaleFadeProps as ScaleFadeProps$1, SlideProps as SlideProps$1, SlideFadeProps as SlideFadeProps$1, CollapseProps as CollapseProps$1, ModalBodyProps, TabListProps, TabProps, LinkProps, GridProps, GridItemProps, EditableProps as EditableProps$1 } from '@chakra-ui/react';
2
2
  export { AbsoluteCenter, AccordionButtonProps, AccordionIcon, AccordionIconProps, AccordionItemProps, AccordionPanelProps, AccordionProps, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, AspectRatioProps, BadgeProps, Box, BoxProps, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, ContainerProps, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Hide, Highlight, Image, ImageProps, 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, StackProps, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, TableBodyProps, TableCaption, TableCaptionProps, TableCellProps, TableColumnHeaderProps, TableContainer, TableContainerProps, TableFooterProps, TableHeadProps, TableRowProps, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, keyframes, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
3
3
  import { Props, GroupBase, MultiValue, SingleValue, ActionMeta, MenuListProps, SelectInstance, ChakraStylesConfig, CreatableSelectComponent } from 'chakra-react-select';
4
4
  export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect, MultiValue, SingleValue, chakraComponents as selectChakraComponents } from 'chakra-react-select';
@@ -26,6 +26,7 @@ import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/sys
26
26
  import * as _chakra_ui_layout_dist_stack_stack_utils from '@chakra-ui/layout/dist/stack/stack.utils';
27
27
  import * as _chakra_ui_radio_dist_radio_group from '@chakra-ui/radio/dist/radio-group';
28
28
  import * as react_select from 'react-select';
29
+ import * as react_select_dist_declarations_src_types from 'react-select/dist/declarations/src/types';
29
30
  import * as _chakra_ui_switch_dist_switch from '@chakra-ui/switch/dist/switch';
30
31
  import * as _chakra_ui_textarea_dist_textarea from '@chakra-ui/textarea/dist/textarea';
31
32
  import { Props as Props$1 } from 'react-input-mask';
@@ -152,6 +153,7 @@ type SelectFieldProps<T, K extends boolean = false> = SelectProps<T, K> & Omit<I
152
153
  label: string;
153
154
  validate?: RegisterOptions;
154
155
  isRequired?: boolean;
156
+ onChange?: (option: K extends true ? MultiValue<T> | undefined : SingleValue<T> | undefined, event: ActionMeta<T>) => void;
155
157
  };
156
158
 
157
159
  /**
@@ -285,6 +287,7 @@ declare const SelectField: <T extends Option<string>, K extends boolean = false>
285
287
  label: string;
286
288
  validate?: react_hook_form.RegisterOptions | undefined;
287
289
  isRequired?: boolean | undefined;
290
+ onChange?: ((option: K extends true ? react_select_dist_declarations_src_types.MultiValue<T> | undefined : react_select_dist_declarations_src_types.SingleValue<T> | undefined, event: react_select.ActionMeta<T>) => void) | undefined;
288
291
  } & React__default.RefAttributes<HTMLDivElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
289
292
 
290
293
  declare const getMatchingValue: <T extends Option<string>, K extends boolean>(value: (K extends true ? string[] | T[] : string | T) | undefined, options: react_select.OptionsOrGroups<T, react_select.GroupBase<T>> | undefined) => T | T[] | undefined;
@@ -392,7 +395,7 @@ interface AvatarGroupProps extends StackProps {
392
395
  * <Avatar />
393
396
  * ?)
394
397
  */
395
- declare const Avatar: ({ variant, notificationCount, name, image, size, ...rest }: AvatarProps) => JSX.Element;
398
+ declare const Avatar: ({ variant, notificationCount, name, image, size, bgColor, ...rest }: AvatarProps) => JSX.Element;
396
399
 
397
400
  /**
398
401
  * Used to display a group of users
@@ -417,6 +420,15 @@ declare const Avatar: ({ variant, notificationCount, name, image, size, ...rest
417
420
  */
418
421
  declare const AvatarGroup: ({ children, max, spacing, ...rest }: AvatarGroupProps) => JSX.Element;
419
422
 
423
+ type BadgeSize = 'xs' | 'sm' | 'md' | 'lg';
424
+ type BadgeVariant = 'solid' | 'outline' | 'subtle' | 'ghost';
425
+ type ColorScheme = ThemingProps['colorScheme'];
426
+ interface BadgeProps extends Omit<BadgeProps$1, 'size' | 'variant'> {
427
+ size?: BadgeSize;
428
+ variant?: BadgeVariant;
429
+ colorScheme?: ColorScheme;
430
+ }
431
+
420
432
  /**
421
433
  * Badges are used to highlight an item's status for quick recognition.
422
434
  * @see {@link https://northlight.dev/reference/badge}
@@ -426,7 +438,7 @@ declare const AvatarGroup: ({ children, max, spacing, ...rest }: AvatarGroupProp
426
438
  * +
427
439
  * const colors = ["gray", "mediatoolBlue", "blue", "red", "green",
428
440
  * "orange", "yellow", "teal", "purple", "pink"]
429
- * const variants = ["solid", "outline", "subtle"]
441
+ * const variants = ["solid", "outline", "subtle", "ghost"]
430
442
  * const Example = () => {
431
443
  * return <Stack>
432
444
  * { colors.map((color) => (
@@ -1158,7 +1170,7 @@ declare const ToolboxHeader: ({ children, onClose, ...rest }: ToolboxHeaderProps
1158
1170
  * @see Toolbox
1159
1171
  * @see {@link https://northlight.dev/reference/toolbox-content}
1160
1172
  */
1161
- declare const ToolboxContent: ({ children, ...rest }: ToolboxContentProps) => JSX.Element;
1173
+ declare const ToolboxContent: ({ sx, children, ...rest }: ToolboxContentProps) => JSX.Element;
1162
1174
 
1163
1175
  /**
1164
1176
  * @see Toolbox
@@ -973,19 +973,22 @@ const Avatar$1 = (_a) => {
973
973
  notificationCount = 0,
974
974
  name,
975
975
  image,
976
- size
976
+ size,
977
+ bgColor
977
978
  } = _b, rest = __objRest$1J(_b, [
978
979
  "variant",
979
980
  "notificationCount",
980
981
  "name",
981
982
  "image",
982
- "size"
983
+ "size",
984
+ "bgColor"
983
985
  ]);
984
986
  const { container, text, userImage, icon } = useMultiStyleConfig("Avatar", {
985
987
  variant,
986
988
  image,
987
989
  size,
988
- name
990
+ name,
991
+ bgColor
989
992
  });
990
993
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2c({ __css: container, "data-testid": "avatar-test-id" }, rest), image ? /* @__PURE__ */ React.createElement(
991
994
  chakra.img,
@@ -4650,8 +4653,8 @@ const Avatar = {
4650
4653
  colors: color,
4651
4654
  sizes: sizing,
4652
4655
  radii: borderRadius
4653
- }, image, name }) => {
4654
- const avatarBgColor = getAvatarBgColor(image, name, color);
4656
+ }, image, name, bgColor }) => {
4657
+ const avatarBgColor = bgColor || getAvatarBgColor(image, name, color);
4655
4658
  return {
4656
4659
  container: {
4657
4660
  bgColor: avatarBgColor,
@@ -5854,7 +5857,31 @@ const Badge = {
5854
5857
  bgColor: "mono.transparent",
5855
5858
  color: textColor
5856
5859
  };
5860
+ },
5861
+ ghost: ({ colorScheme, theme: { colors } }) => {
5862
+ const textColor = colorScheme === "mediatoolBlue" ? colors[colorScheme][500] : colors[colorScheme] && colors[colorScheme][700];
5863
+ return {
5864
+ bgColor: "mono.transparent",
5865
+ color: textColor
5866
+ };
5867
+ }
5868
+ },
5869
+ sizes: {
5870
+ xs: {
5871
+ fontSize: "2xs"
5872
+ },
5873
+ sm: {
5874
+ fontSize: "xs"
5875
+ },
5876
+ md: {
5877
+ fontSize: "sm"
5878
+ },
5879
+ lg: {
5880
+ fontSize: "md"
5857
5881
  }
5882
+ },
5883
+ defaultProps: {
5884
+ size: "sm"
5858
5885
  }
5859
5886
  };
5860
5887
 
@@ -6978,6 +7005,13 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6978
7005
  },
6979
7006
  label: "This Week"
6980
7007
  };
7008
+ const nextWeek = {
7009
+ value: {
7010
+ start: startOfWeek(thisDay.add({ weeks: 1 }), locale),
7011
+ end: endOfWeek(thisDay.add({ weeks: 1 }), locale)
7012
+ },
7013
+ label: "Next Week"
7014
+ };
6981
7015
  const lastWeek = {
6982
7016
  value: {
6983
7017
  start: startOfWeek(thisDay.subtract({ weeks: 1 }), locale),
@@ -7163,16 +7197,17 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
7163
7197
  const fiscalQuarters = [F1, F2, F3, F4];
7164
7198
  const fiscalYears = fiscalStartMonth === 0 ? [] : [thisFiscalYear, lastFiscalYear];
7165
7199
  const quickDates = [
7166
- thisWeek,
7167
- lastWeek,
7168
- thisMonth,
7169
- lastMonth,
7170
7200
  thisYear,
7171
7201
  yearToDate,
7172
- lastYear,
7173
- nextMonth,
7202
+ lastWeek,
7203
+ nextWeek,
7204
+ thisWeek,
7205
+ lastMonth,
7174
7206
  nextThreeMonths,
7175
7207
  nextSixMonths,
7208
+ nextMonth,
7209
+ thisMonth,
7210
+ lastYear,
7176
7211
  nextYear,
7177
7212
  ...fiscalYears
7178
7213
  ];
@@ -8512,7 +8547,7 @@ const Toolbox = (_a) => {
8512
8547
  direction: direction === "left" ? "row-reverse" : "row"
8513
8548
  }, rest),
8514
8549
  isResizable && /* @__PURE__ */ React.createElement(ResizeHandle, __spreadValues$1b({}, resizeProps)),
8515
- /* @__PURE__ */ React.createElement(FocusScope, { autoFocus }, /* @__PURE__ */ React.createElement(Box, { width: "full", height: "full" }, newChildren))
8550
+ /* @__PURE__ */ React.createElement(FocusScope, { autoFocus }, /* @__PURE__ */ React.createElement(VStack, { width: "full", height: "full" }, newChildren))
8516
8551
  )
8517
8552
  ))
8518
8553
  );
@@ -8595,12 +8630,12 @@ var __objRest$Y = (source, exclude) => {
8595
8630
  return target;
8596
8631
  };
8597
8632
  const ToolboxContent = (_a) => {
8598
- var _b = _a, { children } = _b, rest = __objRest$Y(_b, ["children"]);
8633
+ var _b = _a, { sx = {}, children } = _b, rest = __objRest$Y(_b, ["sx", "children"]);
8599
8634
  const { body } = useMultiStyleConfig$1("Toolbox", {});
8600
8635
  return /* @__PURE__ */ React.createElement(
8601
8636
  Flex,
8602
8637
  __spreadValues$19({
8603
- sx: body
8638
+ sx: merge(body, sx)
8604
8639
  }, rest),
8605
8640
  children
8606
8641
  );
@@ -12637,6 +12672,7 @@ const BaseSelectField = (_a, ref) => {
12637
12672
  hidden: value === void 0 || !isClearable,
12638
12673
  onClick: () => {
12639
12674
  onChange(void 0);
12675
+ onChangeCallback(void 0, { action: "clear", removedValues: value });
12640
12676
  },
12641
12677
  icon: /* @__PURE__ */ React.createElement(Icon$1, { as: XCloseSolid })
12642
12678
  }