@rexezuge/web 1.2.0 → 1.4.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 (111) hide show
  1. package/dist/AppPage.d.ts +6 -2
  2. package/dist/AppPage.d.ts.map +1 -1
  3. package/dist/AppPage.js +1 -7
  4. package/dist/AppPage.js.map +7 -1
  5. package/dist/Badge.d.ts +9 -3
  6. package/dist/Badge.d.ts.map +1 -1
  7. package/dist/Badge.js +1 -25
  8. package/dist/Badge.js.map +7 -1
  9. package/dist/Button.d.ts +6 -2
  10. package/dist/Button.d.ts.map +1 -1
  11. package/dist/Button.js +1 -39
  12. package/dist/Button.js.map +7 -1
  13. package/dist/Card.d.ts +12 -9
  14. package/dist/Card.d.ts.map +1 -1
  15. package/dist/Card.js +1 -42
  16. package/dist/Card.js.map +7 -1
  17. package/dist/ContextBar.d.ts +9 -3
  18. package/dist/ContextBar.d.ts.map +1 -1
  19. package/dist/ContextBar.js +1 -7
  20. package/dist/ContextBar.js.map +7 -1
  21. package/dist/FocusInput.d.ts +1 -2
  22. package/dist/FocusInput.d.ts.map +1 -1
  23. package/dist/FocusInput.js +1 -19
  24. package/dist/FocusInput.js.map +7 -1
  25. package/dist/Input.d.ts +9 -8
  26. package/dist/Input.d.ts.map +1 -1
  27. package/dist/Input.js +1 -49
  28. package/dist/Input.js.map +7 -1
  29. package/dist/LanguageSelector.d.ts +6 -2
  30. package/dist/LanguageSelector.d.ts.map +1 -1
  31. package/dist/LanguageSelector.js +1 -12
  32. package/dist/LanguageSelector.js.map +7 -1
  33. package/dist/LoadingButton.d.ts +19 -7
  34. package/dist/LoadingButton.d.ts.map +1 -1
  35. package/dist/LoadingButton.js +1 -30
  36. package/dist/LoadingButton.js.map +7 -1
  37. package/dist/ModalShell.d.ts +12 -4
  38. package/dist/ModalShell.d.ts.map +1 -1
  39. package/dist/ModalShell.js +1 -22
  40. package/dist/ModalShell.js.map +7 -1
  41. package/dist/NoticeBar.d.ts +7 -3
  42. package/dist/NoticeBar.d.ts.map +1 -1
  43. package/dist/NoticeBar.js +1 -12
  44. package/dist/NoticeBar.js.map +7 -1
  45. package/dist/PageHeaderCard.d.ts +6 -2
  46. package/dist/PageHeaderCard.d.ts.map +1 -1
  47. package/dist/PageHeaderCard.js +1 -7
  48. package/dist/PageHeaderCard.js.map +7 -1
  49. package/dist/PageState.d.ts +9 -3
  50. package/dist/PageState.d.ts.map +1 -1
  51. package/dist/PageState.js +1 -47
  52. package/dist/PageState.js.map +7 -1
  53. package/dist/Pagination.d.ts +36 -12
  54. package/dist/Pagination.d.ts.map +1 -1
  55. package/dist/Pagination.js +1 -75
  56. package/dist/Pagination.js.map +7 -1
  57. package/dist/ReadOnlyField.d.ts +12 -4
  58. package/dist/ReadOnlyField.d.ts.map +1 -1
  59. package/dist/ReadOnlyField.js +1 -17
  60. package/dist/ReadOnlyField.js.map +7 -1
  61. package/dist/RefreshButton.d.ts +6 -2
  62. package/dist/RefreshButton.d.ts.map +1 -1
  63. package/dist/RefreshButton.js +1 -8
  64. package/dist/RefreshButton.js.map +7 -1
  65. package/dist/Spinner.d.ts +15 -5
  66. package/dist/Spinner.d.ts.map +1 -1
  67. package/dist/Spinner.js +1 -14
  68. package/dist/Spinner.js.map +7 -1
  69. package/dist/TypeToConfirmModal.d.ts +15 -5
  70. package/dist/TypeToConfirmModal.d.ts.map +1 -1
  71. package/dist/TypeToConfirmModal.js +1 -24
  72. package/dist/TypeToConfirmModal.js.map +7 -1
  73. package/dist/Unauthorized.d.ts +6 -2
  74. package/dist/Unauthorized.d.ts.map +1 -1
  75. package/dist/Unauthorized.js +1 -11
  76. package/dist/Unauthorized.js.map +7 -1
  77. package/dist/api.d.ts +27 -9
  78. package/dist/api.d.ts.map +1 -1
  79. package/dist/api.js +1 -258
  80. package/dist/api.js.map +7 -1
  81. package/dist/constants.js +1 -49
  82. package/dist/constants.js.map +7 -1
  83. package/dist/index.d.ts +51 -51
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +1 -89
  86. package/dist/index.js.map +7 -1
  87. package/dist/theme.d.ts +24 -8
  88. package/dist/theme.d.ts.map +1 -1
  89. package/dist/theme.js +1 -134
  90. package/dist/theme.js.map +7 -1
  91. package/dist/useCopyToClipboard.d.ts +3 -1
  92. package/dist/useCopyToClipboard.d.ts.map +1 -1
  93. package/dist/useCopyToClipboard.js +1 -40
  94. package/dist/useCopyToClipboard.js.map +7 -1
  95. package/dist/useCurrentUser.d.ts +22 -8
  96. package/dist/useCurrentUser.d.ts.map +1 -1
  97. package/dist/useCurrentUser.js +1 -49
  98. package/dist/useCurrentUser.js.map +7 -1
  99. package/dist/useNotice.d.ts +21 -7
  100. package/dist/useNotice.d.ts.map +1 -1
  101. package/dist/useNotice.js +1 -34
  102. package/dist/useNotice.js.map +7 -1
  103. package/dist/useSpaLanguage.d.ts +27 -11
  104. package/dist/useSpaLanguage.d.ts.map +1 -1
  105. package/dist/useSpaLanguage.js +1 -149
  106. package/dist/useSpaLanguage.js.map +7 -1
  107. package/dist/utils.d.ts +6 -2
  108. package/dist/utils.d.ts.map +1 -1
  109. package/dist/utils.js +1 -346
  110. package/dist/utils.js.map +7 -1
  111. package/package.json +4 -4
