@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.
Files changed (109) 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 +18 -8
  15. package/dist/components/chart.js +89 -25
  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 +55 -18
  25. package/dist/components/data-table-header.js +148 -101
  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/form-actions.d.ts +37 -15
  39. package/dist/components/form-actions.js +5 -14
  40. package/dist/components/heading.d.ts +42 -0
  41. package/dist/components/heading.js +25 -0
  42. package/dist/components/icon-button.d.ts +1 -1
  43. package/dist/components/image-crop-dialog.d.ts +60 -0
  44. package/dist/components/image-crop-dialog.js +240 -0
  45. package/dist/components/image-crop-modal.d.ts +12 -55
  46. package/dist/components/image-crop-modal.js +2 -249
  47. package/dist/components/image-upload.d.ts +8 -17
  48. package/dist/components/image-upload.js +3 -3
  49. package/dist/components/index.d.ts +15 -10
  50. package/dist/components/index.js +10 -0
  51. package/dist/components/internal/bottom-bar.d.ts +30 -0
  52. package/dist/components/internal/bottom-bar.js +25 -0
  53. package/dist/components/internal/button.d.ts +1 -1
  54. package/dist/components/internal/icons.d.ts +9 -1
  55. package/dist/components/internal/icons.js +16 -0
  56. package/dist/components/internal/menu.d.ts +3 -2
  57. package/dist/components/internal/menu.js +1 -1
  58. package/dist/components/internal/modal.js +9 -0
  59. package/dist/components/internal/toggle.d.ts +1 -1
  60. package/dist/components/internal/use-on-screen-keyboard.d.ts +12 -0
  61. package/dist/components/internal/use-on-screen-keyboard.js +49 -0
  62. package/dist/components/item.d.ts +14 -7
  63. package/dist/components/item.js +5 -2
  64. package/dist/components/loading-overlay.d.ts +43 -0
  65. package/dist/components/loading-overlay.js +81 -0
  66. package/dist/components/marker.d.ts +11 -3
  67. package/dist/components/marker.js +4 -3
  68. package/dist/components/number-input.d.ts +1 -1
  69. package/dist/components/progress.d.ts +3 -3
  70. package/dist/components/progress.js +2 -2
  71. package/dist/components/row-actions.d.ts +3 -0
  72. package/dist/components/row-actions.js +8 -4
  73. package/dist/components/saving-bar.d.ts +36 -10
  74. package/dist/components/saving-bar.js +14 -6
  75. package/dist/components/section-header.d.ts +4 -3
  76. package/dist/components/selectable-card.d.ts +2 -10
  77. package/dist/components/sidebar.d.ts +8 -11
  78. package/dist/components/sidebar.js +4 -5
  79. package/dist/components/spinner.d.ts +9 -6
  80. package/dist/components/spinner.js +3 -3
  81. package/dist/components/star-rating.d.ts +3 -3
  82. package/dist/components/star-rating.js +2 -2
  83. package/dist/components/stat.d.ts +18 -6
  84. package/dist/components/stat.js +9 -3
  85. package/dist/components/status.d.ts +4 -4
  86. package/dist/components/status.js +2 -2
  87. package/dist/components/stepper.d.ts +33 -0
  88. package/dist/components/stepper.js +36 -0
  89. package/dist/components/summary-bar.d.ts +3 -2
  90. package/dist/components/summary-bar.js +10 -1
  91. package/dist/components/tile.d.ts +5 -5
  92. package/dist/components/tile.js +2 -2
  93. package/dist/components/time-picker.d.ts +1 -1
  94. package/dist/components/toast.d.ts +17 -6
  95. package/dist/components/toast.js +5 -3
  96. package/dist/components/toggle-card-compact.d.ts +6 -25
  97. package/dist/components/toggle-card-compact.js +8 -35
  98. package/dist/components/toggle-card.d.ts +23 -9
  99. package/dist/components/toggle-card.js +38 -2
  100. package/dist/components/toggle.d.ts +1 -1
  101. package/dist/components/typing-indicator.d.ts +2 -2
  102. package/dist/components/typing-indicator.js +1 -1
  103. package/package.json +4 -4
  104. package/styles/base.css +13 -1
  105. package/styles/rds/components-styles.css +767 -281
  106. package/styles/rds/components.css +56 -31
  107. package/styles/rds/foundation.css +1 -1
  108. package/styles/rds/theme.css +40 -29
  109. package/styles/rds.css +1 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@ Add `dark` to `<html>` (or any element) for dark mode:
26
26
  <html class="dark">
27
27
  ```
28
28
 
29
- The stylesheet declares its layers first (`rds.theme`, `rds.tokens`, `rds.components`), so your own unlayered CSS
29
+ The stylesheet declares its layers first (`rds.legacy`, `rds.theme`, `rds.tokens`, `rds.components`), so your own unlayered CSS
30
30
  always wins over the design system without `!important`. The components need no Tailwind and no other stylesheet.
31
31
 
32
32
  ### Legacy: `base.css` (deprecated)
@@ -42,6 +42,41 @@ utilities (`bg-surface-*`, `text-fg-*`, `h-control-*`…) and its CSS variables,
42
42
  @import "@rojaostudio/ds/styles/rds.css";
43
43
  ```
