@crisp-ui-kit/crisp 0.1.0 → 0.5.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/README.md +6 -0
- package/dist/base.css +25 -0
- package/dist/bulkbar.css +13 -0
- package/dist/bulkbar.d.ts +7 -0
- package/dist/button.css +1 -1
- package/dist/command.css +1 -1
- package/dist/contextmenu.css +1 -1
- package/dist/datatable.css +60 -0
- package/dist/datatable.d.ts +7 -0
- package/dist/datepicker.css +1 -1
- package/dist/dialog.css +1 -1
- package/dist/esm/components/accordion/accordion.js +32 -0
- package/dist/esm/components/accordion/accordion.recipe.js +23 -0
- package/dist/esm/components/accordion/index.js +2 -0
- package/dist/esm/components/avatar/avatar.js +8 -0
- package/dist/esm/components/avatar/avatar.recipe.js +39 -0
- package/dist/esm/components/avatar/index.js +2 -0
- package/dist/esm/components/avatargroup/avatargroup.js +16 -0
- package/dist/esm/components/avatargroup/avatargroup.recipe.js +15 -0
- package/dist/esm/components/avatargroup/index.js +2 -0
- package/dist/esm/components/badge/badge.js +8 -0
- package/dist/esm/components/badge/badge.recipe.js +65 -0
- package/dist/esm/components/badge/index.js +2 -0
- package/dist/esm/components/barchart/barchart.js +29 -0
- package/dist/esm/components/barchart/barchart.recipe.js +26 -0
- package/dist/esm/components/barchart/index.js +2 -0
- package/dist/esm/components/breadcrumb/breadcrumb.js +17 -0
- package/dist/esm/components/breadcrumb/breadcrumb.recipe.js +18 -0
- package/dist/esm/components/breadcrumb/index.js +2 -0
- package/dist/esm/components/bulkbar/bulkbar.js +16 -0
- package/dist/esm/components/bulkbar/bulkbar.recipe.js +28 -0
- package/dist/esm/components/bulkbar/index.js +2 -0
- package/dist/esm/components/button/button.js +15 -0
- package/dist/esm/components/button/button.recipe.js +39 -0
- package/dist/esm/components/button/index.js +2 -0
- package/dist/esm/components/callout/callout.js +22 -0
- package/dist/esm/components/callout/callout.recipe.js +26 -0
- package/dist/esm/components/callout/index.js +2 -0
- package/dist/esm/components/card/card.js +15 -0
- package/dist/esm/components/card/card.recipe.js +28 -0
- package/dist/esm/components/card/index.js +2 -0
- package/dist/esm/components/checkbox/checkbox.js +20 -0
- package/dist/esm/components/checkbox/checkbox.recipe.js +23 -0
- package/dist/esm/components/checkbox/index.js +2 -0
- package/dist/esm/components/contextmenu/contextmenu.js +42 -0
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +21 -0
- package/dist/esm/components/contextmenu/index.js +2 -0
- package/dist/esm/components/datatable/datatable.js +245 -0
- package/dist/esm/components/datatable/datatable.recipe.js +72 -0
- package/dist/esm/components/datatable/index.js +2 -0
- package/dist/esm/components/datepicker/datepicker.js +57 -0
- package/dist/esm/components/datepicker/datepicker.recipe.js +32 -0
- package/dist/esm/components/datepicker/index.js +2 -0
- package/dist/esm/components/dialog/dialog.js +48 -0
- package/dist/esm/components/dialog/dialog.recipe.js +32 -0
- package/dist/esm/components/dialog/index.js +2 -0
- package/dist/esm/components/divider/divider.js +7 -0
- package/dist/esm/components/divider/divider.recipe.js +14 -0
- package/dist/esm/components/divider/index.js +2 -0
- package/dist/esm/components/donutchart/donutchart.js +38 -0
- package/dist/esm/components/donutchart/donutchart.recipe.js +27 -0
- package/dist/esm/components/donutchart/index.js +2 -0
- package/dist/esm/components/drawer/drawer.js +42 -0
- package/dist/esm/components/drawer/drawer.recipe.js +27 -0
- package/dist/esm/components/drawer/index.js +2 -0
- package/dist/esm/components/emptystate/emptystate.js +7 -0
- package/dist/esm/components/emptystate/emptystate.recipe.js +31 -0
- package/dist/esm/components/emptystate/index.js +2 -0
- package/dist/esm/components/formfield/formfield.js +14 -0
- package/dist/esm/components/formfield/formfield.recipe.js +19 -0
- package/dist/esm/components/formfield/index.js +2 -0
- package/dist/esm/components/input/index.js +2 -0
- package/dist/esm/components/input/input.js +8 -0
- package/dist/esm/components/input/input.recipe.js +23 -0
- package/dist/esm/components/kbd/index.js +2 -0
- package/dist/esm/components/kbd/kbd.js +8 -0
- package/dist/esm/components/kbd/kbd.recipe.js +20 -0
- package/dist/esm/components/linechart/index.js +2 -0
- package/dist/esm/components/linechart/linechart.js +41 -0
- package/dist/esm/components/linechart/linechart.recipe.js +27 -0
- package/dist/esm/components/menu/index.js +2 -0
- package/dist/esm/components/menu/menu.js +137 -0
- package/dist/esm/components/menu/menu.recipe.js +51 -0
- package/dist/esm/components/multiselect/index.js +2 -0
- package/dist/esm/components/multiselect/multiselect.js +118 -0
- package/dist/esm/components/multiselect/multiselect.recipe.js +68 -0
- package/dist/esm/components/popover/index.js +2 -0
- package/dist/esm/components/popover/popover.js +70 -0
- package/dist/esm/components/popover/popover.recipe.js +18 -0
- package/dist/esm/components/progress/index.js +2 -0
- package/dist/esm/components/progress/progress.js +23 -0
- package/dist/esm/components/progress/progress.recipe.js +17 -0
- package/dist/esm/components/radiogroup/index.js +2 -0
- package/dist/esm/components/radiogroup/radiogroup.js +46 -0
- package/dist/esm/components/radiogroup/radiogroup.recipe.js +37 -0
- package/dist/esm/components/segmented/index.js +2 -0
- package/dist/esm/components/segmented/segmented.js +59 -0
- package/dist/esm/components/segmented/segmented.recipe.js +20 -0
- package/dist/esm/components/select/index.js +2 -0
- package/dist/esm/components/select/select.js +144 -0
- package/dist/esm/components/select/select.recipe.js +76 -0
- package/dist/esm/components/skeleton/index.js +2 -0
- package/dist/esm/components/skeleton/skeleton.js +7 -0
- package/dist/esm/components/skeleton/skeleton.recipe.js +14 -0
- package/dist/esm/components/spinner/index.js +2 -0
- package/dist/esm/components/spinner/spinner.js +11 -0
- package/dist/esm/components/spinner/spinner.recipe.js +13 -0
- package/dist/esm/components/stagebar/index.js +2 -0
- package/dist/esm/components/stagebar/stagebar.js +23 -0
- package/dist/esm/components/stagebar/stagebar.recipe.js +14 -0
- package/dist/esm/components/statcard/index.js +2 -0
- package/dist/esm/components/statcard/statcard.js +12 -0
- package/dist/esm/components/statcard/statcard.recipe.js +34 -0
- package/dist/esm/components/switch/index.js +2 -0
- package/dist/esm/components/switch/switch.js +22 -0
- package/dist/esm/components/switch/switch.recipe.js +26 -0
- package/dist/esm/components/table/index.js +2 -0
- package/dist/esm/components/table/table.js +30 -0
- package/dist/esm/components/table/table.recipe.js +40 -0
- package/dist/esm/components/tabletoolbar/index.js +2 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +79 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +191 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.recipe.js +23 -0
- package/dist/esm/components/tabs/index.js +2 -0
- package/dist/esm/components/tabs/tabs.js +70 -0
- package/dist/esm/components/tabs/tabs.recipe.js +33 -0
- package/dist/esm/components/textarea/index.js +2 -0
- package/dist/esm/components/textarea/textarea.js +20 -0
- package/dist/esm/components/textarea/textarea.recipe.js +31 -0
- package/dist/esm/components/toast/index.js +2 -0
- package/dist/esm/components/toast/toast.js +58 -0
- package/dist/esm/components/toast/toast.recipe.js +28 -0
- package/dist/esm/components/tooltip/index.js +2 -0
- package/dist/esm/components/tooltip/tooltip.js +45 -0
- package/dist/esm/components/tooltip/tooltip.recipe.js +13 -0
- package/dist/esm/core/cx.js +1 -0
- package/dist/esm/core/define.js +3 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/primitive.js +13 -0
- package/dist/esm/core/resolve.js +41 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/index.js +71 -0
- package/dist/esm/product/appshell/appshell.js +44 -0
- package/dist/esm/product/appshell/appshell.recipe.js +27 -0
- package/dist/esm/product/appshell/index.js +2 -0
- package/dist/esm/product/board/board.js +42 -0
- package/dist/esm/product/board/board.recipe.js +28 -0
- package/dist/esm/product/board/index.js +2 -0
- package/dist/esm/product/command/command.js +188 -0
- package/dist/esm/product/command/command.recipe.js +19 -0
- package/dist/esm/product/command/index.js +2 -0
- package/dist/esm/product/entitycard/entitycard.js +11 -0
- package/dist/esm/product/entitycard/entitycard.recipe.js +29 -0
- package/dist/esm/product/entitycard/index.js +2 -0
- package/dist/esm/product/flowcanvas/flowcanvas.js +85 -0
- package/dist/esm/product/flowcanvas/flowcanvas.recipe.js +25 -0
- package/dist/esm/product/flowcanvas/index.js +2 -0
- package/dist/esm/product/inbox/inbox.js +13 -0
- package/dist/esm/product/inbox/inbox.recipe.js +43 -0
- package/dist/esm/product/inbox/index.js +2 -0
- package/dist/esm/product/listpage/index.js +2 -0
- package/dist/esm/product/listpage/listpage.js +21 -0
- package/dist/esm/product/listpage/listpage.recipe.js +43 -0
- package/dist/esm/product/navitem/index.js +1 -0
- package/dist/esm/product/navitem/navitem.js +8 -0
- package/dist/esm/product/navitem/navitem.recipe.js +21 -0
- package/dist/esm/product/onboarding/index.js +2 -0
- package/dist/esm/product/onboarding/onboarding.js +14 -0
- package/dist/esm/product/onboarding/onboarding.recipe.js +41 -0
- package/dist/esm/product/recordpage/index.js +2 -0
- package/dist/esm/product/recordpage/recordpage.js +286 -0
- package/dist/esm/product/recordpage/recordpage.recipe.js +157 -0
- package/dist/esm/product/recordpanel/index.js +2 -0
- package/dist/esm/product/recordpanel/recordpanel.js +47 -0
- package/dist/esm/product/recordpanel/recordpanel.recipe.js +52 -0
- package/dist/esm/product/recordstable/company-logos.js +26 -0
- package/dist/esm/product/recordstable/index.js +2 -0
- package/dist/esm/product/recordstable/recordstable.js +963 -0
- package/dist/esm/product/recordstable/recordstable.recipe.js +149 -0
- package/dist/esm/product/richtext/index.js +2 -0
- package/dist/esm/product/richtext/richtext.js +111 -0
- package/dist/esm/product/richtext/richtext.recipe.js +40 -0
- package/dist/esm/product/settingssection/index.js +2 -0
- package/dist/esm/product/settingssection/settingssection.js +11 -0
- package/dist/esm/product/settingssection/settingssection.recipe.js +20 -0
- package/dist/esm/product/settingsshell/index.js +2 -0
- package/dist/esm/product/settingsshell/settingsshell.js +23 -0
- package/dist/esm/product/settingsshell/settingsshell.recipe.js +38 -0
- package/dist/esm/product/sidebar/index.js +2 -0
- package/dist/esm/product/sidebar/sidebar.js +112 -0
- package/dist/esm/product/sidebar/sidebar.recipe.js +18 -0
- package/dist/esm/product/tasklist/index.js +2 -0
- package/dist/esm/product/tasklist/tasklist.js +16 -0
- package/dist/esm/product/tasklist/tasklist.recipe.js +35 -0
- package/dist/esm/product/trialbanner/index.js +2 -0
- package/dist/esm/product/trialbanner/trialbanner.js +10 -0
- package/dist/esm/product/trialbanner/trialbanner.recipe.js +29 -0
- package/dist/esm/product/viewtoggle/index.js +2 -0
- package/dist/esm/product/viewtoggle/viewtoggle.js +11 -0
- package/dist/esm/product/viewtoggle/viewtoggle.recipe.js +24 -0
- package/dist/esm/tokens/contract.js +18 -0
- package/dist/esm/tokens/index.js +4 -0
- package/dist/esm/tokens/palette.js +30 -0
- package/dist/esm/tokens/scale.js +60 -0
- package/dist/esm/tokens/semantic.js +30 -0
- package/dist/menu.css +2 -2
- package/dist/multiselect.css +3 -3
- package/dist/popover.css +1 -1
- package/dist/recordpage.css +5 -5
- package/dist/recordstable.css +5 -14
- package/dist/select.css +10 -4
- package/dist/select.d.ts +2 -1
- package/dist/sidebar.css +1 -1
- package/dist/statcard.css +6 -0
- package/dist/statcard.d.ts +2 -2
- package/dist/styles.css +237 -37
- package/dist/table.css +26 -0
- package/dist/table.d.ts +8 -0
- package/dist/tabletoolbar.css +70 -0
- package/dist/tabletoolbar.d.ts +7 -0
- package/dist/tokens.css +24 -0
- package/dist/types/components/bulkbar/bulkbar.d.ts +32 -0
- package/dist/types/components/bulkbar/bulkbar.recipe.d.ts +3 -0
- package/dist/types/components/bulkbar/index.d.ts +2 -0
- package/dist/types/components/datatable/datatable.d.ts +98 -0
- package/dist/types/components/datatable/datatable.recipe.d.ts +3 -0
- package/dist/types/components/datatable/index.d.ts +2 -0
- package/dist/types/components/select/select.d.ts +3 -1
- package/dist/types/components/select/select.recipe.d.ts +12 -0
- package/dist/types/components/statcard/statcard.d.ts +6 -1
- package/dist/types/components/statcard/statcard.recipe.d.ts +12 -2
- package/dist/types/components/table/index.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +53 -0
- package/dist/types/components/table/table.recipe.d.ts +21 -0
- package/dist/types/components/tabletoolbar/index.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.chrome.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +63 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.recipe.d.ts +3 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/product/recordstable/company-logos.d.ts +1 -0
- package/dist/types/product/recordstable/recordstable.d.ts +44 -1
- package/dist/types/product/sidebar/index.d.ts +1 -1
- package/dist/types/product/sidebar/sidebar.d.ts +85 -0
- package/dist/types/tokens/contract.d.ts +12 -0
- package/dist/types/tokens/palette.d.ts +48 -0
- package/dist/types/tokens/semantic.d.ts +12 -0
- package/dist/viewtoggle.css +2 -2
- package/package.json +259 -9
- package/dist/index.js +0 -9653
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// The floating bubble for a Tooltip — Attio's dark hint chip. Applied to the
|
|
4
|
+
// portaled bubble itself (not a wrapper), so its styles survive the portal.
|
|
5
|
+
const config = defineRecipe({
|
|
6
|
+
name: "tooltip",
|
|
7
|
+
base: `position: fixed; z-index: 70; box-sizing: border-box; pointer-events: none; max-width: 260px; padding: ${c.space["1"]} ${c.space["2"]}; border-radius: ${c.radius.sm}; background: #20242c; color: #fff; font-family: ${c.font.sans}; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; line-height: 1.45; box-shadow: 0 4px 14px -2px rgba(28,40,64,0.28), 0 0 0 1px rgba(255,255,255,0.04); opacity: 1; transition: opacity 0.12s ease; @starting-style { opacity: 0; }`,
|
|
8
|
+
variants: {},
|
|
9
|
+
defaultVariants: {},
|
|
10
|
+
compoundVariants: [],
|
|
11
|
+
});
|
|
12
|
+
export const tooltipRecipe = resolveRecipe(config);
|
|
13
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as cx } from "clsx";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
const NODES = ["button", "div", "span", "a", "input", "p"];
|
|
5
|
+
export const Primitive = NODES.reduce((acc, node) => {
|
|
6
|
+
const Component = React.forwardRef(({ asChild, ...props }, ref) => {
|
|
7
|
+
const Comp = asChild ? Slot : node;
|
|
8
|
+
return _jsx(Comp, { ref: ref, ...props });
|
|
9
|
+
});
|
|
10
|
+
Component.displayName = `Primitive.${node}`;
|
|
11
|
+
acc[node] = Component;
|
|
12
|
+
return acc;
|
|
13
|
+
}, {});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cx } from "./cx.js";
|
|
2
|
+
const falsyToString = (v) => typeof v === "boolean" ? `${v}` : v === 0 ? "0" : v;
|
|
3
|
+
export function resolveRecipe(config) {
|
|
4
|
+
const { name, base, variants, defaultVariants, compoundVariants } = config;
|
|
5
|
+
return (props) => {
|
|
6
|
+
const classes = [];
|
|
7
|
+
if (base)
|
|
8
|
+
classes.push(name);
|
|
9
|
+
if (variants) {
|
|
10
|
+
for (const variant of Object.keys(variants)) {
|
|
11
|
+
const variantProp = props?.[variant];
|
|
12
|
+
if (variantProp === null)
|
|
13
|
+
continue;
|
|
14
|
+
const defaultProp = defaultVariants?.[variant];
|
|
15
|
+
const key = falsyToString(variantProp) ?? falsyToString(defaultProp);
|
|
16
|
+
if (key == null)
|
|
17
|
+
continue;
|
|
18
|
+
if (variants[variant]?.[key] !== undefined) {
|
|
19
|
+
classes.push(`${name}--${variant}_${key}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const withoutUndefined = props
|
|
23
|
+
? Object.fromEntries(Object.entries(props).filter(([, v]) => v !== undefined))
|
|
24
|
+
: {};
|
|
25
|
+
const merged = {
|
|
26
|
+
...defaultVariants,
|
|
27
|
+
...withoutUndefined,
|
|
28
|
+
};
|
|
29
|
+
compoundVariants?.forEach((cv, i) => {
|
|
30
|
+
const matches = Object.entries(cv).every(([k, val]) => k === "css"
|
|
31
|
+
? true
|
|
32
|
+
: Array.isArray(val)
|
|
33
|
+
? val.includes(merged[k])
|
|
34
|
+
: merged[k] === val);
|
|
35
|
+
if (matches)
|
|
36
|
+
classes.push(`${name}--compound_${i}`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return cx(classes, props?.class, props?.className);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Public API barrel for @crisp-ui-kit/crisp — generated: re-exports every
|
|
2
|
+
// component, the design tokens, and the recipe core. Consumers also import the
|
|
3
|
+
// stylesheet once: import "@crisp-ui-kit/crisp/styles.css";
|
|
4
|
+
// primitives (components/)
|
|
5
|
+
export * from "./components/accordion/index.js";
|
|
6
|
+
export * from "./components/avatar/index.js";
|
|
7
|
+
export * from "./components/avatargroup/index.js";
|
|
8
|
+
export * from "./components/badge/index.js";
|
|
9
|
+
export * from "./components/barchart/index.js";
|
|
10
|
+
export * from "./components/breadcrumb/index.js";
|
|
11
|
+
export * from "./components/bulkbar/index.js";
|
|
12
|
+
export * from "./components/button/index.js";
|
|
13
|
+
export * from "./components/callout/index.js";
|
|
14
|
+
export * from "./components/card/index.js";
|
|
15
|
+
export * from "./components/checkbox/index.js";
|
|
16
|
+
export * from "./components/contextmenu/index.js";
|
|
17
|
+
export * from "./components/datatable/index.js";
|
|
18
|
+
export * from "./components/datepicker/index.js";
|
|
19
|
+
export * from "./components/dialog/index.js";
|
|
20
|
+
export * from "./components/divider/index.js";
|
|
21
|
+
export * from "./components/donutchart/index.js";
|
|
22
|
+
export * from "./components/drawer/index.js";
|
|
23
|
+
export * from "./components/emptystate/index.js";
|
|
24
|
+
export * from "./components/formfield/index.js";
|
|
25
|
+
export * from "./components/input/index.js";
|
|
26
|
+
export * from "./components/kbd/index.js";
|
|
27
|
+
export * from "./components/linechart/index.js";
|
|
28
|
+
export * from "./components/menu/index.js";
|
|
29
|
+
export * from "./components/multiselect/index.js";
|
|
30
|
+
export * from "./components/popover/index.js";
|
|
31
|
+
export * from "./components/progress/index.js";
|
|
32
|
+
export * from "./components/radiogroup/index.js";
|
|
33
|
+
export * from "./components/segmented/index.js";
|
|
34
|
+
export * from "./components/select/index.js";
|
|
35
|
+
export * from "./components/skeleton/index.js";
|
|
36
|
+
export * from "./components/spinner/index.js";
|
|
37
|
+
export * from "./components/stagebar/index.js";
|
|
38
|
+
export * from "./components/statcard/index.js";
|
|
39
|
+
export * from "./components/switch/index.js";
|
|
40
|
+
export * from "./components/table/index.js";
|
|
41
|
+
export * from "./components/tabletoolbar/index.js";
|
|
42
|
+
export * from "./components/tabs/index.js";
|
|
43
|
+
export * from "./components/textarea/index.js";
|
|
44
|
+
export * from "./components/toast/index.js";
|
|
45
|
+
export * from "./components/tooltip/index.js";
|
|
46
|
+
export * from "./core/index.js";
|
|
47
|
+
// product surfaces (product/) — faithful, pixel-measured rebuilds of specific
|
|
48
|
+
// Attio screens (Sidebar, RecordsTable, RecordPage, Inbox, …). Use them as-is
|
|
49
|
+
// or as composition references for your own data; `components/` above holds
|
|
50
|
+
// the generic primitives (Table, DataTable, Button, …) to build your own UI from.
|
|
51
|
+
export * from "./product/appshell/index.js";
|
|
52
|
+
export * from "./product/board/index.js";
|
|
53
|
+
export * from "./product/command/index.js";
|
|
54
|
+
export * from "./product/entitycard/index.js";
|
|
55
|
+
export * from "./product/flowcanvas/index.js";
|
|
56
|
+
export * from "./product/inbox/index.js";
|
|
57
|
+
export * from "./product/listpage/index.js";
|
|
58
|
+
export * from "./product/navitem/index.js";
|
|
59
|
+
export * from "./product/onboarding/index.js";
|
|
60
|
+
export * from "./product/recordpage/index.js";
|
|
61
|
+
export * from "./product/recordpanel/index.js";
|
|
62
|
+
export * from "./product/recordstable/index.js";
|
|
63
|
+
export * from "./product/richtext/index.js";
|
|
64
|
+
export * from "./product/settingssection/index.js";
|
|
65
|
+
export * from "./product/settingsshell/index.js";
|
|
66
|
+
export * from "./product/sidebar/index.js";
|
|
67
|
+
export * from "./product/tasklist/index.js";
|
|
68
|
+
export * from "./product/trialbanner/index.js";
|
|
69
|
+
export * from "./product/viewtoggle/index.js";
|
|
70
|
+
// design tokens + recipe core (for building custom components)
|
|
71
|
+
export * from "./tokens/index.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PanelLeft } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { appshellRecipe } from "./appshell.recipe.js";
|
|
5
|
+
/**
|
|
6
|
+
* App-shell layout with a collapsible + resizable sidebar, mirroring Attio's
|
|
7
|
+
* window: drag the sidebar's right edge to resize, press the sidebar's
|
|
8
|
+
* collapse button to slide it away (a floating button brings it back). The
|
|
9
|
+
* sidebar pane clips rather than squishing, so its content never reflows.
|
|
10
|
+
*/
|
|
11
|
+
export function AppShell({ sidebar, children, defaultWidth = 275, minWidth = 220, maxWidth = 460, className, }) {
|
|
12
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
13
|
+
const [width, setWidth] = React.useState(defaultWidth);
|
|
14
|
+
const [dragging, setDragging] = React.useState(false);
|
|
15
|
+
const startResize = (e) => {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
const startX = e.clientX;
|
|
18
|
+
const startW = width;
|
|
19
|
+
setDragging(true);
|
|
20
|
+
const prevSelect = document.body.style.userSelect;
|
|
21
|
+
const prevCursor = document.body.style.cursor;
|
|
22
|
+
document.body.style.userSelect = "none";
|
|
23
|
+
document.body.style.cursor = "col-resize";
|
|
24
|
+
const onMove = (ev) => {
|
|
25
|
+
const w = Math.round(Math.min(maxWidth, Math.max(minWidth, startW + (ev.clientX - startX))));
|
|
26
|
+
setWidth(w);
|
|
27
|
+
};
|
|
28
|
+
const onUp = () => {
|
|
29
|
+
setDragging(false);
|
|
30
|
+
document.body.style.userSelect = prevSelect;
|
|
31
|
+
document.body.style.cursor = prevCursor;
|
|
32
|
+
window.removeEventListener("pointermove", onMove);
|
|
33
|
+
window.removeEventListener("pointerup", onUp);
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener("pointermove", onMove);
|
|
36
|
+
window.addEventListener("pointerup", onUp);
|
|
37
|
+
};
|
|
38
|
+
const toggleCollapse = () => setCollapsed((v) => !v);
|
|
39
|
+
return (_jsxs("div", { className: appshellRecipe({ className }), children: [_jsxs("div", { className: "appshell-side", "data-collapsed": collapsed ? "" : undefined, style: {
|
|
40
|
+
width: collapsed ? 0 : width,
|
|
41
|
+
transition: dragging ? "none" : "width .18s ease",
|
|
42
|
+
}, children: [_jsx("div", { className: "appshell-side-inner", style: { width }, children: sidebar(toggleCollapse) }), !collapsed && (_jsx("div", { className: "appshell-resize", "data-dragging": dragging ? "" : undefined, "aria-hidden": "true", onPointerDown: startResize }))] }), _jsxs("div", { className: "appshell-main", children: [collapsed && (_jsx("button", { type: "button", className: "appshell-expand", "aria-label": "Expand sidebar", onClick: () => setCollapsed(false), children: _jsx(PanelLeft, { size: 15, strokeWidth: 1.75 }) })), children] })] }));
|
|
43
|
+
}
|
|
44
|
+
AppShell.displayName = "AppShell";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// App-shell layout: a collapsible + resizable sidebar pane next to a main pane,
|
|
4
|
+
// mirroring how Attio's window works. The sidebar pane clips (never squishes)
|
|
5
|
+
// when collapsing, and a drag handle on its edge resizes it.
|
|
6
|
+
const config = defineRecipe({
|
|
7
|
+
name: "appshell",
|
|
8
|
+
base: `
|
|
9
|
+
display: flex; height: 100%; width: 100%; overflow: hidden; background: ${c.bgSurface}; font-family: ${c.font.sans}; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
10
|
+
& .appshell-side { position: relative; flex-shrink: 0; overflow: hidden; }
|
|
11
|
+
& .appshell-side-inner { height: 100%; }
|
|
12
|
+
& .appshell-resize { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; z-index: 5; touch-action: none; }
|
|
13
|
+
& .appshell-resize::after { content: ""; position: absolute; top: 0; right: 0; width: 2px; height: 100%; background: transparent; transition: background-color .12s; }
|
|
14
|
+
& .appshell-resize:hover::after, & .appshell-resize[data-dragging]::after { background: ${c.bgBrandSolid}; }
|
|
15
|
+
& .appshell-main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
|
|
16
|
+
& .appshell-expand { position: absolute; top: ${c.space["2"]}; left: ${c.space["2"]}; z-index: 6; display: inline-flex; align-items: center; justify-content: center; width: ${c.size.row}; height: ${c.size.row}; padding: 0; border: none; border-radius: ${c.radius.md}; box-shadow: inset 0 0 0 1px ${c.borderSubtle}; background: ${c.bgSurface}; color: ${c.fgMuted}; cursor: pointer; transition: background-color .12s; }
|
|
17
|
+
& .appshell-expand:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
18
|
+
`,
|
|
19
|
+
variants: {},
|
|
20
|
+
defaultVariants: {},
|
|
21
|
+
compoundVariants: [],
|
|
22
|
+
});
|
|
23
|
+
export const appshellRecipe = Object.assign(resolveRecipe(config), {
|
|
24
|
+
config,
|
|
25
|
+
meta: { sidebar: { defaultWidth: "275px" } },
|
|
26
|
+
});
|
|
27
|
+
export default config;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { boardRecipe } from "./board.recipe.js";
|
|
4
|
+
/**
|
|
5
|
+
* A kanban board with native drag-and-drop between columns. Cards are
|
|
6
|
+
* `draggable`; dropping one on a column reparents it via `onCardsChange`
|
|
7
|
+
* (the parent owns the cards, so the move is a controlled state update).
|
|
8
|
+
* Measured from Attio's Deals pipeline.
|
|
9
|
+
*/
|
|
10
|
+
export function Board({ columns, cards, onCardsChange, renderCard, onNewCard, newCardLabel = "New", className, }) {
|
|
11
|
+
const [dragId, setDragId] = React.useState(null);
|
|
12
|
+
const [overCol, setOverCol] = React.useState(null);
|
|
13
|
+
const move = (cardId, toColumn) => {
|
|
14
|
+
const card = cards.find((c) => c.id === cardId);
|
|
15
|
+
if (!card || card.columnId === toColumn)
|
|
16
|
+
return;
|
|
17
|
+
onCardsChange?.(cards.map((c) => (c.id === cardId ? { ...c, columnId: toColumn } : c)));
|
|
18
|
+
};
|
|
19
|
+
return (_jsx("div", { className: boardRecipe({ className }), children: columns.map((col) => {
|
|
20
|
+
const colCards = cards.filter((c) => c.columnId === col.id);
|
|
21
|
+
return (_jsxs("div", { className: "board-col", "data-over": overCol === col.id ? "" : undefined, onDragOver: (e) => {
|
|
22
|
+
if (!dragId)
|
|
23
|
+
return;
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
setOverCol(col.id);
|
|
26
|
+
}, onDragLeave: (e) => {
|
|
27
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
28
|
+
setOverCol((v) => (v === col.id ? null : v));
|
|
29
|
+
}
|
|
30
|
+
}, onDrop: (e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
if (dragId)
|
|
33
|
+
move(dragId, col.id);
|
|
34
|
+
setDragId(null);
|
|
35
|
+
setOverCol(null);
|
|
36
|
+
}, children: [_jsxs("div", { className: "board-col-header", children: [col.accent && (_jsx("span", { className: "board-col-dot", style: { background: col.accent } })), _jsx("span", { className: "board-col-title", children: col.title }), _jsx("span", { className: "board-col-count", children: colCards.length }), onNewCard && (_jsx("button", { type: "button", className: "board-col-add", "aria-label": `Add to ${col.title}`, onClick: () => onNewCard(col.id), children: "+" }))] }), _jsxs("div", { className: "board-col-body", children: [onNewCard && (_jsxs("button", { type: "button", className: "board-newcard", onClick: () => onNewCard(col.id), children: ["+ ", newCardLabel] })), colCards.map((card) => (_jsx("div", { className: "board-card", draggable: true, "data-dragging": dragId === card.id ? "" : undefined, onDragStart: () => setDragId(card.id), onDragEnd: () => {
|
|
37
|
+
setDragId(null);
|
|
38
|
+
setOverCol(null);
|
|
39
|
+
}, children: renderCard(card) }, card.id)))] })] }, col.id));
|
|
40
|
+
}) }));
|
|
41
|
+
}
|
|
42
|
+
Board.displayName = "Board";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A kanban board — measured from Attio's Deals pipeline: horizontally scrolling
|
|
4
|
+
// columns (dot + title + count header, a "New" button, a stack of draggable
|
|
5
|
+
// cards), with the hovered drop column highlighted.
|
|
6
|
+
const config = defineRecipe({
|
|
7
|
+
name: "board",
|
|
8
|
+
base: `display: flex; gap: ${c.space["3"]}; height: 100%; box-sizing: border-box; padding: ${c.space["3"]}; overflow-x: auto; align-items: flex-start; font-family: ${c.font.sans};
|
|
9
|
+
& .board-col { display: flex; flex-direction: column; width: 280px; flex-shrink: 0; max-height: 100%; box-sizing: border-box; }
|
|
10
|
+
& .board-col-header { display: flex; align-items: center; gap: ${c.space["2"]}; height: 36px; padding: 0 ${c.space["1"]}; flex-shrink: 0; }
|
|
11
|
+
& .board-col-dot { width: 9px; height: 9px; border-radius: ${c.radius.full}; flex-shrink: 0; }
|
|
12
|
+
& .board-col-title { font-size: ${c.text.lg}; font-weight: ${c.weight.semibold}; color: ${c.fgPrimary}; }
|
|
13
|
+
& .board-col-count { font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
14
|
+
& .board-col-add { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: auto; padding: 0; border: none; border-radius: ${c.radius.md}; background: none; color: ${c.fgMuted}; cursor: pointer; }
|
|
15
|
+
& .board-col-add:hover { background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: ${c.fgPrimary}; }
|
|
16
|
+
& .board-col-body { display: flex; flex-direction: column; gap: ${c.space["2"]}; flex: 1; min-height: 48px; padding: ${c.space["1"]}; border-radius: ${c.radius.lg}; overflow-y: auto; transition: background 0.12s; }
|
|
17
|
+
& .board-col[data-over] .board-col-body { background: color-mix(in srgb, ${c.bgBrandSolid} 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgBrandSolid} 30%, transparent); }
|
|
18
|
+
& .board-newcard { display: flex; align-items: center; justify-content: center; gap: ${c.space["1.5"]}; height: 32px; flex-shrink: 0; border: none; border-radius: ${c.radius.md}; background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); color: ${c.fgMuted}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; }
|
|
19
|
+
& .board-newcard:hover { background: color-mix(in srgb, ${c.fgPrimary} 7%, transparent); color: ${c.fgPrimary}; }
|
|
20
|
+
& .board-card { display: flex; flex-direction: column; gap: ${c.space["2"]}; box-sizing: border-box; padding: ${c.space["2.5"]} ${c.space["3"]}; border-radius: ${c.radius.lg}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.borderSubtle}, 0 1px 2px rgba(0,0,0,0.04); cursor: grab; }
|
|
21
|
+
& .board-card:active { cursor: grabbing; }
|
|
22
|
+
& .board-card[data-dragging] { opacity: 0.4; }`,
|
|
23
|
+
variants: {},
|
|
24
|
+
defaultVariants: {},
|
|
25
|
+
compoundVariants: [],
|
|
26
|
+
});
|
|
27
|
+
export const boardRecipe = resolveRecipe(config);
|
|
28
|
+
export default config;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as combobox from "@zag-js/combobox";
|
|
3
|
+
import * as dialog from "@zag-js/dialog";
|
|
4
|
+
import { normalizeProps, Portal, useMachine } from "@zag-js/react";
|
|
5
|
+
import { Building2, CircleDollarSign, House, ListTodo, Search, Settings, SquareCheck, User, UserPlus, } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Kbd } from "../../components/kbd/index.js";
|
|
8
|
+
import { commandRecipe } from "./command.recipe.js";
|
|
9
|
+
const IconHome = () => (_jsx(House, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
10
|
+
const IconTasks = () => (_jsx(SquareCheck, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
11
|
+
const IconCompanies = () => (_jsx(Building2, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
12
|
+
const IconPeople = () => (_jsx(User, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
13
|
+
const IconDeals = () => (_jsx(CircleDollarSign, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
14
|
+
const IconNewPerson = () => (_jsx(UserPlus, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
15
|
+
const IconNewTask = () => (_jsx(ListTodo, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
16
|
+
const IconSearch = () => (_jsx(Search, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
17
|
+
const IconSettings = () => (_jsx(Settings, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
18
|
+
/** crisp's own generic command set (not copied from any product). */
|
|
19
|
+
export const defaultCommandItems = [
|
|
20
|
+
{
|
|
21
|
+
id: "go-home",
|
|
22
|
+
label: "Go to Home",
|
|
23
|
+
icon: IconHome,
|
|
24
|
+
group: "Navigation",
|
|
25
|
+
shortcut: ["G", "H"],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "go-tasks",
|
|
29
|
+
label: "Go to Tasks",
|
|
30
|
+
icon: IconTasks,
|
|
31
|
+
group: "Navigation",
|
|
32
|
+
shortcut: ["G", "T"],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "go-companies",
|
|
36
|
+
label: "Go to Companies",
|
|
37
|
+
icon: IconCompanies,
|
|
38
|
+
group: "Navigation",
|
|
39
|
+
shortcut: ["G", "C"],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "go-people",
|
|
43
|
+
label: "Go to People",
|
|
44
|
+
icon: IconPeople,
|
|
45
|
+
group: "Navigation",
|
|
46
|
+
shortcut: ["G", "P"],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "go-deals",
|
|
50
|
+
label: "Go to Deals",
|
|
51
|
+
icon: IconDeals,
|
|
52
|
+
group: "Navigation",
|
|
53
|
+
shortcut: ["G", "D"],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "new-company",
|
|
57
|
+
label: "New company",
|
|
58
|
+
icon: IconCompanies,
|
|
59
|
+
group: "Create",
|
|
60
|
+
keywords: ["create", "add"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "new-person",
|
|
64
|
+
label: "New person",
|
|
65
|
+
icon: IconNewPerson,
|
|
66
|
+
group: "Create",
|
|
67
|
+
keywords: ["create", "add"],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "new-task",
|
|
71
|
+
label: "New task",
|
|
72
|
+
icon: IconNewTask,
|
|
73
|
+
group: "Create",
|
|
74
|
+
keywords: ["create", "add"],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "search-records",
|
|
78
|
+
label: "Search records…",
|
|
79
|
+
icon: IconSearch,
|
|
80
|
+
group: "Actions",
|
|
81
|
+
keywords: ["find"],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "settings",
|
|
85
|
+
label: "Settings",
|
|
86
|
+
icon: IconSettings,
|
|
87
|
+
group: "Actions",
|
|
88
|
+
keywords: ["preferences"],
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
// A globally unique (process-lifetime) id per mounted instance, rather than
|
|
92
|
+
// React's tree-position-based useId. The dialog/combobox machines defer
|
|
93
|
+
// their outside-click/focus dismissal listeners by a frame, so a rapid
|
|
94
|
+
// unmount+remount that reused useId's tree-relative ids could let a stale
|
|
95
|
+
// registration from a just-unmounted instance resolve (by id) to a new
|
|
96
|
+
// instance's DOM node.
|
|
97
|
+
let instanceCounter = 0;
|
|
98
|
+
function useCommandInstanceId() {
|
|
99
|
+
const idRef = React.useRef(null);
|
|
100
|
+
if (idRef.current == null) {
|
|
101
|
+
instanceCounter += 1;
|
|
102
|
+
idRef.current = `crisp-command-${instanceCounter}`;
|
|
103
|
+
}
|
|
104
|
+
return idRef.current;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* ⌘K command palette. Composes a Zag dialog machine (modal, focus trap,
|
|
108
|
+
* scroll lock) with a Zag combobox machine (filterable, keyboard-navigable
|
|
109
|
+
* option list) so keyboard/focus correctness comes from the machines, not
|
|
110
|
+
* hand-rolled event handling.
|
|
111
|
+
*/
|
|
112
|
+
export function Command({ open, onOpenChange, items = defaultCommandItems, placeholder = "Search actions and records…", }) {
|
|
113
|
+
const instanceId = useCommandInstanceId();
|
|
114
|
+
const dialogId = `${instanceId}-dialog`;
|
|
115
|
+
const comboId = `${instanceId}-combobox`;
|
|
116
|
+
const inputRef = React.useRef(null);
|
|
117
|
+
const [query, setQuery] = React.useState("");
|
|
118
|
+
const dialogService = useMachine(dialog.machine, {
|
|
119
|
+
id: dialogId,
|
|
120
|
+
open,
|
|
121
|
+
onOpenChange(details) {
|
|
122
|
+
onOpenChange(details.open);
|
|
123
|
+
},
|
|
124
|
+
initialFocusEl: () => inputRef.current,
|
|
125
|
+
"aria-label": "Command palette",
|
|
126
|
+
});
|
|
127
|
+
const dlg = dialog.connect(dialogService, normalizeProps);
|
|
128
|
+
const filteredItems = React.useMemo(() => {
|
|
129
|
+
const q = query.trim().toLowerCase();
|
|
130
|
+
if (!q)
|
|
131
|
+
return items;
|
|
132
|
+
return items.filter((item) => item.label.toLowerCase().includes(q) ||
|
|
133
|
+
item.keywords?.some((k) => k.toLowerCase().includes(q)));
|
|
134
|
+
}, [items, query]);
|
|
135
|
+
const collection = React.useMemo(() => combobox.collection({
|
|
136
|
+
items: filteredItems,
|
|
137
|
+
itemToValue: (item) => item.id,
|
|
138
|
+
itemToString: (item) => item.label,
|
|
139
|
+
}), [filteredItems]);
|
|
140
|
+
const comboService = useMachine(combobox.machine, {
|
|
141
|
+
id: comboId,
|
|
142
|
+
collection,
|
|
143
|
+
// The list is always visible while the dialog is open (not a floating
|
|
144
|
+
// popover) — the combobox is only used for its keyboard/filter machine.
|
|
145
|
+
open: true,
|
|
146
|
+
// The dialog already owns escape/outside-click dismissal; avoid a
|
|
147
|
+
// second competing dismissable layer.
|
|
148
|
+
disableLayer: true,
|
|
149
|
+
inputBehavior: "autohighlight",
|
|
150
|
+
closeOnSelect: false,
|
|
151
|
+
onInputValueChange(details) {
|
|
152
|
+
setQuery(details.inputValue);
|
|
153
|
+
},
|
|
154
|
+
onSelect(details) {
|
|
155
|
+
const item = items.find((candidate) => candidate.id === details.itemValue);
|
|
156
|
+
item?.onSelect?.();
|
|
157
|
+
onOpenChange(false);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
const combo = combobox.connect(comboService, normalizeProps);
|
|
161
|
+
// Reset the query/highlight each time the palette opens, so it never
|
|
162
|
+
// reopens showing a stale filter from the previous session.
|
|
163
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: only re-run when `open` flips — `combo` is a fresh object every render.
|
|
164
|
+
React.useLayoutEffect(() => {
|
|
165
|
+
if (!open)
|
|
166
|
+
return;
|
|
167
|
+
setQuery("");
|
|
168
|
+
combo.setInputValue("", "script");
|
|
169
|
+
combo.clearHighlightValue();
|
|
170
|
+
}, [open]);
|
|
171
|
+
// The footer's primary button mirrors the currently highlighted row (Attio
|
|
172
|
+
// shows the active action there and runs it on ↵ / click).
|
|
173
|
+
const highlightedItem = filteredItems.find((item) => item.id === combo.highlightedValue) ??
|
|
174
|
+
filteredItems[0];
|
|
175
|
+
const runItem = (item) => {
|
|
176
|
+
if (!item)
|
|
177
|
+
return;
|
|
178
|
+
item.onSelect?.();
|
|
179
|
+
onOpenChange(false);
|
|
180
|
+
};
|
|
181
|
+
if (!dlg.open)
|
|
182
|
+
return null;
|
|
183
|
+
return (_jsx(Portal, { children: _jsxs("div", { className: commandRecipe(), children: [_jsx("div", { ...dlg.getBackdropProps(), className: "command-backdrop" }), _jsx("div", { ...dlg.getPositionerProps(), className: "command-positioner", children: _jsx("div", { ...dlg.getContentProps(), className: "command-content", children: _jsxs("div", { className: "command-card", children: [_jsxs("div", { className: "command-control", children: [_jsx(IconSearch, {}), _jsx("input", { ref: inputRef, ...combo.getInputProps(), className: "command-input", placeholder: placeholder })] }), _jsx("div", { ...combo.getContentProps(), className: "command-list", children: filteredItems.length === 0 ? (_jsx("div", { className: "command-empty", children: "No matching commands" })) : (filteredItems.map((item, i) => {
|
|
184
|
+
const Icon = item.icon;
|
|
185
|
+
const showGroup = item.group && item.group !== filteredItems[i - 1]?.group;
|
|
186
|
+
return (_jsxs(React.Fragment, { children: [showGroup && (_jsx("div", { className: "command-group-label", "aria-hidden": "true", children: item.group })), _jsxs("div", { ...combo.getItemProps({ item }), className: "command-item", children: [_jsx(Icon, {}), _jsx("span", { className: "command-item-label", children: item.label }), item.shortcut && (_jsx("span", { className: "command-item-shortcut", children: item.shortcut.map((key) => (_jsx(Kbd, { children: key }, key))) }))] })] }, item.id));
|
|
187
|
+
})) }), _jsxs("div", { className: "command-footer", children: [_jsxs("span", { className: "command-footer-nav", children: [_jsx(Kbd, { children: "\u2191" }), _jsx(Kbd, { children: "\u2193" }), "Navigate"] }), _jsxs("button", { type: "button", className: "command-footer-action", disabled: !highlightedItem, onClick: () => runItem(highlightedItem), children: [_jsx("span", { className: "command-footer-action-label", children: highlightedItem?.label ?? "Select" }), _jsx("span", { className: "command-footer-key", children: "\u21B5" })] })] })] }) }) })] }) }));
|
|
188
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
const config = defineRecipe({
|
|
4
|
+
name: "command",
|
|
5
|
+
base: `display: contents; font-family: ${c.font.sans}; & .command-content, & .command-card { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } & .command-backdrop { position: fixed; inset: 0; z-index: 50; background: transparent; } & .command-positioner { position: fixed; inset: 0; z-index: 51; display: flex; align-items: flex-start; justify-content: center; padding: 15vh ${c.space["4"]} ${c.space["4"]}; } & .command-content { position: relative; display: flex; flex-direction: column; box-sizing: border-box; width: 90vw; max-width: 748px; max-height: 70vh; padding: ${c.space["1"]}; border-radius: ${c.radius["2xl"]}; background: color-mix(in srgb, ${c.bgOverlayFrost} 60%, transparent); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); box-shadow: 0 8px 28px -6px ${c.shadowOverlay1}, 0 18px 88px -4px ${c.shadowOverlay2}, 0 0 1px ${c.shadowOverlay3}; opacity: 1; transform: scale(1); transition: opacity 0.2s ease, transform 0.2s ease; @starting-style { opacity: 0; transform: scale(0.97); } } & .command-card { display: flex; flex-direction: column; flex: 1; min-height: 0; box-sizing: border-box; border-radius: ${c.radius.xl}; background: ${c.bgSurface}; box-shadow: 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 8%, transparent); overflow: hidden; } & .command-control { display: flex; align-items: center; gap: ${c.space["2.5"]}; height: 52px; flex-shrink: 0; padding: 0 ${c.space["4"]}; border-bottom: 1px solid ${c.borderSubtle}; color: ${c.fgMuted}; } & .command-control svg { flex-shrink: 0; } & .command-input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: ${c.font.sans}; font-size: ${c.text.xl}; color: ${c.fgPrimary}; } & .command-input::placeholder { color: ${c.fgMuted}; } & .command-list { flex: 1; min-height: 0; overflow-y: auto; padding: ${c.space["1"]} ${c.space["2.5"]}; display: flex; flex-direction: column; gap: ${c.space.px}; } & .command-empty { padding: ${c.space["8"]} ${c.space["3"]}; text-align: center; font-size: ${c.text.md}; color: ${c.fgMuted}; } & .command-item { box-sizing: border-box; display: flex; align-items: center; gap: ${c.space["2"]}; height: 36px; padding-inline: ${c.space["2.5"]}; border-radius: ${c.radius.xl}; font-size: ${c.text.lg}; color: ${c.fgPrimary}; cursor: pointer; } & .command-item svg { flex-shrink: 0; color: ${c.fgMuted}; } & .command-item[data-highlighted] { background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); } & .command-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } & .command-item-shortcut { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; gap: ${c.space["0.5"]}; } & .command-group-label { padding: ${c.space["2"]} ${c.space["2.5"]} ${c.space["1"]}; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); } & .command-list > .command-group-label:first-child { padding-top: ${c.space["1"]}; } & .command-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; height: 44px; padding: 0 ${c.space["2.5"]}; border-top: 1px solid ${c.borderSubtle}; } & .command-footer-nav { display: flex; align-items: center; gap: ${c.space["1.5"]}; font-size: ${c.text.sm}; color: ${c.fgMuted}; } & .command-footer-action { display: flex; align-items: center; gap: ${c.space["2"]}; height: 28px; max-width: 60%; padding: 0 ${c.space["1"]} 0 ${c.space["2.5"]}; border: none; border-radius: ${c.radius.md}; background: ${c.bgBrandSolid}; color: ${c.fgOnBrand}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; } & .command-footer-action:disabled { opacity: 0.5; cursor: default; } & .command-footer-action-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } & .command-footer-key { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.sm}; background: rgba(255,255,255,0.22); font-size: ${c.text.xs}; }`,
|
|
6
|
+
variants: {},
|
|
7
|
+
defaultVariants: {},
|
|
8
|
+
compoundVariants: [],
|
|
9
|
+
});
|
|
10
|
+
export const commandRecipe = Object.assign(resolveRecipe(config), {
|
|
11
|
+
config,
|
|
12
|
+
meta: {
|
|
13
|
+
content: {
|
|
14
|
+
maxWidth: "720px",
|
|
15
|
+
borderRadius: "16px",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export default config;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { entitycardRecipe } from "./entitycard.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* A note / entity card — measured from Attio's Notes grid. A bordered white
|
|
5
|
+
* card with an author row, a title, a clamped excerpt, and a footer row with a
|
|
6
|
+
* right-aligned date. Rendered as a button so the whole card is clickable.
|
|
7
|
+
*/
|
|
8
|
+
export function EntityCard({ author, title, excerpt, footer, date, onClick, "aria-label": ariaLabel, className, }) {
|
|
9
|
+
return (_jsxs("button", { type: "button", className: entitycardRecipe({ className }), onClick: onClick, "aria-label": ariaLabel, children: [author != null && _jsx("span", { className: "entitycard-author", children: author }), _jsx("span", { className: "entitycard-title", children: title }), excerpt != null && _jsx("span", { className: "entitycard-excerpt", children: excerpt }), _jsx("span", { className: "entitycard-spacer" }), (footer != null || date != null) && (_jsxs("span", { className: "entitycard-foot", children: [footer, date != null && _jsx("span", { className: "entitycard-date", children: date })] }))] }));
|
|
10
|
+
}
|
|
11
|
+
EntityCard.displayName = "EntityCard";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A note / entity card — measured from Attio's Notes grid: a bordered white card
|
|
4
|
+
// with an author row (avatar + name) at the top, a title, a clamped excerpt,
|
|
5
|
+
// and a footer row (avatar + name … date). The whole card is clickable.
|
|
6
|
+
const config = defineRecipe({
|
|
7
|
+
name: "entitycard",
|
|
8
|
+
base: `display: flex; flex-direction: column; box-sizing: border-box; width: 100%; min-width: 0; text-align: left;
|
|
9
|
+
padding: ${c.space["3"]} ${c.space["4"]}; margin: 0; border: none; border-radius: ${c.radius.xl};
|
|
10
|
+
background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.borderSubtle}; color: ${c.fgPrimary};
|
|
11
|
+
font-family: ${c.font.sans}; cursor: pointer; transition: box-shadow .12s ease, background-color .12s ease;
|
|
12
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
13
|
+
|
|
14
|
+
&:hover { box-shadow: inset 0 0 0 1px ${c.borderDefault}, 0 1px 2px rgba(0,0,0,0.04), 0 6px 16px -6px rgba(28,40,64,0.12); }
|
|
15
|
+
&:focus-visible { outline: 2px solid ${c.bgBrandSolid}; outline-offset: 2px; }
|
|
16
|
+
|
|
17
|
+
& .entitycard-author { display: inline-flex; align-items: center; gap: ${c.space["1.5"]}; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
|
|
18
|
+
& .entitycard-title { margin-top: ${c.space["2"]}; font-size: ${c.text.lg}; font-weight: ${c.weight.semibold}; letter-spacing: -0.1px; color: ${c.fgPrimary}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
19
|
+
& .entitycard-excerpt { margin-top: ${c.space["1"]}; font-size: ${c.text.md}; line-height: 18px; color: ${c.fgMuted}; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
|
20
|
+
& .entitycard-spacer { flex: 1; min-height: ${c.space["3"]}; }
|
|
21
|
+
& .entitycard-foot { display: flex; align-items: center; gap: ${c.space["1.5"]}; padding-top: ${c.space["2.5"]}; margin-top: ${c.space["1"]}; border-top: 1px solid ${c.borderSubtle}; font-size: ${c.text.sm}; color: ${c.fgMuted}; }
|
|
22
|
+
& .entitycard-foot-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: ${c.fgPrimary}; }
|
|
23
|
+
& .entitycard-date { margin-left: auto; flex-shrink: 0; white-space: nowrap; }`,
|
|
24
|
+
variants: {},
|
|
25
|
+
defaultVariants: {},
|
|
26
|
+
compoundVariants: [],
|
|
27
|
+
});
|
|
28
|
+
export const entitycardRecipe = resolveRecipe(config);
|
|
29
|
+
export default config;
|