@@ -22,9 +22,13 @@ import type { ReactElement } from 'react';
22
22
  * "Page X of Y" (AWS's other variant, and what the DAV pager renders). Both
23
23
  * render `null` for a single page.
24
24
  */
25
- /** How many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`. */
25
+ /**
26
+ How many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`.
27
+ */
26
28
  declare function pageCountFor(total: number, pageSize: number): number;
27
- /** Pins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read. */
29
+ /**
30
+ Pins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read.
31
+ */
28
32
  declare function clampPage(page: number, pageCount: number): number;
29
33
  /**
30
34
  * The 1-based page numbers to show, keeping the current page as close to the
@@ -33,27 +37,47 @@ declare function clampPage(page: number, pageCount: number): number;
33
37
  * cannot emit page numbers past the last page.
34
38
  */
35
39
  declare function pageWindow(currentPage: number, pageCount: number, windowSize?: number): number[];
36
- /** Overridable text, so an i18next app is not stuck with the English defaults. */
40
+ /**
41
+ Overridable text, so an i18next app is not stuck with the English defaults.
42
+ */
37
43
  interface PaginationLabels {
38
- /** Prev-button accessible name / label. */
44
+ /**
45
+ Prev-button accessible name / label.
46
+ */
39
47
  previous?: string;
40
- /** Next-button accessible name / label. */
48
+ /**
49
+ Next-button accessible name / label.
50
+ */
41
51
  next?: string;
42
- /** The "Page X of Y" summary in `compact` (and as the pager's `aria-label` in `full`). */
52
+ /**
53
+ The "Page X of Y" summary in `compact` (and as the pager's `aria-label` in `full`).
54
+ */
43
55
  summary?: (page: number, pageCount: number) => string;
44
56
  }
45
57
  interface PaginationProps {
46
- /** The page being displayed, 1-based. Clamped into range for rendering. */
58
+ /**
59
+ The page being displayed, 1-based. Clamped into range for rendering.
60
+ */
47
61
  page: number;
48
- /** Total pages. Omit to derive it from `total` and `pageSize`. */
62
+ /**
63
+ Total pages. Omit to derive it from `total` and `pageSize`.
64
+ */
49
65
  pageCount?: number;
50
- /** Total item count across every page. */
66
+ /**
67
+ Total item count across every page.
68
+ */
51
69
  total?: number;
52
- /** Items per page. */
70
+ /**
71
+ Items per page.
72
+ */
53
73
  pageSize?: number;
54
- /** Called with the 1-based page to move to; already clamped into range. */
74
+ /**
75
+ Called with the 1-based page to move to; already clamped into range.
76
+ */
55
77
  onChange: (page: number) => void;
56
- /** `full` shows page numbers, `compact` shows a summary. */
78
+ /**
79
+ `full` shows page numbers, `compact` shows a summary.
80
+ */
57
81
  variant?: 'full' | 'compact';
58
82
  labels?: PaginationLabels;
59
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../src/Pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C;;;;;;;;;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,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAgB,EAChB,MAAW,GACZ,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,YAAY,GAAG,IAAI,CAmDjD;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
@@ -1,75 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button } from './Button';
3
- import { cn } from './utils';
4
- /**
5
- * Pager controls.
6
- *
7
- * ## Provenance
8
- *
9
- * `components/ui/Pagination.tsx` in **AWS-AccessBridge**, with the arithmetic
10
- * (`totalPages`, `clampPage`, `pageNumbers`) that this component reached for
11
- * across `lib/pagination.ts` and `lib/presentation.ts` inlined, because a
12
- * consumer importing the pager should not have to import two more modules to
13
- * understand it. The DAV repos' `VolumeFilePager` (Durable-DAV and
14
- * Durable-DAV-Router) is the family's other pager and informs two decisions: it
15
- * gates on the rows actually being present, and it renders nothing at all when
16
- * the collection fits on one page.
17
- *
18
- * The API is normalized away from the AWS names (`currentPage`, `totalPages`,
19
- * `onPageChange`) to `page`, `pageCount`, `onChange`. `pageCount` may be
20
- * derived instead of passed: give `total` and `pageSize` and the pager does the
21
- * arithmetic, which is what the DAV pager did by hand at its call site.
22
- *
23
- * `full` shows a window of page numbers (AWS's default); `compact` shows
24
- * "Page X of Y" (AWS's other variant, and what the DAV pager renders). Both
25
- * render `null` for a single page.
26
- */
27
- /** How many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`. */
28
- function pageCountFor(total, pageSize) {
29
- if (!Number.isFinite(total) || !Number.isFinite(pageSize) || pageSize <= 0 || total <= 0) {
30
- return 1;
31
- }
32
- return Math.ceil(total / pageSize);
33
- }
34
- /** Pins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read. */
35
- function clampPage(page, pageCount) {
36
- const upper = Math.max(1, Math.trunc(Number.isFinite(pageCount) ? pageCount : 1));
37
- const wanted = Number.isFinite(page) ? Math.trunc(page) : 1;
38
- return Math.min(upper, Math.max(1, wanted));
39
- }
40
- /**
41
- * The 1-based page numbers to show, keeping the current page as close to the
42
- * middle of the window as the ends allow. The window is clamped against
43
- * `windowSize` rather than a fixed `pageCount - 2`, so a non-default window
44
- * cannot emit page numbers past the last page.
45
- */
46
- function pageWindow(currentPage, pageCount, windowSize = 5) {
47
- const count = Math.min(windowSize, pageCount);
48
- if (count <= 0) {
49
- return [];
50
- }
51
- const start = Math.max(1, Math.min(currentPage - Math.floor(windowSize / 2), pageCount - count + 1));
52
- return Array.from({ length: count }, (_, index) => start + index);
53
- }
54
- function Pagination({ page, pageCount, total, pageSize, onChange, variant = 'full', labels = {}, }) {
55
- const derivedPageCount = pageCount ?? (total !== undefined && pageSize !== undefined ? pageCountFor(total, pageSize) : 1);
56
- const pages = Math.max(1, Math.trunc(Number.isFinite(derivedPageCount) ? derivedPageCount : 1));
57
- const current = clampPage(page, pages);
58
- const previousLabel = labels.previous ?? 'Previous';
59
- const nextLabel = labels.next ?? 'Next';
60
- const summaryLabel = labels.summary ?? ((page, count) => `Page ${page} of ${count}`);
61
- // Nothing to page: a single-page list shows no pager rather than a disabled one.
62
- if (pages <= 1) {
63
- return null;
64
- }
65
- const step = (next) => {
66
- const target = clampPage(next, pages);
67
- if (target !== current) {
68
- onChange(target);
69
- }
70
- };
71
- const summary = _jsx("span", { className: "text-xs text-[var(--color-text-muted)] tabular-nums", children: summaryLabel(current, pages) });
72
- return (_jsxs("nav", { className: "flex flex-wrap items-center gap-2", "aria-label": summaryLabel(current, pages), children: [_jsx(Button, { variant: "secondary", size: "sm", disabled: current <= 1, onClick: () => step(current - 1), "aria-label": previousLabel, children: previousLabel }), variant === 'compact' ? (summary) : (_jsx("div", { className: "flex items-center gap-1", children: pageWindow(current, pages).map((pageNumber) => (_jsx(Button, { variant: "secondary", size: "sm", className: cn(pageNumber === current && 'bg-[var(--color-accent)] text-[#0d1008]'), "aria-current": pageNumber === current ? 'page' : undefined, onClick: () => step(pageNumber), children: pageNumber }, pageNumber))) })), _jsx(Button, { variant: "secondary", size: "sm", disabled: current >= pages, onClick: () => step(current + 1), "aria-label": nextLabel, children: nextLabel })] }));
73
- }
74
- export { Pagination, clampPage, pageCountFor, pageWindow };
75
- //# sourceMappingURL=Pagination.js.map
1
+ import{jsx as o,jsxs as N}from"react/jsx-runtime";import{Button as d}from"./Button.js";import{cn as P}from"./utils.js";function b(t,n){return!Number.isFinite(t)||!Number.isFinite(n)||n<=0||t<=0?1:Math.ceil(t/n)}function f(t,n){const i=Math.max(1,Math.trunc(Number.isFinite(n)?n:1)),a=Number.isFinite(t)?Math.trunc(t):1;return Math.min(i,Math.max(1,a))}function y(t,n,i=5){const a=Math.min(i,n);if(a<=0)return[];const u=Math.max(1,Math.min(t-Math.floor(i/2),n-a+1));return Array.from({length:a},(x,c)=>u+c)}function j({page:t,pageCount:n,total:i,pageSize:a,onChange:u,variant:x="full",labels:c={}}){const h=n??(i!==void 0&&a!==void 0?b(i,a):1),s=Math.max(1,Math.trunc(Number.isFinite(h)?h:1)),r=f(t,s);if(s<=1)return null;const M=c.previous??"Previous",v=c.next??"Next",p=c.summary??((e,m)=>`Page ${e} of ${m}`),l=e=>{const m=f(e,s);m!==r&&u(m)},F=o("span",{className:"text-xs text-[var(--color-text-muted)] tabular-nums",children:p(r,s)});return N("nav",{className:"flex flex-wrap items-center gap-2","aria-label":p(r,s),children:[o(d,{variant:"secondary",size:"sm",disabled:r<=1,onClick:()=>l(r-1),"aria-label":M,children:M}),x==="compact"?F:o("div",{className:"flex items-center gap-1",children:y(r,s).map(e=>o(d,{variant:"secondary",size:"sm",className:P(e===r&&"bg-[var(--color-accent)] text-[#0d1008]"),"aria-current":e===r?"page":void 0,onClick:()=>l(e),children:e},e))}),o(d,{variant:"secondary",size:"sm",disabled:r>=s,onClick:()=>l(r+1),"aria-label":v,children:v})]})}export{j as Pagination,f as clampPage,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CAAC,YAE9B,UAAU,IAPN,UAAU,CAQR,CACV,CAAC,GACE,CACP,EACD,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAE,OAAO,IAAI,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAc,SAAS,YACtH,SAAS,GACH,IACL,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { ReactElement } from 'react';\nimport { Button } from './Button';\nimport { cn } from './utils';\n\n/**\n * Pager controls.\n *\n * ## Provenance\n *\n * `components/ui/Pagination.tsx` in **AWS-AccessBridge**, with the arithmetic\n * (`totalPages`, `clampPage`, `pageNumbers`) that this component reached for\n * across `lib/pagination.ts` and `lib/presentation.ts` inlined, because a\n * consumer importing the pager should not have to import two more modules to\n * understand it. The DAV repos' `VolumeFilePager` (Durable-DAV and\n * Durable-DAV-Router) is the family's other pager and informs two decisions: it\n * gates on the rows actually being present, and it renders nothing at all when\n * the collection fits on one page.\n *\n * The API is normalized away from the AWS names (`currentPage`, `totalPages`,\n * `onPageChange`) to `page`, `pageCount`, `onChange`. `pageCount` may be\n * derived instead of passed: give `total` and `pageSize` and the pager does the\n * arithmetic, which is what the DAV pager did by hand at its call site.\n *\n * `full` shows a window of page numbers (AWS's default); `compact` shows\n * \"Page X of Y\" (AWS's other variant, and what the DAV pager renders). Both\n * render `null` for a single page.\n */\n\n/** How many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`. */\nfunction pageCountFor(total: number, pageSize: number): number {\n if (!Number.isFinite(total) || !Number.isFinite(pageSize) || pageSize <= 0 || total <= 0) {\n return 1;\n }\n return Math.ceil(total / pageSize);\n}\n\n/** Pins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read. */\nfunction clampPage(page: number, pageCount: number): number {\n const upper = Math.max(1, Math.trunc(Number.isFinite(pageCount) ? pageCount : 1));\n const wanted = Number.isFinite(page) ? Math.trunc(page) : 1;\n return Math.min(upper, Math.max(1, wanted));\n}\n\n/**\n * The 1-based page numbers to show, keeping the current page as close to the\n * middle of the window as the ends allow. The window is clamped against\n * `windowSize` rather than a fixed `pageCount - 2`, so a non-default window\n * cannot emit page numbers past the last page.\n */\nfunction pageWindow(currentPage: number, pageCount: number, windowSize = 5): number[] {\n const count = Math.min(windowSize, pageCount);\n if (count <= 0) {\n return [];\n }\n const start = Math.max(1, Math.min(currentPage - Math.floor(windowSize / 2), pageCount - count + 1));\n return Array.from({ length: count }, (_, index) => start + index);\n}\n\n/** Overridable text, so an i18next app is not stuck with the English defaults. */\ninterface PaginationLabels {\n /** Prev-button accessible name / label. */\n previous?: string;\n /** Next-button accessible name / label. */\n next?: string;\n /** The \"Page X of Y\" summary in `compact` (and as the pager's `aria-label` in `full`). */\n summary?: (page: number, pageCount: number) => string;\n}\n\ninterface PaginationProps {\n /** The page being displayed, 1-based. Clamped into range for rendering. */\n page: number;\n /** Total pages. Omit to derive it from `total` and `pageSize`. */\n pageCount?: number;\n /** Total item count across every page. */\n total?: number;\n /** Items per page. */\n pageSize?: number;\n /** Called with the 1-based page to move to; already clamped into range. */\n onChange: (page: number) => void;\n /** `full` shows page numbers, `compact` shows a summary. */\n variant?: 'full' | 'compact';\n labels?: PaginationLabels;\n}\n\nfunction Pagination({\n page,\n pageCount,\n total,\n pageSize,\n onChange,\n variant = 'full',\n labels = {},\n}: Readonly<PaginationProps>): ReactElement | null {\n const derivedPageCount = pageCount ?? (total !== undefined && pageSize !== undefined ? pageCountFor(total, pageSize) : 1);\n const pages = Math.max(1, Math.trunc(Number.isFinite(derivedPageCount) ? derivedPageCount : 1));\n const current = clampPage(page, pages);\n const previousLabel = labels.previous ?? 'Previous';\n const nextLabel = labels.next ?? 'Next';\n const summaryLabel = labels.summary ?? ((page: number, count: number) => `Page ${page} of ${count}`);\n\n // Nothing to page: a single-page list shows no pager rather than a disabled one.\n if (pages <= 1) {\n return null;\n }\n\n const step = (next: number): void => {\n const target = clampPage(next, pages);\n if (target !== current) {\n onChange(target);\n }\n };\n\n const summary = <span className=\"text-xs text-[var(--color-text-muted)] tabular-nums\">{summaryLabel(current, pages)}</span>;\n\n return (\n <nav className=\"flex flex-wrap items-center gap-2\" aria-label={summaryLabel(current, pages)}>\n <Button variant=\"secondary\" size=\"sm\" disabled={current <= 1} onClick={() => step(current - 1)} aria-label={previousLabel}>\n {previousLabel}\n </Button>\n {variant === 'compact' ? (\n summary\n ) : (\n <div className=\"flex items-center gap-1\">\n {pageWindow(current, pages).map((pageNumber) => (\n <Button\n key={pageNumber}\n variant=\"secondary\"\n size=\"sm\"\n className={cn(pageNumber === current && 'bg-[var(--color-accent)] text-[#0d1008]')}\n aria-current={pageNumber === current ? 'page' : undefined}\n onClick={() => step(pageNumber)}\n >\n {pageNumber}\n </Button>\n ))}\n </div>\n )}\n <Button variant=\"secondary\" size=\"sm\" disabled={current >= pages} onClick={() => step(current + 1)} aria-label={nextLabel}>\n {nextLabel}\n </Button>\n </nav>\n );\n}\n\nexport { Pagination, clampPage, pageCountFor, pageWindow };\nexport type { PaginationLabels, PaginationProps };\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Pagination.tsx"],
4
+ "sourcesContent": ["import type { ReactElement } from 'react';\nimport { Button } from './Button.tsx';\nimport { cn } from './utils.ts';\n\n/**\n * Pager controls.\n *\n * ## Provenance\n *\n * `components/ui/Pagination.tsx` in **AWS-AccessBridge**, with the arithmetic\n * (`totalPages`, `clampPage`, `pageNumbers`) that this component reached for\n * across `lib/pagination.ts` and `lib/presentation.ts` inlined, because a\n * consumer importing the pager should not have to import two more modules to\n * understand it. The DAV repos' `VolumeFilePager` (Durable-DAV and\n * Durable-DAV-Router) is the family's other pager and informs two decisions: it\n * gates on the rows actually being present, and it renders nothing at all when\n * the collection fits on one page.\n *\n * The API is normalized away from the AWS names (`currentPage`, `totalPages`,\n * `onPageChange`) to `page`, `pageCount`, `onChange`. `pageCount` may be\n * derived instead of passed: give `total` and `pageSize` and the pager does the\n * arithmetic, which is what the DAV pager did by hand at its call site.\n *\n * `full` shows a window of page numbers (AWS's default); `compact` shows\n * \"Page X of Y\" (AWS's other variant, and what the DAV pager renders). Both\n * render `null` for a single page.\n */\n\n/**\nHow many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`.\n*/\nfunction pageCountFor(total: number, pageSize: number): number {\n if (!Number.isFinite(total) || !Number.isFinite(pageSize) || pageSize <= 0 || total <= 0) {\n return 1;\n }\n return Math.ceil(total / pageSize);\n}\n\n/**\nPins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read.\n*/\nfunction clampPage(page: number, pageCount: number): number {\n const upper = Math.max(1, Math.trunc(Number.isFinite(pageCount) ? pageCount : 1));\n const wanted = Number.isFinite(page) ? Math.trunc(page) : 1;\n return Math.min(upper, Math.max(1, wanted));\n}\n\n/**\n * The 1-based page numbers to show, keeping the current page as close to the\n * middle of the window as the ends allow. The window is clamped against\n * `windowSize` rather than a fixed `pageCount - 2`, so a non-default window\n * cannot emit page numbers past the last page.\n */\nfunction pageWindow(currentPage: number, pageCount: number, windowSize = 5): number[] {\n const count = Math.min(windowSize, pageCount);\n if (count <= 0) {\n return [];\n }\n const start = Math.max(1, Math.min(currentPage - Math.floor(windowSize / 2), pageCount - count + 1));\n return Array.from({ length: count }, (_, index) => start + index);\n}\n\n/**\nOverridable text, so an i18next app is not stuck with the English defaults.\n*/\ninterface PaginationLabels {\n /**\n Prev-button accessible name / label.\n */\n previous?: string;\n /**\n Next-button accessible name / label.\n */\n next?: string;\n /**\n The \"Page X of Y\" summary in `compact` (and as the pager's `aria-label` in `full`).\n */\n summary?: (page: number, pageCount: number) => string;\n}\n\ninterface PaginationProps {\n /**\n The page being displayed, 1-based. Clamped into range for rendering.\n */\n page: number;\n /**\n Total pages. Omit to derive it from `total` and `pageSize`.\n */\n pageCount?: number;\n /**\n Total item count across every page.\n */\n total?: number;\n /**\n Items per page.\n */\n pageSize?: number;\n /**\n Called with the 1-based page to move to; already clamped into range.\n */\n onChange: (page: number) => void;\n /**\n `full` shows page numbers, `compact` shows a summary.\n */\n variant?: 'full' | 'compact';\n labels?: PaginationLabels;\n}\n\nfunction Pagination({\n page,\n pageCount,\n total,\n pageSize,\n onChange,\n variant = 'full',\n labels = {},\n}: Readonly<PaginationProps>): ReactElement | null {\n const derivedPageCount = pageCount ?? (total !== undefined && pageSize !== undefined ? pageCountFor(total, pageSize) : 1);\n const pages = Math.max(1, Math.trunc(Number.isFinite(derivedPageCount) ? derivedPageCount : 1));\n const current = clampPage(page, pages);\n\n // Nothing to page: a single-page list shows no pager rather than a disabled one.\n if (pages <= 1) {\n return null;\n }\n\n const previousLabel = labels.previous ?? 'Previous';\n const nextLabel = labels.next ?? 'Next';\n const summaryLabel = labels.summary ?? ((page: number, count: number) => `Page ${page} of ${count}`);\n\n const step = (next: number): void => {\n const target = clampPage(next, pages);\n if (target !== current) {\n onChange(target);\n }\n };\n\n const summary = <span className=\"text-xs text-[var(--color-text-muted)] tabular-nums\">{summaryLabel(current, pages)}</span>;\n\n return (\n <nav className=\"flex flex-wrap items-center gap-2\" aria-label={summaryLabel(current, pages)}>\n <Button variant=\"secondary\" size=\"sm\" disabled={current <= 1} onClick={() => step(current - 1)} aria-label={previousLabel}>\n {previousLabel}\n </Button>\n {variant === 'compact' ? (\n summary\n ) : (\n <div className=\"flex items-center gap-1\">\n {pageWindow(current, pages).map((pageNumber) => (\n <Button\n key={pageNumber}\n variant=\"secondary\"\n size=\"sm\"\n className={cn(pageNumber === current && 'bg-[var(--color-accent)] text-[#0d1008]')}\n aria-current={pageNumber === current ? 'page' : undefined}\n onClick={() => step(pageNumber)}\n >\n {pageNumber}\n </Button>\n ))}\n </div>\n )}\n <Button variant=\"secondary\" size=\"sm\" disabled={current >= pages} onClick={() => step(current + 1)} aria-label={nextLabel}>\n {nextLabel}\n </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C,EACxFE,EAAUlB,EAAUC,EAAMgB,CAAK,EAGrC,GAAIA,GAAS,EACX,OAAO,KAGT,MAAME,EAAgBJ,EAAO,UAAY,WACnCK,EAAYL,EAAO,MAAQ,OAC3BM,EAAeN,EAAO,UAAY,CAACd,EAAcO,IAAkB,QAAQP,CAAI,OAAOO,CAAK,IAE3Fc,EAAQC,GAAsB,CAClC,MAAMC,EAASxB,EAAUuB,EAAMN,CAAK,EAChCO,IAAWN,GACbL,EAASW,CAAM,CAEnB,EAEMC,EAAUC,EAAA,OAAA,CAAM,UAAU,sDAAqD,SAAEL,EAAaH,EAASD,CAAK,CAAC,CAAA,EAEnH,OACEU,EAAA,MAAA,CAAK,UAAU,oCAAmC,aAAaN,EAAaH,EAASD,CAAK,EAAC,SAAA,CACzFS,EAAC/B,EAAM,CAAC,QAAQ,YAAY,KAAK,KAAK,SAAUuB,GAAW,EAAG,QAAS,IAAMI,EAAKJ,EAAU,CAAC,EAAC,aAAcC,EAAa,SACtHA,CAAa,CAAA,EAEfL,IAAY,UACXW,EAEAC,EAAA,MAAA,CAAK,UAAU,0BAAyB,SACrCrB,EAAWa,EAASD,CAAK,EAAE,IAAKW,GAC/BF,EAAC/B,EAAM,CAEL,QAAQ,YACR,KAAK,KACL,UAAWC,EAAGgC,IAAeV,GAAW,yCAAyC,EAAC,eACpEU,IAAeV,EAAU,OAAS,OAChD,QAAS,IAAMI,EAAKM,CAAU,EAAC,SAE9BA,CAAU,EAPNA,CAAU,CASlB,CAAC,CAAA,EAGNF,EAAC/B,EAAM,CAAC,QAAQ,YAAY,KAAK,KAAK,SAAUuB,GAAWD,EAAO,QAAS,IAAMK,EAAKJ,EAAU,CAAC,EAAC,aAAcE,EAAS,SACtHA,CAAS,CAAA,CACH,CAAA,CAAA,CAGf",
6
+ "names": ["Button", "cn", "pageCountFor", "total", "pageSize", "clampPage", "page", "pageCount", "upper", "wanted", "pageWindow", "currentPage", "windowSize", "count", "start", "_", "index", "Pagination", "onChange", "variant", "labels", "derivedPageCount", "pages", "current", "previousLabel", "nextLabel", "summaryLabel", "step", "next", "target", "summary", "_jsx", "_jsxs", "pageNumber"]
7
+ }
@@ -27,11 +27,17 @@
27
27
  * have something they do not. See `useCopyToClipboard` for both failures.
28
28
  */
29
29
  interface ReadOnlyFieldProps {
30
- /** The field's label. */
30
+ /**
31
+ The field's label.
32
+ */
31
33
  label: string;
32
- /** The value, shown verbatim and selectable. */
34
+ /**
35
+ The value, shown verbatim and selectable.
36
+ */
33
37
  value: string;
34
- /** Show the copy button. Defaults to false. */
38
+ /**
39
+ Show the copy button. Defaults to false.
40
+ */
35
41
  showCopy?: boolean;
36
42
  /**
37
43
  * The copy button's accessible name and tooltip.
@@ -40,7 +46,9 @@ interface ReadOnlyFieldProps {
40
46
  * announced as "button" with nothing else.
41
47
  */
42
48
  copyLabel?: string;
43
- /** Merged last onto the value's `<input>`. */
49
+ /**
50
+ Merged last onto the value's `<input>`.
51
+ */
44
52
  className?: string;
45
53
  }
46
54
  declare function ReadOnlyField({ label, value, showCopy, copyLabel, className }: Readonly<ReadOnlyFieldProps>): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyField.d.ts","sourceRoot":"","sources":["../src/ReadOnlyField.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,UAAU,kBAAkB;IAC1B,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,+BA8C5G;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"ReadOnlyField.d.ts","sourceRoot":"","sources":["../src/ReadOnlyField.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,UAAU,kBAAkB;IAC1B;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,+BA8C5G;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,17 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from 'react';
3
- import { Check, Copy } from 'lucide-react';
4
- import { Label } from './Input';
5
- import { cn } from './utils';
6
- import { useCopyToClipboard } from './useCopyToClipboard';
7
- function ReadOnlyField({ label, value, showCopy = false, copyLabel, className }) {
8
- const { copied, copy } = useCopyToClipboard();
9
- // The four copies rendered `<Label>{label}</Label>` with no `htmlFor`, so the
10
- // value input had **no accessible name** — a screen reader announced a bare
11
- // "edit text" for a field holding a secret. The kit's own `Input.tsx` records
12
- // this hazard; `useId` pairs the label without asking a caller for an id.
13
- const inputId = useId();
14
- return (_jsxs("div", { children: [_jsx(Label, { className: "mb-1.5", htmlFor: inputId, children: label }), _jsxs("div", { className: "flex", children: [_jsx("input", { id: inputId, readOnly: true, value: value, className: cn('min-w-0 px-3 py-2 bg-[var(--color-surface-base)] border border-[var(--color-border)] text-[var(--color-text-secondary)] text-sm flex-1', showCopy ? 'rounded-l-lg border-r-0' : 'rounded-lg', className) }), showCopy && (_jsx("button", { type: "button", onClick: () => copy(value), title: copyLabel, "aria-label": copyLabel, "aria-live": "polite", className: "px-3 py-2 rounded-r-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150", children: copied ? (_jsx(Check, { className: "h-3.5 w-3.5 text-[var(--color-success-text)]", "aria-hidden": "true" })) : (_jsx(Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })) }))] })] }));
15
- }
16
- export { ReadOnlyField };
17
- //# sourceMappingURL=ReadOnlyField.js.map
1
+ import{jsx as r,jsxs as l}from"react/jsx-runtime";import{useId as n}from"react";import{Check as m,Copy as u}from"lucide-react";import{Label as p}from"./Input.js";import{cn as b}from"./utils.js";import{useCopyToClipboard as x}from"./useCopyToClipboard.js";function f({label:s,value:e,showCopy:o=!1,copyLabel:a,className:d}){const{copied:c,copy:i}=x(),t=n();return l("div",{children:[r(p,{className:"mb-1.5",htmlFor:t,children:s}),l("div",{className:"flex",children:[r("input",{id:t,readOnly:!0,value:e,className:b("min-w-0 px-3 py-2 bg-[var(--color-surface-base)] border border-[var(--color-border)] text-[var(--color-text-secondary)] text-sm flex-1",o?"rounded-l-lg border-r-0":"rounded-lg",d)}),o&&r("button",{type:"button",onClick:()=>i(e),title:a,"aria-label":a,"aria-live":"polite",className:"px-3 py-2 rounded-r-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150",children:c?r(m,{className:"h-3.5 w-3.5 text-[var(--color-success-text)]","aria-hidden":"true"}):r(u,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})}export{f as ReadOnlyField};
@@ -1 +1,7 @@
1
- {"version":3,"file":"ReadOnlyField.js","sourceRoot":"","sources":["../src/ReadOnly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MAAM,GAAG,CACpD,GACM,CACV,IACG,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { useId, useState } from 'react';\nimport { Check, Copy } from 'lucide-react';\nimport { Label } from './Input';\nimport { cn } from './utils';\nimport { useCopyToClipboard } from './useCopyToClipboard';\n\n/**\n * A labelled, read-only value with an optional copy button.\n *\n * ## Provenance\n *\n * `components/shared/ReadOnlyField.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four copies in two shapes. The three outside\n * Durable-DAV inlined the clipboard handler; Durable-DAV's called its\n * `useCopyToClipboard` hook, which is the version that converged into\n * `@rexezuge/web` and is the one this uses.\n *\n * ## The third bug, which all four copies carried\n *\n * Every copy rendered `<Label>{label}</Label>` with no `htmlFor`, so the value\n * input had **no accessible name** — announced as a bare \"edit text\" for a field\n * whose contents are, in every call site in the family, a credential or an\n * identifier. The click target and the name both depend on the `for`, and\n * neither is visible in the markup that omits it. `useId` pairs them here so a\n * caller cannot forget.\n *\n * The difference was not cosmetic. The inlined three called\n * `navigator.clipboard.writeText` unguarded, so on a plain-HTTP deployment the\n * handler threw synchronously before reporting anything — and where they did\n * guard it, a denied permission still showed the checkmark for a copy that never\n * happened. Every value this component is pointed at in the family is a secret\n * or an identifier, so the false success sends the operator away believing they\n * have something they do not. See `useCopyToClipboard` for both failures.\n */\n\ninterface ReadOnlyFieldProps {\n /** The field's label. */\n label: string;\n /** The value, shown verbatim and selectable. */\n value: string;\n /** Show the copy button. Defaults to false. */\n showCopy?: boolean;\n /**\n * The copy button's accessible name and tooltip.\n *\n * Required whenever `showCopy` is set — a copy button carrying only an icon is\n * announced as \"button\" with nothing else.\n */\n copyLabel?: string;\n /** Merged last onto the value's `<input>`. */\n className?: string;\n}\n\nfunction ReadOnlyField({ label, value, showCopy = false, copyLabel, className }: Readonly<ReadOnlyFieldProps>) {\n const { copied, copy } = useCopyToClipboard();\n // The four copies rendered `<Label>{label}</Label>` with no `htmlFor`, so the\n // value input had **no accessible name** — a screen reader announced a bare\n // \"edit text\" for a field holding a secret. The kit's own `Input.tsx` records\n // this hazard; `useId` pairs the label without asking a caller for an id.\n const inputId = useId();\n\n return (\n <div>\n <Label className=\"mb-1.5\" htmlFor={inputId}>\n {label}\n </Label>\n <div className=\"flex\">\n <input\n id={inputId}\n readOnly\n value={value}\n className={cn(\n 'min-w-0 px-3 py-2 bg-[var(--color-surface-base)] border border-[var(--color-border)] text-[var(--color-text-secondary)] text-sm flex-1',\n showCopy ? 'rounded-l-lg border-r-0' : 'rounded-lg',\n className,\n )}\n />\n {showCopy && (\n <button\n type=\"button\"\n onClick={() => copy(value)}\n title={copyLabel}\n aria-label={copyLabel}\n // `aria-live` so the confirmation is announced. The icon swap alone\n // is invisible to a screen reader, which would make the success\n // state silent for exactly the users copying a secret by hand.\n aria-live=\"polite\"\n className=\"px-3 py-2 rounded-r-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport { ReadOnlyField };\nexport type { ReadOnlyFieldProps };\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/ReadOnlyField.tsx"],
4
+ "sourcesContent": ["import { useId } from 'react';\nimport { Check, Copy } from 'lucide-react';\nimport { Label } from './Input.tsx';\nimport { cn } from './utils.ts';\nimport { useCopyToClipboard } from './useCopyToClipboard.ts';\n\n/**\n * A labelled, read-only value with an optional copy button.\n *\n * ## Provenance\n *\n * `components/shared/ReadOnlyField.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four copies in two shapes. The three outside\n * Durable-DAV inlined the clipboard handler; Durable-DAV's called its\n * `useCopyToClipboard` hook, which is the version that converged into\n * `@rexezuge/web` and is the one this uses.\n *\n * ## The third bug, which all four copies carried\n *\n * Every copy rendered `<Label>{label}</Label>` with no `htmlFor`, so the value\n * input had **no accessible name** — announced as a bare \"edit text\" for a field\n * whose contents are, in every call site in the family, a credential or an\n * identifier. The click target and the name both depend on the `for`, and\n * neither is visible in the markup that omits it. `useId` pairs them here so a\n * caller cannot forget.\n *\n * The difference was not cosmetic. The inlined three called\n * `navigator.clipboard.writeText` unguarded, so on a plain-HTTP deployment the\n * handler threw synchronously before reporting anything — and where they did\n * guard it, a denied permission still showed the checkmark for a copy that never\n * happened. Every value this component is pointed at in the family is a secret\n * or an identifier, so the false success sends the operator away believing they\n * have something they do not. See `useCopyToClipboard` for both failures.\n */\n\ninterface ReadOnlyFieldProps {\n /**\n The field's label.\n */\n label: string;\n /**\n The value, shown verbatim and selectable.\n */\n value: string;\n /**\n Show the copy button. Defaults to false.\n */\n showCopy?: boolean;\n /**\n * The copy button's accessible name and tooltip.\n *\n * Required whenever `showCopy` is set — a copy button carrying only an icon is\n * announced as \"button\" with nothing else.\n */\n copyLabel?: string;\n /**\n Merged last onto the value's `<input>`.\n */\n className?: string;\n}\n\nfunction ReadOnlyField({ label, value, showCopy = false, copyLabel, className }: Readonly<ReadOnlyFieldProps>) {\n const { copied, copy } = useCopyToClipboard();\n // The four copies rendered `<Label>{label}</Label>` with no `htmlFor`, so the\n // value input had **no accessible name** — a screen reader announced a bare\n // \"edit text\" for a field holding a secret. The kit's own `Input.tsx` records\n // this hazard; `useId` pairs the label without asking a caller for an id.\n const inputId = useId();\n\n return (\n <div>\n <Label className=\"mb-1.5\" htmlFor={inputId}>\n {label}\n </Label>\n <div className=\"flex\">\n <input\n id={inputId}\n readOnly\n value={value}\n className={cn(\n 'min-w-0 px-3 py-2 bg-[var(--color-surface-base)] border border-[var(--color-border)] text-[var(--color-text-secondary)] text-sm flex-1',\n showCopy ? 'rounded-l-lg border-r-0' : 'rounded-lg',\n className,\n )}\n />\n {showCopy && (\n <button\n type=\"button\"\n onClick={() => copy(value)}\n title={copyLabel}\n aria-label={copyLabel}\n // `aria-live` so the confirmation is announced. The icon swap alone\n // is invisible to a screen reader, which would make the success\n // state silent for exactly the users copying a secret by hand.\n aria-live=\"polite\"\n className=\"px-3 py-2 rounded-r-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport { ReadOnlyField };\nexport type { ReadOnlyFieldProps };\n"],
5
+ "mappings": "kDAAA,OAAS,SAAAA,MAAa,QACtB,OAAS,SAAAC,EAAO,QAAAC,MAAY,eAC5B,OAAS,SAAAC,MAAa,aACtB,OAAS,MAAAC,MAAU,aACnB,OAAS,sBAAAC,MAA0B,0BAyDnC,SAASC,EAAc,CAAE,MAAAC,EAAO,MAAAC,EAAO,SAAAC,EAAW,GAAO,UAAAC,EAAW,UAAAC,CAAS,EAAgC,CAC3G,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAI,EAAKR,EAAkB,EAKrCS,EAAUd,EAAK,EAErB,OACEe,EAAA,MAAA,CAAA,SAAA,CACEC,EAACb,EAAK,CAAC,UAAU,SAAS,QAASW,EAAO,SACvCP,CAAK,CAAA,EAERQ,EAAA,MAAA,CAAK,UAAU,OAAM,SAAA,CACnBC,EAAA,QAAA,CACE,GAAIF,EACJ,SAAQ,GACR,MAAON,EACP,UAAWJ,EACT,yIACAK,EAAW,0BAA4B,aACvCE,CAAS,CACV,CAAA,EAEFF,GACCO,EAAA,SAAA,CACE,KAAK,SACL,QAAS,IAAMH,EAAKL,CAAK,EACzB,MAAOE,EAAS,aACJA,EAAS,YAIX,SACV,UAAU,6LAA4L,SAErME,EACCI,EAACf,EAAK,CAAC,UAAU,+CAA8C,cAAa,MAAM,CAAA,EAElFe,EAACd,EAAI,CAAC,UAAU,cAAa,cAAa,MAAM,CAAA,CACjD,CAAA,CAEJ,CAAA,CAAA,CACG,CAAA,CAAA,CAGZ",
6
+ "names": ["useId", "Check", "Copy", "Label", "cn", "useCopyToClipboard", "ReadOnlyField", "label", "value", "showCopy", "copyLabel", "className", "copied", "copy", "inputId", "_jsxs", "_jsx"]
7
+ }
@@ -24,9 +24,13 @@
24
24
  */
25
25
  interface RefreshButtonProps {
26
26
  onRefresh: () => void;
27
- /** Shows the spinner and blocks activation until the caller's work clears. */
27
+ /**
28
+ Shows the spinner and blocks activation until the caller's work clears.
29
+ */
28
30
  loading?: boolean;
29
- /** The button's text. */
31
+ /**
32
+ The button's text.
33
+ */
30
34
  label: string;
31
35
  className?: string;
32
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshButton.d.ts","sourceRoot":"","sources":["../src/RefreshButton.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,UAAU,kBAAkB;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,+BAO5F;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"RefreshButton.d.ts","sourceRoot":"","sources":["../src/RefreshButton.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,UAAU,kBAAkB;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;MAEE;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,+BAO5F;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,8 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RefreshCw } from 'lucide-react';
3
- import { Button } from './Button';
4
- function RefreshButton({ onRefresh, loading, label, className }) {
5
- return (_jsxs(Button, { variant: "secondary", size: "sm", onClick: onRefresh, loading: loading, className: className, children: [_jsx(RefreshCw, { className: "h-3.5 w-3.5", "aria-hidden": "true" }), label] }));
6
- }
7
- export { RefreshButton };
8
- //# sourceMappingURL=RefreshButton.js.map
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";import{RefreshCw as i}from"lucide-react";import{Button as n}from"./Button.js";function m({onRefresh:s,loading:r,label:e,className:o}){return t(n,{variant:"secondary",size:"sm",onClick:s,loading:r,className:o,children:[a(i,{className:"h-3.5 w-3.5","aria-hidden":"true"}),e]})}export{m as RefreshButton};
@@ -1 +1,7 @@
1
- {"version":3,"file":"RefreshButton.js","sourceRoot":"","sources":["../src/RefreshButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAoClC,SAAS,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAgC;IAC3F,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,aAC9F,KAAC,SAAS,IAAC,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EACvD,KAAK,IACC,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { RefreshCw } from 'lucide-react';\nimport { Button } from './Button';\n\n/**\n * The refresh control.\n *\n * ## Provenance\n *\n * `components/shared/RefreshButton.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four byte-identical copies.\n *\n * ## Why the icon stays but the label does not\n *\n * This is the one place the kit takes `lucide-react` as a peer, and the split is\n * deliberate. `RefreshCw` is iconography: reimplementing its path data in this\n * package would fork lucide's artwork and freeze it at whatever version the kit\n * vendored it. A label, by contrast, is the consuming app's string catalogue —\n * the app knows whether this reads \"Refresh\" or \"Neu laden\", and a kit that\n * hard-codes English text for it has taken over something it should not own.\n *\n * So: glyph in, string out. That is also why the kit's own `Button` keeps\n * using its own `Spinner` rather than lucide's `Loader2` — chrome is cheap to\n * draw, iconography is not.\n *\n * `loading` is passed straight through to `Button`, which already blocks\n * activation while busy, so a caller does not also thread `disabled`.\n */\n\ninterface RefreshButtonProps {\n onRefresh: () => void;\n /** Shows the spinner and blocks activation until the caller's work clears. */\n loading?: boolean;\n /** The button's text. */\n label: string;\n className?: string;\n}\n\nfunction RefreshButton({ onRefresh, loading, label, className }: Readonly<RefreshButtonProps>) {\n return (\n <Button variant=\"secondary\" size=\"sm\" onClick={onRefresh} loading={loading} className={className}>\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {label}\n </Button>\n );\n}\n\nexport { RefreshButton };\nexport type { RefreshButtonProps };\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/RefreshButton.tsx"],
4
+ "sourcesContent": ["import { RefreshCw } from 'lucide-react';\nimport { Button } from './Button.tsx';\n\n/**\n * The refresh control.\n *\n * ## Provenance\n *\n * `components/shared/RefreshButton.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four byte-identical copies.\n *\n * ## Why the icon stays but the label does not\n *\n * This is the one place the kit takes `lucide-react` as a peer, and the split is\n * deliberate. `RefreshCw` is iconography: reimplementing its path data in this\n * package would fork lucide's artwork and freeze it at whatever version the kit\n * vendored it. A label, by contrast, is the consuming app's string catalogue —\n * the app knows whether this reads \"Refresh\" or \"Neu laden\", and a kit that\n * hard-codes English text for it has taken over something it should not own.\n *\n * So: glyph in, string out. That is also why the kit's own `Button` keeps\n * using its own `Spinner` rather than lucide's `Loader2` — chrome is cheap to\n * draw, iconography is not.\n *\n * `loading` is passed straight through to `Button`, which already blocks\n * activation while busy, so a caller does not also thread `disabled`.\n */\n\ninterface RefreshButtonProps {\n onRefresh: () => void;\n /**\n Shows the spinner and blocks activation until the caller's work clears.\n */\n loading?: boolean;\n /**\n The button's text.\n */\n label: string;\n className?: string;\n}\n\nfunction RefreshButton({ onRefresh, loading, label, className }: Readonly<RefreshButtonProps>) {\n return (\n <Button variant=\"secondary\" size=\"sm\" onClick={onRefresh} loading={loading} className={className}>\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {label}\n </Button>\n );\n}\n\nexport { RefreshButton };\nexport type { RefreshButtonProps };\n"],
5
+ "mappings": "kDAAA,OAAS,aAAAA,MAAiB,eAC1B,OAAS,UAAAC,MAAc,cAwCvB,SAASC,EAAc,CAAE,UAAAC,EAAW,QAAAC,EAAS,MAAAC,EAAO,UAAAC,CAAS,EAAgC,CAC3F,OACEC,EAACN,EAAM,CAAC,QAAQ,YAAY,KAAK,KAAK,QAASE,EAAW,QAASC,EAAS,UAAWE,EAAS,SAAA,CAC9FE,EAACR,EAAS,CAAC,UAAU,cAAa,cAAa,MAAM,CAAA,EACpDK,CAAK,CAAA,CAAA,CAGZ",
6
+ "names": ["RefreshCw", "Button", "RefreshButton", "onRefresh", "loading", "label", "className", "_jsxs", "_jsx"]
7
+ }
package/dist/Spinner.d.ts CHANGED
@@ -14,15 +14,25 @@ import type { CSSProperties } from 'react';
14
14
  * Tailwind's `animate-spin` (present in every consuming app's stylesheet).
15
15
  */
16
16
  interface SpinnerProps {
17
- /** Diameter in pixels. */
17
+ /**
18
+ Diameter in pixels.
19
+ */
18
20
  size?: number;
19
- /** Border colour; `currentColor` inherits from the surrounding text. */
21
+ /**
22
+ Border colour; `currentColor` inherits from the surrounding text.
23
+ */
20
24
  color?: string;
21
- /** Optional caption under the ring. */
25
+ /**
26
+ Optional caption under the ring.
27
+ */
22
28
  label?: string;
23
- /** Padding around the whole block, as a CSS shorthand. */
29
+ /**
30
+ Padding around the whole block, as a CSS shorthand.
31
+ */
24
32
  padding?: string;
25
- /** Extra styles for the outer wrapper. */
33
+ /**
34
+ Extra styles for the outer wrapper.
35
+ */
26
36
  style?: CSSProperties;
27
37
  }
28
38
  declare function Spinner({ size, color, label, padding, style }: Readonly<SpinnerProps>): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C;;;;;;;;;;;;;GAaG;AAEH,UAAU,YAAY;IACpB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,iBAAS,OAAO,CAAC,EAAE,IAAS,EAAE,KAAyB,EAAE,KAAK,EAAE,OAAkB,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkBtI;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C;;;;;;;;;;;;;GAaG;AAEH,UAAU,YAAY;IACpB;;MAEE;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;MAEE;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;MAEE;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;MAEE;IACF,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,iBAAS,OAAO,CAAC,EAAE,IAAS,EAAE,KAAyB,EAAE,KAAK,EAAE,OAAkB,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkBtI;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
package/dist/Spinner.js CHANGED
@@ -1,14 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { theme } from './theme';
3
- function Spinner({ size = 24, color = theme.spinnerBlue, label, padding = '16px 0', style }) {
4
- return (_jsxs("div", { style: { textAlign: 'center', padding, ...style }, children: [_jsx("div", { className: "animate-spin", "aria-hidden": "true", style: {
5
- width: `${size}px`,
6
- height: `${size}px`,
7
- borderRadius: '50%',
8
- border: `2px solid ${color}`,
9
- borderTopColor: 'transparent',
10
- margin: '0 auto',
11
- } }), label ? _jsx("p", { style: { color: '#9ca3af', marginTop: '12px' }, children: label }) : null] }));
12
- }
13
- export { Spinner };
14
- //# sourceMappingURL=Spinner.js.map
1
+ import{jsx as i,jsxs as s}from"react/jsx-runtime";import{theme as a}from"./theme.js";function p({size:r=24,color:n=a.spinnerBlue,label:e,padding:t="16px 0",style:o}){return s("div",{style:{textAlign:"center",padding:t,...o},children:[i("div",{className:"animate-spin","aria-hidden":"true",style:{width:`${r}px`,height:`${r}px`,borderRadius:"50%",border:`2px solid ${n}`,borderTopColor:"transparent",margin:"0 auto"}}),e?i("p",{style:{color:"#9ca3af",marginTop:"12px"},children:e}):null]})}export{p as Spinner};
@@ -1 +1,7 @@
1
- {"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA8BhC,SAAS,OAAO,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,KAAK,EAA0B;IACjH,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,aACpD,cACE,SAAS,EAAC,cAAc,iBACZ,MAAM,EAClB,KAAK,EAAE;oBACL,KAAK,EAAE,GAAG,IAAI,IAAI;oBAClB,MAAM,EAAE,GAAG,IAAI,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,MAAM,EAAE,aAAa,KAAK,EAAE;oBAC5B,cAAc,EAAE,aAAa;oBAC7B,MAAM,EAAE,QAAQ;iBACjB,GACD,EACD,KAAK,CAAC,CAAC,CAAC,YAAG,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,YAAG,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,IAC1E,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import type { CSSProperties } from 'react';\nimport { theme } from './theme';\n\n/**\n * The loading ring.\n *\n * ## Provenance\n *\n * `components/ui/Spinner.tsx` in **AWS-AccessBridge** — the only named spinner\n * in the family. The other repos inline the same ring into their buttons as a\n * `Loader2` icon from `lucide-react`, which the kit does not depend on, so this\n * component *is* the kit's spinner vocabulary: `Button` and `LoadingButton`\n * render it while busy.\n *\n * The ring is a bordered circle with one transparent edge, animated by\n * Tailwind's `animate-spin` (present in every consuming app's stylesheet).\n */\n\ninterface SpinnerProps {\n /** Diameter in pixels. */\n size?: number;\n /** Border colour; `currentColor` inherits from the surrounding text. */\n color?: string;\n /** Optional caption under the ring. */\n label?: string;\n /** Padding around the whole block, as a CSS shorthand. */\n padding?: string;\n /** Extra styles for the outer wrapper. */\n style?: CSSProperties;\n}\n\nfunction Spinner({ size = 24, color = theme.spinnerBlue, label, padding = '16px 0', style }: Readonly<SpinnerProps>): React.JSX.Element {\n return (\n <div style={{ textAlign: 'center', padding, ...style }}>\n <div\n className=\"animate-spin\"\n aria-hidden=\"true\"\n style={{\n width: `${size}px`,\n height: `${size}px`,\n borderRadius: '50%',\n border: `2px solid ${color}`,\n borderTopColor: 'transparent',\n margin: '0 auto',\n }}\n />\n {label ? <p style={{ color: '#9ca3af', marginTop: '12px' }}>{label}</p> : null}\n </div>\n );\n}\n\nexport { Spinner };\nexport type { SpinnerProps };\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Spinner.tsx"],
4
+ "sourcesContent": ["import type { CSSProperties } from 'react';\nimport { theme } from './theme.ts';\n\n/**\n * The loading ring.\n *\n * ## Provenance\n *\n * `components/ui/Spinner.tsx` in **AWS-AccessBridge** — the only named spinner\n * in the family. The other repos inline the same ring into their buttons as a\n * `Loader2` icon from `lucide-react`, which the kit does not depend on, so this\n * component *is* the kit's spinner vocabulary: `Button` and `LoadingButton`\n * render it while busy.\n *\n * The ring is a bordered circle with one transparent edge, animated by\n * Tailwind's `animate-spin` (present in every consuming app's stylesheet).\n */\n\ninterface SpinnerProps {\n /**\n Diameter in pixels.\n */\n size?: number;\n /**\n Border colour; `currentColor` inherits from the surrounding text.\n */\n color?: string;\n /**\n Optional caption under the ring.\n */\n label?: string;\n /**\n Padding around the whole block, as a CSS shorthand.\n */\n padding?: string;\n /**\n Extra styles for the outer wrapper.\n */\n style?: CSSProperties;\n}\n\nfunction Spinner({ size = 24, color = theme.spinnerBlue, label, padding = '16px 0', style }: Readonly<SpinnerProps>): React.JSX.Element {\n return (\n <div style={{ textAlign: 'center', padding, ...style }}>\n <div\n className=\"animate-spin\"\n aria-hidden=\"true\"\n style={{\n width: `${size}px`,\n height: `${size}px`,\n borderRadius: '50%',\n border: `2px solid ${color}`,\n borderTopColor: 'transparent',\n margin: '0 auto',\n }}\n />\n {label ? <p style={{ color: '#9ca3af', marginTop: '12px' }}>{label}</p> : null}\n </div>\n );\n}\n\nexport { Spinner };\nexport type { SpinnerProps };\n"],
5
+ "mappings": "kDACA,OAAS,SAAAA,MAAa,aAwCtB,SAASC,EAAQ,CAAE,KAAAC,EAAO,GAAI,MAAAC,EAAQH,EAAM,YAAa,MAAAI,EAAO,QAAAC,EAAU,SAAU,MAAAC,CAAK,EAA0B,CACjH,OACEC,EAAA,MAAA,CAAK,MAAO,CAAE,UAAW,SAAU,QAAAF,EAAS,GAAGC,CAAK,EAAE,SAAA,CACpDE,EAAA,MAAA,CACE,UAAU,eAAc,cACZ,OACZ,MAAO,CACL,MAAO,GAAGN,CAAI,KACd,OAAQ,GAAGA,CAAI,KACf,aAAc,MACd,OAAQ,aAAaC,CAAK,GAC1B,eAAgB,cAChB,OAAQ,SACT,CAAA,EAEFC,EAAQI,EAAA,IAAA,CAAG,MAAO,CAAE,MAAO,UAAW,UAAW,MAAM,EAAE,SAAGJ,CAAK,CAAA,EAAQ,IAAI,CAAA,CAAA,CAGpF",
6
+ "names": ["theme", "Spinner", "size", "color", "label", "padding", "style", "_jsxs", "_jsx"]
7
+ }
@@ -25,17 +25,27 @@
25
25
  * resource on a case-insensitive backend.
26
26
  */
27
27
  interface TypeToConfirmModalProps {
28
- /** The dialog's heading, and its accessible name. */
28
+ /**
29
+ The dialog's heading, and its accessible name.
30
+ */
29
31
  title: string;
30
- /** The line under the heading, explaining what happens on confirm. */
32
+ /**
33
+ The line under the heading, explaining what happens on confirm.
34
+ */
31
35
  description: string;
32
- /** The string the operator must type. Shown, and offered as a copy. */
36
+ /**
37
+ The string the operator must type. Shown, and offered as a copy.
38
+ */
33
39
  expectedName: string;
34
40
  confirmLabel: string;
35
41
  cancelLabel: string;
36
- /** The copy button's accessible name and tooltip. */
42
+ /**
43
+ The copy button's accessible name and tooltip.
44
+ */
37
45
  copyLabel: string;
38
- /** The prompt over the input. Name the thing: `Type "prod" to confirm`. */
46
+ /**
47
+ The prompt over the input. Name the thing: `Type "prod" to confirm`.
48
+ */
39
49
  promptLabel: string;
40
50
  onConfirm: () => void;
41
51
  onCancel: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeToConfirmModal.d.ts","sourceRoot":"","sources":["../src/TypeToConfirmModal.tsx"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,UAAU,uBAAuB;IAC/B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAe,GAChB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,+BA2EnC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"TypeToConfirmModal.d.ts","sourceRoot":"","sources":["../src/TypeToConfirmModal.tsx"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,UAAU,uBAAuB;IAC/B;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,WAAW,EAAE,MAAM,CAAC;IACpB;;MAEE;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB;;MAEE;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAe,GAChB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,+BA2EnC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1,24 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { AlertTriangle, Check, Copy } from 'lucide-react';
4
- import { Button } from './Button';
5
- import { Input, Label } from './Input';
6
- import { ModalShell } from './ModalShell';
7
- import { useCopyToClipboard } from './useCopyToClipboard';
8
- function TypeToConfirmModal({ title, description, expectedName, confirmLabel, cancelLabel, copyLabel, promptLabel, onConfirm, onCancel, loading = false, }) {
9
- const [input, setInput] = useState('');
10
- const { copied, copy } = useCopyToClipboard();
11
- const matched = input.trim() === expectedName;
12
- return (_jsx(ModalShell, { onClose: onCancel, widthClass: "w-full max-w-md mx-4", ariaLabel: title, children: _jsxs("div", { className: "p-6", children: [_jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-error-bg)] mb-4 mx-auto", children: _jsx(AlertTriangle, { className: "h-5 w-5 text-[var(--color-error-text)]", "aria-hidden": "true" }) }), _jsx("h2", { className: "text-base font-semibold text-[var(--color-text-primary)] text-center mb-2", children: title }), _jsx("p", { className: "text-sm text-[var(--color-text-secondary)] text-center mb-4", children: description }), _jsxs("div", { className: "flex items-center justify-center gap-2 mb-4", children: [_jsx("code", { className: "px-2.5 py-1.5 rounded-lg bg-[var(--color-surface-base)] border border-[var(--color-border)] text-sm font-mono text-[var(--color-text-primary)] break-all", children: expectedName }), _jsx("button", { type: "button", onClick: () => copy(expectedName), title: copyLabel, "aria-label": copyLabel, className: "px-2.5 py-2 rounded-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150", children: copied ? (_jsx(Check, { className: "h-3.5 w-3.5 text-[var(--color-success-text)]", "aria-hidden": "true" })) : (_jsx(Copy, { className: "h-3.5 w-3.5", "aria-hidden": "true" })) })] }), _jsxs("div", { className: "space-y-1.5 mb-6", children: [_jsx(Label, { htmlFor: "danger-confirm-input", children: promptLabel }), _jsx(Input, { id: "danger-confirm-input", value: input, onChange: (event) => setInput(event.target.value), placeholder: expectedName, autoComplete: "off", autoFocus: true })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { variant: "ghost", className: "flex-1", onClick: (event) => {
13
- event.stopPropagation();
14
- onCancel();
15
- }, children: cancelLabel }), _jsx(Button, { variant: "danger", className: "flex-1",
16
- // Armed only on an exact match. `loading` is forwarded separately
17
- // so a confirm already in flight cannot be fired a second time.
18
- disabled: !matched, loading: loading, onClick: (event) => {
19
- event.stopPropagation();
20
- onConfirm();
21
- }, children: confirmLabel })] })] }) }));
22
- }
23
- export { TypeToConfirmModal };
24
- //# sourceMappingURL=TypeToConfirmModal.js.map
1
+ import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useState as g}from"react";import{AlertTriangle as y,Check as C,Copy as N}from"lucide-react";import{Button as i}from"./Button.js";import{Input as w,Label as j}from"./Input.js";import{ModalShell as k}from"./ModalShell.js";import{useCopyToClipboard as T}from"./useCopyToClipboard.js";function F({title:t,description:n,expectedName:o,confirmLabel:d,cancelLabel:m,copyLabel:l,promptLabel:u,onConfirm:p,onCancel:s,loading:h=!1}){const[c,x]=g(""),{copied:f,copy:b}=T(),v=c.trim()===o;return r(k,{onClose:s,widthClass:"w-full max-w-md mx-4",ariaLabel:t,children:a("div",{className:"p-6",children:[r("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-error-bg)] mb-4 mx-auto",children:r(y,{className:"h-5 w-5 text-[var(--color-error-text)]","aria-hidden":"true"})}),r("h2",{className:"text-base font-semibold text-[var(--color-text-primary)] text-center mb-2",children:t}),r("p",{className:"text-sm text-[var(--color-text-secondary)] text-center mb-4",children:n}),a("div",{className:"flex items-center justify-center gap-2 mb-4",children:[r("code",{className:"px-2.5 py-1.5 rounded-lg bg-[var(--color-surface-base)] border border-[var(--color-border)] text-sm font-mono text-[var(--color-text-primary)] break-all",children:o}),r("button",{type:"button",onClick:()=>b(o),title:l,"aria-label":l,className:"px-2.5 py-2 rounded-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150",children:f?r(C,{className:"h-3.5 w-3.5 text-[var(--color-success-text)]","aria-hidden":"true"}):r(N,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),a("div",{className:"space-y-1.5 mb-6",children:[r(j,{htmlFor:"danger-confirm-input",children:u}),r(w,{id:"danger-confirm-input",value:c,onChange:e=>x(e.target.value),placeholder:o,autoComplete:"off",autoFocus:!0})]}),a("div",{className:"flex gap-3",children:[r(i,{variant:"ghost",className:"flex-1",onClick:e=>{e.stopPropagation(),s()},children:m}),r(i,{variant:"danger",className:"flex-1",disabled:!v,loading:h,onClick:e=>{e.stopPropagation(),p()},children:d})]})]})})}export{F as TypeToConfirmModal};
@@ -1 +1,7 @@
1
- {"version":3,"file":"TypeToConfirmModal.js","sourceRoot":"","sources":["../src/TypeToConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA+C1D,SAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAO,GAAG,KAAK,GACmB;IAClC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAE9C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,YAAY,CAAC;IAE9C,OAAO,CAIL,KAAC,UAAU,IAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAC,sBAAsB,EAAC,SAAS,EAAE,KAAK,YAC/E,eAAK,SAAS,EAAC,KAAK,aAClB,cAAK,SAAS,EAAC,iGAAiG,YAC9G,KAAC,aAAa,IAAC,SAAS,EAAC,wCAAwC,iBAAa,MAAM,GAAG,GACnF,EACN,aAAI,SAAS,EAAC,2EAA2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E,CAAC,KAAK,EAAE,EAAE;gCACjB,KAAK,CAAC,eAAe,EAAE,CAAC;gCACxB,SAAS,EAAE,CAAC;4BACd,CAAC,YAEA,YAAY,GACN,IACL,IACF,GACK,CACd,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { useState } from 'react';\nimport { AlertTriangle, Check, Copy } from 'lucide-react';\nimport { Button } from './Button';\nimport { Input, Label } from './Input';\nimport { ModalShell } from './ModalShell';\nimport { useCopyToClipboard } from './useCopyToClipboard';\n\n/**\n * The \"type the name to confirm this destructive action\" dialog.\n *\n * ## Provenance\n *\n * `components/modals/TypeToConfirmModal.tsx` in **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git** and **Mail-Otter** — four copies that\n * agreed on the interaction and each carried its own clipboard handler.\n *\n * ## Why this exists alongside `ConfirmDeleteModal`\n *\n * The two are not interchangeable, and merging them would lose the distinction\n * that makes either useful. A confirmation whose button is always armed asks\n * nothing of the operator; this one requires typing the exact name, which is\n * the right price for deleting a volume, a branch, or a credential. A repo\n * that wants the cheap one uses {@link ConfirmDeleteModal}; a repo that wants\n * this one names the thing twice.\n *\n * ## The match is exact, not case-insensitive\n *\n * All four copies compared `input.trim() === expectedName`. That is\n * intentional and is kept: a confirmation the operator has to get exactly right\n * is a confirmation they read. Trimming is allowed because it is invisible; case\n * folding is not, because a name differing only in case may well be a different\n * resource on a case-insensitive backend.\n */\n\ninterface TypeToConfirmModalProps {\n /** The dialog's heading, and its accessible name. */\n title: string;\n /** The line under the heading, explaining what happens on confirm. */\n description: string;\n /** The string the operator must type. Shown, and offered as a copy. */\n expectedName: string;\n confirmLabel: string;\n cancelLabel: string;\n /** The copy button's accessible name and tooltip. */\n copyLabel: string;\n /** The prompt over the input. Name the thing: `Type \"prod\" to confirm`. */\n promptLabel: string;\n onConfirm: () => void;\n onCancel: () => void;\n loading?: boolean;\n}\n\nfunction TypeToConfirmModal({\n title,\n description,\n expectedName,\n confirmLabel,\n cancelLabel,\n copyLabel,\n promptLabel,\n onConfirm,\n onCancel,\n loading = false,\n}: Readonly<TypeToConfirmModalProps>) {\n const [input, setInput] = useState('');\n const { copied, copy } = useCopyToClipboard();\n\n const matched = input.trim() === expectedName;\n\n return (\n // `closeLabel` is deliberately not `cancelLabel`: a dialog whose corner\n // close button and body cancel button share a name is announced as two\n // identical buttons. `ModalShell` defaults it to \"Close\" for that reason.\n <ModalShell onClose={onCancel} widthClass=\"w-full max-w-md mx-4\" ariaLabel={title}>\n <div className=\"p-6\">\n <div className=\"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-error-bg)] mb-4 mx-auto\">\n <AlertTriangle className=\"h-5 w-5 text-[var(--color-error-text)]\" aria-hidden=\"true\" />\n </div>\n <h2 className=\"text-base font-semibold text-[var(--color-text-primary)] text-center mb-2\">{title}</h2>\n <p className=\"text-sm text-[var(--color-text-secondary)] text-center mb-4\">{description}</p>\n <div className=\"flex items-center justify-center gap-2 mb-4\">\n <code className=\"px-2.5 py-1.5 rounded-lg bg-[var(--color-surface-base)] border border-[var(--color-border)] text-sm font-mono text-[var(--color-text-primary)] break-all\">\n {expectedName}\n </code>\n <button\n type=\"button\"\n onClick={() => copy(expectedName)}\n title={copyLabel}\n aria-label={copyLabel}\n className=\"px-2.5 py-2 rounded-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n </div>\n <div className=\"space-y-1.5 mb-6\">\n <Label htmlFor=\"danger-confirm-input\">{promptLabel}</Label>\n <Input\n id=\"danger-confirm-input\"\n value={input}\n onChange={(event) => setInput(event.target.value)}\n placeholder={expectedName}\n autoComplete=\"off\"\n autoFocus\n />\n </div>\n <div className=\"flex gap-3\">\n <Button\n variant=\"ghost\"\n className=\"flex-1\"\n onClick={(event) => {\n event.stopPropagation();\n onCancel();\n }}\n >\n {cancelLabel}\n </Button>\n <Button\n variant=\"danger\"\n className=\"flex-1\"\n // Armed only on an exact match. `loading` is forwarded separately\n // so a confirm already in flight cannot be fired a second time.\n disabled={!matched}\n loading={loading}\n onClick={(event) => {\n event.stopPropagation();\n onConfirm();\n }}\n >\n {confirmLabel}\n </Button>\n </div>\n </div>\n </ModalShell>\n );\n}\n\nexport { TypeToConfirmModal };\nexport type { TypeToConfirmModalProps };\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/TypeToConfirmModal.tsx"],
4
+ "sourcesContent": ["import { useState } from 'react';\nimport { AlertTriangle, Check, Copy } from 'lucide-react';\nimport { Button } from './Button.tsx';\nimport { Input, Label } from './Input.tsx';\nimport { ModalShell } from './ModalShell.tsx';\nimport { useCopyToClipboard } from './useCopyToClipboard.ts';\n\n/**\n * The \"type the name to confirm this destructive action\" dialog.\n *\n * ## Provenance\n *\n * `components/modals/TypeToConfirmModal.tsx` in **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git** and **Mail-Otter** — four copies that\n * agreed on the interaction and each carried its own clipboard handler.\n *\n * ## Why this exists alongside `ConfirmDeleteModal`\n *\n * The two are not interchangeable, and merging them would lose the distinction\n * that makes either useful. A confirmation whose button is always armed asks\n * nothing of the operator; this one requires typing the exact name, which is\n * the right price for deleting a volume, a branch, or a credential. A repo\n * that wants the cheap one uses {@link ConfirmDeleteModal}; a repo that wants\n * this one names the thing twice.\n *\n * ## The match is exact, not case-insensitive\n *\n * All four copies compared `input.trim() === expectedName`. That is\n * intentional and is kept: a confirmation the operator has to get exactly right\n * is a confirmation they read. Trimming is allowed because it is invisible; case\n * folding is not, because a name differing only in case may well be a different\n * resource on a case-insensitive backend.\n */\n\ninterface TypeToConfirmModalProps {\n /**\n The dialog's heading, and its accessible name.\n */\n title: string;\n /**\n The line under the heading, explaining what happens on confirm.\n */\n description: string;\n /**\n The string the operator must type. Shown, and offered as a copy.\n */\n expectedName: string;\n confirmLabel: string;\n cancelLabel: string;\n /**\n The copy button's accessible name and tooltip.\n */\n copyLabel: string;\n /**\n The prompt over the input. Name the thing: `Type \"prod\" to confirm`.\n */\n promptLabel: string;\n onConfirm: () => void;\n onCancel: () => void;\n loading?: boolean;\n}\n\nfunction TypeToConfirmModal({\n title,\n description,\n expectedName,\n confirmLabel,\n cancelLabel,\n copyLabel,\n promptLabel,\n onConfirm,\n onCancel,\n loading = false,\n}: Readonly<TypeToConfirmModalProps>) {\n const [input, setInput] = useState('');\n const { copied, copy } = useCopyToClipboard();\n\n const matched = input.trim() === expectedName;\n\n return (\n // `closeLabel` is deliberately not `cancelLabel`: a dialog whose corner\n // close button and body cancel button share a name is announced as two\n // identical buttons. `ModalShell` defaults it to \"Close\" for that reason.\n <ModalShell onClose={onCancel} widthClass=\"w-full max-w-md mx-4\" ariaLabel={title}>\n <div className=\"p-6\">\n <div className=\"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-error-bg)] mb-4 mx-auto\">\n <AlertTriangle className=\"h-5 w-5 text-[var(--color-error-text)]\" aria-hidden=\"true\" />\n </div>\n <h2 className=\"text-base font-semibold text-[var(--color-text-primary)] text-center mb-2\">{title}</h2>\n <p className=\"text-sm text-[var(--color-text-secondary)] text-center mb-4\">{description}</p>\n <div className=\"flex items-center justify-center gap-2 mb-4\">\n <code className=\"px-2.5 py-1.5 rounded-lg bg-[var(--color-surface-base)] border border-[var(--color-border)] text-sm font-mono text-[var(--color-text-primary)] break-all\">\n {expectedName}\n </code>\n <button\n type=\"button\"\n onClick={() => copy(expectedName)}\n title={copyLabel}\n aria-label={copyLabel}\n className=\"px-2.5 py-2 rounded-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n </div>\n <div className=\"space-y-1.5 mb-6\">\n <Label htmlFor=\"danger-confirm-input\">{promptLabel}</Label>\n <Input\n id=\"danger-confirm-input\"\n value={input}\n onChange={(event) => setInput(event.target.value)}\n placeholder={expectedName}\n autoComplete=\"off\"\n autoFocus\n />\n </div>\n <div className=\"flex gap-3\">\n <Button\n variant=\"ghost\"\n className=\"flex-1\"\n onClick={(event) => {\n event.stopPropagation();\n onCancel();\n }}\n >\n {cancelLabel}\n </Button>\n <Button\n variant=\"danger\"\n className=\"flex-1\"\n // Armed only on an exact match. `loading` is forwarded separately\n // so a confirm already in flight cannot be fired a second time.\n disabled={!matched}\n loading={loading}\n onClick={(event) => {\n event.stopPropagation();\n onConfirm();\n }}\n >\n {confirmLabel}\n </Button>\n </div>\n </div>\n </ModalShell>\n );\n}\n\nexport { TypeToConfirmModal };\nexport type { TypeToConfirmModalProps };\n"],
5
+ "mappings": "kDAAA,OAAS,YAAAA,MAAgB,QACzB,OAAS,iBAAAC,EAAe,SAAAC,EAAO,QAAAC,MAAY,eAC3C,OAAS,UAAAC,MAAc,cACvB,OAAS,SAAAC,EAAO,SAAAC,MAAa,aAC7B,OAAS,cAAAC,MAAkB,kBAC3B,OAAS,sBAAAC,MAA0B,0BAyDnC,SAASC,EAAmB,CAC1B,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,EACA,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,QAAAC,EAAU,EAAK,EACmB,CAClC,KAAM,CAACC,EAAOC,CAAQ,EAAIrB,EAAS,EAAE,EAC/B,CAAE,OAAAsB,EAAQ,KAAAC,CAAI,EAAKf,EAAkB,EAErCgB,EAAUJ,EAAM,KAAI,IAAOR,EAEjC,OAIEa,EAAClB,EAAU,CAAC,QAASW,EAAU,WAAW,uBAAuB,UAAWR,EAAK,SAC/EgB,EA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,CAAA,CACL,CAAA,CAAA,CACF,CAAA,CAGZ",
6
+ "names": ["useState", "AlertTriangle", "Check", "Copy", "Button", "Input", "Label", "ModalShell", "useCopyToClipboard", "TypeToConfirmModal", "title", "description", "expectedName", "confirmLabel", "cancelLabel", "copyLabel", "promptLabel", "onConfirm", "onCancel", "loading", "input", "setInput", "copied", "copy", "matched", "_jsx", "_jsxs", "event"]
7
+ }
@@ -20,7 +20,9 @@
20
20
  * caller with a different sign-in route passes its own.
21
21
  */
22
22
  interface UnauthorizedProps {
23
- /** The heading. Required: this is the page's only `h1`. */
23
+ /**
24
+ The heading. Required: this is the page's only `h1`.
25
+ */
24
26
  title: string;
25
27
  /**
26
28
  * Why they are being stopped.
@@ -29,7 +31,9 @@ interface UnauthorizedProps {
29
31
  * A blank line under the heading reads as a rendering bug.
30
32
  */
31
33
  message?: string;
32
- /** The sign-in button's label. Required. */
34
+ /**
35
+ The sign-in button's label. Required.
36
+ */
33
37
  actionLabel: string;
34
38
  /**
35
39
  * What the button does.
@@ -1 +1 @@
1
- {"version":3,"file":"Unauthorized.d.ts","sourceRoot":"","sources":["../src/Unauthorized.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,UAAU,iBAAiB;IACzB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC,iBAAiB,CAAC,+BAsBjG;AAED,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"Unauthorized.d.ts","sourceRoot":"","sources":["../src/Unauthorized.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,UAAU,iBAAiB;IACzB;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;MAEE;IACF,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC,iBAAiB,CAAC,+BAsBjG;AAED,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}