@northlight/ui 2.26.1 → 2.27.0

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.
@@ -121,6 +121,7 @@ type Size$1 = 'sm' | 'md' | 'lg';
121
121
  interface Option<T extends string = string> {
122
122
  label: string;
123
123
  value: T;
124
+ isCreation?: boolean;
124
125
  }
125
126
  interface SelectProps<T, K extends boolean> extends Omit<Props<T, K, GroupBase<T>>, 'onChange' | 'value' | 'isMulti'> {
126
127
  /** Whatever is currently selected by the select will be controlled by value prop, if value is
@@ -4022,13 +4023,16 @@ declare const PaneItem: ({ children, ...rest }: GridItemProps) => JSX.Element;
4022
4023
  declare const PaneDivider: _chakra_ui_system_dist_system_types.ComponentWithAs<_chakra_ui_system_dist_system_types.As, BoxProps>;
4023
4024
 
4024
4025
  type EditableSizes = 'sm' | 'md' | 'lg';
4026
+ type EditableVariant = 'brand' | 'default';
4025
4027
  interface EditableProps extends EditableProps$1 {
4026
4028
  value?: string;
4027
4029
  size?: EditableSizes;
4028
4030
  leftItem?: ReactElement;
4031
+ variant?: EditableVariant;
4029
4032
  }
4030
4033
  interface EditableControlsProps {
4031
4034
  size: EditableSizes;
4035
+ variant: EditableVariant;
4032
4036
  }
4033
4037
 
4034
4038
  /**
@@ -4061,7 +4065,7 @@ interface EditableControlsProps {
4061
4065
  </p>
4062
4066
  *
4063
4067
  */
4064
- declare const EditableText: ({ size, value: inputValue, onSubmit, leftItem, ...rest }: EditableProps) => JSX.Element;
4068
+ declare const EditableText: ({ size, value: inputValue, onSubmit, leftItem, variant, ...rest }: EditableProps) => JSX.Element;
4065
4069
 
4066
4070
  interface StepStackProps extends StackProps {
4067
4071
  children: ReactNode | ReactNode[];
@@ -4194,76 +4198,7 @@ interface CreatableSelectDropdownProps<T extends string = string> {
4194
4198
  menuPlacement?: 'top' | 'bottom' | 'auto';
4195
4199
  }
4196
4200
 
4197
- /**
4198
- * A dropdown component that allows users to select a value from given options
4199
- * or create a new one if it doesn't exist.
4200
- * @see {@link https://northlight.dev/reference/creatable-select-dropdown}
4201
- *
4202
- * @example (Example)
4203
- * (?
4204
- * () => {
4205
- * const [artist, setArtist] = useState(null);
4206
- * const [element, setElement] = useState({ label: 'Technique', value: 'technique' })
4207
- * const someOptions = [
4208
- * { label: 'Scooter', value: 'scooter' },
4209
- * { label: 'Snoop Doggy Dogg', value: 'snoop-dogg' },
4210
- * ];
4211
- *
4212
- * const someOtherOptions = [
4213
- * { label: 'Vision', value: 'vision' },
4214
- * { label: 'Technique', value: 'technique' },
4215
- * { label: 'Expression', value: 'expression' }
4216
- * ];
4217
- *
4218
- * return (
4219
- * <VStack gap={10} alignItems={"flex-start"}>
4220
- * <Box align="left">
4221
- * <H1>Basic example</H1>
4222
- * <H3>Select the best artist</H3>
4223
- * <CreatableSelectDropdown
4224
- * standardOptions={someOptions}
4225
- * onOptionChange={setArtist}
4226
- * width="300px"
4227
- * value={artist ? artist.value : undefined}
4228
- * />
4229
- * {artist && artist.value !== 'Add option...' && (
4230
- * <H3 py={8}>The best artist is: {artist.label}</H3>
4231
- * )}
4232
- * </Box>
4233
- * <Box align="left">
4234
- * <H1>Pre-selected option</H1>
4235
- * <H3>What is the quintessential element of an exceptional artisan?</H3>
4236
- * <CreatableSelectDropdown
4237
- * standardOptions={someOtherOptions}
4238
- * onOptionChange={setElement}
4239
- * width="300px"
4240
- * value={element ? element.value : undefined}
4241
- * />
4242
- * {element && element.value !== 'Add option...' && (
4243
- * <H3 py={8}>
4244
- * {element.value === 'vision' && (
4245
- * 'The artist\'s vision shapes their creative world.'
4246
- * )}
4247
- * {element.value === 'technique' && (
4248
- * 'Technique is the legacy\'s bedrock.'
4249
- * )}
4250
- * {element.value === 'expression' && (
4251
- * 'Expression communicates the artist\'s inner voice.'
4252
- * )}
4253
- * {element.value !== 'vision' &&
4254
- * element.value !== 'technique' &&
4255
- * element.value !== 'expression' && (
4256
- * 'Absent the selection of legitimate alternatives.'
4257
- * )}
4258
- * </H3>
4259
- * )}
4260
- * </Box>
4261
- * </VStack>
4262
- * );
4263
- * }
4264
- * ?)
4265
- */
4266
- declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, width, variant, defaultValue, value, menuPlacement, }: CreatableSelectDropdownProps<T>) => JSX.Element;
4201
+ declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, variant, defaultValue, value, menuPlacement, }: CreatableSelectDropdownProps<T>) => JSX.Element;
4267
4202
 
