@duskmoon-dev/components 0.3.3 → 0.4.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 (89) hide show
  1. package/README.md +142 -2
  2. package/dist/classes/chat.d.ts +9 -1
  3. package/dist/classes/console-page.d.ts +16 -0
  4. package/dist/classes/dropdown.d.ts +5 -5
  5. package/dist/classes/fab.d.ts +11 -0
  6. package/dist/classes/index.d.ts +5 -0
  7. package/dist/classes/index.js +180 -34
  8. package/dist/classes/megamenu.d.ts +10 -0
  9. package/dist/classes/otp-input.d.ts +12 -0
  10. package/dist/classes/popover.d.ts +1 -3
  11. package/dist/classes/swap.d.ts +12 -0
  12. package/dist/classes/tree-select.d.ts +6 -6
  13. package/dist/components/app/index.js +128 -68
  14. package/dist/components/avatar/Avatar.types.d.ts +1 -1
  15. package/dist/components/avatar/index.js +2 -1
  16. package/dist/components/badge/index.js +1 -1
  17. package/dist/components/button/Button.d.ts +1 -1
  18. package/dist/components/button/Button.types.d.ts +8 -0
  19. package/dist/components/button/index.js +253 -24
  20. package/dist/components/calendar/index.js +44 -19
  21. package/dist/components/chat/Chat.d.ts +9 -1
  22. package/dist/components/chat/Chat.types.d.ts +26 -0
  23. package/dist/components/chat/index.js +92 -3
  24. package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
  25. package/dist/components/color-picker/index.js +206 -9
  26. package/dist/components/console-page/ConsolePage.d.ts +2 -0
  27. package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
  28. package/dist/components/console-page/index.d.ts +2 -0
  29. package/dist/components/console-page/index.js +205 -0
  30. package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
  31. package/dist/components/date-picker/index.js +537 -35
  32. package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
  33. package/dist/components/dm-date-picker/index.js +545 -43
  34. package/dist/components/dm-drawer/index.js +253 -24
  35. package/dist/components/dm-layout/index.js +391 -24
  36. package/dist/components/dm-menu/index.js +380 -13
  37. package/dist/components/dm-page-header/index.js +404 -114
  38. package/dist/components/dm-pro-table/index.js +1195 -368
  39. package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
  40. package/dist/components/dm-query/index.js +943 -188
  41. package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
  42. package/dist/components/dm-search/index.js +929 -163
  43. package/dist/components/dm-table/index.js +1013 -247
  44. package/dist/components/dm-toolbar/index.js +400 -110
  45. package/dist/components/dm-truncate/index.js +115 -35
  46. package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
  47. package/dist/components/dropdown/index.js +400 -110
  48. package/dist/components/fab/Fab.d.ts +4 -0
  49. package/dist/components/fab/Fab.types.d.ts +25 -0
  50. package/dist/components/fab/index.d.ts +2 -0
  51. package/dist/components/fab/index.js +480 -0
  52. package/dist/components/form/Form.types.d.ts +1 -0
  53. package/dist/components/form/index.js +14 -3
  54. package/dist/components/json-schema-form/JsonSchemaForm.d.ts +19 -0
  55. package/dist/components/json-schema-form/JsonSchemaWidget.d.ts +14 -0
  56. package/dist/components/json-schema-form/index.d.ts +8 -0
  57. package/dist/components/json-schema-form/index.js +7661 -0
  58. package/dist/components/json-schema-form/json-form-widgets.d.ts +26 -0
  59. package/dist/components/json-schema-form/json-schema-form.d.ts +50 -0
  60. package/dist/components/megamenu/Megamenu.d.ts +2 -0
  61. package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
  62. package/dist/components/megamenu/index.d.ts +2 -0
  63. package/dist/components/megamenu/index.js +214 -0
  64. package/dist/components/modal/index.js +128 -68
  65. package/dist/components/otp-input/OtpInput.d.ts +2 -0
  66. package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
  67. package/dist/components/otp-input/index.d.ts +2 -0
  68. package/dist/components/otp-input/index.js +112 -0
  69. package/dist/components/popconfirm/index.js +255 -26
  70. package/dist/components/popover/index.js +24 -4
  71. package/dist/components/select/index.js +12 -0
  72. package/dist/components/swap/Swap.d.ts +3 -0
  73. package/dist/components/swap/Swap.types.d.ts +22 -0
  74. package/dist/components/swap/index.d.ts +2 -0
  75. package/dist/components/swap/index.js +109 -0
  76. package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
  77. package/dist/components/time-picker/index.js +167 -29
  78. package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
  79. package/dist/components/tooltip/index.js +107 -27
  80. package/dist/components/tour/index.js +253 -24
  81. package/dist/components/tree-select/index.js +8 -8
  82. package/dist/components/upload/Upload.types.d.ts +1 -0
  83. package/dist/components/upload/index.js +2 -0
  84. package/dist/generated/version.d.ts +1 -1
  85. package/dist/index.d.ts +5 -0
  86. package/dist/index.js +3343 -1633
  87. package/dist/infrastructure.js +1 -1
  88. package/dist/styles.css +1359 -865
  89. package/package.json +31 -5