44
44
 
45
+ Both stylesheets declare the same layer order, `rds.legacy, rds.theme, rds.tokens, rds.components`, and everything
46
+ in `base.css` (its variables, the primitives, the `h1`–`h6` rule, the `rojao-*` animations) lives in `rds.legacy`.
47
+ So, whatever the import order, the 2.0 wins wherever the two declare the same variable: 31 names, among them
48
+ `--surface-page`, `--text-muted`, `--text-disabled`, `--border-default`, `--border-strong`, `--radius-card`,
49
+ `--radius-control`, `--z-modal`, `--z-dropdown`, `--z-tooltip`, `--space-4` … `--space-64`, `--toast-text`,
50
+ `--toast-border`. A 1.x utility that reads one of them (`bg-surface-page`, `text-fg-muted` through
51
+ `--text-muted`) shows the 2.0 value while both are imported; the 1.x-only names (`--brand-primary`,
52
+ `--surface-default`…) keep theirs. Tailwind's `@utility` and `@theme` blocks stay at the top level, as Tailwind
53
+ requires, and the focus ring stays in Tailwind's `base` layer, so `outline-none` still wins over it. Your own
54
+ unlayered CSS wins over all of it.
55
+
56
+ ## Theme scopes
57
+
58
+ The shipped theme switches on `.dark`, `.ds-plate` and `.ds-scope`, and on three generic attributes:
59
+ `data-rds-mode="dark"`, `data-rds-plate` and `data-rds-scope`. The component tokens are declared again on each of
60
+ them (`RDS_SCOPE_SELECTORS` in `@rojaostudio/ds-core/generate`): a component token holds `var(--theme-role)`, which
61
+ resolves where it is declared, so a theme switched on an element none of them match would repaint the roles but
62
+ not the components inside.
63
+
64
+ ```html
65
+ <section data-rds-mode="dark">…</section> <!-- a dark section on a light page -->
66
+ ```
67
+
68
+ For your own theme, `emitRdsCss(theme, { scope, dark, plate })` checks each selector against that list and throws
69
+ on one the components would not follow:
70
+
71
+ ```ts
72
+ emitRdsCss(theme, { scope: ".my-scope[data-rds-scope]" }); // <div class="my-scope" data-rds-scope>
73
+ emitRdsCss(theme, { scope: ":root", dark: ':root[data-theme="dark"]' }); // next-themes, attribute="data-theme"
74
+ emitRdsCss(theme, { scope: ".my-scope" }); // throws: add data-rds-scope
75
+ ```
76
+
77
+ A dark selector anchored at the root (`:root[…]`, `html…`) is used as is, which is where next-themes puts its
78
+ attribute. `allowUncovered: true` skips the check, for a theme read only by your own CSS.
79
+
45
80
  ## Import the component, not the barrel
46
81
 
47
82
  ```tsx
@@ -99,7 +134,7 @@ renders itself (the × of Alert, Dialog and Toast, the Calendar and Carousel arr
99
134
  ## Requirements
100
135
 
101
136
  React 19. Tailwind CSS is an **optional** peer: only the legacy `base.css` needs it. A few components bring an
102
- optional peer of their own, installed only if you use them: `react-image-crop` (ImageCropModal, ImageUpload) and
137
+ optional peer of their own, installed only if you use them: `react-image-crop` (ImageCropDialog, ImageUpload) and
103
138
  `react-international-phone` (PhoneInput).
104
139
 
105
140
  ## Icons
@@ -115,6 +150,11 @@ import { PixIcon } from '@rojaostudio/ds/icons';
115
150
 
116
151
  ## React Native
117
152
 
153
+ > **Experimental, outside semver in 2.0.** The native target (`@rojaostudio/ds/native/*`) still follows the 1.x
154
+ > API (`Button variant="primary"`, `Modal`, `Menu`…) and the 1.x theme (`generateTheme`). It will be aligned with
155
+ > the 2.0 components in 2.1; until then it may change in any release, minor and patch included. Pin an exact
156
+ > version if you depend on it. The web components never import from it.
157
+
118
158
  ```tsx
119
159
  import { DSThemeProvider } from '@rojaostudio/ds/native/components';
120
160
 
@@ -0,0 +1,66 @@
1
+ # Avisos de terceiros
2
+
3
+ O Rojão DS é distribuído sob a [licença MIT](../../LICENSE). Alguns trechos vêm de projetos de terceiros, ou se apoiam neles, sob as licenças abaixo.
4
+
5
+ ## Incluído no pacote
6
+
7
+ ### Lucide (ícones)
8
+
9
+ Os SVGs em `packages/ds/icons/svg/` e os traçados de `packages/ds/components/internal/icons.tsx` vêm do [Lucide](https://lucide.dev), sob a licença ISC. Parte do Lucide vem do Feather, sob a licença MIT.
10
+
11
+ ```
12
+ ISC License
13
+
14
+ Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT).
15
+ All other copyright (c) for Lucide are held by Lucide Contributors 2022.
16
+
17
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is
18
+ hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
21
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
22
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
23
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
24
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
+ ```
26
+
27
+ ```
28
+ The MIT License (MIT) — Feather
29
+
30
+ Copyright (c) 2013-2022 Cole Bemis
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
33
+ documentation files (the "Software"), to deal in the Software without restriction, including without
34
+ limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
35
+ Software, and to permit persons to whom the Software is furnished to do so, subject to the following
36
+ conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions
39
+ of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
42
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
43
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
44
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
45
+ DEALINGS IN THE SOFTWARE.
46
+ ```
47
+
48
+ ### Pix
49
+
50
+ O símbolo do Pix (`packages/ds/icons/pix.tsx`) é marca do Banco Central do Brasil. Ele está aqui só para indicar o Pix como meio de pagamento, conforme o manual de uso da marca. A licença MIT deste projeto não se estende a ele.
51
+
52
+ ## Dependências (instaladas pelo gerenciador de pacotes, não redistribuídas)
53
+
54
+ | Pacote | Licença | Uso |
55
+ |---|---|---|
56
+ | `@radix-ui/react-*` | MIT | comportamento acessível de overlays, menus, abas e afins |
57
+ | `lucide-react` (peer opcional) | ISC | re-exportação de ícones em `@rojaostudio/ds/icons` |
58
+ | `react-image-crop` (peer opcional) | ISC | recorte do `ImageCropDialog` |
59
+ | `react-international-phone` (peer opcional) | MIT | campo e bandeiras do `PhoneInput` |
60
+
61
+ ## Fontes (referenciadas pelo nome, não distribuídas)
62
+
63
+ | Fonte | Licença |
64
+ |---|---|
65
+ | Inter | SIL Open Font License 1.1 |
66
+ | Roboto Mono | Apache License 2.0 |
@@ -3,15 +3,23 @@ import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  /** person is a circle; brand is a rounded square (a brand, a company, a campaign). */
5
5
  type AvatarType = 'person' | 'brand';
