@apple-pie/slice 0.0.4 → 0.0.6

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 (219) hide show
  1. package/README.md +13 -6
  2. package/dist/cjs/chunks/{Avatar-8-wPWe0V.js → Avatar-z2YcOAoP.js} +1 -1
  3. package/dist/cjs/chunks/{AvatarGroup-CVKmgBbD.js → AvatarGroup-Cz8369zI.js} +1 -1
  4. package/dist/cjs/chunks/{Badge-CMapJCij.js → Badge-COSg__VJ.js} +1 -1
  5. package/dist/cjs/chunks/{UIButton-W-WjUvVm.js → Button-BNXqiA13.js} +28 -33
  6. package/dist/cjs/chunks/{UIButtonBar-FvX4kB-s.js → ButtonBar-CeDdAOlH.js} +5 -5
  7. package/dist/cjs/chunks/{UICard-DBDSyT7E.js → Card-Cc_c-S7i.js} +5 -5
  8. package/dist/cjs/chunks/{CheckBox-7AACxrdZ.js → CheckBox-hTWIPqV_.js} +2 -2
  9. package/dist/cjs/chunks/{UIChip-kjhvRrOV.js → Chip-CLKVldi4.js} +5 -5
  10. package/dist/cjs/chunks/{DivInput-BKKJTFeV.js → DivInput-DnY2emt-.js} +2 -2
  11. package/dist/cjs/chunks/{DrggablePanel-C6TPsDB-.js → DrggablePanel-BtsURL9o.js} +1 -1
  12. package/dist/cjs/chunks/{DropDown-D9sf_m2I.js → DropDown-COr9u96t.js} +2 -2
  13. package/dist/cjs/chunks/{ErrorSummary-Dv44onsV.js → ErrorSummary-BrSHbGpk.js} +1 -1
  14. package/dist/cjs/chunks/FileIcon-CEMQK_Je.js +132 -0
  15. package/dist/cjs/chunks/FileList-BHMne9Mr.js +163 -0
  16. package/dist/cjs/chunks/{FlexDiv-DZBpswHV.js → FlexDiv-BHl29ywz.js} +1 -1
  17. package/dist/cjs/chunks/{Grouper-_kd2nU78.js → Grouper-EyHoeA8w.js} +3 -3
  18. package/dist/cjs/chunks/{IconButton-CjiNliPL.js → IconButton-9QZ4eKBZ.js} +3 -3
  19. package/dist/cjs/chunks/{UILabel-DpMIPlZO.js → Label-s1aCv2Y1.js} +17 -7
  20. package/dist/cjs/chunks/{Pager--55eRDdu.js → Pager-CRjpl1FZ.js} +1 -1
  21. package/dist/cjs/chunks/PromptInput-CfzofBTJ.js +212 -0
  22. package/dist/cjs/chunks/{RadioButton--k2YFFEG.js → RadioButton-DA9YUGEF.js} +2 -2
  23. package/dist/cjs/chunks/{RadioButtonList-D99mA5EZ.js → RadioButtonList-BtsT7GJc.js} +1 -1
  24. package/dist/cjs/chunks/{Slider-C-gn7Sby.js → Slider-CqrIwn-L.js} +1 -1
  25. package/dist/cjs/chunks/{TabBar-CqnPPTFy.js → TabBar-WsNlr-aZ.js} +4 -4
  26. package/dist/cjs/chunks/{TextArea-CWr6mi3Q.js → TextArea-BMJWUH2H.js} +3 -3
  27. package/dist/cjs/chunks/{TextField-BTyhrsbK.js → TextField-mfwz79cD.js} +5 -5
  28. package/dist/cjs/chunks/{Tip-DnLgI7WY.js → Tip-Af6FMEDi.js} +2 -2
  29. package/dist/cjs/chunks/{Toast-CTCc6Cyl.js → Toast-CxAEOW4z.js} +17 -4
  30. package/dist/cjs/chunks/UploadArea-DunGYE1_.js +155 -0
  31. package/dist/cjs/chunks/{_types-CoWzQFsT.js → _types-BNlHsGMQ.js} +2 -2
  32. package/dist/cjs/chunks/{utils-CbayehuI.js → utils-BwNacfBU.js} +2 -0
  33. package/dist/cjs/chunks/windowStore-CPcVHJq6.js +93 -0
  34. package/dist/cjs/hooks/useKeyboardShortcuts.js +3 -1
  35. package/dist/cjs/hooks/useObserveTheme.js +14 -8
  36. package/dist/cjs/hooks/useTrackRenders.js +2 -1
  37. package/dist/cjs/hooks/useWindow.js +29 -7
  38. package/dist/cjs/index.js +53 -38
  39. package/dist/cjs/providers/ThemeProvider.js +6 -3
  40. package/dist/cjs/stores/window.js +12 -0
  41. package/dist/cjs/stores.js +6 -0
  42. package/dist/cjs/theme/type.js +99 -18
  43. package/dist/cjs/uikit/Avatar.js +1 -1
  44. package/dist/cjs/uikit/AvatarGroup.js +2 -2
  45. package/dist/cjs/uikit/Badge.js +1 -1
  46. package/dist/cjs/uikit/{UIButton.js → Button.js} +7 -7
  47. package/dist/cjs/uikit/{UIButtonBar.js → ButtonBar.js} +6 -6
  48. package/dist/cjs/uikit/{UICard.js → Card.js} +4 -4
  49. package/dist/cjs/uikit/CheckBox.js +3 -3
  50. package/dist/cjs/uikit/{UIChip.js → Chip.js} +4 -4
  51. package/dist/cjs/uikit/DivInput.js +2 -2
  52. package/dist/cjs/uikit/DraggablePanel.js +2 -2
  53. package/dist/cjs/uikit/DropDown.js +3 -3
  54. package/dist/cjs/uikit/ErrorSummary.js +1 -1
  55. package/dist/cjs/uikit/{UIFileIcon.js → FileIcon.js} +7 -2
  56. package/dist/cjs/uikit/FileList.js +24 -0
  57. package/dist/cjs/uikit/FlexDiv.js +1 -1
  58. package/dist/cjs/uikit/Grouper.js +4 -4
  59. package/dist/cjs/uikit/Icon.js +2 -2
  60. package/dist/cjs/uikit/IconButton.js +4 -4
  61. package/dist/cjs/uikit/{UILabel.js → Label.js} +3 -3
  62. package/dist/cjs/uikit/Pager.js +2 -2
  63. package/dist/cjs/uikit/{MessageInput.js → PromptInput.js} +10 -11
  64. package/dist/cjs/uikit/RadioButton.js +5 -5
  65. package/dist/cjs/uikit/RadioButtonList.js +6 -6
  66. package/dist/cjs/uikit/Slider.js +2 -2
  67. package/dist/cjs/uikit/TabBar.js +5 -5
  68. package/dist/cjs/uikit/TextArea.js +7 -7
  69. package/dist/cjs/uikit/Textfield.js +7 -7
  70. package/dist/cjs/uikit/Tip.js +2 -2
  71. package/dist/cjs/uikit/Toast.js +3 -3
  72. package/dist/cjs/uikit/UploadArea.js +31 -0
  73. package/dist/css/type.module.css +55 -10
  74. package/dist/esm/chunks/{Avatar-D_muqPrW.js → Avatar-BtkvMV1v.js} +1 -1
  75. package/dist/esm/chunks/{AvatarGroup-D8Xmrn52.js → AvatarGroup-pbqdS56o.js} +1 -1
  76. package/dist/esm/chunks/{Badge-PPf5Uvw3.js → Badge-DtxDLSO0.js} +1 -1
  77. package/dist/esm/chunks/{UIButton-HssaFaip.js → Button-BUJkJqdO.js} +28 -33
  78. package/dist/esm/chunks/{UIButtonBar-CUat663I.js → ButtonBar-Bl0oCxd8.js} +5 -5
  79. package/dist/esm/chunks/{UICard-Dn5f3wg8.js → Card-Bjk0kgQh.js} +5 -5
  80. package/dist/esm/chunks/{CheckBox-CswFI0Xc.js → CheckBox-CvkZuSeB.js} +2 -2
  81. package/dist/esm/chunks/{UIChip-DqnGeVyR.js → Chip-o-YG_HAf.js} +5 -5
  82. package/dist/esm/chunks/{DivInput-iKFkeU2F.js → DivInput-D6ORPrkT.js} +2 -2
  83. package/dist/esm/chunks/{DrggablePanel-CYYwTmFd.js → DrggablePanel-DWrTjXvf.js} +1 -1
  84. package/dist/esm/chunks/{DropDown-D4t6EhKL.js → DropDown-BDIvYWI-.js} +2 -2
  85. package/dist/esm/chunks/{ErrorSummary-DhU5SKPt.js → ErrorSummary-DzDnacH0.js} +1 -1
  86. package/dist/esm/chunks/FileIcon-Cxh-QsYb.js +130 -0
  87. package/dist/esm/chunks/FileList-CdUgbpYF.js +161 -0
  88. package/dist/esm/chunks/{FlexDiv-CmMpORgn.js → FlexDiv-CFyndG99.js} +1 -1
  89. package/dist/esm/chunks/{Grouper-BbreOXI9.js → Grouper-NJbpaaQG.js} +3 -3
  90. package/dist/esm/chunks/{IconButton-hJDuWiDh.js → IconButton-3m9ugITV.js} +3 -3
  91. package/dist/esm/chunks/{UILabel-CpLi8OLx.js → Label-BRon-ejm.js} +17 -7
  92. package/dist/esm/chunks/{Pager-Beht2NyO.js → Pager-BHLyXq9p.js} +1 -1
  93. package/dist/esm/chunks/PromptInput-DodTBG82.js +210 -0
  94. package/dist/esm/chunks/{RadioButton-C4EhaRlp.js → RadioButton-D8otD_Jj.js} +2 -2
  95. package/dist/esm/chunks/{RadioButtonList-iVlML5jt.js → RadioButtonList-CtX1j7rO.js} +1 -1
  96. package/dist/esm/chunks/{Slider-C-PcWqTz.js → Slider-O6UelMjh.js} +1 -1
  97. package/dist/esm/chunks/{TabBar-CMfPQJj-.js → TabBar-C0NgwRa2.js} +4 -4
  98. package/dist/esm/chunks/{TextArea-CiHIh1P_.js → TextArea-DK0giDGR.js} +3 -3
  99. package/dist/esm/chunks/{TextField-6wse4On1.js → TextField-CQ4XYYNm.js} +5 -5
  100. package/dist/esm/chunks/{Tip-CeN0gy3B.js → Tip-iFECDhwN.js} +2 -2
  101. package/dist/esm/chunks/{Toast-C9P_ptX5.js → Toast-ZxMZtbd0.js} +17 -4
  102. package/dist/esm/chunks/UploadArea-C0YHy4Z9.js +147 -0
  103. package/dist/esm/chunks/{_types-BaYeLEWK.js → _types-RJ7q8S0B.js} +2 -2
  104. package/dist/esm/chunks/{utils-BRZK2Drn.js → utils-CZ1LWeN6.js} +2 -0
  105. package/dist/esm/chunks/windowStore-Cu4W4zJM.js +91 -0
  106. package/dist/esm/hooks/useKeyboardShortcuts.js +3 -1
  107. package/dist/esm/hooks/useObserveTheme.js +14 -8
  108. package/dist/esm/hooks/useTrackRenders.js +2 -1
  109. package/dist/esm/hooks/useWindow.js +30 -8
  110. package/dist/esm/index.js +31 -30
  111. package/dist/esm/providers/ThemeProvider.js +6 -3
  112. package/dist/esm/stores/window.js +2 -0
  113. package/dist/esm/stores.js +1 -0
  114. package/dist/esm/theme/type.js +99 -18
  115. package/dist/esm/uikit/Avatar.js +1 -1
  116. package/dist/esm/uikit/AvatarGroup.js +2 -2
  117. package/dist/esm/uikit/Badge.js +1 -1
  118. package/dist/esm/uikit/{UIButton.js → Button.js} +6 -6
  119. package/dist/esm/uikit/{UIButtonBar.js → ButtonBar.js} +5 -5
  120. package/dist/esm/uikit/{UICard.js → Card.js} +3 -3
  121. package/dist/esm/uikit/CheckBox.js +3 -3
  122. package/dist/esm/uikit/{UIChip.js → Chip.js} +3 -3
  123. package/dist/esm/uikit/DivInput.js +2 -2
  124. package/dist/esm/uikit/DraggablePanel.js +2 -2
  125. package/dist/esm/uikit/DropDown.js +3 -3
  126. package/dist/esm/uikit/ErrorSummary.js +1 -1
  127. package/dist/esm/uikit/{UIFileIcon.js → FileIcon.js} +2 -1
  128. package/dist/esm/uikit/FileList.js +18 -0
  129. package/dist/esm/uikit/FlexDiv.js +1 -1
  130. package/dist/esm/uikit/Grouper.js +4 -4
  131. package/dist/esm/uikit/Icon.js +2 -2
  132. package/dist/esm/uikit/IconButton.js +4 -4
  133. package/dist/esm/uikit/{UILabel.js → Label.js} +2 -2
  134. package/dist/esm/uikit/Pager.js +2 -2
  135. package/dist/esm/uikit/{MessageInput.js → PromptInput.js} +9 -10
  136. package/dist/esm/uikit/RadioButton.js +5 -5
  137. package/dist/esm/uikit/RadioButtonList.js +6 -6
  138. package/dist/esm/uikit/Slider.js +2 -2
  139. package/dist/esm/uikit/TabBar.js +5 -5
  140. package/dist/esm/uikit/TextArea.js +7 -7
  141. package/dist/esm/uikit/Textfield.js +7 -7
  142. package/dist/esm/uikit/Tip.js +2 -2
  143. package/dist/esm/uikit/Toast.js +3 -3
  144. package/dist/esm/uikit/{EditorButtonBar.js → UploadArea.js} +8 -11
  145. package/dist/types/hooks/index.d.ts +1 -1
  146. package/dist/types/hooks/useKeyboardShortcuts/useKeyboardShortcuts.d.ts +1 -0
  147. package/dist/types/hooks/useWindow/useWindow.d.ts +11 -2
  148. package/dist/types/index.d.ts +20 -21
  149. package/dist/types/providers/ThemeProvider.d.ts +1 -0
  150. package/dist/types/stores/index.d.ts +1 -0
  151. package/dist/types/stores/window/_types.d.ts +28 -0
  152. package/dist/types/stores/window/index.d.ts +2 -0
  153. package/dist/types/stores/window/windowStore.d.ts +17 -0
  154. package/dist/types/theme/type/types.d.ts +5 -0
  155. package/dist/types/uikit/{UIButton/UIButton.d.ts → Button/Button.d.ts} +3 -3
  156. package/dist/types/uikit/{UIButton → Button}/_types.d.ts +3 -3
  157. package/dist/types/uikit/Button/index.d.ts +2 -0
  158. package/dist/types/uikit/ButtonBar/ButtonBar.d.ts +2 -0
  159. package/dist/types/uikit/{UIButtonBar → ButtonBar}/_types.d.ts +2 -2
  160. package/dist/types/uikit/ButtonBar/index.d.ts +2 -0
  161. package/dist/types/uikit/Card/Card.d.ts +3 -0
  162. package/dist/types/uikit/{UICard → Card}/_types.d.ts +2 -2
  163. package/dist/types/uikit/Card/index.d.ts +2 -0
  164. package/dist/types/uikit/Chip/Chip.d.ts +3 -0
  165. package/dist/types/uikit/{UIChip → Chip}/_types.d.ts +2 -2
  166. package/dist/types/uikit/Chip/index.d.ts +3 -0
  167. package/dist/types/uikit/FileIcon/FileIcon.d.ts +3 -0
  168. package/dist/types/uikit/FileIcon/_types.d.ts +27 -0
  169. package/dist/types/uikit/FileIcon/fileIconRegistry.d.ts +4 -0
  170. package/dist/types/uikit/FileIcon/index.d.ts +3 -0
  171. package/dist/types/uikit/FileList/FileList.d.ts +3 -0
  172. package/dist/types/uikit/FileList/_types.d.ts +24 -0
  173. package/dist/types/uikit/FileList/index.d.ts +2 -0
  174. package/dist/types/uikit/Label/Label.d.ts +2 -0
  175. package/dist/types/uikit/{UILabel → Label}/_types.d.ts +3 -2
  176. package/dist/types/uikit/Label/index.d.ts +2 -0
  177. package/dist/types/uikit/PromptInput/PromptInput.d.ts +63 -0
  178. package/dist/types/uikit/PromptInput/_types.d.ts +35 -0
  179. package/dist/types/uikit/PromptInput/index.d.ts +2 -0
  180. package/dist/types/uikit/UploadArea/UploadArea.d.ts +54 -0
  181. package/dist/types/uikit/UploadArea/_types.d.ts +46 -0
  182. package/dist/types/uikit/UploadArea/index.d.ts +3 -0
  183. package/dist/types/util/files.d.ts +9 -0
  184. package/dist/types/util/utils.d.ts +8 -0
  185. package/package.json +5 -2
  186. package/dist/cjs/chunks/EditorButtonBar-Gaxq4gul.js +0 -244
  187. package/dist/cjs/chunks/MessageInput-YV8cqU8h.js +0 -399
  188. package/dist/cjs/chunks/UIFileIcon-ZrbDIeYz.js +0 -54
  189. package/dist/cjs/uikit/EditorButtonBar.js +0 -28
  190. package/dist/esm/chunks/EditorButtonBar-15cTeQ-H.js +0 -242
  191. package/dist/esm/chunks/MessageInput-DByI4x7h.js +0 -397
  192. package/dist/esm/chunks/UIFileIcon-qGxIPsJJ.js +0 -52
  193. package/dist/types/uikit/EditorButtonBar/EditorButtonBar.d.ts +0 -4
  194. package/dist/types/uikit/EditorButtonBar/_Data.d.ts +0 -12
  195. package/dist/types/uikit/EditorButtonBar/_types.d.ts +0 -61
  196. package/dist/types/uikit/EditorButtonBar/index.d.ts +0 -2
  197. package/dist/types/uikit/MessageInput/ExcerptList/ExcerptList.d.ts +0 -2
  198. package/dist/types/uikit/MessageInput/ExcerptList/_types.d.ts +0 -15
  199. package/dist/types/uikit/MessageInput/FileList/FileList.d.ts +0 -2
  200. package/dist/types/uikit/MessageInput/FileList/_types.d.ts +0 -6
  201. package/dist/types/uikit/MessageInput/InputField/MessageInput.d.ts +0 -2
  202. package/dist/types/uikit/MessageInput/InputField/_types.d.ts +0 -39
  203. package/dist/types/uikit/MessageInput/UserList/UserList.d.ts +0 -5
  204. package/dist/types/uikit/MessageInput/UserList/_types.d.ts +0 -40
  205. package/dist/types/uikit/MessageInput/_Data.d.ts +0 -6
  206. package/dist/types/uikit/MessageInput/_types.d.ts +0 -42
  207. package/dist/types/uikit/MessageInput/index.d.ts +0 -4
  208. package/dist/types/uikit/UIButton/index.d.ts +0 -2
  209. package/dist/types/uikit/UIButtonBar/UIButtonBar.d.ts +0 -2
  210. package/dist/types/uikit/UIButtonBar/index.d.ts +0 -2
  211. package/dist/types/uikit/UICard/UICard.d.ts +0 -3
  212. package/dist/types/uikit/UICard/index.d.ts +0 -2
  213. package/dist/types/uikit/UIChip/UIChip.d.ts +0 -3
  214. package/dist/types/uikit/UIChip/index.d.ts +0 -3
  215. package/dist/types/uikit/UIFileIcon/UIFileIcon.d.ts +0 -3
  216. package/dist/types/uikit/UIFileIcon/_types.d.ts +0 -19
  217. package/dist/types/uikit/UIFileIcon/index.d.ts +0 -2
  218. package/dist/types/uikit/UILabel/UILabel.d.ts +0 -2
  219. package/dist/types/uikit/UILabel/index.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- type UILabelBaseProps = {
2
+ type LabelBaseProps = {
3
3
  children?: React.ReactNode;
4
4
  state?: 'red' | 'yellow' | 'green' | 'blue' | 'grey' | 'lightgrey' | 'white';
5
5
  noFill?: boolean;
@@ -7,9 +7,10 @@ type UILabelBaseProps = {
7
7
  button?: boolean;
8
8
  border?: number;
9
9
  padding?: number | string;
10
+ inline?: boolean;
10
11
  color?: string;
11
12
  size?: 's' | 'm' | 'l';
12
13
  onClick?: (e: React.MouseEvent<any>) => void;
13
14
  };
14
- export type UILabelProps = Omit<React.HTMLAttributes<HTMLDivElement>, keyof UILabelBaseProps> & UILabelBaseProps;
15
+ export type LabelProps = Omit<React.HTMLAttributes<HTMLDivElement>, keyof LabelBaseProps> & LabelBaseProps;
15
16
  export {};
@@ -0,0 +1,2 @@
1
+ export { Label } from './Label';
2
+ export type { LabelProps } from './_types';
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { type FileItem } from '../FileList';
3
+ export declare const PromptInput: React.NamedExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, keyof {
4
+ attachments?: FileItem[];
5
+ children?: React.ReactNode;
6
+ value?: string;
7
+ maxHeight?: string | number;
8
+ working?: boolean;
9
+ borderStyle?: "solid" | "gradient" | "none";
10
+ borderWidth?: number;
11
+ borderColor?: string | number;
12
+ borderColorOn?: string | number;
13
+ borderAnimate?: boolean;
14
+ borderRadius?: number;
15
+ placeholder?: string;
16
+ placeholderWorking?: string;
17
+ focused?: boolean;
18
+ submitClears?: boolean;
19
+ submitEnablesStop?: boolean;
20
+ enterSubmits?: boolean;
21
+ sendButton?: boolean;
22
+ attachButton?: boolean;
23
+ stopEnabled?: boolean;
24
+ maxLength?: number;
25
+ toolbarGap?: number;
26
+ textSize?: "s" | "m" | "l";
27
+ onChange?: (value: string | undefined, attachments?: FileItem[]) => void;
28
+ onSubmit?: (value: string | undefined, attachments?: FileItem[]) => void;
29
+ onBlur?: (value: string | undefined, attachments?: FileItem[]) => void;
30
+ onFocus?: (value: string | undefined, attachments?: FileItem[]) => void;
31
+ onStop?: () => void;
32
+ onAttachmentsChange?: (attachments: FileItem[]) => void;
33
+ }> & {
34
+ attachments?: FileItem[];
35
+ children?: React.ReactNode;
36
+ value?: string;
37
+ maxHeight?: string | number;
38
+ working?: boolean;
39
+ borderStyle?: "solid" | "gradient" | "none";
40
+ borderWidth?: number;
41
+ borderColor?: string | number;
42
+ borderColorOn?: string | number;
43
+ borderAnimate?: boolean;
44
+ borderRadius?: number;
45
+ placeholder?: string;
46
+ placeholderWorking?: string;
47
+ focused?: boolean;
48
+ submitClears?: boolean;
49
+ submitEnablesStop?: boolean;
50
+ enterSubmits?: boolean;
51
+ sendButton?: boolean;
52
+ attachButton?: boolean;
53
+ stopEnabled?: boolean;
54
+ maxLength?: number;
55
+ toolbarGap?: number;
56
+ textSize?: "s" | "m" | "l";
57
+ onChange?: (value: string | undefined, attachments?: FileItem[]) => void;
58
+ onSubmit?: (value: string | undefined, attachments?: FileItem[]) => void;
59
+ onBlur?: (value: string | undefined, attachments?: FileItem[]) => void;
60
+ onFocus?: (value: string | undefined, attachments?: FileItem[]) => void;
61
+ onStop?: () => void;
62
+ onAttachmentsChange?: (attachments: FileItem[]) => void;
63
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,35 @@
1
+ import type React from 'react';
2
+ import type { FileItem } from '../FileList';
3
+ type BasePromptProps = {
4
+ attachments?: FileItem[];
5
+ children?: React.ReactNode;
6
+ value?: string;
7
+ maxHeight?: string | number;
8
+ working?: boolean;
9
+ borderStyle?: 'solid' | 'gradient' | 'none';
10
+ borderWidth?: number;
11
+ borderColor?: string | number;
12
+ borderColorOn?: string | number;
13
+ borderAnimate?: boolean;
14
+ borderRadius?: number;
15
+ placeholder?: string;
16
+ placeholderWorking?: string;
17
+ focused?: boolean;
18
+ submitClears?: boolean;
19
+ submitEnablesStop?: boolean;
20
+ enterSubmits?: boolean;
21
+ sendButton?: boolean;
22
+ attachButton?: boolean;
23
+ stopEnabled?: boolean;
24
+ maxLength?: number;
25
+ toolbarGap?: number;
26
+ textSize?: 's' | 'm' | 'l';
27
+ onChange?: (value: string | undefined, attachments?: FileItem[]) => void;
28
+ onSubmit?: (value: string | undefined, attachments?: FileItem[]) => void;
29
+ onBlur?: (value: string | undefined, attachments?: FileItem[]) => void;
30
+ onFocus?: (value: string | undefined, attachments?: FileItem[]) => void;
31
+ onStop?: () => void;
32
+ onAttachmentsChange?: (attachments: FileItem[]) => void;
33
+ };
34
+ export type PromptProps = Omit<React.HTMLAttributes<HTMLDivElement>, keyof BasePromptProps> & BasePromptProps;
35
+ export {};
@@ -0,0 +1,2 @@
1
+ export { PromptInput } from './PromptInput';
2
+ export type { PromptProps } from './_types';
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ export declare const UploadArea: React.NamedExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, keyof {
3
+ icon?: string;
4
+ iconSize?: number;
5
+ iconColor?: string;
6
+ iconColorHover?: string;
7
+ width?: number | string;
8
+ height?: number | string;
9
+ title?: string;
10
+ message?: string;
11
+ busyMessage?: string;
12
+ bgColor?: string;
13
+ bgColorHover?: string;
14
+ border?: number;
15
+ borderColor?: string | null;
16
+ borderColorHover?: string | null;
17
+ borderStyle?: string;
18
+ textSize?: "s" | "m" | "l";
19
+ padding?: number | string;
20
+ radius?: number | string;
21
+ acceptedTypes?: string[];
22
+ multiple?: boolean;
23
+ busy?: boolean;
24
+ showProgress?: boolean;
25
+ files?: import("../FileList").FileItem[];
26
+ canRemove?: boolean;
27
+ onUpload?: (files: File[]) => void;
28
+ }> & {
29
+ icon?: string;
30
+ iconSize?: number;
31
+ iconColor?: string;
32
+ iconColorHover?: string;
33
+ width?: number | string;
34
+ height?: number | string;
35
+ title?: string;
36
+ message?: string;
37
+ busyMessage?: string;
38
+ bgColor?: string;
39
+ bgColorHover?: string;
40
+ border?: number;
41
+ borderColor?: string | null;
42
+ borderColorHover?: string | null;
43
+ borderStyle?: string;
44
+ textSize?: "s" | "m" | "l";
45
+ padding?: number | string;
46
+ radius?: number | string;
47
+ acceptedTypes?: string[];
48
+ multiple?: boolean;
49
+ busy?: boolean;
50
+ showProgress?: boolean;
51
+ files?: import("../FileList").FileItem[];
52
+ canRemove?: boolean;
53
+ onUpload?: (files: File[]) => void;
54
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,46 @@
1
+ import type React from 'react';
2
+ import type { FileItem } from '../FileList';
3
+ export declare const imageTypes: string[];
4
+ export declare const videoTypes: string[];
5
+ export declare const documentTypes: string[];
6
+ export declare const audioTypes: string[];
7
+ export declare const textTypes: string[];
8
+ export declare const allTypes: string[];
9
+ export declare enum FileTypes {
10
+ images = "images",
11
+ videos = "videos",
12
+ documents = "documents",
13
+ audio = "audio",
14
+ text = "text",
15
+ all = "all",
16
+ custom = "custom"
17
+ }
18
+ type UploadAreaBaseProps = {
19
+ icon?: string;
20
+ iconSize?: number;
21
+ iconColor?: string;
22
+ iconColorHover?: string;
23
+ width?: number | string;
24
+ height?: number | string;
25
+ title?: string;
26
+ message?: string;
27
+ busyMessage?: string;
28
+ bgColor?: string;
29
+ bgColorHover?: string;
30
+ border?: number;
31
+ borderColor?: string | null;
32
+ borderColorHover?: string | null;
33
+ borderStyle?: string;
34
+ textSize?: 's' | 'm' | 'l';
35
+ padding?: number | string;
36
+ radius?: number | string;
37
+ acceptedTypes?: string[];
38
+ multiple?: boolean;
39
+ busy?: boolean;
40
+ showProgress?: boolean;
41
+ files?: FileItem[];
42
+ canRemove?: boolean;
43
+ onUpload?: (files: File[]) => void;
44
+ };
45
+ export type UploadAreaProps = Omit<React.HTMLAttributes<HTMLDivElement>, keyof UploadAreaBaseProps> & UploadAreaBaseProps;
46
+ export {};
@@ -0,0 +1,3 @@
1
+ export { UploadArea } from './UploadArea';
2
+ export type { UploadAreaProps } from './_types';
3
+ export { imageTypes, videoTypes, documentTypes, audioTypes, textTypes, allTypes, } from './_types';
@@ -0,0 +1,9 @@
1
+ export declare function nameAndExtension(fileName: string): {
2
+ name: string;
3
+ ext: string;
4
+ };
5
+ export declare function fileIconName(extension: string): "other" | "text" | "sheet" | "image" | "code" | "pdf" | "md" | "preso" | "audio" | "video" | "clipboard";
6
+ /**
7
+ * Create a text file from clipboard content placing a clipboard file extension
8
+ */
9
+ export declare function clipboardTextToFile(content: string, fileName?: string): File;
@@ -43,3 +43,11 @@ export declare function filterClasses(classNames: string[]): string;
43
43
  * Takes a style string or number and returns a valid CSS style string
44
44
  */
45
45
  export declare function setStyle(value: string | number | undefined, defaultVal?: number | string | undefined): string;
46
+ /**
47
+ * Copy to clipboard
48
+ */
49
+ export declare const copyToClipboard: (rawContent: string) => Promise<boolean>;
50
+ /**
51
+ * Create a tint value from a hex color
52
+ */
53
+ export declare const tintFromColor: (hex: string, percent: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apple-pie/slice",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "exports": {
@@ -102,6 +102,7 @@
102
102
  "devDependencies": {
103
103
  "@biomejs/biome": "^1.9.4",
104
104
  "@chromatic-com/storybook": "^5.0.1",
105
+ "@csstools/postcss-global-data": "^3.1.0",
105
106
  "@rollup/plugin-alias": "^5.1.1",
106
107
  "@rollup/plugin-babel": "^6.0.4",
107
108
  "@rollup/plugin-commonjs": "^28.0.2",
@@ -127,6 +128,7 @@
127
128
  "happy-dom": "^20.7.0",
128
129
  "jsdom": "^28.1.0",
129
130
  "playwright": "^1.58.2",
131
+ "postcss-custom-media": "^11.0.6",
130
132
  "rollup": "^4.32.0",
131
133
  "rollup-plugin-json": "^4.0.0",
132
134
  "rollup-plugin-peer-deps-external": "^2.2.4",
@@ -138,7 +140,8 @@
138
140
  "typescript": "^5.7.3",
139
141
  "vite": "^6.0.11",
140
142
  "vite-plugin-svgr": "^4.3.0",
141
- "vitest": "^4.0.18"
143
+ "vitest": "^4.0.18",
144
+ "zustand": "^5.0.0"
142
145
  },
143
146
  "peerDependencies": {
144
147
  "motion": "^11.15.0",
@@ -1,244 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var React = require('react');
6
- var hooks_useTheme = require('../hooks/useTheme.js');
7
- require('../theme/colors.js');
8
- require('../hooks/useWindow.js');
9
- var hooks_useObserveResize = require('../hooks/useObserveResize.js');
10
- var DropDown = require('./DropDown-D9sf_m2I.js');
11
- var IconButton = require('./IconButton-CjiNliPL.js');
12
- var styleInject_es = require('./style-inject.es-XZHJH68X.js');
13
-
14
- var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.EditorButtonBar-module_wrapper__mfv-c {\n\twidth: 100%;\n}\n\n.EditorButtonBar-module_right__G2tBZ {\n}\n\n.EditorButtonBar-module_left__9omfV {\n\tflex: 1;\n}\n\n.EditorButtonBar-module_buttonGroup__p0aEd {\n\tgap: 4px;\n\tdiv.EditorButtonBar-module_divider__T5y5c {\n\t\theight: 20px;\n\t\tmin-height: 100%;\n\t\twidth: 1px;\n\t\tmin-width: 1px;\n\t\tmax-width: 1px;\n\t\tbackground: var(--core-surface-secondary);\n\t\tmargin: 0 8px;\n\t}\n}\n";
15
- var css = {"wrapper":"EditorButtonBar-module_wrapper__mfv-c flexBox-module_rowStart__nJZnW","right":"EditorButtonBar-module_right__G2tBZ flexBox-module_rowStart__nJZnW","left":"EditorButtonBar-module_left__9omfV flexBox-module_rowStart__nJZnW","buttonGroup":"EditorButtonBar-module_buttonGroup__p0aEd flexBox-module_rowStart__nJZnW"};
16
- styleInject_es.styleInject(css_248z);
17
-
18
- var FormattingOption;
19
- (function (FormattingOption) {
20
- FormattingOption["hilight"] = "hilight";
21
- FormattingOption["bold"] = "bold";
22
- FormattingOption["italic"] = "italic";
23
- FormattingOption["underline"] = "underline";
24
- FormattingOption["strikethrough"] = "strikethrough";
25
- FormattingOption["list"] = "list";
26
- FormattingOption["orderedList"] = "ordered list";
27
- FormattingOption["taskList"] = "task list";
28
- FormattingOption["sinkList"] = "sink list";
29
- FormattingOption["raiseList"] = "raise list";
30
- FormattingOption["undo"] = "undo";
31
- FormattingOption["redo"] = "redo";
32
- FormattingOption["download"] = "download";
33
- FormattingOption["more"] = "more";
34
- FormattingOption["copy"] = "copy";
35
- FormattingOption["link"] = "link";
36
- })(FormattingOption || (FormattingOption = {}));
37
-
38
- const coreButtons = {
39
- link: {
40
- icon: 'link',
41
- toolTip: 'Link',
42
- command: 'link',
43
- id: FormattingOption.link,
44
- },
45
- hilight: {
46
- icon: 'hilight',
47
- toolTip: 'Highlight',
48
- command: 'hilight',
49
- id: FormattingOption.hilight,
50
- },
51
- bold: {
52
- icon: 'bold',
53
- toolTip: 'Bold',
54
- command: 'bold',
55
- id: FormattingOption.bold,
56
- shortcut: { modifier: 'meta', key: 'b' },
57
- },
58
- italic: {
59
- icon: 'italic',
60
- toolTip: 'Italic',
61
- command: 'italic',
62
- id: FormattingOption.italic,
63
- shortcut: { modifier: 'meta', key: 'i' },
64
- },
65
- underline: {
66
- icon: 'underline',
67
- toolTip: 'Underline',
68
- command: 'underline',
69
- id: FormattingOption.underline,
70
- shortcut: { modifier: 'meta', key: 'u' },
71
- },
72
- strikethrough: {
73
- icon: 'strike',
74
- toolTip: 'Strikethrough',
75
- command: 'strike',
76
- id: FormattingOption.strikethrough,
77
- shortcut: { modifier: 'meta', key: 's' },
78
- },
79
- list: {
80
- icon: 'bullet list',
81
- toolTip: 'List',
82
- command: 'ulist',
83
- id: FormattingOption.list,
84
- },
85
- orderedList: {
86
- icon: 'numbered list',
87
- toolTip: 'Ordered list',
88
- command: 'olist',
89
- id: FormattingOption.orderedList,
90
- },
91
- taskList: {
92
- icon: 'task list',
93
- toolTip: 'Task list',
94
- command: 'task',
95
- id: FormattingOption.taskList,
96
- },
97
- sinkList: {
98
- icon: 'sink',
99
- toolTip: 'Sink list item',
100
- command: 'sink',
101
- id: FormattingOption.sinkList,
102
- },
103
- raiseList: {
104
- icon: 'lift',
105
- toolTip: 'Raise list item',
106
- command: 'raise',
107
- id: FormattingOption.raiseList,
108
- },
109
- undo: {
110
- icon: 'undo',
111
- toolTip: 'Undo',
112
- command: 'undo',
113
- id: FormattingOption.undo,
114
- },
115
- redo: {
116
- icon: 'redo',
117
- toolTip: 'Redo',
118
- command: 'redo',
119
- id: FormattingOption.redo,
120
- },
121
- copy: {
122
- icon: 'copy',
123
- toolTip: 'Copy',
124
- command: 'copy',
125
- id: FormattingOption.copy,
126
- },
127
- download: {
128
- icon: 'download',
129
- toolTip: 'Download',
130
- command: 'download',
131
- id: FormattingOption.download,
132
- },
133
- more: {
134
- icon: 'more',
135
- toolTip: 'More Options',
136
- command: 'more',
137
- id: FormattingOption.more,
138
- },
139
- };
140
- const styles = [
141
- { label: 'Heading 1', value: 'h1', alt: 'h1' },
142
- { label: 'Heading 2', value: 'h2', alt: 'h2' },
143
- { label: 'Heading 3', value: 'h3', alt: 'h3' },
144
- { label: 'Body', value: 'p', alt: 'p' },
145
- ];
146
- const buttonGroups = {
147
- format: {
148
- buttons: [
149
- coreButtons.hilight,
150
- coreButtons.bold,
151
- coreButtons.italic,
152
- coreButtons.underline,
153
- coreButtons.strikethrough,
154
- coreButtons.link,
155
- ],
156
- },
157
- lists: {
158
- buttons: [coreButtons.list, coreButtons.orderedList, coreButtons.taskList],
159
- },
160
- listEdit: {
161
- buttons: [coreButtons.sinkList, coreButtons.raiseList],
162
- },
163
- undo: {
164
- buttons: [coreButtons.undo, coreButtons.redo],
165
- },
166
- more: {
167
- buttons: [coreButtons.more],
168
- },
169
- };
170
- const editControls = {
171
- regular: {
172
- styles,
173
- buttons: [
174
- buttonGroups.format,
175
- buttonGroups.lists,
176
- buttonGroups.listEdit,
177
- buttonGroups.undo,
178
- ],
179
- download: coreButtons.download,
180
- },
181
- small: {
182
- buttons: [buttonGroups.format, buttonGroups.more],
183
- download: coreButtons.download,
184
- },
185
- medium: {
186
- styles,
187
- buttons: [buttonGroups.format, buttonGroups.lists],
188
- download: coreButtons.download,
189
- },
190
- };
191
-
192
- const EditorButtonBar = React.memo((props) => {
193
- var _a;
194
- const { onCommand = () => null, onToolTip = () => null, shortSize = 500, mediumSize = 664, state = 'auto', activeStyle = 'p', disabledFormats = [], activeFormats } = props, divAttributes = tslib_es6.__rest(props, ["onCommand", "onToolTip", "shortSize", "mediumSize", "state", "activeStyle", "disabledFormats", "activeFormats"]);
195
- const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
196
- const divStyle = style !== null && style !== void 0 ? style : {};
197
- const divClass = className ? ` ${className}` : '';
198
- const [barState, setBarState] = React.useState('regular');
199
- const ref = React.useRef(null);
200
- const size = hooks_useObserveResize.useObserveResize(ref);
201
- React.useEffect(() => {
202
- if (state !== 'auto')
203
- setBarState(state);
204
- else if (size.width < shortSize)
205
- setBarState('small');
206
- else if (size.width < mediumSize)
207
- setBarState('medium');
208
- else
209
- setBarState('regular');
210
- }, [size, shortSize, mediumSize, state]);
211
- const handleStyleChange = React.useCallback((option) => {
212
- switch (option.value) {
213
- case 'h1':
214
- onCommand('h1', undefined);
215
- break;
216
- case 'h2':
217
- onCommand('h2', undefined);
218
- break;
219
- case 'h3':
220
- onCommand('h3', undefined);
221
- break;
222
- case 'p':
223
- onCommand('p', undefined);
224
- break;
225
- }
226
- }, [onCommand]);
227
- return (jsxRuntime.jsxs("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: divStyle, ref: ref }, rest, { children: [jsxRuntime.jsxs("div", { className: css.left, children: [(editControls === null || editControls === void 0 ? void 0 : editControls[barState].styles) && (jsxRuntime.jsx(DropDown.DropDown, { options: editControls === null || editControls === void 0 ? void 0 : editControls[barState].styles, placeholder: false, unframed: true, width: '100px', selectedValue: activeStyle, onChange: (_index, option) => handleStyleChange(option) })), (_a = editControls === null || editControls === void 0 ? void 0 : editControls[barState].buttons) === null || _a === void 0 ? void 0 : _a.map((group, index) => {
228
- return (jsxRuntime.jsx(RenderGroup, { onCommand: onCommand, onToolTip: onToolTip, buttonGroup: group, activeFormats: activeFormats, disabledFormats: disabledFormats, state: barState }, `button-group-${group.name}${index}`));
229
- })] }), (editControls === null || editControls === void 0 ? void 0 : editControls[barState].download) && (jsxRuntime.jsxs("div", { className: css.right, children: [jsxRuntime.jsx(IconButton.IconButton, { icon: coreButtons.copy.icon, tooltip: coreButtons.copy.toolTip, hover: disabledFormats.includes('download'), toggle: false, onToolTip: onToolTip, disabled: disabledFormats.includes('copy'), onClick: (e) => onCommand(coreButtons.copy.command, e) }), jsxRuntime.jsx(IconButton.IconButton, { icon: coreButtons.download.icon, tooltip: coreButtons.download.toolTip, hover: !disabledFormats.includes('download'), toggle: false, onToolTip: onToolTip, disabled: disabledFormats.includes('download'), onClick: (e) => onCommand(coreButtons.download.command, e) })] }))] })));
230
- });
231
- const RenderGroup = React.memo((props) => {
232
- var _a;
233
- const { onCommand = () => null, onToolTip = () => null, buttonGroup, activeFormats, state = 'default', disabledFormats = [], } = props;
234
- const theme = hooks_useTheme.useTheme();
235
- return (jsxRuntime.jsxs("div", { className: css.buttonGroup, children: [state !== 'small' && jsxRuntime.jsx("div", { className: "divider" }), (_a = buttonGroup === null || buttonGroup === void 0 ? void 0 : buttonGroup.buttons) === null || _a === void 0 ? void 0 : _a.map((button, index) => {
236
- const active = (button === null || button === void 0 ? void 0 : button.id) ? activeFormats === null || activeFormats === void 0 ? void 0 : activeFormats.includes(button.id) : false;
237
- const bgColor = active
238
- ? theme.current.colors['core-surface-secondary']
239
- : 'transparent';
240
- return (jsxRuntime.jsx(IconButton.IconButton, { icon: button === null || button === void 0 ? void 0 : button.icon, tooltip: button === null || button === void 0 ? void 0 : button.toolTip, onToolTip: onToolTip, hover: !disabledFormats.includes(button.id || 'none'), toggle: false, bgColor: bgColor, onClick: (e) => onCommand(button === null || button === void 0 ? void 0 : button.command, e), disabled: disabledFormats.includes(button.id || 'none'), frameSize: 30, iconSize: 20 }, `button-${button === null || button === void 0 ? void 0 : button.icon}-${index}`));
241
- })] }));
242
- });
243
-
244
- exports.EditorButtonBar = EditorButtonBar;