@wavv/ui 2.4.8-alpha.1 → 2.4.8-alpha.3

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.
@@ -65,10 +65,12 @@ const CalendarHeader = ({ date, setDate })=>{
65
65
  const month = mth?.toString() || '';
66
66
  const year = yr?.toString() || '';
67
67
  const handleMonth = (monthId)=>{
68
- setDate(new CalendarDate(+year, +monthId, day || 1));
68
+ const id = Array.isArray(monthId) ? monthId[0] : monthId;
69
+ setDate(new CalendarDate(+year, +id, day || 1));
69
70
  };
70
71
  const handleYear = (yearId)=>{
71
- setDate(new CalendarDate(+yearId, +month, day || 1));
72
+ const id = Array.isArray(yearId) ? yearId[0] : yearId;
73
+ setDate(new CalendarDate(+id, +month, day || 1));
72
74
  };
73
75
  return /*#__PURE__*/ jsxs(Header, {
74
76
  children: [
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { ComboBoxProps } from './typeDefs/reactAriaTypes';
3
- import type { OpenStateProps, SelectInputProps } from './typeDefs/selectionTypes';
3
+ import type { ComboBoxInputProps, OpenStateProps } from './typeDefs/selectionTypes';
4
4
  type Props = {
5
5
  /** Use when loading options asynchronously with onTextChange */
6
6
  loadingResults?: boolean;
@@ -13,9 +13,11 @@ type Props = {
13
13
  /** Customize the create option label. Receives raw inputText and returns the label to display. */
14
14
  formatCreateOption?: (inputText: string) => ReactNode;
15
15
  ref?: React.Ref<HTMLInputElement>;
16
- } & SelectInputProps & OpenStateProps & ComboBoxProps;
16
+ } & ComboBoxInputProps & OpenStateProps & ComboBoxProps;
17
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) & {
18
- Item: ({ id, value, header, body, leftElement, rightElement, inline, disabled, ...props }: import("..").SelectItem & Omit<import("react-aria-components").ListBoxItemProps<object>, "id" | "value" | "isDisabled">) => import("react/jsx-runtime").JSX.Element;
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
+ selectionMode?: import("react-aria-components").SelectionMode;
20
+ }) => import("react/jsx-runtime").JSX.Element;
19
21
  Section: ({ id, title, children }: {
20
22
  id?: string;
21
23
  title?: string;
@@ -26,7 +26,7 @@ const ComboBox_ComboBox = ({ backgroundColor, menuBackground, children, fontSize
26
26
  afterShow,
27
27
  afterHide
28
28
  });
29
- const [internalValue, setInternalValue] = useState(defaultValue || '');
29
+ const [internalValue, setInternalValue] = useState(defaultValue ? String(defaultValue) : '');
30
30
  const [inputText, setInputText] = useState((value || defaultValue || '').toString());
31
31
  const pendingSelectionRef = useRef(null);
32
32
  const isControlled = void 0 !== value;
@@ -1,9 +1,9 @@
1
1
  import { type ButtonProps } from 'react-aria-components';
2
- import type { ListOption, OpenStateProps, SelectInputProps, SelectItem } from './typeDefs/selectionTypes';
2
+ import type { ComboBoxInputProps, ListOption, OpenStateProps, SelectItem } from './typeDefs/selectionTypes';
3
3
  type Props = {
4
4
  /** The options to be displayed in the dropdown */
5
5
  options?: ListOption[];
6
- } & Omit<SelectInputProps, 'options' | 'textOnly'> & OpenStateProps & Omit<ButtonProps, 'ref' | 'isDisabled'>;
6
+ } & Omit<ComboBoxInputProps, 'options' | 'textOnly'> & OpenStateProps & Omit<ButtonProps, 'ref' | 'isDisabled'>;
7
7
  declare const _default: (({ children, before, after, open, label, placeholder, options, width, height, value, defaultValue, loading, hideCaret, color, disabled, readOnly, required, invalid, placeholderColor, fontSize, fontWeight, description, errorMessage, position, backgroundColor, menuBackground, iconLeft, leftElement, rightElement, onChange, onOpenChange, afterShow, afterHide, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
8
8
  Item: ({ children, id, value, header, body, leftElement, rightElement, inline, disabled, ...props }: {
9
9
  children?: import("react").ReactNode;
@@ -105,6 +105,7 @@ declare const icons: {
105
105
  readonly paragraph: ComponentType<WrappedIconProps>;
106
106
  readonly pause: ComponentType<WrappedIconProps>;
107
107
  readonly 'pause-circle': ComponentType<WrappedIconProps>;
108
+ readonly percent: ComponentType<WrappedIconProps>;
108
109
  readonly person: ComponentType<WrappedIconProps>;
109
110
  readonly 'person-add': ComponentType<WrappedIconProps>;
110
111
  readonly 'person-check': ComponentType<WrappedIconProps>;
@@ -138,6 +139,7 @@ declare const icons: {
138
139
  readonly stop: ComponentType<WrappedIconProps>;
139
140
  readonly 'stop-circle': ComponentType<WrappedIconProps>;
140
141
  readonly strikethrough: ComponentType<WrappedIconProps>;
142
+ readonly tag: ComponentType<WrappedIconProps>;
141
143
  readonly template: ComponentType<WrappedIconProps>;
142
144
  readonly transfer: ComponentType<WrappedIconProps>;
143
145
  readonly trash: ComponentType<WrappedIconProps>;
@@ -1,4 +1,4 @@
1
- import { ArrowDown, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowRightLeft, ArrowUp, ArrowUpWideNarrow, BadgeCheck, Ban, Bell, BellDot, Bold, Bot, Braces, Bug, CalendarDays, Camera, ChartColumn, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, Circle, CircleAlert, CircleCheck, CirclePause, CirclePlay, CirclePlus, CircleQuestionMark, CircleStop, CircleUserRound, CircleX, Clapperboard, Clock, Copy, CopyCheck, CopyPlus, CreditCard, Download, Ear, EllipsisVertical, ExternalLink, Eye, EyeOff, Facebook, FileText, Flag, FlaskConical, Frown, Funnel, Globe, GripVertical, Hash, Heading, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Headset, Heart, Highlighter, Hourglass, House, IdCard, Info, Instagram, Italic, Kanban, Layers2, LayoutDashboard, Lightbulb, Link, Linkedin, List, ListChecks, ListFilter, ListOrdered, ListTodo, Loader, LockKeyhole, LockKeyholeOpen, LogIn, LogOut, MapPin, MapPinned, Maximize2, Meh, Menu, Merge, MessageSquareMore, Mic, MicOff, Minimize2, Minus, MonitorSmartphone, NotebookPen, Paperclip, Pause, Pencil, Pilcrow, Pin, PinOff, Play, Plus, Redo, RefreshCcwDot, RefreshCw, Rocket, RotateCw, Search, Send, Settings, Share, Share2, Shield, ShieldCheck, ShieldOff, ShieldPlus, ShoppingCart, Smartphone, Smile, Sparkles, Square, SquarePen, SquareStack, Star, Strikethrough, TextQuote, Trash2, TriangleAlert, Trophy, Underline, Undo, Upload, UserRound, UserRoundCheck, UserRoundPlus, UserRoundX, Users, Video, Voicemail, Volume2, X, Youtube } from "lucide-react";
1
+ import { ArrowDown, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowRightLeft, ArrowUp, ArrowUpWideNarrow, BadgeCheck, Ban, Bell, BellDot, Bold, Bot, Braces, Bug, CalendarDays, Camera, ChartColumn, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, Circle, CircleAlert, CircleCheck, CirclePause, CirclePlay, CirclePlus, CircleQuestionMark, CircleStop, CircleUserRound, CircleX, Clapperboard, Clock, Copy, CopyCheck, CopyPlus, CreditCard, Download, Ear, EllipsisVertical, ExternalLink, Eye, EyeOff, Facebook, FileText, Flag, FlaskConical, Frown, Funnel, Globe, GripVertical, Hash, Heading, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Headset, Heart, Highlighter, Hourglass, House, IdCard, Info, Instagram, Italic, Kanban, Layers2, LayoutDashboard, Lightbulb, Link, Linkedin, List, ListChecks, ListFilter, ListOrdered, ListTodo, Loader, LockKeyhole, LockKeyholeOpen, LogIn, LogOut, MapPin, MapPinned, Maximize2, Meh, Menu, Merge, MessageSquareMore, Mic, MicOff, Minimize2, Minus, MonitorSmartphone, NotebookPen, Paperclip, Pause, Pencil, Percent, Pilcrow, Pin, PinOff, Play, Plus, Redo, RefreshCcwDot, RefreshCw, Rocket, RotateCw, Search, Send, Settings, Share, Share2, Shield, ShieldCheck, ShieldOff, ShieldPlus, ShoppingCart, Smartphone, Smile, Sparkles, Square, SquarePen, SquareStack, Star, Strikethrough, Tag, TextQuote, Trash2, TriangleAlert, Trophy, Underline, Undo, Upload, UserRound, UserRoundCheck, UserRoundPlus, UserRoundX, Users, Video, Voicemail, Volume2, X, Youtube } from "lucide-react";
2
2
  import createWrappedIcon from "./createWrappedIcon.js";
3
3
  const icons = {
4
4
  'activity-history': createWrappedIcon(IdCard),
@@ -105,6 +105,7 @@ const icons = {
105
105
  paragraph: createWrappedIcon(Pilcrow),
106
106
  pause: createWrappedIcon(Pause),
107
107
  'pause-circle': createWrappedIcon(CirclePause),
108
+ percent: createWrappedIcon(Percent),
108
109
  person: createWrappedIcon(UserRound),
109
110
  'person-add': createWrappedIcon(UserRoundPlus),
110
111
  'person-check': createWrappedIcon(UserRoundCheck),
@@ -138,6 +139,7 @@ const icons = {
138
139
  stop: createWrappedIcon(Square),
139
140
  'stop-circle': createWrappedIcon(CircleStop),
140
141
  strikethrough: createWrappedIcon(Strikethrough),
142
+ tag: createWrappedIcon(Tag),
141
143
  template: createWrappedIcon(FileText),
142
144
  transfer: createWrappedIcon(ArrowRightLeft),
143
145
  trash: createWrappedIcon(Trash2),
@@ -1,5 +1,7 @@
1
- import { type ListBoxItemProps } from 'react-aria-components';
1
+ import { type ListBoxItemProps, type SelectionMode } from 'react-aria-components';
2
2
  import type { SelectItem } from '../typeDefs/selectionTypes';
3
- type Props = SelectItem & Omit<ListBoxItemProps, 'value' | 'id' | 'isDisabled'>;
4
- declare const ListBoxItem: ({ id, value, header, body, leftElement, rightElement, inline, disabled, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
3
+ type Props = SelectItem & Omit<ListBoxItemProps, 'value' | 'id' | 'isDisabled'> & {
4
+ selectionMode?: SelectionMode;
5
+ };
6
+ declare const ListBoxItem: ({ id, value, header, body, leftElement, rightElement, inline, disabled, selectionMode, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
5
7
  export default ListBoxItem;
@@ -1,30 +1,44 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import styled from "@emotion/styled";
3
3
  import { ListBoxItem } from "react-aria-components";
4
+ import Icon from "../Icon/index.js";
4
5
  import ItemHeaderBody from "../ListHelpers/ItemHeaderBody.js";
5
6
  import ListItemStyles, { preventProps } from "../ListHelpers/ListItemStyles.js";
6
- const ListBoxItem_ListBoxItem = ({ id, value, header, body, leftElement, rightElement, inline, disabled, ...props })=>{
7
+ const ListBoxItem_ListBoxItem = ({ id, value, header, body, leftElement, rightElement, inline, disabled, selectionMode, ...props })=>{
7
8
  const headerText = header || value;
8
- return /*#__PURE__*/ jsxs(Item, {
9
+ return /*#__PURE__*/ jsx(Item, {
9
10
  id: id || value,
10
11
  textValue: value,
11
12
  isDisabled: disabled,
12
13
  ...props,
13
- children: [
14
- leftElement || null,
15
- headerText && body ? /*#__PURE__*/ jsx(ItemHeaderBody, {
16
- header: headerText,
17
- body: body,
18
- inline: inline,
19
- disabled: disabled
20
- }) : value,
21
- rightElement && /*#__PURE__*/ jsx("div", {
22
- style: {
23
- marginLeft: 'auto'
24
- },
25
- children: rightElement
26
- })
27
- ]
14
+ children: ({ isSelected })=>{
15
+ const showCheck = 'multiple' === selectionMode || 'single' === selectionMode;
16
+ const check = showCheck ? /*#__PURE__*/ jsx(Icon, {
17
+ name: "check",
18
+ color: isSelected ? void 0 : 'transparent',
19
+ size: "small",
20
+ marginLeft: -12,
21
+ marginRight: 4
22
+ }) : null;
23
+ return /*#__PURE__*/ jsxs(Fragment, {
24
+ children: [
25
+ check,
26
+ leftElement || null,
27
+ headerText && body ? /*#__PURE__*/ jsx(ItemHeaderBody, {
28
+ header: headerText,
29
+ body: body,
30
+ inline: inline,
31
+ disabled: disabled
32
+ }) : value,
33
+ rightElement && /*#__PURE__*/ jsx("div", {
34
+ style: {
35
+ marginLeft: 'auto'
36
+ },
37
+ children: rightElement
38
+ })
39
+ ]
40
+ });
41
+ }
28
42
  });
29
43
  };
30
44
  const Item = styled(ListBoxItem, preventProps)(ListItemStyles);
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import { type ListBoxProps } from 'react-aria-components';
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';
5
5
  type Props = {
@@ -8,6 +8,7 @@ type Props = {
8
8
  autoWidth?: boolean;
9
9
  readOnly?: boolean;
10
10
  createOptionItem?: ReactNode;
11
+ selectionMode?: SelectionMode;
11
12
  } & Width & ListBoxProps<ListOption> & Pick<SelectInputProps, 'before' | 'after' | 'menuBackground'>;
12
- declare const ListOptions: ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, ...props }: Props) => ReactNode;
13
+ declare const ListOptions: ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, ...props }: Props) => ReactNode;
13
14
  export default ListOptions;
@@ -4,7 +4,7 @@ import { ListBox } from "react-aria-components";
4
4
  import ListSection from "../ListHelpers/ListSection.js";
5
5
  import ListStyles, { preventProps } from "../ListHelpers/ListStyles.js";
6
6
  import ListBoxItem from "./ListBoxItem.js";
7
- const ListOptions = ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, ...props })=>/*#__PURE__*/ jsxs(ListContainer, {
7
+ const ListOptions = ({ options, children, autoWidth, width, before, after, menuBackground, createOptionItem, selectionMode, ...props })=>/*#__PURE__*/ jsxs(ListContainer, {
8
8
  autoWidth: autoWidth,
9
9
  width: autoWidth ? void 0 : width,
10
10
  background: menuBackground,
@@ -15,6 +15,7 @@ const ListOptions = ({ options, children, autoWidth, width, before, after, menuB
15
15
  style: {
16
16
  outline: 'none'
17
17
  },
18
+ selectionMode: selectionMode,
18
19
  ...props,
19
20
  children: [
20
21
  createOptionItem,
@@ -25,13 +26,15 @@ const ListOptions = ({ options, children, autoWidth, width, before, after, menuB
25
26
  id: section.id,
26
27
  title: section.title,
27
28
  children: section.options.map((item)=>/*#__PURE__*/ jsx(ListBoxItem, {
28
- ...item
29
+ ...item,
30
+ selectionMode: selectionMode
29
31
  }, item.id || item.value))
30
32
  }, section.id);
31
33
  }
32
34
  const item = option;
33
35
  return /*#__PURE__*/ jsx(ListBoxItem, {
34
- ...item
36
+ ...item,
37
+ selectionMode: selectionMode
35
38
  }, item.id || item.value);
36
39
  }),
37
40
  children
@@ -1,10 +1,13 @@
1
+ import { type SelectionMode } from 'react-aria-components';
1
2
  import type { SelectProps } from './typeDefs/reactAriaTypes';
2
3
  import type { OpenStateProps, SelectInputProps } from './typeDefs/selectionTypes';
3
4
  type Props = {
4
5
  ref?: React.Ref<HTMLButtonElement>;
5
6
  } & SelectInputProps & OpenStateProps & SelectProps;
6
- 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, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
7
- Item: ({ id, value, header, body, leftElement, rightElement, inline, disabled, ...props }: import("..").SelectItem & Omit<import("react-aria-components").ListBoxItemProps<object>, "id" | "value" | "isDisabled">) => 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, ref, ...props }: Props) => import("react/jsx-runtime").JSX.Element) & {
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
+ selectionMode?: SelectionMode;
10
+ }) => import("react/jsx-runtime").JSX.Element;
8
11
  Section: ({ id, title, children }: {
9
12
  id?: string;
10
13
  title?: string;
@@ -15,14 +15,24 @@ 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, 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, ref, ...props })=>{
19
19
  const [isOpen, handleOpenChange] = useControlledOpenState({
20
20
  open,
21
21
  onOpenChange,
22
22
  afterShow,
23
23
  afterHide
24
24
  });
25
- const [internalValue, setInternalValue] = useState(defaultValue || '');
25
+ const actualSelectionMode = selectionMode ?? 'single';
26
+ const isMultiple = 'multiple' === actualSelectionMode;
27
+ const [internalValue, setInternalValue] = useState(()=>{
28
+ if (isMultiple) {
29
+ const defaultValueArray = defaultValue;
30
+ return Array.isArray(defaultValueArray) ? defaultValueArray.map(String) : defaultValueArray ? [
31
+ String(defaultValueArray)
32
+ ] : [];
33
+ }
34
+ return defaultValue ? String(defaultValue) : '';
35
+ });
26
36
  const isControlled = void 0 !== value;
27
37
  const currentValue = isControlled ? value : internalValue;
28
38
  const { padding, paddingTop, paddingBottom, paddingRight, paddingLeft } = props;
@@ -43,11 +53,26 @@ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fo
43
53
  };
44
54
  const handleSelect = (val)=>{
45
55
  if (!val) return;
46
- if (!allowRepeatSelection && val === currentValue) return;
47
- if (!isControlled) setInternalValue(val);
48
- if (onChange) onChange(val);
56
+ if (isMultiple) {
57
+ const newValue = Array.isArray(val) ? val.map(String) : [
58
+ String(val)
59
+ ];
60
+ const currentArray = Array.isArray(currentValue) ? currentValue : [];
61
+ if (!allowRepeatSelection && JSON.stringify([
62
+ ...newValue
63
+ ].sort()) === JSON.stringify([
64
+ ...currentArray
65
+ ].sort())) return;
66
+ if (!isControlled) setInternalValue(newValue);
67
+ if (onChange) onChange(newValue);
68
+ } else {
69
+ const stringVal = String(val);
70
+ if (!allowRepeatSelection && stringVal === currentValue) return;
71
+ if (!isControlled) setInternalValue(stringVal);
72
+ if (onChange) onChange(stringVal);
73
+ }
49
74
  };
50
- const hasValue = !!(currentValue || defaultValue);
75
+ const hasValue = isMultiple ? (Array.isArray(currentValue) ? currentValue.length > 0 : false) || (Array.isArray(defaultValue) ? defaultValue.length > 0 : false) : !!(currentValue || defaultValue);
51
76
  const hidePlaceholder = !hasValue && label;
52
77
  const caret = hideCaret ? null : /*#__PURE__*/ jsx(Icon, {
53
78
  name: isOpen ? 'caret-up' : 'caret-down',
@@ -65,7 +90,7 @@ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fo
65
90
  defaultValue: defaultValue,
66
91
  textOnly: textOnly,
67
92
  width: width,
68
- selectionMode: "single",
93
+ selectionMode: selectionMode ?? 'single',
69
94
  ...props,
70
95
  children: [
71
96
  /*#__PURE__*/ jsxs(SelectContainer, {
@@ -103,7 +128,14 @@ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fo
103
128
  opacity: 0,
104
129
  position: 'absolute'
105
130
  } : {},
106
- children: ({ isPlaceholder, selectedText, defaultChildren })=>isPlaceholder ? defaultChildren : selectedText
131
+ children: ({ isPlaceholder, selectedText, selectedItems, defaultChildren })=>{
132
+ if (isPlaceholder) return defaultChildren;
133
+ if (isMultiple && selectedItems) {
134
+ const count = selectedItems.length;
135
+ return count > 0 ? `${count} items selected` : defaultChildren;
136
+ }
137
+ return selectedText;
138
+ }
107
139
  })
108
140
  }),
109
141
  rightElement,
@@ -129,6 +161,7 @@ const Select_Select = ({ backgroundColor, menuBackground, children, fontSize, fo
129
161
  before: before,
130
162
  after: after,
131
163
  menuBackground: menuBackground,
164
+ selectionMode: selectionMode,
132
165
  children: children
133
166
  })
134
167
  })
@@ -98,7 +98,7 @@ export type ComboBoxProps = {
98
98
  onOpenChange?: Combo['onOpenChange'];
99
99
  onInputChange?: Combo['onInputChange'];
100
100
  } & Omit<Combo, 'children' | 'defaultItems' | 'items' | 'onSelectionChange' | 'selectedKey' | 'defaultSelectedKey' | 'defaultInputValue' | 'isOpen' | 'isDisabled' | 'isInvalid' | 'isRequired'>;
101
- type Select = AriaSelectProps<SelectItem>;
101
+ type Select = AriaSelectProps<SelectItem, 'single' | 'multiple'>;
102
102
  export type SelectProps = {
103
103
  autoComplete?: Select['autoComplete'];
104
104
  name?: Select['name'];
@@ -108,10 +108,11 @@ export type SelectProps = {
108
108
  defaultValue?: Select['defaultValue'];
109
109
  autoFocus?: Select['autoFocus'];
110
110
  validationBehavior?: Select['validationBehavior'];
111
+ selectionMode?: Select['selectionMode'];
111
112
  className?: Select['className'];
112
113
  style?: Select['style'];
113
114
  onOpenChange?: Select['onOpenChange'];
114
- } & Omit<Select, 'placeholder' | 'selectionMode' | 'value' | 'children' | 'isOpen' | 'isDisabled' | 'isInvalid' | 'isRequired' | 'defaultSelectedKey' | 'selectionMode' | 'onChange' | 'validate' | 'onSelectionChange'>;
115
+ } & Omit<Select, 'placeholder' | 'value' | 'children' | 'isOpen' | 'isDisabled' | 'isInvalid' | 'isRequired' | 'defaultSelectedKey' | 'selectionMode' | 'onChange' | 'validate' | 'onSelectionChange'>;
115
116
  type MenuProps = AriaMenuProps<ListOption>;
116
117
  export type DropdownMenuProps = {
117
118
  defaultSelectedKeys?: MenuProps['defaultSelectedKeys'];
@@ -43,15 +43,11 @@ export type ListOption<T = ListItem> = T | ListSection<T>;
43
43
  export type SelectItem = Omit<ListItem, 'onClick'>;
44
44
  export type MultiSelectItem = WithRequired<SelectItem, 'id'>;
45
45
  export type MultiSelectOption = ListOption<MultiSelectItem>;
46
- export type SelectInputProps = {
46
+ type BaseSelectInputProps = {
47
47
  /** The option Items to be displayed in the menu */
48
48
  children?: ReactNode;
49
49
  /** The options to be displayed in the menu */
50
50
  options?: ListOption<SelectItem>[];
51
- /** The controlled value of the input */
52
- value?: Key;
53
- /** The uncontrolled initial value of the input */
54
- defaultValue?: Key;
55
51
  /** Allow the selected option to be re-selected */
56
52
  allowRepeatSelection?: boolean;
57
53
  /** Hides the caret icon toggle */
@@ -66,10 +62,24 @@ export type SelectInputProps = {
66
62
  before?: ReactNode;
67
63
  /** The element to display after the menu options */
68
64
  after?: ReactNode;
69
- /** The function to be called when an option is selected */
70
- onChange?: (key: string) => void;
71
65
  maxHeight?: PopoverProps['maxHeight'];
72
66
  } & Omit<InputProps, 'iconRight'> & ShowHideCallbacks & Pick<PopoverProps, 'maxHeight'>;
67
+ export type SelectInputProps = BaseSelectInputProps & {
68
+ /** The controlled value of the input */
69
+ value?: Key | Key[];
70
+ /** The uncontrolled initial value of the input */
71
+ defaultValue?: Key | Key[];
72
+ /** The function to be called when an option is selected */
73
+ onChange?: (key: string | string[]) => void;
74
+ };
75
+ export type ComboBoxInputProps = BaseSelectInputProps & {
76
+ /** The controlled value of the input */
77
+ value?: Key;
78
+ /** The uncontrolled initial value of the input */
79
+ defaultValue?: Key;
80
+ /** The function to be called when an option is selected */
81
+ onChange?: (key: string) => void;
82
+ };
73
83
  export type CalendarBaseProps = {
74
84
  /** Prevents selection of dates in the past (relative to the set date or current date). */
75
85
  preventPast?: boolean | Date;
@@ -82,3 +92,4 @@ export type DateInputProps = {
82
92
  /** Hides the calendar picker icon */
83
93
  hidePicker?: boolean;
84
94
  } & ShowHideCallbacks & Omit<CalendarBaseProps, 'noShadow'> & Omit<InputProps, 'placeholder'>;
95
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "2.4.8-alpha.1",
3
+ "version": "2.4.8-alpha.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {