orbital-ds 0.29.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/AGENTS.md +14 -0
  2. package/components.manifest.json +117 -6
  3. package/dist/hooks/use-ds-messages.d.ts +9 -0
  4. package/dist/lib/auth-flow.d.ts +26 -2
  5. package/dist/lib/auth-flow.js +20 -3
  6. package/dist/lib/header-control.d.ts +4 -0
  7. package/dist/lib/header-control.js +14 -0
  8. package/dist/lib/i18n.d.ts +9 -0
  9. package/dist/lib/i18n.js +27 -0
  10. package/dist/ui/app-bar.d.ts +10 -0
  11. package/dist/ui/app-bar.js +51 -0
  12. package/dist/ui/attachment.js +1 -1
  13. package/dist/ui/auth-form.d.ts +5 -1
  14. package/dist/ui/auth-form.js +5 -0
  15. package/dist/ui/badge.js +2 -2
  16. package/dist/ui/button.js +1 -1
  17. package/dist/ui/content-card.d.ts +6 -2
  18. package/dist/ui/content-card.js +27 -3
  19. package/dist/ui/dropzone.js +1 -1
  20. package/dist/ui/item.js +1 -1
  21. package/dist/ui/legend.js +1 -1
  22. package/dist/ui/locale-switcher.d.ts +19 -0
  23. package/dist/ui/locale-switcher.js +54 -0
  24. package/dist/ui/menubar.js +1 -1
  25. package/dist/ui/message-scroller.js +1 -1
  26. package/dist/ui/navigation-menu.js +2 -2
  27. package/dist/ui/notice-review.d.ts +1 -0
  28. package/dist/ui/notifications.d.ts +12 -2
  29. package/dist/ui/notifications.js +28 -5
  30. package/dist/ui/sidebar.d.ts +17 -3
  31. package/dist/ui/sidebar.js +25 -10
  32. package/dist/ui/theme-toggle.d.ts +14 -0
  33. package/dist/ui/theme-toggle.js +112 -0
  34. package/dist/ui/toggle.js +2 -2
  35. package/dist/ui/week-strip.js +1 -1
  36. package/docs/CONTRACT.md +1 -1
  37. package/docs/designer/patrones.md +6 -0
  38. package/package.json +188 -187
  39. package/scripts/cli.mjs +452 -452
  40. package/dist/motion.css +0 -146
  41. package/dist/styles.css +0 -1656
  42. package/dist/themes/fractalia.css +0 -549
  43. package/dist/themes/fractalia.fonts.css +0 -3
  44. package/dist/themes/fractalia.guide.md +0 -86
  45. package/dist/themes/fractalia.meta.json +0 -112
  46. package/dist/themes/fractalia.scoped.css +0 -549
  47. package/dist/themes/fractalia.tokens.json +0 -39
  48. package/dist/themes/friendly.css +0 -367
  49. package/dist/themes/friendly.fonts.css +0 -2
  50. package/dist/themes/friendly.guide.md +0 -38
  51. package/dist/themes/friendly.meta.json +0 -82
  52. package/dist/themes/friendly.scoped.css +0 -367
  53. package/dist/themes/friendly.tokens.json +0 -45
  54. package/dist/themes/lagoon.css +0 -348
  55. package/dist/themes/lagoon.fonts.css +0 -2
  56. package/dist/themes/lagoon.guide.md +0 -47
  57. package/dist/themes/lagoon.meta.json +0 -85
  58. package/dist/themes/lagoon.scoped.css +0 -348
  59. package/dist/themes/lagoon.tokens.json +0 -49
  60. package/dist/themes/liquid.css +0 -502
  61. package/dist/themes/liquid.fonts.css +0 -7
  62. package/dist/themes/liquid.guide.md +0 -82
  63. package/dist/themes/liquid.meta.json +0 -134
  64. package/dist/themes/liquid.scoped.css +0 -502
  65. package/dist/themes/liquid.tokens.json +0 -47
  66. package/dist/themes/qratia.css +0 -260
  67. package/dist/themes/qratia.fonts.css +0 -2
  68. package/dist/themes/qratia.guide.md +0 -34
  69. package/dist/themes/qratia.meta.json +0 -49
  70. package/dist/themes/qratia.scoped.css +0 -260
  71. package/dist/themes/qratia.tokens.json +0 -49
  72. package/dist/themes/tactile.css +0 -588
  73. package/dist/themes/tactile.fonts.css +0 -3
  74. package/dist/themes/tactile.guide.md +0 -82
  75. package/dist/themes/tactile.meta.json +0 -182
  76. package/dist/themes/tactile.scoped.css +0 -588
  77. package/dist/themes/tactile.tokens.json +0 -42
  78. package/dist/themes/twitter.css +0 -357
  79. package/dist/themes/twitter.fonts.css +0 -6
  80. package/dist/themes/twitter.guide.md +0 -35
  81. package/dist/themes/twitter.meta.json +0 -90
  82. package/dist/themes/twitter.scoped.css +0 -357
  83. package/dist/themes/twitter.tokens.json +0 -45
  84. package/dist/themes/zyro.css +0 -434
  85. package/dist/themes/zyro.fonts.css +0 -2
  86. package/dist/themes/zyro.guide.md +0 -33
  87. package/dist/themes/zyro.meta.json +0 -74
  88. package/dist/themes/zyro.scoped.css +0 -434
  89. package/dist/themes/zyro.tokens.json +0 -46