4268
4203
  declare const useDebounce: <T>(value: T, delay: number) => T;
4269
4204
 
@@ -4329,4 +4264,4 @@ declare const useResizeWidth: ({ stationaryEdge, minWidthPx, maxWidthPx, default
4329
4264
  declare const theme: Record<string, any>;
4330
4265
  declare const tottTheme: Record<string, any>;
4331
4266
 
4332
- 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, CreatableSelectDropdown, CurrentTheme, CustomContainerPropsType, CustomElementType, CustomFlipButtonProps, CustomFlipButtonPropsType, CustomTheme, DatePicker, DatePickerField, DatePickerFieldProps, DatePickerProps, DateRange, DateRangePicker, DateRangePickerField, DateRangePickerFieldProps, DateRangePickerProps, DragAndDrop, DragHandle, DragHandleProps, DragItem, DragItemProps, Draggable, DraggableProps, DropZone, DropZoneProps, Droppable, DroppableProps, DurationType, EditableControlsProps, EditableProps, EditableSizes, EditableText, Fade, FadeProps, FastGrid, FastGridProps, FastList, FastListProps, Field, FieldErrorType, FieldProps, FileEditorModalProps, FileFormat, FileIconButtonProps, FileItemProps, FilePicker, FilePickerField, FilePickerFieldProps, FilePickerProps, FileWithSizeAndType, FileWithSrcNameType, FileWithType, FlipButton, FlipButtonGroup, FlipButtonGroupField, FlipButtonGroupFieldProps, FlipButtonGroupProps, FlipButtonProps, Form, FormBody, FormLabel, FormLabelProps, FormProps, FormattedNumberInput, FormattedNumberInputField, FormattedNumberInputFieldProps, FormattedNumberInputPreset, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, IntentButton, Label, LabelProps, LabelSizes, LabelType, Lead, ListenersType, LoadingBar, MaskedTextInput, MaskedTextInputProps, MediatoolThemeProvider, MediatoolThemeProviderProps, Menu, MenuProps, MenuVariants, Message, Modal, ModalBase, ModalBody, ModalBooleans, ModalProps, ModalSizes, MultiFileList, MultiFileListProps, MultiFilePicker, MultiFilePickerField, MultiFilePickerFieldProps, MultiFilePickerProps, MultiFileUploader, MultiFileUploaderProps, MultiItemType, MultiSort, MultiSortProps, NotificationIconButton, NotificationIconButtonProps, NumVal, NumValType, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, Popover, PresetOptions, ProgressBar, ProgressBarProps, Radio, RadioFieldGroupProps, RadioFieldProps, RadioGroup, RadioGroupField, RadioGroupProps, RadioProps, ResizeHandle, 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, Tooltip, TransitionDirection, UseFormReturn, UseSelectCallbacksProps, UseToastOptions, addAlpha, advancedParseFloat, clamp, createDebounceFunctionInstance, getChildrenWithProps, getContrastColor, getFieldError, getInitials, getMatchingValue, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useDidUpdateEffect, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useResizeWidth, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
4267
+ 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, CreatableSelectDropdown, 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, EditableVariant, Fade, FadeProps, FastGrid, FastGridProps, FastList, FastListProps, Field, FieldErrorType, FieldProps, FileEditorModalProps, FileFormat, FileIconButtonProps, FileItemProps, FilePicker, FilePickerField, FilePickerFieldProps, FilePickerProps, FileWithSizeAndType, FileWithSrcNameType, FileWithType, FlipButton, FlipButtonGroup, FlipButtonGroupField, FlipButtonGroupFieldProps, FlipButtonGroupProps, FlipButtonProps, Form, FormBody, FormLabel, FormLabelProps, FormProps, FormattedNumberInput, FormattedNumberInputField, FormattedNumberInputFieldProps, FormattedNumberInputPreset, FormattedNumberInputProps, H1, H2, H3, H4, H5, H6, HeadingProps, HeadingType, Icon, IconButton, IconButtonProps, IconProps, InputFieldProps, IntentButton, Label, LabelProps, LabelSizes, LabelType, Lead, ListenersType, LoadingBar, MaskedTextInput, MaskedTextInputProps, MediatoolThemeProvider, MediatoolThemeProviderProps, Menu, MenuProps, MenuVariants, Message, Modal, ModalBase, ModalBody, ModalBooleans, ModalProps, ModalSizes, MultiFileList, MultiFileListProps, MultiFilePicker, MultiFilePickerField, MultiFilePickerFieldProps, MultiFilePickerProps, MultiFileUploader, MultiFileUploaderProps, MultiItemType, MultiSort, MultiSortProps, NotificationIconButton, NotificationIconButtonProps, NumVal, NumValType, NumberInput, NumberInputField, NumberInputFieldProps, NumberInputProps, NumberInputSizeProps, NumberInputStepperProps, OffsetType, Option, OrganizationLogo, OrganizationLogoProps, OverflowGroup, OverflowGroupProps, OverflowIndicatorProps, P, PProps, PaneDivider, PaneItem, PinInput, PinInputProps, PinSize, PinSizeTuple, PinVariant, Popover, PresetOptions, ProgressBar, ProgressBarProps, Radio, RadioFieldGroupProps, RadioFieldProps, RadioGroup, RadioGroupField, RadioGroupProps, RadioProps, ResizeHandle, 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, Tooltip, TransitionDirection, UseFormReturn, UseSelectCallbacksProps, UseToastOptions, addAlpha, advancedParseFloat, clamp, createDebounceFunctionInstance, getChildrenWithProps, getContrastColor, getFieldError, getInitials, getMatchingValue, getShades, highlight, luminosity, ring, statusIconMap, theme, tottTheme, trimFormValues, useArrowFocus, useCurrentTheme, useDebounce, useDidUpdateEffect, useLoadingMessage, useOutsideRectClick, useOverflowGroup, useResizeWidth, useScreenSize, useScrollToBottom, useSelectCallbacks, useSetValueRefreshed, useToast };
@@ -1,4 +1,4 @@
1
- import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useInterval, useMediaQuery, useToken as useToken$1, Box, useMultiStyleConfig, chakra, Alert as Alert$2, AspectRatio as AspectRatio$1, forwardRef, useStyleConfig, Icon as Icon$2, Heading, Text, FormLabel as FormLabel$1, VisuallyHidden, HStack, Badge as Badge$2, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, Flex, IconButton as IconButton$1, Popover as Popover$2, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, keyframes, extendTheme, Table as Table$2, Thead, Tbody, Tr, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Portal, Tooltip as Tooltip$2, VStack, Circle, Center, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, CloseButton as CloseButton$1, Radio as Radio$2, RadioGroup as RadioGroup$1, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, Editable, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalBody as ModalBody$1, ModalHeader, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, Progress, Image as Image$1, ChakraProvider, Menu as Menu$2, NumberInputStepper as NumberInputStepper$1, Divider, NumberIncrementStepper, NumberDecrementStepper, NumberInput as NumberInput$2, NumberInputField as NumberInputField$1, PinInput as PinInput$2, Switch as Switch$2, TabPanel as TabPanel$1, Tabs as Tabs$2, Textarea as Textarea$2, useToast as useToast$1, TagLeftIcon, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Grid, GridItem, useOutsideClick } from '@chakra-ui/react';
1
+ import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useInterval, useMediaQuery, useToken as useToken$1, Box, useMultiStyleConfig, chakra, Alert as Alert$2, AspectRatio as AspectRatio$1, forwardRef, useStyleConfig, Icon as Icon$2, Heading, Text, FormLabel as FormLabel$1, VisuallyHidden, HStack, Badge as Badge$2, Spinner as Spinner$2, Button as Button$2, Checkbox as Checkbox$2, FormControl, Stack, FormErrorMessage, Flex, IconButton as IconButton$1, Popover as Popover$2, useDisclosure, useBoolean, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, keyframes, extendTheme, Table as Table$2, Thead, Tbody, Tr, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Portal, Tooltip as Tooltip$2, VStack, Circle, Center, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, CloseButton as CloseButton$1, Radio as Radio$2, RadioGroup as RadioGroup$1, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, Editable, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalBody as ModalBody$1, ModalHeader, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, Progress, Image as Image$1, ChakraProvider, Menu as Menu$2, NumberInputStepper as NumberInputStepper$1, Divider, NumberIncrementStepper, NumberDecrementStepper, NumberInput as NumberInput$2, NumberInputField as NumberInputField$1, PinInput as PinInput$2, Switch as Switch$2, TabPanel as TabPanel$1, Tabs as Tabs$2, Textarea as Textarea$2, useToast as useToast$1, TagLeftIcon, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Grid, GridItem } from '@chakra-ui/react';
2
2
  export { AbsoluteCenter, AccordionIcon, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, Box, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Hide, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkBox, LinkOverlay, List, ListIcon, ListItem, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, Show, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, keyframes, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
3
3
  import React, { useState, useEffect, useRef, isValidElement, cloneElement, Children, createContext, useContext, forwardRef as forwardRef$1, useImperativeHandle, memo, useMemo, useCallback } from 'react';
4
4
  import { CreatableSelect, chakraComponents, AsyncSelect, Select as Select$3 } from 'chakra-react-select';
@@ -10034,7 +10034,15 @@ var __spreadValues$O = (a, b) => {
10034
10034
  }
10035
10035
  return a;
10036
10036
  };