package/README.md CHANGED
@@ -41,8 +41,8 @@ import { Button, DmTable, theme } from "@duskmoon-dev/components";
41
41
 
42
42
  ## Public Surface
43
43
 
44
- - 73 standard components such as `Button`, `Chat`, `Table`, `Modal`, `Select`,
45
- and `Typography`.
44
+ - 79 standard components such as `Button`, `Chat`, `OtpInput`, `Swap`, `Fab`,
45
+ `Megamenu`, `ConsolePage`, `Table`, `Modal`, `Select`, and `Typography`.
46
46
  - 21 DuskMoon workflow components such as `DmLayout`, `DmSearch`, `DmTable`,
47
47
  `DmProTable`, and `DmToolbar`.
48
48
  - 13 infrastructure exports including `theme`, `version`,
@@ -50,6 +50,69 @@ import { Button, DmTable, theme } from "@duskmoon-dev/components";
50
50
  - Component subpath exports follow `@duskmoon-dev/components/{component-id}`,
51
51
  for example `@duskmoon-dev/components/date-picker`.
52
52
 
53
+ `OtpInput` uses one native input with decorative slots. `Swap` uses a native
54
+ checkbox. `Fab`, `Megamenu`, and the mobile menu in `ConsolePage` use the
55
+ browser's Popover API for opening, Escape dismissal, and focus restoration.
56
+ These components require `@duskmoon-dev/core` 1.20.0 or newer.
57
+
58
+ `Form.Item` associates its label with a single child control, preserving an
59
+ existing child `id`. For composite controls, pass `htmlFor` with the target
60
+ control's `id`. `Badge appearance="outline"` emits both `badge-outlined` and
61
+ the supported `badge-outline` alias.
62
+
63
+ `Chat.Scroll` provides a fixed-height transcript with a sticky reply rail.
64
+ Pair assistant rows and indicator buttons with timeline slots 1–24; user rows
65
+ do not need ticks. `Chat.Status` and `Chat.Actions` accept ordinary content and
66
+ button callbacks, so the application owns generation state and metrics. The
67
+ Chat docs show all ten Core 1.20.3 showcases, including RTL bubbles, live states,
68
+ tool statuses, and message actions. For an LLM reply, place reasoning and tool
69
+ details inside one `Chat.Bubble`, with final content in
70
+ `.chat-bubble-content`. The new Chat styles and the `Avatar` `2xl` size require
71
+ Core 1.20.3 or newer.
72
+
73
+ ```tsx
74
+ import { Chat } from "@duskmoon-dev/components/chat";
75
+ import { useId } from "react";
76
+
77
+ export function Conversation() {
78
+ const replyId = useId();
79
+ async function copyReply() {
80
+ await navigator.clipboard.writeText("The build passed.");
81
+ }
82
+
83
+ return (
84
+ <Chat.Scroll style={{ height: 320 }} aria-label="Conversation">
85
+ <Chat.ScrollTrack aria-label="Assistant replies">
86
+ <Chat.ScrollIndicator timeline={1} targetId={replyId} />
87
+ </Chat.ScrollTrack>
88
+ <Chat.ScrollBody>
89
+ <Chat id={replyId} timeline={1}>
90
+ <Chat.Bubble>The build passed.</Chat.Bubble>
91
+ <Chat.Status>
92
+ <Chat.StatusItem>Completed</Chat.StatusItem>
93
+ <Chat.StatusItem>
94
+ <Chat.StatusValue>42</Chat.StatusValue> token/s
95
+ </Chat.StatusItem>
96
+ </Chat.Status>
97
+ <Chat.Actions hover>
98
+ <button type="button" onClick={copyReply}>
99
+ Copy reply
100
+ </button>
101
+ </Chat.Actions>
102
+ </Chat>
103
+ </Chat.ScrollBody>
104
+ </Chat.Scroll>
105
+ );
106
+ }
107
+ ```
108
+
109
+ `Modal` requires a modern browser with native `<dialog>` support. It opens and
110
+ closes through `showModal()` and `close()`, while its forwarded ref and div props
111
+ remain on the inner modal box. Controlled callers must update `open` in
112
+ `onCancel`; `maskClassName` is applied to the dialog for `::backdrop` styling.
113
+ The static `Modal.confirm`, `info`, `success`, `error`, and `warning` handles
114
+ remain exported but do not render a service surface yet.
115
+
53
116
  ## Development
