@northlight/ui 2.11.0 → 2.12.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.
@@ -1,3705 +0,0 @@
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, TableProps as TableProps$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
- 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, Hide, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkBox, 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, 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, Tooltip, 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
- import * as React$1 from 'react';
4
- import React__default, { ChangeEvent, ComponentType, InputHTMLAttributes, ReactNode, Ref, ReactElement, RefObject, MutableRefObject, EffectCallback, DependencyList } from 'react';
5
- import { RegisterOptions, FieldValues, UseFormReturn as UseFormReturn$1, SetValueConfig, FieldPath, Control, ControllerRenderProps, UseFormProps, FieldError, Merge, FieldErrorsImpl } from 'react-hook-form';
6
- export { useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
7
- import { CheckboxGroupState } from '@react-stately/checkbox';
8
- import { RadioGroupState } from '@react-stately/radio';
9
- import { CSSObject } from '@emotion/react';
10
- import { DateValue } from '@internationalized/date';
11
- import { AriaDatePickerProps, AriaDateRangePickerProps } from '@react-aria/datepicker';
12
- import { Props, GroupBase, ActionMeta, ChakraStylesConfig, SelectInstance, MultiValue, SingleValue, MenuListProps } from 'chakra-react-select';
13
- export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect } from 'chakra-react-select';
14
- import { DndContextProps, UseDroppableArguments, UseDraggableArguments, UniqueIdentifier, CollisionDetection, SensorDescriptor, SensorOptions, Modifiers } from '@dnd-kit/core';
15
- export * from '@dnd-kit/core';
16
- import { UseSortableArguments, SortingStrategy, SortableContextProps } from '@dnd-kit/sortable';
17
- export * from '@dnd-kit/sortable';
18
- import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
19
- export * from '@dnd-kit/utilities';
20
- export { useInterval as dndUseInterval } from '@dnd-kit/utilities';
21
- export * from '@dnd-kit/modifiers';
22
- import { VariableSizeListProps, VariableSizeList, VariableSizeGridProps, VariableSizeGrid } from 'react-window';
23
- import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
24
- import { Props as Props$1 } from 'react-input-mask';
25
- import { NumericFormatProps } from 'react-number-format';
26
- import * as _chakra_ui_toast_dist_toast_types_24f022fd from '@chakra-ui/toast/dist/toast.types-24f022fd';
27
- import { UseClickableProps } from '@chakra-ui/clickable';
28
- import * as _react_types_shared from '@react-types/shared';
29
- import * as _react_aria_focus from '@react-aria/focus';
30
-
31
- /**
32
- * The wrapper that uses cloneElement to pass props to AccordionItem children.
33
- * @see {@link https::/northlight.dev/reference/accordion}
34
- *
35
- * @example
36
- * (?
37
- * <Accordion>
38
- <AccordionItem>
39
- <H2>
40
- <AccordionButton>
41
- <Box as="span" flex='1' textAlign='left'>
42
- Section 1 title
43
- </Box>
44
- <AccordionIcon />
45
- </AccordionButton>
46
- </H2>
47
- <AccordionPanel pb={4}>
48
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
49
- tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
50
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
51
- commodo consequat.
52
- </AccordionPanel>
53
- </AccordionItem>
54
-
55
- <AccordionItem>
56
- <H2>
57
- <AccordionButton>
58
- <Box as="span" flex='1' textAlign='left'>
59
- Section 2 title
60
- </Box>
61
- <AccordionIcon />
62
- </AccordionButton>
63
- </H2>
64
- <AccordionPanel pb={4}>
65
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
66
- tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
67
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
68
- commodo consequat.
69
- </AccordionPanel>
70
- </AccordionItem>
71
- </Accordion>
72
- * ?)
73
- */
74
- declare const Accordion: (props: AccordionProps) => JSX.Element;
75
-
76
- /**
77
- * The button that toggles the expand/collapse state of the accordion item.
78
- * This button must be wrapped in an element with role heading.
79
- * @see Accordion
80
- * @see AcordionItem
81
- * @see {@link https://northlight.dev/reference/accordion-button}
82
- * @example
83
- * (Needs to be wrapped around AccordionItem and
84
- * Accordion context)
85
- * (?
86
- * <Accordion>
87
- * <AccordionItem>
88
- * <AccordionButton>Content</AccordionButton>
89
- * </AccordionItem>
90
- * </Accordion>
91
- * ?)
92
- */
93
- declare const AccordionButton: (props: AccordionButtonProps) => JSX.Element;
94
-
95
- /**
96
- * The container for the details to be revealed.
97
- * @see {@link htpts://northlight.dev/reference/accordion-panel}
98
- */
99
- declare const AccordionPanel: (props: AccordionPanelProps) => JSX.Element;
100
-
101
- declare const AccordionItem: (props: AccordionItemProps) => JSX.Element;
102
-
103
- interface OrganizationLogoProps extends AvatarProps$1 {
104
- name: string;
105
- image?: string;
106
- }
107
-
108
- /**
109
- * @see {@link https://northlight.dev/reference/organization-logo}
110
- *
111
- * @example
112
- * (?
113
- * <OrganizationLogo name="mediatool" />
114
- * ?)
115
- *
116
- */
117
- declare const OrganizationLogo: ({ name, image, variant, ...rest }: OrganizationLogoProps) => JSX.Element;
118
-
119
- type AlertVariants = 'success' | 'warning' | 'error' | 'info';
120
- interface AlertProps extends AlertProps$1 {
121
- variant?: AlertVariants;
122
- }
123
-
124
- declare const Alert: ({ variant, children, ...rest }: AlertProps) => JSX.Element;
125
-
126
- /**
127
- * Meant to restrict child by specific ratio
128
- * @see {@link https://northlight.dev/aspect-ratio}
129
- * @example
130
- * (?
131
- <AspectRatio maxW='400px' ratio={4 / 3}>
132
- <Image src='https://bit.ly/naruto-sage' alt='naruto' objectFit='cover' />
133
- </AspectRatio>
134
- ?)
135
- *
136
- * */
137
- declare const AspectRatio: (props: AspectRatioProps) => JSX.Element;
138
-
139
- interface AvatarProps extends Omit<AvatarProps$1, 'src' | 'srcSet' | 'getInitials' | 'onError' | 'loading' | 'icon' | 'referrerPolicy' | 'showBorder' | 'iconLabel' | 'ignoreFallback'> {
140
- name?: string;
141
- image?: string;
142
- /** This will render a badge in the corner of the avatar */
143
- notificationCount?: number;
144
- size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg';
145
- variant?: 'square' | 'rounded';
146
- }
147
- interface AvatarBadgeProps {
148
- notificationCount?: number;
149
- }
150
- interface AvatarGroupProps extends StackProps {
151
- max: number;
152
- spacing?: number | string;
153
- /** The children should be avatar components */
154
- children: JSX.Element[] | React__default.ReactNode[];
155
- }
156
-
157
- /**
158
- * @see AvatarGroup
159
- * @see {@link https://northlight.dev/reference/avatar}
160
- *
161
- * @example (Example)
162
- * Avatar takes a name and image
163
- * (?
164
- * <Avatar name="Anakin Skywalker" image='src/assets/avatars/vader.png' />
165
- * ?)
166
- *
167
- * <br />
168
- * If there is no image, it will render the initials of the name along with a random bg color.
169
- * (?
170
- * <Avatar name="Anakin Skywalker" />
171
- * ?)
172
- *
173
- * <br />
174
- *
175
- * If the name also is undefined, it will render a fallback icon
176
- * (?
177
- * <Avatar />
178
- * ?)
179
- */
180
- declare const Avatar: ({ variant, notificationCount, name, image, size, ...rest }: AvatarProps) => JSX.Element;
181
-
182
- /**
183
- * Used to display a group of users
184
- * @see Avatar
185
- * @see {@link https://northlight.dev/reference/avatar-group}
186
- *
187
- * @example (Example)
188
- * (?
189
- * <AvatarGroup max={ 3 }>
190
- {[1, 2, 3, 4, 5].map((i) => (
191
- <Avatar
192
- name="Anakin Skywalker"
193
- image="src/assets/avatars/trooper.png"
194
- size="sm"
195
- variant="rounded"
196
- key={ i }
197
- />
198
- )) }
199
- </AvatarGroup>
200
- * ?)
201
- *
202
- */
203
- declare const AvatarGroup: ({ children, max, spacing, ...rest }: AvatarGroupProps) => JSX.Element;
204
-
205
- /**
206
- * Badges are used to highlight an item's status for quick recognition.
207
- * @see {@link https://northlight.dev/reference/badge}
208
- *
209
- * @example
210
- * (?
211
- * <Stack>
212
- <HStack spacing={ 4 }>
213
- <Badge>Default badge</Badge>
214
- <Badge variant="outline">Outline badge</Badge>
215
- <Badge variant="subtle">Subtle badge</Badge>
216
- </HStack>
217
- <HStack spacing={ 4 } mt={ 4 }>
218
- <Badge variant="solid" colorScheme="mediatoolBlue">Solid badge</Badge>
219
- <Badge variant="outline" colorScheme="mediatoolBlue">Outline badge</Badge>
220
- <Badge variant="subtle" colorScheme="mediatoolBlue">Subtle badge</Badge>
221
- </HStack>
222
- <HStack spacing={ 4 } mt={ 4 }>
223
- <Badge variant="solid" colorScheme="red">Solid badge</Badge>
224
- <Badge variant="outline" colorScheme="red">Outline badge</Badge>
225
- <Badge variant="subtle" colorScheme="red">Subtle badge</Badge>
226
- </HStack>
227
- </Stack>
228
- * ?)
229
- */
230
- declare const Badge: (props: BadgeProps) => JSX.Element;
231
-
232
- interface BlinkerProps {
233
- color?: string;
234
- size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg';
235
- isBlinking?: boolean;
236
- }
237
-
238
- /**
239
- * Status indicator of some sorts
240
- * @see {@link https://northlight.dev/reference/blinker}
241
- *
242
- * @example (Example)
243
- * (?
244
- * <Box p="4">
245
- * <Blinker color="bg.brand.default" />
246
- * </Box>
247
- * ?)
248
- */
249
- declare const Blinker: ({ color, size, isBlinking, ...rest }: BlinkerProps) => JSX.Element;
250
-
251
- type ButtonVariants = 'default' | 'danger' | 'success' | 'brand' | 'brandSubdued' | 'link' | 'ghost';
252
- interface ButtonProps extends ButtonProps$1 {
253
- variant?: ButtonVariants;
254
- }
255
-
256
- /**
257
- * @see {@link https://northlight.dev/reference/button}
258
- *
259
- * @example
260
- * (?
261
- <Button
262
- variant="success"
263
- leftIcon={ <Icon as={ FolderCheckDuo } /> }
264
- rightIcon={ <Icon as={ PlusDuo } /> }
265
- >
266
- Create folder
267
- </Button>
268
- * ?)
269
- *
270
- * @example (Example)
271
- * (?
272
- * +
273
- * const variants = ['link', 'success', 'default', 'danger', 'brand', 'ghost']
274
- *
275
- * const ExampleButton = () => {
276
- * const [currentVariant, setCurrentVariant ] = useState(0)
277
- * const [ isLoading, setIsLoading ] = useState(false)
278
- *
279
- * const handleClick = () => {
280
- * setIsLoading(true)
281
- * setTimeout(() => {
282
- * setCurrentVariant((prev) => prev === 5 ? 0 : prev + 1)
283
- * setIsLoading(false)
284
- * }, 300)
285
- *
286
- * }
287
- *
288
- * return (
289
- * <Button variant={variants[currentVariant]}
290
- * isLoading={isLoading} onClick={handleClick} loadingText="Saving...">
291
- * Save changes
292
- * </Button>
293
- * )
294
- *
295
- * }
296
- *
297
- * render(<ExampleButton/>)
298
- * ?)
299
- */
300
- declare const Button: (props: ButtonProps & React__default.RefAttributes<unknown>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
301
-
302
- type CheckboxVariants = 'default' | 'rounded';
303
- interface CheckboxProps extends Omit<CheckboxProps$1, 'value'> {
304
- onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
305
- value?: boolean;
306
- variant?: CheckboxVariants;
307
- }
308
- interface CheckboxFieldProps extends CheckboxProps$1 {
309
- name: string;
310
- label: string;
311
- validate?: RegisterOptions;
312
- isRequired?: boolean;
313
- variant?: CheckboxVariants;
314
- direction?: StackDirection;
315
- labelPlacement?: 'left' | 'right';
316
- labelSize?: '2xs' | 'xs' | 'sm' | 'md' | 'lg';
317
- }
318
-
319
- /**
320
- * @see CheckboxField
321
- * @see {@link https://northlight.dev/reference/checkbox}
322
- *
323
- * @example (Example)
324
- * Mainly used for forms, however this component is controlled by
325
- * a value prop and an onChange callback
326
- *
327
- * (?
328
- * +
329
- * const MyForm = () => {
330
- * const [ isVegan, setIsVegan ] = useState(false)
331
- *
332
- * return (
333
- * <Stack p="2">
334
- * <Label size="sm" htmlFor="vegan-checkbox">Are you vegan</Label>
335
- * <Checkbox name="vegan-checkbox" onChange={() => setIsVegan((prev) => !prev)} value={isVegan} />
336
- * </Stack>
337
- *
338
- * )
339
- * }
340
- *
341
- * render(<MyForm />)
342
- *
343
- * ?)
344
- *
345
- */
346
- declare const Checkbox: ({ value, onChange, name, size, variant, ...rest }: CheckboxProps) => JSX.Element;
347
-
348
- /**
349
- * The checkbox component wrapped in a <Field />
350
- * meant to be used only inside <Form />
351
- * @see Checkbox
352
- * @see {@link https://northlight.dev/reference/checkbox-field}
353
- * @example (Example)
354
- * ## Basic
355
- * (?
356
- * <Form initialValues={{name: ''}}>
357
- * <CheckboxField
358
- * name="terms"
359
- * label="I agree to the Terms & Conditions"
360
- * labelPlacement="left"
361
- * labelSize="md"
362
- * />
363
- * </Form>
364
- * ?)
365
- *
366
- */
367
- declare const CheckboxField: ({ name, label, variant, isRequired, validate, onChange: onChangeCallback, direction, labelPlacement, labelSize, ...rest }: CheckboxFieldProps) => JSX.Element;
368
-
369
- type ColorPickerSize = 'sm' | 'md' | 'lg';
370
- interface ColorPickerProps extends Omit<IconButtonProps$1, 'onChange' | 'value' | 'aria-label' | 'variant'> {
371
- onChange?: (value: string) => void;
372
- /** This are what color options the user can choose */
373
- colors?: string[];
374
- /** This are the extended color options displayed when clicking the down caret */
375
- expandedColors?: string[];
376
- value?: string | null;
377
- size?: ColorPickerSize;
378
- name?: string;
379
- }
380
- type ColorButtonProps = {
381
- color: string;
382
- onClick: () => void;
383
- size?: ColorPickerSize;
384
- selected?: boolean;
385
- };
386
- type ColorsExpandButtonProps = {
387
- onClick: () => void;
388
- size: ColorPickerSize;
389
- expanded: boolean;
390
- };
391
- type ColorPickerFieldProps = ColorPickerProps & {
392
- name: string;
393
- label: string;
394
- validate?: RegisterOptions;
395
- size?: ColorPickerSize;
396
- isRequired?: boolean;
397
- direction?: StackDirection;
398
- };
399
-
400
- /**
401
- * Dropdown menu where user can select hex value
402
- * from set colors
403
- * @see {@link https://northlight.dev/reference/color-picker}
404
- *
405
- * @example (Example)
406
- * ##Pick a color for this campaign
407
- * (?
408
- * () => {
409
- * const [ color, setColor ] = useState(undefined)
410
- * return (
411
- * <HStack>
412
- * <ColorPicker color={color} onChange={setColor}/>
413
- * <ClipboardInput value={ color } />
414
-
415
- * </HStack>
416
- * )
417
- * }
418
- *
419
- * ?)
420
- *
421
- *
422
- */
423
- declare const ColorPicker: ({ onChange, colors, expandedColors, value, name, size, ...rest }: ColorPickerProps) => JSX.Element;
424
-
425
- /**
426
- * The <ColorPicker /> component wrapped in a <Field />
427
- * meant to be used only inside <Form />
428
- * @see ColorPicker
429
- * @see {@link https://northlight.dev/reference/color-picker}
430
- *
431
- */
432
- declare const ColorPickerField: ({ name, label, direction, isRequired, validate, ...rest }: ColorPickerFieldProps) => JSX.Element;
433
-
434
- type FlipButtonSize = 'xs' | 'sm' | 'md' | 'lg';
435
- type FlipButtonVariant = 'default' | 'brand';
436
- type StyleType = {
437
- opacity: '0';
438
- width: '0';
439
- height: '0';
440
- };
441
- type InputPropsType = InputHTMLAttributes<HTMLInputElement>;
442
- type FocusPropsType = React__default.DOMAttributes<Element>;
443
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
444
- type TupleTypes<T> = {
445
- [P in keyof T]: T[P];
446
- } extends {
447
- [key: number]: infer V;
448
- } ? V : never;
449
- type MergedFocusAndInputProps = UnionToIntersection<TupleTypes<[InputPropsType, FocusPropsType]>>;
450
- interface CustomFlipButtonPropsType extends MergedFocusAndInputProps {
451
- ref: React__default.MutableRefObject<null>;
452
- style: StyleType;
453
- 'aria-label': string;
454
- }
455
- type FocusRingType = {
456
- outline?: string;
457
- ring?: string;
458
- ringColor?: string;
459
- ringOffset?: string;
460
- };
461
- type CustomContainerPropsType = {
462
- 'aria-checked': boolean;
463
- 'aria-disabled': boolean;
464
- sx: FocusRingType;
465
- as: 'label';
466
- cursor: 'pointer';
467
- };
468
- interface CustomFlipButtonProps {
469
- state: CheckboxGroupState | RadioGroupState | null;
470
- flipButtonProps: CustomFlipButtonPropsType;
471
- containerProps: CustomContainerPropsType;
472
- isFocused: boolean;
473
- isSelected: boolean;
474
- isDisabled: boolean;
475
- isMulti: boolean;
476
- focusRing: FocusRingType;
477
- label?: string;
478
- value: string;
479
- }
480
- interface FlipButtonProps {
481
- size?: FlipButtonSize;
482
- variant?: FlipButtonVariant;
483
- isMulti?: boolean;
484
- isDisabled?: boolean;
485
- icon?: ComponentType<any>;
486
- value: string;
487
- label?: string;
488
- iconPlacement?: 'left' | 'right' | 'none';
489
- children?: ((props: CustomFlipButtonProps) => JSX.Element) | string;
490
- }
491
- interface FlipButtonGroupProps extends Omit<FlipButtonProps, 'value' | 'children' | 'label'> {
492
- onChange?: (val: string | string[]) => void;
493
- direction?: StackDirection;
494
- children?: React__default.ReactNode[] | React__default.ReactNode;
495
- name?: string;
496
- value?: string | string[];
497
- iconPlacement?: 'left' | 'right' | 'none';
498
- /** This enables passing styles directly to the div closes to the flip buttons */
499
- sx?: CSSObject;
500
- }
501
- interface FlipButtonGroupFieldProps extends FlipButtonGroupProps {
502
- name: string;
503
- label: string;
504
- isRequired?: boolean;
505
- validate?: RegisterOptions;
506
- value?: string;
507
- iconPlacement?: 'left' | 'right' | 'none';
508
- }
509
-
510
- /**
511
- * Meant to act as a middleman to turn any component into
512
- * either a radio or checkbox input
513
- * where the user can choose between multiple options
514
- * @see CheckboxGroup
515
- * @see RadioGroup
516
- * @see FlipButtonGroup
517
- * @see {@link https://northlight.dev/reference/flip-button}
518
- *
519
- * @example (Example)
520
- * ### It must always be wrapped in a group
521
- * (?
522
- * <FlipButton />
523
- * ?)
524
- * Or it will throw an error
525
- *
526
- *
527
- * @example (Example)
528
- * ### As a radio button group
529
- * (?
530
- *<FlipButtonGroup isMulti={ false } size="sm">
531
- <FlipButton value="one" icon={AgencyDuo}>One</FlipButton>
532
- <FlipButton value="two" icon={StagesDuo}>Two</FlipButton>
533
- <FlipButton value="three" icon={Flag04Duo}>Three</FlipButton>
534
- </FlipButtonGroup>
535
- * ?)
536
- *
537
- * @example (Example)
538
- * ### As a checkbox button group
539
- * (?
540
- *<FlipButtonGroup isMulti={ true } size="sm">
541
- <FlipButton value="one" icon={TagsStackDuo}>One</FlipButton>
542
- <FlipButton value="two" icon={Image03Duo}>Two</FlipButton>
543
- <FlipButton value="three" icon={TagDuo }>Three</FlipButton>
544
- </FlipButtonGroup>
545
- * ?)
546
- *
547
- * @example (Example)
548
- * ###Custom Flip Button
549
- * (?
550
- * +
551
- * const customElement = ({
552
- flipButtonProps,
553
- containerProps,
554
- isSelected,
555
- label,
556
- value,
557
- }) => (
558
- <HStack
559
- { ...containerProps }
560
- spacing="4"
561
- _checked={ { bgColor: 'blue.500', color: 'text.inverted' } }
562
- borderRadius="md"
563
- p="2"
564
- >
565
- <input { ...flipButtonProps } />
566
- <Icon as={ UsersDuo } />
567
- <Stack spacing="0">
568
- <Text>{ label }</Text>
569
- <Text color={ isSelected ? 'text.inverted' : 'gray.200' }>
570
- { value === 'public'
571
- ? 'Everyone can view and edit the plan'
572
- : 'The plan is only visible to you'
573
- }
574
- </Text>
575
- </Stack>
576
- </HStack>
577
- )
578
-
579
- const MyComponent = () => (
580
- <FlipButtonGroup direction="column" sx={{bgColor: 'transparent'}}>
581
- <FlipButton value="public" label="Public">
582
- { customElement }
583
- </FlipButton>
584
- <FlipButton value="private" label="Private">
585
- { customElement }
586
- </FlipButton>
587
- </FlipButtonGroup>
588
-
589
- )
590
- render(<MyComponent/>)
591
- *
592
- * ?)
593
- *
594
- */
595
- declare const FlipButton: (props: FlipButtonProps) => JSX.Element;
596
-
597
- /**
598
- * Provides context to FlipButton
599
- * @see FlipButton
600
- * @see {@link https://northlight.dev/reference/flip-button-group}
601
- */
602
- declare const FlipButtonGroup: (props: FlipButtonGroupProps) => JSX.Element;
603
-
604
- /**
605
- * The FlipButtonGroup component wrapped in a <Field />
606
- * meant to be used only inside <Form />
607
- * @see FlipButton
608
- * @see {@link https://northlight.dev/reference/flip-button-group-field}
609
- *
610
- * @example (Example)
611
- * (?
612
- * <Form intitialValues={{foods: 'pizza'}}>
613
- <FlipButtonGroupField name="foods" label="Select the food you enjoy most" variant="brand">
614
- <FlipButton value="pizza">Pizza</FlipButton>
615
- <FlipButton value="hamburger">Button</FlipButton>
616
- <FlipButton value="steak">Steak</FlipButton>
617
- </FlipButtonGroupField>
618
- * </Form>
619
- *
620
- * ?)
621
- *
622
- */
623
- declare const FlipButtonGroupField: ({ name, label, children, direction, isRequired, iconPlacement, onChange: onChangeCallback, validate, ...rest }: FlipButtonGroupFieldProps) => JSX.Element;
624
-
625
- type Color = 'blue' | 'gray' | 'red' | 'pink' | 'green' | 'orange' | 'purple' | 'yellow' | 'mediatoolBlue';
626
- type ColorGrade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
627
- type ColorShades = Record<ColorGrade, string>;
628
-
629
- interface InputFieldProps {
630
- inputLeftElement?: React.ReactNode;
631
- inputRightElement?: React.ReactNode;
632
- }
633
-
634
- interface DateRange {
635
- startDate: string;
636
- endDate: string;
637
- }
638
- interface DatePickerSettings {
639
- firstDayOfWeek: 'sunday' | 'monday';
640
- resetDate: () => void;
641
- isInvalid?: boolean;
642
- /** The dateFormat is a string,
643
- * which acts as a template on how to display the date for the user, ex:
644
- * dateFormat="mm.dd.yyyy" */
645
- dateFormat?: string;
646
- isClearable?: boolean;
647
- variant?: 'outline' | 'filled';
648
- }
649
- type DatePickerMode = 'simple' | 'advanced';
650
- interface DatePickerProps extends AriaDatePickerProps<DateValue>, DatePickerSettings {
651
- }
652
- interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>, 'onChange' | 'value' | 'minValue' | 'maxValue'>, DatePickerSettings {
653
- onChange?: (date: null | DateRange) => void;
654
- value: DateRange | null;
655
- minValue?: string | undefined;
656
- maxValue?: string | undefined;
657
- fiscalStartMonth?: number;
658
- fiscalStartDay?: number;
659
- mode?: DatePickerMode;
660
- }
661
- interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldProps {
662
- name: string;
663
- label: string;
664
- minValue?: string;
665
- maxValue?: string;
666
- validate?: RegisterOptions;
667
- firstDayOfWeek?: 'sunday' | 'monday';
668
- direction?: StackDirection;
669
- dateFormat?: string;
670
- onChange?: (date: DateValue) => void;
671
- isClearable?: boolean;
672
- fiscalStartMonth?: number;
673
- fiscalStartDay?: number;
674
- }
675
- interface DateRangePickerFieldProps extends Omit<DatePickerFieldProps, 'onChange'> {
676
- onChange?: (date: null | DateRange) => void;
677
- mode?: DatePickerMode;
678
- }
679
- type FormBody = Record<string, DateRange>;
680
-
681
- /**
682
- * Popover to select single date
683
- * @see DatePickerField
684
- * @see {@link https://northlight.dev/reference/date-picker}
685
- *
686
- * @example (Example)
687
- * ## When is your birthday
688
- * (?
689
- * () => {
690
- * const [ date, setDate ] = useState('2023-10-10')
691
- *
692
- * const parseDate = () => {
693
- * return undefined
694
- * }
695
- *
696
- * return (
697
- * <DatePicker
698
- * firstDayOfWeek="monday"
699
- * resetDate={() => setDate(null)} onChange={setDate} value={parseDate(date)}/>
700
- * )
701
- * }
702
- *
703
- * ?)
704
- * <br />
705
- * ### Some notes on date format
706
- * As you can see in the above example, the parseDate function returns undefined.
707
- * The DatePicker natively handles
708
- * dates as a DateValue object. To get out a string value on format yyyy-mm-dd,
709
- * you can use the javascript <b>.toString</b> method,
710
- * and for getting it back from string to DateValue,
711
- * you can use the parseDate util.
712
- * <br />
713
- * To read more about date formatting, consult the
714
- * <a target="_blank" style="fontWeight: bold;" href="https://react-spectrum.adobe.com/internationalized/date/CalendarDate.html">react aria internationalized documentation</a>
715
- *
716
- * @example (Example)
717
- * ## Another example
718
- * (?
719
- * <DatePicker
720
- * variant="filled"
721
- * dateFormat="mm|dd-yyyy"
722
- * />
723
- * ?)
724
- *
725
- */
726
- declare const DatePicker: (props: DatePickerProps) => JSX.Element;
727
-
728
- /**
729
- * Popover to choose date range on format {startDate:' yyyy-mm-dd', endDate: 'yyyy-mm-dd'}
730
- *
731
- * @see DatePicker
732
- * @see DateRangePickerField
733
- * @see {@link https://northlight.dev/reference/date-range-picker}
734
- * @example (Example)
735
- * ## Advanced Mode
736
- * (Due to it being harder to setup normal date range picker,
737
- * the date range picker field is demoed,
738
- * here, you need to pass down and parse a value for the date range picker for it to work properly,
739
- * consult the date picker documentation and the source code for date range picker
740
- * field for appropiate use)
741
- * (?
742
- * <Form initialValues={{date: null}}>
743
- * <DateRangePickerField name="date"/>
744
- * </Form>
745
- * ?)
746
- *
747
- * @example (Example)
748
- * ## Simple mode
749
- * The previous example was the date range picker variant
750
- * for which we call advance, this one is a simpler version with the same core functionality:
751
- * (?
752
- * <Form initialValues={{date: null}}>
753
- * <DateRangePickerField name="date" mode="simple"/>
754
- * </Form>
755
- * ?)
756
- *
757
- * @example (Example)
758
- * ## Sophisticated example
759
- * The `DateRangePickerField` can have **fiscalStartMonth** and **fiscalStartDay** as a `number`
760
- * (?
761
- * <Form initialValues={{date: null}}>
762
- * <DateRangePickerField
763
- * name="date"
764
- * mode="advanced"
765
- * variant="filled"
766
- * fiscalStartMonth={3}
767
- * fiscalStartDay={5}
768
- * dateFormat="mm|dd-yyyy"
769
- * minValue="2023-01-01"
770
- * maxValue="2028-01-01"
771
- * />
772
- * </Form>
773
- * ?)
774
- */
775
- declare const DateRangePicker: (props: DateRangePickerProps) => JSX.Element;
776
-
777
- /**
778
- * The <DatePicker /> component wrapped in a <Field />
779
- * meant to be used only inside <Form />
780
- * @see DatePicker
781
- * @see {@link https://northlight.dev/reference/date-picker-field}
782
- *
783
- * @example (Example)
784
- * ##Fill in your information:
785
- * (?
786
- * <Form initialValues={{date: null}}>
787
- * <DatePickerField name="date" />
788
- * </Form>
789
- *
790
- * ?)
791
- * <br />
792
- * ###The simplest way
793
- * Using the date picker in a form is probably the easiest
794
- * way to use it, it will handle the state for you and you
795
- * can retrieve the date at the end as a string on format
796
- * yyyy-mm-dd on the onSubmit callback on <Form>
797
- *
798
- */
799
- declare const DatePickerField: ({ name, minValue, maxValue, isRequired, direction, label, validate, firstDayOfWeek, onChange: onChangeCallback, inputLeftElement, inputRightElement, ...rest }: DatePickerFieldProps) => JSX.Element;
800
-
801
- /**
802
- * The <DateRangePicker /> component wrapped in a <Field />
803
- * meant to be used only inside <Form />
804
- * @see DateRangePicker
805
- * @see {@link https://northlight.dev/reference/date-range-picker-field}
806
- *
807
- */
808
- declare const DateRangePickerField: ({ name, minValue, maxValue, isRequired, direction, label, validate, firstDayOfWeek, onChange: onChangeCallback, isClearable, ...rest }: DateRangePickerFieldProps) => JSX.Element;
809
-
810
- interface ToolboxProps extends Omit<FlexProps, 'direction'> {
811
- isOpen: boolean;
812
- /** where the toolbox pops in from */
813
- direction?: 'right' | 'left';
814
- /** if true creates a statically positioned box element that takes up
815
- * width, causes layout change. */
816
- shouldPush?: boolean;
817
- children: JSX.Element[] | JSX.Element;
818
- size?: 'sm' | 'md' | 'lg';
819
- onClose: () => void;
820
- /** if true focuses on the first element in the toolboxcontent. */
821
- autoFocus?: boolean;
822
- }
823
- interface ToolboxHeaderProps extends FlexProps {
824
- onClose?: () => void;
825
- children: JSX.Element | string;
826
- }
827
- interface ToolboxContentProps extends FlexProps {
828
- children: JSX.Element | string;
829
- }
830
- interface ToolboxFooterProps extends FlexProps {
831
- children: JSX.Element | JSX.Element[] | string;
832
- }
833
-
834
- /**
835
- * Controllable Sidebar drawer
836
- * @see Slide
837
- * @see {@link https://northlight.dev/reference/toolbox}
838
- * @example
839
- * (?
840
- *() => {
841
- const { isOpen, onOpen, onClose } = useDisclosure()
842
- return (
843
- <Flex>
844
- <Button onClick={ onOpen } w="full">
845
- Open Toolbox
846
- </Button>
847
- <Toolbox isOpen={ isOpen } onClose={ onClose } size="md">
848
- <ToolboxHeader>Title</ToolboxHeader>
849
- <ToolboxContent>
850
- <Stack>
851
- <Input />
852
- <Input />
853
- </Stack>
854
- </ToolboxContent>
855
- <ToolboxFooter justifyContent="end" gap="2">
856
- <Button variant="ghost">Cancel</Button>
857
- <Button variant="brand">Save</Button>
858
- </ToolboxFooter>
859
- </Toolbox>
860
- </Flex>
861
- )
862
- }
863
- * ?)
864
- */
865
- declare const Toolbox: ({ isOpen, children, direction, shouldPush, size, width, onClose, autoFocus, ...rest }: ToolboxProps) => JSX.Element;
866
-
867
- /**
868
- * @see Toolbox
869
- * @see {@link https://northlight.dev/reference/toolbox-header}
870
- *
871
- */
872
- declare const ToolboxHeader: ({ children, onClose, ...rest }: ToolboxHeaderProps) => JSX.Element;
873
-
874
- /**
875
- * Main content of toolbox drawer
876
- * @see Toolbox
877
- * @see {@link https://northlight.dev/reference/toolbox-content}
878
- */
879
- declare const ToolboxContent: ({ children, ...rest }: ToolboxContentProps) => JSX.Element;
880
-
881
- /**
882
- * @see Toolbox
883
- * @see {@link https://northlight.dev/reference/toolbox-footer}
884
- */
885
- declare const ToolboxFooter: ({ children, ...rest }: ToolboxFooterProps) => JSX.Element;
886
-
887
- interface CarouselProps extends Omit<BoxProps, 'onChange'> {
888
- children: JSX.Element[];
889
- /** Whether to show default navigational arrows on sides */
890
- showArrows?: boolean;
891
- /** Whether to show default navigational radio button on bottom */
892
- showRadio?: boolean;
893
- /** This is the width of the container that each seperate child component is rendered within */
894
- itemWidth?: number;
895
- /** This is the height of the container that each seperate child component is rendered within */
896
- itemHeight?: number;
897
- spacing?: number;
898
- /** A number, representing the index of the number
899
- * that is currently centered/focused in the carousel */
900
- value?: number;
901
- /** callback function that passes the current centered item in the carousel */
902
- onChange?: (value: number) => void;
903
- /** Custom styles to apply directly on closes wrapper to children */
904
- carouselStyles?: StackProps;
905
- }
906
-
907
- /**
908
- * Easiely one of the fanciest components, horizontal carousel wrapper for anything
909
- *
910
- * @see {@link https://northlight.dev/reference/carousel}
911
- *
912
- * @example (Example)
913
- * The carousel takes up 100% of its parents container width and height.
914
- * It then renders all children div into a draggable div using framer-motion
915
-
916
- * (?
917
- * +
918
- *const Item = ({ name, ...rest }) => (
919
- <Center color="white" bg="teal.500" rounded="md" w="full" h="full" { ...rest }>
920
- { name }
921
- </Center>
922
- )
923
-
924
- const MyCarousel = () => (
925
- <Box h="300px">
926
- <Carousel>
927
- <Item name="Item 1" />
928
- <Item name="Item 2" />
929
- <Item name="Item 3" />
930
- </Carousel>
931
- </Box>
932
-
933
- )
934
-
935
- render(<MyCarousel />)
936
- *
937
- * ?)
938
- *
939
- * @example (Example)
940
- * ##Controling the carousel state
941
- * The carousel takes an **onChange** and value
942
- * (which is the index of the current active element), meaning it can be controlled.
943
- *
944
- * (?
945
- * +
946
- * const Item = ({ name, ...rest }) => (
947
- <Center color="white" bg="teal.500" rounded="md" w="full" h="full" { ...rest }>
948
- { name }
949
- </Center>
950
- )
951
-
952
- const MyCarousel = () => {
953
- const [index, setIndex ] = useState(0)
954
- return (
955
-
956
- <VStack
957
- borderColor="border.default"
958
- borderWidth="st.border.width.sm" borderStyle="solid" p="2" borderRadius="st.border.radius.lg">
959
- <Box w="full" h="sm">
960
- <Carousel
961
- showArrows={ false }
962
- showRadio={ false }
963
- value={ index }
964
- onChange={ (v) => setIndex(v) }
965
- >
966
- <Item name="Item 1" />
967
- <Item name="Item 2" />
968
- <Item name="Item 3" />
969
- </Carousel>
970
- </Box>
971
- <FlipButtonGroup
972
- onChange={ (v) => setIndex(parseInt(v, 10)) }
973
- value={ `${index}` }
974
- variant="brand"
975
- >
976
- <FlipButton value="0">One</FlipButton>
977
- <FlipButton value="1">Two</FlipButton>
978
- <FlipButton value="2">Three</FlipButton>
979
- </FlipButtonGroup>
980
- </VStack>
981
- )
982
- }
983
- *
984
- render(<MyCarousel/>)
985
- * ?)
986
- *(You can also hide the default
987
- navigational arrows and radio button using <b>showArrows</b> and
988
- <b>showRadio</b> as in example)
989
- */
990
- declare const Carousel: ({ children, showArrows, showRadio, value: controlledIndex, onChange, itemWidth, itemHeight, spacing, carouselStyles, ...rest }: CarouselProps) => JSX.Element;
991
-
992
- type Size$1 = 'sm' | 'md' | 'lg';
993
- interface SearchBarOptionType {
994
- label: string;
995
- value: any;
996
- }
997
- type CustomElementType<T extends SearchBarOptionType> = ((props: T) => JSX.Element) | null;
998
- interface SearchBarProps<T extends SearchBarOptionType, K extends boolean = false> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
999
- value?: T | T[];
1000
- onChange?: (val: any, event: ActionMeta<T>) => void;
1001
- onAdd?: (val: unknown) => void;
1002
- onRemove?: (val: unknown) => void;
1003
- size?: Size$1;
1004
- 'data-testid'?: string;
1005
- debouncedWaitTime?: number;
1006
- clearInputOnSelect?: boolean;
1007
- closeMenuonSelect?: boolean;
1008
- defaultOptions?: T[];
1009
- sx?: ChakraStylesConfig<any>;
1010
- isMulti?: K;
1011
- customOption?: CustomElementType<T>;
1012
- customTag?: CustomElementType<T>;
1013
- loadOptions?: ((query: string) => Promise<T[]>) | null;
1014
- onSearchInputChange?: (input: string) => void;
1015
- icon?: ComponentType<any>;
1016
- }
1017
- interface SearchBarFieldProps<T extends SearchBarOptionType, K extends boolean = false> extends Omit<SearchBarProps<T, K>, 'onChange'>, InputFieldProps {
1018
- onChange?: (val: T | T[], event: ActionMeta<T>) => void;
1019
- direction?: StackDirection;
1020
- name: string;
1021
- label: string;
1022
- validate?: RegisterOptions;
1023
- isRequired?: boolean;
1024
- }
1025
-
1026
- 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;
1027
-
1028
- 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;
1029
-
1030
- /**
1031
- * Context used for all drag and drop components
1032
- * (Based on dnd-kit)
1033
- * @see Draggable
1034
- * @see Droppable
1035
- * @see {@link https://northlight.dev}
1036
- * @see {@link https://dndkit.com/}
1037
- *
1038
- */
1039
- declare const DragAndDrop: (props: DndContextProps) => JSX.Element;
1040
-
1041
- type ListenersType = SyntheticListenerMap;
1042
- type ChildrenType$1<PropType = any, PropTypeTwo = any> = ((props: PropType, secondProp: PropTypeTwo, thirdProp?: any) => JSX.Element | JSX.Element[] | undefined) | (JSX.Element | JSX.Element[]);
1043
- type MultiItemType<itemKeys extends string | number | symbol> = Record<itemKeys, string[]>;
1044
- interface DroppableProps extends UseDroppableArguments {
1045
- children?: ((props: any) => JSX.Element | JSX.Element[]) | (JSX.Element | JSX.Element[]);
1046
- }
1047
- interface DraggableProps extends UseDraggableArguments {
1048
- itemLabel?: string;
1049
- children?: ChildrenType$1<ListenersType>;
1050
- disableDrag?: boolean;
1051
- }
1052
- interface SortableItemProps extends UseSortableArguments {
1053
- children?: ChildrenType$1<ListenersType>;
1054
- itemLabel?: UniqueIdentifier;
1055
- dblClickThreshold?: number;
1056
- disableDrag?: boolean;
1057
- }
1058
- type MovedItemType<T> = {
1059
- item: T;
1060
- oldIndex: number;
1061
- newIndex: number;
1062
- };
1063
- interface SortableListProps<T> {
1064
- children?: ChildrenType$1<T, ListenersType>;
1065
- items: T[];
1066
- /** Play around with this in case the sortable items don't land where
1067
- * supposed to. See: https://docs.dndkit.com/api-documentation/context-provider/collision-detection-algorithms */
1068
- collisionDetection?: CollisionDetection;
1069
- /** Used to optimize rendering, see: https://docs.dndkit.com/presets/sortable#sorting-strategies */
1070
- strategy?: SortingStrategy;
1071
- onChange?: (items: T[]) => void;
1072
- createKey?: (item: T) => UniqueIdentifier;
1073
- /** You can add an overlay, which can make it more accessible in use
1074
- * cases where it can be hard to see for the user where their item will land on drop */
1075
- displayOverlay?: boolean;
1076
- /** In case you want to adjust the input methods, see: https://docs.dndkit.com/api-documentation/sensors */
1077
- sensors?: SensorDescriptor<SensorOptions>[];
1078
- dblClickThreshold?: number;
1079
- disableDrag?: boolean;
1080
- /** callback, passes the dragged item and it's old / new index after a drag, */
1081
- onMovedItem?: ({ item, oldIndex, newIndex }: MovedItemType<T>) => void;
1082
- /** Read: https://docs.dndkit.com/api-documentation/modifiers#restricting-motion-to-an-axis */
1083
- modifiers?: Modifiers;
1084
- }
1085
- interface MultiSortProps<itemKeys extends string | number | symbol> {
1086
- children?: ChildrenType$1;
1087
- items: MultiItemType<itemKeys>;
1088
- /** https://docs.dndkit.com/api-documentation/context-provider/collision-detection-algorithms */
1089
- collisionDetection?: CollisionDetection;
1090
- onChange?: (items: MultiItemType<itemKeys>) => void;
1091
- /** https://docs.dndkit.com/api-documentation/sensors */
1092
- sensors?: SensorDescriptor<SensorOptions>[];
1093
- }
1094
- interface DragItemProps extends Omit<TagProps$1, 'variant'> {
1095
- isDragging?: boolean;
1096
- itemLabel?: UniqueIdentifier;
1097
- bgColor?: string;
1098
- }
1099
- interface DragHandleProps extends IconProps$1 {
1100
- isDragging?: boolean;
1101
- icon?: ComponentType<any>;
1102
- }
1103
- interface DropZoneProps {
1104
- sx?: SystemStyleObject;
1105
- name: UniqueIdentifier;
1106
- children?: JSX.Element;
1107
- }
1108
- interface SortableContainerProps {
1109
- items: UniqueIdentifier[];
1110
- strategy?: SortingStrategy;
1111
- children?: (id: UniqueIdentifier) => JSX.Element;
1112
- }
1113
-
1114
- /**
1115
- * Will turn it's childen into a draggable component when under DragAndDrop context
1116
- * @see {@link https://northlight.dev/reference/draggable}
1117
- *
1118
- * @example (Example)
1119
- * ##Basic exapmle
1120
- * (?
1121
- * <DragAndDrop>
1122
- * <HStack>
1123
- * <Draggable id="random-id" />
1124
- * <Draggable />
1125
- * </HStack>
1126
- * </DragAndDrop>
1127
- * ?)
1128
- * <br />
1129
- * (Notice that the id prop is required)
1130
- *
1131
- * @example (Example)
1132
- * ## With custom children
1133
- *
1134
- * (?
1135
- * <DragAndDrop>
1136
- * <Box p="4">
1137
- * <Draggable id="random-id">
1138
- * <Center
1139
- * boxSize="3xs"
1140
- * boxShadow="xl"
1141
- * borderRadius="st.border.radius.lg"
1142
- * bgColor="bg.overlayer"
1143
- * >I am draggable</Center>
1144
- * </Draggable>
1145
- * </Box>
1146
- *
1147
- * </DragAndDrop>
1148
- * ?)
1149
- *
1150
- *
1151
- */
1152
- declare const Draggable: ({ itemLabel, children, disableDrag, ...rest }: DraggableProps) => JSX.Element;
1153
-
1154
- /**
1155
- * Wrapper where you can style a container to place draggable elements
1156
- * @see DropZone
1157
- * @see Draggable
1158
- * @see DragAndDrop
1159
- * @see {@link https://northlight.dev/reference/droppable}
1160
- *
1161
- * @example (Example)
1162
- * ## Move the item into the container
1163
- * (?
1164
- * () => {
1165
- * const [ isDropped, setIsDropped ] = useState(false)
1166
- * const handleDragEnd = (e) => {
1167
- * setIsDropped(e.over && e.over.id === 'droppable')
1168
- * }
1169
- *
1170
- * return (
1171
- * <DragAndDrop onDragEnd={handleDragEnd}>
1172
- * <HStack>
1173
- * {!isDropped && <Draggable id="draggable" />}
1174
- * <Droppable id="droppable">
1175
- * <Center bgColor="bg.filled" boxSize="3xs">
1176
- * {isDropped ? <Draggable id="draggable"/> : <P>Drop here!</P>}
1177
- * </Center>
1178
- * </Droppable>
1179
- * </HStack>
1180
- *
1181
- * </DragAndDrop>
1182
- *
1183
- * )
1184
- *
1185
- *
1186
- * }
1187
- * ?)
1188
- *
1189
- */
1190
- declare const Droppable: ({ children, ...rest }: DroppableProps) => JSX.Element;
1191
-
1192
- /**
1193
- * Wrapper that provides context for sortable elements using DnD-kit
1194
- * @see DragAndDrop
1195
- * @see SortableList
1196
- * @see MultiSort
1197
- * @see {@link https://northlight.dev}
1198
- * @see {@link https://docs.dndkit.com/presets/sortable/sortable-context}
1199
- * @example
1200
- * **<a href="https://docs.dndkit.com/presets/sortable/sortable-context" target="_blank">Read more on dnd-docs</a>**
1201
- * */
1202
- declare const Sortable: (props: SortableContextProps) => JSX.Element;
1203
-
1204
- /**
1205
- * Renders a draggable item under sortable context
1206
- * @see SortableList
1207
- * @see MultiSort
1208
- * @see {@link https://northlight.dev/reference/sortable-item}
1209
- *
1210
- * @example
1211
- * (? <SortableItem id="sortable-1"/> ?)
1212
- * */
1213
- declare const SortableItem: ({ itemLabel, dblClickThreshold, children, disableDrag, ...rest }: SortableItemProps) => JSX.Element;
1214
-
1215
- /**
1216
- * Default draggable item none other provided in SortableList and MultiSort.
1217
- * Renders a tag which can be used under the DragAndDrop context
1218
- * @see DragAndDrop
1219
- * @see SortableList
1220
- * @see MultiSort
1221
- * @see {@link https://northlight.dev/reference/drag-item}
1222
- *
1223
- * @example (Example)
1224
- * (?
1225
- * <DragItem itemLabel="Option 1" bgColor="bg.filled" />
1226
- * ?)
1227
- *
1228
- */
1229
- declare const DragItem: (props: DragItemProps & React__default.RefAttributes<unknown>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
1230
-
1231
- /**
1232
- * Util component to display drag handle icon
1233
- * for draggable react components under DragAndDrop context
1234
- * @see DragAndDrop
1235
- * @see {@link https://northlight.dev/reference/drag-handle}
1236
- *
1237
- * @example (Example)
1238
- * (?
1239
- * <DragHandle />
1240
- * ?)
1241
- */
1242
- declare const DragHandle: ({ icon, isDragging, ...rest }: DragHandleProps) => JSX.Element;
1243
-
1244
- /**
1245
- * Prestyled droppable area to drop draggable components,
1246
- * you can override the styles of dropzone with sx prop
1247
- * @see Draggable
1248
- * @see Droppable
1249
- * @see DragAndDrop
1250
- * @see {@link https://northlight.dev/reference/drop-zone}
1251
- *
1252
- * @example (Example)
1253
- * ## You can drop draggable components
1254
- * (?
1255
- * <DragAndDrop>
1256
- * <DropZone name="random-id-2"><Draggable id="test"/></DropZone>
1257
- * </DragAndDrop>
1258
- * ?)
1259
- */
1260
- declare const DropZone: ({ sx, name, children, ...rest }: DropZoneProps) => JSX.Element;
1261
-
1262
- /**
1263
- * Util component for sorting items in two dimensions(container and order in container)
1264
- * @see SortableList
1265
- * @see DragAndDrop
1266
- * @see {@link https://northlight.dev/reference/multi-sort}
1267
- *
1268
- * @example
1269
- * (?
1270
- * () => {
1271
- const [ multiItems, setMultiItems ] = useState({
1272
- container1: [
1273
- 'JavaScript',
1274
- 'Python',
1275
- 'Front end',
1276
- 'Back end',
1277
- ],
1278
- container2: [ 'HTML', 'CSS' ],
1279
- container3: [ 'Chakra UI', 'Next.js', 'Tailwind UI' ],
1280
- })
1281
- return (
1282
- <Stack>
1283
- <MultiSort
1284
- items={ multiItems }
1285
- onChange={ (items) => setMultiItems(items) }
1286
- >
1287
- { (items, activeId) => (
1288
- <HStack alignItems="start">
1289
- <VStack>
1290
- <Heading size="sm">I like</Heading>
1291
- <DropZone name="container1">
1292
- <SortableContainer items={ items.container1 } />
1293
- </DropZone>
1294
- </VStack>
1295
- <VStack>
1296
- <Heading size="sm">I don't like</Heading>
1297
- <DropZone name="container2">
1298
- <SortableContainer items={ items.container2 } />
1299
- </DropZone>
1300
- </VStack>
1301
- <VStack>
1302
- <Heading size="sm">Neutral</Heading>
1303
- <DropZone name="container3">
1304
- <SortableContainer items={ items.container3 } />
1305
- </DropZone>
1306
- </VStack>
1307
- <DragOverlay>
1308
- { activeId ? (
1309
- <DragItem
1310
- itemLabel={ activeId }
1311
- isDragging={ true }
1312
- bgColor="background.tag.default"
1313
- />
1314
- ) : null }
1315
- </DragOverlay>
1316
- </HStack>
1317
- ) }
1318
- </MultiSort>
1319
- <Text>Controlled output: </Text>
1320
- <Code p={ 2 } borderRadius={ 4 }>
1321
- <pre>{ JSON.stringify(multiItems, null, 2) }</pre>
1322
- </Code>
1323
- </Stack>
1324
- )
1325
- * }
1326
- * ?)
1327
- * <br />
1328
- * Multisort abstracts logic away for setting up sortable items between multiple containers,
1329
- * you can then separate, or create and style this containers as you want,
1330
- * by putting them under <Droppable /> or a prestyled <Dropzone />
1331
-
1332
- SortableContainer is a wrapper for a <Sortable /> with a sortable item
1333
- * */
1334
- declare function MultiSort<itemKeys extends string | number | symbol>({ items: sortableItems, onChange, children, collisionDetection, sensors, }: MultiSortProps<itemKeys>): JSX.Element;
1335
-
1336
- /**
1337
- * Util component to render sortable items under sortable context
1338
- * @see SortableItem
1339
- * @see Sortable
1340
- * @see {@link https://northlight.dev/reference/sortable-list}
1341
- *
1342
- * @example (Example)
1343
- * ## You can render any layout of sortable components, for example grid:
1344
- * (?
1345
- * () => {
1346
- * const [items, setItems] = useState(Array.from({length: 100}, (_, i) => i))
1347
- * return (
1348
- * <Stack>
1349
- <SimpleGrid minChildWidth="50px" spacing={ 4 }>
1350
- <SortableList
1351
- items={ items }
1352
- onChange={ (items) => setItems(items) }
1353
- />
1354
- </SimpleGrid>
1355
- <Code p={ 2 } borderRadius={ 4 }>
1356
- { JSON.stringify(items, null, 2) }
1357
- </Code>
1358
- </Stack>
1359
- * )}
1360
- * ?)
1361
- *
1362
- * @example (Example)
1363
- * ### With custom component
1364
- * (?
1365
- * () => {
1366
- * const [items, setItems] = useState([ { name: 'item1' }, { name: 'item2' }, { name: 'item3' } ])
1367
- * return (
1368
- * <Stack>
1369
- *
1370
- * <SortableList
1371
- items={ items }
1372
- createKey={ (item) => item.name }
1373
- disableDrag={ true }
1374
- onChange={setItems}
1375
- >
1376
- { ({ name }, listeners, { isOver }) => (
1377
- <HStack>
1378
- <DragHandle { ...listeners } isDragging={ isOver } />
1379
- <Input defaultValue={ name } />
1380
- </HStack>
1381
- ) }
1382
- </SortableList>
1383
- </Stack>
1384
- )}
1385
- * ?)
1386
- <br />
1387
- If disableDrag=false, then when the user double clicks it will trigger
1388
- the default behaviour of the rendered component instead of the dragging,
1389
- you can adjust the threshold with dblClickThreshold, default is 300ms
1390
- *
1391
- *
1392
- */
1393
- declare function SortableList<T>({ children, items, collisionDetection, createKey, strategy, onChange, onMovedItem, displayOverlay, sensors, dblClickThreshold, disableDrag, modifiers, }: SortableListProps<T>): JSX.Element;
1394
-
1395
- /**
1396
- * Used with multi sort to render a sortable list inside a droppable
1397
- * @see MultiSort
1398
- * @see {@link https://northlight.dev/reference/sortable-container}
1399
- *
1400
- * @example
1401
- * (?
1402
- * <SortableContainer items={['item 1', 'item 2', 'item 3']} />
1403
- * ?)
1404
- *
1405
- */
1406
- declare const SortableContainer: ({ children, items, strategy }: SortableContainerProps) => JSX.Element;
1407
-
1408
- interface HeadingProps extends HeadingProps$1 {
1409
- }
1410
-
1411
- /**
1412
- * @see {@link https://northlight.dev/reference/h1}
1413
- * @example (Example)
1414
- * (?
1415
- * <H1>Heading 1</H1>
1416
- * ?)
1417
- */
1418
- declare const H1: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1419
-
1420
- /**
1421
- * @see {@link https://northlight.dev/reference/h2}
1422
- * @example (Example)
1423
- * (?
1424
- * <H2>Heading 2</H2>
1425
- * ?)
1426
- *
1427
- */
1428
- declare const H2: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1429
-
1430
- /**
1431
- * @see {@link https://northlight.dev/reference/h3}
1432
- * @example (Example)
1433
- * (?
1434
- * <H3>Heading 3</H3>
1435
- * ?)
1436
- */
1437
- declare const H3: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1438
-
1439
- /**
1440
- * @see {@link https://northlight.dev/reference/h4}
1441
- * @example (Example)
1442
- * (?
1443
- * <H4>Heading 4</H4>
1444
- * ?)
1445
- */
1446
- declare const H4: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1447
-
1448
- /**
1449
- * @see {@link https://northlight.dev/reference/h5}
1450
- * @example (Example)
1451
- * (?
1452
- * <H5>Heading 5</H5>
1453
- * ?)
1454
- */
1455
- declare const H5: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1456
-
1457
- /**
1458
- * @see {@link https://northlight.dev/reference/h6}
1459
- * @example (Example)
1460
- * (?
1461
- * <H6>Heading 6</H6>
1462
- * ?)
1463
- */
1464
- declare const H6: ({ children, sx, ...rest }: HeadingProps) => JSX.Element;
1465
-
1466
- interface PProps extends TextProps {
1467
- variant?: '14' | '16';
1468
- }
1469
-
1470
- /**
1471
- * @see {@link https://northlight.dev/reference/p}
1472
- * @example
1473
- * (?
1474
- * <P>Body text</P>
1475
- * ?)
1476
- *
1477
- */
1478
- declare const P: ({ children, variant, sx, ...rest }: PProps) => JSX.Element;
1479
-
1480
- /**
1481
- * One of the stylized typography components
1482
- * @see Capitalized
1483
- * @see Lead
1484
- * @see Small
1485
- * @see Tiny
1486
- * @see {@link https://northlight.dev/reference/blockquote }
1487
- *
1488
- * @example (Example)
1489
- * (?
1490
- * <Blockquote sx={{color: 'green.500' }}>Success</Blockquote>
1491
- * ?)
1492
- * (_Note, all other css properties not listed under the
1493
- * props tab to right should be passed down via **sx**_)
1494
- *
1495
- *
1496
- *
1497
- */
1498
- declare const Blockquote: ({ children, sx, ...rest }: TextProps) => JSX.Element;
1499
-
1500
- /**
1501
- * One of the stylized typography components
1502
- * @see Blockquote
1503
- * @see Lead
1504
- * @see Small
1505
- * @see Tiny
1506
- * @see {@link https://northlight.dev/reference/capitalized }
1507
- *
1508
- * @example (Example)
1509
- * (?
1510
- * <Capitalized sx={{color: 'red.500' }}>Error</Capitalized>
1511
- * ?)
1512
- * (_Note, all other css properties not listed
1513
- * under the props tab to right should be passed down via **sx**_)
1514
- *
1515
- */
1516
- declare const Capitalized: ({ children, sx, ...rest }: TextProps) => JSX.Element;
1517
-
1518
- /**
1519
- * One of the stylized typography components
1520
- * @see Blockquote
1521
- * @see Lead
1522
- * @see Small
1523
- * @see Tiny
1524
- * @see {@link https://northlight.dev/reference/lead }
1525
- *
1526
- * @example
1527
- * (?
1528
- * <Lead>Lead</Lead>
1529
- * ?)
1530
- * (_Note, all other css properties not listed
1531
- * under the props tab to right should be passed down via **sx**_)
1532
- *
1533
- */
1534
- declare const Lead: ({ children, sx, ...rest }: TextProps) => JSX.Element;
1535
-
1536
- /**
1537
- * One of the stylized typography components
1538
- * @see Capitalized
1539
- * @see Lead
1540
- * @see Blockquote
1541
- * @see Tiny
1542
- * @see {@link https://northlight.dev/reference/small }
1543
- *
1544
- * @example (Example)
1545
- * (?
1546
- * <Small>Small</Small>
1547
- * ?)
1548
- * (_Note, all other css properties not listed under the
1549
- * props tab to right should be passed down via **sx**_)
1550
- *
1551
- */
1552
- declare const Small: ({ children, sx, ...rest }: TextProps) => JSX.Element;
1553
-
1554
- /**
1555
- * One of the stylized typography components
1556
- * @see Capitalized
1557
- * @see Lead
1558
- * @see Blockquote
1559
- * @see Small
1560
- * @see {@link https://northlight.dev/reference/tiny }
1561
- *
1562
- * @example (Example)
1563
- * (?
1564
- * <Tiny>Tiny</Tiny>
1565
- * ?)
1566
- * (_Note, all other css properties not listed under the
1567
- * props tab to right should be passed down via **sx**_)
1568
- *
1569
- */
1570
- declare const Tiny: ({ children, sx, ...rest }: TextProps) => JSX.Element;
1571
-
1572
- type LabelSizes = '2xs' | 'xs' | 'sm' | 'md' | 'lg';
1573
- interface LabelProps extends FormLabelProps$1 {
1574
- size?: LabelSizes;
1575
- }
1576
-
1577
- /**
1578
- * One of the stylized typography components
1579
- * @see Blockquote
1580
- * @see Lead
1581
- * @see Small
1582
- * @see Tiny
1583
- * @see {@link https://northlight.dev/reference/label }
1584
- *
1585
- * @example
1586
- * (?
1587
- * <Label sx={{color: 'brand.500' }} size="lg">Brand</Label>
1588
- * ?)
1589
- * (_Note, all other css properties not listed
1590
- * under the props tab to right should be passed down via **sx**_)
1591
- *
1592
- */
1593
- declare const Label: ({ children, size, sx, ...rest }: LabelProps) => JSX.Element;
1594
-
1595
- type HeadingType = typeof Heading;
1596
- type BodyType = typeof P;
1597
- type StylizedType = typeof Text;
1598
- type LabelType = typeof Label;
1599
-
1600
- interface FormLabelProps extends LabelProps {
1601
- size?: LabelSizes;
1602
- }
1603
-
1604
- /**
1605
- * Renders a label, meant to be used alongside a field component
1606
- * @see Field
1607
- * @see {@link https://northlight.dev/reference/form-label}
1608
- *
1609
- */
1610
- declare const FormLabel: ({ children: label, ...rest }: FormLabelProps) => JSX.Element;
1611
-
1612
- interface FastListProps extends Omit<VariableSizeListProps, 'itemSize' | 'children' | 'height' | 'width' | 'direction'> {
1613
- itemSize: number | ((index: number) => number);
1614
- itemCount: number;
1615
- direction?: StackDirection;
1616
- children: JSX.Element | ((index: number) => JSX.Element | string) | string;
1617
- width?: number;
1618
- height?: number;
1619
- initialScrollOffset?: number;
1620
- overscanCount?: number;
1621
- }
1622
-
1623
- /**
1624
- * Wrapper that renders children in a virtualized stacked layout
1625
- * @see FastGrid
1626
- * @see {@link https://northlight.dev/reference/fast-list}
1627
- *
1628
- * @example (Example)
1629
- * (?
1630
- * <Box h="500px" w="300p" border="1px solid gray" p={ 4 } borderRadius={ 4 }>
1631
- <FastList itemCount={ 10000 } itemSize={ 30 } overscanCount={ 100 }>
1632
- { (index) => `item-${index}` }
1633
- </FastList>
1634
- </Box>
1635
- * ?)
1636
- *
1637
- */
1638
- declare const FastList: (props: FastListProps & React__default.RefAttributes<VariableSizeList<any>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
1639
-
1640
- interface FastGridProps extends Omit<VariableSizeGridProps, 'children' | 'height' | 'width' | 'columnWidth' | 'rowHeight' | 'columnCount' | 'rowCount'> {
1641
- columnSize: number | ((index: number) => number);
1642
- rowSize: number | ((index: number) => number);
1643
- columns: number;
1644
- rows: number;
1645
- children: JSX.Element | ((rowIndex: number, columnIndex: number) => JSX.Element | string | null) | string;
1646
- width?: number;
1647
- height?: number;
1648
- overscanRowCount?: number;
1649
- overscanColumnCount?: number;
1650
- }
1651
-
1652
- /**
1653
- * Wrapper that renders children in a virtualized html grid layout
1654
- * @see FastList
1655
- * @see {@link https://northlight.dev/reference/fast-grid}
1656
- *
1657
- * @example (Example)
1658
- * ## Simple example
1659
- * (?
1660
- * <Box h="500px" w="500px" border="1px solid gray" p={ 4 } borderRadius={ 4 }>
1661
- <FastGrid
1662
- columns={ 10000 }
1663
- rows={ 10000 }
1664
- rowSize={ 100 }
1665
- columnSize={ 100 }
1666
- overscanRowCount={ 10 }
1667
- overscanColumnCount={ 1 }
1668
- >
1669
- { (rowIndex, columnIndex) => `[${rowIndex}, ${columnIndex}]` }
1670
- </FastGrid>
1671
- </Box>
1672
- *
1673
- * ?)
1674
- *
1675
- * @example (Example)
1676
- * ## Spreadsheet example
1677
- * (?
1678
- * +
1679
- *
1680
- const getCell = (rowIndex, columnIndex) => {
1681
- if (rowIndex === 0 && columnIndex === 0) return ''
1682
- if (rowIndex === 0) {
1683
- return (
1684
- <Lead w="full">
1685
- { ' ' }
1686
- Col { columnIndex }
1687
- </Lead>
1688
- )
1689
- }
1690
- if (columnIndex === 0) {
1691
- return (
1692
- <Lead w="full">
1693
- { ' ' }
1694
- Row { rowIndex }
1695
- </Lead>
1696
- )
1697
- }
1698
- return (
1699
- <TextField name={ `${rowIndex}-${columnIndex}` } />
1700
- )
1701
- }
1702
- *
1703
- * const MyGrid = () => {
1704
- * const [values, setValues ] = useState({})
1705
- * return(
1706
- * <Form initialValues={{}}>
1707
- * {({getValues}) => (
1708
- * <Stack>
1709
- * <Box h="500px" w="500p" border="1px solid gray" p={ 4 } borderRadius={ 4 }>
1710
- <FastGrid
1711
- columns={ 10000 }
1712
- rows={ 10000 }
1713
- rowSize={ 50 }
1714
- columnSize={ 100 }
1715
- overscanRowCount={ 10 }
1716
- overscanColumnCount={ 1 }
1717
- >
1718
- {getCell}
1719
- </FastGrid>
1720
- </Box>
1721
- <Button onClick={() => setValues(getValues())} variant="success">Save</Button>
1722
- <Code> <pre>{JSON.stringify(values, null, 2)}</pre></Code>
1723
- </Stack>
1724
- * )}
1725
- </Form>
1726
- * )}
1727
-
1728
- render(<MyGrid />)
1729
- *
1730
- *
1731
- * ?)
1732
- * **(Note, FastGrid must be wrapped in a parent element with set height and width!)**
1733
- *
1734
- */
1735
- declare const FastGrid: (props: FastGridProps & React__default.RefAttributes<VariableSizeGrid<any>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
1736
-
1737
- interface IconProps extends IconProps$1 {
1738
- as?: ComponentType<any>;
1739
- size?: 'xs' | 'sm' | 'md' | 'lg';
1740
- }
1741
-
1742
- /**
1743
- * Pass down any icon from northlight/icons via as prop
1744
- * @see IconButton
1745
- * @see {@link https://northlight.dev/reference/icon}
1746
- *
1747
- * @example
1748
- * (?
1749
- * <Icon as={SmileyDuo} size="lg" />
1750
- * ?)
1751
- */
1752
- declare const Icon: _chakra_ui_system_dist_system_types.ComponentWithAs<_chakra_ui_system_dist_system_types.As, IconProps>;
1753
-
1754
- interface IconButtonProps extends IconButtonProps$1 {
1755
- variant?: ButtonVariants;
1756
- }
1757
-
1758
- /**
1759
- * A normal button but renders an icon instead of text
1760
- * @see Button
1761
- * @see Icon
1762
- * @see {@link https://northlight.dev/reference/icon-button}
1763
- *
1764
- * @example (Example)
1765
- * (?
1766
- * <IconButton variant='brand' icon={<Icon as={UsersDuo} />} onClick={console.log}/>
1767
- * ?)
1768
- *
1769
- * @example (Example)
1770
- * (?
1771
- <IconButton
1772
- isRound={ true }
1773
- aria-label="create"
1774
- variant="success"
1775
- icon={ <Icon as={ PlusSolid } /> }
1776
- />
1777
- * ?)
1778
- *
1779
- */
1780
- declare const IconButton: (props: IconButtonProps & React__default.RefAttributes<unknown>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
1781
-
1782
- type ModalSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full' | 'huge';
1783
- interface ModalProps extends ModalProps$1 {
1784
- size?: ModalSizes;
1785
- /** If true then the modal will never unmount but only hide when closing,
1786
- * stayMountedOnClose is false by default */
1787
- stayMountedOnClose?: boolean;
1788
- }
1789
-
1790
- interface CompressionType {
1791
- width: number;
1792
- height: number;
1793
- quality: number;
1794
- }
1795
- interface EditFileOptionsType {
1796
- canEdit: boolean;
1797
- canEditImage: boolean;
1798
- canEditName: boolean;
1799
- }
1800
- interface FileFormat {
1801
- src: string | null;
1802
- name: string;
1803
- type: string;
1804
- _id: string;
1805
- isLazy?: boolean;
1806
- size: number | null;
1807
- isUploading?: boolean;
1808
- uploaded?: number;
1809
- lastModified?: number;
1810
- }
1811
- type FileWithType = Pick<FileFormat, 'type'>;
1812
- type FileWithSrcNameType = Pick<FileFormat, 'src' | 'name' | 'type'>;
1813
- type FileWithSizeAndType = Pick<FileFormat, 'type' | 'size'>;
1814
- type ModalBooleans = {
1815
- canCropImage?: boolean;
1816
- canEditFile?: boolean;
1817
- confirmDelete?: boolean;
1818
- canEditFileName?: boolean;
1819
- };
1820
- interface FilePickerProps {
1821
- /** Ex: acceptFormat="'acceptFormat="video/*, .jpg" */
1822
- acceptFormat?: string;
1823
- onChange?: (image: File | null) => void;
1824
- compression?: CompressionType;
1825
- isUploading?: boolean;
1826
- uploaded?: number;
1827
- maxFileSize?: number;
1828
- value?: string | null;
1829
- loadWithSpinner?: boolean;
1830
- /** Will upon a popup modal for the user to click another button to triggr delte callback */
1831
- confirmDelete?: boolean;
1832
- editFileOptions?: EditFileOptionsType;
1833
- showProgress?: boolean;
1834
- }
1835
- interface FilePickerFieldProps extends Omit<FilePickerProps, 'onChange'> {
1836
- name: string;
1837
- label: string;
1838
- validate?: RegisterOptions;
1839
- isRequired?: boolean;
1840
- direction?: StackDirection;
1841
- onChange?: (File: string | null) => void;
1842
- }
1843
- interface MultiFilePickerFieldProps extends Omit<FilePickerFieldProps, 'onChange'> {
1844
- onChange?: (File: string[]) => void;
1845
- }
1846
- interface MultiFilePickerProps<T extends FileFormat> extends Omit<FilePickerProps, 'onChange'> {
1847
- onChange?: (files: File[]) => void;
1848
- compression?: CompressionType;
1849
- files?: T[] | null;
1850
- uploadingFiles?: T[];
1851
- deleteFile?: ((file: T | FileFormat) => void) | null;
1852
- enablePreLoad?: boolean;
1853
- enableSmartLoad?: boolean;
1854
- confirmDelete?: boolean;
1855
- }
1856
- interface MultiFileUploaderProps<T extends FileFormat> {
1857
- /** Ex: acceptFormat="'acceptFormat="video/*, .jpg" */
1858
- acceptFormat?: string;
1859
- compression?: CompressionType;
1860
- maxFileSize?: number;
1861
- /** Callback Will immediately return file objects before compressed */
1862
- addFilesToQueue?: (files: T[]) => void;
1863
- updatePreviewFiles?: (files: any[]) => void;
1864
- onChange?: (files: File[]) => void;
1865
- }
1866
- interface MultiFileListProps<T extends FileFormat> {
1867
- files?: T[];
1868
- uploadingFiles?: T[];
1869
- deleteFile?: (file: T | FileFormat) => void;
1870
- onChange?: (files: File[]) => void;
1871
- addFile?: (file: File, id: string) => void;
1872
- enableSmartLoad?: boolean;
1873
- editFileOptions?: EditFileOptionsType;
1874
- confirmDelete?: boolean;
1875
- }
1876
- interface FileItemProps<T> {
1877
- file: T | FileFormat;
1878
- deleteFile: (file: T | FileFormat) => void;
1879
- onChangeCallback: (files: File[]) => void;
1880
- addFile?: (file: File, id: string) => void;
1881
- isLazy?: boolean;
1882
- editFileOptions?: EditFileOptionsType;
1883
- confirmDelete?: boolean;
1884
- }
1885
- interface ConfirmDeleteModalProps extends Omit<ModalProps, 'children'> {
1886
- confirmDelete: () => void;
1887
- fileName: string;
1888
- }
1889
- interface FileEditorModalProps extends Omit<ModalProps, 'children'> {
1890
- fileName: string;
1891
- canEditFileName?: boolean;
1892
- canCropImage?: boolean;
1893
- isImage: boolean;
1894
- handleCrop: () => void;
1895
- image: File | string | null;
1896
- setFileName: (value: string) => void;
1897
- }
1898
- interface FileIconButtonProps extends Omit<IconButtonProps$1, 'icon' | 'ButtonVariants'> {
1899
- icon: ComponentType<any>;
1900
- variant?: ButtonVariants;
1901
- }
1902
-
1903
- /**
1904
- * Lets user import file of any type as Javascript File Object
1905
- * @see MultiFilePicker
1906
- * @see {@link https://northlight.dev/reference/file-picker}
1907
- *
1908
- * @example (Example)
1909
- * (?
1910
- * <FilePicker />
1911
- * ?)
1912
- *
1913
- *
1914
- */
1915
- declare const FilePicker: ({ acceptFormat, onChange, compression, uploaded: uploadedInitial, maxFileSize, showProgress, value, loadWithSpinner, confirmDelete, editFileOptions, }: FilePickerProps) => JSX.Element;
1916
-
1917
- /**
1918
- * The file picker component wrapped in a <Field />
1919
- * meant to be used only inside <Form />
1920
- * @see FilePicker
1921
- * @see Field
1922
- * @see {@link https://northlight.dev/reference/file-picker-field}
1923
- *
1924
- * @example (Example)
1925
- * ## Meant for uploading images in a form
1926
- * Where they handled as base64 string
1927
- * (?
1928
- * <Form initialValues={{image: ''}}>
1929
- * {({watch}) => (
1930
- * <Stack>
1931
- * <FilePickerField name="image" />
1932
- * <Code maxH="xs" overflowY="scroll">{JSON.stringify(watch(), null, 2)}</Code>
1933
- * </Stack>
1934
- * )}
1935
- * </Form>
1936
- *
1937
- * ?)
1938
- *
1939
- */
1940
- declare const FilePickerField: ({ name, label, direction, isRequired, validate, onChange: onChangeCallback, ...rest }: FilePickerFieldProps) => JSX.Element;
1941
-
1942
- /**
1943
- * Input to upload multiple files without ui to render files
1944
- * @see MultiFilePicker
1945
- * @see {@link https://northlight.dev/reference/multi-file-uploader}
1946
- * @example
1947
- * (?
1948
- * () => {
1949
- * const [ images, setImages ] = useState([])
1950
- * return (
1951
- * <Stack>
1952
- <Box h="sm">
1953
- <Carousel>
1954
- { images.map((imageSrc) => (
1955
- <Image src={imageSrc} borderRadius="st.border.radius.md" />
1956
- )) }
1957
- </Carousel>
1958
- </Box>
1959
- <MultiFileUploader
1960
- acceptFormat="image/*"
1961
- onChange={ (newFiles) =>
1962
- setImages(
1963
- newFiles.map((file) => URL.createObjectURL(file))
1964
- )
1965
- }
1966
- />
1967
- </Stack>
1968
- * )
1969
- * }
1970
- * ?)
1971
- *
1972
- */
1973
- declare function MultiFileUploader<T extends FileFormat>({ acceptFormat, compression, onChange, addFilesToQueue, updatePreviewFiles, maxFileSize, }: MultiFileUploaderProps<T>): JSX.Element;
1974
-
1975
- /**
1976
- * Lets user import file of any type as Javascript File Object
1977
- * @see FilePicker
1978
- * @see {@link https://northlight.dev/reference/multi-file-picker}
1979
- *
1980
- * @example (Example)
1981
- * (?
1982
- * <MultiFilePicker />
1983
- * ?)
1984
- * ## For more information, view: <a href="https://northlight.dev/components/file%20picker">guide</a>
1985
- *
1986
- *
1987
- */
1988
- declare function MultiFilePicker<T extends FileFormat>({ acceptFormat, compression, onChange, files, uploadingFiles, deleteFile, confirmDelete, maxFileSize, enablePreLoad, enableSmartLoad, editFileOptions, }: MultiFilePickerProps<T>): JSX.Element;
1989
-
1990
- /**
1991
- * Show list of files, their uploading progress as well as options to edit/delete them
1992
- * @see MultiFileUploader
1993
- * @see MultiFilePicker
1994
- * @see {@link https://northlight.dev/multi-file-list}
1995
- *
1996
- */
1997
- declare function MultiFileList<T extends FileFormat>({ files, uploadingFiles, onChange, deleteFile, addFile, confirmDelete, editFileOptions, enableSmartLoad, }: MultiFileListProps<T>): JSX.Element;
1998
-
1999
- /**
2000
- * The multi file picker component wrapped in a <Field />
2001
- * meant to be used only inside <Form />
2002
- * @see MultiFilePicker
2003
- * @see Field
2004
- * @see {@link https://northlight.dev/reference/multi-file-picker-field}
2005
- *
2006
- * @example (Example)
2007
- * ## Meant for uploading images in a form
2008
- * Where they handled as base64 strings
2009
- * (?
2010
- * <Form initialValues={{images: []}}>
2011
- * {({watch}) => (
2012
- * <Stack>
2013
- * <MultiFilePickerField name="images" />
2014
- * <Code maxH="xs" overflowY="scroll">{JSON.stringify(watch(), null, 2)}</Code>
2015
- * </Stack>
2016
- * )}
2017
- * </Form>
2018
- *
2019
- * ?)
2020
- *
2021
- */
2022
- declare const MultiFilePickerField: ({ name, label, direction, isRequired, validate, onChange: onChangeCallback, ...rest }: MultiFilePickerFieldProps) => JSX.Element;
2023
-
2024
- interface OverflowGroupProps {
2025
- childrenProps?: Record<string, any>;
2026
- max?: number;
2027
- children: JSX.Element[] | React__default.ReactNode[];
2028
- onChange?: (nbrRemainingChildren: number) => void;
2029
- /** Should be used together with the userOverflowGroup hook to fit by parent element */
2030
- rect?: HTMLElement | null;
2031
- }
2032
-
2033
- /**
2034
- * Util wrapper for lists by only rendering as many items as fit per the specification
2035
- * @see {@link https://northlight.dev/reference/overflow-group}
2036
- * @example
2037
- * (?
2038
- * +
2039
- *
2040
- const CustomSlider = ({ onChange }) => (
2041
- <Slider min={ 100 } max={ 300 } step={ 1 } onChange={ onChange }>
2042
- <SliderTrack>
2043
- <SliderFilledTrack />
2044
- </SliderTrack>
2045
- <SliderThumb />
2046
- </Slider>
2047
- )
2048
- *
2049
-
2050
- const arrayWithLength = (n) => {
2051
- let buffer = []
2052
- for(let i = 0; i < n; i++) {
2053
- buffer.push(i)
2054
- }
2055
- return buffer
2056
- }
2057
- * const MyComponent = () => {
2058
- * const [ n, setN ] = useState(5)
2059
- const [ max, setMax ] = useState(10)
2060
- const [ width, setWidth ] = useState(200)
2061
- const [ height, setHeight ] = useState(200)
2062
- const { containerRef, rect } = useOverflowGroup()
2063
- const [ nbrRemainingItems, setNbrRemainingItems ] = useState(0)
2064
- * return (
2065
- * <Stack mb={ 4 } spacing={ 4 } w="40%">
2066
- <Stack h="300px">
2067
- <Wrap
2068
- w={ width }
2069
- h={ height }
2070
- ref={ containerRef }
2071
- borderWidth="2px"
2072
- borderColor="gray.200"
2073
- borderStyle="solid"
2074
- p="2"
2075
- borderRadius="md"
2076
- >
2077
- <OverflowGroup
2078
- max={ max }
2079
- rect={ rect }
2080
- onChange={ setNbrRemainingItems }
2081
- >
2082
- { arrayWithLength(n).map((i) => (
2083
- <Badge key={ i } h="max-content">
2084
- Item { i }
2085
- </Badge>
2086
- )) }
2087
- </OverflowGroup>
2088
- { nbrRemainingItems > 0 && (
2089
- <Tag w="fit-content">+{ nbrRemainingItems }</Tag>
2090
- ) }
2091
- </Wrap>
2092
- </Stack>
2093
- <Stack bgColor="gray.50" p="2" borderRadius="md">
2094
- <HStack>
2095
- <Label>Height</Label>
2096
- <CustomSlider onChange={ setHeight } />
2097
- </HStack>
2098
- <HStack>
2099
- <Label>Width</Label>
2100
- <CustomSlider onChange={ setWidth } />
2101
- </HStack>
2102
- <HStack>
2103
- <Label>Number of items </Label>
2104
- <NumberInput onChange={ (v) => setN(Number(v)) } value={ n } />
2105
- </HStack>
2106
- <HStack>
2107
- <Label>Render max </Label>
2108
- <NumberInput onChange={ (v) => setMax(Number(v)) } value={ max } />
2109
- </HStack>
2110
- </Stack>
2111
- </Stack>
2112
- * )}
2113
- render(<MyComponent/>)
2114
- * ?)
2115
- <br />
2116
- The overflow group requires either a max prop for a set limit, or a rect prop,
2117
- for a dynamic, responsive layouts. The rect prop can be received via the useOverflowGroup hook,
2118
- along with a containerRef that needs to be set on the wrapper around the overflow group.
2119
- <br />
2120
- <br />
2121
- The overflow group is ambiguous in the styling of the children and does not pose any premade layout;
2122
- instead the wrapper parent container determines the layout.
2123
- One could for example use a <Stack /> <HStack /> or <Grid> and all would work.
2124
- The overflow group only checks if the children don't fit within the height/width
2125
- of it's container via the containerRef.
2126
-
2127
- *
2128
- */
2129
- declare const OverflowGroup: ({ children, max: initMax, childrenProps, onChange, rect, }: OverflowGroupProps) => JSX.Element;
2130
-
2131
- declare const useOverflowGroup: () => {
2132
- rect: HTMLDivElement | null;
2133
- containerRef: (node: any) => void;
2134
- };
2135
-
2136
- declare const getContrastColor: (color: string) => "text.default" | "text.inverted";
2137
-
2138
- declare const luminosity: (hexcolor: string) => number;
2139
-
2140
- declare const ring: CSSObject;
2141
-
2142
- declare const highlight: CSSObject;
2143
-
2144
- declare const getShades: (startShade: number, endShade?: number) => string[];
2145
-
2146
- declare const getInitials: (name: string) => string;
2147
-
2148
- type UseFormReturn<T extends FieldValues> = UseFormReturn$1<T>;
2149
- type Maybe<T> = T | undefined;
2150
- type CustomSubmitHandler<TFieldValues extends FieldValues> = (data: TFieldValues, event: UseFormReturn<TFieldValues>) => any | Promise<any>;
2151
- type SetValueOptionsType = Maybe<SetValueConfig>;
2152
- interface FieldProps<FormValues extends FieldValues = FieldValues, FieldName extends FieldPath<FormValues> = FieldPath<FormValues>> extends Omit<StackProps, 'children'> {
2153
- name: FieldName;
2154
- /** Label displayed as text beside or under/over
2155
- * (depending on direction prop) over children. Recommended for accesibility */
2156
- label?: string;
2157
- /** The input and label will be rendered inside a stack,
2158
- * this determines whether to put the label above/below/left/right of the input */
2159
- direction?: StackDirection;
2160
- isRequired?: boolean;
2161
- /** In rare cases the htmlFor attribute can mess up the markup,
2162
- * if this prop is true then htmlFor on the label will be undefined */
2163
- noLabelConnection?: boolean;
2164
- /** Inline validation, in most cases validation should be handled in the form component itself,
2165
- * but you can pass down simple validation like
2166
- * validate={{maxLength: {message: 'Max 40 characters', value: 40}}}
2167
- * for more information view https://react-hook-form.com/api/useform/register/ docs. (Whatever you put into the validate object will be put as the second options arguments on the react hook form register method)
2168
- * */
2169
- validate?: RegisterOptions;
2170
- /**
2171
- * The value is taken from the formContext by default,
2172
- * but may be manually specified to ensure field type inference.
2173
- * */
2174
- control?: Control<FormValues>;
2175
- children: (field: ControllerRenderProps<FormValues, FieldName>, methods: UseFormReturn<FormValues>) => JSX.Element;
2176
- }
2177
- interface FormProps<FormValues extends FieldValues> {
2178
- /** This should contain an object with the name of the fields and their default values. */
2179
- initialValues: FormValues;
2180
- /** This prop will reset the form if the initial values change */
2181
- enableReinitialize?: boolean;
2182
- onSubmit: CustomSubmitHandler<FormValues>;
2183
- /** You can define your own form methods outside of the form component using the useForm hook and passing down via methods prop: https://react-hook-form.com/api/useform/ */
2184
- methods?: UseFormReturn<FormValues>;
2185
- /** Every option that can be passed to useForm hook kan be passed here,
2186
- * for example formSettings={{mode: 'onChange'}}
2187
- * (will trigger validation function on every change in form state */
2188
- formSettings?: UseFormProps<FormValues>;
2189
- /** A functtion that takes in the current form values, and returns an object,
2190
- * where the keys are the name of the fields and the values are object
2191
- * with a message key of what error occured.
2192
- * ex: validate ={(formValues) => {
2193
- * let errors = {}
2194
- * if(formValues.name === 'DROP TABLE;') {
2195
- * errors.name = {message: 'Nice try'}
2196
- * }
2197
- * return errors
2198
- * }}
2199
- * */
2200
- validate?: any;
2201
- /** This will recursively trim all values strings inside the form values,
2202
- * no matter how nesteed they are */
2203
- shouldTrim?: boolean;
2204
- children: ((methods: UseFormReturn<FormValues>) => ReactNode) | ReactNode;
2205
- innerFormStyle?: any;
2206
- }
2207
- type FieldErrorType<T extends FieldValues> = FieldError | Merge<FieldError, FieldErrorsImpl<T>> | undefined;
2208
-
2209
- declare function getFieldError<T extends FieldValues>(name: string, errors: FieldErrorsImpl<T>): FieldErrorType<T>;
2210
-
2211
- declare const getChildrenWithProps: (children: React__default.ReactNode | React__default.ReactNode[], styles: Record<string, any>, predicate?: (child: React__default.ReactNode, index: number) => boolean) => (string | number | boolean | React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | React__default.ReactFragment | null | undefined)[];
2212
-
2213
- declare const addAlpha: (color: string, alpha?: number) => string;
2214
-
2215
- /** A debounce function to be used together with Async select in SearchBar.
2216
- * The reason to why the usual debounce hook does not work is because we
2217
- * don't control the loadOptions call ourselves.
2218
- *
2219
- * Important to note is that the timeout here needs to NOT be reinstantiated
2220
- * every render, otherwise it defeats the purpose as a new timeout will be
2221
- * created every time the component re-renders.
2222
- */
2223
- declare const createDebounceFunctionInstance: (delay: number) => (fn: any) => (...args: any) => void;
2224
-
2225
- type CurrentTheme = 'webappTheme' | 'tottTheme';
2226
- declare const CustomTheme: React$1.Context<CurrentTheme>;
2227
- declare const useCurrentTheme: () => CurrentTheme;
2228
-
2229
- interface MediatoolThemeProviderProps {
2230
- children: ReactNode;
2231
- theme?: Record<string, any>;
2232
- themeName?: CurrentTheme;
2233
- }
2234
-
2235
- /**
2236
- * Should be at the root of you project, wraps the app in the theme context
2237
- * @see {@link https://northlight.dev/reference/mediatool-theme-provider}
2238
- *
2239
- * @example
2240
- * Should pass down a theme from northlight/ui, currently exports two themes:
2241
- * * theme - light mode
2242
- * * tottTheme - dark mode
2243
- *
2244
- *
2245
- */
2246
- declare const MediatoolThemeProvider: ({ children, theme, themeName, }: MediatoolThemeProviderProps) => JSX.Element;
2247
-
2248
- type NumberInputSizeProps = 'sm' | 'md' | 'lg';
2249
- interface NumberInputProps extends NumberInputProps$1 {
2250
- size?: NumberInputSizeProps;
2251
- onChange?: (...event: any[]) => void;
2252
- onlyAcceptPercentage?: boolean;
2253
- onInputChange?: (input: string) => void;
2254
- /** If true it will show arrows on far right of number input that when clicked can
2255
- * increment and decrement the number value.
2256
- */
2257
- enableStepperArrows?: boolean;
2258
- }
2259
- type NumberInputFieldProps = Omit<NumberInputProps, 'onChange'> & InputFieldProps & {
2260
- name: string;
2261
- label: string;
2262
- validate?: RegisterOptions;
2263
- size?: NumberInputSizeProps;
2264
- isRequired?: boolean;
2265
- unit?: string;
2266
- direction?: StackDirection;
2267
- onChange?: (e: number | string) => void;
2268
- inputLeftElement?: React.ReactNode;
2269
- inputRightElement?: React.ReactNode;
2270
- };
2271
- interface NumberInputStepperProps {
2272
- includePercentage?: boolean;
2273
- }
2274
-
2275
- /**
2276
- * Basic accessible input that only allows numbers, with support for arrow keys,
2277
- * min max values and percentages
2278
- *
2279
- * @example
2280
- * (?
2281
- * <Box p="3">
2282
- * <NumberInput max={100} min={0} step={3} onlyAcceptPercentage={true} enableStepperArrows={true}/>
2283
- * </Box>
2284
- * ?)
2285
- *
2286
- */
2287
- declare const NumberInput: ({ variant, size, onChange, onInputChange, enableStepperArrows, name, onlyAcceptPercentage, ...rest }: NumberInputProps) => JSX.Element;
2288
-
2289
- /**
2290
- * The number input component wrapped in a <Field />
2291
- * meant to be used only inside <Form />
2292
- * @see NumberInput
2293
- * @see {@link https://northlight.dev/reference/number-input-field}
2294
- *
2295
- */
2296
- declare const NumberInputField: ({ name, label, direction, isRequired, validate, onChange: onChangeCallback, onlyAcceptPercentage, inputLeftElement, inputRightElement, ...rest }: NumberInputFieldProps) => JSX.Element;
2297
-
2298
- declare const advancedParseFloat: (value: number | string) => string | number;
2299
-
2300
- interface NotificationIconButtonProps extends IconButtonProps$1 {
2301
- variant?: ButtonVariants;
2302
- blinkerColor?: string;
2303
- hasNotification?: boolean;
2304
- }
2305
-
2306
- /**
2307
- * A custom component that composes the IconButton and Blinker components.
2308
- * The notification blinker blinks on hover.
2309
- * @see {@link https://northlight.dev/reference/notification-icon-button}
2310
- *
2311
- * @example
2312
- * (?
2313
- * <Box w="min-content">
2314
- <NotificationIconButton
2315
- variant="brand"
2316
- aria-label="conversations"
2317
- icon={ <Icon as={ ConversationDuo } /> }
2318
- hasNotification={ true }
2319
- size="lg"
2320
- />
2321
- </Box>
2322
- * ?)
2323
- */
2324
- declare const NotificationIconButton: (props: NotificationIconButtonProps & React__default.RefAttributes<unknown>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
2325
-
2326
- type PinVariant = 'green' | 'yellow' | 'gray' | 'red';
2327
- type PinSize = 'sm' | 'md' | 'lg';
2328
- type PinSizeTuple = [number, number];
2329
- interface PinInputProps extends PinInputProps$1 {
2330
- size?: PinSize;
2331
- hidden?: boolean;
2332
- }
2333
-
2334
- /**
2335
- * For entering numbers in ex two factor authentication
2336
- * @see {@link https://northlight.dev/reference/pin-input}
2337
- * @example
2338
- * (?
2339
- <HStack p="1">
2340
- <PinInput>
2341
- <PinInputField />
2342
- <PinInputField />
2343
- <PinInputField />
2344
- <PinInputField />
2345
- </PinInput>
2346
- </HStack>
2347
- * ?)
2348
- *
2349
- *
2350
- */
2351
- declare const PinInput: ({ variant, hidden, children, ...rest }: PinInputProps) => JSX.Element;
2352
-
2353
- interface ProgressBarProps extends StackProps {
2354
- loaded: number;
2355
- /** Whether to remove the progress bar from the DOM tree once finnished loading */
2356
- hideDisplay?: boolean;
2357
- onLoadEnd?: () => void;
2358
- }
2359
-
2360
- /**
2361
- * @see {@link https:/northlight/reference/progress-bar}
2362
- *
2363
- * @example
2364
- * (?
2365
- * () => {
2366
- const [ progress, setProgress ] = useState(0)
2367
- if (progress > 1 && buffer) {
2368
- clearInterval(buffer)
2369
- buffer = null
2370
- }
2371
-
2372
- const handleClick = () => {
2373
- setProgress(0)
2374
- buffer = setInterval(
2375
- () => setProgress((prev) => prev + Math.random() * 0.1),
2376
- Math.random() * 300 + 200
2377
- )
2378
- }
2379
- return (
2380
- <Stack>
2381
- <ProgressBar loaded={ progress } hideDisplay={true}/>
2382
- <Button onClick={ handleClick }>Start Loading</Button>
2383
- </Stack>
2384
- )
2385
- * }
2386
- * ?)
2387
- *
2388
- */
2389
- declare const ProgressBar: ({ loaded, onLoadEnd, hideDisplay, ...rest }: ProgressBarProps) => JSX.Element;
2390
-
2391
- type RadioProps = RadioProps$1 & {
2392
- onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
2393
- value?: string;
2394
- };
2395
- type RadioFieldProps = RadioProps$1 & {
2396
- value: string;
2397
- };
2398
- type RadioGroupProps = RadioGroupProps$1 & {
2399
- direction?: StackDirection;
2400
- };
2401
- type RadioFieldGroupProps = RadioGroupProps$1 & {
2402
- direction?: StackDirection;
2403
- name: string;
2404
- label: string;
2405
- validate?: RegisterOptions;
2406
- isRequired?: boolean;
2407
- value?: string;
2408
- };
2409
-
2410
- /**
2411
- * @see RadioGroup
2412
- * @see {@link https://northlight.dev/reference/radio}
2413
- */
2414
- declare const Radio: ({ size, onChange, name, value, ...rest }: RadioProps) => JSX.Element;
2415
-
2416
- /**
2417
- * Wrapper to select one of multiple options
2418
- * @see {@link https://northlight.dev/reference/radio-group}
2419
- * @example
2420
- * (?
2421
- <RadioGroup>
2422
- <HStack>
2423
- <Radio value="1" />
2424
- <Radio value="2" />
2425
- <Radio value="3" />
2426
- </HStack>
2427
- </RadioGroup>
2428
- * ?)
2429
- *
2430
- */
2431
- declare const RadioGroup: ({ direction, children, name, ...rest }: RadioGroupProps) => JSX.Element;
2432
-
2433
- /**
2434
- * The radio group component wrapped in a <Field />
2435
- * meant to be used only inside <Form />
2436
- * @see RadioGroup
2437
- * @see Radio
2438
- * @see {@link https://northlight.dev/reference/radio-group-field}
2439
- *
2440
- */
2441
- declare const RadioGroupField: ({ name, label, children, direction, isRequired, validate, onChange: onChangeCallback, ...rest }: RadioFieldGroupProps) => JSX.Element;
2442
-
2443
- type Size = 'sm' | 'md' | 'lg';
2444
- interface Option {
2445
- label: string;
2446
- value: string;
2447
- }
2448
- interface SelectProps<T, K extends boolean> extends Omit<Props<T, K, GroupBase<T>>, 'onChange' | 'value' | 'isMulti'> {
2449
- /** Whatever is currently selected by the select will be controlled by value prop */
2450
- value?: Option | Option[];
2451
- /** Take a look at the second argument, the event,
2452
- * for info as to which specific element was added */
2453
- onChange?: (option: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
2454
- onAdd?: (val: unknown) => void;
2455
- onRemove?: (val: unknown) => void;
2456
- /** Used for accessibility */
2457
- name?: string;
2458
- size?: Size;
2459
- 'data-testid'?: string;
2460
- loadingList?: ComponentType<MenuListProps<T, K, GroupBase<T>>> | undefined;
2461
- /** Custom icon that will be put to the faremost right of the component */
2462
- icon?: ComponentType<any>;
2463
- /** Custom icon that will be put to the faremost left of the component */
2464
- leftIcon?: ComponentType<any>;
2465
- customOption?: ((option: T) => JSX.Element) | null;
2466
- isMulti?: K;
2467
- ref?: Ref<SelectInstance<T, K, GroupBase<T>>>;
2468
- }
2469
- type SelectFieldProps<T, K extends boolean = false> = SelectProps<T, K> & Omit<InputFieldProps, 'isMulti'> & {
2470
- direction?: StackDirection;
2471
- name: string;
2472
- label: string;
2473
- validate?: RegisterOptions;
2474
- isRequired?: boolean;
2475
- };
2476
-
2477
- /**
2478
- * Select component that provides a customizable and accessible select input.
2479
- * It is built on top of Chakra UI and Chakra React Select components.
2480
- *
2481
- * @see SearchBar
2482
- * @see {@link https://northlight.dev/reference/select}
2483
- *
2484
- * @example (Example)
2485
- * ## Single Select
2486
- * (?
2487
- * <Select
2488
- * options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
2489
- * onChange={(value, action) => console.log('Selected:', value)}
2490
- * />
2491
- * ?)
2492
- *
2493
- * @example (Example)
2494
- * ## Clearable Select
2495
- * (?
2496
- * <Select
2497
- * options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
2498
- * onChange={(value, action) => console.log('Selected:', value)}
2499
- * isClearable={ true }
2500
- * />
2501
- * ?)
2502
- *
2503
- * @example (Example)
2504
- * ## Multi select
2505
- * (?
2506
- * <Select
2507
- * options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
2508
- * onChange={(value, action) => console.log('Selected:', value)}
2509
- * isMulti
2510
- * />
2511
- * ?)
2512
- *
2513
- * @example (Example)
2514
- * ## Event meta
2515
- * _There is a second argument passed to the handlechange that can be useful
2516
- * for knowing which elements where adding/removed_
2517
- * (?
2518
- * () => {
2519
- * const handleChange = (val, e) => {
2520
- switch (e.action) {
2521
- case 'select-option':
2522
- //on add value
2523
- console.log(e.option)
2524
- break
2525
- case 'pop-value':
2526
- //on remove value
2527
- console.log(e.removedValue.categoryKey)
2528
- break
2529
- default:
2530
- break
2531
- }
2532
- }
2533
- * return <Select onChange={handleChange} options={[{label: '1', value: '1'}]} isMulti={true}/>
2534
- *
2535
- * }
2536
- * ?)
2537
- *
2538
- * @example (Example)
2539
- * ##Customizing
2540
- * There are two special props for easy customization
2541
- * * customOption
2542
- * * customTag
2543
- *
2544
- * This are themselves react components
2545
- * (?
2546
- +const customOption = ({ label }) => (
2547
- <HStack>
2548
- <Avatar name={label} />
2549
- <P>{label}</P>
2550
- </HStack>
2551
- );
2552
-
2553
- const customTag = ({ label }) => {
2554
- const [ isIncluded, setIsIncluded ] = useState(true)
2555
- const toggle = () => setIsIncluded((prev) => !prev)
2556
-
2557
- return (
2558
- <Flex>
2559
- <Button
2560
- size="xs"
2561
- onClick={ toggle }
2562
- onMouseDown={ (e) => e.stopPropagation() }
2563
- >
2564
- { isIncluded ? 'Include' : 'Exclude' }
2565
- </Button>
2566
- <Tag>{ label }</Tag>
2567
- </Flex>
2568
- )
2569
- }
2570
-
2571
- const CustomSelect = () => (
2572
- <Select
2573
- customOption={customOption}
2574
- customTag={ customTag }
2575
- isMulti={true}
2576
- options={[
2577
- { label: 'Option 1', value: '1' },
2578
- { label: 'Option 2', value: '2' },
2579
- ]}
2580
-
2581
- />
2582
- );
2583
-
2584
- render(<CustomSelect />);
2585
- *
2586
- * ?)
2587
- *
2588
- *
2589
- * @example (Example)
2590
- * ## Testing
2591
- * You can grab the test id for the select by
2592
- * **screen.getByTestId('custom-testid)
2593
- * .children[0].children[2].children[0].children[1].children[0]**
2594
- * (?
2595
- * <Select
2596
- * data-testid="custom-test-id"
2597
- * />
2598
- * ?)
2599
- */
2600
- declare const Select: <T extends Option, K extends boolean = false>(props: SelectProps<T, K> & React__default.RefAttributes<SelectInstance<T, K, GroupBase<T>>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
2601
-
2602
- 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;
2603
-
2604
- type SpinnerProps = SpinnerProps$1;
2605
-
2606
- /**
2607
- * Loading indicator
2608
- * @see {@link https://northlight.dev/reference/spinner }
2609
- * @example
2610
- * (? <Spinner /> ?)
2611
- */
2612
- declare const Spinner: ({ ...rest }: SpinnerProps) => JSX.Element;
2613
-
2614
- type SwitchProps = SwitchProps$1 & {
2615
- onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
2616
- value?: boolean;
2617
- };
2618
- type SwitchFieldProps = SwitchProps$1 & {
2619
- name: string;
2620
- label: string;
2621
- validate?: RegisterOptions;
2622
- isRequired?: boolean;
2623
- direction?: StackDirection;
2624
- labelPosition?: 'left' | 'right';
2625
- };
2626
-
2627
- /**
2628
- * @see SwitchField
2629
- * @see {@link https://northlight.dev/reference/switch}
2630
- *
2631
- * @example (Example)
2632
- * Mainly used for forms, however this component is controlled by
2633
- * a value prop and an onChange callback
2634
- *
2635
- * (?
2636
- * () => {
2637
- * const [ advancedMode, setAdvancedMode ] = useState(false)
2638
- *
2639
- * return (
2640
- * <Stack p="2">
2641
- * <Label size="sm" htmlFor="advanced-mode-switch">Advanced mode</Label>
2642
- * <Switch name="vegan-checkbox" onChange={() => setAdvancedMode((prev) => !prev)}
2643
- * value={advancedMode} />
2644
- * </Stack>
2645
- * )
2646
- * }
2647
- * ?)
2648
- */
2649
- declare const Switch: ({ value, onChange, name, size, ...rest }: SwitchProps) => JSX.Element;
2650
-
2651
- /**
2652
- * The switch component wrapped in a <Field />
2653
- * meant to be used only inside <Form />
2654
- * @see switch
2655
- * @see {@link https://northlight.dev/reference/switch-field}
2656
- * @example (Example)
2657
- * ## Basic
2658
- * (?
2659
- * <Form initialValues={{name: ''}}>
2660
- * <SwitchField
2661
- * name="terms"
2662
- * label="I agree to the Terms & Conditions"
2663
- * labelPosition="left"
2664
- * />
2665
- * </Form>
2666
- * ?)
2667
- *
2668
- */
2669
- declare const SwitchField: ({ name, label, isRequired, validate, onChange: onChangeCallback, direction, labelPosition, ...rest }: SwitchFieldProps) => JSX.Element;
2670
-
2671
- interface TableProps extends Omit<TableProps$1, 'variant'> {
2672
- variant?: TableProps$1['variant'] | 'rounded';
2673
- }
2674
-
2675
- /**
2676
- * @see {@link https://northlight.dev/reference/table}
2677
- *
2678
- * @example
2679
- * (?
2680
- <Table variant="rounded">
2681
- <Thead>
2682
- <Tr>
2683
- <Th fontWeight="bold"> Number</Th>
2684
- <Th fontWeight="bold"> Title</Th>
2685
- </Tr>
2686
- </Thead>
2687
- <Tbody>
2688
- { [1, 2, 3, 4, 5].map((num) => (
2689
- <Tr key={ num }>
2690
- <Td>{ num }</Td>
2691
- <Td>
2692
- This is great Typography man
2693
- </Td>
2694
- </Tr>
2695
- )) }
2696
- </Tbody>
2697
- </Table>
2698
- * ?)
2699
- *
2700
- */
2701
- declare const Table: (props: TableProps) => JSX.Element;
2702
-
2703
- interface TabsProps extends TabsProps$1 {
2704
- }
2705
- interface TabPanelProps extends TabPanelProps$1 {
2706
- }
2707
-
2708
- /**
2709
- * Used to display content under tabs context
2710
- * @see Tabs
2711
- * @see {@link https://northlight.dev/reference/tab-panel}
2712
- * @example
2713
- * (? <TabPanel>Tab 1</TabPanel> ?)
2714
- */
2715
- declare const TabPanel: (props: TabPanelProps) => JSX.Element;
2716
-
2717
- /**
2718
- * Context provider for tabs tabs
2719
- * @see TabList
2720
- * @see TabPanels
2721
- * @see {@link https://northlight.dev/reference/tabs}
2722
- * @example
2723
- * (?
2724
- <Tabs>
2725
- <Stack spacing="2">
2726
- <TabList>
2727
- <Tab>One</Tab>
2728
- <Tab>Two</Tab>
2729
- <Tab>Three</Tab>
2730
- </TabList>
2731
- <TabPanels>
2732
- <TabPanel>
2733
- <P>one!</P>
2734
- </TabPanel>
2735
- <TabPanel>
2736
- <P>two!</P>
2737
- </TabPanel>
2738
- <TabPanel>
2739
- <P>three!</P>
2740
- </TabPanel>
2741
- </TabPanels>
2742
- </Stack>
2743
- </Tabs>
2744
- * ?)
2745
- *
2746
- */
2747
- declare const Tabs: ({ children, variant, isManual, ...rest }: TabsProps) => JSX.Element;
2748
-
2749
- interface TagProps extends TagProps$1 {
2750
- bgColor?: string;
2751
- variant?: 'solid' | 'subtle';
2752
- }
2753
- interface OverflowIndicatorProps {
2754
- nbrRemainingTags: number;
2755
- }
2756
- interface TagGroupProps extends StackProps {
2757
- max?: number;
2758
- spacing?: number | string;
2759
- children: JSX.Element[] | React.ReactNode[];
2760
- OverflowIndicator?: (props: OverflowIndicatorProps) => JSX.Element;
2761
- }
2762
-
2763
- /**
2764
- * @see TagGroup
2765
- * @see {@link https://northlight.dev/reference/tag}
2766
- *
2767
- * @example
2768
- * (? <Tag>Brand 1</Tag> ?)
2769
- *
2770
- * @example
2771
- * (?
2772
- * <Tag>
2773
- <TagLeftIcon>
2774
- <Icon as={ StackSolid } />
2775
- </TagLeftIcon>
2776
- <TagLabel>Left Icon</TagLabel>
2777
- </Tag>
2778
- * ?)
2779
- *
2780
- */
2781
- declare const Tag: (props: TagProps & React__default.RefAttributes<unknown>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
2782
-
2783
- /**
2784
- * Used when rending multiple tags in limited container for responsive layout
2785
- * @see Tag
2786
- * @see {@link https://northlight.dev/reference/tag-group}
2787
- *
2788
- * @example
2789
- * ##Try resizing the window!
2790
- * (?
2791
- <TagGroup w="full"
2792
- borderWidth="st.border.width.sm"
2793
- borderColor="border.default"
2794
- borderStyle="solid"
2795
- p="2"
2796
- borderRadius="md"
2797
- >
2798
- { Array.from({length: 20}, (_, i) => i).map((i) => (
2799
- <Tag w="max-content" key={ i }>Brand-{ i }</Tag>
2800
- )) }
2801
- </TagGroup>
2802
- * ?)
2803
- *
2804
- *
2805
- */
2806
- declare const TagGroup: ({ children, max, spacing, OverflowIndicator, ...rest }: TagGroupProps) => JSX.Element;
2807
-
2808
- type TextSizeProps = 'sm' | 'md';
2809
- interface TextareaProps extends TextareaProps$1 {
2810
- onChange?: (...event: any[]) => void | ((e: ChangeEvent<HTMLInputElement>) => void);
2811
- value?: string;
2812
- size?: TextSizeProps;
2813
- }
2814
- type TextareaFieldProps = TextareaProps$1 & {
2815
- name: string;
2816
- label: string;
2817
- validate?: RegisterOptions;
2818
- isRequired?: boolean;
2819
- size?: TextSizeProps;
2820
- direction?: StackDirection;
2821
- };
2822
-
2823
- /**
2824
- * Text input for larger raw text
2825
- * @see Input
2826
- * @see {@link https://northlight.dev/reference/textarea}
2827
- *
2828
- * @example
2829
- * (? <Textarea /> ?)
2830
- */
2831
- declare const Textarea: ({ size, onChange, name, value, ...rest }: TextareaProps) => JSX.Element;
2832
-
2833
- declare const TextareaField: ({ name, label, isRequired, validate, direction, onChange: onChangeCallback, ...rest }: TextareaFieldProps) => JSX.Element;
2834
-
2835
- interface TextInputFormatter {
2836
- format: (value: string) => string;
2837
- unFormat: (value: string) => string;
2838
- }
2839
- interface TextFieldProps extends Omit<InputProps, 'onChange'>, InputFieldProps {
2840
- name: string;
2841
- label: string;
2842
- mask?: string;
2843
- formatter?: TextInputFormatter;
2844
- validate?: RegisterOptions;
2845
- direction?: StackDirection;
2846
- onChange?: (e: React.ChangeEvent<HTMLInputElement> | string) => void;
2847
- }
2848
- type MaskedTextInputProps = InputProps & Props$1 & {
2849
- maskPlaceholder?: string;
2850
- };
2851
- type FormattedNumberInputPreset = 'eu' | 'us' | 'nor';
2852
- interface PresetOptions {
2853
- thousandSeparator: string;
2854
- decimalSeparator: string;
2855
- }
2856
- interface FormattedNumberInputProps extends Omit<NumericFormatProps, 'onChange' | 'max' | 'min'> {
2857
- max?: number;
2858
- min?: number;
2859
- /** Changes thousand and decimal separators */
2860
- preset?: FormattedNumberInputPreset;
2861
- /** Gives you back an object, see https://s-yadav.github.io/react-number-format/docs/quirks */
2862
- onChange?: NumericFormatProps['onValueChange'];
2863
- /** Will format number UI as percentage, but return as decimal value */
2864
- isPercentage?: boolean;
2865
- /** Will round up and restrict number of decimals */
2866
- numberOfDecimals?: number;
2867
- }
2868
- interface FormattedNumberInputFieldProps extends FormattedNumberInputProps {
2869
- name: string;
2870
- label: string;
2871
- validate?: RegisterOptions;
2872
- isRequired?: boolean;
2873
- direction?: StackDirection;
2874
- }
2875
-
2876
- /**
2877
- * @see {@link https://northlight.dev/reference/formatted-number-input-field}
2878
- @example (Example)
2879
- * The formatted number input is built uppon react-number-format
2880
- * It formats numbers by adjusting thousand and decimal separators
2881
- * ex : 22345351.34234 => 222 453 51,34234
2882
- * It comes with three presets: eu, us and nor.
2883
- * These have the following separators:
2884
- (?
2885
- <FormattedNumberInput
2886
- preset="us"
2887
- onChange={(values) => console.log(values.floatValue)}
2888
- isPercentage={true}
2889
- max={1E9}
2890
- min={0}
2891
- />
2892
- ?)
2893
-
2894
- @example (Example)
2895
- ### Nor preset
2896
- (?
2897
- <FormattedNumberInput
2898
- preset="nor"
2899
- onChange={(values) => console.log(values.floatValue)}
2900
- value={320341345102.34134}
2901
- numberOfDecimals={5}
2902
- />
2903
- ?)
2904
-
2905
- @example (Example)
2906
- ### Eu preset
2907
- (?
2908
- <FormattedNumberInput
2909
- preset="eu"
2910
- onChange={(values) => console.log(values.floatValue)}
2911
- value={320341345102.34134}
2912
- numberOfDecimals={5}
2913
- />
2914
- ?)
2915
-
2916
- */
2917
- declare const FormattedNumberInput: ({ preset, isPercentage, onChange, value, numberOfDecimals, max, min, ...rest }: FormattedNumberInputProps) => JSX.Element;
2918
-
2919
- /**
2920
- * The formatted number input component wrapped in a <Field />
2921
- * meant to be used only inside <Form />
2922
- * @see FormattedNumberInput
2923
- * @see {@link https://northlight.dev/reference/formatted-number-input-field}
2924
- * @example (Example)
2925
- * (?
2926
- * <Form initialValues={{money: ''}}>
2927
- * <FormattedNumberInputField
2928
- * name="money"
2929
- * label="How much money is currently on your account"
2930
- * labelPosition="left"
2931
- * />
2932
- * </Form>
2933
- * ?)
2934
- *
2935
- */
2936
- declare const FormattedNumberInputField: ({ name, label, isRequired, validate, onChange: onChangeCallback, direction, ...rest }: FormattedNumberInputFieldProps) => JSX.Element;
2937
-
2938
- declare const MaskedTextInput: ({ mask, maskPlaceholder, alwaysShowMask, name, value, placeholder, onChange, onBlur, ...rest }: MaskedTextInputProps) => JSX.Element;
2939
-
2940
- /**
2941
- * The Input component wrapped in <Field />
2942
- * Also supported formmated and musked input via as prop
2943
- * @see Input
2944
- * @see MaskedTextInput
2945
- * @see FormattedNumberInput
2946
- * @see {@link https://northlight.dev/reference/text-field}
2947
- *
2948
- *
2949
- */
2950
- declare const TextField: ({ name, label, as: As, isRequired, validate, direction, onChange: onChangeCallback, inputLeftElement, inputRightElement, ...rest }: TextFieldProps) => JSX.Element;
2951
-
2952
- interface ToastProps extends AlertProps {
2953
- title?: string;
2954
- variant?: AlertVariants;
2955
- description?: string;
2956
- onClose?: () => void;
2957
- }
2958
- interface UseToastOptions extends UseToastOptions$1 {
2959
- variant?: AlertVariants;
2960
- title?: string;
2961
- description?: string;
2962
- }
2963
-
2964
- /**
2965
- * Toast is a modified alert meant for popup alerts
2966
- * @see useToast
2967
- * @see Alert
2968
- * @see {@link https://northlight.dev/reference/toast}
2969
- * @example
2970
- * (?
2971
- *
2972
- <HStack spacing={ 4 }>
2973
- <Toast variant="success" title="success" />
2974
- <Toast variant="warning" title="warning" />
2975
- <Toast variant="info" title="info" />
2976
- <Toast variant="error" title="error" />
2977
- </HStack>
2978
- * ?)
2979
- *
2980
- */
2981
- declare const Toast: ({ variant, title, description, onClose, ...rest }: ToastProps) => JSX.Element;
2982
-
2983
- /**
2984
- * This hook returns a toast function that when called will popup a toast
2985
- * @see Toast
2986
- * @see {@link https://northlight.dev/reference/use-toast}
2987
- * @example
2988
- * (?
2989
- * () => {
2990
- * const toast = useToast()
2991
- * const handleClick = () => {
2992
- * toast({title: 'Success', description: 'Your file changes have been saved' })
2993
- * }
2994
- * return (
2995
- * <Button onClick={handleClick} variant="success">Save</Button>
2996
- * )}
2997
- * ?)
2998
- */
2999
- declare const useToast: (defaultOpts?: UseToastOptions) => (opts?: UseToastOptions) => _chakra_ui_toast_dist_toast_types_24f022fd.a;
3000
-
3001
- type DurationType = number | null;
3002
- type OffsetType = number | string;
3003
- type ChildrenType = React.ReactNode | React.ReactNode[];
3004
- type TransitionDirection = 'right' | 'bottom' | 'left' | 'top' | null;
3005
- /** For fade component */
3006
- interface FadeProps extends FadeProps$1 {
3007
- /** Sets both enterDuration and exitDuration at same time to same value */
3008
- duration?: DurationType;
3009
- enterDuration?: DurationType;
3010
- exitDuration?: DurationType;
3011
- /** Makes the element not focusable when not visible */
3012
- disableFocus?: boolean;
3013
- /** Will remove the component from DOM tree if in is false */
3014
- hideDisplay?: boolean;
3015
- enterDelay?: number;
3016
- exitDelay?: number;
3017
- onTransitionComplete?: (isHidden: boolean) => void;
3018
- }
3019
- interface ScaleFadeProps extends FadeProps, Omit<ScaleFadeProps$1, 'delay'> {
3020
- }
3021
- interface SlideProps extends FadeProps, Omit<SlideProps$1, 'delay'> {
3022
- }
3023
- interface SlideFadeProps extends FadeProps, Omit<SlideFadeProps$1, 'delay'> {
3024
- direction?: TransitionDirection;
3025
- offset?: number;
3026
- }
3027
- interface CollapseProps extends FadeProps, Omit<CollapseProps$1, 'delay'> {
3028
- }
3029
-
3030
- /**
3031
- * Simple transition to hide/show content
3032
- * @see ScaleFade
3033
- * @see SlideFade
3034
- * @see {@link https://northlight.dev/reference/fade}
3035
- *
3036
- * @example (Example)
3037
- * ##View other options
3038
- * (?
3039
- *
3040
- () => {
3041
- const [ show, setShow ] = useState(false)
3042
- const toggle = () => {
3043
- setShow((prev) => !prev)
3044
-
3045
- }
3046
- return (
3047
- <>
3048
- <Button onClick={toggle}>Render random number</Button>
3049
- <Box borderRadius="st.border.radius.sm"
3050
- borderWidth="st.border.width.sm" borderColor="border.default">
3051
- <Fade in={ show} exitDuration={1}>
3052
- <HStack p="10" bg="bg.filled" rounded="md" >
3053
- <H3>
3054
- {Math.round(Math.random() * 100)}
3055
- </H3>
3056
- </HStack>
3057
- </Fade>
3058
- </Box>
3059
- </>
3060
-
3061
- )
3062
-
3063
- }
3064
-
3065
- * ?)
3066
- *
3067
- */
3068
- declare const Fade: ({ children, enterDuration, exitDuration, duration, in: show, disableFocus, hideDisplay, enterDelay, exitDelay, onTransitionComplete, ...rest }: FadeProps) => JSX.Element;
3069
-
3070
- /**
3071
- * Simple transition to hide/show content
3072
- * @see Fade
3073
- * @see SlideFade
3074
- * @see {@link https://northlight.dev/reference/slide-fade}
3075
- *
3076
- * @example (Example)
3077
- * ##View other options
3078
- * (?
3079
- *
3080
- () => {
3081
- const [ show, setShow ] = useState(false)
3082
- const toggle = () => {
3083
- setShow((prev) => !prev)
3084
-
3085
- }
3086
- return (
3087
- <>
3088
- <Button onClick={toggle}>Render random number</Button>
3089
- <Box borderRadius="st.border.radius.sm"
3090
- borderWidth="st.border.width.sm" borderColor="border.default">
3091
- <SlideFade in={ show} exitDuration={1}>
3092
- <HStack p="10" bg="bg.filled" rounded="md" >
3093
- <H3>
3094
- {Math.round(Math.random() * 100)}
3095
- </H3>
3096
- </HStack>
3097
- </SlideFade>
3098
- </Box>
3099
- </>
3100
- )
3101
- }
3102
- * ?)
3103
- *
3104
- */
3105
- declare const ScaleFade: ({ children, enterDuration, exitDuration, duration, in: show, disableFocus, hideDisplay, enterDelay, exitDelay, onTransitionComplete, ...rest }: ScaleFadeProps) => JSX.Element;
3106
-
3107
- declare const Slide: ({ children, enterDuration, exitDuration, duration, in: show, disableFocus, hideDisplay, enterDelay, exitDelay, direction, onTransitionComplete, ...rest }: SlideProps) => JSX.Element;
3108
-
3109
- declare const SlideFade: ({ children, enterDuration, exitDuration, duration, in: show, disableFocus, hideDisplay, direction, offset: delta, offsetX: deltaX, offsetY: deltaY, enterDelay, exitDelay, onTransitionComplete, ...rest }: SlideFadeProps) => JSX.Element;
3110
-
3111
- /**
3112
- * Simple transition to hide/show content
3113
- * @see Fade
3114
- * @see ScaleFade
3115
- * @see SlideFade
3116
- * @see {@link https://northlight.dev/reference/collapse}
3117
- *
3118
- * @example (Example)
3119
- * ##View other options
3120
- * (?
3121
- *
3122
- () => {
3123
- const [ show, setShow ] = useState(false)
3124
- const toggle = () => {
3125
- setShow((prev) => !prev)
3126
-
3127
- }
3128
- return (
3129
- <>
3130
- <Button onClick={toggle}>Click Me</Button>
3131
- <Box borderRadius="st.border.radius.sm"
3132
- borderWidth="st.border.width.sm" borderColor="border.default">
3133
- <Collapse in={ show}>
3134
- <HStack p="10" bg="bg.filled" rounded="md" >
3135
- <P>
3136
- Enable advanced mode
3137
- </P>
3138
-
3139
- <Switch />
3140
- </HStack>
3141
- </Collapse>
3142
- </Box>
3143
- </>
3144
-
3145
- )
3146
-
3147
- }
3148
-
3149
- * ?)
3150
-
3151
- *
3152
- */
3153
- declare const Collapse: ({ children, enterDuration, exitDuration, duration, in: show, disableFocus, hideDisplay, enterDelay, exitDelay, onTransitionComplete, ...rest }: CollapseProps) => JSX.Element;
3154
-
3155
- interface StatusPinProps {
3156
- size?: PinSize;
3157
- variant: PinVariant;
3158
- }
3159
-
3160
- /**
3161
- * @see StatusBlock
3162
- * @see {@link https://northlight/reference/status-pin}
3163
- *
3164
- * @example
3165
- * (? <StatusPin variant="green" /> ?)
3166
- *
3167
- */
3168
- declare const StatusPin: ({ size, variant }: StatusPinProps) => JSX.Element;
3169
-
3170
- type BlockVariant = 'working' | 'pending' | 'approved' | 'rejected';
3171
- interface StatusBlockProps {
3172
- variant: BlockVariant;
3173
- }
3174
- type BlockVariantColorTuple = [`${Color}.${ColorGrade}`, `${Color}.${ColorGrade}`];
3175
- declare const statusIconMap: Record<BlockVariant, any>;
3176
-
3177
- /**
3178
- * Used as status indicator
3179
- * @see {@link https://northlight.dev/reference/status-block}
3180
- * @example
3181
- * (? <StatusBlock variant="approved" /> ?)
3182
- */
3183
- declare const StatusBlock: ({ variant }: StatusBlockProps) => JSX.Element;
3184
-
3185
- interface AsyncErrorProps extends AlertProps {
3186
- message?: string;
3187
- }
3188
-
3189
- /**
3190
- * @see {@link https://northlight.dev/reference/async-error}
3191
- * @example
3192
- * (?
3193
- * <AsyncError />
3194
- * ?)
3195
- *
3196
- */
3197
- declare const AsyncError: ({ message, ...rest }: AsyncErrorProps) => JSX.Element;
3198
-
3199
- /**
3200
- * @see {@link https://northlight.dev/reference/modal}
3201
- *
3202
- * */
3203
- declare const ModalBase: ({ isCentered, children, ...rest }: ModalProps) => JSX.Element;
3204
- declare const Modal: ({ stayMountedOnClose, isOpen, ...rest }: ModalProps) => JSX.Element;
3205
-
3206
- /**
3207
- * The context provider for handling state of components wrapped in field
3208
- * @see Field
3209
- * @see {@link https://northlight.dev/reference/form}
3210
- *
3211
- * @example (Example)
3212
- * ## Basic
3213
- * (?
3214
- * <Form initialValues={{name: ''}} onSubmit={console.log}>
3215
- * <TextField name="name" label="What is your name" />
3216
- * </Form>
3217
- * ?)
3218
- *
3219
- * @example (Example)
3220
- * ## With form methods
3221
- * The form context provider passes down a lot of methods for handling state
3222
- * (?
3223
- * <Form initialValues={{name: ''}}>
3224
- * {({watch, reset }) => (
3225
- * <Stack>
3226
- * <TextField name="name" label="What is your name?"/>
3227
- * <Button variant="danger" onClick={() => reset({})}>Reset</Button>
3228
- * <Code>{JSON.stringify(watch(), null, 2)}</Code>
3229
- * </Stack>
3230
- * )}
3231
- *
3232
- * </Form>
3233
- * ?)
3234
- * You can view more form methods on the **<a href="https://react-hook-form.com/api/useform/" target="_blank">react hook form docs</a>**
3235
- * (everything that the useForm hooks returns)
3236
- *
3237
- * @example (Example)
3238
- * ## Moving the form state outside of Form
3239
- * (?
3240
- * +
3241
-
3242
- //This code could live in the backend
3243
- const submitValuesToBackend = (values) => {
3244
- console.log({values})
3245
- if(values.firstName !== 'Steve') {
3246
- throw Error('We only allow people named Steve \;\)')
3247
- }
3248
- }
3249
- const MyForm = () => (
3250
- <Form
3251
- initialValues={ { firstName: '' } }
3252
- onSubmit={ async (values, methods) => {
3253
- try {
3254
- await submitValuesToBackend(values)
3255
- }
3256
- catch (err) {
3257
- methods.setError('firstName', { message: err.message })
3258
- }
3259
- } }
3260
- >
3261
- <HStack alignItems="end" p="3">
3262
- <TextField
3263
- name="firstName"
3264
- label="First Name"
3265
- isRequired={ true }
3266
- />
3267
- <Button type="submit" variant="success">Validate</Button>
3268
- </HStack>
3269
- </Form>
3270
-
3271
- )
3272
-
3273
- render(<MyForm />)
3274
-
3275
- * ?)
3276
-
3277
- @example (Example)
3278
- ## Using a ref
3279
- You can move up the form state using a ref as well
3280
- (?
3281
- () => {
3282
- const methods = useRef(null)
3283
-
3284
- return (
3285
- <Stack>
3286
- <Form
3287
- ref={methods}
3288
- initialValues={{name: ''}}
3289
- >
3290
- <TextField name="name" label="What is your name?" />
3291
- </Form>
3292
- <Button onClick={() => methods.current.reset({name: (Math.round(Math.random() * 100))})}>
3293
- Get random number
3294
- </Button>
3295
- </Stack>
3296
-
3297
- )
3298
-
3299
- }
3300
- ?)
3301
-
3302
- */
3303
- declare const Form: <FormValues extends FieldValues>(props: FormProps<FormValues> & React__default.RefAttributes<UseFormReturn$1<FormValues>>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
3304
-
3305
- /**
3306
- * Wraps children under form context
3307
- * @see TextField
3308
- * @see Form
3309
- * @see {@link https://northlight.dev/reference/field}
3310
- *
3311
- * @example (Example)
3312
- * ## Input example
3313
- * (?
3314
- * <Form initialValues={{name: ''}}>
3315
- * <Box p="2">
3316
- * <Field name="name" label="Input name">
3317
- * {({value, onChange}) => (
3318
- * <Input value={value} onChange={onChange} />
3319
- * )}
3320
- * </Field>
3321
- * </Box>
3322
- *
3323
- * </Form>
3324
- * ?)
3325
- * <br />
3326
- * As you can see the field component acts as a middleman to connect
3327
- * any component to the form context, via a controlled value and onChange prop.
3328
- * Most of the common use cases for field,
3329
- * such as text input have been abstracted into their own components, for example _TextField_
3330
- *
3331
- * @example (Example)
3332
- * ## Example with validation and form submition
3333
- * (?
3334
- * () => {
3335
- * const toast = useToast()
3336
- * const handleSubmit =(v) => {
3337
- * toast({title: 'Sent Message', description: `"${v.message}"`})
3338
- * }
3339
- * return (
3340
- * <Form initialValues={{message: ''}} onSubmit={handleSubmit}>
3341
- * <Stack p="2">
3342
- * <Field
3343
- * name="message"
3344
- * label="Write email"
3345
- * isRequired={true}
3346
- * validate={{maxLength: {message: 'Message must be under 30 characters', value: 30}}}
3347
- * >
3348
- * {({value, onChange}) => (
3349
- * <Textarea value={value} onChange={onChange} />
3350
- * )}
3351
- * </Field>
3352
- * <Button type="submit" variant="brand">Send Message</Button>
3353
- * </Stack>
3354
- *
3355
- * </Form>
3356
- * )
3357
- * }
3358
- * ?)
3359
- *
3360
- * @example (Example)
3361
- * ## Type-safety
3362
- * There are multiple ways to provide types for
3363
- * the field callback values. To ensure that each
3364
- * component within the field receives the correct
3365
- * value, it's essential to make the field aware
3366
- * of the form state values. When the Field component
3367
- * does not receive any types, the "value" callback
3368
- * argument will have the type of "any".
3369
- * <br /><br />
3370
- * ### Passing down the control prop (Recommended)
3371
- * (?
3372
- * <Form initialValues={{username: 'Alex'}}>
3373
- * {
3374
- * ({ control }) => {
3375
- * <Box p="2">
3376
- * <Field name="username" label="Input name" control={ control }>
3377
- * {({value, onChange}) => ( // "value" has type of "string"
3378
- * <Input value={value} onChange={onChange} />
3379
- * )}
3380
- * </Field>
3381
- * </Box>
3382
- * }
3383
- * }
3384
- * </Form>
3385
- * ?)
3386
- * <br /><br />
3387
- * ### Specifying generic arguments
3388
- * You can also specify generic arguments on the Field
3389
- * component to ensure that "value" has a valid type.
3390
- * The passed generic type combined with the valid
3391
- * "name" property ensures that "value" has the expected
3392
- * type received from the generic type:
3393
- * `<Field<MyFormBody> name="username">...</Field>`
3394
- */
3395
- declare function Field<FormValues extends FieldValues = FieldValues, FieldName extends FieldPath<FormValues> = FieldPath<FormValues>>({ name, label, children, direction, isRequired, noLabelConnection, validate, control: passedControl, ...rest }: FieldProps<FormValues, FieldName>): JSX.Element;
3396
-
3397
- declare const useSetValueRefreshed: () => (name: any, value: any, options: SetValueOptionsType) => void;
3398
-
3399
- declare const trimFormValues: <T extends FieldValues>(obj: FieldValues) => T;
3400
-
3401
- type StepListProps = TabListProps;
3402
- interface StepPanelProps extends TabPanelProps$1 {
3403
- }
3404
- type StepsProps = TabsProps$1;
3405
- interface StepProps extends TabProps {
3406
- label: string;
3407
- description?: string;
3408
- }
3409
-
3410
- /**
3411
- * Used to display content under specific step
3412
- * @see Steps
3413
- * @see StepPanels
3414
- * @see {@link https://northlight.dev/reference/step-panel}
3415
- * @example
3416
- * (? <StepPanel>Step 1</StepPanel> ?)
3417
- */
3418
- declare const StepPanel: (props: StepPanelProps) => JSX.Element;
3419
-
3420
- /**
3421
- * Context provider for steps tabs
3422
- * @see StepList
3423
- * @see StepPanels
3424
- * @see {@link https://northlight.dev/reference/steps}
3425
- * @example
3426
- * (?
3427
- <Steps>
3428
- <StepList>
3429
- <Step label="Step 1" description="Name and email" />
3430
- <Step label="Step 2" description="Pick a password" />
3431
- <Step label="Step 3" description="Review" />
3432
- </StepList>
3433
- <StepPanels>
3434
- <StepPanel>1</StepPanel>
3435
- <StepPanel>2</StepPanel>
3436
- <StepPanel>3</StepPanel>
3437
- </StepPanels>
3438
- </Steps>
3439
- * ?)
3440
- *
3441
- *
3442
- */
3443
- declare const Steps: (props: StepsProps) => JSX.Element;
3444
-
3445
- /**
3446
- * Renders a step in a step list
3447
- * @see StepList
3448
- * @see Steps
3449
- * @see {@link https://northlight.dev/reference/step}
3450
- * @example
3451
- * (? <Step label="Step 1" description="Personal information" /> ?)
3452
- *
3453
- */
3454
- declare const Step: ({ label, description, ...rest }: StepProps) => JSX.Element;
3455
-
3456
- /**
3457
- * Used to render a navigational list of steps
3458
- * @see Step
3459
- * @see Steps
3460
- * @see {@link https://northlight.dev/reference/step-list}
3461
- * @example
3462
- * (?
3463
- <StepList>
3464
- <Step label="Step 1" description="Name and email" />
3465
- <Step label="Step 2" description="Pick a password" />
3466
- <Step label="Step 3" description="Review" />
3467
- </StepList>
3468
- * ?)
3469
- *
3470
- */
3471
- declare const StepList: ({ children, ...rest }: StepListProps) => JSX.Element;
3472
-
3473
- interface ClipboardInputProps extends InputProps {
3474
- value: string;
3475
- size?: 'sm' | 'md' | 'lg';
3476
- }
3477
-
3478
- /**
3479
- * Meant to display non editable copiable text
3480
- * @see {@link https://northlight.dev/reference/clipboard-input}
3481
- *
3482
- * @example (Example)
3483
- * ## Your token
3484
- * (?
3485
- * <ClipboardInput value="8aa6d075-eae2-49b3-8f65-318ece801b3b" aria-label="Copy token" />
3486
- * ?)
3487
- *
3488
- */
3489
- declare const ClipboardInput: ({ size, value, "aria-label": ariaLabel, ...rest }: ClipboardInputProps) => JSX.Element;
3490
-
3491
- interface ClickableProps extends UseClickableProps {
3492
- href?: string;
3493
- linkProps?: LinkProps;
3494
- }
3495
-
3496
- /**
3497
- * Wrapper component to make children interactive
3498
- * by taking care of focus/accessibility, will render
3499
- * either a link or button depending on if passing
3500
- * an href
3501
- * @see {@link https://northlight.dev/reference/clickable}
3502
- * @example (Example)
3503
- * ### Click to send notification
3504
- * (?
3505
- * () => {
3506
- * const [ count, setCount ] = useState(0)
3507
- * return (
3508
- * <Clickable onClick={ () => setCount((prev) => prev + 1) }>
3509
- <Avatar name="anakin skywalker" variant="rounded" notificationCount={count}/>
3510
- </Clickable>
3511
- * )
3512
- * }
3513
- * ?)
3514
- * @example (Example)
3515
- * ### Rendering a link if passing href
3516
- * (?
3517
- <Clickable href="/reference/select">
3518
- <Center boxSize="3xs" bgColor="gray.50">
3519
- Link
3520
- </Center>
3521
- </Clickable>
3522
- * ?)
3523
- *
3524
- */
3525
- declare const Clickable: ({ href, linkProps, ...rest }: ClickableProps) => JSX.Element;
3526
-
3527
- interface SplitPaneProps extends GridProps {
3528
- isOpen: boolean;
3529
- children: ReactElement[];
3530
- initialSplit?: number;
3531
- minLeftWidth?: number;
3532
- minRightWidth?: number;
3533
- }
3534
-
3535
- /**
3536
- * Used for split screen layouts
3537
- * @see PaneItem
3538
- * @see PaneDivider
3539
- * @see {@link https://northlight.dev/reference/split-pane}
3540
- *
3541
- */
3542
- declare const SplitPane: ({ children, initialSplit, isOpen, minLeftWidth, minRightWidth, }: SplitPaneProps) => JSX.Element;
3543
-
3544
- /**
3545
- * Wrapper around child of split pane
3546
- * @see SplitPane
3547
- * @see {@link https://northlight.dev/reference/PaneItem}
3548
- *
3549
- */
3550
- declare const PaneItem: ({ children, ...rest }: GridItemProps) => JSX.Element;
3551
-
3552
- /**
3553
- * Simple vertical line for split screen
3554
- * @see SplitPane
3555
- * @see PaneItem
3556
- * @see {@link https://northlight.dev/reference/pane-divider}
3557
- * @example
3558
- * (?
3559
- * <Box h="xs">
3560
- * <PaneDivider />
3561
- * </Box>
3562
- * ?)
3563
- * */
3564
- declare const PaneDivider: _chakra_ui_system_dist_system_types.ComponentWithAs<_chakra_ui_system_dist_system_types.As, BoxProps>;
3565
-
3566
- type EditableSizes = 'sm' | 'md' | 'lg';
3567
- interface EditableProps extends EditableProps$1 {
3568
- value?: string;
3569
- size?: EditableSizes;
3570
- leftItem?: ReactElement;
3571
- }
3572
- interface EditableControlsProps {
3573
- size: EditableSizes;
3574
- }
3575
-
3576
- /**
3577
- * Used to safely modify text with default or previousely set value
3578
- * @see {@link https://northlight.dev/reference/editable-text}
3579
- *
3580
- * @example (Example)
3581
- * ##Edit password
3582
- * (?
3583
- * () => {
3584
- * const [v, setV] = useState('123456789')
3585
- * return (
3586
- * <Box p="2">
3587
- * <EditableText value={v} onSubmit={setV} leftItem={<Icon as={LockDuo} />}/>
3588
- * </Box>
3589
- * )
3590
- * }
3591
- * ?)
3592
- *
3593
- * @example (Example)
3594
- * ## Other notes
3595
- <p>
3596
- Pressing <b>ESC</b> or clicking on the
3597
- <b> red icon</b> will delete the changes and go back to the original state
3598
- </p>
3599
- <p>
3600
- Pressing <b>ENTER</b> or clicking on the
3601
- <b> green icon</b> will save the changes internally and fire the{ ' ' }
3602
- <Code>onSubmit</Code> callback.
3603
- </p>
3604
- *
3605
- */
3606
- declare const EditableText: ({ size, value: inputValue, onSubmit, leftItem, ...rest }: EditableProps) => JSX.Element;
3607
-
3608
- interface StepStackProps extends StackProps {
3609
- children: ReactNode | ReactNode[];
3610
- rowHeight?: string;
3611
- /** The vertical alignment of the circles.
3612
- * Accepts any values that can be used with the alignItems CSS property.
3613
- * Defaults to "center".
3614
- */
3615
- stepCircleAlignment?: string;
3616
- }
3617
-
3618
- /**
3619
- Util wrapper for creating ordered vertical layouts by stack
3620
- @see {@link https://northlight.dev/reference/step-stack}
3621
- @example
3622
- The component takes all the props that a normal stack takes, with the addition of a
3623
- rowHeight prop, which is needed to get the correct height for the grey
3624
- line that goes between the steps. Any valid css height unit, px, rem, %,
3625
- and tokens xs, sm are valid input for the <Code>rowHeight</Code> prop,
3626
- for example, <Code>rowHeight="3rem"</Code>.
3627
- <br /><br />
3628
- ## Simple step stack
3629
- (?
3630
- <StepStack maxW="sm" spacing="4" rowHeight="10">
3631
- { Array.from({length: 5}, (_, i) => i).map((i) => <Input key={ i } />) }
3632
- </StepStack>
3633
- ?)
3634
- <br />
3635
- ## Example with flex-start stepCircleAlignment prop
3636
- (?
3637
- <StepStack maxW="sm" spacing="4" rowHeight="10" stepCircleAlignment="flex-start">
3638
- { Array.from({ length: 5 }, (_, i) => i).map((i) => (
3639
- <Center
3640
- key={ i }
3641
- width={ 400 }
3642
- height={ 100 }
3643
- borderRadius={ 10 }
3644
- backgroundColor="blue.500"
3645
- color="white"
3646
- >
3647
- <Text>Step { i + 1 }</Text>
3648
- </Center>
3649
- )) }
3650
- </StepStack>
3651
- ?)
3652
- */
3653
- declare const StepStack: ({ children, spacing, rowHeight, stepCircleAlignment, ...rest }: StepStackProps) => JSX.Element;
3654
-
3655
- declare const useDebounce: <T>(value: T, delay: number) => T;
3656
-
3657
- declare const useLoadingMessage: (prefix?: string, delay?: number) => string;
3658
-
3659
- interface Message {
3660
- content: string;
3661
- role: string;
3662
- type?: string;
3663
- data?: string;
3664
- }
3665
- declare const useScrollToBottom: (scrollView: RefObject<HTMLDivElement>, messages: Message[]) => void;
3666
-
3667
- declare const useArrowFocus: (columns: number) => {
3668
- defaultArrows: (e: any) => void;
3669
- focusPrevious: ({ repeat, wrap, }?: {
3670
- wrap: boolean;
3671
- repeat: number;
3672
- }) => void;
3673
- focusNext: ({ repeat, wrap, }?: {
3674
- wrap: boolean;
3675
- repeat: number;
3676
- }) => void;
3677
- focusFirst: (opts?: _react_aria_focus.FocusManagerOptions | undefined) => _react_types_shared.FocusableElement;
3678
- focusLast: (opts?: _react_aria_focus.FocusManagerOptions | undefined) => _react_types_shared.FocusableElement;
3679
- };
3680
-
3681
- interface UseSelectCallbacksProps<T, K extends boolean = false> extends Omit<Props<T, boolean, GroupBase<T>>, 'onChange' | 'value'> {
3682
- onChange: (option: K extends true ? MultiValue<T> : SingleValue<T>, event: ActionMeta<T>) => void;
3683
- onAdd: (val: unknown) => void;
3684
- onRemove: (val: unknown) => void;
3685
- isMulti?: boolean;
3686
- value: T | T[];
3687
- }
3688
- interface BasicOption {
3689
- label: string;
3690
- value: unknown;
3691
- }
3692
- type SelectActionMeta<T> = ActionMeta<T>;
3693
-
3694
- 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;
3695
-
3696
- declare const useOutsideRectClick: (ref: MutableRefObject<HTMLElement | null>, callback: (event: MouseEvent | TouchEvent) => void) => void;
3697
-
3698
- declare const useScreenSize: () => "sm" | "md" | "lg";
3699
-
3700
- declare const useDidUpdateEffect: (effect: EffectCallback, dependencies: DependencyList) => void;
3701
-
3702
- declare const theme: Record<string, any>;
3703
- declare const tottTheme: Record<string, any>;
3704
-
3705
- 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, 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, 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, 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, useDidUpdateEffect, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };