@object-ui/components 17.5.0 → 17.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +10155 -0
  2. package/README.md +20 -10
  3. package/dist/custom/button-group.d.ts +2 -2
  4. package/dist/custom/character-count.d.ts +56 -0
  5. package/dist/custom/combobox.d.ts +2 -4
  6. package/dist/custom/config-field-renderer.d.ts +1 -1
  7. package/dist/custom/config-panel-renderer.d.ts +3 -3
  8. package/dist/custom/empty.d.ts +16 -4
  9. package/dist/custom/field.d.ts +1 -1
  10. package/dist/custom/filter-builder.d.ts +448 -36
  11. package/dist/custom/fullscreen-editor.d.ts +48 -2
  12. package/dist/custom/index.d.ts +27 -28
  13. package/dist/custom/item.d.ts +2 -2
  14. package/dist/custom/kbd.d.ts +1 -1
  15. package/dist/custom/mobile-dialog-content.d.ts +22 -1
  16. package/dist/custom/navigation-overlay.d.ts +105 -0
  17. package/dist/custom/refresh-indicator.d.ts +8 -2
  18. package/dist/custom/resizable.d.ts +1 -1
  19. package/dist/custom/view-states.d.ts +74 -1
  20. package/dist/debug/index.d.ts +2 -2
  21. package/dist/hooks/related-count-store.d.ts +26 -28
  22. package/dist/index.css +174 -364
  23. package/dist/index.d.ts +21 -21
  24. package/dist/index.js +7274 -6350
  25. package/dist/index.umd.cjs +12 -13
  26. package/dist/lib/close-label.d.ts +1 -2
  27. package/dist/lib/date-fns-locale.d.ts +41 -0
  28. package/dist/lib/form-control-dom-props.d.ts +77 -0
  29. package/dist/lib/lazy-icon.d.ts +32 -1
  30. package/dist/lib/lucide-record-icon-names.d.ts +30 -0
  31. package/dist/lib/slider-thumb.d.ts +86 -0
  32. package/dist/lib/utils.d.ts +113 -0
  33. package/dist/notifications/index.d.ts +5 -5
  34. package/dist/renderers/action/action-bar.d.ts +8 -36
  35. package/dist/renderers/action/action-button.d.ts +15 -4
  36. package/dist/renderers/action/action-group.d.ts +5 -4
  37. package/dist/renderers/action/action-icon.d.ts +12 -2
  38. package/dist/renderers/action/action-menu.d.ts +5 -2
  39. package/dist/renderers/action/auto-trigger.d.ts +19 -4
  40. package/dist/renderers/action/resolve-icon.d.ts +27 -2
  41. package/dist/renderers/action/static-params.d.ts +79 -0
  42. package/dist/renderers/action/visibility-gate.d.ts +11 -3
  43. package/dist/renderers/basic/elements.d.ts +6 -3
  44. package/dist/renderers/basic/html-elements.d.ts +8 -4
  45. package/dist/renderers/basic/readProps.d.ts +60 -0
  46. package/dist/renderers/complex/data-table.d.ts +31 -14
  47. package/dist/renderers/complex/dataTableBindDiagnostic.d.ts +187 -0
  48. package/dist/renderers/form/validationRuleKeys.d.ts +45 -0
  49. package/dist/renderers/layout/box.d.ts +8 -0
  50. package/dist/renderers/layout/containers.d.ts +1 -10
  51. package/dist/renderers/layout/react-page.d.ts +16 -2
  52. package/dist/renderers/navigation/sidebar.d.ts +31 -0
  53. package/dist/share/index.d.ts +2 -2
  54. package/dist/ui/badge.d.ts +1 -1
  55. package/dist/ui/button.d.ts +1 -1
  56. package/dist/ui/calendar.d.ts +3 -2
  57. package/dist/ui/carousel.d.ts +2 -2
  58. package/dist/ui/command.d.ts +8 -8
  59. package/dist/ui/form.d.ts +1 -1
  60. package/dist/ui/index.d.ts +46 -47
  61. package/dist/ui/input-otp.d.ts +2 -2
  62. package/dist/ui/pagination.d.ts +1 -1
  63. package/dist/ui/sheet.d.ts +1 -1
  64. package/dist/ui/sidebar.d.ts +4 -3
  65. package/dist/ui/slider.d.ts +2 -1
  66. package/package.json +17 -18
  67. package/dist/SchemaRenderer.d.ts +0 -4
  68. package/dist/custom/action-param-dialog.d.ts +0 -21
  69. package/dist/custom/export-progress-dialog.d.ts +0 -43
  70. package/dist/hooks/use-export-job.d.ts +0 -34
  71. package/dist/renderers/data-display/table.d.ts +0 -2
  72. package/dist/ui/chart.d.ts +0 -56
  73. package/dist/ui/toast.d.ts +0 -22
