@theweekendprojects/emvb-daisyui 0.0.0-stage → 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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -2
  3. package/licenses/daisyui-MIT.txt +3 -0
  4. package/package.json +55 -4
  5. package/src/catalog/basic.ts +407 -0
  6. package/src/catalog/class-names.ts +623 -0
  7. package/src/catalog/countdown.ts +392 -0
  8. package/src/catalog/data-display.ts +563 -0
  9. package/src/catalog/forms.ts +433 -0
  10. package/src/catalog/index.ts +77 -0
  11. package/src/catalog/interactive.ts +567 -0
  12. package/src/catalog/layout-marketing.ts +641 -0
  13. package/src/catalog/missing-complex.ts +430 -0
  14. package/src/catalog/missing-primitives.ts +409 -0
  15. package/src/catalog/navigation.ts +438 -0
  16. package/src/catalog/value-class.ts +20 -0
  17. package/src/compatibility/index.ts +104 -0
  18. package/src/compound/editor.ts +299 -0
  19. package/src/compound/index.ts +157 -0
  20. package/src/conformance/cli.ts +9 -0
  21. package/src/conformance/compile.ts +77 -0
  22. package/src/conformance/index.ts +4 -0
  23. package/src/conformance/manifest.ts +39 -0
  24. package/src/conformance/official-inventory.ts +135 -0
  25. package/src/conformance/report-cli.ts +5 -0
  26. package/src/conformance/report.ts +59 -0
  27. package/src/conformance/verify-css.ts +22 -0
  28. package/src/extension/class-token.ts +11 -0
  29. package/src/extension/classes.ts +636 -0
  30. package/src/extension/collect-classes.ts +73 -0
  31. package/src/extension/content.ts +93 -0
  32. package/src/extension/daisy.css +12441 -0
  33. package/src/extension/daisy.js +1 -0
  34. package/src/extension/elements.ts +262 -0
  35. package/src/extension/index.ts +39 -0
  36. package/src/extension/to-output.ts +113 -0
  37. package/src/generator/artifacts.ts +81 -0
  38. package/src/generator/class-names.ts +35 -0
  39. package/src/generator/cli.ts +21 -0
  40. package/src/generator/generate.ts +122 -0
  41. package/src/generator/index.ts +2 -0
  42. package/src/generator/write-class-names.ts +10 -0
  43. package/src/index.ts +12 -0
  44. package/src/render/classes.ts +48 -0
  45. package/src/render/href.ts +19 -0
  46. package/src/render/index.ts +3 -0
  47. package/src/render/provider.ts +37 -0
  48. package/src/renderer.ts +6 -0
  49. package/src/runtime/browser.ts +11 -0
  50. package/src/runtime/index.ts +41 -0
  51. package/src/test-support.ts +13 -0
  52. package/src/themes/index.ts +72 -0
  53. package/src/types.ts +116 -0
  54. package/src/validation/index.ts +153 -0
  55. package/src/verified/primitives.ts +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shahriar Robbani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # @theweekendprojects/emvb-daisyui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@theweekendprojects/emvb-daisyui)](https://www.npmjs.com/package/@theweekendprojects/emvb-daisyui)
