@parrot-co/parrot-ui 1.0.0-beta.1 → 1.0.0-beta.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.
- package/dist/index.d.mts +62 -6
- package/dist/index.d.ts +62 -6
- package/dist/index.js +217 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -4
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +77 -0
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import * as react_aria_components from 'react-aria-components';
|
|
4
|
-
import { TextFieldProps, NumberFieldProps, ButtonProps as ButtonProps$1, ToggleButtonProps as ToggleButtonProps$1, CheckboxFieldProps, CheckboxGroupProps as CheckboxGroupProps$1, MenuTriggerProps as MenuTriggerProps$1, MenuProps as MenuProps$1, Placement, MenuItemProps as MenuItemProps$1, MenuSectionProps as MenuSectionProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps as ListBoxItemProps$1, ListBoxSectionProps as ListBoxSectionProps$1, RadioFieldProps, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, CalendarProps as CalendarProps$1, DateValue, RangeCalendarProps as RangeCalendarProps$1, DateFieldProps as DateFieldProps$1, TimeFieldProps as TimeFieldProps$1, TimeValue, DatePickerProps as DatePickerProps$1, DateRangePickerProps as DateRangePickerProps$1, ProgressBarProps, SwitchFieldProps, SliderProps as SliderProps$1,
|
|
5
|
-
import { OverlayTriggerProps } from 'react-stately';
|
|
4
|
+
import { TextFieldProps, NumberFieldProps, ButtonProps as ButtonProps$1, ToggleButtonProps as ToggleButtonProps$1, CheckboxFieldProps, CheckboxGroupProps as CheckboxGroupProps$1, MenuTriggerProps as MenuTriggerProps$1, MenuProps as MenuProps$1, Placement, MenuItemProps as MenuItemProps$1, MenuSectionProps as MenuSectionProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps as ListBoxItemProps$1, ListBoxSectionProps as ListBoxSectionProps$1, RadioFieldProps, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, Key, CalendarProps as CalendarProps$1, DateValue, RangeCalendarProps as RangeCalendarProps$1, DateFieldProps as DateFieldProps$1, TimeFieldProps as TimeFieldProps$1, TimeValue, DatePickerProps as DatePickerProps$1, DateRangePickerProps as DateRangePickerProps$1, ProgressBarProps, SwitchFieldProps, SliderProps as SliderProps$1, TabsProps as TabsProps$1, Selection, SortDescriptor, ModalOverlayProps, PopoverProps as PopoverProps$1, TagGroupProps as TagGroupProps$1, TagListProps, TagProps as TagProps$1, Color as Color$1, ColorAreaProps as ColorAreaProps$1, ColorFieldProps as ColorFieldProps$1, ColorSwatchPickerProps as ColorSwatchPickerProps$1, ColorSliderProps as ColorSliderProps$1, TooltipProps as TooltipProps$1 } from 'react-aria-components';
|
|
5
|
+
import { SectionProps, ItemProps, OverlayTriggerProps } from 'react-stately';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Open registry of valid `color` values. Consumers extend it via module
|
|
@@ -84,9 +84,14 @@ type Appearance = "light" | "dark";
|
|
|
84
84
|
type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
85
85
|
type SizeOption = "none" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
86
86
|
|
|
87
|
+
type Maybe<T> = T | null | undefined;
|
|
87
88
|
type ActionStatus = "idle" | "loading" | "success" | "error";
|
|
88
89
|
type Dict<T = unknown> = Record<string, T>;
|
|
89
90
|
type ID = string | number;
|
|
91
|
+
type SectionElement<T> = React.ReactElement<SectionProps<T>>;
|
|
92
|
+
type ItemElement<T> = React.ReactElement<ItemProps<T>>;
|
|
93
|
+
type CollectionElement<T> = SectionElement<T> | ItemElement<T>;
|
|
94
|
+
type CollectionChildren<T> = CollectionElement<T> | CollectionElement<T>[] | ((item: T) => CollectionElement<T>);
|
|
90
95
|
type Breakpoints = "base" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
91
96
|
interface StyleProps<S extends string = string> {
|
|
92
97
|
/** Use this to add classes to the component. you can also use the `className` prop. But i won't recommend to use both at the same time. */
|
|
@@ -99,8 +104,12 @@ interface StyleProps<S extends string = string> {
|
|
|
99
104
|
type ResponsiveProp<T> = T | {
|
|
100
105
|
[K in Breakpoints]?: T;
|
|
101
106
|
};
|
|
107
|
+
interface ColorProps {
|
|
108
|
+
color?: Color;
|
|
109
|
+
variant?: ColorVariant;
|
|
110
|
+
}
|
|
102
111
|
|
|
103
|
-
type FieldProps<S extends string> = InputProps & StyleProps<S | "wrapper" | "label" | "input" | "description"> & {
|
|
112
|
+
type FieldProps<S extends string> = InputProps & StyleProps<S | "wrapper" | "control" | "label" | "input" | "description"> & {
|
|
104
113
|
children?: React__default.ReactNode;
|
|
105
114
|
replaceDefaultControlWrapper?: boolean;
|
|
106
115
|
};
|
|
@@ -135,6 +144,47 @@ type NumberInputProps = Omit<NumberFieldProps, "className" | "style" | "children
|
|
|
135
144
|
};
|
|
136
145
|
declare function NumberInput({ appearance, size, color, classNames, styles, append, prepend, placeholder, showSteppers, error, label, description, incrementIcon, decrementIcon, inputRef, wrapperRef, validationStatus, shape, radius, ...props }: NumberInputProps): React$1.JSX.Element;
|
|
137
146
|
|
|
147
|
+
declare function PasswordInput({ wrapperRef, ...props }: TextInputProps): React__default.JSX.Element;
|
|
148
|
+
|
|
149
|
+
type PinInputType = "numeric" | "alphanumeric" | "all";
|
|
150
|
+
type PinInputProps = Omit<FieldComponentProps<"input" | "control" | "group" | "slot">, "prepend" | "append" | "shape"> & {
|
|
151
|
+
value?: string;
|
|
152
|
+
defaultValue?: string;
|
|
153
|
+
onChange?: (value: string) => void;
|
|
154
|
+
onComplete?: (value: string) => void;
|
|
155
|
+
/** Number of characters. Alias: `maxLength`. Defaults to 6. */
|
|
156
|
+
length?: number;
|
|
157
|
+
maxLength?: number;
|
|
158
|
+
type?: PinInputType;
|
|
159
|
+
/** Overrides `type`'s value filter. A `^...$` anchored source is expected. */
|
|
160
|
+
pattern?: RegExp;
|
|
161
|
+
/** Render each filled slot as a dot instead of the character. */
|
|
162
|
+
mask?: boolean;
|
|
163
|
+
/** Placeholder character shown in empty slots. */
|
|
164
|
+
placeholder?: string;
|
|
165
|
+
isReadOnly?: boolean;
|
|
166
|
+
autoFocus?: boolean;
|
|
167
|
+
name?: string;
|
|
168
|
+
/** Auto-render mode only: split slots into groups of this size. */
|
|
169
|
+
groupSize?: number;
|
|
170
|
+
/** Auto-render mode only: node rendered between groups. */
|
|
171
|
+
separator?: React$1.ReactNode;
|
|
172
|
+
children?: React$1.ReactNode;
|
|
173
|
+
};
|
|
174
|
+
declare function PinInput({ value, defaultValue, onChange, onComplete, length, maxLength, type, pattern, mask, placeholder, isReadOnly, autoFocus, name, groupSize, separator, children, inputRef: inputRefProp, classNames, styles, ...fieldProps }: PinInputProps): React$1.JSX.Element;
|
|
175
|
+
interface PinInputGroupProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
176
|
+
_SILENCE_TS?: boolean;
|
|
177
|
+
}
|
|
178
|
+
declare function PinInputGroup({ className, ...props }: PinInputGroupProps): React$1.JSX.Element;
|
|
179
|
+
interface PinInputSlotProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
180
|
+
index: number;
|
|
181
|
+
}
|
|
182
|
+
declare function PinInputSlot({ index, className, ...props }: PinInputSlotProps): React$1.JSX.Element;
|
|
183
|
+
interface PinInputSeparatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
184
|
+
_SILENCE_TS?: boolean;
|
|
185
|
+
}
|
|
186
|
+
declare function PinInputSeparator({ className, children, ...props }: PinInputSeparatorProps): React$1.JSX.Element;
|
|
187
|
+
|
|
138
188
|
type TextWeight = "light" | "regular" | "medium" | "semi-bold" | "bold" | "heavy" | "inherit";
|
|
139
189
|
type TextColorVariant = "light" | "lighter" | "dark" | "default";
|
|
140
190
|
interface TextProps extends Omit<React$1.ComponentPropsWithRef<"span">, "color"> {
|
|
@@ -374,7 +424,8 @@ interface RadioItemProps extends Omit<RadioFieldProps, "className" | "style" | "
|
|
|
374
424
|
declare function RadioItem({ className, style, classNames, styles, children, ...props }: RadioItemProps): React$1.JSX.Element;
|
|
375
425
|
|
|
376
426
|
type SelectionMode = "single" | "multiple";
|
|
377
|
-
|
|
427
|
+
type SelectionValue<M extends SelectionMode> = M extends "multiple" ? Key[] : Key | null;
|
|
428
|
+
interface SelectProps<T extends object, M extends SelectionMode = "single"> extends Omit<SelectProps$1<T, M>, "className" | "style" | "children" | "isInvalid" | "selectedKey" | "defaultSelectedKey" | "selectedKeys" | "defaultSelectedKeys" | "onSelectionChange" | "onChange" | "value" | "defaultValue">, Pick<ListBoxProps<T>, "items" | "labelKey" | "valueKey" | "sectionKey" | "renderOption" | "renderSectionLabel" | "disabledKeys" | "children">, StyleProps<"wrapper" | "trigger" | "value" | "placeholder" | "label" | "popover"> {
|
|
378
429
|
label?: React$1.ReactNode;
|
|
379
430
|
description?: React$1.ReactNode;
|
|
380
431
|
error?: React$1.ReactNode;
|
|
@@ -386,8 +437,13 @@ interface SelectProps<T extends object, M extends SelectionMode = "single"> exte
|
|
|
386
437
|
showSectionSeparator?: boolean;
|
|
387
438
|
showSelectionIndicator?: boolean;
|
|
388
439
|
renderValue?: (value: T) => React$1.ReactNode;
|
|
440
|
+
/** Selected key(s). `Key[]` when `selectionMode="multiple"`, else `Key | null`. */
|
|
441
|
+
value?: SelectionValue<M>;
|
|
442
|
+
defaultValue?: SelectionValue<M>;
|
|
443
|
+
/** Fires with the selected `Key[]` (multiple) or `Key | null` (single). */
|
|
444
|
+
onChange?: (value: SelectionValue<M>) => void;
|
|
389
445
|
}
|
|
390
|
-
declare function Select<T extends object, M extends SelectionMode = "single">({ label, description, error, placeholder, appearance, renderValue, color, size, radius, listBoxColor, showSectionSeparator, showSelectionIndicator, items, children, labelKey, valueKey, sectionKey, renderOption, renderSectionLabel, disabledKeys, className, classNames, style, styles, "aria-label": ariaLabel, ...racProps }: SelectProps<T, M>): React$1.JSX.Element;
|
|
446
|
+
declare function Select<T extends object, M extends SelectionMode = "single">({ label, description, error, placeholder, appearance, renderValue, color, size, radius, listBoxColor, showSectionSeparator, showSelectionIndicator, items, children, labelKey, valueKey, sectionKey, renderOption, renderSectionLabel, disabledKeys, className, classNames, style, styles, value, defaultValue, onChange, "aria-label": ariaLabel, ...racProps }: SelectProps<T, M>): React$1.JSX.Element;
|
|
391
447
|
|
|
392
448
|
interface CalendarProps extends Omit<CalendarProps$1<DateValue>, "className" | "style" | "children" | "visibleDuration"> {
|
|
393
449
|
numberOfMonths?: number;
|
|
@@ -929,4 +985,4 @@ declare function pattern<T>(regex: RegExp, message?: string): FieldValidator<T>;
|
|
|
929
985
|
declare function matches<T>(fieldName: keyof T & string, message?: string): FieldValidator<T>;
|
|
930
986
|
declare function compose<T>(...fns: Array<FieldValidator<T>>): FieldValidator<T>;
|
|
931
987
|
|
|
932
|
-
export { Avatar, AvatarGroup, type BaseModalProps, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, CheckboxItem, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatchPicker, ComboBox, type CustomToastRender, DateField, DatePicker, DateRangePicker, type FieldValidator, FileUploader, HoverCard, type HoverCardProps, IconButton, Input, ListBox, ListBoxItem, ListBoxSection, Loader, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Modal, type ModalControls, type ModalDef, type ModalInputProps, type ModalKey, type ModalProps, ModalProvider, type ModalProviderProps, type ModalRegistry, type ModalResult, NumberInput, ListBoxItem as Option, type ParrotModalRegistry, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioCard, RadioGroup, RadioItem, RangeCalendar, ListBoxSection as Section, Select, Separator, Slider, Space, Sticker, Switch, Tab, Table, Tabs, Tag, TagGroup, TagGroupItem, TagInput, Text, Textarea, ThemeProvider, TimeField, Timeline, type ToastAction, type ToastOptions, type ToastPosition, ToastRegion, type ToastRegionProps, type ToastVariant, Toggle, ToggleButton, ToggleGroup, Tooltip, type TooltipProps, type UseFormOptions, type UseFormReturn, compose, email, matches, max, maxLength, min, minLength, parseColor, pattern, required, toast, useForm, useModal, useModals, useTheme };
|
|
988
|
+
export { type ActionStatus, type Appearance, Avatar, AvatarGroup, type BaseModalProps, type Breakpoints, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, CheckboxItem, type CollectionChildren, type CollectionElement, type Color, ColorArea, ColorField, ColorPicker, type ColorProps, ColorSlider, ColorSwatchPicker, type ColorVariant, ComboBox, type ControlSize, type CustomToastRender, DateField, DatePicker, DateRangePicker, type Dict, type FieldValidator, FileUploader, HoverCard, type HoverCardProps, type ID, IconButton, Input, type InputAppearance, type ItemElement, ListBox, ListBoxItem, ListBoxSection, Loader, type Maybe, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Modal, type ModalControls, type ModalDef, type ModalInputProps, type ModalKey, type ModalProps, ModalProvider, type ModalProviderProps, type ModalRegistry, type ModalResult, NumberInput, ListBoxItem as Option, type ParrotColorRegistry, type ParrotModalRegistry, type ParrotVariantRegistry, PasswordInput, PinInput, PinInputGroup, type PinInputGroupProps, type PinInputProps, PinInputSeparator, type PinInputSeparatorProps, PinInputSlot, type PinInputSlotProps, type PinInputType, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioCard, RadioGroup, RadioItem, type Radius, RangeCalendar, type ResponsiveProp, ListBoxSection as Section, type SectionElement, Select, Separator, type Size, Slider, Space, Sticker, type StyleProps, Switch, Tab, Table, Tabs, Tag, TagGroup, TagGroupItem, TagInput, Text, Textarea, ThemeProvider, TimeField, Timeline, type ToastAction, type ToastOptions, type ToastPosition, ToastRegion, type ToastRegionProps, type ToastVariant, Toggle, ToggleButton, ToggleGroup, Tooltip, type TooltipProps, type UseFormOptions, type UseFormReturn, type Variant, compose, email, matches, max, maxLength, min, minLength, parseColor, pattern, required, toast, useForm, useModal, useModals, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import * as react_aria_components from 'react-aria-components';
|
|
4
|
-
import { TextFieldProps, NumberFieldProps, ButtonProps as ButtonProps$1, ToggleButtonProps as ToggleButtonProps$1, CheckboxFieldProps, CheckboxGroupProps as CheckboxGroupProps$1, MenuTriggerProps as MenuTriggerProps$1, MenuProps as MenuProps$1, Placement, MenuItemProps as MenuItemProps$1, MenuSectionProps as MenuSectionProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps as ListBoxItemProps$1, ListBoxSectionProps as ListBoxSectionProps$1, RadioFieldProps, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, CalendarProps as CalendarProps$1, DateValue, RangeCalendarProps as RangeCalendarProps$1, DateFieldProps as DateFieldProps$1, TimeFieldProps as TimeFieldProps$1, TimeValue, DatePickerProps as DatePickerProps$1, DateRangePickerProps as DateRangePickerProps$1, ProgressBarProps, SwitchFieldProps, SliderProps as SliderProps$1,
|
|
5
|
-
import { OverlayTriggerProps } from 'react-stately';
|
|
4
|
+
import { TextFieldProps, NumberFieldProps, ButtonProps as ButtonProps$1, ToggleButtonProps as ToggleButtonProps$1, CheckboxFieldProps, CheckboxGroupProps as CheckboxGroupProps$1, MenuTriggerProps as MenuTriggerProps$1, MenuProps as MenuProps$1, Placement, MenuItemProps as MenuItemProps$1, MenuSectionProps as MenuSectionProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps as ListBoxItemProps$1, ListBoxSectionProps as ListBoxSectionProps$1, RadioFieldProps, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, Key, CalendarProps as CalendarProps$1, DateValue, RangeCalendarProps as RangeCalendarProps$1, DateFieldProps as DateFieldProps$1, TimeFieldProps as TimeFieldProps$1, TimeValue, DatePickerProps as DatePickerProps$1, DateRangePickerProps as DateRangePickerProps$1, ProgressBarProps, SwitchFieldProps, SliderProps as SliderProps$1, TabsProps as TabsProps$1, Selection, SortDescriptor, ModalOverlayProps, PopoverProps as PopoverProps$1, TagGroupProps as TagGroupProps$1, TagListProps, TagProps as TagProps$1, Color as Color$1, ColorAreaProps as ColorAreaProps$1, ColorFieldProps as ColorFieldProps$1, ColorSwatchPickerProps as ColorSwatchPickerProps$1, ColorSliderProps as ColorSliderProps$1, TooltipProps as TooltipProps$1 } from 'react-aria-components';
|
|
5
|
+
import { SectionProps, ItemProps, OverlayTriggerProps } from 'react-stately';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Open registry of valid `color` values. Consumers extend it via module
|
|
@@ -84,9 +84,14 @@ type Appearance = "light" | "dark";
|
|
|
84
84
|
type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
85
85
|
type SizeOption = "none" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
86
86
|
|
|
87
|
+
type Maybe<T> = T | null | undefined;
|
|
87
88
|
type ActionStatus = "idle" | "loading" | "success" | "error";
|
|
88
89
|
type Dict<T = unknown> = Record<string, T>;
|
|
89
90
|
type ID = string | number;
|
|
91
|
+
type SectionElement<T> = React.ReactElement<SectionProps<T>>;
|
|
92
|
+
type ItemElement<T> = React.ReactElement<ItemProps<T>>;
|
|
93
|
+
type CollectionElement<T> = SectionElement<T> | ItemElement<T>;
|
|
94
|
+
type CollectionChildren<T> = CollectionElement<T> | CollectionElement<T>[] | ((item: T) => CollectionElement<T>);
|
|
90
95
|
type Breakpoints = "base" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
91
96
|
interface StyleProps<S extends string = string> {
|
|
92
97
|
/** Use this to add classes to the component. you can also use the `className` prop. But i won't recommend to use both at the same time. */
|
|
@@ -99,8 +104,12 @@ interface StyleProps<S extends string = string> {
|
|
|
99
104
|
type ResponsiveProp<T> = T | {
|
|
100
105
|
[K in Breakpoints]?: T;
|
|
101
106
|
};
|
|
107
|
+
interface ColorProps {
|
|
108
|
+
color?: Color;
|
|
109
|
+
variant?: ColorVariant;
|
|
110
|
+
}
|
|
102
111
|
|
|
103
|
-
type FieldProps<S extends string> = InputProps & StyleProps<S | "wrapper" | "label" | "input" | "description"> & {
|
|
112
|
+
type FieldProps<S extends string> = InputProps & StyleProps<S | "wrapper" | "control" | "label" | "input" | "description"> & {
|
|
104
113
|
children?: React__default.ReactNode;
|
|
105
114
|
replaceDefaultControlWrapper?: boolean;
|
|
106
115
|
};
|
|
@@ -135,6 +144,47 @@ type NumberInputProps = Omit<NumberFieldProps, "className" | "style" | "children
|
|
|
135
144
|
};
|
|
136
145
|
declare function NumberInput({ appearance, size, color, classNames, styles, append, prepend, placeholder, showSteppers, error, label, description, incrementIcon, decrementIcon, inputRef, wrapperRef, validationStatus, shape, radius, ...props }: NumberInputProps): React$1.JSX.Element;
|
|
137
146
|
|
|
147
|
+
declare function PasswordInput({ wrapperRef, ...props }: TextInputProps): React__default.JSX.Element;
|
|
148
|
+
|
|
149
|
+
type PinInputType = "numeric" | "alphanumeric" | "all";
|
|
150
|
+
type PinInputProps = Omit<FieldComponentProps<"input" | "control" | "group" | "slot">, "prepend" | "append" | "shape"> & {
|
|
151
|
+
value?: string;
|
|
152
|
+
defaultValue?: string;
|
|
153
|
+
onChange?: (value: string) => void;
|
|
154
|
+
onComplete?: (value: string) => void;
|
|
155
|
+
/** Number of characters. Alias: `maxLength`. Defaults to 6. */
|
|
156
|
+
length?: number;
|
|
157
|
+
maxLength?: number;
|
|
158
|
+
type?: PinInputType;
|
|
159
|
+
/** Overrides `type`'s value filter. A `^...$` anchored source is expected. */
|
|
160
|
+
pattern?: RegExp;
|
|
161
|
+
/** Render each filled slot as a dot instead of the character. */
|
|
162
|
+
mask?: boolean;
|
|
163
|
+
/** Placeholder character shown in empty slots. */
|
|
164
|
+
placeholder?: string;
|
|
165
|
+
isReadOnly?: boolean;
|
|
166
|
+
autoFocus?: boolean;
|
|
167
|
+
name?: string;
|
|
168
|
+
/** Auto-render mode only: split slots into groups of this size. */
|
|
169
|
+
groupSize?: number;
|
|
170
|
+
/** Auto-render mode only: node rendered between groups. */
|
|
171
|
+
separator?: React$1.ReactNode;
|
|
172
|
+
children?: React$1.ReactNode;
|
|
173
|
+
};
|
|
174
|
+
declare function PinInput({ value, defaultValue, onChange, onComplete, length, maxLength, type, pattern, mask, placeholder, isReadOnly, autoFocus, name, groupSize, separator, children, inputRef: inputRefProp, classNames, styles, ...fieldProps }: PinInputProps): React$1.JSX.Element;
|
|
175
|
+
interface PinInputGroupProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
176
|
+
_SILENCE_TS?: boolean;
|
|
177
|
+
}
|
|
178
|
+
declare function PinInputGroup({ className, ...props }: PinInputGroupProps): React$1.JSX.Element;
|
|
179
|
+
interface PinInputSlotProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
180
|
+
index: number;
|
|
181
|
+
}
|
|
182
|
+
declare function PinInputSlot({ index, className, ...props }: PinInputSlotProps): React$1.JSX.Element;
|
|
183
|
+
interface PinInputSeparatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
184
|
+
_SILENCE_TS?: boolean;
|
|
185
|
+
}
|
|
186
|
+
declare function PinInputSeparator({ className, children, ...props }: PinInputSeparatorProps): React$1.JSX.Element;
|
|
187
|
+
|
|
138
188
|
type TextWeight = "light" | "regular" | "medium" | "semi-bold" | "bold" | "heavy" | "inherit";
|
|
139
189
|
type TextColorVariant = "light" | "lighter" | "dark" | "default";
|
|
140
190
|
interface TextProps extends Omit<React$1.ComponentPropsWithRef<"span">, "color"> {
|
|
@@ -374,7 +424,8 @@ interface RadioItemProps extends Omit<RadioFieldProps, "className" | "style" | "
|
|
|
374
424
|
declare function RadioItem({ className, style, classNames, styles, children, ...props }: RadioItemProps): React$1.JSX.Element;
|
|
375
425
|
|
|
376
426
|
type SelectionMode = "single" | "multiple";
|
|
377
|
-
|
|
427
|
+
type SelectionValue<M extends SelectionMode> = M extends "multiple" ? Key[] : Key | null;
|
|
428
|
+
interface SelectProps<T extends object, M extends SelectionMode = "single"> extends Omit<SelectProps$1<T, M>, "className" | "style" | "children" | "isInvalid" | "selectedKey" | "defaultSelectedKey" | "selectedKeys" | "defaultSelectedKeys" | "onSelectionChange" | "onChange" | "value" | "defaultValue">, Pick<ListBoxProps<T>, "items" | "labelKey" | "valueKey" | "sectionKey" | "renderOption" | "renderSectionLabel" | "disabledKeys" | "children">, StyleProps<"wrapper" | "trigger" | "value" | "placeholder" | "label" | "popover"> {
|
|
378
429
|
label?: React$1.ReactNode;
|
|
379
430
|
description?: React$1.ReactNode;
|
|
380
431
|
error?: React$1.ReactNode;
|
|
@@ -386,8 +437,13 @@ interface SelectProps<T extends object, M extends SelectionMode = "single"> exte
|
|
|
386
437
|
showSectionSeparator?: boolean;
|
|
387
438
|
showSelectionIndicator?: boolean;
|
|
388
439
|
renderValue?: (value: T) => React$1.ReactNode;
|
|
440
|
+
/** Selected key(s). `Key[]` when `selectionMode="multiple"`, else `Key | null`. */
|
|
441
|
+
value?: SelectionValue<M>;
|
|
442
|
+
defaultValue?: SelectionValue<M>;
|
|
443
|
+
/** Fires with the selected `Key[]` (multiple) or `Key | null` (single). */
|
|
444
|
+
onChange?: (value: SelectionValue<M>) => void;
|
|
389
445
|
}
|
|
390
|
-
declare function Select<T extends object, M extends SelectionMode = "single">({ label, description, error, placeholder, appearance, renderValue, color, size, radius, listBoxColor, showSectionSeparator, showSelectionIndicator, items, children, labelKey, valueKey, sectionKey, renderOption, renderSectionLabel, disabledKeys, className, classNames, style, styles, "aria-label": ariaLabel, ...racProps }: SelectProps<T, M>): React$1.JSX.Element;
|
|
446
|
+
declare function Select<T extends object, M extends SelectionMode = "single">({ label, description, error, placeholder, appearance, renderValue, color, size, radius, listBoxColor, showSectionSeparator, showSelectionIndicator, items, children, labelKey, valueKey, sectionKey, renderOption, renderSectionLabel, disabledKeys, className, classNames, style, styles, value, defaultValue, onChange, "aria-label": ariaLabel, ...racProps }: SelectProps<T, M>): React$1.JSX.Element;
|
|
391
447
|
|
|
392
448
|
interface CalendarProps extends Omit<CalendarProps$1<DateValue>, "className" | "style" | "children" | "visibleDuration"> {
|
|
393
449
|
numberOfMonths?: number;
|
|
@@ -929,4 +985,4 @@ declare function pattern<T>(regex: RegExp, message?: string): FieldValidator<T>;
|
|
|
929
985
|
declare function matches<T>(fieldName: keyof T & string, message?: string): FieldValidator<T>;
|
|
930
986
|
declare function compose<T>(...fns: Array<FieldValidator<T>>): FieldValidator<T>;
|
|
931
987
|
|
|
932
|
-
export { Avatar, AvatarGroup, type BaseModalProps, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, CheckboxItem, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatchPicker, ComboBox, type CustomToastRender, DateField, DatePicker, DateRangePicker, type FieldValidator, FileUploader, HoverCard, type HoverCardProps, IconButton, Input, ListBox, ListBoxItem, ListBoxSection, Loader, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Modal, type ModalControls, type ModalDef, type ModalInputProps, type ModalKey, type ModalProps, ModalProvider, type ModalProviderProps, type ModalRegistry, type ModalResult, NumberInput, ListBoxItem as Option, type ParrotModalRegistry, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioCard, RadioGroup, RadioItem, RangeCalendar, ListBoxSection as Section, Select, Separator, Slider, Space, Sticker, Switch, Tab, Table, Tabs, Tag, TagGroup, TagGroupItem, TagInput, Text, Textarea, ThemeProvider, TimeField, Timeline, type ToastAction, type ToastOptions, type ToastPosition, ToastRegion, type ToastRegionProps, type ToastVariant, Toggle, ToggleButton, ToggleGroup, Tooltip, type TooltipProps, type UseFormOptions, type UseFormReturn, compose, email, matches, max, maxLength, min, minLength, parseColor, pattern, required, toast, useForm, useModal, useModals, useTheme };
|
|
988
|
+
export { type ActionStatus, type Appearance, Avatar, AvatarGroup, type BaseModalProps, type Breakpoints, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, CheckboxItem, type CollectionChildren, type CollectionElement, type Color, ColorArea, ColorField, ColorPicker, type ColorProps, ColorSlider, ColorSwatchPicker, type ColorVariant, ComboBox, type ControlSize, type CustomToastRender, DateField, DatePicker, DateRangePicker, type Dict, type FieldValidator, FileUploader, HoverCard, type HoverCardProps, type ID, IconButton, Input, type InputAppearance, type ItemElement, ListBox, ListBoxItem, ListBoxSection, Loader, type Maybe, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Modal, type ModalControls, type ModalDef, type ModalInputProps, type ModalKey, type ModalProps, ModalProvider, type ModalProviderProps, type ModalRegistry, type ModalResult, NumberInput, ListBoxItem as Option, type ParrotColorRegistry, type ParrotModalRegistry, type ParrotVariantRegistry, PasswordInput, PinInput, PinInputGroup, type PinInputGroupProps, type PinInputProps, PinInputSeparator, type PinInputSeparatorProps, PinInputSlot, type PinInputSlotProps, type PinInputType, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioCard, RadioGroup, RadioItem, type Radius, RangeCalendar, type ResponsiveProp, ListBoxSection as Section, type SectionElement, Select, Separator, type Size, Slider, Space, Sticker, type StyleProps, Switch, Tab, Table, Tabs, Tag, TagGroup, TagGroupItem, TagInput, Text, Textarea, ThemeProvider, TimeField, Timeline, type ToastAction, type ToastOptions, type ToastPosition, ToastRegion, type ToastRegionProps, type ToastVariant, Toggle, ToggleButton, ToggleGroup, Tooltip, type TooltipProps, type UseFormOptions, type UseFormReturn, type Variant, compose, email, matches, max, maxLength, min, minLength, parseColor, pattern, required, toast, useForm, useModal, useModals, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React13 = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var inputOtp = require('input-otp');
|
|
5
6
|
var date = require('@internationalized/date');
|
|
6
7
|
var reactStately = require('react-stately');
|
|
7
8
|
var reactDom = require('react-dom');
|
|
@@ -484,8 +485,10 @@ function Field({
|
|
|
484
485
|
ref: groupRef,
|
|
485
486
|
className: cn(
|
|
486
487
|
"prt-input-control relative inline-flex w-full items-center",
|
|
487
|
-
space.classNames
|
|
488
|
+
space.classNames,
|
|
489
|
+
classNames?.control
|
|
488
490
|
),
|
|
491
|
+
style: styles?.control,
|
|
489
492
|
"data-has-error": !!error,
|
|
490
493
|
"data-appearance": resolvedAppearance,
|
|
491
494
|
"data-disabled": isDisabled
|
|
@@ -932,6 +935,9 @@ function HiChevronRight({ size = "1em", ...props }) {
|
|
|
932
935
|
function HiChevronUp({ size = "1em", ...props }) {
|
|
933
936
|
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { fillRule: "evenodd", d: "M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 010 1.414z", clipRule: "evenodd" }));
|
|
934
937
|
}
|
|
938
|
+
function HiEye({ size = "1em", ...props }) {
|
|
939
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }), /* @__PURE__ */ React13__namespace.createElement("path", { fillRule: "evenodd", d: "M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z", clipRule: "evenodd" }));
|
|
940
|
+
}
|
|
935
941
|
function HiOutlineCalendar({ size = "1em", ...props }) {
|
|
936
942
|
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }));
|
|
937
943
|
}
|
|
@@ -963,6 +969,198 @@ function HiX({ size = "1em", ...props }) {
|
|
|
963
969
|
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }));
|
|
964
970
|
}
|
|
965
971
|
|
|
972
|
+
// src/components/input/password-input.tsx
|
|
973
|
+
function PasswordInput({ wrapperRef, ...props }) {
|
|
974
|
+
const [showPassword, setShowPassword] = React13__namespace.default.useState(false);
|
|
975
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
976
|
+
Input,
|
|
977
|
+
{
|
|
978
|
+
wrapperRef,
|
|
979
|
+
...props,
|
|
980
|
+
type: showPassword ? "text" : "password",
|
|
981
|
+
append: /* @__PURE__ */ React13__namespace.default.createElement(
|
|
982
|
+
IconButton,
|
|
983
|
+
{
|
|
984
|
+
onPress: () => setShowPassword((p) => !p),
|
|
985
|
+
size: "sm",
|
|
986
|
+
variant: "light"
|
|
987
|
+
},
|
|
988
|
+
/* @__PURE__ */ React13__namespace.default.createElement(HiEye, { size: 16 })
|
|
989
|
+
)
|
|
990
|
+
}
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
var PATTERNS = {
|
|
994
|
+
numeric: inputOtp.REGEXP_ONLY_DIGITS,
|
|
995
|
+
alphanumeric: inputOtp.REGEXP_ONLY_DIGITS_AND_CHARS,
|
|
996
|
+
all: void 0
|
|
997
|
+
};
|
|
998
|
+
var INPUT_MODE = {
|
|
999
|
+
numeric: "numeric",
|
|
1000
|
+
alphanumeric: "text",
|
|
1001
|
+
all: "text"
|
|
1002
|
+
};
|
|
1003
|
+
var PinInputConfigContext = React13__namespace.createContext(null);
|
|
1004
|
+
function usePinInputConfig() {
|
|
1005
|
+
const ctx = React13__namespace.useContext(PinInputConfigContext);
|
|
1006
|
+
if (!ctx) {
|
|
1007
|
+
throw new Error(
|
|
1008
|
+
"PinInput compound components must be rendered inside <PinInput>"
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
return ctx;
|
|
1012
|
+
}
|
|
1013
|
+
function PinInput({
|
|
1014
|
+
value,
|
|
1015
|
+
defaultValue,
|
|
1016
|
+
onChange,
|
|
1017
|
+
onComplete,
|
|
1018
|
+
length,
|
|
1019
|
+
maxLength: maxLength2,
|
|
1020
|
+
type = "numeric",
|
|
1021
|
+
pattern: pattern2,
|
|
1022
|
+
mask = false,
|
|
1023
|
+
placeholder,
|
|
1024
|
+
isReadOnly = false,
|
|
1025
|
+
autoFocus,
|
|
1026
|
+
name,
|
|
1027
|
+
groupSize,
|
|
1028
|
+
separator,
|
|
1029
|
+
children,
|
|
1030
|
+
inputRef: inputRefProp,
|
|
1031
|
+
classNames,
|
|
1032
|
+
styles,
|
|
1033
|
+
...fieldProps
|
|
1034
|
+
}) {
|
|
1035
|
+
const resolvedMax = maxLength2 ?? length ?? 6;
|
|
1036
|
+
const isDisabled = fieldProps.isDisabled ?? false;
|
|
1037
|
+
const isInvalid = !!fieldProps.error;
|
|
1038
|
+
const isControlled = value !== void 0;
|
|
1039
|
+
const [internalValue, setInternalValue] = React13__namespace.useState(defaultValue ?? "");
|
|
1040
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1041
|
+
function handleChange(next) {
|
|
1042
|
+
if (!isControlled) setInternalValue(next);
|
|
1043
|
+
onChange?.(next);
|
|
1044
|
+
}
|
|
1045
|
+
const config = React13__namespace.useMemo(
|
|
1046
|
+
() => ({ mask, placeholder, isDisabled, isInvalid }),
|
|
1047
|
+
[mask, placeholder, isDisabled, isInvalid]
|
|
1048
|
+
);
|
|
1049
|
+
const fieldError = React13__namespace.useMemo(
|
|
1050
|
+
() => ({
|
|
1051
|
+
isInvalid,
|
|
1052
|
+
validationErrors: [],
|
|
1053
|
+
validationDetails: {}
|
|
1054
|
+
}),
|
|
1055
|
+
[isInvalid]
|
|
1056
|
+
);
|
|
1057
|
+
const content = children ?? renderSlots(resolvedMax, groupSize, separator, classNames?.slot);
|
|
1058
|
+
return /* @__PURE__ */ React13__namespace.createElement(PinInputConfigContext.Provider, { value: config }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.FieldErrorContext.Provider, { value: fieldError }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1059
|
+
Field,
|
|
1060
|
+
{
|
|
1061
|
+
...fieldProps,
|
|
1062
|
+
classNames,
|
|
1063
|
+
styles,
|
|
1064
|
+
replaceDefaultControlWrapper: true
|
|
1065
|
+
},
|
|
1066
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1067
|
+
"div",
|
|
1068
|
+
{
|
|
1069
|
+
className: cn("prt-pin", classNames?.control),
|
|
1070
|
+
style: styles?.control,
|
|
1071
|
+
"data-disabled": isDisabled || void 0,
|
|
1072
|
+
"data-invalid": isInvalid || void 0
|
|
1073
|
+
},
|
|
1074
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1075
|
+
inputOtp.OTPInput,
|
|
1076
|
+
{
|
|
1077
|
+
ref: inputRefProp,
|
|
1078
|
+
value: currentValue,
|
|
1079
|
+
onChange: handleChange,
|
|
1080
|
+
onComplete,
|
|
1081
|
+
maxLength: resolvedMax,
|
|
1082
|
+
pattern: pattern2?.source ?? PATTERNS[type],
|
|
1083
|
+
inputMode: INPUT_MODE[type],
|
|
1084
|
+
textAlign: "center",
|
|
1085
|
+
autoComplete: "one-time-code",
|
|
1086
|
+
autoCorrect: "off",
|
|
1087
|
+
autoCapitalize: "off",
|
|
1088
|
+
spellCheck: false,
|
|
1089
|
+
autoFocus,
|
|
1090
|
+
disabled: isDisabled,
|
|
1091
|
+
readOnly: isReadOnly,
|
|
1092
|
+
name,
|
|
1093
|
+
"aria-invalid": isInvalid || void 0,
|
|
1094
|
+
containerClassName: "prt-pin-otp",
|
|
1095
|
+
className: cn("prt-pin-input", classNames?.input),
|
|
1096
|
+
style: styles?.input
|
|
1097
|
+
},
|
|
1098
|
+
content
|
|
1099
|
+
)
|
|
1100
|
+
)
|
|
1101
|
+
)));
|
|
1102
|
+
}
|
|
1103
|
+
function renderSlots(maxLength2, groupSize, separator, slotClassName) {
|
|
1104
|
+
const size = groupSize && groupSize > 0 ? groupSize : maxLength2;
|
|
1105
|
+
const groups = [];
|
|
1106
|
+
for (let i = 0; i < maxLength2; i += size) {
|
|
1107
|
+
groups.push(
|
|
1108
|
+
Array.from({ length: Math.min(size, maxLength2 - i) }, (_, j) => i + j)
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
return groups.map((indices, groupIndex) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, { key: groupIndex }, groupIndex > 0 && /* @__PURE__ */ React13__namespace.createElement(PinInputSeparator, null, separator), /* @__PURE__ */ React13__namespace.createElement(PinInputGroup, null, indices.map((index) => /* @__PURE__ */ React13__namespace.createElement(PinInputSlot, { key: index, index, className: slotClassName })))));
|
|
1112
|
+
}
|
|
1113
|
+
function PinInputGroup({ className, ...props }) {
|
|
1114
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1115
|
+
"div",
|
|
1116
|
+
{
|
|
1117
|
+
className: cn("prt-pin-group", className),
|
|
1118
|
+
"data-slot": "group",
|
|
1119
|
+
...props
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
function PinInputSlot({
|
|
1124
|
+
index,
|
|
1125
|
+
className,
|
|
1126
|
+
...props
|
|
1127
|
+
}) {
|
|
1128
|
+
const { mask, placeholder, isDisabled, isInvalid } = usePinInputConfig();
|
|
1129
|
+
const { slots } = React13__namespace.useContext(inputOtp.OTPInputContext);
|
|
1130
|
+
const slot = slots[index];
|
|
1131
|
+
const char = slot?.char ?? null;
|
|
1132
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
...props,
|
|
1136
|
+
className: cn("prt-pin-slot", className),
|
|
1137
|
+
"data-slot": "slot",
|
|
1138
|
+
"data-active": slot?.isActive || void 0,
|
|
1139
|
+
"data-filled": !!char || void 0,
|
|
1140
|
+
"data-disabled": isDisabled || void 0,
|
|
1141
|
+
"data-invalid": isInvalid || void 0
|
|
1142
|
+
},
|
|
1143
|
+
char !== null ? /* @__PURE__ */ React13__namespace.createElement("span", { className: "prt-pin-char" }, mask ? "\u2022" : char) : placeholder ? /* @__PURE__ */ React13__namespace.createElement("span", { className: "prt-pin-placeholder" }, placeholder) : null,
|
|
1144
|
+
slot?.hasFakeCaret && /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-pin-caret", "aria-hidden": true })
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
function PinInputSeparator({
|
|
1148
|
+
className,
|
|
1149
|
+
children,
|
|
1150
|
+
...props
|
|
1151
|
+
}) {
|
|
1152
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1153
|
+
"div",
|
|
1154
|
+
{
|
|
1155
|
+
className: cn("prt-pin-separator", className),
|
|
1156
|
+
"data-slot": "separator",
|
|
1157
|
+
"aria-hidden": true,
|
|
1158
|
+
...props
|
|
1159
|
+
},
|
|
1160
|
+
children ?? "-"
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
966
1164
|
// src/utils/theme.ts
|
|
967
1165
|
var supportedColors = [
|
|
968
1166
|
"red",
|
|
@@ -1825,14 +2023,25 @@ function Select({
|
|
|
1825
2023
|
classNames,
|
|
1826
2024
|
style,
|
|
1827
2025
|
styles,
|
|
2026
|
+
value,
|
|
2027
|
+
defaultValue,
|
|
2028
|
+
onChange,
|
|
1828
2029
|
"aria-label": ariaLabel,
|
|
1829
2030
|
...racProps
|
|
1830
2031
|
}) {
|
|
1831
2032
|
const theme = useTheme();
|
|
1832
2033
|
const resolvedColor = color ?? theme?.color;
|
|
1833
|
-
const resolvedSize = size ?? theme?.size ?? "
|
|
2034
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
1834
2035
|
const resolvedAppearance = appearance ?? theme?.inputAppearance ?? "outline";
|
|
1835
2036
|
const isMultiple = racProps.selectionMode === "multiple";
|
|
2037
|
+
const selectionProps = {
|
|
2038
|
+
value,
|
|
2039
|
+
defaultValue,
|
|
2040
|
+
onChange: onChange ? (next) => {
|
|
2041
|
+
if (next && typeof next === "object" && "nativeEvent" in next) return;
|
|
2042
|
+
onChange(next);
|
|
2043
|
+
} : void 0
|
|
2044
|
+
};
|
|
1836
2045
|
function labelOf(item) {
|
|
1837
2046
|
if (item == null) return null;
|
|
1838
2047
|
return item[labelKey];
|
|
@@ -1841,6 +2050,7 @@ function Select({
|
|
|
1841
2050
|
reactAriaComponents.Select,
|
|
1842
2051
|
{
|
|
1843
2052
|
...racProps,
|
|
2053
|
+
...selectionProps,
|
|
1844
2054
|
placeholder,
|
|
1845
2055
|
isInvalid: !!error,
|
|
1846
2056
|
"aria-label": ariaLabel ?? (label == null ? placeholder ?? "Select" : void 0),
|
|
@@ -4675,6 +4885,11 @@ exports.Modal = Modal;
|
|
|
4675
4885
|
exports.ModalProvider = ModalProvider;
|
|
4676
4886
|
exports.NumberInput = NumberInput;
|
|
4677
4887
|
exports.Option = ListBoxItem;
|
|
4888
|
+
exports.PasswordInput = PasswordInput;
|
|
4889
|
+
exports.PinInput = PinInput;
|
|
4890
|
+
exports.PinInputGroup = PinInputGroup;
|
|
4891
|
+
exports.PinInputSeparator = PinInputSeparator;
|
|
4892
|
+
exports.PinInputSlot = PinInputSlot;
|
|
4678
4893
|
exports.Popover = Popover;
|
|
4679
4894
|
exports.PopoverContent = PopoverContent;
|
|
4680
4895
|
exports.PopoverTrigger = PopoverTrigger;
|