@antadesign/anta 0.1.1-dev.8 → 0.2.1

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.
Files changed (239) hide show
  1. package/README.md +42 -3
  2. package/dist/components/Button.js +4 -3
  3. package/dist/components/Progress.module.css +0 -5
  4. package/dist/components/Tag.d.ts +55 -0
  5. package/dist/components/Tag.js +40 -0
  6. package/dist/components/Text.d.ts +4 -2
  7. package/dist/components/Text.module.css +0 -6
  8. package/dist/components/Tooltip.d.ts +4 -2
  9. package/dist/elements/a-button.css +1 -733
  10. package/dist/elements/a-icon.css +1 -43
  11. package/dist/elements/a-icon.shapes.css +1 -373
  12. package/dist/elements/a-icon.shapes.d.ts +2 -1
  13. package/dist/elements/a-icon.shapes.js +3 -1
  14. package/dist/elements/a-progress.css +1 -68
  15. package/dist/elements/a-tag.css +1 -0
  16. package/dist/elements/a-text.css +1 -86
  17. package/dist/elements/a-title.css +1 -64
  18. package/dist/elements/a-tooltip.css +1 -42
  19. package/dist/elements/a-tooltip.d.ts +7 -0
  20. package/dist/elements/a-tooltip.js +96 -19
  21. package/dist/elements/index.d.ts +2 -4
  22. package/dist/elements/index.js +1 -6
  23. package/dist/general_types.d.ts +15 -35
  24. package/dist/index.d.ts +3 -4
  25. package/dist/index.js +2 -4
  26. package/dist/jsx-runtime.d.ts +19 -16
  27. package/dist/reset.css +1 -205
  28. package/dist/tokens.css +1 -285
  29. package/package.json +15 -15
  30. package/dist/components/Button.module.css +0 -2
  31. package/dist/components/Sticker.d.ts +0 -31
  32. package/dist/components/Sticker.js +0 -17
  33. package/dist/components/StickerAnimated.d.ts +0 -23
  34. package/dist/components/StickerAnimated.js +0 -28
  35. package/dist/components/__generated__/stickers/angry-animated.d.ts +0 -3
  36. package/dist/components/__generated__/stickers/angry-animated.js +0 -7
  37. package/dist/components/__generated__/stickers/angry.d.ts +0 -3
  38. package/dist/components/__generated__/stickers/angry.js +0 -7
  39. package/dist/components/__generated__/stickers/ask-animated.d.ts +0 -3
  40. package/dist/components/__generated__/stickers/ask-animated.js +0 -7
  41. package/dist/components/__generated__/stickers/ask.d.ts +0 -3
  42. package/dist/components/__generated__/stickers/ask.js +0 -7
  43. package/dist/components/__generated__/stickers/balance-animated.d.ts +0 -3
  44. package/dist/components/__generated__/stickers/balance-animated.js +0 -7
  45. package/dist/components/__generated__/stickers/balance.d.ts +0 -3
  46. package/dist/components/__generated__/stickers/balance.js +0 -7
  47. package/dist/components/__generated__/stickers/butterfly-animated.d.ts +0 -3
  48. package/dist/components/__generated__/stickers/butterfly-animated.js +0 -7
  49. package/dist/components/__generated__/stickers/butterfly-snake-animated.d.ts +0 -3
  50. package/dist/components/__generated__/stickers/butterfly-snake-animated.js +0 -7
  51. package/dist/components/__generated__/stickers/butterfly-snake.d.ts +0 -3
  52. package/dist/components/__generated__/stickers/butterfly-snake.js +0 -7
  53. package/dist/components/__generated__/stickers/butterfly.d.ts +0 -3
  54. package/dist/components/__generated__/stickers/butterfly.js +0 -7
  55. package/dist/components/__generated__/stickers/catch-animated.d.ts +0 -3
  56. package/dist/components/__generated__/stickers/catch-animated.js +0 -7
  57. package/dist/components/__generated__/stickers/catch.d.ts +0 -3
  58. package/dist/components/__generated__/stickers/catch.js +0 -7
  59. package/dist/components/__generated__/stickers/clap-animated.d.ts +0 -3
  60. package/dist/components/__generated__/stickers/clap-animated.js +0 -7
  61. package/dist/components/__generated__/stickers/clap.d.ts +0 -3
  62. package/dist/components/__generated__/stickers/clap.js +0 -7
  63. package/dist/components/__generated__/stickers/coding-animated.d.ts +0 -3
  64. package/dist/components/__generated__/stickers/coding-animated.js +0 -7
  65. package/dist/components/__generated__/stickers/coding.d.ts +0 -3
  66. package/dist/components/__generated__/stickers/coding.js +0 -7
  67. package/dist/components/__generated__/stickers/cowboy-animated.d.ts +0 -3
  68. package/dist/components/__generated__/stickers/cowboy-animated.js +0 -7
  69. package/dist/components/__generated__/stickers/cowboy.d.ts +0 -3
  70. package/dist/components/__generated__/stickers/cowboy.js +0 -7
  71. package/dist/components/__generated__/stickers/dance-animated.d.ts +0 -3
  72. package/dist/components/__generated__/stickers/dance-animated.js +0 -7
  73. package/dist/components/__generated__/stickers/dance.d.ts +0 -3
  74. package/dist/components/__generated__/stickers/dance.js +0 -7
  75. package/dist/components/__generated__/stickers/detective-animated.d.ts +0 -3
  76. package/dist/components/__generated__/stickers/detective-animated.js +0 -7
  77. package/dist/components/__generated__/stickers/detective.d.ts +0 -3
  78. package/dist/components/__generated__/stickers/detective.js +0 -7
  79. package/dist/components/__generated__/stickers/disapprove-animated.d.ts +0 -3
  80. package/dist/components/__generated__/stickers/disapprove-animated.js +0 -7
  81. package/dist/components/__generated__/stickers/disapprove.d.ts +0 -3
  82. package/dist/components/__generated__/stickers/disapprove.js +0 -7
  83. package/dist/components/__generated__/stickers/distracted-animated.d.ts +0 -3
  84. package/dist/components/__generated__/stickers/distracted-animated.js +0 -7
  85. package/dist/components/__generated__/stickers/distracted.d.ts +0 -3
  86. package/dist/components/__generated__/stickers/distracted.js +0 -7
  87. package/dist/components/__generated__/stickers/dive-animated.d.ts +0 -3
  88. package/dist/components/__generated__/stickers/dive-animated.js +0 -7
  89. package/dist/components/__generated__/stickers/dive.d.ts +0 -3
  90. package/dist/components/__generated__/stickers/dive.js +0 -7
  91. package/dist/components/__generated__/stickers/eat-animated.d.ts +0 -3
  92. package/dist/components/__generated__/stickers/eat-animated.js +0 -7
  93. package/dist/components/__generated__/stickers/eat.d.ts +0 -3
  94. package/dist/components/__generated__/stickers/eat.js +0 -7
  95. package/dist/components/__generated__/stickers/facepalm-animated.d.ts +0 -3
  96. package/dist/components/__generated__/stickers/facepalm-animated.js +0 -7
  97. package/dist/components/__generated__/stickers/facepalm.d.ts +0 -3
  98. package/dist/components/__generated__/stickers/facepalm.js +0 -7
  99. package/dist/components/__generated__/stickers/failed-animated.d.ts +0 -3
  100. package/dist/components/__generated__/stickers/failed-animated.js +0 -7
  101. package/dist/components/__generated__/stickers/failed.d.ts +0 -3
  102. package/dist/components/__generated__/stickers/failed.js +0 -7
  103. package/dist/components/__generated__/stickers/found-animated.d.ts +0 -3
  104. package/dist/components/__generated__/stickers/found-animated.js +0 -7
  105. package/dist/components/__generated__/stickers/found.d.ts +0 -3
  106. package/dist/components/__generated__/stickers/found.js +0 -7
  107. package/dist/components/__generated__/stickers/grow-animated.d.ts +0 -3
  108. package/dist/components/__generated__/stickers/grow-animated.js +0 -7
  109. package/dist/components/__generated__/stickers/grow.d.ts +0 -3
  110. package/dist/components/__generated__/stickers/grow.js +0 -7
  111. package/dist/components/__generated__/stickers/handstand-animated.d.ts +0 -3
  112. package/dist/components/__generated__/stickers/handstand-animated.js +0 -7
  113. package/dist/components/__generated__/stickers/handstand.d.ts +0 -3
  114. package/dist/components/__generated__/stickers/handstand.js +0 -7
  115. package/dist/components/__generated__/stickers/heart-animated.d.ts +0 -3
  116. package/dist/components/__generated__/stickers/heart-animated.js +0 -7
  117. package/dist/components/__generated__/stickers/heart.d.ts +0 -3
  118. package/dist/components/__generated__/stickers/heart.js +0 -7
  119. package/dist/components/__generated__/stickers/hello-animated.d.ts +0 -3
  120. package/dist/components/__generated__/stickers/hello-animated.js +0 -7
  121. package/dist/components/__generated__/stickers/hello.d.ts +0 -3
  122. package/dist/components/__generated__/stickers/hello.js +0 -7
  123. package/dist/components/__generated__/stickers/idea-animated.d.ts +0 -3
  124. package/dist/components/__generated__/stickers/idea-animated.js +0 -7
  125. package/dist/components/__generated__/stickers/idea.d.ts +0 -3
  126. package/dist/components/__generated__/stickers/idea.js +0 -7
  127. package/dist/components/__generated__/stickers/index.d.ts +0 -99
  128. package/dist/components/__generated__/stickers/index.js +0 -198
  129. package/dist/components/__generated__/stickers/laugh-animated.d.ts +0 -3
  130. package/dist/components/__generated__/stickers/laugh-animated.js +0 -7
  131. package/dist/components/__generated__/stickers/laugh.d.ts +0 -3
  132. package/dist/components/__generated__/stickers/laugh.js +0 -7
  133. package/dist/components/__generated__/stickers/love-animated.d.ts +0 -3
  134. package/dist/components/__generated__/stickers/love-animated.js +0 -7
  135. package/dist/components/__generated__/stickers/love.d.ts +0 -3
  136. package/dist/components/__generated__/stickers/love.js +0 -7
  137. package/dist/components/__generated__/stickers/nap-animated.d.ts +0 -3
  138. package/dist/components/__generated__/stickers/nap-animated.js +0 -7
  139. package/dist/components/__generated__/stickers/nap.d.ts +0 -3
  140. package/dist/components/__generated__/stickers/nap.js +0 -7
  141. package/dist/components/__generated__/stickers/party-animated.d.ts +0 -3
  142. package/dist/components/__generated__/stickers/party-animated.js +0 -7
  143. package/dist/components/__generated__/stickers/party.d.ts +0 -3
  144. package/dist/components/__generated__/stickers/party.js +0 -7
  145. package/dist/components/__generated__/stickers/passed-animated.d.ts +0 -3
  146. package/dist/components/__generated__/stickers/passed-animated.js +0 -7
  147. package/dist/components/__generated__/stickers/passed.d.ts +0 -3
  148. package/dist/components/__generated__/stickers/passed.js +0 -7
  149. package/dist/components/__generated__/stickers/peekaboo-animated.d.ts +0 -3
  150. package/dist/components/__generated__/stickers/peekaboo-animated.js +0 -7
  151. package/dist/components/__generated__/stickers/peekaboo.d.ts +0 -3
  152. package/dist/components/__generated__/stickers/peekaboo.js +0 -7
  153. package/dist/components/__generated__/stickers/pizza-animated.d.ts +0 -3
  154. package/dist/components/__generated__/stickers/pizza-animated.js +0 -7
  155. package/dist/components/__generated__/stickers/pizza.d.ts +0 -3
  156. package/dist/components/__generated__/stickers/pizza.js +0 -7
  157. package/dist/components/__generated__/stickers/puzzle-animated.d.ts +0 -3
  158. package/dist/components/__generated__/stickers/puzzle-animated.js +0 -7
  159. package/dist/components/__generated__/stickers/puzzle.d.ts +0 -3
  160. package/dist/components/__generated__/stickers/puzzle.js +0 -7
  161. package/dist/components/__generated__/stickers/sad-animated.d.ts +0 -3
  162. package/dist/components/__generated__/stickers/sad-animated.js +0 -7
  163. package/dist/components/__generated__/stickers/sad.d.ts +0 -3
  164. package/dist/components/__generated__/stickers/sad.js +0 -7
  165. package/dist/components/__generated__/stickers/scared-animated.d.ts +0 -3
  166. package/dist/components/__generated__/stickers/scared-animated.js +0 -7
  167. package/dist/components/__generated__/stickers/scared.d.ts +0 -3
  168. package/dist/components/__generated__/stickers/scared.js +0 -7
  169. package/dist/components/__generated__/stickers/scroll-animated.d.ts +0 -3
  170. package/dist/components/__generated__/stickers/scroll-animated.js +0 -7
  171. package/dist/components/__generated__/stickers/scroll.d.ts +0 -3
  172. package/dist/components/__generated__/stickers/scroll.js +0 -7
  173. package/dist/components/__generated__/stickers/search-animated.d.ts +0 -3
  174. package/dist/components/__generated__/stickers/search-animated.js +0 -7
  175. package/dist/components/__generated__/stickers/search.d.ts +0 -3
  176. package/dist/components/__generated__/stickers/search.js +0 -7
  177. package/dist/components/__generated__/stickers/shield-animated.d.ts +0 -3
  178. package/dist/components/__generated__/stickers/shield-animated.js +0 -7
  179. package/dist/components/__generated__/stickers/shield.d.ts +0 -3
  180. package/dist/components/__generated__/stickers/shield.js +0 -7
  181. package/dist/components/__generated__/stickers/shocked-animated.d.ts +0 -3
  182. package/dist/components/__generated__/stickers/shocked-animated.js +0 -7
  183. package/dist/components/__generated__/stickers/shocked.d.ts +0 -3
  184. package/dist/components/__generated__/stickers/shocked.js +0 -7
  185. package/dist/components/__generated__/stickers/sleep-animated.d.ts +0 -3
  186. package/dist/components/__generated__/stickers/sleep-animated.js +0 -7
  187. package/dist/components/__generated__/stickers/sleep.d.ts +0 -3
  188. package/dist/components/__generated__/stickers/sleep.js +0 -7
  189. package/dist/components/__generated__/stickers/stressed-animated.d.ts +0 -3
  190. package/dist/components/__generated__/stickers/stressed-animated.js +0 -7
  191. package/dist/components/__generated__/stickers/stressed.d.ts +0 -3
  192. package/dist/components/__generated__/stickers/stressed.js +0 -7
  193. package/dist/components/__generated__/stickers/suspicious-animated.d.ts +0 -3
  194. package/dist/components/__generated__/stickers/suspicious-animated.js +0 -7
  195. package/dist/components/__generated__/stickers/suspicious.d.ts +0 -3
  196. package/dist/components/__generated__/stickers/suspicious.js +0 -7
  197. package/dist/components/__generated__/stickers/thanks-animated.d.ts +0 -3
  198. package/dist/components/__generated__/stickers/thanks-animated.js +0 -7
  199. package/dist/components/__generated__/stickers/thanks.d.ts +0 -3
  200. package/dist/components/__generated__/stickers/thanks.js +0 -7
  201. package/dist/components/__generated__/stickers/think-animated.d.ts +0 -3
  202. package/dist/components/__generated__/stickers/think-animated.js +0 -7
  203. package/dist/components/__generated__/stickers/think-of-you-animated.d.ts +0 -3
  204. package/dist/components/__generated__/stickers/think-of-you-animated.js +0 -7
  205. package/dist/components/__generated__/stickers/think-of-you.d.ts +0 -3
  206. package/dist/components/__generated__/stickers/think-of-you.js +0 -7
  207. package/dist/components/__generated__/stickers/think.d.ts +0 -3
  208. package/dist/components/__generated__/stickers/think.js +0 -7
  209. package/dist/components/__generated__/stickers/thumbs-up-animated.d.ts +0 -3
  210. package/dist/components/__generated__/stickers/thumbs-up-animated.js +0 -7
  211. package/dist/components/__generated__/stickers/thumbs-up.d.ts +0 -3
  212. package/dist/components/__generated__/stickers/thumbs-up.js +0 -7
  213. package/dist/components/__generated__/stickers/vacation-animated.d.ts +0 -3
  214. package/dist/components/__generated__/stickers/vacation-animated.js +0 -7
  215. package/dist/components/__generated__/stickers/vacation.d.ts +0 -3
  216. package/dist/components/__generated__/stickers/vacation.js +0 -7
  217. package/dist/components/__generated__/stickers/wait-animated.d.ts +0 -3
  218. package/dist/components/__generated__/stickers/wait-animated.js +0 -7
  219. package/dist/components/__generated__/stickers/wait.d.ts +0 -3
  220. package/dist/components/__generated__/stickers/wait.js +0 -7
  221. package/dist/components/__generated__/stickers/wink-animated.d.ts +0 -3
  222. package/dist/components/__generated__/stickers/wink-animated.js +0 -7
  223. package/dist/components/__generated__/stickers/wink.d.ts +0 -3
  224. package/dist/components/__generated__/stickers/wink.js +0 -7
  225. package/dist/components/__generated__/stickers/work-animated.d.ts +0 -3
  226. package/dist/components/__generated__/stickers/work-animated.js +0 -7
  227. package/dist/components/__generated__/stickers/work.d.ts +0 -3
  228. package/dist/components/__generated__/stickers/work.js +0 -7
  229. package/dist/components/__generated__/stickers/zen-animated.d.ts +0 -3
  230. package/dist/components/__generated__/stickers/zen-animated.js +0 -7
  231. package/dist/components/__generated__/stickers/zen.d.ts +0 -3
  232. package/dist/components/__generated__/stickers/zen.js +0 -7
  233. package/dist/elements/a-sticker-animated.css +0 -9
  234. package/dist/elements/a-sticker-animated.d.ts +0 -39
  235. package/dist/elements/a-sticker-animated.js +0 -81
  236. package/dist/elements/a-sticker.css +0 -9
  237. package/dist/elements/a-sticker.d.ts +0 -19
  238. package/dist/elements/a-sticker.js +0 -32
  239. package/dist/generate-stickers.mjs +0 -293
