@rojaostudio/ds 2.0.0-next.2 → 2.0.0-next.21

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 (101) hide show
  1. package/README.md +42 -2
  2. package/THIRD_PARTY_NOTICES.md +66 -0
  3. package/dist/components/avatar.d.ts +20 -12
  4. package/dist/components/avatar.js +8 -6
  5. package/dist/components/badge.d.ts +7 -6
  6. package/dist/components/badge.js +2 -1
  7. package/dist/components/breadcrumb.d.ts +4 -4
  8. package/dist/components/breadcrumb.js +1 -1
  9. package/dist/components/bubble.d.ts +26 -11
  10. package/dist/components/bubble.js +3 -3
  11. package/dist/components/button.d.ts +1 -1
  12. package/dist/components/card.d.ts +28 -12
  13. package/dist/components/card.js +4 -2
  14. package/dist/components/chart.d.ts +17 -3
  15. package/dist/components/chart.js +70 -24
  16. package/dist/components/choice-carousel.d.ts +1 -1
  17. package/dist/components/choice-carousel.js +2 -4
  18. package/dist/components/choice-list.d.ts +40 -0
  19. package/dist/components/choice-list.js +122 -0
  20. package/dist/components/choice-preview-card.d.ts +1 -7
  21. package/dist/components/color-input.d.ts +1 -1
  22. package/dist/components/context-menu.d.ts +5 -2
  23. package/dist/components/currency-input.d.ts +0 -2
  24. package/dist/components/data-table-header.d.ts +34 -16
  25. package/dist/components/data-table-header.js +132 -67
  26. package/dist/components/date-picker.d.ts +1 -1
  27. package/dist/components/dialog.d.ts +6 -3
  28. package/dist/components/dialog.js +2 -2
  29. package/dist/components/dropdown-menu.d.ts +5 -2
  30. package/dist/components/dropzone.d.ts +2 -2
  31. package/dist/components/dropzone.js +1 -1
  32. package/dist/components/file-input.d.ts +13 -8
  33. package/dist/components/file-input.js +24 -21
  34. package/dist/components/filter-chip.d.ts +11 -5
  35. package/dist/components/filter-chip.js +15 -6
  36. package/dist/components/floating-stepper.d.ts +11 -28
  37. package/dist/components/floating-stepper.js +2 -30
  38. package/dist/components/heading.d.ts +42 -0
  39. package/dist/components/heading.js +25 -0
  40. package/dist/components/icon-button.d.ts +1 -1
  41. package/dist/components/image-crop-dialog.d.ts +60 -0
  42. package/dist/components/image-crop-dialog.js +240 -0
  43. package/dist/components/image-crop-modal.d.ts +12 -55
  44. package/dist/components/image-crop-modal.js +2 -249
  45. package/dist/components/image-upload.d.ts +8 -17
  46. package/dist/components/image-upload.js +3 -3
  47. package/dist/components/index.d.ts +11 -8
  48. package/dist/components/index.js +8 -0
  49. package/dist/components/internal/button.d.ts +1 -1
  50. package/dist/components/internal/icons.d.ts +11 -1
  51. package/dist/components/internal/icons.js +20 -0
  52. package/dist/components/internal/menu.d.ts +3 -2
  53. package/dist/components/internal/menu.js +1 -1
  54. package/dist/components/internal/modal.js +9 -0
  55. package/dist/components/internal/toggle.d.ts +1 -1
  56. package/dist/components/item.d.ts +14 -7
  57. package/dist/components/item.js +5 -2
  58. package/dist/components/marker.d.ts +11 -3
  59. package/dist/components/marker.js +4 -3
  60. package/dist/components/number-input.d.ts +1 -1
  61. package/dist/components/progress.d.ts +3 -3
  62. package/dist/components/progress.js +2 -2
  63. package/dist/components/row-actions.d.ts +3 -0
  64. package/dist/components/row-actions.js +8 -4
  65. package/dist/components/saving-bar.d.ts +16 -4
  66. package/dist/components/saving-bar.js +37 -9
  67. package/dist/components/section-header.d.ts +4 -3
  68. package/dist/components/selectable-card.d.ts +2 -10
  69. package/dist/components/sidebar.d.ts +8 -11
  70. package/dist/components/sidebar.js +4 -5
  71. package/dist/components/spinner.d.ts +9 -6
  72. package/dist/components/spinner.js +3 -3
  73. package/dist/components/star-rating.d.ts +3 -3
  74. package/dist/components/star-rating.js +2 -2
  75. package/dist/components/stat.d.ts +18 -6
  76. package/dist/components/stat.js +9 -3
  77. package/dist/components/status.d.ts +4 -4
  78. package/dist/components/status.js +2 -2
  79. package/dist/components/stepper.d.ts +33 -0
  80. package/dist/components/stepper.js +36 -0
  81. package/dist/components/summary-bar.d.ts +3 -2
  82. package/dist/components/summary-bar.js +10 -1
  83. package/dist/components/tile.d.ts +5 -5
  84. package/dist/components/tile.js +2 -2
  85. package/dist/components/time-picker.d.ts +1 -1
  86. package/dist/components/toast.d.ts +17 -6
  87. package/dist/components/toast.js +5 -3
  88. package/dist/components/toggle-card-compact.d.ts +6 -25
  89. package/dist/components/toggle-card-compact.js +8 -35
  90. package/dist/components/toggle-card.d.ts +23 -9
  91. package/dist/components/toggle-card.js +38 -2
  92. package/dist/components/toggle.d.ts +1 -1
  93. package/dist/components/typing-indicator.d.ts +2 -2
  94. package/dist/components/typing-indicator.js +1 -1
  95. package/package.json +4 -4
  96. package/styles/base.css +13 -1
  97. package/styles/rds/components-styles.css +611 -173
  98. package/styles/rds/components.css +40 -25
  99. package/styles/rds/foundation.css +1 -1
  100. package/styles/rds/theme.css +40 -29
  101. package/styles/rds.css +1 -1