54
117
 
55
118
  ```bash
@@ -65,3 +128,80 @@ bun run typecheck
65
128
  # Check parity manifest coverage
66
129
  bun run parity:components
67
130
  ```
131
+
132
+ ## JSON Schema forms
133
+
134
+ `@duskmoon-dev/components/json-schema-form` exports `JsonSchemaForm`,
135
+ `compileForm`, `JsonSchemaWidget`, and the `RenderableSchema`, `CompiledForm`,
136
+ `FormValue`, `JsonValue`, `FormErrors`, `FormValidationResult`,
137
+ `JsonSchemaFormProps`, `JsonSchemaWidgetProps`, and widget contract types.
138
+ Ajv and ajv-formats are installed as package runtime dependencies. The package
139
+ stylesheet includes the renderer layout. Import these APIs from the explicit
140
+ subpath; schema compilation is kept separate from the root component bundle.
141
+
142
+ ```tsx
143
+ import { useState } from "react";
144
+ import "@duskmoon-dev/components/styles.css";
145
+ import {
146
+ JsonSchemaForm,
147
+ type FormErrors,
148
+ type FormValue,
149
+ type RenderableSchema,
150
+ } from "@duskmoon-dev/components/json-schema-form";
151
+
152
+ const schema: RenderableSchema = {
153
+ type: "object",
154
+ required: ["name"],
155
+ properties: {
156
+ name: { type: "string", title: "Name", minLength: 1 },
157
+ age: { type: "integer", title: "Age", minimum: 0 },
158
+ },
159
+ };
160
+
161
+ export function ProfileIsland({ send }: { send: (value: FormValue) => void }) {
162
+ const [value, setValue] = useState<FormValue>({ name: "Ada" });
163
+ const [errors, setErrors] = useState<FormErrors>({});
164
+ return (
165
+ <JsonSchemaForm
166
+ schema={schema}
167
+ value={value}
168
+ onChange={setValue}
169
+ errors={errors}
170
+ onErrorsChange={setErrors}
171
+ onSubmit={send}
172
+ />
173
+ );
174
+ }
175
+ ```
176
+
177
+ Mount the React root inside a LiveView element with a stable `id` and
178
+ `phx-update="ignore"`. Parse the backend's schema JSON and call `compileForm`
179
+ when accepting untrusted input; catch compilation errors before rendering.
180
+ Pass the returned object as `compiled` instead of `schema` to compile once.
181
+ Send the validated object from `onSubmit` through the island's LiveView hook;
182
+ backend validation is still required. Use a new React `key` when replacing a
183
+ schema and starting a fresh form.
184
+
185
+ `value` and `onChange` control values. Omit `value` for internal state, optionally
186
+ seeded by `defaultValue`. Reset restores `defaultValue` or schema defaults,
187
+ notifies `onChange`, clears validation errors, and calls `onReset`. Backend
188
+ `errors` merge with local errors and use escaped JSON Pointer keys such as
189
+ `/address/email` (the empty key denotes a form error). Clear backend errors in
190
+ `onErrorsChange`, which receives an empty object on edits/reset and validation
191
+ errors on submission. `onSubmit` runs only for valid values and receives a
192
+ copied JSON object with numbers and booleans preserved.
193
+
194
+ The supported schema is a strict JSON Schema draft 2020-12 subset: object roots,
195
+ nested objects, homogeneous arrays, primitive fields/enums/defaults, required
196
+ fields, `additionalProperties: false`, string constraints/formats, numeric
197
+ constraints, and array/object size constraints. References, combinators,
198
+ nullable types, and arbitrary keywords are rejected. Validation does not coerce,
199
+ remove, or default submitted values.
200
+
201
+ Use `x-widget` for explicit component selection, `x-options` for typed option
202
+ labels/hierarchies, and `x-widget-options` for orientation, length, count,
203
+ allowHalf, min, max, and step where supported. `widgetNames`, `WidgetName`,
204
+ `WidgetOption`, `WidgetConfig`, and `OrientationWidgetConfig` expose this
205
+ contract; `compileForm` checks widget/type/config compatibility. Upload widgets
206
+ submit JSON file metadata (`name`, `size`, `type`, `lastModified`), with file
207
+ transfer owned by the application.
@@ -4,6 +4,15 @@ export declare const chatAvatarClass = "chat-avatar";
4
4
  export declare const chatHeaderClass = "chat-header";
