@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.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.
Files changed (62) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +8260 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-CNbBbErC.js +129 -0
  7. package/dist/pages/_figures-data-BDmScEny.js +606 -0
  8. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  9. package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
  10. package/dist/pages/alert-BD4e6QTh.js +769 -0
  11. package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
  12. package/dist/pages/area-chart-B91dLcGo.js +562 -0
  13. package/dist/pages/avatar-DPPHXJAu.js +713 -0
  14. package/dist/pages/badge-C9JR0thI.js +729 -0
  15. package/dist/pages/button-D3V912P4.js +518 -0
  16. package/dist/pages/calendar-DSDZ9nRH.js +630 -0
  17. package/dist/pages/card-DUggbis3.js +659 -0
  18. package/dist/pages/checkbox-DwimQaK3.js +365 -0
  19. package/dist/pages/colour-BwuO8xAv.js +1498 -0
  20. package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
  21. package/dist/pages/date-picker-BYSa816m.js +1421 -0
  22. package/dist/pages/delta-CtAo0eIM.js +574 -0
  23. package/dist/pages/dialog-BRAf4LMh.js +1451 -0
  24. package/dist/pages/docs-BNOb7AqR.js +515 -0
  25. package/dist/pages/empty-state-C-mLrXW2.js +417 -0
  26. package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
  27. package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
  28. package/dist/pages/host-B6znjEgQ.js +109 -0
  29. package/dist/pages/icon-button-C9eSVPPW.js +861 -0
  30. package/dist/pages/icons-sxkTs5Ob.js +473 -0
  31. package/dist/pages/input-KF9Gkawf.js +1093 -0
  32. package/dist/pages/installation-DpsX8G_n.js +445 -0
  33. package/dist/pages/kbd-cNfDoikz.js +544 -0
  34. package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
  35. package/dist/pages/logo-BfGF1Pq9.js +571 -0
  36. package/dist/pages/menu-by2sgQ09.js +1618 -0
  37. package/dist/pages/motion-BvTGc2Dk.js +855 -0
  38. package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
  39. package/dist/pages/overview-BPEbZQ6g.js +130 -0
  40. package/dist/pages/pagination-BBUnGvv5.js +249 -0
  41. package/dist/pages/popover-Db1gLDpb.js +1136 -0
  42. package/dist/pages/principles-CeAIOIdt.js +483 -0
  43. package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
  44. package/dist/pages/registry-CroHzK9I.js +244 -0
  45. package/dist/pages/release-Dvo684UJ.js +13 -0
  46. package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
  47. package/dist/pages/search-field-BN7MWGQ4.js +693 -0
  48. package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
  49. package/dist/pages/select-DguELoRR.js +1429 -0
  50. package/dist/pages/separator-CPZub9pv.js +351 -0
  51. package/dist/pages/shape-DKvA0YKr.js +627 -0
  52. package/dist/pages/skeleton-DLuBhP46.js +561 -0
  53. package/dist/pages/sparkline-DMMYGbHn.js +668 -0
  54. package/dist/pages/switch-B-Qe4kcT.js +517 -0
  55. package/dist/pages/table-AMoODng4.js +607 -0
  56. package/dist/pages/tabs-B4M-usCV.js +1455 -0
  57. package/dist/pages/textarea-fTuUZRQb.js +693 -0
  58. package/dist/pages/toast-CKP03zjy.js +1176 -0
  59. package/dist/pages/tooltip-CBYil3kt.js +697 -0
  60. package/dist/pages/typography-PCbg8Bhg.js +735 -0
  61. package/manifest.json +3125 -0
  62. package/package.json +35 -4