6
- type AvatarSize = 'sm' | 'default' | 'lg' | 'xl';
7
- /** What the Avatar shows. It follows from the props: a photo (`src`), initials (a name) or an icon (no name). */
8
- type AvatarVariant = 'image' | 'fallback' | 'icon';
6
+ type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
7
+ /**
8
+ * What the Avatar shows (Figma: `content`). It follows from the props: a photo (`src`), initials (a name) or an icon
9
+ * (no name).
10
+ */
11
+ type AvatarContent = 'image' | 'fallback' | 'icon';
12
+ /** @deprecated Use AvatarContent (2.0.0-next: the Figma `variant` is `content`). */
13
+ type AvatarVariant = AvatarContent;
9
14
  interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
10
15
  /** person is a circle; brand is a square with rounded corners, initials in bold on the brand's mark colour. */
11
16
  type?: AvatarType;
12
- /** sm 24, default 32, lg 40, xl 56. Inside an AvatarGroup, the group's size. */
13
- size?: AvatarSize;
14
- /** The photo (Figma: `variant=image`). If it fails to load, the initials (or the icon) show instead. */
17
+ /**
18
+ * sm 24, md 32 (default), lg 40, xl 56 (Figma: `size`). Inside an AvatarGroup, the group's size. `'default'` is
19
+ * deprecated (2.0.0-next): it is `'md'`.
20
+ */
21
+ size?: AvatarSize | 'default';
22
+ /** The photo (Figma: `content=image`). If it fails to load, the initials (or the icon) show instead. */
15
23
  src?: string;
16
24
  /**
17
25
  * The full name: the photo's alt, the initials' aria-label and the source of the initials. Leave it out only for an
@@ -20,7 +28,7 @@ interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>
20
28
  name?: string;
21
29
  /** The initials (Figma: `fallbackText`). By default two letters from `name`, one on a brand. */
22
30
  fallbackText?: string;
23
- /** The icon when there is no name (Figma: `variant=icon` + `icon`). By default a person, or a building on a brand. */
31
+ /** The icon when there is no name (Figma: `content=icon` + `icon`). By default a person, or a building on a brand. */
24
32
  icon?: ReactNode;
25
33
  /** The presence dot (Figma: `showBadge`). The colour is not the only sign: `badgeLabel` goes into the accessible name. */
26
34
  showBadge?: boolean;
@@ -31,7 +39,7 @@ interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>
31
39
  declare function initials(name: string): string;
32
40
  /**
33
41
  * Avatar — Figma [RDS] Content/Avatar. A person, or a brand, in miniature: photo, initials or icon. Not
34
- * interactive. The Figma `variant` follows from the props: `src` → image, a name → fallback, neither → icon.
42
+ * interactive. The Figma `content` follows from the props: `src` → image, a name → fallback, neither → icon.
35
43
  * Styles: avatar.css.
36
44
  */
37
45
  declare function Avatar({ type, size, src, name, fallbackText, icon, showBadge, badgeLabel, className, ...rest }: AvatarProps): react.JSX.Element;
@@ -39,14 +47,14 @@ type AvatarGroupSize = Exclude<AvatarSize, 'xl'>;
39
47
  interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
40
48
  /** Who the group is ("Equipe do projeto"). Required: it names the group for screen readers. */
41
49
  'aria-label': string;