10037
- const EditableControls = ({ size }) => {
10037
+ const mapEditableVariantsToButtonSubmitVariants = {
10038
+ brand: "brand",
10039
+ default: "success"
10040
+ };
10041
+ const mapEditableVariantsToButtonCancelVariants = {
10042
+ brand: "ghost",
10043
+ default: "danger"
10044
+ };
10045
+ const EditableControls = ({ size, variant = "default" }) => {
10038
10046
  const {
10039
10047
  getSubmitButtonProps,
10040
10048
  getCancelButtonProps
@@ -10046,7 +10054,7 @@ const EditableControls = ({ size }) => {
10046
10054
  __spreadValues$O({
10047
10055
  "aria-label": "Cancel",
10048
10056
  sx: button,
10049
- variant: "danger"
10057
+ variant: mapEditableVariantsToButtonCancelVariants[variant]
10050
10058
  }, getCancelButtonProps()),
10051
10059
  /* @__PURE__ */ React.createElement(Icon$1, { sx: icon, as: XCloseSolid })
10052
10060
  ), /* @__PURE__ */ React.createElement(
@@ -10054,7 +10062,7 @@ const EditableControls = ({ size }) => {
10054
10062
  __spreadValues$O({
10055
10063
  "aria-label": "Save",
10056
10064
  sx: button,
10057
- variant: "success"
10065
+ variant: mapEditableVariantsToButtonSubmitVariants[variant]
10058
10066
  }, getSubmitButtonProps()),
10059
10067
  /* @__PURE__ */ React.createElement(Icon$1, { sx: icon, as: CheckDuo })
10060
10068
  )) : /* @__PURE__ */ React.createElement(
@@ -10102,12 +10110,14 @@ const EditableText = (_a) => {
10102
10110
  size = "md",
10103
10111
  value: inputValue,
10104
10112
  onSubmit,
10105
- leftItem
10113
+ leftItem,
10114
+ variant = "default"
10106
10115
  } = _b, rest = __objRest$E(_b, [
10107
10116
  "size",
10108
10117
  "value",
10109
10118
  "onSubmit",
10110
- "leftItem"
10119
+ "leftItem",
10120
+ "variant"
10111
10121
  ]);
10112
10122
  const [value, setValue] = useState(inputValue);
10113
10123
  const { input, preview } = useMultiStyleConfig("EditableText", { size, value });
@@ -10136,7 +10146,7 @@ const EditableText = (_a) => {
10136
10146
  size,
10137
10147
  sx: input
10138
10148
  }
10139
- ), /* @__PURE__ */ React.createElement(InputRightElement, { sx: { width: "min-content" } }, /* @__PURE__ */ React.createElement(EditableControls, { size })))
10149
+ ), /* @__PURE__ */ React.createElement(InputRightElement, { sx: { width: "min-content" } }, /* @__PURE__ */ React.createElement(EditableControls, { size, variant })))
10140
10150
  );