package/README.md CHANGED
@@ -70,27 +70,32 @@ entry goes on generating the classes your own source uses, as it always did.
70
70
  ### 2. Register Components
71
71
 
72
72
  ```tsx
73
- import { registerDefaultRenderers } from '@object-ui/components'
73
+ import { initializeComponents } from '@object-ui/components'
74
74
 
75
- registerDefaultRenderers()
75
+ initializeComponents()
76
76
  ```
77
77
 
78
+ Importing the package already registers its components as a side effect;
79
+ `initializeComponents()` is the explicit call for bundlers that would otherwise
80
+ tree-shake that import away.
81
+
78
82
  ## Usage
79
83
 
80
84
  ### With SchemaRenderer
81
85
 
82
86
  ```tsx
83
87
  import { SchemaRenderer } from '@object-ui/react'
84
- import { registerDefaultRenderers } from '@object-ui/components'
88
+ import { initializeComponents } from '@object-ui/components'
89
+ import type { DeclaredNode } from '@object-ui/types'
85
90
 
86
- registerDefaultRenderers()
91
+ initializeComponents()
87
92
 
88
- const schema = {
93
+ const schema: DeclaredNode = {
89
94
  type: 'card',
90
95
  title: 'Welcome',
91
- body: {
96
+ children: {
92
97
  type: 'text',
93
- value: 'Hello from Object UI!'
98
+ content: 'Hello from Object UI!'
94
99
  }
95
100
  }
96
101
 
@@ -171,6 +176,7 @@ them draw the notification's `severity` icon unless it declares an `icon`
171
176
  override naming a real Lucide icon. See the
172
177
  [notifications guide](https://objectui.org/docs/guide/notifications).
173
178
 
179
+ <!-- doc-snippet: fragment — router-layout excerpt: `Outlet` is react-router's, supplied by the host application -->
174
180
  ```tsx
175
181
  import { NotificationBanners, NotificationAlerts } from '@object-ui/components';
176
182
 
@@ -200,16 +206,20 @@ All components accept `className` for Tailwind classes:
200
206
  Register your own components:
201
207
 
202
208
  ```tsx
203
- import { registerRenderer } from '@object-ui/react'
209
+ import { ComponentRegistry } from '@object-ui/core'
204
210
  import { Button } from '@object-ui/components'
205
211
 
206
- function CustomButton(props) {
212
+ function CustomButton(props: Record<string, unknown>) {
207
213
  return <Button {...props} className="my-custom-style" />
208
214
  }
209
215
 
210
- registerRenderer('custom-button', CustomButton)
216
+ ComponentRegistry.register('custom-button', CustomButton)
211
217
  ```
212
218
 
219
+ `ComponentRegistry` is a process-level singleton exported by `@object-ui/core`;
220
+ `SchemaRenderer` resolves every `type` against it, so a component registered
221
+ here is renderable from schema anywhere in the app.
222
+
213
223
  ## API Reference
214
224
 
