@vinyasa/form 1.0.22 → 1.0.23

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.
Files changed (140) hide show
  1. package/dist/cjs/autocomplete.cjs +709 -309
  2. package/dist/cjs/autocomplete.css +1 -1
  3. package/dist/cjs/checkbox.cjs +399 -244
  4. package/dist/cjs/checkbox.css +5 -1
  5. package/dist/cjs/color-picker.cjs +478 -325
  6. package/dist/cjs/color-picker.css +1 -1
  7. package/dist/cjs/combobox.cjs +574 -359
  8. package/dist/cjs/combobox.css +1 -1
  9. package/dist/cjs/date-picker.cjs +522 -322
  10. package/dist/cjs/date-picker.css +1 -1
  11. package/dist/cjs/dropzone.cjs +562 -391
  12. package/dist/cjs/dropzone.css +1 -1
  13. package/dist/cjs/field.cjs +353 -0
  14. package/dist/cjs/field.css +139 -0
  15. package/dist/cjs/file-upload.cjs +667 -380
  16. package/dist/cjs/file-upload.css +44 -1
  17. package/dist/cjs/index.cjs +3066 -2546
  18. package/dist/cjs/index.css +9 -1
  19. package/dist/cjs/input.cjs +220 -74
  20. package/dist/cjs/input.css +1 -1
  21. package/dist/cjs/multi-select.cjs +756 -400
  22. package/dist/cjs/multi-select.css +1 -1
  23. package/dist/cjs/number-input.cjs +267 -125
  24. package/dist/cjs/number-input.css +1 -1
  25. package/dist/cjs/otp-input.cjs +232 -85
  26. package/dist/cjs/otp-input.css +1 -1
  27. package/dist/cjs/password-input.cjs +239 -93
  28. package/dist/cjs/password-input.css +1 -1
  29. package/dist/cjs/radio-group.cjs +388 -246
  30. package/dist/cjs/radio-group.css +1 -1
  31. package/dist/cjs/range-slider.cjs +106 -62
  32. package/dist/cjs/rich-text-editor.cjs +549 -517
  33. package/dist/cjs/rich-text-editor.css +1 -1
  34. package/dist/cjs/search-input.cjs +244 -98
  35. package/dist/cjs/search-input.css +1 -1
  36. package/dist/cjs/select.cjs +485 -353
  37. package/dist/cjs/select.css +1 -1
  38. package/dist/cjs/slider.cjs +129 -155
  39. package/dist/cjs/switch.cjs +376 -239
  40. package/dist/cjs/switch.css +5 -1
  41. package/dist/cjs/tags-input.cjs +264 -113
  42. package/dist/cjs/tags-input.css +1 -1
  43. package/dist/cjs/textarea.cjs +225 -79
  44. package/dist/cjs/textarea.css +1 -1
  45. package/dist/cjs/time-picker.cjs +546 -371
  46. package/dist/cjs/time-picker.css +1 -1
  47. package/dist/cjs/toggle-button.cjs +18 -15
  48. package/dist/esm/{switch.css → 1485.css} +4 -0
  49. package/dist/esm/1485.js +28 -0
  50. package/dist/esm/{2995.css → 2315.css} +1 -1
  51. package/dist/esm/{2995.js → 2315.js} +96 -4
  52. package/dist/esm/2692.js +114 -0
  53. package/dist/esm/27.js +23 -27
  54. package/dist/esm/345.js +81 -0
  55. package/dist/esm/5074.js +66 -0
  56. package/dist/esm/5333.js +72 -0
  57. package/dist/esm/6982.js +35 -0
  58. package/dist/esm/7580.js +34 -0
  59. package/dist/esm/7678.js +101 -0
  60. package/dist/esm/7800.js +131 -0
  61. package/dist/esm/8479.js +115 -0
  62. package/dist/esm/{checkbox.css → 9167.css} +4 -0
  63. package/dist/esm/9167.js +30 -0
  64. package/dist/esm/9545.js +118 -0
  65. package/dist/esm/{2942.css → 9559.css} +43 -0
  66. package/dist/esm/9559.js +179 -0
  67. package/dist/esm/autocomplete.js +2 -95
  68. package/dist/esm/checkbox.js +1 -38
  69. package/dist/esm/color-picker.js +1 -130
  70. package/dist/esm/combobox.js +1 -126
  71. package/dist/esm/components/autocomplete/Autocomplete.d.ts +26 -16
  72. package/dist/esm/components/autocomplete/index.d.ts +1 -3
  73. package/dist/esm/components/checkbox/Checkbox.d.ts +12 -4
  74. package/dist/esm/components/checkbox/index.d.ts +1 -3
  75. package/dist/esm/components/color-picker/ColorPicker.d.ts +28 -21
  76. package/dist/esm/components/color-picker/index.d.ts +1 -3
  77. package/dist/esm/components/combobox/Combobox.d.ts +55 -29
  78. package/dist/esm/components/combobox/index.d.ts +1 -3
  79. package/dist/esm/components/date-picker/DatePicker.d.ts +28 -24
  80. package/dist/esm/components/date-picker/index.d.ts +1 -3
  81. package/dist/esm/components/dropzone/Dropzone.d.ts +52 -9
  82. package/dist/esm/components/dropzone/index.d.ts +1 -3
  83. package/dist/esm/components/field/Field.d.ts +106 -0
  84. package/dist/esm/components/field/index.d.ts +1 -0
  85. package/dist/esm/components/file-upload/FileUpload.d.ts +11 -18
  86. package/dist/esm/components/file-upload/index.d.ts +1 -3
  87. package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
  88. package/dist/esm/components/input/Input.d.ts +3 -5
  89. package/dist/esm/components/multi-select/MultiSelect.d.ts +37 -30
  90. package/dist/esm/components/multi-select/index.d.ts +1 -3
  91. package/dist/esm/components/number-input/NumberInput.d.ts +3 -5
  92. package/dist/esm/components/otp-input/OtpInput.d.ts +2 -4
  93. package/dist/esm/components/password-input/PasswordInput.d.ts +3 -5
  94. package/dist/esm/components/radio-group/RadioGroup.d.ts +18 -10
  95. package/dist/esm/components/radio-group/index.d.ts +1 -3
  96. package/dist/esm/components/range-slider/RangeSlider.d.ts +1 -1
  97. package/dist/esm/components/rich-text-editor/RichTextEditor.d.ts +44 -7
  98. package/dist/esm/components/rich-text-editor/index.d.ts +1 -3
  99. package/dist/esm/components/search-input/SearchInput.d.ts +3 -5
  100. package/dist/esm/components/select/Select.d.ts +36 -23
  101. package/dist/esm/components/select/index.d.ts +1 -3
  102. package/dist/esm/components/slider/Slider.d.ts +17 -10
  103. package/dist/esm/components/slider/index.d.ts +1 -3
  104. package/dist/esm/components/switch/Switch.d.ts +10 -5
  105. package/dist/esm/components/switch/index.d.ts +1 -3
  106. package/dist/esm/components/tags-input/TagsInput.d.ts +3 -5
  107. package/dist/esm/components/textarea/Textarea.d.ts +3 -5
  108. package/dist/esm/components/time-picker/TimePicker.d.ts +31 -23
  109. package/dist/esm/components/time-picker/index.d.ts +1 -3
  110. package/dist/esm/date-picker.js +1 -118
  111. package/dist/esm/dropzone.js +1 -137
  112. package/dist/esm/field.d.ts +2 -24
  113. package/dist/esm/field.js +1 -0
  114. package/dist/esm/file-upload.js +2 -123
  115. package/dist/esm/index.d.ts +15 -14
  116. package/dist/esm/index.js +15 -14
  117. package/dist/esm/input.js +16 -25
  118. package/dist/esm/multi-select.js +2 -164
  119. package/dist/esm/number-input.js +65 -78
  120. package/dist/esm/otp-input.js +31 -38
  121. package/dist/esm/password-input.js +32 -41
  122. package/dist/esm/radio-group.js +1 -44
  123. package/dist/esm/range-slider.js +15 -8
  124. package/dist/esm/rich-text-editor.js +1 -212
  125. package/dist/esm/search-input.js +35 -44
  126. package/dist/esm/select.js +1 -87
  127. package/dist/esm/slider.js +1 -4
  128. package/dist/esm/switch.js +1 -36
  129. package/dist/esm/tags-input.js +51 -59
  130. package/dist/esm/textarea.js +22 -31
  131. package/dist/esm/time-picker.js +1 -137
  132. package/package.json +18 -9
  133. package/dist/esm/2942.js +0 -13
  134. package/dist/esm/4557.js +0 -39
  135. package/dist/esm/dropzone.css +0 -43
  136. /package/dist/esm/{date-picker.css → 2692.css} +0 -0
  137. /package/dist/esm/{select.css → 5333.css} +0 -0
  138. /package/dist/esm/{radio-group.css → 7580.css} +0 -0
  139. /package/dist/esm/{color-picker.css → 7678.css} +0 -0
  140. /package/dist/esm/{rich-text-editor.css → 9545.css} +0 -0