package/README.md CHANGED
@@ -10,7 +10,7 @@ This constraint shapes the architecture: the web components carry the core styli
10
10
 
11
11
  `@antadesign/anta` is an NPM package, so you can `npm install @antadesign/anta` or do that with `pnpm` / `bun`.
12
12
 
13
- Since Anta is in active development we suggest using the latest dev version: `"@antadesign/anta": "dev"` in your `package.json`. For production builds we suggest pinning to a stable version from npm.
13
+ Use the latest version from npm, but **always pin an exact version** `"@antadesign/anta": "0.2.0"` in your `package.json` rather than a floating tag like `"latest"` or `"dev"`, which can change between installs.
14
14
 
15
15
  ### Usage
16
16
 
@@ -36,7 +36,7 @@ Anta exposes four independent imports. Tokens + elements + the JSX layer are the
36
36
 
37
37
  The chain matters: the per-element CSS that ships with `/elements` references variables like `var(--text-1)` and `var(--bg-2)`. Those variables are *only defined* by `tokens.css`. Skip the tokens import and the components render with whatever the surrounding cascade provides — usually nothing styled at all.
38
38
 
39
- `@antadesign/anta/elements` registers **all** elements — convenient, but it includes every element's code (and deps). To keep your bundle lean, import only the elements you use from their per-element entry points instead: `import '@antadesign/anta/elements/a-tooltip'` registers just `<a-tooltip>` **and loads just its CSS**. Unused elements — and their dependencies, e.g. `lottie-web` (needed only by `<a-sticker-animated>`) — then never enter your bundle. See [Registering elements](#registering-elements).
39
+ `@antadesign/anta/elements` registers **all** elements — convenient, but it includes every element's code (and deps). To keep your bundle lean, import only the elements you use from their per-element entry points instead: `import '@antadesign/anta/elements/a-tooltip'` registers just `<a-tooltip>` **and loads just its CSS**. Unused elements — and any dependencies they pull in — then never enter your bundle. See [Registering elements](#registering-elements).
40
40
 
