@northlight/ui 2.12.0 → 2.12.2

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