@orbitcommerce/constellation-docs 1.0.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- 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-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- 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-BvxQWBTy.js +403 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- 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-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CXZ3V1d4.js +1612 -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-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- 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-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- 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-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- 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-hg7txTc3.js +1381 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- 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-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- 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-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- 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-DpsX8G_n.js → installation-DRUWNVHP.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- 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-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- 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-BfGF1Pq9.js → logo-D3a3QGKJ.js} +13 -13
- 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-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- 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-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-BSfEqHY8.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- 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-BCPvtP8J.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- 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-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- 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-CkdBWWfG.js → radio-group-CbiibLwn.js} +581 -18
- 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-CNR7zpf7.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-DYBCY7jm.js} +4 -1
- 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-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- 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-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- 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-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- 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-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- 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-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-mq_pNXza.js +3232 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Cf4MZ8Fq.js} +257 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- 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-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- 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-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- 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 +10989 -1108
- package/package.json +3 -3
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { MenuItem, MenuSeparator, Toolbar, ToolbarButton, ToolbarGroup, ToolbarItem, ToolbarMenu, ToolbarSelect, ToolbarSpacer } from "@orbitcommerce/constellation";
|
|
7
|
+
import { ArrowSquareOutIcon, ArrowUUpLeftIcon, ArrowUUpRightIcon, ArrowsDownUpIcon, CodeIcon, CursorClickIcon, DotsThreeVerticalIcon, EyeIcon, EyeSlashIcon, FloppyDiskIcon, HandIcon, LinkSimpleIcon, ListBulletsIcon, ListNumbersIcon, PaletteIcon, SelectionIcon, StackIcon, TextAlignCenterIcon, TextAlignLeftIcon, TextAlignRightIcon, TextBIcon, TextItalicIcon, TextTIcon, TextUnderlineIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/toolbar.tsx
|
|
9
|
+
var STYLES = [
|
|
10
|
+
{
|
|
11
|
+
value: "p",
|
|
12
|
+
label: "Paragraph"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "h2",
|
|
16
|
+
label: "Heading 2"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "h3",
|
|
20
|
+
label: "Heading 3"
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
/** The marks of an editor's toolbar, each a toggle that remembers its own state. */
|
|
24
|
+
function useMarks(initial) {
|
|
25
|
+
const [on, setOn] = useState(initial);
|
|
26
|
+
const toggle = (mark) => setOn((marks) => marks.includes(mark) ? marks.filter((m) => m !== mark) : [...marks, mark]);
|
|
27
|
+
return {
|
|
28
|
+
on,
|
|
29
|
+
toggle
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function EditorToolbar({ size, wrap }) {
|
|
33
|
+
const { on, toggle } = useMarks(["bold"]);
|
|
34
|
+
const [style, setStyle] = useState("p");
|
|
35
|
+
const [align, setAlign] = useState("left");
|
|
36
|
+
const [source, setSource] = useState(false);
|
|
37
|
+
return /* @__PURE__ */ jsxs(Toolbar, {
|
|
38
|
+
label: "Formatting",
|
|
39
|
+
surface: "sunken",
|
|
40
|
+
size,
|
|
41
|
+
wrap,
|
|
42
|
+
keepSelection: true,
|
|
43
|
+
className: "toolbar-demo",
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
46
|
+
label: "History",
|
|
47
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
48
|
+
label: "Undo",
|
|
49
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpLeftIcon, {}),
|
|
50
|
+
shortcut: ["mod", "Z"]
|
|
51
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
52
|
+
label: "Redo",
|
|
53
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpRightIcon, {}),
|
|
54
|
+
shortcut: [
|
|
55
|
+
"mod",
|
|
56
|
+
"shift",
|
|
57
|
+
"Z"
|
|
58
|
+
],
|
|
59
|
+
disabled: true
|
|
60
|
+
})]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarSelect, {
|
|
63
|
+
label: "Text style",
|
|
64
|
+
value: style,
|
|
65
|
+
onValueChange: setStyle,
|
|
66
|
+
options: STYLES
|
|
67
|
+
}) }),
|
|
68
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
69
|
+
label: "Marks",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
72
|
+
label: "Bold",
|
|
73
|
+
icon: /* @__PURE__ */ jsx(TextBIcon, {}),
|
|
74
|
+
shortcut: ["mod", "B"],
|
|
75
|
+
pressed: on.includes("bold"),
|
|
76
|
+
onClick: () => toggle("bold")
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
79
|
+
label: "Italic",
|
|
80
|
+
icon: /* @__PURE__ */ jsx(TextItalicIcon, {}),
|
|
81
|
+
shortcut: ["mod", "I"],
|
|
82
|
+
pressed: on.includes("italic"),
|
|
83
|
+
onClick: () => toggle("italic")
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
86
|
+
label: "Underline",
|
|
87
|
+
icon: /* @__PURE__ */ jsx(TextUnderlineIcon, {}),
|
|
88
|
+
shortcut: ["mod", "U"],
|
|
89
|
+
pressed: on.includes("underline"),
|
|
90
|
+
onClick: () => toggle("underline")
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
95
|
+
label: "Lists",
|
|
96
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
97
|
+
label: "Bulleted list",
|
|
98
|
+
icon: /* @__PURE__ */ jsx(ListBulletsIcon, {}),
|
|
99
|
+
pressed: on.includes("ul"),
|
|
100
|
+
onClick: () => toggle("ul")
|
|
101
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
102
|
+
label: "Numbered list",
|
|
103
|
+
icon: /* @__PURE__ */ jsx(ListNumbersIcon, {}),
|
|
104
|
+
pressed: on.includes("ol"),
|
|
105
|
+
onClick: () => toggle("ol")
|
|
106
|
+
})]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
109
|
+
label: "Alignment",
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
112
|
+
label: "Align left",
|
|
113
|
+
icon: /* @__PURE__ */ jsx(TextAlignLeftIcon, {}),
|
|
114
|
+
pressed: align === "left",
|
|
115
|
+
onClick: () => setAlign("left")
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
118
|
+
label: "Centre",
|
|
119
|
+
icon: /* @__PURE__ */ jsx(TextAlignCenterIcon, {}),
|
|
120
|
+
pressed: align === "center",
|
|
121
|
+
onClick: () => setAlign("center")
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
124
|
+
label: "Align right",
|
|
125
|
+
icon: /* @__PURE__ */ jsx(TextAlignRightIcon, {}),
|
|
126
|
+
pressed: align === "right",
|
|
127
|
+
onClick: () => setAlign("right")
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
132
|
+
label: "Link",
|
|
133
|
+
icon: /* @__PURE__ */ jsx(LinkSimpleIcon, {})
|
|
134
|
+
}) }),
|
|
135
|
+
/* @__PURE__ */ jsx(ToolbarSpacer, {}),
|
|
136
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
137
|
+
label: "HTML source",
|
|
138
|
+
icon: /* @__PURE__ */ jsx(CodeIcon, {}),
|
|
139
|
+
pressed: source,
|
|
140
|
+
onClick: () => setSource((v) => !v)
|
|
141
|
+
}) })
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function BuilderTools() {
|
|
146
|
+
const [hideHidden, setHideHidden] = useState(false);
|
|
147
|
+
const [scroll, setScroll] = useState(true);
|
|
148
|
+
return /* @__PURE__ */ jsxs(Toolbar, {
|
|
149
|
+
label: "Page tools",
|
|
150
|
+
tooltipSide: "bottom",
|
|
151
|
+
className: "toolbar-demo",
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
154
|
+
label: "View",
|
|
155
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
156
|
+
label: "Collapse hidden elements",
|
|
157
|
+
icon: /* @__PURE__ */ jsx(EyeSlashIcon, {}),
|
|
158
|
+
pressed: hideHidden,
|
|
159
|
+
onClick: () => setHideHidden((v) => !v)
|
|
160
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
161
|
+
label: "Preview scroll effects",
|
|
162
|
+
icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
|
|
163
|
+
pressed: scroll,
|
|
164
|
+
onClick: () => setScroll((v) => !v)
|
|
165
|
+
})]
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
168
|
+
label: "History",
|
|
169
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
170
|
+
label: "Undo",
|
|
171
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpLeftIcon, {}),
|
|
172
|
+
shortcut: ["mod", "Z"]
|
|
173
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
174
|
+
label: "Redo",
|
|
175
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpRightIcon, {}),
|
|
176
|
+
shortcut: [
|
|
177
|
+
"mod",
|
|
178
|
+
"shift",
|
|
179
|
+
"Z"
|
|
180
|
+
]
|
|
181
|
+
})]
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
184
|
+
label: "Preview",
|
|
185
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
186
|
+
label: "Preview",
|
|
187
|
+
icon: /* @__PURE__ */ jsx(EyeIcon, {})
|
|
188
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
189
|
+
label: "Open on the live site",
|
|
190
|
+
icon: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {})
|
|
191
|
+
})]
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(ToolbarMenu, {
|
|
194
|
+
label: "More actions",
|
|
195
|
+
icon: /* @__PURE__ */ jsx(DotsThreeVerticalIcon, { weight: "bold" }),
|
|
196
|
+
align: "end",
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
199
|
+
icon: /* @__PURE__ */ jsx(FloppyDiskIcon, {}),
|
|
200
|
+
children: "Save as section"
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
203
|
+
/* @__PURE__ */ jsx(MenuItem, { children: "Page settings" })
|
|
204
|
+
]
|
|
205
|
+
}) })
|
|
206
|
+
]
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function EmailTools() {
|
|
210
|
+
const [preview, setPreview] = useState(true);
|
|
211
|
+
return /* @__PURE__ */ jsxs(Toolbar, {
|
|
212
|
+
label: "Email editor",
|
|
213
|
+
className: "toolbar-demo",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
216
|
+
label: "History",
|
|
217
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
218
|
+
variant: "secondary",
|
|
219
|
+
label: "Undo",
|
|
220
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpLeftIcon, {}),
|
|
221
|
+
shortcut: ["mod", "Z"]
|
|
222
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
223
|
+
variant: "secondary",
|
|
224
|
+
label: "Redo",
|
|
225
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpRightIcon, {}),
|
|
226
|
+
shortcut: [
|
|
227
|
+
"mod",
|
|
228
|
+
"shift",
|
|
229
|
+
"Z"
|
|
230
|
+
]
|
|
231
|
+
})]
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ jsx(ToolbarSpacer, {}),
|
|
234
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
235
|
+
variant: "secondary",
|
|
236
|
+
label: "Styles",
|
|
237
|
+
icon: /* @__PURE__ */ jsx(PaletteIcon, {}),
|
|
238
|
+
children: "Styles"
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ jsx(ToolbarItem, { children: /* @__PURE__ */ jsx("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
className: "toolbar-demo__own",
|
|
243
|
+
"aria-pressed": preview,
|
|
244
|
+
onClick: () => setPreview((v) => !v),
|
|
245
|
+
children: preview ? "Hide preview" : "Show preview"
|
|
246
|
+
}) })
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function VerticalTools() {
|
|
251
|
+
const [tool, setTool] = useState("select");
|
|
252
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
253
|
+
className: "toolbar-vertical-stage",
|
|
254
|
+
children: [/* @__PURE__ */ jsxs(Toolbar, {
|
|
255
|
+
label: "Canvas tools",
|
|
256
|
+
orientation: "vertical",
|
|
257
|
+
surface: "sunken",
|
|
258
|
+
className: "toolbar-vertical",
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
261
|
+
label: "Pointer",
|
|
262
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
263
|
+
label: "Select",
|
|
264
|
+
icon: /* @__PURE__ */ jsx(CursorClickIcon, {}),
|
|
265
|
+
pressed: tool === "select",
|
|
266
|
+
onClick: () => setTool("select")
|
|
267
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
268
|
+
label: "Pan",
|
|
269
|
+
icon: /* @__PURE__ */ jsx(HandIcon, {}),
|
|
270
|
+
pressed: tool === "pan",
|
|
271
|
+
onClick: () => setTool("pan")
|
|
272
|
+
})]
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, {
|
|
275
|
+
label: "Add",
|
|
276
|
+
children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
277
|
+
label: "Text",
|
|
278
|
+
icon: /* @__PURE__ */ jsx(TextTIcon, {}),
|
|
279
|
+
pressed: tool === "text",
|
|
280
|
+
onClick: () => setTool("text")
|
|
281
|
+
}), /* @__PURE__ */ jsxs(ToolbarMenu, {
|
|
282
|
+
label: "Insert a section",
|
|
283
|
+
icon: /* @__PURE__ */ jsx(StackIcon, {}),
|
|
284
|
+
children: [/* @__PURE__ */ jsx(MenuItem, { children: "Hero banner" }), /* @__PURE__ */ jsx(MenuItem, { children: "Product grid" })]
|
|
285
|
+
})]
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
288
|
+
label: "Group selection",
|
|
289
|
+
icon: /* @__PURE__ */ jsx(SelectionIcon, {}),
|
|
290
|
+
disabledReason: "Choose two or more elements to group them."
|
|
291
|
+
}) })
|
|
292
|
+
]
|
|
293
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
294
|
+
className: "toolbar-vertical-stage__note",
|
|
295
|
+
children: `Tool: ${tool}`
|
|
296
|
+
})]
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function Preview() {
|
|
300
|
+
return /* @__PURE__ */ jsx("div", {
|
|
301
|
+
className: "toolbar-preview",
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
children: /* @__PURE__ */ jsxs(Toolbar, {
|
|
304
|
+
label: "Formatting",
|
|
305
|
+
surface: "sunken",
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
308
|
+
label: "Undo",
|
|
309
|
+
icon: /* @__PURE__ */ jsx(ArrowUUpLeftIcon, {}),
|
|
310
|
+
tooltip: false
|
|
311
|
+
}) }),
|
|
312
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
313
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
314
|
+
label: "Bold",
|
|
315
|
+
icon: /* @__PURE__ */ jsx(TextBIcon, {}),
|
|
316
|
+
pressed: true,
|
|
317
|
+
tooltip: false
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
320
|
+
label: "Italic",
|
|
321
|
+
icon: /* @__PURE__ */ jsx(TextItalicIcon, {}),
|
|
322
|
+
pressed: false,
|
|
323
|
+
tooltip: false
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
326
|
+
label: "Underline",
|
|
327
|
+
icon: /* @__PURE__ */ jsx(TextUnderlineIcon, {}),
|
|
328
|
+
pressed: false,
|
|
329
|
+
tooltip: false
|
|
330
|
+
})
|
|
331
|
+
] }),
|
|
332
|
+
/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
333
|
+
label: "Link",
|
|
334
|
+
icon: /* @__PURE__ */ jsx(LinkSimpleIcon, {}),
|
|
335
|
+
tooltip: false
|
|
336
|
+
}) })
|
|
337
|
+
]
|
|
338
|
+
})
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function Page() {
|
|
342
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
343
|
+
title: "Toolbar",
|
|
344
|
+
status: "new",
|
|
345
|
+
importNames: [
|
|
346
|
+
"Toolbar",
|
|
347
|
+
"ToolbarGroup",
|
|
348
|
+
"ToolbarButton",
|
|
349
|
+
"ToolbarSelect",
|
|
350
|
+
"ToolbarMenu",
|
|
351
|
+
"ToolbarItem",
|
|
352
|
+
"ToolbarSpacer"
|
|
353
|
+
],
|
|
354
|
+
lead: "A row of tools that is one stop in the tab order, the arrow keys moving between them: an editor's formatting tools, a builder's view and history tools, an email editor's bar.",
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
357
|
+
id: "basics",
|
|
358
|
+
title: "Basics",
|
|
359
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
360
|
+
"Put the tools in groups, each set apart by a hairline. An icon tool is named by its ",
|
|
361
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
362
|
+
", which is also its tip, with a ",
|
|
363
|
+
/* @__PURE__ */ jsx("code", { children: "shortcut" }),
|
|
364
|
+
" if it has one; ",
|
|
365
|
+
/* @__PURE__ */ jsx("code", { children: "pressed" }),
|
|
366
|
+
" makes it a toggle. An editor's toolbar sits on the ",
|
|
367
|
+
/* @__PURE__ */ jsx("code", { children: "sunken" }),
|
|
368
|
+
" surface, where a tool that is on is a raised pill, and sets ",
|
|
369
|
+
/* @__PURE__ */ jsx("code", { children: "keepSelection" }),
|
|
370
|
+
", so pressing a tool leaves the text and its selection where they were."
|
|
371
|
+
] }),
|
|
372
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
373
|
+
align: "fill",
|
|
374
|
+
code: `<Toolbar label="Formatting" surface="sunken" keepSelection>
|
|
375
|
+
<ToolbarGroup label="History">
|
|
376
|
+
<ToolbarButton label="Undo" icon={<ArrowUUpLeftIcon />} shortcut={['mod', 'Z']} onClick={undo} />
|
|
377
|
+
<ToolbarButton label="Redo" icon={<ArrowUUpRightIcon />} shortcut={['mod', 'shift', 'Z']} disabled={!canRedo} />
|
|
378
|
+
</ToolbarGroup>
|
|
379
|
+
<ToolbarGroup>
|
|
380
|
+
<ToolbarSelect label="Text style" value={style} onValueChange={setStyle} options={styles} />
|
|
381
|
+
</ToolbarGroup>
|
|
382
|
+
<ToolbarGroup label="Marks">
|
|
383
|
+
<ToolbarButton label="Bold" icon={<TextBIcon />} shortcut={['mod', 'B']} pressed={isBold} onClick={toggleBold} />
|
|
384
|
+
…
|
|
385
|
+
</ToolbarGroup>
|
|
386
|
+
<ToolbarSpacer />
|
|
387
|
+
<ToolbarGroup>
|
|
388
|
+
<ToolbarButton label="HTML source" icon={<CodeIcon />} pressed={source} onClick={toggleSource} />
|
|
389
|
+
</ToolbarGroup>
|
|
390
|
+
</Toolbar>`,
|
|
391
|
+
children: /* @__PURE__ */ jsx(EditorToolbar, {})
|
|
392
|
+
}), /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsx(EditorToolbar, {}) })]
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
395
|
+
id: "plain",
|
|
396
|
+
title: "On a plain ground",
|
|
397
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
398
|
+
"By default the tools sit on whatever the toolbar is on, as the builder's top bar draws them: ghost tools whose toggles take the teal wash when on. A toolbar at the top of the window opens its tips below (",
|
|
399
|
+
/* @__PURE__ */ jsx("code", { children: "tooltipSide=\"bottom\"" }),
|
|
400
|
+
"). A ",
|
|
401
|
+
/* @__PURE__ */ jsx("code", { children: "ToolbarMenu" }),
|
|
402
|
+
" is a tool that opens a menu; its tip stays shut while the menu is open."
|
|
403
|
+
] }),
|
|
404
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
405
|
+
code: `<Toolbar label="Page tools" tooltipSide="bottom">
|
|
406
|
+
<ToolbarGroup label="View">
|
|
407
|
+
<ToolbarButton label="Collapse hidden elements" icon={<EyeSlashIcon />} pressed={hideHidden} onClick={toggle} />
|
|
408
|
+
…
|
|
409
|
+
</ToolbarGroup>
|
|
410
|
+
<ToolbarGroup>
|
|
411
|
+
<ToolbarMenu label="More actions" icon={<DotsThreeVerticalIcon weight="bold" />} align="end">
|
|
412
|
+
<MenuItem icon={<FloppyDiskIcon />}>Save as section</MenuItem>
|
|
413
|
+
</ToolbarMenu>
|
|
414
|
+
</ToolbarGroup>
|
|
415
|
+
</Toolbar>`,
|
|
416
|
+
children: /* @__PURE__ */ jsx(BuilderTools, {})
|
|
417
|
+
})
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
420
|
+
id: "words",
|
|
421
|
+
title: "Tools with words, and controls of your own",
|
|
422
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
423
|
+
"Give a ",
|
|
424
|
+
/* @__PURE__ */ jsx("code", { children: "ToolbarButton" }),
|
|
425
|
+
" words as its children for a tool that says what it does; ",
|
|
426
|
+
/* @__PURE__ */ jsx("code", { children: "variant=\"secondary\"" }),
|
|
427
|
+
" ",
|
|
428
|
+
"draws it as a pill of its own. ",
|
|
429
|
+
/* @__PURE__ */ jsx("code", { children: "ToolbarItem" }),
|
|
430
|
+
" makes any control of yours one of the tools, in the arrow keys' path. ",
|
|
431
|
+
/* @__PURE__ */ jsx("code", { children: "ToolbarSpacer" }),
|
|
432
|
+
" pushes what follows to the end."
|
|
433
|
+
] }),
|
|
434
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
435
|
+
align: "fill",
|
|
436
|
+
code: `<Toolbar label="Email editor">
|
|
437
|
+
<ToolbarGroup label="History">
|
|
438
|
+
<ToolbarButton variant="secondary" label="Undo" icon={<ArrowUUpLeftIcon />} />
|
|
439
|
+
<ToolbarButton variant="secondary" label="Redo" icon={<ArrowUUpRightIcon />} />
|
|
440
|
+
</ToolbarGroup>
|
|
441
|
+
<ToolbarSpacer />
|
|
442
|
+
<ToolbarButton variant="secondary" label="Styles" icon={<PaletteIcon />}>Styles</ToolbarButton>
|
|
443
|
+
<ToolbarItem>
|
|
444
|
+
<button type="button" aria-pressed={preview} onClick={togglePreview}>Hide preview</button>
|
|
445
|
+
</ToolbarItem>
|
|
446
|
+
</Toolbar>`,
|
|
447
|
+
children: /* @__PURE__ */ jsx(EmailTools, {})
|
|
448
|
+
})
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
451
|
+
id: "vertical",
|
|
452
|
+
title: "Vertical, and a tool off with a reason",
|
|
453
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
454
|
+
/* @__PURE__ */ jsx("code", { children: "orientation=\"vertical\"" }),
|
|
455
|
+
" stacks the tools, the hairlines between groups running across, and up and down move between them; a menu tool opens with the right arrow, Enter or Space. A tool that is off for a reason the person should know takes ",
|
|
456
|
+
/* @__PURE__ */ jsx("code", { children: "disabledReason" }),
|
|
457
|
+
": it stays in the arrow keys' path, says why in a tip on hover, focus or a tap, and does nothing when pressed."
|
|
458
|
+
] }),
|
|
459
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
460
|
+
code: `<Toolbar label="Canvas tools" orientation="vertical" surface="sunken">
|
|
461
|
+
<ToolbarGroup label="Pointer">
|
|
462
|
+
<ToolbarButton label="Select" icon={<CursorClickIcon />} pressed={tool === 'select'} onClick={…} />
|
|
463
|
+
…
|
|
464
|
+
</ToolbarGroup>
|
|
465
|
+
<ToolbarGroup label="Add">
|
|
466
|
+
<ToolbarMenu label="Insert a section" icon={<StackIcon />}>…</ToolbarMenu>
|
|
467
|
+
</ToolbarGroup>
|
|
468
|
+
<ToolbarGroup>
|
|
469
|
+
<ToolbarButton label="Group selection" icon={<SelectionIcon />} disabledReason="Choose two or more elements to group them." />
|
|
470
|
+
</ToolbarGroup>
|
|
471
|
+
</Toolbar>`,
|
|
472
|
+
children: /* @__PURE__ */ jsx(VerticalTools, {})
|
|
473
|
+
})
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
476
|
+
id: "sizes",
|
|
477
|
+
title: "Sizes and wrapping",
|
|
478
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
479
|
+
"Tools are 30px by default (",
|
|
480
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
481
|
+
"); ",
|
|
482
|
+
/* @__PURE__ */ jsx("code", { children: "xs" }),
|
|
483
|
+
" is 24px for a dense inspector and ",
|
|
484
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
485
|
+
" 36px. The tools stay on one row that scrolls sideways when there is no room. With ",
|
|
486
|
+
/* @__PURE__ */ jsx("code", { children: "wrap" }),
|
|
487
|
+
" they run on to more rows instead, and a group that starts a row drops its hairline."
|
|
488
|
+
] }),
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
491
|
+
title: "Extra small",
|
|
492
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
493
|
+
align: "fill",
|
|
494
|
+
code: `<Toolbar label="Formatting" surface="sunken" size="xs">…</Toolbar>`,
|
|
495
|
+
children: /* @__PURE__ */ jsx(EditorToolbar, { size: "xs" })
|
|
496
|
+
})
|
|
497
|
+
}),
|
|
498
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
499
|
+
title: "Wrapping in a narrow box",
|
|
500
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
501
|
+
align: "fill",
|
|
502
|
+
code: `<Toolbar label="Formatting" surface="sunken" wrap>…</Toolbar>`,
|
|
503
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
504
|
+
className: "toolbar-narrow",
|
|
505
|
+
children: /* @__PURE__ */ jsx(EditorToolbar, { wrap: true })
|
|
506
|
+
})
|
|
507
|
+
})
|
|
508
|
+
}),
|
|
509
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
510
|
+
columns: [
|
|
511
|
+
"Size",
|
|
512
|
+
"Tool",
|
|
513
|
+
"Use"
|
|
514
|
+
],
|
|
515
|
+
rows: [
|
|
516
|
+
[
|
|
517
|
+
"xs",
|
|
518
|
+
"24px",
|
|
519
|
+
"Dense inspectors and the tools inside a panel"
|
|
520
|
+
],
|
|
521
|
+
[
|
|
522
|
+
"sm",
|
|
523
|
+
"30px",
|
|
524
|
+
"Editors and the builder bar (default)"
|
|
525
|
+
],
|
|
526
|
+
[
|
|
527
|
+
"md",
|
|
528
|
+
"36px",
|
|
529
|
+
"A toolbar standing alone on a page"
|
|
530
|
+
]
|
|
531
|
+
]
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
536
|
+
id: "guidelines",
|
|
537
|
+
title: "Guidelines",
|
|
538
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
539
|
+
"Group the tools by what they do (history, marks, lists, alignment, inserts), a few to a group.",
|
|
540
|
+
"Name every icon tool by the thing it sets, not the action: \"Bold\", not \"Make bold\". A screen reader adds \"pressed\".",
|
|
541
|
+
"Switch a tool off when it cannot act now (Redo with nothing to redo). Give a reason (disabledReason) when the person needs to know why.",
|
|
542
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
543
|
+
"For a choice of one of several views on a page, use a ",
|
|
544
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
545
|
+
to: "/components/segmented-control",
|
|
546
|
+
children: "segmented control"
|
|
547
|
+
}),
|
|
548
|
+
" ",
|
|
549
|
+
"beside the toolbar rather than toggles in it."
|
|
550
|
+
] })
|
|
551
|
+
] })
|
|
552
|
+
}),
|
|
553
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
554
|
+
id: "accessibility",
|
|
555
|
+
title: "Accessibility",
|
|
556
|
+
children: [/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
557
|
+
"The toolbar is one stop in the tab order (role=\"toolbar\", named by label). Left and right move between tools, the other way round in a right-to-left page, and Home and End go to the first and the last; up and down when it is vertical.",
|
|
558
|
+
"The stop is the tool last used, so Tab leaves the toolbar and Shift+Tab comes back to it. A tool that is switched off is passed over; if it held focus, focus moves to the next tool instead of falling to the page. A tool off with a reason stays reachable, its reason its description.",
|
|
559
|
+
"A group that is hidden (a bar folding tools into a menu) is gone from the page and from the arrow keys’ path.",
|
|
560
|
+
"A field inside the toolbar keeps its own arrow keys.",
|
|
561
|
+
"Groups are role=\"group\", named by their label when they have one. Toggles say pressed or not pressed.",
|
|
562
|
+
"Under forced colours the hairlines are borders, a toggle that is on keeps an outline, and the select pill a system edge."
|
|
563
|
+
] }), /* @__PURE__ */ jsxs(Note, {
|
|
564
|
+
title: "Keeping the selection",
|
|
565
|
+
children: [
|
|
566
|
+
"With ",
|
|
567
|
+
/* @__PURE__ */ jsx("code", { children: "keepSelection" }),
|
|
568
|
+
" a press does not move focus to the tool, so an editor's selection survives it. The tool still runs on the click, and the keyboard reaches every tool as ever."
|
|
569
|
+
]
|
|
570
|
+
})]
|
|
571
|
+
}),
|
|
572
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
573
|
+
id: "props",
|
|
574
|
+
title: "Props",
|
|
575
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every attribute of a div, which go on the toolbar." }),
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
578
|
+
title: "Toolbar",
|
|
579
|
+
rows: [
|
|
580
|
+
{
|
|
581
|
+
name: "label",
|
|
582
|
+
type: "string",
|
|
583
|
+
description: "Names the toolbar: \"Formatting\". Or pass aria-labelledby."
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "surface",
|
|
587
|
+
type: "'plain' | 'sunken'",
|
|
588
|
+
default: "'plain'",
|
|
589
|
+
description: "The tools on what is round them, or on the toolbar’s own sunken ground."
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
name: "size",
|
|
593
|
+
type: "'xs' | 'sm' | 'md'",
|
|
594
|
+
default: "'sm'",
|
|
595
|
+
description: "The tools’ size: 24, 30 or 36px."
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: "orientation",
|
|
599
|
+
type: "'horizontal' | 'vertical'",
|
|
600
|
+
default: "'horizontal'",
|
|
601
|
+
description: "Which arrow keys move between tools."
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: "wrap",
|
|
605
|
+
type: "boolean",
|
|
606
|
+
default: "false",
|
|
607
|
+
description: "Run on to more rows rather than scroll sideways."
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: "keepSelection",
|
|
611
|
+
type: "boolean",
|
|
612
|
+
default: "false",
|
|
613
|
+
description: "A press leaves focus, and an editor’s selection, where it was."
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: "loop",
|
|
617
|
+
type: "boolean",
|
|
618
|
+
default: "true",
|
|
619
|
+
description: "The arrows go round from the last tool to the first."
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
name: "tooltipSide",
|
|
623
|
+
type: "'top' | 'bottom'",
|
|
624
|
+
default: "'top'",
|
|
625
|
+
description: "Which side of a tool its tip opens on."
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "onRestoreFocus",
|
|
629
|
+
type: "() => void",
|
|
630
|
+
description: "With keepSelection: where focus goes after a menu the pointer used closes (the editor’s text)."
|
|
631
|
+
}
|
|
632
|
+
]
|
|
633
|
+
}),
|
|
634
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
635
|
+
title: "ToolbarButton",
|
|
636
|
+
rows: [
|
|
637
|
+
{
|
|
638
|
+
name: "label",
|
|
639
|
+
type: "string",
|
|
640
|
+
required: true,
|
|
641
|
+
description: "The tool’s name, and the tip of an icon tool."
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "icon",
|
|
645
|
+
type: "ReactNode",
|
|
646
|
+
description: "The glyph."
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
name: "children",
|
|
650
|
+
type: "ReactNode",
|
|
651
|
+
description: "Words on the tool. Without them it is its icon alone."
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
name: "pressed",
|
|
655
|
+
type: "boolean",
|
|
656
|
+
description: "A toggle that is on. Pass false for one that is off."
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
name: "shortcut",
|
|
660
|
+
type: "string[]",
|
|
661
|
+
description: "Keys shown in the tip: [\"mod\", \"B\"]."
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: "tooltip",
|
|
665
|
+
type: "ReactNode | false",
|
|
666
|
+
description: "The tip, if not the label; false for none."
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
name: "variant",
|
|
670
|
+
type: "'ghost' | 'secondary'",
|
|
671
|
+
default: "'ghost'",
|
|
672
|
+
description: "A ghost tool, or a pill of its own."
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: "size",
|
|
676
|
+
type: "'xs' | 'sm' | 'md'",
|
|
677
|
+
description: "Overrides the toolbar’s size."
|
|
678
|
+
}
|
|
679
|
+
]
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
682
|
+
title: "ToolbarSelect",
|
|
683
|
+
rows: [
|
|
684
|
+
{
|
|
685
|
+
name: "label",
|
|
686
|
+
type: "string",
|
|
687
|
+
required: true,
|
|
688
|
+
description: "What is chosen. The trigger reads \"Text style: Paragraph\"."
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
name: "options",
|
|
692
|
+
type: "ToolbarSelectOption[]",
|
|
693
|
+
required: true,
|
|
694
|
+
description: "{ value, label, preview?, disabled? }; preview draws the row (a heading at its size)."
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: "value",
|
|
698
|
+
type: "string",
|
|
699
|
+
required: true,
|
|
700
|
+
description: "The current choice."
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: "onValueChange",
|
|
704
|
+
type: "(value) => void",
|
|
705
|
+
required: true,
|
|
706
|
+
description: "Hears a new choice."
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
name: "disabled",
|
|
710
|
+
type: "boolean",
|
|
711
|
+
description: "Passed over, and opens nothing."
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
}),
|
|
715
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
716
|
+
title: "ToolbarMenu",
|
|
717
|
+
rows: [
|
|
718
|
+
{
|
|
719
|
+
name: "label",
|
|
720
|
+
type: "string",
|
|
721
|
+
required: true,
|
|
722
|
+
description: "The trigger’s name, and its tip."
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
name: "icon",
|
|
726
|
+
type: "ReactNode",
|
|
727
|
+
description: "An icon trigger."
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
name: "text",
|
|
731
|
+
type: "ReactNode",
|
|
732
|
+
description: "Words on the trigger, as a pill with a caret."
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "children",
|
|
736
|
+
type: "ReactNode",
|
|
737
|
+
required: true,
|
|
738
|
+
description: "The menu’s rows."
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
name: "align",
|
|
742
|
+
type: "'start' | 'center' | 'end'",
|
|
743
|
+
default: "'start'",
|
|
744
|
+
description: "Where the menu lines up with its trigger."
|
|
745
|
+
}
|
|
746
|
+
]
|
|
747
|
+
})
|
|
748
|
+
]
|
|
749
|
+
})
|
|
750
|
+
]
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
754
|
+
export { Page, Preview };
|