package/AGENTS.md CHANGED
@@ -65,6 +65,20 @@ adivinar. Lee antes: `README.md`, `docs/CONTRACT.md`, `contract.json` y
65
65
  ni capa se escribe a mano (el doctor lo comprueba también dentro de valores arbitrarios).
66
66
  - Otras librerías: `readDsTransition()` (`orbital-ds/lib/motion`) da duración y curva CSS.
67
67
 
68
+ ## Cabecera, lateral y hover (0.30)
69
+
70
+ - **`AppBar`** (`app` · `compact` · `transparent`) con `AppBarTitle` y `AppBarActions`; en la derecha, siempre
71
+ campana (`NotificationCenter`), idioma (`LocaleSwitcher`: `compact` · `menu`) y tema (`ThemeToggle`: `icon` · `cycle` ·
72
+ `segmented`). Los tres comparten `tone` (`neutral` · `brand` · `soft`) y se ajustan a la marca solo con
73
+ `--ds-header-control-*` (`-fg`, `-bg`, `-hover-bg`, `-active-bg`, `-radius`, `-brand-*`, `-badge-bg/-fg`) en `brand.css`.
74
+ - **`NotificationCenter`**: presets `count` · `dot` · `compact`; ejes `indicator` (count · dot · none) y `density`.
75
+ - **`Sidebar`**: ejes `tone` (`default` · `brand` · `contrast`, por `--ds-sidebar-brand-*` / `-contrast-*`) e
76
+ `indicator` (`fill` · `bar`, `--ds-sidebar-bar-w`); en el raíl de iconos todo queda centrado.
77
+ - **Hover unificado**: `--ds-hover-bg`, `--ds-active-bg`, `--ds-row-hover`. Un componente nunca pone `hover:bg-muted/…`.
78
+ - **Gris estándar**: `scripts/neutral.mjs` deriva la escalera de neutros de la semilla `--ds-neutral-h/-c`;
79
+ `pnpm check:neutral` (dentro de `verify`) comprueba que el tema la cumple. En la escalera: `lagoon`, `friendly`, `liquid`, `qratia`, `tactile` y `zyro`. Exentos con `/* @neutral off */` (fieles a su sistema de origen): `fractalia` y `twitter`.
80
+ - **Sin subrayado en títulos**: se retiró el «rotulador» de los títulos; `--ds-marker*` se conserva para los temas que lo usan.
81
+
68
82
  ## Gráficos e informes (Apache ECharts)
69
83
 
70
84
  - **Librería oficial: ECharts** (dependencia opcional). `chart.tsx` (Recharts) se mantiene por compatibilidad,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "orbital-ds",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "engine": "@base-ui/react",
5
5
  "docs": [
6
6
  "README.md",
@@ -109,6 +109,36 @@
109
109
  "Pasa siempre `format` si el número lleva unidad (horas, %, moneda): la unidad no rueda."
110
110
  ]
111
111
  },
112
+ "app-bar": {
113
+ "import": "orbital-ds/ui/app-bar",
114
+ "exports": [
115
+ "AppBar",
116
+ "AppBarActions",
117
+ "AppBarTitle"
118
+ ],
119
+ "slots": [
120
+ "app-bar",
121
+ "app-bar-actions",
122
+ "app-bar-title"
123
+ ],
124
+ "optionalPeers": [],
125
+ "presets": {
126
+ "values": [
127
+ "app",
128
+ "compact",
129
+ "transparent"
130
+ ],
131
+ "default": "app",
132
+ "intent": {
133
+ "app": "barra normal: fondo propio y filete inferior",
134
+ "compact": "barra baja, para vistas densas o paneles",
135
+ "transparent": "hereda el fondo del lienzo, sin filete: el panel se lee como una sola pieza"
136
+ }
137
+ },
138
+ "notes": [
139
+ "Una por pantalla, arriba del lienzo; `transparent` con lienzo flotante para no partir el panel en dos fondos."
140
+ ]
141
+ },
112
142
  "aspect-ratio": {
113
143
  "import": "orbital-ds/ui/aspect-ratio",
114
144
  "exports": [
@@ -176,6 +206,8 @@
176
206
  ],
177
207
  "slots": [
178
208
  "auth-form",
209
+ "auth-form-access",
210
+ "auth-form-audience",
179
211
  "auth-form-code",
180
212
  "auth-form-field",
181
213
  "auth-form-field-error",
@@ -822,7 +854,9 @@
822
854
  ],
823
855
  "slots": [
824
856
  "content-card",
825
- "content-card-media"
857
+ "content-card-dot",
858
+ "content-card-media",
859
+ "content-card-value"
826
860
  ],
827
861
  "optionalPeers": [],
828
862
  "presets": {
@@ -830,18 +864,22 @@
830
864
  "basic",
831
865
  "feature",
832
866
  "media",
833
- "horizontal"
867
+ "horizontal",
868
+ "metric",
869
+ "status"
834
870
  ],
835
871
  "default": "basic",
836
872
  "intent": {
837
873
  "basic": "título, descripción, contenido y pie",
838
874
  "feature": "icono arriba, título y descripción (una capacidad, un atajo, un paso)",
839
875
  "media": "portada arriba (imagen o vídeo) y texto debajo",
840
- "horizontal": "portada a un lado; apila en un contenedor estrecho (container query)"
876
+ "horizontal": "portada a un lado; apila en un contenedor estrecho (container query)",
877
+ "metric": "un dato grande (`value`, con `delta` opcional) bajo el título: un KPI suelto",
878
+ "status": "una línea con punto de estado (`tone`) y texto: el estado de un sistema o un proceso"
841
879
  }
842
880
  },
