@object-ui/components 17.1.0 → 17.3.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.
@@ -0,0 +1,50 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * Translated accessible name for the close button the Shadcn `Sheet` and
10
+ * `Dialog` primitives auto-render — objectstack#5505.
11
+ *
12
+ * Those buttons are icon-only (a lucide `X`), so their `sr-only` span is not
13
+ * decoration: it IS the control's accessible name, the thing a screen reader
14
+ * announces and the thing `getByRole('button', { name })` matches. Upstream
15
+ * ships it as a hardcoded English literal, so under zh/ja/es every drawer and
16
+ * modal in the console announced "Close" in English.
17
+ *
18
+ * ## Why the implementation lives HERE and not in the primitives
19
+ *
20
+ * `packages/components/src/ui/**` is regenerated from the Shadcn registry
21
+ * (AGENTS.md Commandment #7) — anything written there is overwritten by the
22
+ * next `pnpm shadcn:update`. `src/lib/` is not part of that regeneration, so
23
+ * this file is permanent. The primitives get only a one-line
24
+ * `<CloseSrLabel />` reference, re-applied on every sync by the declared patch
25
+ * in `scripts/shadcn-local-patches.mjs`. Keeping the payload out of the
26
+ * regenerated zone is what makes the patch small enough to survive upstream
27
+ * churn: two anchored lines rather than an inlined hook.
28
+ *
29
+ * ## Why `createSafeTranslation`
30
+ *
31
+ * The no-provider path must stay English. A large number of existing unit
32
+ * tests and e2e specs address dialogs and drawers by their English accessible
33
+ * name with no `I18nProvider` mounted (e.g.
34
+ * `packages/plugin-form/src/discardGuard.test.tsx`,
35
+ * `packages/plugin-detail/src/__tests__/InlineCreateRelated.closeButtonName.test.tsx`),
36
+ * and a primitive that rendered a raw `common.close` key there would break all
37
+ * of them. `createSafeTranslation` probes its test key and falls back to the
38
+ * defaults map below when translations are not configured, so "no provider"
39
+ * resolves to "Close" rather than to a key.
40
+ */
41
+ import * as React from "react";
42
+ /**
43
+ * `sr-only` accessible name for an icon-only close control.
44
+ *
45
+ * A component rather than a helper call because it owns a hook — the
46
+ * primitives render it as `<CloseSrLabel />` inside their close button, which
47
+ * keeps the hook call legal in files whose components are expression-bodied
48
+ * `forwardRef` arrows with no statement block to put a hook in.
49
+ */
50
+ export declare function CloseSrLabel(): React.ReactElement;
@@ -1,37 +1,33 @@
1
+ import { ShareLink as SpecShareLink, ShareLinkAudience, ShareLinkPermission } from '@objectstack/spec/contracts';
1
2
  /**
2
- * ObjectUI — ShareDialog
3
- * Copyright (c) 2024-present ObjectStack Inc.
3
+ * The share-link vocabulary is the framework's, so this dialog uses the
4
+ * framework's bindings rather than the copies it used to declare
5
+ * (objectstack#4115). The two enums were member-for-member identical — the
6
+ * comment further down already said "audience values match the framework's
7
+ * `ShareLinkAudience` contract", which is a claim only an import can keep.
8
+ */
9
+ export type { ShareLinkPermission, ShareLinkAudience };
10
+ /**
11
+ * A share link as the BROWSER receives it.
4
12
  *
5
- * Platform-level share-link dialog. Mirrors the "anyone with the link"
6
- * pattern from Notion / Figma:
13
+ * The spec's `ShareLink` is the stored row; this is the same row minus the one
14
+ * field that must never cross the wire. Deriving means a new spec field is
15
+ * typed here the day it ships, while the two deltas stay visible and bounded:
7
16
  *
8
- * • Object opts in via `publicSharing.enabled` on the spec.
9
- * • Each record can mint one or more capability tokens.
10
- * • Tokens carry a permission, an audience, an optional expiry,
11
- * an optional password, and an optional email allowlist.
17
+ * - `password_hash` is omitted, not optional. It is the credential itself;
18
+ * typing it in a browser package is an invitation to render it.
19
+ * - `password_protected` is the boolean projection the UI needs in its place.
20
+ * - `created_at` is widened to `| null`, matching every other timestamp on the
21
+ * spec's own row (`expires_at`, `revoked_at`, `last_used_at`).
12
22
  *
13
- * The dialog is intentionally driven by props rather than a hook so it
14
- * can be reused from the AI page, the floating chatbot panel, record
15
- * detail views, and any other surface — all of which already know their
16
- * `apiBase`, `objectName`, and `recordId`.
23
+ * Pinned by `__tests__/share-filter-sort-spec-parity.test.ts`.
17
24
  */
18
- export type ShareLinkPermission = 'view' | 'comment' | 'edit';
19
- export type ShareLinkAudience = 'public' | 'link_only' | 'signed_in' | 'email';
20
- export interface ShareLink {
21
- id: string;
22
- token: string;
23
- object_name: string;
24
- record_id: string;
25
- permission: ShareLinkPermission;
26
- audience: ShareLinkAudience;
27
- expires_at?: string | null;
25
+ export type ShareLink = Omit<SpecShareLink, 'password_hash' | 'created_at'> & {
26
+ /** Whether a password is set — the server's stand-in for `password_hash`. */
28
27
  password_protected?: boolean;
29
- label?: string | null;
30
- revoked_at?: string | null;
28
+ /** ISO timestamp; `null` when the row predates audit stamping. */
31
29
  created_at?: string | null;
32
- last_used_at?: string | null;
33
- use_count?: number;
34
- }
30
+ };
35
31
  export interface ShareDialogProps {
36
32
  open: boolean;
37
33
  onOpenChange: (open: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/components",
3
- "version": "17.1.0",
3
+ "version": "17.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Standard UI component library for Object UI, built with Shadcn UI + Tailwind CSS",
@@ -26,6 +26,7 @@
26
26
  "./style.css": "./dist/index.css"
27
27
  },
28
28
  "dependencies": {
29
+ "@objectstack/spec": "^17.0.0-rc.2",
29
30
  "@radix-ui/react-accordion": "^1.2.20",
30
31
  "@radix-ui/react-alert-dialog": "^1.1.23",
31
32
  "@radix-ui/react-aspect-ratio": "^1.1.15",
@@ -59,7 +60,7 @@
59
60
  "date-fns": "^4.4.0",
60
61
  "embla-carousel-react": "^8.6.0",
61
62
  "input-otp": "^1.4.2",
62
- "lucide-react": "^1.25.0",
63
+ "lucide-react": "^1.28.0",
63
64
  "next-themes": "^0.4.6",
64
65
  "react-day-picker": "^10.0.1",
65
66
  "react-hook-form": "^7.83.0",
@@ -69,12 +70,12 @@
69
70
  "tailwind-merge": "^3.6.0",
70
71
  "tailwindcss-animate": "^1.0.7",
71
72
  "vaul": "^1.1.2",
72
- "@object-ui/core": "17.1.0",
73
- "@object-ui/i18n": "17.1.0",
74
- "@object-ui/react": "17.1.0",
75
- "@object-ui/react-runtime": "17.1.0",
76
- "@object-ui/sdui-parser": "17.1.0",
77
- "@object-ui/types": "17.1.0"
73
+ "@object-ui/core": "17.3.0",
74
+ "@object-ui/i18n": "17.3.0",
75
+ "@object-ui/react": "17.3.0",
76
+ "@object-ui/react-runtime": "17.3.0",
77
+ "@object-ui/sdui-parser": "17.3.0",
78
+ "@object-ui/types": "17.3.0"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "react": "^18.0.0 || ^19.0.0",
@@ -82,17 +83,17 @@
82
83
  "tailwindcss": "^4.2.1"
83
84
  },
84
85
  "devDependencies": {
85
- "@objectstack/spec": "^17.0.0-rc.0",
86
+ "@radix-ui/react-focus-scope": "^1.1.16",
86
87
  "@tailwindcss/postcss": "^4.3.3",
87
- "@types/react": "19.2.17",
88
- "@types/react-dom": "19.2.3",
89
- "@vitejs/plugin-react": "^6.0.4",
88
+ "@types/react": "19.2.18",
89
+ "@types/react-dom": "19.2.4",
90
+ "@vitejs/plugin-react": "^6.0.5",
90
91
  "autoprefixer": "^10.5.4",
91
- "postcss": "^8.5.23",
92
- "shadcn": "^4.15.0",
92
+ "postcss": "^8.5.26",
93
+ "shadcn": "^4.16.0",
93
94
  "tailwindcss": "^4.3.3",
94
95
  "typescript": "^6.0.3",
95
- "vite": "^8.1.5",
96
+ "vite": "^8.2.0",
96
97
  "vite-plugin-dts": "^5.0.3",
97
98
  "zod": "^4.4.3"
98
99
  },
@@ -123,7 +124,7 @@
123
124
  "prebuild": "pnpm --filter @object-ui/types build && pnpm --filter @object-ui/core build && pnpm --filter @object-ui/react build",
124
125
  "pretest": "pnpm run prebuild",
125
126
  "test": "vitest run",
126
- "type-check": "tsc --noEmit",
127
+ "type-check": "tsc --noEmit && tsc -p tsconfig.typetests.json",
127
128
  "lint": "eslint ."
128
129
  }
129
130
  }