@pixpilot/shadcn-ui 1.38.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +1 -0
  2. package/dist/ColorPicker/mcp.js +105 -0
  3. package/dist/ColorPickerBase/mcp.js +97 -0
  4. package/dist/absolute-fill/AbsoluteFill.d.cts +2 -2
  5. package/dist/absolute-fill/mcp.js +23 -0
  6. package/dist/alert/mcp.js +41 -0
  7. package/dist/avatar-upload/mcp.js +86 -0
  8. package/dist/button-extended/ButtonExtended.d.cts +2 -2
  9. package/dist/button-extended/mcp.js +53 -0
  10. package/dist/button-group/mcp.js +28 -0
  11. package/dist/card/Card.d.cts +3 -3
  12. package/dist/circle-loader/mcp.js +48 -0
  13. package/dist/close-button-absolute/mcp.js +39 -0
  14. package/dist/close-button-rounded/mcp.js +39 -0
  15. package/dist/color-select/ColorSelect.cjs +2 -2
  16. package/dist/color-select/ColorSelect.d.cts +3 -2
  17. package/dist/color-select/ColorSelect.d.ts +3 -2
  18. package/dist/color-select/ColorSelect.js +3 -3
  19. package/dist/color-select/mcp.js +59 -0
  20. package/dist/combobox/Combobox.cjs +4 -3
  21. package/dist/combobox/Combobox.d.cts +8 -4
  22. package/dist/combobox/Combobox.d.ts +8 -4
  23. package/dist/combobox/Combobox.js +5 -4
  24. package/dist/combobox/index.d.cts +1 -1
  25. package/dist/combobox/index.d.ts +1 -1
  26. package/dist/combobox/mcp.js +64 -0
  27. package/dist/confirmation-dialog/mcp.js +55 -0
  28. package/dist/content-card/ContentCard.d.ts +2 -2
  29. package/dist/content-card/mcp.js +30 -0
  30. package/dist/date-picker/DatePicker.d.ts +2 -2
  31. package/dist/date-picker/mcp.js +43 -0
  32. package/dist/dialog/Dialog.d.ts +5 -5
  33. package/dist/dialog/mcp.js +53 -0
  34. package/dist/dialog-provider/mcp.js +24 -0
  35. package/dist/file-upload/FileUpload.d.cts +2 -2
  36. package/dist/file-upload/FileUpload.d.ts +2 -2
  37. package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
  38. package/dist/file-upload-inline/mcp.js +89 -0
  39. package/dist/file-upload-root/FileUploadRoot.d.ts +2 -2
  40. package/dist/file-upload-root/mcp.js +84 -0
  41. package/dist/generated/mcp-registry.js +84 -6
  42. package/dist/icon-selector/IconPicker.cjs +2 -2
  43. package/dist/icon-selector/IconPicker.d.cts +1 -0
  44. package/dist/icon-selector/IconPicker.d.ts +1 -0
  45. package/dist/icon-selector/IconPicker.js +2 -2
  46. package/dist/icon-selector/mcp.js +60 -0
  47. package/dist/icon-toggle/mcp.js +62 -0
  48. package/dist/index.d.cts +4 -4
  49. package/dist/index.d.ts +4 -4
  50. package/dist/input/mcp.js +33 -0
  51. package/dist/layout/mcp.js +29 -0
  52. package/dist/loading-overlay/mcp.js +64 -0
  53. package/dist/mcp/src/search.js +81 -0
  54. package/dist/mcp/src/server.js +10 -5
  55. package/dist/pagination/mcp.js +65 -0
  56. package/dist/popover/mcp.js +27 -0
  57. package/dist/rating/Rating.d.cts +3 -3
  58. package/dist/rating/Rating.d.ts +3 -3
  59. package/dist/rating/mcp.js +73 -0
  60. package/dist/rich-text-editor/mcp.js +78 -0
  61. package/dist/scaled-preview/mcp.js +47 -0
  62. package/dist/select/Select.cjs +4 -2
  63. package/dist/select/Select.d.cts +14 -5
  64. package/dist/select/Select.d.ts +14 -5
  65. package/dist/select/Select.js +4 -2
  66. package/dist/select/index.d.cts +1 -1
  67. package/dist/select/index.d.ts +1 -1
  68. package/dist/select/mcp.js +70 -0
  69. package/dist/slider/mcp.js +80 -0
  70. package/dist/tabs/mcp.js +51 -0
  71. package/dist/tags-input/TagsInput.cjs +67 -65
  72. package/dist/tags-input/TagsInput.d.cts +6 -33
  73. package/dist/tags-input/TagsInput.d.ts +6 -33
  74. package/dist/tags-input/TagsInput.js +68 -66
  75. package/dist/tags-input/TagsInputInline.d.cts +2 -2
  76. package/dist/tags-input/TagsInputInline.d.ts +2 -2
  77. package/dist/tags-input/index.d.cts +2 -2
  78. package/dist/tags-input/index.d.ts +2 -2
  79. package/dist/tags-input/mcp.js +100 -0
  80. package/dist/theme-provider/mcp.js +57 -0
  81. package/dist/theme-toggle/ThemeModeDropdown.d.ts +2 -2
  82. package/dist/theme-toggle/ThemeModeSwitchInside.d.ts +2 -2
  83. package/dist/theme-toggle/ThemeModeSwitchOutside.d.ts +2 -2
  84. package/dist/theme-toggle/ThemeModeToggleButton.d.ts +2 -2
  85. package/dist/theme-toggle/mcp.js +38 -0
  86. package/dist/toast/mcp.js +52 -0
  87. package/dist/toggle-button/mcp.js +58 -0
  88. package/dist/toggle-group/mcp.js +67 -0
  89. package/dist/tooltip/mcp.js +24 -0
  90. package/package.json +6 -6