@@ -1,123 +1,2 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { PaperclipIcon, UploadIcon, XIcon } from "@vinyasa/icons";
3
- import { useId, useState } from "react";
4
- import { useDropzone } from "react-dropzone";
5
- import { field, describedByIds } from "./4557.js";
6
- import { fileName, rejectionText, fileRemove, fileSize, fileNameIcon, fileList, fileRow, trigger, fileNameText, fileMeta, fileListWrapper } from "./2942.js";
7
- const formatFileSize = (bytes)=>{
8
- if (bytes < 1024) return `${String(bytes)} B`;
9
- if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
10
- return `${(bytes / 1048576).toFixed(1)} MB`;
11
- };
12
- const FileUpload = ({ value, onValueChange, accept, maxFiles, maxSize, label, description, error, required, disabled, id: idProp })=>{
13
- const [internalFiles, setInternalFiles] = useState([]);
14
- const isControlled = void 0 !== value;
15
- const currentFiles = isControlled ? value : internalFiles;
16
- const [rejectionMessage, setRejectionMessage] = useState();
17
- const generatedId = useId();
18
- const id = idProp ?? generatedId;
19
- const setFiles = (next)=>{
20
- if (!isControlled) setInternalFiles(next);
21
- onValueChange?.(next);
22
- };
23
- const removeFile = (file)=>{
24
- setFiles(currentFiles.filter((entry)=>entry !== file));
25
- };
26
- const { getRootProps, getInputProps } = useDropzone({
27
- accept,
28
- maxFiles,
29
- maxSize,
30
- disabled,
31
- onDrop: (acceptedFiles, fileRejections)=>{
32
- fileRejections.length > 0 ? setRejectionMessage(fileRejections[0]?.errors[0]?.message) : setRejectionMessage(void 0);
33
- if (acceptedFiles.length > 0) setFiles([
34
- ...currentFiles,
35
- ...acceptedFiles
36
- ]);
37
- }
38
- });
39
- return /*#__PURE__*/ jsxs(field, {
40
- id: id,
41
- label: label,
42
- description: description,
43
- error: error,
44
- required: required,
45
- children: [
46
- /*#__PURE__*/ jsxs("button", {
47
- type: "button",
48
- ...getRootProps({
49
- id,
50
- role: 'button',
51
- 'data-disabled': disabled,
52
- disabled
53
- }),
54
- className: trigger,
55
- "aria-describedby": describedByIds(id, {
56
- description,
57
- error
58
- }),
59
- children: [
60
- /*#__PURE__*/ jsx("input", {
61
- ...getInputProps()
62
- }),
63
- /*#__PURE__*/ jsx(UploadIcon, {
64
- "aria-hidden": "true"
65
- }),
66
- "Choose files"
67
- ]
68
- }),
69
- rejectionMessage ? /*#__PURE__*/ jsx("p", {
70
- className: rejectionText,
71
- children: rejectionMessage
72
- }) : null,
73
- currentFiles.length > 0 ? /*#__PURE__*/ jsx("div", {
74
- className: fileListWrapper,
75
- children: /*#__PURE__*/ jsx("ul", {
76
- className: fileList,
77
- children: currentFiles.map((file)=>/*#__PURE__*/ jsxs("li", {
78
- className: fileRow,
79
- children: [
80
- /*#__PURE__*/ jsxs("span", {
81
- className: fileName,
82
- children: [
83
- /*#__PURE__*/ jsx(PaperclipIcon, {
84
- "aria-hidden": "true",
85
- className: fileNameIcon
86
- }),
87
- /*#__PURE__*/ jsx("span", {
88
- className: fileNameText,
89
- title: file.name,
90
- children: file.name
91
- })
92
- ]
93
- }),
94
- /*#__PURE__*/ jsxs("span", {
95
- className: fileMeta,
96
- children: [
97
- /*#__PURE__*/ jsx("span", {
98
- className: fileSize,
99
- children: formatFileSize(file.size)
100
- }),
101
- /*#__PURE__*/ jsx("button", {
102
- type: "button",
103
- className: fileRemove,
104
- "aria-label": `Remove ${file.name}`,
105
- onClick: ()=>{
106
- removeFile(file);
107
- },
108
- children: /*#__PURE__*/ jsx(XIcon, {})
109
- })
110
- ]
111
- })
112
- ]
113
- }, `${file.name}-${String(file.lastModified)}`))
114
- })
115
- }) : null
116
- ]
117
- });
118
- };
119
- FileUpload.displayName = 'FileUpload';
120
- const file_upload_FileUpload = FileUpload;
121
- const file_upload = file_upload_FileUpload;
122
- export default file_upload;
123
- export { file_upload as FileUpload };
1
+ export { FileUpload, FileUploadTrigger } from "./6982.js";
2
+ export { DropzoneFileItem as FileUploadFileItem, DropzoneFileList as FileUploadFileList, DropzoneRejection as FileUploadRejection } from "./9559.js";
@@ -1,24 +1,25 @@
1
- export { default as Autocomplete, type AutocompleteProps } from './components/autocomplete';
2
- export { default as Checkbox, type CheckboxProps } from './components/checkbox';
3
- export { default as ColorPicker, type ColorPickerProps } from './components/color-picker';
4
- export { default as Combobox, type ComboboxOption, type ComboboxProps, } from './components/combobox';
5
- export { default as DatePicker, type DatePickerProps } from './components/date-picker';
6
- export { default as Dropzone, type DropzoneProps } from './components/dropzone';
7
- export { default as FileUpload, type FileUploadProps } from './components/file-upload';
1
+ export { Autocomplete, AutocompleteContent, AutocompleteEmpty, AutocompleteInput, AutocompleteItem, AutocompleteList, type AutocompleteContentProps, type AutocompleteInputProps, type AutocompleteItemProps, type AutocompleteProps, } from './components/autocomplete';
2
+ export { Checkbox, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, } from './components/checkbox';
3
+ export { ColorPicker, ColorPickerContent, ColorPickerSwatch, ColorPickerTrigger, ColorPickerValue, type ColorPickerContentProps, type ColorPickerSwatchProps, type ColorPickerTriggerProps, type ColorPickerValueProps, } from './components/color-picker';
4
+ export { Combobox, ComboboxContent, ComboboxEmpty, ComboboxIcon, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxList, ComboboxTrigger, ComboboxValue, type ComboboxContentProps, type ComboboxEmptyProps, type ComboboxIconProps, type ComboboxInputProps, type ComboboxItemProps, type ComboboxItemIndicatorProps, type ComboboxListProps, type ComboboxProps, type ComboboxTriggerProps, type ComboboxValueProps, } from './components/combobox';
5
+ export { DatePicker, DatePickerContent, DatePickerIcon, DatePickerTrigger, DatePickerValue, type DatePickerContentProps, type DatePickerIconProps, type DatePickerProps, type DatePickerTriggerProps, type DatePickerValueProps, } from './components/date-picker';
6
+ export { Dropzone, DropzoneFileItem, DropzoneFileList, DropzoneRejection, DropzoneTrigger, useDropzoneContext, type DropzoneFileItemProps, type DropzoneProps, type DropzoneTriggerProps, } from './components/dropzone';
7
+ export { Field, FieldControl, FieldDescription, FieldError, FieldLabel, useFieldContext, type FieldContextValue, type FieldControlProps, type FieldDescriptionProps, type FieldErrorProps, type FieldLabelProps, type FieldProps, } from './components/field';
8
+ export { FileUpload, FileUploadFileItem, FileUploadFileList, FileUploadRejection, FileUploadTrigger, type FileUploadProps, type FileUploadTriggerProps, } from './components/file-upload';
8
9
  export { default as IconButton, type IconButtonProps } from './components/icon-button';