@@ -0,0 +1,249 @@
1
+ "use client";
2
+ import { a as DocTable, d as Section, i as DocPage, m as ThemePair, o as Example, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
3
+ import { t as Playground } from "./Playground-CNbBbErC.js";
4
+ import { useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Pagination, paginationItems } from "@orbitcommerce/constellation";
7
+ //#region src/pages/components/pagination.tsx
8
+ function Preview() {
9
+ return /* @__PURE__ */ jsx(Pagination, {
10
+ page: 3,
11
+ pageCount: 25,
12
+ onPageChange: () => {}
13
+ });
14
+ }
15
+ function Live({ pageCount = 25, summary = true }) {
16
+ const [page, setPage] = useState(1);
17
+ const start = (page - 1) * 50 + 1;
18
+ const end = Math.min(page * 50, 1241);
19
+ return /* @__PURE__ */ jsx(Pagination, {
20
+ page,
21
+ pageCount,
22
+ onPageChange: setPage,
23
+ summary: summary ? `${start}–${end} of 1,241 orders` : void 0,
24
+ style: { width: "100%" }
25
+ });
26
+ }
27
+ var PLAYGROUND = [
28
+ {
29
+ prop: "page",
30
+ type: "select",
31
+ options: [
32
+ "1",
33
+ "2",
34
+ "5",
35
+ "12",
36
+ "25"
37
+ ],
38
+ default: "5",
39
+ toAttr: (v) => `page={${v}}`
40
+ },
41
+ {
42
+ prop: "pageCount",
43
+ type: "select",
44
+ options: [
45
+ "3",
46
+ "7",
47
+ "25",
48
+ "120"
49
+ ],
50
+ default: "25",
51
+ toAttr: (v) => `pageCount={${v}}`
52
+ },
53
+ {
54
+ prop: "siblings",
55
+ type: "select",
56
+ options: [
57
+ "0",
58
+ "1",
59
+ "2"
60
+ ],
61
+ default: "1",
62
+ toAttr: (v) => v === "1" ? null : `siblings={${v}}`
63
+ },
64
+ {
65
+ prop: "disabled",
66
+ type: "boolean",
67
+ default: false
68
+ }
69
+ ];
70
+ function Page() {
71
+ return /* @__PURE__ */ jsxs(DocPage, {
72
+ title: "Pagination",
73
+ status: "new",
74
+ importNames: ["Pagination"],
75
+ lead: "Pages of a long list: a summary of where you are on the left, round page buttons on the right, the current page in ink. On phones the numbers fold into 3 / 25 between the arrows.",
76
+ children: [
77
+ /* @__PURE__ */ jsx(Section, {
78
+ id: "playground",
79
+ title: "Playground",
80
+ children: /* @__PURE__ */ jsx(Playground, {
81
+ component: "Pagination",
82
+ controls: PLAYGROUND,
83
+ minHeight: 160,
84
+ extraCode: () => ["onPageChange={setPage}"],
85
+ render: (v) => /* @__PURE__ */ jsx(Pagination, {
86
+ page: Number(v.page),
87
+ pageCount: Number(v.pageCount),
88
+ siblings: Number(v.siblings),
89
+ disabled: Boolean(v.disabled),
90
+ onPageChange: () => {}
91
+ })
92
+ })
93
+ }),
94
+ /* @__PURE__ */ jsx(Section, {
95
+ id: "with-summary",
96
+ title: "With a summary",
97
+ description: /* @__PURE__ */ jsx("p", { children: "Say what is on screen and how much there is: \"1–50 of 1,241 orders\". Press the pages." }),
98
+ children: /* @__PURE__ */ jsx(Example, {
99
+ align: "fill",
100
+ code: `
101
+ const [page, setPage] = useState(1)
102
+
103
+ <Pagination
104
+ page={page}
105
+ pageCount={Math.ceil(total / 50)}
106
+ onPageChange={setPage}
107
+ summary={\`\${start}–\${end} of \${total.toLocaleString('en-GB')} orders\`}
108
+ />`,
109
+ children: /* @__PURE__ */ jsx(Live, {})
110
+ })
111
+ }),
112
+ /* @__PURE__ */ jsx(Section, {
113
+ id: "gaps",
114
+ title: "Which pages show",
115
+ description: /* @__PURE__ */ jsxs("p", { children: [
116
+ "The first and last page, the current page with ",
117
+ /* @__PURE__ */ jsx("code", { children: "siblings" }),
118
+ " either side, and a gap wherever pages are skipped. When the whole run fits in the room the gaps would take, every page shows."
119
+ ] }),
120
+ children: /* @__PURE__ */ jsx(DocTable, {
121
+ columns: ["Where you are", "What shows"],
122
+ rows: [
123
+ ["Page 1 of 25", paginationItems(1, 25).map((i) => typeof i === "number" ? i : "…").join(" ")],
124
+ ["Page 12 of 25", paginationItems(12, 25).map((i) => typeof i === "number" ? i : "…").join(" ")],
125
+ ["Page 25 of 25", paginationItems(25, 25).map((i) => typeof i === "number" ? i : "…").join(" ")],
126
+ ["Page 4 of 7", paginationItems(4, 7).map((i) => typeof i === "number" ? i : "…").join(" ")]
127
+ ]
128
+ })
129
+ }),
130
+ /* @__PURE__ */ jsx(Section, {
131
+ id: "loading",
132
+ title: "While a page loads",
133
+ description: /* @__PURE__ */ jsxs("p", { children: [
134
+ "Pass ",
135
+ /* @__PURE__ */ jsx("code", { children: "disabled" }),
136
+ " while the next page is on its way, so a second press cannot queue another request."
137
+ ] }),
138
+ children: /* @__PURE__ */ jsx(Example, {
139
+ code: `<Pagination page={2} pageCount={25} onPageChange={setPage} disabled={isFetching} />`,
140
+ children: /* @__PURE__ */ jsx(Pagination, {
141
+ page: 2,
142
+ pageCount: 25,
143
+ onPageChange: () => {},
144
+ disabled: true
145
+ })
146
+ })
147
+ }),
148
+ /* @__PURE__ */ jsx(Section, {
149
+ id: "both-themes",
150
+ title: "In both themes",
151
+ children: /* @__PURE__ */ jsx(ThemePair, {
152
+ align: "fill",
153
+ children: /* @__PURE__ */ jsx(Pagination, {
154
+ page: 3,
155
+ pageCount: 25,
156
+ onPageChange: () => {},
157
+ summary: "101–150 of 1,241",
158
+ style: { width: "100%" }
159
+ })
160
+ })
161
+ }),
162
+ /* @__PURE__ */ jsx(Section, {
163
+ id: "guidelines",
164
+ title: "Guidelines",
165
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
166
+ "Put it under the list it pages, inside the table frame when there is one (TableFrame footer).",
167
+ "Keep the page in the URL (?page=3), so a reload, a shared link or the back button returns to the same page.",
168
+ "Nothing to page (one page): the buttons do not render; the summary still does if you pass one."
169
+ ] })
170
+ }),
171
+ /* @__PURE__ */ jsx(Section, {
172
+ id: "accessibility",
173
+ title: "Accessibility",
174
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
175
+ "A nav named \"Pagination\" (pass label to translate it), so it is a landmark.",
176
+ "The current page carries aria-current=\"page\". Page buttons are named \"Page 3\"; pass pageLabel to translate.",
177
+ "The arrows are icon buttons with their own names (\"Previous page\", \"Next page\")."
178
+ ] })
179
+ }),
180
+ /* @__PURE__ */ jsx(Section, {
181
+ id: "props",
182
+ title: "Props",
183
+ children: /* @__PURE__ */ jsx(PropsTable, { rows: [
184
+ {
185
+ name: "page",
186
+ type: "number",
187
+ required: true,
188
+ description: "The current page, from 1."
189
+ },
190
+ {
191
+ name: "pageCount",
192
+ type: "number",
193
+ required: true,
194
+ description: "How many pages there are."
195
+ },
196
+ {
197
+ name: "onPageChange",
198
+ type: "(page: number) => void",
199
+ required: true,
200
+ description: "Called with the page to show."
201
+ },
202
+ {
203
+ name: "summary",
204
+ type: "ReactNode",
205
+ description: "Left of the pages, e.g. \"1–50 of 1,241 orders\"."
206
+ },
207
+ {
208
+ name: "siblings",
209
+ type: "number",
210
+ default: "1",
211
+ description: "Pages either side of the current one."
212
+ },
213
+ {
214
+ name: "disabled",
215
+ type: "boolean",
216
+ default: "false",
217
+ description: "Every control rests, e.g. while loading."
218
+ },
219
+ {
220
+ name: "label",
221
+ type: "string",
222
+ default: "'Pagination'",
223
+ description: "Accessible name of the navigation."
224
+ },
225
+ {
226
+ name: "previousLabel",
227
+ type: "string",
228
+ default: "'Previous page'",
229
+ description: "Name of the back arrow."
230
+ },
231
+ {
232
+ name: "nextLabel",
233
+ type: "string",
234
+ default: "'Next page'",
235
+ description: "Name of the forward arrow."
236
+ },
237
+ {
238
+ name: "pageLabel",
239
+ type: "(page: number) => string",
240
+ default: "\"Page 3\"",
241
+ description: "Name of each page button."
242
+ }
243
+ ] })
244
+ })
245
+ ]
246
+ });
247
+ }
248
+ //#endregion
249
+ export { Page, Preview };