@antadesign/anta 0.1.1-dev.7 → 0.2.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 +11 -0
- package/dist/components/Button.js +4 -3
- package/dist/components/Menu.d.ts +61 -0
- package/dist/components/Menu.js +34 -0
- package/dist/components/MenuGroup.d.ts +24 -0
- package/dist/components/MenuGroup.js +19 -0
- package/dist/components/MenuItem.d.ts +49 -0
- package/dist/components/MenuItem.js +40 -0
- package/dist/components/MenuSeparator.d.ts +14 -0
- package/dist/components/MenuSeparator.js +7 -0
- package/dist/components/Tag.d.ts +55 -0
- package/dist/components/Tag.js +40 -0
- package/dist/components/Text.d.ts +4 -2
- package/dist/components/Tooltip.d.ts +57 -0
- package/dist/components/Tooltip.js +26 -0
- package/dist/elements/a-button.css +31 -8
- package/dist/elements/a-button.d.ts +1 -0
- package/dist/elements/a-button.js +2 -0
- package/dist/elements/a-icon.d.ts +2 -0
- package/dist/elements/a-icon.js +3 -0
- package/dist/elements/a-icon.shapes.css +4 -0
- package/dist/elements/a-icon.shapes.d.ts +2 -1
- package/dist/elements/a-icon.shapes.js +3 -1
- package/dist/elements/a-menu-group.css +21 -0
- package/dist/elements/a-menu-group.d.ts +13 -0
- package/dist/elements/a-menu-group.js +15 -0
- package/dist/elements/a-menu-item.css +162 -0
- package/dist/elements/a-menu-item.d.ts +27 -0
- package/dist/elements/a-menu-item.js +29 -0
- package/dist/elements/a-menu-separator.css +15 -0
- package/dist/elements/a-menu-separator.d.ts +12 -0
- package/dist/elements/a-menu-separator.js +15 -0
- package/dist/elements/a-menu.css +34 -0
- package/dist/elements/a-menu.d.ts +120 -0
- package/dist/elements/a-menu.js +649 -0
- package/dist/elements/a-progress.d.ts +1 -0
- package/dist/elements/a-progress.js +2 -0
- package/dist/elements/a-sticker-animated.d.ts +1 -0
- package/dist/elements/a-sticker-animated.js +2 -0
- package/dist/elements/a-sticker.d.ts +1 -0
- package/dist/elements/a-sticker.js +2 -0
- package/dist/elements/a-tag.css +196 -0
- package/dist/elements/a-text.css +17 -13
- package/dist/elements/a-text.d.ts +1 -0
- package/dist/elements/a-text.js +2 -0
- package/dist/elements/a-tooltip.css +62 -0
- package/dist/elements/a-tooltip.d.ts +68 -0
- package/dist/elements/a-tooltip.js +488 -0
- package/dist/elements/index.d.ts +18 -10
- package/dist/elements/index.js +12 -35
- package/dist/general_types.d.ts +40 -41
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/jsx-runtime.d.ts +7 -5
- package/dist/reset.css +14 -5
- package/package.json +13 -14
package/dist/general_types.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export interface ATextAttributes extends BaseAttributes {
|
|
|
76
76
|
/** Type scale. `small` = 13/16, `medium` (default) = 15/20, `large` = 17/24. */
|
|
77
77
|
size?: 'small' | 'medium' | 'large';
|
|
78
78
|
/** Render as inline-block instead of the default block. */
|
|
79
|
-
inline?: boolean |
|
|
79
|
+
inline?: boolean | '';
|
|
80
80
|
/** Truncate to N lines with a trailing ellipsis. The attribute value
|
|
81
81
|
* carries the line count (e.g. `"1"`, `"3"`); the count is also
|
|
82
82
|
* available via the `--line-clamp` CSS custom property set inline. */
|
|
@@ -84,7 +84,7 @@ export interface ATextAttributes extends BaseAttributes {
|
|
|
84
84
|
/** Marks the host as expandable when paired with `truncate`. Adds
|
|
85
85
|
* the fade-out mask; the JSX wrapper renders the chevron and owns
|
|
86
86
|
* the click/keyboard expansion logic. */
|
|
87
|
-
expandable?: boolean |
|
|
87
|
+
expandable?: boolean | '';
|
|
88
88
|
/** ARIA disclosure state, mirrors the JSX wrapper's `expanded` flag. */
|
|
89
89
|
'aria-expanded'?: boolean | 'true' | 'false';
|
|
90
90
|
}
|
|
@@ -108,43 +108,23 @@ export interface ATitleAttributes extends BaseAttributes {
|
|
|
108
108
|
'aria-level'?: number | string;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
* Attributes for the `<a-
|
|
111
|
+
* Attributes for the `<a-tag>` styled tag.
|
|
112
112
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* `<slot>`, so children aren't rendered). The JSX wrapper
|
|
116
|
-
* (`Sticker{Name}`) sets it from the per-sticker module's inlined SVG.
|
|
117
|
-
* Sizing comes from `--sticker-size`.
|
|
113
|
+
* `<a-tag>` has no JS — it's a CSS-only styled element. Low-level
|
|
114
|
+
* attributes; for the JSX wrapper use `Tag` from `@antadesign/anta`.
|
|
118
115
|
*/
|
|
119
|
-
export interface
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* string. On change the element `JSON.parse`s it once and drives a
|
|
132
|
-
* `lottie-web` player (SVG renderer) inside its shadow DOM. The JSX
|
|
133
|
-
* wrapper (`Sticker{Name}Animated`) sets it from the per-sticker
|
|
134
|
-
* module's inlined JSON. Sizing comes from the `--sticker-size` CSS
|
|
135
|
-
* variable; `paused` controls playback.
|
|
136
|
-
*/
|
|
137
|
-
export interface AStickerAnimatedAttributes extends BaseAttributes {
|
|
138
|
-
/** Lottie payload as a JSON string. The element parses it once on
|
|
139
|
-
* change. */
|
|
140
|
-
animation?: string;
|
|
141
|
-
/** Present (any string value, including `""`) freezes the animation.
|
|
142
|
-
* A numeric string is parsed as seconds and the player seeks to
|
|
143
|
-
* that time before pausing. Omit to play. */
|
|
144
|
-
paused?: string | boolean | number;
|
|
145
|
-
role?: string;
|
|
146
|
-
'aria-label'?: string;
|
|
147
|
-
'aria-hidden'?: 'true' | 'false' | boolean;
|
|
116
|
+
export interface ATagAttributes extends BaseAttributes {
|
|
117
|
+
/** Semantic tone, or any literal CSS color for a one-off custom tone.
|
|
118
|
+
* Named tones map to the `--text-2-{tone}` / `--bg-4-{tone}` palette;
|
|
119
|
+
* a custom color keeps its hue with lightness/chroma pinned.
|
|
120
|
+
* `'neutral'` is the default gray (same as omitting it). */
|
|
121
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
122
|
+
/** Size variant. `small` = 16px tall, `medium` (default) = 20px,
|
|
123
|
+
* `large` = 24px. */
|
|
124
|
+
size?: 'small' | 'medium' | 'large';
|
|
125
|
+
/** Render in normal case instead of the default uppercase.
|
|
126
|
+
* Presence-based (`''` on, omit off). */
|
|
127
|
+
nocaps?: boolean | '';
|
|
148
128
|
}
|
|
149
129
|
/**
|
|
150
130
|
* Attributes for the `<a-icon>` custom element. `shape` is typed as
|
|
@@ -173,6 +153,25 @@ export interface AIconAttributes extends BaseAttributes {
|
|
|
173
153
|
/** Hides decorative icons from screen readers. */
|
|
174
154
|
'aria-hidden'?: 'true' | 'false' | boolean;
|
|
175
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Attributes for the `<a-tooltip>` custom element. Placed as a child of the
|
|
158
|
+
* element it annotates (content as children). For the typed JSX wrapper use
|
|
159
|
+
* `Tooltip` from `@antadesign/anta`.
|
|
160
|
+
*/
|
|
161
|
+
export interface ATooltipAttributes extends BaseAttributes {
|
|
162
|
+
/** Show delay in milliseconds. Never use `0` — use ~`50`. Defaults to 250. */
|
|
163
|
+
delay?: number | string;
|
|
164
|
+
/** Preferred side; auto-flips when there's no room. Defaults to `'bottom'`. */
|
|
165
|
+
placement?: 'top' | 'bottom';
|
|
166
|
+
/** Pin under the anchor instead of following the cursor. Presence-based
|
|
167
|
+
* (`''` on, omit off). */
|
|
168
|
+
static?: boolean | '';
|
|
169
|
+
/** Make the bubble hoverable/clickable (pointer events on, stays open while
|
|
170
|
+
* hovered). Implies `static`. Presence-based (`''` on, omit off). */
|
|
171
|
+
interactive?: boolean | '';
|
|
172
|
+
/** HTML `id`. */
|
|
173
|
+
id?: string;
|
|
174
|
+
}
|
|
176
175
|
/**
|
|
177
176
|
* Attributes for the `<a-button>` custom element. For the typed JSX
|
|
178
177
|
* wrapper use `Button` from `@antadesign/anta`.
|
|
@@ -188,13 +187,13 @@ export interface AButtonAttributes extends BaseAttributes {
|
|
|
188
187
|
size?: 'small' | 'medium' | 'large';
|
|
189
188
|
/** Drop outer padding to zero. Only takes effect on `priority="quaternary"`.
|
|
190
189
|
* Presence-based: `''` (or any value) turns it on; omit to turn off. */
|
|
191
|
-
paddingless?:
|
|
190
|
+
paddingless?: boolean | '';
|
|
192
191
|
/** Loading state. Presence-based (`''` on, omit off). */
|
|
193
|
-
loading?:
|
|
192
|
+
loading?: boolean | '';
|
|
194
193
|
/** Disabled state. Presence-based (`''` on, omit off). */
|
|
195
|
-
disabled?:
|
|
194
|
+
disabled?: boolean | '';
|
|
196
195
|
/** Toggled-on / pressed state. Presence-based (`''` on, omit off). */
|
|
197
|
-
selected?:
|
|
196
|
+
selected?: boolean | '';
|
|
198
197
|
/** Submit/reset semantics. */
|
|
199
198
|
type?: 'button' | 'submit' | 'reset';
|
|
200
199
|
/** Associate with a form by id when not nested inside it. */
|
package/dist/index.d.ts
CHANGED
|
@@ -22,15 +22,15 @@ export { Text } from './components/Text';
|
|
|
22
22
|
export type { TextProps } from './components/Text';
|
|
23
23
|
export { Title } from './components/Title';
|
|
24
24
|
export type { TitleProps } from './components/Title';
|
|
25
|
+
export { Tag } from './components/Tag';
|
|
26
|
+
export type { TagProps } from './components/Tag';
|
|
25
27
|
export { Icon } from './components/Icon';
|
|
26
28
|
export type { IconProps } from './components/Icon';
|
|
27
29
|
export { Button } from './components/Button';
|
|
28
30
|
export type { ButtonProps, BaseButtonProps, ContentMode, SubmitMode, PriorityMode, } from './components/Button';
|
|
29
31
|
export { ICON_SHAPES, ICON_SYNONYMS } from './elements/a-icon.shapes';
|
|
30
|
-
export {
|
|
31
|
-
export type {
|
|
32
|
-
export { StickerAnimated } from './components/StickerAnimated';
|
|
33
|
-
export type { StickerAnimatedProps } from './components/StickerAnimated';
|
|
32
|
+
export { Tooltip } from './components/Tooltip';
|
|
33
|
+
export type { TooltipProps } from './components/Tooltip';
|
|
34
34
|
export type { BaseProps, BaseAttributes } from './general_types';
|
|
35
35
|
export { configure } from './jsx-runtime';
|
|
36
36
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Progress } from "./components/Progress";
|
|
2
2
|
import { Text } from "./components/Text";
|
|
3
3
|
import { Title } from "./components/Title";
|
|
4
|
+
import { Tag } from "./components/Tag";
|
|
4
5
|
import { Icon } from "./components/Icon";
|
|
5
6
|
import { Button } from "./components/Button";
|
|
6
7
|
import { ICON_SHAPES, ICON_SYNONYMS } from "./elements/a-icon.shapes";
|
|
7
|
-
import {
|
|
8
|
-
import { StickerAnimated } from "./components/StickerAnimated";
|
|
8
|
+
import { Tooltip } from "./components/Tooltip";
|
|
9
9
|
import { configure } from "./jsx-runtime";
|
|
10
10
|
export {
|
|
11
11
|
Button,
|
|
@@ -13,9 +13,9 @@ export {
|
|
|
13
13
|
ICON_SYNONYMS,
|
|
14
14
|
Icon,
|
|
15
15
|
Progress,
|
|
16
|
-
|
|
17
|
-
StickerAnimated,
|
|
16
|
+
Tag,
|
|
18
17
|
Text,
|
|
19
18
|
Title,
|
|
19
|
+
Tooltip,
|
|
20
20
|
configure
|
|
21
21
|
};
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -22,9 +22,9 @@ export declare function configure(jsx: JsxFunction, Fragment?: ComponentType): v
|
|
|
22
22
|
export declare function jsx(type: ComponentType, props: Record<string, unknown> | null, key?: string | number): unknown;
|
|
23
23
|
export declare function jsxs(type: ComponentType, props: Record<string, unknown> | null, key?: string | number): unknown;
|
|
24
24
|
export { _Fragment as Fragment };
|
|
25
|
-
import type { AProgressAttributes, ATextAttributes, ATitleAttributes, AIconAttributes, AButtonAttributes,
|
|
25
|
+
import type { AProgressAttributes, ATextAttributes, ATitleAttributes, ATagAttributes, AIconAttributes, AButtonAttributes, ATooltipAttributes, BaseAttributes } from './general_types';
|
|
26
26
|
export declare namespace JSX {
|
|
27
|
-
|
|
27
|
+
interface IntrinsicElements extends React.JSX.IntrinsicElements {
|
|
28
28
|
'a-progress': AProgressAttributes;
|
|
29
29
|
'a-progress-label': BaseAttributes;
|
|
30
30
|
'a-progress-number': BaseAttributes;
|
|
@@ -32,10 +32,12 @@ export declare namespace JSX {
|
|
|
32
32
|
'a-progress-hint': BaseAttributes;
|
|
33
33
|
'a-text': ATextAttributes;
|
|
34
34
|
'a-title': ATitleAttributes;
|
|
35
|
+
'a-tag': ATagAttributes;
|
|
36
|
+
'a-tag-label': BaseAttributes;
|
|
37
|
+
'a-tag-value': BaseAttributes;
|
|
35
38
|
'a-icon': AIconAttributes;
|
|
36
39
|
'a-button': AButtonAttributes;
|
|
37
40
|
'a-button-label': BaseAttributes;
|
|
38
|
-
'a-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
+
'a-tooltip': ATooltipAttributes;
|
|
42
|
+
}
|
|
41
43
|
}
|
package/dist/reset.css
CHANGED
|
@@ -108,9 +108,18 @@
|
|
|
108
108
|
/* Global link defaults. Hairline underline at 75% alpha;
|
|
109
109
|
underline goes to currentColor (100%) and 1px on hover. Color
|
|
110
110
|
comes from --link-color tokens, which auto-flip in dark mode.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
`:not(:where([role="button"]))` excludes anchor-buttons (`<a role="button">`,
|
|
112
|
+
e.g. `<Button href>`): `a:link`/`a:visited` are pseudo-classes with the
|
|
113
|
+
same (0,1,1) specificity as `a[role="button"]`, so without the exclusion
|
|
114
|
+
they'd tie and win on source order, giving buttons link colour +
|
|
115
|
+
underline. The `:where()` keeps the exclusion specificity-neutral so this
|
|
116
|
+
base rule stays at (0,0,1)/(0,1,1) — a bare `:not([role="button"])` would
|
|
117
|
+
add an attribute selector's weight and out-specify prose-link overrides
|
|
118
|
+
like `a-text a` / the <Button> prose-link rule, leaving their links stuck
|
|
119
|
+
on the global blue. Other contexts (nav, headings) still override as needed. */
|
|
120
|
+
a:not(:where([role="button"])),
|
|
121
|
+
a:not(:where([role="button"])):link,
|
|
122
|
+
a:not(:where([role="button"])):visited {
|
|
114
123
|
color: var(--link-color);
|
|
115
124
|
text-decoration: underline;
|
|
116
125
|
text-decoration-style: solid;
|
|
@@ -121,14 +130,14 @@
|
|
|
121
130
|
/* Hover only on real-pointer devices — gating avoids the sticky hover
|
|
122
131
|
color that lingers after a tap on touch screens. */
|
|
123
132
|
@media (hover: hover) and (pointer: fine) {
|
|
124
|
-
a:hover {
|
|
133
|
+
a:not(:where([role="button"])):hover {
|
|
125
134
|
color: var(--link-color-hover);
|
|
126
135
|
/* Underline color is left as the resting hairline (the base rule's
|
|
127
136
|
`currentColor` mix) — only the thickness grows on hover. */
|
|
128
137
|
text-decoration-thickness: 1px;
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
|
-
a:active {
|
|
140
|
+
a:not(:where([role="button"])):active {
|
|
132
141
|
text-decoration-color: color-mix(in srgb, currentColor 75%, transparent);
|
|
133
142
|
}
|
|
134
143
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,18 +26,17 @@
|
|
|
26
26
|
"types": "./dist/elements/*.d.ts",
|
|
27
27
|
"default": "./dist/elements/*.js"
|
|
28
28
|
},
|
|
29
|
+
"./anta_helpers": {
|
|
30
|
+
"types": "./dist/anta_helpers.d.ts",
|
|
31
|
+
"default": "./dist/anta_helpers.js"
|
|
32
|
+
},
|
|
33
|
+
"./general_types": {
|
|
34
|
+
"types": "./dist/general_types.d.ts",
|
|
35
|
+
"default": "./dist/general_types.js"
|
|
36
|
+
},
|
|
29
37
|
"./tokens.css": "./dist/tokens.css",
|
|
30
38
|
"./reset.css": "./dist/reset.css",
|
|
31
39
|
"./generate-icons.mjs": "./dist/generate-icons.mjs",
|
|
32
|
-
"./generate-stickers.mjs": "./dist/generate-stickers.mjs",
|
|
33
|
-
"./stickers": {
|
|
34
|
-
"types": "./dist/components/__generated__/stickers/index.d.ts",
|
|
35
|
-
"default": "./dist/components/__generated__/stickers/index.js"
|
|
36
|
-
},
|
|
37
|
-
"./stickers/*": {
|
|
38
|
-
"types": "./dist/components/__generated__/stickers/*.d.ts",
|
|
39
|
-
"default": "./dist/components/__generated__/stickers/*.js"
|
|
40
|
-
},
|
|
41
40
|
"./*": {
|
|
42
41
|
"types": "./dist/*.d.ts",
|
|
43
42
|
"default": "./dist/*"
|
|
@@ -45,13 +44,13 @@
|
|
|
45
44
|
},
|
|
46
45
|
"scripts": {
|
|
47
46
|
"build": "pnpm run build:js && pnpm run build:css && pnpm run build:types",
|
|
48
|
-
"build:css": "find src -name '*.css' | while IFS= read -r f; do d=\"dist/${f#src/}\"; mkdir -p \"$(dirname \"$d\")\"; cp \"$f\" \"$d\"; done && cp scripts/generate-icons.mjs
|
|
47
|
+
"build:css": "find src -name '*.css' | while IFS= read -r f; do d=\"dist/${f#src/}\"; mkdir -p \"$(dirname \"$d\")\"; cp \"$f\" \"$d\"; done && cp scripts/generate-icons.mjs dist/",
|
|
49
48
|
"build:js": "esbuild $(find src \\( -name '*.ts' -o -name '*.tsx' \\) ! -name '*.d.ts') --outdir=dist --outbase=src --jsx=automatic --jsx-import-source=@antadesign/anta --format=esm --target=ES2022 --loader:.module.css=local-css --loader:.css=global-css",
|
|
50
49
|
"build:types": "tsc -p src/tsconfig.json",
|
|
51
|
-
"dev": "nodemon -w src -e ts,tsx,css -x 'pnpm run build && pnpm --filter anta-site run docs' & pnpm --filter anta-site run dev & wait",
|
|
50
|
+
"dev": "echo $$ > .dev.pid; trap 'rm -f .dev.pid' EXIT; nodemon -w src -w stickers/src -e ts,tsx,css -x 'pnpm run build && pnpm --filter @antadesign/stickers run build && pnpm --filter anta-site run docs' & pnpm --filter anta-site run dev & wait",
|
|
51
|
+
"stop": "node scripts/dev-stop.mjs",
|
|
52
52
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
53
53
|
"icons": "node scripts/generate-icons.mjs --input src/elements/icons --output src/elements --name a-icon.shapes --internal",
|
|
54
|
-
"stickers": "node scripts/generate-stickers.mjs --input src/elements/stickers --output src/components/__generated__/stickers --internal",
|
|
55
54
|
"clean": "rm -rf dist",
|
|
56
55
|
"prepare": "pnpm run build",
|
|
57
56
|
"prepublishOnly": "pnpm run build"
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
},
|
|
65
64
|
"dependencies": {
|
|
66
65
|
"clsx": "^2.1.0",
|
|
67
|
-
"
|
|
66
|
+
"es-toolkit": "^1.47.0"
|
|
68
67
|
},
|
|
69
68
|
"peerDependencies": {
|
|
70
69
|
"react": "^18.0.0 || ^19.0.0"
|