@@ -0,0 +1,70 @@
1
+ import { defineProps } from "../mcp/src/utils.js";
2
+
3
+ //#region src/select/mcp.ts
4
+ const meta = {
5
+ name: "Select",
6
+ category: "Forms",
7
+ htmlElement: "button",
8
+ description: "A single-select dropdown driven by an options array, with configurable keyboard navigation, dropdown positioning, and an optional clear button.",
9
+ props: defineProps({
10
+ options: "Selectable options as `{ label, value }[]` where value is a string or number.",
11
+ value: "Controlled selected value (compared as a string).",
12
+ onChange: "Called with the selected value when it changes; called with \"\" when cleared.",
13
+ placeholder: "Placeholder text shown before a value is selected.",
14
+ contentProps: "Props forwarded to the underlying select content popover.",
15
+ keyboardMode: {
16
+ description: "How arrow keys behave: \"dropdown\" opens the menu, \"cycle\" steps through options in place.",
17
+ type: "\"cycle\" | \"dropdown\"",
18
+ defaultValue: "\"dropdown\""
19
+ },
20
+ position: {
21
+ description: "Dropdown positioning strategy.",
22
+ type: "\"item-aligned\" | \"popper\""
23
+ },
24
+ clearable: {
25
+ description: "Shows a clear button when a value is selected.",
26
+ type: "boolean",
27
+ defaultValue: "false"
28
+ },
29
+ disabled: "Disables the select trigger.",
30
+ name: "Name used when the select participates in native form submission.",
31
+ required: "Marks the select as required.",
32
+ id: "Optional id attribute applied to the select trigger.",
33
+ className: "Additional CSS class applied to the select trigger.",
34
+ open: {
35
+ description: "Controlled open state of the dropdown.",
36
+ type: "boolean"
37
+ },
38
+ onOpenChange: {
39
+ description: "Called when the dropdown opens or closes.",
40
+ type: "(open: boolean) => void"
41
+ },
42
+ size: {
43
+ description: "Controls the trigger height.",
44
+ type: "\"sm\" | \"default\"",
45
+ defaultValue: "\"default\""
46
+ },
47
+ asChild: {
48
+ description: "Render the trigger behavior and styles through the child element instead of a native button.",
49
+ type: "boolean",
50
+ defaultValue: "false"
51
+ }
52
+ }),
53
+ examples: [{
54
+ title: "Basic select",
55
+ code: "<Select value={value} onChange={setValue} options={[{ label: \"One\", value: \"1\" }, { label: \"Two\", value: \"2\" }]} placeholder=\"Choose…\" />"
56
+ }, {
57
+ title: "Clearable select",
58
+ code: "<Select value={value} onChange={setValue} options={options} clearable />"
59
+ }],
60
+ related: ["Combobox", "ColorSelect"],
61
+ keywords: [
62
+ "select",
63
+ "dropdown",
64
+ "options",
65
+ "form"
66
+ ]
67
+ };
68
+
69
+ //#endregion
70
+ export { meta };
@@ -0,0 +1,80 @@
1
+ import { defineProps } from "../mcp/src/utils.js";
2
+
3
+ //#region src/slider/mcp.ts
4
+ const meta = {
5
+ name: "Slider",
6
+ category: "Forms",
7
+ description: "A range slider wrapping the shadcn slider with extra vertical padding. Supports single-thumb and multi-thumb (range) values.",
8
+ props: defineProps({
9
+ value: {
10
+ description: "Controlled value(s). Provide multiple numbers for a range slider.",
11
+ type: "number[]"
12
+ },
13
+ defaultValue: {
14
+ description: "Initial value(s) when uncontrolled.",
15
+ type: "number[]"
16
+ },
17
+ onValueChange: {
18
+ description: "Called with the new value array as the thumb(s) move.",
19
+ type: "(value: number[]) => void"
20
+ },
21
+ min: {
22
+ description: "Minimum value.",
23
+ type: "number",
24
+ defaultValue: "0"
25
+ },
26
+ max: {
27
+ description: "Maximum value.",
28
+ type: "number",
29
+ defaultValue: "100"
30
+ },
31
+ step: {
32
+ description: "Step increment between values.",
33
+ type: "number",
34
+ defaultValue: "1"
35
+ },
36
+ disabled: "Disables slider interaction.",
37
+ orientation: {
38
+ description: "Slider orientation.",
39
+ type: "\"horizontal\" | \"vertical\"",
40
+ defaultValue: "\"horizontal\""
41
+ },
42
+ onValueCommit: {
43
+ description: "Called with the final value array when the user stops dragging.",
44
+ type: "(value: number[]) => void"
45
+ },
46
+ minStepsBetweenThumbs: {
47
+ description: "Minimum number of steps to keep between thumbs in a range slider.",
48
+ type: "number",
49
+ defaultValue: "0"
50
+ },
51
+ inverted: {
52
+ description: "Visually and functionally inverts the slider direction.",
53
+ type: "boolean",
54
+ defaultValue: "false"
55
+ },
56
+ name: "Form field name submitted with the slider value for native form integration.",
57
+ form: "Associates the slider with a form by id when rendered outside of it.",
58
+ asChild: {
59
+ description: "Merge behavior and styles onto the child element instead of the default wrapper.",
60
+ type: "boolean",
61
+ defaultValue: "false"
62
+ }
63
+ }),
64
+ examples: [{
65
+ title: "Single value",
66
+ code: "<Slider value={[volume]} onValueChange={([v]) => setVolume(v)} max={100} />"
67
+ }, {
68
+ title: "Range",
69
+ code: "<Slider value={range} onValueChange={setRange} min={0} max={1000} step={10} />"
70
+ }],
71
+ keywords: [
72
+ "slider",
73
+ "range",
74
+ "input",
75
+ "form"
76
+ ]
77
+ };
78
+
79
+ //#endregion
80
+ export { meta };
@@ -0,0 +1,51 @@
1
+ import { defineProps } from "../mcp/src/utils.js";
2
+
3
+ //#region src/tabs/mcp.ts
4
+ const meta = {
5
+ name: "Tabs",
6
+ category: "Navigation",
7
+ description: "A tabbed navigation container composed with TabsList, TabsTrigger, and TabsContent. TabsList adds an \"underline\" variant on top of the shadcn variants.",
8
+ props: defineProps({
9
+ value: {
10
+ description: "Controlled active tab value.",
11
+ type: "string"
12
+ },
13
+ defaultValue: {
14
+ description: "Initial active tab value when uncontrolled.",
15
+ type: "string"
16
+ },
17
+ onValueChange: {
18
+ description: "Called with the newly selected tab value.",
19
+ type: "(value: string) => void"
20
+ },
21
+ orientation: {
22
+ description: "Tab orientation.",
23
+ type: "\"horizontal\" | \"vertical\"",
24
+ defaultValue: "\"horizontal\""
25
+ },
26
+ activationMode: {
27
+ description: "Whether a tab activates automatically on focus or manually on click/Enter.",
28
+ type: "\"automatic\" | \"manual\"",
29
+ defaultValue: "\"automatic\""
30
+ },
31
+ asChild: {
32
+ description: "Merge behavior and styles onto the child element instead of the default wrapper.",
33
+ type: "boolean",
34
+ defaultValue: "false"
35
+ }
36
+ }),
37
+ notes: ["TabsList accepts a `variant` of \"default\" | \"underline\" | \"outline\" | \"ghost\" | \"pill\"."],
38
+ examples: [{
39
+ title: "Underline tabs",
40
+ code: "<Tabs defaultValue=\"a\">\n <TabsList variant=\"underline\">\n <TabsTrigger value=\"a\">A</TabsTrigger>\n <TabsTrigger value=\"b\">B</TabsTrigger>\n </TabsList>\n <TabsContent value=\"a\">First</TabsContent>\n <TabsContent value=\"b\">Second</TabsContent>\n</Tabs>"
41
+ }],
42
+ keywords: [
43
+ "tabs",
44
+ "navigation",
45
+ "panels",
46
+ "segmented"
47
+ ]
48
+ };
49
+
50
+ //#endregion
51
+ export { meta };
@@ -31,7 +31,8 @@ const EMPTY_OPTIONS = [];
31
31
  * - Options support with dropdown (like Select)
