@wavv/ui 2.4.22 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ type Props = {
14
14
  formatCreateOption?: (inputText: string) => ReactNode;
15
15
  ref?: React.Ref<HTMLInputElement>;
16
16
  } & ComboBoxInputProps & OpenStateProps & ComboBoxProps;
17
- declare const _default: (({ backgroundColor, menuBackground, children, fontSize, disabled, invalid, required, readOnly, loading, loadingResults, label, options, placeholder, placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, iconLeft, leftElement, rightElement, allowRepeatSelection, allowsEmptyCollection, emptyFallback, position, fixedPosition, open, onOpenChange, before, after, onChange, onCreate, formatCreateOption, afterShow, afterHide, onTextChange, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
17
+ declare const _default: (({ backgroundColor, menuBackground, children, fontSize, disabled, invalid, required, readOnly, loading, loadingResults, label, options, placeholder, placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, iconLeft, leftElement, rightElement, allowRepeatSelection, allowsEmptyCollection, emptyFallback, position, fixedPosition, open, onOpenChange, before, after, separators, onChange, onCreate, formatCreateOption, afterShow, afterHide, onTextChange, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
18
18
  Item: ({ id, value, header, body, leftElement, rightElement, inline, disabled, selectionMode, ...props }: import("..").SelectItem & Omit<import("react-aria-components").ListBoxItemProps<object>, "id" | "value" | "isDisabled"> & {
19
19
  selectionMode?: import("react-aria-components").SelectionMode;
20
20
  }) => import("react/jsx-runtime").JSX.Element;
@@ -19,7 +19,7 @@ import ListRootStyles, { preventProps } from "./ListHelpers/ListRootStyles.js";
19
19
  import ListSection from "./ListHelpers/ListSection.js";
20
20
  import MotionPopover from "./MotionPopover.js";
21
21
  import Spinner from "./Spinner.js";
22
- const ComboBox_ComboBox = ({ backgroundColor, menuBackground, children, fontSize, disabled, invalid, required, readOnly, loading, loadingResults, label, options, placeholder = 'Select', placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, iconLeft, leftElement, rightElement, allowRepeatSelection, allowsEmptyCollection, emptyFallback, position, fixedPosition, open, onOpenChange, before, after, onChange, onCreate, formatCreateOption, afterShow, afterHide, onTextChange, ref, ...props })=>{
22
+ const ComboBox_ComboBox = ({ backgroundColor, menuBackground, children, fontSize, disabled, invalid, required, readOnly, loading, loadingResults, label, options, placeholder = 'Select', placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, iconLeft, leftElement, rightElement, allowRepeatSelection, allowsEmptyCollection, emptyFallback, position, fixedPosition, open, onOpenChange, before, after, separators, onChange, onCreate, formatCreateOption, afterShow, afterHide, onTextChange, ref, ...props })=>{
23
23
  const [isOpen, handleOpenChange] = useControlledOpenState({
24
24
  open,
25
25
  onOpenChange,
@@ -167,6 +167,7 @@ const ComboBox_ComboBox = ({ backgroundColor, menuBackground, children, fontSize
167
167
  before: before,
168
168
  after: after,
169
169
  menuBackground: menuBackground,
170
+ separators: separators,
170
171
  renderEmptyState: emptyContent ? ()=>emptyContent : void 0,
171
172
  createOptionItem: showCreateOption && /*#__PURE__*/ jsx(CreateItem, {
172
173
  onAction: handleCreateOption,
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  import { type ListBoxProps, type SelectionMode } from 'react-aria-components';
3
3
  import type { ListOption, SelectInputProps } from '../typeDefs/selectionTypes';
4
4
  import type { Width } from '../types';
@@ -9,6 +9,8 @@ type Props = {
9
9
  readOnly?: boolean;
10
10
  createOptionItem?: ReactNode;
11
11
  selectionMode?: SelectionMode;
12
+ /** Renders a divider between each option */
13
+ separators?: boolean;
12
14
  } & Width & ListBoxProps<ListOption> & Pick<SelectInputProps, 'before' | 'after' | 'menuBackground'>;
13
- declare const ListOptions: ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, ...props }: Props) => ReactNode;
15
+ declare const ListOptions: ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, separators, ...props }: Props) => ReactNode;
14
16
  export default ListOptions;
@@ -1,10 +1,21 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import styled from "@emotion/styled";
3
- import { ListBox } from "react-aria-components";
3
+ import { Fragment } from "react";
4
+ import { ListBox, Separator } from "react-aria-components";
4
5
  import ListSection from "../ListHelpers/ListSection.js";
5
6
  import ListStyles, { preventProps } from "../ListHelpers/ListStyles.js";
6
7
  import ListBoxItem from "./ListBoxItem.js";
7
- const ListOptions = ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, ...props })=>/*#__PURE__*/ jsxs(ListContainer, {
8
+ const ListOptions = ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, separators, ...props })=>{
9
+ const renderItem = (item, isLast)=>/*#__PURE__*/ jsxs(Fragment, {
10
+ children: [
11
+ /*#__PURE__*/ jsx(ListBoxItem, {
12
+ ...item,
13
+ selectionMode: selectionMode
14
+ }),
15
+ separators && !isLast && /*#__PURE__*/ jsx(ListOptions_Separator, {})
16
+ ]
17
+ }, item.id || item.value);
18
+ return /*#__PURE__*/ jsxs(ListContainer, {
8
19
  autoWidth: autoWidth,
9
20
  width: autoWidth ? void 0 : width,
10
21
  background: menuBackground,
@@ -19,23 +30,17 @@ const ListOptions = ({ options, children, autoWidth, width, before, after, menuB
19
30
  ...props,
20
31
  children: [
21
32
  createOptionItem,
22
- options?.map((option)=>{
33
+ options?.map((option, index)=>{
23
34
  if ('options' in option) {
24
35
  const section = option;
25
36
  return /*#__PURE__*/ jsx(ListSection, {
26
37
  id: section.id,
27
38
  title: section.title,
28
- children: section.options.map((item)=>/*#__PURE__*/ jsx(ListBoxItem, {
29
- ...item,
30
- selectionMode: selectionMode
31
- }, item.id || item.value))
39
+ children: section.options.map((item, i)=>renderItem(item, i === section.options.length - 1))
32
40
  }, section.id);
33
41
  }
34
42
  const item = option;
35
- return /*#__PURE__*/ jsx(ListBoxItem, {
36
- ...item,
37
- selectionMode: selectionMode
38
- }, item.id || item.value);
43
+ return renderItem(item, index === options.length - 1);
39
44
  }),
40
45
  children
41
46
  ]
@@ -43,6 +48,13 @@ const ListOptions = ({ options, children, autoWidth, width, before, after, menuB
43
48
  after
44
49
  ]
45
50
  });
51
+ };
52
+ const ListOptions_Separator = styled(Separator)(({ theme })=>({
53
+ height: 1,
54
+ border: 'none',
55
+ backgroundColor: theme.scale2,
56
+ margin: '0'
57
+ }));
46
58
  const ListContainer = styled('div', preventProps)(ListStyles);
47
59
  const ListBoxParts_ListOptions = ListOptions;
48
60
  export { ListBoxParts_ListOptions as default };
@@ -47,6 +47,6 @@ type MultiSelectProps = {
47
47
  maxListHeight?: number;
48
48
  /** The maxHeight of the options list */
49
49
  maxMenuHeight?: number;
50
- } & Width & Margin & Padding & ElAttributes & Pick<SelectInputProps, 'invalid'>;
51
- declare const MultiSelect: ({ options, items, listLabel, listText, itemsTitle, maxItems, placeholder, width, accepts, disabled, hideItemsInfo, compact, backgroundColor, borderless, autoFocus, embedded, invalid, maxListHeight, maxMenuHeight, onToggleAllItems, addItem, removeItem, onTextChange, ref, ...props }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
50
+ } & Width & Margin & Padding & ElAttributes & Pick<SelectInputProps, 'invalid' | 'separators'>;
51
+ declare const MultiSelect: ({ options, items, listLabel, listText, itemsTitle, maxItems, placeholder, width, accepts, disabled, hideItemsInfo, compact, backgroundColor, borderless, autoFocus, embedded, invalid, maxListHeight, maxMenuHeight, onToggleAllItems, addItem, removeItem, onTextChange, separators, ref, ...props }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
52
52
  export default MultiSelect;
@@ -8,7 +8,7 @@ import { marginProps, paddingProps as styledProps_js_paddingProps } from "../hel
8
8
  import Icon from "../Icon/index.js";
9
9
  import Tag from "../Tag.js";
10
10
  import SearchDropdown from "./SearchDropdown.js";
11
- const MultiSelect = ({ options, items, listLabel, listText, itemsTitle, maxItems, placeholder, width, accepts, disabled, hideItemsInfo, compact, backgroundColor, borderless, autoFocus, embedded, invalid, maxListHeight, maxMenuHeight, onToggleAllItems, addItem, removeItem, onTextChange, ref, ...props })=>{
11
+ const MultiSelect = ({ options, items, listLabel, listText, itemsTitle, maxItems, placeholder, width, accepts, disabled, hideItemsInfo, compact, backgroundColor, borderless, autoFocus, embedded, invalid, maxListHeight, maxMenuHeight, onToggleAllItems, addItem, removeItem, onTextChange, separators, ref, ...props })=>{
12
12
  const [expanded, setExpanded] = useState(autoFocus || false);
13
13
  const [error, setError] = useState(false);
14
14
  const { font, input: inputColors } = useTheme();
@@ -97,6 +97,7 @@ const MultiSelect = ({ options, items, listLabel, listText, itemsTitle, maxItems
97
97
  ref: dropdownRef,
98
98
  accepts: accepts,
99
99
  maxHeight: maxMenuHeight,
100
+ separators: separators,
100
101
  onValidChange: (valid)=>setError(!valid)
101
102
  })
102
103
  ]
@@ -13,5 +13,5 @@ type Props = {
13
13
  onValidChange?: (valid: boolean) => void;
14
14
  ref?: React.Ref<HTMLInputElement>;
15
15
  } & Omit<SelectInputProps, 'options'> & ComboBoxProps;
16
- declare const SearchDropdown: ({ options, items, triggerRef, placeholder, placeholderColor, fontSize, position, fixedPosition, maxHeight, disabled, accepts, addItem, removeItem, afterShow, afterHide, onTextChange, onValidChange, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ declare const SearchDropdown: ({ options, items, triggerRef, placeholder, placeholderColor, fontSize, position, fixedPosition, maxHeight, disabled, accepts, addItem, removeItem, separators, afterShow, afterHide, onTextChange, onValidChange, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
17
17
  export default SearchDropdown;
@@ -9,7 +9,7 @@ import isAcceptable from "../Inputs/helpers/isAcceptable.js";
9
9
  import useDynamicWidth from "../Inputs/helpers/useDynamicWidth.js";
10
10
  import ListOptions from "../ListBoxParts/ListOptions.js";
11
11
  import MotionPopover from "../MotionPopover.js";
12
- const SearchDropdown = ({ options, items, triggerRef, placeholder, placeholderColor, fontSize, position, fixedPosition, maxHeight, disabled, accepts, addItem, removeItem, afterShow, afterHide, onTextChange, onValidChange, ref, ...props })=>{
12
+ const SearchDropdown = ({ options, items, triggerRef, placeholder, placeholderColor, fontSize, position, fixedPosition, maxHeight, disabled, accepts, addItem, removeItem, separators, afterShow, afterHide, onTextChange, onValidChange, ref, ...props })=>{
13
13
  const [isOpen, setIsOpen] = useState(false);
14
14
  const [filteredOptions, setFilteredOptions] = useState([]);
15
15
  const [inputText, setInputText] = useState('');
@@ -120,7 +120,8 @@ const SearchDropdown = ({ options, items, triggerRef, placeholder, placeholderCo
120
120
  children: ({ isEntering, isExiting })=>/*#__PURE__*/ jsx(ListOptions, {
121
121
  options: filteredOptions,
122
122
  width: refObject?.current?.offsetWidth,
123
- readOnly: isEntering || isExiting
123
+ readOnly: isEntering || isExiting,
124
+ separators: separators
124
125
  })
125
126
  })
126
127
  ]
@@ -4,7 +4,7 @@ import type { OpenStateProps, SelectInputProps } from './typeDefs/selectionTypes
4
4
  type Props = {
5
5
  ref?: React.Ref<HTMLButtonElement>;
6
6
  } & SelectInputProps & OpenStateProps & SelectProps;
7
- declare const _default: (({ backgroundColor, menuBackground, children, fontSize, fontWeight, color, disabled, invalid, required, readOnly, loading, label, options, placeholder, placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, allowRepeatSelection, hideCaret, position, fixedPosition, borderRadius, iconLeft, leftElement, rightElement, before, after, open, onOpenChange, onChange, afterShow, afterHide, selectionMode, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
7
+ declare const _default: (({ backgroundColor, menuBackground, children, fontSize, fontWeight, color, disabled, invalid, required, readOnly, loading, label, options, placeholder, placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, allowRepeatSelection, hideCaret, position, fixedPosition, borderRadius, iconLeft, leftElement, rightElement, before, after, open, onOpenChange, onChange, afterShow, afterHide, selectionMode, separators, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
8
8
  Item: ({ id, value, header, body, leftElement, rightElement, inline, disabled, selectionMode, ...props }: import("..").SelectItem & Omit<import("react-aria-components").ListBoxItemProps<object>, "id" | "value" | "isDisabled"> & {
9
9
  selectionMode?: SelectionMode;
10
10
  }) => import("react/jsx-runtime").JSX.Element;
@@ -15,7 +15,7 @@ import ListRootStyles, { preventProps } from "./ListHelpers/ListRootStyles.js";
15
15
  import ListSection from "./ListHelpers/ListSection.js";
16
16
  import MotionPopover from "./MotionPopover.js";
17
17
  import Spinner from "./Spinner.js";
18
- const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fontWeight, color, disabled, invalid, required, readOnly, loading, label, options, placeholder = 'Select', placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, allowRepeatSelection, hideCaret, position, fixedPosition, borderRadius, iconLeft, leftElement, rightElement, before, after, open, onOpenChange, onChange, afterShow, afterHide, selectionMode, ref, ...props })=>{
18
+ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fontWeight, color, disabled, invalid, required, readOnly, loading, label, options, placeholder = 'Select', placeholderColor, description, errorMessage, textOnly, value, defaultValue, width, height, maxHeight, allowRepeatSelection, hideCaret, position, fixedPosition, borderRadius, iconLeft, leftElement, rightElement, before, after, open, onOpenChange, onChange, afterShow, afterHide, selectionMode, separators, ref, ...props })=>{
19
19
  const [isOpen, handleOpenChange] = useControlledOpenState({
20
20
  open,
21
21
  onOpenChange,
@@ -162,6 +162,7 @@ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fo
162
162
  after: after,
163
163
  menuBackground: menuBackground,
164
164
  selectionMode: selectionMode,
165
+ separators: separators,
165
166
  children: children
166
167
  })
167
168
  })
@@ -62,6 +62,8 @@ type BaseSelectInputProps = {
62
62
  before?: ReactNode;
63
63
  /** The element to display after the menu options */
64
64
  after?: ReactNode;
65
+ /** Renders a divider between each option */
66
+ separators?: boolean;
65
67
  maxHeight?: PopoverProps['maxHeight'];
66
68
  } & Omit<InputProps, 'iconRight'> & ShowHideCallbacks & Pick<PopoverProps, 'maxHeight'>;
67
69
  type SingleSelectInputProps = BaseSelectInputProps & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "2.4.22",
3
+ "version": "2.5.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {