@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,949 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
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";
|
|
3
|
+
import { t as Playground } from "./Playground-Mk1yIWXb.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Button, Dialog, DialogBody, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, Input, Textarea } from "@orbitcommerce/constellation";
|
|
7
|
+
import { CheckCircleIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/textarea.tsx
|
|
9
|
+
var GIFT = "Happy birthday, Mum! Hope the new chair makes the long days at the desk a little easier. Lots of love, Sam x";
|
|
10
|
+
var SEO = "The Arden ergonomic chair in black mesh, with adjustable lumbar support, 4D arms and a five-year warranty. Free UK delivery on orders over £50, from Leeds.";
|
|
11
|
+
var NOTE = "Customer rang to ask for delivery after 3pm.\nIf nobody answers, leave it with the neighbour at number 12.";
|
|
12
|
+
var RETURNS = `You can return anything within 30 days of delivery, as long as it is unused and in its original packaging.
|
|
13
|
+
|
|
14
|
+
Start a return from your account, or reply to your order email. We will send a prepaid label for orders over £50; under that, returns cost £4.95, taken from your refund.
|
|
15
|
+
|
|
16
|
+
Large items such as desks and storage are collected by our courier. We will email you to book a day.
|
|
17
|
+
|
|
18
|
+
Refunds go back to the card you paid with within 5 working days of the return reaching Leeds.`;
|
|
19
|
+
function Preview() {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "textarea-preview",
|
|
22
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
23
|
+
label: "Gift message",
|
|
24
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
25
|
+
rows: 2,
|
|
26
|
+
size: "sm",
|
|
27
|
+
showCount: true,
|
|
28
|
+
maxLength: 200,
|
|
29
|
+
defaultValue: GIFT
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
var quote = (v) => String(v).replace(/"/g, """);
|
|
35
|
+
var PLAYGROUND = [
|
|
36
|
+
{
|
|
37
|
+
prop: "aria-label",
|
|
38
|
+
type: "text",
|
|
39
|
+
default: "Order note",
|
|
40
|
+
toAttr: (v) => `aria-label="${quote(v)}"`
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
prop: "placeholder",
|
|
44
|
+
type: "text",
|
|
45
|
+
default: "Only your team sees notes",
|
|
46
|
+
toAttr: (v) => v ? `placeholder="${quote(v)}"` : null
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
prop: "size",
|
|
50
|
+
type: "select",
|
|
51
|
+
options: [
|
|
52
|
+
"sm",
|
|
53
|
+
"md",
|
|
54
|
+
"lg"
|
|
55
|
+
],
|
|
56
|
+
default: "md"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
prop: "rows",
|
|
60
|
+
type: "select",
|
|
61
|
+
options: [
|
|
62
|
+
"1",
|
|
63
|
+
"2",
|
|
64
|
+
"3",
|
|
65
|
+
"5"
|
|
66
|
+
],
|
|
67
|
+
default: "3",
|
|
68
|
+
toAttr: (v) => v === "3" ? null : `rows={${v}}`
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
prop: "autoGrow",
|
|
72
|
+
type: "boolean",
|
|
73
|
+
default: false,
|
|
74
|
+
toAttr: (v) => v ? "autoGrow maxRows={8}" : null
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
prop: "showCount",
|
|
78
|
+
type: "boolean",
|
|
79
|
+
default: false,
|
|
80
|
+
toAttr: (v) => v ? "showCount maxLength={160}" : null
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
prop: "invalid",
|
|
84
|
+
type: "boolean",
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
prop: "readOnly",
|
|
89
|
+
type: "boolean",
|
|
90
|
+
default: false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
prop: "disabled",
|
|
94
|
+
type: "boolean",
|
|
95
|
+
default: false
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
function NoteComposer({ size }) {
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: "textarea-composer",
|
|
101
|
+
children: [/* @__PURE__ */ jsx(Textarea, {
|
|
102
|
+
size,
|
|
103
|
+
rows: 1,
|
|
104
|
+
autoGrow: true,
|
|
105
|
+
maxRows: 4,
|
|
106
|
+
"aria-label": "Add a note to order #1043",
|
|
107
|
+
placeholder: "Add a note"
|
|
108
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
109
|
+
size,
|
|
110
|
+
children: "Add note"
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function OrderNote() {
|
|
115
|
+
const [note, setNote] = useState(NOTE);
|
|
116
|
+
const [saved, setSaved] = useState();
|
|
117
|
+
const save = (event) => {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
setSaved(note.trim() ? "Note saved to order #1043" : void 0);
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
122
|
+
className: "textarea-form",
|
|
123
|
+
noValidate: true,
|
|
124
|
+
onSubmit: save,
|
|
125
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
126
|
+
label: "Note",
|
|
127
|
+
hint: "Only your team sees it, on the order and the packing slip.",
|
|
128
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
129
|
+
autoGrow: true,
|
|
130
|
+
minRows: 2,
|
|
131
|
+
maxRows: 8,
|
|
132
|
+
value: note,
|
|
133
|
+
onChange: (e) => {
|
|
134
|
+
setNote(e.target.value);
|
|
135
|
+
setSaved(void 0);
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: "textarea-form__footer",
|
|
140
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
141
|
+
role: "status",
|
|
142
|
+
className: "textarea-status",
|
|
143
|
+
children: saved ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
144
|
+
weight: "fill",
|
|
145
|
+
"aria-hidden": "true"
|
|
146
|
+
}), saved] }) : null
|
|
147
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
148
|
+
type: "submit",
|
|
149
|
+
variant: "primary",
|
|
150
|
+
children: "Save note"
|
|
151
|
+
})]
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function SeoDescription() {
|
|
156
|
+
const [text, setText] = useState(SEO);
|
|
157
|
+
return /* @__PURE__ */ jsx("div", {
|
|
158
|
+
className: "textarea-stack",
|
|
159
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
160
|
+
label: "Search engine description",
|
|
161
|
+
hint: "Shown under the page title in search results.",
|
|
162
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
163
|
+
rows: 3,
|
|
164
|
+
showCount: true,
|
|
165
|
+
maxLength: 160,
|
|
166
|
+
value: text,
|
|
167
|
+
onChange: (e) => setText(e.target.value)
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
var CUSTOM_CSS = `/* Harbour Desk Co: a softer product grid */
|
|
173
|
+
.product-card {
|
|
174
|
+
border-radius: 16px;
|
|
175
|
+
padding: 12px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@media (max-width: 640px) {
|
|
179
|
+
.product-card { padding: 8px; }
|
|
180
|
+
}`;
|
|
181
|
+
var STORE_CONFIG = `{
|
|
182
|
+
"theme": "harbour",
|
|
183
|
+
"currency": "GBP"
|
|
184
|
+
"freeDeliveryOver": 75
|
|
185
|
+
}`;
|
|
186
|
+
var THEME_CSS = `.site-header { height: 72px; }`;
|
|
187
|
+
function MetaDescription() {
|
|
188
|
+
const [text, setText] = useState("The Arden ergonomic chair in black mesh, with 4D arms, a sliding seat and lumbar support that follows you. Delivered free in five working days, with a five-year guarantee.");
|
|
189
|
+
return /* @__PURE__ */ jsx("div", {
|
|
190
|
+
className: "textarea-stack",
|
|
191
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
192
|
+
label: "Meta description",
|
|
193
|
+
hint: "Search engines show about 160 characters.",
|
|
194
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
195
|
+
rows: 3,
|
|
196
|
+
recommendedLength: 160,
|
|
197
|
+
value: text,
|
|
198
|
+
onChange: (e) => setText(e.target.value)
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function ReturnReason() {
|
|
204
|
+
const [reason, setReason] = useState("");
|
|
205
|
+
const [error, setError] = useState();
|
|
206
|
+
const [sent, setSent] = useState(false);
|
|
207
|
+
const send = (event) => {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
const problem = reason.trim().length < 10 ? "Tell us a little more about what is wrong, so we can sort it quickly" : void 0;
|
|
210
|
+
setError(problem);
|
|
211
|
+
setSent(!problem);
|
|
212
|
+
};
|
|
213
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
214
|
+
className: "textarea-form",
|
|
215
|
+
noValidate: true,
|
|
216
|
+
onSubmit: send,
|
|
217
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
218
|
+
label: "What is wrong with it?",
|
|
219
|
+
hint: "A sentence or two is plenty.",
|
|
220
|
+
error,
|
|
221
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
222
|
+
rows: 3,
|
|
223
|
+
placeholder: "For example, a caster arrived cracked",
|
|
224
|
+
value: reason,
|
|
225
|
+
onChange: (e) => {
|
|
226
|
+
setReason(e.target.value);
|
|
227
|
+
setError(void 0);
|
|
228
|
+
setSent(false);
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
232
|
+
className: "textarea-form__footer",
|
|
233
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
234
|
+
role: "status",
|
|
235
|
+
className: "textarea-status",
|
|
236
|
+
children: sent ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
237
|
+
weight: "fill",
|
|
238
|
+
"aria-hidden": "true"
|
|
239
|
+
}), "Return started for order #1043"] }) : null
|
|
240
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
241
|
+
type: "submit",
|
|
242
|
+
variant: "primary",
|
|
243
|
+
children: "Start return"
|
|
244
|
+
})]
|
|
245
|
+
})]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function Page() {
|
|
249
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
250
|
+
title: "Textarea",
|
|
251
|
+
status: "new",
|
|
252
|
+
importNames: ["Textarea"],
|
|
253
|
+
lead: "A multi-line text field, for notes, messages and descriptions: anything longer than a line. It is the Input's frame, and it can grow with its text and count characters against a limit.",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
256
|
+
id: "playground",
|
|
257
|
+
title: "Playground",
|
|
258
|
+
description: /* @__PURE__ */ jsx("p", { children: "Change the props, then type a few lines. With autoGrow on, the field grows to eight rows and then scrolls." }),
|
|
259
|
+
children: /* @__PURE__ */ jsx(Playground, {
|
|
260
|
+
component: "Textarea",
|
|
261
|
+
controls: PLAYGROUND,
|
|
262
|
+
minHeight: 240,
|
|
263
|
+
render: (v) => /* @__PURE__ */ jsx("div", {
|
|
264
|
+
className: "textarea-stage",
|
|
265
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
266
|
+
"aria-label": String(v["aria-label"]),
|
|
267
|
+
placeholder: String(v.placeholder) || void 0,
|
|
268
|
+
size: v.size,
|
|
269
|
+
rows: Number(v.rows),
|
|
270
|
+
autoGrow: Boolean(v.autoGrow),
|
|
271
|
+
maxRows: v.autoGrow ? 8 : void 0,
|
|
272
|
+
showCount: Boolean(v.showCount),
|
|
273
|
+
maxLength: v.showCount ? 160 : void 0,
|
|
274
|
+
invalid: Boolean(v.invalid),
|
|
275
|
+
readOnly: Boolean(v.readOnly),
|
|
276
|
+
disabled: Boolean(v.disabled)
|
|
277
|
+
}, `${String(v.autoGrow)}-${String(v.rows)}`)
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
}),
|
|
281
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
282
|
+
id: "field",
|
|
283
|
+
title: "With a field",
|
|
284
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
285
|
+
"Put it in a ",
|
|
286
|
+
/* @__PURE__ */ jsx("code", { children: "Field" }),
|
|
287
|
+
" for a label above and a hint below, as with an Input: the label points at the textarea, the hint becomes its description, and an error marks it invalid. Set ",
|
|
288
|
+
/* @__PURE__ */ jsx("code", { children: "rows" }),
|
|
289
|
+
" to the length of answer you expect; three is the default."
|
|
290
|
+
] }),
|
|
291
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
292
|
+
code: `
|
|
293
|
+
<Field label="Gift message" hint="Printed on a card in the parcel.">
|
|
294
|
+
<Textarea rows={3} showCount maxLength={200} defaultValue="Happy birthday, Mum! ..." />
|
|
295
|
+
</Field>`,
|
|
296
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
297
|
+
className: "textarea-stack",
|
|
298
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
299
|
+
label: "Gift message",
|
|
300
|
+
hint: "Printed on a card in the parcel.",
|
|
301
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
302
|
+
rows: 3,
|
|
303
|
+
showCount: true,
|
|
304
|
+
maxLength: 200,
|
|
305
|
+
defaultValue: GIFT
|
|
306
|
+
})
|
|
307
|
+
})
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
312
|
+
id: "sizes",
|
|
313
|
+
title: "Sizes",
|
|
314
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
315
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
316
|
+
", ",
|
|
317
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
318
|
+
" (default) and ",
|
|
319
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
320
|
+
" take the Input's 13, 14 and 15px text. Lines run on a fixed rhythm, so one row is exactly as tall as an Input of the same size (30, 36 or 44px). A one-row field that grows sits on a line with its button, and stays lined up with it until the text wraps."
|
|
321
|
+
] }),
|
|
322
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
323
|
+
code: `
|
|
324
|
+
<Textarea size="sm" rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
|
|
325
|
+
<Button size="sm">Add note</Button>
|
|
326
|
+
|
|
327
|
+
<Textarea rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
|
|
328
|
+
<Button>Add note</Button>
|
|
329
|
+
|
|
330
|
+
<Textarea size="lg" rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
|
|
331
|
+
<Button size="lg">Add note</Button>`,
|
|
332
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
333
|
+
className: "textarea-sizes",
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ jsx(NoteComposer, { size: "sm" }),
|
|
336
|
+
/* @__PURE__ */ jsx(NoteComposer, { size: "md" }),
|
|
337
|
+
/* @__PURE__ */ jsx(NoteComposer, { size: "lg" })
|
|
338
|
+
]
|
|
339
|
+
})
|
|
340
|
+
})
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
343
|
+
id: "auto-grow",
|
|
344
|
+
title: "Auto-grow",
|
|
345
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
346
|
+
/* @__PURE__ */ jsx("code", { children: "autoGrow" }),
|
|
347
|
+
" fits the field to its text, from ",
|
|
348
|
+
/* @__PURE__ */ jsx("code", { children: "minRows" }),
|
|
349
|
+
" (or ",
|
|
350
|
+
/* @__PURE__ */ jsx("code", { children: "rows" }),
|
|
351
|
+
") up to",
|
|
352
|
+
" ",
|
|
353
|
+
/* @__PURE__ */ jsx("code", { children: "maxRows" }),
|
|
354
|
+
", then scrolls. It is measured by a hidden copy of the text set in the same place, so the page never jumps as the field grows, and the resize handle goes. Type a few more lines into this note."
|
|
355
|
+
] }),
|
|
356
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
357
|
+
code: `
|
|
358
|
+
const [note, setNote] = useState('Customer rang to ask for delivery after 3pm. ...')
|
|
359
|
+
|
|
360
|
+
<Field label="Note" hint="Only your team sees it, on the order and the packing slip.">
|
|
361
|
+
<Textarea autoGrow minRows={2} maxRows={8} value={note} onChange={(e) => setNote(e.target.value)} />
|
|
362
|
+
</Field>`,
|
|
363
|
+
children: /* @__PURE__ */ jsx(OrderNote, {})
|
|
364
|
+
})
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
367
|
+
id: "count",
|
|
368
|
+
title: "Character count",
|
|
369
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
370
|
+
/* @__PURE__ */ jsx("code", { children: "showCount" }),
|
|
371
|
+
" puts a count in the frame's bottom corner: the characters typed, out of",
|
|
372
|
+
" ",
|
|
373
|
+
/* @__PURE__ */ jsx("code", { children: "maxLength" }),
|
|
374
|
+
" when there is one. It stays quiet until the last tenth of the limit, then takes the warning wash; the browser stops typing at the limit itself. A value set in code that runs over turns it red."
|
|
375
|
+
] }), /* @__PURE__ */ jsx("p", { children: "This description starts 5 short of its 160: delete a few words, or add some." })] }),
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx(Example, {
|
|
378
|
+
code: `
|
|
379
|
+
<Field label="Search engine description" hint="Shown under the page title in search results.">
|
|
380
|
+
<Textarea rows={3} showCount maxLength={160} value={text} onChange={(e) => setText(e.target.value)} />
|
|
381
|
+
</Field>`,
|
|
382
|
+
children: /* @__PURE__ */ jsx(SeoDescription, {})
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
385
|
+
columns: [
|
|
386
|
+
"Count",
|
|
387
|
+
"Looks",
|
|
388
|
+
"Screen readers"
|
|
389
|
+
],
|
|
390
|
+
rows: [
|
|
391
|
+
[
|
|
392
|
+
"Up to 90% of the limit",
|
|
393
|
+
"Quiet slate digits",
|
|
394
|
+
"Read with the field: \"12 characters left\""
|
|
395
|
+
],
|
|
396
|
+
[
|
|
397
|
+
"The last 10%",
|
|
398
|
+
"Digits on the warning wash",
|
|
399
|
+
"Announced politely as they change"
|
|
400
|
+
],
|
|
401
|
+
[
|
|
402
|
+
"Over the limit (set in code)",
|
|
403
|
+
"Digits on a red wash",
|
|
404
|
+
"Announced: \"3 characters too many\""
|
|
405
|
+
]
|
|
406
|
+
]
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
409
|
+
title: "A recommended length",
|
|
410
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "recommendedLength" }), " is a soft limit, as on the Input: the count runs against it, typing goes on past it, and past it the count turns red, the edge turns red and the field reads as invalid, while the text is kept. Screen readers hear \"142 of 160 characters used\", then how far over it runs."] }),
|
|
411
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
412
|
+
code: `
|
|
413
|
+
<Field label="Meta description" hint="Search engines show about 160 characters.">
|
|
414
|
+
<Textarea rows={3} recommendedLength={160} value={text} onChange={(e) => setText(e.target.value)} />
|
|
415
|
+
</Field>`,
|
|
416
|
+
children: /* @__PURE__ */ jsx(MetaDescription, {})
|
|
417
|
+
})
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ jsxs(Note, { children: [
|
|
420
|
+
"The spoken words come from ",
|
|
421
|
+
/* @__PURE__ */ jsx("code", { children: "countLabel" }),
|
|
422
|
+
" and ",
|
|
423
|
+
/* @__PURE__ */ jsx("code", { children: "recommendedLabel" }),
|
|
424
|
+
", functions of the length and the limit. Pass your own to translate them."
|
|
425
|
+
] })
|
|
426
|
+
]
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
429
|
+
id: "code",
|
|
430
|
+
title: "Code",
|
|
431
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "variant=\"code\"" }), " is the field for custom CSS, a head or body script, or a JSON config: set in mono, with spelling and autocorrect off and lines kept whole (they scroll sideways). Tab indents by two spaces, Shift+Tab takes it back, and both work on every line of a selection; Enter keeps the line's indent. The resize handle stays."] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
432
|
+
"Tab is the code's, so there are two ways out, and the footer says the first while the field has focus: Escape, then Tab, moves on as Tab always does; Ctrl+M turns Tab's indenting off, and on again, and the footer says which it is. Inside a dialog or a sheet the first Escape is the field's step out and a second closes the dialog. Screen readers hear the same with the field. ",
|
|
433
|
+
/* @__PURE__ */ jsx("code", { children: "language" }),
|
|
434
|
+
" names the code in the footer;",
|
|
435
|
+
" ",
|
|
436
|
+
/* @__PURE__ */ jsx("code", { children: "lineNumbers" }),
|
|
437
|
+
" adds a gutter; ",
|
|
438
|
+
/* @__PURE__ */ jsx("code", { children: "highlight" }),
|
|
439
|
+
" colours it with the kit's light reading of CSS, HTML, JavaScript and JSON, or with your own highlighter."
|
|
440
|
+
] })] }),
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ jsx(Example, {
|
|
443
|
+
align: "fill",
|
|
444
|
+
code: `
|
|
445
|
+
<Field label="Custom CSS" description="Added after the theme's own styles, on every page.">
|
|
446
|
+
<Textarea variant="code" language="css" lineNumbers highlight rows={7} defaultValue={css} />
|
|
447
|
+
</Field>`,
|
|
448
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
449
|
+
className: "textarea-code",
|
|
450
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
451
|
+
label: "Custom CSS",
|
|
452
|
+
description: "Added after the theme's own styles, on every page.",
|
|
453
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
454
|
+
variant: "code",
|
|
455
|
+
language: "css",
|
|
456
|
+
lineNumbers: true,
|
|
457
|
+
highlight: true,
|
|
458
|
+
rows: 7,
|
|
459
|
+
defaultValue: CUSTOM_CSS
|
|
460
|
+
})
|
|
461
|
+
})
|
|
462
|
+
})
|
|
463
|
+
}),
|
|
464
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
465
|
+
title: "Problems in the code",
|
|
466
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
467
|
+
"A JSON field checks itself a moment after the typing stops and lists the first problem under the code, at its line and column, in words: \"Expected a comma or a closing brace\". The place is a button that puts the caret there, its line is marked in the gutter, and the field reads as invalid. Pass ",
|
|
468
|
+
/* @__PURE__ */ jsx("code", { children: "issues" }),
|
|
469
|
+
" to list your own (a CSS check, a server's answer) for any language. ",
|
|
470
|
+
/* @__PURE__ */ jsx("code", { children: "checkJson" }),
|
|
471
|
+
" is exported for a check of your own."
|
|
472
|
+
] }),
|
|
473
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
474
|
+
align: "fill",
|
|
475
|
+
code: `
|
|
476
|
+
<Field label="Store config" hint="JSON. Read by the store's theme at build time.">
|
|
477
|
+
<Textarea variant="code" language="json" lineNumbers highlight rows={6} defaultValue={config} />
|
|
478
|
+
</Field>`,
|
|
479
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
480
|
+
className: "textarea-code",
|
|
481
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
482
|
+
label: "Store config",
|
|
483
|
+
hint: "JSON. Read by the store's theme at build time.",
|
|
484
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
485
|
+
variant: "code",
|
|
486
|
+
language: "json",
|
|
487
|
+
lineNumbers: true,
|
|
488
|
+
highlight: true,
|
|
489
|
+
rows: 6,
|
|
490
|
+
defaultValue: STORE_CONFIG
|
|
491
|
+
})
|
|
492
|
+
})
|
|
493
|
+
})
|
|
494
|
+
})
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
497
|
+
title: "In a dialog",
|
|
498
|
+
description: /* @__PURE__ */ jsx("p", { children: "A long script or stylesheet is edited in a dialog, as the page builder's code editor is. There the first Escape is the field's step out (then Tab moves on), and a second Escape closes the dialog." }),
|
|
499
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
500
|
+
code: `
|
|
501
|
+
<Dialog>
|
|
502
|
+
<DialogTrigger asChild>
|
|
503
|
+
<Button>Edit custom CSS</Button>
|
|
504
|
+
</DialogTrigger>
|
|
505
|
+
<DialogContent size="lg">
|
|
506
|
+
<DialogHeader>
|
|
507
|
+
<DialogTitle>Custom CSS</DialogTitle>
|
|
508
|
+
</DialogHeader>
|
|
509
|
+
<DialogBody>
|
|
510
|
+
<Textarea aria-label="Custom CSS" variant="code" language="css" lineNumbers highlight rows={12} defaultValue={css} />
|
|
511
|
+
</DialogBody>
|
|
512
|
+
<DialogFooter>
|
|
513
|
+
<DialogClose asChild>
|
|
514
|
+
<Button variant="primary">Done</Button>
|
|
515
|
+
</DialogClose>
|
|
516
|
+
</DialogFooter>
|
|
517
|
+
</DialogContent>
|
|
518
|
+
</Dialog>`,
|
|
519
|
+
children: /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
520
|
+
asChild: true,
|
|
521
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Edit custom CSS" })
|
|
522
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
523
|
+
size: "lg",
|
|
524
|
+
children: [
|
|
525
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Custom CSS" }) }),
|
|
526
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx(Textarea, {
|
|
527
|
+
"aria-label": "Custom CSS",
|
|
528
|
+
variant: "code",
|
|
529
|
+
language: "css",
|
|
530
|
+
lineNumbers: true,
|
|
531
|
+
highlight: true,
|
|
532
|
+
rows: 12,
|
|
533
|
+
defaultValue: CUSTOM_CSS
|
|
534
|
+
}) }),
|
|
535
|
+
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(DialogClose, {
|
|
536
|
+
asChild: true,
|
|
537
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
538
|
+
variant: "primary",
|
|
539
|
+
children: "Done"
|
|
540
|
+
})
|
|
541
|
+
}) })
|
|
542
|
+
]
|
|
543
|
+
})] })
|
|
544
|
+
})
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
547
|
+
title: "Plain, small and read-only",
|
|
548
|
+
description: /* @__PURE__ */ jsx("p", { children: "Without line numbers or colour it is a mono field with the keys. It takes the sizes, and read-only gives Tab back to the page." }),
|
|
549
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
550
|
+
align: "fill",
|
|
551
|
+
code: `
|
|
552
|
+
<Field label="Head script" size="sm">
|
|
553
|
+
<Textarea variant="code" language="html" rows={3} placeholder="<script>…<\/script>" />
|
|
554
|
+
</Field>
|
|
555
|
+
<Field label="Theme CSS" hint="Set by the theme">
|
|
556
|
+
<Textarea variant="code" language="css" readOnly rows={3} value={themeCss} />
|
|
557
|
+
</Field>`,
|
|
558
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
559
|
+
className: "textarea-grid",
|
|
560
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
561
|
+
label: "Head script",
|
|
562
|
+
size: "sm",
|
|
563
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
564
|
+
variant: "code",
|
|
565
|
+
language: "html",
|
|
566
|
+
rows: 3,
|
|
567
|
+
placeholder: "<script>…<\/script>"
|
|
568
|
+
})
|
|
569
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
570
|
+
label: "Theme CSS",
|
|
571
|
+
hint: "Set by the theme",
|
|
572
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
573
|
+
variant: "code",
|
|
574
|
+
language: "css",
|
|
575
|
+
readOnly: true,
|
|
576
|
+
rows: 3,
|
|
577
|
+
value: THEME_CSS
|
|
578
|
+
})
|
|
579
|
+
})]
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
})
|
|
583
|
+
]
|
|
584
|
+
}),
|
|
585
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
586
|
+
id: "states",
|
|
587
|
+
title: "States",
|
|
588
|
+
description: /* @__PURE__ */ jsx("p", { children: "The Input's states, many lines tall. Hover firms the hairline; focus turns it teal with the soft halo; an error in the Field swaps the teal for red. Read-only and disabled sink into the well: a read-only field can still be selected and copied." }),
|
|
589
|
+
children: [
|
|
590
|
+
/* @__PURE__ */ jsx(Example, {
|
|
591
|
+
align: "fill",
|
|
592
|
+
code: `
|
|
593
|
+
<Field label="Packing instructions">
|
|
594
|
+
<Textarea rows={2} placeholder="For example, wrap the legs separately" />
|
|
595
|
+
</Field>
|
|
596
|
+
<Field label="Packing instructions">
|
|
597
|
+
<Textarea rows={2} defaultValue="Wrap the chair base in two layers of bubble wrap." />
|
|
598
|
+
</Field>
|
|
599
|
+
<Field label="Reason for the refund" error="Enter a reason, so the customer knows why">
|
|
600
|
+
<Textarea rows={2} />
|
|
601
|
+
</Field>
|
|
602
|
+
<Field label="Customer's note" hint="Left at checkout">
|
|
603
|
+
<Textarea rows={2} readOnly value="Please leave the parcel in the porch. The doorbell does not work." />
|
|
604
|
+
</Field>
|
|
605
|
+
<Field label="Gift message" hint="Turn on Gift wrap to add a message">
|
|
606
|
+
<Textarea rows={2} disabled />
|
|
607
|
+
</Field>`,
|
|
608
|
+
caption: "Empty, filled, invalid, read-only and disabled.",
|
|
609
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
610
|
+
className: "textarea-grid",
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ jsx(Field, {
|
|
613
|
+
label: "Packing instructions",
|
|
614
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
615
|
+
rows: 2,
|
|
616
|
+
placeholder: "For example, wrap the legs separately"
|
|
617
|
+
})
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ jsx(Field, {
|
|
620
|
+
label: "Packing instructions",
|
|
621
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
622
|
+
rows: 2,
|
|
623
|
+
defaultValue: "Wrap the chair base in two layers of bubble wrap."
|
|
624
|
+
})
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ jsx(Field, {
|
|
627
|
+
label: "Reason for the refund",
|
|
628
|
+
error: "Enter a reason, so the customer knows why",
|
|
629
|
+
children: /* @__PURE__ */ jsx(Textarea, { rows: 2 })
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ jsx(Field, {
|
|
632
|
+
label: "Customer's note",
|
|
633
|
+
hint: "Left at checkout",
|
|
634
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
635
|
+
rows: 2,
|
|
636
|
+
readOnly: true,
|
|
637
|
+
value: "Please leave the parcel in the porch. The doorbell does not work."
|
|
638
|
+
})
|
|
639
|
+
}),
|
|
640
|
+
/* @__PURE__ */ jsx(Field, {
|
|
641
|
+
label: "Gift message",
|
|
642
|
+
hint: "Turn on Gift wrap to add a message",
|
|
643
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
644
|
+
rows: 2,
|
|
645
|
+
disabled: true
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
]
|
|
649
|
+
})
|
|
650
|
+
}),
|
|
651
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
652
|
+
title: "Errors",
|
|
653
|
+
description: /* @__PURE__ */ jsx("p", { children: "Check when the form is sent and clear the error as soon as the person starts fixing it. Press Start return with the field empty." }),
|
|
654
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
655
|
+
code: `
|
|
656
|
+
<Field label="What is wrong with it?" hint="A sentence or two is plenty." error={error}>
|
|
657
|
+
<Textarea
|
|
658
|
+
rows={3}
|
|
659
|
+
placeholder="For example, a caster arrived cracked"
|
|
660
|
+
value={reason}
|
|
661
|
+
onChange={(e) => {
|
|
662
|
+
setReason(e.target.value)
|
|
663
|
+
setError(undefined)
|
|
664
|
+
}}
|
|
665
|
+
/>
|
|
666
|
+
</Field>`,
|
|
667
|
+
children: /* @__PURE__ */ jsx(ReturnReason, {})
|
|
668
|
+
})
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
671
|
+
title: "Long content",
|
|
672
|
+
description: /* @__PURE__ */ jsx("p", { children: "Past its most rows, a field that grows scrolls inside its frame, and the frame keeps its edge whole." }),
|
|
673
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
674
|
+
code: `<Textarea autoGrow minRows={3} maxRows={6} defaultValue={returnsPolicy} aria-label="Returns policy" />`,
|
|
675
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
676
|
+
className: "textarea-stage",
|
|
677
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
678
|
+
autoGrow: true,
|
|
679
|
+
minRows: 3,
|
|
680
|
+
maxRows: 6,
|
|
681
|
+
defaultValue: RETURNS,
|
|
682
|
+
"aria-label": "Returns policy"
|
|
683
|
+
})
|
|
684
|
+
})
|
|
685
|
+
})
|
|
686
|
+
})
|
|
687
|
+
]
|
|
688
|
+
}),
|
|
689
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
690
|
+
id: "both-themes",
|
|
691
|
+
title: "In both themes",
|
|
692
|
+
description: /* @__PURE__ */ jsx("p", { children: "A count in its warning wash, an error and a disabled field, light and dark side by side." }),
|
|
693
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
694
|
+
align: "fill",
|
|
695
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
696
|
+
className: "textarea-pair",
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ jsx(Field, {
|
|
699
|
+
label: "Search engine description",
|
|
700
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
701
|
+
rows: 3,
|
|
702
|
+
showCount: true,
|
|
703
|
+
maxLength: 160,
|
|
704
|
+
defaultValue: SEO
|
|
705
|
+
})
|
|
706
|
+
}),
|
|
707
|
+
/* @__PURE__ */ jsx(Field, {
|
|
708
|
+
label: "Reason for the refund",
|
|
709
|
+
error: "Enter a reason, so the customer knows why",
|
|
710
|
+
children: /* @__PURE__ */ jsx(Textarea, { rows: 2 })
|
|
711
|
+
}),
|
|
712
|
+
/* @__PURE__ */ jsx(Field, {
|
|
713
|
+
label: "Gift message",
|
|
714
|
+
hint: "Turn on Gift wrap to add a message",
|
|
715
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
716
|
+
rows: 2,
|
|
717
|
+
disabled: true
|
|
718
|
+
})
|
|
719
|
+
})
|
|
720
|
+
]
|
|
721
|
+
})
|
|
722
|
+
})
|
|
723
|
+
}),
|
|
724
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
725
|
+
id: "guidelines",
|
|
726
|
+
title: "Guidelines",
|
|
727
|
+
children: [
|
|
728
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
729
|
+
do: {
|
|
730
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
731
|
+
className: "textarea-dodont",
|
|
732
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
733
|
+
label: "Note",
|
|
734
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
735
|
+
rows: 2,
|
|
736
|
+
defaultValue: "Customer rang to ask for delivery after 3pm."
|
|
737
|
+
})
|
|
738
|
+
})
|
|
739
|
+
}),
|
|
740
|
+
caption: "Free text with no set shape: a note, a message, a reason."
|
|
741
|
+
},
|
|
742
|
+
dont: {
|
|
743
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
744
|
+
className: "textarea-dodont",
|
|
745
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
746
|
+
label: "Delivery address",
|
|
747
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
748
|
+
rows: 3,
|
|
749
|
+
defaultValue: "14 Mill Lane\nLeeds\nLS1 4AB"
|
|
750
|
+
})
|
|
751
|
+
})
|
|
752
|
+
}),
|
|
753
|
+
caption: "Structured answers in one box. An address is separate fields, so it can be checked and used."
|
|
754
|
+
}
|
|
755
|
+
}),
|
|
756
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
757
|
+
do: {
|
|
758
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
759
|
+
className: "textarea-dodont",
|
|
760
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
761
|
+
label: "Product title",
|
|
762
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "Arden ergonomic chair" })
|
|
763
|
+
})
|
|
764
|
+
}),
|
|
765
|
+
caption: "One line of answer gets an Input."
|
|
766
|
+
},
|
|
767
|
+
dont: {
|
|
768
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
769
|
+
className: "textarea-dodont",
|
|
770
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
771
|
+
label: "Product title",
|
|
772
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
773
|
+
rows: 4,
|
|
774
|
+
defaultValue: "Arden ergonomic chair"
|
|
775
|
+
})
|
|
776
|
+
})
|
|
777
|
+
}),
|
|
778
|
+
caption: "A tall box asks for more than the answer needs."
|
|
779
|
+
}
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
782
|
+
"Size the field to the answer you expect: two or three rows for a note, more for a description. Let it grow rather than making it huge.",
|
|
783
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: "Show a count only when there is a limit that matters, such as a search description or an SMS. Say what the limit is for in the hint." }),
|
|
784
|
+
"A placeholder gives an example of a good answer; it never replaces the label.",
|
|
785
|
+
"Long formatted copy (product descriptions, blog posts) belongs in the rich text editor, not here."
|
|
786
|
+
] })
|
|
787
|
+
]
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
790
|
+
id: "accessibility",
|
|
791
|
+
title: "Accessibility",
|
|
792
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
793
|
+
"A native textarea: everything the browser and assistive tech know about text fields works, including spellcheck and dictation.",
|
|
794
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
795
|
+
"In a Field, the label names it and the hint or error describes it. An error also sets ",
|
|
796
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
797
|
+
". Outside a Field, give it an ",
|
|
798
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
799
|
+
"."
|
|
800
|
+
] }),
|
|
801
|
+
"With a limit, the count is part of its description, so it is read with the field. In the last tenth it is announced politely as it changes, never on every key press before that.",
|
|
802
|
+
"The visible digits are hidden from screen readers; they hear words instead, from countLabel.",
|
|
803
|
+
"Clicking anywhere in the frame, the count included, puts the caret in the field.",
|
|
804
|
+
"Focus shows as a teal edge with a soft halo round the whole frame."
|
|
805
|
+
] })
|
|
806
|
+
}),
|
|
807
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
808
|
+
id: "props",
|
|
809
|
+
title: "Props",
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
812
|
+
{
|
|
813
|
+
name: "size",
|
|
814
|
+
type: "'sm' | 'md' | 'lg'",
|
|
815
|
+
default: "'md'",
|
|
816
|
+
description: "Text of 13, 14 or 15px; one row is 30, 36 or 44px tall, as an Input."
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: "rows",
|
|
820
|
+
type: "number",
|
|
821
|
+
default: "3",
|
|
822
|
+
description: "Height in rows. With autoGrow, the fewest rows unless minRows is set."
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "autoGrow",
|
|
826
|
+
type: "boolean",
|
|
827
|
+
default: "false",
|
|
828
|
+
description: "Grow with the text, then scroll. Removes the resize handle."
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: "minRows",
|
|
832
|
+
type: "number",
|
|
833
|
+
description: "With autoGrow: the fewest rows. Defaults to rows, or 3."
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
name: "maxRows",
|
|
837
|
+
type: "number",
|
|
838
|
+
description: "With autoGrow: the most rows before it scrolls. No limit when left out."
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
name: "showCount",
|
|
842
|
+
type: "boolean",
|
|
843
|
+
default: "false",
|
|
844
|
+
description: "A character count in the bottom corner, out of maxLength when set."
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
name: "maxLength",
|
|
848
|
+
type: "number",
|
|
849
|
+
description: "The native limit. The count warns in its last tenth."
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
name: "countLabel",
|
|
853
|
+
type: "(length, maxLength) => string",
|
|
854
|
+
description: "Words screen readers hear for the count. Defaults to \"12 characters left\"."
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
name: "variant",
|
|
858
|
+
type: "'text' | 'code'",
|
|
859
|
+
default: "'text'",
|
|
860
|
+
description: "code: mono, spelling off, lines kept whole, Tab indents; Esc then Tab, or Ctrl+M, gives Tab back."
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: "language",
|
|
864
|
+
type: "'css' | 'html' | 'js' | 'json' | 'text'",
|
|
865
|
+
default: "'text'",
|
|
866
|
+
description: "With code: named in the footer, read by highlight; json checks itself."
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
name: "lineNumbers",
|
|
870
|
+
type: "boolean",
|
|
871
|
+
default: "false",
|
|
872
|
+
description: "With code: a gutter of line numbers, scrolled with the code."
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
name: "highlight",
|
|
876
|
+
type: "boolean | (code, language) => ReactNode",
|
|
877
|
+
description: "With code: colours the code under the text, with the kit's tokenizer or your own."
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: "issues",
|
|
881
|
+
type: "CodeIssue[]",
|
|
882
|
+
description: "With code: problems to list, { line, column?, message }, each with a button to its place."
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
name: "indent",
|
|
886
|
+
type: "string",
|
|
887
|
+
default: "' '",
|
|
888
|
+
description: "With code: what Tab inserts."
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: "jsonCheck",
|
|
892
|
+
type: "Partial<JsonCheckLabels> | false",
|
|
893
|
+
description: "With json: the check's words, or false to turn it off."
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
name: "codeLabels",
|
|
897
|
+
type: "Partial<CodeFieldLabels>",
|
|
898
|
+
description: "With code: keys, tabMoves, tabIndents, issueAt(line, column), languages."
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: "recommendedLength",
|
|
902
|
+
type: "number",
|
|
903
|
+
description: "A soft limit: the count runs against it, typing goes past it, and past it the field reads as invalid."
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: "recommendedLabel",
|
|
907
|
+
type: "(length, recommended) => string",
|
|
908
|
+
description: "Words for a count against recommendedLength. Defaults to \"142 of 160 characters used\"."
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
name: "invalid",
|
|
912
|
+
type: "boolean",
|
|
913
|
+
description: "Red edge and aria-invalid. In a Field, follows its error; aria-invalid works too."
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
name: "readOnly",
|
|
917
|
+
type: "boolean",
|
|
918
|
+
description: "Sinks into the well; still focusable and copyable."
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: "disabled",
|
|
922
|
+
type: "boolean",
|
|
923
|
+
description: "Sinks into the well and dims; skipped by Tab."
|
|
924
|
+
}
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ jsxs("p", {
|
|
927
|
+
className: "doc-section__description",
|
|
928
|
+
children: [
|
|
929
|
+
"Every other native textarea attribute, and the ",
|
|
930
|
+
/* @__PURE__ */ jsx("code", { children: "ref" }),
|
|
931
|
+
", go to the ",
|
|
932
|
+
/* @__PURE__ */ jsx("code", { children: "textarea" }),
|
|
933
|
+
".",
|
|
934
|
+
" ",
|
|
935
|
+
/* @__PURE__ */ jsx("code", { children: "className" }),
|
|
936
|
+
" and ",
|
|
937
|
+
/* @__PURE__ */ jsx("code", { children: "style" }),
|
|
938
|
+
" go to the frame around it."
|
|
939
|
+
]
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
942
|
+
]
|
|
943
|
+
}),
|
|
944
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
945
|
+
]
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
//#endregion
|
|
949
|
+
export { Page, Preview };
|