@orbitcommerce/constellation-docs 1.0.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BvxQWBTy.js +403 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CXZ3V1d4.js +1612 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-hg7txTc3.js +1381 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/{installation-DpsX8G_n.js → installation-DRUWNVHP.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/{logo-BfGF1Pq9.js → logo-D3a3QGKJ.js} +13 -13
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-BSfEqHY8.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-BCPvtP8J.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-CbiibLwn.js} +581 -18
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-CNR7zpf7.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-DYBCY7jm.js} +4 -1
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-mq_pNXza.js +3232 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Cf4MZ8Fq.js} +257 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +10989 -1108
- package/package.json +3 -3
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,1127 @@
|
|
|
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 { t as Playground } from "./Playground-Mk1yIWXb.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { COLOR_FIELD_PRESETS, ColorField, ColorPicker, Field, Input, ThemeScope, themeColourGroups } from "@orbitcommerce/constellation";
|
|
8
|
+
//#region src/pages/components/color-field.tsx
|
|
9
|
+
function Preview() {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "color-field-preview",
|
|
12
|
+
children: [/* @__PURE__ */ jsx(ColorField, {
|
|
13
|
+
label: "Brand colour",
|
|
14
|
+
defaultValue: "#0d9488"
|
|
15
|
+
}), /* @__PURE__ */ jsx(ColorField, {
|
|
16
|
+
compact: true,
|
|
17
|
+
label: "Accent",
|
|
18
|
+
defaultValue: "#2563eb"
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var PLAYGROUND = [
|
|
23
|
+
{
|
|
24
|
+
prop: "label",
|
|
25
|
+
type: "text",
|
|
26
|
+
default: "Brand colour"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
prop: "size",
|
|
30
|
+
type: "select",
|
|
31
|
+
options: [
|
|
32
|
+
"sm",
|
|
33
|
+
"md",
|
|
34
|
+
"lg"
|
|
35
|
+
],
|
|
36
|
+
default: "md"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
prop: "alpha",
|
|
40
|
+
type: "boolean",
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
prop: "allowTransparent",
|
|
45
|
+
type: "boolean",
|
|
46
|
+
default: true,
|
|
47
|
+
toAttr: (v) => v ? null : "allowTransparent={false}"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
prop: "required",
|
|
51
|
+
type: "boolean",
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
prop: "compact",
|
|
56
|
+
type: "boolean",
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
prop: "invalid",
|
|
61
|
+
type: "boolean",
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
prop: "disabled",
|
|
66
|
+
type: "boolean",
|
|
67
|
+
default: false
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
function BrandColour() {
|
|
71
|
+
const [colour, setColour] = useState("#0d9488");
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "color-field-stack",
|
|
74
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
75
|
+
label: "Brand colour",
|
|
76
|
+
hint: "Buttons and links on your storefront use it",
|
|
77
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
78
|
+
value: colour,
|
|
79
|
+
onValueChange: setColour
|
|
80
|
+
})
|
|
81
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
82
|
+
className: "color-field-note",
|
|
83
|
+
children: ["Stored as ", /* @__PURE__ */ jsx("code", { children: colour })]
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function Compact() {
|
|
88
|
+
const [colour, setColour] = useState("#16a34a");
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
90
|
+
className: "color-field-row",
|
|
91
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
92
|
+
className: "color-field-note",
|
|
93
|
+
children: "In stock"
|
|
94
|
+
}), /* @__PURE__ */ jsx(ColorField, {
|
|
95
|
+
compact: true,
|
|
96
|
+
label: "Stock colour",
|
|
97
|
+
value: colour,
|
|
98
|
+
onValueChange: setColour
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function Alpha() {
|
|
103
|
+
const [colour, setColour] = useState("#2563ebcc");
|
|
104
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
105
|
+
className: "color-field-stack",
|
|
106
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
107
|
+
label: "Banner overlay",
|
|
108
|
+
hint: "An eight-digit hex carries the opacity: #rrggbbaa",
|
|
109
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
110
|
+
alpha: true,
|
|
111
|
+
value: colour,
|
|
112
|
+
onValueChange: setColour
|
|
113
|
+
})
|
|
114
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
115
|
+
className: "color-field-note",
|
|
116
|
+
children: ["Stored as ", /* @__PURE__ */ jsx("code", { children: colour })]
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function Transparent() {
|
|
121
|
+
const [colour, setColour] = useState("#0d9488");
|
|
122
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
123
|
+
className: "color-field-stack",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(Field, {
|
|
126
|
+
label: "Panel background",
|
|
127
|
+
hint: "Choose Transparent in the picker to let the surface through",
|
|
128
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
129
|
+
value: colour,
|
|
130
|
+
onValueChange: setColour
|
|
131
|
+
})
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
134
|
+
label: "A transparent background",
|
|
135
|
+
value: "transparent"
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsxs("p", {
|
|
138
|
+
className: "color-field-note",
|
|
139
|
+
children: [
|
|
140
|
+
"Stored as ",
|
|
141
|
+
/* @__PURE__ */ jsx("code", { children: JSON.stringify(colour) }),
|
|
142
|
+
", or ",
|
|
143
|
+
/* @__PURE__ */ jsx("code", { children: "\"transparent\"" }),
|
|
144
|
+
"."
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function Required() {
|
|
151
|
+
const [colour, setColour] = useState("#b91c1c");
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: "color-field-stack",
|
|
154
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
155
|
+
label: "Brand colour",
|
|
156
|
+
required: true,
|
|
157
|
+
hint: "Clear is not offered; the field must keep a colour",
|
|
158
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
159
|
+
required: true,
|
|
160
|
+
value: colour,
|
|
161
|
+
onValueChange: setColour
|
|
162
|
+
})
|
|
163
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
164
|
+
label: "Accent colour",
|
|
165
|
+
required: true,
|
|
166
|
+
hint: "With allowTransparent off, Transparent is gone too",
|
|
167
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
168
|
+
required: true,
|
|
169
|
+
allowTransparent: false,
|
|
170
|
+
value: colour,
|
|
171
|
+
onValueChange: setColour
|
|
172
|
+
})
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function States() {
|
|
177
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
178
|
+
className: "color-field-column",
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx(Field, {
|
|
181
|
+
label: "Small",
|
|
182
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
183
|
+
size: "sm",
|
|
184
|
+
defaultValue: "#2563eb"
|
|
185
|
+
})
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ jsx(Field, {
|
|
188
|
+
label: "Medium",
|
|
189
|
+
children: /* @__PURE__ */ jsx(ColorField, { defaultValue: "#2563eb" })
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ jsx(Field, {
|
|
192
|
+
label: "Large",
|
|
193
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
194
|
+
size: "lg",
|
|
195
|
+
defaultValue: "#2563eb"
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsx(Field, {
|
|
199
|
+
label: "Brand colour",
|
|
200
|
+
error: "Choose a colour",
|
|
201
|
+
children: /* @__PURE__ */ jsx(ColorField, {})
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ jsx(Field, {
|
|
204
|
+
label: "Logo colour",
|
|
205
|
+
hint: "Set by your brand kit",
|
|
206
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
207
|
+
readOnly: true,
|
|
208
|
+
defaultValue: "#0d9488"
|
|
209
|
+
})
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsx(Field, {
|
|
212
|
+
label: "Theme colour",
|
|
213
|
+
hint: "Turn on Custom theme to set one",
|
|
214
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
215
|
+
disabled: true,
|
|
216
|
+
defaultValue: "#2563eb"
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function Picker() {
|
|
223
|
+
const [colour, setColour] = useState("#7c3aed");
|
|
224
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
225
|
+
className: "color-field-stack",
|
|
226
|
+
children: [/* @__PURE__ */ jsx(ColorPicker, {
|
|
227
|
+
value: colour,
|
|
228
|
+
onValueChange: setColour,
|
|
229
|
+
presets: COLOR_FIELD_PRESETS
|
|
230
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
231
|
+
className: "color-field-note",
|
|
232
|
+
children: ["Chosen: ", /* @__PURE__ */ jsx("code", { children: colour })]
|
|
233
|
+
})]
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function PickerAlpha() {
|
|
237
|
+
const [colour, setColour] = useState("#16a34acc");
|
|
238
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
239
|
+
className: "color-field-stack",
|
|
240
|
+
children: [/* @__PURE__ */ jsx(ColorPicker, {
|
|
241
|
+
alpha: true,
|
|
242
|
+
value: colour,
|
|
243
|
+
onValueChange: setColour,
|
|
244
|
+
presets: COLOR_FIELD_PRESETS
|
|
245
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
246
|
+
className: "color-field-note",
|
|
247
|
+
children: ["Chosen: ", /* @__PURE__ */ jsx("code", { children: colour })]
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function Matrix() {
|
|
252
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
253
|
+
className: "color-field-column",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx(ColorField, { label: "Empty" }),
|
|
256
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
257
|
+
label: "A colour",
|
|
258
|
+
defaultValue: "#0d9488"
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
261
|
+
label: "Transparent",
|
|
262
|
+
value: "transparent"
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
265
|
+
label: "With opacity",
|
|
266
|
+
alpha: true,
|
|
267
|
+
defaultValue: "#2563ebcc"
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ jsx(Field, {
|
|
270
|
+
label: "Invalid",
|
|
271
|
+
error: "Choose a colour",
|
|
272
|
+
children: /* @__PURE__ */ jsx(ColorField, {})
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
275
|
+
compact: true,
|
|
276
|
+
label: "Compact",
|
|
277
|
+
defaultValue: "#db2777"
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
280
|
+
label: "Disabled",
|
|
281
|
+
disabled: true,
|
|
282
|
+
defaultValue: "#2563eb"
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
var HARBOUR_THEME = themeColourGroups({
|
|
288
|
+
primary: "#1f4e5f",
|
|
289
|
+
secondary: "#4da69e",
|
|
290
|
+
accent: "#e07a3f",
|
|
291
|
+
text: "#1c2731",
|
|
292
|
+
background: "#ffffff"
|
|
293
|
+
});
|
|
294
|
+
function InspectorColours() {
|
|
295
|
+
const [text, setText] = useState("var(--pb-color-text)");
|
|
296
|
+
const [heading, setHeading] = useState("var(--pb-color-primary)");
|
|
297
|
+
const [overlay, setOverlay] = useState("rgba(28, 39, 49, 0.45)");
|
|
298
|
+
const resolve = (value) => HARBOUR_THEME.flatMap((group) => group.colours).find((entry) => entry.value === value)?.colour ?? value;
|
|
299
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
300
|
+
className: "color-field-inspector",
|
|
301
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
302
|
+
className: "color-field-inspector__fields",
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ jsx(Field, {
|
|
305
|
+
label: "Heading colour",
|
|
306
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
307
|
+
size: "sm",
|
|
308
|
+
value: heading,
|
|
309
|
+
onValueChange: setHeading,
|
|
310
|
+
themeColours: HARBOUR_THEME,
|
|
311
|
+
eyedropper: true
|
|
312
|
+
})
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ jsx(Field, {
|
|
315
|
+
label: "Text colour",
|
|
316
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
317
|
+
size: "sm",
|
|
318
|
+
value: text,
|
|
319
|
+
onValueChange: setText,
|
|
320
|
+
themeColours: HARBOUR_THEME,
|
|
321
|
+
eyedropper: true
|
|
322
|
+
})
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ jsx(Field, {
|
|
325
|
+
label: "Overlay",
|
|
326
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
327
|
+
size: "sm",
|
|
328
|
+
alpha: true,
|
|
329
|
+
format: "rgba",
|
|
330
|
+
value: overlay,
|
|
331
|
+
onValueChange: setOverlay,
|
|
332
|
+
themeColours: HARBOUR_THEME
|
|
333
|
+
})
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
}), /* @__PURE__ */ jsx(ThemeScope, {
|
|
337
|
+
theme: "light",
|
|
338
|
+
className: "color-field-inspector__canvas",
|
|
339
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
340
|
+
className: "color-field-inspector__hero",
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ jsx("span", {
|
|
343
|
+
className: "color-field-inspector__overlay",
|
|
344
|
+
style: { background: resolve(overlay) }
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsx("p", {
|
|
347
|
+
className: "color-field-inspector__heading",
|
|
348
|
+
style: { color: resolve(heading) },
|
|
349
|
+
children: "Desks that work as hard as you"
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ jsx("p", {
|
|
352
|
+
className: "color-field-inspector__text",
|
|
353
|
+
style: { color: resolve(text) },
|
|
354
|
+
children: "Oak, ash and walnut, made to order in Bristol."
|
|
355
|
+
})
|
|
356
|
+
]
|
|
357
|
+
})
|
|
358
|
+
})]
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function DefaultColours() {
|
|
362
|
+
const [button, setButton] = useState(null);
|
|
363
|
+
const [band, setBand] = useState("#f2efe8");
|
|
364
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
365
|
+
className: "color-field-defaults",
|
|
366
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
367
|
+
label: "Button colour",
|
|
368
|
+
hint: button === null ? "Follows the theme’s primary colour." : "Set for this block only.",
|
|
369
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
370
|
+
inherit: true,
|
|
371
|
+
inheritedColour: "#1f4e5f",
|
|
372
|
+
value: button,
|
|
373
|
+
onValueChange: setButton
|
|
374
|
+
})
|
|
375
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
376
|
+
label: "Band background",
|
|
377
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
378
|
+
inherit: true,
|
|
379
|
+
defaultSwitch: true,
|
|
380
|
+
inheritedColour: "#f9fafb",
|
|
381
|
+
starterColour: "#f2efe8",
|
|
382
|
+
value: band,
|
|
383
|
+
onValueChange: setBand
|
|
384
|
+
})
|
|
385
|
+
})]
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function Page() {
|
|
389
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
390
|
+
title: "Colour field",
|
|
391
|
+
status: "new",
|
|
392
|
+
importNames: ["ColorField", "ColorPicker"],
|
|
393
|
+
lead: "A swatch and its hex code in one field-shaped box: type the hex, or open the kit's own colour picker from the swatch. The panel on its own is ColorPicker, for building your own button or sheet around it.",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
396
|
+
id: "playground",
|
|
397
|
+
title: "Playground",
|
|
398
|
+
description: /* @__PURE__ */ jsx("p", { children: "Change the props, then open the picker by clicking the swatch, or with Enter or Space once it has focus. The swatch and the hex field follow the picker live." }),
|
|
399
|
+
children: /* @__PURE__ */ jsx(Playground, {
|
|
400
|
+
component: "ColorField",
|
|
401
|
+
controls: PLAYGROUND,
|
|
402
|
+
minHeight: 200,
|
|
403
|
+
extraCode: () => ["defaultValue=\"#2563eb\""],
|
|
404
|
+
render: (v) => /* @__PURE__ */ jsx("div", {
|
|
405
|
+
className: "color-field-stage",
|
|
406
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
407
|
+
label: String(v.label),
|
|
408
|
+
size: v.size,
|
|
409
|
+
alpha: Boolean(v.alpha),
|
|
410
|
+
allowTransparent: Boolean(v.allowTransparent),
|
|
411
|
+
required: Boolean(v.required),
|
|
412
|
+
compact: Boolean(v.compact),
|
|
413
|
+
invalid: Boolean(v.invalid),
|
|
414
|
+
disabled: Boolean(v.disabled),
|
|
415
|
+
defaultValue: "#2563eb"
|
|
416
|
+
})
|
|
417
|
+
})
|
|
418
|
+
})
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
421
|
+
id: "basics",
|
|
422
|
+
title: "Basics",
|
|
423
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
424
|
+
"ColorField is a field for one colour. It shows a swatch and the colour's hex code; type a hex and it is taken as soon as it reads, or open the picker from the swatch. The value is a string: a hex colour, the word",
|
|
425
|
+
" ",
|
|
426
|
+
/* @__PURE__ */ jsx("code", { children: "\"transparent\"" }),
|
|
427
|
+
", or ",
|
|
428
|
+
/* @__PURE__ */ jsx("code", { children: "\"\"" }),
|
|
429
|
+
" for none. The swatch shows a chequerboard when there is no colour."
|
|
430
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
431
|
+
"Reach for it wherever a form needs a colour: a brand colour, an accent, a background. For the panel alone, without the field box, use ",
|
|
432
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
433
|
+
to: "/components/color-field#picker",
|
|
434
|
+
children: "ColorPicker"
|
|
435
|
+
}),
|
|
436
|
+
" further down this page. To show a colour rather than choose one, a",
|
|
437
|
+
" ",
|
|
438
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
439
|
+
to: "/components/chip",
|
|
440
|
+
children: "Chip"
|
|
441
|
+
}),
|
|
442
|
+
" or a plain swatch reads it without pretending to be a control."
|
|
443
|
+
] })] }),
|
|
444
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
445
|
+
align: "start",
|
|
446
|
+
code: `
|
|
447
|
+
const [colour, setColour] = useState('#0d9488')
|
|
448
|
+
|
|
449
|
+
<Field label="Brand colour" hint="Buttons and links on your storefront use it">
|
|
450
|
+
<ColorField value={colour} onValueChange={setColour} />
|
|
451
|
+
</Field>`,
|
|
452
|
+
children: /* @__PURE__ */ jsx(BrandColour, {})
|
|
453
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
454
|
+
columns: ["Reach for", "When"],
|
|
455
|
+
rows: [
|
|
456
|
+
[/* @__PURE__ */ jsx("code", { children: "ColorField" }), "One colour in a form, with a swatch and its hex."],
|
|
457
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
458
|
+
to: "/components/color-field#picker",
|
|
459
|
+
children: "ColorPicker"
|
|
460
|
+
}), "The panel on its own, when you build the button or the sheet around it."],
|
|
461
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
462
|
+
to: "/components/input#field",
|
|
463
|
+
children: "Input"
|
|
464
|
+
}), "A plain hex typed by hand, where a swatch and a picker would be more than the page needs."],
|
|
465
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
466
|
+
to: "/components/chip",
|
|
467
|
+
children: "Chip"
|
|
468
|
+
}), "A colour to read, not to choose."]
|
|
469
|
+
]
|
|
470
|
+
})]
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
473
|
+
id: "the-field",
|
|
474
|
+
title: "The field",
|
|
475
|
+
description: /* @__PURE__ */ jsx("p", { children: "The field holds a colour, or says there is none, and can be trimmed or tightened to fit its place." }),
|
|
476
|
+
children: [
|
|
477
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
478
|
+
title: "Compact",
|
|
479
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "compact" }), " draws just the swatch, for a tight row beside other controls. It keeps its name, so it is still a button a screen reader can announce and press."] }),
|
|
480
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
481
|
+
align: "start",
|
|
482
|
+
code: `
|
|
483
|
+
const [colour, setColour] = useState('#16a34a')
|
|
484
|
+
|
|
485
|
+
<p>In stock</p>
|
|
486
|
+
<ColorField compact label="Stock colour" value={colour} onValueChange={setColour} />`,
|
|
487
|
+
children: /* @__PURE__ */ jsx(Compact, {})
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
491
|
+
title: "Opacity",
|
|
492
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
493
|
+
/* @__PURE__ */ jsx("code", { children: "alpha" }),
|
|
494
|
+
" adds an opacity track to the picker, and the value may then be an eight-digit hex,",
|
|
495
|
+
" ",
|
|
496
|
+
/* @__PURE__ */ jsx("code", { children: "#rrggbbaa" }),
|
|
497
|
+
". Without it the colour is always opaque and the hex is six digits."
|
|
498
|
+
] }),
|
|
499
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
500
|
+
align: "start",
|
|
501
|
+
code: `
|
|
502
|
+
const [colour, setColour] = useState('#2563ebcc')
|
|
503
|
+
|
|
504
|
+
<Field label="Banner overlay" hint="An eight-digit hex carries the opacity: #rrggbbaa">
|
|
505
|
+
<ColorField alpha value={colour} onValueChange={setColour} />
|
|
506
|
+
</Field>`,
|
|
507
|
+
children: /* @__PURE__ */ jsx(Alpha, {})
|
|
508
|
+
})
|
|
509
|
+
}),
|
|
510
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
511
|
+
title: "Transparent",
|
|
512
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
513
|
+
"With ",
|
|
514
|
+
/* @__PURE__ */ jsx("code", { children: "allowTransparent" }),
|
|
515
|
+
" on (the default) the picker offers a Transparent button. A transparent colour shows the word in the field and a chequerboard in the swatch. Pass",
|
|
516
|
+
" ",
|
|
517
|
+
/* @__PURE__ */ jsxs("code", { children: ["allowTransparent=", "{false}"] }),
|
|
518
|
+
" to leave it out."
|
|
519
|
+
] }),
|
|
520
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
521
|
+
align: "start",
|
|
522
|
+
code: `
|
|
523
|
+
const [colour, setColour] = useState('#0d9488')
|
|
524
|
+
|
|
525
|
+
<Field label="Panel background" hint="Choose Transparent in the picker to let the surface through">
|
|
526
|
+
<ColorField value={colour} onValueChange={setColour} />
|
|
527
|
+
</Field>
|
|
528
|
+
<ColorField label="A transparent background" value="transparent" />`,
|
|
529
|
+
children: /* @__PURE__ */ jsx(Transparent, {})
|
|
530
|
+
})
|
|
531
|
+
}),
|
|
532
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
533
|
+
title: "Required",
|
|
534
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
535
|
+
"A ",
|
|
536
|
+
/* @__PURE__ */ jsx("code", { children: "required" }),
|
|
537
|
+
" field must keep a colour: Clear is not drawn, emptying the text does not commit an empty value, and Transparent leaves the colour in place unless ",
|
|
538
|
+
/* @__PURE__ */ jsx("code", { children: "allowTransparent" }),
|
|
539
|
+
" is on. Put it in a ",
|
|
540
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
541
|
+
to: "/components/input#field",
|
|
542
|
+
children: "Field"
|
|
543
|
+
}),
|
|
544
|
+
" marked ",
|
|
545
|
+
/* @__PURE__ */ jsx("code", { children: "required" }),
|
|
546
|
+
" so the label says so too."
|
|
547
|
+
] }),
|
|
548
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
549
|
+
align: "start",
|
|
550
|
+
code: `
|
|
551
|
+
<Field label="Brand colour" required hint="Clear is not offered; the field must keep a colour">
|
|
552
|
+
<ColorField required value={colour} onValueChange={setColour} />
|
|
553
|
+
</Field>
|
|
554
|
+
<Field label="Accent colour" required hint="With allowTransparent off, Transparent is gone too">
|
|
555
|
+
<ColorField required allowTransparent={false} value={colour} onValueChange={setColour} />
|
|
556
|
+
</Field>`,
|
|
557
|
+
children: /* @__PURE__ */ jsx(Required, {})
|
|
558
|
+
})
|
|
559
|
+
})
|
|
560
|
+
]
|
|
561
|
+
}),
|
|
562
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
563
|
+
id: "states",
|
|
564
|
+
title: "Sizes and states",
|
|
565
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
566
|
+
"The box takes the same three heights as ",
|
|
567
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
568
|
+
to: "/components/input",
|
|
569
|
+
children: "Input"
|
|
570
|
+
}),
|
|
571
|
+
": ",
|
|
572
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
573
|
+
" ",
|
|
574
|
+
"(30px), ",
|
|
575
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
576
|
+
" (36px, default) and ",
|
|
577
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
578
|
+
" (44px). An invalid field shows the error treatment and a message. A read-only one sinks to the well and keeps its colour: the hex can be selected and copied, and the swatch stays in reach to be read but does not open the picker. A disabled one sinks to the well too, its swatch dimmed, and takes nothing."
|
|
579
|
+
] }),
|
|
580
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
581
|
+
align: "start",
|
|
582
|
+
code: `
|
|
583
|
+
<Field label="Small"><ColorField size="sm" defaultValue="#2563eb" /></Field>
|
|
584
|
+
<Field label="Medium"><ColorField defaultValue="#2563eb" /></Field>
|
|
585
|
+
<Field label="Large"><ColorField size="lg" defaultValue="#2563eb" /></Field>
|
|
586
|
+
|
|
587
|
+
<Field label="Brand colour" error="Choose a colour">
|
|
588
|
+
<ColorField />
|
|
589
|
+
</Field>
|
|
590
|
+
<Field label="Logo colour" hint="Set by your brand kit">
|
|
591
|
+
<ColorField readOnly defaultValue="#0d9488" />
|
|
592
|
+
</Field>
|
|
593
|
+
<Field label="Theme colour" hint="Turn on Custom theme to set one">
|
|
594
|
+
<ColorField disabled defaultValue="#2563eb" />
|
|
595
|
+
</Field>`,
|
|
596
|
+
children: /* @__PURE__ */ jsx(States, {})
|
|
597
|
+
}), /* @__PURE__ */ jsxs(Note, { children: [
|
|
598
|
+
"Typing a hex that is not one yet marks the field invalid and calls ",
|
|
599
|
+
/* @__PURE__ */ jsx("code", { children: "onInvalidChange(true)" }),
|
|
600
|
+
"; on blur the text goes back to the colour that is stored. A valid hex is taken as it is typed."
|
|
601
|
+
] })]
|
|
602
|
+
}),
|
|
603
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
604
|
+
id: "picker",
|
|
605
|
+
title: "The picker on its own",
|
|
606
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "ColorPicker" }), " is the panel the field opens: a saturation and brightness area, a hue track, an optional opacity track, a hex field with a swatch, and preset swatches. Everything works by pointer and by keyboard. Use it directly when you want your own trigger or your own sheet around it."] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
607
|
+
"The default presets are the sixteen in ",
|
|
608
|
+
/* @__PURE__ */ jsx("code", { children: "COLOR_FIELD_PRESETS" }),
|
|
609
|
+
": greys from black to white, then a spread of hues. Pass ",
|
|
610
|
+
/* @__PURE__ */ jsx("code", { children: "presets" }),
|
|
611
|
+
" to change them, or ",
|
|
612
|
+
/* @__PURE__ */ jsxs("code", { children: ["presets=", "{[]}"] }),
|
|
613
|
+
" for none."
|
|
614
|
+
] })] }),
|
|
615
|
+
children: [
|
|
616
|
+
/* @__PURE__ */ jsx(Example, {
|
|
617
|
+
align: "start",
|
|
618
|
+
minHeight: 420,
|
|
619
|
+
code: `
|
|
620
|
+
const [colour, setColour] = useState('#7c3aed')
|
|
621
|
+
|
|
622
|
+
<ColorPicker value={colour} onValueChange={setColour} presets={COLOR_FIELD_PRESETS} />`,
|
|
623
|
+
children: /* @__PURE__ */ jsx(Picker, {})
|
|
624
|
+
}),
|
|
625
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
626
|
+
title: "Opacity",
|
|
627
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "alpha" }), " adds the opacity track under the hue track. The colour it gives is an eight-digit hex when it is not opaque."] }),
|
|
628
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
629
|
+
align: "start",
|
|
630
|
+
minHeight: 460,
|
|
631
|
+
code: `<ColorPicker alpha value={colour} onValueChange={setColour} presets={COLOR_FIELD_PRESETS} />`,
|
|
632
|
+
children: /* @__PURE__ */ jsx(PickerAlpha, {})
|
|
633
|
+
})
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
636
|
+
title: "The eyedropper",
|
|
637
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
638
|
+
"With ",
|
|
639
|
+
/* @__PURE__ */ jsx("code", { children: "eyedropper" }),
|
|
640
|
+
", a button picks a colour from anywhere on the screen."
|
|
641
|
+
] }),
|
|
642
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
643
|
+
clientOnly: true,
|
|
644
|
+
align: "start",
|
|
645
|
+
minHeight: 420,
|
|
646
|
+
code: `<ColorPicker eyedropper defaultValue="#16a34a" />`,
|
|
647
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
648
|
+
className: "color-field-stage color-field-stage--picker",
|
|
649
|
+
children: /* @__PURE__ */ jsx(ColorPicker, {
|
|
650
|
+
eyedropper: true,
|
|
651
|
+
defaultValue: "#16a34a"
|
|
652
|
+
})
|
|
653
|
+
})
|
|
654
|
+
}), /* @__PURE__ */ jsxs(Note, { children: [
|
|
655
|
+
"The eyedropper button is drawn only in browsers that have ",
|
|
656
|
+
/* @__PURE__ */ jsx("code", { children: "window.EyeDropper" }),
|
|
657
|
+
": Chrome and Edge on desktop, for now. Everywhere else it is left out, so the panel never shows a button that cannot work."
|
|
658
|
+
] })]
|
|
659
|
+
}),
|
|
660
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
661
|
+
title: "Disabled",
|
|
662
|
+
description: /* @__PURE__ */ jsx("p", { children: "A disabled panel is dimmed and takes nothing." }),
|
|
663
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
664
|
+
align: "start",
|
|
665
|
+
minHeight: 420,
|
|
666
|
+
code: `<ColorPicker disabled defaultValue="#2563eb" presets={COLOR_FIELD_PRESETS} />`,
|
|
667
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
668
|
+
className: "color-field-stage color-field-stage--picker",
|
|
669
|
+
children: /* @__PURE__ */ jsx(ColorPicker, {
|
|
670
|
+
disabled: true,
|
|
671
|
+
defaultValue: "#2563eb",
|
|
672
|
+
presets: COLOR_FIELD_PRESETS
|
|
673
|
+
})
|
|
674
|
+
})
|
|
675
|
+
})
|
|
676
|
+
})
|
|
677
|
+
]
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
680
|
+
id: "builder",
|
|
681
|
+
title: "In a builder's inspector",
|
|
682
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
683
|
+
/* @__PURE__ */ jsx("code", { children: "themeColours" }),
|
|
684
|
+
" offers the theme's own colours beside the picker, in a tab of their own, grouped Brand, Text, Backgrounds and Status. Choosing a role stores a reference, such as",
|
|
685
|
+
" ",
|
|
686
|
+
/* @__PURE__ */ jsx("code", { children: "var(--pb-color-primary)" }),
|
|
687
|
+
", not its hex, so the element keeps following the store's palette when the palette changes. The field shows a reference by its name on a small chip, its swatch painted in the colour it resolves to; focus the text to edit the reference by hand. ",
|
|
688
|
+
/* @__PURE__ */ jsx("code", { children: "themeColourGroups(palette)" }),
|
|
689
|
+
" ",
|
|
690
|
+
"builds the page builder's groups from a store's palette; the status colours (success, warning, error) are roles too, so they follow the palette as well."
|
|
691
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
692
|
+
"Pick a custom colour over a role and the picker says it is unlinked, with Re-link to put the role back. Values come in and go out as hex, ",
|
|
693
|
+
/* @__PURE__ */ jsx("code", { children: "rgb()" }),
|
|
694
|
+
" and ",
|
|
695
|
+
/* @__PURE__ */ jsx("code", { children: "rgba()" }),
|
|
696
|
+
", or ",
|
|
697
|
+
/* @__PURE__ */ jsx("code", { children: "var()" }),
|
|
698
|
+
":",
|
|
699
|
+
" ",
|
|
700
|
+
/* @__PURE__ */ jsx("code", { children: "format=\"rgba\"" }),
|
|
701
|
+
" writes a translucent colour as ",
|
|
702
|
+
/* @__PURE__ */ jsx("code", { children: "rgba()" }),
|
|
703
|
+
" (hex while it is opaque), as the page builder stores an overlay. ",
|
|
704
|
+
/* @__PURE__ */ jsx("code", { children: "eyedropper" }),
|
|
705
|
+
" passes the screen picker through."
|
|
706
|
+
] })] }),
|
|
707
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
708
|
+
align: "fill",
|
|
709
|
+
minHeight: 380,
|
|
710
|
+
code: `
|
|
711
|
+
const theme = themeColourGroups(store.palette)
|
|
712
|
+
|
|
713
|
+
<Field label="Heading colour">
|
|
714
|
+
<ColorField size="sm" value={heading} onValueChange={setHeading} themeColours={theme} eyedropper />
|
|
715
|
+
</Field>
|
|
716
|
+
<Field label="Overlay">
|
|
717
|
+
<ColorField size="sm" alpha format="rgba" value={overlay} onValueChange={setOverlay} themeColours={theme} />
|
|
718
|
+
</Field>`,
|
|
719
|
+
children: /* @__PURE__ */ jsx(InspectorColours, {})
|
|
720
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
721
|
+
title: "A default it inherits",
|
|
722
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
723
|
+
"Many builder colours have no value of their own until someone sets one: they inherit the theme's.",
|
|
724
|
+
" ",
|
|
725
|
+
/* @__PURE__ */ jsx("code", { children: "inherit" }),
|
|
726
|
+
" gives the field that state, ",
|
|
727
|
+
/* @__PURE__ */ jsx("code", { children: "null" }),
|
|
728
|
+
", which is not the same as no colour (",
|
|
729
|
+
/* @__PURE__ */ jsx("code", { children: "''" }),
|
|
730
|
+
"). The field says \"Default\", its swatch paints ",
|
|
731
|
+
/* @__PURE__ */ jsx("code", { children: "inheritedColour" }),
|
|
732
|
+
", emptying the text goes back to it, and the picker offers \"Use default\" beside Clear."
|
|
733
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
734
|
+
/* @__PURE__ */ jsx("code", { children: "defaultSwitch" }),
|
|
735
|
+
" adds a \"Use default\" switch beside the box, as the product sheets' design settings have: turned off, it seeds ",
|
|
736
|
+
/* @__PURE__ */ jsx("code", { children: "starterColour" }),
|
|
737
|
+
" (or the inherited colour) so there is a colour to adjust; turned on, the field goes back to its default."
|
|
738
|
+
] })] }),
|
|
739
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
740
|
+
align: "fill",
|
|
741
|
+
minHeight: 240,
|
|
742
|
+
code: `
|
|
743
|
+
<Field label="Button colour">
|
|
744
|
+
<ColorField inherit inheritedColour="#1f4e5f" value={button} onValueChange={setButton} />
|
|
745
|
+
</Field>
|
|
746
|
+
<Field label="Band background">
|
|
747
|
+
<ColorField inherit defaultSwitch inheritedColour="#f9fafb" starterColour="#f2efe8" value={band} onValueChange={setBand} />
|
|
748
|
+
</Field>`,
|
|
749
|
+
children: /* @__PURE__ */ jsx(DefaultColours, {})
|
|
750
|
+
})
|
|
751
|
+
})]
|
|
752
|
+
}),
|
|
753
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
754
|
+
id: "themes",
|
|
755
|
+
title: "In both themes",
|
|
756
|
+
children: [/* @__PURE__ */ jsx(ThemePair, {
|
|
757
|
+
align: "start",
|
|
758
|
+
minHeight: 360,
|
|
759
|
+
children: /* @__PURE__ */ jsx(Matrix, {})
|
|
760
|
+
}), /* @__PURE__ */ jsx(ThemePair, {
|
|
761
|
+
align: "start",
|
|
762
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
763
|
+
className: "color-field-column",
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
766
|
+
size: "sm",
|
|
767
|
+
label: "Heading colour",
|
|
768
|
+
value: "var(--pb-color-primary)",
|
|
769
|
+
themeColours: HARBOUR_THEME
|
|
770
|
+
}),
|
|
771
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
772
|
+
size: "sm",
|
|
773
|
+
label: "Overlay",
|
|
774
|
+
alpha: true,
|
|
775
|
+
format: "rgba",
|
|
776
|
+
value: "rgba(28, 39, 49, 0.45)"
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
779
|
+
size: "sm",
|
|
780
|
+
label: "Button colour",
|
|
781
|
+
inherit: true,
|
|
782
|
+
value: null,
|
|
783
|
+
inheritedColour: "#1f4e5f"
|
|
784
|
+
}),
|
|
785
|
+
/* @__PURE__ */ jsx(ColorField, {
|
|
786
|
+
size: "sm",
|
|
787
|
+
label: "Band background",
|
|
788
|
+
inherit: true,
|
|
789
|
+
defaultSwitch: true,
|
|
790
|
+
value: "#f2efe8"
|
|
791
|
+
})
|
|
792
|
+
]
|
|
793
|
+
})
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
797
|
+
id: "accessibility",
|
|
798
|
+
title: "Accessibility",
|
|
799
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
800
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
801
|
+
"The swatch is a button named by ",
|
|
802
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
803
|
+
", or in a Field by \"Choose a colour\" and the Field's label (\"Choose a colour Brand colour\"), so several on a page tell each other apart. It is described by the colour it shows (the hex, \"Transparent\" or \"No colour\"), which the compact swatch needs, with no hex beside it. It carries ",
|
|
804
|
+
/* @__PURE__ */ jsx("code", { children: "aria-haspopup=\"dialog\"" }),
|
|
805
|
+
" and opens the picker in a popover, a dialog named by its heading (the ",
|
|
806
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
807
|
+
", or the Field's label); Escape or a click outside closes it and returns focus to the swatch. Read-only, the swatch stays in the tab order, marked ",
|
|
808
|
+
/* @__PURE__ */ jsx("code", { children: "aria-disabled" }),
|
|
809
|
+
", and does not open."
|
|
810
|
+
] }),
|
|
811
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
812
|
+
"The hex field is a text input. Inside a ",
|
|
813
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
814
|
+
to: "/components/input#field",
|
|
815
|
+
children: "Field"
|
|
816
|
+
}),
|
|
817
|
+
" it takes the Field's ",
|
|
818
|
+
/* @__PURE__ */ jsx("code", { children: "id" }),
|
|
819
|
+
", ",
|
|
820
|
+
/* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
|
|
821
|
+
" and invalid state, so the label names it and an error is read with it. An invalid hex sets ",
|
|
822
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
823
|
+
"."
|
|
824
|
+
] }),
|
|
825
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
826
|
+
"In the picker, the area is a slider named \"Colour\", read as \"Saturation 100%, brightness 100%\"; the hue track is \"Hue\", read in degrees, and with ",
|
|
827
|
+
/* @__PURE__ */ jsx("code", { children: "alpha" }),
|
|
828
|
+
" there is an \"Opacity\" track read in percent. Presets are buttons named by their hex, and the hex field is an",
|
|
829
|
+
" ",
|
|
830
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
831
|
+
to: "/components/input",
|
|
832
|
+
children: "Input"
|
|
833
|
+
}),
|
|
834
|
+
" named \"Hex code\"."
|
|
835
|
+
] }),
|
|
836
|
+
"Keyboard: arrow keys move a slider (Shift moves ten, Page Up and Down move brightness ten), Home and End take a track to its ends and the area's saturation to its ends, and typing a valid hex in the picker takes it. Tab moves through the panel, and Escape closes it.",
|
|
837
|
+
"A transparent colour is written as the word \"transparent\" in the field, so it is not left to the chequerboard alone."
|
|
838
|
+
] })
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
841
|
+
id: "guidelines",
|
|
842
|
+
title: "Guidelines",
|
|
843
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
844
|
+
do: {
|
|
845
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
846
|
+
className: "color-field-stage",
|
|
847
|
+
children: /* @__PURE__ */ jsx(ColorField, {
|
|
848
|
+
label: "Brand colour",
|
|
849
|
+
defaultValue: "#0d9488"
|
|
850
|
+
})
|
|
851
|
+
}),
|
|
852
|
+
caption: "Give a colour a swatch and a picker. The hex is there for anyone who has one to paste."
|
|
853
|
+
},
|
|
854
|
+
dont: {
|
|
855
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
856
|
+
className: "color-field-stage",
|
|
857
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
858
|
+
"aria-label": "Brand colour",
|
|
859
|
+
defaultValue: "#0d9488"
|
|
860
|
+
})
|
|
861
|
+
}),
|
|
862
|
+
caption: "A hex on its own asks people to remember a code. Use ColorField so the colour can be seen and chosen."
|
|
863
|
+
}
|
|
864
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
865
|
+
"Label the field with what the colour is for (\"Brand colour\", \"Accent\"), never just \"Colour\".",
|
|
866
|
+
"Keep the sixteen presets for a first choice, and let the picker take any colour for the rest. They are neutrals and a spread of hues, not a brand palette.",
|
|
867
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
868
|
+
"Use ",
|
|
869
|
+
/* @__PURE__ */ jsx("code", { children: "alpha" }),
|
|
870
|
+
" only where a colour can be see-through: an overlay, a wash. Elsewhere an opaque colour is simpler to read and to store."
|
|
871
|
+
] }),
|
|
872
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
873
|
+
"Mark a colour that must be set with ",
|
|
874
|
+
/* @__PURE__ */ jsx("code", { children: "required" }),
|
|
875
|
+
", so Clear is not offered and the Field's label says so."
|
|
876
|
+
] }),
|
|
877
|
+
"Use compact in a tight row (a table cell, a toolbar) where the swatch alone is enough, and keep its label for assistive tech."
|
|
878
|
+
] })]
|
|
879
|
+
}),
|
|
880
|
+
/* @__PURE__ */ jsx(Fragment$1, {}),
|
|
881
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
882
|
+
id: "props",
|
|
883
|
+
title: "Props",
|
|
884
|
+
description: /* @__PURE__ */ jsx("p", { children: "Native input attributes and the ref go to the hex input; className and style go to the box around it." }),
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
887
|
+
title: "ColorField",
|
|
888
|
+
rows: [
|
|
889
|
+
{
|
|
890
|
+
name: "value",
|
|
891
|
+
type: "string | null",
|
|
892
|
+
description: "Controlled colour: hex, rgb() or rgba(), a var() reference, \"transparent\", or \"\" for none. With inherit, null is the default."
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
name: "defaultValue",
|
|
896
|
+
type: "string | null",
|
|
897
|
+
default: "'' (null with inherit)",
|
|
898
|
+
description: "Starting colour when uncontrolled."
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: "onValueChange",
|
|
902
|
+
type: "(colour: string) => void",
|
|
903
|
+
description: "Called with the new colour whenever it changes; with inherit, with null when it goes back to the default."
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: "format",
|
|
907
|
+
type: "'hex' | 'rgba'",
|
|
908
|
+
default: "'hex'",
|
|
909
|
+
description: "How a picked or typed colour is written: hex (eight digits when translucent), or rgba() while translucent and hex while opaque."
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "themeColours",
|
|
913
|
+
type: "ThemeColourGroup[]",
|
|
914
|
+
description: "The theme’s colours, grouped, in a tab beside the picker. themeColourGroups(palette) builds the page builder’s."
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: "eyedropper",
|
|
918
|
+
type: "boolean",
|
|
919
|
+
default: "false",
|
|
920
|
+
description: "The screen picker in the panel, where the browser has one."
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: "inherit",
|
|
924
|
+
type: "boolean",
|
|
925
|
+
default: "false",
|
|
926
|
+
description: "A default the colour inherits (null, \"Default\"), apart from no colour."
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
name: "inheritedColour",
|
|
930
|
+
type: "string",
|
|
931
|
+
description: "With inherit: the colour the default resolves to, painted on the swatch."
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
name: "defaultSwitch",
|
|
935
|
+
type: "boolean",
|
|
936
|
+
default: "false",
|
|
937
|
+
description: "With inherit: a \"Use default\" switch beside the box."
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: "starterColour",
|
|
941
|
+
type: "string",
|
|
942
|
+
description: "With defaultSwitch: the colour seeded when the switch is turned off. Default the inherited colour."
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
name: "allowTransparent",
|
|
946
|
+
type: "boolean",
|
|
947
|
+
default: "true",
|
|
948
|
+
description: "Offers Transparent in the picker."
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
name: "required",
|
|
952
|
+
type: "boolean",
|
|
953
|
+
default: "false",
|
|
954
|
+
description: "The field must keep a colour: Clear (and Transparent, unless allowed) leave it in place."
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: "alpha",
|
|
958
|
+
type: "boolean",
|
|
959
|
+
default: "false",
|
|
960
|
+
description: "An opacity track in the picker; the colour may then carry alpha (eight digits)."
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
name: "presets",
|
|
964
|
+
type: "string[]",
|
|
965
|
+
default: "COLOR_FIELD_PRESETS",
|
|
966
|
+
description: "Swatches in the picker. The sixteen defaults, or your own; [] for none."
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
name: "label",
|
|
970
|
+
type: "string",
|
|
971
|
+
description: "Names the swatch and the picker's heading. In a Field, leave it out: the Field's label names both."
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "compact",
|
|
975
|
+
type: "boolean",
|
|
976
|
+
default: "false",
|
|
977
|
+
description: "Just the swatch, for a tight row."
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
name: "size",
|
|
981
|
+
type: "'sm' | 'md' | 'lg'",
|
|
982
|
+
default: "'md'",
|
|
983
|
+
description: "30, 36 or 44px: the same heights as Input and Button."
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
name: "invalid",
|
|
987
|
+
type: "boolean",
|
|
988
|
+
description: "The error treatment and aria-invalid. Inside a Field it follows the Field's error."
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
name: "onInvalidChange",
|
|
992
|
+
type: "(invalid: boolean) => void",
|
|
993
|
+
description: "Told whether the typed text is not a colour yet. Called only when the flag changes."
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
name: "placeholder",
|
|
997
|
+
type: "string",
|
|
998
|
+
default: "'#000000'",
|
|
999
|
+
description: "The empty hex field."
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
name: "readOnly",
|
|
1003
|
+
type: "boolean",
|
|
1004
|
+
description: "Keeps the colour: the hex is read-only, the swatch stays in reach (aria-disabled) and the picker cannot open. The box sinks to the well."
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: "disabled",
|
|
1008
|
+
type: "boolean",
|
|
1009
|
+
description: "The swatch and input are disabled and the picker cannot open. The box sinks to the well and the swatch dims."
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "labels",
|
|
1013
|
+
type: "Partial<ColorFieldLabels>",
|
|
1014
|
+
description: "Words for another language. Anything left out stays English; colorFieldLabels is the English set."
|
|
1015
|
+
}
|
|
1016
|
+
]
|
|
1017
|
+
}),
|
|
1018
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
1019
|
+
title: "ColorFieldLabels",
|
|
1020
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
1021
|
+
columns: ["Word", "Default"],
|
|
1022
|
+
rows: [
|
|
1023
|
+
[/* @__PURE__ */ jsx("code", { children: "choose" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Choose a colour\": the swatch button, with the Field's label after it in a Field, and the picker heading when there is no label and no Field." })],
|
|
1024
|
+
[/* @__PURE__ */ jsx("code", { children: "transparent" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Transparent\": the picker's Transparent button, and what the swatch says it shows then." })],
|
|
1025
|
+
[/* @__PURE__ */ jsx("code", { children: "clear" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Clear\": the picker's Clear button." })],
|
|
1026
|
+
[/* @__PURE__ */ jsx("code", { children: "none" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"No colour\": what the swatch says it shows while there is no colour." })],
|
|
1027
|
+
[/* @__PURE__ */ jsx("code", { children: "default" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Default\": the empty text while the field is on its default." })],
|
|
1028
|
+
[/* @__PURE__ */ jsx("code", { children: "inherited" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Default (inherits)\": what the swatch says then." })],
|
|
1029
|
+
[/* @__PURE__ */ jsx("code", { children: "useDefault" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Use default\": the picker's button and the switch." })],
|
|
1030
|
+
[/* @__PURE__ */ jsx("code", { children: "linked" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Primary, a theme colour\": what the swatch says for a theme colour." })],
|
|
1031
|
+
[/* @__PURE__ */ jsx("code", { children: "sources" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Colours\": names the picker's two tabs." })],
|
|
1032
|
+
[/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1033
|
+
/* @__PURE__ */ jsx("code", { children: "themeTab" }),
|
|
1034
|
+
", ",
|
|
1035
|
+
/* @__PURE__ */ jsx("code", { children: "customTab" })
|
|
1036
|
+
] }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Theme\" and \"Custom\": the tabs." })],
|
|
1037
|
+
[/* @__PURE__ */ jsx("code", { children: "unlinked" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Unlinked from Primary\": after a custom pick over a theme colour." })],
|
|
1038
|
+
[/* @__PURE__ */ jsx("code", { children: "relink" }), /* @__PURE__ */ jsx(Fragment$1, { children: "\"Re-link\": links the theme colour again." })]
|
|
1039
|
+
]
|
|
1040
|
+
})
|
|
1041
|
+
}),
|
|
1042
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1043
|
+
title: "ColorPicker",
|
|
1044
|
+
rows: [
|
|
1045
|
+
{
|
|
1046
|
+
name: "value",
|
|
1047
|
+
type: "string",
|
|
1048
|
+
description: "Controlled colour: hex or rgb() / rgba() text. It is written back as hex (eight digits when alpha is on and it is not opaque), or as format says."
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: "format",
|
|
1052
|
+
type: "'hex' | 'rgba'",
|
|
1053
|
+
default: "'hex'",
|
|
1054
|
+
description: "rgba(): written as rgba() while translucent, hex while opaque."
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
name: "defaultValue",
|
|
1058
|
+
type: "string",
|
|
1059
|
+
default: "'#000000'",
|
|
1060
|
+
description: "Starting colour when uncontrolled."
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
name: "onValueChange",
|
|
1064
|
+
type: "(hex: string) => void",
|
|
1065
|
+
description: "Called on every change, also while a pointer drags."
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
name: "onValueCommit",
|
|
1069
|
+
type: "(hex: string) => void",
|
|
1070
|
+
description: "Called once a change is finished: a pointer up, a key, a preset, or a valid hex typed."
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
name: "alpha",
|
|
1074
|
+
type: "boolean",
|
|
1075
|
+
default: "false",
|
|
1076
|
+
description: "Shows the opacity track."
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
name: "presets",
|
|
1080
|
+
type: "string[]",
|
|
1081
|
+
description: "Swatches under the tracks. None by default; ColorField passes the sixteen."
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
name: "eyedropper",
|
|
1085
|
+
type: "boolean",
|
|
1086
|
+
default: "false",
|
|
1087
|
+
description: "A button that picks a colour from the screen, where the browser has window.EyeDropper."
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
name: "disabled",
|
|
1091
|
+
type: "boolean",
|
|
1092
|
+
default: "false",
|
|
1093
|
+
description: "Dims the panel and switches off every part."
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
name: "labels",
|
|
1097
|
+
type: "Partial<ColorPickerLabels>",
|
|
1098
|
+
description: "Words for another language. Anything left out stays English; colorPickerLabels is the English set."
|
|
1099
|
+
}
|
|
1100
|
+
]
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
1103
|
+
title: "ColorPickerLabels",
|
|
1104
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
1105
|
+
columns: ["Word", "Default"],
|
|
1106
|
+
rows: [
|
|
1107
|
+
[/* @__PURE__ */ jsx("code", { children: "area" }), "\"Colour\": names the saturation and brightness area."],
|
|
1108
|
+
[/* @__PURE__ */ jsx("code", { children: "areaValue" }), "Reads \"Saturation 100%, brightness 100%\" from the two values."],
|
|
1109
|
+
[/* @__PURE__ */ jsx("code", { children: "hue" }), "\"Hue\": names the hue track."],
|
|
1110
|
+
[/* @__PURE__ */ jsx("code", { children: "hueValue" }), "Reads \"180 degrees\" from the hue."],
|
|
1111
|
+
[/* @__PURE__ */ jsx("code", { children: "alpha" }), "\"Opacity\": names the opacity track."],
|
|
1112
|
+
[/* @__PURE__ */ jsx("code", { children: "alphaValue" }), "Reads \"50%\" from the opacity."],
|
|
1113
|
+
[/* @__PURE__ */ jsx("code", { children: "hex" }), "\"Hex code\": names the hex field."],
|
|
1114
|
+
[/* @__PURE__ */ jsx("code", { children: "presets" }), "\"Preset colours\": names the group."],
|
|
1115
|
+
[/* @__PURE__ */ jsx("code", { children: "preset" }), "The hex itself is each swatch's name."],
|
|
1116
|
+
[/* @__PURE__ */ jsx("code", { children: "eyedropper" }), "\"Pick a colour from the screen\": names the eyedropper button."]
|
|
1117
|
+
]
|
|
1118
|
+
})
|
|
1119
|
+
}),
|
|
1120
|
+
/* @__PURE__ */ jsx(Note, { children: "ColorField and ColorPicker are client components: the picker opens on a click, and the eyedropper only where the browser has one." })
|
|
1121
|
+
]
|
|
1122
|
+
})
|
|
1123
|
+
]
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
//#endregion
|
|
1127
|
+
export { Page, Preview };
|