5
5
  export declare const chatBubbleBaseClass = "chat-bubble";
6
6
  export declare const chatFooterClass = "chat-footer";
7
+ export declare const chatStatusClass = "chat-status";
8
+ export declare const chatStatusItemClass = "chat-status-item";
9
+ export declare const chatStatusValueClass = "chat-status-value";
10
+ export declare const chatActionsClass = "chat-actions";
11
+ export declare const chatActionsHoverClass = "chat-actions-hover";
12
+ export declare const chatScrollClass = "chat-scroll";
13
+ export declare const chatScrollBodyClass = "chat-scroll-body";
14
+ export declare const chatScrollTrackClass = "chat-scroll-track";
15
+ export declare const chatScrollIndicatorClass = "chat-scroll-indicator";
7
16
  export declare const chatReasoningClass = "chat-reasoning";
8
17
  export declare const chatToolBaseClass = "chat-tool";
9
18
  export declare const chatToolHeaderClass = "chat-tool-header";
@@ -11,7 +20,6 @@ export declare const chatToolStatusClass = "chat-tool-status";
11
20
  export declare const chatToolCallClass = "chat-tool-call";
12
21
  export declare const chatToolResultClass = "chat-tool-result";
13
22
  export declare const chatTypingClass = "chat-typing";
14
- export declare const chatStreamingCaretClass = "chat-streaming-caret";
15
23
  export declare const chatBubbleFilledClass = "chat-bubble-filled";
16
24
  export declare const chatBubbleStreamingClass = "chat-bubble-streaming";
17
25
  export declare const chatPlacementClasses: Record<ChatPlacement, string>;
