@northlight/ui 1.5.4 → 1.5.6

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/README.md CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  This awesome collection of components, built upon Chakra, powers all of Mediatool's features.
4
4
 
5
- ## Get started
6
-
7
- 1. Run `yarn`
8
- 2. Run `yarn start`
9
- 3. Navigate to http://localhost:3008
10
-
11
5
  ## Overview
12
6
 
13
7
  Below you'll find an overview of each part of the library.
@@ -16,14 +10,6 @@ Below you'll find an overview of each part of the library.
16
10
 
17
11
  In this folder you'll find components, hooks, utils and theme. This is the actual library and is what gets published to npm.
18
12
 
19
- ### sandbox
20
-
21
- Sandbox is what you'd expect from the name - a sandbox environment. It serves as documentation as well as a playground for testing new components in an interactive enrivonment.
22
- Sandbox is built like a mini micro frontend, meaning that `docs` and `demo` are 2 separate mini apps. `Docs` is the default fallback when navigating to localhost:3008/.
23
-
24
- `Docs` works similarly to how Storybook works, without the need to write explicit stories. Simply follow existing structure and create a component under `docs/pages`, and write code just how you normally would.
25
- `Test` was created by Sebastian. However he was not aware that other main pages were documented here, thus he didn't write any explanation.
26
-
27
13
  ## Contribute
28
14
 
29
15
  Want to contribute? Awesome! Find what suits your use-case below and follow the steps.
@@ -1,4 +1,4 @@
1
- import { AccordionProps, AccordionButtonProps, AccordionPanelProps, AccordionItemProps, AvatarProps as AvatarProps$1, AlertProps as AlertProps$1, AspectRatioProps, BadgeProps, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, StackDirection, IconButtonProps as IconButtonProps$1, InputProps, FlexProps, BoxProps, StackProps, TagProps as TagProps$1, IconProps as IconProps$1, SystemStyleObject, HeadingProps as HeadingProps$1, TextProps, FormLabelProps as FormLabelProps$1, Heading, Text, ModalProps as ModalProps$1, NumberInputProps as NumberInputProps$1, PinInputProps as PinInputProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SpinnerProps as SpinnerProps$1, SwitchProps as SwitchProps$1, TabsProps as TabsProps$1, TabPanelProps as TabPanelProps$1, TextareaProps as TextareaProps$1, UseToastOptions as UseToastOptions$1, FadeProps as FadeProps$1, ScaleFadeProps as ScaleFadeProps$1, SlideProps as SlideProps$1, SlideFadeProps as SlideFadeProps$1, CollapseProps as CollapseProps$1, TabListProps, TabProps, LinkProps, GridProps, GridItemProps, EditableProps as EditableProps$1 } from '@chakra-ui/react';
1
+ import { AccordionProps, AccordionButtonProps, AccordionPanelProps, AccordionItemProps, AvatarProps as AvatarProps$1, AlertProps as AlertProps$1, AspectRatioProps, StackProps, BadgeProps, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, StackDirection, IconButtonProps as IconButtonProps$1, InputProps, FlexProps, BoxProps, TagProps as TagProps$1, IconProps as IconProps$1, SystemStyleObject, HeadingProps as HeadingProps$1, TextProps, FormLabelProps as FormLabelProps$1, Heading, Text, ModalProps as ModalProps$1, NumberInputProps as NumberInputProps$1, PinInputProps as PinInputProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SpinnerProps as SpinnerProps$1, SwitchProps as SwitchProps$1, TabsProps as TabsProps$1, TabPanelProps as TabPanelProps$1, TextareaProps as TextareaProps$1, UseToastOptions as UseToastOptions$1, FadeProps as FadeProps$1, ScaleFadeProps as ScaleFadeProps$1, SlideProps as SlideProps$1, SlideFadeProps as SlideFadeProps$1, CollapseProps as CollapseProps$1, 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, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkOverlay, List, ListIcon, ListItem, Menu, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, 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, Table, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tooltip, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ChangeEvent, ComponentType, InputHTMLAttributes, ReactNode, ReactElement } from 'react';
@@ -145,7 +145,7 @@ interface AvatarProps extends Omit<AvatarProps$1, 'src' | 'srcSet' | 'getInitial
145
145
  interface AvatarBadgeProps {
146
146
  notificationCount?: number;
147
147
  }
