@orbitcommerce/constellation-docs 1.0.0 → 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/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-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-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-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-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-BB3mNl7D.js +1364 -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-C3UcpQJT.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-B38rnzoq.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-LA9XRhZc.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-cfPVTB5V.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-C-4tg6FS.js} +580 -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-BZg-xAbi.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.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-CL0vomno.js +3225 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -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 +10984 -1108
- package/package.json +2 -2
- 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,648 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, 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 { ConditionBuilder, Input, RuleActions, RuleList, RuleTest, Select, Textarea, isConditionComplete, moveItem } from "@orbitcommerce/constellation";
|
|
7
|
+
//#region src/pages/components/rule-list.tsx
|
|
8
|
+
var RATE_FIELDS = [
|
|
9
|
+
{
|
|
10
|
+
value: "cart_total",
|
|
11
|
+
label: "Basket total",
|
|
12
|
+
group: "Basket",
|
|
13
|
+
type: "number",
|
|
14
|
+
prefix: "£"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "weight",
|
|
18
|
+
label: "Total weight",
|
|
19
|
+
group: "Basket",
|
|
20
|
+
type: "number",
|
|
21
|
+
suffix: "kg"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "postcode",
|
|
25
|
+
label: "Postcode area",
|
|
26
|
+
group: "Delivery",
|
|
27
|
+
type: "text",
|
|
28
|
+
placeholder: "IV, KW, HS"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "day",
|
|
32
|
+
label: "Delivery day",
|
|
33
|
+
group: "Delivery",
|
|
34
|
+
type: "weekday"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
var KINDS = [
|
|
38
|
+
{
|
|
39
|
+
value: "flat",
|
|
40
|
+
label: "Flat"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "per_kg",
|
|
44
|
+
label: "Per kg"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "free",
|
|
48
|
+
label: "Free"
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
var RATES = [
|
|
52
|
+
{
|
|
53
|
+
id: "rate-heavy",
|
|
54
|
+
name: "Heavy parcels",
|
|
55
|
+
on: true,
|
|
56
|
+
kind: "flat",
|
|
57
|
+
amount: "24.00",
|
|
58
|
+
conditions: [{
|
|
59
|
+
id: "heavy",
|
|
60
|
+
match: "all",
|
|
61
|
+
conditions: [{
|
|
62
|
+
id: "heavy-a",
|
|
63
|
+
field: "weight",
|
|
64
|
+
operator: "gte",
|
|
65
|
+
value: "30"
|
|
66
|
+
}, {
|
|
67
|
+
id: "heavy-b",
|
|
68
|
+
field: "cart_total",
|
|
69
|
+
operator: "lt",
|
|
70
|
+
value: "1000"
|
|
71
|
+
}]
|
|
72
|
+
}]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "rate-highlands",
|
|
76
|
+
name: "Highlands and islands",
|
|
77
|
+
on: true,
|
|
78
|
+
kind: "per_kg",
|
|
79
|
+
amount: "1.80",
|
|
80
|
+
conditions: [{
|
|
81
|
+
id: "hi",
|
|
82
|
+
match: "any",
|
|
83
|
+
conditions: [{
|
|
84
|
+
id: "hi-a",
|
|
85
|
+
field: "postcode",
|
|
86
|
+
operator: "starts_with",
|
|
87
|
+
value: "IV"
|
|
88
|
+
}]
|
|
89
|
+
}]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "rate-free",
|
|
93
|
+
name: "Free over £750",
|
|
94
|
+
on: false,
|
|
95
|
+
kind: "free",
|
|
96
|
+
amount: "",
|
|
97
|
+
conditions: [{
|
|
98
|
+
id: "free",
|
|
99
|
+
match: "all",
|
|
100
|
+
conditions: [{
|
|
101
|
+
id: "free-a",
|
|
102
|
+
field: "cart_total",
|
|
103
|
+
operator: "gte",
|
|
104
|
+
value: "750"
|
|
105
|
+
}]
|
|
106
|
+
}]
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
var summaryOf = (rate) => {
|
|
110
|
+
const count = rate.conditions.reduce((sum, group) => sum + group.conditions.length, 0);
|
|
111
|
+
return `${KINDS.find((kind) => kind.value === rate.kind)?.label} · ${count} ${count === 1 ? "condition" : "conditions"}`;
|
|
112
|
+
};
|
|
113
|
+
var nextRate = 1;
|
|
114
|
+
function Preview() {
|
|
115
|
+
return /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "rule-list-preview",
|
|
117
|
+
children: /* @__PURE__ */ jsx(RuleList, {
|
|
118
|
+
items: RATES.slice(0, 2),
|
|
119
|
+
getKey: (rate) => rate.id,
|
|
120
|
+
getName: (rate) => rate.name,
|
|
121
|
+
getSummary: summaryOf,
|
|
122
|
+
defaultOpen: "none",
|
|
123
|
+
renderRule: () => null,
|
|
124
|
+
isEnabled: (rate) => rate.on,
|
|
125
|
+
onEnabledChange: () => {}
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function DeliveryRules() {
|
|
130
|
+
const [rates, setRates] = useState(RATES);
|
|
131
|
+
const set = (id, patch) => setRates((now) => now.map((rate) => rate.id === id ? {
|
|
132
|
+
...rate,
|
|
133
|
+
...patch
|
|
134
|
+
} : rate));
|
|
135
|
+
return /* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: "rule-list-stage",
|
|
137
|
+
children: /* @__PURE__ */ jsx(RuleList, {
|
|
138
|
+
"aria-label": "Delivery rules, tried in order",
|
|
139
|
+
items: rates,
|
|
140
|
+
getKey: (rate) => rate.id,
|
|
141
|
+
getName: (rate) => rate.name,
|
|
142
|
+
getSummary: summaryOf,
|
|
143
|
+
onReorder: (from, to) => setRates((now) => moveItem(now, from, to)),
|
|
144
|
+
isEnabled: (rate) => rate.on,
|
|
145
|
+
onEnabledChange: (rate, _, on) => set(rate.id, { on }),
|
|
146
|
+
onDuplicate: (rate, index) => setRates((now) => {
|
|
147
|
+
const next = [...now];
|
|
148
|
+
next.splice(index + 1, 0, {
|
|
149
|
+
...rate,
|
|
150
|
+
id: `rate-copy-${nextRate++}`,
|
|
151
|
+
name: `${rate.name} (copy)`
|
|
152
|
+
});
|
|
153
|
+
return next;
|
|
154
|
+
}),
|
|
155
|
+
onRemove: (index) => setRates((now) => now.filter((_, i) => i !== index)),
|
|
156
|
+
onRestore: (rate, index) => setRates((now) => {
|
|
157
|
+
const next = [...now];
|
|
158
|
+
next.splice(index, 0, rate);
|
|
159
|
+
return next;
|
|
160
|
+
}),
|
|
161
|
+
onAdd: () => setRates((now) => [...now, {
|
|
162
|
+
id: `rate-new-${nextRate++}`,
|
|
163
|
+
name: `Rule ${now.length + 1}`,
|
|
164
|
+
on: true,
|
|
165
|
+
kind: "flat",
|
|
166
|
+
amount: "",
|
|
167
|
+
conditions: [{
|
|
168
|
+
id: `g-${nextRate}`,
|
|
169
|
+
match: "all",
|
|
170
|
+
conditions: []
|
|
171
|
+
}]
|
|
172
|
+
}]),
|
|
173
|
+
renderRule: (rate) => /* @__PURE__ */ jsxs("div", {
|
|
174
|
+
className: "rule-list-body",
|
|
175
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
176
|
+
className: "rule-list-rate",
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsxs("label", {
|
|
179
|
+
className: "rule-list-field",
|
|
180
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Name" }), /* @__PURE__ */ jsx(Input, {
|
|
181
|
+
size: "sm",
|
|
182
|
+
value: rate.name,
|
|
183
|
+
onChange: (event) => set(rate.id, { name: event.target.value })
|
|
184
|
+
})]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsxs("div", {
|
|
187
|
+
className: "rule-list-field",
|
|
188
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
189
|
+
"aria-hidden": "true",
|
|
190
|
+
children: "Charge"
|
|
191
|
+
}), /* @__PURE__ */ jsx(Select, {
|
|
192
|
+
size: "sm",
|
|
193
|
+
"aria-label": `Charge for ${rate.name}`,
|
|
194
|
+
value: rate.kind,
|
|
195
|
+
options: KINDS,
|
|
196
|
+
onValueChange: (kind) => set(rate.id, { kind })
|
|
197
|
+
})]
|
|
198
|
+
}),
|
|
199
|
+
rate.kind !== "free" ? /* @__PURE__ */ jsxs("div", {
|
|
200
|
+
className: "rule-list-field",
|
|
201
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
children: rate.kind === "flat" ? "Amount" : "Per kg"
|
|
204
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
205
|
+
size: "sm",
|
|
206
|
+
"aria-label": `Amount for ${rate.name}`,
|
|
207
|
+
prefix: "£",
|
|
208
|
+
inputMode: "decimal",
|
|
209
|
+
value: rate.amount,
|
|
210
|
+
onChange: (event) => set(rate.id, { amount: event.target.value })
|
|
211
|
+
})]
|
|
212
|
+
}) : null
|
|
213
|
+
]
|
|
214
|
+
}), /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
215
|
+
fields: RATE_FIELDS,
|
|
216
|
+
value: rate.conditions,
|
|
217
|
+
onValueChange: (conditions) => set(rate.id, { conditions }),
|
|
218
|
+
maxConditions: 5
|
|
219
|
+
})]
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
var CHAT_FIELDS = [
|
|
225
|
+
{
|
|
226
|
+
value: "page",
|
|
227
|
+
label: "Page address",
|
|
228
|
+
group: "Visitor",
|
|
229
|
+
type: "text",
|
|
230
|
+
placeholder: "/checkout"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: "returning",
|
|
234
|
+
label: "Returning visitor",
|
|
235
|
+
group: "Visitor",
|
|
236
|
+
type: "boolean"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
value: "hours",
|
|
240
|
+
label: "Time of day",
|
|
241
|
+
group: "Conversation",
|
|
242
|
+
type: "time"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
value: "waiting",
|
|
246
|
+
label: "Minutes waiting",
|
|
247
|
+
group: "Conversation",
|
|
248
|
+
type: "number",
|
|
249
|
+
suffix: "min"
|
|
250
|
+
}
|
|
251
|
+
];
|
|
252
|
+
var ACTION_TYPES = [
|
|
253
|
+
{
|
|
254
|
+
value: "assign",
|
|
255
|
+
label: "Assign to a team",
|
|
256
|
+
unique: true,
|
|
257
|
+
defaultParams: () => ({ team: "sales" }),
|
|
258
|
+
renderParams: ({ action, setParam, position }) => /* @__PURE__ */ jsx(Select, {
|
|
259
|
+
size: "sm",
|
|
260
|
+
"aria-label": `Team, action ${position}`,
|
|
261
|
+
value: String(action.params.team ?? ""),
|
|
262
|
+
options: [
|
|
263
|
+
{
|
|
264
|
+
value: "sales",
|
|
265
|
+
label: "Sales"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
value: "support",
|
|
269
|
+
label: "Customer support"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
value: "trade",
|
|
273
|
+
label: "Trade accounts"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
onValueChange: (team) => setParam("team", team)
|
|
277
|
+
})
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
value: "message",
|
|
281
|
+
label: "Send a message",
|
|
282
|
+
wait: true,
|
|
283
|
+
defaultParams: () => ({ text: "" }),
|
|
284
|
+
renderParams: ({ action, setParam, position }) => /* @__PURE__ */ jsx(Textarea, {
|
|
285
|
+
size: "sm",
|
|
286
|
+
rows: 2,
|
|
287
|
+
"aria-label": `Message, action ${position}`,
|
|
288
|
+
placeholder: "Hello, can we help with your order?",
|
|
289
|
+
value: String(action.params.text ?? ""),
|
|
290
|
+
onChange: (event) => setParam("text", event.target.value)
|
|
291
|
+
})
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
value: "tag",
|
|
295
|
+
label: "Add a tag",
|
|
296
|
+
defaultParams: () => ({ tag: "" }),
|
|
297
|
+
renderParams: ({ action, setParam, position }) => /* @__PURE__ */ jsx(Input, {
|
|
298
|
+
size: "sm",
|
|
299
|
+
"aria-label": `Tag, action ${position}`,
|
|
300
|
+
placeholder: "Checkout help",
|
|
301
|
+
value: String(action.params.tag ?? ""),
|
|
302
|
+
onChange: (event) => setParam("tag", event.target.value)
|
|
303
|
+
})
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
value: "close",
|
|
307
|
+
label: "Close the conversation",
|
|
308
|
+
unique: true,
|
|
309
|
+
wait: true
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
function ChatAutomation() {
|
|
313
|
+
const [conditions, setConditions] = useState([{
|
|
314
|
+
id: "chat",
|
|
315
|
+
match: "all",
|
|
316
|
+
conditions: [{
|
|
317
|
+
id: "chat-a",
|
|
318
|
+
field: "page",
|
|
319
|
+
operator: "starts_with",
|
|
320
|
+
value: "/checkout"
|
|
321
|
+
}, {
|
|
322
|
+
id: "chat-b",
|
|
323
|
+
field: "waiting",
|
|
324
|
+
operator: "gte",
|
|
325
|
+
value: "2"
|
|
326
|
+
}]
|
|
327
|
+
}]);
|
|
328
|
+
const [actions, setActions] = useState([{
|
|
329
|
+
id: "act-a",
|
|
330
|
+
type: "message",
|
|
331
|
+
params: { text: "Hello, can we help you finish your order?" },
|
|
332
|
+
wait: 1
|
|
333
|
+
}, {
|
|
334
|
+
id: "act-b",
|
|
335
|
+
type: "assign",
|
|
336
|
+
params: { team: "sales" }
|
|
337
|
+
}]);
|
|
338
|
+
const complete = conditions.every((group) => group.conditions.every((condition) => isConditionComplete(condition, CHAT_FIELDS)));
|
|
339
|
+
const test = (id) => new Promise((resolve) => setTimeout(() => resolve({
|
|
340
|
+
matched: !id.endsWith("7"),
|
|
341
|
+
conditions: [{
|
|
342
|
+
label: "Page address starts with /checkout",
|
|
343
|
+
matched: true,
|
|
344
|
+
reason: "the visitor is on /checkout/delivery"
|
|
345
|
+
}, {
|
|
346
|
+
label: "Minutes waiting is at least 2",
|
|
347
|
+
matched: !id.endsWith("7"),
|
|
348
|
+
reason: id.endsWith("7") ? "they have waited 40 seconds" : "they have waited 3 minutes"
|
|
349
|
+
}]
|
|
350
|
+
}), 500));
|
|
351
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
352
|
+
className: "rule-list-stage rule-list-automation",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsxs("section", {
|
|
355
|
+
className: "rule-list-part",
|
|
356
|
+
"aria-labelledby": "chat-when",
|
|
357
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
358
|
+
className: "rule-list-part__title",
|
|
359
|
+
id: "chat-when",
|
|
360
|
+
children: "When"
|
|
361
|
+
}), /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
362
|
+
fields: CHAT_FIELDS,
|
|
363
|
+
value: conditions,
|
|
364
|
+
onValueChange: setConditions,
|
|
365
|
+
maxConditions: 5
|
|
366
|
+
})]
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ jsx(RuleActions, {
|
|
369
|
+
types: ACTION_TYPES,
|
|
370
|
+
value: actions,
|
|
371
|
+
onValueChange: setActions,
|
|
372
|
+
max: 4
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ jsx(RuleTest, {
|
|
375
|
+
className: "rule-list-test",
|
|
376
|
+
onTest: test,
|
|
377
|
+
disabledReason: complete ? void 0 : "Finish the conditions first."
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function Page() {
|
|
383
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
384
|
+
title: "Rule list",
|
|
385
|
+
status: "new",
|
|
386
|
+
importNames: [
|
|
387
|
+
"RuleList",
|
|
388
|
+
"RuleActions",
|
|
389
|
+
"RuleTest"
|
|
390
|
+
],
|
|
391
|
+
lead: "The rules of a delivery rate, a price list or a chat automation: rule cards that drag to reorder and fold to a summary, each with its switch, Duplicate and Remove; the Then rows that say what a rule does; and a dry run that reads back whether a rule would match.",
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
394
|
+
id: "basics",
|
|
395
|
+
title: "Rule cards",
|
|
396
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
397
|
+
/* @__PURE__ */ jsx("code", { children: "RuleList" }),
|
|
398
|
+
" draws a card per rule, in the order they are tried. Each card folds to its name and a summary (\"Flat · 2 conditions\"), drags by its handle to reorder (or lifts from the keyboard with Space, as a",
|
|
399
|
+
" ",
|
|
400
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
401
|
+
to: "/components/sortable-card",
|
|
402
|
+
children: "sortable card"
|
|
403
|
+
}),
|
|
404
|
+
" does), and carries a switch (",
|
|
405
|
+
/* @__PURE__ */ jsx("code", { children: "onEnabledChange" }),
|
|
406
|
+
"), Duplicate and Remove in its header. Its body is the rule's editor, from ",
|
|
407
|
+
/* @__PURE__ */ jsx("code", { children: "renderRule" }),
|
|
408
|
+
": here the charge and a ",
|
|
409
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
410
|
+
to: "/components/condition-builder",
|
|
411
|
+
children: "condition builder"
|
|
412
|
+
}),
|
|
413
|
+
". Duplicate a rule, remove one and undo it, or switch the last one on."
|
|
414
|
+
] }),
|
|
415
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
416
|
+
align: "fill",
|
|
417
|
+
code: `
|
|
418
|
+
<RuleList
|
|
419
|
+
aria-label="Delivery rules, tried in order"
|
|
420
|
+
items={rates}
|
|
421
|
+
getKey={(rate) => rate.id}
|
|
422
|
+
getName={(rate) => rate.name}
|
|
423
|
+
getSummary={(rate) => \`\${kindOf(rate)} · \${countOf(rate)} conditions\`}
|
|
424
|
+
onReorder={(from, to) => setRates((now) => moveItem(now, from, to))}
|
|
425
|
+
isEnabled={(rate) => rate.on}
|
|
426
|
+
onEnabledChange={(rate, index, on) => update(rate.id, { on })}
|
|
427
|
+
onDuplicate={duplicate}
|
|
428
|
+
onRemove={remove}
|
|
429
|
+
onRestore={restore}
|
|
430
|
+
onAdd={addRate}
|
|
431
|
+
renderRule={(rate) => (
|
|
432
|
+
<>
|
|
433
|
+
<RateFields rate={rate} />
|
|
434
|
+
<ConditionBuilder fields={fields} value={rate.conditions} onValueChange={(conditions) => update(rate.id, { conditions })} />
|
|
435
|
+
</>
|
|
436
|
+
)}
|
|
437
|
+
/>`,
|
|
438
|
+
children: /* @__PURE__ */ jsx(DeliveryRules, {})
|
|
439
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
440
|
+
title: "Focus after each change",
|
|
441
|
+
children: "A copy is put after its rule, opens and takes focus on its disclosure; removing a rule moves focus to the next card (or Add) and offers Undo for 8 seconds; a new rule opens with its first field focused. Each change is said politely."
|
|
442
|
+
})]
|
|
443
|
+
}),
|
|
444
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
445
|
+
id: "actions",
|
|
446
|
+
title: "Then: what a rule does, and a dry run",
|
|
447
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
448
|
+
/* @__PURE__ */ jsx("code", { children: "RuleActions" }),
|
|
449
|
+
" is the \"Then\" rows: each an action type (",
|
|
450
|
+
/* @__PURE__ */ jsx("code", { children: "types" }),
|
|
451
|
+
") with its own settings from",
|
|
452
|
+
" ",
|
|
453
|
+
/* @__PURE__ */ jsx("code", { children: "renderParams" }),
|
|
454
|
+
", a wait in minutes first where the type has ",
|
|
455
|
+
/* @__PURE__ */ jsx("code", { children: "wait" }),
|
|
456
|
+
", and a type marked",
|
|
457
|
+
" ",
|
|
458
|
+
/* @__PURE__ */ jsx("code", { children: "unique" }),
|
|
459
|
+
" held off in the other rows once it is picked. ",
|
|
460
|
+
/* @__PURE__ */ jsx("code", { children: "RuleTest" }),
|
|
461
|
+
" runs the rule against a conversation without acting on it and reads back the verdict with a line per condition and its reason; it is held off, with its reason, until the conditions are whole. Test an id ending in 7 to see a miss."
|
|
462
|
+
] }),
|
|
463
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
464
|
+
align: "fill",
|
|
465
|
+
code: `
|
|
466
|
+
<ConditionBuilder fields={chatFields} value={conditions} onValueChange={setConditions} />
|
|
467
|
+
<RuleActions types={actionTypes} value={actions} onValueChange={setActions} max={4} />
|
|
468
|
+
<RuleTest onTest={(id) => api.testRule(rule, id)} disabledReason={complete ? undefined : 'Finish the conditions first.'} />`,
|
|
469
|
+
children: /* @__PURE__ */ jsx(ChatAutomation, {})
|
|
470
|
+
})
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
473
|
+
id: "both-themes",
|
|
474
|
+
title: "In both themes",
|
|
475
|
+
description: /* @__PURE__ */ jsx("p", { children: "Two rules folded to their summaries, one switched off." }),
|
|
476
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
477
|
+
align: "start",
|
|
478
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
479
|
+
className: "rule-list-theme",
|
|
480
|
+
children: /* @__PURE__ */ jsx(RuleList, {
|
|
481
|
+
items: [RATES[0], RATES[2]],
|
|
482
|
+
getKey: (rate) => rate.id,
|
|
483
|
+
getName: (rate) => rate.name,
|
|
484
|
+
getSummary: summaryOf,
|
|
485
|
+
defaultOpen: "none",
|
|
486
|
+
renderRule: () => /* @__PURE__ */ jsx("p", {
|
|
487
|
+
className: "rule-list-note",
|
|
488
|
+
children: "The rule's editor."
|
|
489
|
+
}),
|
|
490
|
+
isEnabled: (rate) => rate.on,
|
|
491
|
+
onEnabledChange: () => {},
|
|
492
|
+
onDuplicate: () => {},
|
|
493
|
+
onRemove: () => {}
|
|
494
|
+
})
|
|
495
|
+
})
|
|
496
|
+
})
|
|
497
|
+
}),
|
|
498
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
499
|
+
id: "accessibility",
|
|
500
|
+
title: "Accessibility",
|
|
501
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
502
|
+
"The rules are a list (name it with aria-label); each card’s disclosure is named \"Expand Heavy parcels\" or \"Collapse Heavy parcels\", and its switch, Duplicate and Remove are named for the rule.",
|
|
503
|
+
"The drag handle is the sortable list’s: Space lifts a card, the arrows move it, Space drops it and Escape puts it back, each move said aloud.",
|
|
504
|
+
"A switched-off rule says \"Off\" in its summary, in words as well as in its quieter title.",
|
|
505
|
+
"RuleActions is a group named \"Then\"; each type control and setting is named with its place (\"Do this, action 2\").",
|
|
506
|
+
"RuleTest is a group named by its title; Enter in the id runs it (it is not a form, so it is safe inside one), and the verdict is said politely. Each condition’s line says Matched or Not matched in words, beside its mark."
|
|
507
|
+
] })
|
|
508
|
+
}),
|
|
509
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
510
|
+
id: "props",
|
|
511
|
+
title: "Props",
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
514
|
+
title: "RuleList",
|
|
515
|
+
rows: [
|
|
516
|
+
{
|
|
517
|
+
name: "items",
|
|
518
|
+
type: "T[]",
|
|
519
|
+
required: true,
|
|
520
|
+
description: "The rules, in the order they are tried."
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: "getKey",
|
|
524
|
+
type: "(item: T, index: number) => string",
|
|
525
|
+
required: true,
|
|
526
|
+
description: "A stable key per rule."
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: "getName",
|
|
530
|
+
type: "(item: T, index: number) => string",
|
|
531
|
+
required: true,
|
|
532
|
+
description: "The card’s title, and the name its controls and announcements use."
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
name: "getSummary",
|
|
536
|
+
type: "(item: T, index: number) => ReactNode",
|
|
537
|
+
description: "The line under the title: \"Flat · 3 conditions\"."
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "renderRule",
|
|
541
|
+
type: "(item: T, state) => ReactNode",
|
|
542
|
+
required: true,
|
|
543
|
+
description: "The rule’s editor, in the card’s body. state: { index, open, enabled }."
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: "onReorder",
|
|
547
|
+
type: "(from: number, to: number) => void",
|
|
548
|
+
description: "The cards drag to reorder. Without it they stay in place."
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "isEnabled / onEnabledChange",
|
|
552
|
+
type: "(item, index) => boolean / (item, index, on) => void",
|
|
553
|
+
description: "The card’s switch."
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "onDuplicate",
|
|
557
|
+
type: "(item: T, index: number) => void",
|
|
558
|
+
description: "Copies a rule; insert the copy after it."
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "onRemove / onRestore",
|
|
562
|
+
type: "(index) => void / (item, index) => void",
|
|
563
|
+
description: "Removes a rule, and puts it back from Undo."
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: "onAdd",
|
|
567
|
+
type: "() => void",
|
|
568
|
+
description: "Appends a rule, which opens with its first field focused."
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: "defaultOpen",
|
|
572
|
+
type: "'first' | 'all' | 'none'",
|
|
573
|
+
default: "'first'",
|
|
574
|
+
description: "Which cards start open."
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: "labels",
|
|
578
|
+
type: "Partial<RuleListLabels>",
|
|
579
|
+
description: "The words it says. ruleListLabels is the English set."
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
}),
|
|
583
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
584
|
+
title: "RuleActions",
|
|
585
|
+
rows: [
|
|
586
|
+
{
|
|
587
|
+
name: "types",
|
|
588
|
+
type: "RuleActionType[]",
|
|
589
|
+
required: true,
|
|
590
|
+
description: "{ value, label, defaultParams?, renderParams?, wait?, unique? }."
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
name: "value",
|
|
594
|
+
type: "RuleAction[]",
|
|
595
|
+
required: true,
|
|
596
|
+
description: "The actions, in the order they run: { id, type, params, wait? }."
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "onValueChange",
|
|
600
|
+
type: "(actions: RuleAction[]) => void",
|
|
601
|
+
description: "Called with the new actions."
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: "max",
|
|
605
|
+
type: "number",
|
|
606
|
+
description: "The most actions a rule may hold."
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: "errors",
|
|
610
|
+
type: "Record<string, ReactNode>",
|
|
611
|
+
description: "Problems by action id."
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
name: "labels",
|
|
615
|
+
type: "Partial<RuleActionsLabels>",
|
|
616
|
+
description: "ruleActionsLabels is the English set."
|
|
617
|
+
}
|
|
618
|
+
]
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
621
|
+
title: "RuleTest",
|
|
622
|
+
rows: [
|
|
623
|
+
{
|
|
624
|
+
name: "onTest",
|
|
625
|
+
type: "(input: string) => RuleTestResult | Promise<RuleTestResult>",
|
|
626
|
+
required: true,
|
|
627
|
+
description: "Runs the rule against the id: { matched, conditions: { label, matched, reason? }[] }."
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "disabledReason",
|
|
631
|
+
type: "ReactNode",
|
|
632
|
+
description: "Why Test is off, while it is."
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: "labels",
|
|
636
|
+
type: "Partial<RuleTestLabels>",
|
|
637
|
+
description: "ruleTestLabels is the English set."
|
|
638
|
+
}
|
|
639
|
+
]
|
|
640
|
+
})
|
|
641
|
+
]
|
|
642
|
+
}),
|
|
643
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
644
|
+
]
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
export { Page, Preview };
|