@octavius2929-personal/design-system 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/dm-serif-display-latin-ext-italic-400-QUYR73UK.woff2 +0 -0
- package/dist/dm-serif-display-latin-ext-normal-400-GP44XTZK.woff2 +0 -0
- package/dist/dm-serif-display-latin-italic-400-NM54ELTO.woff2 +0 -0
- package/dist/dm-serif-display-latin-normal-400-DCCDLJOI.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-ext-normal-400-T6XOR2FX.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-ext-normal-500-LJE4XY22.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-ext-normal-600-IEJYURAG.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-normal-400-A2WATXFY.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-normal-500-33HAQIPI.woff2 +0 -0
- package/dist/ibm-plex-mono-latin-normal-600-IIV3OB4N.woff2 +0 -0
- package/dist/index.cjs +80 -18
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +888 -746
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +644 -6
- package/dist/index.d.ts +644 -6
- package/dist/index.js +88 -27
- package/dist/index.js.map +1 -0
- package/dist/newsreader-latin-ext-italic-400-500-6IPSRR6F.woff2 +0 -0
- package/dist/newsreader-latin-ext-normal-300-600-HJH6YDA4.woff2 +0 -0
- package/dist/newsreader-latin-italic-400-500-ZC4QAWU3.woff2 +0 -0
- package/dist/newsreader-latin-normal-300-600-J4KAOEDO.woff2 +0 -0
- package/dist/unifraktur-maguntia-latin-normal-400-TOQBJZN4.woff2 +0 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
Librería de componentes **React** con estilos en TypeScript (vanilla-extract). Generada con `@octavius2929-personal/scaffold-generator`.
|
|
4
4
|
|
|
5
|
+
## Instalación
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @octavius2929-personal/design-system
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`react` y `react-dom` son **peer dependencies** (`>=18`): asegurate de tenerlos instalados en tu app.
|
|
12
|
+
|
|
13
|
+
## Uso
|
|
14
|
+
|
|
15
|
+
1. Importá el CSS **una sola vez** (en el entrypoint de tu app, p. ej. `main.tsx`):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import "@octavius2929-personal/design-system/styles.css";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Envolvé tu app con `ThemeProvider` y usá los componentes:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { ThemeProvider, Button } from "@octavius2929-personal/design-system";
|
|
25
|
+
|
|
26
|
+
export function App() {
|
|
27
|
+
return (
|
|
28
|
+
<ThemeProvider defaultSchema="tinta" defaultMode="light">
|
|
29
|
+
<Button variant="filled" tone="accent" size="md" onClick={() => alert("¡Hola!")}>
|
|
30
|
+
Continuar
|
|
31
|
+
</Button>
|
|
32
|
+
</ThemeProvider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`ThemeProvider` es **opcional**: sin él los componentes usan el schema `tinta` en modo `light` (las vars de `:root`).
|
|
38
|
+
|
|
39
|
+
3. Para cambiar el schema (paleta) o el modo en runtime, usá `useTheme()` desde un componente dentro del provider:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { useTheme, schemaNames } from "@octavius2929-personal/design-system";
|
|
43
|
+
|
|
44
|
+
function ThemeSwitch() {
|
|
45
|
+
const { schema, mode, setSchema, toggleMode } = useTheme();
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<select value={schema} onChange={(e) => setSchema(e.target.value as typeof schema)}>
|
|
49
|
+
{schemaNames.map((name) => (
|
|
50
|
+
<option key={name} value={name}>
|
|
51
|
+
{name}
|
|
52
|
+
</option>
|
|
53
|
+
))}
|
|
54
|
+
</select>
|
|
55
|
+
<button type="button" onClick={toggleMode}>
|
|
56
|
+
Modo: {mode}
|
|
57
|
+
</button>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Los componentes toman el tema activo solos (no hace falta un wrapper con clase). La lista de paletas disponibles está en el export `schemaNames`.
|
|
64
|
+
|
|
5
65
|
## Comandos
|
|
6
66
|
|
|
7
67
|
| Comando | Qué hace |
|
|
@@ -51,3 +111,7 @@ El ejemplo (`Button` + `useToggle`) es demostrativo — reemplazalo por tus comp
|
|
|
51
111
|
1. Ajustá `name`, `version` y `description` en `package.json`.
|
|
52
112
|
2. `npm run build` genera `dist/` (incluye `index.css`).
|
|
53
113
|
3. `npm publish` (el campo `files` ya limita el tarball a `dist/`). Recordales a los consumidores importar `<pkg>/styles.css`.
|
|
114
|
+
|
|
115
|
+
## Versionado
|
|
116
|
+
|
|
117
|
+
El versionado es **semántico** (SemVer) y se deriva automáticamente de los [conventional commits](https://www.conventionalcommits.org/). Las versiones y el changelog de cada release viven en los **[GitHub Releases](https://github.com/proyectos-octavio/design-system/releases)** del repositorio — no hay `CHANGELOG.md` en el árbol del proyecto porque el proceso de release no commitea de vuelta.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
Tooltip: () => Tooltip,
|
|
65
65
|
TriangleAlertIcon: () => TriangleAlertIcon,
|
|
66
66
|
XIcon: () => XIcon,
|
|
67
|
+
colorVars: () => colorVars,
|
|
67
68
|
modeNames: () => modeNames,
|
|
68
69
|
schemaNames: () => schemaNames,
|
|
69
70
|
text: () => text,
|
|
@@ -76,10 +77,11 @@ __export(index_exports, {
|
|
|
76
77
|
module.exports = __toCommonJS(index_exports);
|
|
77
78
|
|
|
78
79
|
// src/theme/theme.css.ts
|
|
80
|
+
var colorVars = { bg1: "var(--bg1__e3grur2c)", bg2: "var(--bg2__e3grur2d)", bg3: "var(--bg3__e3grur2e)", bgInset: "var(--bgInset__e3grur2f)", fg1: "var(--fg1__e3grur2g)", fg2: "var(--fg2__e3grur2h)", fg3: "var(--fg3__e3grur2i)", fgOnAccent: "var(--fgOnAccent__e3grur2j)", border1: "var(--border1__e3grur2k)", border2: "var(--border2__e3grur2l)", borderStrong: "var(--borderStrong__e3grur2m)", accent: "var(--accent__e3grur2n)", accentHover: "var(--accentHover__e3grur2o)", accentSoft: "var(--accentSoft__e3grur2p)", ok: "var(--ok__e3grur2q)", warn: "var(--warn__e3grur2r)", danger: "var(--danger__e3grur2s)", info: "var(--info__e3grur2t)", focus: "var(--focus__e3grur2u)", scrim: "var(--scrim__e3grur2v)" };
|
|
79
81
|
var modeNames = ["light", "dark", "sepia", "contrast"];
|
|
80
82
|
var schemaNames = ["tinta"];
|
|
81
|
-
var themes = { tinta: { light: "
|
|
82
|
-
var vars = { font: { display: "var(--font-display__e3grur0)", text: "var(--font-text__e3grur1)", mono: "var(--font-mono__e3grur2)", black: "var(--font-black__e3grur3)" }, text: { eyebrow: { size: "var(--text-eyebrow-size__e3grur4)", lineHeight: "var(--text-eyebrow-lineHeight__e3grur5)", weight: "var(--text-eyebrow-weight__e3grur6)", letterSpacing: "var(--text-eyebrow-letterSpacing__e3grur7)" }, display: { size: "var(--text-display-size__e3grur8)", lineHeight: "var(--text-display-lineHeight__e3grur9)", weight: "var(--text-display-weight__e3grura)", letterSpacing: "var(--text-display-letterSpacing__e3grurb)" }, h1: { size: "var(--text-h1-size__e3grurc)", lineHeight: "var(--text-h1-lineHeight__e3grurd)", weight: "var(--text-h1-weight__e3grure)", letterSpacing: "var(--text-h1-letterSpacing__e3grurf)" }, h2: { size: "var(--text-h2-size__e3grurg)", lineHeight: "var(--text-h2-lineHeight__e3grurh)", weight: "var(--text-h2-weight__e3gruri)", letterSpacing: "var(--text-h2-letterSpacing__e3grurj)" }, h3: { size: "var(--text-h3-size__e3grurk)", lineHeight: "var(--text-h3-lineHeight__e3grurl)", weight: "var(--text-h3-weight__e3grurm)", letterSpacing: "var(--text-h3-letterSpacing__e3grurn)" }, h4: { size: "var(--text-h4-size__e3gruro)", lineHeight: "var(--text-h4-lineHeight__e3grurp)", weight: "var(--text-h4-weight__e3grurq)", letterSpacing: "var(--text-h4-letterSpacing__e3grurr)" }, body: { size: "var(--text-body-size__e3grurs)", lineHeight: "var(--text-body-lineHeight__e3grurt)", weight: "var(--text-body-weight__e3gruru)", letterSpacing: "var(--text-body-letterSpacing__e3grurv)" }, lead: { size: "var(--text-lead-size__e3grurw)", lineHeight: "var(--text-lead-lineHeight__e3grurx)", weight: "var(--text-lead-weight__e3grury)", letterSpacing: "var(--text-lead-letterSpacing__e3grurz)" }, small: { size: "var(--text-small-size__e3grur10)", lineHeight: "var(--text-small-lineHeight__e3grur11)", weight: "var(--text-small-weight__e3grur12)", letterSpacing: "var(--text-small-letterSpacing__e3grur13)" }, caption: { size: "var(--text-caption-size__e3grur14)", lineHeight: "var(--text-caption-lineHeight__e3grur15)", weight: "var(--text-caption-weight__e3grur16)", letterSpacing: "var(--text-caption-letterSpacing__e3grur17)" } }, space: { none: "var(--space-none__e3grur18)", xs: "var(--space-xs__e3grur19)", sm: "var(--space-sm__e3grur1a)", md: "var(--space-md__e3grur1b)", lg: "var(--space-lg__e3grur1c)", xl: "var(--space-xl__e3grur1d)", "2xl": "var(--space-2xl__e3grur1e)", "3xl": "var(--space-3xl__e3grur1f)", "4xl": "var(--space-4xl__e3grur1g)", "5xl": "var(--space-5xl__e3grur1h)" }, radius: { none: "var(--radius-none__e3grur1i)", sm: "var(--radius-sm__e3grur1j)", md: "var(--radius-md__e3grur1k)", lg: "var(--radius-lg__e3grur1l)", base: "var(--radius-base__e3grur1m)", full: "var(--radius-full__e3grur1n)" }, border: { hair: "var(--border-hair__e3grur1o)", rule: "var(--border-rule__e3grur1p)", heavy: "var(--border-heavy__e3grur1q)" }, tracking: { tight: "var(--tracking-tight__e3grur1r)", normal: "var(--tracking-normal__e3grur1s)", wide: "var(--tracking-wide__e3grur1t)", wider: "var(--tracking-wider__e3grur1u)", widest: "var(--tracking-widest__e3grur1v)" }, leading: { tight: "var(--leading-tight__e3grur1w)", snug: "var(--leading-snug__e3grur1x)", normal: "var(--leading-normal__e3grur1y)", relaxed: "var(--leading-relaxed__e3grur1z)" }, weight: { light: "var(--weight-light__e3grur20)", regular: "var(--weight-regular__e3grur21)", medium: "var(--weight-medium__e3grur22)", semibold: "var(--weight-semibold__e3grur23)", bold: "var(--weight-bold__e3grur24)" }, dur: { fast: "var(--dur-fast__e3grur25)", base: "var(--dur-base__e3grur26)", slow: "var(--dur-slow__e3grur27)" }, ease: { ink: "var(--ease-ink__e3grur28)" }, shadow: { sm: "var(--shadow-sm__e3grur29)", md: "var(--shadow-md__e3grur2a)", lg: "var(--shadow-lg__e3grur2b)" }, color:
|
|
83
|
+
var themes = { tinta: { light: "theme_themes_tinta_light__e3grur2w", dark: "theme_themes_tinta_dark__e3grur2x", sepia: "theme_themes_tinta_sepia__e3grur2y", contrast: "theme_themes_tinta_contrast__e3grur2z" } };
|
|
84
|
+
var vars = { font: { display: "var(--font-display__e3grur0)", text: "var(--font-text__e3grur1)", mono: "var(--font-mono__e3grur2)", black: "var(--font-black__e3grur3)" }, text: { eyebrow: { size: "var(--text-eyebrow-size__e3grur4)", lineHeight: "var(--text-eyebrow-lineHeight__e3grur5)", weight: "var(--text-eyebrow-weight__e3grur6)", letterSpacing: "var(--text-eyebrow-letterSpacing__e3grur7)" }, display: { size: "var(--text-display-size__e3grur8)", lineHeight: "var(--text-display-lineHeight__e3grur9)", weight: "var(--text-display-weight__e3grura)", letterSpacing: "var(--text-display-letterSpacing__e3grurb)" }, h1: { size: "var(--text-h1-size__e3grurc)", lineHeight: "var(--text-h1-lineHeight__e3grurd)", weight: "var(--text-h1-weight__e3grure)", letterSpacing: "var(--text-h1-letterSpacing__e3grurf)" }, h2: { size: "var(--text-h2-size__e3grurg)", lineHeight: "var(--text-h2-lineHeight__e3grurh)", weight: "var(--text-h2-weight__e3gruri)", letterSpacing: "var(--text-h2-letterSpacing__e3grurj)" }, h3: { size: "var(--text-h3-size__e3grurk)", lineHeight: "var(--text-h3-lineHeight__e3grurl)", weight: "var(--text-h3-weight__e3grurm)", letterSpacing: "var(--text-h3-letterSpacing__e3grurn)" }, h4: { size: "var(--text-h4-size__e3gruro)", lineHeight: "var(--text-h4-lineHeight__e3grurp)", weight: "var(--text-h4-weight__e3grurq)", letterSpacing: "var(--text-h4-letterSpacing__e3grurr)" }, body: { size: "var(--text-body-size__e3grurs)", lineHeight: "var(--text-body-lineHeight__e3grurt)", weight: "var(--text-body-weight__e3gruru)", letterSpacing: "var(--text-body-letterSpacing__e3grurv)" }, lead: { size: "var(--text-lead-size__e3grurw)", lineHeight: "var(--text-lead-lineHeight__e3grurx)", weight: "var(--text-lead-weight__e3grury)", letterSpacing: "var(--text-lead-letterSpacing__e3grurz)" }, small: { size: "var(--text-small-size__e3grur10)", lineHeight: "var(--text-small-lineHeight__e3grur11)", weight: "var(--text-small-weight__e3grur12)", letterSpacing: "var(--text-small-letterSpacing__e3grur13)" }, caption: { size: "var(--text-caption-size__e3grur14)", lineHeight: "var(--text-caption-lineHeight__e3grur15)", weight: "var(--text-caption-weight__e3grur16)", letterSpacing: "var(--text-caption-letterSpacing__e3grur17)" } }, space: { none: "var(--space-none__e3grur18)", xs: "var(--space-xs__e3grur19)", sm: "var(--space-sm__e3grur1a)", md: "var(--space-md__e3grur1b)", lg: "var(--space-lg__e3grur1c)", xl: "var(--space-xl__e3grur1d)", "2xl": "var(--space-2xl__e3grur1e)", "3xl": "var(--space-3xl__e3grur1f)", "4xl": "var(--space-4xl__e3grur1g)", "5xl": "var(--space-5xl__e3grur1h)" }, radius: { none: "var(--radius-none__e3grur1i)", sm: "var(--radius-sm__e3grur1j)", md: "var(--radius-md__e3grur1k)", lg: "var(--radius-lg__e3grur1l)", base: "var(--radius-base__e3grur1m)", full: "var(--radius-full__e3grur1n)" }, border: { hair: "var(--border-hair__e3grur1o)", rule: "var(--border-rule__e3grur1p)", heavy: "var(--border-heavy__e3grur1q)" }, tracking: { tight: "var(--tracking-tight__e3grur1r)", normal: "var(--tracking-normal__e3grur1s)", wide: "var(--tracking-wide__e3grur1t)", wider: "var(--tracking-wider__e3grur1u)", widest: "var(--tracking-widest__e3grur1v)" }, leading: { tight: "var(--leading-tight__e3grur1w)", snug: "var(--leading-snug__e3grur1x)", normal: "var(--leading-normal__e3grur1y)", relaxed: "var(--leading-relaxed__e3grur1z)" }, weight: { light: "var(--weight-light__e3grur20)", regular: "var(--weight-regular__e3grur21)", medium: "var(--weight-medium__e3grur22)", semibold: "var(--weight-semibold__e3grur23)", bold: "var(--weight-bold__e3grur24)" }, dur: { fast: "var(--dur-fast__e3grur25)", base: "var(--dur-base__e3grur26)", slow: "var(--dur-slow__e3grur27)" }, ease: { ink: "var(--ease-ink__e3grur28)" }, shadow: { sm: "var(--shadow-sm__e3grur29)", md: "var(--shadow-md__e3grur2a)", lg: "var(--shadow-lg__e3grur2b)" }, color: colorVars };
|
|
83
85
|
|
|
84
86
|
// src/hooks/use-previous/index.ts
|
|
85
87
|
var import_react = require("react");
|
|
@@ -110,29 +112,79 @@ var noop = () => {
|
|
|
110
112
|
var DEFAULT_VALUE = {
|
|
111
113
|
schema: "tinta",
|
|
112
114
|
mode: "light",
|
|
115
|
+
preference: "light",
|
|
113
116
|
themeClass: themes.tinta.light,
|
|
114
117
|
setSchema: noop,
|
|
115
118
|
setMode: noop,
|
|
116
|
-
toggleMode: noop
|
|
119
|
+
toggleMode: noop,
|
|
120
|
+
cycleMode: noop
|
|
117
121
|
};
|
|
118
122
|
var ThemeContext = (0, import_react3.createContext)(null);
|
|
123
|
+
function resolveSystemMode() {
|
|
124
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return "light";
|
|
125
|
+
if (window.matchMedia("(prefers-contrast: more)").matches) return "contrast";
|
|
126
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
|
|
127
|
+
return "light";
|
|
128
|
+
}
|
|
129
|
+
function readStored(key) {
|
|
130
|
+
if (typeof window === "undefined") return null;
|
|
131
|
+
try {
|
|
132
|
+
const raw = window.localStorage.getItem(key);
|
|
133
|
+
return raw ? JSON.parse(raw) : null;
|
|
134
|
+
} catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function writeStored(key, value) {
|
|
139
|
+
if (typeof window === "undefined") return;
|
|
140
|
+
try {
|
|
141
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
}
|
|
119
145
|
function ThemeProvider({
|
|
120
146
|
children,
|
|
121
147
|
defaultSchema = "tinta",
|
|
122
|
-
defaultMode = "light"
|
|
148
|
+
defaultMode = "light",
|
|
149
|
+
storageKey = "ds-theme",
|
|
150
|
+
persist = true
|
|
123
151
|
}) {
|
|
124
|
-
const [schema, setSchema] = (0, import_react3.useState)(
|
|
125
|
-
|
|
152
|
+
const [schema, setSchema] = (0, import_react3.useState)(
|
|
153
|
+
() => persist && readStored(storageKey)?.schema || defaultSchema
|
|
154
|
+
);
|
|
155
|
+
const [preference, setPreference] = (0, import_react3.useState)(
|
|
156
|
+
() => (persist ? readStored(storageKey)?.preference : null) ?? defaultMode
|
|
157
|
+
);
|
|
158
|
+
const [systemMode, setSystemMode] = (0, import_react3.useState)(resolveSystemMode);
|
|
159
|
+
(0, import_react3.useEffect)(() => {
|
|
160
|
+
if (preference !== "system") return;
|
|
161
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
162
|
+
const mqls = ["(prefers-contrast: more)", "(prefers-color-scheme: dark)"].map(
|
|
163
|
+
(q) => window.matchMedia(q)
|
|
164
|
+
);
|
|
165
|
+
const onChange = () => setSystemMode(resolveSystemMode());
|
|
166
|
+
onChange();
|
|
167
|
+
for (const mql of mqls) mql.addEventListener?.("change", onChange);
|
|
168
|
+
return () => {
|
|
169
|
+
for (const mql of mqls) mql.removeEventListener?.("change", onChange);
|
|
170
|
+
};
|
|
171
|
+
}, [preference]);
|
|
172
|
+
const mode = preference === "system" ? systemMode : preference;
|
|
173
|
+
(0, import_react3.useEffect)(() => {
|
|
174
|
+
if (persist) writeStored(storageKey, { schema, preference });
|
|
175
|
+
}, [schema, preference, persist, storageKey]);
|
|
126
176
|
const value = (0, import_react3.useMemo)(
|
|
127
177
|
() => ({
|
|
128
178
|
schema,
|
|
129
179
|
mode,
|
|
180
|
+
preference,
|
|
130
181
|
themeClass: themes[schema][mode],
|
|
131
182
|
setSchema,
|
|
132
|
-
setMode,
|
|
133
|
-
toggleMode: () =>
|
|
183
|
+
setMode: setPreference,
|
|
184
|
+
toggleMode: () => setPreference(mode === "dark" ? "light" : "dark"),
|
|
185
|
+
cycleMode: () => setPreference(modeNames[(modeNames.indexOf(mode) + 1) % modeNames.length])
|
|
134
186
|
}),
|
|
135
|
-
[schema, mode]
|
|
187
|
+
[schema, mode, preference]
|
|
136
188
|
);
|
|
137
189
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value, children });
|
|
138
190
|
}
|
|
@@ -1788,6 +1840,7 @@ function Menu({ trigger: trigger2, items }) {
|
|
|
1788
1840
|
|
|
1789
1841
|
// src/components/dialog/index.tsx
|
|
1790
1842
|
var import_react34 = require("react");
|
|
1843
|
+
var import_react_dom = require("react-dom");
|
|
1791
1844
|
|
|
1792
1845
|
// src/components/dialog/use-styles.ts
|
|
1793
1846
|
var import_react33 = require("react");
|
|
@@ -1845,7 +1898,7 @@ function Dialog({ open, onClose, title, actions: actions3, children }) {
|
|
|
1845
1898
|
document.body.style.overflow = previousOverflow;
|
|
1846
1899
|
};
|
|
1847
1900
|
}, [open]);
|
|
1848
|
-
if (!open) return null;
|
|
1901
|
+
if (!open || typeof document === "undefined") return null;
|
|
1849
1902
|
const stop = (event) => event.stopPropagation();
|
|
1850
1903
|
const onSurfaceKeyDown = (event) => {
|
|
1851
1904
|
if (event.key !== "Tab") return;
|
|
@@ -1872,7 +1925,7 @@ function Dialog({ open, onClose, title, actions: actions3, children }) {
|
|
|
1872
1925
|
first.focus();
|
|
1873
1926
|
}
|
|
1874
1927
|
};
|
|
1875
|
-
return (
|
|
1928
|
+
return (0, import_react_dom.createPortal)(
|
|
1876
1929
|
// biome-ignore lint/a11y/useKeyWithClickEvents: ESC handled by a document keydown listener.
|
|
1877
1930
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: overlay2, "data-testid": "dialog-overlay", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1878
1931
|
"div",
|
|
@@ -1891,10 +1944,14 @@ function Dialog({ open, onClose, title, actions: actions3, children }) {
|
|
|
1891
1944
|
actions3 != null && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: actionsClass, children: actions3 })
|
|
1892
1945
|
]
|
|
1893
1946
|
}
|
|
1894
|
-
) })
|
|
1947
|
+
) }),
|
|
1948
|
+
document.body
|
|
1895
1949
|
);
|
|
1896
1950
|
}
|
|
1897
1951
|
|
|
1952
|
+
// src/components/snackbar/index.tsx
|
|
1953
|
+
var import_react_dom2 = require("react-dom");
|
|
1954
|
+
|
|
1898
1955
|
// src/components/snackbar/use-styles.ts
|
|
1899
1956
|
var import_react35 = require("react");
|
|
1900
1957
|
|
|
@@ -1920,12 +1977,15 @@ function useStyles24() {
|
|
|
1920
1977
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1921
1978
|
function Snackbar({ open, message: message2, action, onClose }) {
|
|
1922
1979
|
const { root: root24, message: messageClass, closeBtn: closeBtn2 } = useStyles24();
|
|
1923
|
-
if (!open) return null;
|
|
1924
|
-
return
|
|
1925
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1980
|
+
if (!open || typeof document === "undefined") return null;
|
|
1981
|
+
return (0, import_react_dom2.createPortal)(
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { role: "status", className: root24, children: [
|
|
1983
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: messageClass, children: message2 }),
|
|
1984
|
+
action,
|
|
1985
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-label": "Close", className: closeBtn2, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(XIcon, { size: 18 }) })
|
|
1986
|
+
] }),
|
|
1987
|
+
document.body
|
|
1988
|
+
);
|
|
1929
1989
|
}
|
|
1930
1990
|
|
|
1931
1991
|
// src/components/table/use-styles.ts
|
|
@@ -2200,6 +2260,7 @@ var text = { eyebrow: "typography_text_eyebrow__1wmlzy0", display: "typography_t
|
|
|
2200
2260
|
Tooltip,
|
|
2201
2261
|
TriangleAlertIcon,
|
|
2202
2262
|
XIcon,
|
|
2263
|
+
colorVars,
|
|
2203
2264
|
modeNames,
|
|
2204
2265
|
schemaNames,
|
|
2205
2266
|
text,
|
|
@@ -2209,3 +2270,4 @@ var text = { eyebrow: "typography_text_eyebrow__1wmlzy0", display: "typography_t
|
|
|
2209
2270
|
useTheme,
|
|
2210
2271
|
useToggle
|
|
2211
2272
|
});
|
|
2273
|
+
//# sourceMappingURL=index.cjs.map
|