ozdenui 0.1.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 (149) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +14 -0
  3. data/NOTICE +5 -0
  4. data/README.md +242 -0
  5. data/exe/ozdenui +17 -0
  6. data/lib/ozdenui/AGENTS.md +210 -0
  7. data/lib/ozdenui/COMPONENTS.md +3017 -0
  8. data/lib/ozdenui/app.rb +749 -0
  9. data/lib/ozdenui/command.rb +107 -0
  10. data/lib/ozdenui/components.rb +368 -0
  11. data/lib/ozdenui/dialogs.rb +212 -0
  12. data/lib/ozdenui/files.rb +124 -0
  13. data/lib/ozdenui/icon.png +0 -0
  14. data/lib/ozdenui/kit.json +1 -0
  15. data/lib/ozdenui/kit.rb +115 -0
  16. data/lib/ozdenui/look.rb +229 -0
  17. data/lib/ozdenui/objects.rb +652 -0
  18. data/lib/ozdenui/server.rb +270 -0
  19. data/lib/ozdenui/values.rb +273 -0
  20. data/lib/ozdenui/version.rb +15 -0
  21. data/lib/ozdenui/web/basic/LICENSE +14 -0
  22. data/lib/ozdenui/web/basic/basic.min.css +1 -0
  23. data/lib/ozdenui/web/basic/basic.min.js +78 -0
  24. data/lib/ozdenui/web/basic/font/open-sans/LICENSE.txt +206 -0
  25. data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
  26. data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
  27. data/lib/ozdenui/web/basic/scroll-bar.min.js +3 -0
  28. data/lib/ozdenui/web/bridge.js +584 -0
  29. data/lib/ozdenui/web/comp/accordion.js +659 -0
  30. data/lib/ozdenui/web/comp/action-button/add.png +0 -0
  31. data/lib/ozdenui/web/comp/action-button.js +521 -0
  32. data/lib/ozdenui/web/comp/action-tab-bar.js +383 -0
  33. data/lib/ozdenui/web/comp/app-bar.js +237 -0
  34. data/lib/ozdenui/web/comp/badge.js +292 -0
  35. data/lib/ozdenui/web/comp/bottom-bar.js +555 -0
  36. data/lib/ozdenui/web/comp/breadcrumbs.js +524 -0
  37. data/lib/ozdenui/web/comp/canvas.js +652 -0
  38. data/lib/ozdenui/web/comp/chat-view.js +827 -0
  39. data/lib/ozdenui/web/comp/check-box.js +490 -0
  40. data/lib/ozdenui/web/comp/code-editor.js +965 -0
  41. data/lib/ozdenui/web/comp/color-picker.js +636 -0
  42. data/lib/ozdenui/web/comp/context-menu.js +951 -0
  43. data/lib/ozdenui/web/comp/currency-field.js +209 -0
  44. data/lib/ozdenui/web/comp/data-table/arrow.svg +2 -0
  45. data/lib/ozdenui/web/comp/data-table.js +937 -0
  46. data/lib/ozdenui/web/comp/date-picker.js +1055 -0
  47. data/lib/ozdenui/web/comp/dialog.js +992 -0
  48. data/lib/ozdenui/web/comp/email-field.js +65 -0
  49. data/lib/ozdenui/web/comp/file-picker.js +920 -0
  50. data/lib/ozdenui/web/comp/filters.js +807 -0
  51. data/lib/ozdenui/web/comp/form.js +602 -0
  52. data/lib/ozdenui/web/comp/full-screen-select/arrow.svg +2 -0
  53. data/lib/ozdenui/web/comp/full-screen-select/cancel.svg +2 -0
  54. data/lib/ozdenui/web/comp/full-screen-select.js +614 -0
  55. data/lib/ozdenui/web/comp/gauge.js +439 -0
  56. data/lib/ozdenui/web/comp/graph-box.js +3911 -0
  57. data/lib/ozdenui/web/comp/grid-group.js +185 -0
  58. data/lib/ozdenui/web/comp/hold-to-confirm-button/trash-red.png +0 -0
  59. data/lib/ozdenui/web/comp/hold-to-confirm-button/trash.png +0 -0
  60. data/lib/ozdenui/web/comp/hold-to-confirm-button.js +289 -0
  61. data/lib/ozdenui/web/comp/image-view.js +598 -0
  62. data/lib/ozdenui/web/comp/item-list.js +1740 -0
  63. data/lib/ozdenui/web/comp/json-editor.js +3221 -0
  64. data/lib/ozdenui/web/comp/json-view.js +597 -0
  65. data/lib/ozdenui/web/comp/label-editor.js +1140 -0
  66. data/lib/ozdenui/web/comp/left-menu/data-table.png +0 -0
  67. data/lib/ozdenui/web/comp/left-menu/home.png +0 -0
  68. data/lib/ozdenui/web/comp/left-menu/reports.png +0 -0
  69. data/lib/ozdenui/web/comp/left-menu/setting.png +0 -0
  70. data/lib/ozdenui/web/comp/left-menu.js +548 -0
  71. data/lib/ozdenui/web/comp/line-progress-bar.js +343 -0
  72. data/lib/ozdenui/web/comp/loading-screen.js +413 -0
  73. data/lib/ozdenui/web/comp/log-view.js +530 -0
  74. data/lib/ozdenui/web/comp/login-page.js +685 -0
  75. data/lib/ozdenui/web/comp/markdown-view.js +1045 -0
  76. data/lib/ozdenui/web/comp/menu-bar.js +624 -0
  77. data/lib/ozdenui/web/comp/mini-graph-box.js +492 -0
  78. data/lib/ozdenui/web/comp/minimal-accent.js +208 -0
  79. data/lib/ozdenui/web/comp/notice.js +229 -0
  80. data/lib/ozdenui/web/comp/number-field.js +128 -0
  81. data/lib/ozdenui/web/comp/numeric-keyboard.js +298 -0
  82. data/lib/ozdenui/web/comp/page-control.js +762 -0
  83. data/lib/ozdenui/web/comp/page-header.js +191 -0
  84. data/lib/ozdenui/web/comp/password-field/hide-btn.png +0 -0
  85. data/lib/ozdenui/web/comp/password-field/hide-btn2.png +0 -0
  86. data/lib/ozdenui/web/comp/password-field/show-btn.png +0 -0
  87. data/lib/ozdenui/web/comp/password-field/show-btn2.png +0 -0
  88. data/lib/ozdenui/web/comp/password-field.js +192 -0
  89. data/lib/ozdenui/web/comp/period-bar.js +436 -0
  90. data/lib/ozdenui/web/comp/phone-field.js +322 -0
  91. data/lib/ozdenui/web/comp/progress-bar.js +992 -0
  92. data/lib/ozdenui/web/comp/property-panel.js +3639 -0
  93. data/lib/ozdenui/web/comp/radio-button.js +527 -0
  94. data/lib/ozdenui/web/comp/range-slider.js +569 -0
  95. data/lib/ozdenui/web/comp/rich-text-editor.js +1064 -0
  96. data/lib/ozdenui/web/comp/scroll-area.js +308 -0
  97. data/lib/ozdenui/web/comp/scrolling-text.js +297 -0
  98. data/lib/ozdenui/web/comp/search-input/clear-round.svg +1 -0
  99. data/lib/ozdenui/web/comp/search-input/clear.svg +1 -0
  100. data/lib/ozdenui/web/comp/search-input/filter.png +0 -0
  101. data/lib/ozdenui/web/comp/search-input/filter.svg +1 -0
  102. data/lib/ozdenui/web/comp/search-input/search.svg +1 -0
  103. data/lib/ozdenui/web/comp/search-input.js +725 -0
  104. data/lib/ozdenui/web/comp/search-results.js +596 -0
  105. data/lib/ozdenui/web/comp/select-box.js +1862 -0
  106. data/lib/ozdenui/web/comp/settings-row.js +299 -0
  107. data/lib/ozdenui/web/comp/side-panel.js +616 -0
  108. data/lib/ozdenui/web/comp/slider-field.js +952 -0
  109. data/lib/ozdenui/web/comp/slider.js +838 -0
  110. data/lib/ozdenui/web/comp/smart-button/alert-black.png +0 -0
  111. data/lib/ozdenui/web/comp/smart-button/clock.png +0 -0
  112. data/lib/ozdenui/web/comp/smart-button.js +981 -0
  113. data/lib/ozdenui/web/comp/smart-table/clock.png +0 -0
  114. data/lib/ozdenui/web/comp/smart-table/down.png +0 -0
  115. data/lib/ozdenui/web/comp/smart-table/scroll.png +0 -0
  116. data/lib/ozdenui/web/comp/smart-table/sort.png +0 -0
  117. data/lib/ozdenui/web/comp/smart-table/up.png +0 -0
  118. data/lib/ozdenui/web/comp/smart-table.js +1883 -0
  119. data/lib/ozdenui/web/comp/sortable-list.js +1181 -0
  120. data/lib/ozdenui/web/comp/spark-line-box.js +738 -0
  121. data/lib/ozdenui/web/comp/splitter.js +411 -0
  122. data/lib/ozdenui/web/comp/status-bar.js +408 -0
  123. data/lib/ozdenui/web/comp/step-bar.js +345 -0
  124. data/lib/ozdenui/web/comp/stepper.js +753 -0
  125. data/lib/ozdenui/web/comp/tabs.js +1366 -0
  126. data/lib/ozdenui/web/comp/tag-input.js +1107 -0
  127. data/lib/ozdenui/web/comp/tap-effect.js +170 -0
  128. data/lib/ozdenui/web/comp/text-area-field.js +233 -0
  129. data/lib/ozdenui/web/comp/text-field.js +1006 -0
  130. data/lib/ozdenui/web/comp/time-line.js +398 -0
  131. data/lib/ozdenui/web/comp/time-picker.js +1032 -0
  132. data/lib/ozdenui/web/comp/tiny-select/arrow.svg +1 -0
  133. data/lib/ozdenui/web/comp/tiny-select.js +322 -0
  134. data/lib/ozdenui/web/comp/tiny-table.js +283 -0
  135. data/lib/ozdenui/web/comp/toast.js +891 -0
  136. data/lib/ozdenui/web/comp/toggle.js +757 -0
  137. data/lib/ozdenui/web/comp/tool-bar.js +760 -0
  138. data/lib/ozdenui/web/comp/tooltip.js +534 -0
  139. data/lib/ozdenui/web/comp/tree-view.js +1179 -0
  140. data/lib/ozdenui/web/comp/ui-effects.js +1097 -0
  141. data/lib/ozdenui/web/comp/ui-standards.js +403 -0
  142. data/lib/ozdenui/web/comp/url-field.js +190 -0
  143. data/lib/ozdenui/web/comp/web-view.js +588 -0
  144. data/lib/ozdenui/web/components.js +123 -0
  145. data/lib/ozdenui/web/index.html +39 -0
  146. data/lib/ozdenui/window.rb +188 -0
  147. data/lib/ozdenui/window_cocoa.rb +221 -0
  148. data/lib/ozdenui.rb +32 -0
  149. metadata +200 -0
