@vinhhypc/config-theme 0.1.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 +57 -0
- package/dist/components/themed/Accordion.d.ts +23 -0
- package/dist/components/themed/Accordion.js +37 -0
- package/dist/components/themed/Accordion.js.map +1 -0
- package/dist/components/themed/Alert.d.ts +13 -0
- package/dist/components/themed/Alert.js +17 -0
- package/dist/components/themed/Alert.js.map +1 -0
- package/dist/components/themed/Avatar.d.ts +19 -0
- package/dist/components/themed/Avatar.js +30 -0
- package/dist/components/themed/Avatar.js.map +1 -0
- package/dist/components/themed/Badge.d.ts +11 -0
- package/dist/components/themed/Badge.js +17 -0
- package/dist/components/themed/Badge.js.map +1 -0
- package/dist/components/themed/Button.d.ts +14 -0
- package/dist/components/themed/Button.js +20 -0
- package/dist/components/themed/Button.js.map +1 -0
- package/dist/components/themed/Calendar.d.ts +18 -0
- package/dist/components/themed/Calendar.js +59 -0
- package/dist/components/themed/Calendar.js.map +1 -0
- package/dist/components/themed/Card.d.ts +17 -0
- package/dist/components/themed/Card.js +14 -0
- package/dist/components/themed/Card.js.map +1 -0
- package/dist/components/themed/Checkbox.d.ts +16 -0
- package/dist/components/themed/Checkbox.js +15 -0
- package/dist/components/themed/Checkbox.js.map +1 -0
- package/dist/components/themed/DropdownMenu.d.ts +20 -0
- package/dist/components/themed/DropdownMenu.js +39 -0
- package/dist/components/themed/DropdownMenu.js.map +1 -0
- package/dist/components/themed/Input.d.ts +18 -0
- package/dist/components/themed/Input.js +25 -0
- package/dist/components/themed/Input.js.map +1 -0
- package/dist/components/themed/Pagination.d.ts +17 -0
- package/dist/components/themed/Pagination.js +33 -0
- package/dist/components/themed/Pagination.js.map +1 -0
- package/dist/components/themed/Select.d.ts +16 -0
- package/dist/components/themed/Select.js +20 -0
- package/dist/components/themed/Select.js.map +1 -0
- package/dist/components/themed/Sheet.d.ts +19 -0
- package/dist/components/themed/Sheet.js +28 -0
- package/dist/components/themed/Sheet.js.map +1 -0
- package/dist/components/themed/Sidebar.d.ts +21 -0
- package/dist/components/themed/Sidebar.js +11 -0
- package/dist/components/themed/Sidebar.js.map +1 -0
- package/dist/components/themed/Table.d.ts +21 -0
- package/dist/components/themed/Table.js +10 -0
- package/dist/components/themed/Table.js.map +1 -0
- package/dist/components/themed/ThemeProvider.d.ts +41 -0
- package/dist/components/themed/ThemeProvider.js +53 -0
- package/dist/components/themed/ThemeProvider.js.map +1 -0
- package/dist/components/themed/Toast.d.ts +19 -0
- package/dist/components/themed/Toast.js +13 -0
- package/dist/components/themed/Toast.js.map +1 -0
- package/dist/components/themed/Tooltip.d.ts +15 -0
- package/dist/components/themed/Tooltip.js +11 -0
- package/dist/components/themed/Tooltip.js.map +1 -0
- package/dist/components/themed/index.d.ts +33 -0
- package/dist/components/themed/index.js +35 -0
- package/dist/components/themed/index.js.map +1 -0
- package/dist/components/themed/styles.d.ts +29 -0
- package/dist/components/themed/styles.js +270 -0
- package/dist/components/themed/styles.js.map +1 -0
- package/dist/components/themed/themeCss.d.ts +35 -0
- package/dist/components/themed/themeCss.js +76 -0
- package/dist/components/themed/themeCss.js.map +1 -0
- package/dist/lib/config/defaults.d.ts +5 -0
- package/dist/lib/config/defaults.js +86 -0
- package/dist/lib/config/defaults.js.map +1 -0
- package/dist/lib/config/presets.d.ts +13 -0
- package/dist/lib/config/presets.js +104 -0
- package/dist/lib/config/presets.js.map +1 -0
- package/dist/lib/config/types.d.ts +146 -0
- package/dist/lib/config/types.js +46 -0
- package/dist/lib/config/types.js.map +1 -0
- package/dist/lib/tokens/adapters.d.ts +15 -0
- package/dist/lib/tokens/adapters.js +102 -0
- package/dist/lib/tokens/adapters.js.map +1 -0
- package/dist/lib/tokens/color.d.ts +23 -0
- package/dist/lib/tokens/color.js +132 -0
- package/dist/lib/tokens/color.js.map +1 -0
- package/dist/lib/tokens/elevation.d.ts +6 -0
- package/dist/lib/tokens/elevation.js +40 -0
- package/dist/lib/tokens/elevation.js.map +1 -0
- package/dist/lib/tokens/index.d.ts +43 -0
- package/dist/lib/tokens/index.js +88 -0
- package/dist/lib/tokens/index.js.map +1 -0
- package/dist/lib/tokens/interactions.d.ts +12 -0
- package/dist/lib/tokens/interactions.js +72 -0
- package/dist/lib/tokens/interactions.js.map +1 -0
- package/dist/lib/tokens/opacity.d.ts +14 -0
- package/dist/lib/tokens/opacity.js +34 -0
- package/dist/lib/tokens/opacity.js.map +1 -0
- package/dist/lib/tokens/spacing.d.ts +17 -0
- package/dist/lib/tokens/spacing.js +32 -0
- package/dist/lib/tokens/spacing.js.map +1 -0
- package/dist/lib/tokens/typography.d.ts +16 -0
- package/dist/lib/tokens/typography.js +23 -0
- package/dist/lib/tokens/typography.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** Build the visible page list with ellipses for large ranges. */
|
|
3
|
+
function pageList(page, total, siblings) {
|
|
4
|
+
if (total <= siblings + 2) {
|
|
5
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
6
|
+
}
|
|
7
|
+
const pages = new Set([1, total, page]);
|
|
8
|
+
for (let i = 1; i <= Math.floor(siblings / 2); i++) {
|
|
9
|
+
pages.add(Math.max(1, page - i));
|
|
10
|
+
pages.add(Math.min(total, page + i));
|
|
11
|
+
}
|
|
12
|
+
const sorted = [...pages].sort((a, b) => a - b);
|
|
13
|
+
const out = [];
|
|
14
|
+
let prev = 0;
|
|
15
|
+
for (const p of sorted) {
|
|
16
|
+
if (p - prev > 1)
|
|
17
|
+
out.push("…");
|
|
18
|
+
out.push(p);
|
|
19
|
+
prev = p;
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Token-driven pagination. Emits semantic classes (`tc-pagination`, `tc-page`,
|
|
25
|
+
* …) styled by the surrounding `<ThemedSurface>`, so it re-themes with the
|
|
26
|
+
* active design config.
|
|
27
|
+
*/
|
|
28
|
+
export function Pagination({ page, total, onChange, siblings = 5 }) {
|
|
29
|
+
const go = (p) => onChange(Math.min(total, Math.max(1, p)));
|
|
30
|
+
return (_jsxs("nav", { className: "tc-pagination", "aria-label": "Ph\u00E2n trang", children: [_jsx("button", { type: "button", className: "tc-page", disabled: page <= 1, onClick: () => go(page - 1), "aria-label": "Trang tr\u01B0\u1EDBc", children: "\u2039" }), pageList(page, total, siblings).map((p, i) => p === "…" ? (_jsx("span", { className: "tc-page", "aria-hidden": "true", style: { border: 0, background: "transparent", cursor: "default" }, children: "\u2026" }, `gap-${i}`)) : (_jsx("button", { type: "button", className: p === page ? "tc-page tc-page--active" : "tc-page", "aria-current": p === page ? "page" : undefined, onClick: () => go(p), children: p }, p))), _jsx("button", { type: "button", className: "tc-page", disabled: page >= total, onClick: () => go(page + 1), "aria-label": "Trang sau", children: "\u203A" })] }));
|
|
31
|
+
}
|
|
32
|
+
Pagination.displayName = "Pagination";
|
|
33
|
+
//# sourceMappingURL=Pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../../components/themed/Pagination.tsx"],"names":[],"mappings":";AAYA,kEAAkE;AAClE,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa,EAAE,QAAgB;IAC7D,IAAI,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,GA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CAAC,gBAAa,uBAAa,uBAE3G,EACR,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC5C,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CACV,eAAuB,SAAS,EAAC,SAAS,iBAAa,MAAM,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,wBAArH,OAAO,CAAC,EAAE,CAEd,CACR,CAAC,CAAC,CAAC,CACF,iBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,kBAC/C,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC7C,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,YAEnB,CAAC,IANG,CAAC,CAOC,CACV,CACF,EACD,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,EAAE,IAAI,IAAI,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,gBAAa,WAAW,uBAE7G,IACL,CACP,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { type SelectHTMLAttributes } from "react";
|
|
2
|
+
import type { InputVariant } from "./Input.js";
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
8
|
+
options: SelectOption[];
|
|
9
|
+
variant?: InputVariant;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Token-driven select. Reuses the input classes (`tci`, …) styled by the
|
|
14
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// `React` imported explicitly so this also renders under Storybook's Vite
|
|
3
|
+
// pipeline (classic JSX runtime); harmless in the Next app.
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Token-driven select. Reuses the input classes (`tci`, …) styled by the
|
|
7
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
8
|
+
*/
|
|
9
|
+
export const Select = forwardRef(({ options, variant = "outline", error, className, ...props }, ref) => {
|
|
10
|
+
const classes = ["tci"];
|
|
11
|
+
if (variant !== "outline")
|
|
12
|
+
classes.push(`tci--${variant}`);
|
|
13
|
+
if (error)
|
|
14
|
+
classes.push("tci--error");
|
|
15
|
+
if (className)
|
|
16
|
+
classes.push(className);
|
|
17
|
+
return (_jsx("select", { ref: ref, className: classes.join(" "), ...props, children: options.map((o) => (_jsx("option", { value: o.value, children: o.label }, o.value))) }));
|
|
18
|
+
});
|
|
19
|
+
Select.displayName = "Select";
|
|
20
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../../components/themed/Select.tsx"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,4DAA4D;AAC5D,OAAc,EAAE,UAAU,EAA6B,MAAM,OAAO,CAAC;AAcrE;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACpE,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC;IAC3D,IAAI,KAAK;QAAE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,IAAI,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,CACL,iBAAQ,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAM,KAAK,YACtD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClB,iBAAsB,KAAK,EAAE,CAAC,CAAC,KAAK,YACjC,CAAC,CAAC,KAAK,IADG,CAAC,CAAC,KAAK,CAEX,CACV,CAAC,GACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
export type SheetSide = "right" | "left";
|
|
3
|
+
export interface SheetProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
side?: SheetSide;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Token-driven slide-over sheet (drawer). Emits semantic classes
|
|
12
|
+
* (`tc-drawer`, `tc-drawer--right`, …) styled by the surrounding
|
|
13
|
+
* `<ThemedSurface>`, so it re-themes with the active design config. Closes on
|
|
14
|
+
* overlay click / Escape.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Sheet({ open, onClose, side, title, children }: SheetProps): React.JSX.Element | null;
|
|
17
|
+
export declare namespace Sheet {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
// `React` imported explicitly so this also renders under Storybook's Vite
|
|
4
|
+
// pipeline (classic JSX runtime); harmless in the Next app.
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
/**
|
|
7
|
+
* Token-driven slide-over sheet (drawer). Emits semantic classes
|
|
8
|
+
* (`tc-drawer`, `tc-drawer--right`, …) styled by the surrounding
|
|
9
|
+
* `<ThemedSurface>`, so it re-themes with the active design config. Closes on
|
|
10
|
+
* overlay click / Escape.
|
|
11
|
+
*/
|
|
12
|
+
export function Sheet({ open, onClose, side = "right", title, children }) {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!open)
|
|
15
|
+
return;
|
|
16
|
+
const onKey = (e) => {
|
|
17
|
+
if (e.key === "Escape")
|
|
18
|
+
onClose();
|
|
19
|
+
};
|
|
20
|
+
document.addEventListener("keydown", onKey);
|
|
21
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
22
|
+
}, [open, onClose]);
|
|
23
|
+
if (!open)
|
|
24
|
+
return null;
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "tc-drawer-overlay", onClick: onClose, "aria-hidden": "true" }), _jsxs("aside", { className: `tc-drawer tc-drawer--${side}`, role: "dialog", "aria-modal": "true", "aria-label": typeof title === "string" ? title : "Sheet", children: [title != null && _jsx("h3", { className: "tc-dialog__title", children: title }), children] })] }));
|
|
26
|
+
}
|
|
27
|
+
Sheet.displayName = "Sheet";
|
|
28
|
+
//# sourceMappingURL=Sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sheet.js","sourceRoot":"","sources":["../../../../../components/themed/Sheet.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,0EAA0E;AAC1E,4DAA4D;AAC5D,OAAc,EAAE,SAAS,EA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8
|
+
items: SidebarItem[];
|
|
9
|
+
activeId?: string;
|
|
10
|
+
onSelect?: (id: string) => void;
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Token-driven sidebar nav. Emits semantic classes (`tc-sidebar`, …) styled by
|
|
15
|
+
* the surrounding `<ThemedSurface>`, so it re-themes with the active design
|
|
16
|
+
* config.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Sidebar({ items, activeId, onSelect, title }: SidebarProps): React.JSX.Element;
|
|
19
|
+
export declare namespace Sidebar {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Token-driven sidebar nav. Emits semantic classes (`tc-sidebar`, …) styled by
|
|
4
|
+
* the surrounding `<ThemedSurface>`, so it re-themes with the active design
|
|
5
|
+
* config.
|
|
6
|
+
*/
|
|
7
|
+
export function Sidebar({ items, activeId, onSelect, title }) {
|
|
8
|
+
return (_jsxs("nav", { className: "tc-sidebar", "aria-label": "\u0110i\u1EC1u h\u01B0\u1EDBng", children: [title != null && _jsx("p", { className: "tc-sidebar__title", children: title }), items.map((item) => (_jsxs("button", { type: "button", className: item.id === activeId ? "tc-sidebar__item tc-sidebar__item--active" : "tc-sidebar__item", "aria-current": item.id === activeId ? "page" : undefined, onClick: () => onSelect?.(item.id), children: [item.icon, item.label] }, item.id)))] }));
|
|
9
|
+
}
|
|
10
|
+
Sidebar.displayName = "Sidebar";
|
|
11
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../../components/themed/Sidebar.tsx"],"names":[],"mappings":";AAiBA;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAgB;IACxE,OAAO,CACL,eAAK,SAAS,EAAC,YAAY,gBAAY,gCAAY,aAChD,KAAK,IAAI,IAAI,IAAI,YAAG,SAAS,EAAC,mBAAmB,YAAE,KAAK,GAAK,EAC7D,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,kBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC,CAAC,kBAAkB,kBACpF,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACvD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAEjC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,KAPN,IAAI,CAAC,EAAE,CAQL,CACV,CAAC,IACE,CACP,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
export interface TableColumn<T> {
|
|
3
|
+
key: keyof T & string;
|
|
4
|
+
header: ReactNode;
|
|
5
|
+
/** Custom cell renderer; defaults to the raw value. */
|
|
6
|
+
render?: (row: T) => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface TableProps<T> {
|
|
9
|
+
columns: TableColumn<T>[];
|
|
10
|
+
data: T[];
|
|
11
|
+
/** Optional key extractor; defaults to the row index. */
|
|
12
|
+
rowKey?: (row: T, index: number) => string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Token-driven table. Emits the semantic `tc-table` class styled by the
|
|
16
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Table<T>({ columns, data, rowKey }: TableProps<T>): React.JSX.Element;
|
|
19
|
+
export declare namespace Table {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Token-driven table. Emits the semantic `tc-table` class styled by the
|
|
4
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
5
|
+
*/
|
|
6
|
+
export function Table({ columns, data, rowKey }) {
|
|
7
|
+
return (_jsxs("table", { className: "tc-table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((c) => (_jsx("th", { children: c.header }, c.key))) }) }), _jsx("tbody", { children: data.map((row, i) => (_jsx("tr", { children: columns.map((c) => (_jsx("td", { children: c.render ? c.render(row) : row[c.key] }, c.key))) }, rowKey ? rowKey(row, i) : i))) })] }));
|
|
8
|
+
}
|
|
9
|
+
Table.displayName = "Table";
|
|
10
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../../components/themed/Table.tsx"],"names":[],"mappings":";AAkBA;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAiB;IAC/D,OAAO,CACL,iBAAO,SAAS,EAAC,UAAU,aACzB,0BACE,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClB,uBAAiB,CAAC,CAAC,MAAM,IAAhB,CAAC,CAAC,GAAG,CAAiB,CAChC,CAAC,GACC,GACC,EACR,0BACG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACpB,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClB,uBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAe,IAA5D,CAAC,CAAC,GAAG,CAA6D,CAC5E,CAAC,IAHK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAI/B,CACN,CAAC,GACI,IACF,CACT,CAAC;AACJ,CAAC;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import type { DesignConfig } from "../../lib/config/types.js";
|
|
3
|
+
import { type Mode } from "./themeCss.js";
|
|
4
|
+
interface ThemeContextValue {
|
|
5
|
+
config: DesignConfig;
|
|
6
|
+
mode: Mode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Access the active design config / mode from inside a `<ThemeProvider>`.
|
|
10
|
+
* The themed components don't need this (they are class-driven), but consumer
|
|
11
|
+
* code can read it to make config-aware decisions.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useTheme(): ThemeContextValue;
|
|
14
|
+
export interface ThemeProviderProps {
|
|
15
|
+
/** The chosen design tokens. Drives every CSS variable + the component sheet. */
|
|
16
|
+
config: DesignConfig;
|
|
17
|
+
/** Light or dark surface vars. Default: "light". */
|
|
18
|
+
mode?: Mode;
|
|
19
|
+
/** Paint the configured surface background + padding around children. */
|
|
20
|
+
surface?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The config provider for the themed component library.
|
|
27
|
+
*
|
|
28
|
+
* Wrap your app (or any subtree) in `<ThemeProvider config={...}>`. It:
|
|
29
|
+
* 1. sets every design token as a CSS custom property on a scoped wrapper, and
|
|
30
|
+
* 2. injects the component stylesheet (`.tcb`, `.tc-card`, …) scoped to that
|
|
31
|
+
* same wrapper.
|
|
32
|
+
*
|
|
33
|
+
* Because the scope is generated per instance, multiple providers with
|
|
34
|
+
* different configs can coexist on one page. Components emit only semantic
|
|
35
|
+
* classes, so they re-theme automatically whenever `config`/`mode` change.
|
|
36
|
+
*/
|
|
37
|
+
export declare function ThemeProvider({ config, mode, surface, className, style, children, }: ThemeProviderProps): React.JSX.Element;
|
|
38
|
+
export declare namespace ThemeProvider {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// `React` imported explicitly so this also renders under non-automatic JSX
|
|
4
|
+
// runtimes (Storybook's Vite pipeline); harmless in the Next app.
|
|
5
|
+
import { createContext, useContext, useId, useMemo, } from "react";
|
|
6
|
+
import { themeVars } from "./themeCss.js";
|
|
7
|
+
import { componentStyles } from "./styles.js";
|
|
8
|
+
const ThemeContext = createContext(null);
|
|
9
|
+
/**
|
|
10
|
+
* Access the active design config / mode from inside a `<ThemeProvider>`.
|
|
11
|
+
* The themed components don't need this (they are class-driven), but consumer
|
|
12
|
+
* code can read it to make config-aware decisions.
|
|
13
|
+
*/
|
|
14
|
+
export function useTheme() {
|
|
15
|
+
const ctx = useContext(ThemeContext);
|
|
16
|
+
if (!ctx)
|
|
17
|
+
throw new Error("useTheme must be used within <ThemeProvider>");
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The config provider for the themed component library.
|
|
22
|
+
*
|
|
23
|
+
* Wrap your app (or any subtree) in `<ThemeProvider config={...}>`. It:
|
|
24
|
+
* 1. sets every design token as a CSS custom property on a scoped wrapper, and
|
|
25
|
+
* 2. injects the component stylesheet (`.tcb`, `.tc-card`, …) scoped to that
|
|
26
|
+
* same wrapper.
|
|
27
|
+
*
|
|
28
|
+
* Because the scope is generated per instance, multiple providers with
|
|
29
|
+
* different configs can coexist on one page. Components emit only semantic
|
|
30
|
+
* classes, so they re-theme automatically whenever `config`/`mode` change.
|
|
31
|
+
*/
|
|
32
|
+
export function ThemeProvider({ config, mode = "light", surface = false, className, style, children, }) {
|
|
33
|
+
const rawId = useId();
|
|
34
|
+
const scope = "tc" + rawId.replace(/[^a-zA-Z0-9]/g, "");
|
|
35
|
+
const vars = useMemo(() => themeVars(config, mode), [config, mode]);
|
|
36
|
+
const css = useMemo(() => componentStyles(`.${scope} `, config), [scope, config]);
|
|
37
|
+
const rootStyle = {
|
|
38
|
+
...vars,
|
|
39
|
+
fontFamily: "var(--font-base)",
|
|
40
|
+
color: "var(--text)",
|
|
41
|
+
...(surface
|
|
42
|
+
? {
|
|
43
|
+
background: "var(--surface)",
|
|
44
|
+
padding: "var(--space-6)",
|
|
45
|
+
borderRadius: "var(--radius-lg)",
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
48
|
+
...style,
|
|
49
|
+
};
|
|
50
|
+
return (_jsx(ThemeContext.Provider, { value: { config, mode }, children: _jsxs("div", { className: [scope, className].filter(Boolean).join(" "), style: rootStyle, children: [_jsx("style", { dangerouslySetInnerHTML: { __html: css } }), children] }) }));
|
|
51
|
+
}
|
|
52
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
53
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../../../../components/themed/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,2EAA2E;AAC3E,kEAAkE;AAClE,OAAc,EACZ,aAAa,EACb,UAAU,EACV,KAAK,EACL,OAAO,GAGR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3C,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,U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AC,EAAE,KAAK,EAAE,SAAS,aAE5E,gBAAO,uBAAuB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAI,EAClD,QAAQ,IACL,GACgB,CACzB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
export type ToastVariant = "info" | "success" | "warning" | "error";
|
|
3
|
+
export interface ToastProps {
|
|
4
|
+
variant?: ToastVariant;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** When provided, renders a close button. */
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Token-driven toast. Emits semantic classes (`tc-toast`, `tc-toast--success`,
|
|
12
|
+
* …) styled by the surrounding `<ThemedSurface>`, so it re-themes with the
|
|
13
|
+
* active design config. Presentational — positioning/lifetime is up to the
|
|
14
|
+
* caller.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Toast({ variant, title, children, onClose }: ToastProps): React.JSX.Element;
|
|
17
|
+
export declare namespace Toast {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Token-driven toast. Emits semantic classes (`tc-toast`, `tc-toast--success`,
|
|
4
|
+
* …) styled by the surrounding `<ThemedSurface>`, so it re-themes with the
|
|
5
|
+
* active design config. Presentational — positioning/lifetime is up to the
|
|
6
|
+
* caller.
|
|
7
|
+
*/
|
|
8
|
+
export function Toast({ variant = "info", title, children, onClose }) {
|
|
9
|
+
const classes = ["tc-toast", `tc-toast--${variant}`];
|
|
10
|
+
return (_jsxs("div", { className: classes.join(" "), role: "status", children: [_jsxs("div", { className: "tc-toast__body", children: [title != null && _jsx("div", { className: "tc-toast__title", children: title }), children != null && _jsx("div", { className: "tc-toast__msg", children: children })] }), onClose && (_jsx("button", { type: "button", className: "tc-toast__close", "aria-label": "\u0110\u00F3ng", onClick: onClose, children: "\u00D7" }))] }));
|
|
11
|
+
}
|
|
12
|
+
Toast.displayName = "Toast";
|
|
13
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../../../components/themed/Toast.tsx"],"names":[],"mappings":";AAcA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAc;IAC9E,MAAM,OAAO,GAAG,CAAC,UAAU,EAAE,aAAa,OAAO,EAAE,CAAC,CAAC;IACrD,OAAO,CACL,eAAK,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,aAC9C,eAAK,SAAS,EAAC,gBAAgB,aAC5B,KAAK,IAAI,IAAI,IAAI,cAAK,SAAS,EAAC,iBAAiB,YAAE,KAAK,GAAO,EAC/D,QAAQ,IAAI,IAAI,IAAI,cAAK,SAAS,EAAC,eAAe,YAAE,QAAQ,GAAO,IAChE,EACL,OAAO,IAAI,CACV,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,iBAAiB,gBAAY,gBAAM,EAAC,OAAO,EAAE,OAAO,uBAE3E,CACV,IACG,CACP,CAAC;AACJ,CAAC;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
export interface TooltipProps {
|
|
3
|
+
/** Text shown in the popover on hover / focus. */
|
|
4
|
+
text: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Token-driven tooltip. Emits semantic classes (`tc-tooltip`, …) styled by the
|
|
9
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
10
|
+
* Pure CSS hover/focus — no JS state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Tooltip({ text, children }: TooltipProps): React.JSX.Element;
|
|
13
|
+
export declare namespace Tooltip {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Token-driven tooltip. Emits semantic classes (`tc-tooltip`, …) styled by the
|
|
4
|
+
* surrounding `<ThemedSurface>`, so it re-themes with the active design config.
|
|
5
|
+
* Pure CSS hover/focus — no JS state.
|
|
6
|
+
*/
|
|
7
|
+
export function Tooltip({ text, children }) {
|
|
8
|
+
return (_jsxs("span", { className: "tc-tooltip", tabIndex: 0, children: [children, _jsx("span", { role: "tooltip", className: "tc-tooltip__pop", children: text })] }));
|
|
9
|
+
}
|
|
10
|
+
Tooltip.displayName = "Tooltip";
|
|
11
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../components/themed/Tooltip.tsx"],"names":[],"mappings":";AAUA;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAgB;IACtD,OAAO,CACL,gBAAM,SAAS,EAAC,YAAY,EAAC,QAAQ,EAAE,CAAC,aACrC,QAAQ,EACT,eAAM,IAAI,EAAC,SAAS,EAAC,SAAS,EAAC,iBAAiB,YAC7C,IAAI,GACA,IACF,CACR,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for the themed component library.
|
|
3
|
+
*
|
|
4
|
+
* Consumers wrap their app in `<ThemeProvider config={...}>` and use any of the
|
|
5
|
+
* components below; everything re-themes from the provided design tokens.
|
|
6
|
+
*
|
|
7
|
+
* import { ThemeProvider, Button, Card } from "@vinhhypc/config-theme";
|
|
8
|
+
* import { presets, applyPreset } from "@vinhhypc/config-theme";
|
|
9
|
+
*/
|
|
10
|
+
export { ThemeProvider, useTheme, type ThemeProviderProps } from "./ThemeProvider.js";
|
|
11
|
+
export { themeVars, type Mode } from "./themeCss.js";
|
|
12
|
+
export { componentStyles } from "./styles.js";
|
|
13
|
+
export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from "./Button.js";
|
|
14
|
+
export { Accordion, type AccordionProps, type AccordionItem } from "./Accordion.js";
|
|
15
|
+
export { Alert, type AlertProps, type AlertVariant } from "./Alert.js";
|
|
16
|
+
export { Avatar, type AvatarProps, type AvatarSize, type AvatarVariant } from "./Avatar.js";
|
|
17
|
+
export { Badge, type BadgeProps, type BadgeVariant } from "./Badge.js";
|
|
18
|
+
export { Calendar, type CalendarProps } from "./Calendar.js";
|
|
19
|
+
export { Card, type CardProps, type CardVariant } from "./Card.js";
|
|
20
|
+
export { Checkbox, type CheckboxProps } from "./Checkbox.js";
|
|
21
|
+
export { DropdownMenu, type DropdownMenuProps, type DropdownMenuItem } from "./DropdownMenu.js";
|
|
22
|
+
export { Input, Field, type InputProps, type InputVariant } from "./Input.js";
|
|
23
|
+
export { Pagination, type PaginationProps } from "./Pagination.js";
|
|
24
|
+
export { Select, type SelectProps, type SelectOption } from "./Select.js";
|
|
25
|
+
export { Sidebar, type SidebarProps, type SidebarItem } from "./Sidebar.js";
|
|
26
|
+
export { Sheet, type SheetProps, type SheetSide } from "./Sheet.js";
|
|
27
|
+
export { Table, type TableProps, type TableColumn } from "./Table.js";
|
|
28
|
+
export { Toast, type ToastProps, type ToastVariant } from "./Toast.js";
|
|
29
|
+
export { Tooltip, type TooltipProps } from "./Tooltip.js";
|
|
30
|
+
export type { DesignConfig, ThemeMode, ThemeStyle } from "../../lib/config/types.js";
|
|
31
|
+
export { defaultConfig, cloneConfig } from "../../lib/config/defaults.js";
|
|
32
|
+
export { presets, applyPreset } from "../../lib/config/presets.js";
|
|
33
|
+
export { resolveTokens, buildCssVars, cssVarsToBlock, cssVarsToStyleObject } from "../../lib/tokens/index.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for the themed component library.
|
|
3
|
+
*
|
|
4
|
+
* Consumers wrap their app in `<ThemeProvider config={...}>` and use any of the
|
|
5
|
+
* components below; everything re-themes from the provided design tokens.
|
|
6
|
+
*
|
|
7
|
+
* import { ThemeProvider, Button, Card } from "@vinhhypc/config-theme";
|
|
8
|
+
* import { presets, applyPreset } from "@vinhhypc/config-theme";
|
|
9
|
+
*/
|
|
10
|
+
/* Provider + theming primitives */
|
|
11
|
+
export { ThemeProvider, useTheme } from "./ThemeProvider.js";
|
|
12
|
+
export { themeVars } from "./themeCss.js";
|
|
13
|
+
export { componentStyles } from "./styles.js";
|
|
14
|
+
/* Components */
|
|
15
|
+
export { Button } from "./Button.js";
|
|
16
|
+
export { Accordion } from "./Accordion.js";
|
|
17
|
+
export { Alert } from "./Alert.js";
|
|
18
|
+
export { Avatar } from "./Avatar.js";
|
|
19
|
+
export { Badge } from "./Badge.js";
|
|
20
|
+
export { Calendar } from "./Calendar.js";
|
|
21
|
+
export { Card } from "./Card.js";
|
|
22
|
+
export { Checkbox } from "./Checkbox.js";
|
|
23
|
+
export { DropdownMenu } from "./DropdownMenu.js";
|
|
24
|
+
export { Input, Field } from "./Input.js";
|
|
25
|
+
export { Pagination } from "./Pagination.js";
|
|
26
|
+
export { Select } from "./Select.js";
|
|
27
|
+
export { Sidebar } from "./Sidebar.js";
|
|
28
|
+
export { Sheet } from "./Sheet.js";
|
|
29
|
+
export { Table } from "./Table.js";
|
|
30
|
+
export { Toast } from "./Toast.js";
|
|
31
|
+
export { Tooltip } from "./Tooltip.js";
|
|
32
|
+
export { defaultConfig, cloneConfig } from "../../lib/config/defaults.js";
|
|
33
|
+
export { presets, applyPreset } from "../../lib/config/presets.js";
|
|
34
|
+
export { resolveTokens, buildCssVars, cssVarsToBlock, cssVarsToStyleObject } from "../../lib/tokens/index.js";
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../components/themed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mCAAmC;AACnC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAA2B,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,gBAAgB;AAChB,OAAO,EAAE,MAAM,EAAyD,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,SAAS,EAA2C,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,EAAsC,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,MAAM,EAAyD,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,KAAK,EAAsC,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAoC,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAiD,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,KAAK,EAAsC,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,MAAM,EAAuC,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,OAAO,EAAuC,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,KAAK,EAAmC,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,KAAK,EAAqC,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,KAAK,EAAsC,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token-driven stylesheet for every showcase component. Each builder prefixes
|
|
3
|
+
* its selectors with `p` (e.g. ".scope " for a scoped surface, or "" for a
|
|
4
|
+
* global sheet) and reads values from the design config / CSS vars, so the
|
|
5
|
+
* components re-theme automatically. `componentStyles` concatenates them all;
|
|
6
|
+
* `<ThemedSurface>` injects the result.
|
|
7
|
+
*/
|
|
8
|
+
import type { DesignConfig } from "../../lib/config/types.js";
|
|
9
|
+
export declare function buttonStyles(p: string, config: DesignConfig): string;
|
|
10
|
+
export declare function inputStyles(p: string, config: DesignConfig): string;
|
|
11
|
+
export declare function checkboxStyles(p: string, config: DesignConfig): string;
|
|
12
|
+
export declare function badgeStyles(p: string, config: DesignConfig): string;
|
|
13
|
+
export declare function alertStyles(p: string, config: DesignConfig): string;
|
|
14
|
+
export declare function avatarStyles(p: string): string;
|
|
15
|
+
export declare function cardStyles(p: string, config: DesignConfig): string;
|
|
16
|
+
export declare function tableStyles(p: string, config: DesignConfig): string;
|
|
17
|
+
export declare function progressStyles(p: string): string;
|
|
18
|
+
export declare function spinStyles(p: string): string;
|
|
19
|
+
export declare function tabsStyles(p: string, config: DesignConfig): string;
|
|
20
|
+
export declare function tooltipStyles(p: string, config: DesignConfig): string;
|
|
21
|
+
export declare function dropdownStyles(p: string, config: DesignConfig): string;
|
|
22
|
+
export declare function overlayStyles(p: string, config: DesignConfig): string;
|
|
23
|
+
export declare function paginationStyles(p: string, config: DesignConfig): string;
|
|
24
|
+
export declare function calendarStyles(p: string, config: DesignConfig): string;
|
|
25
|
+
export declare function sidebarStyles(p: string, config: DesignConfig): string;
|
|
26
|
+
export declare function toastStyles(p: string, config: DesignConfig): string;
|
|
27
|
+
export declare function accordionStyles(p: string, config: DesignConfig): string;
|
|
28
|
+
/** Concatenate every component stylesheet for the given selector prefix. */
|
|
29
|
+
export declare function componentStyles(prefix: string, config: DesignConfig): string;
|