@crisp-ui-kit/crisp 0.53.5 → 0.54.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.
- package/dist/cjs/components/bulkbar/bulkbar.js +5 -1
- package/dist/cjs/components/fileupload/fileupload.js +19 -3
- package/dist/cjs/components/formfield/formfield.js +8 -1
- package/dist/cjs/components/heatmapchart/heatmapchart.js +14 -2
- package/dist/cjs/components/skiplink/index.js +17 -0
- package/dist/cjs/components/skiplink/skiplink.js +16 -0
- package/dist/cjs/components/skiplink/skiplink.recipe.js +33 -0
- package/dist/cjs/components/textlink/index.js +7 -0
- package/dist/cjs/components/textlink/textlink.js +16 -0
- package/dist/cjs/components/textlink/textlink.recipe.js +35 -0
- package/dist/cjs/components/visuallyhidden/index.js +17 -0
- package/dist/cjs/components/visuallyhidden/visuallyhidden.js +16 -0
- package/dist/cjs/components/visuallyhidden/visuallyhidden.recipe.js +20 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/product/board/board.js +11 -2
- package/dist/cjs/product/command/command.js +13 -1
- package/dist/cjs/product/flowcanvas/flowcanvas.js +9 -2
- package/dist/cjs/product/headerbar/headerbar.js +15 -0
- package/dist/cjs/product/headerbar/headerbar.recipe.js +35 -0
- package/dist/cjs/product/headerbar/index.js +17 -0
- package/dist/cjs/product/inbox/inbox.js +13 -1
- package/dist/cjs/product/onboarding/onboarding.js +22 -1
- package/dist/cjs/product/recordpage/index.js +2 -1
- package/dist/cjs/product/recordpage/recordpage.js +197 -123
- package/dist/cjs/product/recordpage/recordpage.recipe.js +5 -0
- package/dist/cjs/product/tasklist/tasklist.js +8 -1
- package/dist/esm/components/bulkbar/bulkbar.js +5 -1
- package/dist/esm/components/fileupload/fileupload.js +20 -4
- package/dist/esm/components/formfield/formfield.js +8 -1
- package/dist/esm/components/heatmapchart/heatmapchart.js +14 -2
- package/dist/esm/components/skiplink/index.js +1 -0
- package/dist/esm/components/skiplink/skiplink.js +13 -0
- package/dist/esm/components/skiplink/skiplink.recipe.js +30 -0
- package/dist/esm/components/textlink/index.js +2 -0
- package/dist/esm/components/textlink/textlink.js +13 -0
- package/dist/esm/components/textlink/textlink.recipe.js +32 -0
- package/dist/esm/components/visuallyhidden/index.js +1 -0
- package/dist/esm/components/visuallyhidden/visuallyhidden.js +13 -0
- package/dist/esm/components/visuallyhidden/visuallyhidden.recipe.js +17 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/product/board/board.js +12 -3
- package/dist/esm/product/command/command.js +14 -2
- package/dist/esm/product/flowcanvas/flowcanvas.js +9 -2
- package/dist/esm/product/headerbar/headerbar.js +12 -0
- package/dist/esm/product/headerbar/headerbar.recipe.js +32 -0
- package/dist/esm/product/headerbar/index.js +1 -0
- package/dist/esm/product/inbox/inbox.js +13 -1
- package/dist/esm/product/onboarding/onboarding.js +22 -1
- package/dist/esm/product/recordpage/index.js +1 -1
- package/dist/esm/product/recordpage/recordpage.js +197 -124
- package/dist/esm/product/recordpage/recordpage.recipe.js +5 -0
- package/dist/esm/product/tasklist/tasklist.js +8 -1
- package/dist/headerbar.css +7 -0
- package/dist/headerbar.d.ts +7 -0
- package/dist/headerbar.layered.css +9 -0
- package/dist/recordpage.css +17 -31
- package/dist/recordpage.layered.css +17 -31
- package/dist/skiplink.css +5 -0
- package/dist/skiplink.d.ts +7 -0
- package/dist/skiplink.layered.css +7 -0
- package/dist/styles.css +47 -31
- package/dist/styles.layered.css +47 -31
- package/dist/textlink.css +11 -0
- package/dist/textlink.d.ts +7 -0
- package/dist/textlink.layered.css +13 -0
- package/dist/types/components/bulkbar/bulkbar.d.ts +1 -1
- package/dist/types/components/heatmapchart/heatmapchart.d.ts +1 -1
- package/dist/types/components/skiplink/index.d.ts +1 -0
- package/dist/types/components/skiplink/skiplink.d.ts +18 -0
- package/dist/types/components/skiplink/skiplink.recipe.d.ts +3 -0
- package/dist/types/components/textlink/index.d.ts +2 -0
- package/dist/types/components/textlink/textlink.d.ts +19 -0
- package/dist/types/components/textlink/textlink.recipe.d.ts +13 -0
- package/dist/types/components/visuallyhidden/index.d.ts +1 -0
- package/dist/types/components/visuallyhidden/visuallyhidden.d.ts +15 -0
- package/dist/types/components/visuallyhidden/visuallyhidden.recipe.d.ts +3 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/product/board/board.d.ts +1 -1
- package/dist/types/product/command/command.d.ts +1 -1
- package/dist/types/product/flowcanvas/flowcanvas.d.ts +1 -1
- package/dist/types/product/headerbar/headerbar.d.ts +27 -0
- package/dist/types/product/headerbar/headerbar.recipe.d.ts +3 -0
- package/dist/types/product/headerbar/index.d.ts +1 -0
- package/dist/types/product/inbox/inbox.d.ts +1 -1
- package/dist/types/product/onboarding/onboarding.d.ts +1 -1
- package/dist/types/product/recordpage/index.d.ts +1 -1
- package/dist/types/product/recordpage/recordpage.d.ts +90 -1
- package/dist/types/product/tasklist/tasklist.d.ts +1 -1
- package/dist/visuallyhidden.css +3 -0
- package/dist/visuallyhidden.d.ts +7 -0
- package/dist/visuallyhidden.layered.css +5 -0
- package/package.json +21 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { skiplinkRecipe } from "./skiplink.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* A "skip to content" link — invisible until it is the thing with focus
|
|
5
|
+
* (a sighted mouse user never sees it), so a keyboard user's first Tab from
|
|
6
|
+
* a cold load reaches it instead of walking the whole nav first. Render it
|
|
7
|
+
* as the very first thing on the page, before the sidebar/header. See the
|
|
8
|
+
* recipe's own doc comment for why there's no Attio value behind its chrome.
|
|
9
|
+
*/
|
|
10
|
+
export function SkipLink({ href = "#main-content", children = "Skip to content", className, ...rest }) {
|
|
11
|
+
return (_jsx("a", { href: href, className: skiplinkRecipe({ className }), ...rest, children: children }));
|
|
12
|
+
}
|
|
13
|
+
SkipLink.displayName = "SkipLink";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// A "skip to content" link: invisible (the same sr-only clip
|
|
4
|
+
// VisuallyHidden uses) until it is the thing with focus, so a sighted
|
|
5
|
+
// mouse user never sees it but a keyboard user's first Tab from a cold
|
|
6
|
+
// load reaches it. No Attio screen ships one to measure -- this is
|
|
7
|
+
// boilerplate accessibility furniture, not a design value (crisp#462 GRC
|
|
8
|
+
// audit gap 2 of 4, crisp#540) -- so the un-hidden chrome reuses already-measured
|
|
9
|
+
// crisp values throughout: the `bgPopover` floating surface + its
|
|
10
|
+
// `elevation.floating` shadow (the same pairing Menu/Popover/ContextMenu/
|
|
11
|
+
// Toast use for "a surface that appears above everything else"), `radius.md`,
|
|
12
|
+
// and the canonical `:focus-visible` ring every other crisp control uses
|
|
13
|
+
// (`outline: 2px solid ${bgBrandSolid}`, 1px offset) -- no new value is
|
|
14
|
+
// introduced.
|
|
15
|
+
const config = defineRecipe({
|
|
16
|
+
name: "skiplink",
|
|
17
|
+
base: `position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; text-decoration: none;
|
|
18
|
+
font-family: ${c.font.sans}; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary};
|
|
19
|
+
|
|
20
|
+
&:focus {
|
|
21
|
+
position: fixed; top: ${c.space["3"]}; inset-inline-start: ${c.space["3"]}; z-index: 90; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal;
|
|
22
|
+
padding: ${c.space["2"]} ${c.space["3"]}; border-radius: ${c.radius.md}; background: ${c.bgPopover}; box-shadow: ${e.floating};
|
|
23
|
+
}
|
|
24
|
+
&:focus-visible { outline: 2px solid ${c.bgBrandSolid}; outline-offset: 1px; }`,
|
|
25
|
+
variants: {},
|
|
26
|
+
defaultVariants: {},
|
|
27
|
+
compoundVariants: [],
|
|
28
|
+
});
|
|
29
|
+
export const skiplinkRecipe = resolveRecipe(config);
|
|
30
|
+
export default config;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { textlinkRecipe } from "./textlink.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inline navigable text — a real `<a href>` always, the same href+onClick
|
|
5
|
+
* division `StatList` uses: `href` gives ordinary browser behaviour (new
|
|
6
|
+
* tab, copy link, hover status), an `onClick` that calls
|
|
7
|
+
* `event.preventDefault()` pairs it with client-side routing (e.g.
|
|
8
|
+
* react-router's own `Link`).
|
|
9
|
+
*/
|
|
10
|
+
export function TextLink({ tone = "muted", className, ...rest }) {
|
|
11
|
+
return _jsx("a", { className: textlinkRecipe({ tone, className }), ...rest });
|
|
12
|
+
}
|
|
13
|
+
TextLink.displayName = "TextLink";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// The one inline-navigable-text shape GRC's own screens kept hand-typing at
|
|
4
|
+
// every call site (internal/grc#110 / your-moon/crisp#529): a card's own
|
|
5
|
+
// trailing "View all →", and a muted in-context reference link that goes
|
|
6
|
+
// brand on hover. No new colour or size here — both variants read the exact
|
|
7
|
+
// tokens those call sites already used (`bgBrandSolid` reused as a text
|
|
8
|
+
// colour, the same alias GRC's own `--color-fg-brand` resolves to; `fgMuted`;
|
|
9
|
+
// the existing 12px/13px text sizes) rather than a fresh guess, and neither
|
|
10
|
+
// is measured against one specific Attio widget for the same reason
|
|
11
|
+
// StatList/HeatmapChart's own doc comments give: this exact "small trailing
|
|
12
|
+
// link" isn't a distinct Attio component to point a CDP session at, it's a
|
|
13
|
+
// reuse of already-measured type and colour values in a new arrangement.
|
|
14
|
+
const config = defineRecipe({
|
|
15
|
+
name: "textlink",
|
|
16
|
+
base: `display: inline; font-family: ${c.font.sans}; text-decoration: none; cursor: pointer;
|
|
17
|
+
&:hover { text-decoration: underline; }`,
|
|
18
|
+
variants: {
|
|
19
|
+
tone: {
|
|
20
|
+
// The bold, always-brand-coloured trailing link a Card's own `action`
|
|
21
|
+
// slot uses ("View all →", "All registers →").
|
|
22
|
+
brand: `font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: ${c.bgBrandSolid};`,
|
|
23
|
+
// A quieter in-context reference (a sample record under a finding)
|
|
24
|
+
// that only goes brand on hover.
|
|
25
|
+
muted: `font-size: ${c.text.md}; font-weight: ${c.weight.regular}; color: ${c.fgMuted}; &:hover { color: ${c.bgBrandSolid}; }`,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: { tone: "muted" },
|
|
29
|
+
compoundVariants: [],
|
|
30
|
+
});
|
|
31
|
+
export const textlinkRecipe = resolveRecipe(config);
|
|
32
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./visuallyhidden.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { visuallyhiddenRecipe } from "./visuallyhidden.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hides content visually while keeping it in the accessibility tree and
|
|
5
|
+
* the tab order — a label for an icon-only control, extra context for a
|
|
6
|
+
* screen-reader user that a sighted one gets from layout alone. Renders a
|
|
7
|
+
* `<span>`; wrap the element that needs the treatment, or read its content
|
|
8
|
+
* as a `label`/`aria-label` source in a test.
|
|
9
|
+
*/
|
|
10
|
+
export function VisuallyHidden({ className, ...rest }) {
|
|
11
|
+
return _jsx("span", { className: visuallyhiddenRecipe({ className }), ...rest });
|
|
12
|
+
}
|
|
13
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
// The standard "sr-only" clip pattern: content stays in the accessibility
|
|
3
|
+
// tree and the tab order, but occupies no visible space and is never
|
|
4
|
+
// painted. Pure CSS mechanics, not a design value -- there is nothing to
|
|
5
|
+
// measure against Attio here (crisp#462 GRC audit gap 2 of 4, crisp#540):
|
|
6
|
+
// no Attio screen ships content that is deliberately invisible-but-reachable,
|
|
7
|
+
// so this is the standard web-platform pattern, same shape `SkipLink` also
|
|
8
|
+
// starts from before it un-hides on focus.
|
|
9
|
+
const config = defineRecipe({
|
|
10
|
+
name: "visuallyhidden",
|
|
11
|
+
base: `position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;`,
|
|
12
|
+
variants: {},
|
|
13
|
+
defaultVariants: {},
|
|
14
|
+
compoundVariants: [],
|
|
15
|
+
});
|
|
16
|
+
export const visuallyhiddenRecipe = resolveRecipe(config);
|
|
17
|
+
export default config;
|
package/dist/esm/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export * from "./components/resizablepanel/index.js";
|
|
|
44
44
|
export * from "./components/segmented/index.js";
|
|
45
45
|
export * from "./components/select/index.js";
|
|
46
46
|
export * from "./components/skeleton/index.js";
|
|
47
|
+
export * from "./components/skiplink/index.js";
|
|
47
48
|
export * from "./components/slider/index.js";
|
|
48
49
|
export * from "./components/spinner/index.js";
|
|
49
50
|
export * from "./components/stagebar/index.js";
|
|
@@ -53,9 +54,11 @@ export * from "./components/table/index.js";
|
|
|
53
54
|
export * from "./components/tabletoolbar/index.js";
|
|
54
55
|
export * from "./components/tabs/index.js";
|
|
55
56
|
export * from "./components/textarea/index.js";
|
|
57
|
+
export * from "./components/textlink/index.js";
|
|
56
58
|
export * from "./components/timepicker/index.js";
|
|
57
59
|
export * from "./components/toast/index.js";
|
|
58
60
|
export * from "./components/tooltip/index.js";
|
|
61
|
+
export * from "./components/visuallyhidden/index.js";
|
|
59
62
|
export * from "./components/wheelpicker/index.js";
|
|
60
63
|
export * from "./core/index.js";
|
|
61
64
|
// product surfaces (product/) — faithful, pixel-measured rebuilds of specific
|
|
@@ -68,6 +71,7 @@ export * from "./product/board/index.js";
|
|
|
68
71
|
export * from "./product/command/index.js";
|
|
69
72
|
export * from "./product/entitycard/index.js";
|
|
70
73
|
export * from "./product/flowcanvas/index.js";
|
|
74
|
+
export * from "./product/headerbar/index.js";
|
|
71
75
|
export * from "./product/inbox/index.js";
|
|
72
76
|
export * from "./product/listpage/index.js";
|
|
73
77
|
export * from "./product/navitem/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { isRtlElement } from "../../core/index.js";
|
|
3
|
+
import { isRtlElement, useCrispMessage, useCrispMessages } from "../../core/index.js";
|
|
4
4
|
import { boardRecipe } from "./board.recipe.js";
|
|
5
5
|
/**
|
|
6
6
|
* A kanban board with native drag-and-drop between columns. Cards are
|
|
@@ -8,7 +8,16 @@ import { boardRecipe } from "./board.recipe.js";
|
|
|
8
8
|
* (the parent owns the cards, so the move is a controlled state update).
|
|
9
9
|
* Measured from a deals pipeline.
|
|
10
10
|
*/
|
|
11
|
-
export function Board({ columns, cards, onCardsChange, renderCard, onNewCard, newCardLabel
|
|
11
|
+
export function Board({ columns, cards, onCardsChange, renderCard, onNewCard, newCardLabel: newCardLabelProp, getCardLabel, announceMove: announceMoveProp, className, ...rest }) {
|
|
12
|
+
// crisp/#471: same resolution order as every other component's own —
|
|
13
|
+
// explicit prop, then a CrispMessagesProvider's translation of the English
|
|
14
|
+
// default, then that default itself.
|
|
15
|
+
const newCardLabel = useCrispMessage(newCardLabelProp, "New");
|
|
16
|
+
const crispMessages = useCrispMessages();
|
|
17
|
+
const announceMove = announceMoveProp ??
|
|
18
|
+
((column, card) => card
|
|
19
|
+
? `${card} ${crispMessages["moved to"] ?? "moved to"} ${column}`
|
|
20
|
+
: `${crispMessages["Moved to"] ?? "Moved to"} ${column}`);
|
|
12
21
|
const [dragId, setDragId] = React.useState(null);
|
|
13
22
|
const [overCol, setOverCol] = React.useState(null);
|
|
14
23
|
const [announcement, setAnnouncement] = React.useState("");
|
|
@@ -65,7 +74,7 @@ export function Board({ columns, cards, onCardsChange, renderCard, onNewCard, ne
|
|
|
65
74
|
move(dragId, col.id);
|
|
66
75
|
setDragId(null);
|
|
67
76
|
setOverCol(null);
|
|
68
|
-
}, children: [_jsxs("div", { className: "crisp-board-col-header", children: [col.accent && (_jsx("span", { className: "crisp-board-col-dot", style: { background: col.accent } })), _jsx("span", { className: "crisp-board-col-title", children: col.title }), _jsx("span", { className: "crisp-board-col-count", children: colCards.length }), onNewCard && (_jsx("button", { type: "button", className: "crisp-board-col-add", "aria-label":
|
|
77
|
+
}, children: [_jsxs("div", { className: "crisp-board-col-header", children: [col.accent && (_jsx("span", { className: "crisp-board-col-dot", style: { background: col.accent } })), _jsx("span", { className: "crisp-board-col-title", children: col.title }), _jsx("span", { className: "crisp-board-col-count", children: colCards.length }), onNewCard && (_jsx("button", { type: "button", className: "crisp-board-col-add", "aria-label": `${crispMessages["Add to"] ?? "Add to"} ${col.title}`, onClick: () => onNewCard(col.id), children: "+" }))] }), _jsxs("div", { className: "crisp-board-col-body", role: "list", "aria-label": col.title, children: [onNewCard && (_jsxs("button", { type: "button", className: "crisp-board-newcard", onClick: () => onNewCard(col.id), children: ["+ ", newCardLabel] })), colCards.map((card) => (_jsx("div", { className: "crisp-board-card", role: "listitem",
|
|
69
78
|
// biome-ignore lint/a11y/noNoninteractiveTabindex: the rule assumes a listitem cannot be operated. This one carries the board's only keyboard path to move a card, so it has to be reachable by Tab
|
|
70
79
|
tabIndex: 0, "aria-label": getCardLabel?.(card), "data-card-id": card.id, draggable: true, "data-dragging": dragId === card.id ? "" : undefined, onDragStart: () => setDragId(card.id), onDragEnd: () => {
|
|
71
80
|
setDragId(null);
|
|
@@ -5,7 +5,7 @@ import { normalizeProps, Portal, useMachine } from "@zag-js/react";
|
|
|
5
5
|
import { Building2, CircleDollarSign, House, ListTodo, Search, Settings, SquareCheck, User, UserPlus, } from "lucide-react";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Kbd } from "../../components/kbd/index.js";
|
|
8
|
-
import { cx, withDescribedBy } from "../../core/index.js";
|
|
8
|
+
import { cx, useCrispMessage, useCrispMessages, withDescribedBy, } from "../../core/index.js";
|
|
9
9
|
import { commandRecipe } from "./command.recipe.js";
|
|
10
10
|
const IconHome = () => (_jsx(House, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
11
11
|
const IconTasks = () => (_jsx(SquareCheck, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
@@ -110,7 +110,19 @@ function useCommandInstanceId() {
|
|
|
110
110
|
* option list) so keyboard/focus correctness comes from the machines, not
|
|
111
111
|
* hand-rolled event handling.
|
|
112
112
|
*/
|
|
113
|
-
export function Command({ open, onOpenChange, items = defaultCommandItems, placeholder
|
|
113
|
+
export function Command({ open, onOpenChange, items = defaultCommandItems, placeholder: placeholderProp, "aria-label": ariaLabelProp, navigateLabel: navigateLabelProp, selectLabel: selectLabelProp, emptyLabel: emptyLabelProp, query: queryProp, onQueryChange, filterItems = true, className, "aria-describedby": describedBy, ...rest }) {
|
|
114
|
+
// crisp/#471: same resolution order as every other component's own.
|
|
115
|
+
// `navigateLabel`/`emptyLabel` are typed `React.ReactNode`, so they
|
|
116
|
+
// resolve by hand rather than through `useCrispMessage`, which is
|
|
117
|
+
// string-only.
|
|
118
|
+
const crispMessages = useCrispMessages();
|
|
119
|
+
const placeholder = useCrispMessage(placeholderProp, "Search actions and records…");
|
|
120
|
+
const ariaLabel = useCrispMessage(ariaLabelProp, "Command palette");
|
|
121
|
+
const navigateLabel = navigateLabelProp ?? crispMessages.Navigate ?? "Navigate";
|
|
122
|
+
const selectLabel = useCrispMessage(selectLabelProp, "Select");
|
|
123
|
+
const emptyLabel = emptyLabelProp ??
|
|
124
|
+
crispMessages["No matching commands"] ??
|
|
125
|
+
"No matching commands";
|
|
114
126
|
const instanceId = useCommandInstanceId();
|
|
115
127
|
const dialogId = `${instanceId}-dialog`;
|
|
116
128
|
const comboId = `${instanceId}-combobox`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Minus, Plus } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { useCrispMessage } from "../../core/index.js";
|
|
4
5
|
import { flowcanvasRecipe } from "./flowcanvas.recipe.js";
|
|
5
6
|
const GRID = 20;
|
|
6
7
|
const clampZoom = (z) => Math.min(1.5, Math.max(0.5, z));
|
|
@@ -9,7 +10,13 @@ const clampZoom = (z) => Math.min(1.5, Math.max(0.5, z));
|
|
|
9
10
|
* measured from a workflows editor. Drag a node to move it (fires
|
|
10
11
|
* `onNodesChange`); drag the background to pan; use the toolbar to zoom.
|
|
11
12
|
*/
|
|
12
|
-
export function FlowCanvas({ nodes, edges, onNodesChange, renderNode, nodeWidth = 240, nodeHeight = 64, "aria-label":
|
|
13
|
+
export function FlowCanvas({ nodes, edges, onNodesChange, renderNode, nodeWidth = 240, nodeHeight = 64, "aria-label": ariaLabelProp, className, zoomOutLabel: zoomOutLabelProp, zoomInLabel: zoomInLabelProp, resetLabel: resetLabelProp, edgesLabel: edgesLabelProp, ...rest }) {
|
|
14
|
+
// crisp/#471: same resolution order as every other component's own.
|
|
15
|
+
const ariaLabel = useCrispMessage(ariaLabelProp, "Flow canvas");
|
|
16
|
+
const zoomOutLabel = useCrispMessage(zoomOutLabelProp, "Zoom out");
|
|
17
|
+
const zoomInLabel = useCrispMessage(zoomInLabelProp, "Zoom in");
|
|
18
|
+
const resetLabel = useCrispMessage(resetLabelProp, "Reset");
|
|
19
|
+
const edgesLabel = useCrispMessage(edgesLabelProp, "Edges");
|
|
13
20
|
const [pan, setPan] = React.useState({ x: 40, y: 40 });
|
|
14
21
|
const [zoom, setZoom] = React.useState(1);
|
|
15
22
|
const [panning, setPanning] = React.useState(false);
|
|
@@ -64,7 +71,7 @@ export function FlowCanvas({ nodes, edges, onNodesChange, renderNode, nodeWidth
|
|
|
64
71
|
...rest.style,
|
|
65
72
|
backgroundSize: `${GRID * zoom}px ${GRID * zoom}px`,
|
|
66
73
|
backgroundPosition: `${pan.x}px ${pan.y}px`,
|
|
67
|
-
}, role: "application", "aria-label": ariaLabel
|
|
74
|
+
}, role: "application", "aria-label": ariaLabel, onPointerDown: onBackgroundPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, children: [_jsxs("div", { className: "crisp-flowcanvas-viewport", style: {
|
|
68
75
|
transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`,
|
|
69
76
|
}, children: [_jsxs("svg", { className: "crisp-flowcanvas-edges", "aria-hidden": "true", children: [_jsx("title", { children: edgesLabel }), edges.map((edge) => {
|
|
70
77
|
const a = byId.get(edge.from);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { headerbarRecipe } from "./headerbar.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* A page-level header row: an optional leading slot, a flexible title/
|
|
5
|
+
* breadcrumb region, and a trailing action cluster, on the measured 48px
|
|
6
|
+
* bar Attio uses for both its page-header and its view-bar row. See the
|
|
7
|
+
* recipe's own doc comment for the live measurement (crisp#462).
|
|
8
|
+
*/
|
|
9
|
+
export function HeaderBar({ leading, title, trailing, bordered = true, className, ...rest }) {
|
|
10
|
+
return (_jsxs("div", { className: headerbarRecipe({ className }), "data-bordered": bordered ? "" : undefined, ...rest, children: [leading ? (_jsx("span", { className: "crisp-headerbar-leading", children: leading })) : null, title ? _jsx("div", { className: "crisp-headerbar-title", children: title }) : null, trailing ? (_jsx("span", { className: "crisp-headerbar-trailing", children: trailing })) : null] }));
|
|
11
|
+
}
|
|
12
|
+
HeaderBar.displayName = "HeaderBar";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A page-level header row — measured live at app.attio.com/techpartners/companies
|
|
4
|
+
// against two stacked bars: the top utility bar (breadcrumb + trailing icon
|
|
5
|
+
// actions, e.g. search/notifications) and the view bar directly under it
|
|
6
|
+
// ("All Companies" view name + tabs + "New Company"). Both share the same
|
|
7
|
+
// 48px content height and `0 ${space3}` padding; only the outer (first) bar
|
|
8
|
+
// carries the divider -- measured `border-bottom: 1px solid rgb(238,239,241)`
|
|
9
|
+
// (`borderSubtle`/`line100`, exact match) on the utility bar, no border of
|
|
10
|
+
// its own on the view bar directly beneath it. `bordered` (default true)
|
|
11
|
+
// lets a consumer that stacks two HeaderBars turn it off on the inner one,
|
|
12
|
+
// the way GRC's own AppLayout UtilityBar + Page viewBar do today with two
|
|
13
|
+
// hand-rolled, drifting copies of the same 49px bar (crisp#462 GRC audit,
|
|
14
|
+
// crisp#527).
|
|
15
|
+
//
|
|
16
|
+
// No bell, no breadcrumb, no search box baked in -- those are the `leading`/
|
|
17
|
+
// `title`/`trailing` slot content a consumer supplies. `size.header` (48px)
|
|
18
|
+
// is reused rather than a new token, since it's the same "workspace-switcher
|
|
19
|
+
// header height" measured elsewhere in the sidebar.
|
|
20
|
+
const config = defineRecipe({
|
|
21
|
+
name: "headerbar",
|
|
22
|
+
base: `box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: ${c.space["2"]}; height: ${c.size.header}; flex-shrink: 0; padding: 0 ${c.space["3"]}; font-family: ${c.font.sans}; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
23
|
+
&[data-bordered] { border-bottom: 1px solid ${c.borderSubtle}; }
|
|
24
|
+
& .crisp-headerbar-leading { display: flex; align-items: center; gap: ${c.space["2"]}; flex-shrink: 0; min-width: 0; }
|
|
25
|
+
& .crisp-headerbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: ${c.space["2"]}; overflow: hidden; }
|
|
26
|
+
& .crisp-headerbar-trailing { display: flex; align-items: center; gap: ${c.space["2"]}; flex-shrink: 0; }`,
|
|
27
|
+
variants: {},
|
|
28
|
+
defaultVariants: {},
|
|
29
|
+
compoundVariants: [],
|
|
30
|
+
});
|
|
31
|
+
export const headerbarRecipe = resolveRecipe(config);
|
|
32
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./headerbar.js";
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Bell } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useTablistKeyboard } from "../../components/tabs/index.js";
|
|
5
|
+
import { useCrispMessage, useCrispMessages } from "../../core/index.js";
|
|
5
6
|
import { inboxRecipe } from "./inbox.recipe.js";
|
|
6
7
|
/**
|
|
7
8
|
* A notifications inbox panel — measured from a notification flyout. A
|
|
@@ -9,8 +10,19 @@ import { inboxRecipe } from "./inbox.recipe.js";
|
|
|
9
10
|
* (avatar + message + time + unread dot) or a centred empty state. Put it inside
|
|
10
11
|
* a Popover for the flyout.
|
|
11
12
|
*/
|
|
12
|
-
export function Inbox({ notifications = [], title
|
|
13
|
+
export function Inbox({ notifications = [], title: titleProp, tabs, activeTab, onTabChange, emptyTitle: emptyTitleProp, emptySubtitle: emptySubtitleProp, emptyAction, tabsLabel: tabsLabelProp, className, ...rest }) {
|
|
13
14
|
const listRef = React.useRef(null);
|
|
15
|
+
// crisp/#471: `title`/`emptyTitle`/`emptySubtitle` are typed
|
|
16
|
+
// `React.ReactNode`, so they resolve by hand rather than through
|
|
17
|
+
// `useCrispMessage`, which is string-only — same reasoning as DataTable's
|
|
18
|
+
// own `empty`.
|
|
19
|
+
const crispMessages = useCrispMessages();
|
|
20
|
+
const title = titleProp ?? crispMessages.Notifications ?? "Notifications";
|
|
21
|
+
const emptyTitle = emptyTitleProp ?? crispMessages["No notifications"] ?? "No notifications";
|
|
22
|
+
const emptySubtitle = emptySubtitleProp ??
|
|
23
|
+
crispMessages["Notifications such as mentions and important updates will be displayed here."] ??
|
|
24
|
+
"Notifications such as mentions and important updates will be displayed here.";
|
|
25
|
+
const tabsLabel = useCrispMessage(tabsLabelProp, "Notification views");
|
|
14
26
|
// crisp's shared tablist model, the one `Tabs` runs (#195). Hand-rolling a
|
|
15
27
|
// second one is how Inbox ended up with no arrow keys, no roving tabindex
|
|
16
28
|
// and no name while `Tabs` had all three.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Check, ChevronDown, MoreHorizontal } from "lucide-react";
|
|
3
|
+
import { useCrispMessage, useCrispMessages } from "../../core/index.js";
|
|
3
4
|
import { onboardingRecipe } from "./onboarding.recipe.js";
|
|
4
5
|
/**
|
|
5
6
|
* The English defaults for the two pieces of copy that are formatters rather
|
|
@@ -15,9 +16,29 @@ export const onboardingLabels = {
|
|
|
15
16
|
* started" widget. Title + optional menu/minimize, a segmented progress bar,
|
|
16
17
|
* and step rows (completed rows strike through with a brand check).
|
|
17
18
|
*/
|
|
18
|
-
export function OnboardingChecklist({ title
|
|
19
|
+
export function OnboardingChecklist({ title: titleProp, steps, encouragement: encouragementProp, onStepClick, onMenu, onMinimize, className, optionsLabel: optionsLabelProp, minimizeLabel: minimizeLabelProp, progressLabel: progressLabelProp, progressText: progressTextProp, completedStepLabel: completedStepLabelProp, ...rest }) {
|
|
19
20
|
const total = steps.length;
|
|
20
21
|
const done = steps.filter((s) => s.done).length;
|
|
22
|
+
// crisp/#471: same resolution order as every other component's own —
|
|
23
|
+
// explicit prop, then a CrispMessagesProvider's translation of the English
|
|
24
|
+
// default, then that default itself. `title`/`encouragement` are typed
|
|
25
|
+
// `React.ReactNode` (a caller can pass a translated element), so they
|
|
26
|
+
// resolve by hand rather than through `useCrispMessage`, which is
|
|
27
|
+
// string-only — same reasoning as DataTable's own `empty`.
|
|
28
|
+
const crispMessages = useCrispMessages();
|
|
29
|
+
const title = titleProp ?? crispMessages["Getting started"] ?? "Getting started";
|
|
30
|
+
const encouragement = encouragementProp ?? crispMessages["Keep it up!"] ?? "Keep it up!";
|
|
31
|
+
const optionsLabel = useCrispMessage(optionsLabelProp, "Checklist options");
|
|
32
|
+
const minimizeLabel = useCrispMessage(minimizeLabelProp, "Minimize");
|
|
33
|
+
const progressLabel = useCrispMessage(progressLabelProp, "Onboarding progress");
|
|
34
|
+
// `progressText`/`completedStepLabel` are formatters, not strings (the
|
|
35
|
+
// count moves within the sentence between languages, #216) — each of
|
|
36
|
+
// their own static fragments gets its own lookup, same as
|
|
37
|
+
// TableToolbar's "Sorted by" (crisp/#217).
|
|
38
|
+
const progressText = progressTextProp ??
|
|
39
|
+
((doneCount, totalCount) => (_jsxs(_Fragment, { children: [_jsxs("b", { children: [doneCount, "/", totalCount] }), " ", crispMessages["steps completed"] ?? "steps completed"] })));
|
|
40
|
+
const completedStepLabel = completedStepLabelProp ??
|
|
41
|
+
((label) => `${String(label)} ${crispMessages["— completed"] ?? "— completed"}`);
|
|
21
42
|
return (_jsxs("div", { className: onboardingRecipe({ className }), ...rest, children: [_jsxs("div", { className: "crisp-onboarding-head", children: [_jsx("span", { className: "crisp-onboarding-title", children: title }), onMenu && (_jsx("button", { type: "button", className: "crisp-onboarding-iconbtn", "aria-label": optionsLabel, onClick: onMenu, children: _jsx(MoreHorizontal, { size: 16, strokeWidth: 1.75 }) })), onMinimize && (_jsx("button", { type: "button", className: "crisp-onboarding-iconbtn", "aria-label": minimizeLabel, onClick: onMinimize, children: _jsx(ChevronDown, { size: 16, strokeWidth: 1.75 }) }))] }), _jsxs("span", { className: "crisp-onboarding-sub", children: [progressText(done, total), encouragement ? _jsxs(_Fragment, { children: [" \u00B7 ", encouragement] }) : null] }), _jsx("div", { className: "crisp-onboarding-progress", role: "progressbar", "aria-valuenow": done, "aria-valuemin": 0, "aria-valuemax": total, "aria-label": progressLabel, children: Array.from({ length: total }, (_, i) => (_jsx("span", { className: "crisp-onboarding-seg", "data-done": i < done ? "" : undefined }, i))) }), _jsx("div", { className: "crisp-onboarding-steps", children: steps.map((s) => (_jsxs("button", { type: "button", className: "crisp-onboarding-step", "data-done": s.done ? "" : undefined, "aria-label": s.done ? completedStepLabel(s.label) : undefined, disabled: s.done, onClick: s.done ? undefined : () => onStepClick?.(s.id), children: [_jsx("span", { className: "crisp-onboarding-step-icon", children: s.icon }), _jsx("span", { className: "crisp-onboarding-step-label", children: s.label }), _jsx("span", { className: "crisp-onboarding-step-check", children: s.done && _jsx(Check, { size: 12, strokeWidth: 3 }) })] }, s.id))) })] }));
|
|
22
43
|
}
|
|
23
44
|
OnboardingChecklist.displayName = "OnboardingChecklist";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { RecordPage, recordPageLabels, } from "./recordpage.js";
|
|
1
|
+
export { RecordDetails, RecordPage, recordPageLabels, } from "./recordpage.js";
|
|
2
2
|
export { recordpageRecipe } from "./recordpage.recipe.js";
|