843
881
  "notes": [
844
- "Tarjeta de contenido para rejillas: `basic` (texto), `feature` (icono + capacidad), `media` (portada arriba), `horizontal` (portada al lado). El énfasis (`elevated`, `outlined`, `filled`, `ghost`) cambia la prominencia, no la estructura.",
882
+ "Tarjeta de contenido para rejillas: `basic` (texto), `feature` (icono + capacidad), `media` (portada arriba), `horizontal` (portada al lado), `metric` (un dato grande: `value` y `delta`), `status` (punto de estado con `tone` + texto). El énfasis (`elevated`, `outlined`, `filled`, `ghost`) cambia la prominencia, no la estructura.",
845
883
  "Interactiva con `href` (navega) o `onSelect` (acción): toda la tarjeta es el objetivo y el título el enlace; no metas botones dentro de un enlace ni tarjetas dentro de tarjetas. Para filas de entidades usa Item variant=\"card\"; para cifras, Stat.",
846
884
  "Para disponer varias, Mosaic (even · bento · trio)."
847
885
  ]
@@ -1682,6 +1720,30 @@
1682
1720
  "Mientras carga, pinta la forma de lo que vendrá: `list` para filas, `card` para una tarjeta, `table` para una tabla, `detail` para una ficha."
1683
1721
  ]
1684
1722
  },
1723
+ "locale-switcher": {
1724
+ "import": "orbital-ds/ui/locale-switcher",
1725
+ "exports": [
1726
+ "LocaleSwitcher"
1727
+ ],
1728
+ "slots": [
1729
+ "locale-switcher"
1730
+ ],
1731
+ "optionalPeers": [],
1732
+ "presets": {
1733
+ "values": [
1734
+ "compact",
1735
+ "menu"
1736
+ ],
1737
+ "default": "compact",
1738
+ "intent": {
1739
+ "compact": "icono y código corto («ES») en la barra superior; abre un menú con los nombres",
1740
+ "menu": "icono y nombre completo del idioma activo, para zonas con más sitio"
1741
+ }
1742
+ },
1743
+ "notes": [
1744
+ "Siempre visible en la barra superior, junto a ThemeToggle; el nombre de cada idioma se escribe en ese idioma, no traducido."
1745
+ ]
1746
+ },
1685
1747
  "marker": {
1686
1748
  "import": "orbital-ds/ui/marker",
1687
1749
  "exports": [
@@ -1984,6 +2046,8 @@
1984
2046
  "NotificationTabs",
1985
2047
  "NotificationTabsContent",
1986
2048
  "formatRelativeTime",
2049
+ "type NotificationCenterPreset",
2050
+ "type NotificationIndicator",
1987
2051
  "type NotificationState",
1988
2052
  "type NotificationTab",
1989
2053
  "type NotificationTone"
@@ -1992,6 +2056,7 @@
1992
2056
  "notification-actions",
1993
2057
  "notification-center",
1994
2058
  "notification-count",
2059
+ "notification-count-dot",
1995
2060
  "notification-dot",
1996
2061
  "notification-empty",
1997
2062
  "notification-header",
@@ -2011,7 +2076,23 @@
2011
2076
  "notification-trigger",
2012
2077
  "notification-unread"
2013
2078
  ],
2014
- "optionalPeers": []
2079
+ "optionalPeers": [],
2080
+ "presets": {
2081
+ "values": [
2082
+ "count",
2083
+ "dot",
2084
+ "compact"
2085
+ ],
2086
+ "default": "count",
2087
+ "intent": {
2088
+ "count": "contador numérico sobre la campana, panel normal (por defecto)",
2089
+ "dot": "solo un punto: avisos poco frecuentes, barra discreta",
2090
+ "compact": "contador y panel estrecho (--ds-notifications-w-compact): barras bajas, móvil"
2091
+ }
2092
+ },
2093
+ "notes": [
2094
+ "Un solo centro por app, en AppBarActions junto a LocaleSwitcher y ThemeToggle; `dot` si los avisos son raros, `compact` en móvil."
2095
+ ]
2015
2096
  },
2016
2097
  "oauth-consent": {
2017
2098
  "import": "orbital-ds/ui/oauth-consent",
@@ -2523,7 +2604,10 @@
2523
2604
  "SidebarRail",
2524
2605
  "SidebarSeparator",
2525
2606
  "SidebarTrigger",
2607
+ "type SidebarIndicator",
2526
2608
  "type SidebarPreset",
2609
+ "type SidebarSurface",
2610
+ "type SidebarTone",
2527
2611
  "useSidebar"
2528
2612
  ],
2529
2613
  "slots": [
@@ -2566,6 +2650,7 @@
2566
2650
  }
2567
2651
  },
2568
2652
  "notes": [
2653
+ "`glass` solo luce si hay algo detrás (fondo de la app o imagen); en el resto, `floating` o `flat`.",
2569
2654
  "Elige el lateral por intención con `preset`: `app` (dock flotante, raíl de iconos) para un producto; `workspace` (contenido como hoja) para una herramienta de uso diario; `admin` (fijo y denso) para un backoffice con muchos destinos; `focus` (se oculta) para editores, mapas y lienzos. Las props sueltas (variant, collapsible, density) lo ajustan.",
2570
2655
  "Con `collapsible=\"icon\"` cada SidebarMenuButton necesita su icono y su `tooltip`: plegado solo se ve el icono."
2571
2656
  ]
@@ -2931,6 +3016,32 @@
2931
3016
  ],
2932
3017
  "optionalPeers": []
2933
3018
  },
