@antadesign/anta 0.1.1-dev.5 → 0.1.1-dev.7

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 +15 -2
  2. package/dist/components/Button.d.ts +113 -0
  3. package/dist/components/Button.js +100 -0
  4. package/dist/components/Button.module.css +2 -0
  5. package/dist/components/Icon.d.ts +2 -1
  6. package/dist/components/Progress.d.ts +4 -2
  7. package/dist/components/Sticker.d.ts +31 -0
  8. package/dist/components/Sticker.js +17 -0
  9. package/dist/components/StickerAnimated.d.ts +23 -0
  10. package/dist/components/StickerAnimated.js +28 -0
  11. package/dist/components/Text.d.ts +6 -2
  12. package/dist/components/Text.js +2 -1
  13. package/dist/components/Title.d.ts +43 -0
  14. package/dist/components/Title.js +20 -0
  15. package/dist/components/__generated__/stickers/angry-animated.d.ts +3 -0
  16. package/dist/components/__generated__/stickers/angry-animated.js +7 -0
  17. package/dist/components/__generated__/stickers/angry.d.ts +3 -0
  18. package/dist/components/__generated__/stickers/angry.js +7 -0
  19. package/dist/components/__generated__/stickers/ask-animated.d.ts +3 -0
  20. package/dist/components/__generated__/stickers/ask-animated.js +7 -0
  21. package/dist/components/__generated__/stickers/ask.d.ts +3 -0
  22. package/dist/components/__generated__/stickers/ask.js +7 -0
  23. package/dist/components/__generated__/stickers/balance-animated.d.ts +3 -0
  24. package/dist/components/__generated__/stickers/balance-animated.js +7 -0
  25. package/dist/components/__generated__/stickers/balance.d.ts +3 -0
  26. package/dist/components/__generated__/stickers/balance.js +7 -0
  27. package/dist/components/__generated__/stickers/butterfly-animated.d.ts +3 -0
  28. package/dist/components/__generated__/stickers/butterfly-animated.js +7 -0
  29. package/dist/components/__generated__/stickers/butterfly-snake-animated.d.ts +3 -0
  30. package/dist/components/__generated__/stickers/butterfly-snake-animated.js +7 -0
  31. package/dist/components/__generated__/stickers/butterfly-snake.d.ts +3 -0
  32. package/dist/components/__generated__/stickers/butterfly-snake.js +7 -0
  33. package/dist/components/__generated__/stickers/butterfly.d.ts +3 -0
  34. package/dist/components/__generated__/stickers/butterfly.js +7 -0
  35. package/dist/components/__generated__/stickers/catch-animated.d.ts +3 -0
  36. package/dist/components/__generated__/stickers/catch-animated.js +7 -0
  37. package/dist/components/__generated__/stickers/catch.d.ts +3 -0
  38. package/dist/components/__generated__/stickers/catch.js +7 -0
  39. package/dist/components/__generated__/stickers/clap-animated.d.ts +3 -0
  40. package/dist/components/__generated__/stickers/clap-animated.js +7 -0
  41. package/dist/components/__generated__/stickers/clap.d.ts +3 -0
  42. package/dist/components/__generated__/stickers/clap.js +7 -0
  43. package/dist/components/__generated__/stickers/coding-animated.d.ts +3 -0
  44. package/dist/components/__generated__/stickers/coding-animated.js +7 -0
  45. package/dist/components/__generated__/stickers/coding.d.ts +3 -0
  46. package/dist/components/__generated__/stickers/coding.js +7 -0
  47. package/dist/components/__generated__/stickers/cowboy-animated.d.ts +3 -0
  48. package/dist/components/__generated__/stickers/cowboy-animated.js +7 -0
  49. package/dist/components/__generated__/stickers/cowboy.d.ts +3 -0
  50. package/dist/components/__generated__/stickers/cowboy.js +7 -0
  51. package/dist/components/__generated__/stickers/dance-animated.d.ts +3 -0
  52. package/dist/components/__generated__/stickers/dance-animated.js +7 -0
  53. package/dist/components/__generated__/stickers/dance.d.ts +3 -0
  54. package/dist/components/__generated__/stickers/dance.js +7 -0
  55. package/dist/components/__generated__/stickers/detective-animated.d.ts +3 -0
  56. package/dist/components/__generated__/stickers/detective-animated.js +7 -0
  57. package/dist/components/__generated__/stickers/detective.d.ts +3 -0
  58. package/dist/components/__generated__/stickers/detective.js +7 -0
  59. package/dist/components/__generated__/stickers/disapprove-animated.d.ts +3 -0
  60. package/dist/components/__generated__/stickers/disapprove-animated.js +7 -0
  61. package/dist/components/__generated__/stickers/disapprove.d.ts +3 -0
  62. package/dist/components/__generated__/stickers/disapprove.js +7 -0
  63. package/dist/components/__generated__/stickers/distracted-animated.d.ts +3 -0
  64. package/dist/components/__generated__/stickers/distracted-animated.js +7 -0
  65. package/dist/components/__generated__/stickers/distracted.d.ts +3 -0
  66. package/dist/components/__generated__/stickers/distracted.js +7 -0
  67. package/dist/components/__generated__/stickers/dive-animated.d.ts +3 -0
  68. package/dist/components/__generated__/stickers/dive-animated.js +7 -0
  69. package/dist/components/__generated__/stickers/dive.d.ts +3 -0
  70. package/dist/components/__generated__/stickers/dive.js +7 -0
  71. package/dist/components/__generated__/stickers/eat-animated.d.ts +3 -0
  72. package/dist/components/__generated__/stickers/eat-animated.js +7 -0
  73. package/dist/components/__generated__/stickers/eat.d.ts +3 -0
  74. package/dist/components/__generated__/stickers/eat.js +7 -0
  75. package/dist/components/__generated__/stickers/facepalm-animated.d.ts +3 -0
  76. package/dist/components/__generated__/stickers/facepalm-animated.js +7 -0
  77. package/dist/components/__generated__/stickers/facepalm.d.ts +3 -0
  78. package/dist/components/__generated__/stickers/facepalm.js +7 -0
  79. package/dist/components/__generated__/stickers/failed-animated.d.ts +3 -0
  80. package/dist/components/__generated__/stickers/failed-animated.js +7 -0
  81. package/dist/components/__generated__/stickers/failed.d.ts +3 -0
  82. package/dist/components/__generated__/stickers/failed.js +7 -0
  83. package/dist/components/__generated__/stickers/found-animated.d.ts +3 -0
  84. package/dist/components/__generated__/stickers/found-animated.js +7 -0
  85. package/dist/components/__generated__/stickers/found.d.ts +3 -0
  86. package/dist/components/__generated__/stickers/found.js +7 -0
  87. package/dist/components/__generated__/stickers/grow-animated.d.ts +3 -0
  88. package/dist/components/__generated__/stickers/grow-animated.js +7 -0
  89. package/dist/components/__generated__/stickers/grow.d.ts +3 -0
  90. package/dist/components/__generated__/stickers/grow.js +7 -0
  91. package/dist/components/__generated__/stickers/handstand-animated.d.ts +3 -0
  92. package/dist/components/__generated__/stickers/handstand-animated.js +7 -0
  93. package/dist/components/__generated__/stickers/handstand.d.ts +3 -0
  94. package/dist/components/__generated__/stickers/handstand.js +7 -0
  95. package/dist/components/__generated__/stickers/heart-animated.d.ts +3 -0
  96. package/dist/components/__generated__/stickers/heart-animated.js +7 -0
  97. package/dist/components/__generated__/stickers/heart.d.ts +3 -0
  98. package/dist/components/__generated__/stickers/heart.js +7 -0
  99. package/dist/components/__generated__/stickers/hello-animated.d.ts +3 -0
  100. package/dist/components/__generated__/stickers/hello-animated.js +7 -0
  101. package/dist/components/__generated__/stickers/hello.d.ts +3 -0
  102. package/dist/components/__generated__/stickers/hello.js +7 -0
  103. package/dist/components/__generated__/stickers/idea-animated.d.ts +3 -0
  104. package/dist/components/__generated__/stickers/idea-animated.js +7 -0
  105. package/dist/components/__generated__/stickers/idea.d.ts +3 -0
  106. package/dist/components/__generated__/stickers/idea.js +7 -0
  107. package/dist/components/__generated__/stickers/index.d.ts +99 -0
  108. package/dist/components/__generated__/stickers/index.js +198 -0
  109. package/dist/components/__generated__/stickers/laugh-animated.d.ts +3 -0
  110. package/dist/components/__generated__/stickers/laugh-animated.js +7 -0
  111. package/dist/components/__generated__/stickers/laugh.d.ts +3 -0
  112. package/dist/components/__generated__/stickers/laugh.js +7 -0
  113. package/dist/components/__generated__/stickers/love-animated.d.ts +3 -0
  114. package/dist/components/__generated__/stickers/love-animated.js +7 -0
  115. package/dist/components/__generated__/stickers/love.d.ts +3 -0
  116. package/dist/components/__generated__/stickers/love.js +7 -0
  117. package/dist/components/__generated__/stickers/nap-animated.d.ts +3 -0
  118. package/dist/components/__generated__/stickers/nap-animated.js +7 -0
  119. package/dist/components/__generated__/stickers/nap.d.ts +3 -0
  120. package/dist/components/__generated__/stickers/nap.js +7 -0
  121. package/dist/components/__generated__/stickers/party-animated.d.ts +3 -0
  122. package/dist/components/__generated__/stickers/party-animated.js +7 -0
  123. package/dist/components/__generated__/stickers/party.d.ts +3 -0
  124. package/dist/components/__generated__/stickers/party.js +7 -0
  125. package/dist/components/__generated__/stickers/passed-animated.d.ts +3 -0
  126. package/dist/components/__generated__/stickers/passed-animated.js +7 -0
  127. package/dist/components/__generated__/stickers/passed.d.ts +3 -0
  128. package/dist/components/__generated__/stickers/passed.js +7 -0
  129. package/dist/components/__generated__/stickers/peekaboo-animated.d.ts +3 -0
  130. package/dist/components/__generated__/stickers/peekaboo-animated.js +7 -0
  131. package/dist/components/__generated__/stickers/peekaboo.d.ts +3 -0
  132. package/dist/components/__generated__/stickers/peekaboo.js +7 -0
  133. package/dist/components/__generated__/stickers/pizza-animated.d.ts +3 -0
  134. package/dist/components/__generated__/stickers/pizza-animated.js +7 -0
  135. package/dist/components/__generated__/stickers/pizza.d.ts +3 -0
  136. package/dist/components/__generated__/stickers/pizza.js +7 -0
  137. package/dist/components/__generated__/stickers/puzzle-animated.d.ts +3 -0
  138. package/dist/components/__generated__/stickers/puzzle-animated.js +7 -0
  139. package/dist/components/__generated__/stickers/puzzle.d.ts +3 -0
  140. package/dist/components/__generated__/stickers/puzzle.js +7 -0
  141. package/dist/components/__generated__/stickers/sad-animated.d.ts +3 -0
  142. package/dist/components/__generated__/stickers/sad-animated.js +7 -0
  143. package/dist/components/__generated__/stickers/sad.d.ts +3 -0
  144. package/dist/components/__generated__/stickers/sad.js +7 -0
  145. package/dist/components/__generated__/stickers/scared-animated.d.ts +3 -0
  146. package/dist/components/__generated__/stickers/scared-animated.js +7 -0
  147. package/dist/components/__generated__/stickers/scared.d.ts +3 -0
  148. package/dist/components/__generated__/stickers/scared.js +7 -0
  149. package/dist/components/__generated__/stickers/scroll-animated.d.ts +3 -0
  150. package/dist/components/__generated__/stickers/scroll-animated.js +7 -0
  151. package/dist/components/__generated__/stickers/scroll.d.ts +3 -0
  152. package/dist/components/__generated__/stickers/scroll.js +7 -0
  153. package/dist/components/__generated__/stickers/search-animated.d.ts +3 -0
  154. package/dist/components/__generated__/stickers/search-animated.js +7 -0
  155. package/dist/components/__generated__/stickers/search.d.ts +3 -0
  156. package/dist/components/__generated__/stickers/search.js +7 -0
  157. package/dist/components/__generated__/stickers/shield-animated.d.ts +3 -0
  158. package/dist/components/__generated__/stickers/shield-animated.js +7 -0
  159. package/dist/components/__generated__/stickers/shield.d.ts +3 -0
  160. package/dist/components/__generated__/stickers/shield.js +7 -0
  161. package/dist/components/__generated__/stickers/shocked-animated.d.ts +3 -0
  162. package/dist/components/__generated__/stickers/shocked-animated.js +7 -0
  163. package/dist/components/__generated__/stickers/shocked.d.ts +3 -0
  164. package/dist/components/__generated__/stickers/shocked.js +7 -0
  165. package/dist/components/__generated__/stickers/sleep-animated.d.ts +3 -0
  166. package/dist/components/__generated__/stickers/sleep-animated.js +7 -0
  167. package/dist/components/__generated__/stickers/sleep.d.ts +3 -0
  168. package/dist/components/__generated__/stickers/sleep.js +7 -0
  169. package/dist/components/__generated__/stickers/stressed-animated.d.ts +3 -0
  170. package/dist/components/__generated__/stickers/stressed-animated.js +7 -0
  171. package/dist/components/__generated__/stickers/stressed.d.ts +3 -0
  172. package/dist/components/__generated__/stickers/stressed.js +7 -0
  173. package/dist/components/__generated__/stickers/suspicious-animated.d.ts +3 -0
  174. package/dist/components/__generated__/stickers/suspicious-animated.js +7 -0
  175. package/dist/components/__generated__/stickers/suspicious.d.ts +3 -0
  176. package/dist/components/__generated__/stickers/suspicious.js +7 -0
  177. package/dist/components/__generated__/stickers/thanks-animated.d.ts +3 -0
  178. package/dist/components/__generated__/stickers/thanks-animated.js +7 -0
  179. package/dist/components/__generated__/stickers/thanks.d.ts +3 -0
  180. package/dist/components/__generated__/stickers/thanks.js +7 -0
  181. package/dist/components/__generated__/stickers/think-animated.d.ts +3 -0
  182. package/dist/components/__generated__/stickers/think-animated.js +7 -0
  183. package/dist/components/__generated__/stickers/think-of-you-animated.d.ts +3 -0
  184. package/dist/components/__generated__/stickers/think-of-you-animated.js +7 -0
  185. package/dist/components/__generated__/stickers/think-of-you.d.ts +3 -0
  186. package/dist/components/__generated__/stickers/think-of-you.js +7 -0
  187. package/dist/components/__generated__/stickers/think.d.ts +3 -0
  188. package/dist/components/__generated__/stickers/think.js +7 -0
  189. package/dist/components/__generated__/stickers/thumbs-up-animated.d.ts +3 -0
  190. package/dist/components/__generated__/stickers/thumbs-up-animated.js +7 -0
  191. package/dist/components/__generated__/stickers/thumbs-up.d.ts +3 -0
  192. package/dist/components/__generated__/stickers/thumbs-up.js +7 -0
  193. package/dist/components/__generated__/stickers/vacation-animated.d.ts +3 -0
  194. package/dist/components/__generated__/stickers/vacation-animated.js +7 -0
  195. package/dist/components/__generated__/stickers/vacation.d.ts +3 -0
  196. package/dist/components/__generated__/stickers/vacation.js +7 -0
  197. package/dist/components/__generated__/stickers/wait-animated.d.ts +3 -0
  198. package/dist/components/__generated__/stickers/wait-animated.js +7 -0
  199. package/dist/components/__generated__/stickers/wait.d.ts +3 -0
  200. package/dist/components/__generated__/stickers/wait.js +7 -0
  201. package/dist/components/__generated__/stickers/wink-animated.d.ts +3 -0
  202. package/dist/components/__generated__/stickers/wink-animated.js +7 -0
  203. package/dist/components/__generated__/stickers/wink.d.ts +3 -0
  204. package/dist/components/__generated__/stickers/wink.js +7 -0
  205. package/dist/components/__generated__/stickers/work-animated.d.ts +3 -0
  206. package/dist/components/__generated__/stickers/work-animated.js +7 -0
  207. package/dist/components/__generated__/stickers/work.d.ts +3 -0
  208. package/dist/components/__generated__/stickers/work.js +7 -0
  209. package/dist/components/__generated__/stickers/zen-animated.d.ts +3 -0
  210. package/dist/components/__generated__/stickers/zen-animated.js +7 -0
  211. package/dist/components/__generated__/stickers/zen.d.ts +3 -0
  212. package/dist/components/__generated__/stickers/zen.js +7 -0
  213. package/dist/elements/a-button.css +733 -0
  214. package/dist/elements/a-button.d.ts +10 -0
  215. package/dist/elements/a-button.js +76 -0
  216. package/dist/elements/a-icon.css +31 -6
  217. package/dist/elements/a-icon.shapes.css +9 -1
  218. package/dist/elements/a-icon.shapes.d.ts +5 -2
  219. package/dist/elements/a-icon.shapes.js +2 -0
  220. package/dist/elements/a-progress.css +7 -9
  221. package/dist/elements/a-sticker-animated.css +9 -0
  222. package/dist/elements/a-sticker-animated.d.ts +38 -0
  223. package/dist/elements/a-sticker-animated.js +79 -0
  224. package/dist/elements/a-sticker.css +9 -0
  225. package/dist/elements/a-sticker.d.ts +18 -0
  226. package/dist/elements/a-sticker.js +30 -0
  227. package/dist/elements/a-text.css +14 -5
  228. package/dist/elements/a-title.css +64 -0
  229. package/dist/elements/index.d.ts +7 -0
  230. package/dist/elements/index.js +19 -0
  231. package/dist/general_types.d.ts +120 -4
  232. package/dist/generate-icons.mjs +5 -3
  233. package/dist/generate-stickers.mjs +293 -0
  234. package/dist/index.d.ts +8 -0
  235. package/dist/index.js +8 -0
  236. package/dist/jsx-runtime.d.ts +6 -1
  237. package/dist/reset.css +96 -11
  238. package/dist/tokens.css +186 -182
  239. package/package.json +17 -4