9
10
  export { default as Input, type InputProps, type InputSize } from './components/input';
10
- export { default as MultiSelect, type MultiSelectOption, type MultiSelectProps, } from './components/multi-select';
11
+ export { MultiSelect, MultiSelectChip, MultiSelectChipOverflow, MultiSelectChipRemove, MultiSelectChipRow, MultiSelectContent, MultiSelectEmpty, MultiSelectInput, MultiSelectItem, MultiSelectItemIndicator, MultiSelectList, MultiSelectPlaceholder, MultiSelectTrigger, type MultiSelectChipOverflowProps, type MultiSelectChipProps, type MultiSelectChipRemoveProps, type MultiSelectChipRowProps, type MultiSelectPlaceholderProps, type MultiSelectTriggerProps, } from './components/multi-select';
11
12
  export { default as NumberInput, type NumberInputProps, type NumberInputSize, } from './components/number-input';
12
13
  export { default as OtpInput, type OtpInputProps } from './components/otp-input';
13
14
  export { default as PasswordInput, type PasswordInputProps, type PasswordInputSize, } from './components/password-input';
14
- export { default as RadioGroup, type RadioGroupProps, type RadioOption, } from './components/radio-group';
15
+ export { RadioGroup, RadioGroupIndicator, RadioGroupItem, type RadioGroupIndicatorProps, type RadioGroupItemProps, type RadioGroupProps, } from './components/radio-group';
15
16
  export { default as RangeSlider, type RangeSliderProps } from './components/range-slider';