@@ -0,0 +1,920 @@
1
+ /* Bismillah */
2
+
3
+ /*
4
+
5
+ File Picker - v26.11
6
+
7
+ UI COMPONENT TEMPLATE
8
+ - A drop zone: drag and drop files, or click (Enter/Space) to open the file dialog.
9
+ - Shows the selected files as a list (image preview, name, size, remove button).
10
+ - Supports: multiple, accept (type filter), maxSize, maxFiles, directory selection, enabled.
11
+ - A low zone (zoneHeight): what does not fit is hidden: first the icon, then the hint, then the description. The title stays.
12
+ - Everything is drawn with code (no image files needed). iconSvg: an svg icon of your own (it takes the colors of the
13
+ style); iconFile: a picture (a png, jpg or svg file, a data: address) in its place (it keeps its own colors).
14
+ - animated: 1 (off by default): the icon lifts a little under the mouse, and lifts and grows while a file is dragged
15
+ over the zone. Only transform changes. Off when the system asks for reduced motion.
16
+ - Style packages: "light" (default; the old name "classic" works too), "dark", "minimal", "minimalDark". Select with styleName. (FilePicker.styles)
17
+
18
+ IMPORTANT: About the file path
19
+ - Browsers do NOT give the real disk path of a file (security rule).
20
+ You get: name, size, type, lastModified and the File object (to read or upload the file).
21
+ - In folder selection (directory: 1), "path" is the relative path in the folder. (Ex: "photos/2026/a.jpg")
22
+ - In desktop environments (Electron), "path" is the real disk path when the environment provides it. The row shows the
23
+ name; its bubble shows the path.
24
+ - A program that has the file dialog of its system and real paths (the Python library):
25
+ onOpenDialog: function (self) {} opens its dialog in the place of the dialog of the page, and it gives what was chosen to
26
+ addFiles([{ name, path, size, type, lastModified, previewAddress }]): plain objects, not File objects.
27
+ previewAddress: a picture for the list (a plain object has no blob to make one from).
28
+ getFileDetails(): the files without their File objects, for a program that keeps them as text.
29
+
30
+ Started Date: September 2026
31
+ Webpage: https://bug7a.github.io/js-components/
32
+
33
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
34
+ Licensed under the Apache License, Version 2.0
35
+ SPDX-License-Identifier: Apache-2.0
36
+
37
+ */
38
+
39
+ "use strict";
40
+
41
+ // Default values:
42
+ const FilePickerDefaults = {
43
+ key: "0",
44
+ width: 360,
45
+ height: "auto",
46
+ zoneHeight: 170,
47
+ multiple: 0, // 1: Select more than one file. New files are added to the list.
48
+ directory: 0, // 1: Select a folder (all files in it). Click only, not drag.
49
+ accept: "", // Ex: "image/*", ".pdf,.docx", "image/png,image/jpeg"
50
+ maxSize: 0, // Bytes. 0: No limit. Ex: 5 * 1024 * 1024 (5 MB)
51
+ maxFiles: 0, // 0: No limit (only for multiple: 1)
52
+ enabled: 1,
53
+ showIcon: 1, // 0: Hide the upload icon. (A zone too low for it hides it by itself.)
54
+ iconSvg: "", // An "<svg" text of your own, drawn with currentColor. Empty: the icon of the style (box.setIconSvg())
55
+ iconFile: "", // A picture of your own (a path or a data: address) in the place of the icon, with its own colors (box.setIcon())
56
+ animated: 0, // 1: the icon lifts under the mouse, and more while a file is dragged over. (box.setAnimated(0/1))
57
+ showList: 1,
58
+ showPreview: 1, // Image thumbnails in the list.
59
+ preventPageDrop: 1, // 1: A file dropped outside the zone does not open in the browser tab.
60
+ titleText: "Drag and drop a file here",
61
+ descriptionText: "or click to select",
62
+ hintText: "", // Empty: created from accept and maxSize
63
+ dropText: "Drop to add",
64
+ allowHtml: 0, // 1: titleText, descriptionText and dropText are HTML (only for your own texts)
65
+ onChange: function (self) { }, // self.files: [{ file, name, displayName, path, size, sizeText, type, extension, lastModified }]
66
+ onError: function (self, errors) { }, // errors: [{ type: "accept" | "maxSize" | "maxFiles", name, message }]
67
+ onOpenDialog: null, // function (self): the dialog of a program, in the place of the dialog of the page (see above)
68
+ styleName: "light", // "light" ("classic": its old name), "dark", "minimal", "minimalDark" or a name added to FilePicker.styles
69
+ style: {
70
+ zone: {
71
+ color: White(1),
72
+ border: 2,
73
+ borderColor: Black(0.2),
74
+ round: 10,
75
+ },
76
+ zoneHover: {
77
+ color: "#FAFAFA",
78
+ borderColor: Black(0.4),
79
+ },
80
+ zoneDragOver: {
81
+ color: "#EEF4FF",
82
+ borderColor: "#3871E0",
83
+ },
84
+ icon: {
85
+ size: 40,
86
+ space: 6, // px under the icon, more than the gap of the zone
87
+ svg: "", // the upload icon of the look, drawn with currentColor. "": FilePicker.UPLOAD_ICON
88
+ color: Black(0.45),
89
+ dragOverColor: "#3871E0",
90
+ },
91
+ title: {
92
+ fontSize: 16,
93
+ textColor: Black(0.8),
94
+ fontFamily: "opensans-bold",
95
+ },
96
+ desc: {
97
+ fontSize: 14,
98
+ textColor: Black(0.5),
99
+ },
100
+ hint: {
101
+ fontSize: 12,
102
+ textColor: Black(0.4),
103
+ },
104
+ item: {
105
+ height: 52,
106
+ color: White(1),
107
+ border: 1,
108
+ borderColor: Black(0.1),
109
+ round: 8,
110
+ },
111
+ itemName: {
112
+ fontSize: 14,
113
+ textColor: Black(0.85),
114
+ },
115
+ itemSize: {
116
+ fontSize: 12,
117
+ textColor: Black(0.45),
118
+ },
119
+ badge: {
120
+ color: Black(0.06),
121
+ textColor: Black(0.6),
122
+ round: 6,
123
+ },
124
+ removeButton: {
125
+ textColor: Black(0.45),
126
+ hoverColor: "#FE5D49",
127
+ },
128
+ disabled: {
129
+ opacity: 0.4,
130
+ },
131
+ }
132
+ };
133
+
134
+ const FilePicker = function (params = {}) {
135
+
136
+ // Merge style package: params.style > FilePicker.styles[styleName] > FilePickerDefaults.style (light)
137
+ basic.applyStylePackage(params, FilePicker.styles, FilePickerDefaults);
138
+
139
+ // Merge params:
140
+ mergeIntoIfMissing(params, FilePickerDefaults);
141
+
142
+ // Edit params, if needed:
143
+ params.color = "transparent";
144
+ params.height = "auto";
145
+
146
+ // BOX: Component container
147
+ let box = startObject(params);
148
+
149
+ // *** PRIVATE VARIABLES:
150
+ const _s = box.style;
151
+ let dragCounter = 0; // WHY: dragenter/dragleave also fire for inner elements.
152
+ let isMouseOver = 0;
153
+ let rows = [];
154
+ let previewUrls = [];
155
+ const ZONE_MOTION = "background-color 0.15s, border-color 0.15s";
156
+ const MOTION_TIME = "0.25s";
157
+ const MOTION_EASE = "cubic-bezier(0.2, 0.8, 0.2, 1)";
158
+ const HOVER_ICON_LIFT = 2; // px
159
+ const HOVER_ICON_GROW = 1.04;
160
+ const DROP_ICON_LIFT = 5; // px
161
+ const DROP_ICON_GROW = 1.08;
162
+ let wasAnimated = 0;
163
+ const ZONE_GAP = 4; // Between the parts of the zone
164
+ const ZONE_MIN_SPACE = 4; // At least this much over and under the parts of the zone
165
+ const HINT_SPACE = 4; // More space over the hint
166
+ const ROW_GAP = 10; // Space between the thumbnail, the texts and the remove button
167
+ const THUMB_INSET = 16; // The thumbnail is this much smaller than the row height
168
+ const BADGE_MAX_LETTERS = 4; // "JPEG", "DOCX"
169
+
170
+ // *** PUBLIC VARIABLES:
171
+ // [var] Selected files: [{ file, name, displayName, path, size, sizeText, type, extension, lastModified }]
172
+ box.files = [];
173
+ // [var] "normal", "hover", "dragover"
174
+ box.state = "normal";
175
+
176
+ // *** PRIVATE FUNCTIONS:
177
+
178
+ const setText = function (label, text) {
179
+ const value = (text === undefined || text === null) ? "" : String(text);
180
+ if (box.allowHtml == 1) label.text = value;
181
+ else label.plainText = value;
182
+ };
183
+
184
+ // The parts the zone can lose, first the one it needs least. (The title always stays.)
185
+ const getOptionalParts = function () {
186
+ const parts = [];
187
+ if (box.showIcon == 1) parts.push({ object: box.icon, extra: _s.icon.space });
188
+ if (box.hint.text) parts.push({ object: box.hint, extra: HINT_SPACE });
189
+ if (box.descriptionText) parts.push({ object: box.desc, extra: 0 });
190
+ return parts;
191
+ };
192
+
193
+ // WHY measured: the height of a text depends on its lines, and those on the width of the zone.
194
+ const fitZoneContent = function () {
195
+ const parts = getOptionalParts();
196
+ parts.forEach((part) => { part.object.visible = 1; });
197
+ const room = box.zone.elem.clientHeight - (ZONE_MIN_SPACE * 2);
198
+ if (room <= 0) return; // Not drawn yet: box.zone.onResize comes back.
199
+ let used = box.title.elem.offsetHeight;
200
+ parts.forEach((part) => { used += part.object.elem.offsetHeight + part.extra + ZONE_GAP; });
201
+ parts.forEach(function (part) {
202
+ if (used <= room) return;
203
+ used -= part.object.elem.offsetHeight + part.extra + ZONE_GAP;
204
+ part.object.visible = 0;
205
+ });
206
+ };
207
+
208
+ const getExtension = function (name) {
209
+ const index = name.lastIndexOf(".");
210
+ return (index > 0) ? name.slice(index + 1).toLowerCase() : "";
211
+ };
212
+
213
+ const createFileInfo = function (file) {
214
+ return {
215
+ file: file,
216
+ name: file.name,
217
+ // WHY not the path: a real disk path does not fit in a row; the relative path of a folder says where it is.
218
+ displayName: file.webkitRelativePath || file.name,
219
+ // WHY: Browsers do not give the real path. Electron may give it with file.path.
220
+ path: file.path || file.webkitRelativePath || file.name,
221
+ size: file.size,
222
+ sizeText: FilePicker.formatSize(file.size),
223
+ type: file.type || "",
224
+ extension: getExtension(file.name),
225
+ lastModified: file.lastModified,
226
+ };
227
+ };
228
+
229
+ const isSameFile = function (a, b) {
230
+ return a.name == b.name && a.size == b.size && a.lastModified == b.lastModified && a.path == b.path;
231
+ };
232
+
233
+ // Checks a file with the accept list. Ex: "image/*,.pdf"
234
+ const isAccepted = function (file) {
235
+
236
+ if (!box.accept) return true;
237
+
238
+ const name = file.name.toLowerCase();
239
+ const type = (file.type || "").toLowerCase();
240
+
241
+ return box.accept.split(",").some(function (rule) {
242
+ rule = rule.trim().toLowerCase();
243
+ if (!rule) return false;
244
+ if (rule.charAt(0) == ".") return name.endsWith(rule);
245
+ if (rule.endsWith("/*")) return type.startsWith(rule.slice(0, -1));
246
+ return type == rule;
247
+ });
248
+
249
+ };
250
+
251
+ const createHintText = function () {
252
+ if (box.hintText) return box.hintText;
253
+ const parts = [];
254
+ if (box.accept) {
255
+ const rules = box.accept.split(",").map(function (rule) { return rule.trim(); });
256
+ parts.push(rules.join(", "));
257
+ }
258
+ if (box.maxSize) parts.push("max " + FilePicker.formatSize(box.maxSize));
259
+ if (box.multiple == 1 && box.maxFiles) parts.push(box.maxFiles + " files");
260
+ return parts.join(" • ");
261
+ };
262
+
263
+ // WHY: A user who asked the system for less motion gets the still icon.
264
+ const isMotionOn = function () {
265
+ if (box.animated != 1) return false;
266
+ const reduceMotion = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
267
+ return !reduceMotion;
268
+ };
269
+
270
+ const getIconTransform = function () {
271
+ if (box.state == "dragover") return "translateY(-" + DROP_ICON_LIFT + "px) scale(" + DROP_ICON_GROW + ")";
272
+ if (box.state == "hover") return "translateY(-" + HOVER_ICON_LIFT + "px) scale(" + HOVER_ICON_GROW + ")";
273
+ return "none";
274
+ };
275
+
276
+ // The look of the state. (Nothing when animated is off.)
277
+ const paintMotion = function () {
278
+ if (!isMotionOn()) return;
279
+ box.icon.css.transform = getIconTransform();
280
+ };
281
+
282
+ // The transition, or the still look of animated: 0.
283
+ const applyAnimated = function () {
284
+ if (!isMotionOn()) {
285
+ if (wasAnimated) {
286
+ wasAnimated = 0;
287
+ box.icon.setMotion("");
288
+ box.icon.css.transform = "";
289
+ }
290
+ return;
291
+ }
292
+ wasAnimated = 1;
293
+ box.icon.setMotion("transform " + MOTION_TIME + " " + MOTION_EASE);
294
+ paintMotion();
295
+ };
296
+
297
+ const setState = function (state) {
298
+
299
+ box.state = state;
300
+
301
+ let zoneStyle = _s.zone;
302
+ if (state == "hover") zoneStyle = _s.zoneHover;
303
+ if (state == "dragover") zoneStyle = _s.zoneDragOver;
304
+
305
+ box.zone.color = zoneStyle.color;
306
+ box.zone.borderColor = zoneStyle.borderColor;
307
+
308
+ const iconColor = (state == "dragover") ? _s.icon.dragOverColor : _s.icon.color;
309
+ box.icon.textColor = iconColor;
310
+ paintMotion();
311
+
312
+ setText(box.title, (state == "dragover") ? box.dropText : box.titleText);
313
+
314
+ };
315
+
316
+ // The upload icon: a picture of the page (iconFile), or an "<svg" text drawn with currentColor.
317
+ const applyIcon = function () {
318
+ if (!box.iconFile) {
319
+ box.icon.elem.innerHTML = box.iconSvg || _s.icon.svg || FilePicker.UPLOAD_ICON;
320
+ return;
321
+ }
322
+ // WHY an element, not an <img> text: a path or a data: address may hold quotes
323
+ const picture = document.createElement("img");
324
+ picture.src = box.iconFile;
325
+ picture.alt = "";
326
+ box.icon.elem.replaceChildren(picture);
327
+ };
328
+
329
+ const paintEnabled = function () {
330
+ const isEnabled = (box.enabled == 1);
331
+ box.opacity = (isEnabled) ? 1 : _s.disabled.opacity;
332
+ box.zone.cursor = (isEnabled) ? "pointer" : "default";
333
+ box.zone.tabIndex = (isEnabled) ? 0 : -1;
334
+ box.zone.aria = { disabled: (isEnabled) ? "false" : "true" };
335
+ box.input.disabled = !isEnabled;
336
+ };
337
+
338
+ const revokePreviews = function () {
339
+ previewUrls.forEach(function (url) { URL.revokeObjectURL(url); });
340
+ previewUrls = [];
341
+ };
342
+
343
+ const removeRows = function () {
344
+ rows.forEach(function (row) { row.remove(); });
345
+ rows = [];
346
+ revokePreviews();
347
+ };
348
+
349
+ // The address of a picture for the list. "": none (a plain object of a program without a previewAddress).
350
+ const getPreviewAddress = function (info) {
351
+ if (info.file.previewAddress) return info.file.previewAddress;
352
+ if (!(info.file instanceof Blob)) return "";
353
+ const url = URL.createObjectURL(info.file);
354
+ previewUrls.push(url);
355
+ return url;
356
+ };
357
+
358
+ // ICON: Image preview, or LABEL: extension badge
359
+ const createThumbnail = function (info) {
360
+
361
+ const thumbSize = _s.item.height - THUMB_INSET;
362
+ const isImage = (box.showPreview == 1 && info.type.startsWith("image/"));
363
+ const previewAddress = (isImage) ? getPreviewAddress(info) : "";
364
+
365
+ if (previewAddress) {
366
+ const icoPreview = Icon({ width: thumbSize, height: thumbSize, round: _s.badge.round });
367
+ icoPreview.css.objectFit = "cover";
368
+ icoPreview.shrink = 0;
369
+ icoPreview.load(previewAddress);
370
+ return;
371
+ }
372
+
373
+ const lblBadge = Label({
374
+ width: thumbSize,
375
+ height: thumbSize,
376
+ text: (info.extension || "file").slice(0, BADGE_MAX_LETTERS).toUpperCase(),
377
+ textAlign: "center",
378
+ fontSize: 10,
379
+ fontFamily: "opensans-bold",
380
+ color: _s.badge.color,
381
+ textColor: _s.badge.textColor,
382
+ round: _s.badge.round,
383
+ });
384
+ lblBadge.lineHeight = thumbSize; // WHY: The text in the middle (a number is px).
385
+ lblBadge.shrink = 0;
386
+
387
+ };
388
+
389
+ const createRemoveButton = function (index) {
390
+
391
+ const btnRemove = Label({
392
+ width: 28,
393
+ height: 28,
394
+ text: "×",
395
+ textAlign: "center",
396
+ fontSize: 20,
397
+ round: 100,
398
+ textColor: _s.removeButton.textColor,
399
+ });
400
+ btnRemove.lineHeight = "26px";
401
+ btnRemove.cursor = "pointer";
402
+ btnRemove.shrink = 0;
403
+ btnRemove.elem.title = "Remove";
404
+
405
+ btnRemove.on("mouseover", function () {
406
+ btnRemove.textColor = _s.removeButton.hoverColor;
407
+ });
408
+ btnRemove.on("mouseout", function () {
409
+ btnRemove.textColor = _s.removeButton.textColor;
410
+ });
411
+ btnRemove.on("click", function () {
412
+ if (box.enabled != 1) return;
413
+ box.removeFile(index);
414
+ });
415
+
416
+ };
417
+
418
+ const createRow = function (info, index) {
419
+
420
+ // GROUP: Row
421
+ const row = HGroup({
422
+ width: "100%",
423
+ height: _s.item.height,
424
+ align: "left center",
425
+ gap: ROW_GAP,
426
+ padding: [ROW_GAP, 0],
427
+ color: _s.item.color,
428
+ border: _s.item.border,
429
+ borderColor: _s.item.borderColor,
430
+ round: _s.item.round,
431
+ });
432
+ row.clickable = 1;
433
+ row.elem.title = info.path; // Full name on mouse over
434
+
435
+ createThumbnail(info);
436
+
437
+ // GROUP: Name, size
438
+ const grpTexts = VGroup({
439
+ width: "auto",
440
+ height: "auto",
441
+ align: "left center",
442
+ });
443
+ grpTexts.css = { flex: "1 1 0", minWidth: "0" };
444
+
445
+ // LABEL: Name
446
+ const lblName = Label({
447
+ width: "100%",
448
+ plainText: info.displayName,
449
+ ..._s.itemName,
450
+ });
451
+ lblName.css = { whiteSpace: "nowrap", textOverflow: "ellipsis" };
452
+
453
+ // LABEL: Size and type
454
+ const typeText = (info.type) ? " • " + info.type : "";
455
+ const lblSize = Label({
456
+ plainText: info.sizeText + typeText,
457
+ ..._s.itemSize,
458
+ });
459
+ lblSize.css.whiteSpace = "nowrap";
460
+
461
+ endGroup();
462
+
463
+ createRemoveButton(index);
464
+
465
+ endGroup();
466
+
467
+ return row;
468
+
469
+ };
470
+
471
+ const renderList = function () {
472
+
473
+ removeRows();
474
+
475
+ box.list.visible = (box.showList == 1 && box.files.length > 0) ? 1 : 0;
476
+ if (box.showList != 1) return;
477
+
478
+ createIn(box.list, function () {
479
+ box.files.forEach(function (info, index) {
480
+ rows.push(createRow(info, index));
481
+ });
482
+ });
483
+
484
+ };
485
+
486
+ const createError = function (type, name, message) {
487
+ return { type: type, name: name, message: message };
488
+ };
489
+
490
+ // The files that pass accept and maxSize. The others go to errors.
491
+ const readValidFiles = function (fileList, errors) {
492
+
493
+ const validFiles = [];
494
+
495
+ Array.from(fileList).forEach(function (file) {
496
+
497
+ if (!isAccepted(file)) {
498
+ errors.push(createError("accept", file.name, file.name + ": file type is not allowed."));
499
+ return;
500
+ }
501
+ if (box.maxSize && file.size > box.maxSize) {
502
+ const message = file.name + ": larger than " + FilePicker.formatSize(box.maxSize) + ".";
503
+ errors.push(createError("maxSize", file.name, message));
504
+ return;
505
+ }
506
+ validFiles.push(createFileInfo(file));
507
+
508
+ });
509
+
510
+ return validFiles;
511
+
512
+ };
513
+
514
+ // Returns how many files were added.
515
+ const addToList = function (newFiles, errors) {
516
+
517
+ let addedCount = 0;
518
+ newFiles.forEach(function (info) {
519
+
520
+ const isInList = box.files.some(function (listed) { return isSameFile(listed, info); });
521
+ if (isInList) return;
522
+
523
+ if (box.maxFiles && box.files.length >= box.maxFiles) {
524
+ errors.push(createError("maxFiles", info.name, info.name + ": maximum " + box.maxFiles + " files."));
525
+ return;
526
+ }
527
+ box.files.push(info);
528
+ addedCount++;
529
+
530
+ });
531
+ return addedCount;
532
+
533
+ };
534
+
535
+ // Add files from the dialog or drop.
536
+ const addFiles = function (fileList) {
537
+
538
+ if (box.enabled != 1) return;
539
+
540
+ const errors = [];
541
+ let newFiles = readValidFiles(fileList, errors);
542
+
543
+ let addedCount = 0;
544
+ // WHY directory too: a folder is many files; directory: 1 without multiple: 1 kept only the first file of the
545
+ // folder and said "Only one file can be selected." (sample 3 of file-picker.htm)
546
+ const isMultiple = (box.multiple == 1 || box.directory == 1);
547
+ if (!isMultiple) {
548
+ if (newFiles.length > 1) {
549
+ errors.push(createError("maxFiles", "", "Only one file can be selected."));
550
+ }
551
+ newFiles = newFiles.slice(0, 1);
552
+ if (newFiles.length) box.files = newFiles;
553
+ addedCount = newFiles.length;
554
+ } else {
555
+ // WHY the count: a file that was already in the list (or over maxFiles) called onChange with the same list
556
+ addedCount = addToList(newFiles, errors);
557
+ }
558
+
559
+ if (addedCount) {
560
+ renderList();
561
+ box.onChange(box);
562
+ }
563
+
564
+ if (errors.length) box.onError(box, errors);
565
+
566
+ };
567
+
568
+ const onPageDragOver = function (self, event) {
569
+ event.preventDefault();
570
+ };
571
+
572
+ // *** PUBLIC FUNCTIONS:
573
+
574
+ // Open the file dialog.
575
+ box.open = function () {
576
+ if (box.enabled != 1) return;
577
+ if (typeof box.onOpenDialog === "function") {
578
+ box.onOpenDialog(box);
579
+ return;
580
+ }
581
+ box.input.value = ""; // WHY: The same file can be selected again.
582
+ box.input.click();
583
+ };
584
+ // NOTE: Browsers open the dialog only after a user action (click, key).
585
+
586
+ box.getFiles = function () {
587
+ return box.files.slice();
588
+ };
589
+
590
+ box.getFileDetails = function () {
591
+ return box.files.map(function (info) {
592
+ const details = Object.assign({}, info);
593
+ delete details.file;
594
+ return details;
595
+ });
596
+ };
597
+
598
+ // silent: 1 -> onChange is not called.
599
+ box.removeFile = function (index, silent = 0) {
600
+ if (index < 0 || index >= box.files.length) return;
601
+ box.files.splice(index, 1);
602
+ renderList();
603
+ if (!silent) box.onChange(box);
604
+ };
605
+
606
+ box.clear = function (silent = 0) {
607
+ if (box.files.length == 0) return;
608
+ box.files = [];
609
+ renderList();
610
+ if (!silent) box.onChange(box);
611
+ };
612
+
613
+ // Add files with code. (Ex: from a paste event)
614
+ box.addFiles = function (fileList) {
615
+ addFiles(fileList);
616
+ };
617
+
618
+ box.setAnimated = function (value) {
619
+ box.animated = (value == 1) ? 1 : 0;
620
+ applyAnimated();
621
+ };
622
+
623
+ // An "<svg" text drawn with currentColor. Empty: the upload icon of the style. (An iconFile is shown over it.)
624
+ box.setIconSvg = function (svgText) {
625
+ box.iconSvg = svgText || "";
626
+ applyIcon();
627
+ };
628
+
629
+ // A picture of your own (a path or a data: address) in the place of the icon. Empty: the svg icon.
630
+ box.setIcon = function (file) {
631
+ box.iconFile = file || "";
632
+ applyIcon();
633
+ };
634
+ // USAGE: filePicker.setIcon("../assets/icons/upload.png")
635
+
636
+ box.setEnabled = function (enabled) {
637
+ box.enabled = basic.isOn(enabled) ? 1 : 0;
638
+ paintEnabled();
639
+ };
640
+ // USAGE: get: selectFile.enabled, set: selectFile.setEnabled(0)
641
+
642
+ box.setTitleText = function (text) {
643
+ box.titleText = text;
644
+ if (box.state != "dragover") setText(box.title, text);
645
+ fitZoneContent();
646
+ };
647
+
648
+ box.setDescriptionText = function (text) {
649
+ box.descriptionText = text;
650
+ setText(box.desc, text);
651
+ fitZoneContent();
652
+ };
653
+
654
+ box.refresh = function () {
655
+ paintEnabled();
656
+ renderList();
657
+ };
658
+
659
+ // WHY: box.superRemove is overwritten by a component that extends this one, so the local copy is called below.
660
+ const superRemove = box.remove;
661
+ box.superRemove = superRemove;
662
+ box.remove = function () {
663
+
664
+ if (!box) return; // WHY: remove() can be called twice (also by the parent's remove()).
665
+ revokePreviews();
666
+
667
+ superRemove.call(box); // NOTE: basic.js remove(). It cleans all the events and the objects inside.
668
+ box = null;
669
+
670
+ };
671
+
672
+ // *** OBJECT VIEW:
673
+
674
+ // GROUP: Component content (zone, list)
675
+ box.content = VGroup({
676
+ width: "100%",
677
+ height: "auto",
678
+ align: "left top",
679
+ gap: 10,
680
+ position: "relative", // WHY: Component height is "auto". A relative group makes the container wrap it.
681
+ });
682
+
683
+ // GROUP: Drop zone
684
+ box.zone = VGroup({
685
+ width: "100%",
686
+ height: box.zoneHeight,
687
+ align: "center",
688
+ gap: ZONE_GAP,
689
+ padding: [16, ZONE_MIN_SPACE],
690
+ color: _s.zone.color,
691
+ border: _s.zone.border,
692
+ borderColor: _s.zone.borderColor,
693
+ round: _s.zone.round,
694
+ });
695
+ box.zone.css = { borderStyle: "dashed", outline: "none" };
696
+ box.zone.role = "button";
697
+ box.zone.setMotion(ZONE_MOTION);
698
+
699
+ // BOX: Upload icon (a cloud and an arrow, drawn with currentColor)
700
+ box.icon = Box({
701
+ width: _s.icon.size,
702
+ height: _s.icon.size,
703
+ color: "transparent",
704
+ textColor: _s.icon.color,
705
+ shrink: 0,
706
+ });
707
+ box.icon.css.marginBottom = _s.icon.space + "px";
708
+ box.icon.clipContent = 0;
709
+ // WHY: an svg of the page may come without a size of its own.
710
+ basic.addCss("file-picker-icon", ".file-picker-icon svg, .file-picker-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }");
711
+ box.icon.elem.classList.add("file-picker-icon");
712
+ applyIcon();
713
+
714
+ if (box.showIcon != 1) box.icon.visible = 0;
715
+
716
+ // LABEL: Title
717
+ box.title = Label({
718
+ textAlign: "center",
719
+ shrink: 0,
720
+ ..._s.title,
721
+ });
722
+ setText(box.title, box.titleText);
723
+
724
+ // LABEL: Description
725
+ box.desc = Label({
726
+ textAlign: "center",
727
+ shrink: 0,
728
+ ..._s.desc,
729
+ });
730
+ setText(box.desc, box.descriptionText);
731
+
732
+ // LABEL: Hint (accept, max size)
733
+ box.hint = Label({
734
+ plainText: createHintText(),
735
+ textAlign: "center",
736
+ shrink: 0,
737
+ ..._s.hint,
738
+ });
739
+ box.hint.css.marginTop = HINT_SPACE + "px";
740
+ if (!box.hint.text) box.hint.visible = 0;
741
+
742
+ endGroup();
743
+
744
+ // GROUP: File list (created by renderList)
745
+ box.list = VGroup({
746
+ width: "100%",
747
+ height: "auto",
748
+ align: "left top",
749
+ gap: 6,
750
+ });
751
+
752
+ endGroup();
753
+
754
+ endGroup();
755
+
756
+ // INPUT: Hidden file input (native file dialog)
757
+ box.input = document.createElement("input");
758
+ box.input.type = "file";
759
+ box.input.style.display = "none";
760
+ if (box.multiple == 1 || box.directory == 1) box.input.multiple = true;
761
+ if (box.accept) box.input.accept = box.accept;
762
+ if (box.directory == 1) box.input.webkitdirectory = true;
763
+ box.elem.appendChild(box.input);
764
+
765
+ // *** OBJECT INIT CODE:
766
+ box.zone.onResize(fitZoneContent);
767
+ fitZoneContent();
768
+
769
+ box.input.addEventListener("change", function () {
770
+ addFiles(box.input.files);
771
+ box.input.value = "";
772
+ });
773
+ // NOTE: box.remove() removes the input element too, so its event is cleaned with it.
774
+
775
+ box.zone.on("click", function () {
776
+ box.open();
777
+ });
778
+
779
+ box.zone.on("keydown", function (self, event) {
780
+ if (event.key !== "Enter" && event.key !== " ") return;
781
+ event.preventDefault();
782
+ box.open();
783
+ });
784
+
785
+ box.zone.on("mouseover", function () {
786
+ isMouseOver = 1;
787
+ if (box.enabled != 1 || box.state == "dragover") return;
788
+ setState("hover");
789
+ });
790
+
791
+ box.zone.on("mouseout", function () {
792
+ isMouseOver = 0;
793
+ if (box.state != "dragover") setState("normal");
794
+ });
795
+
796
+ box.zone.on("dragenter", function (self, event) {
797
+ event.preventDefault();
798
+ if (box.enabled != 1) return;
799
+ dragCounter++;
800
+ setState("dragover");
801
+ });
802
+
803
+ box.zone.on("dragover", function (self, event) {
804
+ event.preventDefault(); // WHY: Required to allow drop.
805
+ if (event.dataTransfer) event.dataTransfer.dropEffect = (box.enabled == 1) ? "copy" : "none";
806
+ });
807
+
808
+ box.zone.on("dragleave", function (self, event) {
809
+ dragCounter = Math.max(0, dragCounter - 1);
810
+ if (dragCounter == 0) setState((isMouseOver) ? "hover" : "normal");
811
+ });
812
+
813
+ box.zone.on("drop", function (self, event) {
814
+ event.preventDefault();
815
+ dragCounter = 0;
816
+ setState("normal");
817
+ if (box.enabled != 1 || !event.dataTransfer) return;
818
+ // NOTE: A dropped folder can not be read as a file list. Use directory: 1 with click.
819
+ addFiles(event.dataTransfer.files);
820
+ });
821
+
822
+ if (box.preventPageDrop == 1) {
823
+ box.listenTo(window, "dragover", onPageDragOver); // (removed with the box)
824
+ box.listenTo(window, "drop", onPageDragOver);
825
+ }
826
+
827
+ box.enabled = basic.isOn(box.enabled) ? 1 : 0;
828
+ applyAnimated();
829
+ setState("normal");
830
+ paintEnabled();
831
+ renderList();
832
+
833
+ return endObject(box);
834
+
835
+ };
836
+
837
+ // *** STYLE PACKAGES:
838
+
839
+ // USAGE: FilePicker.styles.myStyle = { zone: { round: 14 } };
840
+ FilePicker.styles = {
841
+
842
+ // White, dark text, a dashed line.
843
+ light: FilePickerDefaults.style,
844
+
845
+ // Dark theme, same colors as ColorPicker "dark".
846
+ dark: {
847
+ zone: { color: "#232322", borderColor: "rgba(255, 255, 255, 0.22)" },
848
+ zoneHover: { color: "#2A2A29", borderColor: "rgba(255, 255, 255, 0.40)" },
849
+ zoneDragOver: { color: "#26332F", borderColor: "#65A293" },
850
+ icon: { color: "rgba(255, 255, 255, 0.55)", dragOverColor: "#65A293" },
851
+ title: { textColor: "rgba(255, 255, 255, 0.90)" },
852
+ desc: { textColor: "rgba(255, 255, 255, 0.55)" },
853
+ hint: { textColor: "rgba(255, 255, 255, 0.40)" },
854
+ item: { color: "#232322", borderColor: "rgba(255, 255, 255, 0.12)" },
855
+ itemName: { textColor: "rgba(255, 255, 255, 0.90)" },
856
+ itemSize: { textColor: "rgba(255, 255, 255, 0.50)" },
857
+ badge: { color: "rgba(255, 255, 255, 0.10)", textColor: "rgba(255, 255, 255, 0.70)" },
858
+ removeButton: { textColor: "rgba(255, 255, 255, 0.55)" },
859
+ },
860
+
861
+ };
862
+ FilePicker.styles.classic = FilePicker.styles.light; // the old name of light: the pages made with it keep their look
863
+
864
+ // *** STATIC FUNCTIONS:
865
+
866
+ // The upload icon: a cloud open at the bottom, an arrow going up through it.
867
+ FilePicker.UPLOAD_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="2.5 2.5 19 19" fill="none"'
868
+ + ' stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="display:block">'
869
+ + '<path d="M8.5 18H7a4 4 0 0 1-.5-7.97A6 6 0 0 1 17.6 9a4.6 4.6 0 0 1-.6 9h-1.5"/>'
870
+ + '<path d="M12 20.5V12M9 15l3-3 3 3"/></svg>';
871
+
872
+ // The upload icon of the minimal theme (_designs/minimal-theme.htm), drawn as its other icons: a 24 px grid, lines 2
873
+ // wide with round ends. The head of the arrow is in the cloud.
874
+ FilePicker.MINIMAL_UPLOAD_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none"'
875
+ + ' stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:block">'
876
+ + '<path d="M7 18a4.5 4.5 0 0 1-.5-9A6 6 0 0 1 18 9.5a4 4 0 0 1-1 8.5"/>'
877
+ + '<path d="M12 12v8M9 15l3-3 3 3"/></svg>';
878
+
879
+ // 1536 -> "1.5 KB"
880
+ FilePicker.formatSize = function (bytes) {
881
+ if (!bytes) return "0 B";
882
+ const units = ["B", "KB", "MB", "GB", "TB"];
883
+ const index = Math.min(units.length - 1, Math.floor(Math.log(bytes) / Math.log(1024)));
884
+ const value = bytes / Math.pow(1024, index);
885
+ if (index == 0) return value + " " + units[index];
886
+ const decimals = (value < 10) ? 1 : 0;
887
+ return value.toFixed(decimals) + " " + units[index];
888
+ };
889
+ // USAGE: FilePicker.formatSize(5 * 1024 * 1024) -> "5.0 MB"
890
+
891
+ // WHY: Label.text uses innerHTML. File names must not be read as HTML.
892
+ FilePicker.escapeHtml = basic.escapeHtml; // (the name is kept: other code may use it)
893
+
894
+ // The minimal theme (_designs/minimal-theme.htm): a lower zone (120 px) with no fill and a dashed line of 3:1 at least
895
+ // (it is a control: a click chooses a file), darker under the mouse and ink while a file is dragged over it; a 28 px
896
+ // line icon of its own; 13 px texts; the rows of the files with a soft line. minimalDark: the same on a dark window.
897
+ FilePicker.createMinimalStyle = function (colors) {
898
+ return {
899
+ zoneHeight: 120,
900
+ style: {
901
+ zone: { color: "transparent", border: 1, borderColor: colors.edge, round: 4 },
902
+ zoneHover: { color: "transparent", borderColor: colors.edgeHover },
903
+ zoneDragOver: { color: colors.hover, borderColor: colors.ink },
904
+ icon: { size: 28, space: 0, svg: FilePicker.MINIMAL_UPLOAD_ICON, color: colors.softText, dragOverColor: colors.ink },
905
+ title: { fontSize: 13, textColor: colors.text, fontFamily: "opensans-bold" },
906
+ desc: { fontSize: 12, textColor: colors.softText },
907
+ hint: { fontSize: 11, textColor: colors.softText },
908
+ item: { height: 42, color: "transparent", border: 1, borderColor: colors.line, round: 4 }, // WHY 42: room for the two lines of texts
909
+ itemName: { fontSize: 13, textColor: colors.text },
910
+ itemSize: { fontSize: 11, textColor: colors.softText },
911
+ badge: { color: "transparent", textColor: colors.softText, round: 3 },
912
+ removeButton: { textColor: colors.softText, hoverColor: colors.danger },
913
+ disabled: { opacity: 0.4 },
914
+ },
915
+ };
916
+ };
917
+ FilePicker.MINIMAL_COLORS = { text: Black(0.85), softText: Black(0.55), line: Black(0.2), edge: Black(0.45), edgeHover: Black(0.65), ink: "#1F1F1F", hover: Black(0.04), danger: "#C24A36" };
918
+ FilePicker.styles.minimal = FilePicker.createMinimalStyle(FilePicker.MINIMAL_COLORS);
919
+ FilePicker.MINIMAL_DARK_COLORS = { text: White(0.88), softText: White(0.55), line: White(0.18), edge: White(0.42), edgeHover: White(0.62), ink: "#EDEDEB", hover: White(0.06), danger: "#FF9F93" };
920
+ FilePicker.styles.minimalDark = FilePicker.createMinimalStyle(FilePicker.MINIMAL_DARK_COLORS);