215
225
  See [full documentation](https://objectui.org/docs/components) for detailed API reference.
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
- import { Separator } from '../ui/separator';
2
+ import { Separator } from '../ui/separator.js';
3
3
  declare const buttonGroupVariants: (props?: ({
4
- orientation?: "horizontal" | "vertical" | null | undefined;
4
+ orientation?: "vertical" | "horizontal" | null | undefined;
5
5
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
6
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
7
7
  declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<"div"> & {
@@ -0,0 +1,56 @@
1
+ import { default as React } from 'react';
2
+ export interface CharacterCountProps {
3
+ /**
4
+ * Length of the text this surface is counting. The inline surface passes the
5
+ * committed value's length; the fullscreen dialog passes the DRAFT's, which
6
+ * is the number that is true of what the user is looking at.
7
+ */
8
+ length: number;
9
+ /**
10
+ * The declared cap. Callers render this component only when the field
11
+ * declares one, so it is non-optional here — a counter with no cap to count
12
+ * against has nothing to say and must not be mounted at all (an unconditional
13
+ * live region in every long-text field is the objectui#3408 defect back
14
+ * again).
15
+ */
16
+ maxLength: number;
17
+ /**
18
+ * The description node's `id`, minted by the host from `useId()`.
19
+ *
20
+ * The host MUST also name it in the edited control's `aria-describedby` —
21
+ * this component renders the sentence, only the host knows which element is
22
+ * being described, and a description nothing references is a node no screen
23
+ * reader will ever reach. That association is asserted from the OUTSIDE (the
24
+ * tests resolve `aria-describedby` and concatenate the referenced nodes' text,
25
+ * exactly as an assistive technology does) rather than trusted here.
26
+ *
27
+ * Two surfaces of one widget therefore need two ids: the dialog's draft and
28
+ * the inline value diverge the moment the user types in the dialog, so one
29
+ * shared id would point both controls at whichever sentence rendered last.
30
+ */
31
+ descriptionId: string;
32
+ /**
33
+ * Render node 3, the threshold-gated debounced `aria-live` status region.
34
+ *
35
+ * Required on purpose — see the component doc above. `false` removes the
36
+ * region from the DOM entirely (not merely empties it), which is the only
37
+ * form of "no live region" a test can tell apart from "a live region that
38
+ * happens to be silent right now".
39
+ */
40
+ announceNearLimit: boolean;
41
+ /**
42
+ * Classes for the visible digits. Required because placement is entirely the
43
+ * surface's business — inline pins them to the textarea's bottom-right
44
+ * corner, the dialog lays them out as a footer item — and a default borrowed
45
+ * from either one would position the other wrongly while looking deliberate.
46
+ */
47
+ className: string;
48
+ /**
49
+ * `data-testid` for the visible digits, namespaced per surface
50
+ * (`textarea-character-count`, `textarea-fullscreen-character-count`) so a
51
+ * test that finds digits can say WHICH surface it found them on. Same
52
+ * convention, same reason, as `FullscreenFieldEditor`'s `testIdPrefix`.
53
+ */
54
+ testId: string;
55
+ }
56
+ export declare function CharacterCount({ length, maxLength, descriptionId, announceNearLimit, className, testId, }: CharacterCountProps): React.JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { ComboboxOption } from '@object-ui/types/form';
1
2
  /**
2
3
  * ObjectUI
3
4
  * Copyright (c) 2024-present ObjectStack Inc.
@@ -6,10 +7,7 @@
6
7
  * LICENSE file in the root directory of this source tree.
7
8
  */
8
9
  import * as React from "react";
9
- export interface ComboboxOption {
10
- value: string;
11
- label: string;
12
- }
10
+ export type { ComboboxOption } from '@object-ui/types/form';
13
11
  /**
14
12
  * Beyond its own named props, the combobox accepts standard button attributes
15
13
  * (`id`, `aria-*`, `data-*`, handlers, …) and forwards them to the trigger —
@@ -1,4 +1,4 @@
1
- import { ConfigField } from '../types/config-panel';
1
+ import { ConfigField } from '../types/config-panel.js';
2
2
  /**
3
3
  * ObjectUI
4
4
  * Copyright (c) 2024-present ObjectStack Inc.
@@ -1,4 +1,4 @@
1
- import { ConfigPanelSchema } from '../types/config-panel';
1
+ import { ConfigPanelSchema } from '../types/config-panel.js';
2
2
  /**
3
3
  * ObjectUI
4
4
  * Copyright (c) 2024-present ObjectStack Inc.
@@ -32,9 +32,9 @@ export interface ConfigPanelRendererProps {
32
32
  className?: string;
33
33
  /** Additional inline styles applied to the panel root (e.g. to override `--config-panel-width`). */
34
34
  style?: React.CSSProperties;
35
- /** Label for save button (default: "Save") */
35
+ /** Label for save button (default: the locale pack's `common.save`) */
36
36
  saveLabel?: string;
37
- /** Label for discard button (default: "Discard") */
37
+ /** Label for discard button (default: the locale pack's `common.discard`) */
38
38
  discardLabel?: string;
39
39
  /** Ref for the panel root element */
40
40
  panelRef?: React.Ref<HTMLDivElement>;
@@ -6,15 +6,27 @@ declare const emptyMediaVariants: (props?: ({
6
6
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
7
  declare function EmptyMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>): import("react").JSX.Element;
8
8
  declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
9
- declare function EmptyDescription({ className, ...props }: React.ComponentProps<"p">): import("react").JSX.Element;
9
+ declare function EmptyDescription({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
10
10
  declare function EmptyContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
11
11
  /**
12
12
  * EmptyValue — universal inline placeholder for missing cell/field values.
13
13
  *
14
14
  * Use this anywhere a renderer would otherwise show "-" or "—" for a null,
15
- * undefined or empty value. It renders a muted, non-interactive en-dash that
16
- * does not inherit link/button colors from surrounding ancestors, so a missing
17
- * value never looks clickable.
15
+ * undefined or empty value. It renders a muted, non-interactive EM-dash (the
16
+ * `glyph` default below is U+2014, and every call site depends on that width)
17
+ * that does not inherit link/button colors from surrounding ancestors, so a
18
+ * missing value never looks clickable. This sentence said "en-dash" until
19
+ * objectui#8506: the word was wrong, never the code — do not "fix" the glyph
20
+ * to match a stale docblock.
21
+ *
22
+ * ⚠️ A caller that passes a `title` through `...props` must also pass
23
+ * `pointer-events-auto` in `className`. `pointer-events-none` below stops this
24
+ * span being a hit target, so a `title` on it never renders a tooltip — the
25
+ * hover falls through to whichever ancestor has one. The attribute stays in the
26
+ * DOM either way, which is exactly why nothing catches it: a test that reads
27
+ * `getAttribute('title')` is green over a tooltip that can never appear
28
+ * (objectui#8506, where `DetailSection` kept such a `title` and two landed pins
29
+ * navigate by it).
18
30
  */
19
31
  declare function EmptyValue({ className, glyph, ...props }: React.ComponentProps<"span"> & {
20
32
  glyph?: string;
@@ -25,7 +25,7 @@ export interface FieldProps extends React.HTMLAttributes<HTMLDivElement>, Varian
25
25
  * A labelled form-control wrapper: label, slotted control, description, error.
26
26
  *
27
27
  * Named `FieldContainer`, not `Field` (objectstack#4115): `@objectstack/spec/data`
28
- * exports `Field` — an object FIELD's metadata (type, reference_to, options,
28
+ * exports `Field` — an object FIELD's metadata (type, reference, options,
29
29
  * permissions, …) and its builder namespace — which has nothing to do with this
30
30
  * `<div>`. Two unrelated things under one name is the defect that issue exists
31
31
  * to remove; `@object-ui/app-shell` already renamed the same kind of collision