148
- interface AvatarGroupProps {
148
+ interface AvatarGroupProps extends StackProps {
149
149
  max: number;
150
150
  spacing?: number | string;
151
151
  /** The children should be avatar components */
@@ -469,7 +469,7 @@ interface FlipButtonProps {
469
469
  icon?: ComponentType<any>;
470
470
  value: string;
471
471
  label?: string;
472
- children: ((props: CustomFlipButtonProps) => JSX.Element) | string;
472
+ children?: ((props: CustomFlipButtonProps) => JSX.Element) | string;
473
473
  }
474
474
  interface FlipButtonGroupProps extends Omit<FlipButtonProps, 'value' | 'children' | 'label'> {
475
475
  onChange?: (val: string | string[]) => void;
@@ -782,7 +782,7 @@ declare const DatePickerField: ({ name, minValue, maxValue, isRequired, directio
782
782
  * @see {@link https://northlight.dev/reference/date-range-picker-field}
783
783
  *
784
784
  */
785
- declare const DateRangePickerField: ({ name, minValue, maxValue, isRequired, direction, label, validate, firstDayOfWeek, onChange: onChangeCallback, ...rest }: DateRangePickerFieldProps) => JSX.Element;
785
+ declare const DateRangePickerField: ({ name, minValue, maxValue, isRequired, direction, label, validate, firstDayOfWeek, onChange: onChangeCallback, isClearable, ...rest }: DateRangePickerFieldProps) => JSX.Element;
786
786
 
787
787
  interface ToolboxProps extends Omit<FlexProps, 'direction'> {
788
788
  isOpen: boolean;
@@ -4042,7 +4042,7 @@ const RangeCalendar = (props) => {
4042
4042
  state,
4043
4043
  ref
4044
4044
  );
4045
- const { fiscalStartMonth, handleClose, resetDate } = props;
4045
+ const { fiscalStartMonth, handleClose, resetDate, isClearable = true } = props;
4046
4046
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$g(__spreadValues$1a({}, calendarProps), { ref, __css: rangeCalendarContainer }), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
4047
4047
  QuickSelect,
4048
4048
  {
@@ -4058,7 +4058,7 @@ const RangeCalendar = (props) => {
4058
4058
  offset: { months: 1 },
4059
4059
  locale
4060
4060
  }
4061
- ), /* @__PURE__ */ React.createElement(AdjustRange, { state, adjust: "end" }), /* @__PURE__ */ React.createElement(HStack, { alignSelf: "end", pt: "2" }, /* @__PURE__ */ React.createElement(Button$1, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button$1, { variant: "brand", onClick: handleClose, size: "sm" }, "Save"))))))));
4061
+ ), /* @__PURE__ */ React.createElement(AdjustRange, { state, adjust: "end" }), /* @__PURE__ */ React.createElement(HStack, { alignSelf: "end", pt: "2" }, isClearable && /* @__PURE__ */ React.createElement(Button$1, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button$1, { variant: "brand", onClick: handleClose, size: "sm" }, "Save"))))))));
4062
4062
  };
4063
4063
 
4064
4064
  var __defProp$19 = Object.defineProperty;
@@ -4094,7 +4094,7 @@ const SimpleRangeCalendar = (props) => {
4094
4094
  state,
4095
4095
  ref
4096
4096
  );
4097
- const { fiscalStartMonth, handleClose, resetDate } = props;
4097
+ const { fiscalStartMonth, handleClose, resetDate, isClearable = true } = props;
4098
4098
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$f(__spreadValues$19({}, calendarProps), { ref, __css: rangeCalendarContainer }), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
4099
4099
  QuickSelect,
