@arbidocs/react 0.5.143 → 0.5.145
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.
- package/dist/chat/ConversationScope.js +5 -2
- package/dist/chat/ConversationScope.js.map +2 -2
- package/dist/{chunk-4NGWDVHD.cjs → chunk-B6T54X65.cjs} +6 -3
- package/dist/chunk-B6T54X65.cjs.map +1 -0
- package/dist/entities/SharingEntity.js +4 -1
- package/dist/entities/SharingEntity.js.map +2 -2
- package/dist/index.cjs +222 -218
- package/dist/index.cjs.map +1 -1
- package/dist/offline.js +2 -1
- package/dist/offline.js.map +2 -2
- package/dist/ui/index.cjs +151 -151
- package/package.json +3 -3
- package/dist/chunk-4NGWDVHD.cjs.map +0 -1
|
@@ -26,6 +26,7 @@ function SharingEntity({
|
|
|
26
26
|
const [open, setOpen] = useState(false);
|
|
27
27
|
const lastPointer = useRef("mouse");
|
|
28
28
|
const canToggle = !!onToggle && !disabled;
|
|
29
|
+
const blocked = !!onToggle && disabled;
|
|
29
30
|
const label = shared ? SHARING_LABELS.workspace : SHARING_LABELS.onlyMe;
|
|
30
31
|
const hint = disabled ? disabledTooltip : shared ? tooltipActive : tooltipInactive;
|
|
31
32
|
const handleClick = (e) => {
|
|
@@ -51,7 +52,8 @@ function SharingEntity({
|
|
|
51
52
|
"data-testid": testId
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
|
-
if (!shared)
|
|
55
|
+
if (!shared)
|
|
56
|
+
return blocked ? /* @__PURE__ */ jsx("span", { className: "inline-flex", "aria-disabled": "true", children: pill }) : pill;
|
|
55
57
|
return /* @__PURE__ */ jsxs(HoverCard, { open, onOpenChange: setOpen, openDelay: 200, closeDelay: 100, children: [
|
|
56
58
|
/* @__PURE__ */ jsx(
|
|
57
59
|
HoverCardTrigger,
|
|
@@ -66,6 +68,7 @@ function SharingEntity({
|
|
|
66
68
|
className: "inline-flex",
|
|
67
69
|
role: "group",
|
|
68
70
|
"aria-label": `${SHARING_LABELS.workspace}: shared with all workspace members`,
|
|
71
|
+
"aria-disabled": blocked || void 0,
|
|
69
72
|
children: pill
|
|
70
73
|
}
|
|
71
74
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/entities/SharingEntity.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * SharingEntity\n *\n * The entity pill of who can see an item: \"Only me\" (one person) or \"Workspace\" (several people).\n * It is the one pill every sharing indicator uses, in two variants: `full` (icon + label) and `icon`\n * (the glyph alone, for a narrow cell or a header; the label stays as its accessible name).\n *\n * The \"Workspace\" pill owns its hover: a card (opened by hover, keyboard focus, or a tap on a touch\n * screen) with `members`, the workspace's member list. `members` is only mounted while the card is\n * open, so a data-reading list costs nothing until someone looks. \"Only me\" has no card.\n *\n * With `onToggle` a click flips the visibility (a tap on a touch screen opens the card instead, so\n * a stray tap never changes who can see an item) and the pill is a toggle button, `aria-pressed`\n * while shared; without, the pill is a plain indicator. A click never reaches a parent's handler\n * (a row or card selection)
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * SharingEntity\n *\n * The entity pill of who can see an item: \"Only me\" (one person) or \"Workspace\" (several people).\n * It is the one pill every sharing indicator uses, in two variants: `full` (icon + label) and `icon`\n * (the glyph alone, for a narrow cell or a header; the label stays as its accessible name).\n *\n * The \"Workspace\" pill owns its hover: a card (opened by hover, keyboard focus, or a tap on a touch\n * screen) with `members`, the workspace's member list. `members` is only mounted while the card is\n * open, so a data-reading list costs nothing until someone looks. \"Only me\" has no card.\n *\n * With `onToggle` a click flips the visibility (a tap on a touch screen opens the card instead, so\n * a stray tap never changes who can see an item) and the pill is a toggle button, `aria-pressed`\n * while shared; without, the pill is a plain indicator. A click never reaches a parent's handler\n * (a row or card selection). A toggle that is `disabled` is marked `aria-disabled`.\n */\n\nimport { useRef, useState, type MouseEvent, type PointerEvent, type ReactNode } from 'react'\nimport { User, Users } from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card'\nimport { EntityPill } from './EntityPill'\n\nlet sharedMembers: ReactNode = null\n\n/**\n * Where every `SharingEntity` finds the member list of its card (the entity registry's seam: the\n * connected layer, which can read the workspace's members, registers it once; panels that portal\n * outside any one subtree still get it).\n */\nexport function configureSharingMembers(members: ReactNode): void {\n sharedMembers = members\n}\n\nexport const SHARING_LABELS = { onlyMe: 'Only me', workspace: 'Workspace' } as const\n\nexport interface SharingEntityProps {\n shared: boolean\n /** `full` (default) icon + label; `icon` the glyph alone. */\n variant?: 'full' | 'icon'\n size?: 'sm' | 'md'\n /** Called with true to share, false to make private. Omit for an indicator that is not clickable. */\n onToggle?: (shouldShare: boolean) => void\n disabled?: boolean\n /** Why the visibility cannot be changed (a line in the card, or the tooltip). */\n disabledTooltip?: string\n /** What a click does while shared / private. */\n tooltipActive?: string\n tooltipInactive?: string\n /** The member list of the Workspace card (default: the registered one, `configureSharingMembers`); mounted only while the card is open. */\n members?: ReactNode\n className?: string\n 'data-testid'?: string\n}\n\nexport function SharingEntity({\n shared,\n variant = 'full',\n size = 'sm',\n onToggle,\n disabled = false,\n disabledTooltip,\n tooltipActive,\n tooltipInactive,\n members: membersProp,\n className,\n 'data-testid': testId,\n}: SharingEntityProps) {\n const members = membersProp ?? sharedMembers\n const [open, setOpen] = useState(false)\n const lastPointer = useRef<string>('mouse')\n const canToggle = !!onToggle && !disabled\n // A toggle that cannot toggle now (not the creator's, or a change in flight) says so: a click on it\n // does nothing. aria-disabled, not `disabled`: the pill still shows its tooltip and member card.\n const blocked = !!onToggle && disabled\n const label = shared ? SHARING_LABELS.workspace : SHARING_LABELS.onlyMe\n const hint = disabled ? disabledTooltip : shared ? tooltipActive : tooltipInactive\n\n const handleClick = (e: MouseEvent) => {\n e.stopPropagation()\n // A touch screen has no hover: a tap on a Workspace pill shows who is in it (and never flips it).\n if (shared && lastPointer.current === 'touch') {\n setOpen(true)\n return\n }\n if (canToggle) onToggle(!shared)\n }\n\n const pill = (\n <EntityPill\n shape=\"pill\"\n size={size}\n icon={\n shared ? (\n <Users className=\"size-3.5 shrink-0 text-primary\" aria-hidden />\n ) : (\n <User className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n )\n }\n label={label}\n labelClassName={cn(variant === 'icon' && 'sr-only', !shared && 'text-muted-foreground')}\n className={cn(shared && 'text-primary', className)}\n onClick={handleClick}\n pressed={onToggle ? shared : undefined}\n tooltipContent={!shared && hint ? hint : undefined}\n data-testid={testId}\n />\n )\n\n if (!shared)\n return blocked ? (\n <span className=\"inline-flex\" aria-disabled=\"true\">\n {pill}\n </span>\n ) : (\n pill\n )\n\n return (\n <HoverCard open={open} onOpenChange={setOpen} openDelay={200} closeDelay={100}>\n <HoverCardTrigger\n asChild\n onPointerDown={(e: PointerEvent) => {\n lastPointer.current = e.pointerType\n }}\n >\n <span\n className=\"inline-flex\"\n role=\"group\"\n aria-label={`${SHARING_LABELS.workspace}: shared with all workspace members`}\n aria-disabled={blocked || undefined}\n >\n {pill}\n </span>\n </HoverCardTrigger>\n {open && (\n <HoverCardContent side=\"left\" align=\"center\" className=\"w-60 space-y-2 p-3\">\n <p className=\"text-xs font-semibold\">Workspace members</p>\n {members}\n {hint && <p className=\"border-t pt-2 text-xs text-muted-foreground\">{hint}</p>}\n </HoverCardContent>\n )}\n </HoverCard>\n )\n}\n"],
|
|
5
|
+
"mappings": "AA8FU,cA0CF,YA1CE;AA7EV,SAAS,QAAQ,gBAAoE;AACrF,SAAS,MAAM,aAAa;AAC5B,SAAS,UAAU;AACnB,SAAS,WAAW,kBAAkB,wBAAwB;AAC9D,SAAS,kBAAkB;AAE3B,IAAI,gBAA2B;AAOxB,SAAS,wBAAwB,SAA0B;AAChE,kBAAgB;AAClB;AAEO,MAAM,iBAAiB,EAAE,QAAQ,WAAW,WAAW,YAAY;AAqBnE,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,UAAU;AA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