@@ -1,254 +1,7 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { useEffect, useRef, useState } from "react";
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-modal.js';
2
+ import { CropPreset } from './image-crop-dialog.js';
3
3
 
4
4
  /**
5
- * @deprecated Use `<FileInput variant="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 the 1.x API compiling and
7
- * keeps the upload (`onUpload`) and the crop (`crop`). Every variant renders the tile: an image asks for a preview.
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 ImageCropModal before the upload. */
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 variant="tile">`, with the upload in its `onFiles` and the URL in `preview`. */
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 ImageUploadAspect, type ImageUploadCrop, type ImageUploadLabels, type ImageUploadProps, type ImageUploadVariant };
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 { ImageCropModal } from "./image-crop-modal.js";
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
- variant: "tile",
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
- ImageCropModal,
84
+ ImageCropDialog,
85
85
  {
86
86
  open: !!pendingFile,
87
87
  file: pendingFile,
@@ -8,14 +8,14 @@ export { DropdownMenu, DropdownMenuAlign, DropdownMenuItem, DropdownMenuItemProp
8
8
  export { ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuItemTone, ContextMenuProps, ContextMenuSeparator } from './context-menu.js';
9
9
  export { Command, CommandGroup, CommandGroupProps, CommandItem, CommandItemProps, CommandProps } from './command.js';
10
10
  export { FilterChip, FilterChipGroup, FilterChipGroupProps, FilterChipProps } from './filter-chip.js';
11
- export { DataTableFilterDef, DataTableFilterOption, DataTableHeader, DataTableHeaderProps, DataTableHeaderSearch, DataTablePillDef, FilterDropdown } from './data-table-header.js';
11
+ export { DataTableFilterDef, DataTableFilterOption, DataTableHeader, DataTableHeaderProps, DataTableHeaderSearch, FilterDropdown } from './data-table-header.js';
12
12
  export { Button, ButtonIconPosition, ButtonProps } from './button.js';
13
13
  export { Badge, BadgeProps, BadgeTone, BadgeVariant, formatBadgeValue } from './badge.js';
14
14
  export { Status, StatusProps, StatusSize, StatusTone, StatusVariant } from './status.js';
15
15
  export { Delta, DeltaDirection, DeltaProps, DeltaTone } from './delta.js';
16
16
  export { Progress, ProgressKind, ProgressProps, ProgressSize } from './progress.js';
17
17
  export { StarRating, StarRatingProps, StarRatingSize } from './star-rating.js';
18
- export { Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardSize, CardSurface } from './card.js';
18
+ export { Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardSize, CardSurface, CardVariant } from './card.js';
19
19
  export { Tile, TileProps, TileSize, TileTone, TileVariant } from './tile.js';
20
20
  export { Kbd, KbdGroup, KbdGroupProps, KbdProps } from './kbd.js';
21
21
  export { Sparkline, SparklineProps } from './sparkline.js';
@@ -38,15 +38,17 @@ export { Empty, EmptyProps } from './empty.js';
38
38
  export { InsightCard, InsightCardProps, InsightCardType } from './insight-card.js';
39
39
  export { SectionCard, SectionCardProps } from './section-card.js';
40
40
  export { SectionHeader, SectionHeaderProps } from './section-header.js';
41
+ export { Stepper, StepperProps, StepperStep } from './stepper.js';
41
42
  export { FloatingStepper, FloatingStepperProps, FloatingStepperStep } from './floating-stepper.js';
42
43
  export { Stat, StatProps, StatTone } from './stat.js';
43
44
  export { SummaryBar, SummaryBarItem, SummaryBarLayout, SummaryBarProps, SummaryBarTone } from './summary-bar.js';
44
- export { ToggleCard, ToggleCardProps } from './toggle-card.js';
45
+ export { ToggleCard, ToggleCardLayout, ToggleCardProps } from './toggle-card.js';
45
46
  export { ToggleCardCompact, ToggleCardCompactProps } from './toggle-card-compact.js';
46
47
  export { ChipInput, ChipInputProps } from './chip-input.js';
47
48
  export { CopyField, CopyFieldProps } from './copy-field.js';
48
49
  export { QRDisplay, QRDisplayProps } from './qr-display.js';
49
50
  export { ChoiceCard } from './choice-card.js';
51
+ export { ChoiceList, ChoiceListItem, ChoiceListItemProps, ChoiceListProps } from './choice-list.js';
50
52
  export { OptionTile, OptionTileGrid, OptionTileGridProps, OptionTileItem, OptionTileProps } from './option-tile.js';
51
53
  export { SelectableCard, SelectableCardProps } from './selectable-card.js';
52
54
  export { ChoicePreviewCard, ChoicePreviewCardProps } from './choice-preview-card.js';
@@ -55,8 +57,8 @@ export { SettingsList, SettingsListProps } from './settings-list.js';
55
57
  export { Dropzone, DropzoneProps } from './dropzone.js';
56
58
  export { MediaTile, MediaTileAspect, MediaTileProps } from './media-tile.js';
57
59
  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';
60
+ export { Bubble, BubbleAlign, BubbleProps, BubbleTone, BubbleVariant } from './bubble.js';
61
+ export { Marker, MarkerKind, MarkerProps, MarkerVariant } from './marker.js';
60
62
  export { Message, MessageAlign, MessageProps } from './message.js';
61
63
  export { MessageScroller, MessageScrollerProps } from './message-scroller.js';
62
64
  export { Questionnaire, QuestionnaireAnswer, QuestionnaireProps } from './questionnaire.js';
@@ -64,7 +66,7 @@ export { TypingIndicator, TypingIndicatorProps } from './typing-indicator.js';
64
66
  export { ChoiceCarousel, ChoiceCarouselProps } from './choice-carousel.js';
65
67
  export { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps } from './tabs.js';
66
68
  export { PageHeader, PageHeaderHeading, PageHeaderProps } from './page-header.js';
67
- export { Sidebar, SidebarHeader, SidebarItem, SidebarItemProps, SidebarProps, SidebarSection, SidebarSectionProps, SidebarSeparator, SidebarTone } from './sidebar.js';
69
+ export { Sidebar, SidebarHeader, SidebarItem, SidebarItemProps, SidebarProps, SidebarSection, SidebarSectionProps, SidebarSeparator } from './sidebar.js';
68
70
  export { NavigationMenu, NavigationMenuEntry, NavigationMenuLink, NavigationMenuLinkComponent, NavigationMenuProps } from './navigation-menu.js';
69
71
  export { SavingBar, SavingBarProps, SavingBarStatus } from './saving-bar.js';
70
72
  export { SavingBarProvider, SavingBarRegistration, SavingBarRoot, usePageSavingBar } from './saving-bar-context.js';
@@ -76,7 +78,8 @@ export { Switch, SwitchProps } from './switch.js';
76
78
  export { Tooltip, TooltipProps, TooltipSide } from './tooltip.js';
77
79
  export { ToastFn, ToastOptions, ToastTone, ToastVariant, ToastView, ToastViewProps, Toaster, ToasterProps, toast, toastClassName, useToast } from './toast.js';
78
80
  export { Separator, SeparatorOrientation, SeparatorProps } from './separator.js';
79
- export { Avatar, AvatarGroup, AvatarGroupProps, AvatarGroupSize, AvatarProps, AvatarSize, AvatarType, AvatarVariant, initials } from './avatar.js';
81
+ export { Heading, HeadingElement, HeadingLevel, HeadingMark, HeadingMarkProps, HeadingProps, HeadingTone } from './heading.js';
82
+ export { Avatar, AvatarContent, AvatarGroup, AvatarGroupProps, AvatarGroupSize, AvatarProps, AvatarSize, AvatarType, AvatarVariant, initials } from './avatar.js';
80
83
  export { IconButton, IconButtonProps } from './icon-button.js';
81
84
  export { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps } from './button-group.js';
82
85
  export { ActionBar, ActionBarProps } from './action-bar.js';
@@ -89,7 +92,7 @@ export { Accordion, AccordionItem, AccordionItemProps, AccordionProps } from './
89
92
  export { Slider, SliderProps } from './slider.js';
90
93
  export { Listbox, ListboxOption, ListboxOptionProps, ListboxProps } from './listbox.js';
91
94
  export { Calendar, CalendarProps } from './calendar.js';
92
- export { FileInput, FileInputProps, FileInputVariant, formatFileSize } from './file-input.js';
95
+ export { FileInput, FileInputLayout, FileInputProps, FileInputVariant, formatFileSize } from './file-input.js';
93
96
  export { NumberInput, NumberInputProps, NumberInputStep } from './number-input.js';
94
97
  export { InputOTP, InputOTPLength, InputOTPProps } from './input-otp.js';
95
98
  export { Combobox, ComboboxMultipleProps, ComboboxOption, ComboboxProps, ComboboxSingleProps } from './combobox.js';
@@ -45,6 +45,7 @@ import { Empty } from "./empty.js";
45
45
  import { InsightCard } from "./insight-card.js";
46
46
  import { SectionCard } from "./section-card.js";
47
47
  import { SectionHeader } from "./section-header.js";
48
+ import { Stepper } from "./stepper.js";
48
49
  import { FloatingStepper } from "./floating-stepper.js";
49
50
  import { Stat } from "./stat.js";
50
51
  import { SummaryBar } from "./summary-bar.js";
@@ -54,6 +55,7 @@ import { ChipInput } from "./chip-input.js";
54
55
  import { CopyField } from "./copy-field.js";
55
56
  import { QRDisplay } from "./qr-display.js";
56
57
  import { ChoiceCard, ChoiceCardGroup } from "./choice-card.js";
58
+ import { ChoiceList, ChoiceListItem } from "./choice-list.js";
57
59
  import { OptionTile, OptionTileGrid } from "./option-tile.js";
58
60
  import { SelectableCard } from "./selectable-card.js";
59
61
  import { ChoicePreviewCard } from "./choice-preview-card.js";
@@ -83,6 +85,7 @@ import { Switch } from "./switch.js";
83
85
  import { Tooltip } from "./tooltip.js";
84
86
  import { Toaster, ToastView, toast, useToast, toastClassName } from "./toast.js";
85
87
  import { Separator } from "./separator.js";
88
+ import { Heading, HeadingMark } from "./heading.js";
86
89
  import { Avatar, AvatarGroup, initials } from "./avatar.js";
87
90
  import { IconButton } from "./icon-button.js";
88
91
  import { ButtonGroup } from "./button-group.js";
@@ -161,6 +164,8 @@ export {
161
164
  ChoiceCard,
162
165
  ChoiceCardGroup,
163
166
  ChoiceCarousel,
167
+ ChoiceList,
168
+ ChoiceListItem,
164
169
  ChoicePreviewCard,
165
170
  ColorInput,
166
171
  Combobox,
@@ -205,6 +210,8 @@ export {
205
210
  GoogleButton,
206
211
  GoogleConsent,
207
212
  GoogleSignIn,
213
+ Heading,
214
+ HeadingMark,
208
215
  HoverCard,
209
216
  IconButton,
210
217
  Input,
@@ -267,6 +274,7 @@ export {
267
274
  Stat,
268
275
  Status,
269
276
  StepProgress,
277
+ Stepper,
270
278
  SummaryBar,
271
279
  Switch,
272
280
  Table,
@@ -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
- /** Figma calls this property `style`; here it is `variant` because `style` belongs to React. */
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
@@ -12,6 +12,8 @@ declare function CheckIcon(): react.JSX.Element;
12
12
  declare function MinusIcon(): react.JSX.Element;
13
13
  /** A chevron pointing down: opens a list. */
14
14
  declare function ChevronDownIcon(): react.JSX.Element;
15
+ /** A chevron pointing up: opens a panel that comes up from below (the SavingBar's details). */
16
+ declare function ChevronUpIcon(): react.JSX.Element;
15
17
  /** An open eye: shows what is hidden (a password). */
16
18
  declare function EyeIcon(): react.JSX.Element;
17
19
  /** A crossed eye: hides again what was shown. */
@@ -104,5 +106,13 @@ declare function CopyIcon(): react.JSX.Element;
104
106
  declare function PencilIcon(): react.JSX.Element;
105
107
  /** Three sliders: the filters of a list. */
106
108
  declare function SlidersIcon(): react.JSX.Element;
109
+ /** A square: the 1:1 crop. */
110
+ declare function SquareIcon(): react.JSX.Element;
111
+ /** A standing rectangle: a portrait crop (4:5). */
112
+ declare function RectangleVerticalIcon(): react.JSX.Element;
113
+ /** A lying rectangle: a landscape crop (16:9). */
114
+ declare function RectangleHorizontalIcon(): react.JSX.Element;
115
+ /** A dashed square: a free crop, no fixed aspect. */
116
+ declare function SquareDashedIcon(): react.JSX.Element;
107
117
 
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 };
118
+ export { AlertIcon, ArrowDownIcon, ArrowLeftIcon, ArrowUpDownIcon, ArrowUpIcon, BadgeCheckIcon, BuildingIcon, CalendarIcon, CameraIcon, CheckCheckIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, 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 };
@@ -21,6 +21,9 @@ function MinusIcon() {
21
21
  function ChevronDownIcon() {
22
22
  return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
23
23
  }
24
+ function ChevronUpIcon() {
25
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
26
+ }
24
27
  function EyeIcon() {
25
28
  return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
26
29
  /* @__PURE__ */ jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }),
@@ -260,6 +263,18 @@ function PencilIcon() {
260
263
  function SlidersIcon() {
261
264
  return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3M14 2v4M8 10v4M16 18v4" }) });
262
265
  }
266
+ function SquareIcon() {
267
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }) });
268
+ }
269
+ function RectangleVerticalIcon() {
270
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("rect", { width: "12", height: "20", x: "6", y: "2", rx: "2" }) });
271
+ }
272
+ function RectangleHorizontalIcon() {
273
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("rect", { width: "20", height: "12", x: "2", y: "6", rx: "2" }) });
274
+ }
275
+ function SquareDashedIcon() {
276
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M5 3a2 2 0 0 0-2 2M19 3a2 2 0 0 1 2 2M21 19a2 2 0 0 1-2 2M5 21a2 2 0 0 1-2-2M9 3h1M9 21h1M14 3h1M14 21h1M3 9v1M21 9v1M3 14v1M21 14v1" }) });
277
+ }
263
278
  export {
264
279
  AlertIcon,
265
280
  ArrowDownIcon,
@@ -275,6 +290,7 @@ export {
275
290
  ChevronDownIcon,
276
291
  ChevronLeftIcon,
277
292
  ChevronRightIcon,
293
+ ChevronUpIcon,
278
294
  CircleCheckIcon,
279
295
  ClockIcon,
280
296
  CloseIcon,
@@ -299,6 +315,8 @@ export {
299
315
  PhoneIcon,
300
316
  PlusIcon,
301
317
  QuoteIcon,
318
+ RectangleHorizontalIcon,
319
+ RectangleVerticalIcon,
302
320
  ReplyIcon,
303
321
  RotateCcwIcon,
304
322
  SearchIcon,
@@ -306,6 +324,8 @@ export {
306
324
  SlidersIcon,
307
325
  SmileIcon,
308
326
  SparklesIcon,
327
+ SquareDashedIcon,
328
+ SquareIcon,
309
329
  StarFilledIcon,
310
330
  StarIcon,
311
331
  TableIcon,
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
- type MenuItemTone = 'default' | 'danger';
4
+ /** neutral (default) or danger (Figma: `tone`). */
5
+ type MenuItemTone = 'neutral' | 'danger';
5
6
  interface MenuItemContentProps {
6
7
  /** The action, a verb ("Duplicar") (Figma: `label`). */
7
8
  children: ReactNode;
@@ -10,7 +11,7 @@ interface MenuItemContentProps {
10
11
  /** A keyboard shortcut shown on the right (Figma: `showShortcut`), such as "Ctrl D". Not announced. */
11
12
  shortcut?: ReactNode;
12
13
  }
13
- declare const menuItemClassName: (tone?: MenuItemTone, extra?: string) => string;
14
+ declare const menuItemClassName: (tone?: MenuItemTone | "default", extra?: string) => string;
14
15
  declare function MenuItemContent({ children, icon, shortcut }: MenuItemContentProps): react.JSX.Element;
15
16
 
16
17
  export { MenuItemContent, type MenuItemContentProps, type MenuItemTone, menuItemClassName };
@@ -1,6 +1,6 @@
1
1
  import "../../chunk-ORMEWXMH.js";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- const menuItemClassName = (tone = "default", extra) => ["rds-menu__item", tone === "danger" && "rds-menu__item--danger", extra].filter(Boolean).join(" ");
3
+ const menuItemClassName = (tone = "neutral", extra) => ["rds-menu__item", tone === "danger" && "rds-menu__item--danger", extra].filter(Boolean).join(" ");
4
4
  function MenuItemContent({ children, icon, shortcut }) {
5
5
  return /* @__PURE__ */ jsxs(Fragment, { children: [
6
6
  icon && /* @__PURE__ */ jsx("span", { className: "rds-menu__icon", "aria-hidden": "true", children: icon }),
@@ -4,6 +4,7 @@ import {
4
4
  __spreadValues
5
5
  } from "../../chunk-ORMEWXMH.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useRef } from "react";
7
8
  import * as DialogPrimitive from "@radix-ui/react-dialog";
8
9
  import { Button } from "../button.js";
9
10
  import { IconButton } from "../icon-button.js";
@@ -32,6 +33,7 @@ function ModalShell({
32
33
  container,
33
34
  className
34
35
  }) {
36
+ const opener = useRef(null);
35
37
  const cancel = /* @__PURE__ */ jsx(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { tone: "neutral", variant: "outline", children: cancelLabel }) }, "cancel");
36
38
  const confirm = /* @__PURE__ */ jsx(Button, { onClick: onConfirm, children: confirmLabel }, "confirm");
37
39
  const actions = footer != null ? footer : confirmLabel ? stackedFooter ? [confirm, cancel] : [cancel, confirm] : null;
@@ -51,6 +53,7 @@ function ModalShell({
51
53
  className: ["rds-modal", prefix, ...modifiers, className].filter(Boolean).join(" "),
52
54
  style: boxStyle,
53
55
  onOpenAutoFocus: (event) => {
56
+ opener.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
54
57
  const box = event.currentTarget;
55
58
  const first = box.querySelector(
56
59
  '.rds-modal__body :is(input, textarea, select, button, a[href], [tabindex]:not([tabindex="-1"])):not(:disabled)'
@@ -59,6 +62,12 @@ function ModalShell({
59
62
  event.preventDefault();
60
63
  first.focus();
61
64
  }
65
+ },
66
+ onCloseAutoFocus: (event) => {
67
+ var _a;
68
+ if (trigger || !((_a = opener.current) == null ? void 0 : _a.isConnected)) return;
69
+ event.preventDefault();
70
+ opener.current.focus();
62
71
  }
63
72
  }, description ? {} : { "aria-describedby": void 0 }), {
64
73
  children: [
@@ -1,4 +1,4 @@
1
- /** Figma calls this property `style`: ghost in a toolbar, outline when it stands alone. */
1
+ /** The emphasis (Figma: `variant`): ghost in a toolbar, outline when it stands alone. */
2
2
  type ToggleVariant = 'ghost' | 'outline';
3
3
  declare function toggleClassName(variant: ToggleVariant, extra?: string): string;
4
4
  /** A toggle without visible text needs a name, or a screen reader only says "toggle button". */