16
- export { default as RichTextEditor, type RichTextEditorProps } from './components/rich-text-editor';
17
+ export { RichTextEditor, RichTextEditorContent, RichTextEditorDivider, RichTextEditorToolbar, RichTextEditorToolbarButton, useRichTextEditorActive, useRichTextEditorContext, useRichTextEditorDisabled, type RichTextEditorProps, type RichTextEditorToolbarButtonProps, type RichTextEditorToolbarProps, } from './components/rich-text-editor';
17
18
  export { default as SearchInput, type SearchInputProps, type SearchInputSize, } from './components/search-input';
18
- export { default as Select, type SelectOption, type SelectProps } from './components/select';
19
- export { default as Slider, type SliderProps } from './components/slider';
20
- export { default as Switch, type SwitchProps } from './components/switch';
19
+ export { Select, SelectContent, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue, SelectViewport, type SelectItemProps, type SelectTriggerProps, type SelectValueProps, } from './components/select';
20
+ export { Slider, SliderRange, SliderThumb, SliderTrack, type SliderProps, type SliderRangeProps, type SliderThumbProps, type SliderTrackProps, } from './components/slider';
21
+ export { Switch, SwitchThumb, type SwitchProps, type SwitchThumbProps } from './components/switch';
21
22
  export { default as TagsInput, type TagsInputProps } from './components/tags-input';