3019
+ "theme-toggle": {
3020
+ "import": "orbital-ds/ui/theme-toggle",
3021
+ "exports": [
3022
+ "ThemeToggle"
3023
+ ],
3024
+ "slots": [
3025
+ "theme-toggle"
3026
+ ],
3027
+ "optionalPeers": [],
3028
+ "presets": {
3029
+ "values": [
3030
+ "icon",
3031
+ "cycle",
3032
+ "segmented"
3033
+ ],
3034
+ "default": "icon",
3035
+ "intent": {
3036
+ "icon": "botón de icono en la barra superior: abre un menú con las tres opciones",
3037
+ "cycle": "botón de icono que pasa de uno a otro al pulsarlo (sin menú)",
3038
+ "segmented": "tres opciones a la vista, para Configuración"
3039
+ }
3040
+ },
3041
+ "notes": [
3042
+ "En la barra superior, `icon` junto a LocaleSwitcher; `segmented` solo donde la persona elige su preferencia con calma (Configuración)."
3043
+ ]
3044
+ },
2934
3045
  "timeline": {
2935
3046
  "import": "orbital-ds/ui/timeline",
2936
3047
  "exports": [
@@ -30,6 +30,11 @@ declare const DsMessagesContext: React.Context<{
30
30
  sidebarToggle: string;
31
31
  sidebarTitle: string;
32
32
  sidebarDescription: string;
33
+ themeToggleLabel: string;
34
+ themeLight: string;
35
+ themeDark: string;
36
+ themeSystem: string;
37
+ localeSwitcherLabel: string;
33
38
  questionnairePrevious: string;
34
39
  questionnaireSkip: string;
35
40
  questionnaireNext: string;
@@ -251,6 +256,10 @@ declare const DsMessagesContext: React.Context<{
251
256
  authSignUpLink: string;
252
257
  authNoAccess: string;
253
258
  authRequestAccessLink: string;
259
+ authAudienceMixed: string;
260
+ authAudienceInternal: string;
261
+ authAccessInternal: string;
262
+ authAccessExternal: string;
254
263
  authHaveAccount: string;
255
264
  authSignInLink: string;
256
265
  authMfaTitle: string;
@@ -7,6 +7,13 @@ type AuthFlowPreset = "standard" | "social" | "passwordless" | "partner" | "ente
7
7
  type AuthAudience = "internal" | "external" | "mixed";
8
8
  type AuthSignUp = "open" | "invite" | "none";
9
9
  type AuthSignInMethod = "password" | "social" | "passkey" | "magic-link" | "email-code" | "sso";
10
+ /** Por qué puerta entra una persona: plantilla de la organización o gente de fuera. */
11
+ type AuthAccessKind = "internal" | "external";
12
+ type AuthAccessRule = {
13
+ methods: AuthSignInMethod[];
14
+ mfaRequired: boolean;
15
+ signUp: AuthSignUp;
16
+ };
10
17
  type AuthFlowConfig = {
11
18
  preset: AuthFlowPreset;
12
19
  /** Para quién es la puerta: plantilla (internal), gente de fuera (external) o las dos (mixed). */
@@ -27,6 +34,11 @@ type AuthFlowConfig = {
27
34
  required: boolean;
28
35
  methods: MfaMethod[];
29
36
  };
37
+ /** Reglas por tipo de persona; lo que falte se deduce del flujo (ver `resolveAuthAccess`). */
38
+ access?: {
39
+ internal?: Partial<AuthAccessRule>;
40
+ external?: Partial<AuthAccessRule>;
41
+ };
30
42
  /** Props de AuthLayout. */
31
43
  layout: {
32
44
  preset?: "centered" | "split" | "cover" | "banner" | "minimal";
@@ -45,15 +57,27 @@ declare const AUTH_FLOW_PRESETS: Record<AuthFlowPreset, FlowDefaults>;
45
57
  declare function defineAuthFlow(preset: AuthFlowPreset, overrides?: Partial<Omit<AuthFlowConfig, "preset">>): AuthFlowConfig;
46
58
  /** ¿Es de la plantilla? Compara el dominio del correo (y sus subdominios) con `internalDomains`. */
47
59
  declare function isInternalIdentifier(flow: Pick<AuthFlowConfig, "internalDomains">, identifier: string): boolean;
60
+ type AccessFlow = Pick<AuthFlowConfig, "audience" | "methods" | "internalDomains" | "signUp" | "mfa" | "access">;
61
+ /** Regla efectiva de cada puerta: lo explícito de `access` manda; el resto se deduce del flujo. */
62
+ declare function authAccessRule(flow: AccessFlow, kind: AuthAccessKind): AuthAccessRule;
63
+ /**
64
+ * ¿Por qué puerta entra este correo y qué se le exigirá? `internal` si el flujo es interno o el dominio es de
65
+ * la plantilla; `external` en el resto. Devuelve la regla de esa puerta y el método con el que seguir.
66
+ */
67
+ declare function resolveAuthAccess(flow: AccessFlow, identifier: string): AuthAccessRule & {
68
+ kind: AuthAccessKind;
69
+ method: AuthSignInMethod;
70
+ };
48
71
  /**
49
72
  * Ruta por defecto para `AuthForm onIdentify`: la plantilla (o una puerta interna) va al SSO; el
50
73
  * resto, al primer método de cuenta propia del flujo. Para dominios de clientes con su propio SSO
51
74
  * (enterprise, partner), la app consulta antes a su proveedor y cae aquí si no lo encuentra.
52
75
  */
53
- declare function routeAuthIdentifier(flow: Pick<AuthFlowConfig, "audience" | "methods" | "internalDomains">, identifier: string): {
76
+ declare function routeAuthIdentifier(flow: Pick<AuthFlowConfig, "audience" | "methods" | "internalDomains"> & Partial<Pick<AuthFlowConfig, "signUp" | "mfa" | "access">>, identifier: string): {
54
77
  method: "password" | "sso" | "passkey" | "email-code" | "magic-link";
78
+ access: AuthAccessKind;
55
79
  };
56
80
  /** Problemas de un flujo (vacío = válido). Mensajes en inglés, como `dsWarn`. */
57
81
  declare function validateAuthFlow(flow: AuthFlowConfig): string[];
58
82
 
59
- export { AUTH_FLOW_PRESETS, type AuthAudience, type AuthFlowConfig, type AuthFlowPreset, type AuthSignInMethod, type AuthSignUp, defineAuthFlow, isInternalIdentifier, routeAuthIdentifier, validateAuthFlow };
83
+ export { AUTH_FLOW_PRESETS, type AuthAccessKind, type AuthAccessRule, type AuthAudience, type AuthFlowConfig, type AuthFlowPreset, type AuthSignInMethod, type AuthSignUp, authAccessRule, defineAuthFlow, isInternalIdentifier, resolveAuthAccess, routeAuthIdentifier, validateAuthFlow };
@@ -84,6 +84,7 @@ function defineAuthFlow(preset, overrides = {}) {
84
84
  ...overrides,
85
85
  preset,
86
86
  mfa: { ...base.mfa, ...overrides.mfa },
87
+ access: { internal: { ...overrides.access?.internal }, external: { ...overrides.access?.external } },
87
88
  layout: { ...base.layout, ...overrides.layout }
88
89
  };
89
90
  }
@@ -95,12 +96,24 @@ function isInternalIdentifier(flow, identifier) {
95
96
  return domain === base || domain.endsWith(`.${base}`);
96
97
  });
97
98
  }
99
+ function authAccessRule(flow, kind) {
100
+ const own = flow.methods.filter((m) => m !== "sso");
101
+ const sso = flow.methods.includes("sso");
102
+ const base = kind === "internal" ? { methods: sso ? ["sso"] : own, mfaRequired: sso ? false : flow.mfa.required, signUp: "none" } : { methods: own.length ? own : flow.methods, mfaRequired: flow.mfa.required, signUp: flow.signUp };
103
+ return { ...base, ...flow.access?.[kind] };
104
+ }
105
+ function resolveAuthAccess(flow, identifier) {
106
+ const kind = flow.audience === "internal" || flow.audience === "mixed" && isInternalIdentifier(flow, identifier) ? "internal" : "external";
107
+ const rule = authAccessRule(flow, kind);
108
+ return { ...rule, kind, method: rule.methods[0] ?? "password" };
109
+ }
98
110
  function routeAuthIdentifier(flow, identifier) {
99
- if (flow.methods.includes("sso") && (flow.audience === "internal" || isInternalIdentifier(flow, identifier))) return { method: "sso" };
100
- const own = flow.methods.find(
111
+ const r = resolveAuthAccess({ signUp: "open", mfa: { required: false, methods: [] }, ...flow }, identifier);
112
+ if (r.methods.includes("sso") && r.kind === "internal") return { method: "sso", access: r.kind };
113
+ const own = r.methods.find(
101
114
  (m) => m === "password" || m === "email-code" || m === "magic-link" || m === "passkey"
102
115
  );
103
- return { method: own ?? "sso" };
116
+ return { method: own ?? "sso", access: r.kind };
104
117
  }
105
118
  function validateAuthFlow(flow) {
106
119
  const issues = [];
@@ -123,13 +136,17 @@ function validateAuthFlow(flow) {
123
136
  if (!flow.internalDomains.length) issues.push("Mixed audience without `internalDomains`: staff cannot be routed to SSO.");
124
137
  if (!flow.identifierFirst) issues.push("Mixed audience works best with identifierFirst: the email decides the door.");
125
138
  }
139
+ if (flow.access?.internal?.signUp && flow.access.internal.signUp !== "none") issues.push('`access.internal.signUp` should be "none": staff accounts come from the directory.');
140
+ if (flow.access?.external?.methods?.includes("sso") && flow.audience !== "external") issues.push('`access.external.methods` with "sso": SSO is the staff door; external SSO goes through `onIdentify` (their own company).');
126
141
  if (flow.audience === "external" && flow.internalDomains.length) issues.push('`internalDomains` on an external audience: use "mixed" if staff also sign in here.');
127
142
  return issues;
128
143
  }
129
144
  export {
130
145
  AUTH_FLOW_PRESETS,
146
+ authAccessRule,
131
147
  defineAuthFlow,
132
148
  isInternalIdentifier,
149
+ resolveAuthAccess,
133
150
  routeAuthIdentifier,
134
151
  validateAuthFlow
135
152
  };
@@ -0,0 +1,4 @@
1
+ type HeaderControlTone = "neutral" | "brand" | "soft";
2
+ declare function headerControlClass(tone?: HeaderControlTone): string;
3
+
4
+ export { type HeaderControlTone, headerControlClass };
@@ -0,0 +1,14 @@
1
+ const TONES = {
2
+ neutral: "",
3
+ brand: "[--ds-header-control-fg:var(--ds-header-control-brand-fg)] [--ds-header-control-bg:var(--ds-header-control-brand-bg)] [--ds-header-control-hover-bg:var(--ds-header-control-brand-hover-bg)]",
4
+ soft: "[--ds-header-control-bg:var(--muted)]"
5
+ };
6
+ function headerControlClass(tone = "neutral") {
7
+ return [
8
+ "rounded-(--ds-header-control-radius) bg-(--ds-header-control-bg) text-(--ds-header-control-fg) hover:bg-(--ds-header-control-hover-bg) aria-expanded:bg-(--ds-header-control-hover-bg) active:bg-(--ds-header-control-active-bg)",
9
+ TONES[tone]
10
+ ].join(" ");
11
+ }
12
+ export {
13
+ headerControlClass
14
+ };
@@ -29,6 +29,11 @@ declare const en: {
29
29
  sidebarToggle: string;
30
30
  sidebarTitle: string;
31
31
  sidebarDescription: string;
32
+ themeToggleLabel: string;
33
+ themeLight: string;
34
+ themeDark: string;
35
+ themeSystem: string;
36
+ localeSwitcherLabel: string;
32
37
  questionnairePrevious: string;
33
38
  questionnaireSkip: string;
34
39
  questionnaireNext: string;
@@ -250,6 +255,10 @@ declare const en: {
250
255
  authSignUpLink: string;
251
256
  authNoAccess: string;
252
257
  authRequestAccessLink: string;
258
+ authAudienceMixed: string;
259
+ authAudienceInternal: string;
260
+ authAccessInternal: string;
261
+ authAccessExternal: string;
253
262
  authHaveAccount: string;
254
263
  authSignInLink: string;
255
264
  authMfaTitle: string;
package/dist/lib/i18n.js CHANGED
@@ -28,6 +28,11 @@ const en = {
28
28
  sidebarToggle: "Toggle sidebar",
29
29
  sidebarTitle: "Sidebar",
30
30
  sidebarDescription: "Displays the mobile sidebar.",
31
+ themeToggleLabel: "Theme",
32
+ themeLight: "Light",
33
+ themeDark: "Dark",
34
+ themeSystem: "System",
35
+ localeSwitcherLabel: "Language",
31
36
  questionnairePrevious: "Previous",
32
37
  questionnaireSkip: "Skip",
33
38
  questionnaireNext: "Next",
@@ -250,6 +255,10 @@ const en = {
250
255
  authSignUpLink: "Sign up",
251
256
  authNoAccess: "Need access?",
252
257
  authRequestAccessLink: "Request it",
258
+ authAudienceMixed: "Staff: enter your work email and we will take you to single sign-on. External users: use your own account.",
259
+ authAudienceInternal: "Access for the organization's staff, with their work account (single sign-on).",
260
+ authAccessInternal: "Staff",
261
+ authAccessExternal: "External",
253
262
  authHaveAccount: "Already have an account?",
254
263
  authSignInLink: "Sign in",
255
264
  authMfaTitle: "Two-step verification",
@@ -400,6 +409,11 @@ const es = {
400
409
  sidebarToggle: "Mostrar u ocultar el lateral",
401
410
  sidebarTitle: "Lateral",
402
411
  sidebarDescription: "Muestra el lateral en el m\xF3vil.",
412
+ themeToggleLabel: "Tema",
413
+ themeLight: "Claro",
414
+ themeDark: "Oscuro",
415
+ themeSystem: "Sistema",
416
+ localeSwitcherLabel: "Idioma",
403
417
  questionnairePrevious: "Anterior",
404
418
  questionnaireSkip: "Omitir",
405
419
  questionnaireNext: "Siguiente",
@@ -622,6 +636,10 @@ const es = {
622
636
  authSignUpLink: "Reg\xEDstrate",
623
637
  authNoAccess: "\xBFNo tienes acceso?",
624
638
  authRequestAccessLink: "Solic\xEDtalo",
639
+ authAudienceMixed: "Personal de la organizaci\xF3n: escribe tu correo de trabajo y te llevamos al SSO. Personas externas: usa tu propia cuenta.",
640
+ authAudienceInternal: "Acceso para el personal de la organizaci\xF3n, con su cuenta de trabajo (SSO).",
641
+ authAccessInternal: "Personal",
642
+ authAccessExternal: "Externo",
625
643
  authHaveAccount: "\xBFYa tienes cuenta?",
626
644
  authSignInLink: "Inicia sesi\xF3n",
627
645
  authMfaTitle: "Verificaci\xF3n en dos pasos",
@@ -772,6 +790,11 @@ const ptBR = {
772
790
  sidebarToggle: "Mostrar ou ocultar a barra lateral",
773
791
  sidebarTitle: "Barra lateral",
774
792
  sidebarDescription: "Mostra a barra lateral no celular.",
793
+ themeToggleLabel: "Tema",
794
+ themeLight: "Claro",
795
+ themeDark: "Escuro",
796
+ themeSystem: "Sistema",
797
+ localeSwitcherLabel: "Idioma",
775
798
  questionnairePrevious: "Anterior",
776
799
  questionnaireSkip: "Pular",
777
800
  questionnaireNext: "Pr\xF3xima",
@@ -994,6 +1017,10 @@ const ptBR = {
994
1017
  authSignUpLink: "Cadastre-se",
995
1018
  authNoAccess: "N\xE3o tem acesso?",
996
1019
  authRequestAccessLink: "Solicite",
1020
+ authAudienceMixed: "Equipe da organiza\xE7\xE3o: informe seu e-mail de trabalho e levaremos voc\xEA ao SSO. Pessoas externas: use sua pr\xF3pria conta.",
1021
+ authAudienceInternal: "Acesso para a equipe da organiza\xE7\xE3o, com a conta de trabalho (SSO).",
1022
+ authAccessInternal: "Equipe",
1023
+ authAccessExternal: "Externo",
997
1024
  authHaveAccount: "J\xE1 tem uma conta?",
998
1025
  authSignInLink: "Entrar",
999
1026
  authMfaTitle: "Verifica\xE7\xE3o em duas etapas",
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ type AppBarPreset = "app" | "compact" | "transparent";
4
+ declare function AppBar({ preset, className, ...props }: React.ComponentProps<"header"> & {
5
+ preset?: AppBarPreset;
6
+ }): React.JSX.Element;
7
+ declare function AppBarTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
8
+ declare function AppBarActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
9
+
10
+ export { AppBar, AppBarActions, type AppBarPreset, AppBarTitle };
@@ -0,0 +1,51 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ const APPBAR_PRESETS = {
4
+ app: "",
5
+ compact: "[--ds-appbar-h:var(--ds-appbar-h-compact)]",
6
+ transparent: "[--ds-appbar-bg:transparent] [--ds-appbar-border:transparent]"
7
+ };
8
+ function AppBar({
9
+ preset = "app",
10
+ className,
11
+ ...props
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ "header",
15
+ {
16
+ "data-slot": "app-bar",
17
+ "data-preset": preset,
18
+ className: cn(
19
+ "flex h-(--ds-appbar-h) shrink-0 items-center gap-(--ds-appbar-gap) border-b border-(--ds-appbar-border) bg-(--ds-appbar-bg) px-(--ds-appbar-px)",
20
+ APPBAR_PRESETS[preset],
21
+ className
22
+ ),
23
+ ...props
24
+ }
25
+ );
26
+ }
27
+ function AppBarTitle({ className, ...props }) {
28
+ return /* @__PURE__ */ jsx(
29
+ "div",
30
+ {
31
+ "data-slot": "app-bar-title",
32
+ className: cn("min-w-0 flex-1 truncate text-sm font-(--ds-title-weight)", className),
33
+ ...props
34
+ }
35
+ );
36
+ }
37
+ function AppBarActions({ className, ...props }) {
38
+ return /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ "data-slot": "app-bar-actions",
42
+ className: cn("ms-auto flex shrink-0 items-center gap-(--ds-appbar-gap)", className),
43
+ ...props
44
+ }
45
+ );
46
+ }
47
+ export {
48
+ AppBar,
49
+ AppBarActions,
50
+ AppBarTitle
51
+ };
@@ -5,7 +5,7 @@ import { cva } from "class-variance-authority";
5
5
  import { cn } from "../lib/utils.js";
6
6
  import { Button } from "./button.js";
7
7
  const attachmentVariants = cva(
8
- "group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-chip border bg-card text-card-foreground transition-colors duration-(--ds-motion-snap) focus-within:ring-(length:--ds-ring-width) focus-within:ring-(--ds-ring-color) has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-danger/30 data-[state=idle]:border-dashed",
8
+ "group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-chip border bg-card text-card-foreground transition-colors duration-(--ds-motion-snap) focus-within:ring-(length:--ds-ring-width) focus-within:ring-(--ds-ring-color) has-[>a,>button]:hover:bg-(--ds-row-hover) data-[state=error]:border-danger/30 data-[state=idle]:border-dashed",
9
9
  {
10
10
  variants: {
11
11
  size: {
@@ -30,11 +30,13 @@ type AuthResult = void | undefined | {
30
30
  /** Ruta que decide la app para un identificador (home realm discovery). */
31
31
  type AuthRoute = void | undefined | {
32
32
  method: "password" | "sso" | "passkey" | "email-code" | "magic-link";
33
+ /** Puerta por la que entra: plantilla o gente de fuera (se muestra junto al correo). */
34
+ access?: "internal" | "external";
33
35
  /** SSO con varias organizaciones para el mismo dominio: se deja elegir. */
34
36
  organizations?: AuthOrganization[];
35
37
  error?: AuthMessage;
36
38
  };
37
- declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
39
+ declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, audience, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
38
40
  preset?: AuthFormPreset;
39
41
  title?: React.ReactNode;
40
42
  description?: React.ReactNode;
@@ -47,6 +49,8 @@ declare function AuthForm({ preset, title, description, icon, identifier, defaul
47
49
  identifierFirst?: boolean;
48
50
  /** Home realm discovery: la app dice qué método le toca a ese identificador. */
49
51
  onIdentify?: (identifier: string) => AuthRoute | Promise<AuthRoute>;
52
+ /** Quién puede entrar: explica en pantalla, antes de escribir el correo, qué puerta le toca a cada persona. */
53
+ audience?: "internal" | "external" | "mixed";
50
54
  /** Campos y orden (sign-up y reset-password). */
51
55
  fields?: AuthField[];
52
56
  /** Campos propios de la app, antes del botón (llegan en `formData`). */
@@ -44,6 +44,7 @@ function AuthForm({
44
44
  defaultIdentifier = "",
45
45
  identifierFirst,
46
46
  onIdentify,
47
+ audience,
47
48
  fields,
48
49
  extraFields,
49
50
  passwordRules,
@@ -73,6 +74,7 @@ function AuthForm({
73
74
  const t = useDsMessages();
74
75
  const d = PRESETS[preset];
75
76
  const list = fields ?? d.fields;
77
+ const [accessKind, setAccessKind] = React.useState(null);
76
78
  const stepFirst = preset === "sign-in" && (identifierFirst ?? d.identifierFirst);
77
79
  const strength = showStrength ?? d.strength;
78
80
  const uid = React.useId();
@@ -176,6 +178,7 @@ function AuthForm({
176
178
  const route = await run("identify", () => onIdentify(values.identifier.trim()));
177
179
  if (!route) return go("password");
178
180
  if (route.error) return setError(route.error);
181
+ setAccessKind(route.access ?? null);
179
182
  if (route.method === "sso") {
180
183
  if (route.organizations && route.organizations.length > 1) {
181
184
  setOrganizations(route.organizations);
@@ -474,9 +477,11 @@ function AuthForm({
474
477
  /* @__PURE__ */ jsx(AuthError, { error: shownError }),
475
478
  view === "password" ? /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form-identity", className: "flex items-center justify-between gap-2 rounded-(--ds-auth-radius) border border-(--ds-auth-border) px-3 py-2 text-sm", children: [
476
479
  /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: email }),
480
+ accessKind ? /* @__PURE__ */ jsx("span", { "data-slot": "auth-form-access", "data-access": accessKind, className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground", children: accessKind === "internal" ? t.authAccessInternal : t.authAccessExternal }) : null,
477
481
  /* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", onClick: () => go("form"), children: t.authChange }),
478
482
  /* @__PURE__ */ jsx("input", { type: "hidden", name: "username", autoComplete: "username", value: email })
479
483
  ] }) : null,
484
+ audience && audience !== "external" && stepFirst && view === "form" ? /* @__PURE__ */ jsx("p", { "data-slot": "auth-form-audience", "data-audience": audience, className: "rounded-(--ds-auth-radius) bg-muted px-3 py-2 text-xs text-pretty text-muted-foreground", children: audience === "mixed" ? t.authAudienceMixed : t.authAudienceInternal }) : null,
480
485
  visibleFields.map(renderField),
481
486
  !ssoView && extraFields && !(stepFirst && view === "form") ? extraFields : null,
482
487
  remember && preset === "sign-in" && !(stepFirst && view === "form") ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
package/dist/ui/badge.js CHANGED
@@ -10,8 +10,8 @@ const badgeVariants = cva(
10
10
  default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
11
11
  secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
12
12
  destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
13
- outline: "border-border bg-(--ds-field-bg) text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
14
- ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
13
+ outline: "border-border bg-(--ds-field-bg) text-foreground [a]:hover:bg-(--ds-hover-bg) [a]:hover:text-muted-foreground",
14
+ ghost: "hover:bg-(--ds-hover-bg) hover:text-muted-foreground",
15
15
  link: "text-primary underline-offset-4 hover:underline",
16
16
  // Estados: etiqueta suave con el texto del estado o, con --ds-on-soft, en tinta (AA comprobado por check:ds).
17
17
  info: "bg-info-soft text-[color:var(--ds-on-soft,var(--info))]",
package/dist/ui/button.js CHANGED
@@ -10,7 +10,7 @@ const buttonVariants = cva(
10
10
  default: "bg-primary text-primary-foreground hover:bg-(--ds-button-primary-hover) hover:text-(--ds-button-primary-hover-fg) disabled:bg-[color:var(--ds-button-disabled-bg,var(--primary))] disabled:text-[color:var(--ds-button-disabled-fg,var(--primary-foreground))]",
11
11
  outline: "border-(--ds-button-outline-border) bg-(--ds-button-outline-bg) text-(--ds-button-outline-fg) hover:bg-(--ds-field-bg-hover) hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground disabled:bg-[color:var(--ds-button-disabled-bg,var(--ds-button-outline-bg))] disabled:text-[color:var(--ds-button-disabled-fg,var(--ds-button-outline-fg))] disabled:border-[color:var(--ds-button-disabled-border,var(--ds-button-outline-border))]",
12
12
  secondary: "border-(--ds-button-secondary-border) bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground disabled:bg-[color:var(--ds-button-disabled-bg,var(--secondary))] disabled:text-[color:var(--ds-button-disabled-fg,var(--secondary-foreground))] disabled:border-[color:var(--ds-button-disabled-border,var(--ds-button-secondary-border))]",
13
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 disabled:bg-[color:var(--ds-button-disabled-bg,transparent)] disabled:text-[color:var(--ds-button-disabled-fg,currentColor)]",
13
+ ghost: "hover:bg-(--ds-hover-bg) hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground disabled:bg-[color:var(--ds-button-disabled-bg,transparent)] disabled:text-[color:var(--ds-button-disabled-fg,currentColor)]",
14
14
  destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40 disabled:bg-[color:var(--ds-button-disabled-bg,color-mix(in_oklab,var(--destructive)_10%,transparent))] disabled:text-[color:var(--ds-button-disabled-fg,var(--destructive))] dark:disabled:bg-[color:var(--ds-button-disabled-bg,color-mix(in_oklab,var(--destructive)_20%,transparent))]",
15
15
  cta: "bg-[color:var(--ds-cta-bg,var(--primary))] text-[color:var(--ds-cta-fg,var(--primary-foreground))] hover:bg-[color:var(--ds-cta-hover,var(--ds-cta-bg,var(--primary)))] disabled:bg-[color:var(--ds-button-disabled-bg,var(--ds-cta-bg,var(--primary)))] disabled:text-[color:var(--ds-button-disabled-fg,var(--ds-cta-fg,var(--primary-foreground)))]",
16
16
  link: "text-primary underline-offset-4 hover:underline disabled:bg-[color:var(--ds-button-disabled-bg,transparent)] disabled:text-[color:var(--ds-button-disabled-fg,var(--primary))]"