42
- /** The size of every Avatar inside (Figma: sm, default, lg). */
43
- size?: AvatarGroupSize;
50
+ /** The size of every Avatar inside (Figma: sm, md, lg). `'default'` is deprecated (2.0.0-next): it is `'md'`. */
51
+ size?: AvatarGroupSize | 'default';
44
52
  /** Show only the first `max` and a "+N" with the rest. 3 or 4 is a good limit. */
45
53
  max?: number;
46
54
  /** The Avatars. */
47
55
  children: ReactNode;
48
56
  }
49
57
  /** AvatarGroup — Figma [RDS] Content/AvatarGroup. Overlapping avatars, each with a ring that separates it. */
50
- declare function AvatarGroup({ size, max, className, children, ...rest }: AvatarGroupProps): react.JSX.Element;
58
+ declare function AvatarGroup({ size: sizeProp, max, className, children, ...rest }: AvatarGroupProps): react.JSX.Element;
51
59
 
52
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarGroupSize, type AvatarProps, type AvatarSize, type AvatarType, type AvatarVariant, initials };
60
+ export { Avatar, type AvatarContent, AvatarGroup, type AvatarGroupProps, type AvatarGroupSize, type AvatarProps, type AvatarSize, type AvatarType, type AvatarVariant, initials };
@@ -8,6 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Children, createContext, useContext, useState } from "react";
9
9
  import { BuildingIcon, UserIcon } from "./internal/icons.js";
10
10
  const GroupSize = createContext(void 0);
11
+ const sizeOf = (size) => size === "default" ? "md" : size;
11
12
  function initials(name) {
12
13
  const parts = name.trim().split(/\s+/).filter(Boolean);
13
14
  if (parts.length === 0) return "?";
@@ -38,26 +39,27 @@ function Avatar(_a) {
38
39
  ]);
39
40
  var _a2, _b2;
40
41
  const groupSize = useContext(GroupSize);
41
- const finalSize = (_a2 = size != null ? size : groupSize) != null ? _a2 : "default";
42
+ const finalSize = sizeOf((_a2 = size != null ? size : groupSize) != null ? _a2 : "md");
42
43
  const [failed, setFailed] = useState(null);
43
44
  const trimmed = (_b2 = name == null ? void 0 : name.trim()) != null ? _b2 : "";
44
45
  const letters = fallbackText != null ? fallbackText : trimmed ? type === "brand" ? trimmed[0].toUpperCase() : initials(trimmed) : "";
45
- const variant = src && failed !== src ? "image" : letters ? "fallback" : "icon";
46
+ const content = src && failed !== src ? "image" : letters ? "fallback" : "icon";
46
47
  const label = trimmed ? showBadge ? `${trimmed}, ${badgeLabel}` : trimmed : void 0;
47
- const semantics = variant === "image" ? {} : label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
48
+ const semantics = content === "image" ? {} : label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
48
49
  return /* @__PURE__ */ jsxs(
49
50
  "span",
50
51
  __spreadProps(__spreadValues(__spreadValues({}, semantics), rest), {
51
- className: ["rds-avatar", `rds-avatar--${type}`, `rds-avatar--${finalSize}`, `rds-avatar--${variant}`, className].filter(Boolean).join(" "),
52
+ className: ["rds-avatar", `rds-avatar--${type}`, `rds-avatar--${finalSize}`, `rds-avatar--${content}`, className].filter(Boolean).join(" "),
52
53
  children: [
53
- variant === "image" ? /* @__PURE__ */ jsx("img", { className: "rds-avatar__image", src, alt: label != null ? label : "", onError: () => setFailed(src != null ? src : null) }) : /* @__PURE__ */ jsx("span", { className: "rds-avatar__fallback", "aria-hidden": "true", children: variant === "fallback" ? letters : icon != null ? icon : type === "brand" ? /* @__PURE__ */ jsx(BuildingIcon, {}) : /* @__PURE__ */ jsx(UserIcon, {}) }),
54
+ content === "image" ? /* @__PURE__ */ jsx("img", { className: "rds-avatar__image", src, alt: label != null ? label : "", onError: () => setFailed(src != null ? src : null) }) : /* @__PURE__ */ jsx("span", { className: "rds-avatar__fallback", "aria-hidden": "true", children: content === "fallback" ? letters : icon != null ? icon : type === "brand" ? /* @__PURE__ */ jsx(BuildingIcon, {}) : /* @__PURE__ */ jsx(UserIcon, {}) }),
54
55
  showBadge && /* @__PURE__ */ jsx("span", { className: "rds-avatar__badge", "aria-hidden": "true" })
55
56
  ]
56
57
  })
57
58
  );
58
59
  }
