@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,839 @@
|
|
|
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 { useRef, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Badge, Button, Chip, Field, Textarea } from "@orbitcommerce/constellation";
|
|
7
|
+
import { ArmchairIcon, BracketsCurlyIcon, LightbulbIcon, SparkleIcon, TagIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/chip.tsx
|
|
9
|
+
function Preview() {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "chip-preview",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
14
|
+
selected: true,
|
|
15
|
+
onSelectedChange: () => {},
|
|
16
|
+
children: "All"
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
19
|
+
selected: false,
|
|
20
|
+
onSelectedChange: () => {},
|
|
21
|
+
count: 128,
|
|
22
|
+
children: "Furniture"
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
25
|
+
selected: false,
|
|
26
|
+
onSelectedChange: () => {},
|
|
27
|
+
children: "Lighting"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
30
|
+
onRemove: () => {},
|
|
31
|
+
children: "Trade"
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
34
|
+
color: "#b4440c",
|
|
35
|
+
size: "sm",
|
|
36
|
+
children: "Urgent"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var INDUSTRIES = [
|
|
42
|
+
{
|
|
43
|
+
id: "all",
|
|
44
|
+
label: "All",
|
|
45
|
+
count: 214
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "furniture",
|
|
49
|
+
label: "Furniture",
|
|
50
|
+
count: 128
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "lighting",
|
|
54
|
+
label: "Lighting",
|
|
55
|
+
count: 46
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "textiles",
|
|
59
|
+
label: "Textiles",
|
|
60
|
+
count: 40
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
/** One chosen at a time; All clears the rest. A group, named, so assistive tech announces the set. */
|
|
64
|
+
function QuickPicks() {
|
|
65
|
+
const [picked, setPicked] = useState("all");
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
role: "group",
|
|
68
|
+
"aria-label": "Industry",
|
|
69
|
+
className: "chip-row",
|
|
70
|
+
children: INDUSTRIES.map((industry) => /* @__PURE__ */ jsx(Chip, {
|
|
71
|
+
selected: picked === industry.id,
|
|
72
|
+
onSelectedChange: (on) => setPicked(on ? industry.id : "all"),
|
|
73
|
+
count: industry.count,
|
|
74
|
+
children: industry.label
|
|
75
|
+
}, industry.id))
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** Any number chosen at once. */
|
|
79
|
+
function MultiPick() {
|
|
80
|
+
const [picked, setPicked] = useState(["furniture"]);
|
|
81
|
+
const toggle = (id, on) => setPicked((now) => on ? [...now, id] : now.filter((x) => x !== id));
|
|
82
|
+
return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
role: "group",
|
|
84
|
+
"aria-label": "Show these",
|
|
85
|
+
className: "chip-row",
|
|
86
|
+
children: INDUSTRIES.slice(1).map((industry) => /* @__PURE__ */ jsx(Chip, {
|
|
87
|
+
selected: picked.includes(industry.id),
|
|
88
|
+
onSelectedChange: (on) => toggle(industry.id, on),
|
|
89
|
+
children: industry.label
|
|
90
|
+
}, industry.id))
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var FIRST_TAGS = [
|
|
94
|
+
"Trade",
|
|
95
|
+
"VIP",
|
|
96
|
+
"Wholesale",
|
|
97
|
+
"Gift"
|
|
98
|
+
];
|
|
99
|
+
function Tags() {
|
|
100
|
+
const [tags, setTags] = useState(FIRST_TAGS);
|
|
101
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
102
|
+
className: "chip-row",
|
|
103
|
+
children: tags.length ? tags.map((tag) => /* @__PURE__ */ jsx(Chip, {
|
|
104
|
+
size: "sm",
|
|
105
|
+
onRemove: () => setTags((now) => now.filter((t) => t !== tag)),
|
|
106
|
+
children: tag
|
|
107
|
+
}, tag)) : /* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: "chip-empty",
|
|
109
|
+
children: "No tags"
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
112
|
+
size: "sm",
|
|
113
|
+
variant: "soft",
|
|
114
|
+
onClick: () => setTags(FIRST_TAGS),
|
|
115
|
+
children: "Put them back"
|
|
116
|
+
})] });
|
|
117
|
+
}
|
|
118
|
+
function Applied() {
|
|
119
|
+
const [filters, setFilters] = useState(["Brand: Northlight", "Colour: Walnut"]);
|
|
120
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: "chip-row",
|
|
122
|
+
children: [filters.map((filter) => /* @__PURE__ */ jsx(Chip, {
|
|
123
|
+
selected: true,
|
|
124
|
+
onRemove: () => setFilters((now) => now.filter((f) => f !== filter)),
|
|
125
|
+
removeLabel: `Clear ${filter}`,
|
|
126
|
+
children: filter
|
|
127
|
+
}, filter)), filters.length === 0 ? /* @__PURE__ */ jsx("span", {
|
|
128
|
+
className: "chip-empty",
|
|
129
|
+
children: "No filters"
|
|
130
|
+
}) : null]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
var PROMPTS = [
|
|
134
|
+
"Shorten every title",
|
|
135
|
+
"Add the material to each title",
|
|
136
|
+
"Write titles in sentence case"
|
|
137
|
+
];
|
|
138
|
+
/** Suggested prompts: each chip fills the field with its words. */
|
|
139
|
+
function PromptSuggestions() {
|
|
140
|
+
const [prompt, setPrompt] = useState("");
|
|
141
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
142
|
+
className: "chip-compose",
|
|
143
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
144
|
+
label: "What should change?",
|
|
145
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
146
|
+
rows: 2,
|
|
147
|
+
value: prompt,
|
|
148
|
+
onChange: (event) => setPrompt(event.target.value),
|
|
149
|
+
placeholder: "Type a rule"
|
|
150
|
+
})
|
|
151
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
152
|
+
className: "chip-row",
|
|
153
|
+
role: "group",
|
|
154
|
+
"aria-label": "Suggested prompts",
|
|
155
|
+
children: PROMPTS.map((suggestion) => /* @__PURE__ */ jsx(Chip, {
|
|
156
|
+
size: "sm",
|
|
157
|
+
icon: /* @__PURE__ */ jsx(SparkleIcon, {}),
|
|
158
|
+
onAction: () => setPrompt(suggestion),
|
|
159
|
+
children: suggestion
|
|
160
|
+
}, suggestion))
|
|
161
|
+
})]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
var TOKENS = [
|
|
165
|
+
"{{first_name}}",
|
|
166
|
+
"{{order_number}}",
|
|
167
|
+
"{{store_name}}"
|
|
168
|
+
];
|
|
169
|
+
/** Tokens that go in at the caret: keepFocus leaves the pointer's focus, and the caret, in the field. */
|
|
170
|
+
function TokenInsert() {
|
|
171
|
+
const field = useRef(null);
|
|
172
|
+
const [message, setMessage] = useState("Hello , thanks for your order.");
|
|
173
|
+
const insert = (token) => {
|
|
174
|
+
const box = field.current;
|
|
175
|
+
const start = box?.selectionStart ?? message.length;
|
|
176
|
+
const end = box?.selectionEnd ?? message.length;
|
|
177
|
+
const next = message.slice(0, start) + token + message.slice(end);
|
|
178
|
+
setMessage(next);
|
|
179
|
+
requestAnimationFrame(() => {
|
|
180
|
+
box?.setSelectionRange(start + token.length, start + token.length);
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: "chip-compose",
|
|
185
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
186
|
+
label: "Auto reply",
|
|
187
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
188
|
+
ref: field,
|
|
189
|
+
rows: 3,
|
|
190
|
+
value: message,
|
|
191
|
+
onChange: (event) => setMessage(event.target.value)
|
|
192
|
+
})
|
|
193
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
194
|
+
className: "chip-row",
|
|
195
|
+
role: "group",
|
|
196
|
+
"aria-label": "Insert a detail",
|
|
197
|
+
children: TOKENS.map((token) => /* @__PURE__ */ jsx(Chip, {
|
|
198
|
+
size: "sm",
|
|
199
|
+
icon: /* @__PURE__ */ jsx(BracketsCurlyIcon, {}),
|
|
200
|
+
keepFocus: true,
|
|
201
|
+
onAction: () => insert(token),
|
|
202
|
+
children: token
|
|
203
|
+
}, token))
|
|
204
|
+
})]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/** Glass chips over a drawn photo, and over the assistant's bar. */
|
|
208
|
+
function GlassOverMedia() {
|
|
209
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "chip-photo",
|
|
211
|
+
role: "img",
|
|
212
|
+
"aria-label": "An oak sideboard in a living room, with three suggestions over it",
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx("span", {
|
|
215
|
+
className: "chip-photo__floor",
|
|
216
|
+
"aria-hidden": "true"
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: "chip-photo__piece",
|
|
220
|
+
"aria-hidden": "true"
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: "chip-photo__chips",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
226
|
+
variant: "glass",
|
|
227
|
+
icon: /* @__PURE__ */ jsx(SparkleIcon, {}),
|
|
228
|
+
onAction: () => {},
|
|
229
|
+
children: "Write a product description"
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
232
|
+
variant: "glass",
|
|
233
|
+
onAction: () => {},
|
|
234
|
+
children: "Remove the background"
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
237
|
+
variant: "glass",
|
|
238
|
+
size: "sm",
|
|
239
|
+
children: "Oak"
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function Matrix() {
|
|
247
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
248
|
+
className: "chip-matrix",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsxs("div", {
|
|
251
|
+
className: "chip-row",
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx(Chip, { children: "Static" }),
|
|
254
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
255
|
+
selected: false,
|
|
256
|
+
onSelectedChange: () => {},
|
|
257
|
+
children: "Toggle off"
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
260
|
+
selected: true,
|
|
261
|
+
onSelectedChange: () => {},
|
|
262
|
+
children: "Toggle on"
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
265
|
+
onRemove: () => {},
|
|
266
|
+
children: "Removable"
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
269
|
+
color: "#0b6e4f",
|
|
270
|
+
children: "Colour"
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
273
|
+
selected: false,
|
|
274
|
+
onSelectedChange: () => {},
|
|
275
|
+
disabled: true,
|
|
276
|
+
children: "Disabled"
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ jsxs("div", {
|
|
281
|
+
className: "chip-row",
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
284
|
+
selected: true,
|
|
285
|
+
onRemove: () => {},
|
|
286
|
+
removeLabel: "Clear Applied filter",
|
|
287
|
+
children: "Applied filter"
|
|
288
|
+
}),
|
|
289
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
290
|
+
icon: /* @__PURE__ */ jsx(TagIcon, {}),
|
|
291
|
+
children: "With icon"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
294
|
+
count: 128,
|
|
295
|
+
children: "With count"
|
|
296
|
+
}),
|
|
297
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
298
|
+
selected: true,
|
|
299
|
+
onSelectedChange: () => {},
|
|
300
|
+
count: 128,
|
|
301
|
+
children: "Chosen with count"
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
304
|
+
onRemove: () => {},
|
|
305
|
+
disabled: true,
|
|
306
|
+
children: "Disabled removable"
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
309
|
+
disabled: true,
|
|
310
|
+
children: "Disabled static"
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ jsxs("div", {
|
|
315
|
+
className: "chip-row",
|
|
316
|
+
children: [
|
|
317
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
318
|
+
size: "sm",
|
|
319
|
+
children: "Static"
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
322
|
+
size: "sm",
|
|
323
|
+
selected: false,
|
|
324
|
+
onSelectedChange: () => {},
|
|
325
|
+
children: "Toggle off"
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
328
|
+
size: "sm",
|
|
329
|
+
selected: true,
|
|
330
|
+
onSelectedChange: () => {},
|
|
331
|
+
children: "Toggle on"
|
|
332
|
+
}),
|
|
333
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
334
|
+
size: "sm",
|
|
335
|
+
onRemove: () => {},
|
|
336
|
+
children: "Removable"
|
|
337
|
+
}),
|
|
338
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
339
|
+
size: "sm",
|
|
340
|
+
color: "#0b6e4f",
|
|
341
|
+
children: "Colour"
|
|
342
|
+
})
|
|
343
|
+
]
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
var code = (value) => /* @__PURE__ */ jsx("code", { children: value });
|
|
349
|
+
function Page() {
|
|
350
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
351
|
+
title: "Chip",
|
|
352
|
+
status: "new",
|
|
353
|
+
importNames: ["Chip"],
|
|
354
|
+
lead: "A pebble pill for a value the merchant picks or removes: a tag, a quick-pick filter, a selected value. A badge says what state something is in; a chip is the one you press or take away.",
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
357
|
+
id: "toggle",
|
|
358
|
+
title: "Quick picks and filters",
|
|
359
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
360
|
+
"Give a chip ",
|
|
361
|
+
/* @__PURE__ */ jsx("code", { children: "selected" }),
|
|
362
|
+
" and ",
|
|
363
|
+
/* @__PURE__ */ jsx("code", { children: "onSelectedChange" }),
|
|
364
|
+
" and it is a toggle: a button with",
|
|
365
|
+
" ",
|
|
366
|
+
/* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
|
|
367
|
+
". A chosen chip rides a white thumb inside a teal ring, because teal marks what is chosen, and is never a filled teal pill. Wrap a row of them in ",
|
|
368
|
+
/* @__PURE__ */ jsx("code", { children: "role=\"group\"" }),
|
|
369
|
+
" with a name, so assistive tech announces the set. Whether one pick or many can be on is up to the page."
|
|
370
|
+
] }),
|
|
371
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
372
|
+
align: "start",
|
|
373
|
+
code: `
|
|
374
|
+
const [picked, setPicked] = useState('all')
|
|
375
|
+
|
|
376
|
+
<div role="group" aria-label="Industry">
|
|
377
|
+
{industries.map((industry) => (
|
|
378
|
+
<Chip
|
|
379
|
+
key={industry.id}
|
|
380
|
+
selected={picked === industry.id}
|
|
381
|
+
onSelectedChange={(on) => setPicked(on ? industry.id : 'all')}
|
|
382
|
+
count={industry.count}
|
|
383
|
+
>
|
|
384
|
+
{industry.label}
|
|
385
|
+
</Chip>
|
|
386
|
+
))}
|
|
387
|
+
</div>`,
|
|
388
|
+
children: /* @__PURE__ */ jsx(QuickPicks, {})
|
|
389
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
390
|
+
title: "Any number at once",
|
|
391
|
+
description: /* @__PURE__ */ jsx("p", { children: "The same chip, with the page keeping a list. Pressing a chosen chip turns it off." }),
|
|
392
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
393
|
+
align: "start",
|
|
394
|
+
code: `
|
|
395
|
+
const [picked, setPicked] = useState(['furniture'])
|
|
396
|
+
|
|
397
|
+
<Chip
|
|
398
|
+
selected={picked.includes(id)}
|
|
399
|
+
onSelectedChange={(on) => setPicked((now) => (on ? [...now, id] : now.filter((x) => x !== id)))}
|
|
400
|
+
>
|
|
401
|
+
{label}
|
|
402
|
+
</Chip>`,
|
|
403
|
+
children: /* @__PURE__ */ jsx(MultiPick, {})
|
|
404
|
+
})
|
|
405
|
+
})]
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
408
|
+
id: "removable",
|
|
409
|
+
title: "Tags and selected values",
|
|
410
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
411
|
+
"Give a chip ",
|
|
412
|
+
/* @__PURE__ */ jsx("code", { children: "onRemove" }),
|
|
413
|
+
" and it ends in a round button that takes it away. The button is named for the label (\"Remove VIP\"); in another language pass the whole phrase as ",
|
|
414
|
+
/* @__PURE__ */ jsx("code", { children: "removeLabel" }),
|
|
415
|
+
". Tab to the button and press Enter or Space: focus moves to the next chip, and after the last one to the next control past the row. Use the small size for tags in a dense row."
|
|
416
|
+
] }),
|
|
417
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
418
|
+
align: "start",
|
|
419
|
+
code: `
|
|
420
|
+
<Chip size="sm" onRemove={() => untag('VIP')}>VIP</Chip>
|
|
421
|
+
<Chip size="sm" onRemove={() => untag('Trade')} removeLabel="Remove the Trade tag">Trade</Chip>`,
|
|
422
|
+
children: /* @__PURE__ */ jsx(Tags, {})
|
|
423
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
424
|
+
title: "An applied filter",
|
|
425
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
426
|
+
"A filter that is on, with a way to clear it: ",
|
|
427
|
+
/* @__PURE__ */ jsx("code", { children: "selected" }),
|
|
428
|
+
" and ",
|
|
429
|
+
/* @__PURE__ */ jsx("code", { children: "onRemove" }),
|
|
430
|
+
" together. It draws the chosen look and is not a toggle. Name the button for the whole filter, as \"Clear Brand: Northlight\"."
|
|
431
|
+
] }),
|
|
432
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
433
|
+
align: "start",
|
|
434
|
+
code: `
|
|
435
|
+
<Chip selected onRemove={() => clear('brand')} removeLabel="Clear Brand: Northlight">
|
|
436
|
+
Brand: Northlight
|
|
437
|
+
</Chip>`,
|
|
438
|
+
children: /* @__PURE__ */ jsx(Applied, {})
|
|
439
|
+
})
|
|
440
|
+
})]
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
443
|
+
id: "action",
|
|
444
|
+
title: "Action",
|
|
445
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "onAction" }), " makes the chip a plain button that runs something: a suggested prompt that fills a field, a detail that goes into a message. It is pressed as a toggle is and is never chosen. Use it for a few ready-made moves next to the field they act on, not for a page's main actions (those are buttons)."] }),
|
|
446
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
447
|
+
align: "fill",
|
|
448
|
+
code: `
|
|
449
|
+
const [prompt, setPrompt] = useState('')
|
|
450
|
+
|
|
451
|
+
<Field label="What should change?">
|
|
452
|
+
<Textarea value={prompt} onChange={(event) => setPrompt(event.target.value)} />
|
|
453
|
+
</Field>
|
|
454
|
+
<div role="group" aria-label="Suggested prompts">
|
|
455
|
+
{prompts.map((suggestion) => (
|
|
456
|
+
<Chip size="sm" icon={<SparkleIcon />} onAction={() => setPrompt(suggestion)}>
|
|
457
|
+
{suggestion}
|
|
458
|
+
</Chip>
|
|
459
|
+
))}
|
|
460
|
+
</div>`,
|
|
461
|
+
children: /* @__PURE__ */ jsx(PromptSuggestions, {})
|
|
462
|
+
}), /* @__PURE__ */ jsx(Example, {
|
|
463
|
+
align: "fill",
|
|
464
|
+
caption: "keepFocus: a press with the pointer leaves focus, and the caret, in the field, so the token goes in where the person was typing. From the keyboard, Tab reaches the chips as it reaches any button, and the field remembers its caret.",
|
|
465
|
+
code: `
|
|
466
|
+
<Textarea ref={field} value={message} onChange={...} />
|
|
467
|
+
{tokens.map((token) => (
|
|
468
|
+
<Chip size="sm" icon={<BracketsCurlyIcon />} keepFocus onAction={() => insertAtCaret(token)}>
|
|
469
|
+
{token}
|
|
470
|
+
</Chip>
|
|
471
|
+
))}`,
|
|
472
|
+
children: /* @__PURE__ */ jsx(TokenInsert, {})
|
|
473
|
+
})]
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
476
|
+
id: "static",
|
|
477
|
+
title: "Static, with an icon or a count",
|
|
478
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
479
|
+
"With neither ",
|
|
480
|
+
/* @__PURE__ */ jsx("code", { children: "selected" }),
|
|
481
|
+
" nor ",
|
|
482
|
+
/* @__PURE__ */ jsx("code", { children: "onRemove" }),
|
|
483
|
+
" a chip is a plain pebble. An ",
|
|
484
|
+
/* @__PURE__ */ jsx("code", { children: "icon" }),
|
|
485
|
+
" leads the label and a ",
|
|
486
|
+
/* @__PURE__ */ jsx("code", { children: "count" }),
|
|
487
|
+
" follows it, in a quiet tabular figure. If it is only a label with nothing to do, use a",
|
|
488
|
+
" ",
|
|
489
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
490
|
+
to: "/components/badge",
|
|
491
|
+
children: "Badge"
|
|
492
|
+
}),
|
|
493
|
+
": at ",
|
|
494
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
495
|
+
" a chip is the height of one."
|
|
496
|
+
] }),
|
|
497
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
498
|
+
align: "start",
|
|
499
|
+
code: `
|
|
500
|
+
<Chip icon={<ArmchairIcon />}>Furniture</Chip>
|
|
501
|
+
<Chip icon={<LightbulbIcon />} count={46}>Lighting</Chip>
|
|
502
|
+
<Chip size="sm" icon={<TagIcon />}>Gift</Chip>`,
|
|
503
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
504
|
+
className: "chip-row",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
507
|
+
icon: /* @__PURE__ */ jsx(ArmchairIcon, {}),
|
|
508
|
+
children: "Furniture"
|
|
509
|
+
}),
|
|
510
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
511
|
+
icon: /* @__PURE__ */ jsx(LightbulbIcon, {}),
|
|
512
|
+
count: 46,
|
|
513
|
+
children: "Lighting"
|
|
514
|
+
}),
|
|
515
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
516
|
+
size: "sm",
|
|
517
|
+
icon: /* @__PURE__ */ jsx(TagIcon, {}),
|
|
518
|
+
children: "Gift"
|
|
519
|
+
})
|
|
520
|
+
]
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
}),
|
|
524
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
525
|
+
id: "colour",
|
|
526
|
+
title: "A colour the user chose",
|
|
527
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "color" }), " takes any CSS colour, as tags do when a merchant picks their colour. The pill is tinted with it and the words take it leaned towards ink, so they read in both themes, a pale colour such as amber or sky too."] }),
|
|
528
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
529
|
+
align: "start",
|
|
530
|
+
code: `
|
|
531
|
+
<Chip size="sm" color="#b4440c">Urgent</Chip>
|
|
532
|
+
<Chip size="sm" color="#0b6e4f">Wholesale</Chip>
|
|
533
|
+
<Chip size="sm" color="#1d4ed8">Gift</Chip>
|
|
534
|
+
<Chip size="sm" color="#f59e0b">Pre-order</Chip>
|
|
535
|
+
<Chip size="sm" color="#7c3aed" onRemove={() => {}}>Press</Chip>`,
|
|
536
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
537
|
+
className: "chip-row",
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
540
|
+
size: "sm",
|
|
541
|
+
color: "#b4440c",
|
|
542
|
+
children: "Urgent"
|
|
543
|
+
}),
|
|
544
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
545
|
+
size: "sm",
|
|
546
|
+
color: "#0b6e4f",
|
|
547
|
+
children: "Wholesale"
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
550
|
+
size: "sm",
|
|
551
|
+
color: "#1d4ed8",
|
|
552
|
+
children: "Gift"
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
555
|
+
size: "sm",
|
|
556
|
+
color: "#f59e0b",
|
|
557
|
+
children: "Pre-order"
|
|
558
|
+
}),
|
|
559
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
560
|
+
size: "sm",
|
|
561
|
+
color: "#7c3aed",
|
|
562
|
+
onRemove: () => {},
|
|
563
|
+
children: "Press"
|
|
564
|
+
})
|
|
565
|
+
]
|
|
566
|
+
})
|
|
567
|
+
})
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
570
|
+
id: "glass",
|
|
571
|
+
title: "Glass",
|
|
572
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "variant=\"glass\"" }), " is for chips that sit over something else: a photo, a live preview, the assistant's bar. It is the canvas a fifth clear, frosted and lifted by the raised shadow, so the chip holds its own over any picture. Where the browser cannot frost, it is the plain canvas. Every kind of chip takes it."] }),
|
|
573
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
574
|
+
align: "fill",
|
|
575
|
+
code: `
|
|
576
|
+
<div className="photo">
|
|
577
|
+
<Chip variant="glass" icon={<SparkleIcon />} onAction={write}>Write a product description</Chip>
|
|
578
|
+
<Chip variant="glass" onAction={cutOut}>Remove the background</Chip>
|
|
579
|
+
<Chip variant="glass" size="sm">Oak</Chip>
|
|
580
|
+
</div>`,
|
|
581
|
+
children: /* @__PURE__ */ jsx(GlassOverMedia, {})
|
|
582
|
+
})
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
585
|
+
id: "sizes",
|
|
586
|
+
title: "Sizes",
|
|
587
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
588
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
589
|
+
" (default) is 30px with 13px text, the height of the filter pills and small buttons it sits with: quick picks and filters. ",
|
|
590
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
591
|
+
" is 22px with 12px text, the height of a badge: tags in dense rows and tables."
|
|
592
|
+
] }),
|
|
593
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
594
|
+
align: "start",
|
|
595
|
+
code: `
|
|
596
|
+
<Chip selected onSelectedChange={() => {}}>Medium</Chip>
|
|
597
|
+
<Chip size="sm" selected onSelectedChange={() => {}}>Small</Chip>`,
|
|
598
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
599
|
+
className: "chip-row",
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
602
|
+
selected: true,
|
|
603
|
+
onSelectedChange: () => {},
|
|
604
|
+
children: "Medium"
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
607
|
+
size: "sm",
|
|
608
|
+
selected: true,
|
|
609
|
+
onSelectedChange: () => {},
|
|
610
|
+
children: "Small"
|
|
611
|
+
}),
|
|
612
|
+
/* @__PURE__ */ jsx(Badge, { children: "A badge, for comparison" })
|
|
613
|
+
]
|
|
614
|
+
})
|
|
615
|
+
})
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
618
|
+
id: "both-themes",
|
|
619
|
+
title: "In both themes",
|
|
620
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every kind of chip at both sizes, then an applied filter, an icon, a count and the disabled kinds, light and dark side by side. In dark the pebble deepens and the chosen thumb sits inside a lighter teal ring." }),
|
|
621
|
+
children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsx(Matrix, {}) })
|
|
622
|
+
}),
|
|
623
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
624
|
+
id: "guidelines",
|
|
625
|
+
title: "Guidelines",
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
628
|
+
do: {
|
|
629
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
630
|
+
className: "chip-row",
|
|
631
|
+
children: [/* @__PURE__ */ jsx(Chip, {
|
|
632
|
+
selected: true,
|
|
633
|
+
onSelectedChange: () => {},
|
|
634
|
+
children: "Furniture"
|
|
635
|
+
}), /* @__PURE__ */ jsx(Chip, {
|
|
636
|
+
selected: false,
|
|
637
|
+
onSelectedChange: () => {},
|
|
638
|
+
children: "Lighting"
|
|
639
|
+
})]
|
|
640
|
+
}),
|
|
641
|
+
caption: "Chosen is a white thumb in a teal ring. Teal marks what is chosen."
|
|
642
|
+
},
|
|
643
|
+
dont: {
|
|
644
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
645
|
+
className: "chip-row",
|
|
646
|
+
children: [/* @__PURE__ */ jsx(Badge, {
|
|
647
|
+
tone: "accent",
|
|
648
|
+
variant: "solid",
|
|
649
|
+
children: "Furniture"
|
|
650
|
+
}), /* @__PURE__ */ jsx(Badge, { children: "Lighting" })]
|
|
651
|
+
}),
|
|
652
|
+
caption: "A badge is not a control. It cannot be pressed, and a filled teal pill reads as a button."
|
|
653
|
+
}
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
656
|
+
columns: ["Reach for", "When"],
|
|
657
|
+
rows: [
|
|
658
|
+
[code("Chip"), "A value the merchant picks or removes: a tag, a quick-pick filter, a selected value."],
|
|
659
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
660
|
+
to: "/components/badge",
|
|
661
|
+
children: "Badge"
|
|
662
|
+
}), "A state or a count to read. Nothing to press."],
|
|
663
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
664
|
+
to: "/components/status-badge",
|
|
665
|
+
children: "Status badge"
|
|
666
|
+
}), "A status from the registry: Paid, Void, Failed."],
|
|
667
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
668
|
+
to: "/components/segmented-control",
|
|
669
|
+
children: "Segmented control"
|
|
670
|
+
}), "One of a few views of the same thing, always one on, in a joined bar."],
|
|
671
|
+
[/* @__PURE__ */ jsx(DocLink, {
|
|
672
|
+
to: "/components/tabs",
|
|
673
|
+
children: "Tabs"
|
|
674
|
+
}), "Switching a page between sections."]
|
|
675
|
+
]
|
|
676
|
+
}),
|
|
677
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
678
|
+
"Sentence case and short: \"Furniture\", \"Brand: Northlight\". Never all caps.",
|
|
679
|
+
"A group of toggle chips is one question. Name the group, and let \"All\" clear the rest when one pick is on at a time.",
|
|
680
|
+
"Removing a chip changes the data: do it at once and say so on the page, or confirm if it cannot be undone.",
|
|
681
|
+
"Chips wrap onto the next line with a gap of 6px. Do not scroll a row of chips sideways."
|
|
682
|
+
] })
|
|
683
|
+
]
|
|
684
|
+
}),
|
|
685
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
686
|
+
id: "accessibility",
|
|
687
|
+
title: "Accessibility",
|
|
688
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
689
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
690
|
+
"A toggle chip is a ",
|
|
691
|
+
/* @__PURE__ */ jsx("code", { children: "button" }),
|
|
692
|
+
" with ",
|
|
693
|
+
/* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
|
|
694
|
+
", so it is a tab stop that Enter and Space press, and assistive tech announces it as a toggle button, pressed or not."
|
|
695
|
+
] }),
|
|
696
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
697
|
+
"Name a row of toggles with ",
|
|
698
|
+
/* @__PURE__ */ jsx("code", { children: "role=\"group\"" }),
|
|
699
|
+
" and ",
|
|
700
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
701
|
+
" (or ",
|
|
702
|
+
/* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
|
|
703
|
+
"). A count is read after the label: \"Furniture 128\"."
|
|
704
|
+
] }),
|
|
705
|
+
"A removable chip is not itself focusable. Its remove button is, and is named by removeLabel, by default \"Remove\" and the label.",
|
|
706
|
+
"Removing a chip from the keyboard hands focus to the next chip's button, or the one before; when the last chip goes, to the next control past the row (or the one before it), never back to the top of the page.",
|
|
707
|
+
"A disabled toggle is a disabled button; a disabled removable chip disables its remove button.",
|
|
708
|
+
"The icon is decorative. The label carries the meaning, and a chosen chip does not rely on colour alone: it is also heavier and ringed."
|
|
709
|
+
] })
|
|
710
|
+
}),
|
|
711
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
712
|
+
id: "differences",
|
|
713
|
+
title: "Where it differs from the vendor dashboard",
|
|
714
|
+
description: /* @__PURE__ */ jsx("p", { children: "The pebble, the chosen thumb and the removable chip are the vendor dashboard's. These are the places the kit chooses differently, or where the numbers do not sit on the kit's scales." }),
|
|
715
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
716
|
+
columns: [
|
|
717
|
+
"Where",
|
|
718
|
+
"Vendor dashboard",
|
|
719
|
+
"Kit"
|
|
720
|
+
],
|
|
721
|
+
rows: [
|
|
722
|
+
[
|
|
723
|
+
"Heights",
|
|
724
|
+
"Quick-pick and filter chips are 28px, and a tag in a dense row 22px.",
|
|
725
|
+
"30px and 22px. The 30px chip is on the kit's control scale (--o-control-sm), the height of the filter pill and the small buttons it sits beside in a filter bar. The 22px chip is exactly a Badge, so the two sit in a row together."
|
|
726
|
+
],
|
|
727
|
+
[
|
|
728
|
+
"A hovered chosen chip",
|
|
729
|
+
"Repaints pebble: its hover rule out-ranks its chosen rule, so a chosen chip loses its white thumb under the pointer.",
|
|
730
|
+
"Stays white with its teal ring. A chosen chip is chosen whether or not the pointer is over it."
|
|
731
|
+
],
|
|
732
|
+
[
|
|
733
|
+
"A removable chip",
|
|
734
|
+
"The campaign filter chip is 30px with 6px at the end.",
|
|
735
|
+
"A 30px chip with 5px at the end, so its 20px remove button is centred on the end of the pill."
|
|
736
|
+
],
|
|
737
|
+
[
|
|
738
|
+
"A disabled chip",
|
|
739
|
+
"Fades.",
|
|
740
|
+
"Fades, and never calls your onClick, onSelectedChange or onRemove, whichever kind it is."
|
|
741
|
+
]
|
|
742
|
+
]
|
|
743
|
+
})
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
746
|
+
id: "props",
|
|
747
|
+
title: "Props",
|
|
748
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native attribute of the element it renders." }),
|
|
749
|
+
children: [/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
750
|
+
{
|
|
751
|
+
name: "children",
|
|
752
|
+
type: "ReactNode",
|
|
753
|
+
required: true,
|
|
754
|
+
description: "The label."
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
name: "size",
|
|
758
|
+
type: "'sm' | 'md'",
|
|
759
|
+
default: "'md'",
|
|
760
|
+
description: "30px for quick picks and filters, 22px for tags in dense rows."
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: "variant",
|
|
764
|
+
type: "'pebble' | 'glass'",
|
|
765
|
+
default: "'pebble'",
|
|
766
|
+
description: "The muted fill, or frosted canvas for a chip over a photo, a preview or the assistant."
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
name: "icon",
|
|
770
|
+
type: "ReactNode",
|
|
771
|
+
description: "Leading icon, 14px (12px at sm). Decorative."
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: "count",
|
|
775
|
+
type: "ReactNode",
|
|
776
|
+
description: "A figure after the label. Quiet until the chip is chosen."
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "color",
|
|
780
|
+
type: "string",
|
|
781
|
+
description: "A colour the user chose: any CSS colour. Tints the pill and colours the words, leaned towards ink."
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
name: "selected",
|
|
785
|
+
type: "boolean",
|
|
786
|
+
description: "Makes the chip a toggle and sets whether it is chosen. With onRemove it only draws the chosen look."
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
name: "defaultSelected",
|
|
790
|
+
type: "boolean",
|
|
791
|
+
description: "Starts a toggle chip chosen, when it keeps its own state."
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
name: "onSelectedChange",
|
|
795
|
+
type: "(selected: boolean) => void",
|
|
796
|
+
description: "Called with the new state when a toggle chip is pressed. Makes the chip a toggle."
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
name: "onAction",
|
|
800
|
+
type: "() => void",
|
|
801
|
+
description: "Makes the chip a plain button that runs this: a suggested prompt, a token to insert. Wins over the toggle props."
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: "keepFocus",
|
|
805
|
+
type: "boolean",
|
|
806
|
+
default: "false",
|
|
807
|
+
description: "For an action that writes into a field: a pointer press leaves focus, and the caret, where it was."
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
name: "onRemove",
|
|
811
|
+
type: "() => void",
|
|
812
|
+
description: "Makes the chip removable: a round button at its end calls this. A removable chip is not also a toggle."
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "removeLabel",
|
|
816
|
+
type: "string",
|
|
817
|
+
default: "'Remove ' + label",
|
|
818
|
+
description: "The remove button's accessible name. Pass the whole phrase in another language."
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
name: "disabled",
|
|
822
|
+
type: "boolean",
|
|
823
|
+
default: "false",
|
|
824
|
+
description: "Stops the chip being pressed or removed, and fades it."
|
|
825
|
+
}
|
|
826
|
+
] }), /* @__PURE__ */ jsxs(Note, {
|
|
827
|
+
title: "Dragging",
|
|
828
|
+
children: [
|
|
829
|
+
"A chip that drags, such as a product option value, takes its drag handle and listeners from the page's own drag library: the kit has none. Pass the library's ref and attributes to the chip, and put the grip in the ",
|
|
830
|
+
/* @__PURE__ */ jsx("code", { children: "icon" }),
|
|
831
|
+
" slot or the children."
|
|
832
|
+
]
|
|
833
|
+
})]
|
|
834
|
+
})
|
|
835
|
+
]
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
//#endregion
|
|
839
|
+
export { Page, Preview };
|