32
32
  * - freeSolo mode for custom tags (like MUI Autocomplete)
33
33
  */
34
- function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS, freeSolo = true, placeholder = "Add tags...", emptyText = "No options found.", className, disabled = false, readOnly = false, maxTags, allowDuplicates = false, editable = false, label, delimiter = ",", addOnPaste = true, addOnTab = true, onValidate, addButtonVisibility = "touch" }) {
34
+ function TagsInput(props) {
35
+ const { id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS, freeSolo = true, placeholder = "Add tags...", emptyText = "No options found.", className, disabled = false, readOnly = false, maxTags, allowDuplicates = false, editable = false, label, delimiter = ",", addOnPaste = true, addOnTab = true, onValidate, addButtonVisibility = "touch",...restProps } = props;
35
36
  const [open, setOpen] = (0, react.useState)(false);
36
37
  const [searchValue, setSearchValue] = (0, react.useState)("");
37
38
  const [freeInputValue, setFreeInputValue] = (0, react.useState)("");
@@ -135,6 +136,7 @@ function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS,
135
136
  value
136
137
  ]);
137
138
  if (!hasOptions) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TagsInputInline.TagsInputInline, {
139
+ ...restProps,
138
140
  id,
139
141
  label,
140
142
  className,
@@ -160,81 +162,81 @@ function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS,
160
162
  onAddCurrentInput: handleAddCurrentInput,
161
163
  showClear: value.length > 0 && !disabled && !readOnly
162
164
  });
