@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,715 @@
|
|
|
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, 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, Combobox, ConditionBuilder, conditionOperators } from "@orbitcommerce/constellation";
|
|
7
|
+
//#region src/pages/components/condition-builder.tsx
|
|
8
|
+
var SEGMENT_FIELDS = [
|
|
9
|
+
{
|
|
10
|
+
value: "total_spent",
|
|
11
|
+
label: "Total spent",
|
|
12
|
+
group: "Customer",
|
|
13
|
+
type: "number",
|
|
14
|
+
prefix: "£"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "order_count",
|
|
18
|
+
label: "Number of orders",
|
|
19
|
+
group: "Customer",
|
|
20
|
+
type: "number"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "email",
|
|
24
|
+
label: "Email",
|
|
25
|
+
group: "Customer",
|
|
26
|
+
type: "text",
|
|
27
|
+
placeholder: "@harbourdesk.example"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "consent",
|
|
31
|
+
label: "Marketing consent",
|
|
32
|
+
group: "Customer",
|
|
33
|
+
type: "boolean"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "tags",
|
|
37
|
+
label: "Tags",
|
|
38
|
+
group: "Customer",
|
|
39
|
+
type: "tags",
|
|
40
|
+
placeholder: "Add a tag"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "last_order",
|
|
44
|
+
label: "Last order",
|
|
45
|
+
group: "Order",
|
|
46
|
+
type: "date"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "country",
|
|
50
|
+
label: "Delivery country",
|
|
51
|
+
group: "Order",
|
|
52
|
+
type: "choice",
|
|
53
|
+
placeholder: "Choose a country",
|
|
54
|
+
options: [
|
|
55
|
+
{
|
|
56
|
+
value: "GB",
|
|
57
|
+
label: "United Kingdom"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: "IE",
|
|
61
|
+
label: "Ireland"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: "FR",
|
|
65
|
+
label: "France"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: "DE",
|
|
69
|
+
label: "Germany"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
var SEGMENT = [{
|
|
75
|
+
id: "seg-1",
|
|
76
|
+
match: "all",
|
|
77
|
+
conditions: [{
|
|
78
|
+
id: "seg-1-a",
|
|
79
|
+
field: "total_spent",
|
|
80
|
+
operator: "gt",
|
|
81
|
+
value: "500"
|
|
82
|
+
}, {
|
|
83
|
+
id: "seg-1-b",
|
|
84
|
+
field: "consent",
|
|
85
|
+
operator: "is",
|
|
86
|
+
value: true
|
|
87
|
+
}]
|
|
88
|
+
}, {
|
|
89
|
+
id: "seg-2",
|
|
90
|
+
match: "any",
|
|
91
|
+
conditions: [{
|
|
92
|
+
id: "seg-2-a",
|
|
93
|
+
field: "tags",
|
|
94
|
+
operator: "has_any",
|
|
95
|
+
value: ["Trade", "Wholesale"]
|
|
96
|
+
}]
|
|
97
|
+
}];
|
|
98
|
+
var RATE_FIELDS = [
|
|
99
|
+
{
|
|
100
|
+
value: "cart_total",
|
|
101
|
+
label: "Basket total",
|
|
102
|
+
group: "Basket",
|
|
103
|
+
type: "number",
|
|
104
|
+
prefix: "£"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: "weight",
|
|
108
|
+
label: "Total weight",
|
|
109
|
+
group: "Basket",
|
|
110
|
+
type: "number",
|
|
111
|
+
suffix: "kg"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
value: "postcode",
|
|
115
|
+
label: "Postcode area",
|
|
116
|
+
group: "Delivery",
|
|
117
|
+
type: "text",
|
|
118
|
+
placeholder: "IV, KW, HS"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
value: "day",
|
|
122
|
+
label: "Delivery day",
|
|
123
|
+
group: "Delivery",
|
|
124
|
+
type: "weekday"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: "window",
|
|
128
|
+
label: "Order time",
|
|
129
|
+
group: "Delivery",
|
|
130
|
+
type: "time"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: "category",
|
|
134
|
+
label: "Product category",
|
|
135
|
+
group: "Products",
|
|
136
|
+
type: "tree",
|
|
137
|
+
placeholder: "Choose a category",
|
|
138
|
+
loadChildren: (parentId) => new Promise((resolve) => setTimeout(() => resolve(CATEGORY_LEVELS[parentId ?? ""] ?? []), 300)),
|
|
139
|
+
loadPath: (id) => new Promise((resolve) => setTimeout(() => resolve(CATEGORY_PATHS[id] ?? []), 300))
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: "brand",
|
|
143
|
+
label: "Brand",
|
|
144
|
+
group: "Products",
|
|
145
|
+
type: "brand"
|
|
146
|
+
}
|
|
147
|
+
];
|
|
148
|
+
var RATE = [{
|
|
149
|
+
id: "rate",
|
|
150
|
+
match: "all",
|
|
151
|
+
conditions: [
|
|
152
|
+
{
|
|
153
|
+
id: "rate-a",
|
|
154
|
+
field: "weight",
|
|
155
|
+
operator: "between",
|
|
156
|
+
value: {
|
|
157
|
+
from: "30",
|
|
158
|
+
to: ""
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: "rate-b",
|
|
163
|
+
field: "day",
|
|
164
|
+
operator: "on_days",
|
|
165
|
+
value: ["sat"]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "rate-c",
|
|
169
|
+
field: "window",
|
|
170
|
+
operator: "time_between",
|
|
171
|
+
value: {
|
|
172
|
+
from: "09:00",
|
|
173
|
+
to: "13:00"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "rate-d",
|
|
178
|
+
field: "category",
|
|
179
|
+
operator: "in_tree",
|
|
180
|
+
value: "task-chairs"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}];
|
|
184
|
+
/** A store's categories, served a level at a time. */
|
|
185
|
+
var CATEGORY_LEVELS = {
|
|
186
|
+
"": [{
|
|
187
|
+
id: "office",
|
|
188
|
+
label: "Office",
|
|
189
|
+
hasChildren: true
|
|
190
|
+
}, {
|
|
191
|
+
id: "lighting",
|
|
192
|
+
label: "Lighting",
|
|
193
|
+
hasChildren: true
|
|
194
|
+
}],
|
|
195
|
+
office: [{
|
|
196
|
+
id: "chairs",
|
|
197
|
+
label: "Chairs",
|
|
198
|
+
hasChildren: true
|
|
199
|
+
}, {
|
|
200
|
+
id: "desks",
|
|
201
|
+
label: "Desks"
|
|
202
|
+
}],
|
|
203
|
+
chairs: [{
|
|
204
|
+
id: "task-chairs",
|
|
205
|
+
label: "Task chairs"
|
|
206
|
+
}, {
|
|
207
|
+
id: "lounge-chairs",
|
|
208
|
+
label: "Lounge chairs"
|
|
209
|
+
}],
|
|
210
|
+
lighting: [{
|
|
211
|
+
id: "desk-lamps",
|
|
212
|
+
label: "Desk lamps"
|
|
213
|
+
}]
|
|
214
|
+
};
|
|
215
|
+
var CATEGORY_PATHS = { "task-chairs": [
|
|
216
|
+
{
|
|
217
|
+
id: "office",
|
|
218
|
+
label: "Office",
|
|
219
|
+
hasChildren: true
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "chairs",
|
|
223
|
+
label: "Chairs",
|
|
224
|
+
hasChildren: true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "task-chairs",
|
|
228
|
+
label: "Task chairs"
|
|
229
|
+
}
|
|
230
|
+
] };
|
|
231
|
+
/** An operator of the host's own for a field type the kit does not know: a brand, edited by a picker of the host's. */
|
|
232
|
+
var BRAND_OPERATORS = [...conditionOperators, {
|
|
233
|
+
value: "by_brand",
|
|
234
|
+
label: "is by",
|
|
235
|
+
types: ["brand"],
|
|
236
|
+
shape: "custom"
|
|
237
|
+
}];
|
|
238
|
+
var BRANDS = [
|
|
239
|
+
{
|
|
240
|
+
value: "arden",
|
|
241
|
+
label: "Arden"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
value: "kestrel",
|
|
245
|
+
label: "Kestrel"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
value: "lumen",
|
|
249
|
+
label: "Lumen"
|
|
250
|
+
}
|
|
251
|
+
];
|
|
252
|
+
function Preview() {
|
|
253
|
+
return /* @__PURE__ */ jsx("div", {
|
|
254
|
+
className: "condition-builder-preview",
|
|
255
|
+
children: /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
256
|
+
readOnly: true,
|
|
257
|
+
fields: SEGMENT_FIELDS,
|
|
258
|
+
value: SEGMENT
|
|
259
|
+
})
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function Segment() {
|
|
263
|
+
const [groups, setGroups] = useState(SEGMENT);
|
|
264
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
265
|
+
className: "condition-builder-stage",
|
|
266
|
+
children: [/* @__PURE__ */ jsx(ConditionBuilder, {
|
|
267
|
+
fields: SEGMENT_FIELDS,
|
|
268
|
+
value: groups,
|
|
269
|
+
onValueChange: setGroups,
|
|
270
|
+
maxGroups: 3,
|
|
271
|
+
maxConditions: 6
|
|
272
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
273
|
+
className: "condition-builder-summary",
|
|
274
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
275
|
+
className: "condition-builder-summary__title",
|
|
276
|
+
children: "As it reads"
|
|
277
|
+
}), /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
278
|
+
readOnly: true,
|
|
279
|
+
fields: SEGMENT_FIELDS,
|
|
280
|
+
value: groups
|
|
281
|
+
})]
|
|
282
|
+
})]
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function DeliveryRate() {
|
|
286
|
+
const [groups, setGroups] = useState(RATE);
|
|
287
|
+
const [checked, setChecked] = useState(false);
|
|
288
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
289
|
+
className: "condition-builder-stage",
|
|
290
|
+
children: [/* @__PURE__ */ jsx(ConditionBuilder, {
|
|
291
|
+
fields: RATE_FIELDS,
|
|
292
|
+
operators: BRAND_OPERATORS,
|
|
293
|
+
value: groups,
|
|
294
|
+
onValueChange: setGroups,
|
|
295
|
+
maxConditions: 5,
|
|
296
|
+
showErrors: checked,
|
|
297
|
+
errors: Object.fromEntries((groups[0]?.conditions ?? []).filter((each) => each.field === "postcode" && typeof each.value === "string" && /\bBT\b/i.test(each.value)).map((each) => [each.id, "Northern Ireland is a zone of its own: move BT to it"])),
|
|
298
|
+
renderValueEditor: ({ condition, onChange, label, errorId, invalid }) => /* @__PURE__ */ jsx(Combobox, {
|
|
299
|
+
multiple: true,
|
|
300
|
+
size: "sm",
|
|
301
|
+
"aria-label": label,
|
|
302
|
+
"aria-describedby": errorId,
|
|
303
|
+
invalid,
|
|
304
|
+
placeholder: "Choose brands",
|
|
305
|
+
options: BRANDS,
|
|
306
|
+
value: Array.isArray(condition.value) ? condition.value : [],
|
|
307
|
+
onValueChange: (next) => onChange(next)
|
|
308
|
+
}),
|
|
309
|
+
formatValue: (condition) => Array.isArray(condition.value) ? condition.value.map((key) => BRANDS.find((each) => each.value === key)?.label ?? key).join(", ") : ""
|
|
310
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
311
|
+
className: "condition-builder-actions",
|
|
312
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
313
|
+
size: "sm",
|
|
314
|
+
onClick: () => setChecked(true),
|
|
315
|
+
children: "Save rate"
|
|
316
|
+
})
|
|
317
|
+
})]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function Page() {
|
|
321
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
322
|
+
title: "Condition builder",
|
|
323
|
+
status: "new",
|
|
324
|
+
importNames: [
|
|
325
|
+
"ConditionBuilder",
|
|
326
|
+
"conditionOperators",
|
|
327
|
+
"conditionBuilderLabels",
|
|
328
|
+
"isConditionComplete"
|
|
329
|
+
],
|
|
330
|
+
lead: "Groups of conditions that match all or any of themselves, for a customer segment, a conditional delivery rate, a price rule, a smart category or an automation. Each condition picks a field, an operator valid for the field's type and a value in the editor that operator takes, and the same groups read back as sentences.",
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
333
|
+
id: "basics",
|
|
334
|
+
title: "Basics",
|
|
335
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
336
|
+
"Give it the ",
|
|
337
|
+
/* @__PURE__ */ jsx("code", { children: "fields" }),
|
|
338
|
+
" a condition can test, each with a ",
|
|
339
|
+
/* @__PURE__ */ jsx("code", { children: "type" }),
|
|
340
|
+
" (",
|
|
341
|
+
/* @__PURE__ */ jsx("code", { children: "number" }),
|
|
342
|
+
",",
|
|
343
|
+
" ",
|
|
344
|
+
/* @__PURE__ */ jsx("code", { children: "text" }),
|
|
345
|
+
", ",
|
|
346
|
+
/* @__PURE__ */ jsx("code", { children: "boolean" }),
|
|
347
|
+
", ",
|
|
348
|
+
/* @__PURE__ */ jsx("code", { children: "date" }),
|
|
349
|
+
", ",
|
|
350
|
+
/* @__PURE__ */ jsx("code", { children: "time" }),
|
|
351
|
+
", ",
|
|
352
|
+
/* @__PURE__ */ jsx("code", { children: "weekday" }),
|
|
353
|
+
",",
|
|
354
|
+
" ",
|
|
355
|
+
/* @__PURE__ */ jsx("code", { children: "choice" }),
|
|
356
|
+
", ",
|
|
357
|
+
/* @__PURE__ */ jsx("code", { children: "tags" }),
|
|
358
|
+
", or one of yours) and a ",
|
|
359
|
+
/* @__PURE__ */ jsx("code", { children: "group" }),
|
|
360
|
+
" to list it under, and hold the groups in state. A condition offers the operators whose ",
|
|
361
|
+
/* @__PURE__ */ jsx("code", { children: "types" }),
|
|
362
|
+
" hold its field's type, and the value editor its operator's ",
|
|
363
|
+
/* @__PURE__ */ jsx("code", { children: "shape" }),
|
|
364
|
+
" takes. With ",
|
|
365
|
+
/* @__PURE__ */ jsx("code", { children: "maxGroups" }),
|
|
366
|
+
" above 1 a builder holds several groups, any of which may match, with \"or\" between them. Below it, the same groups as they read."
|
|
367
|
+
] }),
|
|
368
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
369
|
+
align: "fill",
|
|
370
|
+
code: `
|
|
371
|
+
const [groups, setGroups] = useState<ConditionGroup[]>(segment)
|
|
372
|
+
|
|
373
|
+
<ConditionBuilder fields={fields} value={groups} onValueChange={setGroups} maxGroups={3} maxConditions={6} />
|
|
374
|
+
<ConditionBuilder readOnly fields={fields} value={groups} />`,
|
|
375
|
+
children: /* @__PURE__ */ jsx(Segment, {})
|
|
376
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
377
|
+
title: "A value reset when its shape changes",
|
|
378
|
+
children: "A new operator keeps the value while it takes the same shape (\"is greater than\" to \"is at least\" keeps £500), and starts it empty when the shape changes (\"is between\" takes two figures). A new field keeps the operator if it still applies to the field's type, and otherwise moves to its first."
|
|
379
|
+
})]
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
382
|
+
id: "values",
|
|
383
|
+
title: "The value editors",
|
|
384
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
385
|
+
"Each operator names the editor its value takes. The kit draws these from its own parts: a ",
|
|
386
|
+
/* @__PURE__ */ jsx("code", { children: "tree" }),
|
|
387
|
+
" value (a category) is a ",
|
|
388
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
389
|
+
to: "/components/tree-select",
|
|
390
|
+
children: "tree select"
|
|
391
|
+
}),
|
|
392
|
+
" fed by the field's",
|
|
393
|
+
" ",
|
|
394
|
+
/* @__PURE__ */ jsx("code", { children: "loadChildren" }),
|
|
395
|
+
", a level at a time, with a saved category's name from its ",
|
|
396
|
+
/* @__PURE__ */ jsx("code", { children: "loadPath" }),
|
|
397
|
+
". A",
|
|
398
|
+
" ",
|
|
399
|
+
/* @__PURE__ */ jsx("code", { children: "custom" }),
|
|
400
|
+
" shape is drawn by ",
|
|
401
|
+
/* @__PURE__ */ jsx("code", { children: "renderValueEditor" }),
|
|
402
|
+
", which is handed the condition, its name and its error id: here a brand picker of the page's own. Add a condition, press Save rate with one left empty, or type BT as a postcode area."
|
|
403
|
+
] }),
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx(Example, {
|
|
406
|
+
align: "fill",
|
|
407
|
+
code: `
|
|
408
|
+
<ConditionBuilder
|
|
409
|
+
fields={rateFields}
|
|
410
|
+
operators={[...conditionOperators, { value: 'by_brand', label: 'is by', types: ['brand'], shape: 'custom' }]}
|
|
411
|
+
value={groups}
|
|
412
|
+
onValueChange={setGroups}
|
|
413
|
+
maxConditions={5}
|
|
414
|
+
showErrors={saved}
|
|
415
|
+
errors={problemsById}
|
|
416
|
+
renderValueEditor={({ condition, onChange, label, errorId, invalid }) => (
|
|
417
|
+
<Combobox multiple size="sm" aria-label={label} aria-describedby={errorId} invalid={invalid} options={brands} value={condition.value} onValueChange={onChange} />
|
|
418
|
+
)}
|
|
419
|
+
/>`,
|
|
420
|
+
children: /* @__PURE__ */ jsx(DeliveryRate, {})
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
423
|
+
title: "A category tree",
|
|
424
|
+
children: [
|
|
425
|
+
"A field of ",
|
|
426
|
+
/* @__PURE__ */ jsx("code", { children: "type: 'tree'" }),
|
|
427
|
+
" takes the kit's ",
|
|
428
|
+
/* @__PURE__ */ jsx("code", { children: "is in" }),
|
|
429
|
+
" and ",
|
|
430
|
+
/* @__PURE__ */ jsx("code", { children: "is not in" }),
|
|
431
|
+
", and its value is a node's id. Give the field ",
|
|
432
|
+
/* @__PURE__ */ jsx("code", { children: "items" }),
|
|
433
|
+
" for a tree you hold, or ",
|
|
434
|
+
/* @__PURE__ */ jsx("code", { children: "loadChildren(parentId, parent)" }),
|
|
435
|
+
" for one served a level at a time, with ",
|
|
436
|
+
/* @__PURE__ */ jsx("code", { children: "loadPath(id)" }),
|
|
437
|
+
" to name a saved value: the builder and the picker share one request per value, and the sentence view says the name, not the id."
|
|
438
|
+
]
|
|
439
|
+
}),
|
|
440
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
441
|
+
columns: [
|
|
442
|
+
"Shape",
|
|
443
|
+
"The editor",
|
|
444
|
+
"Its value"
|
|
445
|
+
],
|
|
446
|
+
rows: [
|
|
447
|
+
[
|
|
448
|
+
"text",
|
|
449
|
+
"Input, with the field’s prefix and suffix",
|
|
450
|
+
"'@harbourdesk.example'"
|
|
451
|
+
],
|
|
452
|
+
[
|
|
453
|
+
"number",
|
|
454
|
+
"Input of figures",
|
|
455
|
+
"'500'"
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
"range",
|
|
459
|
+
"Two figures with \"and\" between them",
|
|
460
|
+
"{ from: '30', to: '60' }"
|
|
461
|
+
],
|
|
462
|
+
[
|
|
463
|
+
"tags",
|
|
464
|
+
"TagInput: a list of words",
|
|
465
|
+
"['Trade', 'Wholesale']"
|
|
466
|
+
],
|
|
467
|
+
[
|
|
468
|
+
"boolean",
|
|
469
|
+
"Yes, No or Not set",
|
|
470
|
+
"true, false or null"
|
|
471
|
+
],
|
|
472
|
+
[
|
|
473
|
+
"date",
|
|
474
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
475
|
+
to: "/components/date-input",
|
|
476
|
+
children: "DateInput"
|
|
477
|
+
}),
|
|
478
|
+
"'2026-10-31'"
|
|
479
|
+
],
|
|
480
|
+
[
|
|
481
|
+
"dateRange",
|
|
482
|
+
"Two DateInputs, the end no earlier than the start",
|
|
483
|
+
"{ from, to }"
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"timeRange",
|
|
487
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
488
|
+
to: "/components/time-input",
|
|
489
|
+
children: "TimeRangeInput"
|
|
490
|
+
}),
|
|
491
|
+
"{ from: '09:00', to: '13:00' }"
|
|
492
|
+
],
|
|
493
|
+
[
|
|
494
|
+
"weekdays",
|
|
495
|
+
"A row of day toggles",
|
|
496
|
+
"['sat']"
|
|
497
|
+
],
|
|
498
|
+
[
|
|
499
|
+
"select",
|
|
500
|
+
"Combobox, one of the field’s options",
|
|
501
|
+
"'GB'"
|
|
502
|
+
],
|
|
503
|
+
[
|
|
504
|
+
"multiSelect",
|
|
505
|
+
"Combobox, several of them",
|
|
506
|
+
"['GB', 'IE']"
|
|
507
|
+
],
|
|
508
|
+
[
|
|
509
|
+
"tree",
|
|
510
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
511
|
+
to: "/components/tree-select",
|
|
512
|
+
children: "TreeSelect"
|
|
513
|
+
}),
|
|
514
|
+
"'task-chairs'"
|
|
515
|
+
],
|
|
516
|
+
[
|
|
517
|
+
"custom",
|
|
518
|
+
"Yours, from renderValueEditor",
|
|
519
|
+
"Whatever you give onChange"
|
|
520
|
+
],
|
|
521
|
+
[
|
|
522
|
+
"none",
|
|
523
|
+
"Nothing (\"is empty\", \"is set\")",
|
|
524
|
+
"null"
|
|
525
|
+
]
|
|
526
|
+
]
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
}),
|
|
530
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
531
|
+
id: "errors",
|
|
532
|
+
title: "Caps and errors",
|
|
533
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
534
|
+
/* @__PURE__ */ jsx("code", { children: "maxConditions" }),
|
|
535
|
+
" holds Add condition off at the cap and says why under it. ",
|
|
536
|
+
/* @__PURE__ */ jsx("code", { children: "showErrors" }),
|
|
537
|
+
" marks every condition with no value with ",
|
|
538
|
+
/* @__PURE__ */ jsx("code", { children: "labels.valueRequired" }),
|
|
539
|
+
", and ",
|
|
540
|
+
/* @__PURE__ */ jsx("code", { children: "errors" }),
|
|
541
|
+
" takes problems of your own by condition id; each is a Field's error line under its condition, which takes the negative edge, and the value editor is described by it. ",
|
|
542
|
+
/* @__PURE__ */ jsx("code", { children: "isConditionComplete" }),
|
|
543
|
+
" is the same check, for a Save of yours."
|
|
544
|
+
] })
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
547
|
+
id: "sentence",
|
|
548
|
+
title: "The sentence view",
|
|
549
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "readOnly" }), " draws the groups as sentences, a line per condition with its parts a dot apart, for a summary or a rule's collapsed card."] }),
|
|
550
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
551
|
+
align: "start",
|
|
552
|
+
code: `<ConditionBuilder readOnly fields={fields} value={groups} />`,
|
|
553
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
554
|
+
className: "condition-builder-stage",
|
|
555
|
+
children: /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
556
|
+
readOnly: true,
|
|
557
|
+
fields: SEGMENT_FIELDS,
|
|
558
|
+
value: SEGMENT
|
|
559
|
+
})
|
|
560
|
+
})
|
|
561
|
+
})
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
564
|
+
id: "both-themes",
|
|
565
|
+
title: "In both themes",
|
|
566
|
+
description: /* @__PURE__ */ jsx("p", { children: "One group with three conditions, and the sentence view." }),
|
|
567
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
568
|
+
align: "start",
|
|
569
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
570
|
+
className: "condition-builder-theme",
|
|
571
|
+
children: [/* @__PURE__ */ jsx(ConditionBuilder, {
|
|
572
|
+
fields: RATE_FIELDS,
|
|
573
|
+
value: RATE,
|
|
574
|
+
onValueChange: () => {}
|
|
575
|
+
}), /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
576
|
+
readOnly: true,
|
|
577
|
+
fields: RATE_FIELDS,
|
|
578
|
+
value: RATE
|
|
579
|
+
})]
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
}),
|
|
583
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
584
|
+
id: "accessibility",
|
|
585
|
+
title: "Accessibility",
|
|
586
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
587
|
+
"Each group is a named group (\"Group 1\"), and its match control a radio group named \"Match, group 1\".",
|
|
588
|
+
"The conditions are a list; each control is named with its place (\"Field, condition 2\", \"Value, condition 2\", \"From, condition 2\"), so the small labels over them are for the eye only.",
|
|
589
|
+
"Adding a condition moves focus to its field and says \"Condition 3 added\"; removing one moves focus to the next condition (or Add condition) and offers Undo, as a Repeater does.",
|
|
590
|
+
"A condition’s error is linked to its value editor as its description, and the editor is marked invalid.",
|
|
591
|
+
"The sentence view is a list of plain lines; its dots are hidden from assistive tech, so each line reads as words."
|
|
592
|
+
] })
|
|
593
|
+
}),
|
|
594
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
595
|
+
id: "guidelines",
|
|
596
|
+
title: "Guidelines",
|
|
597
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
598
|
+
do: {
|
|
599
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
600
|
+
className: "condition-builder-dd",
|
|
601
|
+
children: /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
602
|
+
readOnly: true,
|
|
603
|
+
fields: SEGMENT_FIELDS,
|
|
604
|
+
value: SEGMENT.slice(0, 1)
|
|
605
|
+
})
|
|
606
|
+
}),
|
|
607
|
+
caption: "Show the sentence where the rule is read more than changed: a list of segments, a collapsed rule."
|
|
608
|
+
},
|
|
609
|
+
dont: {
|
|
610
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
611
|
+
className: "condition-builder-dd",
|
|
612
|
+
children: /* @__PURE__ */ jsx(ConditionBuilder, {
|
|
613
|
+
fields: SEGMENT_FIELDS,
|
|
614
|
+
value: SEGMENT.slice(0, 1),
|
|
615
|
+
onValueChange: () => {}
|
|
616
|
+
})
|
|
617
|
+
}),
|
|
618
|
+
caption: "Do not open every builder in a list at once: one editable rule at a time."
|
|
619
|
+
}
|
|
620
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
621
|
+
"Name fields as a merchant would say them (\"Basket total\", not \"cart_total\"), and group them by what they belong to.",
|
|
622
|
+
"Offer only the operators that make sense for each type; pass your own list to add, remove or translate them.",
|
|
623
|
+
"Keep one group unless people really need \"this or that\": a second group is a harder rule to read."
|
|
624
|
+
] })]
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
627
|
+
id: "props",
|
|
628
|
+
title: "Props",
|
|
629
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native div attribute; ref, className and native props go to the root." }),
|
|
630
|
+
children: /* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
631
|
+
{
|
|
632
|
+
name: "fields",
|
|
633
|
+
type: "ConditionField[]",
|
|
634
|
+
required: true,
|
|
635
|
+
description: "The fields a condition can test: { value, label, group?, type, options?, prefix?, suffix?, placeholder? }."
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
name: "value",
|
|
639
|
+
type: "ConditionGroup[]",
|
|
640
|
+
required: true,
|
|
641
|
+
description: "The groups (controlled): { id, match: all | any, conditions: { id, field, operator, value }[] }."
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "onValueChange",
|
|
645
|
+
type: "(groups: ConditionGroup[]) => void",
|
|
646
|
+
description: "Called with the new groups."
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
name: "operators",
|
|
650
|
+
type: "ConditionOperator[]",
|
|
651
|
+
default: "conditionOperators",
|
|
652
|
+
description: "The operators: { value, label, types, shape }."
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "maxGroups",
|
|
656
|
+
type: "number",
|
|
657
|
+
default: "1",
|
|
658
|
+
description: "How many groups there may be. One is drawn plain, with no Add group."
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: "maxConditions",
|
|
662
|
+
type: "number",
|
|
663
|
+
description: "The most conditions in a group: Add condition is held off at it."
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: "readOnly",
|
|
667
|
+
type: "boolean",
|
|
668
|
+
default: "false",
|
|
669
|
+
description: "Draws the sentence view."
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: "showErrors",
|
|
673
|
+
type: "boolean",
|
|
674
|
+
default: "false",
|
|
675
|
+
description: "Marks every condition with no value."
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "errors",
|
|
679
|
+
type: "Record<string, ReactNode>",
|
|
680
|
+
description: "Problems of your own, by condition id."
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
name: "renderValueEditor",
|
|
684
|
+
type: "(props: ConditionValueEditorProps) => ReactNode",
|
|
685
|
+
description: "Draws a custom shape’s value."
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: "formatValue",
|
|
689
|
+
type: "(condition, field) => string",
|
|
690
|
+
description: "Writes a custom value in the sentence view."
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: "createId",
|
|
694
|
+
type: "() => string",
|
|
695
|
+
description: "A new id for a condition or a group."
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "locale",
|
|
699
|
+
type: "string",
|
|
700
|
+
default: "'en-GB'",
|
|
701
|
+
description: "The locale the sentence writes dates in."
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "labels",
|
|
705
|
+
type: "Partial<ConditionBuilderLabels>",
|
|
706
|
+
description: "The words it says itself. conditionBuilderLabels is the English set."
|
|
707
|
+
}
|
|
708
|
+
] })
|
|
709
|
+
}),
|
|
710
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
711
|
+
]
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
//#endregion
|
|
715
|
+
export { Page, Preview };
|