41
41
  ### Cascade layers
42
42
 
@@ -79,7 +79,7 @@ import '@antadesign/anta/elements/a-tooltip' // only <a-tooltip> + its CSS
79
79
  import '@antadesign/anta/elements/a-button' // only <a-button> + its CSS
80
80
  ```
81
81
 
82
- Both styles are side-effect imports (the act of importing registers the element), and both are idempotent and SSR-safe. The granular form keeps unused elements — and their dependencies, e.g. `lottie-web`, which only `<a-sticker-animated>` pulls in — out of your bundle.
82
+ Both styles are side-effect imports (the act of importing registers the element), and both are idempotent and SSR-safe. The granular form keeps unused elements — and any dependencies they pull in — out of your bundle.
83
83
 
84
84
  The cleanest pattern is a **static, synchronous import at your app's entry file** — outside any component, outside any hook:
85
85
 
@@ -125,6 +125,45 @@ import { h, Fragment } from 'preact'
125
125
  configure(h, Fragment)
126
126
  ```
127
127
 
128
+ ### TypeScript: typing raw `<a-*>` tags in JSX
129
+
130
+ If you only use the JSX wrappers (`<Button>`, `<Progress>`, …) you need no setup — they're typed like any React component. This section is only for writing the raw `<a-*>` tags directly in JSX.
131
+
132
+ **Option A (preferred)** — point your JSX types at anta in `tsconfig.json`:
133
+
134
+ ```jsonc
135
+ { "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "@antadesign/anta" } }
136
+ ```
137
+
138
+ Every `a-*` tag type-checks, all standard HTML tags keep working, and importing anything from `@antadesign/stickers` adds the sticker tags automatically.
139
+
140
+ **Option B** — if you can't change `jsxImportSource` (a shared tsconfig, Emotion's `@emotion/react` source, an older `@types/react` without the `React.JSX` namespace), merge anta's tag map into your JSX namespace yourself. Anta exports it as a standalone interface, `AntaIntrinsicElements` — and `@antadesign/stickers` exports the matching `StickerIntrinsicElements` — so it's a single `extends` in any `.d.ts` covered by your tsconfig:
141
+
142
+ ```ts
143
+ import type { AntaIntrinsicElements } from '@antadesign/anta'
144
+ import type { StickerIntrinsicElements } from '@antadesign/stickers' // only if you use stickers
145
+
146
+ declare global {
147
+ namespace JSX {
148
+ interface IntrinsicElements extends AntaIntrinsicElements, StickerIntrinsicElements {}
149
+ }
150
+ }
151
+ ```
152
+
153
+ On modern `@types/react` (≥18) with `jsx: "react-jsx"`, the JSX namespace is module-scoped and the global declaration above is silently ignored — target the `react` module instead:
154
+
155
+ ```ts
156
+ import type { AntaIntrinsicElements } from '@antadesign/anta'
157
+
158
+ declare module 'react' {
159
+ namespace JSX {
160
+ interface IntrinsicElements extends AntaIntrinsicElements {}
161
+ }
162
+ }
163
+ ```
164
+
165
+ Either way the tags stay fully typed — unknown `a-*` tags and wrong prop types are still errors. New tags arrive automatically when you upgrade anta; there's no per-tag list to maintain.
166
+
128
167
  ### Raw web components (no JSX)