59
60
  function AvatarGroup(_c) {
60
- var _d = _c, { size = "default", max, className, children } = _d, rest = __objRest(_d, ["size", "max", "className", "children"]);
61
+ var _d = _c, { size: sizeProp = "md", max, className, children } = _d, rest = __objRest(_d, ["size", "max", "className", "children"]);
62
+ const size = sizeOf(sizeProp);
61
63
  const items = Children.toArray(children);
62
64
  const shown = max && items.length > max ? items.slice(0, max) : items;
63
65
  const hidden = items.length - shown.length;
@@ -2,8 +2,8 @@ import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  type BadgeTone = 'neutral' | 'action' | 'accent' | 'inverse';
5
- /** Figma calls this property `style`. */
6
- type BadgeVariant = 'fill' | 'soft' | 'highlight';
5
+ /** The emphasis (Figma: `variant`): fill (solid) or soft (a light plate; on accent, the brand's highlighter). */
6
+ type BadgeVariant = 'fill' | 'soft';
7
7
  interface BadgeBase extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
8
8
  /** The label (Figma: `label`): "Nova", "Grátis". Ignored when `value` is given. */
9
9
  children?: ReactNode;
@@ -11,15 +11,16 @@ interface BadgeBase extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
11
11
  value?: number;
12
12
  }
13
13
  /**
14
- * Not every tone has every variant (as in Figma): soft only on neutral and action, highlight only on accent,
15
- * inverse only fill. The types allow only those.
14
+ * Not every tone has every variant (as in Figma): inverse is only fill. On accent, soft is the brand's highlighter
15
+ * (the old `highlight`). The types allow only those.
16
16
  */