22
23
  export { default as Textarea, type TextareaProps, type TextareaSize } from './components/textarea';
23
- export { default as TimePicker, type TimePickerProps } from './components/time-picker';
24
+ export { TimePicker, TimePickerContent, TimePickerIcon, TimePickerTrigger, TimePickerValue, type TimePickerContentProps, type TimePickerIconProps, type TimePickerProps, type TimePickerTriggerProps, type TimePickerValueProps, } from './components/time-picker';
24
25
  export { default as ToggleButton, type ToggleButtonProps } from './components/toggle-button';
package/dist/esm/index.js CHANGED
@@ -1,24 +1,25 @@
1
- export { Autocomplete } from "./autocomplete.js";
2
- export { Checkbox } from "./checkbox.js";
3
- export { ColorPicker } from "./color-picker.js";
4
- export { Combobox } from "./combobox.js";
5
- export { DatePicker } from "./date-picker.js";
6
- export { Dropzone } from "./dropzone.js";
7
- export { FileUpload } from "./file-upload.js";
1
+ export { Autocomplete, AutocompleteContent, AutocompleteInput, AutocompleteItem } from "./345.js";
2
+ export { AutocompleteEmpty, AutocompleteEmpty as ComboboxEmpty, AutocompleteEmpty as MultiSelectEmpty, AutocompleteList, AutocompleteList as ComboboxList, AutocompleteList as MultiSelectList, Combobox, ComboboxContent, ComboboxContent as MultiSelectContent, ComboboxIcon, ComboboxInput, ComboboxInput as MultiSelectInput, ComboboxItem, ComboboxItem as MultiSelectItem, ComboboxItemIndicator, ComboboxItemIndicator as MultiSelectItemIndicator, ComboboxTrigger, ComboboxValue } from "./8479.js";
3
+ export { Checkbox, CheckboxIndicator } from "./9167.js";
4
+ export { ColorPicker, ColorPickerContent, ColorPickerSwatch, ColorPickerTrigger, ColorPickerValue } from "./7678.js";
5
+ export { DatePicker, DatePickerContent, DatePickerIcon, DatePickerTrigger, DatePickerValue } from "./2692.js";
6
+ export { Dropzone, DropzoneFileItem, DropzoneFileItem as FileUploadFileItem, DropzoneFileList, DropzoneFileList as FileUploadFileList, DropzoneRejection, DropzoneRejection as FileUploadRejection, DropzoneTrigger, useDropzoneContext } from "./9559.js";
7
+ export { Field, FieldControl, FieldDescription, FieldError, FieldLabel, useFieldContext } from "./2315.js";
8
+ export { FileUpload, FileUploadTrigger } from "./6982.js";
8
9
  export { IconButton } from "./icon-button.js";
9
10
  export { Input } from "./input.js";
10
- export { MultiSelect } from "./multi-select.js";
11
+ export { MultiSelect, MultiSelectChip, MultiSelectChipOverflow, MultiSelectChipRemove, MultiSelectChipRow, MultiSelectPlaceholder, MultiSelectTrigger } from "./5074.js";
11
12
  export { NumberInput } from "./number-input.js";
12
13
  export { OtpInput } from "./otp-input.js";
13
14
  export { PasswordInput } from "./password-input.js";
14
- export { RadioGroup } from "./radio-group.js";
15
+ export { RadioGroup, RadioGroupIndicator, RadioGroupItem } from "./7580.js";
15
16
  export { RangeSlider } from "./range-slider.js";
16
- export { RichTextEditor } from "./rich-text-editor.js";
17
+ export { RichTextEditor, RichTextEditorContent, RichTextEditorDivider, RichTextEditorToolbar, RichTextEditorToolbarButton, useRichTextEditorActive, useRichTextEditorContext, useRichTextEditorDisabled } from "./9545.js";
17
18
  export { SearchInput } from "./search-input.js";
18
- export { Select } from "./select.js";
19
- export { Slider } from "./slider.js";
20
- export { Switch } from "./switch.js";
19
+ export { Select, SelectContent, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue, SelectViewport } from "./5333.js";
20
+ export { Slider, SliderRange, SliderThumb, SliderTrack } from "./27.js";
21
+ export { Switch, SwitchThumb } from "./1485.js";
21
22
  export { TagsInput } from "./tags-input.js";
22
23
  export { Textarea } from "./textarea.js";
23
- export { TimePicker } from "./time-picker.js";
24
+ export { TimePicker, TimePickerContent, TimePickerIcon, TimePickerTrigger, TimePickerValue } from "./7800.js";
24
25
  export { ToggleButton } from "./toggle-button.js";
