@orbitcommerce/constellation-docs 0.0.0-stage → 1.2.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/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +20787 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-Mk1yIWXb.js +129 -0
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/alert-D3i7xZTU.js +914 -0
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/app-shell-D4hdlHps.js +1558 -0
- package/dist/pages/area-chart-BEWFwiB2.js +718 -0
- package/dist/pages/avatar-BFEqQViw.js +895 -0
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/badge-0-PyMrih.js +1035 -0
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/button-DAyfssDY.js +715 -0
- package/dist/pages/calendar-Ds7KsgSI.js +682 -0
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/colour-q2ntvI0w.js +1974 -0
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/date-picker-GdBciR99.js +1569 -0
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/delta-CNAGv8JY.js +779 -0
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/docs-lM2UBSir.js +520 -0
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/icons-CJ9Aar3d.js +736 -0
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/installation-C3UcpQJT.js +528 -0
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/kbd-UNj4zqxn.js +545 -0
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/live-globe-95ROMhGQ.js +715 -0
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/logo-B38rnzoq.js +571 -0
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/menu-NrLYKqKp.js +2132 -0
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/motion-CrXtiBvA.js +865 -0
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/overview-LA9XRhZc.js +130 -0
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/pagination-C1EgVtW4.js +294 -0
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/popover-C3Oar9D5.js +1198 -0
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/principles-pnDyfHpK.js +483 -0
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/release-Cs6tl16C.js +16 -0
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/search-field-D1uG7R6A.js +693 -0
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
- package/dist/pages/select-DZ43NpOm.js +1434 -0
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/separator-CFwqRvfO.js +428 -0
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/shape-DzniHAVT.js +627 -0
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/sparkline-D3aavCly.js +947 -0
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/switch-C93K6j9h.js +617 -0
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/textarea-CCM-SnGN.js +949 -0
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/toast-zXLRiMRT.js +1391 -0
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/tooltip-LHtCUkF-.js +826 -0
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/typography-BSijtiRl.js +876 -0
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +13001 -0
- package/package.json +35 -4
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as DocTable, d as Section$1, i as DocPage, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
3
|
+
import { c as SpecimenFrame, l as TooltipPill } from "./_overlays-specimens-bawR331Z.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Button, IconButton, Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Tooltip, TooltipProvider } from "@orbitcommerce/constellation";
|
|
7
|
+
import { ArchiveIcon, ColumnsIcon, CopyIcon, DotsThreeIcon, EnvelopeSimpleIcon, FloppyDiskIcon, ImageIcon, InfoIcon, KeyboardIcon, LinkSimpleIcon, MagnifyingGlassIcon, PrinterIcon, SidebarSimpleIcon, TextTIcon, TrashIcon, TruckIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/tooltip.tsx
|
|
9
|
+
function Preview() {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "tooltip-still",
|
|
12
|
+
children: [/* @__PURE__ */ jsx(TooltipPill, {
|
|
13
|
+
shortcut: ["mod", "P"],
|
|
14
|
+
children: "Print packing slip"
|
|
15
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
16
|
+
label: "Print packing slip",
|
|
17
|
+
variant: "secondary",
|
|
18
|
+
tabIndex: -1,
|
|
19
|
+
children: /* @__PURE__ */ jsx(PrinterIcon, {})
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** A builder's elements, each an HTML5 drag source: the tip hangs on a wrapper, so the drag keeps the tile's own events. */
|
|
24
|
+
var ELEMENTS = [
|
|
25
|
+
{
|
|
26
|
+
name: "Heading",
|
|
27
|
+
icon: /* @__PURE__ */ jsx(TextTIcon, {}),
|
|
28
|
+
tip: "A title for a section. Drag it onto the page."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "Image",
|
|
32
|
+
icon: /* @__PURE__ */ jsx(ImageIcon, {}),
|
|
33
|
+
tip: "A picture from the media library, at any width. Drag it onto the page."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "Columns",
|
|
37
|
+
icon: /* @__PURE__ */ jsx(ColumnsIcon, {}),
|
|
38
|
+
tip: "Two to four columns side by side, which stack on a phone. Drag it onto the page."
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
function ElementTiles() {
|
|
42
|
+
const [dropped, setDropped] = useState("");
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
className: "tooltip-elements",
|
|
45
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "tooltip-elements__grid",
|
|
47
|
+
children: ELEMENTS.map((element) => /* @__PURE__ */ jsx(Tooltip, {
|
|
48
|
+
wrap: true,
|
|
49
|
+
content: element.tip,
|
|
50
|
+
width: 220,
|
|
51
|
+
side: "bottom",
|
|
52
|
+
delayDuration: 500,
|
|
53
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "tooltip-elements__tile",
|
|
55
|
+
draggable: true,
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
role: "button",
|
|
58
|
+
"aria-label": `${element.name}: drag onto the page`,
|
|
59
|
+
"data-state": "idle",
|
|
60
|
+
onDragStart: (event) => event.dataTransfer.setData("text/plain", element.name),
|
|
61
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
children: element.icon
|
|
64
|
+
}), element.name]
|
|
65
|
+
})
|
|
66
|
+
}, element.name))
|
|
67
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: "tooltip-elements__drop",
|
|
69
|
+
onDragOver: (event) => event.preventDefault(),
|
|
70
|
+
onDrop: (event) => {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
setDropped(event.dataTransfer.getData("text/plain"));
|
|
73
|
+
},
|
|
74
|
+
children: dropped ? `${dropped} added to the page.` : "Drop an element here"
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function OrderToolbar() {
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
className: "tooltip-toolbar",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
83
|
+
content: "Print packing slip",
|
|
84
|
+
shortcut: ["mod", "P"],
|
|
85
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
86
|
+
label: "Print packing slip",
|
|
87
|
+
children: /* @__PURE__ */ jsx(PrinterIcon, {})
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
91
|
+
content: "Email customer",
|
|
92
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
93
|
+
label: "Email customer",
|
|
94
|
+
children: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {})
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
98
|
+
content: "Copy order link",
|
|
99
|
+
shortcut: [
|
|
100
|
+
"mod",
|
|
101
|
+
"shift",
|
|
102
|
+
"C"
|
|
103
|
+
],
|
|
104
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
105
|
+
label: "Copy order link",
|
|
106
|
+
children: /* @__PURE__ */ jsx(LinkSimpleIcon, {})
|
|
107
|
+
})
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "tooltip-toolbar__rule",
|
|
111
|
+
"aria-hidden": "true"
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
114
|
+
content: "Archive order",
|
|
115
|
+
shortcut: ["E"],
|
|
116
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
117
|
+
label: "Archive order",
|
|
118
|
+
children: /* @__PURE__ */ jsx(ArchiveIcon, {})
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Tooltips held open for review. Real tooltips; `hideWhenDetached` hides them once their trigger scrolls out of view. */
|
|
125
|
+
function HeldOpen() {
|
|
126
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "tooltip-held",
|
|
128
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
129
|
+
content: "Print packing slip",
|
|
130
|
+
shortcut: ["mod", "P"],
|
|
131
|
+
open: true,
|
|
132
|
+
hideWhenDetached: true,
|
|
133
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
134
|
+
label: "Print packing slip",
|
|
135
|
+
variant: "secondary",
|
|
136
|
+
children: /* @__PURE__ */ jsx(PrinterIcon, {})
|
|
137
|
+
})
|
|
138
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
139
|
+
content: "Saves your changes without publishing them",
|
|
140
|
+
side: "bottom",
|
|
141
|
+
open: true,
|
|
142
|
+
hideWhenDetached: true,
|
|
143
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Save draft" })
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function MoreActions() {
|
|
148
|
+
const [open, setOpen] = useState(false);
|
|
149
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
150
|
+
open,
|
|
151
|
+
onOpenChange: setOpen,
|
|
152
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
153
|
+
content: "More actions",
|
|
154
|
+
disabled: open,
|
|
155
|
+
children: /* @__PURE__ */ jsx(MenuTrigger, {
|
|
156
|
+
asChild: true,
|
|
157
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
158
|
+
label: "More actions",
|
|
159
|
+
variant: "secondary",
|
|
160
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
164
|
+
align: "end",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
167
|
+
icon: /* @__PURE__ */ jsx(TruckIcon, {}),
|
|
168
|
+
children: "Mark as fulfilled"
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
171
|
+
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
172
|
+
children: "Duplicate order"
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
175
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
176
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
177
|
+
tone: "critical",
|
|
178
|
+
children: "Delete order"
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function ProviderToolbar() {
|
|
185
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
186
|
+
className: "tooltip-toolbar",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
189
|
+
content: "Save",
|
|
190
|
+
shortcut: ["mod", "S"],
|
|
191
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
192
|
+
label: "Save",
|
|
193
|
+
children: /* @__PURE__ */ jsx(FloppyDiskIcon, {})
|
|
194
|
+
})
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
197
|
+
content: "Duplicate",
|
|
198
|
+
shortcut: [
|
|
199
|
+
"mod",
|
|
200
|
+
"shift",
|
|
201
|
+
"D"
|
|
202
|
+
],
|
|
203
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
204
|
+
label: "Duplicate",
|
|
205
|
+
children: /* @__PURE__ */ jsx(CopyIcon, {})
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
209
|
+
content: "Print packing slip",
|
|
210
|
+
shortcut: ["mod", "P"],
|
|
211
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
212
|
+
label: "Print packing slip",
|
|
213
|
+
children: /* @__PURE__ */ jsx(PrinterIcon, {})
|
|
214
|
+
})
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
217
|
+
content: "Archive order",
|
|
218
|
+
shortcut: ["E"],
|
|
219
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
220
|
+
label: "Archive order",
|
|
221
|
+
children: /* @__PURE__ */ jsx(ArchiveIcon, {})
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function Page() {
|
|
228
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
229
|
+
title: "Tooltip",
|
|
230
|
+
status: "stable",
|
|
231
|
+
importNames: ["Tooltip", "TooltipProvider"],
|
|
232
|
+
lead: "A short label on an inverse pill that names a control, usually an icon button, and can show its keyboard shortcut. It grows out of its trigger on hover or keyboard focus, and never holds anything you need to read to get on.",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
235
|
+
id: "basics",
|
|
236
|
+
title: "Basics",
|
|
237
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
238
|
+
"Wrap the control in a ",
|
|
239
|
+
/* @__PURE__ */ jsx("code", { children: "Tooltip" }),
|
|
240
|
+
" and give it ",
|
|
241
|
+
/* @__PURE__ */ jsx("code", { children: "content" }),
|
|
242
|
+
". The pill grows out of its trigger in 140ms, drifting 3px away from it, with no arrow: the growth shows where it came from. Hover or tab along the toolbar."
|
|
243
|
+
] }),
|
|
244
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
245
|
+
minHeight: 200,
|
|
246
|
+
code: `
|
|
247
|
+
<Tooltip content="Print packing slip" shortcut={['mod', 'P']}>
|
|
248
|
+
<IconButton label="Print packing slip"><PrinterIcon /></IconButton>
|
|
249
|
+
</Tooltip>
|
|
250
|
+
<Tooltip content="Email customer">
|
|
251
|
+
<IconButton label="Email customer"><EnvelopeSimpleIcon /></IconButton>
|
|
252
|
+
</Tooltip>
|
|
253
|
+
<Tooltip content="Copy order link" shortcut={['mod', 'shift', 'C']}>
|
|
254
|
+
<IconButton label="Copy order link"><LinkSimpleIcon /></IconButton>
|
|
255
|
+
</Tooltip>
|
|
256
|
+
<Tooltip content="Archive order" shortcut={['E']}>
|
|
257
|
+
<IconButton label="Archive order"><ArchiveIcon /></IconButton>
|
|
258
|
+
</Tooltip>`,
|
|
259
|
+
children: /* @__PURE__ */ jsx(OrderToolbar, {})
|
|
260
|
+
})
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
263
|
+
id: "both-themes",
|
|
264
|
+
title: "In both themes",
|
|
265
|
+
description: /* @__PURE__ */ jsx("p", { children: "Held open for review: real tooltips, one with keycaps and one long enough to wrap. It is an inverse pill: graphite with frost text in light, and pale with ink text in dark, so it stands off either page. One line is an exact pill; wrapped text becomes a softly rounded rectangle." }),
|
|
266
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
267
|
+
minHeight: 240,
|
|
268
|
+
children: /* @__PURE__ */ jsx(HeldOpen, {})
|
|
269
|
+
})
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
272
|
+
id: "sides",
|
|
273
|
+
title: "Sides",
|
|
274
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
275
|
+
/* @__PURE__ */ jsx("code", { children: "side" }),
|
|
276
|
+
" picks where it prefers to open: ",
|
|
277
|
+
/* @__PURE__ */ jsx("code", { children: "top" }),
|
|
278
|
+
" (the default), ",
|
|
279
|
+
/* @__PURE__ */ jsx("code", { children: "right" }),
|
|
280
|
+
",",
|
|
281
|
+
" ",
|
|
282
|
+
/* @__PURE__ */ jsx("code", { children: "bottom" }),
|
|
283
|
+
" or ",
|
|
284
|
+
/* @__PURE__ */ jsx("code", { children: "left" }),
|
|
285
|
+
". It flips to the other side when there is no room and keeps 8px inside the window. Use ",
|
|
286
|
+
/* @__PURE__ */ jsx("code", { children: "right" }),
|
|
287
|
+
" beside a folded sidebar and ",
|
|
288
|
+
/* @__PURE__ */ jsx("code", { children: "bottom" }),
|
|
289
|
+
" under a header."
|
|
290
|
+
] }),
|
|
291
|
+
children: [/* @__PURE__ */ jsxs(Example, {
|
|
292
|
+
minHeight: 200,
|
|
293
|
+
code: `
|
|
294
|
+
<Tooltip content="Opens above"><Button>Top</Button></Tooltip>
|
|
295
|
+
<Tooltip content="Opens to the right" side="right"><Button>Right</Button></Tooltip>
|
|
296
|
+
<Tooltip content="Opens below" side="bottom"><Button>Bottom</Button></Tooltip>
|
|
297
|
+
<Tooltip content="Opens to the left" side="left"><Button>Left</Button></Tooltip>`,
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
300
|
+
content: "Opens above",
|
|
301
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Top" })
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
304
|
+
content: "Opens to the right",
|
|
305
|
+
side: "right",
|
|
306
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Right" })
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
309
|
+
content: "Opens below",
|
|
310
|
+
side: "bottom",
|
|
311
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Bottom" })
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
314
|
+
content: "Opens to the left",
|
|
315
|
+
side: "left",
|
|
316
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Left" })
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
320
|
+
title: "Alignment",
|
|
321
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
322
|
+
/* @__PURE__ */ jsx("code", { children: "align" }),
|
|
323
|
+
" lines the pill up with the ",
|
|
324
|
+
/* @__PURE__ */ jsx("code", { children: "start" }),
|
|
325
|
+
", ",
|
|
326
|
+
/* @__PURE__ */ jsx("code", { children: "center" }),
|
|
327
|
+
" (the default) or",
|
|
328
|
+
" ",
|
|
329
|
+
/* @__PURE__ */ jsx("code", { children: "end" }),
|
|
330
|
+
" of its trigger. It matters on wide triggers."
|
|
331
|
+
] }),
|
|
332
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
333
|
+
minHeight: 180,
|
|
334
|
+
code: `
|
|
335
|
+
<Tooltip content="Lined up with the start" align="start"><Button style={{ minWidth: 220 }}>Start</Button></Tooltip>
|
|
336
|
+
<Tooltip content="Centred on the trigger"><Button style={{ minWidth: 220 }}>Centre</Button></Tooltip>
|
|
337
|
+
<Tooltip content="Lined up with the end" align="end"><Button style={{ minWidth: 220 }}>End</Button></Tooltip>`,
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
340
|
+
content: "Lined up with the start",
|
|
341
|
+
align: "start",
|
|
342
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
343
|
+
style: { minWidth: 220 },
|
|
344
|
+
children: "Start"
|
|
345
|
+
})
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
348
|
+
content: "Centred on the trigger",
|
|
349
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
350
|
+
style: { minWidth: 220 },
|
|
351
|
+
children: "Centre"
|
|
352
|
+
})
|
|
353
|
+
}),
|
|
354
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
355
|
+
content: "Lined up with the end",
|
|
356
|
+
align: "end",
|
|
357
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
358
|
+
style: { minWidth: 220 },
|
|
359
|
+
children: "End"
|
|
360
|
+
})
|
|
361
|
+
})
|
|
362
|
+
]
|
|
363
|
+
})
|
|
364
|
+
})]
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
367
|
+
id: "shortcuts",
|
|
368
|
+
title: "Shortcuts",
|
|
369
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
370
|
+
/* @__PURE__ */ jsx("code", { children: "shortcut" }),
|
|
371
|
+
" adds keycaps after the text, restyled for the inverse pill. Keys take friendly names that read right on every platform: ",
|
|
372
|
+
/* @__PURE__ */ jsx("code", { children: "mod" }),
|
|
373
|
+
" is ⌘ on a Mac and Ctrl elsewhere, and ",
|
|
374
|
+
/* @__PURE__ */ jsx("code", { children: "shift" }),
|
|
375
|
+
",",
|
|
376
|
+
" ",
|
|
377
|
+
/* @__PURE__ */ jsx("code", { children: "alt" }),
|
|
378
|
+
", ",
|
|
379
|
+
/* @__PURE__ */ jsx("code", { children: "enter" }),
|
|
380
|
+
", ",
|
|
381
|
+
/* @__PURE__ */ jsx("code", { children: "esc" }),
|
|
382
|
+
" and the arrows become their symbols on a Mac. Single letters are capitalised. The caps are only drawn: bind the keys in the app."
|
|
383
|
+
] }),
|
|
384
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
385
|
+
minHeight: 200,
|
|
386
|
+
code: `
|
|
387
|
+
<Tooltip content="Save" shortcut={['mod', 'S']}>…</Tooltip>
|
|
388
|
+
<Tooltip content="Search" shortcut={['mod', 'K']}>…</Tooltip>
|
|
389
|
+
<Tooltip content="Duplicate" shortcut={['mod', 'shift', 'D']}>…</Tooltip>
|
|
390
|
+
<Tooltip content="Collapse sidebar" shortcut={['[']}>…</Tooltip>
|
|
391
|
+
<Tooltip content="Keyboard shortcuts" shortcut={['?']}>…</Tooltip>`,
|
|
392
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
393
|
+
className: "tooltip-toolbar",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
396
|
+
content: "Save",
|
|
397
|
+
shortcut: ["mod", "S"],
|
|
398
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
399
|
+
label: "Save",
|
|
400
|
+
children: /* @__PURE__ */ jsx(FloppyDiskIcon, {})
|
|
401
|
+
})
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
404
|
+
content: "Search",
|
|
405
|
+
shortcut: ["mod", "K"],
|
|
406
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
407
|
+
label: "Search",
|
|
408
|
+
children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {})
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
412
|
+
content: "Duplicate",
|
|
413
|
+
shortcut: [
|
|
414
|
+
"mod",
|
|
415
|
+
"shift",
|
|
416
|
+
"D"
|
|
417
|
+
],
|
|
418
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
419
|
+
label: "Duplicate",
|
|
420
|
+
children: /* @__PURE__ */ jsx(CopyIcon, {})
|
|
421
|
+
})
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
424
|
+
content: "Collapse sidebar",
|
|
425
|
+
shortcut: ["["],
|
|
426
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
427
|
+
label: "Collapse sidebar",
|
|
428
|
+
children: /* @__PURE__ */ jsx(SidebarSimpleIcon, {})
|
|
429
|
+
})
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
432
|
+
content: "Keyboard shortcuts",
|
|
433
|
+
shortcut: ["?"],
|
|
434
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
435
|
+
label: "Keyboard shortcuts",
|
|
436
|
+
children: /* @__PURE__ */ jsx(KeyboardIcon, {})
|
|
437
|
+
})
|
|
438
|
+
})
|
|
439
|
+
]
|
|
440
|
+
})
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
444
|
+
id: "long-text",
|
|
445
|
+
title: "Long text",
|
|
446
|
+
description: /* @__PURE__ */ jsx("p", { children: "A tooltip stops at 260px and wraps, its lines filling the pill so it hugs its words, with no word left alone on the last line. Keep it to a short phrase; a sentence is the most it should ever hold." }),
|
|
447
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
448
|
+
minHeight: 200,
|
|
449
|
+
code: `
|
|
450
|
+
<Tooltip content="Includes stock in transit between your warehouses">
|
|
451
|
+
<IconButton label="About stock counts"><InfoIcon /></IconButton>
|
|
452
|
+
</Tooltip>`,
|
|
453
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
454
|
+
content: "Includes stock in transit between your warehouses",
|
|
455
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
456
|
+
label: "About stock counts",
|
|
457
|
+
variant: "secondary",
|
|
458
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
459
|
+
})
|
|
460
|
+
})
|
|
461
|
+
})
|
|
462
|
+
}),
|
|
463
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
464
|
+
id: "delay",
|
|
465
|
+
title: "Delay",
|
|
466
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
467
|
+
"A tooltip waits 350ms under a resting pointer before it opens, so sweeping across the page does not set off a trail of them. ",
|
|
468
|
+
/* @__PURE__ */ jsx("code", { children: "delayDuration" }),
|
|
469
|
+
" changes the wait for one tooltip; 0 opens it at once. Keyboard focus never waits."
|
|
470
|
+
] }),
|
|
471
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
472
|
+
minHeight: 180,
|
|
473
|
+
code: `
|
|
474
|
+
<Tooltip content="Opens at once" delayDuration={0}><Button>No delay</Button></Tooltip>
|
|
475
|
+
<Tooltip content="Opens after 350ms"><Button>Default</Button></Tooltip>
|
|
476
|
+
<Tooltip content="Opens after 700ms" delayDuration={700}><Button>Slow</Button></Tooltip>`,
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
479
|
+
content: "Opens at once",
|
|
480
|
+
delayDuration: 0,
|
|
481
|
+
children: /* @__PURE__ */ jsx(Button, { children: "No delay" })
|
|
482
|
+
}),
|
|
483
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
484
|
+
content: "Opens after 350ms",
|
|
485
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Default" })
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
488
|
+
content: "Opens after 700ms",
|
|
489
|
+
delayDuration: 700,
|
|
490
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Slow" })
|
|
491
|
+
})
|
|
492
|
+
]
|
|
493
|
+
})
|
|
494
|
+
}),
|
|
495
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
496
|
+
id: "provider",
|
|
497
|
+
title: "Provider",
|
|
498
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
499
|
+
/* @__PURE__ */ jsx("code", { children: "TooltipProvider" }),
|
|
500
|
+
" shares timing between the tooltips inside it. Once one has opened, moving to a neighbour within 150ms (",
|
|
501
|
+
/* @__PURE__ */ jsx("code", { children: "skipDelayDuration" }),
|
|
502
|
+
") opens it straight away with a quick fade instead of the grow, which is what makes a toolbar feel quick. Wrap the app once; these docs do. A tooltip outside any provider brings its own with the same defaults."
|
|
503
|
+
] }),
|
|
504
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
505
|
+
code: `
|
|
506
|
+
// Once, near the root of the app
|
|
507
|
+
<TooltipProvider>
|
|
508
|
+
<App />
|
|
509
|
+
</TooltipProvider>
|
|
510
|
+
|
|
511
|
+
// A toolbar where every tooltip waits the full delay
|
|
512
|
+
<TooltipProvider skipDelayDuration={0}>
|
|
513
|
+
<Toolbar />
|
|
514
|
+
</TooltipProvider>`,
|
|
515
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
516
|
+
className: "tooltip-rows",
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(ProviderToolbar, {}) }),
|
|
519
|
+
/* @__PURE__ */ jsx("p", {
|
|
520
|
+
className: "tooltip-pair-label",
|
|
521
|
+
children: "Shared timing: sweep along, and each next tooltip opens at once"
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ jsx(TooltipProvider, {
|
|
524
|
+
skipDelayDuration: 0,
|
|
525
|
+
children: /* @__PURE__ */ jsx(ProviderToolbar, {})
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ jsx("p", {
|
|
528
|
+
className: "tooltip-pair-label",
|
|
529
|
+
children: "skipDelayDuration={0}: each one waits its full delay"
|
|
530
|
+
})
|
|
531
|
+
]
|
|
532
|
+
})
|
|
533
|
+
})
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
536
|
+
id: "disabled",
|
|
537
|
+
title: "Disabled",
|
|
538
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
539
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
540
|
+
" keeps a tooltip closed without unmounting anything, so the trigger keeps focus. Use it while a menu from the same trigger is open, so the label does not sit on top of the menu. A tooltip with empty ",
|
|
541
|
+
/* @__PURE__ */ jsx("code", { children: "content" }),
|
|
542
|
+
" never opens either, which suits a label that only sometimes applies."
|
|
543
|
+
] }),
|
|
544
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
545
|
+
minHeight: 260,
|
|
546
|
+
code: `
|
|
547
|
+
const [open, setOpen] = useState(false)
|
|
548
|
+
|
|
549
|
+
<Menu open={open} onOpenChange={setOpen}>
|
|
550
|
+
<Tooltip content="More actions" disabled={open}>
|
|
551
|
+
<MenuTrigger asChild>
|
|
552
|
+
<IconButton label="More actions" variant="secondary">
|
|
553
|
+
<DotsThreeIcon weight="bold" />
|
|
554
|
+
</IconButton>
|
|
555
|
+
</MenuTrigger>
|
|
556
|
+
</Tooltip>
|
|
557
|
+
<MenuContent align="end">…</MenuContent>
|
|
558
|
+
</Menu>`,
|
|
559
|
+
children: /* @__PURE__ */ jsx(MoreActions, {})
|
|
560
|
+
})
|
|
561
|
+
}),
|
|
562
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
563
|
+
id: "on-a-press",
|
|
564
|
+
title: "Open on a press",
|
|
565
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
566
|
+
"A touch screen has no hover, so an ordinary tip never opens there. ",
|
|
567
|
+
/* @__PURE__ */ jsx("code", { children: "openOnPress" }),
|
|
568
|
+
" opens it on a tap as well, and keeps it open through a click or Enter, which close an ordinary tip; a second tap or a press anywhere else puts it away. Use it for a trigger whose press does nothing else, such as a button that is off with a reason: ",
|
|
569
|
+
/* @__PURE__ */ jsx("code", { children: "Button" }),
|
|
570
|
+
"'s ",
|
|
571
|
+
/* @__PURE__ */ jsx("code", { children: "disabledReason" }),
|
|
572
|
+
" turns it on by itself."
|
|
573
|
+
] }),
|
|
574
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
575
|
+
code: `
|
|
576
|
+
<Tooltip content="Only the store owner can change the plan." openOnPress>
|
|
577
|
+
<IconButton label="Why can I not change the plan?" variant="secondary">
|
|
578
|
+
<InfoIcon />
|
|
579
|
+
</IconButton>
|
|
580
|
+
</Tooltip>
|
|
581
|
+
<Button disabledReason="Add a different card first, then remove this one.">Remove card</Button>`,
|
|
582
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
583
|
+
content: "Only the store owner can change the plan.",
|
|
584
|
+
openOnPress: true,
|
|
585
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
586
|
+
label: "Why can I not change the plan?",
|
|
587
|
+
variant: "secondary",
|
|
588
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
589
|
+
})
|
|
590
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
591
|
+
disabledReason: "Add a different card first, then remove this one.",
|
|
592
|
+
children: "Remove card"
|
|
593
|
+
})]
|
|
594
|
+
})
|
|
595
|
+
}),
|
|
596
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
597
|
+
id: "drag-sources",
|
|
598
|
+
title: "On a drag source",
|
|
599
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
600
|
+
"A tip hangs on its trigger and writes its own ",
|
|
601
|
+
/* @__PURE__ */ jsx("code", { children: "data-state" }),
|
|
602
|
+
" and ",
|
|
603
|
+
/* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
|
|
604
|
+
" onto it, which a drag library owns on a drag source (a builder's element tiles, an HTML5 draggable).",
|
|
605
|
+
" ",
|
|
606
|
+
/* @__PURE__ */ jsx("code", { children: "wrap" }),
|
|
607
|
+
" hangs the tip on a wrapper round the child instead, so the child keeps its own ref, events and attributes. The tip closes as a drag starts and stays shut until it ends. ",
|
|
608
|
+
/* @__PURE__ */ jsx("code", { children: "width" }),
|
|
609
|
+
" gives a tip of a sentence or two a width of its own. Hover a tile, then drag it to the box."
|
|
610
|
+
] }),
|
|
611
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
612
|
+
align: "fill",
|
|
613
|
+
code: `
|
|
614
|
+
<Tooltip wrap content="A picture from the media library, at any width. Drag it onto the page." width={220} delayDuration={500}>
|
|
615
|
+
<div draggable ref={(node) => connectors.create(node, <Image />)}>Image</div>
|
|
616
|
+
</Tooltip>`,
|
|
617
|
+
children: /* @__PURE__ */ jsx(ElementTiles, {})
|
|
618
|
+
})
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
621
|
+
id: "keyboard-and-touch",
|
|
622
|
+
title: "Keyboard and touch",
|
|
623
|
+
description: /* @__PURE__ */ jsx("p", { children: "How a tooltip opens and closes beyond the mouse." }),
|
|
624
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
625
|
+
columns: ["", "What happens"],
|
|
626
|
+
rows: [
|
|
627
|
+
["Keyboard focus", "Opens at once, with no delay. Moving focus away closes it."],
|
|
628
|
+
["Tabbing to a trigger off screen", "The trigger scrolls into view and its tooltip stays open. (The underlying Radix tooltip closes when its trigger scrolls; this one stays open when keyboard focus has only just opened it.)"],
|
|
629
|
+
["Escape", "Closes it and leaves focus on the trigger."],
|
|
630
|
+
["Pressing the trigger", "Closes it, and a click does not reopen it until the pointer leaves and comes back. With openOnPress a press opens it and keeps it open."],
|
|
631
|
+
["Moving onto the tooltip", "It stays open, so it can be read at a large zoom. disableHoverableContent on the provider turns this off."],
|
|
632
|
+
["Touch", "Never opens: there is no hover, and a tap runs the control. Anything only in a tooltip is lost on a phone, unless openOnPress opens it on a tap (a button off with a reason does)."]
|
|
633
|
+
]
|
|
634
|
+
})
|
|
635
|
+
}),
|
|
636
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
637
|
+
id: "guidelines",
|
|
638
|
+
title: "When not to use one",
|
|
639
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
640
|
+
do: {
|
|
641
|
+
children: /* @__PURE__ */ jsxs(SpecimenFrame, {
|
|
642
|
+
className: "tooltip-still",
|
|
643
|
+
children: [/* @__PURE__ */ jsx(TooltipPill, {
|
|
644
|
+
shortcut: ["mod", "P"],
|
|
645
|
+
children: "Print packing slip"
|
|
646
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
647
|
+
label: "Print packing slip",
|
|
648
|
+
variant: "secondary",
|
|
649
|
+
children: /* @__PURE__ */ jsx(PrinterIcon, {})
|
|
650
|
+
})]
|
|
651
|
+
}),
|
|
652
|
+
caption: "Name an icon-only control, and show its shortcut. The label says what pressing it does."
|
|
653
|
+
},
|
|
654
|
+
dont: {
|
|
655
|
+
children: /* @__PURE__ */ jsxs(SpecimenFrame, {
|
|
656
|
+
className: "tooltip-still",
|
|
657
|
+
children: [/* @__PURE__ */ jsx(TooltipPill, { children: "Add a payment method before you can publish" }), /* @__PURE__ */ jsx(Button, {
|
|
658
|
+
variant: "primary",
|
|
659
|
+
disabled: true,
|
|
660
|
+
children: "Publish"
|
|
661
|
+
})]
|
|
662
|
+
}),
|
|
663
|
+
caption: "A disabled button cannot be hovered or focused, so this never shows, and touch users never see a tooltip at all. Say it on the page."
|
|
664
|
+
}
|
|
665
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
666
|
+
"Never put essential information in a tooltip: why something is off, a price, an error or a warning belongs on the page.",
|
|
667
|
+
"Nothing interactive inside. A link or a button in a tooltip cannot be reached.",
|
|
668
|
+
"A few words in sentence case, with no full stop. If it needs a second sentence, it wants to be on the page.",
|
|
669
|
+
"Do not repeat a visible label. A button that says \"Export\" needs no tooltip saying \"Export\".",
|
|
670
|
+
"Match the tooltip to the icon button's label, so what people see and what screen readers say agree."
|
|
671
|
+
] })]
|
|
672
|
+
}),
|
|
673
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
674
|
+
id: "accessibility",
|
|
675
|
+
title: "Accessibility",
|
|
676
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
677
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
678
|
+
"Built on Radix Tooltip. While it is open the tooltip has ",
|
|
679
|
+
/* @__PURE__ */ jsx("code", { children: "role=\"tooltip\"" }),
|
|
680
|
+
" and the trigger points at it with ",
|
|
681
|
+
/* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
|
|
682
|
+
", so its text is read as the trigger's description. The trigger's own name (an ",
|
|
683
|
+
/* @__PURE__ */ jsx("code", { children: "IconButton" }),
|
|
684
|
+
"'s ",
|
|
685
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
686
|
+
") is still what names it."
|
|
687
|
+
] }),
|
|
688
|
+
"It opens on keyboard focus as well as hover, closes on Escape, and stays open while the pointer moves onto it.",
|
|
689
|
+
"Focus that comes back to its trigger without the keyboard, as a menu or a dialog hands it back after a mouse choice, does not open it. A menu or popover trigger keeps its open look under a tooltip.",
|
|
690
|
+
"Symbol keycaps carry spoken names, so ⌘ is read as \"Command\".",
|
|
691
|
+
"The trigger must take a ref and props: the kit's buttons do. Wrap anything else in an element that can.",
|
|
692
|
+
"With reduced motion it fades in and out without growing or drifting."
|
|
693
|
+
] })
|
|
694
|
+
}),
|
|
695
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
696
|
+
id: "props",
|
|
697
|
+
title: "Props",
|
|
698
|
+
children: [/* @__PURE__ */ jsx(PropsTable, {
|
|
699
|
+
title: "Tooltip",
|
|
700
|
+
rows: [
|
|
701
|
+
{
|
|
702
|
+
name: "content",
|
|
703
|
+
type: "ReactNode",
|
|
704
|
+
required: true,
|
|
705
|
+
description: "What it says. Keep it short; nothing interactive. Empty content never opens."
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
name: "children",
|
|
709
|
+
type: "ReactElement",
|
|
710
|
+
required: true,
|
|
711
|
+
description: "The trigger. It must take a ref and props, as the kit's buttons do."
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: "side",
|
|
715
|
+
type: "'top' | 'right' | 'bottom' | 'left'",
|
|
716
|
+
default: "'top'",
|
|
717
|
+
description: "Preferred side. Flips when there is no room."
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "align",
|
|
721
|
+
type: "'start' | 'center' | 'end'",
|
|
722
|
+
default: "'center'",
|
|
723
|
+
description: "Which part of the trigger it lines up with."
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
name: "shortcut",
|
|
727
|
+
type: "string[]",
|
|
728
|
+
description: "Keycaps after the text, e.g. ['mod', 'K']."
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "disabled",
|
|
732
|
+
type: "boolean",
|
|
733
|
+
default: "false",
|
|
734
|
+
description: "Keeps it closed, e.g. while a menu from the same trigger is open."
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
name: "delayDuration",
|
|
738
|
+
type: "number",
|
|
739
|
+
description: "Hover wait in ms for this tooltip. Defaults to the provider's 350."
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
name: "open",
|
|
743
|
+
type: "boolean",
|
|
744
|
+
description: "Controlled open state."
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: "defaultOpen",
|
|
748
|
+
type: "boolean",
|
|
749
|
+
default: "false",
|
|
750
|
+
description: "Starting state when uncontrolled."
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "onOpenChange",
|
|
754
|
+
type: "(open: boolean) => void",
|
|
755
|
+
description: "Called when it opens or closes."
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: "sideOffset",
|
|
759
|
+
type: "number",
|
|
760
|
+
default: "6",
|
|
761
|
+
description: "Gap from the trigger in px."
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
name: "collisionPadding",
|
|
765
|
+
type: "number",
|
|
766
|
+
default: "8",
|
|
767
|
+
description: "Space kept from the edges of the window."
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
name: "openOnPress",
|
|
771
|
+
type: "boolean",
|
|
772
|
+
default: "false",
|
|
773
|
+
description: "Opens on a tap, and stays open through a click or Enter; a second tap or a press elsewhere closes it."
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: "wrap",
|
|
777
|
+
type: "boolean",
|
|
778
|
+
default: "false",
|
|
779
|
+
description: "Hangs the tip on a wrapper round the child, so a drag source keeps its own ref and events; closes as a drag starts."
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "wrapperClassName",
|
|
783
|
+
type: "string",
|
|
784
|
+
description: "A class for the wrapper wrap draws."
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
name: "width",
|
|
788
|
+
type: "number",
|
|
789
|
+
description: "A width of its own for the tip, in px."
|
|
790
|
+
}
|
|
791
|
+
]
|
|
792
|
+
}), /* @__PURE__ */ jsx(PropsTable, {
|
|
793
|
+
title: "TooltipProvider",
|
|
794
|
+
rows: [
|
|
795
|
+
{
|
|
796
|
+
name: "children",
|
|
797
|
+
type: "ReactNode",
|
|
798
|
+
required: true,
|
|
799
|
+
description: "The app, or a toolbar."
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: "delayDuration",
|
|
803
|
+
type: "number",
|
|
804
|
+
default: "350",
|
|
805
|
+
description: "Hover wait in ms before the first tooltip opens."
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
name: "skipDelayDuration",
|
|
809
|
+
type: "number",
|
|
810
|
+
default: "150",
|
|
811
|
+
description: "Window in ms in which moving to another trigger opens its tooltip at once."
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
name: "disableHoverableContent",
|
|
815
|
+
type: "boolean",
|
|
816
|
+
default: "false",
|
|
817
|
+
description: "Close as soon as the pointer leaves the trigger, even towards the tooltip."
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
})]
|
|
821
|
+
})
|
|
822
|
+
]
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
//#endregion
|
|
826
|
+
export { Page, Preview };
|