129
168
 
130
169
  ```html
@@ -38,12 +38,13 @@ const Button = ({
38
38
  children,
39
39
  ...rest
40
40
  }) => {
41
- const isCustomTone = tone != null && !NAMED_TONES.has(tone);
42
- const computedStyle = isCustomTone ? { ...style, ["--button-tone-source"]: tone } : style;
41
+ const toneAttr = tone || void 0;
42
+ const isCustomTone = toneAttr != null && !NAMED_TONES.has(toneAttr);
43
+ const computedStyle = isCustomTone ? { ...style, ["--button-tone-source"]: toneAttr } : style;
43
44
  const isIconOnly = icon != null && label == null && children == null && iconTrailing == null;
44
45
  const sharedAttrs = {
45
46
  priority,
46
- tone,
47
+ tone: toneAttr,
47
48
  underline,
48
49
  // 'medium' (and unset) is the implicit default — emit no DOM attr.
49
50
  size: size && size !== "medium" ? size : void 0,
@@ -1,5 +0,0 @@
1
- /*
2
- * Base layout is handled by the <a-progress> web component (display: block).
3
- * This module is reserved for conditional styles driven by JSX logic.
4
- * And in this case we usually start with .container style
5
- */
@@ -0,0 +1,55 @@
1
+ import type { BaseProps } from "../general_types";
2
+ import type { IconShape } from '../elements/a-icon.shapes';
3
+ export interface TagProps extends BaseProps {
4
+ /** A short "key" shown before the value. When paired with `value` it
5
+ * renders bold (weight 600), same color. On its own (no `value`) it's
6
+ * treated as the tag's primary text and keeps the default styling. */
7
+ label?: string;
8
+ /** The tag's primary text — a status, count, version, duration, etc.
9
+ * Rendered in the default color and weight, with no divider from the
10
+ * label; the color + weight contrast does the separating. */
11
+ value?: string;
12
+ /** Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`)
13
+ * for a one-off custom tone. Named tones map to the `--text-2-{tone}` /
14
+ * `--bg-4-{tone}` palette; a custom color keeps its hue while lightness
15
+ * and chroma are pinned. `'neutral'` (the default) is the gray tag —
16
+ * the same as omitting `tone`.
17
+ * @defaultValue neutral */
18
+ tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
19
+ /** Size variant. `small` = 16px tall, `medium` = 20px, `large` = 24px
20
+ * (matching `Button`). Omit the attribute or pass `'medium'` for the
21
+ * default — both render identically and emit no DOM attribute.
22
+ * @defaultValue medium */
23
+ size?: 'small' | 'medium' | 'large';
24
+ /** Render in normal (mixed) case instead of the default uppercase
25
+ * (keeps Anta's small body-text letter-spacing; uppercase tracks wider). */
26
+ nocaps?: boolean;
27
+ /** Leading icon shape. Sits flush before the label, scaled to the pill. */
28
+ icon?: IconShape;
29
+ /** Trailing icon shape. Renders last, after the value. */
30
+ iconTrailing?: IconShape;
31
+ }
32
+ /**
33
+ * Compact pill / chip for status, labels, and metadata.
34
+ *
35
+ * Renders an `<a-tag>` styled tag (no JS, no shadow DOM) — color and size
36
+ * come entirely from attributes. Content is composed from `icon`, `label`,
37
+ * `value`, and `iconTrailing` (like `<Button>`): `value` is the primary
38
+ * text (default styling) and `label`, when paired with a value, renders as
39
+ * a bold "key" before it (same color, no divider). Tabular figures are
40
+ * always on, so counts / versions / timers don't reflow. For an arbitrary
41
+ * multi-part tag, pass `children` instead — each segment after the first
42
+ * gets a hairline divider (the `label` + `value` pair is the no-divider
43
+ * exception).
44
+ *
45
+ * Requires `@antadesign/anta/elements` to be imported (client-side only)
46
+ * so the CSS ships with the page.
47
+ *
48
+ * @example Basic usage
49
+ * ```tsx
50
+ * <Tag tone="success" label="Running" />
51
+ * <Tag tone="info" icon="hourglass" label="Build" value="2m 14s" />
52
+ * <Tag tone="brand" size="small" nocaps value="v2.1.0" />
53
+ * ```
54
+ */
55
+ export declare const Tag: ({ icon, iconTrailing, label, value, tone, size, nocaps, className, style, children, ...rest }: TagProps) => any;
@@ -0,0 +1,40 @@
1
+ import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
2
+ const NAMED_TONES = /* @__PURE__ */ new Set(["neutral", "brand", "info", "success", "warning", "critical"]);
3
+ const Tag = ({
4
+ icon,
5
+ iconTrailing,
6
+ label,
7
+ value,
8
+ tone,
9
+ size,
10
+ nocaps,
11
+ className,
12
+ style,
13
+ children,
14
+ ...rest
15
+ }) => {
16
+ const isCustomTone = tone != null && !NAMED_TONES.has(tone);
17
+ const computedStyle = isCustomTone ? { ...style, ["--tag-tone-source"]: tone } : style;
18
+ const hasValue = value != null;
19
+ return /* @__PURE__ */ jsxs(
20
+ "a-tag",
21
+ {
22
+ tone,
23
+ size: size && size !== "medium" ? size : void 0,
24
+ nocaps: nocaps ? "" : void 0,
25
+ class: className,
26
+ style: computedStyle,
27
+ ...rest,
28
+ children: [
29
+ icon && /* @__PURE__ */ jsx("a-icon", { shape: icon, "aria-hidden": "true" }),
30
+ label != null && (hasValue ? /* @__PURE__ */ jsx("a-tag-label", { children: label }) : /* @__PURE__ */ jsx("a-tag-value", { children: label })),
31
+ hasValue && /* @__PURE__ */ jsx("a-tag-value", { children: value }),
32
+ children,
33
+ iconTrailing && /* @__PURE__ */ jsx("a-icon", { shape: iconTrailing, "aria-hidden": "true" })
34
+ ]
35
+ }
36
+ );
37
+ };
38
+ export {
39
+ Tag
40
+ };
@@ -1,7 +1,9 @@
1
1
  import type { BaseProps } from "../general_types";