10141
10151
  };
10142
10152
 
@@ -13877,10 +13887,28 @@ var __objRest = (source, exclude) => {
13877
13887
  }
13878
13888
  return target;
13879
13889
  };
13890
+ const { Option: ChakraOption } = chakraComponents;
13880
13891
  const customComponents = {
13881
13892
  Option: (_a) => {
13882
13893
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
13883
- return /* @__PURE__ */ React.createElement(chakraComponents.Option, __spreadValues$1({}, props), /* @__PURE__ */ React.createElement(React.Fragment, null, props.data.isCreation ? /* @__PURE__ */ React.createElement(Flex, { mr: 3, width: 1.5, mb: 0.5, justifyContent: "center", alignItems: "center" }, /* @__PURE__ */ React.createElement(Icon$1, { mb: "4px", as: PlusSolid, color: "brand" })) : /* @__PURE__ */ React.createElement(Box, { mr: 3, width: 1.5 }), children));
13894
+ return /* @__PURE__ */ React.createElement(ChakraOption, __spreadValues$1({}, props), props.data.isCreation && /* @__PURE__ */ React.createElement(
13895
+ Flex,
13896
+ {
13897
+ mr: 3,
13898
+ width: 1.5,
13899
+ mb: 0.5,
13900
+ justifyContent: "center",
13901
+ alignItems: "center"
13902
+ },
13903
+ /* @__PURE__ */ React.createElement(Icon$1, { as: PlusSolid, color: "brand" })
13904
+ ), !props.data.isCreation && /* @__PURE__ */ React.createElement(Box, { mr: 3, width: 1.5 }), /* @__PURE__ */ React.createElement(
13905
+ Text,
13906
+ {
13907
+ color: props.data.isCreation ? "text.brand" : "text.default",
13908
+ fontWeight: props.data.isCreation ? "semibold" : "normal"
13909
+ },
13910
+ children
13911
+ ));
13884
13912
  }
13885
13913
  };
