@usefragments/ui 1.3.3 → 1.4.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 (137) hide show
  1. package/dist/assets/ui.css +1176 -766
  2. package/dist/chart.cjs +60 -24
  3. package/dist/chart.js +38 -24
  4. package/dist/colorpicker.cjs +56 -9
  5. package/dist/colorpicker.js +34 -9
  6. package/dist/components/Badge/Badge.module.scss.cjs +23 -16
  7. package/dist/components/Badge/Badge.module.scss.js +23 -16
  8. package/dist/components/Badge/index.cjs +8 -1
  9. package/dist/components/Badge/index.d.ts +3 -0
  10. package/dist/components/Badge/index.d.ts.map +1 -1
  11. package/dist/components/Badge/index.js +8 -1
  12. package/dist/components/Button/Button.module.scss.cjs +16 -13
  13. package/dist/components/Button/Button.module.scss.js +16 -13
  14. package/dist/components/Button/index.d.ts +2 -1
  15. package/dist/components/Button/index.d.ts.map +1 -1
  16. package/dist/components/Chart/index.d.ts +3 -0
  17. package/dist/components/Chart/index.d.ts.map +1 -1
  18. package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
  19. package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
  20. package/dist/components/ColorPicker/index.d.ts +4 -0
  21. package/dist/components/ColorPicker/index.d.ts.map +1 -1
  22. package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
  23. package/dist/components/Combobox/Combobox.module.scss.js +23 -23
  24. package/dist/components/Command/Command.module.scss.cjs +11 -11
  25. package/dist/components/Command/Command.module.scss.js +11 -11
  26. package/dist/components/ConversationList/ConversationList.module.scss.cjs +13 -10
  27. package/dist/components/ConversationList/ConversationList.module.scss.js +14 -11
  28. package/dist/components/ConversationList/index.cjs +26 -22
  29. package/dist/components/ConversationList/index.d.ts +5 -1
  30. package/dist/components/ConversationList/index.d.ts.map +1 -1
  31. package/dist/components/ConversationList/index.js +27 -23
  32. package/dist/components/DataTable/index.d.ts +4 -1
  33. package/dist/components/DataTable/index.d.ts.map +1 -1
  34. package/dist/components/DatePicker/index.d.ts +3 -0
  35. package/dist/components/DatePicker/index.d.ts.map +1 -1
  36. package/dist/components/Editor/index.d.ts +4 -1
  37. package/dist/components/Editor/index.d.ts.map +1 -1
  38. package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
  39. package/dist/components/Listbox/Listbox.module.scss.js +8 -8
  40. package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
  41. package/dist/components/Markdown/Markdown.module.scss.js +1 -1
  42. package/dist/components/Markdown/index.d.ts +16 -0
  43. package/dist/components/Markdown/index.d.ts.map +1 -1
  44. package/dist/components/Menu/Menu.module.scss.cjs +14 -14
  45. package/dist/components/Menu/Menu.module.scss.js +14 -14
  46. package/dist/components/Message/Message.module.scss.cjs +23 -20
  47. package/dist/components/Message/Message.module.scss.js +24 -21
  48. package/dist/components/Message/index.cjs +5 -1
  49. package/dist/components/Message/index.d.ts.map +1 -1
  50. package/dist/components/Message/index.js +5 -1
  51. package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
  52. package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
  53. package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
  54. package/dist/components/Pagination/Pagination.module.scss.js +7 -7
  55. package/dist/components/Prompt/Prompt.module.scss.cjs +52 -22
  56. package/dist/components/Prompt/Prompt.module.scss.js +52 -22
  57. package/dist/components/Prompt/index.cjs +197 -2
  58. package/dist/components/Prompt/index.d.ts +98 -3
  59. package/dist/components/Prompt/index.d.ts.map +1 -1
  60. package/dist/components/Prompt/index.js +198 -3
  61. package/dist/components/Select/Select.module.scss.cjs +29 -17
  62. package/dist/components/Select/Select.module.scss.js +30 -18
  63. package/dist/components/Select/index.cjs +45 -8
  64. package/dist/components/Select/index.d.ts +17 -2
  65. package/dist/components/Select/index.d.ts.map +1 -1
  66. package/dist/components/Select/index.js +45 -8
  67. package/dist/components/Sidebar/Sidebar.module.scss.cjs +45 -42
  68. package/dist/components/Sidebar/Sidebar.module.scss.js +45 -42
  69. package/dist/components/Sidebar/index.cjs +2 -0
  70. package/dist/components/Sidebar/index.d.ts +6 -1
  71. package/dist/components/Sidebar/index.d.ts.map +1 -1
  72. package/dist/components/Sidebar/index.js +2 -0
  73. package/dist/components/Text/Text.module.scss.cjs +63 -51
  74. package/dist/components/Text/Text.module.scss.js +63 -51
  75. package/dist/components/Text/index.d.ts +4 -2
  76. package/dist/components/Text/index.d.ts.map +1 -1
  77. package/dist/data-table.cjs +210 -28
  78. package/dist/data-table.js +189 -29
  79. package/dist/datepicker.cjs +63 -14
  80. package/dist/datepicker.js +41 -14
  81. package/dist/editor.cjs +67 -16
  82. package/dist/editor.js +45 -16
  83. package/dist/index.cjs +1 -0
  84. package/dist/index.d.ts +1 -1
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +2 -1
  87. package/dist/markdown.cjs +63 -19
  88. package/dist/markdown.js +41 -19
  89. package/fragments.json +1 -1
  90. package/package.json +2 -2
  91. package/src/components/Badge/Badge.contract.json +28 -5
  92. package/src/components/Badge/Badge.module.scss +21 -0
  93. package/src/components/Badge/index.tsx +10 -1
  94. package/src/components/Button/Button.contract.json +9 -3
  95. package/src/components/Button/Button.module.scss +34 -0
  96. package/src/components/Button/index.tsx +11 -1
  97. package/src/components/Chart/Chart.contract.json +7 -0
  98. package/src/components/Chart/index.tsx +44 -27
  99. package/src/components/CodeBlock/CodeBlock.contract.json +7 -0
  100. package/src/components/CodeBlock/CodeBlock.module.scss +7 -2
  101. package/src/components/ColorPicker/ColorPicker.contract.json +9 -1
  102. package/src/components/ColorPicker/index.tsx +42 -12
  103. package/src/components/Combobox/Combobox.module.scss +4 -13
  104. package/src/components/ConversationList/ConversationList.contract.json +16 -1
  105. package/src/components/ConversationList/ConversationList.module.scss +12 -0
  106. package/src/components/ConversationList/index.tsx +40 -26
  107. package/src/components/DataTable/DataTable.contract.json +8 -1
  108. package/src/components/DataTable/index.tsx +282 -51
  109. package/src/components/DatePicker/DatePicker.contract.json +8 -1
  110. package/src/components/DatePicker/index.tsx +51 -22
  111. package/src/components/Editor/Editor.contract.json +19 -1
  112. package/src/components/Editor/index.tsx +67 -23
  113. package/src/components/Listbox/Listbox.module.scss +3 -11
  114. package/src/components/Markdown/Markdown.contract.json +15 -1
  115. package/src/components/Markdown/Markdown.module.scss +18 -1
  116. package/src/components/Markdown/index.tsx +58 -24
  117. package/src/components/Menu/Menu.module.scss +12 -2
  118. package/src/components/Message/Message.contract.json +3 -0
  119. package/src/components/Message/Message.module.scss +33 -4
  120. package/src/components/Message/index.tsx +7 -1
  121. package/src/components/Pagination/Pagination.contract.json +1 -0
  122. package/src/components/Pagination/Pagination.module.scss +5 -4
  123. package/src/components/Prompt/Prompt.contract.json +40 -1
  124. package/src/components/Prompt/Prompt.module.scss +351 -4
  125. package/src/components/Prompt/index.tsx +324 -0
  126. package/src/components/Select/Select.contract.json +11 -1
  127. package/src/components/Select/Select.module.scss +80 -13
  128. package/src/components/Select/index.tsx +73 -7
  129. package/src/components/Sidebar/Sidebar.contract.json +1 -0
  130. package/src/components/Sidebar/Sidebar.module.scss +10 -0
  131. package/src/components/Sidebar/index.tsx +7 -0
  132. package/src/components/Text/Text.contract.json +7 -4
  133. package/src/components/Text/Text.module.scss +18 -0
  134. package/src/components/Text/index.tsx +4 -2
  135. package/src/index.ts +1 -0
  136. package/src/tokens/_mixins.scss +39 -4
  137. package/src/tokens/_variables.scss +30 -0
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const pagination = "_pagination_1ruwh_1";
4
- const list = "_list_1ruwh_7";
5
- const item = "_item_1ruwh_16";
6
- const itemActive = "_itemActive_1ruwh_57";
7
- const itemDisabled = "_itemDisabled_1ruwh_65";
8
- const navButton = "_navButton_1ruwh_71";
9
- const ellipsis = "_ellipsis_1ruwh_76";
3
+ const pagination = "_pagination_lk556_1";
4
+ const list = "_list_lk556_7";
5
+ const item = "_item_lk556_16";
6
+ const itemActive = "_itemActive_lk556_57";
7
+ const itemDisabled = "_itemDisabled_lk556_66";
8
+ const navButton = "_navButton_lk556_72";
9
+ const ellipsis = "_ellipsis_lk556_77";
10
10
  const styles = {
11
11
  pagination,
12
12
  list,
@@ -1,10 +1,10 @@
1
- const pagination = "_pagination_1ruwh_1";
2
- const list = "_list_1ruwh_7";
3
- const item = "_item_1ruwh_16";
4
- const itemActive = "_itemActive_1ruwh_57";
5
- const itemDisabled = "_itemDisabled_1ruwh_65";
6
- const navButton = "_navButton_1ruwh_71";
7
- const ellipsis = "_ellipsis_1ruwh_76";
1
+ const pagination = "_pagination_lk556_1";
2
+ const list = "_list_lk556_7";
3
+ const item = "_item_lk556_16";
4
+ const itemActive = "_itemActive_lk556_57";
5
+ const itemDisabled = "_itemDisabled_lk556_66";
6
+ const navButton = "_navButton_lk556_72";
7
+ const ellipsis = "_ellipsis_lk556_77";
8
8
  const styles = {
9
9
  pagination,
10
10
  list,
@@ -1,51 +1,81 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const prompt = "_prompt_1k8t3_1";
4
- const fixed = "_fixed_1k8t3_60";
5
- const sticky = "_sticky_1k8t3_71";
6
- const textarea = "_textarea_1k8t3_86";
7
- const tabs = "_tabs_1k8t3_127";
8
- const tabsInner = "_tabsInner_1k8t3_135";
9
- const tabButton = "_tabButton_1k8t3_145";
10
- const tabButtonActive = "_tabButtonActive_1k8t3_174";
11
- const toolbar = "_toolbar_1k8t3_179";
12
- const actions = "_actions_1k8t3_189";
13
- const info = "_info_1k8t3_196";
14
- const actionButton = "_actionButton_1k8t3_203";
15
- const modeButton = "_modeButton_1k8t3_249";
16
- const modeButtonActive = "_modeButtonActive_1k8t3_292";
17
- const usage = "_usage_1k8t3_297";
18
- const submit = "_submit_1k8t3_304";
19
- const submitLoading = "_submitLoading_1k8t3_353";
20
- const submitSpinner = "_submitSpinner_1k8t3_357";
3
+ const prompt = "_prompt_1wo4v_1";
4
+ const fixed = "_fixed_1wo4v_60";
5
+ const sticky = "_sticky_1wo4v_71";
6
+ const seamless = "_seamless_1wo4v_86";
7
+ const toolbar = "_toolbar_1wo4v_102";
8
+ const textarea = "_textarea_1wo4v_107";
9
+ const attachments = "_attachments_1wo4v_110";
10
+ const tabs = "_tabs_1wo4v_115";
11
+ const tabsInner = "_tabsInner_1wo4v_123";
12
+ const attach = "_attach_1wo4v_110";
13
+ const select = "_select_1wo4v_141";
14
+ const modeButton = "_modeButton_1wo4v_142";
15
+ const submit = "_submit_1wo4v_173";
16
+ const actionButton = "_actionButton_1wo4v_174";
17
+ const tabButton = "_tabButton_1wo4v_246";
18
+ const tabButtonActive = "_tabButtonActive_1wo4v_275";
19
+ const actions = "_actions_1wo4v_290";
20
+ const info = "_info_1wo4v_297";
21
+ const modeButtonActive = "_modeButtonActive_1wo4v_393";
22
+ const attachment = "_attachment_1wo4v_110";
23
+ const attachmentThumb = "_attachmentThumb_1wo4v_473";
24
+ const attachmentName = "_attachmentName_1wo4v_481";
25
+ const attachmentSize = "_attachmentSize_1wo4v_489";
26
+ const attachmentRemove = "_attachmentRemove_1wo4v_495";
27
+ const dragging = "_dragging_1wo4v_539";
28
+ const usage = "_usage_1wo4v_547";
29
+ const submitLoading = "_submitLoading_1wo4v_603";
30
+ const submitSpinner = "_submitSpinner_1wo4v_607";
21
31
  const styles = {
22
32
  prompt,
23
33
  fixed,
24
34
  sticky,
35
+ seamless,
36
+ toolbar,
25
37
  textarea,
38
+ attachments,
26
39
  tabs,
27
40
  tabsInner,
41
+ attach,
42
+ select,
43
+ modeButton,
44
+ submit,
45
+ actionButton,
28
46
  tabButton,
29
47
  tabButtonActive,
30
- toolbar,
31
48
  actions,
32
49
  info,
33
- actionButton,
34
- modeButton,
35
50
  modeButtonActive,
51
+ attachment,
52
+ attachmentThumb,
53
+ attachmentName,
54
+ attachmentSize,
55
+ attachmentRemove,
56
+ dragging,
36
57
  usage,
37
- submit,
38
58
  submitLoading,
39
59
  submitSpinner
40
60
  };
41
61
  exports.actionButton = actionButton;
42
62
  exports.actions = actions;
63
+ exports.attach = attach;
64
+ exports.attachment = attachment;
65
+ exports.attachmentName = attachmentName;
66
+ exports.attachmentRemove = attachmentRemove;
67
+ exports.attachmentSize = attachmentSize;
68
+ exports.attachmentThumb = attachmentThumb;
69
+ exports.attachments = attachments;
43
70
  exports.default = styles;
71
+ exports.dragging = dragging;
44
72
  exports.fixed = fixed;
45
73
  exports.info = info;
46
74
  exports.modeButton = modeButton;
47
75
  exports.modeButtonActive = modeButtonActive;
48
76
  exports.prompt = prompt;
77
+ exports.seamless = seamless;
78
+ exports.select = select;
49
79
  exports.sticky = sticky;
50
80
  exports.submit = submit;
51
81
  exports.submitLoading = submitLoading;
@@ -1,50 +1,80 @@
1
- const prompt = "_prompt_1k8t3_1";
2
- const fixed = "_fixed_1k8t3_60";
3
- const sticky = "_sticky_1k8t3_71";
4
- const textarea = "_textarea_1k8t3_86";
5
- const tabs = "_tabs_1k8t3_127";
6
- const tabsInner = "_tabsInner_1k8t3_135";
7
- const tabButton = "_tabButton_1k8t3_145";
8
- const tabButtonActive = "_tabButtonActive_1k8t3_174";
9
- const toolbar = "_toolbar_1k8t3_179";
10
- const actions = "_actions_1k8t3_189";
11
- const info = "_info_1k8t3_196";
12
- const actionButton = "_actionButton_1k8t3_203";
13
- const modeButton = "_modeButton_1k8t3_249";
14
- const modeButtonActive = "_modeButtonActive_1k8t3_292";
15
- const usage = "_usage_1k8t3_297";
16
- const submit = "_submit_1k8t3_304";
17
- const submitLoading = "_submitLoading_1k8t3_353";
18
- const submitSpinner = "_submitSpinner_1k8t3_357";
1
+ const prompt = "_prompt_1wo4v_1";
2
+ const fixed = "_fixed_1wo4v_60";
3
+ const sticky = "_sticky_1wo4v_71";
4
+ const seamless = "_seamless_1wo4v_86";
5
+ const toolbar = "_toolbar_1wo4v_102";
6
+ const textarea = "_textarea_1wo4v_107";
7
+ const attachments = "_attachments_1wo4v_110";
8
+ const tabs = "_tabs_1wo4v_115";
9
+ const tabsInner = "_tabsInner_1wo4v_123";
10
+ const attach = "_attach_1wo4v_110";
11
+ const select = "_select_1wo4v_141";
12
+ const modeButton = "_modeButton_1wo4v_142";
13
+ const submit = "_submit_1wo4v_173";
14
+ const actionButton = "_actionButton_1wo4v_174";
15
+ const tabButton = "_tabButton_1wo4v_246";
16
+ const tabButtonActive = "_tabButtonActive_1wo4v_275";
17
+ const actions = "_actions_1wo4v_290";
18
+ const info = "_info_1wo4v_297";
19
+ const modeButtonActive = "_modeButtonActive_1wo4v_393";
20
+ const attachment = "_attachment_1wo4v_110";
21
+ const attachmentThumb = "_attachmentThumb_1wo4v_473";
22
+ const attachmentName = "_attachmentName_1wo4v_481";
23
+ const attachmentSize = "_attachmentSize_1wo4v_489";
24
+ const attachmentRemove = "_attachmentRemove_1wo4v_495";
25
+ const dragging = "_dragging_1wo4v_539";
26
+ const usage = "_usage_1wo4v_547";
27
+ const submitLoading = "_submitLoading_1wo4v_603";
28
+ const submitSpinner = "_submitSpinner_1wo4v_607";
19
29
  const styles = {
20
30
  prompt,
21
31
  fixed,
22
32
  sticky,
33
+ seamless,
34
+ toolbar,
23
35
  textarea,
36
+ attachments,
24
37
  tabs,
25
38
  tabsInner,
39
+ attach,
40
+ select,
41
+ modeButton,
42
+ submit,
43
+ actionButton,
26
44
  tabButton,
27
45
  tabButtonActive,
28
- toolbar,
29
46
  actions,
30
47
  info,
31
- actionButton,
32
- modeButton,
33
48
  modeButtonActive,
49
+ attachment,
50
+ attachmentThumb,
51
+ attachmentName,
52
+ attachmentSize,
53
+ attachmentRemove,
54
+ dragging,
34
55
  usage,
35
- submit,
36
56
  submitLoading,
37
57
  submitSpinner
38
58
  };
39
59
  export {
40
60
  actionButton,
41
61
  actions,
62
+ attach,
63
+ attachment,
64
+ attachmentName,
65
+ attachmentRemove,
66
+ attachmentSize,
67
+ attachmentThumb,
68
+ attachments,
42
69
  styles as default,
70
+ dragging,
43
71
  fixed,
44
72
  info,
45
73
  modeButton,
46
74
  modeButtonActive,
47
75
  prompt,
76
+ seamless,
77
+ select,
48
78
  sticky,
49
79
  submit,
50
80
  submitLoading,
@@ -5,6 +5,7 @@ const jsxRuntime = require("react/jsx-runtime");
5
5
  const React = require("react");
6
6
  const Prompt_module = require("./Prompt.module.scss.cjs");
7
7
  const index = require("../Loading/index.cjs");
8
+ const index$1 = require("../Select/index.cjs");
8
9
  function _interopNamespaceDefault(e) {
9
10
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
11
  if (e) {
@@ -22,6 +23,34 @@ function _interopNamespaceDefault(e) {
22
23
  return Object.freeze(n);
23
24
  }
24
25
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
+ function PlusIcon() {
27
+ return /* @__PURE__ */ jsxRuntime.jsx(
28
+ "svg",
29
+ {
30
+ xmlns: "http://www.w3.org/2000/svg",
31
+ width: "16",
32
+ height: "16",
33
+ viewBox: "0 0 256 256",
34
+ fill: "currentColor",
35
+ "aria-hidden": "true",
36
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z" })
37
+ }
38
+ );
39
+ }
40
+ function CloseIcon() {
41
+ return /* @__PURE__ */ jsxRuntime.jsx(
42
+ "svg",
43
+ {
44
+ xmlns: "http://www.w3.org/2000/svg",
45
+ width: "16",
46
+ height: "16",
47
+ viewBox: "0 0 256 256",
48
+ fill: "currentColor",
49
+ "aria-hidden": "true",
50
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" })
51
+ }
52
+ );
53
+ }
25
54
  function ArrowUpIcon() {
26
55
  return /* @__PURE__ */ jsxRuntime.jsx(
27
56
  "svg",
@@ -73,10 +102,15 @@ function PromptRoot({
73
102
  autoResize = true,
74
103
  submitOnEnter = true,
75
104
  variant = "default",
105
+ appearance = "panel",
106
+ onFiles,
107
+ accept,
76
108
  className,
77
109
  ...htmlProps
78
110
  }) {
79
111
  const textareaRef = React__namespace.useRef(null);
112
+ const [dragging, setDragging] = React__namespace.useState(false);
113
+ const dragDepth = React__namespace.useRef(0);
80
114
  const [value, setValue] = useControllableState(
81
115
  controlledValue,
82
116
  defaultValue,
@@ -86,6 +120,13 @@ function PromptRoot({
86
120
  if (disabled || loading || !value.trim()) return;
87
121
  onSubmit == null ? void 0 : onSubmit(value);
88
122
  }, [disabled, loading, value, onSubmit]);
123
+ const acceptFiles = React__namespace.useCallback(
124
+ (files) => {
125
+ if (!onFiles || disabled || loading || files.length === 0) return;
126
+ onFiles(files);
127
+ },
128
+ [onFiles, disabled, loading]
129
+ );
89
130
  const contextValue = {
90
131
  value,
91
132
  setValue,
@@ -97,12 +138,39 @@ function PromptRoot({
97
138
  autoResize,
98
139
  submitOnEnter,
99
140
  handleSubmit,
100
- textareaRef
141
+ textareaRef,
142
+ accept,
143
+ onFiles: onFiles ? acceptFiles : void 0
101
144
  };
145
+ const dropHandlers = onFiles ? {
146
+ onDragEnter: (event) => {
147
+ if (!event.dataTransfer.types.includes("Files")) return;
148
+ dragDepth.current += 1;
149
+ setDragging(true);
150
+ },
151
+ onDragOver: (event) => {
152
+ if (!event.dataTransfer.types.includes("Files")) return;
153
+ event.preventDefault();
154
+ event.dataTransfer.dropEffect = "copy";
155
+ },
156
+ onDragLeave: () => {
157
+ dragDepth.current = Math.max(0, dragDepth.current - 1);
158
+ if (dragDepth.current === 0) setDragging(false);
159
+ },
160
+ onDrop: (event) => {
161
+ if (!event.dataTransfer.types.includes("Files")) return;
162
+ event.preventDefault();
163
+ dragDepth.current = 0;
164
+ setDragging(false);
165
+ acceptFiles(Array.from(event.dataTransfer.files));
166
+ }
167
+ } : null;
102
168
  const classes = [
103
169
  Prompt_module.default.prompt,
104
170
  variant === "fixed" && Prompt_module.default.fixed,
105
171
  variant === "sticky" && Prompt_module.default.sticky,
172
+ appearance === "seamless" && Prompt_module.default.seamless,
173
+ dragging && Prompt_module.default.dragging,
106
174
  disabled && Prompt_module.default.disabled,
107
175
  loading && Prompt_module.default.loading,
108
176
  className
@@ -111,10 +179,13 @@ function PromptRoot({
111
179
  "div",
112
180
  {
113
181
  ...htmlProps,
182
+ ...dropHandlers,
114
183
  className: classes,
115
184
  "data-disabled": disabled || void 0,
116
185
  "data-loading": loading || void 0,
117
186
  "data-variant": variant,
187
+ "data-appearance": appearance,
188
+ "data-dragging": dragging || void 0,
118
189
  children
119
190
  }
120
191
  ) });
@@ -124,6 +195,7 @@ function PromptTextarea({
124
195
  className,
125
196
  onChange,
126
197
  onKeyDown,
198
+ onPaste,
127
199
  "aria-label": ariaLabel,
128
200
  ...htmlProps
129
201
  }) {
@@ -138,7 +210,8 @@ function PromptTextarea({
138
210
  autoResize,
139
211
  submitOnEnter,
140
212
  handleSubmit,
141
- textareaRef
213
+ textareaRef,
214
+ onFiles
142
215
  } = usePromptContext();
143
216
  const lineHeight = 1.5;
144
217
  const padding = 12;
@@ -169,6 +242,20 @@ function PromptTextarea({
169
242
  handleSubmit();
170
243
  }
171
244
  };
245
+ const handlePaste = (e) => {
246
+ onPaste == null ? void 0 : onPaste(e);
247
+ if (e.defaultPrevented || !onFiles) return;
248
+ const files = Array.from(e.clipboardData.files);
249
+ if (files.length === 0) return;
250
+ e.preventDefault();
251
+ onFiles(
252
+ files.map(
253
+ (file, index2) => file.name && file.name !== "image.png" ? file : new File([file], `pasted-${index2 + 1}.${file.type.split("/")[1] || "png"}`, {
254
+ type: file.type
255
+ })
256
+ )
257
+ );
258
+ };
172
259
  const classes = [Prompt_module.default.textarea, className].filter(Boolean).join(" ");
173
260
  return /* @__PURE__ */ jsxRuntime.jsx(
174
261
  "textarea",
@@ -179,6 +266,7 @@ function PromptTextarea({
179
266
  value,
180
267
  onChange: handleChange,
181
268
  onKeyDown: handleKeyDown,
269
+ onPaste: handlePaste,
182
270
  placeholder: overridePlaceholder ?? placeholder,
183
271
  disabled: disabled || loading,
184
272
  rows: minRows,
@@ -259,6 +347,107 @@ function PromptModeButton({
259
347
  }
260
348
  );
261
349
  }
350
+ function formatSize(bytes) {
351
+ if (bytes < 1024) return `${bytes} B`;
352
+ const kb = bytes / 1024;
353
+ if (kb < 1024) return `${Math.round(kb)} KB`;
354
+ return `${(kb / 1024).toFixed(kb / 1024 < 10 ? 1 : 0)} MB`;
355
+ }
356
+ function PromptAttachments({ items, onRemove, className }) {
357
+ if (items.length === 0) return null;
358
+ const classes = [Prompt_module.default.attachments, className].filter(Boolean).join(" ");
359
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, "aria-label": "Attachments", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: Prompt_module.default.attachment, children: [
360
+ item.previewUrl ? (
361
+ // Decorative: the filename beside it is the accessible name, and a
362
+ // thumbnail of a screenshot has no description worth inventing.
363
+ /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.previewUrl, alt: "", className: Prompt_module.default.attachmentThumb })
364
+ ) : null,
365
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: Prompt_module.default.attachmentName, title: item.name, children: item.name }),
366
+ item.size != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: Prompt_module.default.attachmentSize, children: formatSize(item.size) }),
367
+ onRemove && /* @__PURE__ */ jsxRuntime.jsx(
368
+ "button",
369
+ {
370
+ type: "button",
371
+ className: Prompt_module.default.attachmentRemove,
372
+ onClick: () => onRemove(item.id),
373
+ "aria-label": `Remove ${item.name}`,
374
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
375
+ }
376
+ )
377
+ ] }, item.id)) });
378
+ }
379
+ function PromptAttach({
380
+ "aria-label": ariaLabel = "Attach files",
381
+ children,
382
+ accept: acceptOverride,
383
+ multiple = true,
384
+ disabled: buttonDisabled,
385
+ className
386
+ }) {
387
+ const { disabled, loading, accept, onFiles } = usePromptContext();
388
+ const inputRef = React__namespace.useRef(null);
389
+ const isDisabled = disabled || loading || buttonDisabled || !onFiles;
390
+ const classes = [Prompt_module.default.attach, className].filter(Boolean).join(" ");
391
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
392
+ /* @__PURE__ */ jsxRuntime.jsx(
393
+ "button",
394
+ {
395
+ type: "button",
396
+ className: classes,
397
+ onClick: () => {
398
+ var _a;
399
+ return (_a = inputRef.current) == null ? void 0 : _a.click();
400
+ },
401
+ disabled: isDisabled,
402
+ "aria-label": ariaLabel,
403
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {})
404
+ }
405
+ ),
406
+ /* @__PURE__ */ jsxRuntime.jsx(
407
+ "input",
408
+ {
409
+ ref: inputRef,
410
+ type: "file",
411
+ hidden: true,
412
+ accept: acceptOverride ?? accept,
413
+ multiple,
414
+ onChange: (event) => {
415
+ const files = Array.from(event.target.files ?? []);
416
+ event.target.value = "";
417
+ onFiles == null ? void 0 : onFiles(files);
418
+ }
419
+ }
420
+ )
421
+ ] });
422
+ }
423
+ function PromptSelect({
424
+ icon,
425
+ "aria-label": ariaLabel,
426
+ options,
427
+ children,
428
+ placeholder,
429
+ disabled: selectDisabled,
430
+ className,
431
+ ...selectProps
432
+ }) {
433
+ const { disabled, loading } = usePromptContext();
434
+ const classes = [Prompt_module.default.select, className].filter(Boolean).join(" ");
435
+ return /* @__PURE__ */ jsxRuntime.jsxs(
436
+ index$1.Select,
437
+ {
438
+ ...selectProps,
439
+ size: "sm",
440
+ variant: "ghost",
441
+ options,
442
+ placeholder,
443
+ disabled: disabled || loading || selectDisabled,
444
+ children: [
445
+ /* @__PURE__ */ jsxRuntime.jsx(index$1.Select.Trigger, { className: classes, icon, "aria-label": ariaLabel }),
446
+ /* @__PURE__ */ jsxRuntime.jsx(index$1.Select.Content, { children })
447
+ ]
448
+ }
449
+ );
450
+ }
262
451
  function PromptUsage({ children, className }) {
263
452
  const classes = [Prompt_module.default.usage, className].filter(Boolean).join(" ");
264
453
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: classes, children });
@@ -305,15 +494,21 @@ const Prompt = Object.assign(PromptRoot, {
305
494
  Info: PromptInfo,
306
495
  ActionButton: PromptActionButton,
307
496
  ModeButton: PromptModeButton,
497
+ Select: PromptSelect,
498
+ Attach: PromptAttach,
499
+ Attachments: PromptAttachments,
308
500
  Usage: PromptUsage,
309
501
  Submit: PromptSubmit
310
502
  });
311
503
  exports.Prompt = Prompt;
312
504
  exports.PromptActionButton = PromptActionButton;
313
505
  exports.PromptActions = PromptActions;
506
+ exports.PromptAttach = PromptAttach;
507
+ exports.PromptAttachments = PromptAttachments;
314
508
  exports.PromptInfo = PromptInfo;
315
509
  exports.PromptModeButton = PromptModeButton;
316
510
  exports.PromptRoot = PromptRoot;
511
+ exports.PromptSelect = PromptSelect;
317
512
  exports.PromptSubmit = PromptSubmit;
318
513
  exports.PromptTab = PromptTab;
319
514
  exports.PromptTabs = PromptTabs;