@rojaostudio/ds 2.0.0-next.3 → 2.0.0-next.30
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/README.md +42 -2
- package/THIRD_PARTY_NOTICES.md +66 -0
- package/dist/components/avatar.d.ts +20 -12
- package/dist/components/avatar.js +8 -6
- package/dist/components/badge.d.ts +7 -6
- package/dist/components/badge.js +2 -1
- package/dist/components/breadcrumb.d.ts +4 -4
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/bubble.d.ts +26 -11
- package/dist/components/bubble.js +3 -3
- package/dist/components/button.d.ts +1 -1
- package/dist/components/card.d.ts +28 -12
- package/dist/components/card.js +4 -2
- package/dist/components/chart.d.ts +18 -8
- package/dist/components/chart.js +89 -25
- package/dist/components/choice-carousel.d.ts +1 -1
- package/dist/components/choice-carousel.js +2 -4
- package/dist/components/choice-list.d.ts +40 -0
- package/dist/components/choice-list.js +122 -0
- package/dist/components/choice-preview-card.d.ts +1 -7
- package/dist/components/color-input.d.ts +1 -1
- package/dist/components/context-menu.d.ts +5 -2
- package/dist/components/currency-input.d.ts +0 -2
- package/dist/components/data-table-header.d.ts +55 -18
- package/dist/components/data-table-header.js +148 -101
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/dialog.d.ts +6 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/dropdown-menu.d.ts +5 -2
- package/dist/components/dropzone.d.ts +2 -2
- package/dist/components/dropzone.js +1 -1
- package/dist/components/file-input.d.ts +13 -8
- package/dist/components/file-input.js +24 -21
- package/dist/components/filter-chip.d.ts +11 -5
- package/dist/components/filter-chip.js +15 -6
- package/dist/components/floating-stepper.d.ts +11 -28
- package/dist/components/floating-stepper.js +2 -30
- package/dist/components/form-actions.d.ts +37 -15
- package/dist/components/form-actions.js +5 -14
- package/dist/components/heading.d.ts +42 -0
- package/dist/components/heading.js +25 -0
- package/dist/components/icon-button.d.ts +1 -1
- package/dist/components/image-crop-dialog.d.ts +60 -0
- package/dist/components/image-crop-dialog.js +240 -0
- package/dist/components/image-crop-modal.d.ts +12 -55
- package/dist/components/image-crop-modal.js +2 -249
- package/dist/components/image-upload.d.ts +8 -17
- package/dist/components/image-upload.js +3 -3
- package/dist/components/index.d.ts +15 -10
- package/dist/components/index.js +10 -0
- package/dist/components/internal/bottom-bar.d.ts +30 -0
- package/dist/components/internal/bottom-bar.js +25 -0
- package/dist/components/internal/button.d.ts +1 -1
- package/dist/components/internal/icons.d.ts +9 -1
- package/dist/components/internal/icons.js +16 -0
- package/dist/components/internal/menu.d.ts +3 -2
- package/dist/components/internal/menu.js +1 -1
- package/dist/components/internal/modal.js +9 -0
- package/dist/components/internal/toggle.d.ts +1 -1
- package/dist/components/internal/use-on-screen-keyboard.d.ts +12 -0
- package/dist/components/internal/use-on-screen-keyboard.js +49 -0
- package/dist/components/item.d.ts +14 -7
- package/dist/components/item.js +5 -2
- package/dist/components/loading-overlay.d.ts +43 -0
- package/dist/components/loading-overlay.js +81 -0
- package/dist/components/marker.d.ts +11 -3
- package/dist/components/marker.js +4 -3
- package/dist/components/number-input.d.ts +1 -1
- package/dist/components/progress.d.ts +3 -3
- package/dist/components/progress.js +2 -2
- package/dist/components/row-actions.d.ts +3 -0
- package/dist/components/row-actions.js +8 -4
- package/dist/components/saving-bar.d.ts +36 -10
- package/dist/components/saving-bar.js +14 -6
- package/dist/components/section-header.d.ts +4 -3
- package/dist/components/selectable-card.d.ts +2 -10
- package/dist/components/sidebar.d.ts +8 -11
- package/dist/components/sidebar.js +4 -5
- package/dist/components/spinner.d.ts +9 -6
- package/dist/components/spinner.js +3 -3
- package/dist/components/star-rating.d.ts +3 -3
- package/dist/components/star-rating.js +2 -2
- package/dist/components/stat.d.ts +18 -6
- package/dist/components/stat.js +9 -3
- package/dist/components/status.d.ts +4 -4
- package/dist/components/status.js +2 -2
- package/dist/components/stepper.d.ts +33 -0
- package/dist/components/stepper.js +36 -0
- package/dist/components/summary-bar.d.ts +3 -2
- package/dist/components/summary-bar.js +10 -1
- package/dist/components/tile.d.ts +5 -5
- package/dist/components/tile.js +2 -2
- package/dist/components/time-picker.d.ts +1 -1
- package/dist/components/toast.d.ts +17 -6
- package/dist/components/toast.js +5 -3
- package/dist/components/toggle-card-compact.d.ts +6 -25
- package/dist/components/toggle-card-compact.js +8 -35
- package/dist/components/toggle-card.d.ts +23 -9
- package/dist/components/toggle-card.js +38 -2
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/typing-indicator.d.ts +2 -2
- package/dist/components/typing-indicator.js +1 -1
- package/package.json +4 -4
- package/styles/base.css +13 -1
- package/styles/rds/components-styles.css +767 -281
- package/styles/rds/components.css +56 -31
- package/styles/rds/foundation.css +1 -1
- package/styles/rds/theme.css +40 -29
- package/styles/rds.css +1 -1
|
@@ -1,59 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ImageCropDialog, ImageCropDialogProps } from './image-crop-dialog.js';
|
|
2
|
+
export { CropPreset } from './image-crop-dialog.js';
|
|
3
|
+
import 'react';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Uso:
|
|
9
|
-
* <ImageCropModal
|
|
10
|
-
* open={open}
|
|
11
|
-
* file={selectedFile}
|
|
12
|
-
* onCancel={() => setOpen(false)}
|
|
13
|
-
* onConfirm={(blob) => uploadCroppedImage(blob)}
|
|
14
|
-
* />
|
|
15
|
-
*
|
|
16
|
-
* Presets default: Livre (1:2 a 2:1), 1:1, 4:5, 16:9.
|
|
17
|
-
* Customize via prop `presets`.
|
|
6
|
+
* image-crop-modal — the 1.x and 2.0-next name of the ImageCropDialog, kept so
|
|
7
|
+
* `@rojaostudio/ds/components/image-crop-modal` and `ImageCropModal` still work in 2.0. The codemod
|
|
8
|
+
* (`npx @rojaostudio/ds-codemod`) renames both. Like the dialog, it needs the optional peer `react-image-crop`.
|
|
18
9
|
*/
|
|
19
|
-
interface CropPreset {
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
/** Aspect ratio fixo. undefined = livre (com bounds MIN/MAX_ASPECT). */
|
|
23
|
-
aspect?: number;
|
|
24
|
-
/** Ícone opcional exibido antes do rótulo (ajuda quem não decodifica "16:9"). */
|
|
25
|
-
icon?: React.ReactNode;
|
|
26
|
-
}
|
|
27
|
-
interface ImageCropModalProps {
|
|
28
|
-
open: boolean;
|
|
29
|
-
file: File | null;
|
|
30
|
-
/** Label de contexto pro título (ex: "Foto 2 de 4"). */
|
|
31
|
-
position?: string;
|
|
32
|
-
onCancel: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* Recebe o blob do recorte. Pode ser assíncrono (ex.: upload) — o modal AGUARDA a promise
|
|
35
|
-
* e mantém o botão travado/carregando até resolver, evitando duplo-clique que duplicaria a
|
|
36
|
-
* imagem (o upload roda fora do `busy` se o modal não esperar).
|
|
37
|
-
*/
|
|
38
|
-
onConfirm: (blob: Blob) => void | Promise<void>;
|
|
39
|
-
/** Presets disponíveis. default = Livre + 1:1 + 4:5 + 16:9. */
|
|
40
|
-
presets?: CropPreset[];
|
|
41
|
-
/** Limite mínimo de aspect ratio (alto-baixo). default = 0.5 (1:2). */
|
|
42
|
-
minAspect?: number;
|
|
43
|
-
/** Limite máximo de aspect ratio (largo-baixo). default = 2.0 (2:1). */
|
|
44
|
-
maxAspect?: number;
|
|
45
|
-
/** Título do modal. default = "Ajustar foto". */
|
|
46
|
-
title?: string;
|
|
47
|
-
/** Label do botão confirmar. default = "Aplicar e enviar". */
|
|
48
|
-
confirmLabel?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Teto de tamanho do blob de saída (bytes). Quando definido, a saída do crop
|
|
51
|
-
* é forçada a JPEG e comprimida (qualidade + downscale) até caber no limite —
|
|
52
|
-
* evita que foto de celular grande estoure o limite de upload. Sem ele, a
|
|
53
|
-
* saída mantém o tipo original e qualidade fixa (comportamento inalterado).
|
|
54
|
-
*/
|
|
55
|
-
maxSizeBytes?: number;
|
|
56
|
-
}
|
|
57
|
-
declare function ImageCropModal({ open, file, position, onCancel, onConfirm, presets, minAspect, maxAspect, title, confirmLabel, maxSizeBytes, }: ImageCropModalProps): react.JSX.Element;
|
|
58
10
|
|
|
59
|
-
|
|
11
|
+
/** @deprecated Renamed to `ImageCropDialog` (`@rojaostudio/ds/components/image-crop-dialog`) in 2.0. Same props. */
|
|
12
|
+
declare const ImageCropModal: typeof ImageCropDialog;
|
|
13
|
+
/** @deprecated Renamed to `ImageCropDialogProps` in 2.0. */
|
|
14
|
+
type ImageCropModalProps = ImageCropDialogProps;
|
|
15
|
+
|
|
16
|
+
export { ImageCropModal, type ImageCropModalProps };
|
|
@@ -1,254 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import ReactCrop, { centerCrop } from "react-image-crop";
|
|
6
|
-
import "react-image-crop/dist/ReactCrop.css";
|
|
7
|
-
import { Alert } from "./alert.js";
|
|
8
|
-
import { Button } from "./button.js";
|
|
9
|
-
import { Dialog } from "./dialog.js";
|
|
10
|
-
import { Spinner } from "./spinner.js";
|
|
11
|
-
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
12
|
-
function RatioIcon({ w, h }) {
|
|
13
|
-
const box = 16;
|
|
14
|
-
const rw = w >= h ? box : w / h * box;
|
|
15
|
-
const rh = h >= w ? box : h / w * box;
|
|
16
|
-
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("rect", { x: (18 - rw) / 2, y: (18 - rh) / 2, width: rw, height: rh, rx: "1.5", stroke: "currentColor", strokeWidth: "1.6" }) });
|
|
17
|
-
}
|
|
18
|
-
function FreeIcon() {
|
|
19
|
-
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("rect", { x: "2.5", y: "2.5", width: "13", height: "13", rx: "1.5", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "2.5 2.2" }) });
|
|
20
|
-
}
|
|
21
|
-
const DEFAULT_PRESETS = [
|
|
22
|
-
{ id: "square", label: "1:1", aspect: 1, icon: /* @__PURE__ */ jsx(RatioIcon, { w: 1, h: 1 }) },
|
|
23
|
-
{ id: "portrait", label: "4:5", aspect: 4 / 5, icon: /* @__PURE__ */ jsx(RatioIcon, { w: 4, h: 5 }) },
|
|
24
|
-
{ id: "landscape", label: "16:9", aspect: 16 / 9, icon: /* @__PURE__ */ jsx(RatioIcon, { w: 16, h: 9 }) },
|
|
25
|
-
{ id: "free", label: "Livre", icon: /* @__PURE__ */ jsx(FreeIcon, {}) }
|
|
26
|
-
];
|
|
27
|
-
const DEFAULT_MIN_ASPECT = 0.5;
|
|
28
|
-
const DEFAULT_MAX_ASPECT = 2;
|
|
29
|
-
function buildInitialCrop(width, height, aspect) {
|
|
30
|
-
if (!aspect) {
|
|
31
|
-
return { unit: "%", x: 0, y: 0, width: 100, height: 100 };
|
|
32
|
-
}
|
|
33
|
-
const imageAspect = width / height;
|
|
34
|
-
let cropW;
|
|
35
|
-
let cropH;
|
|
36
|
-
if (aspect >= imageAspect) {
|
|
37
|
-
cropW = 100;
|
|
38
|
-
cropH = imageAspect / aspect * 100;
|
|
39
|
-
} else {
|
|
40
|
-
cropH = 100;
|
|
41
|
-
cropW = aspect / imageAspect * 100;
|
|
42
|
-
}
|
|
43
|
-
return centerCrop({ unit: "%", x: 0, y: 0, width: cropW, height: cropH }, width, height);
|
|
44
|
-
}
|
|
45
|
-
const QUALITY_STEPS = [0.85, 0.75, 0.65, 0.55];
|
|
46
|
-
const MAX_SIDE_STEPS = [1600, 1200];
|
|
47
|
-
function canvasToBlob(canvas, mimeType, quality) {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
canvas.toBlob((blob) => blob ? resolve(blob) : reject(new Error("toBlob failed")), mimeType, quality);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function drawCrop(image, crop, maxSide) {
|
|
53
|
-
const canvas = document.createElement("canvas");
|
|
54
|
-
const scaleX = image.naturalWidth / image.width;
|
|
55
|
-
const scaleY = image.naturalHeight / image.height;
|
|
56
|
-
let outW = Math.round(crop.width * scaleX);
|
|
57
|
-
let outH = Math.round(crop.height * scaleY);
|
|
58
|
-
if (maxSide && Math.max(outW, outH) > maxSide) {
|
|
59
|
-
const ratio = maxSide / Math.max(outW, outH);
|
|
60
|
-
outW = Math.round(outW * ratio);
|
|
61
|
-
outH = Math.round(outH * ratio);
|
|
62
|
-
}
|
|
63
|
-
canvas.width = outW;
|
|
64
|
-
canvas.height = outH;
|
|
65
|
-
const ctx = canvas.getContext("2d");
|
|
66
|
-
if (!ctx) throw new Error("Canvas not supported");
|
|
67
|
-
ctx.drawImage(
|
|
68
|
-
image,
|
|
69
|
-
crop.x * scaleX,
|
|
70
|
-
crop.y * scaleY,
|
|
71
|
-
crop.width * scaleX,
|
|
72
|
-
crop.height * scaleY,
|
|
73
|
-
0,
|
|
74
|
-
0,
|
|
75
|
-
outW,
|
|
76
|
-
outH
|
|
77
|
-
);
|
|
78
|
-
return canvas;
|
|
79
|
-
}
|
|
80
|
-
async function cropToBlob(image, crop, mimeType, maxSizeBytes) {
|
|
81
|
-
const baseCanvas = drawCrop(image, crop);
|
|
82
|
-
if (!maxSizeBytes) {
|
|
83
|
-
return canvasToBlob(baseCanvas, mimeType, 0.92);
|
|
84
|
-
}
|
|
85
|
-
const out = await canvasToBlob(baseCanvas, "image/jpeg", 0.92);
|
|
86
|
-
if (out.size <= maxSizeBytes) return out;
|
|
87
|
-
let best = out;
|
|
88
|
-
for (const q of QUALITY_STEPS) {
|
|
89
|
-
const candidate = await canvasToBlob(baseCanvas, "image/jpeg", q);
|
|
90
|
-
best = candidate;
|
|
91
|
-
if (candidate.size <= maxSizeBytes) return candidate;
|
|
92
|
-
}
|
|
93
|
-
for (const side of MAX_SIDE_STEPS) {
|
|
94
|
-
const scaledCanvas = drawCrop(image, crop, side);
|
|
95
|
-
for (const q of QUALITY_STEPS) {
|
|
96
|
-
const candidate = await canvasToBlob(scaledCanvas, "image/jpeg", q);
|
|
97
|
-
best = candidate;
|
|
98
|
-
if (candidate.size <= maxSizeBytes) return candidate;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return best;
|
|
102
|
-
}
|
|
103
|
-
function ImageCropModal({
|
|
104
|
-
open,
|
|
105
|
-
file,
|
|
106
|
-
position,
|
|
107
|
-
onCancel,
|
|
108
|
-
onConfirm,
|
|
109
|
-
presets = DEFAULT_PRESETS,
|
|
110
|
-
minAspect = DEFAULT_MIN_ASPECT,
|
|
111
|
-
maxAspect = DEFAULT_MAX_ASPECT,
|
|
112
|
-
title = "Ajustar foto",
|
|
113
|
-
confirmLabel = "Aplicar e enviar",
|
|
114
|
-
maxSizeBytes
|
|
115
|
-
}) {
|
|
116
|
-
const [src, setSrc] = useState(null);
|
|
117
|
-
const [preset, setPreset] = useState(presets[0]);
|
|
118
|
-
const [crop, setCrop] = useState();
|
|
119
|
-
const [completedCrop, setCompletedCrop] = useState(null);
|
|
120
|
-
const [aspectError, setAspectError] = useState(null);
|
|
121
|
-
const [busy, setBusy] = useState(false);
|
|
122
|
-
const [imgLoaded, setImgLoaded] = useState(false);
|
|
123
|
-
const imgRef = useRef(null);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
if (!file) {
|
|
126
|
-
setSrc(null);
|
|
127
|
-
setImgLoaded(false);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const url = URL.createObjectURL(file);
|
|
131
|
-
setSrc(url);
|
|
132
|
-
setPreset(presets[0]);
|
|
133
|
-
setCrop(void 0);
|
|
134
|
-
setCompletedCrop(null);
|
|
135
|
-
setAspectError(null);
|
|
136
|
-
setImgLoaded(false);
|
|
137
|
-
return () => URL.revokeObjectURL(url);
|
|
138
|
-
}, [file, presets]);
|
|
139
|
-
function handleImageLoad(e) {
|
|
140
|
-
var _a, _b, _c, _d;
|
|
141
|
-
const { width, height } = e.currentTarget;
|
|
142
|
-
const initial = buildInitialCrop(width, height, preset.aspect);
|
|
143
|
-
setCrop(initial);
|
|
144
|
-
const pixelInitial = {
|
|
145
|
-
unit: "px",
|
|
146
|
-
x: ((_a = initial.x) != null ? _a : 0) / 100 * width,
|
|
147
|
-
y: ((_b = initial.y) != null ? _b : 0) / 100 * height,
|
|
148
|
-
width: ((_c = initial.width) != null ? _c : 0) / 100 * width,
|
|
149
|
-
height: ((_d = initial.height) != null ? _d : 0) / 100 * height
|
|
150
|
-
};
|
|
151
|
-
setCompletedCrop(pixelInitial);
|
|
152
|
-
setImgLoaded(true);
|
|
153
|
-
}
|
|
154
|
-
function applyPreset(p) {
|
|
155
|
-
setPreset(p);
|
|
156
|
-
setAspectError(null);
|
|
157
|
-
if (imgRef.current) {
|
|
158
|
-
const { width, height } = imgRef.current;
|
|
159
|
-
setCrop(buildInitialCrop(width, height, p.aspect));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function validateFreeAspect(c) {
|
|
163
|
-
if (preset.aspect) return true;
|
|
164
|
-
if (!c.width || !c.height) return false;
|
|
165
|
-
const ratio = c.width / c.height;
|
|
166
|
-
if (ratio < minAspect) {
|
|
167
|
-
setAspectError(`Recorte muito alto. M\xEDnimo permitido: ${minAspect.toFixed(1)}.`);
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
if (ratio > maxAspect) {
|
|
171
|
-
setAspectError(`Recorte muito largo. M\xE1ximo permitido: ${maxAspect.toFixed(1)}.`);
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
setAspectError(null);
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
async function handleConfirm() {
|
|
178
|
-
if (busy) return;
|
|
179
|
-
if (!completedCrop || !imgRef.current || !file) return;
|
|
180
|
-
if (!validateFreeAspect(completedCrop)) return;
|
|
181
|
-
setBusy(true);
|
|
182
|
-
try {
|
|
183
|
-
const blob = await cropToBlob(imgRef.current, completedCrop, file.type || "image/jpeg", maxSizeBytes);
|
|
184
|
-
await onConfirm(blob);
|
|
185
|
-
} catch (err) {
|
|
186
|
-
console.error("cropToBlob error", err);
|
|
187
|
-
} finally {
|
|
188
|
-
setBusy(false);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return /* @__PURE__ */ jsx(
|
|
192
|
-
Dialog,
|
|
193
|
-
{
|
|
194
|
-
open,
|
|
195
|
-
onOpenChange: (next) => {
|
|
196
|
-
if (!next) onCancel();
|
|
197
|
-
},
|
|
198
|
-
size: "lg",
|
|
199
|
-
title: position ? `${title} \xB7 ${position}` : title,
|
|
200
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
|
-
/* @__PURE__ */ jsx(Button, { tone: "neutral", variant: "ghost", onClick: onCancel, children: "Cancelar" }),
|
|
202
|
-
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, disabled: busy || !completedCrop || !!aspectError, loading: busy, children: busy ? "Aplicando\u2026" : confirmLabel })
|
|
203
|
-
] }),
|
|
204
|
-
children: /* @__PURE__ */ jsxs("div", { className: "rds-image-crop", children: [
|
|
205
|
-
presets.length > 1 && /* @__PURE__ */ jsx(
|
|
206
|
-
ToggleGroup,
|
|
207
|
-
{
|
|
208
|
-
type: "single",
|
|
209
|
-
"aria-label": "Propor\xE7\xE3o",
|
|
210
|
-
value: preset.id,
|
|
211
|
-
onValueChange: (id) => {
|
|
212
|
-
const next = presets.find((p) => p.id === id);
|
|
213
|
-
if (next) applyPreset(next);
|
|
214
|
-
},
|
|
215
|
-
className: "rds-image-crop__presets",
|
|
216
|
-
children: presets.map((p) => /* @__PURE__ */ jsx(ToggleGroupItem, { value: p.id, icon: p.icon, children: p.label }, p.id))
|
|
217
|
-
}
|
|
218
|
-
),
|
|
219
|
-
/* @__PURE__ */ jsxs("div", { className: "rds-image-crop__stage", children: [
|
|
220
|
-
src && /* @__PURE__ */ jsx(
|
|
221
|
-
ReactCrop,
|
|
222
|
-
{
|
|
223
|
-
crop,
|
|
224
|
-
onChange: (_, percentCrop) => setCrop(percentCrop),
|
|
225
|
-
onComplete: (c) => {
|
|
226
|
-
setCompletedCrop(c);
|
|
227
|
-
validateFreeAspect(c);
|
|
228
|
-
},
|
|
229
|
-
aspect: preset.aspect,
|
|
230
|
-
keepSelection: true,
|
|
231
|
-
minWidth: 50,
|
|
232
|
-
minHeight: 50,
|
|
233
|
-
className: "rds-image-crop__crop",
|
|
234
|
-
children: /* @__PURE__ */ jsx("img", { ref: imgRef, src, alt: "", onLoad: handleImageLoad, className: "rds-image-crop__image" })
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
!imgLoaded && /* @__PURE__ */ jsx("div", { className: "rds-image-crop__layer", children: /* @__PURE__ */ jsx(Spinner, { size: "lg", label: "Carregando imagem\u2026" }) }),
|
|
238
|
-
busy && /* @__PURE__ */ jsx("div", { className: "rds-image-crop__layer rds-image-crop__layer--busy", children: /* @__PURE__ */ jsx(Spinner, { size: "lg", tone: "inverse", label: "Enviando\u2026" }) })
|
|
239
|
-
] }),
|
|
240
|
-
aspectError && /* @__PURE__ */ jsx(Alert, { tone: "danger", title: aspectError, announce: "alert" }),
|
|
241
|
-
!aspectError && preset.id === "free" && /* @__PURE__ */ jsxs("p", { className: "rds-image-crop__hint", children: [
|
|
242
|
-
"Livre: propor\xE7\xE3o entre ",
|
|
243
|
-
minAspect.toFixed(1),
|
|
244
|
-
" (vertical) e ",
|
|
245
|
-
maxAspect.toFixed(1),
|
|
246
|
-
" (horizontal)."
|
|
247
|
-
] })
|
|
248
|
-
] })
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
}
|
|
3
|
+
import { ImageCropDialog } from "./image-crop-dialog.js";
|
|
4
|
+
const ImageCropModal = ImageCropDialog;
|
|
252
5
|
export {
|
|
253
6
|
ImageCropModal
|
|
254
7
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CropPreset } from './image-crop-
|
|
2
|
+
import { CropPreset } from './image-crop-dialog.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @deprecated Use `<FileInput
|
|
6
|
-
* and the swap and remove buttons. ImageUpload is now a thin wrapper over it that keeps the 1.x API compiling and
|
|
7
|
-
* keeps the upload (`onUpload`) and the crop (`crop`).
|
|
5
|
+
* @deprecated Use `<FileInput layout="tile">` (Figma [RDS] Forms/FileInput): the image's square with the preview
|
|
6
|
+
* and the swap and remove buttons. ImageUpload is now a thin wrapper over it that keeps most of the 1.x API compiling and
|
|
7
|
+
* keeps the upload (`onUpload`) and the crop (`crop`). It is always the tile (`variant`, `aspect` and the preview
|
|
8
|
+
* class names left in 2.0): an image asks for a preview.
|
|
8
9
|
*/
|
|
9
|
-
type ImageUploadAspect = 'logo' | 'banner' | 'square';
|
|
10
|
-
type ImageUploadVariant = 'button' | 'dropzone' | 'tile';
|
|
11
10
|
interface ImageUploadLabels {
|
|
12
11
|
/** The empty tile's text (FileInput's `tileText`). */
|
|
13
12
|
select: string;
|
|
@@ -26,7 +25,7 @@ interface ImageUploadLabels {
|
|
|
26
25
|
/** The error message when the upload fails without one. */
|
|
27
26
|
error: string;
|
|
28
27
|
}
|
|
29
|
-
/** When given, the chosen image goes through the
|
|
28
|
+
/** When given, the chosen image goes through the ImageCropDialog before the upload. */
|
|
30
29
|
interface ImageUploadCrop {
|
|
31
30
|
presets?: CropPreset[];
|
|
32
31
|
minAspect?: number;
|
|
@@ -36,10 +35,6 @@ interface ImageUploadCrop {
|
|
|
36
35
|
confirmLabel?: string;
|
|
37
36
|
}
|
|
38
37
|
interface ImageUploadProps {
|
|
39
|
-
/** @deprecated Ignored: the tile's preview fills the square. */
|
|
40
|
-
previewClassName?: string;
|
|
41
|
-
/** @deprecated Ignored. */
|
|
42
|
-
previewWrapperClassName?: string;
|
|
43
38
|
/** The form field name: a hidden input carries the image's URL. */
|
|
44
39
|
name: string;
|
|
45
40
|
/** The image's URL, '' for none. */
|
|
@@ -49,16 +44,12 @@ interface ImageUploadProps {
|
|
|
49
44
|
onUpload: (file: File) => Promise<string>;
|
|
50
45
|
label?: string;
|
|
51
46
|
hint?: string;
|
|
52
|
-
/** @deprecated Ignored: the tile is a 112 square. */
|
|
53
|
-
aspect?: ImageUploadAspect;
|
|
54
47
|
accept?: string;
|
|
55
48
|
className?: string;
|
|
56
|
-
/** @deprecated Ignored: every variant is the tile. */
|
|
57
|
-
variant?: ImageUploadVariant;
|
|
58
49
|
crop?: ImageUploadCrop;
|
|
59
50
|
labels?: Partial<ImageUploadLabels>;
|
|
60
51
|
}
|
|
61
|
-
/** @deprecated Use `<FileInput
|
|
52
|
+
/** @deprecated Use `<FileInput layout="tile">`, with the upload in its `onFiles` and the URL in `preview`. */
|
|
62
53
|
declare function ImageUpload({ name, value, onChange, onUpload, label, hint, accept, className, crop, labels, }: ImageUploadProps): react.JSX.Element;
|
|
63
54
|
|
|
64
|
-
export { ImageUpload, type
|
|
55
|
+
export { ImageUpload, type ImageUploadCrop, type ImageUploadLabels, type ImageUploadProps };
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useRef, useState } from "react";
|
|
7
7
|
import { FileInput } from "./file-input.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ImageCropDialog } from "./image-crop-dialog.js";
|
|
9
9
|
const DEFAULT_LABELS = {
|
|
10
10
|
select: "Selecionar imagem",
|
|
11
11
|
change: "Trocar imagem",
|
|
@@ -63,7 +63,7 @@ function ImageUpload({
|
|
|
63
63
|
FileInput,
|
|
64
64
|
{
|
|
65
65
|
ref: input,
|
|
66
|
-
|
|
66
|
+
layout: "tile",
|
|
67
67
|
label,
|
|
68
68
|
"aria-label": label ? void 0 : L.aria,
|
|
69
69
|
hint,
|
|
@@ -81,7 +81,7 @@ function ImageUpload({
|
|
|
81
81
|
),
|
|
82
82
|
/* @__PURE__ */ jsx("input", { type: "hidden", name, value }),
|
|
83
83
|
crop && /* @__PURE__ */ jsx(
|
|
84
|
-
|
|
84
|
+
ImageCropDialog,
|
|
85
85
|
{
|
|
86
86
|
open: !!pendingFile,
|
|
87
87
|
file: pendingFile,
|
|
@@ -4,18 +4,19 @@ export { HoverCard, HoverCardProps } from './hover-card.js';
|
|
|
4
4
|
export { Dialog, DialogClose, DialogProps, DialogSize } from './dialog.js';
|
|
5
5
|
export { Sheet, SheetClose, SheetProps, SheetSide } from './sheet.js';
|
|
6
6
|
export { Drawer, DrawerClose, DrawerProps } from './drawer.js';
|
|
7
|
+
export { LoadingOverlay, LoadingOverlayProps } from './loading-overlay.js';
|
|
7
8
|
export { DropdownMenu, DropdownMenuAlign, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuItemTone, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSide } from './dropdown-menu.js';
|
|
8
9
|
export { ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuItemTone, ContextMenuProps, ContextMenuSeparator } from './context-menu.js';
|
|
9
10
|
export { Command, CommandGroup, CommandGroupProps, CommandItem, CommandItemProps, CommandProps } from './command.js';
|
|
10
11
|
export { FilterChip, FilterChipGroup, FilterChipGroupProps, FilterChipProps } from './filter-chip.js';
|
|
11
|
-
export { DataTableFilterDef, DataTableFilterOption, DataTableHeader, DataTableHeaderProps, DataTableHeaderSearch,
|
|
12
|
+
export { DataTableFilterDef, DataTableFilterOption, DataTableHeader, DataTableHeaderProps, DataTableHeaderSearch, FilterDropdown } from './data-table-header.js';
|
|
12
13
|
export { Button, ButtonIconPosition, ButtonProps } from './button.js';
|
|
13
14
|
export { Badge, BadgeProps, BadgeTone, BadgeVariant, formatBadgeValue } from './badge.js';
|
|
14
15
|
export { Status, StatusProps, StatusSize, StatusTone, StatusVariant } from './status.js';
|
|
15
16
|
export { Delta, DeltaDirection, DeltaProps, DeltaTone } from './delta.js';
|
|
16
17
|
export { Progress, ProgressKind, ProgressProps, ProgressSize } from './progress.js';
|
|
17
18
|
export { StarRating, StarRatingProps, StarRatingSize } from './star-rating.js';
|
|
18
|
-
export { Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardSize, CardSurface } from './card.js';
|
|
19
|
+
export { Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardSize, CardSurface, CardVariant } from './card.js';
|
|
19
20
|
export { Tile, TileProps, TileSize, TileTone, TileVariant } from './tile.js';
|
|
20
21
|
export { Kbd, KbdGroup, KbdGroupProps, KbdProps } from './kbd.js';
|
|
21
22
|
export { Sparkline, SparklineProps } from './sparkline.js';
|
|
@@ -38,15 +39,17 @@ export { Empty, EmptyProps } from './empty.js';
|
|
|
38
39
|
export { InsightCard, InsightCardProps, InsightCardType } from './insight-card.js';
|
|
39
40
|
export { SectionCard, SectionCardProps } from './section-card.js';
|
|
40
41
|
export { SectionHeader, SectionHeaderProps } from './section-header.js';
|
|
42
|
+
export { Stepper, StepperProps, StepperStep } from './stepper.js';
|
|
41
43
|
export { FloatingStepper, FloatingStepperProps, FloatingStepperStep } from './floating-stepper.js';
|
|
42
44
|
export { Stat, StatProps, StatTone } from './stat.js';
|
|
43
45
|
export { SummaryBar, SummaryBarItem, SummaryBarLayout, SummaryBarProps, SummaryBarTone } from './summary-bar.js';
|
|
44
|
-
export { ToggleCard, ToggleCardProps } from './toggle-card.js';
|
|
46
|
+
export { ToggleCard, ToggleCardLayout, ToggleCardProps } from './toggle-card.js';
|
|
45
47
|
export { ToggleCardCompact, ToggleCardCompactProps } from './toggle-card-compact.js';
|
|
46
48
|
export { ChipInput, ChipInputProps } from './chip-input.js';
|
|
47
49
|
export { CopyField, CopyFieldProps } from './copy-field.js';
|
|
48
50
|
export { QRDisplay, QRDisplayProps } from './qr-display.js';
|
|
49
51
|
export { ChoiceCard } from './choice-card.js';
|
|
52
|
+
export { ChoiceList, ChoiceListItem, ChoiceListItemProps, ChoiceListProps } from './choice-list.js';
|
|
50
53
|
export { OptionTile, OptionTileGrid, OptionTileGridProps, OptionTileItem, OptionTileProps } from './option-tile.js';
|
|
51
54
|
export { SelectableCard, SelectableCardProps } from './selectable-card.js';
|
|
52
55
|
export { ChoicePreviewCard, ChoicePreviewCardProps } from './choice-preview-card.js';
|
|
@@ -55,8 +58,8 @@ export { SettingsList, SettingsListProps } from './settings-list.js';
|
|
|
55
58
|
export { Dropzone, DropzoneProps } from './dropzone.js';
|
|
56
59
|
export { MediaTile, MediaTileAspect, MediaTileProps } from './media-tile.js';
|
|
57
60
|
export { Attachment, AttachmentOrientation, AttachmentProps, AttachmentStatus } from './attachment.js';
|
|
58
|
-
export { Bubble, BubbleAlign, BubbleProps, BubbleVariant } from './bubble.js';
|
|
59
|
-
export { Marker, MarkerProps, MarkerVariant } from './marker.js';
|
|
61
|
+
export { Bubble, BubbleAlign, BubbleProps, BubbleTone, BubbleVariant } from './bubble.js';
|
|
62
|
+
export { Marker, MarkerKind, MarkerProps, MarkerVariant } from './marker.js';
|
|
60
63
|
export { Message, MessageAlign, MessageProps } from './message.js';
|
|
61
64
|
export { MessageScroller, MessageScrollerProps } from './message-scroller.js';
|
|
62
65
|
export { Questionnaire, QuestionnaireAnswer, QuestionnaireProps } from './questionnaire.js';
|
|
@@ -64,9 +67,9 @@ export { TypingIndicator, TypingIndicatorProps } from './typing-indicator.js';
|
|
|
64
67
|
export { ChoiceCarousel, ChoiceCarouselProps } from './choice-carousel.js';
|
|
65
68
|
export { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps } from './tabs.js';
|
|
66
69
|
export { PageHeader, PageHeaderHeading, PageHeaderProps } from './page-header.js';
|
|
67
|
-
export { Sidebar, SidebarHeader, SidebarItem, SidebarItemProps, SidebarProps, SidebarSection, SidebarSectionProps, SidebarSeparator
|
|
70
|
+
export { Sidebar, SidebarHeader, SidebarItem, SidebarItemProps, SidebarProps, SidebarSection, SidebarSectionProps, SidebarSeparator } from './sidebar.js';
|
|
68
71
|
export { NavigationMenu, NavigationMenuEntry, NavigationMenuLink, NavigationMenuLinkComponent, NavigationMenuProps } from './navigation-menu.js';
|
|
69
|
-
export { SavingBar, SavingBarProps, SavingBarStatus } from './saving-bar.js';
|
|
72
|
+
export { SavingBar, SavingBarPlacement, SavingBarProps, SavingBarStatus } from './saving-bar.js';
|
|
70
73
|
export { SavingBarProvider, SavingBarRegistration, SavingBarRoot, usePageSavingBar } from './saving-bar-context.js';
|
|
71
74
|
export { FAB, FABConfig, FABProps, FABProvider, FABRoot, useFAB, usePageFAB } from './fab.js';
|
|
72
75
|
export { Table, TableAlign, TableBody, TableCell, TableCellProps, TableHead, TableHeadProps, TableHeader, TableProps, TableRow, TableSort, TableStatus, TableStatusProps } from './table.js';
|
|
@@ -76,11 +79,12 @@ export { Switch, SwitchProps } from './switch.js';
|
|
|
76
79
|
export { Tooltip, TooltipProps, TooltipSide } from './tooltip.js';
|
|
77
80
|
export { ToastFn, ToastOptions, ToastTone, ToastVariant, ToastView, ToastViewProps, Toaster, ToasterProps, toast, toastClassName, useToast } from './toast.js';
|
|
78
81
|
export { Separator, SeparatorOrientation, SeparatorProps } from './separator.js';
|
|
79
|
-
export {
|
|
82
|
+
export { Heading, HeadingElement, HeadingLevel, HeadingMark, HeadingMarkProps, HeadingProps, HeadingTone } from './heading.js';
|
|
83
|
+
export { Avatar, AvatarContent, AvatarGroup, AvatarGroupProps, AvatarGroupSize, AvatarProps, AvatarSize, AvatarType, AvatarVariant, initials } from './avatar.js';
|
|
80
84
|
export { IconButton, IconButtonProps } from './icon-button.js';
|
|
81
85
|
export { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps } from './button-group.js';
|
|
82
86
|
export { ActionBar, ActionBarProps } from './action-bar.js';
|
|
83
|
-
export { FormActions,
|
|
87
|
+
export { FormActions, FormActionsPlacement, FormActionsProps } from './form-actions.js';
|
|
84
88
|
export { Breadcrumb, BreadcrumbItem, BreadcrumbLinkComponent, BreadcrumbProps, BreadcrumbTone } from './breadcrumb.js';
|
|
85
89
|
export { Pagination, PaginationLinkComponent, PaginationProps, pageItems } from './pagination.js';
|
|
86
90
|
export { Popover, PopoverAlign, PopoverClose, PopoverProps, PopoverSide } from './popover.js';
|
|
@@ -89,7 +93,7 @@ export { Accordion, AccordionItem, AccordionItemProps, AccordionProps } from './
|
|
|
89
93
|
export { Slider, SliderProps } from './slider.js';
|
|
90
94
|
export { Listbox, ListboxOption, ListboxOptionProps, ListboxProps } from './listbox.js';
|
|
91
95
|
export { Calendar, CalendarProps } from './calendar.js';
|
|
92
|
-
export { FileInput, FileInputProps, FileInputVariant, formatFileSize } from './file-input.js';
|
|
96
|
+
export { FileInput, FileInputLayout, FileInputProps, FileInputVariant, formatFileSize } from './file-input.js';
|
|
93
97
|
export { NumberInput, NumberInputProps, NumberInputStep } from './number-input.js';
|
|
94
98
|
export { InputOTP, InputOTPLength, InputOTPProps } from './input-otp.js';
|
|
95
99
|
export { Combobox, ComboboxMultipleProps, ComboboxOption, ComboboxProps, ComboboxSingleProps } from './combobox.js';
|
|
@@ -132,6 +136,7 @@ import '@radix-ui/react-dialog';
|
|
|
132
136
|
import './internal/modal.js';
|
|
133
137
|
import './internal/menu.js';
|
|
134
138
|
import './internal/fieldset.js';
|
|
139
|
+
import './internal/bottom-bar.js';
|
|
135
140
|
import '@radix-ui/react-toggle';
|
|
136
141
|
import '@radix-ui/react-tooltip';
|
|
137
142
|
import '@radix-ui/react-popover';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { HoverCard } from "./hover-card.js";
|
|
|
5
5
|
import { Dialog, DialogClose } from "./dialog.js";
|
|
6
6
|
import { Sheet, SheetClose } from "./sheet.js";
|
|
7
7
|
import { Drawer, DrawerClose } from "./drawer.js";
|
|
8
|
+
import { LoadingOverlay } from "./loading-overlay.js";
|
|
8
9
|
import {
|
|
9
10
|
DropdownMenu,
|
|
10
11
|
DropdownMenuItem,
|
|
@@ -45,6 +46,7 @@ import { Empty } from "./empty.js";
|
|
|
45
46
|
import { InsightCard } from "./insight-card.js";
|
|
46
47
|
import { SectionCard } from "./section-card.js";
|
|
47
48
|
import { SectionHeader } from "./section-header.js";
|
|
49
|
+
import { Stepper } from "./stepper.js";
|
|
48
50
|
import { FloatingStepper } from "./floating-stepper.js";
|
|
49
51
|
import { Stat } from "./stat.js";
|
|
50
52
|
import { SummaryBar } from "./summary-bar.js";
|
|
@@ -54,6 +56,7 @@ import { ChipInput } from "./chip-input.js";
|
|
|
54
56
|
import { CopyField } from "./copy-field.js";
|
|
55
57
|
import { QRDisplay } from "./qr-display.js";
|
|
56
58
|
import { ChoiceCard, ChoiceCardGroup } from "./choice-card.js";
|
|
59
|
+
import { ChoiceList, ChoiceListItem } from "./choice-list.js";
|
|
57
60
|
import { OptionTile, OptionTileGrid } from "./option-tile.js";
|
|
58
61
|
import { SelectableCard } from "./selectable-card.js";
|
|
59
62
|
import { ChoicePreviewCard } from "./choice-preview-card.js";
|
|
@@ -83,6 +86,7 @@ import { Switch } from "./switch.js";
|
|
|
83
86
|
import { Tooltip } from "./tooltip.js";
|
|
84
87
|
import { Toaster, ToastView, toast, useToast, toastClassName } from "./toast.js";
|
|
85
88
|
import { Separator } from "./separator.js";
|
|
89
|
+
import { Heading, HeadingMark } from "./heading.js";
|
|
86
90
|
import { Avatar, AvatarGroup, initials } from "./avatar.js";
|
|
87
91
|
import { IconButton } from "./icon-button.js";
|
|
88
92
|
import { ButtonGroup } from "./button-group.js";
|
|
@@ -161,6 +165,8 @@ export {
|
|
|
161
165
|
ChoiceCard,
|
|
162
166
|
ChoiceCardGroup,
|
|
163
167
|
ChoiceCarousel,
|
|
168
|
+
ChoiceList,
|
|
169
|
+
ChoiceListItem,
|
|
164
170
|
ChoicePreviewCard,
|
|
165
171
|
ColorInput,
|
|
166
172
|
Combobox,
|
|
@@ -205,6 +211,8 @@ export {
|
|
|
205
211
|
GoogleButton,
|
|
206
212
|
GoogleConsent,
|
|
207
213
|
GoogleSignIn,
|
|
214
|
+
Heading,
|
|
215
|
+
HeadingMark,
|
|
208
216
|
HoverCard,
|
|
209
217
|
IconButton,
|
|
210
218
|
Input,
|
|
@@ -216,6 +224,7 @@ export {
|
|
|
216
224
|
KbdGroup,
|
|
217
225
|
Listbox,
|
|
218
226
|
ListboxOption,
|
|
227
|
+
LoadingOverlay,
|
|
219
228
|
Marker,
|
|
220
229
|
MediaTile,
|
|
221
230
|
Message,
|
|
@@ -267,6 +276,7 @@ export {
|
|
|
267
276
|
Stat,
|
|
268
277
|
Status,
|
|
269
278
|
StepProgress,
|
|
279
|
+
Stepper,
|
|
270
280
|
SummaryBar,
|
|
271
281
|
Switch,
|
|
272
282
|
Table,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type BottomBarPlacement = 'docked' | 'floating';
|
|
5
|
+
interface BottomBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* docked (the container's width, against the foot, square corners) or floating (from lg 1024 up: off the foot by
|
|
8
|
+
* bottom-bar/floating/margin, at most bottom-bar/floating/max-width, centred, bottom-bar/floating/radius and the
|
|
9
|
+
* elevation/overlay shadow). Below 1024 floating is exactly docked (Figma: `placement`).
|
|
10
|
+
*/
|
|
11
|
+
placement?: BottomBarPlacement;
|
|
12
|
+
/**
|
|
13
|
+
* The leading slot, on the left: one ~44 control, never running text. Present (even `null` or `false` while its
|
|
14
|
+
* control is hidden), the slot is there and reserves bottom-bar/leading/min-width, so what follows does not jump
|
|
15
|
+
* when the control comes and goes; left out (`undefined`), there is no slot. Whoever fills it says its own changes.
|
|
16
|
+
*/
|
|
17
|
+
leading?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* BottomBar — Figma [RDS] Actions/.bottom-bar, private: the shell at the foot of the screen under the FormActions and
|
|
22
|
+
* the SavingBar. Not exported from the package. It owns the colour (bottom-bar/background, the brand's primary), the
|
|
23
|
+
* height (64 plus env(safe-area-inset-bottom) compact, 68 expanded), the padding and gap, the place (sticky at the
|
|
24
|
+
* bottom of the scrolling container), the placement, the leading slot, the Button tokens in the bar's colours and the
|
|
25
|
+
* on-screen keyboard (compact: it slides away while a field is being typed in). Whoever builds on it puts the
|
|
26
|
+
* actions. Styles: bottom-bar.css.
|
|
27
|
+
*/
|
|
28
|
+
declare function BottomBar({ placement, leading, className, children, ...rest }: BottomBarProps): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { BottomBar, type BottomBarPlacement, type BottomBarProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useOnScreenKeyboard } from "./use-on-screen-keyboard.js";
|
|
9
|
+
function BottomBar(_a) {
|
|
10
|
+
var _b = _a, { placement = "docked", leading, className, children } = _b, rest = __objRest(_b, ["placement", "leading", "className", "children"]);
|
|
11
|
+
const keyboard = useOnScreenKeyboard();
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
15
|
+
className: ["rds-bottom-bar", `rds-bottom-bar--${placement}`, keyboard && "rds-bottom-bar--keyboard", className].filter(Boolean).join(" "),
|
|
16
|
+
children: [
|
|
17
|
+
leading !== void 0 && /* @__PURE__ */ jsx("div", { className: "rds-bottom-bar__leading", children: leading }),
|
|
18
|
+
children
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
BottomBar
|
|
25
|
+
};
|
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { MouseEventHandler, MouseEvent } from 'react';
|
|
3
3
|
|
|
4
4
|
type ButtonTone = 'action' | 'neutral' | 'danger' | 'inverse';
|
|
5
|
-
/**
|
|
5
|
+
/** The emphasis (Figma: `variant`): fill, outline or ghost. */
|
|
6
6
|
type ButtonVariant = 'fill' | 'outline' | 'ghost';
|
|
7
7
|
/**
|
|
8
8
|
* The height: sm 36, md 44 (the default), lg 52. The touch target is 44 in every size: on sm, an invisible layer
|
|
@@ -104,5 +104,13 @@ declare function CopyIcon(): react.JSX.Element;
|
|
|
104
104
|
declare function PencilIcon(): react.JSX.Element;
|
|
105
105
|
/** Three sliders: the filters of a list. */
|
|
106
106
|
declare function SlidersIcon(): react.JSX.Element;
|
|
107
|
+
/** A square: the 1:1 crop. */
|
|
108
|
+
declare function SquareIcon(): react.JSX.Element;
|
|
109
|
+
/** A standing rectangle: a portrait crop (4:5). */
|
|
110
|
+
declare function RectangleVerticalIcon(): react.JSX.Element;
|
|
111
|
+
/** A lying rectangle: a landscape crop (16:9). */
|
|
112
|
+
declare function RectangleHorizontalIcon(): react.JSX.Element;
|
|
113
|
+
/** A dashed square: a free crop, no fixed aspect. */
|
|
114
|
+
declare function SquareDashedIcon(): react.JSX.Element;
|
|
107
115
|
|
|
108
|
-
export { AlertIcon, ArrowDownIcon, ArrowLeftIcon, ArrowUpDownIcon, ArrowUpIcon, BadgeCheckIcon, BuildingIcon, CalendarIcon, CameraIcon, CheckCheckIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleCheckIcon, ClockIcon, CloseIcon, CopyIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileTextIcon, ImageIcon, ImageOffIcon, ImagePlusIcon, InfoIcon, LockIcon, MapPinIcon, MegaphoneIcon, MenuIcon, MicIcon, MinusIcon, MoreVerticalIcon, PaperclipIcon, PencilIcon, PhoneIcon, PlusIcon, QuoteIcon, ReplyIcon, RotateCcwIcon, SearchIcon, SearchXIcon, SlidersIcon, SmileIcon, SparklesIcon, StarFilledIcon, StarIcon, TableIcon, ThumbsUpIcon, TriangleAlertIcon, UploadIcon, UserIcon };
|
|
116
|
+
export { AlertIcon, ArrowDownIcon, ArrowLeftIcon, ArrowUpDownIcon, ArrowUpIcon, BadgeCheckIcon, BuildingIcon, CalendarIcon, CameraIcon, CheckCheckIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleCheckIcon, ClockIcon, CloseIcon, CopyIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileTextIcon, ImageIcon, ImageOffIcon, ImagePlusIcon, InfoIcon, LockIcon, MapPinIcon, MegaphoneIcon, MenuIcon, MicIcon, MinusIcon, MoreVerticalIcon, PaperclipIcon, PencilIcon, PhoneIcon, PlusIcon, QuoteIcon, RectangleHorizontalIcon, RectangleVerticalIcon, ReplyIcon, RotateCcwIcon, SearchIcon, SearchXIcon, SlidersIcon, SmileIcon, SparklesIcon, SquareDashedIcon, SquareIcon, StarFilledIcon, StarIcon, TableIcon, ThumbsUpIcon, TriangleAlertIcon, UploadIcon, UserIcon };
|