17
17
  type BadgeProps = BadgeBase & ({
18
18
  tone?: 'neutral' | 'action';
19
- variant?: 'fill' | 'soft';
19
+ variant?: BadgeVariant;
20
20
  } | {
21
21
  tone: 'accent';
22
- variant?: 'fill' | 'highlight';
22
+ /** `'highlight'` is deprecated (2.0.0-next): it is `variant="soft"` on `tone="accent"`. */
23
+ variant?: BadgeVariant | 'highlight';
23
24
  } | {
24
25
  tone: 'inverse';
25
26
  variant?: 'fill';
@@ -10,10 +10,11 @@ function formatBadgeValue(value) {
10
10
  function Badge(_a) {
11
11
  var _b = _a, { tone = "neutral", variant = "fill", value, children, className } = _b, rest = __objRest(_b, ["tone", "variant", "value", "children", "className"]);
12
12
  const isNumber = value !== void 0;
13
+ const emphasis = variant === "highlight" ? "soft" : variant;
13
14
  return /* @__PURE__ */ jsx(
14
15
  "span",
15
16
  __spreadProps(__spreadValues({}, rest), {
16
- className: ["rds-badge", `rds-badge--${tone}-${variant}`, isNumber && "rds-badge--number", className].filter(Boolean).join(" "),
17
+ className: ["rds-badge", `rds-badge--${tone}-${emphasis}`, isNumber && "rds-badge--number", className].filter(Boolean).join(" "),
17
18
  children: isNumber ? formatBadgeValue(value) : children
18
19
  })
19
20
  );
@@ -6,7 +6,7 @@ interface BreadcrumbItem {
6
6
  /** Where the step leads. The last step is the current page and never gets a link. */
7
7
  href?: string;
8
8
  }
9
- type BreadcrumbTone = 'default' | 'inverse';
9
+ type BreadcrumbTone = 'neutral' | 'inverse';
10
10
  type BreadcrumbLinkComponent = ComponentType<{
11
11
  href: string;
12
12
  className?: string;
@@ -16,10 +16,10 @@ interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, 'children'>
16
16
  /** The path, from the most general to the current page, the last one (Figma: the `items` slot). */
17
17
  items: BreadcrumbItem[];
18
18
  /**
19
- * default on a light surface; inverse over colors/primary. Deprecated in the Figma since 27/09/2026: for the brand
20
- * colour, put the Breadcrumb in a brand-mode scope and keep the default tone.
19
+ * neutral (default) on a light surface; inverse over colors/primary (Figma: `tone`). For the brand colour prefer a
20
+ * brand-mode scope (`.ds-plate`) with the neutral tone. `'default'` is deprecated (2.0.0-next): it is `'neutral'`.
21
21
  */
22
- tone?: BreadcrumbTone;
22
+ tone?: BreadcrumbTone | 'default';
23
23
  /** More steps than this: the middle ones hide behind "…", a button that shows the whole path. */
24
24
  maxItems?: number;
25
25
  /** The link element (default `<a>`). Pass a framework Link (Next's `Link`) to navigate on the client. */
@@ -11,7 +11,7 @@ function Anchor({ href, className, children }) {
11
11
  return /* @__PURE__ */ jsx("a", { href, className, children });
12
12
  }
13
13
  function Breadcrumb(_a) {
14
- var _b = _a, { items, tone = "default", maxItems = 4, linkAs: Link = Anchor, className } = _b, rest = __objRest(_b, ["items", "tone", "maxItems", "linkAs", "className"]);
14
+ var _b = _a, { items, tone = "neutral", maxItems = 4, linkAs: Link = Anchor, className } = _b, rest = __objRest(_b, ["items", "tone", "maxItems", "linkAs", "className"]);
15
15
  const [expanded, setExpanded] = useState(false);
16
16
  const list = useRef(null);
17
17
  const collapse = !expanded && items.length > maxItems;
@@ -1,29 +1,44 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
- type BubbleVariant = 'fill' | 'muted' | 'tinted' | 'outline' | 'ghost' | 'error' | 'typing';
4
+ /** The emphasis (Figma: `variant`). */
5
+ type BubbleVariant = 'fill' | 'soft' | 'outline' | 'ghost';
6
+ /** The colour (Figma: `tone`). action and danger exist only on soft. */
7
+ type BubbleTone = 'neutral' | 'action' | 'danger';
5
8
  type BubbleAlign = 'start' | 'end';
6
- interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
7
- /**
8
- * The surface (Figma: `style`). fill: the person writing, in the brand colour. muted or tinted: the one answering.
9
- * outline: on a coloured background. ghost: a long answer from the assistant, no box. error: it was not sent.
10
- * typing: the three dots of the one answering while they write; no text, no reactions.
11
- */
12
- variant?: BubbleVariant;
9
+ interface BubbleBase extends HTMLAttributes<HTMLDivElement> {
13
10
  /** start: the one answering, the small corner bottom left; end: the person writing, bottom right. */
14
11
  align?: BubbleAlign;
15
12
  /**
16
- * The message (Figma: `text`). Line breaks are kept. In `typing` it is what a screen reader hears instead of the
13
+ * The three dots of the one answering while they write (Figma: `typing=true`); no text, no reactions. The
14
+ * surface is the soft neutral one, whatever `variant` and `tone` say.
15
+ */
16
+ typing?: boolean;
17
+ /**
18
+ * The message (Figma: `text`). Line breaks are kept. With `typing` it is what a screen reader hears instead of the
17
19
  * dots, "digitando…" by default ("Ana está digitando…").
18
20
  */
19
21
  children?: ReactNode;
20
22
  /** How many reacted (Figma: `showReactions` + `reactions`). The pill goes under the text; 0 hides it. */
21
23
  reactions?: number;
22
24
  }
25
+ /**
26
+ * The surface (Figma: `variant` × `tone`, only the combinations the Figma draws):
27
+ * - soft (default): the one answering. tone neutral (default), action (the brand tint) or danger (it was not sent).
28
+ * - fill: the person writing, in the brand colour. outline: on a coloured background. ghost: a long answer from the
29
+ * assistant, no box. These three are neutral only.
30
+ */
31
+ type BubbleProps = BubbleBase & ({
32
+ variant?: 'soft';
33
+ tone?: BubbleTone;
34
+ } | {
35
+ variant: 'fill' | 'outline' | 'ghost';
36
+ tone?: 'neutral';
37
+ });
23
38
  /**
24
39
  * Bubble — Figma [RDS] Chat/Bubble. The surface of a message: it grows up to 480 and wraps. Inside a Message,
25
40
  * which adds the avatar, the name and the actions. Styles: bubble.css.
26
41
  */
27
- declare function Bubble({ variant, align, children, reactions, className, ...rest }: BubbleProps): react.JSX.Element;
42
+ declare function Bubble({ variant, tone, typing, align, children, reactions, className, ...rest }: BubbleProps): react.JSX.Element;
28
43
 
29
- export { Bubble, type BubbleAlign, type BubbleProps, type BubbleVariant };
44
+ export { Bubble, type BubbleAlign, type BubbleProps, type BubbleTone, type BubbleVariant };
@@ -6,8 +6,8 @@ import {
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { ThumbsUpIcon } from "./internal/icons.js";
8
8
  function Bubble(_a) {
9
- var _b = _a, { variant = "muted", align = "start", children, reactions, className } = _b, rest = __objRest(_b, ["variant", "align", "children", "reactions", "className"]);
10
- if (variant === "typing") {
9
+ var _b = _a, { variant = "soft", tone = "neutral", typing = false, align = "start", children, reactions, className } = _b, rest = __objRest(_b, ["variant", "tone", "typing", "align", "children", "reactions", "className"]);
10
+ if (typing) {
11
11
  return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ role: "status" }, rest), { className: ["rds-bubble", "rds-bubble--typing", `rds-bubble--${align}`, className].filter(Boolean).join(" "), children: [
12
12
  /* @__PURE__ */ jsxs("span", { className: "rds-bubble__dots", "aria-hidden": "true", children: [
13
13
  /* @__PURE__ */ jsx("span", {}),
@@ -17,7 +17,7 @@ function Bubble(_a) {
17
17
  /* @__PURE__ */ jsx("span", { className: "rds-visually-hidden", children: children != null ? children : "digitando\u2026" })
18
18
  ] }));
19
19
  }
20
- return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-bubble", `rds-bubble--${variant}`, `rds-bubble--${align}`, className].filter(Boolean).join(" "), children: [
20
+ return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-bubble", `rds-bubble--${variant}`, `rds-bubble--${tone}`, `rds-bubble--${align}`, className].filter(Boolean).join(" "), children: [
21
21
  /* @__PURE__ */ jsx("div", { className: "rds-bubble__text", children }),
22
22
  reactions !== void 0 && reactions > 0 && /* @__PURE__ */ jsx("div", { className: "rds-bubble__reactions-row", children: /* @__PURE__ */ jsxs("span", { className: "rds-bubble__reactions", children: [
23
23
  /* @__PURE__ */ jsxs("span", { className: "rds-bubble__reactions-count", "aria-hidden": "true", children: [
@@ -9,7 +9,7 @@ interface ButtonProps extends ComponentPropsWithRef<'button'> {
9
9
  children: ReactNode;
10
10
  /** The role: brand click (action), quiet (neutral), destructive (danger), or over the brand plate (inverse). */
11
11
  tone?: ButtonTone;
12
- /** The emphasis (Figma: `style`): fill draws the most attention, ghost the least. */
12
+ /** The emphasis (Figma: `variant`): fill draws the most attention, ghost the least. */
13
13
  variant?: ButtonVariant;
14
14
  /**
15
15
  * The height, by the space available (Figma: `size`): sm 36, md 44 (default), lg 52. Text 14/20 on sm and md,
@@ -1,14 +1,27 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
- type CardSurface = 'default' | 'tint';
5
- type CardSize = 'default' | 'sm';
4
+ /** The surface (Figma: `variant`). */
5
+ type CardVariant = 'surface' | 'soft' | 'outline';
6
+ /** @deprecated Use CardVariant (2.0.0-next): default → surface, tint → soft, outline stays. */
7
+ type CardSurface = 'default' | 'outline' | 'tint';
8
+ type CardSize = 'md' | 'sm';
6
9
  type Heading = 'h2' | 'h3' | 'h4';
7
10
  interface CardProps extends HTMLAttributes<HTMLElement> {
8
- /** tint is the brand's light background, with no border, for a card that stands out. */
11
+ /**
12
+ * The surface (Figma: `variant`). surface (default): white, with a border and elevation/raised, for a topic on its
13
+ * own on the page. outline: only the border, no fill nor shadow, it takes the surface underneath; for cards side by
14
+ * side in a grid, inside a panel or a list. soft: the brand's light plate, no border nor shadow; a rare highlight,
15
+ * one per screen.
16
+ */
17
+ variant?: CardVariant;
18
+ /** @deprecated Use `variant` (2.0.0-next): default → surface, tint → soft, outline → outline. */
9
19
  surface?: CardSurface;
10
- /** sm aligns everything on 12 and makes the header text smaller, for dense lists and indicators. */
11
- size?: CardSize;
20
+ /**
21
+ * md (default) pads 24; sm pads 16 and makes the header text smaller, for dense lists and indicators (Figma:
22
+ * `size`). `'default'` is deprecated (2.0.0-next): it is `'md'`.
23
+ */
24
+ size?: CardSize | 'default';
12
25
  /** article (default) for a topic that reads on its own; section or div when it is part of something larger. */
13
26
  as?: 'article' | 'section' | 'div';
14
27
  /**
@@ -21,7 +34,7 @@ interface CardProps extends HTMLAttributes<HTMLElement> {
21
34
  * Card — Figma [RDS] Content/Card. A topic that reads on its own: a plan, a summary with an action. Never a card
22
35
  * inside a card. When it has a CardHeader, the title names the card. Styles: card.css.
23
36
  */
24
- declare function Card({ surface, size, as: Root, className, children, ...rest }: CardProps): react.JSX.Element;
37
+ declare function Card({ variant, surface, size, as: Root, className, children, ...rest }: CardProps): react.JSX.Element;
25
38
  interface CardHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
26
39
  /** What the card is about (Figma: `title`). It names the card for screen readers. */
27
40
  title: ReactNode;
@@ -29,9 +42,9 @@ interface CardHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
29
42
  titleAs?: Heading;
30
43
  /** One supporting line (Figma: `showDescription` + `description`). */
31
44
  description?: ReactNode;
32
- /** A Tile before the text (Figma: `showIcon`): variant soft, size default (sm on a small card). */
45
+ /** A Tile before the text (Figma: `showIcon`): variant soft, size md (sm on a small card). */
33
46
  icon?: ReactNode;
34
- /** One action on the right (Figma: `showAction` + `action`): a ghost Button or an IconButton. */
47
+ /** Opt-in: one action on the right (Figma: `showAction` + `action`), a ghost Button or an IconButton. None by default. */
35
48
  action?: ReactNode;
36
49
  /** start: side by side; center: stacked and centred. */
37
50
  align?: 'start' | 'center';
@@ -42,14 +55,17 @@ type CardContentProps = HTMLAttributes<HTMLDivElement>;
42
55
  /** The card's content (Figma: the `cardContent` slot). */
43
56
  declare function CardContent({ className, ...rest }: CardContentProps): react.JSX.Element;
44
57
  interface CardFooterProps extends HTMLAttributes<HTMLElement> {
45
- /** One or two Buttons (Figma: `actions` one · two). A third action goes into the content, as a link. */
58
+ /**
59
+ * One or two Buttons (Figma: `actions` one · two), side by side: the main one (action fill) last, the secondary one
60
+ * a neutral ghost Button before it. A third action goes into the content, as a link.
61
+ */
46
62
  children: ReactNode;
47
- /** start, end, or full (buttons stacked across the whole width). */
63
+ /** start, end (default), or full (the two side by side, half each, for a narrow card on a phone). */
48
64
  align?: 'start' | 'end' | 'full';
49
65
  /** A line under the buttons (Figma: `showTertiaryContent` + `tertiaryContent`), such as a sign-up link. */
50
66
  note?: ReactNode;
51
67
  }
52
- /** The card's footer, with its actions (Figma: .card/footer). */
68
+ /** The card's footer, with its actions (Figma: .card/footer). No band and no rule: spacing sets it apart. */
53
69
  declare function CardFooter({ align, note, className, children, ...rest }: CardFooterProps): react.JSX.Element;
54
70
 
55
- export { Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, type CardSize, type CardSurface };
71
+ export { Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, type CardSize, type CardSurface, type CardVariant };
@@ -6,9 +6,11 @@ import {
6
6
  } from "../chunk-ORMEWXMH.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { createContext, useContext, useId } from "react";
9
+ const SURFACE_TO_VARIANT = { default: "surface", tint: "soft", outline: "outline" };
9
10
  const TitleId = createContext(void 0);
10
11
  function Card(_a) {
11
- var _b = _a, { surface = "default", size = "default", as: Root = "article", className, children } = _b, rest = __objRest(_b, ["surface", "size", "as", "className", "children"]);
12
+ var _b = _a, { variant, surface, size = "md", as: Root = "article", className, children } = _b, rest = __objRest(_b, ["variant", "surface", "size", "as", "className", "children"]);
13
+ const look = variant != null ? variant : surface ? SURFACE_TO_VARIANT[surface] : "surface";
12
14
  const titleId = useId();
13
15
  const labelled = Root !== "div" && !rest["aria-label"] && !rest["aria-labelledby"];
14
16
  return /* @__PURE__ */ jsx(TitleId.Provider, { value: labelled ? titleId : void 0, children: /* @__PURE__ */ jsx(
@@ -16,7 +18,7 @@ function Card(_a) {
16
18
  __spreadProps(__spreadValues({
17
19
  "aria-labelledby": labelled ? titleId : void 0
18
20
  }, rest), {
19
- className: ["rds-card", `rds-card--${surface}`, size === "sm" && "rds-card--sm", className].filter(Boolean).join(" "),
21
+ className: ["rds-card", `rds-card--${look}`, size === "sm" && "rds-card--sm", className].filter(Boolean).join(" "),
20
22
  children
21
23
  })
22
24
  ) });
@@ -10,7 +10,7 @@ interface ChartSeries {
10
10
  /** line only: which axis it reads on. right only when the two series have different units (volume and rate). */
11
11
  axis?: 'left' | 'right';
12
12
  }
13
- interface ChartProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
13
+ interface ChartProps extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'onSelect'> {
14
14
  /** What the chart shows, with the period. It names the chart and captions its data table. */
15
15
  label: string;
16
16
  /** line: lines over time; bar: a ranking in horizontal bars; column: columns by category. */
@@ -32,18 +32,28 @@ interface ChartProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
32
32
  showLegend?: boolean;
33
33
  /** The values of the point under the pointer or the keyboard (Figma: `showTooltip`). */
34
34
  showTooltip?: boolean;
35
- /** Off: only the first, middle and last label (Figma: `showAllDates`). Use it under about 360 px. */
35
+ /**
36
+ * line and column: which x labels show (Figma: `dates`). edges, the default: the first, middle and last; all: every
37
+ * label, for short series only.
38
+ */
39
+ dates?: 'edges' | 'all';
40
+ /** line and column: one label every N points, with a tick on every point (Figma: `dates=every`). Wins over `dates`. */
41
+ dateEvery?: number;
42
+ /** @deprecated Use `dates="all"` (true) or `dates="edges"` (false). */
36
43
  showAllDates?: boolean;
44
+ /**
45
+ * bar and column: where each item leads, in the order of `labels`. In bar each bar becomes a link named
46
+ * "<label>: <value>"; in column a click or Enter on the plot follows the item's link. Only http(s) URLs, relative
47
+ * paths and #fragments are followed; any other scheme (javascript:, data:…) is ignored, with a warning in dev.
48
+ */
49
+ hrefs?: Array<string | undefined>;
50
+ /** bar and column: called with the item's index when it is chosen (click, Enter). In bar each bar becomes a button. */
51
+ onSelect?: (index: number) => void;
37
52
  /** Show the data table under the chart. By default it is there only for screen readers. */
38
53
  showTable?: boolean;
39
54
  /** Height of the plot area, in px (Figma: 200). */
40
55
  height?: number;
41
56
  }
42
- /**
43
- * Chart — Figma [RDS] Content/Chart. The chart area, to go inside a Card. Every chart carries a table with the same
44
- * data (visually hidden unless `showTable`). In line and column the plot is a slider for screen readers and the
45
- * keyboard: the arrows move from point to point, and each point is read with its label and values. Styles: chart.css.
46
- */
47
- declare function Chart({ label, type, labels, series, formatLeft, formatRight, showRightAxis, showLegend, showTooltip, showAllDates, showTable, height, className, ...rest }: ChartProps): react.JSX.Element;
57
+ declare function Chart({ label, type, labels, series, formatLeft, formatRight, showRightAxis, showLegend, showTooltip, dates, dateEvery, showAllDates, hrefs: hrefsProp, onSelect, showTable, height, className, ...rest }: ChartProps): react.JSX.Element;
48
58
 
49
59
  export { Chart, type ChartProps, type ChartSeries, type ChartType };