163
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
164
- className: (0, __pixpilot_shadcn.cn)("relative", className),
165
- children: [label !== void 0 && label !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TagsInputInLineLabel, { children: label }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, {
165
+ const showLabel = label !== void 0 && label !== "";
166
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(showLabel ? "div" : react.default.Fragment, {
167
+ ...showLabel ? { className: (0, __pixpilot_shadcn.cn)("relative", className) } : {},
168
+ children: [showLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TagsInputInLineLabel, { children: label }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, {
166
169
  open: open && !disabled && !readOnly,
167
170
  onOpenChange: setOpen,
168
171
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverTrigger, {
169
172
  asChild: true,
170
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
171
- className: "w-full",
172
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TagsInputInline.TagsInputInline, {
173
- id,
174
- label,
175
- showLabel: false,
176
- disabled,
177
- editable,
178
- max: maxTags,
179
- onValueChange: handleValueChange,
180
- onValidate: handleValidate,
181
- readOnly,
182
- value: stringValues,
183
- delimiter: freeSolo ? delimiter : void 0,
184
- addOnPaste: freeSolo ? addOnPaste : false,
185
- addOnTab: freeSolo ? addOnTab : false,
186
- items: inlineItems,
187
- onListClick: (e) => {
188
- if (!disabled && !readOnly) {
189
- e.stopPropagation();
190
- setOpen(true);
191
- }
192
- },
193
- inputRef,
194
- inputPlaceholder: placeholder,
195
- inputValue: searchValue,
196
- onInputFocus: (e) => {
173
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TagsInputInline.TagsInputInline, {
174
+ ...restProps,
175
+ className: (0, __pixpilot_shadcn.cn)("w-full", className),
176
+ id,
177
+ label,
178
+ showLabel: false,
179
+ disabled,
180
+ editable,
181
+ max: maxTags,
182
+ onValueChange: handleValueChange,
183
+ onValidate: handleValidate,
184
+ readOnly,
185
+ value: stringValues,
186
+ delimiter: freeSolo ? delimiter : void 0,
187
+ addOnPaste: freeSolo ? addOnPaste : false,
188
+ addOnTab: freeSolo ? addOnTab : false,
189
+ items: inlineItems,
190
+ onListClick: (e) => {
191
+ if (!disabled && !readOnly) {
197
192
  e.stopPropagation();
198
193
  setOpen(true);
199
- },
200
- onInputChange: (e) => {
194
+ }
195
+ },
196
+ inputRef,
197
+ inputPlaceholder: placeholder,
198
+ inputValue: searchValue,
199
+ onInputFocus: (e) => {
200
+ e.stopPropagation();
201
+ setOpen(true);
202
+ },
203
+ onInputChange: (e) => {
204
+ e.stopPropagation();
205
+ setSearchValue(e.target.value);
206
+ },
207
+ onInputKeyDown: (e) => {
208
+ if (open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
209
+ e.preventDefault();
201
210
  e.stopPropagation();
202
- setSearchValue(e.target.value);
203
- },
204
- onInputKeyDown: (e) => {
205
- if (open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
211
+ const command = document.querySelector("[cmdk-root]");
212
+ if (command) {
213
+ const event = new KeyboardEvent("keydown", {
214
+ key: e.key,
215
+ bubbles: true,
216
+ cancelable: true
217
+ });
218
+ command.dispatchEvent(event);
219
+ }
220
+ return;
221
+ }
222
+ if (open && e.key === "Enter") {
223
+ const selectedItem = document.querySelector("[cmdk-item][data-selected=\"true\"]");
224
+ if (selectedItem) {
206
225
  e.preventDefault();
207
226
  e.stopPropagation();
208
- const command = document.querySelector("[cmdk-root]");
209
- if (command) {
210
- const event = new KeyboardEvent("keydown", {
211
- key: e.key,
212
- bubbles: true,
213
- cancelable: true
214
- });
215
- command.dispatchEvent(event);
216
- }
227
+ selectedItem.click();
217
228
  return;
218
229
  }
219
- if (open && e.key === "Enter") {
220
- const selectedItem = document.querySelector("[cmdk-item][data-selected=\"true\"]");
221
- if (selectedItem) {
222
- e.preventDefault();
223
- e.stopPropagation();
224
- selectedItem.click();
225
- return;
226
- }
227
- }
228
- e.stopPropagation();
229
- },
230
- onInputMouseDown: (e) => {
231
- e.stopPropagation();
232
- },
233
- addButtonVisibility,
234
- canAddCurrentValue,
235
- onAddCurrentInput: handleAddCurrentInput,
236
- showClear: value.length > 0 && !disabled && !readOnly
237
- })
230
+ }
231
+ e.stopPropagation();
232
+ },
233
+ onInputMouseDown: (e) => {
234
+ e.stopPropagation();
235
+ },
236
+ addButtonVisibility,
237
+ canAddCurrentValue,
238
+ onAddCurrentInput: handleAddCurrentInput,
239
+ showClear: value.length > 0 && !disabled && !readOnly
238
240
  })
239
241
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverContent, {
240
242
  className: "p-0",
@@ -1,27 +1,20 @@
1
1
  import { CommandOptionListItem } from "../command-option-list/CommandOptionList.cjs";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import { TagsInputInline } from "./TagsInputInline.cjs";
3
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
4
+ import { ComponentProps } from "react";
3
5
 
4
6
  //#region src/tags-input/TagsInput.d.ts
5
- interface TagsInputProps {
6
- id?: string;
7
+ interface TagsInputProps extends Omit<ComponentProps<typeof TagsInputInline>, 'onChange' | 'value' | 'onValueChange' | 'onValidate' | 'items' | 'max' | 'inputRef' | 'inputPlaceholder' | 'inputValue' | 'onInputFocus' | 'onInputChange' | 'onInputKeyDown' | 'onInputMouseDown' | 'onListClick' | 'canAddCurrentValue' | 'onAddCurrentInput' | 'showClear'> {
7
8
  value?: Array<string | number>;
8
9
  onChange?: (value: Array<string | number>) => void;
9
10
  options?: CommandOptionListItem[];
10
11
  freeSolo?: boolean;
12
+ /** Placeholder for the tag input field. */
11
13
  placeholder?: string;
12
14
  emptyText?: string;
13
- className?: string;
14
- disabled?: boolean;
15
- readOnly?: boolean;
16
15
  maxTags?: number;
17
16
  allowDuplicates?: boolean;
18
- editable?: boolean;
19
- label?: string;
20
- delimiter?: string;
21
- addOnPaste?: boolean;
22
- addOnTab?: boolean;
23
17
  onValidate?: (value: string) => boolean;
24
- addButtonVisibility?: 'always' | 'touch' | 'never';
25
18
  }
26
19
  /**
27
20
  * TagsInput component - Inline tags input based on DiceUI
@@ -39,26 +32,6 @@ interface TagsInputProps {
39
32
  * - Options support with dropdown (like Select)
40
33
  * - freeSolo mode for custom tags (like MUI Autocomplete)
41
34
  */
42
- declare function TagsInput({
43
- id,
44
- value,
45
- onChange,
46
- options,
47
- freeSolo,
48
- placeholder,
49
- emptyText,
50
- className,
51
- disabled,
52
- readOnly,
53
- maxTags,
54
- allowDuplicates,
55
- editable,
56
- label,
57
- delimiter,
58
- addOnPaste,
59
- addOnTab,
60
- onValidate,
61
- addButtonVisibility
62
- }: TagsInputProps): react_jsx_runtime15.JSX.Element;
35
+ declare function TagsInput(props: TagsInputProps): react_jsx_runtime19.JSX.Element;
63
36
  //#endregion
64
37
  export { TagsInput, TagsInputProps };
@@ -1,27 +1,20 @@
1
1
  import { CommandOptionListItem } from "../command-option-list/CommandOptionList.js";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import { TagsInputInline } from "./TagsInputInline.js";
3
+ import { ComponentProps } from "react";
4
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
3
5
 
4
6
  //#region src/tags-input/TagsInput.d.ts
5
- interface TagsInputProps {
6
- id?: string;
7
+ interface TagsInputProps extends Omit<ComponentProps<typeof TagsInputInline>, 'onChange' | 'value' | 'onValueChange' | 'onValidate' | 'items' | 'max' | 'inputRef' | 'inputPlaceholder' | 'inputValue' | 'onInputFocus' | 'onInputChange' | 'onInputKeyDown' | 'onInputMouseDown' | 'onListClick' | 'canAddCurrentValue' | 'onAddCurrentInput' | 'showClear'> {
7
8
  value?: Array<string | number>;
8
9
  onChange?: (value: Array<string | number>) => void;
9
10
  options?: CommandOptionListItem[];
10
11
  freeSolo?: boolean;
12
+ /** Placeholder for the tag input field. */
11
13
  placeholder?: string;
12
14
  emptyText?: string;
13
- className?: string;
14
- disabled?: boolean;
15
- readOnly?: boolean;
16
15
  maxTags?: number;
17
16
  allowDuplicates?: boolean;
18
- editable?: boolean;
19
- label?: string;
20
- delimiter?: string;
21
- addOnPaste?: boolean;
22
- addOnTab?: boolean;
23
17
  onValidate?: (value: string) => boolean;
24
- addButtonVisibility?: 'always' | 'touch' | 'never';
25
18
  }
26
19
  /**
27
20
  * TagsInput component - Inline tags input based on DiceUI
@@ -39,26 +32,6 @@ interface TagsInputProps {
39
32
  * - Options support with dropdown (like Select)
40
33
  * - freeSolo mode for custom tags (like MUI Autocomplete)
41
34
  */
42
- declare function TagsInput({
43
- id,
44
- value,
45
- onChange,
46
- options,
47
- freeSolo,
48
- placeholder,
49
- emptyText,
50
- className,
51
- disabled,
52
- readOnly,
53
- maxTags,
54
- allowDuplicates,
55
- editable,
56
- label,
57
- delimiter,
58
- addOnPaste,
59
- addOnTab,
60
- onValidate,
61
- addButtonVisibility
62
- }: TagsInputProps): react_jsx_runtime18.JSX.Element;
35
+ declare function TagsInput(props: TagsInputProps): react_jsx_runtime19.JSX.Element;
63
36
  //#endregion
64
37
  export { TagsInput, TagsInputProps };
@@ -5,7 +5,7 @@ import { CommandOptionList } from "../command-option-list/CommandOptionList.js";
5
5
  import "../command-option-list/index.js";
6
6
  import { TagsInputInline } from "./TagsInputInline.js";
7
7
  import { Command, Popover, PopoverContent, PopoverTrigger, TagsInputInLineLabel, cn } from "@pixpilot/shadcn";
8
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
 
11
11
  //#region src/tags-input/TagsInput.tsx
@@ -27,7 +27,8 @@ const EMPTY_OPTIONS = [];
27
27
  * - Options support with dropdown (like Select)
28
28
  * - freeSolo mode for custom tags (like MUI Autocomplete)
29
29
  */
30
- function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS, freeSolo = true, placeholder = "Add tags...", emptyText = "No options found.", className, disabled = false, readOnly = false, maxTags, allowDuplicates = false, editable = false, label, delimiter = ",", addOnPaste = true, addOnTab = true, onValidate, addButtonVisibility = "touch" }) {
30
+ function TagsInput(props) {
31
+ const { id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS, freeSolo = true, placeholder = "Add tags...", emptyText = "No options found.", className, disabled = false, readOnly = false, maxTags, allowDuplicates = false, editable = false, label, delimiter = ",", addOnPaste = true, addOnTab = true, onValidate, addButtonVisibility = "touch",...restProps } = props;
31
32
  const [open, setOpen] = useState(false);
32
33
  const [searchValue, setSearchValue] = useState("");
33
34
  const [freeInputValue, setFreeInputValue] = useState("");
@@ -131,6 +132,7 @@ function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS,
131
132
  value
132
133
  ]);
133
134
  if (!hasOptions) return /* @__PURE__ */ jsx(TagsInputInline, {
135
+ ...restProps,
134
136
  id,
135
137
  label,
136
138
  className,
@@ -156,81 +158,81 @@ function TagsInput({ id, value = EMPTY_ARRAY, onChange, options = EMPTY_OPTIONS,
156
158
  onAddCurrentInput: handleAddCurrentInput,
157
159
  showClear: value.length > 0 && !disabled && !readOnly
158
160
  });
159
- return /* @__PURE__ */ jsxs("div", {
160
- className: cn("relative", className),
161
- children: [label !== void 0 && label !== "" ? /* @__PURE__ */ jsx(TagsInputInLineLabel, { children: label }) : null, /* @__PURE__ */ jsxs(Popover, {
161
+ const showLabel = label !== void 0 && label !== "";
162
+ return /* @__PURE__ */ jsxs(showLabel ? "div" : React.Fragment, {
163
+ ...showLabel ? { className: cn("relative", className) } : {},
164
+ children: [showLabel ? /* @__PURE__ */ jsx(TagsInputInLineLabel, { children: label }) : null, /* @__PURE__ */ jsxs(Popover, {
162
165
  open: open && !disabled && !readOnly,
163
166
  onOpenChange: setOpen,
164
167
  children: [/* @__PURE__ */ jsx(PopoverTrigger, {
165
168
  asChild: true,
166
- children: /* @__PURE__ */ jsx("div", {
167
- className: "w-full",
168
- children: /* @__PURE__ */ jsx(TagsInputInline, {
169
- id,
170
- label,
171
- showLabel: false,
172
- disabled,
173
- editable,
174
- max: maxTags,
175
- onValueChange: handleValueChange,
176
- onValidate: handleValidate,
177
- readOnly,
178
- value: stringValues,
179
- delimiter: freeSolo ? delimiter : void 0,
180
- addOnPaste: freeSolo ? addOnPaste : false,
181
- addOnTab: freeSolo ? addOnTab : false,
182
- items: inlineItems,
183
- onListClick: (e) => {
184
- if (!disabled && !readOnly) {
185
- e.stopPropagation();
186
- setOpen(true);
187
- }
188
- },
189
- inputRef,
190
- inputPlaceholder: placeholder,
191
- inputValue: searchValue,
192
- onInputFocus: (e) => {
169
+ children: /* @__PURE__ */ jsx(TagsInputInline, {
170
+ ...restProps,
171
+ className: cn("w-full", className),
172
+ id,
173
+ label,
174
+ showLabel: false,
175
+ disabled,
176
+ editable,
177
+ max: maxTags,
178
+ onValueChange: handleValueChange,
179
+ onValidate: handleValidate,
180
+ readOnly,
181
+ value: stringValues,
182
+ delimiter: freeSolo ? delimiter : void 0,
183
+ addOnPaste: freeSolo ? addOnPaste : false,
184
+ addOnTab: freeSolo ? addOnTab : false,
185
+ items: inlineItems,
186
+ onListClick: (e) => {
187
+ if (!disabled && !readOnly) {
193
188
  e.stopPropagation();
194
189
  setOpen(true);
195
- },
196
- onInputChange: (e) => {
190
+ }
191
+ },
192
+ inputRef,
193
+ inputPlaceholder: placeholder,
194
+ inputValue: searchValue,
195
+ onInputFocus: (e) => {
196
+ e.stopPropagation();
197
+ setOpen(true);
198
+ },
199
+ onInputChange: (e) => {
200
+ e.stopPropagation();
201
+ setSearchValue(e.target.value);
202
+ },
203
+ onInputKeyDown: (e) => {
204
+ if (open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
205
+ e.preventDefault();
197
206
  e.stopPropagation();
198
- setSearchValue(e.target.value);
199
- },
200
- onInputKeyDown: (e) => {
201
- if (open && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
207
+ const command = document.querySelector("[cmdk-root]");
208
+ if (command) {
209
+ const event = new KeyboardEvent("keydown", {
210
+ key: e.key,
211
+ bubbles: true,
212
+ cancelable: true
213
+ });
214
+ command.dispatchEvent(event);
215
+ }
216
+ return;
217
+ }
218
+ if (open && e.key === "Enter") {
219
+ const selectedItem = document.querySelector("[cmdk-item][data-selected=\"true\"]");
220
+ if (selectedItem) {
202
221
  e.preventDefault();
203
222
  e.stopPropagation();
204
- const command = document.querySelector("[cmdk-root]");
205
- if (command) {
206
- const event = new KeyboardEvent("keydown", {
207
- key: e.key,
208
- bubbles: true,
209
- cancelable: true
210
- });
211
- command.dispatchEvent(event);
212
- }
223
+ selectedItem.click();
213
224
  return;
214
225
  }
215
- if (open && e.key === "Enter") {
216
- const selectedItem = document.querySelector("[cmdk-item][data-selected=\"true\"]");
217
- if (selectedItem) {
218
- e.preventDefault();
219
- e.stopPropagation();
220
- selectedItem.click();
221
- return;
222
- }
223
- }
224
- e.stopPropagation();
225
- },
226
- onInputMouseDown: (e) => {
227
- e.stopPropagation();
228
- },
229
- addButtonVisibility,
230
- canAddCurrentValue,
231
- onAddCurrentInput: handleAddCurrentInput,
232
- showClear: value.length > 0 && !disabled && !readOnly
233
- })
226
+ }
227
+ e.stopPropagation();
228
+ },
229
+ onInputMouseDown: (e) => {
230
+ e.stopPropagation();
231
+ },
232
+ addButtonVisibility,
233
+ canAddCurrentValue,
234
+ onAddCurrentInput: handleAddCurrentInput,
235
+ showClear: value.length > 0 && !disabled && !readOnly
234
236
  })
235
237
  }), /* @__PURE__ */ jsx(PopoverContent, {
236
238
  className: "p-0",