@@ -1,3 +1,4 @@
1
+ import type { IconShape } from './elements/a-icon.shapes';
1
2
  /** Common props for JSX component wrappers. */
2
3
  export interface BaseProps {
3
4
  /** CSS class name. Merged with any internal classes by the component. */
@@ -6,9 +7,21 @@ export interface BaseProps {
6
7
  style?: React.CSSProperties;
7
8
  /** Child elements. When provided, replaces the component's default label/content. */
8
9
  children?: React.ReactNode;
10
+ /** HTML `id` attribute. */
11
+ id?: string;
12
+ /** HTML `title` attribute — native browser tooltip on hover. */
13
+ title?: string;
14
+ /** Tab order. Set to `-1` to skip the element when tabbing. */
15
+ tabIndex?: number;
16
+ /** Any `data-*` attribute is forwarded to the rendered element. */
17
+ [key: `data-${string}`]: unknown;
18
+ /** Any `aria-*` attribute is forwarded to the rendered element. */
19
+ [key: `aria-${string}`]: unknown;
9
20
  }
10
21
  /** Attributes for intrinsic custom elements (`<a-*>` tags) in JSX. */
11
22
  export interface BaseAttributes {
23
+ /** React/Preact reconciliation key when rendered inside a list. */
24
+ key?: string | number | null;
12
25
  /** HTML `class` attribute (standard DOM). */
13
26
  class?: string;
14
27
  /** React/Preact-style class name. Alias for `class`. */
@@ -60,6 +73,8 @@ export interface ATextAttributes extends BaseAttributes {
60
73
  priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
61
74
  /** Color tint. Applies the matching `--text-{N}-{tone}` palette. */
62
75
  tone?: 'brand' | 'success' | 'critical' | 'warning' | 'info';
76
+ /** Type scale. `small` = 13/16, `medium` (default) = 15/20, `large` = 17/24. */
77
+ size?: 'small' | 'medium' | 'large';
63
78
  /** Render as inline-block instead of the default block. */
64
79
  inline?: boolean | string;
65
80
  /** Truncate to N lines with a trailing ellipsis. The attribute value
@@ -74,13 +89,83 @@ export interface ATextAttributes extends BaseAttributes {
74
89
  'aria-expanded'?: boolean | 'true' | 'false';
75
90
  }
76
91
  /**
77
- * Attributes for the `<a-icon>` custom element. The `shape` attribute
78
- * value is typed as `string` here so the element accepts any consumer's
79
- * generated shapes. The JSX wrapper (`Icon`) narrows it to `IconShape`.
92
+ * Attributes for the `<a-title>` styled tag.
93
+ *
94
+ * `<a-title>` has no JS it's a CSS-only styled element. Low-level
95
+ * attributes; for the JSX wrapper with typed `level` numbers and ARIA
96
+ * use `Title` from `@antadesign/anta`.
97
+ */
98
+ export interface ATitleAttributes extends BaseAttributes {
99
+ /** Heading level as a string attribute, '1'-'6'. */
100
+ level?: string;
101
+ /** Visual priority. Maps to text-1..text-5. */
102
+ priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
103
+ /** Color tint. Applies the matching `--text-{N}-{tone}` palette. */
104
+ tone?: 'brand' | 'success' | 'critical' | 'warning' | 'info';
105
+ /** ARIA role — the JSX wrapper sets this to `'heading'`. */
106
+ role?: string;
107
+ /** ARIA heading level — the JSX wrapper sets this to match `level`. */
108
+ 'aria-level'?: number | string;
109
+ }
110
+ /**
111
+ * Attributes for the `<a-sticker>` static sticker carrier.
112
+ *
113
+ * The SVG payload is passed as the `svg` attribute — a markup string.
114
+ * On change, the element writes it into its shadow DOM (no light-DOM
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`.
118
+ */
119
+ export interface AStickerAttributes extends BaseAttributes {
120
+ /** SVG markup string. On change the element drops it into its shadow
121
+ * DOM (`innerHTML`). */
122
+ svg?: string;
123
+ role?: string;
124
+ 'aria-label'?: string;
125
+ 'aria-hidden'?: 'true' | 'false' | boolean;
126
+ }
127
+ /**
128
+ * Attributes for the `<a-sticker-animated>` Lottie sticker carrier.
129
+ *
130
+ * The Lottie payload is passed as the `animation` attribute — a JSON
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;
148
+ }
149
+ /**
150
+ * Attributes for the `<a-icon>` custom element. `shape` is typed as
151
+ * `IconShape` (`keyof IconShapes`); the `IconShapes` interface is
152
+ * module-augmentable, so consumers who generate their own shape sets
153
+ * via `declare module '@antadesign/anta' { interface IconShapes { … } }`
154
+ * get those keys accepted automatically.
80
155
  */
81
156
  export interface AIconAttributes extends BaseAttributes {
82
157
  /** Which icon to render. */
83
- shape?: string;
158
+ shape?: IconShape;
159
+ /** Width and height in pixels. Mapped to the `--icon-size` custom
160
+ * property via the CSS Values 5 typed `attr()` function — Chrome
161
+ * 133+ and Safari 18.2+ only. Firefox hasn't shipped typed
162
+ * `attr()` yet, so on raw `<a-icon size="N">` the attribute is
163
+ * silently ignored there and the icon stays at the default 16 ×
164
+ * 16. For cross-browser sizing in pure-HTML usage, set the
165
+ * variable inline: `<a-icon style="--icon-size: 24px">`. The JSX
166
+ * `<Icon size={N}>` wrapper already does that under the hood and
167
+ * is the recommended path. */
168
+ size?: number | string;
84
169
  /** ARIA role — the JSX wrapper sets `'img'` when a label is provided. */
85
170
  role?: string;
86
171
  /** ARIA accessible name when the icon carries meaning. */
@@ -88,3 +173,34 @@ export interface AIconAttributes extends BaseAttributes {
88
173
  /** Hides decorative icons from screen readers. */
89
174
  'aria-hidden'?: 'true' | 'false' | boolean;
90
175
  }
176
+ /**
177
+ * Attributes for the `<a-button>` custom element. For the typed JSX
178
+ * wrapper use `Button` from `@antadesign/anta`.
179
+ */
180
+ export interface AButtonAttributes extends BaseAttributes {
181
+ /** Visual emphasis. */
182
+ priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary';
183
+ /** Semantic tone, or any literal CSS color for a one-off custom tone. */
184
+ tone?: 'neutral' | 'brand' | 'critical' | 'info' | 'success' | 'warning' | (string & {});
185
+ /** Underline style. Only renders on `priority="tertiary" | "quaternary"`. */
186
+ underline?: 'solid' | 'dashed' | 'dotted';
187
+ /** Size variant. small=22px, medium=26px, large=30px. */
188
+ size?: 'small' | 'medium' | 'large';
189
+ /** Drop outer padding to zero. Only takes effect on `priority="quaternary"`.
190
+ * Presence-based: `''` (or any value) turns it on; omit to turn off. */
191
+ paddingless?: '' | 'true' | 'false' | boolean;
192
+ /** Loading state. Presence-based (`''` on, omit off). */
193
+ loading?: '' | 'true' | 'false' | boolean;
194
+ /** Disabled state. Presence-based (`''` on, omit off). */
195
+ disabled?: '' | 'true' | 'false' | boolean;
196
+ /** Toggled-on / pressed state. Presence-based (`''` on, omit off). */
197
+ selected?: '' | 'true' | 'false' | boolean;
198
+ /** Submit/reset semantics. */
199
+ type?: 'button' | 'submit' | 'reset';
200
+ /** Associate with a form by id when not nested inside it. */
201
+ form?: string;
202
+ /** Custom event name dispatched (bubbling) on click. */
203
+ 'data-custom-event'?: string;
204
+ 'aria-disabled'?: 'true' | 'false' | boolean;
205
+ 'aria-busy'?: 'true' | 'false' | boolean;
206
+ }
@@ -63,7 +63,7 @@ export async function generate({ input, output = '.', name = 'a-icon.shapes', in
63
63
  // built-ins; consumers who want their icons unlayered can post-
64
64
  // process the output.
65
65
  const cssLines = [
66
- '/* Auto-generated by scripts/generate-icons.mjs. Do not edit by hand. */',
66
+ '/* Auto-generated by @antadesign/anta. Do not edit by hand. */',
67
67
  '',
68
68
  '@layer anta {',
69
69
  '',
@@ -132,7 +132,9 @@ export async function generate({ input, output = '.', name = 'a-icon.shapes', in
132
132
 
133
133
  const synonymsEntries = Object.entries(synonyms)
134
134
  const tsLines = [
135
- '/* Auto-generated by scripts/generate-icons.mjs. Do not edit by hand. */',
135
+ '/* Auto-generated by @antadesign/anta. Do not edit by hand. */',
136
+ '',
137
+ "import type { IconShapes } from '@antadesign/anta'",
136
138
  '',
137
139
  'export const ICON_SHAPES = [',
138
140
  ...shapes.map((s) => ` '${s}',`),
@@ -150,7 +152,7 @@ export async function generate({ input, output = '.', name = 'a-icon.shapes', in
150
152
  ' }',
151
153
  '}',
152
154
  '',
153
- "export type IconShape = keyof import('@antadesign/anta').IconShapes",
155
+ 'export type IconShape = keyof IconShapes',
154
156
  '',
155
157
  ]
156
158
  fs.writeFileSync(tsPath, tsLines.join('\n'))
@@ -0,0 +1,293 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * generate-stickers.mjs — read a folder of per-sticker subfolders and emit
4
+ * one per-sticker TS module per mode (static + animated) under the chosen
5
+ * output folder, plus a barrel index that re-exports them.
6
+ *
7
+ * Expected source layout:
8
+ *
9
+ * stickers/
10
+ * coding/
11
+ * coding.json — Lottie animation (drives Sticker{Name}Animated)
12
+ * coding.svg — static pose (drives Sticker{Name})
13
+ * vacation/
14
+ * vacation.json
15
+ * vacation.svg
16
+ * …
17
+ *
18
+ *
19
+ * Collision detection — when `--internal` is NOT passed (i.e. consumer
20
+ * run), the generator warns if a generated name collides with one of
21
+ * anta's built-in stickers. Anta's own build passes `--internal`.
22
+ *
23
+ * node scripts/generate-stickers.mjs --input ./stickers --output ./src/components/__generated__/stickers
24
+ */
25
+
26
+ import fs from "node:fs";
27
+ import path from "node:path";
28
+
29
+ // Anta's built-in sticker names. Consumers who generate a same-named
30
+ // sticker get a warning; their generated module will resolve to the same
31
+ // import path and shadow ours. Keep this list in sync with the canonical
32
+ // names under ./stickers/<name>/.
33
+ const DEFAULT_BUILT_IN = [
34
+ "angry",
35
+ "ask",
36
+ "balance",
37
+ "butterfly",
38
+ "butterfly-snake",
39
+ "catch",
40
+ "clap",
41
+ "coding",
42
+ "cowboy",
43
+ "dance",
44
+ "detective",
45
+ "disapprove",
46
+ "distracted",
47
+ "dive",
48
+ "eat",
49
+ "facepalm",
50
+ "failed",
51
+ "found",
52
+ "grow",
53
+ "handstand",
54
+ "heart",
55
+ "hello",
56
+ "idea",
57
+ "laugh",
58
+ "love",
59
+ "nap",
60
+ "party",
61
+ "passed",
62
+ "peekaboo",
63
+ "pizza",
64
+ "puzzle",
65
+ "sad",
66
+ "scared",
67
+ "scroll",
68
+ "search",
69
+ "shield",
70
+ "shocked",
71
+ "sleep",
72
+ "stressed",
73
+ "suspicious",
74
+ "thanks",
75
+ "think",
76
+ "think-of-you",
77
+ "thumbs-up",
78
+ "vacation",
79
+ "wait",
80
+ "wink",
81
+ "work",
82
+ "zen",
83
+ ];
84
+
85
+ function pascalCase(name) {
86
+ return name
87
+ .split(/[-_\s]+/)
88
+ .filter(Boolean)
89
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
90
+ .join("");
91
+ }
92
+
93
+ function componentName(base) {
94
+ return `Sticker${pascalCase(base)}`;
95
+ }
96
+
97
+ export async function generate({ input, output, internal = false } = {}) {
98
+ if (!input) throw new Error("generate-stickers: --input is required");
99
+ if (!output) throw new Error("generate-stickers: --output is required");
100
+
101
+ const inDir = path.resolve(input);
102
+ const outDir = path.resolve(output);
103
+ if (!fs.existsSync(inDir)) {
104
+ throw new Error(`generate-stickers: input folder not found: ${inDir}`);
105
+ }
106
+ fs.mkdirSync(outDir, { recursive: true });
107
+
108
+ // Each immediate subfolder of inDir is one sticker. The folder name is
109
+ // the canonical sticker name.
110
+ const subdirs = fs
111
+ .readdirSync(inDir, { withFileTypes: true })
112
+ .filter((d) => d.isDirectory())
113
+ .map((d) => d.name)
114
+ .sort();
115
+
116
+ if (subdirs.length === 0) {
117
+ console.warn(`generate-stickers: no sticker subfolders in ${inDir}`);
118
+ }
119
+
120
+ // Clear out previous generated files so renamed/removed stickers don't
121
+ // leave stale modules behind. Keep index.ts (about to be rewritten) and
122
+ // the per-sticker static + animated file names we're about to write.
123
+ // Naming convention: `<name>.ts` is the static (default) sticker;
124
+ // `<name>-animated.ts` is the Lottie-backed animated variant.
125
+ const keep = new Set([
126
+ "index.ts",
127
+ ...subdirs.flatMap((n) => [`${n}.ts`, `${n}-animated.ts`]),
128
+ ]);
129
+ for (const existing of fs.readdirSync(outDir)) {
130
+ if (!keep.has(existing) && /\.ts$/.test(existing)) {
131
+ fs.unlinkSync(path.join(outDir, existing));
132
+ }
133
+ }
134
+
135
+ const exports = [];
136
+ const skipped = [];
137
+ const builtInSet = internal ? new Set() : new Set(DEFAULT_BUILT_IN);
138
+ const collisions = [];
139
+
140
+ for (const name of subdirs) {
141
+ const subdir = path.join(inDir, name);
142
+ const lottiePath = path.join(subdir, `${name}.json`);
143
+ const svgPath = path.join(subdir, `${name}.svg`);
144
+ const hasLottie = fs.existsSync(lottiePath);
145
+ const hasSvg = fs.existsSync(svgPath) && fs.statSync(svgPath).size > 0;
146
+ if (!hasLottie && !hasSvg) {
147
+ skipped.push(`${name} (no ${name}.json or ${name}.svg)`);
148
+ continue;
149
+ }
150
+ if (builtInSet.has(name)) collisions.push(name);
151
+ const cname = componentName(name);
152
+ const animatedName = `${cname}Animated`;
153
+
154
+ // Static module — the default. Emitted whenever a non-empty SVG
155
+ // exists. Imports the `Sticker` runtime wrapper from the package
156
+ // root `@antadesign/anta` (same root specifier the icon codegen
157
+ // uses — no bespoke runtime subpath). Lives at `<name>.ts` so the
158
+ // import path matches the bare sticker name.
159
+ //
160
+ // Two exports: the JSX `Sticker{Name}` component (React/Preact),
161
+ // and the raw `svg` string (vanilla JS / non-JSX consumers, who
162
+ // assign it to an `<a-sticker>` element's `svg` attribute).
163
+ // Bundlers tree-shake the unused one.
164
+ if (hasSvg) {
165
+ const svg = fs.readFileSync(svgPath, "utf8");
166
+ const lines = [
167
+ "/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
168
+ "",
169
+ "import { Sticker, type StickerProps } from '@antadesign/anta'",
170
+ "",
171
+ `export const svg = ${JSON.stringify(svg)}`,
172
+ "",
173
+ `export const ${cname} = (props: StickerProps) => Sticker({ ...props, svg })`,
174
+ "",
175
+ ];
176
+ fs.writeFileSync(path.join(outDir, `${name}.ts`), lines.join("\n"));
177
+ }
178
+
179
+ // Animated module — emitted whenever a Lottie JSON exists. Each
180
+ // module lives in `<name>-animated.ts` so importing only the static
181
+ // sticker (`<name>.ts`) never drags the Lottie payload. Bundlers
182
+ // tree-shake per-file when the barrel uses `export { … } from
183
+ // './foo'`. Imports the `StickerAnimated` runtime wrapper from the
184
+ // package root `@antadesign/anta`.
185
+ //
186
+ // The animation is exported as a JSON *string* (not the parsed
187
+ // object). `<a-sticker-animated>` receives it via its `animation`
188
+ // attribute and parses it once on set. Two exports: the JSX
189
+ // `Sticker{Name}Animated` component, and the raw `animationJson`
190
+ // string (vanilla JS / non-JSX consumers who call
191
+ // `el.setAttribute('animation', animationJson)`).
192
+ if (hasLottie) {
193
+ const lottieJson = fs.readFileSync(lottiePath, "utf8");
194
+ const lines = [
195
+ "/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
196
+ "",
197
+ "import { StickerAnimated, type StickerAnimatedProps } from '@antadesign/anta'",
198
+ "",
199
+ `export const animationJson = ${JSON.stringify(lottieJson)}`,
200
+ "",
201
+ `export const ${animatedName} = (props: StickerAnimatedProps) => StickerAnimated({ ...props, animation: animationJson })`,
202
+ "",
203
+ ];
204
+ fs.writeFileSync(
205
+ path.join(outDir, `${name}-animated.ts`),
206
+ lines.join("\n"),
207
+ );
208
+ }
209
+
210
+ exports.push({
211
+ base: name,
212
+ componentName: cname,
213
+ hasLottie,
214
+ hasSvg,
215
+ animatedName,
216
+ });
217
+ }
218
+
219
+ // Barrel — alphabetical for stable diffs, side-effect free so unused
220
+ // stickers tree-shake. Each export references the correct per-mode
221
+ // file so importing only the static variant doesn't pull the animated
222
+ // module (and vice versa).
223
+ const reExports = [];
224
+ for (const {
225
+ base,
226
+ componentName,
227
+ hasLottie,
228
+ hasSvg,
229
+ animatedName,
230
+ } of exports) {
231
+ if (hasSvg) reExports.push(`export { ${componentName} } from './${base}'`);
232
+ if (hasLottie)
233
+ reExports.push(`export { ${animatedName} } from './${base}-animated'`);
234
+ }
235
+ const indexLines = [
236
+ "/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
237
+ "",
238
+ "export type { StickerProps, StickerAnimatedProps } from '@antadesign/anta'",
239
+ "",
240
+ ...reExports,
241
+ "",
242
+ ];
243
+ fs.writeFileSync(path.join(outDir, "index.ts"), indexLines.join("\n"));
244
+
245
+ if (collisions.length > 0) {
246
+ console.warn(
247
+ `generate-stickers: ${collisions.length} sticker name(s) collide with Anta's built-in stickers: ` +
248
+ `${collisions.join(", ")}. ` +
249
+ `Consumers importing from \`@antadesign/anta/stickers\` get Anta's; your generated barrel exposes yours under its own import path.`,
250
+ );
251
+ }
252
+
253
+ console.log(
254
+ `generate-stickers: wrote ${exports.length} sticker${exports.length === 1 ? "" : "s"} to ${outDir}`,
255
+ );
256
+ if (skipped.length) {
257
+ console.warn(
258
+ `generate-stickers: skipped ${skipped.length} (${skipped.join(", ")})`,
259
+ );
260
+ }
261
+ return { stickers: exports };
262
+ }
263
+
264
+ function parseArgs(argv) {
265
+ const out = {};
266
+ for (let i = 0; i < argv.length; i++) {
267
+ const arg = argv[i];
268
+ if (arg.startsWith("--")) {
269
+ const key = arg.slice(2);
270
+ const next = argv[i + 1];
271
+ if (next && !next.startsWith("--")) {
272
+ out[key] = next;
273
+ i++;
274
+ } else {
275
+ out[key] = true;
276
+ }
277
+ }
278
+ }
279
+ return out;
280
+ }
281
+
282
+ const isMain = process.argv[1]?.endsWith("generate-stickers.mjs");
283
+ if (isMain) {
284
+ const args = parseArgs(process.argv.slice(2));
285
+ generate({
286
+ input: args.input,
287
+ output: args.output,
288
+ internal: args.internal === true,
289
+ }).catch((e) => {
290
+ console.error(e.message);
291
+ process.exit(1);
292
+ });
293
+ }
package/dist/index.d.ts CHANGED
@@ -20,9 +20,17 @@ export { Progress } from './components/Progress';
20
20
  export type { ProgressProps } from './components/Progress';
21
21
  export { Text } from './components/Text';
22
22
  export type { TextProps } from './components/Text';
23
+ export { Title } from './components/Title';
24
+ export type { TitleProps } from './components/Title';
23
25
  export { Icon } from './components/Icon';
24
26
  export type { IconProps } from './components/Icon';
27
+ export { Button } from './components/Button';
28
+ export type { ButtonProps, BaseButtonProps, ContentMode, SubmitMode, PriorityMode, } from './components/Button';
25
29
  export { ICON_SHAPES, ICON_SYNONYMS } from './elements/a-icon.shapes';
30
+ export { Sticker } from './components/Sticker';
31
+ export type { StickerProps } from './components/Sticker';
32
+ export { StickerAnimated } from './components/StickerAnimated';
33
+ export type { StickerAnimatedProps } from './components/StickerAnimated';
26
34
  export type { BaseProps, BaseAttributes } from './general_types';
27
35
  export { configure } from './jsx-runtime';
28
36
  /**
package/dist/index.js CHANGED
@@ -1,13 +1,21 @@
1
1
  import { Progress } from "./components/Progress";
2
2
  import { Text } from "./components/Text";
3
+ import { Title } from "./components/Title";
3
4
  import { Icon } from "./components/Icon";
5
+ import { Button } from "./components/Button";
4
6
  import { ICON_SHAPES, ICON_SYNONYMS } from "./elements/a-icon.shapes";
7
+ import { Sticker } from "./components/Sticker";
8
+ import { StickerAnimated } from "./components/StickerAnimated";
5
9
  import { configure } from "./jsx-runtime";
6
10
  export {
11
+ Button,
7
12
  ICON_SHAPES,
8
13
  ICON_SYNONYMS,
9
14
  Icon,
10
15
  Progress,
16
+ Sticker,
17
+ StickerAnimated,
11
18
  Text,
19
+ Title,
12
20
  configure
13
21
  };
@@ -22,7 +22,7 @@ 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, AIconAttributes, BaseAttributes } from './general_types';
25
+ import type { AProgressAttributes, ATextAttributes, ATitleAttributes, AIconAttributes, AButtonAttributes, AStickerAttributes, AStickerAnimatedAttributes, BaseAttributes } from './general_types';
26
26
  export declare namespace JSX {
27
27
  type IntrinsicElements = React.JSX.IntrinsicElements & {
28
28
  'a-progress': AProgressAttributes;
@@ -31,6 +31,11 @@ export declare namespace JSX {
31
31
  'a-progress-text': BaseAttributes;
32
32
  'a-progress-hint': BaseAttributes;
33
33
  'a-text': ATextAttributes;
34
+ 'a-title': ATitleAttributes;
34
35
  'a-icon': AIconAttributes;
36
+ 'a-button': AButtonAttributes;
37
+ 'a-button-label': BaseAttributes;
38
+ 'a-sticker': AStickerAttributes;
39
+ 'a-sticker-animated': AStickerAnimatedAttributes;
35
40
  };
36
41
  }
package/dist/reset.css CHANGED
@@ -52,14 +52,32 @@
52
52
 
53
53
  /* ───── Typography defaults — Anta opinion ───────────────────── */
54
54
 
55
+ /* Raw headings adopt the same visual scale as `<Title level={n}>`
56
+ so plain markup matches the component. Values are duplicated in
57
+ `src/elements/a-title.css`; keep the two in lockstep. */
55
58
  h1, h2, h3, h4, h5, h6 {
56
- font-weight: 600;
59
+ color: var(--text-1);
60
+ font-weight: 584.62;
61
+ letter-spacing: 0;
57
62
  }
58
63
 
64
+ h1 { font-size: 28px; line-height: 32px; margin-block: 0 16px; }
65
+ h2 { font-size: 24px; line-height: 28px; margin-block: 32px 12px; }
66
+ h3 { font-size: 20px; line-height: 24px; margin-block: 24px 12px; }
67
+ h4 { font-size: 17px; line-height: 20px; margin-block: 20px 8px; }
68
+ h5 { font-size: 15px; line-height: 20px; margin-block: 16px 8px; }
69
+ h6 { font-size: 13px; line-height: 16px; margin-block: 16px 4px; }
70
+
59
71
  strong {
60
72
  font-weight: 600;
61
73
  }
62
74
 
75
+ /* Keep inline `<code>` from inflating the line box of the prose it
76
+ sits in — `1em` pins its line height to its own font size. */
77
+ code {
78
+ line-height: 1em;
79
+ }
80
+
63
81
  /* Prose lists (ul, ol) get a tight 3ch left padding so markers
64
82
  hug the text, and items get a small bottom margin so
65
83
  consecutive ones breathe. Markers are toned all the way down
@@ -96,20 +114,87 @@
96
114
  color: var(--link-color);
97
115
  text-decoration: underline;
98
116
  text-decoration-style: solid;
99
- text-decoration-color: color-mix(in oklch, currentColor 75%, transparent);
117
+ text-decoration-color: color-mix(in srgb, currentColor 75%, transparent);
100
118
  text-decoration-thickness: 0.5px;
101
119
  text-underline-offset: 3px;
102
120
  }
103
- a:hover {
104
- color: var(--link-color-hover);
105
- /* Underline color set to the hover token directly (rather than
106
- `currentColor`) so it repaints in lockstep with `color` — a
107
- few browsers latch onto the old currentColor value
108
- otherwise. */
109
- text-decoration-color: var(--link-color-hover);
110
- text-decoration-thickness: 1px;
121
+ /* Hover only on real-pointer devices — gating avoids the sticky hover
122
+ color that lingers after a tap on touch screens. */
123
+ @media (hover: hover) and (pointer: fine) {
124
+ a:hover {
125
+ color: var(--link-color-hover);
126
+ /* Underline color is left as the resting hairline (the base rule's
127
+ `currentColor` mix) — only the thickness grows on hover. */
128
+ text-decoration-thickness: 1px;
129
+ }
111
130
  }
112
131
  a:active {
113
- text-decoration-color: color-mix(in oklch, currentColor 75%, transparent);
132
+ text-decoration-color: color-mix(in srgb, currentColor 75%, transparent);
133
+ }
134
+
135
+ /* Text selection — brand color at 15% alpha. */
136
+ ::selection {
137
+ background: color-mix(in srgb, var(--text-1-brand), transparent 85%);
138
+ }
139
+
140
+ /* ───── Tables ───────────────────────────────────────────────── */
141
+
142
+ /* Polite, element-level baseline. Rules live in `@layer anta`, so
143
+ any consumer rule outside a layer — or in `components` /
144
+ `utilities` — overrides without effort. Width is intentionally
145
+ left untouched so app tables stay inline-sized; full-bleed is a
146
+ decision for the surrounding page. */
147
+ table {
148
+ border-collapse: collapse;
149
+ font-variant-numeric: tabular-nums;
150
+ }
151
+
152
+ caption {
153
+ text-align: left;
154
+ color: var(--text-3);
155
+ padding-left: 10px;
156
+ margin-bottom: 0.25em;
157
+ }
158
+
159
+ th, td {
160
+ padding: 5px 10px;
161
+ text-align: left;
162
+ vertical-align: top;
163
+ border-bottom: 1px solid var(--border-5);
164
+ }
165
+
166
+ thead th {
167
+ font-weight: 600;
168
+ }
169
+
170
+ /* Drop the trailing hairline under the table's last row so the
171
+ table doesn't end with an orphan line. Handles both "tbody is
172
+ the final section" and "tfoot is the final section". */
173
+ tfoot tr:last-child > :is(th, td),
174
+ table:not(:has(tfoot)) tbody tr:last-child > :is(th, td) {
175
+ border-bottom: none;
176
+ }
177
+
178
+ /* Opt-in: outer frame + vertical column dividers + 3px rounded
179
+ corners. Switches to separate borders because `border-radius`
180
+ doesn't render reliably under `border-collapse: collapse` — the
181
+ collapsed borders override the radius. Cells draw their own
182
+ right edges to build the internal grid; the last cell in each
183
+ row drops its right border so the table's own border supplies
184
+ the outer frame. Row separators come from the baseline
185
+ `border-bottom` and continue to work under separate-collapse. */
186
+ table[data-bordered] {
187
+ border-collapse: separate;
188
+ border-spacing: 0;
189
+ border: 1px solid var(--border-5);
190
+ border-radius: 3px;
191
+ }
192
+
193
+ table[data-bordered] :is(th, td) {
194
+ border-right: 1px solid var(--border-5);
195
+ }
196
+
197
+ table[data-bordered] tr > :is(th, td):last-child {
198
+ border-right: 0;
114
199
  }
115
200
  }