This commit is contained in:
2026-11-29 07:30:49 +08:00
parent ea56e4cabd
commit 0026089761
71 changed files with 8054 additions and 1428 deletions
@@ -1,11 +1,9 @@
import {
type CSSProperties,
} from "react";
import { mergeClass } from "../../styles/utils/merge-class";
import { type CSSProperties } from "react";
import { displayRecipe } from "../../styles/recipes/display-recipe";
import { dotSizeRecipe } from "../../styles/recipes/dot-size-recipe";
import type { CommonProps } from "../../utils/common-props";
import { brandRecipe } from "../../styles/recipes/brand-recipe";
import { mergeClass } from "../../styles/utils/merge-class";
import type { CommonProps } from "../../utils/common-props";
export type BadgeProps = CommonProps & {
size?: "xs" | "sm" | "md" | "lg";
@@ -39,12 +37,16 @@ export const Badge = (props: BadgeProps) => {
borderRadius: "9999px",
};
const indicatorClass = mergeClass(displayRecipe(), dotSizeRecipe({ size }), brandRecipe({ brand: "danger" }), "pointer-events--none", className);
const indicatorClass = mergeClass(
displayRecipe(),
dotSizeRecipe({ size }),
brandRecipe({ brand: "danger" }),
"pointer-events--none",
className,
);
return (
<div {...rest} ref={ref} style={wrapperStyle}>
<div {...rest} ref={ref} style={wrapperStyle}>
{children}
<div className={indicatorClass} style={indicatorStyle}>
{indicatorContent}
+1
View File
@@ -20,6 +20,7 @@
@import './styles/css/overscroll-behavior.css';
@import './styles/css/overflow.css';
@import './styles/css/outline.css';
@import './styles/css/opacity.css';
@import './styles/css/max-width.css';
@import './styles/css/max-height.css';
@import './styles/css/justify-self.css';
+9 -40
View File
@@ -1,44 +1,6 @@
export * from './utils/use-state-registry.ts';
export * from './utils/slot.tsx';
export * from './utils/radiobox.tsx';
export * from './utils/merge-props.ts';
export * from './utils/down-grade-size.ts';
export * from './utils/common-props.ts';
export * from './components/checkbox-input/checkbox-input.tsx';
export * from './utils/camel-to-kebab.ts';
import './index.css';
export * from './styles/utils/merge-class.ts';
export * from './styles/utils/create-class-recipe.ts';
export * from './styles/recipes/variant-recipe.ts';
export * from './styles/recipes/item-size-recipe.ts';
export * from './styles/recipes/inline-size-recipe.ts';
export * from './styles/recipes/dot-size-recipe.ts';
export * from './styles/recipes/display-recipe.ts';
export * from './styles/recipes/container-recipe.ts';
export * from './styles/recipes/brand-recipe.ts';
export * from './components/theme/use-theme-context.ts';
export * from './components/theme/theme.tsx';
export * from './components/tag/tag.tsx';
export * from './components/slider/slider.tsx';
export * from './components/popover/use-popover-floating.ts';
export * from './components/popover/use-popover-context.ts';
export * from './components/popover/popover.tsx';
export * from './components/popover/popover-trigger.tsx';
export * from './components/popover/popover-dropdown.tsx';
export * from './components/menu/use-menu-trigger-context.ts';
export * from './components/radiobox-input/use-radiobox-input-group-context.ts';
export * from './components/menu/use-menu-floating.ts';
export * from './components/menu/use-menu-floating-context.ts';
export * from './components/menu/use-menu-context.ts';
export * from './components/menu/menu.tsx';
export * from './components/menu/menu-trigger.tsx';
export * from './components/menu/menu-radio-item.tsx';
export * from './components/menu/menu-radio-item-group.tsx';
export * from './components/menu/menu-item.tsx';
export * from './components/menu/menu-dropdown.tsx';
export * from './components/menu/menu-check-item.tsx';
export * from './components/icon/icon.tsx';
export * from './components/button/button.tsx';
export * from './components/badge/badge.tsx';
export * from './assets/svg/volume-mute-svg.tsx';
export * from './assets/svg/volume-low-svg.tsx';
export * from './assets/svg/volume-high-svg.tsx';
@@ -61,4 +23,11 @@ export * from './assets/svg/chevron-right-svg.tsx';
export * from './assets/svg/checkbox-unchecked-svg.tsx';
export * from './assets/svg/checkbox-checked-svg.tsx';
export * from './assets/svg/check-indicator-svg.tsx';
export * from './assets/svg/bold-svg.tsx';
export * from './assets/svg/bold-svg.tsx';
export * from './styles/recipes/variant-recipe.ts';
export * from './styles/recipes/item-size-recipe.ts';
export * from './styles/recipes/inline-size-recipe.ts';
export * from './styles/recipes/dot-size-recipe.ts';
export * from './styles/recipes/display-recipe.ts';
export * from './styles/recipes/container-recipe.ts';
export * from './styles/recipes/brand-recipe.ts';
@@ -27,12 +27,12 @@
border-radius: var(--radius-xl);
}
.rounded--2xl {
border-radius: var(--radius-2xl);
.rounded--xxl {
border-radius: var(--radius-xxl);
}
.rounded--3xl {
border-radius: var(--radius-3xl);
.rounded--xxxl {
border-radius: var(--radius-xxxl);
}
.rounded--4 {
@@ -24,13 +24,13 @@
line-height: var(--line-height);
}
.text--2xl {
font-size: var(--font-size-2xl);
.text--xxl {
font-size: var(--font-size-xxl);
line-height: var(--line-height);
}
.text--3xl {
font-size: var(--font-size-3xl);
.text--xxxl {
font-size: var(--font-size-xxxl);
line-height: var(--line-height);
}
}
@@ -45,11 +45,11 @@
font-weight: var(--font-weight-xl);
}
.font-weight--2xl {
font-weight: var(--font-weight-2xl);
.font-weight--xxl {
font-weight: var(--font-weight-xxl);
}
.font-weight--3xl {
font-weight: var(--font-weight-3xl);
.font-weight--xxxl {
font-weight: var(--font-weight-xxxl);
}
}
+4 -4
View File
@@ -23,11 +23,11 @@
gap: var(--gap-lg);
}
.gap--2xl {
gap: var(--gap-2xl);
.gap--xxl {
gap: var(--gap-xxl);
}
.gap--3xl {
gap: var(--gap-3xl);
.gap--xxxl {
gap: var(--gap-xxxl);
}
}
@@ -19,11 +19,11 @@
height: calc(var(--font-size-xl) / 2);
}
.h--dot-2xl {
height: calc(var(--font-size-2xl) / 2);
.h--dot-xxl {
height: calc(var(--font-size-xxl) / 2);
}
.h--dot-3xl {
height: calc(var(--font-size-3xl) / 2);
.h--dot-xxxl {
height: calc(var(--font-size-xxxl) / 2);
}
}
@@ -39,19 +39,19 @@
}
}
.h--inline-2xl {
height: calc(var(--font-size-2xl) * var(--line-height));
.h--inline-xxl {
height: calc(var(--font-size-xxl) * var(--line-height));
& svg {
height: calc(var(--font-size-2xl) * var(--line-height));
width: calc(var(--font-size-2xl) * var(--line-height));
height: calc(var(--font-size-xxl) * var(--line-height));
width: calc(var(--font-size-xxl) * var(--line-height));
}
}
.h--inline-3xl {
height: calc(var(--font-size-3xl) * var(--line-height));
.h--inline-xxxl {
height: calc(var(--font-size-xxxl) * var(--line-height));
& svg {
height: calc(var(--font-size-3xl) * var(--line-height));
width: calc(var(--font-size-3xl) * var(--line-height));
height: calc(var(--font-size-xxxl) * var(--line-height));
width: calc(var(--font-size-xxxl) * var(--line-height));
}
}
}
@@ -34,18 +34,18 @@
width: calc(var(--font-size-xl) * var(--line-height));
}
}
.h--item-2xl {
height: var(--height-item-2xl);
.h--item-xxl {
height: var(--height-item-xxl);
& svg {
height: calc(var(--font-size-2xl) * var(--line-height));
width: calc(var(--font-size-2xl) * var(--line-height));
height: calc(var(--font-size-xxl) * var(--line-height));
width: calc(var(--font-size-xxl) * var(--line-height));
}
}
.h--item-3xl {
height: var(--height-item-3xl);
.h--item-xxxl {
height: var(--height-item-xxxl);
& svg {
height: calc(var(--font-size-3xl) * var(--line-height));
width: calc(var(--font-size-3xl) * var(--line-height));
height: calc(var(--font-size-xxxl) * var(--line-height));
width: calc(var(--font-size-xxxl) * var(--line-height));
}
}
}
@@ -14,10 +14,10 @@
.px--long-xl {
padding-inline: var(--padding-long-xl);
}
.px--long-2xl {
padding-inline: var(--padding-long-2xl);
.px--long-xxl {
padding-inline: var(--padding-long-xxl);
}
.px--long-3xl {
padding-inline: var(--padding-long-3xl);
.px--long-xxxl {
padding-inline: var(--padding-long-xxxl);
}
}
+8 -8
View File
@@ -17,11 +17,11 @@
.px--xl {
padding-inline: var(--padding-xl);
}
.px--2xl {
padding-inline: var(--padding-2xl);
.px--xxl {
padding-inline: var(--padding-xxl);
}
.px--3xl {
padding-inline: var(--padding-3xl);
.px--xxxl {
padding-inline: var(--padding-xxxl);
}
/* =================================================== */
@@ -44,11 +44,11 @@
.py--xl {
padding-block: var(--padding-xl);
}
.py--2xl {
padding-block: var(--padding-2xl);
.py--xxl {
padding-block: var(--padding-xxl);
}
.py--3xl {
padding-block: var(--padding-3xl);
.py--xxxl {
padding-block: var(--padding-xxxl);
}
/* =================================================== */
+16 -16
View File
@@ -335,8 +335,8 @@
--font-size-md: 14px;
--font-size-lg: 15px;
--font-size-xl: 16px;
--font-size-2xl: 24px;
--font-size-3xl: 30px;
--font-size-xxl: 24px;
--font-size-xxxl: 30px;
--line-height: 1.33;
@@ -352,24 +352,24 @@
--font-weight-md: var(--font-weight-extranormal);
--font-weight-lg: var(--font-weight-semibold);
--font-weight-xl: var(--font-weight-semibold);
--font-weight-2xl: var(--font-weight-semibold);
--font-weight-3xl: var(--font-weight-bold);
--font-weight-xxl: var(--font-weight-semibold);
--font-weight-xxxl: var(--font-weight-bold);
--height-item-xs: 20px;
--height-item-sm: 24px;
--height-item-md: 28px;
--height-item-lg: 32px;
--height-item-xl: 42px;
--height-item-2xl: 56px;
--height-item-3xl: 64px;
--height-item-xxl: 56px;
--height-item-xxxl: 64px;
--radius-xs: 2px;
--radius-sm: 3px;
--radius-md: 4px;
--radius-lg: 5px;
--radius-xl: 8px;
--radius-2xl: 12px;
--radius-3xl: 16px;
--radius-xxl: 12px;
--radius-xxxl: 16px;
--radius-none: 0;
--radius-full: 9999px;
@@ -378,8 +378,8 @@
--padding-md: 6px;
--padding-lg: 7px;
--padding-xl: 16px;
--padding-2xl: 2px;
--padding-3xl: 2px;
--padding-xxl: 2px;
--padding-xxxl: 2px;
--times-of-padding-long: 2;
@@ -388,16 +388,16 @@
--padding-long-md: calc(var(--padding-md) * var(--times-of-padding-long));
--padding-long-lg: calc(var(--padding-lg) * var(--times-of-padding-long));
--padding-long-xl: calc(var(--padding-xl) * var(--times-of-padding-long));
--padding-long-2xl: calc(var(--padding-2xl) * var(--times-of-padding-long));
--padding-long-3xl: calc(var(--padding-3xl) * var(--times-of-padding-long));
--padding-long-xxl: calc(var(--padding-xxl) * var(--times-of-padding-long));
--padding-long-xxxl: calc(var(--padding-xxxl) * var(--times-of-padding-long));
--gap-xs: 2px;
--gap-sm: 3px;
--gap-md: 4px;
--gap-lg: 5px;
--gap-xl: 10px;
--gap-2xl: 12px;
--gap-3xl: 14px;
--gap-xxl: 12px;
--gap-xxxl: 14px;
--gap-none: 0;
--drop-shadow: drop-shadow(0 0 4px rgba(0, 0, 0, 0.14))
@@ -441,6 +441,6 @@
--height-inline-md: calc(var(--font-size-md) * var(--line-height));
--height-inline-lg: calc(var(--font-size-lg) * var(--line-height));
--height-inline-xl: calc(var(--font-size-xl) * var(--line-height));
--height-inline-2xl: calc(var(--font-size-2xl) * var(--line-height));
--height-inline-3xl: calc(var(--font-size-3xl) * var(--line-height));
--height-inline-xxl: calc(var(--font-size-xxl) * var(--line-height));
--height-inline-xxxl: calc(var(--font-size-xxxl) * var(--line-height));
}
@@ -19,12 +19,12 @@
width: calc(var(--font-size-xl) / 2);
}
.w--dot-2xl {
width: calc(var(--font-size-2xl) / 2);
.w--dot-xxl {
width: calc(var(--font-size-xxl) / 2);
}
.w--dot-3xl {
width: calc(var(--font-size-3xl) / 2);
.w--dot-xxxl {
width: calc(var(--font-size-xxxl) / 2);
}
}
@@ -19,7 +19,11 @@
width: calc(var(--font-size-xl) * var(--line-height));
}
.w--inline-xl {
width: calc(var(--font-size-2xl) * var(--line-height));
.w--inline-xxl {
width: calc(var(--font-size-xxl) * var(--line-height));
}
}
.w--inline-xxxl {
width: calc(var(--font-size-xxxl) * var(--line-height));
}
}
@@ -19,7 +19,11 @@
width: var(--height-item-xl);
}
.w--item--2xl {
width: var(--height-item-2xl);
.w--item--xxl {
width: var(--height-item-xxl);
}
}
.w--item--xxxl {
width: var(--height-item-xxxl);
}
}
@@ -19,9 +19,9 @@ type VariantProps<V extends Record<string, Record<string, string>>> = Partial<{
[K in keyof V]: keyof V[K] | boolean;
}>;
export function createClassRecipe<V extends Record<string, Record<string, string>>>(
config: VariantsConfig<V>,
) {
export function createClassRecipe<
V extends Record<string, Record<string, string>>,
>(config: VariantsConfig<V>) {
return function (props: VariantProps<V> = {}): string {
const classes: string[] = [];
@@ -1,3 +1,13 @@
/**
* Use "--" as separator to split prefix and surffix.
*
* If a utility has not "--" separator, all are treated as a prefix.
* @example
* const a = "text--xs px--xs gap";
* const b = "px--none gap--xs";
* const result = merge_class([a,b]);
* // Output: "text--xs px--none gap--xs"
*/
export function mergeClass(...classes: (string[] | string)[]) {
const map = new Map<string, string>();
+6
View File
@@ -0,0 +1,6 @@
declare module "*.css" {
const content: string;
export default content;
}
declare module "*.json";