13886
13914
 
@@ -13903,70 +13931,67 @@ var __spreadValues = (a, b) => {
13903
13931
  return a;
13904
13932
  };
13905
13933
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13934
+ const CREATION_OPTION_VALUE = "add_field";
13906
13935
  const CreatableSelectDropdown = ({
13907
13936
  standardOptions,
13908
13937
  initialPlaceholder = "Select or create...",
13909
- addOptionPlaceholder = "Enter text...",
13938
+ addOptionPlaceholder = "Select or create...",
13910
13939
  creationOption = {
13911
- label: "Add option...",
13912
- value: "Add option...",
13940
+ label: "Add field",
13941
+ value: CREATION_OPTION_VALUE,
13913
13942
  isCreation: true
13914
13943
  },
13915
13944
  onOptionChange,
13916
- width = "100%",
13917
13945
  variant = "outline",
13918
13946
  defaultValue,
13919
13947
  value,
13920
13948
  menuPlacement = "bottom"
13921
13949
  }) => {
13922
- const initialSelectedOption = useMemo(
13923
- () => {
13924
- var _a, _b;
13925
- if (!isNil(value)) {
13926
- return (_a = standardOptions.find((option) => option.value === value)) != null ? _a : null;
13927
- }
13928
- if (!isNil(defaultValue)) {
13929
- return (_b = standardOptions.find((option) => option.value === defaultValue)) != null ? _b : null;
13930
- }
13931
- return null;
13932
- },
13933
- [value]
13934
- );
13935
- const [selectedOption, setSelectedOption] = useState(initialSelectedOption);
13936
- const [newOptionText, setNewOptionText] = useState("");
13950
+ const [selectedOption, setSelectedOption] = useState(() => {
13951
+ var _a, _b;
13952
+ const targetValue = (_a = value != null ? value : defaultValue) != null ? _a : null;
13953
+ return targetValue ? (_b = standardOptions.find((option) => option.value === targetValue)) != null ? _b : null : null;
13954
+ });
13937
13955
  const [newOptionPlaceholder, setNewOptionPlaceholder] = useState(initialPlaceholder);
13938
13956
  const [createdOptions, setCreatedOptions] = useState([]);
13957
+ const [createNewOption, setCreateNewOption] = useState(false);
13958
+ const [addFieldInputValue, setAddFieldInputValue] = useState("");
13939
13959
  function isCreationOption(option) {
13940
13960
  return option && typeof option.isCreation === "boolean";
13941
13961
  }
13942
13962
  const ref = useRef(null);
13943
- useOutsideClick({
13944
- ref,
13945
- handler: () => {
13946
- if (isCreationOption(selectedOption)) {
13947
- setSelectedOption(initialSelectedOption);
13948
- setNewOptionPlaceholder(initialPlaceholder);
13949
- }
13963
+ const checkIfNewOptionTextExistsInOptions = (string, options) => any((option) => toLower(option.value) === string, options);
13964
+ const handleCreateOption = (newOptionTextString) => {
13965
+ setCreateNewOption(true);
13966
+ if (isEmpty(trim(newOptionTextString))) {
13967
+ return;
13950
13968
  }
13951
- });
13952
- const handleInputChange = (newValue) => {
13953
- setNewOptionText(newValue);
13954
- };
13955
- const handleCreateOption = () => {
13956
- const newOptionTextLower = newOptionText.toLowerCase();
13957
- const newOptionExists = standardOptions.some((option) => option.value.toLowerCase() === newOptionTextLower);
13958
- if (!newOptionExists) {
13959
- const newOption = { label: newOptionText, value: newOptionText };
13960
- setCreatedOptions((currentCreatedOptions) => [...currentCreatedOptions, newOption]);
13969
+ const newOptionTextLower = toLower(newOptionTextString);
13970
+ const newOptionExistsInStandardOptions = checkIfNewOptionTextExistsInOptions(newOptionTextLower, standardOptions);
13971
+ const newOptionExistsInCreatedOptions = checkIfNewOptionTextExistsInOptions(
13972
+ newOptionTextLower,
13973
+ createdOptions
13974
+ );
13975
+ if (!newOptionExistsInCreatedOptions && !newOptionExistsInStandardOptions) {
13976
+ const newOption = {
13977
+ label: newOptionTextString,
13978
+ value: newOptionTextString
13979
+ };
13980
+ setCreatedOptions((currentCreatedOptions) => [
13981
+ ...currentCreatedOptions,
13982
+ newOption
13983
+ ]);
13961
13984
  setSelectedOption(newOption);
13962
13985
  onOptionChange(newOption);
13963
13986
  }
13964
- setNewOptionText("");
13965
13987
  setNewOptionPlaceholder(initialPlaceholder);
13966
13988
  };
13967
13989
  const handleChange = (newValue, _actionMeta) => {
13968
13990
  const option = newValue;
13969
- if (option === null) {
13991
+ if (newValue == null ? void 0 : newValue.isCreation) {
13992
+ setCreateNewOption(true);
13993
+ }
13994
+ if (option == null) {
13970
13995
  return;
13971
13996
  }
13972
13997
  if (isCreationOption(option)) {
@@ -13974,14 +13999,10 @@ const CreatableSelectDropdown = ({
13974
13999
  } else {
13975
14000
  setNewOptionPlaceholder(initialPlaceholder);
13976
14001
  }
13977
- setSelectedOption(option);
13978
- onOptionChange(option);
13979
- };
13980
- const handleKeyDown = (event) => {
13981
- if (event.key === "Enter" && newOptionText) {
13982
- handleCreateOption();
13983
- event.preventDefault();
14002
+ if (option.value !== CREATION_OPTION_VALUE) {
14003
+ setSelectedOption(option);
13984
14004
  }
14005
+ onOptionChange(option);
13985
14006
  };
13986
14007
  const combinedOptions = [...standardOptions, ...createdOptions];
13987
14008
  const customOptions = [
@@ -13990,13 +14011,36 @@ const CreatableSelectDropdown = ({
13990
14011
  }),
13991
14012
  ...combinedOptions
13992
14013
  ];
13993
- return /* @__PURE__ */ React.createElement(Box, { ref }, /* @__PURE__ */ React.createElement(
14014
+ return /* @__PURE__ */ React.createElement(Box, { ref, w: "sm", maxW: "full" }, createNewOption && /* @__PURE__ */ React.createElement(
14015
+ EditableText,
14016
+ {
14017
+ value: addFieldInputValue,
14018
+ startWithEditView: true,
14019
+ onChange: (v) => {
14020
+ setAddFieldInputValue(v);
14021
+ },
14022
+ submitOnBlur: false,
14023
+ onCancel: () => {
14024
+ setAddFieldInputValue("");
14025
+ setCreateNewOption(false);
14026
+ },
14027
+ onSubmit: (v) => {
14028
+ handleCreateOption(v);
14029
+ setCreateNewOption(false);
14030
+ },
14031
+ variant: "brand",
14032
+ sx: {
14033
+ minWidth: "100%",
14034
+ width: "100%"
14035
+ }
14036
+ }
14037
+ ), !createNewOption && /* @__PURE__ */ React.createElement(
13994
14038
  CreatableSelect,
13995
14039
  {
13996
14040
  menuPlacement,
13997
14041
  chakraStyles: __spreadProps(__spreadValues({}, customSelectStyles), {
13998
14042
  container: (provided) => __spreadProps(__spreadValues({}, provided), {
13999
- width
14043
+ width: "100%"
14000
14044
  }),
14001
14045
  option: (provided, { isSelected }) => __spreadValues(__spreadValues({}, provided), isSelected && {
14002
14046
  color: "black"
@@ -14007,11 +14051,11 @@ const CreatableSelectDropdown = ({
14007
14051
  value: selectedOption,
14008
14052
  onChange: handleChange,
14009
14053
  isMulti: false,
14010
- onInputChange: handleInputChange,
14011
- onKeyDown: handleKeyDown,
14012
- onCreateOption: handleCreateOption,
14054
+ onCreateOption: (v) => {
14055
+ setCreateNewOption(true);
14056
+ setAddFieldInputValue(v);
14057
+ },
14013
14058
  placeholder: newOptionPlaceholder,
14014
- inputValue: newOptionText,
14015
14059
  useBasicStyles: true,
14016
14060
  variant
14017
14061
  }