4100
4100
  {
@@ -4105,7 +4105,7 @@ const SimpleRangeCalendar = (props) => {
4105
4105
  fiscalStartMonth,
4106
4106
  height: "72"
4107
4107
  }
4108
- ), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { spacing: 2, alignSelf: "center" }, /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, prevButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronLeftSolid, boxSize: 4 })), /* @__PURE__ */ React.createElement(HStack, { w: "full", justify: "center" }, /* @__PURE__ */ React.createElement(MonthSelect, { state, offset: 0 }), /* @__PURE__ */ React.createElement(YearSelectRangeCalendar, { state, offset: 0 })), /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, nextButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronRightSolid, boxSize: 4 }))), /* @__PURE__ */ React.createElement(Stack, { h: "full", justify: "space-between" }, /* @__PURE__ */ React.createElement(RangeCalendarGrid, { state, locale }), /* @__PURE__ */ React.createElement(HStack, { alignSelf: "end", pt: "2" }, /* @__PURE__ */ React.createElement(Button$1, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button$1, { variant: "brand", onClick: handleClose, size: "sm" }, "Save")))))));
4108
+ ), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { spacing: 2, alignSelf: "center" }, /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, prevButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronLeftSolid, boxSize: 4 })), /* @__PURE__ */ React.createElement(HStack, { w: "full", justify: "center" }, /* @__PURE__ */ React.createElement(MonthSelect, { state, offset: 0 }), /* @__PURE__ */ React.createElement(YearSelectRangeCalendar, { state, offset: 0 })), /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, nextButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronRightSolid, boxSize: 4 }))), /* @__PURE__ */ React.createElement(Stack, { h: "full", justify: "space-between" }, /* @__PURE__ */ React.createElement(RangeCalendarGrid, { state, locale }), /* @__PURE__ */ React.createElement(HStack, { alignSelf: "end", pt: "2" }, isClearable && /* @__PURE__ */ React.createElement(Button$1, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button$1, { variant: "brand", onClick: handleClose, size: "sm" }, "Save")))))));
4109
4109
  };
4110
4110
 
4111
4111
  const isValidDateRange = (value) => is(Object, value) && has("startDate", value) && has("endDate", value) && is(String, value.startDate) && is(String, value.endDate);
@@ -4234,14 +4234,16 @@ const DateRangePicker = (props) => {
4234
4234
  __spreadProps$e(__spreadValues$18({}, calendarProps), {
4235
4235
  resetDate,
4236
4236
  handleClose,
4237
- fiscalStartMonth: fiscalStartMonth || 0
4237
+ fiscalStartMonth: fiscalStartMonth || 0,
4238
+ isClearable
4238
4239
  })
4239
4240
  ), mode === "advanced" && /* @__PURE__ */ React.createElement(
4240
4241
  RangeCalendar,
4241
4242
  __spreadProps$e(__spreadValues$18({}, calendarProps), {
4242
4243
  resetDate,
4243
4244
  handleClose,
4244
- fiscalStartMonth: fiscalStartMonth || 0
4245
+ fiscalStartMonth: fiscalStartMonth || 0,
4246
+ isClearable
4245
4247
  })
4246
4248
  )))
4247
4249
  );
@@ -4427,7 +4429,8 @@ const DateRangePickerField = (_a) => {
4427
4429
  label,
4428
4430
  validate,
4429
4431
  firstDayOfWeek = "monday",
4430
- onChange: onChangeCallback = identity
4432
+ onChange: onChangeCallback = identity,
4433
+ isClearable = true
4431
4434
  } = _b, rest = __objRest$P(_b, [
4432
4435
  "name",
4433
4436
  "minValue",
@@ -4437,7 +4440,8 @@ const DateRangePickerField = (_a) => {
4437
4440
  "label",
4438
4441
  "validate",
4439
4442
  "firstDayOfWeek",
4440
- "onChange"
4443
+ "onChange",
4444
+ "isClearable"
4441
4445
  ]);
4442
4446
  const { setValue, setError, trigger } = useFormContext();
4443
4447
  const handleChange = (dateRange) => {
@@ -4472,7 +4476,8 @@ const DateRangePickerField = (_a) => {
4472
4476
  value,
4473
4477
  minValue,
4474
4478
  maxValue,
4475
- validationState: errors.name ? "invalid" : "valid"
4479
+ validationState: errors.name ? "invalid" : "valid",
4480
+ isClearable
4476
4481
  }, rest)
4477
4482
  )
4478
4483
  );