@sereno-ds/ui 0.24.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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/_internal/CharCount.d.ts +9 -0
- package/dist/_internal/CharCount.js +25 -0
- package/dist/_internal/CharCount.js.map +1 -0
- package/dist/_internal/Field.d.ts +17 -0
- package/dist/_internal/Field.js +55 -0
- package/dist/_internal/Field.js.map +1 -0
- package/dist/_internal/mask.d.ts +12 -0
- package/dist/_internal/mask.js +56 -0
- package/dist/_internal/mask.js.map +1 -0
- package/dist/_internal/style.d.ts +12 -0
- package/dist/_internal/style.js +5 -0
- package/dist/_internal/style.js.map +1 -0
- package/dist/core/Avatar.d.ts +14 -0
- package/dist/core/Avatar.js +62 -0
- package/dist/core/Avatar.js.map +1 -0
- package/dist/core/Badge.d.ts +16 -0
- package/dist/core/Badge.js +49 -0
- package/dist/core/Badge.js.map +1 -0
- package/dist/core/Brand.d.ts +18 -0
- package/dist/core/Brand.js +58 -0
- package/dist/core/Brand.js.map +1 -0
- package/dist/core/Button.d.ts +31 -0
- package/dist/core/Button.js +100 -0
- package/dist/core/Button.js.map +1 -0
- package/dist/core/Card.d.ts +15 -0
- package/dist/core/Card.js +34 -0
- package/dist/core/Card.js.map +1 -0
- package/dist/core/IconButton.d.ts +18 -0
- package/dist/core/IconButton.js +64 -0
- package/dist/core/IconButton.js.map +1 -0
- package/dist/core/Menu.d.ts +69 -0
- package/dist/core/Menu.js +278 -0
- package/dist/core/Menu.js.map +1 -0
- package/dist/core/Table.d.ts +92 -0
- package/dist/core/Table.js +162 -0
- package/dist/core/Table.js.map +1 -0
- package/dist/feedback/Alert.d.ts +27 -0
- package/dist/feedback/Alert.js +68 -0
- package/dist/feedback/Alert.js.map +1 -0
- package/dist/feedback/Dialog.d.ts +36 -0
- package/dist/feedback/Dialog.js +218 -0
- package/dist/feedback/Dialog.js.map +1 -0
- package/dist/feedback/EmptyState.d.ts +13 -0
- package/dist/feedback/EmptyState.js +70 -0
- package/dist/feedback/EmptyState.js.map +1 -0
- package/dist/feedback/Skeleton.d.ts +23 -0
- package/dist/feedback/Skeleton.js +44 -0
- package/dist/feedback/Skeleton.js.map +1 -0
- package/dist/feedback/Toast.d.ts +23 -0
- package/dist/feedback/Toast.js +85 -0
- package/dist/feedback/Toast.js.map +1 -0
- package/dist/feedback/ToastProvider.d.ts +69 -0
- package/dist/feedback/ToastProvider.js +183 -0
- package/dist/feedback/ToastProvider.js.map +1 -0
- package/dist/forms/AvatarUpload.d.ts +57 -0
- package/dist/forms/AvatarUpload.js +579 -0
- package/dist/forms/AvatarUpload.js.map +1 -0
- package/dist/forms/Checkbox.d.ts +15 -0
- package/dist/forms/Checkbox.js +57 -0
- package/dist/forms/Checkbox.js.map +1 -0
- package/dist/forms/DateTimePicker.d.ts +43 -0
- package/dist/forms/DateTimePicker.js +391 -0
- package/dist/forms/DateTimePicker.js.map +1 -0
- package/dist/forms/FileUpload.d.ts +39 -0
- package/dist/forms/FileUpload.js +376 -0
- package/dist/forms/FileUpload.js.map +1 -0
- package/dist/forms/Input.d.ts +35 -0
- package/dist/forms/Input.js +143 -0
- package/dist/forms/Input.js.map +1 -0
- package/dist/forms/Radio.d.ts +18 -0
- package/dist/forms/Radio.js +50 -0
- package/dist/forms/Radio.js.map +1 -0
- package/dist/forms/SearchInput.d.ts +23 -0
- package/dist/forms/SearchInput.js +70 -0
- package/dist/forms/SearchInput.js.map +1 -0
- package/dist/forms/Select.d.ts +40 -0
- package/dist/forms/Select.js +524 -0
- package/dist/forms/Select.js.map +1 -0
- package/dist/forms/Switch.d.ts +20 -0
- package/dist/forms/Switch.js +76 -0
- package/dist/forms/Switch.js.map +1 -0
- package/dist/forms/Textarea.d.ts +19 -0
- package/dist/forms/Textarea.js +65 -0
- package/dist/forms/Textarea.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation/BottomNav.d.ts +17 -0
- package/dist/navigation/BottomNav.js +72 -0
- package/dist/navigation/BottomNav.js.map +1 -0
- package/dist/navigation/SidebarNav.d.ts +53 -0
- package/dist/navigation/SidebarNav.js +594 -0
- package/dist/navigation/SidebarNav.js.map +1 -0
- package/dist/navigation/Stepper.d.ts +33 -0
- package/dist/navigation/Stepper.js +87 -0
- package/dist/navigation/Stepper.js.map +1 -0
- package/dist/navigation/Tabs.d.ts +23 -0
- package/dist/navigation/Tabs.js +174 -0
- package/dist/navigation/Tabs.js.map +1 -0
- package/dist/navigation/TopBar.d.ts +17 -0
- package/dist/navigation/TopBar.js +65 -0
- package/dist/navigation/TopBar.js.map +1 -0
- package/dist/styles.css +258 -0
- package/dist/theme/ThemeProvider.d.ts +12 -0
- package/dist/theme/ThemeProvider.js +10 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/ThemeToggle.d.ts +14 -0
- package/dist/theme/ThemeToggle.js +25 -0
- package/dist/theme/ThemeToggle.js.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gabriel Gomes Barbosa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @sereno-ds/ui
|
|
2
|
+
|
|
3
|
+
React primitives for the Sereno Design System — token-driven, inline styles, **no UI base library** (no Radix / MUI / Tailwind). Native light/dark via one `data-theme` attribute.
|
|
4
|
+
|
|
5
|
+
> Browse every component with a live preview: the Sereno DS showcase.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @sereno-ds/ui @sereno-ds/tokens lucide-react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`@sereno-ds/tokens` (the CSS custom properties everything reads) and `lucide-react` (icons — see below) are **peer/companion deps** you install alongside. `react` / `react-dom` (>=18, works on 19) you already have. `next-themes` comes bundled.
|
|
14
|
+
|
|
15
|
+
## Setup — three things, once, at the app root
|
|
16
|
+
|
|
17
|
+
### 1. Import the stylesheets, in this order
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import '@sereno-ds/tokens/tokens.css'; // the token layer (colors, spacing, dark overrides…)
|
|
21
|
+
import '@sereno-ds/ui/styles.css'; // component keyframes + a few structural rules
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`tokens.css` **must** come first. Both are side-effect CSS — import them once (a root layout, `_app`, or `main.tsx`), not per-component.
|
|
25
|
+
|
|
26
|
+
### 2. Provide the fonts
|
|
27
|
+
|
|
28
|
+
Components reference three font CSS variables. Define them however you host fonts; the tokens already carry a system fallback, so text renders without them — just off-brand.
|
|
29
|
+
|
|
30
|
+
| Variable | Family |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `--font-inter` | Inter (body / UI) |
|
|
33
|
+
| `--font-manrope` | Manrope (display / headings) |
|
|
34
|
+
| `--font-jetbrains-mono` | JetBrains Mono (code / numeric) |
|
|
35
|
+
|
|
36
|
+
**Next.js (`next/font`):**
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Inter, Manrope, JetBrains_Mono } from 'next/font/google';
|
|
40
|
+
|
|
41
|
+
const inter = Inter({ subsets: ['latin'], variable: '--font-inter', display: 'swap' });
|
|
42
|
+
const manrope = Manrope({ subsets: ['latin'], weight: ['500', '600', '700', '800'], variable: '--font-manrope', display: 'swap' });
|
|
43
|
+
const mono = JetBrains_Mono({ subsets: ['latin'], variable: '--font-jetbrains-mono', display: 'swap' });
|
|
44
|
+
|
|
45
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
46
|
+
return (
|
|
47
|
+
<html lang="en" className={`${inter.variable} ${manrope.variable} ${mono.variable}`}>
|
|
48
|
+
<body>{children}</body>
|
|
49
|
+
</html>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Vite / plain (Fontsource or `@font-face`):**
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import '@fontsource-variable/inter';
|
|
58
|
+
import '@fontsource-variable/manrope';
|
|
59
|
+
import '@fontsource-variable/jetbrains-mono';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```css
|
|
63
|
+
:root {
|
|
64
|
+
--font-inter: 'Inter Variable', system-ui, sans-serif;
|
|
65
|
+
--font-manrope: 'Manrope Variable', system-ui, sans-serif;
|
|
66
|
+
--font-jetbrains-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 3. Wrap the tree in `ThemeProvider`
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { ThemeProvider } from '@sereno-ds/ui';
|
|
74
|
+
|
|
75
|
+
<ThemeProvider>{children}</ThemeProvider>;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
It writes `data-theme="light" | "dark"` on `<html>` (defaults to the OS preference, remembers the choice). If you already manage `data-theme` yourself, you can skip it — the tokens only need that attribute to be set.
|
|
79
|
+
|
|
80
|
+
## Use
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { Button, Card, Input } from '@sereno-ds/ui';
|
|
84
|
+
import { Check } from 'lucide-react';
|
|
85
|
+
|
|
86
|
+
export function Example() {
|
|
87
|
+
return (
|
|
88
|
+
<Card padding="lg">
|
|
89
|
+
<Input label="Your name" placeholder="Ana Ramos" />
|
|
90
|
+
<Button variant="accent" iconLeft={<Check size={18} />}>
|
|
91
|
+
Confirm
|
|
92
|
+
</Button>
|
|
93
|
+
</Card>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Contract
|
|
99
|
+
|
|
100
|
+
- **Tokens are required.** Components read only CSS custom properties (`--bg-*`, `--text-*`, `--border-*`, `--radius-*`, `--space-*`, `--font-*`, …). They live in `@sereno-ds/tokens`; without it, everything renders unstyled.
|
|
101
|
+
- **Dark mode** is the same components on `[data-theme="dark"]` — no `theme` prop, no variant.
|
|
102
|
+
- **Icons come from you.** Where a component takes an icon (`Button` `iconLeft`, `TopBar` actions, …) you pass a node — typically `lucide-react`, but any 20px-ish SVG works. `@sereno-ds/ui` also uses `lucide-react` for its own built-in affordances (the `Select` caret, the `Input` password eye, `ThemeToggle`), so it's a required peer.
|
|
103
|
+
- **Zero CSS-in-JS runtime.** Styles are plain inline `style={{ … }}` reading `var(--token)`.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "./style";
|
|
4
|
+
function CharCount({ count, max }) {
|
|
5
|
+
const atLimit = max != null && count >= max;
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"span",
|
|
8
|
+
{
|
|
9
|
+
"aria-live": "polite",
|
|
10
|
+
style: sx({
|
|
11
|
+
flex: "0 0 auto",
|
|
12
|
+
fontFamily: "var(--font-body)",
|
|
13
|
+
fontSize: "var(--text-xs)",
|
|
14
|
+
lineHeight: 1.45,
|
|
15
|
+
fontVariantNumeric: "tabular-nums",
|
|
16
|
+
color: atLimit ? "var(--interactive-error)" : "var(--text-muted)"
|
|
17
|
+
}),
|
|
18
|
+
children: max != null ? `${count} / ${max}` : count
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
CharCount
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=CharCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_internal/CharCount.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from './style';\n\n/** `n / max` (or a bare count) for the hint row of Input / Textarea. */\nexport function CharCount({ count, max }: { count: number; max?: number }) {\n const atLimit = max != null && count >= max;\n return (\n <span\n aria-live=\"polite\"\n style={sx({\n flex: '0 0 auto',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n lineHeight: 1.45,\n fontVariantNumeric: 'tabular-nums',\n color: atLimit ? 'var(--interactive-error)' : 'var(--text-muted)',\n })}\n >\n {max != null ? `${count} / ${max}` : count}\n </span>\n );\n}\n"],"mappings":";AASI;AANJ,SAAS,UAAU;AAGZ,SAAS,UAAU,EAAE,OAAO,IAAI,GAAoC;AACzE,QAAM,UAAU,OAAO,QAAQ,SAAS;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,OAAO,GAAG;AAAA,QACR,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,OAAO,UAAU,6BAA6B;AAAA,MAChD,CAAC;AAAA,MAEA,iBAAO,OAAO,GAAG,KAAK,MAAM,GAAG,KAAK;AAAA;AAAA,EACvC;AAEJ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Label + hint/error wrapper shared by Input, Textarea and Select. */
|
|
4
|
+
interface FieldProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
htmlFor?: string;
|
|
10
|
+
/** Right-aligned node on the hint row (e.g. a character counter). */
|
|
11
|
+
counter?: React.ReactNode;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
declare function Field({ label, hint, error, required, htmlFor, counter, children, style }: FieldProps): React.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { Field, type FieldProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "./style";
|
|
4
|
+
function Field({ label, hint, error, required, htmlFor, counter, children, style }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { style: sx({ display: "flex", flexDirection: "column", gap: "var(--space-2)", ...style }), children: [
|
|
6
|
+
label && /* @__PURE__ */ jsxs(
|
|
7
|
+
"label",
|
|
8
|
+
{
|
|
9
|
+
htmlFor,
|
|
10
|
+
style: sx({
|
|
11
|
+
fontFamily: "var(--font-body)",
|
|
12
|
+
fontSize: "var(--text-sm)",
|
|
13
|
+
fontWeight: "var(--weight-semibold)",
|
|
14
|
+
color: "var(--text-primary)",
|
|
15
|
+
letterSpacing: "var(--tracking-snug)"
|
|
16
|
+
}),
|
|
17
|
+
children: [
|
|
18
|
+
label,
|
|
19
|
+
required && /* @__PURE__ */ jsx("span", { style: sx({ color: "var(--interactive-error)", marginLeft: 3 }), children: "*" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
children,
|
|
24
|
+
(error || hint || counter) && /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
style: sx({
|
|
28
|
+
display: "flex",
|
|
29
|
+
alignItems: "baseline",
|
|
30
|
+
gap: "var(--space-3)",
|
|
31
|
+
justifyContent: error || hint ? "space-between" : "flex-end"
|
|
32
|
+
}),
|
|
33
|
+
children: [
|
|
34
|
+
(error || hint) && /* @__PURE__ */ jsx(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
style: sx({
|
|
38
|
+
fontFamily: "var(--font-body)",
|
|
39
|
+
fontSize: "var(--text-xs)",
|
|
40
|
+
lineHeight: 1.45,
|
|
41
|
+
color: error ? "var(--interactive-error)" : "var(--text-muted)"
|
|
42
|
+
}),
|
|
43
|
+
children: error || hint
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
counter
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
Field
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_internal/Field.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from './style';\n\n/** Label + hint/error wrapper shared by Input, Textarea and Select. */\nexport interface FieldProps {\n label?: string;\n hint?: string;\n error?: string;\n required?: boolean;\n htmlFor?: string;\n /** Right-aligned node on the hint row (e.g. a character counter). */\n counter?: React.ReactNode;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n}\n\nexport function Field({ label, hint, error, required, htmlFor, counter, children, style }: FieldProps) {\n return (\n <div style={sx({ display: 'flex', flexDirection: 'column', gap: 'var(--space-2)', ...style })}>\n {label && (\n <label\n htmlFor={htmlFor}\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-primary)',\n letterSpacing: 'var(--tracking-snug)',\n })}\n >\n {label}\n {required && <span style={sx({ color: 'var(--interactive-error)', marginLeft: 3 })}>*</span>}\n </label>\n )}\n {children}\n {(error || hint || counter) && (\n <div\n style={sx({\n display: 'flex',\n alignItems: 'baseline',\n gap: 'var(--space-3)',\n justifyContent: error || hint ? 'space-between' : 'flex-end',\n })}\n >\n {(error || hint) && (\n <span\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n lineHeight: 1.45,\n color: error ? 'var(--interactive-error)' : 'var(--text-muted)',\n })}\n >\n {error || hint}\n </span>\n )}\n {counter}\n </div>\n )}\n </div>\n );\n}"],"mappings":";AAsBQ,SAWe,KAXf;AAnBR,SAAS,UAAU;AAeZ,SAAS,MAAM,EAAE,OAAO,MAAM,OAAO,UAAU,SAAS,SAAS,UAAU,MAAM,GAAe;AACrG,SACE,qBAAC,SAAI,OAAO,GAAG,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,kBAAkB,GAAG,MAAM,CAAC,GACzF;AAAA,aACC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,GAAG;AAAA,UACR,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,eAAe;AAAA,QACjB,CAAC;AAAA,QAEA;AAAA;AAAA,UACA,YAAY,oBAAC,UAAK,OAAO,GAAG,EAAE,OAAO,4BAA4B,YAAY,EAAE,CAAC,GAAG,eAAC;AAAA;AAAA;AAAA,IACvF;AAAA,IAED;AAAA,KACC,SAAS,QAAQ,YACjB;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,gBAAgB,SAAS,OAAO,kBAAkB;AAAA,QACpD,CAAC;AAAA,QAEC;AAAA,oBAAS,SACT;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,GAAG;AAAA,gBACR,YAAY;AAAA,gBACZ,UAAU;AAAA,gBACV,YAAY;AAAA,gBACZ,OAAO,QAAQ,6BAA6B;AAAA,cAC9C,CAAC;AAAA,cAEA,mBAAS;AAAA;AAAA,UACZ;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-rolled input masks — no dependency. `formatMask` takes a preset name (or a
|
|
3
|
+
* custom `#`-per-digit pattern) and a raw string, and returns the formatted value.
|
|
4
|
+
* Extra characters are dropped; separators are inserted positionally.
|
|
5
|
+
*/
|
|
6
|
+
type MaskName = 'phone' | 'cpf' | 'cep' | 'currency';
|
|
7
|
+
declare function formatMask(name: MaskName | string, raw: string): string;
|
|
8
|
+
/** Max length of the fully-formatted value, so the field stops accepting input. */
|
|
9
|
+
declare const MASK_MAXLENGTH: Record<string, number>;
|
|
10
|
+
declare const MASK_INPUTMODE: Record<string, 'numeric' | 'tel'>;
|
|
11
|
+
|
|
12
|
+
export { MASK_INPUTMODE, MASK_MAXLENGTH, type MaskName, formatMask };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const onlyDigits = (s) => s.replace(/\D/g, "");
|
|
2
|
+
function applyPattern(pattern, raw) {
|
|
3
|
+
const d = onlyDigits(raw);
|
|
4
|
+
let out = "";
|
|
5
|
+
let i = 0;
|
|
6
|
+
for (const ch of pattern) {
|
|
7
|
+
if (i >= d.length) break;
|
|
8
|
+
if (ch === "#") out += d[i++];
|
|
9
|
+
else out += ch;
|
|
10
|
+
}
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
const PHONE_10 = "(##) ####-####";
|
|
14
|
+
const PHONE_11 = "(##) #####-####";
|
|
15
|
+
function currencyBRL(raw) {
|
|
16
|
+
const cents = (onlyDigits(raw).replace(/^0+/, "") || "0").padStart(3, "0");
|
|
17
|
+
const int = cents.slice(0, -2).replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
18
|
+
return `${int},${cents.slice(-2)}`;
|
|
19
|
+
}
|
|
20
|
+
function formatMask(name, raw) {
|
|
21
|
+
if (!raw) return "";
|
|
22
|
+
switch (name) {
|
|
23
|
+
case "phone":
|
|
24
|
+
return applyPattern(onlyDigits(raw).length > 10 ? PHONE_11 : PHONE_10, raw);
|
|
25
|
+
case "cpf":
|
|
26
|
+
return applyPattern("###.###.###-##", raw);
|
|
27
|
+
case "cep":
|
|
28
|
+
return applyPattern("#####-###", raw);
|
|
29
|
+
case "currency":
|
|
30
|
+
return currencyBRL(raw);
|
|
31
|
+
default:
|
|
32
|
+
return applyPattern(name, raw);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const MASK_MAXLENGTH = {
|
|
36
|
+
phone: 15,
|
|
37
|
+
// "(11) 99999-9999"
|
|
38
|
+
cpf: 14,
|
|
39
|
+
// "000.000.000-00"
|
|
40
|
+
cep: 9,
|
|
41
|
+
// "00000-000"
|
|
42
|
+
currency: 14
|
|
43
|
+
// "999.999.999,99"
|
|
44
|
+
};
|
|
45
|
+
const MASK_INPUTMODE = {
|
|
46
|
+
phone: "tel",
|
|
47
|
+
cpf: "numeric",
|
|
48
|
+
cep: "numeric",
|
|
49
|
+
currency: "numeric"
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
MASK_INPUTMODE,
|
|
53
|
+
MASK_MAXLENGTH,
|
|
54
|
+
formatMask
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_internal/mask.ts"],"sourcesContent":["/**\n * Hand-rolled input masks — no dependency. `formatMask` takes a preset name (or a\n * custom `#`-per-digit pattern) and a raw string, and returns the formatted value.\n * Extra characters are dropped; separators are inserted positionally.\n */\n\nexport type MaskName = 'phone' | 'cpf' | 'cep' | 'currency';\n\nconst onlyDigits = (s: string) => s.replace(/\\D/g, '');\n\n/** Apply a positional pattern where `#` is one digit and everything else is a literal. */\nfunction applyPattern(pattern: string, raw: string): string {\n const d = onlyDigits(raw);\n let out = '';\n let i = 0;\n for (const ch of pattern) {\n if (i >= d.length) break;\n if (ch === '#') out += d[i++];\n else out += ch;\n }\n return out;\n}\n\nconst PHONE_10 = '(##) ####-####'; // landline\nconst PHONE_11 = '(##) #####-####'; // mobile\n\n/**\n * BR currency amount — digits are read as cents. \"1234\" → \"12,34\". No symbol:\n * pair it with `prefix=\"R$\"` on the field so the value stays a plain number string.\n */\nfunction currencyBRL(raw: string): string {\n const cents = (onlyDigits(raw).replace(/^0+/, '') || '0').padStart(3, '0');\n const int = cents.slice(0, -2).replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\n return `${int},${cents.slice(-2)}`;\n}\n\nexport function formatMask(name: MaskName | string, raw: string): string {\n if (!raw) return '';\n switch (name) {\n case 'phone':\n return applyPattern(onlyDigits(raw).length > 10 ? PHONE_11 : PHONE_10, raw);\n case 'cpf':\n return applyPattern('###.###.###-##', raw);\n case 'cep':\n return applyPattern('#####-###', raw);\n case 'currency':\n return currencyBRL(raw);\n default:\n return applyPattern(name, raw); // custom '#' pattern\n }\n}\n\n/** Max length of the fully-formatted value, so the field stops accepting input. */\nexport const MASK_MAXLENGTH: Record<string, number> = {\n phone: 15, // \"(11) 99999-9999\"\n cpf: 14, // \"000.000.000-00\"\n cep: 9, // \"00000-000\"\n currency: 14, // \"999.999.999,99\"\n};\n\nexport const MASK_INPUTMODE: Record<string, 'numeric' | 'tel'> = {\n phone: 'tel',\n cpf: 'numeric',\n cep: 'numeric',\n currency: 'numeric',\n};\n"],"mappings":"AAQA,MAAM,aAAa,CAAC,MAAc,EAAE,QAAQ,OAAO,EAAE;AAGrD,SAAS,aAAa,SAAiB,KAAqB;AAC1D,QAAM,IAAI,WAAW,GAAG;AACxB,MAAI,MAAM;AACV,MAAI,IAAI;AACR,aAAW,MAAM,SAAS;AACxB,QAAI,KAAK,EAAE,OAAQ;AACnB,QAAI,OAAO,IAAK,QAAO,EAAE,GAAG;AAAA,QACvB,QAAO;AAAA,EACd;AACA,SAAO;AACT;AAEA,MAAM,WAAW;AACjB,MAAM,WAAW;AAMjB,SAAS,YAAY,KAAqB;AACxC,QAAM,SAAS,WAAW,GAAG,EAAE,QAAQ,OAAO,EAAE,KAAK,KAAK,SAAS,GAAG,GAAG;AACzE,QAAM,MAAM,MAAM,MAAM,GAAG,EAAE,EAAE,QAAQ,yBAAyB,GAAG;AACnE,SAAO,GAAG,GAAG,IAAI,MAAM,MAAM,EAAE,CAAC;AAClC;AAEO,SAAS,WAAW,MAAyB,KAAqB;AACvE,MAAI,CAAC,IAAK,QAAO;AACjB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,aAAa,WAAW,GAAG,EAAE,SAAS,KAAK,WAAW,UAAU,GAAG;AAAA,IAC5E,KAAK;AACH,aAAO,aAAa,kBAAkB,GAAG;AAAA,IAC3C,KAAK;AACH,aAAO,aAAa,aAAa,GAAG;AAAA,IACtC,KAAK;AACH,aAAO,YAAY,GAAG;AAAA,IACxB;AACE,aAAO,aAAa,MAAM,GAAG;AAAA,EACjC;AACF;AAGO,MAAM,iBAAyC;AAAA,EACpD,OAAO;AAAA;AAAA,EACP,KAAK;AAAA;AAAA,EACL,KAAK;AAAA;AAAA,EACL,UAAU;AAAA;AACZ;AAEO,MAAM,iBAAoD;AAAA,EAC/D,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Sereno components are token-driven: nearly every style value is a
|
|
5
|
+
* `var(--token)` string, including properties csstype types narrowly (fontWeight,
|
|
6
|
+
* zIndex, opacity…). `sx` accepts a loose style map and hands back a
|
|
7
|
+
* `CSSProperties` so component bodies can stay declarative and close to the
|
|
8
|
+
* original Design System source.
|
|
9
|
+
*/
|
|
10
|
+
declare const sx: (style: Record<string, unknown>) => CSSProperties;
|
|
11
|
+
|
|
12
|
+
export { sx };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_internal/style.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\n/**\n * The Sereno components are token-driven: nearly every style value is a\n * `var(--token)` string, including properties csstype types narrowly (fontWeight,\n * zIndex, opacity…). `sx` accepts a loose style map and hands back a\n * `CSSProperties` so component bodies can stay declarative and close to the\n * original Design System source.\n */\nexport const sx = (style: Record<string, unknown>): CSSProperties => style as CSSProperties;\n"],"mappings":"AASO,MAAM,KAAK,CAAC,UAAkD;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** Circular professional/client identity. Falls back to brand-soft initials when no photo exists. */
|
|
4
|
+
interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/** Full name — drives the initials fallback and the img alt. */
|
|
6
|
+
name?: string;
|
|
7
|
+
src?: string;
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
/** Optional lifecycle dot in the lower-right corner. */
|
|
10
|
+
status?: 'confirmed' | 'pending' | 'cancelled';
|
|
11
|
+
}
|
|
12
|
+
declare function Avatar({ name, src, size, status, style, ...rest }: AvatarProps): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Avatar, type AvatarProps };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "../_internal/style";
|
|
4
|
+
const S = { xs: 24, sm: 32, md: 40, lg: 56, xl: 80 };
|
|
5
|
+
function initials(name) {
|
|
6
|
+
return (name || "").trim().split(/\s+/).slice(0, 2).map((w) => w[0] || "").join("").toUpperCase();
|
|
7
|
+
}
|
|
8
|
+
function Avatar({ name = "", src, size = "md", status, style, ...rest }) {
|
|
9
|
+
const d = S[size] || S.md;
|
|
10
|
+
const fs = d <= 24 ? 10 : d <= 32 ? 12 : d <= 40 ? 14 : d <= 56 ? 18 : 26;
|
|
11
|
+
const dot = status ? { confirmed: "--status-success-dot", pending: "--status-warning-dot", cancelled: "--status-error-dot" }[status] : null;
|
|
12
|
+
return /* @__PURE__ */ jsxs("span", { ...rest, style: sx({ position: "relative", display: "inline-flex", flex: "0 0 auto", ...style }), children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
style: sx({
|
|
17
|
+
width: d,
|
|
18
|
+
height: d,
|
|
19
|
+
borderRadius: "var(--radius-avatar)",
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
display: "inline-flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
// Initials fill is a distinct brand tint (not --bg-brand-soft) so the
|
|
25
|
+
// disc still reads when placed on a brand-soft surface (e.g. the
|
|
26
|
+
// booking profile header).
|
|
27
|
+
background: src ? "var(--bg-subtle)" : "color-mix(in srgb, var(--brand-500) 22%, var(--bg-surface))",
|
|
28
|
+
color: "var(--text-brand)",
|
|
29
|
+
fontFamily: "var(--font-display)",
|
|
30
|
+
fontSize: fs,
|
|
31
|
+
fontWeight: "var(--weight-bold)",
|
|
32
|
+
letterSpacing: "var(--tracking-snug)",
|
|
33
|
+
border: "var(--border-width-hairline) solid " + (src ? "var(--border-subtle)" : "color-mix(in srgb, var(--brand-500) 30%, transparent)")
|
|
34
|
+
}),
|
|
35
|
+
children: src ? (
|
|
36
|
+
// Plain <img>: this is a portable DS primitive, not tied to next/image.
|
|
37
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
38
|
+
/* @__PURE__ */ jsx("img", { src, alt: name, style: sx({ width: "100%", height: "100%", objectFit: "cover" }) })
|
|
39
|
+
) : initials(name)
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
dot && /* @__PURE__ */ jsx(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
style: sx({
|
|
46
|
+
position: "absolute",
|
|
47
|
+
right: -1,
|
|
48
|
+
bottom: -1,
|
|
49
|
+
width: Math.max(8, d * 0.28),
|
|
50
|
+
height: Math.max(8, d * 0.28),
|
|
51
|
+
borderRadius: "999px",
|
|
52
|
+
background: "var(" + dot + ")",
|
|
53
|
+
border: "2px solid var(--bg-surface)"
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
Avatar
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Avatar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/** Circular professional/client identity. Falls back to brand-soft initials when no photo exists. */\nexport interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Full name — drives the initials fallback and the img alt. */\n name?: string;\n src?: string;\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Optional lifecycle dot in the lower-right corner. */\n status?: 'confirmed' | 'pending' | 'cancelled';\n}\n\nconst S = { xs: 24, sm: 32, md: 40, lg: 56, xl: 80 } as const;\n\nfunction initials(name: string): string {\n return (name || '')\n .trim()\n .split(/\\s+/)\n .slice(0, 2)\n .map((w) => w[0] || '')\n .join('')\n .toUpperCase();\n}\n\nexport function Avatar({ name = '', src, size = 'md', status, style, ...rest }: AvatarProps) {\n const d = S[size] || S.md;\n const fs = d <= 24 ? 10 : d <= 32 ? 12 : d <= 40 ? 14 : d <= 56 ? 18 : 26;\n const dot = status\n ? ({ confirmed: '--status-success-dot', pending: '--status-warning-dot', cancelled: '--status-error-dot' } as const)[status]\n : null;\n return (\n <span {...rest} style={sx({ position: 'relative', display: 'inline-flex', flex: '0 0 auto', ...style })}>\n <span\n style={sx({\n width: d,\n height: d,\n borderRadius: 'var(--radius-avatar)',\n overflow: 'hidden',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n // Initials fill is a distinct brand tint (not --bg-brand-soft) so the\n // disc still reads when placed on a brand-soft surface (e.g. the\n // booking profile header).\n background: src ? 'var(--bg-subtle)' : 'color-mix(in srgb, var(--brand-500) 22%, var(--bg-surface))',\n color: 'var(--text-brand)',\n fontFamily: 'var(--font-display)',\n fontSize: fs,\n fontWeight: 'var(--weight-bold)',\n letterSpacing: 'var(--tracking-snug)',\n border: 'var(--border-width-hairline) solid ' + (src ? 'var(--border-subtle)' : 'color-mix(in srgb, var(--brand-500) 30%, transparent)'),\n })}\n >\n {src ? (\n // Plain <img>: this is a portable DS primitive, not tied to next/image.\n // eslint-disable-next-line @next/next/no-img-element\n <img src={src} alt={name} style={sx({ width: '100%', height: '100%', objectFit: 'cover' })} />\n ) : (\n initials(name)\n )}\n </span>\n {dot && (\n <span\n style={sx({\n position: 'absolute',\n right: -1,\n bottom: -1,\n width: Math.max(8, d * 0.28),\n height: Math.max(8, d * 0.28),\n borderRadius: '999px',\n background: 'var(' + dot + ')',\n border: '2px solid var(--bg-surface)',\n })}\n />\n )}\n </span>\n );\n}"],"mappings":";AAkCI,SAyBM,KAzBN;AA/BJ,SAAS,UAAU;AAYnB,MAAM,IAAI,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAEnD,SAAS,SAAS,MAAsB;AACtC,UAAQ,QAAQ,IACb,KAAK,EACL,MAAM,KAAK,EACX,MAAM,GAAG,CAAC,EACV,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EACrB,KAAK,EAAE,EACP,YAAY;AACjB;AAEO,SAAS,OAAO,EAAE,OAAO,IAAI,KAAK,OAAO,MAAM,QAAQ,OAAO,GAAG,KAAK,GAAgB;AAC3F,QAAM,IAAI,EAAE,IAAI,KAAK,EAAE;AACvB,QAAM,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK;AACvE,QAAM,MAAM,SACP,EAAE,WAAW,wBAAwB,SAAS,wBAAwB,WAAW,qBAAqB,EAAY,MAAM,IACzH;AACJ,SACE,qBAAC,UAAM,GAAG,MAAM,OAAO,GAAG,EAAE,UAAU,YAAY,SAAS,eAAe,MAAM,YAAY,GAAG,MAAM,CAAC,GACpG;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,cAAc;AAAA,UACd,UAAU;AAAA,UACV,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,gBAAgB;AAAA;AAAA;AAAA;AAAA,UAIhB,YAAY,MAAM,qBAAqB;AAAA,UACvC,OAAO;AAAA,UACP,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,UACf,QAAQ,yCAAyC,MAAM,yBAAyB;AAAA,QAClF,CAAC;AAAA,QAEA;AAAA;AAAA;AAAA,UAGC,oBAAC,SAAI,KAAU,KAAK,MAAM,OAAO,GAAG,EAAE,OAAO,QAAQ,QAAQ,QAAQ,WAAW,QAAQ,CAAC,GAAG;AAAA,YAE5F,SAAS,IAAI;AAAA;AAAA,IAEjB;AAAA,IACC,OACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,GAAG;AAAA,UACR,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,OAAO,KAAK,IAAI,GAAG,IAAI,IAAI;AAAA,UAC3B,QAAQ,KAAK,IAAI,GAAG,IAAI,IAAI;AAAA,UAC5B,cAAc;AAAA,UACd,YAAY,SAAS,MAAM;AAAA,UAC3B,QAAQ;AAAA,QACV,CAAC;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Status pill for the booking lifecycle and other short labels.
|
|
5
|
+
*/
|
|
6
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
7
|
+
/** Semantic tone. Same five tones across Badge, Alert and Toast. */
|
|
8
|
+
tone?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
9
|
+
size?: 'sm' | 'md';
|
|
10
|
+
/** Leading status dot. Keep it on for lifecycle states. */
|
|
11
|
+
dot?: boolean;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare function Badge({ tone, size, dot, children, style, ...rest }: BadgeProps): React.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Badge, type BadgeProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sx } from "../_internal/style";
|
|
4
|
+
const TONES = {
|
|
5
|
+
success: ["--status-success-bg", "--status-success-fg", "--status-success-dot"],
|
|
6
|
+
warning: ["--status-warning-bg", "--status-warning-fg", "--status-warning-dot"],
|
|
7
|
+
error: ["--status-error-bg", "--status-error-fg", "--status-error-dot"],
|
|
8
|
+
info: ["--status-info-bg", "--status-info-fg", "--status-info-dot"],
|
|
9
|
+
// Neutral = an outlined chip (surface fill + hairline border, added below) so it
|
|
10
|
+
// reads on any background, including a tinted one.
|
|
11
|
+
neutral: ["--bg-surface", "--text-secondary", "--text-muted"]
|
|
12
|
+
};
|
|
13
|
+
function Badge({ tone = "neutral", size = "md", dot = true, children, style, ...rest }) {
|
|
14
|
+
const [bg, fg, dt] = TONES[tone] || TONES.neutral;
|
|
15
|
+
const sm = size === "sm";
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
...rest,
|
|
20
|
+
style: sx({
|
|
21
|
+
display: "inline-flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
gap: sm ? 5 : 6,
|
|
24
|
+
padding: sm ? "2px 8px" : "4px 10px",
|
|
25
|
+
borderRadius: "var(--radius-chip)",
|
|
26
|
+
background: "var(" + bg + ")",
|
|
27
|
+
// The neutral fill can match a tinted surface it sits on — a hairline
|
|
28
|
+
// keeps the chip defined on any background. Tinted tones read on their own.
|
|
29
|
+
border: "var(--border-width-hairline) solid " + (tone === "neutral" ? "var(--border-default)" : "transparent"),
|
|
30
|
+
color: "var(" + fg + ")",
|
|
31
|
+
fontFamily: "var(--font-body)",
|
|
32
|
+
fontSize: sm ? "var(--text-2xs)" : "var(--text-xs)",
|
|
33
|
+
fontWeight: "var(--weight-semibold)",
|
|
34
|
+
letterSpacing: "var(--tracking-snug)",
|
|
35
|
+
lineHeight: 1.4,
|
|
36
|
+
whiteSpace: "nowrap",
|
|
37
|
+
...style
|
|
38
|
+
}),
|
|
39
|
+
children: [
|
|
40
|
+
dot && /* @__PURE__ */ jsx("span", { style: sx({ width: sm ? 5 : 6, height: sm ? 5 : 6, borderRadius: "999px", background: "var(" + dt + ")", flex: "0 0 auto" }) }),
|
|
41
|
+
children
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
Badge
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Badge.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Status pill for the booking lifecycle and other short labels.\n */\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Semantic tone. Same five tones across Badge, Alert and Toast. */\n tone?: 'success' | 'warning' | 'error' | 'info' | 'neutral';\n size?: 'sm' | 'md';\n /** Leading status dot. Keep it on for lifecycle states. */\n dot?: boolean;\n children?: React.ReactNode;\n}\n\nconst TONES: Record<NonNullable<BadgeProps['tone']>, [string, string, string]> = {\n success: ['--status-success-bg', '--status-success-fg', '--status-success-dot'],\n warning: ['--status-warning-bg', '--status-warning-fg', '--status-warning-dot'],\n error: ['--status-error-bg', '--status-error-fg', '--status-error-dot'],\n info: ['--status-info-bg', '--status-info-fg', '--status-info-dot'],\n // Neutral = an outlined chip (surface fill + hairline border, added below) so it\n // reads on any background, including a tinted one.\n neutral: ['--bg-surface', '--text-secondary', '--text-muted'],\n};\n\nexport function Badge({ tone = 'neutral', size = 'md', dot = true, children, style, ...rest }: BadgeProps) {\n const [bg, fg, dt] = TONES[tone] || TONES.neutral;\n const sm = size === 'sm';\n return (\n <span\n {...rest}\n style={sx({\n display: 'inline-flex',\n alignItems: 'center',\n gap: sm ? 5 : 6,\n padding: sm ? '2px 8px' : '4px 10px',\n borderRadius: 'var(--radius-chip)',\n background: 'var(' + bg + ')',\n // The neutral fill can match a tinted surface it sits on — a hairline\n // keeps the chip defined on any background. Tinted tones read on their own.\n border: 'var(--border-width-hairline) solid ' + (tone === 'neutral' ? 'var(--border-default)' : 'transparent'),\n color: 'var(' + fg + ')',\n fontFamily: 'var(--font-body)',\n fontSize: sm ? 'var(--text-2xs)' : 'var(--text-xs)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n lineHeight: 1.4,\n whiteSpace: 'nowrap',\n ...style,\n })}\n >\n {dot && <span style={sx({ width: sm ? 5 : 6, height: sm ? 5 : 6, borderRadius: '999px', background: 'var(' + dt + ')', flex: '0 0 auto' })} />}\n {children}\n </span>\n );\n}"],"mappings":";AA+BI,SAsBU,KAtBV;AA5BJ,SAAS,UAAU;AAcnB,MAAM,QAA2E;AAAA,EAC/E,SAAS,CAAC,uBAAuB,uBAAuB,sBAAsB;AAAA,EAC9E,SAAS,CAAC,uBAAuB,uBAAuB,sBAAsB;AAAA,EAC9E,OAAO,CAAC,qBAAqB,qBAAqB,oBAAoB;AAAA,EACtE,MAAM,CAAC,oBAAoB,oBAAoB,mBAAmB;AAAA;AAAA;AAAA,EAGlE,SAAS,CAAC,gBAAgB,oBAAoB,cAAc;AAC9D;AAEO,SAAS,MAAM,EAAE,OAAO,WAAW,OAAO,MAAM,MAAM,MAAM,UAAU,OAAO,GAAG,KAAK,GAAe;AACzG,QAAM,CAAC,IAAI,IAAI,EAAE,IAAI,MAAM,IAAI,KAAK,MAAM;AAC1C,QAAM,KAAK,SAAS;AACpB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KAAK,KAAK,IAAI;AAAA,QACd,SAAS,KAAK,YAAY;AAAA,QAC1B,cAAc;AAAA,QACd,YAAY,SAAS,KAAK;AAAA;AAAA;AAAA,QAG1B,QAAQ,yCAAyC,SAAS,YAAY,0BAA0B;AAAA,QAChG,OAAO,SAAS,KAAK;AAAA,QACrB,YAAY;AAAA,QACZ,UAAU,KAAK,oBAAoB;AAAA,QACnC,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,GAAG;AAAA,MACL,CAAC;AAAA,MAEA;AAAA,eAAO,oBAAC,UAAK,OAAO,GAAG,EAAE,OAAO,KAAK,IAAI,GAAG,QAAQ,KAAK,IAAI,GAAG,cAAc,SAAS,YAAY,SAAS,KAAK,KAAK,MAAM,WAAW,CAAC,GAAG;AAAA,QAC3I;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Sereno mark: an indigo water-drop symbol, optionally locked up with the
|
|
5
|
+
* "sereno" wordmark. Token-driven — the gradient is the brand indigo
|
|
6
|
+
* (`#7d8bdf` → `#4f46e5`), the wordmark uses `--font-display` (Manrope) at 500.
|
|
7
|
+
*/
|
|
8
|
+
interface BrandProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
9
|
+
/** Symbol height in px. In the lockups it also drives the wordmark size. */
|
|
10
|
+
size?: number;
|
|
11
|
+
/** `symbol` (default), `lockup` (symbol + wordmark, horizontal) or `lockup-vertical`. */
|
|
12
|
+
variant?: 'symbol' | 'lockup' | 'lockup-vertical';
|
|
13
|
+
/** One-colour rendering (`currentColor`) instead of the gradient — for favicons, print, tinted surfaces. */
|
|
14
|
+
mono?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function Brand({ size, variant, mono, style, ...rest }: BrandProps): React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Brand, type BrandProps };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { sx } from "../_internal/style";
|
|
5
|
+
const DROP = "M24 3 C 22 7.5 8 22 8 31.5 C 8 39 15 45 24 45 C 33 45 40 39 40 31.5 C 40 22 26 7.5 24 3 Z";
|
|
6
|
+
function Mark({ size, mono, decorative }) {
|
|
7
|
+
const gid = React.useId();
|
|
8
|
+
const a11y = decorative ? { "aria-hidden": true } : { role: "img", "aria-label": "Sereno" };
|
|
9
|
+
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 48 48", ...a11y, style: { display: "block", flex: "0 0 auto" }, children: [
|
|
10
|
+
!mono && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "3", x2: "0", y2: "45", gradientUnits: "userSpaceOnUse", children: [
|
|
11
|
+
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: "#7d8bdf" }),
|
|
12
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#4f46e5" })
|
|
13
|
+
] }) }),
|
|
14
|
+
/* @__PURE__ */ jsx("path", { d: DROP, fill: mono ? "currentColor" : `url(#${gid})` })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
function Brand({ size = 24, variant = "symbol", mono = false, style, ...rest }) {
|
|
18
|
+
if (variant === "symbol") {
|
|
19
|
+
return /* @__PURE__ */ jsx("span", { ...rest, style: sx({ display: "inline-flex", ...style }), children: /* @__PURE__ */ jsx(Mark, { size, mono, decorative: false }) });
|
|
20
|
+
}
|
|
21
|
+
const vertical = variant === "lockup-vertical";
|
|
22
|
+
const fontSize = Math.round(size * (vertical ? 1 : 0.78));
|
|
23
|
+
const gap = Math.round(size * (vertical ? 0.28 : 0.34));
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
...rest,
|
|
28
|
+
style: sx({
|
|
29
|
+
display: "inline-flex",
|
|
30
|
+
flexDirection: vertical ? "column" : "row",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap,
|
|
33
|
+
...style
|
|
34
|
+
}),
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Mark, { size, mono, decorative: true }),
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
style: sx({
|
|
41
|
+
fontFamily: "var(--font-display)",
|
|
42
|
+
fontWeight: 500,
|
|
43
|
+
fontSize,
|
|
44
|
+
letterSpacing: "-0.02em",
|
|
45
|
+
lineHeight: 1,
|
|
46
|
+
color: mono ? "currentColor" : "var(--text-primary)"
|
|
47
|
+
}),
|
|
48
|
+
children: "sereno"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
Brand
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/Brand.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * The Sereno mark: an indigo water-drop symbol, optionally locked up with the\n * \"sereno\" wordmark. Token-driven — the gradient is the brand indigo\n * (`#7d8bdf` → `#4f46e5`), the wordmark uses `--font-display` (Manrope) at 500.\n */\nexport interface BrandProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Symbol height in px. In the lockups it also drives the wordmark size. */\n size?: number;\n /** `symbol` (default), `lockup` (symbol + wordmark, horizontal) or `lockup-vertical`. */\n variant?: 'symbol' | 'lockup' | 'lockup-vertical';\n /** One-colour rendering (`currentColor`) instead of the gradient — for favicons, print, tinted surfaces. */\n mono?: boolean;\n}\n\nconst DROP = 'M24 3 C 22 7.5 8 22 8 31.5 C 8 39 15 45 24 45 C 33 45 40 39 40 31.5 C 40 22 26 7.5 24 3 Z';\n\nfunction Mark({ size, mono, decorative }: { size: number; mono: boolean; decorative: boolean }) {\n const gid = React.useId();\n const a11y = decorative ? { 'aria-hidden': true as const } : { role: 'img' as const, 'aria-label': 'Sereno' };\n return (\n <svg width={size} height={size} viewBox=\"0 0 48 48\" {...a11y} style={{ display: 'block', flex: '0 0 auto' }}>\n {!mono && (\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"3\" x2=\"0\" y2=\"45\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stopColor=\"#7d8bdf\" />\n <stop offset=\"1\" stopColor=\"#4f46e5\" />\n </linearGradient>\n </defs>\n )}\n <path d={DROP} fill={mono ? 'currentColor' : `url(#${gid})`} />\n </svg>\n );\n}\n\nexport function Brand({ size = 24, variant = 'symbol', mono = false, style, ...rest }: BrandProps) {\n if (variant === 'symbol') {\n return (\n <span {...rest} style={sx({ display: 'inline-flex', ...style })}>\n <Mark size={size} mono={mono} decorative={false} />\n </span>\n );\n }\n\n const vertical = variant === 'lockup-vertical';\n const fontSize = Math.round(size * (vertical ? 1 : 0.78));\n const gap = Math.round(size * (vertical ? 0.28 : 0.34));\n return (\n <span\n {...rest}\n style={sx({\n display: 'inline-flex',\n flexDirection: vertical ? 'column' : 'row',\n alignItems: 'center',\n gap,\n ...style,\n })}\n >\n <Mark size={size} mono={mono} decorative />\n <span\n style={sx({\n fontFamily: 'var(--font-display)',\n fontWeight: 500,\n fontSize,\n letterSpacing: '-0.02em',\n lineHeight: 1,\n color: mono ? 'currentColor' : 'var(--text-primary)',\n })}\n >\n sereno\n </span>\n </span>\n );\n}\n"],"mappings":";AA4BU,SACE,KADF;AA1BV,YAAY,WAAW;AACvB,SAAS,UAAU;AAgBnB,MAAM,OAAO;AAEb,SAAS,KAAK,EAAE,MAAM,MAAM,WAAW,GAAyD;AAC9F,QAAM,MAAM,MAAM,MAAM;AACxB,QAAM,OAAO,aAAa,EAAE,eAAe,KAAc,IAAI,EAAE,MAAM,OAAgB,cAAc,SAAS;AAC5G,SACE,qBAAC,SAAI,OAAO,MAAM,QAAQ,MAAM,SAAQ,aAAa,GAAG,MAAM,OAAO,EAAE,SAAS,SAAS,MAAM,WAAW,GACvG;AAAA,KAAC,QACA,oBAAC,UACC,+BAAC,oBAAe,IAAI,KAAK,IAAG,KAAI,IAAG,KAAI,IAAG,KAAI,IAAG,MAAK,eAAc,kBAClE;AAAA,0BAAC,UAAK,QAAO,KAAI,WAAU,WAAU;AAAA,MACrC,oBAAC,UAAK,QAAO,KAAI,WAAU,WAAU;AAAA,OACvC,GACF;AAAA,IAEF,oBAAC,UAAK,GAAG,MAAM,MAAM,OAAO,iBAAiB,QAAQ,GAAG,KAAK;AAAA,KAC/D;AAEJ;AAEO,SAAS,MAAM,EAAE,OAAO,IAAI,UAAU,UAAU,OAAO,OAAO,OAAO,GAAG,KAAK,GAAe;AACjG,MAAI,YAAY,UAAU;AACxB,WACE,oBAAC,UAAM,GAAG,MAAM,OAAO,GAAG,EAAE,SAAS,eAAe,GAAG,MAAM,CAAC,GAC5D,8BAAC,QAAK,MAAY,MAAY,YAAY,OAAO,GACnD;AAAA,EAEJ;AAEA,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,KAAK,MAAM,QAAQ,WAAW,IAAI,KAAK;AACxD,QAAM,MAAM,KAAK,MAAM,QAAQ,WAAW,OAAO,KAAK;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,GAAG;AAAA,QACR,SAAS;AAAA,QACT,eAAe,WAAW,WAAW;AAAA,QACrC,YAAY;AAAA,QACZ;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,4BAAC,QAAK,MAAY,MAAY,YAAU,MAAC;AAAA,QACzC;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,GAAG;AAAA,cACR,YAAY;AAAA,cACZ,YAAY;AAAA,cACZ;AAAA,cACA,eAAe;AAAA,cACf,YAAY;AAAA,cACZ,OAAO,OAAO,iBAAiB;AAAA,YACjC,CAAC;AAAA,YACF;AAAA;AAAA,QAED;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|