package/dist/esm/input.js CHANGED
@@ -1,35 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useId } from "react";
3
- import { fieldControl } from "./2995.js";
4
- import { field, describedByIds } from "./4557.js";
5
- const Input = /*#__PURE__*/ forwardRef(({ label, description, error, required, size, id: idProp, className, ...rest }, ref)=>{
6
- const generatedId = useId();
7
- const id = idProp ?? generatedId;
2
+ import { forwardRef } from "react";
3
+ import { fieldControl, useResolvedFieldProps } from "./2315.js";
4
+ const Input = /*#__PURE__*/ forwardRef(({ size, invalid, id: idProp, className, 'aria-describedby': ariaDescribedBy, ...rest }, ref)=>{
5
+ const { id, invalid: isInvalid, describedBy } = useResolvedFieldProps({
6
+ id: idProp,
7
+ invalid,
8
+ describedBy: ariaDescribedBy
9
+ });
8
10
  const classes = className ? `${fieldControl({
9
11
  size,
10
- invalid: Boolean(error)
12
+ invalid: isInvalid
11
13
  })} ${className}` : fieldControl({
12
14
  size,
13
- invalid: Boolean(error)
15
+ invalid: isInvalid
14
16
  });
15
- return /*#__PURE__*/ jsx(field, {
17
+ return /*#__PURE__*/ jsx("input", {
18
+ ref: ref,
16
19
  id: id,
17
- label: label,
18
- description: description,
19
- error: error,
20
- required: required,
21
- children: /*#__PURE__*/ jsx("input", {
22
- ref: ref,
23
- id: id,
24
- className: classes,
25
- required: required,
26
- "aria-invalid": error ? true : void 0,
27
- "aria-describedby": describedByIds(id, {
28
- description,
29
- error
30
- }),
31
- ...rest
32
- })
20
+ className: classes,
21
+ "aria-invalid": isInvalid,
22
+ "aria-describedby": describedBy,
23
+ ...rest
33
24
  });
34
25
  });
35
26
  Input.displayName = 'Input';
@@ -1,164 +1,2 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { CheckIcon, SearchIcon, XIcon } from "@vinyasa/icons";
3
- import { Command } from "cmdk";
4
- import { useId, useState } from "react";
5
- import { field, describedByIds } from "./4557.js";
6
- import { fieldControl } from "./2995.js";
7
- import { chip, empty, chipRow, searchIcon, content, placeholder as selectPopover_css_placeholder, chipRemove, itemIndicator, searchInput, item, searchWrapper, list, chipOverflow, triggerBox } from "./6720.js";
8
- import * as __rspack_external__radix_ui_react_popover_e2827c9f from "@radix-ui/react-popover";
9
- const optionText = (option)=>'string' == typeof option.label ? option.label : option.value;
10
- const MultiSelect = ({ options, value, defaultValue = [], onValueChange, placeholder, label, description, error, required, size, emptyMessage = 'No results found.', maxVisibleChips = 2, trigger, id: idProp })=>{
11
- const [internalValue, setInternalValue] = useState(defaultValue);
12
- const isControlled = void 0 !== value;
13
- const currentValue = isControlled ? value : internalValue;
14
- const [open, setOpen] = useState(false);
15
- const generatedId = useId();
16
- const id = idProp ?? generatedId;
17
- const setValue = (next)=>{
18
- if (!isControlled) setInternalValue(next);
19
- onValueChange?.(next);
20
- };
21
- const toggleValue = (optionValue)=>{
22
- setValue(currentValue.includes(optionValue) ? currentValue.filter((entry)=>entry !== optionValue) : [
23
- ...currentValue,
24
- optionValue
25
- ]);
26
- };
27
- const removeValue = (optionValue)=>{
28
- setValue(currentValue.filter((entry)=>entry !== optionValue));
29
- };
30
- const selectedOptions = options.filter((option)=>currentValue.includes(option.value));
31
- const visibleOptions = selectedOptions.slice(0, maxVisibleChips);
32
- const overflowCount = selectedOptions.length - visibleOptions.length;
33
- return /*#__PURE__*/ jsx(field, {
34
- id: id,
35
- label: label,
36
- description: description,
37
- error: error,
38
- required: required,
39
- children: /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_popover_e2827c9f.Root, {
40
- open: open,
41
- onOpenChange: setOpen,
42
- children: [
43
- /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Trigger, {
44
- asChild: true,
45
- children: trigger ?? /*#__PURE__*/ jsx("div", {
46
- id: id,
47
- role: "combobox",
48
- "aria-expanded": open,
49
- "aria-labelledby": label ? `${id}-label` : void 0,
50
- "aria-describedby": describedByIds(id, {
51
- description,
52
- error
53
- }),
54
- tabIndex: 0,
55
- className: `${fieldControl({
56
- size,
57
- invalid: Boolean(error)
58
- })} ${triggerBox}`,
59
- onKeyDown: (event)=>{
60
- if ('Enter' === event.key || ' ' === event.key) {
61
- event.preventDefault();
62
- setOpen((previous)=>!previous);
63
- }
64
- },
65
- children: /*#__PURE__*/ jsxs("span", {
66
- className: chipRow,
67
- children: [
68
- 0 === selectedOptions.length ? /*#__PURE__*/ jsx("span", {
69
- className: selectPopover_css_placeholder,
70
- children: placeholder
71
- }) : null,
72
- visibleOptions.map((option)=>/*#__PURE__*/ jsxs("span", {
73
- className: chip,
74
- children: [
75
- option.label,
76
- /*#__PURE__*/ jsx("button", {
77
- type: "button",
78
- className: chipRemove,
79
- "aria-label": `Remove ${optionText(option)}`,
80
- onClick: (event)=>{
81
- event.stopPropagation();
82
- removeValue(option.value);
83
- },
84
- children: /*#__PURE__*/ jsx(XIcon, {})
85
- })
86
- ]
87
- }, option.value)),
88
- overflowCount > 0 ? /*#__PURE__*/ jsxs("span", {
89
- className: chipOverflow,
90
- children: [
91
- "+",
92
- overflowCount
93
- ]
94
- }) : null
95
- ]
96
- })
97
- })
98
- }),
99
- /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Content, {
100
- className: content,
101
- align: "start",
102
- sideOffset: 4,
103
- onOpenAutoFocus: (event)=>{
104
- event.preventDefault();
105
- },
106
- children: /*#__PURE__*/ jsxs(Command, {
107
- loop: true,
108
- label: "Search options",
109
- children: [
110
- /*#__PURE__*/ jsxs("div", {
111
- className: searchWrapper,
112
- children: [
113
- /*#__PURE__*/ jsx("span", {
114
- className: searchIcon,
115
- "aria-hidden": "true",
116
- children: /*#__PURE__*/ jsx(SearchIcon, {})
117
- }),
118
- /*#__PURE__*/ jsx(Command.Input, {
119
- placeholder: "Search…",
120
- className: searchInput
121
- })
122
- ]
123
- }),
124
- /*#__PURE__*/ jsxs(Command.List, {
125
- className: list,
126
- children: [
127
- /*#__PURE__*/ jsx(Command.Empty, {
128
- className: empty,
129
- children: emptyMessage
130
- }),
131
- options.map((option)=>{
132
- const isSelected = currentValue.includes(option.value);
133
- return /*#__PURE__*/ jsxs(Command.Item, {
134
- value: optionText(option),
135
- disabled: option.disabled,
136
- onSelect: ()=>{
137
- toggleValue(option.value);
138
- },
139
- className: item,
140
- "data-selected": isSelected,
141
- "data-disabled": option.disabled,
142
- children: [
143
- option.label,
144
- isSelected ? /*#__PURE__*/ jsx("span", {
145
- className: itemIndicator,
146
- children: /*#__PURE__*/ jsx(CheckIcon, {})
147
- }) : null
148
- ]
149
- }, option.value);
150
- })
151
- ]
152
- })
153
- ]
154
- })
155
- })
156
- ]
157
- })
158
- });
159
- };
160
- MultiSelect.displayName = 'MultiSelect';
161
- const multi_select_MultiSelect = MultiSelect;
162
- const multi_select = multi_select_MultiSelect;
163
- export default multi_select;
164
- export { multi_select as MultiSelect };
1
+ export { MultiSelect, MultiSelectChip, MultiSelectChipOverflow, MultiSelectChipRemove, MultiSelectChipRow, MultiSelectPlaceholder, MultiSelectTrigger } from "./5074.js";
2
+ export { AutocompleteEmpty as MultiSelectEmpty, AutocompleteList as MultiSelectList, ComboboxContent as MultiSelectContent, ComboboxInput as MultiSelectInput, ComboboxItem as MultiSelectItem, ComboboxItemIndicator as MultiSelectItemIndicator } from "./8479.js";
@@ -1,9 +1,8 @@
1
1
  import "./number-input.css";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { MinusIcon, PlusIcon } from "@vinyasa/icons";
4
- import { forwardRef, useId, useRef } from "react";
5
- import { fieldControl, createRuntimeFn } from "./2995.js";
6
- import { field, describedByIds } from "./4557.js";
4
+ import { forwardRef, useRef } from "react";
5
+ import { fieldControl, useResolvedFieldProps, createRuntimeFn } from "./2315.js";
7
6
  var group = createRuntimeFn({
8
7
  defaultClassName: '_1wyztbj0',
9
8
  variantClassNames: {
@@ -66,84 +65,72 @@ const mergeRefs = (...refs)=>(node)=>{
66
65
  for (const ref of refs)if ('function' == typeof ref) ref(node);
67
66
  else if (ref) ref.current = node;
68
67
  };
69
- const NumberInput = /*#__PURE__*/ forwardRef(({ label, description, error, required, size, showSteppers = true, disabled, id: idProp, className, ...rest }, ref)=>{
70
- const generatedId = useId();
71
- const id = idProp ?? generatedId;
68
+ const NumberInput = /*#__PURE__*/ forwardRef(({ size, invalid, showSteppers = true, disabled, id: idProp, className, 'aria-describedby': ariaDescribedBy, ...rest }, ref)=>{
69
+ const { id, invalid: isInvalid, describedBy } = useResolvedFieldProps({
70
+ id: idProp,
71
+ invalid,
72
+ describedBy: ariaDescribedBy
73
+ });
72
74
  const innerRef = useRef(null);
73
- const invalid = Boolean(error);
74
- return /*#__PURE__*/ jsx(field, {
75
- id: id,
76
- label: label,
77
- description: description,
78
- error: error,
79
- required: required,
80
- children: showSteppers ? /*#__PURE__*/ jsxs("div", {
81
- className: group({
82
- size,
83
- invalid,
84
- disabled
75
+ if (showSteppers) return /*#__PURE__*/ jsxs("div", {
76
+ className: group({
77
+ size,
78
+ invalid: isInvalid,
79
+ disabled
80
+ }),
81
+ children: [
82
+ /*#__PURE__*/ jsx("button", {
83
+ type: "button",
84
+ className: `${groupButton({
85
+ size
86
+ })} ${groupButtonLeading}`,
87
+ disabled: disabled,
88
+ tabIndex: -1,
89
+ "aria-label": "Decrement",
90
+ onClick: ()=>{
91
+ step(innerRef.current, 'down');
92
+ },
93
+ children: /*#__PURE__*/ jsx(MinusIcon, {})
85
94
  }),
86
- children: [
87
- /*#__PURE__*/ jsx("button", {
88
- type: "button",
89
- className: `${groupButton({
90
- size
91
- })} ${groupButtonLeading}`,
92
- disabled: disabled,
93
- tabIndex: -1,
94
- "aria-label": "Decrement",
95
- onClick: ()=>{
96
- step(innerRef.current, 'down');
97
- },
98
- children: /*#__PURE__*/ jsx(MinusIcon, {})
99
- }),
100
- /*#__PURE__*/ jsx("input", {
101
- ref: mergeRefs(ref, innerRef),
102
- id: id,
103
- type: "number",
104
- disabled: disabled,
105
- className: `${groupInput({
106
- size
107
- })} ${className ?? ''}`,
108
- required: required,
109
- "aria-invalid": invalid ? true : void 0,
110
- "aria-describedby": describedByIds(id, {
111
- description,
112
- error
113
- }),
114
- ...rest
115
- }),
116
- /*#__PURE__*/ jsx("button", {
117
- type: "button",
118
- className: `${groupButton({
119
- size
120
- })} ${groupButtonTrailing}`,
121
- disabled: disabled,
122
- tabIndex: -1,
123
- "aria-label": "Increment",
124
- onClick: ()=>{
125
- step(innerRef.current, 'up');
126
- },
127
- children: /*#__PURE__*/ jsx(PlusIcon, {})
128
- })
129
- ]
130
- }) : /*#__PURE__*/ jsx("input", {
131
- ref: mergeRefs(ref, innerRef),
132
- id: id,
133
- type: "number",
134
- disabled: disabled,
135
- className: `${fieldControl({
136
- size,
137
- invalid
138
- })} ${className ?? ''}`,
139
- required: required,
140
- "aria-invalid": invalid ? true : void 0,
141
- "aria-describedby": describedByIds(id, {
142
- description,
143
- error
95
+ /*#__PURE__*/ jsx("input", {
96
+ ref: mergeRefs(ref, innerRef),
97
+ id: id,
98
+ type: "number",
99
+ disabled: disabled,
100
+ className: `${groupInput({
101
+ size
102
+ })} ${className ?? ''}`,
103
+ "aria-invalid": isInvalid,
104
+ "aria-describedby": describedBy,
105
+ ...rest
144
106
  }),
145
- ...rest
146
- })
107
+ /*#__PURE__*/ jsx("button", {
108
+ type: "button",
109
+ className: `${groupButton({
110
+ size
111
+ })} ${groupButtonTrailing}`,
112
+ disabled: disabled,
113
+ tabIndex: -1,
114
+ "aria-label": "Increment",
115
+ onClick: ()=>{
116
+ step(innerRef.current, 'up');
117
+ },
118
+ children: /*#__PURE__*/ jsx(PlusIcon, {})
119
+ })
120
+ ]
121
+ });
122
+ return /*#__PURE__*/ jsx("input", {
123
+ ref: mergeRefs(ref, innerRef),
124
+ id: id,
125
+ type: "number",
126
+ disabled: disabled,
127
+ className: `${fieldControl({
128
+ size,
129
+ invalid: isInvalid
130
+ })} ${className ?? ''}`,
131
+ "aria-invalid": isInvalid,
132
+ "aria-describedby": describedBy,
133
+ ...rest
147
134
  });
148
135
  });
149
136
  NumberInput.displayName = 'NumberInput';