@pushwoosh/smart-components-kit 1.11.1 → 1.13.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.
- package/MediaStorage/GenerateImageTab.d.ts +12 -0
- package/MediaStorage/GenerateImageTab.js +104 -0
- package/MediaStorage/MediaStorage.js +107 -7
- package/MediaStorage/MediaStoragePaginated.js +3 -9
- package/MediaStorage/StockPhotosTab.d.ts +9 -0
- package/MediaStorage/StockPhotosTab.js +135 -0
- package/MediaStorage/aiGallery.d.ts +49 -0
- package/MediaStorage/aiGallery.js +55 -0
- package/MediaStorage/hooks.d.ts +3 -0
- package/MediaStorage/hooks.js +16 -0
- package/MediaStorage/index.d.ts +1 -1
- package/MediaStorage/mediaFile.utils.js +3 -1
- package/MediaStorage/polyglot/messages_ar.js +28 -1
- package/MediaStorage/polyglot/messages_bn.js +28 -1
- package/MediaStorage/polyglot/messages_de.js +28 -1
- package/MediaStorage/polyglot/messages_en.js +28 -1
- package/MediaStorage/polyglot/messages_es.js +28 -1
- package/MediaStorage/polyglot/messages_fr.js +28 -1
- package/MediaStorage/polyglot/messages_he.js +28 -1
- package/MediaStorage/polyglot/messages_hi.js +28 -1
- package/MediaStorage/polyglot/messages_ja.js +28 -1
- package/MediaStorage/polyglot/messages_ko.js +28 -1
- package/MediaStorage/polyglot/messages_pt.js +28 -1
- package/MediaStorage/polyglot/messages_ru.js +28 -1
- package/MediaStorage/polyglot/messages_th.js +28 -1
- package/MediaStorage/polyglot/messages_zh.js +28 -1
- package/MediaStorage/polyglot/types.d.ts +27 -0
- package/MediaStorage/styles.d.ts +54 -0
- package/MediaStorage/styles.js +46 -2
- package/MediaStorage/types.d.ts +13 -0
- package/package.json +1 -1
package/MediaStorage/styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { NativeInput } from '@pushwoosh/dumb-components';
|
|
2
|
+
import { NativeInput, NativeTextarea } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Color, FontSize, FontWeight } from '@pushwoosh/kit-constants';
|
|
4
4
|
export const Grid = styled.div.withConfig({
|
|
5
5
|
displayName: "Grid",
|
|
@@ -143,4 +143,48 @@ export const DropzoneRow = styled.div.withConfig({
|
|
|
143
143
|
export const CanvaActions = styled.div.withConfig({
|
|
144
144
|
displayName: "CanvaActions",
|
|
145
145
|
componentId: "sc-uu3cbo-30"
|
|
146
|
-
})(["display:flex;flex-direction:column;justify-content:center;gap:8px;& > *{width:100%;}"]);
|
|
146
|
+
})(["display:flex;flex-direction:column;justify-content:center;gap:8px;& > *{width:100%;}"]);
|
|
147
|
+
export const TabBody = styled.div.withConfig({
|
|
148
|
+
displayName: "TabBody",
|
|
149
|
+
componentId: "sc-uu3cbo-31"
|
|
150
|
+
})(["padding-top:16px;"]);
|
|
151
|
+
export const SearchRow = styled.div.withConfig({
|
|
152
|
+
displayName: "SearchRow",
|
|
153
|
+
componentId: "sc-uu3cbo-32"
|
|
154
|
+
})(["display:flex;gap:8px;margin-bottom:16px;"]);
|
|
155
|
+
export const StockTile = styled.button.withConfig({
|
|
156
|
+
displayName: "StockTile",
|
|
157
|
+
componentId: "sc-uu3cbo-33"
|
|
158
|
+
})(["all:unset;background-color:", ";opacity:", ";display:block;width:100%;box-sizing:border-box;cursor:pointer;border-radius:6px;overflow:hidden;border:1px solid ", ";transition:border-color 0.15s,opacity 0.15s;&:hover{border-color:", ";}&:disabled{cursor:default;}"], ({
|
|
159
|
+
$avgColor
|
|
160
|
+
}) => $avgColor || 'transparent', ({
|
|
161
|
+
$dimmed
|
|
162
|
+
}) => $dimmed ? 0.6 : 1, Color.DIVIDER, Color.PRIMARY);
|
|
163
|
+
export const StockCredit = styled.a.withConfig({
|
|
164
|
+
displayName: "StockCredit",
|
|
165
|
+
componentId: "sc-uu3cbo-34"
|
|
166
|
+
})(["display:block;margin-top:2px;padding:0 4px 4px;font-size:11px;color:", ";text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;&:hover{text-decoration:underline;}"], Color.LOCKED);
|
|
167
|
+
export const ProviderNote = styled.div.withConfig({
|
|
168
|
+
displayName: "ProviderNote",
|
|
169
|
+
componentId: "sc-uu3cbo-35"
|
|
170
|
+
})(["margin-top:16px;text-align:center;font-size:12px;color:", ";a{color:", ";}"], Color.LOCKED, Color.MAIN);
|
|
171
|
+
export const GenerateForm = styled.div.withConfig({
|
|
172
|
+
displayName: "GenerateForm",
|
|
173
|
+
componentId: "sc-uu3cbo-36"
|
|
174
|
+
})(["display:flex;flex-direction:column;gap:12px;max-width:560px;"]);
|
|
175
|
+
export const GenerateControls = styled.div.withConfig({
|
|
176
|
+
displayName: "GenerateControls",
|
|
177
|
+
componentId: "sc-uu3cbo-37"
|
|
178
|
+
})(["display:flex;align-items:center;gap:8px;"]);
|
|
179
|
+
export const GeneratedPreview = styled.img.withConfig({
|
|
180
|
+
displayName: "GeneratedPreview",
|
|
181
|
+
componentId: "sc-uu3cbo-38"
|
|
182
|
+
})(["display:block;max-width:100%;max-height:420px;border-radius:8px;border:1px solid ", ";"], Color.DIVIDER);
|
|
183
|
+
export const SearchField = styled(NativeInput).withConfig({
|
|
184
|
+
displayName: "SearchField",
|
|
185
|
+
componentId: "sc-uu3cbo-39"
|
|
186
|
+
})(["flex:1;width:auto;max-width:none;"]);
|
|
187
|
+
export const PromptField = styled(NativeTextarea).withConfig({
|
|
188
|
+
displayName: "PromptField",
|
|
189
|
+
componentId: "sc-uu3cbo-40"
|
|
190
|
+
})(["font-family:inherit;resize:vertical;"]);
|
package/MediaStorage/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { MediaFile } from '@pushwoosh/rpc-v2-http-api-data/media_files';
|
|
2
|
+
/** Where the gallery can take an image from: the library itself, a stock-photo search or AI generation. */
|
|
3
|
+
export type MediaSource = 'library' | 'stock' | 'generate';
|
|
2
4
|
/** Per-channel options both gallery entry points accept; `MediaStoragePaginated` forwards them as-is. */
|
|
3
5
|
type MediaFileChannelOptions = {
|
|
4
6
|
/**
|
|
@@ -13,6 +15,17 @@ type MediaFileChannelOptions = {
|
|
|
13
15
|
* the kit has no opinion on why a file is risky for a particular channel.
|
|
14
16
|
*/
|
|
15
17
|
fileWarning?: (file: MediaFile) => string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Tabs to offer; defaults to the library alone, so existing consumers see no change. A source
|
|
20
|
+
* whose output format the `extensions` filter rejects is hidden (Stock is JPEG, Generate PNG or JPEG).
|
|
21
|
+
*/
|
|
22
|
+
sources?: MediaSource[];
|
|
23
|
+
/** Aspect ratios offered in the Generate tab; defaults to every ratio onyx accepts. */
|
|
24
|
+
aspectRatios?: string[];
|
|
25
|
+
/** Pre-selected aspect ratio in the Generate tab. */
|
|
26
|
+
defaultAspectRatio?: string;
|
|
27
|
+
/** Alt text suggested for a stock or generated pick (provider alt or the prompt). */
|
|
28
|
+
onSuggestAlt?: (file: MediaFile, alt: string) => void;
|
|
16
29
|
};
|
|
17
30
|
export type MediaStorageProps = MediaFileChannelOptions & {
|
|
18
31
|
/** Application code whose media files are listed. */
|