2
2
  export interface TextProps extends BaseProps {
3
- /** Visual priority. Maps to text-1..text-5 (`primary` = text-1).
4
- * @defaultValue primary */
3
+ /** Visual priority. Maps to text-1..text-5 (`primary` = text-1, the
4
+ * strongest). The default is `secondary` (text-2) — body text reads a
5
+ * step softer than the strongest foreground; pass `primary` for emphasis.
6
+ * @defaultValue secondary */
5
7
  priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
6
8
  /** Color tint. Applies the matching `--text-{N}-{tone}` palette. */
7
9
  tone?: 'brand' | 'success' | 'critical' | 'warning' | 'info';
@@ -1,6 +0,0 @@
1
- /*
2
- * All Text layout — including truncation, the expandable fade mask,
3
- * and the chevron button — lives in the <a-text> web component's
4
- * shadow DOM. This module is reserved for any future JSX-driven
5
- * conditional styles.
6
- */
@@ -25,8 +25,10 @@ export interface TooltipProps extends BaseProps {
25
25
  * doesn't affect that element's layout.
26
26
  *
27
27
  * Shows on hover (after `delay`) and on keyboard focus; dismisses on mouse
28
- * leave, blur, Escape, or when the anchor scrolls away. Follows the cursor
29
- * by default pass `static` to pin it under the anchor instead.
28
+ * leave, blur, Escape, or when the anchor scrolls away. On touch devices it
29
+ * opens on press-and-hold (a tap never surfaces it) and lingers briefly after
30
+ * release. Follows the cursor by default — pass `static` to pin it under the
31
+ * anchor instead.
30
32
  *
31
33
  * Requires `@antadesign/anta/elements` to be imported (client-side only)
32
34
  * to register the underlying custom element.