@@ -0,0 +1,16 @@
1
+ export type ConsolePageSidebarState = "expanded" | "compact" | "hidden";
2
+ export declare const consolePageFrameClass = "console-page-frame";
3
+ export declare const consolePageAppbarClass = "console-page-appbar";
4
+ export declare const consolePageSidebarClass = "console-page-sidebar";
5
+ export declare const consolePageSidebarHeaderClass = "console-page-sidebar-header";
6
+ export declare const consolePageSidebarBodyClass = "console-page-sidebar-body";
7
+ export declare const consolePageSidebarFooterClass = "console-page-sidebar-footer";
8
+ export declare const consolePageMainClass = "console-page-main";
9
+ export declare const consolePageNavLabelClass = "console-page-nav-label";
10
+ export declare const consolePageSidebarToggleClass = "console-page-sidebar-toggle";
11
+ export declare const consolePageMenuTriggerClass = "console-page-menu-trigger";
12
+ export declare const consolePageMobileMenuClass = "console-page-mobile-menu";
13
+ export declare function getConsolePageClasses({ sidebarState, className, }: {
14
+ sidebarState?: ConsolePageSidebarState;
15
+ className?: string;
16
+ }): string;
@@ -1,12 +1,12 @@
1
1
  import type { DropdownPlacement } from "../components/dropdown/Dropdown.types";
2
- export declare const dropdownWrapperClass = "dropdown-wrapper";
3
- export declare const dropdownBaseClass = "popover dropdown";
4
- export declare const dropdownOpenClass = "popover-show dropdown-open";
5
- export declare const dropdownArrowClass = "popover-arrow dropdown-arrow";
2
+ export declare const dropdownWrapperClass = "dropdown";
3
+ export declare const dropdownBaseClass = "dropdown-content";
4
+ export declare const dropdownOpenClass = "";
5
+ export declare const dropdownArrowClass = "dropdown-arrow";
6
6
  export declare const dropdownMenuClass = "menu dropdown-menu";
7
7
  export declare const dropdownButtonClass = "dropdown-button";
8
8
  export declare const dropdownPlacementClasses: Record<DropdownPlacement, string>;
9
- export declare function getDropdownClasses({ placement, open, arrow, className, }: {
9
+ export declare function getDropdownClasses({ className, }: {
10
10
  placement?: DropdownPlacement;
11
11
  open?: boolean;
12
12
  arrow?: boolean;
@@ -0,0 +1,11 @@
1
+ export declare const fabClass = "fab";
2
+ export declare const fabTriggerClass = "fab-trigger";
3
+ export declare const fabActionsClass = "fab-actions";
4
+ export declare const fabActionClass = "fab-action";
5
+ export declare const fabLabelClass = "fab-label";
6
+ export declare function getFabClasses({ contained, start, speedDial, className, }: {
7
+ contained?: boolean;
8
+ start?: boolean;
9
+ speedDial?: boolean;
10
+ className?: string;
11
+ }): string;
@@ -11,6 +11,7 @@ export * from "./button";
11
11
  export * from "./calendar";
12
12
  export * from "./card";
13
13
  export * from "./chat";
14
+ export * from "./console-page";
14
15
  export * from "./carousel";
15
16
  export * from "./cascader";
16
17
  export * from "./checkbox";
@@ -47,6 +48,7 @@ export * from "./dropdown";
47
48
  export * from "./empty";
48
49
  export * from "./flex";
49
50
  export * from "./float-button";
51
+ export * from "./fab";
50
52
  export * from "./form";
51
53
  export * from "./grid";
52
54
  export * from "./image";
@@ -56,9 +58,11 @@ export * from "./layout";
56
58
  export * from "./list";
57
59
  export * from "./mentions";
58
60
  export * from "./menu";
61
+ export * from "./megamenu";
59
62
  export * from "./message";
60
63
  export * from "./modal";
61
64
  export * from "./notification";
65
+ export * from "./otp-input";
62
66
  export * from "./pagination";
63
67
  export * from "./popover";
64
68
  export * from "./popconfirm";
@@ -78,6 +82,7 @@ export * from "./splitter";
78
82
  export * from "./statistic";
79
83
  export * from "./steps";
80
84
  export * from "./switch";
85
+ export * from "./swap";
81
86
  export * from "./tabs";
82
87
  export * from "./tag";
83
88
  export * from "./table";