@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,779 @@
|
|
|
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, r as DoDont, 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 { Button, Delta, formatDelta, percentChange } from "@orbitcommerce/constellation";
|
|
7
|
+
import { CaretRightIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/delta.tsx
|
|
9
|
+
function Preview() {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "delta-preview",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "delta-stat__label",
|
|
15
|
+
children: "Takings today"
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsx("span", {
|
|
18
|
+
className: "delta-figure",
|
|
19
|
+
children: "£4,218.40"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
22
|
+
value: 18.2,
|
|
23
|
+
label: "vs yesterday"
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
var DAYS = [
|
|
29
|
+
18.2,
|
|
30
|
+
-4,
|
|
31
|
+
.3,
|
|
32
|
+
7.5,
|
|
33
|
+
-12.1,
|
|
34
|
+
0
|
|
35
|
+
];
|
|
36
|
+
function ChangingDelta() {
|
|
37
|
+
const [day, setDay] = useState(0);
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Delta, {
|
|
39
|
+
value: DAYS[day],
|
|
40
|
+
label: "vs yesterday"
|
|
41
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
42
|
+
size: "sm",
|
|
43
|
+
variant: "soft",
|
|
44
|
+
iconEnd: /* @__PURE__ */ jsx(CaretRightIcon, {}),
|
|
45
|
+
onClick: () => setDay((d) => (d + 1) % DAYS.length),
|
|
46
|
+
children: "Next day"
|
|
47
|
+
})] });
|
|
48
|
+
}
|
|
49
|
+
function FigureStrip$1() {
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "delta-strip",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "delta-stat",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "delta-stat__label",
|
|
58
|
+
children: "Takings"
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsx("span", {
|
|
61
|
+
className: "delta-figure",
|
|
62
|
+
children: "£4,218.40"
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
65
|
+
value: 18.2,
|
|
66
|
+
label: "vs yesterday"
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "delta-stat",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: "delta-stat__label",
|
|
75
|
+
children: "Orders"
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "delta-figure",
|
|
79
|
+
children: "36"
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
82
|
+
value: -4,
|
|
83
|
+
label: "vs last Tuesday"
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsxs("div", {
|
|
88
|
+
className: "delta-stat",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", {
|
|
91
|
+
className: "delta-stat__label",
|
|
92
|
+
children: "Conversion rate"
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "delta-figure",
|
|
96
|
+
children: "2.9%"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
99
|
+
value: .3,
|
|
100
|
+
label: "vs last week"
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsxs("div", {
|
|
105
|
+
className: "delta-stat",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: "delta-stat__label",
|
|
109
|
+
children: "Refunds"
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ jsx("span", {
|
|
112
|
+
className: "delta-figure",
|
|
113
|
+
children: "£182.00"
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
116
|
+
value: 12.5,
|
|
117
|
+
positiveIsGood: false,
|
|
118
|
+
label: "vs last month"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
var code = (value) => /* @__PURE__ */ jsx("code", { children: value });
|
|
126
|
+
function Page() {
|
|
127
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
128
|
+
title: "Delta",
|
|
129
|
+
status: "stable",
|
|
130
|
+
importNames: [
|
|
131
|
+
"Delta",
|
|
132
|
+
"formatDelta",
|
|
133
|
+
"percentChange",
|
|
134
|
+
"DELTA_LABELS"
|
|
135
|
+
],
|
|
136
|
+
lead: "How a figure moved: an arrow and a signed percentage on a tinted pill, with an optional comparison after it. It sits beside a figure and answers the merchant's next question: better or worse than before?",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
139
|
+
id: "states",
|
|
140
|
+
title: "States",
|
|
141
|
+
description: /* @__PURE__ */ jsx("p", { children: "One arrow, turned to its heading: up and to the right when rising, down and to the right when falling, level when steady. A change under 0.5% either way is steady (noise, not news), so it stays neutral even though it keeps its sign. The pill is green when the change is good news and red when it is bad." }),
|
|
142
|
+
children: [/* @__PURE__ */ jsxs(Example, {
|
|
143
|
+
code: `
|
|
144
|
+
<Delta value={18.2} />
|
|
145
|
+
<Delta value={-4} />
|
|
146
|
+
<Delta value={0.3} />
|
|
147
|
+
<Delta value={0} />`,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(Delta, { value: 18.2 }),
|
|
150
|
+
/* @__PURE__ */ jsx(Delta, { value: -4 }),
|
|
151
|
+
/* @__PURE__ */ jsx(Delta, { value: .3 }),
|
|
152
|
+
/* @__PURE__ */ jsx(Delta, { value: 0 })
|
|
153
|
+
]
|
|
154
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
155
|
+
title: "Watch it change",
|
|
156
|
+
description: /* @__PURE__ */ jsx("p", { children: "When the direction changes, the arrow swings to its new heading on a spring and the pill changes colour, so the change itself is visible. Press Next day." }),
|
|
157
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
158
|
+
code: `
|
|
159
|
+
const [day, setDay] = useState(0)
|
|
160
|
+
|
|
161
|
+
<Delta value={days[day]} label="vs yesterday" />
|
|
162
|
+
<Button size="sm" variant="soft" iconEnd={<CaretRightIcon />} onClick={nextDay}>
|
|
163
|
+
Next day
|
|
164
|
+
</Button>`,
|
|
165
|
+
children: /* @__PURE__ */ jsx(ChangingDelta, {})
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
170
|
+
id: "when-up-is-bad",
|
|
171
|
+
title: "When up is bad",
|
|
172
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
173
|
+
"Most figures are good when they rise: takings, orders, conversion. For the ones where a rise is bad news (refunds, returns, abandoned checkouts), set ",
|
|
174
|
+
/* @__PURE__ */ jsxs("code", { children: ["positiveIsGood=", "{false}"] }),
|
|
175
|
+
". The arrow still shows the direction; only the colour flips."
|
|
176
|
+
] }),
|
|
177
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
178
|
+
code: `
|
|
179
|
+
<Delta value={12.5} positiveIsGood={false} label="refunds vs last month" />
|
|
180
|
+
<Delta value={-8.4} positiveIsGood={false} label="abandoned checkouts vs last week" />`,
|
|
181
|
+
children: [/* @__PURE__ */ jsx(Delta, {
|
|
182
|
+
value: 12.5,
|
|
183
|
+
positiveIsGood: false,
|
|
184
|
+
label: "refunds vs last month"
|
|
185
|
+
}), /* @__PURE__ */ jsx(Delta, {
|
|
186
|
+
value: -8.4,
|
|
187
|
+
positiveIsGood: false,
|
|
188
|
+
label: "abandoned checkouts vs last week"
|
|
189
|
+
})]
|
|
190
|
+
})
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
193
|
+
id: "no-baseline",
|
|
194
|
+
title: "When there was nothing before",
|
|
195
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
196
|
+
"A change from 0 has no rate: dividing by nothing would say \"infinite\". ",
|
|
197
|
+
/* @__PURE__ */ jsx("code", { children: "percentChange(current, previous)" }),
|
|
198
|
+
" gives ",
|
|
199
|
+
/* @__PURE__ */ jsx("code", { children: "Infinity" }),
|
|
200
|
+
" then, and the delta says \"Up from 0\" in place of the percent, in the neutral tone, with the arrow still saying which way it went. ",
|
|
201
|
+
/* @__PURE__ */ jsx("code", { children: "noBaseline" }),
|
|
202
|
+
" says the same for a value you worked out yourself. Since nothing is compared, ",
|
|
203
|
+
/* @__PURE__ */ jsx("code", { children: "baselineLabel" }),
|
|
204
|
+
" takes the place of",
|
|
205
|
+
" ",
|
|
206
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
207
|
+
": \"in the previous 30 days\". Nothing on both sides is steady, 0.0%."
|
|
208
|
+
] }),
|
|
209
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
210
|
+
code: `
|
|
211
|
+
<Delta value={percentChange(14, 0)} label="vs previous 30 days" baselineLabel="in the previous 30 days" />
|
|
212
|
+
<Delta value={-6} noBaseline />
|
|
213
|
+
<Delta value={percentChange(0, 0)} label="vs previous 30 days" />`,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
216
|
+
value: percentChange(14, 0),
|
|
217
|
+
label: "vs previous 30 days",
|
|
218
|
+
baselineLabel: "in the previous 30 days"
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
221
|
+
value: -6,
|
|
222
|
+
noBaseline: true
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
225
|
+
value: percentChange(0, 0),
|
|
226
|
+
label: "vs previous 30 days"
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
})
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
232
|
+
id: "sentence",
|
|
233
|
+
title: "As a sentence",
|
|
234
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
235
|
+
/* @__PURE__ */ jsx("code", { children: "variant=\"sentence\"" }),
|
|
236
|
+
" drops the pill and the arrow for one line of words in the tone's colour, the percent a little heavier than the comparison: the line under a figure in a strip of counts, where a pill would be one more shape. A change that rounds to nothing says \"No change\", and no baseline says \"Up from 0\". It wraps like a sentence. ",
|
|
237
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
238
|
+
" is 13px, ",
|
|
239
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
240
|
+
" 12px."
|
|
241
|
+
] }),
|
|
242
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
243
|
+
align: "start",
|
|
244
|
+
code: `
|
|
245
|
+
<Delta variant="sentence" value={25} label="vs previous 30 days" />
|
|
246
|
+
<Delta variant="sentence" value={-10} label="vs previous 30 days" />
|
|
247
|
+
<Delta variant="sentence" value={0} label="vs previous 30 days" />
|
|
248
|
+
<Delta variant="sentence" value={percentChange(14, 0)} baselineLabel="in the previous 30 days" />
|
|
249
|
+
<Delta variant="sentence" size="sm" value={12.5} positiveIsGood={false} label="refunds vs last month" />`,
|
|
250
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
251
|
+
className: "delta-sentences",
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
254
|
+
variant: "sentence",
|
|
255
|
+
value: 25,
|
|
256
|
+
label: "vs previous 30 days"
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
259
|
+
variant: "sentence",
|
|
260
|
+
value: -10,
|
|
261
|
+
label: "vs previous 30 days"
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
264
|
+
variant: "sentence",
|
|
265
|
+
value: 0,
|
|
266
|
+
label: "vs previous 30 days"
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
269
|
+
variant: "sentence",
|
|
270
|
+
value: percentChange(14, 0),
|
|
271
|
+
baselineLabel: "in the previous 30 days"
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
274
|
+
variant: "sentence",
|
|
275
|
+
size: "sm",
|
|
276
|
+
value: 12.5,
|
|
277
|
+
positiveIsGood: false,
|
|
278
|
+
label: "refunds vs last month"
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
283
|
+
title: "Under a figure",
|
|
284
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
285
|
+
align: "start",
|
|
286
|
+
code: `
|
|
287
|
+
<span className="label">Profile views</span>
|
|
288
|
+
<span className="figure">1,204</span>
|
|
289
|
+
<Delta variant="sentence" value={percentChange(1204, 963)} precision={0} label="vs previous 30 days" />`,
|
|
290
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
291
|
+
className: "delta-stat",
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ jsx("span", {
|
|
294
|
+
className: "delta-stat__label",
|
|
295
|
+
children: "Profile views"
|
|
296
|
+
}),
|
|
297
|
+
/* @__PURE__ */ jsx("span", {
|
|
298
|
+
className: "delta-figure",
|
|
299
|
+
children: "1,204"
|
|
300
|
+
}),
|
|
301
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
302
|
+
variant: "sentence",
|
|
303
|
+
value: percentChange(1204, 963),
|
|
304
|
+
precision: 0,
|
|
305
|
+
label: "vs previous 30 days"
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
})]
|
|
311
|
+
}),
|
|
312
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
313
|
+
id: "with-figures",
|
|
314
|
+
title: "Beside a figure",
|
|
315
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
316
|
+
"A delta always belongs to a figure. The figure stays in ink, set in Sora with tabular numerals, and the delta carries the colour on its own pill. ",
|
|
317
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
318
|
+
" says what the change is measured against, in quiet text after the pill. Headline figures sit on one hairline, not in boxes: the real strip, with a chart beneath it, is ",
|
|
319
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
320
|
+
to: "/components/figure-tabs",
|
|
321
|
+
children: "Figure tabs"
|
|
322
|
+
}),
|
|
323
|
+
"."
|
|
324
|
+
] }),
|
|
325
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
326
|
+
align: "fill",
|
|
327
|
+
code: `
|
|
328
|
+
<span className="label">Takings</span>
|
|
329
|
+
<span className="figure">£4,218.40</span>
|
|
330
|
+
<Delta value={18.2} label="vs yesterday" />
|
|
331
|
+
|
|
332
|
+
<span className="label">Orders</span>
|
|
333
|
+
<span className="figure">36</span>
|
|
334
|
+
<Delta value={-4} label="vs last Tuesday" />
|
|
335
|
+
|
|
336
|
+
<span className="label">Conversion rate</span>
|
|
337
|
+
<span className="figure">2.9%</span>
|
|
338
|
+
<Delta value={0.3} label="vs last week" />
|
|
339
|
+
|
|
340
|
+
<span className="label">Refunds</span>
|
|
341
|
+
<span className="figure">£182.00</span>
|
|
342
|
+
<Delta value={12.5} positiveIsGood={false} label="vs last month" />`,
|
|
343
|
+
children: /* @__PURE__ */ jsx(FigureStrip$1, {})
|
|
344
|
+
})
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
347
|
+
id: "sizes",
|
|
348
|
+
title: "Sizes",
|
|
349
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
350
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
351
|
+
" (22px, 12px text) is the default, beside figures. ",
|
|
352
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
353
|
+
" (18px, 11px text) is for tables and dense rows."
|
|
354
|
+
] }),
|
|
355
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
356
|
+
align: "start",
|
|
357
|
+
code: `
|
|
358
|
+
<Delta value={18.2} label="vs yesterday" />
|
|
359
|
+
<Delta value={-4} />
|
|
360
|
+
<Delta value={0.2} />
|
|
361
|
+
|
|
362
|
+
<Delta size="sm" value={18.2} label="vs yesterday" />
|
|
363
|
+
<Delta size="sm" value={-4} />
|
|
364
|
+
<Delta size="sm" value={0.2} />`,
|
|
365
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
366
|
+
className: "delta-rows",
|
|
367
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
368
|
+
className: "delta-row",
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
371
|
+
value: 18.2,
|
|
372
|
+
label: "vs yesterday"
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ jsx(Delta, { value: -4 }),
|
|
375
|
+
/* @__PURE__ */ jsx(Delta, { value: .2 })
|
|
376
|
+
]
|
|
377
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
378
|
+
className: "delta-row",
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
381
|
+
size: "sm",
|
|
382
|
+
value: 18.2,
|
|
383
|
+
label: "vs yesterday"
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
386
|
+
size: "sm",
|
|
387
|
+
value: -4
|
|
388
|
+
}),
|
|
389
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
390
|
+
size: "sm",
|
|
391
|
+
value: .2
|
|
392
|
+
})
|
|
393
|
+
]
|
|
394
|
+
})]
|
|
395
|
+
})
|
|
396
|
+
}), /* @__PURE__ */ jsx(Example, {
|
|
397
|
+
align: "fill",
|
|
398
|
+
code: `
|
|
399
|
+
<span>Arden ergonomic chair, black</span>
|
|
400
|
+
<span>£1,904.00</span>
|
|
401
|
+
<Delta size="sm" value={22.6} />
|
|
402
|
+
|
|
403
|
+
<span>Oak veneer desk, 1600mm</span>
|
|
404
|
+
<span>£1,396.00</span>
|
|
405
|
+
<Delta size="sm" value={-6.8} />
|
|
406
|
+
|
|
407
|
+
<span>Dual monitor arm</span>
|
|
408
|
+
<span>£534.00</span>
|
|
409
|
+
<Delta size="sm" value={0.4} />`,
|
|
410
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
411
|
+
className: "delta-table",
|
|
412
|
+
children: [
|
|
413
|
+
/* @__PURE__ */ jsxs("div", {
|
|
414
|
+
className: "delta-table__row",
|
|
415
|
+
children: [
|
|
416
|
+
/* @__PURE__ */ jsx("span", { children: "Arden ergonomic chair, black" }),
|
|
417
|
+
/* @__PURE__ */ jsx("span", {
|
|
418
|
+
className: "delta-table__value",
|
|
419
|
+
children: "£1,904.00"
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
422
|
+
size: "sm",
|
|
423
|
+
value: 22.6
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ jsxs("div", {
|
|
428
|
+
className: "delta-table__row",
|
|
429
|
+
children: [
|
|
430
|
+
/* @__PURE__ */ jsx("span", { children: "Oak veneer desk, 1600mm" }),
|
|
431
|
+
/* @__PURE__ */ jsx("span", {
|
|
432
|
+
className: "delta-table__value",
|
|
433
|
+
children: "£1,396.00"
|
|
434
|
+
}),
|
|
435
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
436
|
+
size: "sm",
|
|
437
|
+
value: -6.8
|
|
438
|
+
})
|
|
439
|
+
]
|
|
440
|
+
}),
|
|
441
|
+
/* @__PURE__ */ jsxs("div", {
|
|
442
|
+
className: "delta-table__row",
|
|
443
|
+
children: [
|
|
444
|
+
/* @__PURE__ */ jsx("span", { children: "Dual monitor arm" }),
|
|
445
|
+
/* @__PURE__ */ jsx("span", {
|
|
446
|
+
className: "delta-table__value",
|
|
447
|
+
children: "£534.00"
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
450
|
+
size: "sm",
|
|
451
|
+
value: .4
|
|
452
|
+
})
|
|
453
|
+
]
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
})
|
|
457
|
+
})]
|
|
458
|
+
}),
|
|
459
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
460
|
+
id: "precision",
|
|
461
|
+
title: "Precision",
|
|
462
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
463
|
+
"One decimal place by default. Use ",
|
|
464
|
+
/* @__PURE__ */ jsxs("code", { children: ["precision=", "{0}"] }),
|
|
465
|
+
" for large swings, where a decimal adds nothing, and ",
|
|
466
|
+
/* @__PURE__ */ jsx("code", { children: "2" }),
|
|
467
|
+
" only where small differences really matter, such as a conversion rate."
|
|
468
|
+
] }),
|
|
469
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
470
|
+
code: `
|
|
471
|
+
<Delta value={146.3} precision={0} />
|
|
472
|
+
<Delta value={6.25} />
|
|
473
|
+
<Delta value={6.25} precision={2} />`,
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
476
|
+
value: 146.3,
|
|
477
|
+
precision: 0
|
|
478
|
+
}),
|
|
479
|
+
/* @__PURE__ */ jsx(Delta, { value: 6.25 }),
|
|
480
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
481
|
+
value: 6.25,
|
|
482
|
+
precision: 2
|
|
483
|
+
})
|
|
484
|
+
]
|
|
485
|
+
})
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
488
|
+
id: "both-themes",
|
|
489
|
+
title: "In both themes",
|
|
490
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every state and both sizes, light and dark side by side." }),
|
|
491
|
+
children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs("div", {
|
|
492
|
+
className: "delta-rows",
|
|
493
|
+
children: [
|
|
494
|
+
/* @__PURE__ */ jsxs("div", {
|
|
495
|
+
className: "delta-row",
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
498
|
+
value: 18.2,
|
|
499
|
+
label: "vs yesterday"
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ jsx(Delta, { value: -4 }),
|
|
502
|
+
/* @__PURE__ */ jsx(Delta, { value: .3 })
|
|
503
|
+
]
|
|
504
|
+
}),
|
|
505
|
+
/* @__PURE__ */ jsxs("div", {
|
|
506
|
+
className: "delta-row",
|
|
507
|
+
children: [/* @__PURE__ */ jsx(Delta, {
|
|
508
|
+
value: 12.5,
|
|
509
|
+
positiveIsGood: false,
|
|
510
|
+
label: "refunds"
|
|
511
|
+
}), /* @__PURE__ */ jsx(Delta, {
|
|
512
|
+
value: -8.4,
|
|
513
|
+
positiveIsGood: false
|
|
514
|
+
})]
|
|
515
|
+
}),
|
|
516
|
+
/* @__PURE__ */ jsxs("div", {
|
|
517
|
+
className: "delta-row",
|
|
518
|
+
children: [
|
|
519
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
520
|
+
size: "sm",
|
|
521
|
+
value: 18.2
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
524
|
+
size: "sm",
|
|
525
|
+
value: -4
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
528
|
+
size: "sm",
|
|
529
|
+
value: .3
|
|
530
|
+
})
|
|
531
|
+
]
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ jsx("div", {
|
|
534
|
+
className: "delta-row",
|
|
535
|
+
children: /* @__PURE__ */ jsx(Delta, {
|
|
536
|
+
value: Number.POSITIVE_INFINITY,
|
|
537
|
+
baselineLabel: "in the previous 30 days"
|
|
538
|
+
})
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ jsxs("div", {
|
|
541
|
+
className: "delta-sentences",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
544
|
+
variant: "sentence",
|
|
545
|
+
value: 25,
|
|
546
|
+
label: "vs previous 30 days"
|
|
547
|
+
}),
|
|
548
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
549
|
+
variant: "sentence",
|
|
550
|
+
value: -10,
|
|
551
|
+
label: "vs previous 30 days"
|
|
552
|
+
}),
|
|
553
|
+
/* @__PURE__ */ jsx(Delta, {
|
|
554
|
+
variant: "sentence",
|
|
555
|
+
value: 0,
|
|
556
|
+
label: "vs previous 30 days"
|
|
557
|
+
})
|
|
558
|
+
]
|
|
559
|
+
})
|
|
560
|
+
]
|
|
561
|
+
}) })
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
564
|
+
id: "format-delta",
|
|
565
|
+
title: "formatDelta",
|
|
566
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
567
|
+
"The formatter the pill uses, exported for text, tooltips and exports that need the same wording: a plus for a rise, a true minus sign for a fall, UK number formatting, and no sign at all when the change rounds to nothing. ",
|
|
568
|
+
/* @__PURE__ */ jsx("code", { children: "precision" }),
|
|
569
|
+
" is rounded and held between 0 and 4."
|
|
570
|
+
] }),
|
|
571
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
572
|
+
columns: ["Call", "Returns"],
|
|
573
|
+
rows: [
|
|
574
|
+
[code("formatDelta(18.2)"), code(`'${formatDelta(18.2)}'`)],
|
|
575
|
+
[code("formatDelta(-4)"), code(`'${formatDelta(-4)}'`)],
|
|
576
|
+
[code("formatDelta(0.04)"), code(`'${formatDelta(.04)}'`)],
|
|
577
|
+
[code("formatDelta(6.254, 2)"), code(`'${formatDelta(6.254, 2)}'`)],
|
|
578
|
+
[code("formatDelta(1204.56, 0)"), code(`'${formatDelta(1204.56, 0)}'`)]
|
|
579
|
+
]
|
|
580
|
+
})
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
583
|
+
id: "guidelines",
|
|
584
|
+
title: "Guidelines",
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
587
|
+
do: {
|
|
588
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
589
|
+
className: "delta-stat",
|
|
590
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
591
|
+
className: "delta-figure",
|
|
592
|
+
children: "£4,218.40"
|
|
593
|
+
}), /* @__PURE__ */ jsx(Delta, {
|
|
594
|
+
value: 18.2,
|
|
595
|
+
label: "vs yesterday"
|
|
596
|
+
})]
|
|
597
|
+
}),
|
|
598
|
+
caption: "The figure stays ink. The delta carries the colour on its own pill."
|
|
599
|
+
},
|
|
600
|
+
dont: {
|
|
601
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
602
|
+
className: "delta-stat",
|
|
603
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
604
|
+
className: "delta-figure",
|
|
605
|
+
"data-painted": "",
|
|
606
|
+
children: "£4,218.40"
|
|
607
|
+
}), /* @__PURE__ */ jsx(Delta, {
|
|
608
|
+
value: 18.2,
|
|
609
|
+
label: "vs yesterday"
|
|
610
|
+
})]
|
|
611
|
+
}),
|
|
612
|
+
caption: "A green figure reads as a different kind of number, and the page fills with colour."
|
|
613
|
+
}
|
|
614
|
+
}),
|
|
615
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
616
|
+
do: {
|
|
617
|
+
children: /* @__PURE__ */ jsx(Delta, {
|
|
618
|
+
value: 12.5,
|
|
619
|
+
positiveIsGood: false,
|
|
620
|
+
label: "refunds vs last month"
|
|
621
|
+
}),
|
|
622
|
+
caption: "Refunds rising is bad news, so the pill is red."
|
|
623
|
+
},
|
|
624
|
+
dont: {
|
|
625
|
+
children: /* @__PURE__ */ jsx(Delta, {
|
|
626
|
+
value: 12.5,
|
|
627
|
+
label: "refunds vs last month"
|
|
628
|
+
}),
|
|
629
|
+
caption: "Left at the default, rising refunds look like good news."
|
|
630
|
+
}
|
|
631
|
+
}),
|
|
632
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
633
|
+
"Always say what the change is against: \"vs yesterday\", \"vs last Tuesday\", \"vs this time last week\".",
|
|
634
|
+
"Compare like with like: the same span of time, and the same point in the day for today.",
|
|
635
|
+
"One delta per figure. Two comparisons on one figure belong in a chart or a tooltip."
|
|
636
|
+
] })
|
|
637
|
+
]
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
640
|
+
id: "accessibility",
|
|
641
|
+
title: "Accessibility",
|
|
642
|
+
children: [/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
643
|
+
"The value carries the direction in text: a plus for a rise, a true minus sign for a fall, which screen readers read as minus. The arrow is hidden.",
|
|
644
|
+
"Whether the change is good is shown by colour alone. Where it matters, say it in words nearby, for example in the label (\"refunds vs last month\") or a summary line.",
|
|
645
|
+
"The comparison label is read straight after the value. In the sentence form the whole line is words, read as one: \"+25.0% vs previous 30 days\".",
|
|
646
|
+
"With no baseline the words say it (\"Up from 0\"), so a reader is never told a change is 0% when it is not.",
|
|
647
|
+
"Under reduced motion the arrow turns to its new heading at once instead of swinging; the colour change stays."
|
|
648
|
+
] }), /* @__PURE__ */ jsxs(Note, {
|
|
649
|
+
title: "For tests and styling",
|
|
650
|
+
children: [
|
|
651
|
+
"The root carries ",
|
|
652
|
+
/* @__PURE__ */ jsx("code", { children: "data-state" }),
|
|
653
|
+
" (",
|
|
654
|
+
/* @__PURE__ */ jsx("code", { children: "rising" }),
|
|
655
|
+
", ",
|
|
656
|
+
/* @__PURE__ */ jsx("code", { children: "falling" }),
|
|
657
|
+
" or",
|
|
658
|
+
" ",
|
|
659
|
+
/* @__PURE__ */ jsx("code", { children: "steady" }),
|
|
660
|
+
"), ",
|
|
661
|
+
/* @__PURE__ */ jsx("code", { children: "data-tone" }),
|
|
662
|
+
" (",
|
|
663
|
+
/* @__PURE__ */ jsx("code", { children: "positive" }),
|
|
664
|
+
", ",
|
|
665
|
+
/* @__PURE__ */ jsx("code", { children: "negative" }),
|
|
666
|
+
" or",
|
|
667
|
+
" ",
|
|
668
|
+
/* @__PURE__ */ jsx("code", { children: "neutral" }),
|
|
669
|
+
"),",
|
|
670
|
+
" ",
|
|
671
|
+
/* @__PURE__ */ jsx("code", { children: "data-variant" }),
|
|
672
|
+
" (",
|
|
673
|
+
/* @__PURE__ */ jsx("code", { children: "pill" }),
|
|
674
|
+
" or ",
|
|
675
|
+
/* @__PURE__ */ jsx("code", { children: "sentence" }),
|
|
676
|
+
"), and ",
|
|
677
|
+
/* @__PURE__ */ jsx("code", { children: "data-baseline=\"none\"" }),
|
|
678
|
+
" ",
|
|
679
|
+
"when there was nothing before."
|
|
680
|
+
]
|
|
681
|
+
})]
|
|
682
|
+
}),
|
|
683
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
684
|
+
id: "props",
|
|
685
|
+
title: "Props",
|
|
686
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native span attribute except children." }),
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
689
|
+
title: "Delta",
|
|
690
|
+
rows: [
|
|
691
|
+
{
|
|
692
|
+
name: "value",
|
|
693
|
+
type: "number",
|
|
694
|
+
required: true,
|
|
695
|
+
description: "Percentage change: 18.2 for +18.2%. Infinity (no baseline) says \"Up from 0\"; anything else that is not a finite number reads as 0."
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "positiveIsGood",
|
|
699
|
+
type: "boolean",
|
|
700
|
+
default: "true",
|
|
701
|
+
description: "Whether a rise is good news. Set false for refunds, returns and abandoned checkouts."
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "precision",
|
|
705
|
+
type: "number",
|
|
706
|
+
default: "1",
|
|
707
|
+
description: "Decimal places, 0 to 4."
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "label",
|
|
711
|
+
type: "ReactNode",
|
|
712
|
+
description: "The comparison after the pill, e.g. \"vs yesterday\"."
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
name: "size",
|
|
716
|
+
type: "'sm' | 'md'",
|
|
717
|
+
default: "'md'",
|
|
718
|
+
description: "18px for tables and dense rows, 22px beside figures. The sentence form: 12px and 13px."
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
name: "variant",
|
|
722
|
+
type: "'pill' | 'sentence'",
|
|
723
|
+
default: "'pill'",
|
|
724
|
+
description: "The pill, or one toned line of words with no pill and no arrow."
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: "noBaseline",
|
|
728
|
+
type: "boolean",
|
|
729
|
+
default: "false",
|
|
730
|
+
description: "The earlier figure was 0: says \"Up from 0\" (or \"Down from 0\") in place of the percent. A value of Infinity says the same."
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: "baselineLabel",
|
|
734
|
+
type: "ReactNode",
|
|
735
|
+
default: "label",
|
|
736
|
+
description: "The comparison with no baseline, in place of label: \"in the previous 30 days\"."
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
name: "labels",
|
|
740
|
+
type: "Partial<DeltaLabels>",
|
|
741
|
+
description: "Its words: upFromZero, downFromZero, and noChange (the sentence form). DELTA_LABELS is the English set."
|
|
742
|
+
}
|
|
743
|
+
]
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
746
|
+
title: "percentChange(current, previous)",
|
|
747
|
+
rows: [{
|
|
748
|
+
name: "current",
|
|
749
|
+
type: "number",
|
|
750
|
+
required: true,
|
|
751
|
+
description: "This period's figure."
|
|
752
|
+
}, {
|
|
753
|
+
name: "previous",
|
|
754
|
+
type: "number",
|
|
755
|
+
required: true,
|
|
756
|
+
description: "The earlier figure. 0 gives Infinity (or -Infinity for a fall; 0 when both are 0); a negative one is measured by its size."
|
|
757
|
+
}]
|
|
758
|
+
}),
|
|
759
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
760
|
+
title: "formatDelta(value, precision)",
|
|
761
|
+
rows: [{
|
|
762
|
+
name: "value",
|
|
763
|
+
type: "number",
|
|
764
|
+
required: true,
|
|
765
|
+
description: "Percentage change."
|
|
766
|
+
}, {
|
|
767
|
+
name: "precision",
|
|
768
|
+
type: "number",
|
|
769
|
+
default: "1",
|
|
770
|
+
description: "Decimal places, rounded and held between 0 and 4."
|
|
771
|
+
}]
|
|
772
|
+
})
|
|
773
|
+
]
|
|
774
|
+
})
|
|
775
|
+
]
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
export { Page, Preview };
|