4
+ [![CI](https://github.com/theweekendprojects/emvb-daisyui/actions/workflows/ci.yml/badge.svg)](https://github.com/theweekendprojects/emvb-daisyui/actions/workflows/ci.yml)
5
+ [![license](https://img.shields.io/npm/l/@theweekendprojects/emvb-daisyui)](./LICENSE)
6
+
7
+ **70 [daisyUI](https://daisyui.com) components for the [EmVB](https://github.com/PerkyZZ999/EmVB) visual
8
+ page builder.** Drag a card, hero, navbar, countdown or table onto an EmDash page, tune
9
+ it in the settings panel, and publish. It is one EmVB extension, built on the Extensions API that
10
+ shipped in EmVB 1.5.
11
+
12
+ - **Nothing to wire up.** The package carries its own compiled stylesheet and script. EmVB loads them
13
+ only on pages that use one of its elements, in the editor canvas and on the public page. No
14
+ Tailwind, no daisyUI install, no CSS route, no admin entry.
15
+ - **Scoped.** Every class is prefixed `daisy-` and EmVB scopes the stylesheet to the extension's own
16
+ elements, so it does not touch the rest of your site.
17
+ - **Light and dark.** Elements follow the page theme. Any element can also pin one of the daisyUI
18
+ themes in its own Theme field.
19
+ - **Real settings, not class strings.** Each component has labelled fields for its colour, size,
20
+ style and state. Layouts store those fields, never raw Tailwind classes.
21
+
22
+ ## Install
23
+
24
+ Requires `@perkyzz/emvb` **1.5.1 or newer**.
25
+
26
+ ```sh
27
+ npm install @theweekendprojects/emvb-daisyui
28
+ ```
29
+
30
+ ```js
31
+ // astro.config.mjs
32
+ import { emvb } from "@perkyzz/emvb";
33
+ import { daisyUIExtension } from "@theweekendprojects/emvb-daisyui/extension";
34
+
35
+ export default defineConfig({
36
+ integrations: [
37
+ emvb({ extensions: [daisyUIExtension] }),
38
+ ],
39
+ });
40
+ ```
41
+
42
+ Open the editor. The components are in the Add panel, in the **Extensions** group.
43
+
44
+ The package exports TypeScript source, so load it from `astro.config.mjs` (Astro and Vite
45
+ handle that) or any bundler that reads TypeScript.
46
+
47
+ ## What is in the box
48
+
49
+ | Group | Components |
50
+ | --- | --- |
51
+ | Actions (19) | Button, Input, Textarea, Select, Checkbox, Radio, Toggle, File-Input, Range, Rating, Swap, Label, Fieldset, Theme Controller, Validator, Filter, Calendar, FAB / Speed Dial, OTP |
52
+ | Data display (15) | Badge, Progress, Statistic, Table, Timeline, Avatar, Chat Bubble, List, Status, Tooltip, Countdown, Kbd, Diff, Hover Gallery, Text Rotate |
53
+ | Feedback (6) | Alert, Modal, Loading, Skeleton, Radial progress, Toast |
54
+ | Layout (15) | Card, Accordion, Drawer, Carousel, Collapse, Stack, Divider, Join, Indicator, Mask, Container, Window mockup, Aura, Hover 3D Card, Columns |
55
+ | Navigation (11) | Navbar, Menu, Breadcrumbs, Pagination, Steps, Dock, Footer, Tabs, Dropdown, Link, Megamenu |
56
+ | Marketing (4) | Hero, Browser Mockup, Phone Mockup, Code Mockup |
57
+
58
+ Elements are stored in your pages as `ext:emvb-daisyui/daisy-<component>`, for example
59
+ `ext:emvb-daisyui/daisy-card`.
60
+
61
+ ## Using the elements
62
+
63
+ - **Containers** (Card, Hero, Collapse, Stack and others) have a content slot. Drop your own
64
+ elements into it, or fill the **Content** field instead: one block per line, and a line written as
65
+ `[label](https://example.com)` becomes a link.
66
+ - **List-like components** (Menu, Tabs, Accordion, Table, Carousel) take an **Items** field, one
67
+ `Label|text` per line. A table takes `cell|cell` per row.
68
+ - **Countdown** counts to a date and time you pick, in the visitor's clock or a fixed time zone. It
69
+ also has a fixed-number mode, like "42 seconds".
70
+ - **Theme**: leave it empty to follow the page, or choose a daisyUI theme for that element.
71
+ - **Variants**: each component lists daisyUI's colours, sizes and styles as dropdowns and toggles.
72
+ The few daisyUI modifiers that are not offered are listed in
73
+ [docs/variant-omissions.md](./docs/variant-omissions.md).
74
+
75
+ More on themes in [docs/theming.md](./docs/theming.md).
76
+
77
+ ## Known limits
78
+
79
+ - The extension cannot tell the editor from the public page, so a **Modal** or **Toast** does not
80
+ show open in the editor ([EmVB #56](https://github.com/PerkyZZ999/EmVB/issues/56)).
81
+ - Layers shows the element type (`ext:emvb-daisyui/daisy-card`), not its label
82
+ ([EmVB #58](https://github.com/PerkyZZ999/EmVB/issues/58)).
83
+ - Menu, Tabs, Carousel and Accordion items are a text field, not child elements.
84
+ - Pages built with the older provider-API version of this kit are not converted. Those nodes show
85
+ EmVB's missing-extension note until you replace them.
86
+ - Section recipes (page templates) are not part of the extension.
87
+
88
+ ## Development
89
+
90
+ ```sh
91
+ bun install
92
+ bun test ./src/ ./packages/
93
+ bun run gen:classes && bun run build:extension # after changing a component
94
+ ```
95
+
96
+ `src/extension/classes.ts`, `daisy.css` and `daisy.js` are generated, and CI fails if they are
97
+ stale. Component definitions live in `src/catalog/`, and `src/extension/` adapts them to the EmVB 1.5
98
+ output format.
99
+
100
+ ## Credits
101
+
102
+ Built on [EmVB](https://github.com/PerkyZZ999/EmVB) and its Extensions API 1.5, designed and shipped
103
+ together with EmVB's author, and on [daisyUI](https://daisyui.com) (MIT, see `licenses/`).
104
+
105
+ ## License
106
+
107
+ [MIT](./LICENSE)
@@ -0,0 +1,3 @@
1
+ daisyUI is licensed under the MIT License.
2
+ Copyright (c) 2020-PRESENT Pouya Saadeghi
3
+ See https://github.com/saadeghi/daisyui/blob/master/LICENSE for the full license text.
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@theweekendprojects/emvb-daisyui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "description": "daisyUI for EmVB: 70 components as an EmVB 1.5 extension (Extensions API 1.5)",
5
+ "license": "MIT",
6
+ "files": [
7
+ "src",
8
+ "!src/**/*.test.ts",
9
+ "README.md",
10
+ "LICENSE",
11
+ "licenses"
12
+ ],
13
+ "type": "module",
14
+ "exports": {
15
+ ".": "./src/extension/index.ts",
16
+ "./extension": "./src/extension/index.ts"
17
+ },
18
+ "scripts": {
19
+ "generate": "bun src/generator/cli.ts",
20
+ "classes:write": "bun src/generator/write-class-names.ts",
21
+ "test": "bun test ./src/",
22
+ "conformance:css": "bun src/conformance/cli.ts",
23
+ "build": "bun scripts/build.ts",
24
+ "conformance:report": "bun src/conformance/report-cli.ts",
25
+ "conformance:official": "bun src/conformance/compile.ts",
26
+ "gen:classes": "bun scripts/gen-extension-classes.ts",
27
+ "build:extension": "bun scripts/build-extension-assets.ts"
28
+ },
29
+ "devDependencies": {
30
+ "@perkyzz/emvb": "1.5.1",
31
+ "daisyui": "5.7.50",
32
+ "happy-dom": "21.0.4",
33
+ "tailwindcss": "4.1.17",
34
+ "zod": "4.6.7"
35
+ },
36
+ "peerDependencies": {
37
+ "@perkyzz/emvb": ">=1.5.1 <2"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/theweekendprojects/emvb-daisyui.git"
42
+ },
43
+ "homepage": "https://github.com/theweekendprojects/emvb-daisyui#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/theweekendprojects/emvb-daisyui/issues"
46
+ },
47
+ "keywords": [
48
+ "emvb",
49
+ "emdash",
50
+ "daisyui",
51
+ "extension",
52
+ "page-builder"
53
+ ],
54
+ "publishConfig": {
55
+ "access": "public"
56
+ }
57
+ }
@@ -0,0 +1,407 @@
1
+ import { safeHref } from "../render/href.ts";
2
+ import type { DaisyComponentDefinition, DaisyVNode } from "../types.ts";
3
+
4
+ const tones = [
5
+ "neutral",
6
+ "primary",
7
+ "secondary",
8
+ "accent",
9
+ "info",
10
+ "success",
11
+ "warning",
12
+ "error",
13
+ ] as const;
14
+ const toneMap = (prefix: string) =>
15
+ Object.fromEntries(tones.map((tone) => [tone, `${prefix}-${tone}`]));
16
+ const sizes = ["xs", "sm", "md", "lg", "xl"] as const;
17
+ const sizeMap = (prefix: string) =>
18
+ Object.fromEntries(sizes.map((size) => [size, `${prefix}-${size}`]));
19
+
20
+ export const BUTTON: DaisyComponentDefinition = {
21
+ id: "button",
22
+ label: "Button",
23
+ category: "Actions",
24
+ tag: "button",
25
+ rootClass: "btn",
26
+ fields: [
27
+ { key: "label", label: "Label", kind: "text", default: "Button", textContent: true },
28
+ {
29
+ key: "tone",
30
+ label: "Color",
31
+ kind: "select",
32
+ default: "primary",
33
+ options: tones,
34
+ classMap: toneMap("btn"),
35
+ },
36
+ {
37
+ key: "variant",
38
+ label: "Variant",
39
+ kind: "select",
40
+ default: "solid",
41
+ options: ["solid", "outline", "dash", "soft", "ghost", "link"],
42
+ classMap: {
43
+ solid: "",
44
+ outline: "btn-outline",
45
+ dash: "btn-dash",
46
+ soft: "btn-soft",
47
+ ghost: "btn-ghost",
48
+ link: "btn-link",
49
+ },
50
+ },
51
+ {
52
+ key: "size",
53
+ label: "Size",
54
+ kind: "select",
55
+ default: "md",
56
+ options: sizes,
57
+ classMap: sizeMap("btn"),
58
+ },
59
+ {
60
+ key: "shape",
61
+ label: "Shape",
62
+ kind: "select",
63
+ default: "default",
64
+ options: ["default", "wide", "block", "square", "circle"],
65
+ optionLabels: {
66
+ default: "Natural width",
67
+ wide: "Wide",
68
+ block: "Full width",
69
+ square: "Square",
70
+ circle: "Circle",
71
+ },
72
+ classMap: {
73
+ default: "",
74
+ wide: "btn-wide",
75
+ block: "btn-block",
76
+ square: "btn-square",
77
+ circle: "btn-circle",
78
+ },
79
+ },
80
+ {
81
+ key: "active",
82
+ label: "Active",
83
+ kind: "boolean",
84
+ default: false,
85
+ classMap: { true: "btn-active", false: "" },
86
+ },
87
+ {
88
+ key: "disabled",
89
+ label: "Disabled",
90
+ kind: "boolean",
91
+ default: false,
92
+ attribute: "aria-disabled",
93
+ },
94
+ ],
95
+ };
96
+
97
+ export const BADGE: DaisyComponentDefinition = {
98
+ id: "badge",
99
+ label: "Badge",
100
+ category: "Data display",
101
+ tag: "span",
102
+ rootClass: "badge",
103
+ fields: [
104
+ { key: "label", label: "Label", kind: "text", default: "Badge", textContent: true },
105
+ {
106
+ key: "tone",
107
+ label: "Color",
108
+ kind: "select",
109
+ default: "neutral",
110
+ options: tones,
111
+ classMap: toneMap("badge"),
112
+ },
113
+ {
114
+ key: "variant",
115
+ label: "Variant",
116
+ kind: "select",
117
+ default: "solid",
118
+ options: ["solid", "outline", "dash", "soft", "ghost"],
119
+ classMap: {
120
+ solid: "",
121
+ outline: "badge-outline",
122
+ dash: "badge-dash",
123
+ soft: "badge-soft",
124
+ ghost: "badge-ghost",
125
+ },
126
+ },
127
+ {
128
+ key: "size",
129
+ label: "Size",
130
+ kind: "select",
131
+ default: "md",
132
+ options: sizes,
133
+ classMap: sizeMap("badge"),
134
+ },
135
+ ],
136
+ build(node, classes) {
137
+ // The neutral colour is a dark fill: as a fill it is right, as the text of an outline, dash or
138
+ // soft badge it disappears on a dark page. Those badges take the theme's text colour instead.
139
+ const hollow = node.props.tone === "neutral" && node.props.variant !== "solid";
140
+ const kept = hollow
141
+ ? classes.map((c) => (c === "badge-neutral" ? "text-base-content" : c))
142
+ : classes;
143
+ return {
144
+ tag: "span",
145
+ attrs: { class: kept.join(" ") },
146
+ children: [String(node.props.label)],
147
+ };
148
+ },
149
+ };
150
+
151
+ export const ALERT: DaisyComponentDefinition = {
152
+ id: "alert",
153
+ label: "Alert",
154
+ category: "Feedback",
155
+ tag: "div",
156
+ rootClass: "alert",
157
+ role: "alert",
158
+ fields: [
159
+ {
160
+ key: "message",
161
+ label: "Message",
162
+ kind: "textarea",
163
+ default: "Your message goes here.",
164
+ textContent: true,
165
+ },
166
+ {
167
+ key: "tone",
168
+ label: "Status",
169
+ kind: "select",
170
+ default: "info",
171
+ options: ["info", "success", "warning", "error"],
172
+ classMap: {
173
+ info: "alert-info",
174
+ success: "alert-success",
175
+ warning: "alert-warning",
176
+ error: "alert-error",
177
+ },
178
+ },
179
+ {
180
+ key: "variant",
181
+ label: "Variant",
182
+ kind: "select",
183
+ default: "soft",
184
+ options: ["solid", "outline", "dash", "soft"],
185
+ classMap: { solid: "", outline: "alert-outline", dash: "alert-dash", soft: "alert-soft" },
186
+ },
187
+ {
188
+ key: "direction",
189
+ label: "Layout",
190
+ kind: "select",
191
+ default: "horizontal",
192
+ options: ["horizontal", "vertical"],
193
+ optionLabels: { horizontal: "Icon beside the text", vertical: "Icon above the text" },
194
+ classMap: { horizontal: "alert-horizontal", vertical: "alert-vertical" },
195
+ },
196
+ ],
197
+ };
198
+
199
+ export const CARD: DaisyComponentDefinition = {
200
+ id: "card",
201
+ label: "Card",
202
+ category: "Layout",
203
+ tag: "article",
204
+ rootClass: "card",
205
+ container: true,
206
+ fields: [
207
+ { key: "title", label: "Title", kind: "text", default: "Card title" },
208
+ {
209
+ key: "body",
210
+ label: "Body",
211
+ kind: "textarea",
212
+ default: "Add supporting content to this card.",
213
+ },
214
+ {
215
+ key: "bordered",
216
+ label: "Border",
217
+ kind: "boolean",
218
+ // Off by default, as daisyUI's own card is; a border is a choice the owner makes.
219
+ default: false,
220
+ classMap: { true: "card-border", false: "" },
221
+ },
222
+ {
223
+ key: "dash",
224
+ label: "Dashed border",
225
+ kind: "boolean",
226
+ default: false,
227
+ classMap: { true: "card-dash", false: "" },
228
+ },
229
+ {
230
+ key: "side",
231
+ label: "Image beside the text",
232
+ kind: "boolean",
233
+ default: false,
234
+ classMap: { true: "card-side", false: "" },
235
+ },
236
+ {
237
+ key: "image",
238
+ label: "Image",
239
+ kind: "media",
240
+ default: "",
241
+ },
242
+ {
243
+ key: "imageFull",
244
+ label: "Image behind the text",
245
+ kind: "boolean",
246
+ default: false,
247
+ classMap: { true: "image-full", false: "" },
248
+ },
249
+ {
250
+ key: "size",
251
+ label: "Size",
252
+ kind: "select",
253
+ default: "md",
254
+ options: sizes,
255
+ classMap: sizeMap("card"),
256
+ },
257
+ // Stretch fills the card's width (the default). Start and center keep a button at its natural width.
258
+ {
259
+ key: "align",
260
+ label: "Content width",
261
+ kind: "select",
262
+ default: "stretch",
263
+ options: ["stretch", "start", "center"],
264
+ optionLabels: {
265
+ stretch: "Full width",
266
+ start: "Left, natural width",
267
+ center: "Centred, natural width",
268
+ },
269
+ },
270
+ ],
271
+ build(node, classes, children) {
272
+ const content: DaisyVNode[] = [
273
+ { tag: "h2", attrs: { class: "card-title" }, children: [String(node.props.title)] },
274
+ { tag: "p", attrs: {}, children: [String(node.props.body)] },
275
+ ...children,
276
+ ];
277
+ const start =
278
+ node.props.align === "start"
279
+ ? " items-start"
280
+ : node.props.align === "center"
281
+ ? " items-center text-center"
282
+ : "";
283
+ // The picture is decorative here: the card's title names it.
284
+ // An unsafe or empty URL drops the picture, so no javascript: value reaches src.
285
+ const imageUrl = safeHref(node.props.image) === "#" ? "" : String(node.props.image);
286
+ const figure: DaisyVNode[] = imageUrl
287
+ ? [
288
+ {
289
+ tag: "figure",
290
+ attrs: {},
291
+ children: [
292
+ {
293
+ tag: "img",
294
+ // A photo keeps a fixed banner height in the card, so a large file cannot fill the page.
295
+ attrs: {
296
+ src: imageUrl,
297
+ alt: "",
298
+ loading: "lazy",
299
+ class: "w-full h-48 object-cover",
300
+ },
301
+ children: [],
302
+ },
303
+ ],
304
+ },
305
+ ]
306
+ : [];
307
+ return {
308
+ tag: "article",
309
+ attrs: { class: classes.filter(Boolean).join(" ") },
310
+ children: [
311
+ ...figure,
312
+ { tag: "div", attrs: { class: `card-body${start}` }, children: content },
313
+ ],
314
+ };
315
+ },
316
+ };
317
+
318
+ export const PROGRESS: DaisyComponentDefinition = {
319
+ id: "progress",
320
+ label: "Progress",
321
+ category: "Data display",
322
+ tag: "div",
323
+ rootClass: "progress",
324
+ fields: [
325
+ { key: "value", label: "Value", kind: "number", default: 40 },
326
+ { key: "label", label: "Accessible label", kind: "text", default: "Progress" },
327
+ { key: "visibleLabel", label: "Visible label", kind: "text", default: "" },
328
+ { key: "max", label: "Maximum", kind: "number", default: 100 },
329
+ {
330
+ key: "tone",
331
+ label: "Color",
332
+ kind: "select",
333
+ default: "primary",
334
+ options: tones,
335
+ classMap: toneMap("progress"),
336
+ },
337
+ ],
338
+ build(node, classes) {
339
+ const value = Math.max(0, Number(node.props.value));
340
+ const max = Math.max(1, Number(node.props.max));
341
+ return {
342
+ tag: "div",
343
+ attrs: {
344
+ class: classes.join(" "),
345
+ role: "progressbar",
346
+ ...(node.props.label ? { "aria-label": String(node.props.label) } : {}),
347
+ "aria-valuemin": "0",
348
+ "aria-valuemax": String(max),
349
+ "aria-valuenow": String(Math.min(value, max)),
350
+ },
351
+ children: node.props.visibleLabel
352
+ ? [
353
+ {
354
+ tag: "span",
355
+ attrs: { class: "progress-label" },
356
+ children: [String(node.props.visibleLabel)],
357
+ },
358
+ ]
359
+ : [],
360
+ };
361
+ },
362
+ };
363
+
364
+ export const STATS: DaisyComponentDefinition = {
365
+ id: "stats",
366
+ label: "Statistic",
367
+ category: "Data display",
368
+ tag: "div",
369
+ rootClass: "stats",
370
+ role: "group",
371
+ fields: [
372
+ { key: "title", label: "Title", kind: "text", default: "Total users" },
373
+ { key: "value", label: "Value", kind: "text", default: "31K" },
374
+ { key: "description", label: "Description", kind: "text", default: "12% increase" },
375
+ {
376
+ key: "direction",
377
+ label: "Direction",
378
+ kind: "select",
379
+ default: "horizontal",
380
+ options: ["horizontal", "vertical"],
381
+ classMap: { horizontal: "stats-horizontal", vertical: "stats-vertical" },
382
+ },
383
+ ],
384
+ build(node, classes) {
385
+ return {
386
+ tag: "div",
387
+ attrs: { class: classes.join(" "), role: "group" },
388
+ children: [
389
+ {
390
+ tag: "div",
391
+ attrs: { class: "stat" },
392
+ children: [
393
+ { tag: "div", attrs: { class: "stat-title" }, children: [String(node.props.title)] },
394
+ { tag: "div", attrs: { class: "stat-value" }, children: [String(node.props.value)] },
395
+ {
396
+ tag: "div",
397
+ attrs: { class: "stat-desc" },
398
+ children: [String(node.props.description)],
399
+ },
400
+ ],
401
+ },
402
+ ],
403
+ };
404
+ },
405
+ };
406
+
407
+ export const BASIC_DAISY_COMPONENTS = [BUTTON, BADGE, ALERT, CARD, PROGRESS, STATS] as const;